[MPlayer-users] Adding support for Theora 4:2:2 and 4:4:4 video files

Giorgio mywing81 at gmail.com
Sun Feb 14 15:08:02 CET 2010


2010/2/14 Reimar Döffinger <Reimar.Doeffinger at gmx.de>:
> On Fri, Feb 12, 2010 at 10:28:58PM +0100, Giorgio wrote:
>>  // to set/get/query special features/parameters
>>  static int control(sh_video_t *sh,int cmd,void* arg,...){
>> +    theora_struct_t *context = (theora_struct_t *)sh->context;
>
> Useless cast.

Fixed.

>>      switch(cmd) {
>>      case VDCTRL_QUERY_FORMAT:
>> -        if ((*((int*)arg)) == IMGFMT_YV12)
>> -         return CONTROL_TRUE;
>> +    if ((*((int*)arg)) == IMGFMT_YV12  &&  context->inf.pixelformat == OC_PF_420) return CONTROL_TRUE;
>> +    if ((*((int*)arg)) == IMGFMT_422P  &&  context->inf.pixelformat == OC_PF_422) return CONTROL_TRUE;
>> +    if ((*((int*)arg)) == IMGFMT_444P  &&  context->inf.pixelformat == OC_PF_444) return CONTROL_TRUE;
>
> Make a function that converts the context->inf.pixelformat to the corresponding IMGFMT_ and use
> that in both places.

Fixed.

>>       return CONTROL_FALSE;
>>      }
>> -
>>      return CONTROL_UNKNOWN;
>
> Unrelated/cosmetic change.

Fixed.

>> @@ -73,6 +75,8 @@
>>      switch(sh->codec->outfmt[sh->outfmtidx])
>>      {
>>         case IMGFMT_YV12: /* well, this should work... */ break;
>> +       case IMGFMT_422P: break;
>> +       case IMGFMT_444P: break;
>>         default:
>>         mp_msg (MSGT_DECVIDEO,MSGL_ERR,"Unsupported out_fmt: 0x%X\n",
>>                 sh->codec->outfmt[sh->outfmtidx]);
>
> I removed this useless piece of code.

Thanks :)

>> @@ -133,7 +137,14 @@
>>
>>      mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: Theora video init ok!\n");
>>
>> -    return mpcodecs_config_vo (sh,context->inf.frame_width,context->inf.frame_height,IMGFMT_YV12);
>> +    switch(context->inf.pixelformat) {
>> +        case OC_PF_420:
>> +        return mpcodecs_config_vo (sh,context->inf.frame_width,context->inf.frame_height,IMGFMT_YV12);
>> +        case OC_PF_422:
>> +        return mpcodecs_config_vo (sh,context->inf.frame_width,context->inf.frame_height,IMGFMT_422P);
>> +        case OC_PF_444:
>> +        return mpcodecs_config_vo (sh,context->inf.frame_width,context->inf.frame_height,IMGFMT_444P);
>> +    }
>
> Trailing whitespace and also code duplication (see my suggestion about the conversion function
> for how to avoid it.

Fixed.

> Apart from that I think it looks ok.

I made all the corrections, I hope it's better now. This is my first
patch, so thank you for your patience.

Giorgio Vazzana
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mplayer_theora_422_444_2.diff
Type: text/x-diff
Size: 1965 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-users/attachments/20100214/bb36f49d/attachment.diff>


More information about the MPlayer-users mailing list