History

avcodec/amfdec: Add VP9 AMF decoder

nyanmisaka committed 1 year ago

Commit b2c0d371 parent 09cd38e4 files · +15 −4Browse files

Showing the changes to libavcodec (3 of 4 files). Show all

Unified · Split

3 files
  1. libavcodec/Makefile +1 −0
  2. libavcodec/allcodecs.c +1 −0
  3. libavcodec/amfdec.c +12 −4
libavcodec/Makefile+1−0
@@ -802,6 +802,7 @@ OBJS-$(CONFIG_VP8_V4L2M2M_ENCODER) += v4l2_m2m_enc.o · 801 unmodified lines
802802 OBJS-$(CONFIG_VP9_DECODER) += vp9.o vp9data.o vp9dsp.o vp9lpf.o vp9recon.o \
803803 vp9block.o vp9prob.o vp9mvs.o vpx_rac.o \
804804 vp9dsp_8bpp.o vp9dsp_10bpp.o vp9dsp_12bpp.o
805+OBJS-$(CONFIG_VP9_AMF_DECODER) += amfdec.o
805806 OBJS-$(CONFIG_VP9_CUVID_DECODER) += cuviddec.o
806807 OBJS-$(CONFIG_VP9_MEDIACODEC_DECODER) += mediacodecdec.o
807808 OBJS-$(CONFIG_VP9_MEDIACODEC_ENCODER) += mediacodecenc.o
libavcodec/allcodecs.c+1−0
@@ -902,6 +902,7 @@ extern const FFCodec ff_vp8_mediacodec_encoder; · 901 unmodified lines
902902 extern const FFCodec ff_vp8_qsv_decoder;
903903 extern const FFCodec ff_vp8_v4l2m2m_encoder;
904904 extern const FFCodec ff_vp8_vaapi_encoder;
905+extern const FFCodec ff_vp9_amf_decoder;
905906 extern const FFCodec ff_vp9_cuvid_decoder;
906907 extern const FFCodec ff_vp9_mediacodec_decoder;
907908 extern const FFCodec ff_vp9_mediacodec_encoder;
libavcodec/amfdec.c+12−4
@@ -90,6 +90,9 @@ static int amf_init_decoder(AVCodecContext *avctx) · 89 unmodified lines
9090 AMFBuffer *buffer;
9191 amf_int64 color_profile;
9292 int pool_size = 36;
93+ // way-around for older drivers that don't support dynamic bitness detection -
94+ // define HEVC and VP9 10-bit based on container info
95+ int no_bitness_detect = amf_legacy_driver_no_bitness_detect(amf_device_ctx);
9396
9497 ctx->drain = 0;
9598 ctx->resolution_changed = 0;
@@ -100,13 +103,17 @@ static int amf_init_decoder(AVCodecContext *avctx) · 4 unmodified lines
100103 break;
101104 case AV_CODEC_ID_HEVC: {
102105 codec_id = AMFVideoDecoderHW_H265_HEVC;
103− // way-around for older drivers that don't support dynamic butness detection -
104− // define HEVC 10-bit based on container info
105− if(amf_legacy_driver_no_bitness_detect(amf_device_ctx)){
106+ if(no_bitness_detect){
106107 if(avctx->pix_fmt == AV_PIX_FMT_YUV420P10)
107108 codec_id = AMFVideoDecoderHW_H265_MAIN10;
108109 }
109−
110+ } break;
111+ case AV_CODEC_ID_VP9: {
112+ codec_id = AMFVideoDecoderHW_VP9;
113+ if(no_bitness_detect){
114+ if(avctx->pix_fmt == AV_PIX_FMT_YUV420P10)
115+ codec_id = AMFVideoDecoderHW_VP9_10BIT;
116+ }
110117 } break;
111118 case AV_CODEC_ID_AV1:
112119 codec_id = AMFVideoDecoderHW_AV1;
@@ -717,4 +724,5 @@ const FFCodec ff_##x##_amf_decoder = { \ · 604 unmodified lines
717724
718725 DEFINE_AMF_DECODER(h264, H264, "h264_mp4toannexb")
719726 DEFINE_AMF_DECODER(hevc, HEVC, NULL)
727+DEFINE_AMF_DECODER(vp9, VP9, NULL)
720728 DEFINE_AMF_DECODER(av1, AV1, NULL)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t