X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fdv.c;h=413d50fb0d7ccc21452b7d06e1be6e3916dbbe6d;hb=ca1bae3983c6592efe4635e7e35a1f85833674b8;hp=462cbbed451cba4766f9b2394497318ec2045e7b;hpb=3638f56dca167a408b6da7fb78cade08780f7d85;p=ffmpeg diff --git a/libavcodec/dv.c b/libavcodec/dv.c index 462cbbed451..413d50fb0d7 100644 --- a/libavcodec/dv.c +++ b/libavcodec/dv.c @@ -37,7 +37,7 @@ * @file * DV codec. */ -#define ALT_BITSTREAM_READER + #include "libavutil/pixdesc.h" #include "avcodec.h" #include "dsputil.h" @@ -364,7 +364,7 @@ typedef struct BlockInfo { uint8_t pos; /* position in block */ void (*idct_put)(uint8_t *dest, int line_size, DCTELEM *block); uint8_t partial_bit_count; - uint16_t partial_bit_buffer; + uint32_t partial_bit_buffer; int shift_offset; } BlockInfo; @@ -392,8 +392,7 @@ static void dv_decode_ac(GetBitContext *gb, BlockInfo *mb, DCTELEM *block) /* if we must parse a partial VLC, we do it here */ if (partial_bit_count > 0) { - re_cache = ((unsigned)re_cache >> partial_bit_count) | - (mb->partial_bit_buffer << (sizeof(re_cache) * 8 - partial_bit_count)); + re_cache = re_cache >> partial_bit_count | mb->partial_bit_buffer; re_index -= partial_bit_count; mb->partial_bit_count = 0; } @@ -416,7 +415,7 @@ static void dv_decode_ac(GetBitContext *gb, BlockInfo *mb, DCTELEM *block) if (re_index + vlc_len > last_index) { /* should be < 16 bits otherwise a codeword could have been parsed */ mb->partial_bit_count = last_index - re_index; - mb->partial_bit_buffer = NEG_USR32(re_cache, mb->partial_bit_count); + mb->partial_bit_buffer = re_cache & ~(-1u >> mb->partial_bit_count); re_index = last_index; break; } @@ -758,7 +757,7 @@ static av_always_inline int dv_guess_dct_mode(DVVideoContext *s, uint8_t *data, if (ps > 0) { int is = s->ildct_cmp(NULL, data , NULL, linesize<<1, 4) + s->ildct_cmp(NULL, data + linesize, NULL, linesize<<1, 4); - return (ps > is); + return ps > is; } }