Rework scan order fetch logic for decoder
authorJingning Han <jingning@google.com>
Tue, 7 Jul 2015 20:52:56 +0000 (13:52 -0700)
committerJingning Han <jingning@google.com>
Tue, 7 Jul 2015 22:03:21 +0000 (15:03 -0700)
Save redundant call for getting prediction mode to obtain scan
order for detokenization.

Change-Id: I0683ef119f1579d1261ed5d59052a1745b68ef6f

vp9/decoder/vp9_decodeframe.c
vp9/decoder/vp9_detokenize.c
vp9/decoder/vp9_detokenize.h

index 7631e4d..6c64540 100644 (file)
@@ -315,7 +315,10 @@ static void predict_and_reconstruct_intra_block(int plane, int block,
                           x, y, plane);
 
   if (!mi->mbmi.skip) {
-    const int eob = vp9_decode_block_tokens(xd, plane, block,
+    const scan_order *sc = (plane || xd->lossless) ?
+        &vp9_default_scan_orders[tx_size] :
+        &vp9_scan_orders[tx_size][intra_mode_to_tx_type_lookup[mode]];
+    const int eob = vp9_decode_block_tokens(xd, plane, sc,
                                             plane_bsize, x, y, tx_size,
                                             args->r, args->seg_id);
     inverse_transform_block(xd, plane, block, tx_size, dst, pd->dst.stride,
@@ -337,8 +340,9 @@ static void reconstruct_inter_block(int plane, int block,
   MACROBLOCKD *const xd = args->xd;
   struct macroblockd_plane *const pd = &xd->plane[plane];
   int x, y, eob;
+  const scan_order *sc = &vp9_default_scan_orders[tx_size];
   txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &x, &y);
-  eob = vp9_decode_block_tokens(xd, plane, block, plane_bsize,
+  eob = vp9_decode_block_tokens(xd, plane, sc, plane_bsize,
                                 x, y, tx_size, args->r, args->seg_id);
   inverse_transform_block(xd, plane, block, tx_size,
                           &pd->dst.buf[4 * y * pd->dst.stride + 4 * x],
index 2e26059..4e3ab82 100644 (file)
@@ -17,7 +17,6 @@
 #if CONFIG_COEFFICIENT_RANGE_CHECKING
 #include "vp9/common/vp9_idct.h"
 #endif
-#include "vp9/common/vp9_scan.h"
 
 #include "vp9/decoder/vp9_detokenize.h"
 
@@ -207,7 +206,7 @@ static int decode_coefs(const MACROBLOCKD *xd,
 }
 
 int vp9_decode_block_tokens(MACROBLOCKD *xd,
-                            int plane, int block,
+                            int plane, const scan_order *sc,
                             BLOCK_SIZE plane_bsize, int x, int y,
                             TX_SIZE tx_size, vp9_reader *r,
                             int seg_id) {
@@ -215,10 +214,9 @@ int vp9_decode_block_tokens(MACROBLOCKD *xd,
   const int16_t *const dequant = pd->seg_dequant[seg_id];
   const int ctx = get_entropy_context(tx_size, pd->above_context + x,
                                                pd->left_context + y);
-  const scan_order *so = get_scan(xd, tx_size, pd->plane_type, block);
   const int eob = decode_coefs(xd, pd->plane_type,
                                pd->dqcoeff, tx_size,
-                               dequant, ctx, so->scan, so->neighbors, r);
+                               dequant, ctx, sc->scan, sc->neighbors, r);
   vp9_set_contexts(xd, pd, plane_bsize, tx_size, eob > 0, x, y);
   return eob;
 }
index df17606..ed826a4 100644 (file)
 
 #include "vp9/decoder/vp9_decoder.h"
 #include "vp9/decoder/vp9_reader.h"
+#include "vp9/common/vp9_scan.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
 int vp9_decode_block_tokens(MACROBLOCKD *xd,
-                            int plane, int block,
+                            int plane, const scan_order *sc,
                             BLOCK_SIZE plane_bsize, int x, int y,
                             TX_SIZE tx_size, vp9_reader *r,
                             int seg_id);