shithub: libvpx

Download patch

ref: 3e976bba2124f20bde60eec67b3011cbf1bf0a53
parent: 12da793d001b0be5855c7a5741909f08fe387fa0
author: Yaowu Xu <yaowu@google.com>
date: Tue Nov 27 11:02:35 EST 2012

Localize Y2 entropy coding context

This commit makes sure Y2 entropy coding context is always updated on
every macroblock even there is no Y2 block.

Change-Id: Ie307cfc46526efe55613be39f9f178d2531b56ba

--- a/vp9/decoder/vp9_decodframe.c
+++ b/vp9/decoder/vp9_decodframe.c
@@ -505,6 +505,8 @@
         vp9_dequant_idct_add(b->qcoeff, b->dequant, b->predictor,
                                *(b->base_dst) + b->dst, 16, b->dst_stride);
       }
+      xd->above_context->y2 = 1;
+      xd->left_context->y2 = 1;
     }
     if (!xd->mode_info_context->mbmi.mb_skip_coeff)
       vp9_decode_mb_tokens_4x4_uv(pbi, xd, bc);
--- a/vp9/decoder/vp9_detokenize.c
+++ b/vp9/decoder/vp9_detokenize.c
@@ -70,6 +70,8 @@
   } else {
     vpx_memset(xd->above_context, 0, sizeof(ENTROPY_CONTEXT_PLANES) - 1);
     vpx_memset(xd->left_context, 0, sizeof(ENTROPY_CONTEXT_PLANES) - 1);
+    xd->above_context->y2 = 1;
+    xd->left_context->y2 = 1;
   }
 }
 
@@ -321,6 +323,8 @@
     eobtotal += c - 4;
     type = PLANE_TYPE_Y_NO_DC;
   } else {
+    xd->above_context->y2 = 1;
+    xd->left_context->y2 = 1;
     type = PLANE_TYPE_Y_WITH_DC;
   }
 
@@ -431,6 +435,8 @@
     eobtotal += vp9_decode_coefs_4x4(dx, xd, bc, PLANE_TYPE_Y2, 24) - 16;
     type = PLANE_TYPE_Y_NO_DC;
   } else {
+    xd->above_context->y2 = 1;
+    xd->left_context->y2 = 1;
     type = PLANE_TYPE_Y_WITH_DC;
   }
 
--- a/vp9/encoder/vp9_tokenize.c
+++ b/vp9/encoder/vp9_tokenize.c
@@ -358,8 +358,11 @@
     }
 
     plane_type = PLANE_TYPE_Y_NO_DC;
-  } else
+  } else {
+    xd->above_context->y2 = 1;
+    xd->left_context->y2 = 1;
     plane_type = PLANE_TYPE_Y_WITH_DC;
+  }
 
   if (tx_size == TX_16X16) {
     tokenize_b(cpi, xd, xd->block, t, PLANE_TYPE_Y_WITH_DC,
@@ -743,6 +746,8 @@
             TX_8X8, dry_run);
     plane_type = PLANE_TYPE_Y_NO_DC;
   } else {
+    xd->above_context->y2 = 1;
+    xd->left_context->y2 = 1;
     plane_type = PLANE_TYPE_Y_WITH_DC;
   }
 
@@ -796,6 +801,8 @@
             L + vp9_block2left[24], TX_4X4, dry_run);
     plane_type = PLANE_TYPE_Y_NO_DC;
   } else {
+    xd->above_context->y2 = 1;
+    xd->left_context->y2 = 1;
     plane_type = PLANE_TYPE_Y_WITH_DC;
   }
 
@@ -825,6 +832,8 @@
   for (b = 16; b < 24; b++)
     stuff_b(cpi, xd, xd->block + b, t, PLANE_TYPE_UV, A + vp9_block2above[b],
             L + vp9_block2left[b], TX_4X4, dry_run);
+  xd->above_context->y2 = 1;
+  xd->left_context->y2 = 1;
 }
 
 void vp9_stuff_mb(VP9_COMP *cpi, MACROBLOCKD *xd, TOKENEXTRA **t, int dry_run) {
@@ -861,5 +870,7 @@
   } else {
     vpx_memset(xd->above_context, 0, sizeof(ENTROPY_CONTEXT_PLANES) - 1);
     vpx_memset(xd->left_context, 0, sizeof(ENTROPY_CONTEXT_PLANES) - 1);
+    xd->above_context->y2 = 1;
+    xd->left_context->y2 = 1;
   }
 }
--