aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorStefan Gehrer <stefan.gehrer@gmx.de>2010-06-30 22:05:29 +0000
committerStefan Gehrer <stefan.gehrer@gmx.de>2010-06-30 22:05:29 +0000
commitbce3bd1ced8ff651d141f3d4f09e9ed903fee325 (patch)
tree1e293cd9c25bec8255d528b3d57a7ddd2f941de2 /libavcodec
parent0db2d3cf1d8b6483160707e1ee0f0574b13c30c6 (diff)
downloadffmpeg-bce3bd1ced8ff651d141f3d4f09e9ed903fee325.tar.gz
renormalize VP5/6/7/8 range coder without loop
Originally committed as revision 23915 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/Makefile2
-rw-r--r--libavcodec/vp56.h16
2 files changed, 10 insertions, 8 deletions
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index c0531c62c8..8184e18e66 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -376,7 +376,7 @@ OBJS-$(CONFIG_VP5_DECODER) += vp5.o vp56.o vp56data.o vp56dsp.o \
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
diff --git a/libavcodec/vp56.h b/libavcodec/vp56.h
index 4eb414bbbe..8e0d7b5ac3 100644
--- a/libavcodec/vp56.h
+++ b/libavcodec/vp56.h
@@ -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(VP56RangeCoder *c, uint8_t prob)
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(VP56RangeCoder *c, uint8_t prob)
}
/* 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;
}