[FFmpeg-devel] [PATCH] HWAccel infrastructure (take 5)
Ivan Kalvachev
ikalvachev
Fri Feb 20 20:49:59 CET 2009
On 2/20/09, Reimar D?ffinger <Reimar.Doeffinger at stud.uni-karlsruhe.de> wrote:
> On Fri, Feb 20, 2009 at 06:06:08PM +0100, Gwenole Beauchesne wrote:
>> static inline int is_hwaccel_format(int imgfmt)
>> {
>> switch (get_video_hwaccel()) {
>> case HWACCEL_VAAPI: return IMGFMT_IS_VAAPI(imgfmt) != 0;
>> case HWACCEL_VDPAU: return IMGFMT_IS_VDPAU(imgfmt) != 0;
>> case HWACCEL_XVMC: return IMGFMT_IS_XVMC(imgfmt) != 0;
>> }
>> return 0;
>> }
>>
>> static enum PixelFormat get_format(struct AVCodecContext *avctx,
>> const enum PixelFormat *fmt){
>> enum PixelFormat selected_format = PIX_FMT_NONE;
>> int imgfmt;
>> sh_video_t *sh = avctx->opaque;
>> int i, try_hwaccel;
>>
>> for (try_hwaccel = 1; try_hwaccel >= 0; --try_hwaccel) {
>> for (i = 0; fmt[i] != PIX_FMT_NONE; i++){
>> imgfmt = pixfmt2imgfmt(fmt[i]);
>> if ((try_hwaccel ^ is_hwaccel_format(imgfmt)) != 0)
>> continue;
>> mp_msg(MSGT_DECVIDEO, MSGL_INFO,
>> MSGTR_MPCODECS_TryingPixfmt, i);
>> if (query_format(sh, imgfmt)) {
>> selected_format = fmt[i];
>> break;
>> }
>
> Well, it is still reimplementing the FFmpeg function, even though for
My point exactly.
> MPlayer it is not such an issue since IMGFMT_IS_.. is relatively easy
> to do, it may be more effort for other applications.
Precisely. What we don't see here is one huge table holding all
possible pix_fmt->imgfmt conversion.
What I want to say is that the above function is useful and outside
libavcodec and could be put in good use.
> Also this approach doesn't seem like such a good idea to me, currently (and
> I do not
> see that changing) for MPlayer the hardware-acceleration format is
> implicitly specified by the -vo, adding another way to specify the same
> thing can't do any good IMO - letting the hwaccel option select the vo
> seems like not such a good idea, since it is necessary to specify the vo
> to get things like denoising etc..
-vf format=yv12 -vo vaapi
> Hardware-decoding within FFmpeg to a
> uncompressed buffer is a different case of course.
With XvMC it is not possible, but at least with vdpau it is possible
to export the video memory image into the main memory.
So the decoding could be moved to the vd_ffmpeg (of vd_ffmpeg_hw)
and depending on the filters set to decode it to surface or main memory.
This would be useful in e.g. mencoder.
Anyway, this is kind of off topic for ffmpeg list.
More information about the ffmpeg-devel
mailing list