]> granicus.if.org Git - libvpx/commitdiff
Cleanup of decode_coefs() function.
authorDmitry Kovalev <dkovalev@google.com>
Sat, 12 Oct 2013 01:01:30 +0000 (18:01 -0700)
committerDmitry Kovalev <dkovalev@google.com>
Tue, 15 Oct 2013 02:59:44 +0000 (19:59 -0700)
Moving entropy context calculation to outer scope and adding consts to
pointers.

Change-Id: I25d0987e97495326ab1e8046e3fa3082c0584485

vp9/decoder/vp9_detokenize.c

index a67945c8cfa9a3be860802619c7ca6ae707a7110..efaedfcb3facdfeefd277ad183ac7d7a01971bec 100644 (file)
@@ -88,22 +88,20 @@ static const vp9_prob cat6_prob[15] = {
 static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd,
                         vp9_reader *r, int block_idx,
                         PLANE_TYPE type, int seg_eob, int16_t *qcoeff_ptr,
-                        TX_SIZE tx_size, const int16_t *dq,
-                        ENTROPY_CONTEXT *A, ENTROPY_CONTEXT *L) {
-  FRAME_CONTEXT *const fc = &cm->fc;
+                        TX_SIZE tx_size, const int16_t *dq, int pt) {
+  const FRAME_CONTEXT *const fc = &cm->fc;
   FRAME_COUNTS *const counts = &cm->counts;
   const int ref = is_inter_block(&xd->this_mi->mbmi);
   int band, c = 0;
-  vp9_prob (*coef_probs)[PREV_COEF_CONTEXTS][UNCONSTRAINED_NODES] =
+  const vp9_prob (*coef_probs)[PREV_COEF_CONTEXTS][UNCONSTRAINED_NODES] =
       fc->coef_probs[tx_size][type][ref];
   vp9_prob coef_probs_full[COEF_BANDS][PREV_COEF_CONTEXTS][ENTROPY_NODES];
   uint8_t load_map[COEF_BANDS][PREV_COEF_CONTEXTS] = { { 0 } };
-  vp9_prob *prob;
+  const vp9_prob *prob;
   vp9_coeff_count_model *coef_counts = counts->coef[tx_size];
   const int16_t *scan, *nb;
   const uint8_t *band_translate;
   uint8_t token_cache[1024];
-  int pt = get_entropy_context(tx_size, A, L);
   get_scan_and_band(xd, tx_size, type, block_idx, &scan, &nb, &band_translate);
 
   while (1) {
@@ -222,14 +220,15 @@ static void decode_block(int plane, int block, BLOCK_SIZE plane_bsize,
   struct macroblockd_plane* pd = &xd->plane[plane];
   const int segment_id = xd->this_mi->mbmi.segment_id;
   const int seg_eob = get_tx_eob(seg, segment_id, tx_size);
-  int aoff, loff, eob;
+  int aoff, loff, eob, pt;
 
   txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &aoff, &loff);
+  pt = get_entropy_context(tx_size, pd->above_context + aoff,
+                                    pd->left_context + loff);
 
   eob = decode_coefs(&arg->pbi->common, xd, arg->r, block,
                      pd->plane_type, seg_eob, BLOCK_OFFSET(pd->qcoeff, block),
-                     tx_size, pd->dequant,
-                     pd->above_context + aoff, pd->left_context + loff);
+                     tx_size, pd->dequant, pt);
 
   set_contexts(xd, pd, plane_bsize, tx_size, eob > 0, aoff, loff);