Mercurial > libavcodec.hg
comparison mpeg12.c @ 4454:c9ce397604f0 libavcodec
correctly set profile/level for hd
| author | bcoudurier |
|---|---|
| date | Thu, 01 Feb 2007 09:47:36 +0000 |
| parents | d9cd0e5255d7 |
| children | ff5472c81ab8 |
comparison
equal
deleted
inserted
replaced
| 4453:22827cd6b228 | 4454:c9ce397604f0 |
|---|---|
| 232 }else{ | 232 }else{ |
| 233 av_log(avctx, AV_LOG_INFO, "MPEG1/2 does not support %d/%d fps, there may be AV sync issues\n", avctx->time_base.den, avctx->time_base.num); | 233 av_log(avctx, AV_LOG_INFO, "MPEG1/2 does not support %d/%d fps, there may be AV sync issues\n", avctx->time_base.den, avctx->time_base.num); |
| 234 } | 234 } |
| 235 } | 235 } |
| 236 | 236 |
| 237 if(avctx->profile == FF_PROFILE_UNKNOWN) | 237 if(avctx->profile == FF_PROFILE_UNKNOWN){ |
| 238 avctx->profile = s->chroma_format == CHROMA_420 ? 4 : 0; | 238 if(avctx->level != FF_LEVEL_UNKNOWN){ |
| 239 | 239 av_log(avctx, AV_LOG_ERROR, "Set profile and level\n"); |
| 240 if(avctx->level == FF_LEVEL_UNKNOWN) | 240 return -1; |
| 241 avctx->level = s->chroma_format == CHROMA_420 ? 8 : 5; | 241 } |
| 242 avctx->profile = s->chroma_format == CHROMA_420 ? 4 : 0; /* Main or 4:2:2 */ | |
| 243 } | |
| 244 | |
| 245 if(avctx->level == FF_LEVEL_UNKNOWN){ | |
| 246 if(avctx->profile == 0){ /* 4:2:2 */ | |
| 247 if(avctx->width <= 720 && avctx->height <= 608) avctx->level = 5; /* Main */ | |
| 248 else avctx->level = 2; /* High */ | |
| 249 }else{ | |
| 250 if(avctx->profile != 1 && s->chroma_format != CHROMA_420){ | |
| 251 av_log(avctx, AV_LOG_ERROR, "Only High(1) and 4:2:2(0) profiles support 4:2:2 color sampling\n"); | |
| 252 return -1; | |
| 253 } | |
| 254 if(avctx->width <= 720 && avctx->height <= 576) avctx->level = 8; /* Main */ | |
| 255 else if(avctx->width <= 1440) avctx->level = 6; /* High 1440 */ | |
| 256 else avctx->level = 4; /* High */ | |
| 257 } | |
| 258 } | |
| 242 | 259 |
| 243 if((avctx->flags2 & CODEC_FLAG2_DROP_FRAME_TIMECODE) && s->frame_rate_index != 4){ | 260 if((avctx->flags2 & CODEC_FLAG2_DROP_FRAME_TIMECODE) && s->frame_rate_index != 4){ |
| 244 av_log(avctx, AV_LOG_ERROR, "Drop frame time code only allowed with 1001/30000 fps\n"); | 261 av_log(avctx, AV_LOG_ERROR, "Drop frame time code only allowed with 1001/30000 fps\n"); |
| 245 return -1; | 262 return -1; |
| 246 } | 263 } |
| 331 | 348 |
| 332 if(s->codec_id == CODEC_ID_MPEG2VIDEO){ | 349 if(s->codec_id == CODEC_ID_MPEG2VIDEO){ |
| 333 put_header(s, EXT_START_CODE); | 350 put_header(s, EXT_START_CODE); |
| 334 put_bits(&s->pb, 4, 1); //seq ext | 351 put_bits(&s->pb, 4, 1); //seq ext |
| 335 | 352 |
| 336 put_bits(&s->pb, 1, s->chroma_format == CHROMA_422); //escx | 353 put_bits(&s->pb, 1, s->avctx->profile == 0); //escx 1 for 4:2:2 profile */ |
| 337 | 354 |
| 338 put_bits(&s->pb, 3, s->avctx->profile); //profile | 355 put_bits(&s->pb, 3, s->avctx->profile); //profile |
| 339 put_bits(&s->pb, 4, s->avctx->level); //level | 356 put_bits(&s->pb, 4, s->avctx->level); //level |
| 340 | 357 |
| 341 put_bits(&s->pb, 1, s->progressive_sequence); | 358 put_bits(&s->pb, 1, s->progressive_sequence); |
