[FFmpeg-cvslog] dnxhddec: rearrange decode_dct_block loop

Mans Rullgard git at videolan.org
Sat Oct 22 23:05:51 CEST 2011


ffmpeg | branch: master | Mans Rullgard <mans at mansr.com> | Fri Jul 22 22:38:14 2011 +0100| [b297c881d6b968bbb2bb7a3a0979429ee03b594c] | committer: Mans Rullgard

dnxhddec: rearrange decode_dct_block loop

This makes decoding a bit faster.

Signed-off-by: Mans Rullgard <mans at mansr.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b297c881d6b968bbb2bb7a3a0979429ee03b594c
---

 libavcodec/dnxhddec.c |   24 +++++++++++++-----------
 1 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c
index 63ccd08..79e4bb3 100644
--- a/libavcodec/dnxhddec.c
+++ b/libavcodec/dnxhddec.c
@@ -204,17 +204,14 @@ static av_always_inline void dnxhd_decode_dct_block(DNXHDContext *ctx,
     block[0] = ctx->last_dc[component];
     //av_log(ctx->avctx, AV_LOG_DEBUG, "dc %d\n", block[0]);
 
-    for (i = 1; ; i++) {
-        UPDATE_CACHE(bs, &ctx->gb);
-        GET_VLC(index1, bs, &ctx->gb, ctx->ac_vlc.table,
-                DNXHD_VLC_BITS, 2);
-        //av_log(ctx->avctx, AV_LOG_DEBUG, "index %d\n", index1);
-        level = ctx->cid_table->ac_level[index1];
-        if (!level) { /* EOB */
-            //av_log(ctx->avctx, AV_LOG_DEBUG, "EOB\n");
-            break;
-        }
+    i = 0;
 
+    UPDATE_CACHE(bs, &ctx->gb);
+    GET_VLC(index1, bs, &ctx->gb, ctx->ac_vlc.table,
+            DNXHD_VLC_BITS, 2);
+    level = ctx->cid_table->ac_level[index1];
+
+    while (level) {
         sign = SHOW_SBITS(bs, &ctx->gb, 1);
         SKIP_BITS(bs, &ctx->gb, 1);
 
@@ -230,7 +227,7 @@ static av_always_inline void dnxhd_decode_dct_block(DNXHDContext *ctx,
             i += ctx->cid_table->run[index2];
         }
 
-        if (i > 63) {
+        if (++i > 63) {
             av_log(ctx->avctx, AV_LOG_ERROR, "ac tex damaged %d, %d\n", n, i);
             break;
         }
@@ -245,6 +242,11 @@ static av_always_inline void dnxhd_decode_dct_block(DNXHDContext *ctx,
 
         //av_log(NULL, AV_LOG_DEBUG, "i %d, j %d, end level %d\n", i, j, level);
         block[j] = (level^sign) - sign;
+
+        UPDATE_CACHE(bs, &ctx->gb);
+        GET_VLC(index1, bs, &ctx->gb, ctx->ac_vlc.table,
+                DNXHD_VLC_BITS, 2);
+        level = ctx->cid_table->ac_level[index1];
     }
 
     CLOSE_READER(bs, &ctx->gb);



More information about the ffmpeg-cvslog mailing list