diff options
author | Ronald S. Bultje <rbultje@google.com> | 2012-07-16 17:49:37 -0700 |
---|---|---|
committer | Ronald S. Bultje <rbultje@google.com> | 2012-07-16 17:49:59 -0700 |
commit | cb1e60fb28fa7c986b4f7bb993cd7e3569786615 (patch) | |
tree | f99d56644ea6c8b35d12673a2f60d337db1d7a4d | |
parent | da8159a479deea42a01733c0fddd46994a2fc6a9 (diff) | |
download | libvpx-cb1e60fb28fa7c986b4f7bb993cd7e3569786615.tar libvpx-cb1e60fb28fa7c986b4f7bb993cd7e3569786615.tar.gz libvpx-cb1e60fb28fa7c986b4f7bb993cd7e3569786615.tar.bz2 libvpx-cb1e60fb28fa7c986b4f7bb993cd7e3569786615.zip |
Fix bug in reference frame counting.
vp8_encode_inter_macroblock() is called in both pick_mb_modes() as
well as encode_sb(), thus the number of macroblocks in the counter
were twice as big as actual numbers. This doesn't affect output.
Change-Id: I6de8a996ee44d2f7f2080d8d2177dd7bc6207c93
-rw-r--r-- | vp8/encoder/encodeframe.c | 53 |
1 files changed, 29 insertions, 24 deletions
diff --git a/vp8/encoder/encodeframe.c b/vp8/encoder/encodeframe.c index 8b1ed0bb3..be2d1f4e3 100644 --- a/vp8/encoder/encodeframe.c +++ b/vp8/encoder/encodeframe.c @@ -873,6 +873,9 @@ static void encode_sb ( VP8_COMP *cpi, } else { + unsigned char *segment_id; + int seg_ref_active; + vp8cx_encode_inter_macroblock(cpi, x, tp, recon_yoffset, recon_uvoffset, 1); //Note the encoder may have changed the segment_id @@ -892,6 +895,32 @@ static void encode_sb ( VP8_COMP *cpi, #endif + // If we have just a single reference frame coded for a segment then + // exclude from the reference frame counts used to work out + // probabilities. NOTE: At the moment we dont support custom trees + // for the reference frame coding for each segment but this is a + // possible future action. + segment_id = &xd->mode_info_context->mbmi.segment_id; + seg_ref_active = segfeature_active( xd, *segment_id, SEG_LVL_REF_FRAME ); + if ( !seg_ref_active || + ( ( check_segref( xd, *segment_id, INTRA_FRAME ) + + check_segref( xd, *segment_id, LAST_FRAME ) + + check_segref( xd, *segment_id, GOLDEN_FRAME ) + + check_segref( xd, *segment_id, ALTREF_FRAME ) ) > 1 ) ) + { +// TODO this may not be a good idea as it makes sample size small and means +// the predictor functions cannot use data about most likely value only most +// likely unpredicted value. +//#if CONFIG_COMPRED +// // Only update count for incorrectly predicted cases +// if ( !ref_pred_flag ) +//#endif + { + cpi->count_mb_ref_frame_usage + [xd->mode_info_context->mbmi.ref_frame]++; + } + } + // Count of last ref frame 0,0 usage if ((xd->mode_info_context->mbmi.mode == ZEROMV) && (xd->mode_info_context->mbmi.ref_frame == LAST_FRAME)) @@ -1706,30 +1735,6 @@ void vp8cx_encode_inter_macroblock cpi->t4x4_count++; } - // If we have just a single reference frame coded for a segment then - // exclude from the reference frame counts used to work out - // probabilities. NOTE: At the moment we dont support custom trees - // for the reference frame coding for each segment but this is a - // possible future action. - if ( !seg_ref_active || - ( ( check_segref( xd, *segment_id, INTRA_FRAME ) + - check_segref( xd, *segment_id, LAST_FRAME ) + - check_segref( xd, *segment_id, GOLDEN_FRAME ) + - check_segref( xd, *segment_id, ALTREF_FRAME ) ) > 1 ) ) - { -// TODO this may not be a good idea as it makes sample size small and means -// the predictor functions cannot use data about most likely value only most -// likely unpredicted value. -//#if CONFIG_COMPRED -// // Only update count for incorrectly predicted cases -// if ( !ref_pred_flag ) -//#endif - { - cpi->count_mb_ref_frame_usage - [xd->mode_info_context->mbmi.ref_frame]++; - } - } - if (xd->mode_info_context->mbmi.ref_frame == INTRA_FRAME) { if (xd->mode_info_context->mbmi.mode == B_PRED) |