[Ffmpeg-devel] [PATCH] correctly set profile/level for mpeg2 hd

Baptiste Coudurier baptiste.coudurier
Thu Jan 25 18:07:37 CET 2007


Baptiste Coudurier wrote:
> Hi
> 
> Michael Niedermayer wrote:
>>> [...]
>>> Index: libavcodec/mpeg12.c
>>> ===================================================================
>>> --- libavcodec/mpeg12.c	(revision 7707)
>>> +++ libavcodec/mpeg12.c	(working copy)
>>> @@ -234,11 +234,19 @@
>>>          }
>>>      }
>>>  
>>> -    if(avctx->profile == FF_PROFILE_UNKNOWN)
>>> +    if(avctx->profile == FF_PROFILE_UNKNOWN) {
>>> +        if (avctx->width > 720 || avctx->height > 576)
>>> +            avctx->profile = 1; /* High Profile */
>>> +        else
>>>          avctx->profile = s->chroma_format == CHROMA_420 ? 4 : 0;
>> this is incorrect, such resolutions do not need high profile
> 
> This is correct, they do not need it, except when 422 chroma,
> and we could use 422P profile when height is 608.
> 
>>> +    }
>>>  
>>> -    if(avctx->level == FF_LEVEL_UNKNOWN)
>>> +    if(avctx->level == FF_LEVEL_UNKNOWN) {
>>> +        if (avctx->width > 720 || avctx->height > 576)
>>> +            avctx->level = 4; /* High Level */
>> High 1440 profile seems sufficient here
>> anyway either set these values correctly or dont set them
> 
> What about 4:2:2 chroma format ? Only High profile and 4:2:2 support it
> at such resolutions.
> Those profile/level I set with the patch are correct,
> they englobes all combinations with the smallest code.
> 
> If you prefer, I'll use the least requiring profile for all
> chroma/resolution combinations.
> 
>> [...]
>>> -                put_bits(&s->pb, 1, s->chroma_format == CHROMA_422); //escx
>>> +                put_bits(&s->pb, 1, s->avctx->profile == 0); //escx 1 for 4:2:2 profile */
>> my mpeg2 draft says non 0 is reserved, so this will need some
>> explanations
>>
> 
> Quote from ISO 13818-2 2000:
> "Table 8-4 describes profiles and levels when the escape bit equals 1.
> For these profiles and levels there is no implied hierarchy from the
> assignment of profile_and_level_indication and profiles and levels
> are not necessarily subsets of
> others."
> 
> 4:2:2 profile always use escape bit to one. Multi view profile uses it
> too, but I don't know if encoder supports it.
> 
> 10000101 4:2:2 profile @ Main level
> 10000010 4:2:2 profile @ High level
> 

Here is another patch. Is that acceptable ?

-- 
Baptiste COUDURIER                              GnuPG Key Id: 0x5C1ABAAA
SMARTJOG S.A.                                    http://www.smartjog.com
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
Phone: +33 1 49966312
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mpeg2_levels.patch
Type: text/x-diff
Size: 2144 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070125/616755fa/attachment.patch>



More information about the ffmpeg-devel mailing list