From 98b0858e1089a65f25041868adf6c00e43861846 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 24 Sep 2003 00:06:33 +0000 Subject: constraint_parameter_flag fix Originally committed as revision 2299 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/mpeg12.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'libavcodec') diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c index ba352d5..b92d071 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); -- cgit v1.1