[Libva] [driver PATCH 2/2] vp8 dec: fix when bool_coder_ctx.count is 0

Zhao, Halley halley.zhao at intel.com
Thu Jan 9 17:53:16 PST 2014


From: "Zhao, Halley" <halley.zhao at intel.com>

bool_coder_ctx.count is remaining bits,
hw requires used-bits-count: 8-bool_coder_ctx.count, range [0,7]
update offset and partition_size[0] as well

Signed-off-by: Zhao Halley <halley.zhao at intel.com>
---
 src/gen8_mfd.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/gen8_mfd.c b/src/gen8_mfd.c
index abf3078..b828675 100644
--- a/src/gen8_mfd.c
+++ b/src/gen8_mfd.c
@@ -2965,6 +2965,15 @@ gen8_mfd_vp8_bsd_object(VADriverContextP ctx,
     struct intel_batchbuffer *batch = gen7_mfd_context->base.batch;
     int i, log2num;
     unsigned int offset = slice_param->slice_data_offset + ((slice_param->macroblock_offset + 7 ) >> 3);
+    unsigned int used_bits = 8-pic_param->bool_coder_ctx.count;
+    unsigned int partition_size_0 = slice_param->partition_size[0];
+
+    assert(pic_param->bool_coder_ctx.count >= 0 && pic_param->bool_coder_ctx.count <= 7);
+    if (used_bits == 8) {
+        used_bits = 0;
+        offset += 1;
+        partition_size_0 -= 1;
+    }
 
     assert(slice_param->num_of_partitions >= 2);
     assert(slice_param->num_of_partitions <= 9);
@@ -2974,8 +2983,7 @@ gen8_mfd_vp8_bsd_object(VADriverContextP ctx,
     BEGIN_BCS_BATCH(batch, 22);
     OUT_BCS_BATCH(batch, MFD_VP8_BSD_OBJECT | (22 - 2));
     OUT_BCS_BATCH(batch,
-                  // XXX, when bool_coder_ctx.count (remaining bits in value) is 0, 0 is also expected for CPBAC Entropy Count?
-                  ((8-pic_param->bool_coder_ctx.count)%8) << 16 | /* Partition 0 CPBAC Entropy Count */
+                  used_bits << 16 | /* Partition 0 CPBAC Entropy Count */
                   pic_param->bool_coder_ctx.range <<  8 | /* Partition 0 Count Entropy Range */
                   log2num << 4 |
                   (slice_param->macroblock_offset & 0x7));
@@ -2983,7 +2991,10 @@ gen8_mfd_vp8_bsd_object(VADriverContextP ctx,
                   pic_param->bool_coder_ctx.value << 24 | /* Partition 0 Count Entropy Value */
                   0);
 
-    for (i = 0; i < 9; i++) {
+    OUT_BCS_BATCH(batch, partition_size_0);
+    OUT_BCS_BATCH(batch, offset);
+    offset += partition_size_0;
+    for (i = 1; i < 9; i++) {
         if (i < slice_param->num_of_partitions) {
             OUT_BCS_BATCH(batch, slice_param->partition_size[i]);
             OUT_BCS_BATCH(batch, offset);
-- 
1.8.3.2



More information about the Libva mailing list