Commit 98b0858e authored by Michael Niedermayer's avatar Michael Niedermayer

constraint_parameter_flag fix

Originally committed as revision 2299 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent e4e70d2e
......@@ -189,6 +189,7 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s)
uint64_t time_code;
float best_aspect_error= 1E10;
float aspect_ratio= s->avctx->aspect_ratio;
int constraint_parameter_flag;
if(aspect_ratio==0.0) aspect_ratio= s->width / (float)s->height; //pixel aspect 1:1 (VGA)
......@@ -245,8 +246,18 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s)
put_bits(&s->pb, 18, v & 0x3FFFF);
put_bits(&s->pb, 1, 1); /* marker */
put_bits(&s->pb, 10, vbv_buffer_size & 0x3FF);
put_bits(&s->pb, 1, 1); /* constrained parameter flag */
put_bits(&s->pb, 10, vbv_buffer_size & 0x3FF);
constraint_parameter_flag=
s->width <= 768 && s->height <= 576 &&
s->mb_width * s->mb_height <= 396 &&
s->mb_width * s->mb_height * frame_rate_tab[s->frame_rate_index] <= MPEG1_FRAME_RATE_BASE*396*25 &&
frame_rate_tab[s->frame_rate_index] <= MPEG1_FRAME_RATE_BASE*30 &&
vbv_buffer_size <= 20 &&
v <= 1856000/400 &&
s->codec_id == CODEC_ID_MPEG1VIDEO;
put_bits(&s->pb, 1, constraint_parameter_flag);
ff_write_quant_matrix(&s->pb, s->avctx->intra_matrix);
ff_write_quant_matrix(&s->pb, s->avctx->inter_matrix);
......
ffmpeg regression test
b85daef6da4204e2f85376a34d9ada8d *./data/a-mpeg1.mpg
74e25b401f34321aeb854e264ef62df8 *./data/a-mpeg1.mpg
6713259d72260740bbddaea30631ea18 *./data/out.yuv
stddev: 7.58 bytes:7299072
88114b12ff7d0e0b54639814cf323841 *./data/a-mpeg2.vob
059aa59cb848fc278b278f816400d2bb *./data/a-mpeg2.vob
0f3dbc8ee895c7853e06b8dec279c666 *./data/out.yuv
stddev: 7.62 bytes:7299072
d0dc46dd831398237a690ebbeff18b64 *./data/a-msmpeg4v2.avi
......@@ -35,7 +35,7 @@ stddev: 10.53 bytes:7145472
2cbab98ebef5fbd229c66fb6435bf9a2 *./data/a-mpeg4-adv.avi
b54262af56f6681186fa2c44e4ef6ec7 *./data/out.yuv
stddev: 7.32 bytes:7602176
fbc13e69385301ae9b8ba34b5baa7881 *./data/a-mpeg1b.mpg
843225ac495abfcc480296143c26bde3 *./data/a-mpeg1b.mpg
da8e21c7b78b7a25558dc319524b91d8 *./data/out.yuv
stddev: 6.32 bytes:6842368
07042f42b3119c39eb26537a84a451df *./data/a-mjpeg.avi
......
ffmpeg regression test
31334d408162b55725075347e382d313 *./data/a-mpeg1.mpg
a6ccb5e768c7bed7a08f8e4343d81871 *./data/a-mpeg1.mpg
0cf790edd0f4c5cf993c2d59211b9de2 *./data/out.yuv
stddev: 4.91 bytes:7299072
e75529f50f81fa8d102938d9f3f85471 *./data/a-mpeg2.vob
37762c54fafba01dd08ce4584b92b850 *./data/a-mpeg2.vob
e32c521f104a6e11b26a6165bcad33f7 *./data/out.yuv
stddev: 4.93 bytes:7299072
14db391f167b52b21a983157b410affc *./data/a-msmpeg4v2.avi
......@@ -35,7 +35,7 @@ stddev: 4.32 bytes:7145472
aeb300900461bdf9e0321934aa6dcc93 *./data/a-mpeg4-adv.avi
e465df12f2c8a6492a6ec0b1bddc1d0d *./data/out.yuv
stddev: 4.97 bytes:7602176
d48038039d4874ebaeeb5fe8346d1350 *./data/a-mpeg1b.mpg
fd09e45413a6b6e3a19bf9dd77503b17 *./data/a-mpeg1b.mpg
71e80b8ff8da567f1bbff000cd925627 *./data/out.yuv
stddev: 4.07 bytes:6842368
e9218a1db885fe0262e88f9df630307d *./data/a-mjpeg.avi
......
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