diff options
Diffstat (limited to 'vp8/encoder')
-rw-r--r-- | vp8/encoder/bitstream.c | 41 | ||||
-rw-r--r-- | vp8/encoder/encodeframe.c | 5 | ||||
-rw-r--r-- | vp8/encoder/mbgraph.c | 13 | ||||
-rw-r--r-- | vp8/encoder/onyx_if.c | 15 | ||||
-rw-r--r-- | vp8/encoder/segmentation.c | 2 |
5 files changed, 52 insertions, 24 deletions
diff --git a/vp8/encoder/bitstream.c b/vp8/encoder/bitstream.c index 2aee8249d..26f1cb487 100644 --- a/vp8/encoder/bitstream.c +++ b/vp8/encoder/bitstream.c @@ -843,13 +843,27 @@ static void encode_ref_frame( vp8_writer *const w, MV_REFERENCE_FRAME rf ) { int seg_ref_active; + int seg_ref_count = 0; //#if CONFIG_SEGFEATURES seg_ref_active = segfeature_active( xd, segment_id, SEG_LVL_REF_FRAME ); +#if CONFIG_COMPRED + if ( seg_ref_active ) + { + seg_ref_count = 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 ); + } + // If segment level coding of this signal is disabled... - if ( !seg_ref_active ) + // or the segment allows multiple reference frame options + if ( !seg_ref_active || (seg_ref_count > 1) ) +#else + if ( !seg_ref_active ) +#endif { #if CONFIG_COMPRED // Values used in prediction model coding @@ -869,7 +883,24 @@ static void encode_ref_frame( vp8_writer *const w, // Get the predicted value so that it can be excluded. MV_REFERENCE_FRAME pred_rf = get_pred_ref( cm, xd ); - vp8_prob * mod_refprobs = cm->mod_refprobs[pred_rf]; + //vp8_prob * mod_refprobs = cm->mod_refprobs[pred_rf]; + vp8_prob mod_refprobs[PREDICTION_PROBS]; + + vpx_memcpy( mod_refprobs, + cm->mod_refprobs[pred_rf], sizeof(mod_refprobs) ); + + // If segment coding enabled blank out options that cant occur by + // setting the branch probability to 0. + if ( seg_ref_active ) + { + mod_refprobs[INTRA_FRAME] *= + check_segref( xd, segment_id, INTRA_FRAME ); + mod_refprobs[LAST_FRAME] *= + check_segref( xd, segment_id, LAST_FRAME ); + mod_refprobs[GOLDEN_FRAME] *= + ( check_segref( xd, segment_id, GOLDEN_FRAME ) * + check_segref( xd, segment_id, ALTREF_FRAME ) ); + } if ( mod_refprobs[0] ) { @@ -915,7 +946,12 @@ static void encode_ref_frame( vp8_writer *const w, } #endif } + + // if using the prediction mdoel we have nothing further to do because + // the reference frame is fully coded by the segment + //#if CONFIG_SEGFEATURES +#if !CONFIG_COMPRED // Else use the segment else { @@ -958,6 +994,7 @@ static void encode_ref_frame( vp8_writer *const w, } } } +#endif } #if CONFIG_SUPERBLOCKS diff --git a/vp8/encoder/encodeframe.c b/vp8/encoder/encodeframe.c index a0a024592..30352d719 100644 --- a/vp8/encoder/encodeframe.c +++ b/vp8/encoder/encodeframe.c @@ -1979,11 +1979,8 @@ int vp8cx_encode_inter_macroblock // SET VARIOUS PREDICTION FLAGS // Did the chosen reference frame match its predicted value. - // If the reference frame is predicted at the segment level we - // mark it as correctly predicted ref_pred_flag = ( (xd->mode_info_context->mbmi.ref_frame == - get_pred_ref( cm, xd )) || - seg_ref_active ); + get_pred_ref( cm, xd )) ); set_pred_flag( xd, PRED_REF, ref_pred_flag ); #endif diff --git a/vp8/encoder/mbgraph.c b/vp8/encoder/mbgraph.c index 18c30a417..e0fed4a47 100644 --- a/vp8/encoder/mbgraph.c +++ b/vp8/encoder/mbgraph.c @@ -91,7 +91,8 @@ static unsigned int do_16x16_motion_iteration vp8_set_mbmode_and_mvs(x, NEWMV, dst_mv); vp8_build_inter16x16_predictors_mby(xd); - VARIANCE_INVOKE(&cpi->rtcd.variance, satd16x16) + //VARIANCE_INVOKE(&cpi->rtcd.variance, satd16x16) + best_err = VARIANCE_INVOKE(&cpi->rtcd.variance, sad16x16) (xd->dst.y_buffer, xd->dst.y_stride, xd->predictor, 16, &best_err); @@ -138,7 +139,8 @@ static int do_16x16_motion_search // FIXME should really use something like near/nearest MV and/or MV prediction xd->pre.y_buffer = ref->y_buffer + mb_y_offset; xd->pre.y_stride = ref->y_stride; - VARIANCE_INVOKE(&cpi->rtcd.variance, satd16x16) + //VARIANCE_INVOKE(&cpi->rtcd.variance, satd16x16) + err = VARIANCE_INVOKE(&cpi->rtcd.variance, sad16x16) (ref->y_buffer + mb_y_offset, ref->y_stride, xd->dst.y_buffer, xd->dst.y_stride, &err); @@ -203,10 +205,12 @@ static int do_16x16_zerozero_search // FIXME should really use something like near/nearest MV and/or MV prediction xd->pre.y_buffer = ref->y_buffer + mb_y_offset; xd->pre.y_stride = ref->y_stride; - VARIANCE_INVOKE(&cpi->rtcd.variance, satd16x16) + //VARIANCE_INVOKE(&cpi->rtcd.variance, satd16x16) + err = VARIANCE_INVOKE(&cpi->rtcd.variance, sad16x16) (ref->y_buffer + mb_y_offset, ref->y_stride, xd->dst.y_buffer, xd->dst.y_stride, &err); + dst_mv->as_int = 0; return err; @@ -232,7 +236,8 @@ static int find_best_16x16_intra xd->mode_info_context->mbmi.mode = mode; RECON_INVOKE(&cpi->rtcd.common->recon, build_intra_predictors_mby)(xd); - VARIANCE_INVOKE(&cpi->rtcd.variance, satd16x16) + //VARIANCE_INVOKE(&cpi->rtcd.variance, satd16x16) + err = VARIANCE_INVOKE(&cpi->rtcd.variance, sad16x16) (xd->predictor, 16, buf->y_buffer + mb_y_offset, buf->y_stride, &err); diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c index b3b0790ff..2ea41ab35 100644 --- a/vp8/encoder/onyx_if.c +++ b/vp8/encoder/onyx_if.c @@ -474,7 +474,7 @@ static void init_seg_features(VP8_COMP *cpi) VP8_COMMON *cm = &cpi->common; MACROBLOCKD *xd = &cpi->mb.e_mbd; - int high_q = (int)(cpi->avg_q > 32.0); + int high_q = (int)(cpi->avg_q > 48.0); int qi_delta; // For now at least dont enable seg features alongside cyclic refresh. @@ -575,15 +575,10 @@ static void init_seg_features(VP8_COMP *cpi) set_segdata( xd, 1, SEG_LVL_ALT_LF, -2 ); enable_segfeature(xd, 1, SEG_LVL_ALT_LF); -#if CONFIG_COMPRED // Segment coding disabled for compred testing if ( high_q || (cpi->static_mb_pct == 100) ) - //if ( 0 ) -#else - if ( high_q || (cpi->static_mb_pct == 100) ) - //if ( 0 ) -#endif { + //set_segref(xd, 1, LAST_FRAME); set_segref(xd, 1, ALTREF_FRAME); enable_segfeature(xd, 1, SEG_LVL_REF_FRAME); @@ -618,14 +613,8 @@ static void init_seg_features(VP8_COMP *cpi) // Special case where we are coding over the top of a previous // alt ref frame -#if CONFIG_COMPRED // Segment coding disabled for compred testing else if ( cpi->is_src_frame_alt_ref ) - //else if ( 0 ) -#else - else if ( cpi->is_src_frame_alt_ref ) - //else if ( 0 ) -#endif { // Enable mode and ref frame features for segment 0 as well enable_segfeature(xd, 0, SEG_LVL_REF_FRAME); diff --git a/vp8/encoder/segmentation.c b/vp8/encoder/segmentation.c index 91dffe166..4a1ce649c 100644 --- a/vp8/encoder/segmentation.c +++ b/vp8/encoder/segmentation.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 The WebM project authors. All Rights Reserved. + * Copyright (c) 2012 The WebM project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source |