[FFmpeg-cvslog] avcodec/amfdec: Add VP9 AMF decoder
nyanmisaka
git at videolan.org
Thu Jun 26 14:48:45 EEST 2025
ffmpeg | branch: master | nyanmisaka <nst799610810 at gmail.com> | Fri Jan 3 14:10:00 2025 -0500| [b2c0d37be5c0fc80fbe2e2dcd04d43d7915b1bcf] | committer: Dmitrii Ovchinnikov
avcodec/amfdec: Add VP9 AMF decoder
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b2c0d37be5c0fc80fbe2e2dcd04d43d7915b1bcf
---
configure | 1 +
libavcodec/Makefile | 1 +
libavcodec/allcodecs.c | 1 +
libavcodec/amfdec.c | 16 ++++++++++++----
4 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/configure b/configure
index d625461983..976a21b931 100755
--- a/configure
+++ b/configure
@@ -3477,6 +3477,7 @@ vp8_vaapi_encoder_deps="VAEncPictureParameterBufferVP8"
vp8_vaapi_encoder_select="vaapi_encode"
vp8_v4l2m2m_decoder_deps="v4l2_m2m vp8_v4l2_m2m"
vp8_v4l2m2m_encoder_deps="v4l2_m2m vp8_v4l2_m2m"
+vp9_amf_decoder_deps="amf"
vp9_cuvid_decoder_deps="cuvid"
vp9_mediacodec_decoder_deps="mediacodec"
vp9_mediacodec_encoder_deps="mediacodec"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index dca6c100c0..7f963e864d 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -802,6 +802,7 @@ OBJS-$(CONFIG_VP8_V4L2M2M_ENCODER) += v4l2_m2m_enc.o
OBJS-$(CONFIG_VP9_DECODER) += vp9.o vp9data.o vp9dsp.o vp9lpf.o vp9recon.o \
vp9block.o vp9prob.o vp9mvs.o vpx_rac.o \
vp9dsp_8bpp.o vp9dsp_10bpp.o vp9dsp_12bpp.o
+OBJS-$(CONFIG_VP9_AMF_DECODER) += amfdec.o
OBJS-$(CONFIG_VP9_CUVID_DECODER) += cuviddec.o
OBJS-$(CONFIG_VP9_MEDIACODEC_DECODER) += mediacodecdec.o
OBJS-$(CONFIG_VP9_MEDIACODEC_ENCODER) += mediacodecenc.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 4b11ad3a75..9087b16895 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -902,6 +902,7 @@ extern const FFCodec ff_vp8_mediacodec_encoder;
extern const FFCodec ff_vp8_qsv_decoder;
extern const FFCodec ff_vp8_v4l2m2m_encoder;
extern const FFCodec ff_vp8_vaapi_encoder;
+extern const FFCodec ff_vp9_amf_decoder;
extern const FFCodec ff_vp9_cuvid_decoder;
extern const FFCodec ff_vp9_mediacodec_decoder;
extern const FFCodec ff_vp9_mediacodec_encoder;
diff --git a/libavcodec/amfdec.c b/libavcodec/amfdec.c
index 1840a1b3c0..5d1611675b 100644
--- a/libavcodec/amfdec.c
+++ b/libavcodec/amfdec.c
@@ -90,6 +90,9 @@ static int amf_init_decoder(AVCodecContext *avctx)
AMFBuffer *buffer;
amf_int64 color_profile;
int pool_size = 36;
+ // way-around for older drivers that don't support dynamic bitness detection -
+ // define HEVC and VP9 10-bit based on container info
+ int no_bitness_detect = amf_legacy_driver_no_bitness_detect(amf_device_ctx);
ctx->drain = 0;
ctx->resolution_changed = 0;
@@ -100,13 +103,17 @@ static int amf_init_decoder(AVCodecContext *avctx)
break;
case AV_CODEC_ID_HEVC: {
codec_id = AMFVideoDecoderHW_H265_HEVC;
- // way-around for older drivers that don't support dynamic butness detection -
- // define HEVC 10-bit based on container info
- if(amf_legacy_driver_no_bitness_detect(amf_device_ctx)){
+ if(no_bitness_detect){
if(avctx->pix_fmt == AV_PIX_FMT_YUV420P10)
codec_id = AMFVideoDecoderHW_H265_MAIN10;
}
-
+ } break;
+ case AV_CODEC_ID_VP9: {
+ codec_id = AMFVideoDecoderHW_VP9;
+ if(no_bitness_detect){
+ if(avctx->pix_fmt == AV_PIX_FMT_YUV420P10)
+ codec_id = AMFVideoDecoderHW_VP9_10BIT;
+ }
} break;
case AV_CODEC_ID_AV1:
codec_id = AMFVideoDecoderHW_AV1;
@@ -717,4 +724,5 @@ const FFCodec ff_##x##_amf_decoder = { \
DEFINE_AMF_DECODER(h264, H264, "h264_mp4toannexb")
DEFINE_AMF_DECODER(hevc, HEVC, NULL)
+DEFINE_AMF_DECODER(vp9, VP9, NULL)
DEFINE_AMF_DECODER(av1, AV1, NULL)
More information about the ffmpeg-cvslog
mailing list