[FFmpeg-devel] [PATCH] HWAccel infrastructure

Gwenole Beauchesne gbeauchesne
Tue Feb 17 19:50:02 CET 2009


Le 17 f?vr. 09 ? 19:28, Ivan Kalvachev a ?crit :

> As my point of interest is how to rework xvmc using unified method,
> there are few things I've thought about that may be needed to improve
> this patch.

I know absolutely nothing to XvMC, so it would be great if you could  
indeed extend the struct afterwards. ;-)

> *hwaccel_codec is currently placed into AVCodecContext,
> It is public structure and I think it should be better to be
> moved in mpegencctx.

That's the location Michael wanted. Is MpegEncContext the base "class"  
for all codec implementations? I would like a location that also suits  
Dirac, e.g. for testing a CUDA implementation of this infrastructure.  
Though, I won't do it myself ATM, it's just in case there is a "gentle  
spirit" that would like to integrate that work into FFmpeg too.

> There is *next field in AVHWAccelCodec. That's very bad idea:

Again, that's what Michael wanted and it actually worked for my  
purposes, so I have not investigated further.

> -adding new functions would be after the next.

You are right, I will move the vtable below the "next" field.

> However the above idea(s) have one problem.
> Let's say that I add functions like block_init() and pack_pblock()
> that are used only by XvMC. All other methods (at least the ones that
> do mpeg2) should implement
> dummy functions for them, only to do nothing.

That's why I only mandate start_frame() and end_frame() to exist.  
Then, if decode_slice() exists, there shall be a start_slice() and  
end_slice() too. And, IMO, if you add your stuff into there, there  
shouldn't be any problem.

> Otherwise, instead of call them like this:
> if(s->hwaccel_codec)
>    s->hwaccel_codec->func1(s,blah);
> --- they should be called like this ---
> if(s->hwaccel_codec && s->hwaccel_codec->func1)
>    s->hwaccel_codec->func1(s,blah);

That's also why I wrote av_hwaccel_decode_{slice,picture}() helpers so  
that future checks can be added into a unique place rather than span  
through all other codecs.

> Don't rush in implementing it. I'd wait for other people comments  
> first.

Oh, please, don't expect me to do any XvMC work too... you'd know that  
better than I! Or is there some secret plan to postpone VA API  
integration as much as possible? If so, please tell it so explicitly...


More information about the ffmpeg-devel mailing list