Moving MVcount to macroblock struct
authorScott LaVarnway <slavarnway@google.com>
Mon, 5 Nov 2012 20:41:24 +0000 (12:41 -0800)
committerScott LaVarnway <slavarnway@google.com>
Tue, 6 Nov 2012 16:51:11 +0000 (08:51 -0800)
Change-Id: Ie22841d096f3c86694b95bd06fc3a8ce1f032a10

vp8/encoder/block.h
vp8/encoder/encodeframe.c
vp8/encoder/encodemv.c
vp8/encoder/ethreading.c
vp8/encoder/onyx_int.h
vp8/encoder/pickinter.c
vp8/encoder/rdopt.c

index 1e475b8..d5496a7 100644 (file)
@@ -129,6 +129,7 @@ typedef struct macroblock
 
     int skip_true_count;
     unsigned int coef_counts [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
+    unsigned int MVcount [2] [MVvals];  /* (row,col) MV cts 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 */
index f99bdb3..6364f7d 100644 (file)
@@ -762,7 +762,7 @@ void vp8_encode_frame(VP8_COMP *cpi)
 
     xd->mode_info_context = cm->mi;
 
-    vp8_zero(cpi->MVcount);
+    vp8_zero(cpi->mb.MVcount);
 
     vp8cx_frame_init_quantizer(cpi);
 
@@ -868,6 +868,7 @@ void vp8_encode_frame(VP8_COMP *cpi)
             for (i = 0; i < cpi->encoding_thread_count; i++)
             {
                 int mode_count;
+                int mv_vals;
                 totalrate += cpi->mb_row_ei[i].totalrate;
 
                 cpi->mb.skip_true_count += cpi->mb_row_ei[i].mb.skip_true_count;
@@ -880,6 +881,13 @@ void vp8_encode_frame(VP8_COMP *cpi)
                     cpi->mb.uv_mode_count[mode_count] +=
                         cpi->mb_row_ei[i].mb.uv_mode_count[mode_count];
 
+                for(mv_vals = 0; mv_vals < MVvals; mv_vals++)
+                {
+                    cpi->mb.MVcount[0][mv_vals] +=
+                        cpi->mb_row_ei[i].mb.MVcount[0][mv_vals];
+                    cpi->mb.MVcount[1][mv_vals] +=
+                        cpi->mb_row_ei[i].mb.MVcount[1][mv_vals];
+                }
 
                 /* add up counts for each thread */
                 sum_coef_counts(x, &cpi->mb_row_ei[i].mb);
index 7d8c84d..0c43d06 100644 (file)
@@ -363,10 +363,12 @@ void vp8_write_mvprobs(VP8_COMP *cpi)
     active_section = 4;
 #endif
     write_component_probs(
-        w, &mvc[0], &vp8_default_mv_context[0], &vp8_mv_update_probs[0], cpi->MVcount[0], 0, &flags[0]
+        w, &mvc[0], &vp8_default_mv_context[0], &vp8_mv_update_probs[0],
+        cpi->mb.MVcount[0], 0, &flags[0]
     );
     write_component_probs(
-        w, &mvc[1], &vp8_default_mv_context[1], &vp8_mv_update_probs[1], cpi->MVcount[1], 1, &flags[1]
+        w, &mvc[1], &vp8_default_mv_context[1], &vp8_mv_update_probs[1],
+        cpi->mb.MVcount[1], 1, &flags[1]
     );
 
     if (flags[0] || flags[1])
index 1ad6dab..81fbe52 100644 (file)
@@ -475,6 +475,7 @@ void vp8cx_init_mbrthread_data(VP8_COMP *cpi,
         vp8_zero(mb->coef_counts);
         vp8_zero(x->ymode_count);
         mb->skip_true_count = 0;
+        vp8_zero(mb->MVcount);
     }
 }
 
index f38bf89..395287d 100644 (file)
@@ -452,8 +452,6 @@ typedef struct VP8_COMP
     int drop_frames_allowed; /* Are we permitted to drop frames? */
     int drop_frame;          /* Drop 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];
     char update_probs [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
 
index f894d39..3f09a9f 100644 (file)
@@ -389,15 +389,16 @@ static void pick_intra_mbuv_mode(MACROBLOCK *mb)
 
 }
 
-static void update_mvcount(VP8_COMP *cpi, MACROBLOCKD *xd, int_mv *best_ref_mv)
+static void update_mvcount(VP8_COMP *cpi, MACROBLOCK *x, int_mv *best_ref_mv)
 {
+    MACROBLOCKD *xd = &x->e_mbd;
     /* Split MV modes currently not supported when RD is nopt enabled,
      * therefore, only need to modify MVcount in NEWMV mode. */
     if (xd->mode_info_context->mbmi.mode == NEWMV)
     {
-        cpi->MVcount[0][mv_max+((xd->mode_info_context->mbmi.mv.as_mv.row -
+        x->MVcount[0][mv_max+((xd->mode_info_context->mbmi.mv.as_mv.row -
                                       best_ref_mv->as_mv.row) >> 1)]++;
-        cpi->MVcount[1][mv_max+((xd->mode_info_context->mbmi.mv.as_mv.col -
+        x->MVcount[1][mv_max+((xd->mode_info_context->mbmi.mv.as_mv.col -
                                       best_ref_mv->as_mv.col) >> 1)]++;
     }
 }
@@ -1240,7 +1241,7 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
       != cpi->common.ref_frame_sign_bias[xd->mode_info_context->mbmi.ref_frame])
         best_ref_mv.as_int = best_ref_mv_sb[!sign_bias].as_int;
 
-    update_mvcount(cpi, &x->e_mbd, &best_ref_mv);
+    update_mvcount(cpi, x, &best_ref_mv);
 }
 
 
index 0dda240..7d80606 100644 (file)
@@ -1738,18 +1738,18 @@ static void rd_update_mvcount(VP8_COMP *cpi, MACROBLOCK *x, int_mv *best_ref_mv)
         {
             if (x->partition_info->bmi[i].mode == NEW4X4)
             {
-                cpi->MVcount[0][mv_max+((x->partition_info->bmi[i].mv.as_mv.row
+                x->MVcount[0][mv_max+((x->partition_info->bmi[i].mv.as_mv.row
                                           - best_ref_mv->as_mv.row) >> 1)]++;
-                cpi->MVcount[1][mv_max+((x->partition_info->bmi[i].mv.as_mv.col
+                x->MVcount[1][mv_max+((x->partition_info->bmi[i].mv.as_mv.col
                                           - best_ref_mv->as_mv.col) >> 1)]++;
             }
         }
     }
     else if (x->e_mbd.mode_info_context->mbmi.mode == NEWMV)
     {
-        cpi->MVcount[0][mv_max+((x->e_mbd.mode_info_context->mbmi.mv.as_mv.row
+        x->MVcount[0][mv_max+((x->e_mbd.mode_info_context->mbmi.mv.as_mv.row
                                           - best_ref_mv->as_mv.row) >> 1)]++;
-        cpi->MVcount[1][mv_max+((x->e_mbd.mode_info_context->mbmi.mv.as_mv.col
+        x->MVcount[1][mv_max+((x->e_mbd.mode_info_context->mbmi.mv.as_mv.col
                                           - best_ref_mv->as_mv.col) >> 1)]++;
     }
 }