changeset 10959:d5320d1acaee libavcodec

Move dquant check into qscale overflow check. This should be faster (couldnt meassue a difference), and its less picky on slightly out of spec dquant.
author michael
date Thu, 21 Jan 2010 21:01:26 +0000
parents 304db572a69a
children 10759fd39860
files h264_cavlc.c
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/h264_cavlc.c	Thu Jan 21 16:50:31 2010 +0000
+++ b/h264_cavlc.c	Thu Jan 21 21:01:26 2010 +0000
@@ -936,15 +936,15 @@
 
         dquant= get_se_golomb(&s->gb);
 
-        if( dquant > 25 || dquant < -26 ){
-            av_log(h->s.avctx, AV_LOG_ERROR, "dquant out of range (%d) at %d %d\n", dquant, s->mb_x, s->mb_y);
-            return -1;
-        }
+        s->qscale += dquant;
 
-        s->qscale += dquant;
         if(((unsigned)s->qscale) > 51){
             if(s->qscale<0) s->qscale+= 52;
             else            s->qscale-= 52;
+            if(((unsigned)s->qscale) > 51){
+                av_log(h->s.avctx, AV_LOG_ERROR, "dquant out of range (%d) at %d %d\n", dquant, s->mb_x, s->mb_y);
+                return -1;
+            }
         }
 
         h->chroma_qp[0]= get_chroma_qp(h, 0, s->qscale);