]> granicus.if.org Git - libvpx/commitdiff
Merge COMPRED
authorPaul Wilkins <paulwilkins@google.com>
Thu, 9 Feb 2012 16:10:46 +0000 (16:10 +0000)
committerPaul Wilkins <paulwilkins@google.com>
Thu, 9 Feb 2012 16:10:46 +0000 (16:10 +0000)
Merged in most of the current common prediction changes
that were under the #if CONFIG_COMPRED option.

Change-Id: If4e6f61dbe7b86dd449f6effbe93b5eb7e893885

vp8/common/blockd.h
vp8/common/onyxc_int.h
vp8/common/pred_common.c
vp8/common/pred_common.h
vp8/decoder/decodemv.c
vp8/decoder/decodframe.c
vp8/encoder/bitstream.c
vp8/encoder/encodeframe.c
vp8/encoder/onyx_if.c
vp8/encoder/pickinter.c
vp8/encoder/rdopt.c

index cf996af1fbfe6ce6fe4fe316d64988910516af28..15b5da29f097bc9da1b9b8d548a4a05a22c6ffa1 100644 (file)
@@ -193,10 +193,7 @@ typedef struct
 
     // Flags used for prediction status of various bistream signals
     unsigned char seg_id_predicted;
-
-#if CONFIG_COMPRED
     unsigned char ref_predicted;
-#endif
 
     // Indicates if the mb is part of the image (1) vs border (0)
     // This can be useful in determining whether the MB provides
index d6f5b13152d2c82488ebce85f22f2bbf3b7b30e8..c424b2a4db4a1f2154f0097561737cd81cb5fe6d 100644 (file)
@@ -49,11 +49,7 @@ void vp8_initialize_common(void);
 #define MAX_PARTITIONS 9
 
 #if CONFIG_DUALPRED
-#if CONFIG_COMPRED
 #define DUAL_PRED_CONTEXTS   2
-#else
-#define DUAL_PRED_CONTEXTS   3
-#endif
 #endif /* CONFIG_DUALPRED */
 
 typedef struct frame_contexts
@@ -242,12 +238,10 @@ typedef struct VP8Common
     vp8_prob segment_pred_probs[PREDICTION_PROBS];
     unsigned char temporal_update;
 
-#if CONFIG_COMPRED
     // Context probabilities for reference frame prediction
     unsigned char ref_scores[MAX_REF_FRAMES];
     vp8_prob ref_pred_probs[PREDICTION_PROBS];
     vp8_prob mod_refprobs[MAX_REF_FRAMES][PREDICTION_PROBS];
-#endif
 
 #if CONFIG_DUALPRED
     vp8_prob prob_dualpred[DUAL_PRED_CONTEXTS];
index 6d82568127ec7ccc814b65ac06970e00691436ad..c7d303c5df31e7eb5c1dc2c4f50dcee971653fe7 100644 (file)
@@ -32,7 +32,6 @@ unsigned char get_pred_context( VP8_COMMON *const cm,
         break;
 
 
-#if CONFIG_COMPRED
     case PRED_REF:
         pred_context = (m - 1)->mbmi.ref_predicted +
                        (m - cm->mode_info_stride)->mbmi.ref_predicted;
@@ -58,7 +57,6 @@ unsigned char get_pred_context( VP8_COMMON *const cm,
             pred_context = 1;
 
         break;
-#endif
 
     default:
         // TODO *** add error trap code.
@@ -87,7 +85,6 @@ vp8_prob get_pred_prob( VP8_COMMON *const cm,
         pred_probability = cm->segment_pred_probs[pred_context];
         break;
 
-#if CONFIG_COMPRED
     case PRED_REF:
         pred_probability = cm->ref_pred_probs[pred_context];
         break;
@@ -98,7 +95,6 @@ vp8_prob get_pred_prob( VP8_COMMON *const cm,
         // probability of dual pred off.
         pred_probability = cm->prob_dualpred[pred_context];
         break;
-#endif
 
     default:
         // TODO *** add error trap code.
@@ -122,12 +118,9 @@ unsigned char get_pred_flag( MACROBLOCKD *const xd,
         pred_flag = xd->mode_info_context->mbmi.seg_id_predicted;
         break;
 
-#if CONFIG_COMPRED
-
     case PRED_REF:
         pred_flag = xd->mode_info_context->mbmi.ref_predicted;
         break;
-#endif
 
     default:
         // TODO *** add error trap code.
@@ -150,12 +143,9 @@ void set_pred_flag( MACROBLOCKD *const xd,
         xd->mode_info_context->mbmi.seg_id_predicted = pred_flag;
         break;
 
-#if CONFIG_COMPRED
-
     case PRED_REF:
         xd->mode_info_context->mbmi.ref_predicted = pred_flag;
         break;
-#endif
 
     default:
         // TODO *** add error trap code.
@@ -175,7 +165,6 @@ unsigned char get_pred_mb_segid( VP8_COMMON *const cm, int MbIndex )
     return cm->last_frame_seg_map[MbIndex];
 }
 
-#if CONFIG_COMPRED
 MV_REFERENCE_FRAME get_pred_ref( VP8_COMMON *const cm,
                                  MACROBLOCKD *const xd )
 {
@@ -348,4 +337,3 @@ void compute_mod_refprobs( VP8_COMMON *const cm )
     cm->ref_scores[GOLDEN_FRAME] = 1 + (gf_count * 16 / 255);
     cm->ref_scores[ALTREF_FRAME] = 1 + (arf_count * 16 / 255);
 }
-#endif
index 94a9ffe2dcaf76ba6baf149fcea1196da78fa803..2548dc9a618aa76eb8718b0c5ab9cfe11d5ba220 100644 (file)
 typedef enum
 {
     PRED_SEG_ID = 0,               // Segment identifier
-
-#if CONFIG_COMPRED
     PRED_REF = 1,
     PRED_DUAL = 2
-#endif
 
 } PRED_ID;
 
@@ -47,11 +44,8 @@ extern void set_pred_flag( MACROBLOCKD *const xd,
 
 extern unsigned char get_pred_mb_segid( VP8_COMMON *const cm, int MbIndex );
 
-#if CONFIG_COMPRED
 extern MV_REFERENCE_FRAME get_pred_ref( VP8_COMMON *const cm,
                                         MACROBLOCKD *const xd );
 extern void compute_mod_refprobs( VP8_COMMON *const cm );
 
-#endif
-
 #endif /* __INC_PRED_COMMON_H__ */
index 23d22c09a63f514aad8105c50509159f36cedbeb..305268db9bbddc22f7cbe518d1b7abb03c59fa75 100644 (file)
@@ -246,9 +246,6 @@ static MV_REFERENCE_FRAME read_ref_frame( VP8D_COMP *pbi,
                                         segment_id,
                                         SEG_LVL_REF_FRAME );
 
-
-#if CONFIG_COMPRED
-
     // If segment coding enabled does the segment allow for more than one
     // possible reference frame
     if ( seg_ref_active )
@@ -262,11 +259,7 @@ static MV_REFERENCE_FRAME read_ref_frame( VP8D_COMP *pbi,
     // Segment reference frame features not available or allows for
     // 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
         unsigned char prediction_flag;
         vp8_prob pred_prob;
@@ -350,102 +343,17 @@ static MV_REFERENCE_FRAME read_ref_frame( VP8D_COMP *pbi,
                 }
             }
         }
-#else
-        ref_frame =
-            (MV_REFERENCE_FRAME) vp8_read(bc, cm->prob_intra_coded);
-
-        if (ref_frame)
-        {
-            if (vp8_read(bc, cm->prob_last_coded))
-            {
-                ref_frame = (MV_REFERENCE_FRAME)((int)ref_frame +
-                            (int)(1 + vp8_read(bc, cm->prob_gf_coded)));
-            }
-        }
-#endif
     }
 
 //#if CONFIG_SEGFEATURES
     // Segment reference frame features are enabled
     else
     {
-#if CONFIG_COMPRED
         // The reference frame for the mb is considered as correclty predicted
         // if it is signaled at the segment level for the purposes of the
         // common prediction model
         set_pred_flag( xd, PRED_REF, 1 );
         ref_frame = get_pred_ref( cm, xd );
-#else
-        // If there are no inter reference frames enabled we can set INTRA
-        if ( !check_segref_inter(xd, segment_id) )
-        {
-            ref_frame = INTRA_FRAME;
-        }
-        else
-        {
-            // Else if there are both intra and inter options we need to read
-            // the inter / intra flag, else mark as inter.
-            if ( check_segref( xd, segment_id, INTRA_FRAME ) )
-                ref_frame =
-                    (MV_REFERENCE_FRAME) vp8_read(bc, cm->prob_intra_coded);
-            else
-                ref_frame = LAST_FRAME;
-
-            if ( ref_frame == LAST_FRAME )
-            {
-                // Now consider last vs (golden or alt) flag....
-                // If Last is not enabled
-                if ( !check_segref( xd, segment_id, LAST_FRAME ) )
-                {
-                    // If not golden then it must be altref
-                    if (!check_segref( xd, segment_id, GOLDEN_FRAME ))
-                    {
-                        ref_frame = ALTREF_FRAME;
-                    }
-                    // Not Altref therefore must be Golden
-                    else if (!check_segref( xd, segment_id,
-                                               ALTREF_FRAME ))
-                    {
-                        ref_frame = GOLDEN_FRAME;
-                    }
-                    // Else we must read bit to decide.
-                    else
-                    {
-                        ref_frame =
-                            (MV_REFERENCE_FRAME)((int)ref_frame +
-                            (int)(1 + vp8_read(bc, cm->prob_gf_coded)));
-                    }
-                }
-                // Both last and at least one of alt or golden are enabled
-                else if ( check_segref( xd, segment_id, GOLDEN_FRAME ) ||
-                          check_segref( xd, segment_id, ALTREF_FRAME ) )
-                {
-                    // Read flag to indicate (golden or altref) vs last
-                    if (vp8_read(bc, cm->prob_last_coded))
-                    {
-                        // If not golden then it must be altref
-                        if (!check_segref( xd, segment_id, GOLDEN_FRAME ))
-                        {
-                            ref_frame = ALTREF_FRAME;
-                        }
-                        // Not Altref therefore must be Golden
-                        else if (!check_segref( xd, segment_id,
-                                                   ALTREF_FRAME ))
-                        {
-                            ref_frame = GOLDEN_FRAME;
-                        }
-                        else
-                        {
-                            ref_frame =
-                                (MV_REFERENCE_FRAME)((int)ref_frame +
-                                (int)(1 + vp8_read(bc, cm->prob_gf_coded)));
-                        }
-                    }
-                    // ELSE LAST
-                }
-            }
-        }
-#endif
     }
 
     return (MV_REFERENCE_FRAME)ref_frame;
@@ -509,11 +417,9 @@ static void mb_mode_mv_init(VP8D_COMP *pbi)
         cm->prob_last_coded  = (vp8_prob)vp8_read_literal(bc, 8);
         cm->prob_gf_coded    = (vp8_prob)vp8_read_literal(bc, 8);
 
-#if CONFIG_COMPRED
         // Computes a modified set of probabilities for use when reference
         // frame prediction fails.
         compute_mod_refprobs( cm );
-#endif
 
 #if CONFIG_DUALPRED
         pbi->common.dual_pred_mode = vp8_read(bc, 128);
@@ -837,12 +743,7 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
 #if CONFIG_DUALPRED
             if ( cm->dual_pred_mode == DUAL_PREDICTION_ONLY ||
                  (cm->dual_pred_mode == HYBRID_PREDICTION &&
-#if CONFIG_COMPRED
                      vp8_read(bc, get_pred_prob( cm, xd, PRED_DUAL ))) )
-#else
-                     vp8_read(bc, cm->prob_dualpred[(mi[-1].mbmi.second_ref_frame != INTRA_FRAME) +
-                                                    (mi[-mis].mbmi.second_ref_frame != INTRA_FRAME)])))
-#endif
             {
                 mbmi->second_ref_frame = mbmi->ref_frame + 1;
                 if (mbmi->second_ref_frame == 4)
index f068f93fd4b79c93da96c526373bcac632057671..566af19f48d5120b96a58926ebc61f642d16fa13 100644 (file)
@@ -1239,7 +1239,6 @@ int vp8_decode_frame(VP8D_COMP *pbi)
         }
     }
 
-#if CONFIG_COMPRED
     // Read common prediction model status flag probability updates for the
     // reference frame
     if ( pc->frame_type == KEY_FRAME )
@@ -1257,7 +1256,6 @@ int vp8_decode_frame(VP8D_COMP *pbi)
                 pc->ref_pred_probs[i] = (vp8_prob)vp8_read_literal(bc, 8);
         }
     }
-#endif
 
     /* Read the loop filter level and type */
     pc->filter_type = (LOOPFILTERTYPE) vp8_read_bit(bc);
index dd8d3d7a6aef3d4d6a004ca979444d509555f035..9e0211d7f3477adfc45434e84afe97a3ecef21ed 100644 (file)
@@ -849,7 +849,6 @@ static void encode_ref_frame( vp8_writer *const w,
                                         segment_id,
                                         SEG_LVL_REF_FRAME );
 
-#if CONFIG_COMPRED
     if ( seg_ref_active )
     {
         seg_ref_count = check_segref( xd, segment_id, INTRA_FRAME ) +
@@ -861,11 +860,7 @@ static void encode_ref_frame( vp8_writer *const w,
     // If segment level coding of this signal is disabled...
     // 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
         unsigned char prediction_flag;
         vp8_prob pred_prob;
@@ -927,77 +922,10 @@ static void encode_ref_frame( vp8_writer *const w,
                 }
             }
         }
-#else
-        if (rf == INTRA_FRAME)
-        {
-            vp8_write(w, 0, cm->prob_intra_coded);
-        }
-        else    /* inter coded */
-        {
-            vp8_write(w, 1, cm->prob_intra_coded);
-
-            if (rf == LAST_FRAME)
-            {
-                vp8_write(w, 0, cm->prob_last_coded);
-            }
-            else
-            {
-                vp8_write(w, 1, cm->prob_last_coded);
-
-                vp8_write(w, (rf == GOLDEN_FRAME) ? 0 : 1, cm->prob_gf_coded);
-            }
-        }
-#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
-    {
-        if (rf == INTRA_FRAME)
-        {
-            // This MB intra coded. If inter also allowed we must code
-            // an explicit inter/intra flag.
-            if ( check_segref_inter( xd, segment_id ) )
-                vp8_write(w, 0, cm->prob_intra_coded);
-        }
-        else    /* inter coded */
-        {
-            // If intra also allowed we must code an explicit intra/inter flag.
-            if ( check_segref( xd, segment_id, INTRA_FRAME ) )
-                vp8_write(w, 1, cm->prob_intra_coded);
-
-            if (rf == LAST_FRAME)
-            {
-                // If GOLDEN or ALTREF allowed we must code explicit flag.
-                if ( check_segref( xd, segment_id, GOLDEN_FRAME ) ||
-                     check_segref( xd, segment_id, ALTREF_FRAME ) )
-                {
-                    vp8_write(w, 0, cm->prob_last_coded);
-                }
-            }
-            else
-            {
-                // if LAST is allowed we must code  explicit flag
-                if ( check_segref( xd, segment_id, LAST_FRAME ) )
-                {
-                    vp8_write(w, 1, cm->prob_last_coded);
-                }
-
-                // if GOLDEN and ALTREF allowed we must code an explicit flag
-                if ( check_segref( xd, segment_id, GOLDEN_FRAME ) &&
-                     check_segref( xd, segment_id, ALTREF_FRAME ) )
-                {
-                    vp8_write(w, (rf == GOLDEN_FRAME) ? 0 : 1, cm->prob_gf_coded);
-                }
-            }
-        }
-    }
-#endif
 }
 
 // Update the probabilities used to encode reference frame data
@@ -1029,11 +957,9 @@ static void update_ref_probs( VP8_COMP *const cpi )
     if (!cm->prob_gf_coded)
        cm->prob_gf_coded = 1;
 
-#if CONFIG_COMPRED
     // Compute a modified set of probabilities to use when prediction of the
     // reference frame fails
     compute_mod_refprobs( cm );
-#endif
 }
 
 #if CONFIG_SUPERBLOCKS
@@ -1058,12 +984,6 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi)
 
     int prob_skip_false = 0;
 
-#if CONFIG_DUALPRED
-#if !CONFIG_COMPRED
-    int prob_dual_pred[DUAL_PRED_CONTEXTS];
-#endif
-#endif /* CONFIG_DUALPRED */
-
     // Values used in prediction model coding
     vp8_prob pred_prob;
     unsigned char prediction_flag;
@@ -1114,7 +1034,6 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi)
         {
             if (cpi->single_pred_count[i] + cpi->dual_pred_count[i])
             {
-#if CONFIG_COMPRED
                 pc->prob_dualpred[i] = cpi->single_pred_count[i] * 255 /
                     (cpi->single_pred_count[i] + cpi->dual_pred_count[i]);
                 if (pc->prob_dualpred[i] < 1)
@@ -1125,20 +1044,6 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi)
                 pc->prob_dualpred[i] = 128;
             }
             vp8_write_literal(w, pc->prob_dualpred[i], 8);
-#else
-                prob_dual_pred[i] = cpi->single_pred_count[i] * 256 /
-                    (cpi->single_pred_count[i] + cpi->dual_pred_count[i]);
-                if (prob_dual_pred[i] < 1)
-                    prob_dual_pred[i] = 1;
-                else if (prob_dual_pred[i] > 255)
-                    prob_dual_pred[i] = 255;
-            }
-            else
-            {
-                prob_dual_pred[i] = 128;
-            }
-            vp8_write_literal(w, prob_dual_pred[i], 8);
-#endif
         }
     }
     else if (cpi->common.dual_pred_mode == SINGLE_PREDICTION_ONLY)
@@ -1324,17 +1229,9 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi)
 #if CONFIG_DUALPRED
                             if (cpi->common.dual_pred_mode == HYBRID_PREDICTION)
                             {
-#if CONFIG_COMPRED
                                 vp8_write(w,
                                           mi->second_ref_frame != INTRA_FRAME,
                                           get_pred_prob( pc, xd, PRED_DUAL ) );
-#else
-
-                                int t = m[-mis].mbmi.second_ref_frame != INTRA_FRAME;
-                                int l = m[-1  ].mbmi.second_ref_frame != INTRA_FRAME;
-                                vp8_write(w, mi->second_ref_frame != INTRA_FRAME,
-                                          prob_dual_pred[t + l]);
-#endif
                             }
                             if (mi->second_ref_frame)
                             {
@@ -1400,17 +1297,9 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi)
 #if CONFIG_DUALPRED
                             if (cpi->common.dual_pred_mode == HYBRID_PREDICTION)
                             {
-#if CONFIG_COMPRED
-
                                 vp8_write(w,
                                           mi->second_ref_frame != INTRA_FRAME,
                                           get_pred_prob( pc, xd, PRED_DUAL ) );
-#else
-                                int t = m[-mis].mbmi.second_ref_frame != INTRA_FRAME;
-                                int l = m[-1  ].mbmi.second_ref_frame != INTRA_FRAME;
-                                vp8_write(w, mi->second_ref_frame != INTRA_FRAME,
-                                          prob_dual_pred[t + l]);
-#endif
                             }
 #endif /* CONFIG_DUALPRED */
                             break;
@@ -1434,17 +1323,6 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi)
         m += mis + (1- (pc->mb_cols & 0x1));
         cpi->mb.partition_info += mis + (1- (pc->mb_cols & 0x1));
     }
-
-#if !CONFIG_COMPRED
-#if CONFIG_DUALPRED
-    if (cpi->common.dual_pred_mode == HYBRID_PREDICTION)
-    {
-        pc->prob_dualpred[0] = (prob_dual_pred[0] + pc->prob_dualpred[0] + 1) >> 1;
-        pc->prob_dualpred[1] = (prob_dual_pred[1] + pc->prob_dualpred[1] + 1) >> 1;
-        pc->prob_dualpred[2] = (prob_dual_pred[2] + pc->prob_dualpred[2] + 1) >> 1;
-    }
-#endif /* CONFIG_DUALPRED */
-#endif
 }
 #else
 static void pack_inter_mode_mvs(VP8_COMP *const cpi)
@@ -1468,12 +1346,6 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi)
 
     int prob_skip_false = 0;
 
-#if CONFIG_DUALPRED
-#if !CONFIG_COMPRED
-    int prob_dual_pred[DUAL_PRED_CONTEXTS];
-#endif
-#endif /* CONFIG_DUALPRED */
-
     // Values used in prediction model coding
     vp8_prob pred_prob;
     unsigned char prediction_flag;
@@ -1521,7 +1393,6 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi)
         {
             if (cpi->single_pred_count[i] + cpi->dual_pred_count[i])
             {
-#if CONFIG_COMPRED
                 pc->prob_dualpred[i] = cpi->single_pred_count[i] * 255 /
                     (cpi->single_pred_count[i] + cpi->dual_pred_count[i]);
                 if (pc->prob_dualpred[i] < 1)
@@ -1532,20 +1403,6 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi)
                 pc->prob_dualpred[i] = 128;
             }
             vp8_write_literal(w, pc->prob_dualpred[i], 8);
-#else
-                prob_dual_pred[i] = cpi->single_pred_count[i] * 256 /
-                    (cpi->single_pred_count[i] + cpi->dual_pred_count[i]);
-                if (prob_dual_pred[i] < 1)
-                    prob_dual_pred[i] = 1;
-                else if (prob_dual_pred[i] > 255)
-                    prob_dual_pred[i] = 255;
-            }
-            else
-            {
-                prob_dual_pred[i] = 128;
-            }
-            vp8_write_literal(w, prob_dual_pred[i], 8);
-#endif
         }
     }
     else if (cpi->common.dual_pred_mode == SINGLE_PREDICTION_ONLY)
@@ -1711,16 +1568,8 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi)
 #if CONFIG_DUALPRED
                         if (cpi->common.dual_pred_mode == HYBRID_PREDICTION)
                         {
-#if CONFIG_COMPRED
-
                             vp8_write(w, mi->second_ref_frame != INTRA_FRAME,
                                       get_pred_prob( pc, xd, PRED_DUAL ) );
-#else
-                            int t = m[-mis].mbmi.second_ref_frame != INTRA_FRAME;
-                            int l = m[-1  ].mbmi.second_ref_frame != INTRA_FRAME;
-                            vp8_write(w, mi->second_ref_frame != INTRA_FRAME,
-                                      prob_dual_pred[t + l]);
-#endif
                         }
                         if (mi->second_ref_frame)
                         {
@@ -1785,16 +1634,8 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi)
 #if CONFIG_DUALPRED
                         if (cpi->common.dual_pred_mode == HYBRID_PREDICTION)
                         {
-#if CONFIG_COMPRED
-
                             vp8_write(w, mi->second_ref_frame != INTRA_FRAME,
                                       get_pred_prob( pc, xd, PRED_DUAL ) );
-#else
-                            int t = m[-mis].mbmi.second_ref_frame != INTRA_FRAME;
-                            int l = m[-1  ].mbmi.second_ref_frame != INTRA_FRAME;
-                            vp8_write(w, mi->second_ref_frame != INTRA_FRAME,
-                                      prob_dual_pred[t + l]);
-#endif
                         }
 #endif /* CONFIG_DUALPRED */
                         break;
@@ -1813,17 +1654,6 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi)
         ++prev_m;
         cpi->mb.partition_info++;
     }
-
-#if !CONFIG_COMPRED
-#if CONFIG_DUALPRED
-    if (cpi->common.dual_pred_mode == HYBRID_PREDICTION)
-    {
-        pc->prob_dualpred[0] = (prob_dual_pred[0] + pc->prob_dualpred[0] + 1) >> 1;
-        pc->prob_dualpred[1] = (prob_dual_pred[1] + pc->prob_dualpred[1] + 1) >> 1;
-        pc->prob_dualpred[2] = (prob_dual_pred[2] + pc->prob_dualpred[2] + 1) >> 1;
-    }
-#endif /* CONFIG_DUALPRED */
-#endif
 }
 #endif // CONFIG_SUPERBLOCKS
 
@@ -2258,9 +2088,6 @@ static int default_coef_context_savings(VP8_COMP *cpi)
     return savings;
 }
 
-#if CONFIG_COMPRED
-// TODO... this will all need changing for new reference frame coding model
-#endif
 int vp8_estimate_entropy_savings(VP8_COMP *cpi)
 {
     int savings = 0;
@@ -2851,7 +2678,6 @@ void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest, unsigned long *size)
         }
     }
 
-#if CONFIG_COMPRED
     // Encode the common prediction model status flag probability updates for
     // the reference frame
     if ( pc->frame_type != KEY_FRAME )
@@ -2867,7 +2693,6 @@ void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest, unsigned long *size)
                 vp8_write_bit(bc, 0);
         }
     }
-#endif
 
     // Encode the loop filter level and type
     vp8_write_bit(bc, pc->filter_type);
index c79ce67dfa6334c72bd77313fa796650b178116e..1600456ece40b6e027371526bce061e5329ef412 100644 (file)
@@ -1181,12 +1181,10 @@ static void encode_frame_internal(VP8_COMP *cpi)
     TOKENEXTRA *tp = cpi->tok;
     int totalrate;
 
-#if CONFIG_COMPRED
     // Compute a modified set of reference frame probabilities to use when
     // prediction fails. These are based on the current genreal estimates for
     // this frame which may be updated with each itteration of the recode loop.
     compute_mod_refprobs( cm );
-#endif
 
 //#if CONFIG_SEGFEATURES
 // debug output
@@ -1785,9 +1783,7 @@ int vp8cx_encode_inter_macroblock
     int distortion;
     unsigned char *segment_id = &xd->mode_info_context->mbmi.segment_id;
     int seg_ref_active;
-#if CONFIG_COMPRED
      unsigned char ref_pred_flag;
-#endif
 
     x->skip = 0;
 
@@ -1824,15 +1820,8 @@ int vp8cx_encode_inter_macroblock
         {
             unsigned char pred_context;
 
-#if CONFIG_COMPRED
             pred_context = get_pred_context( cm, xd, PRED_DUAL );
-#else
-            MB_MODE_INFO *t = &x->e_mbd.mode_info_context
-                              [-cpi->common.mode_info_stride].mbmi;
-            MB_MODE_INFO *l = &x->e_mbd.mode_info_context[-1].mbmi;
-            pred_context = (t->second_ref_frame != INTRA_FRAME) +
-                           (l->second_ref_frame != INTRA_FRAME);
-#endif
+
             if (xd->mode_info_context->mbmi.second_ref_frame == INTRA_FRAME)
                 cpi->single_pred_count[pred_context]++;
             else
@@ -1941,7 +1930,6 @@ int vp8cx_encode_inter_macroblock
 //#if CONFIG_SEGFEATURES
     seg_ref_active = segfeature_active( xd, *segment_id, SEG_LVL_REF_FRAME );
 
-#if CONFIG_COMPRED
     // SET VARIOUS PREDICTION FLAGS
 
     // Did the chosen reference frame match its predicted value.
@@ -1949,8 +1937,6 @@ int vp8cx_encode_inter_macroblock
                            get_pred_ref( cm, xd )) );
     set_pred_flag( xd, PRED_REF, ref_pred_flag );
 
-#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
index a4b730442a5f0478acbd3a35248253dbfbd63314..d8867d2ae16bdf1a457fc84cc85da2b4e940f59a 100644 (file)
@@ -3415,124 +3415,6 @@ static void update_golden_frame_stats(VP8_COMP *cpi)
     }
 }
 
-#if !CONFIG_COMPRED
-//#if 1
-// This function updates the reference frame probability estimates that
-// will be used during mode selection
-static void update_rd_ref_frame_probs(VP8_COMP *cpi)
-{
-    VP8_COMMON *cm = &cpi->common;
-
-#if 0
-    const int *const rfct = cpi->recent_ref_frame_usage;
-    const int rf_intra = rfct[INTRA_FRAME];
-    const int rf_inter = rfct[LAST_FRAME] + rfct[GOLDEN_FRAME] + rfct[ALTREF_FRAME];
-
-    if (cm->frame_type == KEY_FRAME)
-    {
-        cm->prob_intra_coded = 255;
-        cm->prob_last_coded  = 128;
-        cm->prob_gf_coded  = 128;
-    }
-    else if (!(rf_intra + rf_inter))
-    {
-        // This is a trap in case this function is called with cpi->recent_ref_frame_usage[] blank.
-        cm->prob_intra_coded = 63;
-        cm->prob_last_coded  = 128;
-        cm->prob_gf_coded    = 128;
-    }
-    else
-    {
-        cm->prob_intra_coded = (rf_intra * 255) / (rf_intra + rf_inter);
-
-        if (cm->prob_intra_coded < 1)
-            cm->prob_intra_coded = 1;
-
-        if ((cm->frames_since_golden > 0) || cpi->source_alt_ref_active)
-        {
-            cm->prob_last_coded = rf_inter ? (rfct[LAST_FRAME] * 255) / rf_inter : 128;
-
-            if (cm->prob_last_coded < 1)
-                cm->prob_last_coded = 1;
-
-            cm->prob_gf_coded = (rfct[GOLDEN_FRAME] + rfct[ALTREF_FRAME])
-                                 ? (rfct[GOLDEN_FRAME] * 255) / (rfct[GOLDEN_FRAME] + rfct[ALTREF_FRAME]) : 128;
-
-            if (cm->prob_gf_coded < 1)
-                cm->prob_gf_coded = 1;
-        }
-    }
-
-#else
-    const int *const rfct = cpi->count_mb_ref_frame_usage;
-    const int rf_intra = rfct[INTRA_FRAME];
-    const int rf_inter = rfct[LAST_FRAME] + rfct[GOLDEN_FRAME] + rfct[ALTREF_FRAME];
-
-    if (cm->frame_type == KEY_FRAME)
-    {
-        cm->prob_intra_coded = 255;
-        cm->prob_last_coded  = 128;
-        cm->prob_gf_coded  = 128;
-    }
-    else if (!(rf_intra + rf_inter))
-    {
-        // This is a trap in case this function is called with
-        // cpi->recent_ref_frame_usage[] blank.
-        cm->prob_intra_coded = 63;
-        cm->prob_last_coded  = 128;
-        cm->prob_gf_coded    = 128;
-    }
-    else
-    {
-        cm->prob_intra_coded = (rf_intra * 255) / (rf_intra + rf_inter);
-
-        if (cm->prob_intra_coded < 1)
-            cm->prob_intra_coded = 1;
-
-        cm->prob_last_coded =
-            rf_inter ? (rfct[LAST_FRAME] * 255) / rf_inter : 128;
-
-        if (cm->prob_last_coded < 1)
-            cm->prob_last_coded = 1;
-
-        cm->prob_gf_coded =
-            (rfct[GOLDEN_FRAME] + rfct[ALTREF_FRAME])
-                ? (rfct[GOLDEN_FRAME] * 255) /
-                  (rfct[GOLDEN_FRAME] + rfct[ALTREF_FRAME]) : 128;
-
-        if (cm->prob_gf_coded < 1)
-            cm->prob_gf_coded = 1;
-    }
-
-    // update reference frame costs since we can do better than what we got
-    // last frame.
-
-    if (cpi->common.refresh_alt_ref_frame)
-    {
-        cm->prob_intra_coded += 40;
-        cm->prob_last_coded = 200;
-        cm->prob_gf_coded = 1;
-    }
-    else if (cpi->common.frames_since_golden == 0)
-    {
-        cm->prob_last_coded = 214;
-        cm->prob_gf_coded = 1;
-    }
-    else if (cpi->common.frames_since_golden == 1)
-    {
-        cm->prob_last_coded = 192;
-        cm->prob_gf_coded = 220;
-    }
-    else if (cpi->source_alt_ref_active)
-    {
-        cm->prob_gf_coded =
-            ( cm->prob_gf_coded > 30 ) ? cm->prob_gf_coded - 20 : 10;
-    }
-
-#endif
-}
-#endif
-
 // 1 = key, 0 = inter
 static int decide_key_frame(VP8_COMP *cpi)
 {
@@ -3871,7 +3753,6 @@ void loopfilter_frame(VP8_COMP *cpi, VP8_COMMON *cm)
 
 }
 
-#if CONFIG_COMPRED
 // This function updates the reference frame prediction stats
 static void update_refpred_stats( VP8_COMP *cpi )
 {
@@ -3927,33 +3808,6 @@ static void update_refpred_stats( VP8_COMP *cpi )
             xd->mode_info_context++;
         }
 
-        // TEMP / Print out prediction quality numbers
-        if (0)
-        {
-            FILE *f = fopen("predquality.stt", "a");
-            int pred0, pred1, pred2;
-
-
-            pred0 = ref_pred_count[0][0] + ref_pred_count[0][1];
-            if ( pred0 )
-                pred0 = (ref_pred_count[0][1] * 255) / pred0;
-
-            pred1 = ref_pred_count[1][0] + ref_pred_count[1][1];
-            if ( pred1 )
-                pred1 = (ref_pred_count[1][1] * 255) / pred1;
-
-            pred2 = ref_pred_count[2][0] + ref_pred_count[2][1];
-            if ( pred2 )
-                pred2 = (ref_pred_count[2][1] * 255) / pred2;
-
-            fprintf(f, "%8d: %8d %8d: %8d %8d: %8d %8d\n",
-                        cm->current_video_frame,
-                        pred0, ref_pred_count[0][1],
-                        pred1, ref_pred_count[1][1],
-                        pred2, ref_pred_count[2][1] );
-            fclose(f);
-        }
-
         // From the prediction counts set the probabilities for each context
         for ( i = 0; i < PREDICTION_PROBS; i++ )
         {
@@ -3998,7 +3852,6 @@ static void update_refpred_stats( VP8_COMP *cpi )
         }
     }
 }
-#endif
 
 static void encode_frame_to_data_rate
 (
@@ -4156,10 +4009,11 @@ static void encode_frame_to_data_rate
     }
 #endif
 
-#if !CONFIG_COMPRED
-//#if 1
-    update_rd_ref_frame_probs(cpi);
-#endif
+//#if !CONFIG_COMPRED
+    // This function has been deprecated for now but we may want to do
+    // something here at a late date
+    //update_rd_ref_frame_probs(cpi);
+//#endif
 
     // Test code for new segment features
     init_seg_features( cpi );
@@ -5010,11 +4864,9 @@ static void encode_frame_to_data_rate
                     cpi->segmentation_map, cm->MBs );
     }
 
-#if CONFIG_COMPRED
     // Update the common prediction model probabilities to reflect
     // the what was seen in the current frame.
     update_refpred_stats( cpi );
-#endif
 
     // build the bitstream
     vp8_pack_bitstream(cpi, dest, size);
index 239780641bf963b725f7639e0a2e3e0d594a91dc..8b78986e244f8b2dba85f935d1c27d964b54da5f 100644 (file)
@@ -601,7 +601,7 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
 
 
 // #if CONFIG_COMPRED
-// TODO... this will all need changing for new reference frame coding model
+// TODO... this will need changing for new reference frame coding model
 // #endif
         // Work out the cost assosciated with selecting the reference frame
         frame_cost =
index 349a479215c94b0ebedcba0108e899f86efea21b..10686688c5bb8e0558f00245f6368bb2df89d9a8 100644 (file)
@@ -2038,7 +2038,6 @@ static void set_i8x8_block_modes(MACROBLOCK *x, int *modes)
     }
 }
 
-#if CONFIG_COMPRED
 void vp8_estimate_ref_frame_costs(VP8_COMP *cpi, unsigned int * ref_costs )
 {
     VP8_COMMON *cm = &cpi->common;
@@ -2096,7 +2095,6 @@ void vp8_estimate_ref_frame_costs(VP8_COMP *cpi, unsigned int * ref_costs )
         ref_costs[i] = cost;
     }
 }
-#endif
 
 void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int recon_uvoffset,
                             int *returnrate, int *returndistortion, int *returnintra,
@@ -2158,9 +2156,7 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
     unsigned char *u_buffer[4];
     unsigned char *v_buffer[4];
 
-#if CONFIG_COMPRED
     unsigned int ref_costs[MAX_REF_FRAMES];
-#endif
 
     vpx_memset(&best_mbmode, 0, sizeof(best_mbmode));
     vpx_memset(&best_bmodes, 0, sizeof(best_bmodes));
@@ -2226,11 +2222,9 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
     rd_pick_intra_mbuv_mode(cpi, x, &uv_intra_rate, &uv_intra_rate_tokenonly, &uv_intra_distortion);
     uv_intra_mode = x->e_mbd.mode_info_context->mbmi.uv_mode;
 
-#if CONFIG_COMPRED
     // Get estimates of reference frame costs for each reference frame
     // that depend on the current prediction etc.
     vp8_estimate_ref_frame_costs( cpi, ref_costs );
-#endif
 
     for (mode_index = 0; mode_index < MAX_MODES; mode_index++)
     {
@@ -2622,17 +2616,8 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
             vp8_build_inter16x16_predictors_mby(&x->e_mbd);
 
 #if CONFIG_DUALPRED
-#if CONFIG_COMPRED
             dualmode_cost =
                 vp8_cost_bit( get_pred_prob( cm, xd, PRED_DUAL ), 0 );
-#else
-            {
-                MB_MODE_INFO *t = &x->e_mbd.mode_info_context[-cpi->common.mode_info_stride].mbmi;
-                MB_MODE_INFO *l = &x->e_mbd.mode_info_context[-1].mbmi;
-                int cnt = (t->second_ref_frame != INTRA_FRAME) + (l->second_ref_frame != INTRA_FRAME);
-                dualmode_cost = vp8_cost_bit(cm->prob_dualpred[cnt], 0);
-            }
-#endif
 #endif /* CONFIG_DUALPRED */
 
             if (cpi->active_map_enabled && x->active_ptr[0] == 0) {
@@ -2787,17 +2772,8 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
             /* We don't include the cost of the second reference here, because there are only
              * three options: Last/Golden, ARF/Last or Golden/ARF, or in other words if you
              * present them in that order, the second one is always known if the first is known */
-#if CONFIG_COMPRED
             dualmode_cost =
                 vp8_cost_bit( get_pred_prob( cm, xd, PRED_DUAL ), 1 );
-#else
-            {
-                MB_MODE_INFO *t = &x->e_mbd.mode_info_context[-cpi->common.mode_info_stride].mbmi;
-                MB_MODE_INFO *l = &x->e_mbd.mode_info_context[-1].mbmi;
-                int cnt = (t->second_ref_frame != INTRA_FRAME) + (l->second_ref_frame != INTRA_FRAME);
-                dualmode_cost = vp8_cost_bit(cm->prob_dualpred[cnt], 1);
-            }
-#endif
         }
 #endif /* CONFIG_DUALPRED */
 
@@ -2821,12 +2797,7 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
 
         // Estimate the reference frame signaling cost and add it
         // to the rolling cost variable.
-#if CONFIG_COMPRED
         rate2 += ref_costs[x->e_mbd.mode_info_context->mbmi.ref_frame];
-#else
-        rate2 +=
-            x->e_mbd.ref_frame_cost[x->e_mbd.mode_info_context->mbmi.ref_frame];
-#endif
 
         if (!disable_skip)
         {
@@ -2907,12 +2878,7 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
                 x->e_mbd.mode_info_context->mbmi.mv.as_int = 0;
             }
 
-#if CONFIG_COMPRED
             other_cost += ref_costs[x->e_mbd.mode_info_context->mbmi.ref_frame];
-#else
-            other_cost +=
-                x->e_mbd.ref_frame_cost[x->e_mbd.mode_info_context->mbmi.ref_frame];
-#endif
 
             /* Calculate the final y RD estimate for this mode */
             best_yrd = RDCOST(x->rdmult, x->rddiv, (rate2-rate_uv-other_cost),