Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vaapi: add cavs & avs2 decoding support #1

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -2459,6 +2459,8 @@ HAVE_LIST="
texi2html
xmllint
zlib_gzip
va_profile_avs
va_profile_avs2
"

# options emitted with CONFIG_ prefix but not available on the command line
Expand Down Expand Up @@ -3182,6 +3184,8 @@ wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
wmv3_nvdec_hwaccel_select="vc1_nvdec_hwaccel"
wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
wmv3_vdpau_hwaccel_select="vc1_vdpau_hwaccel"
cavs_vaapi_hwaccel_deps="vaapi va_profile_avs VAPictureParameterBufferAVS"
avs2_vaapi_hwaccel_deps="vaapi va_profile_avs2 VAPictureParameterBufferAVS2"

# hardware-accelerated codecs
mediafoundation_deps="mftransform_h MFCreateAlignedMemoryBuffer"
Expand Down Expand Up @@ -7106,6 +7110,23 @@ if enabled vaapi; then
check_type "va/va.h va/va_enc_jpeg.h" "VAEncPictureParameterBufferJPEG"
check_type "va/va.h va/va_enc_vp8.h" "VAEncPictureParameterBufferVP8"
check_type "va/va.h va/va_enc_vp9.h" "VAEncPictureParameterBufferVP9"

#
# Using 'VA_CHECK_VERSION' in source codes make things easy. But we have to wait
# until newly added VAProfile being distributed by VAAPI released version.
#
# Before or after that, we can use auto-detection to keep version compatibility.
# It always works.
#
disable va_profile_avs &&
test_code cc va/va.h "VAProfile p1 = VAProfileAVSJizhun, p2 = VAProfileAVSGuangdian;" &&
enable va_profile_avs
disable va_profile_avs2 &&
test_code cc va/va.h "VAProfile p1 = VAProfileAVS2Main, p2 = VAProfileAVS2Main10;" &&
enable va_profile_avs2

enabled va_profile_avs && check_type "va/va.h va/va_dec_avs.h" "VAPictureParameterBufferAVS"
enabled va_profile_avs2 && check_type "va/va.h va/va_dec_avs2.h" "VAPictureParameterBufferAVS2"
fi

if enabled_all opencl libdrm ; then
Expand Down
3 changes: 3 additions & 0 deletions libavcodec/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ OBJS-$(CONFIG_BRENDER_PIX_DECODER) += brenderpix.o
OBJS-$(CONFIG_C93_DECODER) += c93.o
OBJS-$(CONFIG_CAVS_DECODER) += cavs.o cavsdec.o cavsdsp.o \
cavsdata.o
OBJS-$(CONFIG_AVS2_DECODER) += avs2.o avs2dec.o avs2dec_headers.o
OBJS-$(CONFIG_CBD2_DECODER) += dpcm.o
OBJS-$(CONFIG_CCAPTION_DECODER) += ccaption_dec.o ass.o
OBJS-$(CONFIG_CDGRAPHICS_DECODER) += cdgraphics.o
Expand Down Expand Up @@ -1043,6 +1044,8 @@ OBJS-$(CONFIG_VP9_VAAPI_HWACCEL) += vaapi_vp9.o
OBJS-$(CONFIG_VP9_VDPAU_HWACCEL) += vdpau_vp9.o
OBJS-$(CONFIG_VP9_VIDEOTOOLBOX_HWACCEL) += videotoolbox_vp9.o
OBJS-$(CONFIG_VP8_QSV_HWACCEL) += qsvdec.o
OBJS-$(CONFIG_CAVS_VAAPI_HWACCEL) += vaapi_cavs.o
OBJS-$(CONFIG_AVS2_VAAPI_HWACCEL) += vaapi_avs2.o

# Objects duplicated from other libraries for shared builds
SHLIBOBJS += log2_tab.o reverse.o
Expand Down
1 change: 1 addition & 0 deletions libavcodec/allcodecs.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ extern const FFCodec ff_bmv_video_decoder;
extern const FFCodec ff_brender_pix_decoder;
extern const FFCodec ff_c93_decoder;
extern const FFCodec ff_cavs_decoder;
extern const FFCodec ff_avs2_decoder;
extern const FFCodec ff_cdgraphics_decoder;
extern const FFCodec ff_cdtoons_decoder;
extern const FFCodec ff_cdxl_decoder;
Expand Down
8 changes: 8 additions & 0 deletions libavcodec/avcodec.h
Original file line number Diff line number Diff line change
Expand Up @@ -1722,6 +1722,14 @@ typedef struct AVCodecContext {
#define FF_PROFILE_EVC_BASELINE 0
#define FF_PROFILE_EVC_MAIN 1

#define FF_PROFILE_CAVS_JIZHUN 0x20
#define FF_PROFILE_CAVS_GUANGDIAN 0x48

#define FF_PROFILE_AVS2_PIC 0x12
#define FF_PROFILE_AVS2_MAIN 0x20
#define FF_PROFILE_AVS2_MAIN_10 0x22


/**
* level
* - encoding: Set by user.
Expand Down
Loading