missmatch control for mpeg2 intra dequantization if bitexact=1

Originally committed as revision 5328 to svn://svn.ffmpeg.org/ffmpeg/trunk
pull/126/head
Michael Niedermayer 19 years ago
parent 6eb1427f0f
commit e27b6e62f7
  1. 3
      libavcodec/i386/mpegvideo_mmx.c
  2. 37
      libavcodec/mpegvideo.c
  3. 36
      tests/ffmpeg.regression.ref
  4. 6
      tests/libav.regression.ref
  5. 36
      tests/rotozoom.regression.ref

@ -699,7 +699,8 @@ void MPV_common_init_mmx(MpegEncContext *s)
s->dct_unquantize_h263_inter = dct_unquantize_h263_inter_mmx;
s->dct_unquantize_mpeg1_intra = dct_unquantize_mpeg1_intra_mmx;
s->dct_unquantize_mpeg1_inter = dct_unquantize_mpeg1_inter_mmx;
s->dct_unquantize_mpeg2_intra = dct_unquantize_mpeg2_intra_mmx;
if(!(s->flags & CODEC_FLAG_BITEXACT))
s->dct_unquantize_mpeg2_intra = dct_unquantize_mpeg2_intra_mmx;
s->dct_unquantize_mpeg2_inter = dct_unquantize_mpeg2_inter_mmx;
draw_edges = draw_edges_mmx;

