[SCM] libav/experimental: VP8: simplify decode_block_coeffs to avoid having to track nonzero coeffs Slightly faster.

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 17:13:32 UTC 2013


The following commit has been merged in the experimental branch:
commit afb54a85c385d434dd96040069964a8156bcf7fd
Author: Jason Garrett-Glaser <darkshikari at gmail.com>
Date:   Wed Aug 4 01:38:08 2010 +0000

    VP8: simplify decode_block_coeffs to avoid having to track nonzero coeffs
    Slightly faster.
    
    Originally committed as revision 24689 to svn://svn.ffmpeg.org/ffmpeg/trunk

diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
index 2a0f93b..372d266 100644
--- a/libavcodec/vp8.c
+++ b/libavcodec/vp8.c
@@ -826,17 +826,20 @@ static int decode_block_coeffs(VP56RangeCoder *c, DCTELEM block[16],
                                int i, int zero_nhood, int16_t qmul[2])
 {
     uint8_t *token_prob = probs[i][zero_nhood];
-    int nonzero = 0;
     int coeff;
 
+    if (!vp56_rac_get_prob_branchy(c, token_prob[0]))
+        return 0;
+    goto skip_eob;
+
     do {
         if (!vp56_rac_get_prob_branchy(c, token_prob[0]))   // DCT_EOB
-            return nonzero;
+            return i;
 
 skip_eob:
         if (!vp56_rac_get_prob_branchy(c, token_prob[1])) { // DCT_0
             if (++i == 16)
-                return nonzero; // invalid input; blocks should end with EOB
+                return i; // invalid input; blocks should end with EOB
             token_prob = probs[i][0];
             goto skip_eob;
         }
@@ -870,13 +873,10 @@ skip_eob:
             }
             token_prob = probs[i+1][2];
         }
-
-        // todo: full [16] qmat? load into register?
         block[zigzag_scan[i]] = (vp8_rac_get(c) ? -coeff : coeff) * qmul[!!i];
-        nonzero = ++i;
-    } while (i < 16);
+    } while (++i < 16);
 
-    return nonzero;
+    return i;
 }
 
 static av_always_inline
@@ -910,9 +910,9 @@ void decode_mb_coeffs(VP8Context *s, VP56RangeCoder *c, VP8Macroblock *mb,
     // luma blocks
     for (y = 0; y < 4; y++)
         for (x = 0; x < 4; x++) {
-            nnz_pred = l_nnz[y] + t_nnz[x];
+            nnz_pred = l_nnz[y] + t_nnz[x];START_TIMER;
             nnz = decode_block_coeffs(c, s->block[y][x], s->prob->token[luma_ctx], luma_start,
-                                      nnz_pred, s->qmat[segment].luma_qmul);
+                                      nnz_pred, s->qmat[segment].luma_qmul);STOP_TIMER("test");
             // nnz+block_dc may be one more than the actual last index, but we don't care
             s->non_zero_count_cache[y][x] = nnz + block_dc;
             t_nnz[x] = l_nnz[y] = !!nnz;

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list