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 /libavcodec/mpeg12.c | |
parent | e4e70d2e2db9d47d6e85a5136aad0147eb8c5809 (diff) | |
download | ffmpeg-98b0858e1089a65f25041868adf6c00e43861846.tar.gz |
constraint_parameter_flag fix
Originally committed as revision 2299 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mpeg12.c')
-rw-r--r-- | libavcodec/mpeg12.c | 15 |
1 files changed, 13 insertions, 2 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); |