From 45e0d4618246563cddb1498d33ac643189af1558 Mon Sep 17 00:00:00 2001
From: Jingning Han <jingning@google.com>
Date: Mon, 13 Feb 2017 10:37:10 -0800
Subject: [PATCH] Skip count update in error resilient mode

This fixes a decoding failure issue of adaptive scan order in the
error resilient mode.

BUG=aomedia:353

Change-Id: I4b09f168cd0e0efc843a05f82d7e1c05173ee629
---
 av1/decoder/decodeframe.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index b646965c39..cf515c002d 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -522,8 +522,9 @@ static void predict_and_reconstruct_intra_block(
         av1_decode_block_tokens(xd, plane, scan_order, col, row, tx_size,
                                 tx_type, &max_scan_line, r, mbmi->segment_id);
 #if CONFIG_ADAPT_SCAN
-    av1_update_scan_count_facade(cm, xd->counts, tx_size, tx_type, pd->dqcoeff,
-                                 eob);
+    if (xd->counts)
+      av1_update_scan_count_facade(cm, xd->counts, tx_size, tx_type,
+                                   pd->dqcoeff, eob);
 #endif
     if (eob)
       inverse_transform_block(xd, plane, tx_type, tx_size, dst, pd->dst.stride,
@@ -563,8 +564,9 @@ static void decode_reconstruct_tx(AV1_COMMON *cm, MACROBLOCKD *const xd,
         av1_decode_block_tokens(xd, plane, sc, blk_col, blk_row, plane_tx_size,
                                 tx_type, &max_scan_line, r, mbmi->segment_id);
 #if CONFIG_ADAPT_SCAN
-    av1_update_scan_count_facade(cm, xd->counts, tx_size, tx_type, pd->dqcoeff,
-                                 eob);
+    if (xd->counts)
+      av1_update_scan_count_facade(cm, xd->counts, tx_size, tx_type,
+                                   pd->dqcoeff, eob);
 #endif
     inverse_transform_block(xd, plane, tx_type, plane_tx_size,
                             &pd->dst.buf[(blk_row * pd->dst.stride + blk_col)
@@ -617,8 +619,9 @@ static int reconstruct_inter_block(AV1_COMMON *cm, MACROBLOCKD *const xd,
   uint8_t *dst =
       &pd->dst.buf[(row * pd->dst.stride + col) << tx_size_wide_log2[0]];
 #if CONFIG_ADAPT_SCAN
-  av1_update_scan_count_facade(cm, xd->counts, tx_size, tx_type, pd->dqcoeff,
-                               eob);
+  if (xd->counts)
+    av1_update_scan_count_facade(cm, xd->counts, tx_size, tx_type, pd->dqcoeff,
+                                 eob);
 #endif
   if (eob)
     inverse_transform_block(xd, plane, tx_type, tx_size, dst, pd->dst.stride,
-- 
GitLab