changeset 1479:f718b60fedc2 libavcodec

constraint_parameter_flag fix
author michaelni
date Wed, 24 Sep 2003 00:06:33 +0000
parents e0402982c1a0
children 8657d6800d15
files mpeg12.c
diffstat 1 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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);