[FFmpeg-devel] [PATCH 1/4] vaapi: define a single pixel format for VA-API (AV_PIX_FMT_VAAPI).
Gwenole Beauchesne
gb.devel at gmail.com
Tue Aug 18 11:00:32 CEST 2015
Hi,
2015-08-18 10:43 GMT+02:00 Hendrik Leppkes <h.leppkes at gmail.com>:
> On Tue, Aug 18, 2015 at 10:35 AM, Gwenole Beauchesne <gb.devel at gmail.com> wrote:
>> 2015-08-17 21:53 GMT+02:00 wm4 <nfxjfg at googlemail.com>:
>>> On Mon, 17 Aug 2015 19:17:50 +0200
>>> Gwenole Beauchesne <gb.devel at gmail.com> wrote:
>>>
>>>> Deprecate older VA pixel formats (MOCO, IDCT) as it is now very unlikely
>>>> to ever be useful in the future. Only keep plain AV_PIX_FMT_VAAPI format
>>>> that is aliased to the older VLD variant.
>>>>
>>>> Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne at intel.com>
>>>> ---
>>>> libavcodec/h263dec.c | 2 +-
>>>> libavcodec/h264_slice.c | 2 +-
>>>> libavcodec/mpeg12dec.c | 2 +-
>>>> libavcodec/vaapi_h264.c | 2 +-
>>>> libavcodec/vaapi_mpeg2.c | 2 +-
>>>> libavcodec/vaapi_mpeg4.c | 4 ++--
>>>> libavcodec/vaapi_vc1.c | 4 ++--
>>>> libavcodec/vc1dec.c | 2 +-
>>>> libavutil/pixdesc.c | 9 +++++++++
>>>> libavutil/pixfmt.h | 11 +++++++++++
>>>> libavutil/version.h | 3 +++
>>>> 11 files changed, 33 insertions(+), 10 deletions(-)
>>>>
>>>> diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
>>>> index 7fa7090..e647e40 100644
>>>> --- a/libavcodec/h263dec.c
>>>> +++ b/libavcodec/h263dec.c
>>>> @@ -718,7 +718,7 @@ frame_end:
>>>>
>>>> const enum AVPixelFormat ff_h263_hwaccel_pixfmt_list_420[] = {
>>>> #if CONFIG_H263_VAAPI_HWACCEL || CONFIG_MPEG4_VAAPI_HWACCEL
>>>> - AV_PIX_FMT_VAAPI_VLD,
>>>> + AV_PIX_FMT_VAAPI,
>>>> #endif
>>>> #if CONFIG_H263_VDPAU_HWACCEL || CONFIG_MPEG4_VDPAU_HWACCEL
>>>> AV_PIX_FMT_VDPAU,
>>>> diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
>>>> index 48f501b..7b35c08 100644
>>>> --- a/libavcodec/h264_slice.c
>>>> +++ b/libavcodec/h264_slice.c
>>>> @@ -943,7 +943,7 @@ static enum AVPixelFormat get_pixel_format(H264Context *h, int force_callback)
>>>> *fmt++ = AV_PIX_FMT_D3D11VA_VLD;
>>>> #endif
>>>> #if CONFIG_H264_VAAPI_HWACCEL
>>>> - *fmt++ = AV_PIX_FMT_VAAPI_VLD;
>>>> + *fmt++ = AV_PIX_FMT_VAAPI;
>>>> #endif
>>>> #if CONFIG_H264_VDA_HWACCEL
>>>> *fmt++ = AV_PIX_FMT_VDA_VLD;
>>>> diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
>>>> index c7a5701..d2bedbc 100644
>>>> --- a/libavcodec/mpeg12dec.c
>>>> +++ b/libavcodec/mpeg12dec.c
>>>> @@ -1209,7 +1209,7 @@ static const enum AVPixelFormat mpeg2_hwaccel_pixfmt_list_420[] = {
>>>> AV_PIX_FMT_D3D11VA_VLD,
>>>> #endif
>>>> #if CONFIG_MPEG2_VAAPI_HWACCEL
>>>> - AV_PIX_FMT_VAAPI_VLD,
>>>> + AV_PIX_FMT_VAAPI,
>>>> #endif
>>>> #if CONFIG_MPEG2_VIDEOTOOLBOX_HWACCEL
>>>> AV_PIX_FMT_VIDEOTOOLBOX,
>>>> diff --git a/libavcodec/vaapi_h264.c b/libavcodec/vaapi_h264.c
>>>> index 151aca9..55ee2fc 100644
>>>> --- a/libavcodec/vaapi_h264.c
>>>> +++ b/libavcodec/vaapi_h264.c
>>>> @@ -359,7 +359,7 @@ AVHWAccel ff_h264_vaapi_hwaccel = {
>>>> .name = "h264_vaapi",
>>>> .type = AVMEDIA_TYPE_VIDEO,
>>>> .id = AV_CODEC_ID_H264,
>>>> - .pix_fmt = AV_PIX_FMT_VAAPI_VLD,
>>>> + .pix_fmt = AV_PIX_FMT_VAAPI,
>>>> .start_frame = vaapi_h264_start_frame,
>>>> .end_frame = vaapi_h264_end_frame,
>>>> .decode_slice = vaapi_h264_decode_slice,
>>>> diff --git a/libavcodec/vaapi_mpeg2.c b/libavcodec/vaapi_mpeg2.c
>>>> index 87fab89..27c69cd 100644
>>>> --- a/libavcodec/vaapi_mpeg2.c
>>>> +++ b/libavcodec/vaapi_mpeg2.c
>>>> @@ -138,7 +138,7 @@ AVHWAccel ff_mpeg2_vaapi_hwaccel = {
>>>> .name = "mpeg2_vaapi",
>>>> .type = AVMEDIA_TYPE_VIDEO,
>>>> .id = AV_CODEC_ID_MPEG2VIDEO,
>>>> - .pix_fmt = AV_PIX_FMT_VAAPI_VLD,
>>>> + .pix_fmt = AV_PIX_FMT_VAAPI,
>>>> .start_frame = vaapi_mpeg2_start_frame,
>>>> .end_frame = ff_vaapi_mpeg_end_frame,
>>>> .decode_slice = vaapi_mpeg2_decode_slice,
>>>> diff --git a/libavcodec/vaapi_mpeg4.c b/libavcodec/vaapi_mpeg4.c
>>>> index 9b283f7..5b2e9d4 100644
>>>> --- a/libavcodec/vaapi_mpeg4.c
>>>> +++ b/libavcodec/vaapi_mpeg4.c
>>>> @@ -141,7 +141,7 @@ AVHWAccel ff_mpeg4_vaapi_hwaccel = {
>>>> .name = "mpeg4_vaapi",
>>>> .type = AVMEDIA_TYPE_VIDEO,
>>>> .id = AV_CODEC_ID_MPEG4,
>>>> - .pix_fmt = AV_PIX_FMT_VAAPI_VLD,
>>>> + .pix_fmt = AV_PIX_FMT_VAAPI,
>>>> .start_frame = vaapi_mpeg4_start_frame,
>>>> .end_frame = ff_vaapi_mpeg_end_frame,
>>>> .decode_slice = vaapi_mpeg4_decode_slice,
>>>> @@ -153,7 +153,7 @@ AVHWAccel ff_h263_vaapi_hwaccel = {
>>>> .name = "h263_vaapi",
>>>> .type = AVMEDIA_TYPE_VIDEO,
>>>> .id = AV_CODEC_ID_H263,
>>>> - .pix_fmt = AV_PIX_FMT_VAAPI_VLD,
>>>> + .pix_fmt = AV_PIX_FMT_VAAPI,
>>>> .start_frame = vaapi_mpeg4_start_frame,
>>>> .end_frame = ff_vaapi_mpeg_end_frame,
>>>> .decode_slice = vaapi_mpeg4_decode_slice,
>>>> diff --git a/libavcodec/vaapi_vc1.c b/libavcodec/vaapi_vc1.c
>>>> index 7ef9f2a..63d514d 100644
>>>> --- a/libavcodec/vaapi_vc1.c
>>>> +++ b/libavcodec/vaapi_vc1.c
>>>> @@ -339,7 +339,7 @@ AVHWAccel ff_wmv3_vaapi_hwaccel = {
>>>> .name = "wmv3_vaapi",
>>>> .type = AVMEDIA_TYPE_VIDEO,
>>>> .id = AV_CODEC_ID_WMV3,
>>>> - .pix_fmt = AV_PIX_FMT_VAAPI_VLD,
>>>> + .pix_fmt = AV_PIX_FMT_VAAPI,
>>>> .start_frame = vaapi_vc1_start_frame,
>>>> .end_frame = ff_vaapi_mpeg_end_frame,
>>>> .decode_slice = vaapi_vc1_decode_slice,
>>>> @@ -350,7 +350,7 @@ AVHWAccel ff_vc1_vaapi_hwaccel = {
>>>> .name = "vc1_vaapi",
>>>> .type = AVMEDIA_TYPE_VIDEO,
>>>> .id = AV_CODEC_ID_VC1,
>>>> - .pix_fmt = AV_PIX_FMT_VAAPI_VLD,
>>>> + .pix_fmt = AV_PIX_FMT_VAAPI,
>>>> .start_frame = vaapi_vc1_start_frame,
>>>> .end_frame = ff_vaapi_mpeg_end_frame,
>>>> .decode_slice = vaapi_vc1_decode_slice,
>>>> diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
>>>> index abaa0b4..992ca96 100644
>>>> --- a/libavcodec/vc1dec.c
>>>> +++ b/libavcodec/vc1dec.c
>>>> @@ -1101,7 +1101,7 @@ static const enum AVPixelFormat vc1_hwaccel_pixfmt_list_420[] = {
>>>> AV_PIX_FMT_D3D11VA_VLD,
>>>> #endif
>>>> #if CONFIG_VC1_VAAPI_HWACCEL
>>>> - AV_PIX_FMT_VAAPI_VLD,
>>>> + AV_PIX_FMT_VAAPI,
>>>> #endif
>>>> #if CONFIG_VC1_VDPAU_HWACCEL
>>>> AV_PIX_FMT_VDPAU,
>>>> diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
>>>> index eb0dc9d..eb52113 100644
>>>> --- a/libavutil/pixdesc.c
>>>> +++ b/libavutil/pixdesc.c
>>>> @@ -1208,6 +1208,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
>>>> },
>>>> .flags = AV_PIX_FMT_FLAG_RGB,
>>>> },
>>>> +#if FF_API_VAAPI
>>>> [AV_PIX_FMT_VAAPI_MOCO] = {
>>>> .name = "vaapi_moco",
>>>> .log2_chroma_w = 1,
>>>> @@ -1226,6 +1227,14 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
>>>> .log2_chroma_h = 1,
>>>> .flags = AV_PIX_FMT_FLAG_HWACCEL,
>>>> },
>>>> +#else
>>>> + [AV_PIX_FMT_VAAPI] = {
>>>> + .name = "vaapi",
>>>> + .log2_chroma_w = 1,
>>>> + .log2_chroma_h = 1,
>>>> + .flags = AV_PIX_FMT_FLAG_HWACCEL,
>>>> + },
>>>> +#endif
>>>> [AV_PIX_FMT_YUV420P9LE] = {
>>>> .name = "yuv420p9le",
>>>> .nb_components = 3,
>>>> diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
>>>> index 5cdbeb9..399e466 100644
>>>> --- a/libavutil/pixfmt.h
>>>> +++ b/libavutil/pixfmt.h
>>>> @@ -121,9 +121,20 @@ enum AVPixelFormat {
>>>> AV_PIX_FMT_BGR555BE, ///< packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), big-endian , X=unused/undefined
>>>> AV_PIX_FMT_BGR555LE, ///< packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), little-endian, X=unused/undefined
>>>>
>>>> +#if FF_API_VAAPI
>>>> + /** @name Deprecated pixel formats */
>>>> + /**@{*/
>>>> AV_PIX_FMT_VAAPI_MOCO, ///< HW acceleration through VA API at motion compensation entry-point, Picture.data[3] contains a vaapi_render_state struct which contains macroblocks as well as various fields extracted from headers
>>>> AV_PIX_FMT_VAAPI_IDCT, ///< HW acceleration through VA API at IDCT entry-point, Picture.data[3] contains a vaapi_render_state struct which contains fields extracted from headers
>>>> AV_PIX_FMT_VAAPI_VLD, ///< HW decoding through VA API, Picture.data[3] contains a vaapi_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
>>>> + /**@}*/
>>>> +#endif
>>>> +
>>>> + /**
>>>> + * Hardware acceleration through VA-API, data[3] contains a
>>>> + * VASurfaceID.
>>>> + */
>>>> + AV_PIX_FMT_VAAPI = AV_PIX_FMT_VAAPI_VLD,
>>>>
>>>> AV_PIX_FMT_YUV420P16LE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
>>>> AV_PIX_FMT_YUV420P16BE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
>>>> diff --git a/libavutil/version.h b/libavutil/version.h
>>>> index 653f530..3af71cd 100644
>>>> --- a/libavutil/version.h
>>>> +++ b/libavutil/version.h
>>>> @@ -107,6 +107,9 @@
>>>> #ifndef FF_API_AVFRAME_LAVC
>>>> #define FF_API_AVFRAME_LAVC (LIBAVUTIL_VERSION_MAJOR < 55)
>>>> #endif
>>>> +#ifndef FF_API_VAAPI
>>>> +#define FF_API_VAAPI (LIBAVUTIL_VERSION_MAJOR < 55)
>>>> +#endif
>>>> #ifndef FF_API_VDPAU
>>>> #define FF_API_VDPAU (LIBAVUTIL_VERSION_MAJOR < 55)
>>>> #endif
>>>
>>>
>>> Seems fine, although I don't see the immediate need to rename the VAAPI
>>> pixfmt. (We also have AV_PIX_FMT_D3D11VA_VLD etc.)
>>
>> I was under the impression we wanted to really bump the major and
>> remove the obsolete/deprecated stuff "soon". When that time comes, I
>> don't want to have useless pix_fmts kept for vaapi.
>>
>
> Don't need to keep "useless" pix_fmts, but there really is no big
> point in renaming VAAPI_VLD -> VAAPI, could just keep the VLD suffix,
> since thats really still what it does.
It has always been dubious to name a pixel format after some
hypothetical decode option. It looks cleaner to stick to what we have
in there, i.e. a handle to a VA surface. Besides, *_VLD will become
irrelevant and possibly confusing when we want to really use that for
other usages like e.g. video processing, or possibly video encoding.
Regards,
--
Gwenole Beauchesne
Intel Corporation SAS / 2 rue de Paris, 92196 Meudon Cedex, France
Registration Number (RCS): Nanterre B 302 456 199
More information about the ffmpeg-devel
mailing list