@ -47,6 +47,8 @@ static void dct_unquantize_mpeg1_inter_c(MpegEncContext *s,
DCTELEM *block, int n, int qscale);
static void dct_unquantize_mpeg2_intra_c(MpegEncContext *s,
DCTELEM *block, int n, int qscale);
static void dct_unquantize_mpeg2_intra_bitexact(MpegEncContext *s,
DCTELEM *block, int n, int qscale);
static void dct_unquantize_mpeg2_inter_c(MpegEncContext *s,
DCTELEM *block, int n, int qscale);
static void dct_unquantize_h263_intra_c(MpegEncContext *s,
@ -266,6 +268,8 @@ int DCT_common_init(MpegEncContext *s)
s->dct_unquantize_mpeg1_intra = dct_unquantize_mpeg1_intra_c;
s->dct_unquantize_mpeg1_inter = dct_unquantize_mpeg1_inter_c;
s->dct_unquantize_mpeg2_intra = dct_unquantize_mpeg2_intra_c;
if(s->flags & CODEC_FLAG_BITEXACT)
s->dct_unquantize_mpeg2_intra = dct_unquantize_mpeg2_intra_bitexact;
s->dct_unquantize_mpeg2_inter = dct_unquantize_mpeg2_inter_c;
#ifdef CONFIG_ENCODERS
@ -6527,6 +6531,39 @@ static void dct_unquantize_mpeg2_intra_c(MpegEncContext *s,
}
}
static void dct_unquantize_mpeg2_intra_bitexact(MpegEncContext *s,
DCTELEM *block, int n, int qscale)
{
int i, level, nCoeffs;
const uint16_t *quant_matrix;
int sum=-1;
if(s->alternate_scan) nCoeffs= 63;
else nCoeffs= s->block_last_index[n];
if (n < 4)
block[0] = block[0] * s->y_dc_scale;
else
block[0] = block[0] * s->c_dc_scale;
quant_matrix = s->intra_matrix;
for(i=1;i<=nCoeffs;i++) {
int j= s->intra_scantable.permutated[i];
level = block[j];
if (level) {
if (level < 0) {
level = -level;
level = (int)(level * qscale * quant_matrix[j]) >> 3;
level = -level;
} else {
level = (int)(level * qscale * quant_matrix[j]) >> 3;
}
block[j] = level;
sum+=level;
}
}
block[63]^=sum&1;
}
static void dct_unquantize_mpeg2_inter_c(MpegEncContext *s,
DCTELEM *block, int n, int qscale)
{

@ -3,25 +3,25 @@ ffmpeg regression test
734274 ./data/a-mpeg1.mpg
eff964f940a35427fa9e8d35fb4f5699 *./data/out.yuv
stddev: 7.66 PSNR:30.43 bytes:7602176
5e1e8136cf2565f7cfbcfc7eda8d8f2b *./data/a-mpeg2.mpg
750226 ./data/a-mpeg2.mpg
27ddfd3e44537661eb14b96129a055ef *./data/out.yuv
stddev: 7.69 PSNR:30.40 bytes:7602176
004245d17ae9322ea3c6dc4b0f0554d6 *./data/a-mpeg2.mpg
746381 ./data/a-mpeg2.mpg
c7b9a71245912671889849ed560b67d3 *./data/out.yuv
stddev: 7.69 PSNR:30.40 bytes:7602176
59d4471ff2a9749824b4d813900afdfc *./data/a-mpeg2i.mpg
754366 ./data/a-mpeg2i.mpg
ddf889858529d09c8fe31c701deacd16 *./data/out.yuv
stddev: 7.71 PSNR:30.37 bytes:7602176
d0830d912bc594eeec4d3ec60d727d15 *./data/a-mpeg2thread.mpg
816727 ./data/a-mpeg2thread.mpg
664c5ac9185522238813c476b7b0570a *./data/out.yuv
a60d3fb60982786b9761a07c24664e9c *./data/a-mpeg2.mpg
747312 ./data/a-mpeg2.mpg
f5b8b9c2a5e162b6c01d6b299d03b117 *./data/out.yuv
stddev: 7.69 PSNR:30.39 bytes:7602176
a34af358ee5b5dab19d37ee29f1927b2 *./data/a-mpeg2.mpg
748099 ./data/a-mpeg2.mpg
555f76a5df78088411b83f5faf334762 *./data/out.yuv
stddev: 7.69 PSNR:30.39 bytes:7602176
5173c8b2e244a4ac12cca31ae1c19a0d *./data/a-mpeg2i.mpg
756437 ./data/a-mpeg2i.mpg
e29b8da1aeb96bb9c1a43a400958a11d *./data/out.yuv
stddev: 7.69 PSNR:30.39 bytes:7602176
367414ac9225222fc8ec9352485a7637 *./data/a-mpeg2thread.mpg
820348 ./data/a-mpeg2thread.mpg
6b820ffc74de50cc863b41d51f72c22b *./data/out.yuv
stddev: 7.64 PSNR:30.45 bytes:7602176
d948e29c0be5a78b75c0c7f3ecd8d29d *./data/a-mpeg2reuse.mpg
2114000 ./data/a-mpeg2reuse.mpg
55e78a12330b374db6910447db78ad46 *./data/out.yuv
edb3e58ea66de2e9b32713daf9b5c3f1 *./data/a-mpeg2reuse.mpg
2119706 ./data/a-mpeg2reuse.mpg
1dab2eaca5320fe01afbe9596b2bd6cc *./data/out.yuv
stddev: 7.68 PSNR:30.41 bytes:7602176
09086e7b020e9425a8f7e05372dbcfcd *./data/a-msmpeg4v2.avi
642666 ./data/a-msmpeg4v2.avi

@ -10,9 +10,9 @@ ffmpeg regression test
90784a1b9589095f20fc6bcc0cc23cc4 *./data/b-libav.mpg
387072 ./data/b-libav.mpg
./data/b-libav.mpg CRC=0x8b644837
c9050b51f6d6636cdda3160d43463bc3 *./data/b-libav.ts
479400 ./data/b-libav.ts
./data/b-libav.ts CRC=0x7968c81f
2933a367c996b49f4b7e66a481fb334e *./data/b-libav.ts
476768 ./data/b-libav.ts
./data/b-libav.ts CRC=0x0dd7fc5f
57a8dfc7926802bb337a9d8918de94a8 *./data/b-libav.swf
41816 ./data/b-libav.swf
./data/b-libav.swf CRC=0x2b273fea

@ -3,26 +3,26 @@ ffmpeg regression test
193481 ./data/a-mpeg1.mpg
ce245faede79604bb268f93689a490d6 *./data/out.yuv
stddev: 4.96 PSNR:34.21 bytes:7602176
a59a2a0d04768b9dcd51ab13f751f0ef *./data/a-mpeg2.mpg
199231 ./data/a-mpeg2.mpg
bccb76fc30fca87cc401e41f4c0ef154 *./data/out.yuv
f0310ea9b9a4f37c1a4dd0d4985a3f81 *./data/a-mpeg2.mpg
199396 ./data/a-mpeg2.mpg
94581e9516461557b194aeefaaba3835 *./data/out.yuv
stddev: 4.97 PSNR:34.18 bytes:7602176
eba2bff497863dbe8dad4a771fe14910 *./data/a-mpeg2.mpg
198404 ./data/a-mpeg2.mpg
107af0aac7f32378988469bd6eae9c31 *./data/out.yuv
stddev: 4.98 PSNR:34.17 bytes:7602176
8d0a7f9b0b4cb5a7e4980051994e1390 *./data/a-mpeg2i.mpg
205006 ./data/a-mpeg2i.mpg
d215d0f3cbbfb687a929ccf2dd1a034a *./data/out.yuv
stddev: 4.99 PSNR:34.16 bytes:7602176
20f7d29ae2d7eed5742b22c9d2ed5281 *./data/a-mpeg2thread.mpg
184113 ./data/a-mpeg2thread.mpg
b6cc35f5619c6f44c1c2bfbf01e55aec *./data/out.yuv
374bd257b96328935926b350b0c5cada *./data/a-mpeg2.mpg
198338 ./data/a-mpeg2.mpg
f464b420ae24c1e453df8d3e5ef9140d *./data/out.yuv
stddev: 4.98 PSNR:34.18 bytes:7602176
611f1707acde262e615511eab55d9f74 *./data/a-mpeg2i.mpg
205165 ./data/a-mpeg2i.mpg
8577a8f6bc2ad86fe93e0d1ded6df70a *./data/out.yuv
stddev: 4.98 PSNR:34.16 bytes:7602176
6a23281e0e268db8df62e9e9957ee583 *./data/a-mpeg2thread.mpg
183955 ./data/a-mpeg2thread.mpg
38441603e2201ddb01632ba3411a6bb8 *./data/out.yuv
stddev: 4.76 PSNR:34.56 bytes:7602176
57bc4a05ff7053dc988530714e91f6c2 *./data/a-mpeg2reuse.mpg
397335 ./data/a-mpeg2reuse.mpg
4f6b4006112516a6f939d61876f78eca *./data/out.yuv
stddev: 4.77 PSNR:34.54 bytes:7602176
c9f6617461caee57ccb6d438761527c8 *./data/a-mpeg2reuse.mpg
396729 ./data/a-mpeg2reuse.mpg
b10aec71132301cad001070e8ad46b7d *./data/out.yuv
stddev: 4.77 PSNR:34.55 bytes:7602176
dc68a5115d1bf1bb2eb2ce9bb237bd79 *./data/a-msmpeg4v2.avi
129504 ./data/a-msmpeg4v2.avi
25b5ba0b024fcd4028e707ffbeb80f55 *./data/out.yuv

Loading…
Cancel
Save