Commit bd57cae8 authored by Michael Niedermayer's avatar Michael Niedermayer
Browse files

use mpeg2 quantization bias for mjpeg.

this seems to improve RD performance.

Originally committed as revision 22550 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent db128802
......@@ -503,10 +503,7 @@ av_cold int MPV_encode_init(AVCodecContext *avctx)
// return -1;
}
if(s->codec_id==CODEC_ID_MJPEG){
s->intra_quant_bias= 1<<(QUANT_BIAS_SHIFT-1); //(a + x/2)/x
s->inter_quant_bias= 0;
}else if(s->mpeg_quant || s->codec_id==CODEC_ID_MPEG1VIDEO || s->codec_id==CODEC_ID_MPEG2VIDEO){
if(s->mpeg_quant || s->codec_id==CODEC_ID_MPEG1VIDEO || s->codec_id==CODEC_ID_MPEG2VIDEO || s->codec_id==CODEC_ID_MJPEG){
s->intra_quant_bias= 3<<(QUANT_BIAS_SHIFT-3); //(a + x*3/8)/x
s->inter_quant_bias= 0;
}else{
......
......@@ -150,7 +150,7 @@ do_video_decoding
fi
if [ -n "$do_mjpeg" ] ; then
do_video_encoding mjpeg.avi "-qscale 10" "-an -vcodec mjpeg -pix_fmt yuvj420p"
do_video_encoding mjpeg.avi "-qscale 9" "-an -vcodec mjpeg -pix_fmt yuvj420p"
do_video_decoding "" "-pix_fmt yuv420p"
fi
......
d56c19d41e9754939ea0f15d09bc4a32 *./tests/data/images/jpg/02.jpg
./tests/data/images/jpg/%02d.jpg CRC=0xb8bc5a32
31763 ./tests/data/images/jpg/02.jpg
131878fee153a086d740543fbf2ab359 *./tests/data/images/jpg/02.jpg
./tests/data/images/jpg/%02d.jpg CRC=0x8b019f23
28406 ./tests/data/images/jpg/02.jpg
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: -1 size: 31351
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: -1 size: 28070
ret:-EINVAL st:-1 flags:0 ts:-1.000000
ret:-EINVAL st:-1 flags:1 ts: 1.894167
ret:-EINVAL st: 0 flags:0 ts: 0.800000
......
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 12650
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 12096
ret: 0 st:-1 flags:0 ts:-1.000000
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 12650
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 12096
ret: 0 st:-1 flags:1 ts: 1.894167
ret: 0 st: 0 flags:1 dts: 1.880000 pts: 1.880000 pos: 656618 size: 15508
ret: 0 st: 0 flags:1 dts: 1.880000 pts: 1.880000 pos: 627866 size: 14811
ret: 0 st: 0 flags:0 ts: 0.800000
ret: 0 st: 0 flags:1 dts: 0.800000 pts: 0.800000 pos: 258298 size: 13522
ret: 0 st: 0 flags:1 dts: 0.800000 pts: 0.800000 pos: 247500 size: 12959
ret:-1 st: 0 flags:1 ts:-0.320000
ret:-1 st:-1 flags:0 ts: 2.576668
ret: 0 st:-1 flags:1 ts: 1.470835
ret: 0 st: 0 flags:1 dts: 1.480000 pts: 1.480000 pos: 502632 size: 15224
ret: 0 st: 0 flags:1 dts: 1.480000 pts: 1.480000 pos: 480770 size: 14528
ret: 0 st: 0 flags:0 ts: 0.360000
ret: 0 st: 0 flags:1 dts: 0.360000 pts: 0.360000 pos: 115666 size: 12453
ret: 0 st: 0 flags:1 dts: 0.360000 pts: 0.360000 pos: 111012 size: 11927
ret:-1 st: 0 flags:1 ts:-0.760000
ret:-1 st:-1 flags:0 ts: 2.153336
ret: 0 st:-1 flags:1 ts: 1.047503
ret: 0 st: 0 flags:1 dts: 1.040000 pts: 1.040000 pos: 341140 size: 14170
ret: 0 st: 0 flags:1 dts: 1.040000 pts: 1.040000 pos: 326684 size: 13489
ret: 0 st: 0 flags:0 ts:-0.040000
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 12650
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 12096
ret: 0 st: 0 flags:1 ts: 2.840000
ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos: 687716 size: 15576
ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos: 657534 size: 14881
ret: 0 st:-1 flags:0 ts: 1.730004
ret: 0 st: 0 flags:1 dts: 1.720000 pts: 1.720000 pos: 594720 size: 15432
ret: 0 st: 0 flags:1 dts: 1.720000 pts: 1.720000 pos: 568664 size: 14746
ret: 0 st:-1 flags:1 ts: 0.624171
ret: 0 st: 0 flags:1 dts: 0.640000 pts: 0.640000 pos: 204894 size: 13273
ret: 0 st: 0 flags:1 dts: 0.640000 pts: 0.640000 pos: 196428 size: 12719
ret: 0 st: 0 flags:0 ts:-0.480000
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 12650
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 12096
ret: 0 st: 0 flags:1 ts: 2.400000
ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos: 687716 size: 15576
ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos: 657534 size: 14881
ret: 0 st:-1 flags:0 ts: 1.306672
ret: 0 st: 0 flags:1 dts: 1.320000 pts: 1.320000 pos: 442576 size: 14799
ret: 0 st: 0 flags:1 dts: 1.320000 pts: 1.320000 pos: 423494 size: 14119
ret: 0 st:-1 flags:1 ts: 0.200839
ret: 0 st: 0 flags:1 dts: 0.200000 pts: 0.200000 pos: 66366 size: 12233
ret: 0 st: 0 flags:1 dts: 0.200000 pts: 0.200000 pos: 63872 size: 11714
ret: 0 st: 0 flags:0 ts:-0.920000
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 12650
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 12096
ret: 0 st: 0 flags:1 ts: 2.000000
ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos: 687716 size: 15576
ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos: 657534 size: 14881
ret: 0 st:-1 flags:0 ts: 0.883340
ret: 0 st: 0 flags:1 dts: 0.880000 pts: 0.880000 pos: 285502 size: 13726
ret: 0 st: 0 flags:1 dts: 0.880000 pts: 0.880000 pos: 273520 size: 13131
ret:-1 st:-1 flags:1 ts:-0.222493
ret:-1 st: 0 flags:0 ts: 2.680000
ret: 0 st: 0 flags:1 ts: 1.560000
ret: 0 st: 0 flags:1 dts: 1.560000 pts: 1.560000 pos: 533212 size: 15322
ret: 0 st: 0 flags:1 dts: 1.560000 pts: 1.560000 pos: 509938 size: 14597
ret: 0 st:-1 flags:0 ts: 0.460008
ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 153232 size: 12726
ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146970 size: 12168
ret:-1 st:-1 flags:1 ts:-0.645825
af7ddc0d60cb2d1d83b0bfd829cc7b3a *./tests/data/vsynth1/mjpeg.avi
1570366 ./tests/data/vsynth1/mjpeg.avi
556ba548fe2b1b4ca98ef3f5d5e94bb8 *./tests/data/mjpeg.vsynth1.out.yuv
stddev: 7.92 PSNR: 30.15 bytes: 7603200/ 7603200
8bbf9513b1822945539f27a6eff3c7fa *./tests/data/vsynth1/mjpeg.avi
1516140 ./tests/data/vsynth1/mjpeg.avi
c6ae81b5b896e4d05ff584311aebdb18 *./tests/data/mjpeg.vsynth1.out.yuv
stddev: 7.87 PSNR: 30.21 bytes: 7603200/ 7603200
765b2637f313eda33afdcdc384bfbc06 *./tests/data/vsynth2/mjpeg.avi
704100 ./tests/data/vsynth2/mjpeg.avi
3dc419bf8ddc7482d811e4c9dcf9d418 *./tests/data/mjpeg.vsynth2.out.yuv
stddev: 4.38 PSNR: 35.29 bytes: 7603200/ 7603200
89df32b46c977fb4cb140ec6c489dd76 *./tests/data/vsynth2/mjpeg.avi
673224 ./tests/data/vsynth2/mjpeg.avi
a96a4e15ffcb13e44360df642d049496 *./tests/data/mjpeg.vsynth2.out.yuv
stddev: 4.32 PSNR: 35.40 bytes: 7603200/ 7603200
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment