OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 best_error = pred_error[i]; | 382 best_error = pred_error[i]; |
383 best_mode = (MB_PREDICTION_MODE)i; | 383 best_mode = (MB_PREDICTION_MODE)i; |
384 } | 384 } |
385 } | 385 } |
386 | 386 |
387 | 387 |
388 mb->e_mbd.mode_info_context->mbmi.uv_mode = best_mode; | 388 mb->e_mbd.mode_info_context->mbmi.uv_mode = best_mode; |
389 | 389 |
390 } | 390 } |
391 | 391 |
392 static void update_mvcount(VP8_COMP *cpi, MACROBLOCK *x, int_mv *best_ref_mv) | 392 static void update_mvcount(VP8_COMP *cpi, MACROBLOCKD *xd, int_mv *best_ref_mv) |
393 { | 393 { |
394 MACROBLOCKD *xd = &x->e_mbd; | |
395 /* Split MV modes currently not supported when RD is nopt enabled, | 394 /* Split MV modes currently not supported when RD is nopt enabled, |
396 * therefore, only need to modify MVcount in NEWMV mode. */ | 395 * therefore, only need to modify MVcount in NEWMV mode. */ |
397 if (xd->mode_info_context->mbmi.mode == NEWMV) | 396 if (xd->mode_info_context->mbmi.mode == NEWMV) |
398 { | 397 { |
399 x->MVcount[0][mv_max+((xd->mode_info_context->mbmi.mv.as_mv.row - | 398 cpi->MVcount[0][mv_max+((xd->mode_info_context->mbmi.mv.as_mv.row - |
400 best_ref_mv->as_mv.row) >> 1)]++; | 399 best_ref_mv->as_mv.row) >> 1)]++; |
401 x->MVcount[1][mv_max+((xd->mode_info_context->mbmi.mv.as_mv.col - | 400 cpi->MVcount[1][mv_max+((xd->mode_info_context->mbmi.mv.as_mv.col - |
402 best_ref_mv->as_mv.col) >> 1)]++; | 401 best_ref_mv->as_mv.col) >> 1)]++; |
403 } | 402 } |
404 } | 403 } |
405 | 404 |
406 | 405 |
407 #if CONFIG_MULTI_RES_ENCODING | 406 #if CONFIG_MULTI_RES_ENCODING |
408 static | 407 static |
409 void get_lower_res_motion_info(VP8_COMP *cpi, MACROBLOCKD *xd, int *dissim, | 408 void get_lower_res_motion_info(VP8_COMP *cpi, MACROBLOCKD *xd, int *dissim, |
410 int *parent_ref_frame, | 409 int *parent_ref_frame, |
411 MB_PREDICTION_MODE *parent_mode, | 410 MB_PREDICTION_MODE *parent_mode, |
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1234 if (best_mbmode.mode <= B_PRED) | 1233 if (best_mbmode.mode <= B_PRED) |
1235 { | 1234 { |
1236 /* set mode_info_context->mbmi.uv_mode */ | 1235 /* set mode_info_context->mbmi.uv_mode */ |
1237 pick_intra_mbuv_mode(x); | 1236 pick_intra_mbuv_mode(x); |
1238 } | 1237 } |
1239 | 1238 |
1240 if (sign_bias | 1239 if (sign_bias |
1241 != cpi->common.ref_frame_sign_bias[xd->mode_info_context->mbmi.ref_frame]) | 1240 != cpi->common.ref_frame_sign_bias[xd->mode_info_context->mbmi.ref_frame]) |
1242 best_ref_mv.as_int = best_ref_mv_sb[!sign_bias].as_int; | 1241 best_ref_mv.as_int = best_ref_mv_sb[!sign_bias].as_int; |
1243 | 1242 |
1244 update_mvcount(cpi, x, &best_ref_mv); | 1243 update_mvcount(cpi, &x->e_mbd, &best_ref_mv); |
1245 } | 1244 } |
1246 | 1245 |
1247 | 1246 |
1248 void vp8_pick_intra_mode(MACROBLOCK *x, int *rate_) | 1247 void vp8_pick_intra_mode(VP8_COMP *cpi, MACROBLOCK *x, int *rate_) |
1249 { | 1248 { |
1250 int error4x4, error16x16 = INT_MAX; | 1249 int error4x4, error16x16 = INT_MAX; |
1251 int rate, best_rate = 0, distortion, best_sse; | 1250 int rate, best_rate = 0, distortion, best_sse; |
1252 MB_PREDICTION_MODE mode, best_mode = DC_PRED; | 1251 MB_PREDICTION_MODE mode, best_mode = DC_PRED; |
1253 int this_rd; | 1252 int this_rd; |
1254 unsigned int sse; | 1253 unsigned int sse; |
1255 BLOCK *b = &x->block[0]; | 1254 BLOCK *b = &x->block[0]; |
1256 MACROBLOCKD *xd = &x->e_mbd; | 1255 MACROBLOCKD *xd = &x->e_mbd; |
1257 | 1256 |
1258 xd->mode_info_context->mbmi.ref_frame = INTRA_FRAME; | 1257 xd->mode_info_context->mbmi.ref_frame = INTRA_FRAME; |
(...skipping 27 matching lines...) Expand all Loading... |
1286 error4x4 = pick_intra4x4mby_modes(x, &rate, | 1285 error4x4 = pick_intra4x4mby_modes(x, &rate, |
1287 &best_sse); | 1286 &best_sse); |
1288 if (error4x4 < error16x16) | 1287 if (error4x4 < error16x16) |
1289 { | 1288 { |
1290 xd->mode_info_context->mbmi.mode = B_PRED; | 1289 xd->mode_info_context->mbmi.mode = B_PRED; |
1291 best_rate = rate; | 1290 best_rate = rate; |
1292 } | 1291 } |
1293 | 1292 |
1294 *rate_ = best_rate; | 1293 *rate_ = best_rate; |
1295 } | 1294 } |
OLD | NEW |