[FFmpeg-cvslog] r23915 - in trunk/libavcodec: Makefile vp56.h

stefang subversion
Thu Jul 1 00:05:29 CEST 2010


Author: stefang
Date: Thu Jul  1 00:05:29 2010
New Revision: 23915

Log:
renormalize VP5/6/7/8 range coder without loop

Modified:
   trunk/libavcodec/Makefile
   trunk/libavcodec/vp56.h

Modified: trunk/libavcodec/Makefile
==============================================================================
--- trunk/libavcodec/Makefile	Wed Jun 30 23:46:03 2010	(r23914)
+++ trunk/libavcodec/Makefile	Thu Jul  1 00:05:29 2010	(r23915)
@@ -376,7 +376,7 @@ OBJS-$(CONFIG_VP5_DECODER)             +
 OBJS-$(CONFIG_VP6_DECODER)             += vp6.o vp56.o vp56data.o vp56dsp.o \
                                           vp3dsp.o vp6dsp.o huffman.o
 OBJS-$(CONFIG_VP8_DECODER)             += vp8.o vp8dsp.o vp56.o vp56data.o \
-                                          h264pred.o
+                                          h264pred.o cabac.o
 OBJS-$(CONFIG_VQA_DECODER)             += vqavideo.o
 OBJS-$(CONFIG_WAVPACK_DECODER)         += wavpack.o
 OBJS-$(CONFIG_WMAPRO_DECODER)          += wmaprodec.o wma.o

Modified: trunk/libavcodec/vp56.h
==============================================================================
--- trunk/libavcodec/vp56.h	Wed Jun 30 23:46:03 2010	(r23914)
+++ trunk/libavcodec/vp56.h	Thu Jul  1 00:05:29 2010	(r23915)
@@ -28,6 +28,7 @@
 #include "dsputil.h"
 #include "get_bits.h"
 #include "bytestream.h"
+#include "cabac.h"
 #include "vp56dsp.h"
 
 typedef struct vp56_context VP56Context;
@@ -195,6 +196,7 @@ static inline int vp56_rac_get_prob(VP56
     unsigned int low = 1 + (((c->high - 1) * prob) >> 8);
     unsigned int low_shift = low << 8;
     int bit = c->code_word >= low_shift;
+    int shift;
 
     if (bit) {
         c->high -= low;
@@ -204,13 +206,13 @@ static inline int vp56_rac_get_prob(VP56
     }
 
     /* normalize */
-    while (c->high < 128) {
-        c->high <<= 1;
-        c->code_word <<= 1;
-        if (--c->bits == 0 && c->buffer < c->end) {
-            c->bits = 8;
-            c->code_word |= *c->buffer++;
-        }
+    shift = ff_h264_norm_shift[c->high] - 1;
+    c->high      <<= shift;
+    c->code_word <<= shift;
+    c->bits       -= shift;
+    if(c->bits <= 0 && c->buffer < c->end) {
+        c->code_word |= *c->buffer++ << -c->bits;
+        c->bits += 8;
     }
     return bit;
 }



More information about the ffmpeg-cvslog mailing list