# HG changeset patch # User michaelni # Date 1064361993 0 # Node ID f718b60fedc211700777785468064c0e5e83b353 # Parent e0402982c1a0f8d324cab38ff2fc6f59b540c4c0 constraint_parameter_flag fix diff -r e0402982c1a0 -r f718b60fedc2 mpeg12.c --- a/mpeg12.c Mon Sep 22 20:29:58 2003 +0000 +++ b/mpeg12.c Wed Sep 24 00:06:33 2003 +0000 @@ -189,6 +189,7 @@ 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 @@ 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);