Mercurial > libavcodec.hg
comparison mpeg12.c @ 1479:f718b60fedc2 libavcodec
constraint_parameter_flag fix
| author | michaelni |
|---|---|
| date | Wed, 24 Sep 2003 00:06:33 +0000 |
| parents | 7406ed4479f7 |
| children | a2930ee10a6b |
comparison
equal
deleted
inserted
replaced
| 1478:e0402982c1a0 | 1479:f718b60fedc2 |
|---|---|
| 187 unsigned int fps, v; | 187 unsigned int fps, v; |
| 188 int n, i; | 188 int n, i; |
| 189 uint64_t time_code; | 189 uint64_t time_code; |
| 190 float best_aspect_error= 1E10; | 190 float best_aspect_error= 1E10; |
| 191 float aspect_ratio= s->avctx->aspect_ratio; | 191 float aspect_ratio= s->avctx->aspect_ratio; |
| 192 int constraint_parameter_flag; | |
| 192 | 193 |
| 193 if(aspect_ratio==0.0) aspect_ratio= s->width / (float)s->height; //pixel aspect 1:1 (VGA) | 194 if(aspect_ratio==0.0) aspect_ratio= s->width / (float)s->height; //pixel aspect 1:1 (VGA) |
| 194 | 195 |
| 195 if (s->current_picture.key_frame) { | 196 if (s->current_picture.key_frame) { |
| 196 /* mpeg1 header repeated every gop */ | 197 /* mpeg1 header repeated every gop */ |
| 243 vbv_buffer_size = (( 20 * s->bit_rate) / (1151929 / 2)) * 8 * 1024; | 244 vbv_buffer_size = (( 20 * s->bit_rate) / (1151929 / 2)) * 8 * 1024; |
| 244 vbv_buffer_size= (vbv_buffer_size + 16383) / 16384; | 245 vbv_buffer_size= (vbv_buffer_size + 16383) / 16384; |
| 245 | 246 |
| 246 put_bits(&s->pb, 18, v & 0x3FFFF); | 247 put_bits(&s->pb, 18, v & 0x3FFFF); |
| 247 put_bits(&s->pb, 1, 1); /* marker */ | 248 put_bits(&s->pb, 1, 1); /* marker */ |
| 248 put_bits(&s->pb, 10, vbv_buffer_size & 0x3FF); | 249 put_bits(&s->pb, 10, vbv_buffer_size & 0x3FF); |
| 249 put_bits(&s->pb, 1, 1); /* constrained parameter flag */ | 250 |
| 251 constraint_parameter_flag= | |
| 252 s->width <= 768 && s->height <= 576 && | |
| 253 s->mb_width * s->mb_height <= 396 && | |
| 254 s->mb_width * s->mb_height * frame_rate_tab[s->frame_rate_index] <= MPEG1_FRAME_RATE_BASE*396*25 && | |
| 255 frame_rate_tab[s->frame_rate_index] <= MPEG1_FRAME_RATE_BASE*30 && | |
| 256 vbv_buffer_size <= 20 && | |
| 257 v <= 1856000/400 && | |
| 258 s->codec_id == CODEC_ID_MPEG1VIDEO; | |
| 259 | |
| 260 put_bits(&s->pb, 1, constraint_parameter_flag); | |
| 250 | 261 |
| 251 ff_write_quant_matrix(&s->pb, s->avctx->intra_matrix); | 262 ff_write_quant_matrix(&s->pb, s->avctx->intra_matrix); |
| 252 ff_write_quant_matrix(&s->pb, s->avctx->inter_matrix); | 263 ff_write_quant_matrix(&s->pb, s->avctx->inter_matrix); |
| 253 | 264 |
| 254 if(s->codec_id == CODEC_ID_MPEG2VIDEO){ | 265 if(s->codec_id == CODEC_ID_MPEG2VIDEO){ |
