Skip to content

Commit

Permalink
AV1 VDPAU hwaccel Decode support
Browse files Browse the repository at this point in the history
Support for VDPAU accelerated AV1 decoding was added with libvdpau-1.5.
Support for the same in ffmpeg is added with this patch. Profiles
related to VDPAU AV1 can be found in latest vdpau.h present in
libvdpau-1.5.

Add AV1 VDPAU to list of hwaccels and supported formats
Added file vdpau_av1.c and Modified configure to add VDPAU AV1 support.
Mapped AV1 profiles to VDPAU AV1 profiles. Populated the codec specific
params that need to be passed to VDPAU.

Signed-off-by: Philip Langdale <philipl@overt.org>
  • Loading branch information
ManojGuptaBonda authored and philipl committed Jun 25, 2022
1 parent cf30b53 commit a44fba0
Show file tree
Hide file tree
Showing 8 changed files with 392 additions and 2 deletions.
1 change: 1 addition & 0 deletions Changelog
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ version 5.1:
- QOI image format support
- ffprobe -o option
- virtualbass audio filter
- VDPAU AV1 hwaccel


version 5.0:
Expand Down
3 changes: 3 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -3026,6 +3026,8 @@ av1_nvdec_hwaccel_deps="nvdec CUVIDAV1PICPARAMS"
av1_nvdec_hwaccel_select="av1_decoder"
av1_vaapi_hwaccel_deps="vaapi VADecPictureParameterBufferAV1_bit_depth_idx"
av1_vaapi_hwaccel_select="av1_decoder"
av1_vdpau_hwaccel_deps="vdpau VdpPictureInfoAV1"
av1_vdpau_hwaccel_select="av1_decoder"
h263_vaapi_hwaccel_deps="vaapi"
h263_vaapi_hwaccel_select="h263_decoder"
h263_videotoolbox_hwaccel_deps="videotoolbox"
Expand Down Expand Up @@ -6393,6 +6395,7 @@ check_func_headers mfapi.h MFCreateAlignedMemoryBuffer -lmfplat

check_type "vdpau/vdpau.h" "VdpPictureInfoHEVC"
check_type "vdpau/vdpau.h" "VdpPictureInfoVP9"
check_type "vdpau/vdpau.h" "VdpPictureInfoAV1"

if [ -z "$nvccflags" ]; then
nvccflags=$nvccflags_default
Expand Down
1 change: 1 addition & 0 deletions libavcodec/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -956,6 +956,7 @@ OBJS-$(CONFIG_AV1_D3D11VA_HWACCEL) += dxva2_av1.o
OBJS-$(CONFIG_AV1_DXVA2_HWACCEL) += dxva2_av1.o
OBJS-$(CONFIG_AV1_NVDEC_HWACCEL) += nvdec_av1.o
OBJS-$(CONFIG_AV1_VAAPI_HWACCEL) += vaapi_av1.o
OBJS-$(CONFIG_AV1_VDPAU_HWACCEL) += vdpau_av1.o
OBJS-$(CONFIG_H263_VAAPI_HWACCEL) += vaapi_mpeg4.o
OBJS-$(CONFIG_H263_VIDEOTOOLBOX_HWACCEL) += videotoolbox.o
OBJS-$(CONFIG_H264_D3D11VA_HWACCEL) += dxva2_h264.o
Expand Down
13 changes: 12 additions & 1 deletion libavcodec/av1dec.c
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,8 @@ static int get_pixel_format(AVCodecContext *avctx)
#define HWACCEL_MAX (CONFIG_AV1_DXVA2_HWACCEL + \
CONFIG_AV1_D3D11VA_HWACCEL * 2 + \
CONFIG_AV1_NVDEC_HWACCEL + \
CONFIG_AV1_VAAPI_HWACCEL)
CONFIG_AV1_VAAPI_HWACCEL + \
CONFIG_AV1_VDPAU_HWACCEL)
enum AVPixelFormat pix_fmts[HWACCEL_MAX + 2], *fmtp = pix_fmts;

if (seq->seq_profile == 2 && seq->color_config.high_bitdepth)
Expand Down Expand Up @@ -518,6 +519,9 @@ static int get_pixel_format(AVCodecContext *avctx)
#endif
#if CONFIG_AV1_VAAPI_HWACCEL
*fmtp++ = AV_PIX_FMT_VAAPI;
#endif
#if CONFIG_AV1_VDPAU_HWACCEL
*fmtp++ = AV_PIX_FMT_VDPAU;
#endif
break;
case AV_PIX_FMT_YUV420P10:
Expand All @@ -533,6 +537,9 @@ static int get_pixel_format(AVCodecContext *avctx)
#endif
#if CONFIG_AV1_VAAPI_HWACCEL
*fmtp++ = AV_PIX_FMT_VAAPI;
#endif
#if CONFIG_AV1_VDPAU_HWACCEL
*fmtp++ = AV_PIX_FMT_VDPAU;
#endif
break;
case AV_PIX_FMT_GRAY8:
Expand Down Expand Up @@ -1271,6 +1278,10 @@ const FFCodec ff_av1_decoder = {
#if CONFIG_AV1_VAAPI_HWACCEL
HWACCEL_VAAPI(av1),
#endif
#if CONFIG_AV1_VDPAU_HWACCEL
HWACCEL_VDPAU(av1),
#endif

NULL
},
};
1 change: 1 addition & 0 deletions libavcodec/hwaccels.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ extern const AVHWAccel ff_av1_d3d11va2_hwaccel;
extern const AVHWAccel ff_av1_dxva2_hwaccel;
extern const AVHWAccel ff_av1_nvdec_hwaccel;
extern const AVHWAccel ff_av1_vaapi_hwaccel;
extern const AVHWAccel ff_av1_vdpau_hwaccel;
extern const AVHWAccel ff_h263_vaapi_hwaccel;
extern const AVHWAccel ff_h263_videotoolbox_hwaccel;
extern const AVHWAccel ff_h264_d3d11va_hwaccel;
Expand Down
Loading

0 comments on commit a44fba0

Please sign in to comment.