diff options
Diffstat (limited to 'contrib/ffmpeg/A00-qsv.patch')
-rw-r--r-- | contrib/ffmpeg/A00-qsv.patch | 168 |
1 files changed, 89 insertions, 79 deletions
diff --git a/contrib/ffmpeg/A00-qsv.patch b/contrib/ffmpeg/A00-qsv.patch index 67203beac..c4e7361b3 100644 --- a/contrib/ffmpeg/A00-qsv.patch +++ b/contrib/ffmpeg/A00-qsv.patch @@ -1,84 +1,96 @@ diff --git a/configure b/configure -index 6ab04ae..0c5ad1d 100755 +index 910c47d..328702e 100755 --- a/configure +++ b/configure -@@ -133,6 +133,7 @@ Component options: +@@ -132,6 +132,7 @@ Component options: + + Hardware accelerators: + --enable-dxva2 enable DXVA2 code ++ --enable-qsv enable QSV code --enable-vaapi enable VAAPI code --enable-vda enable VDA code --enable-vdpau enable VDPAU code -+ --enable-qsv enable QSV code +@@ -1126,6 +1127,7 @@ EXTERNAL_LIBRARY_LIST=" - Individual component options: - --disable-everything disable all components listed below -@@ -1076,6 +1077,7 @@ CONFIG_LIST=" + HWACCEL_LIST=" + dxva2 ++ qsv vaapi vda vdpau -+ qsv - version3 - xmm_clobber_test - x11grab -@@ -1629,6 +1631,7 @@ vc1_vdpau_decoder_select="vdpau vc1_decoder" - wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel" - wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel" - wmv3_vdpau_decoder_select="vc1_vdpau_decoder" -+h264_qsv_decoder_select="qsv h264_decoder" - - # parsers - h264_parser_select="error_resilience golomb h264dsp h264pred mpegvideo" -@@ -3584,6 +3587,12 @@ if ! disabled vdpau && enabled vdpau_vdpau_h; then - check_cpp_condition vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" || - { echolog "Please upgrade to libvdpau >= 0.2 if you would like vdpau support." && disable vdpau; } - fi -+if enabled qsv; then -+ disable qsv -+ check_header msdk/mfxvideo.h && enable qsv -+else -+ disable qsv -+fi - - enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel" +@@ -1776,6 +1778,7 @@ zmbv_encoder_deps="zlib" -@@ -3795,6 +3804,7 @@ echo "SDL support ${sdl-no}" - echo "libdxva2 enabled ${dxva2-no}" - echo "libva enabled ${vaapi-no}" - echo "libvdpau enabled ${vdpau-no}" -+echo "libqsv enabled ${qsv-no}" - echo "AVISynth enabled ${avisynth-no}" - echo "frei0r enabled ${frei0r-no}" - echo "gnutls enabled ${gnutls-no}" + # hardware accelerators + dxva2_deps="dxva2api_h" ++qsv_deps="msdk_mfxvideo_h" + vaapi_deps="va_va_h" + vda_deps="VideoDecodeAcceleration_VDADecoder_h pthreads" + vda_extralibs="-framework CoreFoundation -framework VideoDecodeAcceleration -framework QuartzCore" +@@ -1787,6 +1790,8 @@ h263_vdpau_hwaccel_deps="vdpau" + h263_vdpau_hwaccel_select="h263_decoder" + h264_dxva2_hwaccel_deps="dxva2" + h264_dxva2_hwaccel_select="h264_decoder" ++h264_qsv_decoder_deps="qsv" ++h264_qsv_decoder_select="h264_decoder" + h264_vaapi_hwaccel_deps="vaapi" + h264_vaapi_hwaccel_select="h264_decoder" + h264_vda_hwaccel_deps="vda" +@@ -3820,6 +3825,7 @@ check_header dxva.h + check_header dxva2api.h + check_header io.h + check_header malloc.h ++check_header msdk/mfxvideo.h + check_header poll.h + check_header sys/mman.h + check_header sys/param.h diff --git a/libavcodec/Makefile b/libavcodec/Makefile -index a32ff96..52ad9ad 100644 +index 6dfb9a0..4e2d840 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile -@@ -10,6 +10,7 @@ HEADERS = avcodec.h \ +@@ -4,6 +4,7 @@ FFLIBS = avutil + HEADERS = avcodec.h \ + avfft.h \ + dxva2.h \ ++ qsv.h \ + vaapi.h \ + vda.h \ vdpau.h \ - version.h \ - xvmc.h \ -+ qsv.h \ - - OBJS = allcodecs.o \ - audioconvert.o \ -@@ -196,6 +197,7 @@ OBJS-$(CONFIG_H264_DECODER) += h264.o \ +@@ -59,6 +60,7 @@ OBJS-$(CONFIG_MPEGAUDIODSP) += mpegaudiodsp.o \ + OBJS-$(CONFIG_MPEGVIDEO) += mpegvideo.o mpegvideo_motion.o + OBJS-$(CONFIG_MPEGVIDEOENC) += mpegvideo_enc.o mpeg12data.o \ + motion_est.o ratecontrol.o ++OBJS-$(CONFIG_QSV) += qsv.o + OBJS-$(CONFIG_RANGECODER) += rangecoder.o + RDFT-OBJS-$(CONFIG_HARDCODED_TABLES) += sin_tables.o + OBJS-$(CONFIG_RDFT) += rdft.o $(RDFT-OBJS-yes) +@@ -195,6 +197,7 @@ OBJS-$(CONFIG_H264_DECODER) += h264.o \ h264_loopfilter.o h264_direct.o \ cabac.o h264_sei.o h264_ps.o \ h264_refs.o h264_cavlc.o h264_cabac.o -+OBJS-$(CONFIG_H264_QSV_DECODER) += qsv_h264.o qsv.o - OBJS-$(CONFIG_H264_DXVA2_HWACCEL) += dxva2_h264.o - OBJS-$(CONFIG_H264_VAAPI_HWACCEL) += vaapi_h264.o - OBJS-$(CONFIG_H264_VDA_HWACCEL) += vda_h264.o ++OBJS-$(CONFIG_H264_QSV_DECODER) += qsv_h264.o + OBJS-$(CONFIG_HEVC_DECODER) += hevc.o hevc_mvs.o hevc_ps.o hevc_sei.o \ + hevc_cabac.o hevc_refs.o hevcpred.o \ + hevcdsp.o hevc_filter.o cabac.o +@@ -688,6 +691,7 @@ SKIPHEADERS += %_tablegen.h \ + SKIPHEADERS-$(CONFIG_DXVA2) += dxva2.h dxva2_internal.h + SKIPHEADERS-$(CONFIG_LIBSCHROEDINGER) += libschroedinger.h + SKIPHEADERS-$(CONFIG_MPEG_XVMC_DECODER) += xvmc.h ++SKIPHEADERS-$(CONFIG_QSV) += qsv.h + SKIPHEADERS-$(CONFIG_VAAPI) += vaapi_internal.h + SKIPHEADERS-$(CONFIG_VDA) += vda.h + SKIPHEADERS-$(CONFIG_VDPAU) += vdpau.h vdpau_internal.h diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c -index 5786719..94608b0 100644 +index 044f585..99d4d23 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c -@@ -143,6 +143,7 @@ void avcodec_register_all(void) +@@ -154,6 +154,7 @@ void avcodec_register_all(void) REGISTER_DECODER(H263I, h263i); REGISTER_ENCODER(H263P, h263p); REGISTER_DECODER(H264, h264); -+ REGISTER_DECODER(H264_QSV, h264_qsv); - REGISTER_DECODER(H264_VDPAU, h264_vdpau); ++ REGISTER_DECODER(H264_QSV, h264_qsv); + REGISTER_DECODER(HEVC, hevc); + REGISTER_DECODER(HNM4_VIDEO, hnm4_video); REGISTER_ENCDEC (HUFFYUV, huffyuv); - REGISTER_DECODER(IDCIN, idcin); diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c new file mode 100644 index 0000000..2c46111 @@ -1234,10 +1246,10 @@ index 0000000..52378cf +#endif //AVCODEC_QSV_H diff --git a/libavcodec/qsv_h264.c b/libavcodec/qsv_h264.c new file mode 100644 -index 0000000..a353c22 +index 0000000..53a9f16 --- /dev/null +++ b/libavcodec/qsv_h264.c -@@ -0,0 +1,984 @@ +@@ -0,0 +1,982 @@ +/* ********************************************************************* *\ + +Copyright (C) 2013 Intel Corporation. All rights reserved. @@ -1325,12 +1337,12 @@ index 0000000..a353c22 + +int ff_qsv_dec_init_clean(AVCodecContext *avctx) +{ -+ mfxStatus sts = MFX_ERR_NONE; -+ av_qsv_context *qsv = avctx->priv_data; -+ av_qsv_space *qsv_decode = qsv->dec_space; -+ av_qsv_context_clean(qsv); -+ av_freep(&avctx->priv_data); ++ av_qsv_context *qsv = avctx->priv_data; ++ av_qsv_context_clean(qsv); ++ av_freep(&avctx->priv_data); ++ return 0; +} ++ +int ff_qsv_dec_init(AVCodecContext * avctx) +{ + int ret = 0; @@ -1569,17 +1581,15 @@ index 0000000..a353c22 + return AVERROR(ENOMEM); + + if (!(*qsv_config_context)) { -+ av_log(avctx, AV_LOG_INFO, -+ "Using default config for QSV decode\n"); ++ av_log(avctx, AV_LOG_INFO, "Using default config for QSV decode\n"); + avctx->hwaccel_context = &av_qsv_default_config; -+ } else { -+ if ((*qsv_config_context)->io_pattern != -+ MFX_IOPATTERN_OUT_OPAQUE_MEMORY -+ && (*qsv_config_context)->io_pattern != -+ MFX_IOPATTERN_OUT_SYSTEM_MEMORY) { -+ av_log_missing_feature( avctx,"Only MFX_IOPATTERN_OUT_OPAQUE_MEMORY and MFX_IOPATTERN_OUT_SYSTEM_MEMORY are currently supported\n",0); -+ return AVERROR_PATCHWELCOME; -+ } ++ } else if ((*qsv_config_context)->io_pattern != MFX_IOPATTERN_OUT_OPAQUE_MEMORY && ++ (*qsv_config_context)->io_pattern != MFX_IOPATTERN_OUT_SYSTEM_MEMORY) { ++ avpriv_report_missing_feature(avctx, ++ "Only MFX_IOPATTERN_OUT_OPAQUE_MEMORY" ++ " and MFX_IOPATTERN_OUT_SYSTEM_MEMORY" ++ " are currently supported\n"); ++ return AVERROR_PATCHWELCOME; + } + + qsv->qsv_config = avctx->hwaccel_context; @@ -2294,14 +2304,14 @@ index 0000000..3cbdb3f + +#endif //AVCODEC_QSV_H264_H diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h -index 1072f00..de232d4 100644 +index 0d6e0a3..d2779b7 100644 --- a/libavutil/pixfmt.h +++ b/libavutil/pixfmt.h -@@ -178,6 +178,7 @@ enum AVPixelFormat { - AV_PIX_FMT_YUVA422P16LE, ///< planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian) - AV_PIX_FMT_YUVA444P16BE, ///< planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian) - AV_PIX_FMT_YUVA444P16LE, ///< planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian) -+ AV_PIX_FMT_QSV_H264, ///< H.264 HW decoding with QSV, data[2] contains qsv_atom information for MFX_IOPATTERN_OUT_OPAQUE_MEMORY, MFX_IOPATTERN_OUT_VIDEO_MEMORY +@@ -190,6 +190,7 @@ enum AVPixelFormat { + AV_PIX_FMT_NV16, ///< interleaved chroma YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples) + AV_PIX_FMT_NV20LE, ///< interleaved chroma YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + AV_PIX_FMT_NV20BE, ///< interleaved chroma YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian ++ AV_PIX_FMT_QSV_H264, ///< H.264 HW decoding with QSV, data[2] contains qsv_atom information for MFX_IOPATTERN_OUT_OPAQUE_MEMORY, MFX_IOPATTERN_OUT_VIDEO_MEMORY AV_PIX_FMT_NB, ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions #if FF_API_PIX_FMT |