Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] avcodec/amfdec: Add VP9 AMF decoder
@ 2025-06-23 13:14 Dmitrii Ovchinnikov
  0 siblings, 0 replies; only message in thread
From: Dmitrii Ovchinnikov @ 2025-06-23 13:14 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: nyanmisaka

From: nyanmisaka <nst799610810@gmail.com>

---
 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 f76f946dfe..fcc0af5681 100755
--- a/configure
+++ b/configure
@@ -3457,6 +3457,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 9630074205..3157729e55 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -799,6 +799,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 3be33f5cc4..fa90e25633 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -899,6 +899,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 88e55a7752..75a624d48c 100644
--- a/libavcodec/amfdec.c
+++ b/libavcodec/amfdec.c
@@ -89,6 +89,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;
@@ -99,13 +102,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;
@@ -713,4 +720,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)
-- 
2.47.1.windows.2

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-06-23 13:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-23 13:14 [FFmpeg-devel] [PATCH] avcodec/amfdec: Add VP9 AMF decoder Dmitrii Ovchinnikov

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git