diff options
author | Christophe Gisquet <christophe.gisquet@gmail.com> | 2014-08-25 20:24:30 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-08-25 23:24:07 +0200 |
commit | f75baa6c9b1784866f3ecd7ec2ee223644c38e7b (patch) | |
tree | e344789cca9231752e33e44044d01ae8d98df0bf /libavcodec | |
parent | 6ee7681723a41c8c9bf5f3d11c723c6907848f7d (diff) | |
download | ffmpeg-f75baa6c9b1784866f3ecd7ec2ee223644c38e7b.tar.gz |
huffyuvdec: decode the last odd sample
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/huffyuvdec.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c index bc5ad151fb..1df77e0893 100644 --- a/libavcodec/huffyuvdec.c +++ b/libavcodec/huffyuvdec.c @@ -660,11 +660,9 @@ static void decode_422_bitstream(HYuvContext *s, int count) dst1 = get_vlc2(&s->gb, s->vlc[plane].table, VLC_BITS, 3)<<2;\ dst1 += get_bits(&s->gb, 2);\ } -static void decode_plane_bitstream(HYuvContext *s, int count, int plane) +static void decode_plane_bitstream(HYuvContext *s, int width, int plane) { - int i; - - count /= 2; + int i, count = width/2; if (s->bps <= 8) { OPEN_READER(re, &s->gb); @@ -677,6 +675,14 @@ static void decode_plane_bitstream(HYuvContext *s, int count, int plane) READ_2PIX_PLANE(s->temp[0][2 * i], s->temp[0][2 * i + 1], plane, OP8bits); } } + if( width&1 && BITS_LEFT(re, &s->gb)>0 ) { + unsigned int index; + int nb_bits, code, n; + UPDATE_CACHE(re, &s->gb); + index = SHOW_UBITS(re, &s->gb, VLC_BITS); + VLC_INTERN(s->temp[0][width-1], s->vlc[plane].table, + &s->gb, re, VLC_BITS, 3); + } CLOSE_READER(re, &s->gb); } else if (s->bps <= 14) { OPEN_READER(re, &s->gb); @@ -689,6 +695,14 @@ static void decode_plane_bitstream(HYuvContext *s, int count, int plane) READ_2PIX_PLANE(s->temp16[0][2 * i], s->temp16[0][2 * i + 1], plane, OP14bits); } } + if( width&1 && BITS_LEFT(re, &s->gb)>0 ) { + unsigned int index; + int nb_bits, code, n; + UPDATE_CACHE(re, &s->gb); + index = SHOW_UBITS(re, &s->gb, VLC_BITS); + VLC_INTERN(s->temp16[0][width-1], s->vlc[plane].table, + &s->gb, re, VLC_BITS, 3); + } CLOSE_READER(re, &s->gb); } else { if (count >= (get_bits_left(&s->gb)) / (32 * 2)) { @@ -700,6 +714,10 @@ static void decode_plane_bitstream(HYuvContext *s, int count, int plane) READ_2PIX_PLANE16(s->temp16[0][2 * i], s->temp16[0][2 * i + 1], plane); } } + if( width&1 && get_bits_left(&s->gb)>0 ) { + int dst = get_vlc2(&s->gb, s->vlc[plane].table, VLC_BITS, 3)<<2; + s->temp16[0][width-1] = dst + get_bits(&s->gb, 2); + } } } |