huffyuvdec: decode the last odd sample

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Christophe Gisquet 2014-08-25 20:24:30 +00:00 committed by Michael Niedermayer
parent 6ee7681723
commit f75baa6c9b
3 changed files with 26 additions and 8 deletions

View File

@ -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);
}
}
}

View File

@ -1,4 +1,4 @@
9b3e44ccdd28614f588804a0682db312 *tests/data/fate/vsynth3-ffvhuff420p12.avi
175256 tests/data/fate/vsynth3-ffvhuff420p12.avi
faf8b5ec29b12ac41b1bd1a6ebd8a757 *tests/data/fate/vsynth3-ffvhuff420p12.out.rawvideo
stddev: 47.95 PSNR: 14.51 MAXDIFF: 237 bytes: 86700/ 86700
ee95a44ccd612b5057860b43fe9775d6 *tests/data/fate/vsynth3-ffvhuff420p12.out.rawvideo
stddev: 0.69 PSNR: 51.35 MAXDIFF: 1 bytes: 86700/ 86700

View File

@ -1,4 +1,4 @@
5afec2536440c892919a1569c7109858 *tests/data/fate/vsynth3-ffvhuff422p10left.avi
173548 tests/data/fate/vsynth3-ffvhuff422p10left.avi
7815024a7239be263c6bf910021df1a0 *tests/data/fate/vsynth3-ffvhuff422p10left.out.rawvideo
stddev: 38.41 PSNR: 16.44 MAXDIFF: 237 bytes: 86700/ 86700
0cf7cf68724fa5146b1667e4fa08b0e1 *tests/data/fate/vsynth3-ffvhuff422p10left.out.rawvideo
stddev: 2.12 PSNR: 41.58 MAXDIFF: 26 bytes: 86700/ 86700