[FFmpeg-devel] [PATCH] HWAccel infrastructure (take 7.1)

Gwenole Beauchesne gbeauchesne
Mon Feb 23 19:44:59 CET 2009


Le 23 f?vr. 09 ? 18:59, Michael Niedermayer a ?crit :

> what do you and others think about doing instead:
>
> +    if (CONFIG_HWACCEL && avctx->hwaccel) {
> +        if (avctx->hwaccel->end_frame(avctx) < 0)
> +            return -1;
> +    }
>
> ?
> its not speed relevant but it would safe a few bytes on embeded  
> systems ...

What kind of embeddd systems? Because there are some "embedded"  
systems that have decoders. ;-)

> [...]
>> +enum PixelFormat ff_query_pixfmt(AVCodecContext *avctx, enum  
>> CodecID codec_id)
>> +{
>> +    AVCodec *c;
>> +    AVHWAccel *hwaccel;
>> +    enum PixelFormat pix_fmts[PIX_FMT_NB + 1];
>> +    int i, n_pix_fmts = 0;
>> +
>> +    /* 1. Finds hardware accelerated formats */
>> +    for (hwaccel = first_hwaccel; hwaccel; hwaccel = hwaccel- 
>> >next) {
>> +        if (hwaccel->id == codec_id)
>> +            pix_fmts[n_pix_fmts++] = hwaccel->pix_fmt;
>> +    }
>> +
>> +    /* 2. Append default codec formats, or YUV420P */
>> +    for (c = first_avcodec; c; c = c->next) {
>> +        if (c->id == codec_id) {
>> +            if (c->pix_fmts) {
>> +                for (i = 0; c->pix_fmts[i] != PIX_FMT_NONE; i++)
>> +                    pix_fmts[n_pix_fmts++] = c->pix_fmts[i];
>> +            }
>> +            else
>> +                pix_fmts[n_pix_fmts++] = PIX_FMT_YUV420P;
>> +            break;
>> +        }
>> +    }
>> +
>> +    pix_fmts[n_pix_fmts] = PIX_FMT_NONE;
>> +    return avctx->get_format(avctx, pix_fmts);
>> +}
>
> this is broken actually, and ive not realized this until now ....
> AVCodec.pix_fmts is the full and authrative list of suported pix_fmts
>
> thus all calls to this function can be replaced by
> return avctx->get_format(avctx, avctx->codec->pix_fmts);
>
> and ff_query_pixfmt() droped

What? How do you deal with registered HW accelerated codecs then?





More information about the ffmpeg-devel mailing list