aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Gisquet <christophe.gisquet@gmail.com>2014-06-04 20:48:58 +0000
committerMichael Niedermayer <michaelni@gmx.at>2014-06-05 01:47:07 +0200
commit6848325acb80bb9a33d154b787db13c9d53b5a63 (patch)
tree89164d31c4533459eed63d052a3ca3375ebab474
parenta37020402a4c0c1f375bb7323ed5f79c2c75c538 (diff)
downloadffmpeg-6848325acb80bb9a33d154b787db13c9d53b5a63.tar.gz
huffyuvdec: remove superfluous check
An invalid entry already has the property of having a negative number of bits, so remove the check on the reserved value, and rearrange the code as a consequence. 346800 decicycles in 422, 262079 runs, 65 skips 168197 decicycles in gray, 262077 runs, 67 skips Overall time: 7.878s 319076 decicycles in 422, 262096 runs, 48 skips 159875 decicycles in gray, 262057 runs, 87 skips Overall time: 7.394s Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/huffyuvdec.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c
index 01c01ce00b..dc803cd931 100644
--- a/libavcodec/huffyuvdec.c
+++ b/libavcodec/huffyuvdec.c
@@ -586,13 +586,13 @@ static av_cold int decode_init_thread_copy(AVCodecContext *avctx)
#define GET_VLC_DUAL(dst0, dst1, name, gb, dtable, table1, table2, \
- bits, max_depth, rsvd ) \
+ bits, max_depth) \
do { \
unsigned int index = SHOW_UBITS(name, gb, bits); \
- int code = dtable[index][0]; \
- int n = dtable[index][1]; \
+ int code, n = dtable[index][1]; \
\
- if (code != rsvd && n>0) { \
+ if (n>0) { \
+ code = dtable[index][0]; \
dst0 = code>>8; \
dst1 = code; \
LAST_SKIP_BITS(name, gb, n); \
@@ -609,8 +609,7 @@ static av_cold int decode_init_thread_copy(AVCodecContext *avctx)
#define READ_2PIX(dst0, dst1, plane1)\
UPDATE_CACHE(re, &s->gb); \
GET_VLC_DUAL(dst0, dst1, re, &s->gb, s->vlc[4+plane1].table, \
- s->vlc[0].table, s->vlc[plane1].table, \
- VLC_BITS, 3, 0xffff)
+ s->vlc[0].table, s->vlc[plane1].table, VLC_BITS, 3)
static void decode_422_bitstream(HYuvContext *s, int count)
{
@@ -640,8 +639,7 @@ static void decode_422_bitstream(HYuvContext *s, int count)
#define READ_2PIX_PLANE(dst0, dst1, plane) \
UPDATE_CACHE(re, &s->gb); \
GET_VLC_DUAL(dst0, dst1, re, &s->gb, s->vlc[4+plane].table, \
- s->vlc[plane].table, s->vlc[plane].table, \
- VLC_BITS, 3, 0xffff)
+ s->vlc[plane].table, s->vlc[plane].table, VLC_BITS, 3)
#define READ_2PIX_PLANE14(dst0, dst1, plane){\
int16_t code = get_vlc2(&s->gb, s->vlc[4+plane].table, VLC_BITS, 1);\