From: Scott LaVarnway Date: Mon, 5 Nov 2012 20:25:18 +0000 (-0800) Subject: Moving ymode_count, uv_mode_count to macroblock struct X-Git-Tag: v1.2.0~35 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=95390b2b20e1b34883bdc8a985bc5fc94387a97d;p=libvpx Moving ymode_count, uv_mode_count to macroblock struct Change-Id: Ib73c7b2bee4cb2eb2528fa6b381fffe9503079a0 --- diff --git a/vp8/encoder/bitstream.c b/vp8/encoder/bitstream.c index 7ab6dc906..f84ae68f7 100644 --- a/vp8/encoder/bitstream.c +++ b/vp8/encoder/bitstream.c @@ -118,7 +118,7 @@ static void update_mbintra_mode_probs(VP8_COMP *cpi) update_mode( w, VP8_YMODES, vp8_ymode_encodings, vp8_ymode_tree, - Pnew, x->fc.ymode_prob, bct, (unsigned int *)cpi->ymode_count + Pnew, x->fc.ymode_prob, bct, (unsigned int *)cpi->mb.ymode_count ); } { @@ -127,7 +127,7 @@ static void update_mbintra_mode_probs(VP8_COMP *cpi) update_mode( w, VP8_UV_MODES, vp8_uv_mode_encodings, vp8_uv_mode_tree, - Pnew, x->fc.uv_mode_prob, bct, (unsigned int *)cpi->uv_mode_count + Pnew, x->fc.uv_mode_prob, bct, (unsigned int *)cpi->mb.uv_mode_count ); } } diff --git a/vp8/encoder/block.h b/vp8/encoder/block.h index e6228ec64..1e475b83d 100644 --- a/vp8/encoder/block.h +++ b/vp8/encoder/block.h @@ -130,6 +130,10 @@ typedef struct macroblock int skip_true_count; unsigned int coef_counts [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS]; + int ymode_count [VP8_YMODES]; /* intra MB type cts this frame */ + int uv_mode_count[VP8_UV_MODES]; /* intra MB type cts this frame */ + + void (*short_fdct4x4)(short *input, short *output, int pitch); void (*short_fdct8x4)(short *input, short *output, int pitch); diff --git a/vp8/encoder/encodeframe.c b/vp8/encoder/encodeframe.c index d580d89c3..f99bdb3ee 100644 --- a/vp8/encoder/encodeframe.c +++ b/vp8/encoder/encodeframe.c @@ -643,8 +643,6 @@ static void init_encode_frame_mb_context(VP8_COMP *cpi) xd->left_context = &cm->left_context; vp8_zero(cpi->count_mb_ref_frame_usage) - vp8_zero(cpi->ymode_count) - vp8_zero(cpi->uv_mode_count) x->mvc = cm->fc.mvc; @@ -676,6 +674,8 @@ static void init_encode_frame_mb_context(VP8_COMP *cpi) xd->fullpixel_mask = 0xfffffff8; vp8_zero(x->coef_counts); + vp8_zero(x->ymode_count); + vp8_zero(x->uv_mode_count) } static void sum_coef_counts(MACROBLOCK *x, MACROBLOCK *x_thread) @@ -867,10 +867,20 @@ void vp8_encode_frame(VP8_COMP *cpi) for (i = 0; i < cpi->encoding_thread_count; i++) { + int mode_count; totalrate += cpi->mb_row_ei[i].totalrate; cpi->mb.skip_true_count += cpi->mb_row_ei[i].mb.skip_true_count; + for(mode_count = 0; mode_count < VP8_YMODES; mode_count++) + cpi->mb.ymode_count[mode_count] += + cpi->mb_row_ei[i].mb.ymode_count[mode_count]; + + for(mode_count = 0; mode_count < VP8_UV_MODES; mode_count++) + cpi->mb.uv_mode_count[mode_count] += + cpi->mb_row_ei[i].mb.uv_mode_count[mode_count]; + + /* add up counts for each thread */ sum_coef_counts(x, &cpi->mb_row_ei[i].mb); } @@ -1101,8 +1111,8 @@ static void sum_intra_stats(VP8_COMP *cpi, MACROBLOCK *x) #endif - ++cpi->ymode_count[m]; - ++cpi->uv_mode_count[uvm]; + ++x->ymode_count[m]; + ++x->uv_mode_count[uvm]; } diff --git a/vp8/encoder/ethreading.c b/vp8/encoder/ethreading.c index 9b7805e50..1ad6dabf0 100644 --- a/vp8/encoder/ethreading.c +++ b/vp8/encoder/ethreading.c @@ -473,6 +473,7 @@ void vp8cx_init_mbrthread_data(VP8_COMP *cpi, mbd->fullpixel_mask = 0xfffffff8; vp8_zero(mb->coef_counts); + vp8_zero(x->ymode_count); mb->skip_true_count = 0; } } diff --git a/vp8/encoder/onyx_int.h b/vp8/encoder/onyx_int.h index 7cea72508..f38bf8942 100644 --- a/vp8/encoder/onyx_int.h +++ b/vp8/encoder/onyx_int.h @@ -452,9 +452,6 @@ typedef struct VP8_COMP int drop_frames_allowed; /* Are we permitted to drop frames? */ int drop_frame; /* Drop 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 */ - 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]; diff --git a/vp8/encoder/ratectrl.c b/vp8/encoder/ratectrl.c index 1432c143b..77c1c5ad0 100644 --- a/vp8/encoder/ratectrl.c +++ b/vp8/encoder/ratectrl.c @@ -242,8 +242,8 @@ void vp8_save_coding_context(VP8_COMP *cpi) vp8_copy(cc->ymode_prob, cpi->common.fc.ymode_prob); vp8_copy(cc->uv_mode_prob, cpi->common.fc.uv_mode_prob); - vp8_copy(cc->ymode_count, cpi->ymode_count); - vp8_copy(cc->uv_mode_count, cpi->uv_mode_count); + vp8_copy(cc->ymode_count, cpi->mb.ymode_count); + vp8_copy(cc->uv_mode_count, cpi->mb.uv_mode_count); /* Stats */ @@ -280,8 +280,8 @@ void vp8_restore_coding_context(VP8_COMP *cpi) vp8_copy(cpi->common.fc.ymode_prob, cc->ymode_prob); vp8_copy(cpi->common.fc.uv_mode_prob, cc->uv_mode_prob); - vp8_copy(cpi->ymode_count, cc->ymode_count); - vp8_copy(cpi->uv_mode_count, cc->uv_mode_count); + vp8_copy(cpi->mb.ymode_count, cc->ymode_count); + vp8_copy(cpi->mb.uv_mode_count, cc->uv_mode_count); /* Stats */ #ifdef MODE_STATS