huffyuvdec: decode the last odd sample

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
pull/85/head
Christophe Gisquet 10 years ago committed by Michael Niedermayer
parent 6ee7681723
commit f75baa6c9b
  1. 26
      libavcodec/huffyuvdec.c
  2. 4
      tests/ref/vsynth/vsynth3-ffvhuff420p12
  3. 4
      tests/ref/vsynth/vsynth3-ffvhuff422p10left

@ -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_vlc2(&s->gb, s->vlc[plane].table, VLC_BITS, 3)<<2;\
dst1 += get_bits(&s->gb, 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; int i, count = width/2;
count /= 2;
if (s->bps <= 8) { if (s->bps <= 8) {
OPEN_READER(re, &s->gb); 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); 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); CLOSE_READER(re, &s->gb);
} else if (s->bps <= 14) { } else if (s->bps <= 14) {
OPEN_READER(re, &s->gb); 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); 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); CLOSE_READER(re, &s->gb);
} else { } else {
if (count >= (get_bits_left(&s->gb)) / (32 * 2)) { 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); 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);
}
} }
} }

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

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

Loading…
Cancel
Save