diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2003-09-24 00:06:33 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2003-09-24 00:06:33 +0000 |
commit | 98b0858e1089a65f25041868adf6c00e43861846 (patch) | |
tree | 57979785ce0f8b227908761610056aeeff51b391 | |
parent | e4e70d2e2db9d47d6e85a5136aad0147eb8c5809 (diff) | |
download | ffmpeg-98b0858e1089a65f25041868adf6c00e43861846.tar.gz |
constraint_parameter_flag fix
Originally committed as revision 2299 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavcodec/mpeg12.c | 15 | ||||
-rw-r--r-- | tests/ffmpeg.regression.ref | 6 | ||||
-rw-r--r-- | tests/rotozoom.regression.ref | 6 |
3 files changed, 19 insertions, 8 deletions
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c index ba352d5c4c..b92d071503 100644 --- a/libavcodec/mpeg12.c +++ b/libavcodec/mpeg12.c @@ -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); diff --git a/tests/ffmpeg.regression.ref b/tests/ffmpeg.regression.ref index 970fbbea6d..620a973146 100644 --- a/tests/ffmpeg.regression.ref +++ b/tests/ffmpeg.regression.ref @@ -1,8 +1,8 @@ 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 diff --git a/tests/rotozoom.regression.ref b/tests/rotozoom.regression.ref index 2834a19160..18c2377879 100644 --- a/tests/rotozoom.regression.ref +++ b/tests/rotozoom.regression.ref @@ -1,8 +1,8 @@ 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 |