Moving MVcount to macroblock struct

Change-Id: Ie22841d096f3c86694b95bd06fc3a8ce1f032a10
This commit is contained in:
Scott LaVarnway 2012-11-05 12:41:24 -08:00
Родитель 95390b2b20
Коммит 01824d1848
7 изменённых файлов: 24 добавлений и 13 удалений

Просмотреть файл

@ -129,6 +129,7 @@ typedef struct macroblock
int skip_true_count; int skip_true_count;
unsigned int coef_counts [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS]; unsigned int coef_counts [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
unsigned int MVcount [2] [MVvals]; /* (row,col) MV cts this frame */
int ymode_count [VP8_YMODES]; /* intra MB type cts this frame */ int ymode_count [VP8_YMODES]; /* intra MB type cts this frame */
int uv_mode_count[VP8_UV_MODES]; /* intra MB type cts this frame */ int uv_mode_count[VP8_UV_MODES]; /* intra MB type cts this frame */

Просмотреть файл

@ -762,7 +762,7 @@ void vp8_encode_frame(VP8_COMP *cpi)
xd->mode_info_context = cm->mi; xd->mode_info_context = cm->mi;
vp8_zero(cpi->MVcount); vp8_zero(cpi->mb.MVcount);
vp8cx_frame_init_quantizer(cpi); vp8cx_frame_init_quantizer(cpi);
@ -868,6 +868,7 @@ void vp8_encode_frame(VP8_COMP *cpi)
for (i = 0; i < cpi->encoding_thread_count; i++) for (i = 0; i < cpi->encoding_thread_count; i++)
{ {
int mode_count; int mode_count;
int mv_vals;
totalrate += cpi->mb_row_ei[i].totalrate; totalrate += cpi->mb_row_ei[i].totalrate;
cpi->mb.skip_true_count += cpi->mb_row_ei[i].mb.skip_true_count; cpi->mb.skip_true_count += cpi->mb_row_ei[i].mb.skip_true_count;
@ -880,6 +881,13 @@ void vp8_encode_frame(VP8_COMP *cpi)
cpi->mb.uv_mode_count[mode_count] += cpi->mb.uv_mode_count[mode_count] +=
cpi->mb_row_ei[i].mb.uv_mode_count[mode_count]; cpi->mb_row_ei[i].mb.uv_mode_count[mode_count];
for(mv_vals = 0; mv_vals < MVvals; mv_vals++)
{
cpi->mb.MVcount[0][mv_vals] +=
cpi->mb_row_ei[i].mb.MVcount[0][mv_vals];
cpi->mb.MVcount[1][mv_vals] +=
cpi->mb_row_ei[i].mb.MVcount[1][mv_vals];
}
/* add up counts for each thread */ /* add up counts for each thread */
sum_coef_counts(x, &cpi->mb_row_ei[i].mb); sum_coef_counts(x, &cpi->mb_row_ei[i].mb);

Просмотреть файл

@ -363,10 +363,12 @@ void vp8_write_mvprobs(VP8_COMP *cpi)
active_section = 4; active_section = 4;
#endif #endif
write_component_probs( write_component_probs(
w, &mvc[0], &vp8_default_mv_context[0], &vp8_mv_update_probs[0], cpi->MVcount[0], 0, &flags[0] w, &mvc[0], &vp8_default_mv_context[0], &vp8_mv_update_probs[0],
cpi->mb.MVcount[0], 0, &flags[0]
); );
write_component_probs( write_component_probs(
w, &mvc[1], &vp8_default_mv_context[1], &vp8_mv_update_probs[1], cpi->MVcount[1], 1, &flags[1] w, &mvc[1], &vp8_default_mv_context[1], &vp8_mv_update_probs[1],
cpi->mb.MVcount[1], 1, &flags[1]
); );
if (flags[0] || flags[1]) if (flags[0] || flags[1])

Просмотреть файл

@ -475,6 +475,7 @@ void vp8cx_init_mbrthread_data(VP8_COMP *cpi,
vp8_zero(mb->coef_counts); vp8_zero(mb->coef_counts);
vp8_zero(x->ymode_count); vp8_zero(x->ymode_count);
mb->skip_true_count = 0; mb->skip_true_count = 0;
vp8_zero(mb->MVcount);
} }
} }

Просмотреть файл

@ -452,8 +452,6 @@ typedef struct VP8_COMP
int drop_frames_allowed; /* Are we permitted to drop frames? */ int drop_frames_allowed; /* Are we permitted to drop frames? */
int drop_frame; /* Drop this frame? */ int drop_frame; /* Drop this frame? */
unsigned int MVcount [2] [MVvals]; /* (row,col) MV cts this frame */
vp8_prob frame_coef_probs [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES]; vp8_prob frame_coef_probs [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
char update_probs [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES]; char update_probs [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];

Просмотреть файл

@ -389,15 +389,16 @@ static void pick_intra_mbuv_mode(MACROBLOCK *mb)
} }
static void update_mvcount(VP8_COMP *cpi, MACROBLOCKD *xd, int_mv *best_ref_mv) static void update_mvcount(VP8_COMP *cpi, MACROBLOCK *x, int_mv *best_ref_mv)
{ {
MACROBLOCKD *xd = &x->e_mbd;
/* Split MV modes currently not supported when RD is nopt enabled, /* Split MV modes currently not supported when RD is nopt enabled,
* therefore, only need to modify MVcount in NEWMV mode. */ * therefore, only need to modify MVcount in NEWMV mode. */
if (xd->mode_info_context->mbmi.mode == NEWMV) if (xd->mode_info_context->mbmi.mode == NEWMV)
{ {
cpi->MVcount[0][mv_max+((xd->mode_info_context->mbmi.mv.as_mv.row - x->MVcount[0][mv_max+((xd->mode_info_context->mbmi.mv.as_mv.row -
best_ref_mv->as_mv.row) >> 1)]++; best_ref_mv->as_mv.row) >> 1)]++;
cpi->MVcount[1][mv_max+((xd->mode_info_context->mbmi.mv.as_mv.col - x->MVcount[1][mv_max+((xd->mode_info_context->mbmi.mv.as_mv.col -
best_ref_mv->as_mv.col) >> 1)]++; best_ref_mv->as_mv.col) >> 1)]++;
} }
} }
@ -1240,7 +1241,7 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
!= cpi->common.ref_frame_sign_bias[xd->mode_info_context->mbmi.ref_frame]) != cpi->common.ref_frame_sign_bias[xd->mode_info_context->mbmi.ref_frame])
best_ref_mv.as_int = best_ref_mv_sb[!sign_bias].as_int; best_ref_mv.as_int = best_ref_mv_sb[!sign_bias].as_int;
update_mvcount(cpi, &x->e_mbd, &best_ref_mv); update_mvcount(cpi, x, &best_ref_mv);
} }

Просмотреть файл

@ -1738,18 +1738,18 @@ static void rd_update_mvcount(VP8_COMP *cpi, MACROBLOCK *x, int_mv *best_ref_mv)
{ {
if (x->partition_info->bmi[i].mode == NEW4X4) if (x->partition_info->bmi[i].mode == NEW4X4)
{ {
cpi->MVcount[0][mv_max+((x->partition_info->bmi[i].mv.as_mv.row x->MVcount[0][mv_max+((x->partition_info->bmi[i].mv.as_mv.row
- best_ref_mv->as_mv.row) >> 1)]++; - best_ref_mv->as_mv.row) >> 1)]++;
cpi->MVcount[1][mv_max+((x->partition_info->bmi[i].mv.as_mv.col x->MVcount[1][mv_max+((x->partition_info->bmi[i].mv.as_mv.col
- best_ref_mv->as_mv.col) >> 1)]++; - best_ref_mv->as_mv.col) >> 1)]++;
} }
} }
} }
else if (x->e_mbd.mode_info_context->mbmi.mode == NEWMV) else if (x->e_mbd.mode_info_context->mbmi.mode == NEWMV)
{ {
cpi->MVcount[0][mv_max+((x->e_mbd.mode_info_context->mbmi.mv.as_mv.row x->MVcount[0][mv_max+((x->e_mbd.mode_info_context->mbmi.mv.as_mv.row
- best_ref_mv->as_mv.row) >> 1)]++; - best_ref_mv->as_mv.row) >> 1)]++;
cpi->MVcount[1][mv_max+((x->e_mbd.mode_info_context->mbmi.mv.as_mv.col x->MVcount[1][mv_max+((x->e_mbd.mode_info_context->mbmi.mv.as_mv.col
- best_ref_mv->as_mv.col) >> 1)]++; - best_ref_mv->as_mv.col) >> 1)]++;
} }
} }