Moving ymode_count, uv_mode_count to macroblock struct
authorScott LaVarnway <slavarnway@google.com>
Mon, 5 Nov 2012 20:25:18 +0000 (12:25 -0800)
committerScott LaVarnway <slavarnway@google.com>
Mon, 5 Nov 2012 20:25:18 +0000 (12:25 -0800)
Change-Id: Ib73c7b2bee4cb2eb2528fa6b381fffe9503079a0

vp8/encoder/bitstream.c
vp8/encoder/block.h
vp8/encoder/encodeframe.c
vp8/encoder/ethreading.c
vp8/encoder/onyx_int.h
vp8/encoder/ratectrl.c

index 7ab6dc9..f84ae68 100644 (file)
@@ -118,7 +118,7 @@ static void update_mbintra_mode_probs(VP8_COMP *cpi)
 
         update_mode(
             w, VP8_YMODES, vp8_ymode_encodings, vp8_ymode_tree,
-            Pnew, x->fc.ymode_prob, bct, (unsigned int *)cpi->ymode_count
+            Pnew, x->fc.ymode_prob, bct, (unsigned int *)cpi->mb.ymode_count
         );
     }
     {
@@ -127,7 +127,7 @@ static void update_mbintra_mode_probs(VP8_COMP *cpi)
 
         update_mode(
             w, VP8_UV_MODES, vp8_uv_mode_encodings, vp8_uv_mode_tree,
-            Pnew, x->fc.uv_mode_prob, bct, (unsigned int *)cpi->uv_mode_count
+            Pnew, x->fc.uv_mode_prob, bct, (unsigned int *)cpi->mb.uv_mode_count
         );
     }
 }
index e6228ec..1e475b8 100644 (file)
@@ -130,6 +130,10 @@ typedef struct macroblock
     int skip_true_count;
     unsigned int coef_counts [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
 
+    int ymode_count [VP8_YMODES];        /* intra MB type cts this frame */
+    int uv_mode_count[VP8_UV_MODES];     /* intra MB type cts this frame */
+
+
 
     void (*short_fdct4x4)(short *input, short *output, int pitch);
     void (*short_fdct8x4)(short *input, short *output, int pitch);
index d580d89..f99bdb3 100644 (file)
@@ -643,8 +643,6 @@ static void init_encode_frame_mb_context(VP8_COMP *cpi)
     xd->left_context = &cm->left_context;
 
     vp8_zero(cpi->count_mb_ref_frame_usage)
-    vp8_zero(cpi->ymode_count)
-    vp8_zero(cpi->uv_mode_count)
 
     x->mvc = cm->fc.mvc;
 
@@ -676,6 +674,8 @@ static void init_encode_frame_mb_context(VP8_COMP *cpi)
         xd->fullpixel_mask = 0xfffffff8;
 
     vp8_zero(x->coef_counts);
+    vp8_zero(x->ymode_count);
+    vp8_zero(x->uv_mode_count)
 }
 
 static void sum_coef_counts(MACROBLOCK *x, MACROBLOCK *x_thread)
@@ -867,10 +867,20 @@ void vp8_encode_frame(VP8_COMP *cpi)
 
             for (i = 0; i < cpi->encoding_thread_count; i++)
             {
+                int mode_count;
                 totalrate += cpi->mb_row_ei[i].totalrate;
 
                 cpi->mb.skip_true_count += cpi->mb_row_ei[i].mb.skip_true_count;
 
+                for(mode_count = 0; mode_count < VP8_YMODES; mode_count++)
+                    cpi->mb.ymode_count[mode_count] +=
+                        cpi->mb_row_ei[i].mb.ymode_count[mode_count];
+
+                for(mode_count = 0; mode_count < VP8_UV_MODES; mode_count++)
+                    cpi->mb.uv_mode_count[mode_count] +=
+                        cpi->mb_row_ei[i].mb.uv_mode_count[mode_count];
+
+
                 /* add up counts for each thread */
                 sum_coef_counts(x, &cpi->mb_row_ei[i].mb);
             }
@@ -1101,8 +1111,8 @@ static void sum_intra_stats(VP8_COMP *cpi, MACROBLOCK *x)
 
 #endif
 
-    ++cpi->ymode_count[m];
-    ++cpi->uv_mode_count[uvm];
+    ++x->ymode_count[m];
+    ++x->uv_mode_count[uvm];
 
 }
 
index 9b7805e..1ad6dab 100644 (file)
@@ -473,6 +473,7 @@ void vp8cx_init_mbrthread_data(VP8_COMP *cpi,
             mbd->fullpixel_mask = 0xfffffff8;
 
         vp8_zero(mb->coef_counts);
+        vp8_zero(x->ymode_count);
         mb->skip_true_count = 0;
     }
 }
index 7cea725..f38bf89 100644 (file)
@@ -452,9 +452,6 @@ typedef struct VP8_COMP
     int drop_frames_allowed; /* Are we permitted to drop frames? */
     int drop_frame;          /* Drop 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 */
-
     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];
index 1432c14..77c1c5a 100644 (file)
@@ -242,8 +242,8 @@ void vp8_save_coding_context(VP8_COMP *cpi)
     vp8_copy(cc->ymode_prob,   cpi->common.fc.ymode_prob);
     vp8_copy(cc->uv_mode_prob,  cpi->common.fc.uv_mode_prob);
 
-    vp8_copy(cc->ymode_count, cpi->ymode_count);
-    vp8_copy(cc->uv_mode_count, cpi->uv_mode_count);
+    vp8_copy(cc->ymode_count, cpi->mb.ymode_count);
+    vp8_copy(cc->uv_mode_count, cpi->mb.uv_mode_count);
 
 
     /* Stats */
@@ -280,8 +280,8 @@ void vp8_restore_coding_context(VP8_COMP *cpi)
     vp8_copy(cpi->common.fc.ymode_prob,   cc->ymode_prob);
     vp8_copy(cpi->common.fc.uv_mode_prob,  cc->uv_mode_prob);
 
-    vp8_copy(cpi->ymode_count, cc->ymode_count);
-    vp8_copy(cpi->uv_mode_count, cc->uv_mode_count);
+    vp8_copy(cpi->mb.ymode_count, cc->ymode_count);
+    vp8_copy(cpi->mb.uv_mode_count, cc->uv_mode_count);
 
     /* Stats */
 #ifdef MODE_STATS