Commit 8bca292c authored by Philip Langdale's avatar Philip Langdale

avcodec: Implement mpeg1 nvdec hwaccel

Once I remembered that there's a separate decoder type for mpeg1,
even though params struct is shared with mpeg2, everything worked.
parent 4c7b023d
...@@ -13,7 +13,7 @@ version <next>: ...@@ -13,7 +13,7 @@ version <next>:
- PCE support for extended channel layouts in the AAC encoder - PCE support for extended channel layouts in the AAC encoder
- native aptX encoder and decoder - native aptX encoder and decoder
- Raw aptX muxer and demuxer - Raw aptX muxer and demuxer
- NVIDIA NVDEC-accelerated H.264, HEVC, MPEG-2, VC1 and VP9 hwaccel decoding - NVIDIA NVDEC-accelerated H.264, HEVC, MPEG-1/2, VC1 and VP9 hwaccel decoding
- Intel QSV-accelerated overlay filter - Intel QSV-accelerated overlay filter
- mcompand audio filter - mcompand audio filter
- acontrast audio filter - acontrast audio filter
......
...@@ -2704,6 +2704,8 @@ mjpeg_cuvid_hwaccel_select="mjpeg_cuvid_decoder" ...@@ -2704,6 +2704,8 @@ mjpeg_cuvid_hwaccel_select="mjpeg_cuvid_decoder"
mpeg_xvmc_hwaccel_deps="xvmc" mpeg_xvmc_hwaccel_deps="xvmc"
mpeg_xvmc_hwaccel_select="mpeg2video_decoder" mpeg_xvmc_hwaccel_select="mpeg2video_decoder"
mpeg1_cuvid_hwaccel_select="mpeg1_cuvid_decoder" mpeg1_cuvid_hwaccel_select="mpeg1_cuvid_decoder"
mpeg1_nvdec_hwaccel_deps="nvdec"
mpeg1_nvdec_hwaccel_select="mpeg1video_decoder"
mpeg1_vdpau_hwaccel_deps="vdpau" mpeg1_vdpau_hwaccel_deps="vdpau"
mpeg1_vdpau_hwaccel_select="mpeg1video_decoder" mpeg1_vdpau_hwaccel_select="mpeg1video_decoder"
mpeg1_videotoolbox_hwaccel_deps="videotoolbox" mpeg1_videotoolbox_hwaccel_deps="videotoolbox"
......
...@@ -849,6 +849,7 @@ OBJS-$(CONFIG_HEVC_NVDEC_HWACCEL) += nvdec_hevc.o ...@@ -849,6 +849,7 @@ OBJS-$(CONFIG_HEVC_NVDEC_HWACCEL) += nvdec_hevc.o
OBJS-$(CONFIG_HEVC_QSV_HWACCEL) += qsvdec_h2645.o OBJS-$(CONFIG_HEVC_QSV_HWACCEL) += qsvdec_h2645.o
OBJS-$(CONFIG_HEVC_VAAPI_HWACCEL) += vaapi_hevc.o OBJS-$(CONFIG_HEVC_VAAPI_HWACCEL) += vaapi_hevc.o
OBJS-$(CONFIG_HEVC_VDPAU_HWACCEL) += vdpau_hevc.o OBJS-$(CONFIG_HEVC_VDPAU_HWACCEL) += vdpau_hevc.o
OBJS-$(CONFIG_MPEG1_NVDEC_HWACCEL) += nvdec_mpeg12.o
OBJS-$(CONFIG_MPEG1_VDPAU_HWACCEL) += vdpau_mpeg12.o OBJS-$(CONFIG_MPEG1_VDPAU_HWACCEL) += vdpau_mpeg12.o
OBJS-$(CONFIG_MPEG1_VIDEOTOOLBOX_HWACCEL) += videotoolbox.o OBJS-$(CONFIG_MPEG1_VIDEOTOOLBOX_HWACCEL) += videotoolbox.o
OBJS-$(CONFIG_MPEG1_XVMC_HWACCEL) += mpegvideo_xvmc.o OBJS-$(CONFIG_MPEG1_XVMC_HWACCEL) += mpegvideo_xvmc.o
......
...@@ -87,6 +87,7 @@ static void register_all(void) ...@@ -87,6 +87,7 @@ static void register_all(void)
REGISTER_HWACCEL(HEVC_VIDEOTOOLBOX, hevc_videotoolbox); REGISTER_HWACCEL(HEVC_VIDEOTOOLBOX, hevc_videotoolbox);
REGISTER_HWACCEL(MJPEG_CUVID, mjpeg_cuvid); REGISTER_HWACCEL(MJPEG_CUVID, mjpeg_cuvid);
REGISTER_HWACCEL(MPEG1_CUVID, mpeg1_cuvid); REGISTER_HWACCEL(MPEG1_CUVID, mpeg1_cuvid);
REGISTER_HWACCEL(MPEG1_NVDEC, mpeg1_nvdec);
REGISTER_HWACCEL(MPEG1_XVMC, mpeg1_xvmc); REGISTER_HWACCEL(MPEG1_XVMC, mpeg1_xvmc);
REGISTER_HWACCEL(MPEG1_VDPAU, mpeg1_vdpau); REGISTER_HWACCEL(MPEG1_VDPAU, mpeg1_vdpau);
REGISTER_HWACCEL(MPEG1_VIDEOTOOLBOX, mpeg1_videotoolbox); REGISTER_HWACCEL(MPEG1_VIDEOTOOLBOX, mpeg1_videotoolbox);
......
...@@ -1130,6 +1130,9 @@ static void quant_matrix_rebuild(uint16_t *matrix, const uint8_t *old_perm, ...@@ -1130,6 +1130,9 @@ static void quant_matrix_rebuild(uint16_t *matrix, const uint8_t *old_perm,
} }
static const enum AVPixelFormat mpeg1_hwaccel_pixfmt_list_420[] = { static const enum AVPixelFormat mpeg1_hwaccel_pixfmt_list_420[] = {
#if CONFIG_MPEG1_NVDEC_HWACCEL
AV_PIX_FMT_CUDA,
#endif
#if CONFIG_MPEG1_XVMC_HWACCEL #if CONFIG_MPEG1_XVMC_HWACCEL
AV_PIX_FMT_XVMC, AV_PIX_FMT_XVMC,
#endif #endif
......
...@@ -54,6 +54,7 @@ static int map_avcodec_id(enum AVCodecID id) ...@@ -54,6 +54,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; case AV_CODEC_ID_HEVC: return cudaVideoCodec_HEVC;
case AV_CODEC_ID_MPEG1VIDEO: return cudaVideoCodec_MPEG1;
case AV_CODEC_ID_MPEG2VIDEO: return cudaVideoCodec_MPEG2; case AV_CODEC_ID_MPEG2VIDEO: return cudaVideoCodec_MPEG2;
case AV_CODEC_ID_VC1: return cudaVideoCodec_VC1; case AV_CODEC_ID_VC1: return cudaVideoCodec_VC1;
case AV_CODEC_ID_VP9: return cudaVideoCodec_VP9; case AV_CODEC_ID_VP9: return cudaVideoCodec_VP9;
......
/* /*
* MPEG-2 HW decode acceleration through NVDEC * MPEG-1/2 HW decode acceleration through NVDEC
* *
* Copyright (c) 2017 Philip Langdale * Copyright (c) 2017 Philip Langdale
* *
...@@ -105,3 +105,19 @@ AVHWAccel ff_mpeg2_nvdec_hwaccel = { ...@@ -105,3 +105,19 @@ AVHWAccel ff_mpeg2_nvdec_hwaccel = {
.priv_data_size = sizeof(NVDECContext), .priv_data_size = sizeof(NVDECContext),
}; };
#endif #endif
#if CONFIG_MPEG1_NVDEC_HWACCEL
AVHWAccel ff_mpeg1_nvdec_hwaccel = {
.name = "mpeg1_nvdec",
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_MPEG1VIDEO,
.pix_fmt = AV_PIX_FMT_CUDA,
.start_frame = nvdec_mpeg12_start_frame,
.end_frame = ff_nvdec_simple_end_frame,
.decode_slice = ff_nvdec_simple_decode_slice,
.frame_params = nvdec_mpeg12_frame_params,
.init = ff_nvdec_decode_init,
.uninit = ff_nvdec_decode_uninit,
.priv_data_size = sizeof(NVDECContext),
};
#endif
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#define LIBAVCODEC_VERSION_MAJOR 58 #define LIBAVCODEC_VERSION_MAJOR 58
#define LIBAVCODEC_VERSION_MINOR 3 #define LIBAVCODEC_VERSION_MINOR 3
#define LIBAVCODEC_VERSION_MICRO 103 #define LIBAVCODEC_VERSION_MICRO 104
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \ LIBAVCODEC_VERSION_MINOR, \
......
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