Commit b90fdb2c authored by Anton Khirnov's avatar Anton Khirnov

hevcdec: add a CUVID hwaccel

parent 770cf1db
...@@ -18,7 +18,7 @@ version <next>: ...@@ -18,7 +18,7 @@ version <next>:
- support for decoding through D3D11VA in avconv - support for decoding through D3D11VA in avconv
- Cinepak encoder - Cinepak encoder
- Intel QSV-accelerated MJPEG encoding - Intel QSV-accelerated MJPEG encoding
- NVIDIA CUVID-accelerated H.264 decoding - NVIDIA CUVID-accelerated H.264 and HEVC decoding
version 12: version 12:
......
...@@ -2210,6 +2210,8 @@ h264_vda_old_hwaccel_deps="vda" ...@@ -2210,6 +2210,8 @@ h264_vda_old_hwaccel_deps="vda"
h264_vda_old_hwaccel_select="h264_decoder" h264_vda_old_hwaccel_select="h264_decoder"
h264_vdpau_hwaccel_deps="vdpau" h264_vdpau_hwaccel_deps="vdpau"
h264_vdpau_hwaccel_select="h264_decoder" h264_vdpau_hwaccel_select="h264_decoder"
hevc_cuvid_hwaccel_deps="cuvid CUVIDHEVCPICPARAMS"
hevc_cuvid_hwaccel_select="hevc_decoder"
hevc_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_HEVC" hevc_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_HEVC"
hevc_d3d11va_hwaccel_select="hevc_decoder" hevc_d3d11va_hwaccel_select="hevc_decoder"
hevc_d3d11va2_hwaccel_deps="d3d11va DXVA_PicParams_HEVC" hevc_d3d11va2_hwaccel_deps="d3d11va DXVA_PicParams_HEVC"
...@@ -4700,6 +4702,7 @@ check_lib psapi "windows.h psapi.h" GetProcessMemoryInfo -lpsapi ...@@ -4700,6 +4702,7 @@ check_lib psapi "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
check_type "cuviddec.h" "CUVIDH264PICPARAMS" check_type "cuviddec.h" "CUVIDH264PICPARAMS"
check_type "cuviddec.h" "CUVIDHEVCPICPARAMS"
check_struct "cuviddec.h" "CUVIDDECODECREATEINFO" bitDepthMinus8 check_struct "cuviddec.h" "CUVIDDECODECREATEINFO" bitDepthMinus8
check_type "windows.h dxva.h" "DXVA_PicParams_HEVC" -DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP -D_CRT_BUILD_DESKTOP_APP=0 check_type "windows.h dxva.h" "DXVA_PicParams_HEVC" -DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP -D_CRT_BUILD_DESKTOP_APP=0
......
...@@ -641,6 +641,7 @@ OBJS-$(CONFIG_H264_QSV_HWACCEL) += qsvdec_h2645.o ...@@ -641,6 +641,7 @@ OBJS-$(CONFIG_H264_QSV_HWACCEL) += qsvdec_h2645.o
OBJS-$(CONFIG_H264_VAAPI_HWACCEL) += vaapi_h264.o OBJS-$(CONFIG_H264_VAAPI_HWACCEL) += vaapi_h264.o
OBJS-$(CONFIG_H264_VDA_HWACCEL) += vda_h264.o OBJS-$(CONFIG_H264_VDA_HWACCEL) += vda_h264.o
OBJS-$(CONFIG_H264_VDPAU_HWACCEL) += vdpau_h264.o OBJS-$(CONFIG_H264_VDPAU_HWACCEL) += vdpau_h264.o
OBJS-$(CONFIG_HEVC_CUVID_HWACCEL) += cuvid_hevc.o
OBJS-$(CONFIG_HEVC_D3D11VA_HWACCEL) += dxva2_hevc.o OBJS-$(CONFIG_HEVC_D3D11VA_HWACCEL) += dxva2_hevc.o
OBJS-$(CONFIG_HEVC_DXVA2_HWACCEL) += dxva2_hevc.o OBJS-$(CONFIG_HEVC_DXVA2_HWACCEL) += dxva2_hevc.o
OBJS-$(CONFIG_HEVC_QSV_HWACCEL) += qsvdec_h2645.o OBJS-$(CONFIG_HEVC_QSV_HWACCEL) += qsvdec_h2645.o
......
...@@ -78,6 +78,7 @@ void avcodec_register_all(void) ...@@ -78,6 +78,7 @@ void avcodec_register_all(void)
REGISTER_HWACCEL(H264_VDA, h264_vda); REGISTER_HWACCEL(H264_VDA, h264_vda);
REGISTER_HWACCEL(H264_VDA_OLD, h264_vda_old); REGISTER_HWACCEL(H264_VDA_OLD, h264_vda_old);
REGISTER_HWACCEL(H264_VDPAU, h264_vdpau); REGISTER_HWACCEL(H264_VDPAU, h264_vdpau);
REGISTER_HWACCEL(HEVC_CUVID, hevc_cuvid);
REGISTER_HWACCEL(HEVC_D3D11VA, hevc_d3d11va); REGISTER_HWACCEL(HEVC_D3D11VA, hevc_d3d11va);
REGISTER_HWACCEL(HEVC_D3D11VA2, hevc_d3d11va2); REGISTER_HWACCEL(HEVC_D3D11VA2, hevc_d3d11va2);
REGISTER_HWACCEL(HEVC_DXVA2, hevc_dxva2); REGISTER_HWACCEL(HEVC_DXVA2, hevc_dxva2);
......
...@@ -53,6 +53,7 @@ static int map_avcodec_id(enum AVCodecID id) ...@@ -53,6 +53,7 @@ static int map_avcodec_id(enum AVCodecID id)
{ {
switch (id) { switch (id) {
case AV_CODEC_ID_H264: return cudaVideoCodec_H264; case AV_CODEC_ID_H264: return cudaVideoCodec_H264;
case AV_CODEC_ID_HEVC: return cudaVideoCodec_HEVC;
} }
return -1; return -1;
} }
......
This diff is collapsed.
...@@ -384,7 +384,8 @@ static void export_stream_params(AVCodecContext *avctx, const HEVCParamSets *ps, ...@@ -384,7 +384,8 @@ static void export_stream_params(AVCodecContext *avctx, const HEVCParamSets *ps,
static enum AVPixelFormat get_format(HEVCContext *s, const HEVCSPS *sps) static enum AVPixelFormat get_format(HEVCContext *s, const HEVCSPS *sps)
{ {
#define HWACCEL_MAX (CONFIG_HEVC_DXVA2_HWACCEL + CONFIG_HEVC_D3D11VA_HWACCEL * 2 + \ #define HWACCEL_MAX (CONFIG_HEVC_DXVA2_HWACCEL + CONFIG_HEVC_D3D11VA_HWACCEL * 2 + \
CONFIG_HEVC_VAAPI_HWACCEL + CONFIG_HEVC_VDPAU_HWACCEL) CONFIG_HEVC_VAAPI_HWACCEL + CONFIG_HEVC_VDPAU_HWACCEL + \
CONFIG_HEVC_CUVID_HWACCEL)
enum AVPixelFormat pix_fmts[HWACCEL_MAX + 2], *fmt = pix_fmts; enum AVPixelFormat pix_fmts[HWACCEL_MAX + 2], *fmt = pix_fmts;
if (sps->pix_fmt == AV_PIX_FMT_YUV420P || sps->pix_fmt == AV_PIX_FMT_YUVJ420P || if (sps->pix_fmt == AV_PIX_FMT_YUV420P || sps->pix_fmt == AV_PIX_FMT_YUVJ420P ||
...@@ -398,9 +399,15 @@ static enum AVPixelFormat get_format(HEVCContext *s, const HEVCSPS *sps) ...@@ -398,9 +399,15 @@ static enum AVPixelFormat get_format(HEVCContext *s, const HEVCSPS *sps)
#endif #endif
#if CONFIG_HEVC_VAAPI_HWACCEL #if CONFIG_HEVC_VAAPI_HWACCEL
*fmt++ = AV_PIX_FMT_VAAPI; *fmt++ = AV_PIX_FMT_VAAPI;
#endif
#if CONFIG_HEVC_CUVID_HWACCEL && HAVE_CUVIDDECODECREATEINFO_BITDEPTHMINUS8
*fmt++ = AV_PIX_FMT_CUDA;
#endif #endif
} }
if (sps->pix_fmt == AV_PIX_FMT_YUV420P || sps->pix_fmt == AV_PIX_FMT_YUVJ420P) { if (sps->pix_fmt == AV_PIX_FMT_YUV420P || sps->pix_fmt == AV_PIX_FMT_YUVJ420P) {
#if CONFIG_HEVC_CUVID_HWACCEL && !HAVE_CUVIDDECODECREATEINFO_BITDEPTHMINUS8
*fmt++ = AV_PIX_FMT_CUDA;
#endif
#if CONFIG_HEVC_VDPAU_HWACCEL #if CONFIG_HEVC_VDPAU_HWACCEL
*fmt++ = AV_PIX_FMT_VDPAU; *fmt++ = AV_PIX_FMT_VDPAU;
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment