shithub: libvpx

Download patch

ref: b16fac42d49bd357ed107a23376deb98dbb25016
parent: d606bf93ef2567753afb508fb9d61da78681ba91
author: Dmitry Kovalev <dkovalev@google.com>
date: Wed Jan 8 13:36:38 EST 2014

Using VP9_COMMON instead of VP9_COMP.

Change-Id: If7d3958653104f3e170853e931f8489de3ecf3cc

--- a/vp9/encoder/vp9_bitstream.c
+++ b/vp9/encoder/vp9_bitstream.c
@@ -125,8 +125,7 @@
   }
 }
 
-void vp9_update_skip_probs(VP9_COMP *cpi, vp9_writer *w) {
-  VP9_COMMON *cm = &cpi->common;
+void vp9_update_skip_probs(VP9_COMMON *cm, vp9_writer *w) {
   int k;
 
   for (k = 0; k < MBSKIP_CONTEXTS; ++k)
@@ -935,9 +934,7 @@
     vp9_wb_write_literal(wb, type_to_literal[type], 2);
 }
 
-static void fix_mcomp_filter_type(VP9_COMP *cpi) {
-  VP9_COMMON *const cm = &cpi->common;
-
+static void fix_mcomp_filter_type(VP9_COMMON *cm) {
   if (cm->mcomp_filter_type == SWITCHABLE) {
     // Check to see if only one of the filters is actually used
     int count[SWITCHABLE_FILTERS];
@@ -1066,9 +1063,8 @@
   return total_size;
 }
 
-static void write_display_size(VP9_COMP *cpi, struct vp9_write_bit_buffer *wb) {
-  VP9_COMMON *const cm = &cpi->common;
-
+static void write_display_size(const VP9_COMMON *cm,
+                               struct vp9_write_bit_buffer *wb) {
   const int scaling_active = cm->width != cm->display_width ||
                              cm->height != cm->display_height;
   vp9_wb_write_bit(wb, scaling_active);
@@ -1078,13 +1074,12 @@
   }
 }
 
-static void write_frame_size(VP9_COMP *cpi,
+static void write_frame_size(const VP9_COMMON *cm,
                              struct vp9_write_bit_buffer *wb) {
-  VP9_COMMON *const cm = &cpi->common;
   vp9_wb_write_literal(wb, cm->width - 1, 16);
   vp9_wb_write_literal(wb, cm->height - 1, 16);
 
-  write_display_size(cpi, wb);
+  write_display_size(cm, wb);
 }
 
 static void write_frame_size_with_refs(VP9_COMP *cpi,
@@ -1114,7 +1109,7 @@
     vp9_wb_write_literal(wb, cm->height - 1, 16);
   }
 
-  write_display_size(cpi, wb);
+  write_display_size(cm, wb);
 }
 
 static void write_sync_code(struct vp9_write_bit_buffer *wb) {
@@ -1156,7 +1151,7 @@
       vp9_wb_write_bit(wb, 0);  // has extra plane
     }
 
-    write_frame_size(cpi, wb);
+    write_frame_size(cm, wb);
   } else {
     if (!cm->show_frame)
       vp9_wb_write_bit(wb, cm->intra_only);
@@ -1168,7 +1163,7 @@
       write_sync_code(wb);
 
       vp9_wb_write_literal(wb, get_refresh_mask(cpi), REF_FRAMES);
-      write_frame_size(cpi, wb);
+      write_frame_size(cm, wb);
     } else {
       MV_REFERENCE_FRAME ref_frame;
       vp9_wb_write_literal(wb, get_refresh_mask(cpi), REF_FRAMES);
@@ -1182,7 +1177,7 @@
 
       vp9_wb_write_bit(wb, cm->allow_high_precision_mv);
 
-      fix_mcomp_filter_type(cpi);
+      fix_mcomp_filter_type(cm);
       write_interp_filter_type(cm->mcomp_filter_type, wb);
     }
   }
@@ -1220,7 +1215,7 @@
   active_section = 2;
 #endif
 
-  vp9_update_skip_probs(cpi, &header_bc);
+  vp9_update_skip_probs(cm, &header_bc);
 
   if (!frame_is_intra_only(cm)) {
     int i;
@@ -1242,9 +1237,8 @@
                                 cm->counts.intra_inter[i]);
 
     if (cm->allow_comp_inter_inter) {
-      const int reference_mode = cpi->common.reference_mode;
-      const int use_compound_pred = reference_mode != SINGLE_REFERENCE;
-      const int use_hybrid_pred = reference_mode == REFERENCE_MODE_SELECT;
+      const int use_compound_pred = cm->reference_mode != SINGLE_REFERENCE;
+      const int use_hybrid_pred = cm->reference_mode == REFERENCE_MODE_SELECT;
 
       vp9_write_bit(&header_bc, use_compound_pred);
       if (use_compound_pred) {
@@ -1278,7 +1272,7 @@
       prob_diff_update(vp9_partition_tree, fc->partition_prob[i],
                        cm->counts.partition[i], PARTITION_TYPES, &header_bc);
 
-    vp9_write_nmv_probs(cpi, cm->allow_high_precision_mv, &header_bc);
+    vp9_write_nmv_probs(cm, cm->allow_high_precision_mv, &header_bc);
   }
 
   vp9_stop_encode(&header_bc);
--- a/vp9/encoder/vp9_bitstream.h
+++ b/vp9/encoder/vp9_bitstream.h
@@ -12,6 +12,6 @@
 #ifndef VP9_ENCODER_VP9_BITSTREAM_H_
 #define VP9_ENCODER_VP9_BITSTREAM_H_
 
-void vp9_update_skip_probs(VP9_COMP *cpi, vp9_writer *bc);
+void vp9_update_skip_probs(VP9_COMMON *cm, vp9_writer *bc);
 
 #endif  // VP9_ENCODER_VP9_BITSTREAM_H_
--- a/vp9/encoder/vp9_encodemv.c
+++ b/vp9/encoder/vp9_encodemv.c
@@ -163,10 +163,10 @@
     update_mv(w, branch_ct[i], &probs[i], NMV_UPDATE_PROB);
 }
 
-void vp9_write_nmv_probs(VP9_COMP* const cpi, int usehp, vp9_writer *w) {
+void vp9_write_nmv_probs(VP9_COMMON *cm, int usehp, vp9_writer *w) {
   int i, j;
-  nmv_context *mvc = &cpi->common.fc.nmvc;
-  nmv_context_counts *counts = &cpi->common.counts.mv;
+  nmv_context *const mvc = &cm->fc.nmvc;
+  nmv_context_counts *const counts = &cm->counts.mv;
 
   write_mv_update(vp9_mv_joint_tree, mvc->joints, counts->joints, MV_JOINTS, w);
 
--- a/vp9/encoder/vp9_encodemv.h
+++ b/vp9/encoder/vp9_encodemv.h
@@ -16,7 +16,7 @@
 
 void vp9_entropy_mv_init();
 
-void vp9_write_nmv_probs(VP9_COMP* const, int usehp, vp9_writer* const);
+void vp9_write_nmv_probs(VP9_COMMON *cm, int usehp, vp9_writer* const);
 
 void vp9_encode_mv(VP9_COMP *cpi, vp9_writer* w, const MV* mv, const MV* ref,
                    const nmv_context* mvctx, int usehp);