[FFmpeg-cvslog] h261dec, ituh263dec: Move condition.

Reimar Döffinger git at videolan.org
Mon Sep 1 19:42:36 CEST 2014


ffmpeg | branch: master | Reimar Döffinger <Reimar.Doeffinger at gmx.de> | Sun Aug 31 23:01:09 2014 +0200| [e8d0b84e8a5893ed29993e743de82079c93b5fb6] | committer: Reimar Döffinger

h261dec, ituh263dec: Move condition.

Stops compiler from doing incredibly stupid things.
With vsynth1-flv inner loop goes from 3501 to 3275
decicycles.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger at gmx.de>

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

 libavcodec/h261dec.c    |   12 ++++++------
 libavcodec/ituh263dec.c |   10 +++++-----
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c
index 9b95775..a8aae6e 100644
--- a/libavcodec/h261dec.c
+++ b/libavcodec/h261dec.c
@@ -309,13 +309,13 @@ static int h261_decode_block(H261Context *h, int16_t *block, int n, int coded)
     for (;;) {
         UPDATE_CACHE(re, &s->gb);
         GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TCOEFF_VLC_BITS, 2, 0);
-        if (run == 66 && level) {
-            CLOSE_READER(re, &s->gb);
-            av_log(s->avctx, AV_LOG_ERROR, "illegal ac vlc code at %dx%d\n",
-                   s->mb_x, s->mb_y);
-            return -1;
-        }
         if (run == 66) {
+            if (level) {
+                CLOSE_READER(re, &s->gb);
+                av_log(s->avctx, AV_LOG_ERROR, "illegal ac vlc code at %dx%d\n",
+                       s->mb_x, s->mb_y);
+                return -1;
+            }
             /* escape */
             /* The remaining combinations of (run, level) are encoded with a
              * 20-bit word consisting of 6 bits escape, 6 bits run and 8 bits
diff --git a/libavcodec/ituh263dec.c b/libavcodec/ituh263dec.c
index 7be56bf..70a8ffe 100644
--- a/libavcodec/ituh263dec.c
+++ b/libavcodec/ituh263dec.c
@@ -485,12 +485,12 @@ retry:
     for(;;) {
         UPDATE_CACHE(re, &s->gb);
         GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2, 0);
-        if (run == 66 && level){
-            CLOSE_READER(re, &s->gb);
-            av_log(s->avctx, AV_LOG_ERROR, "illegal ac vlc code at %dx%d\n", s->mb_x, s->mb_y);
-            return -1;
-        }
         if (run == 66) {
+            if (level){
+                CLOSE_READER(re, &s->gb);
+                av_log(s->avctx, AV_LOG_ERROR, "illegal ac vlc code at %dx%d\n", s->mb_x, s->mb_y);
+                return -1;
+            }
             /* escape */
             if (CONFIG_FLV_DECODER && s->h263_flv > 1) {
                 int is11 = SHOW_UBITS(re, &s->gb, 1);



More information about the ffmpeg-cvslog mailing list