diff options
author | Philip Langdale <philipl@overt.org> | 2017-11-16 07:38:10 -0800 |
---|---|---|
committer | Philip Langdale <philipl@overt.org> | 2017-11-20 07:03:26 -0800 |
commit | 8bca292c3045a7f372299f71c8d88b541fe2a816 (patch) | |
tree | 3b3367c83d6476c1f8d917988fbec92c5fb18bca /libavcodec | |
parent | 4c7b023d56e09a78a587d036db1b64bf7c493b3d (diff) | |
download | ffmpeg-8bca292c3045a7f372299f71c8d88b541fe2a816.tar.gz |
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.
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/Makefile | 1 | ||||
-rw-r--r-- | libavcodec/allcodecs.c | 1 | ||||
-rw-r--r-- | libavcodec/mpeg12dec.c | 3 | ||||
-rw-r--r-- | libavcodec/nvdec.c | 1 | ||||
-rw-r--r-- | libavcodec/nvdec_mpeg12.c | 18 | ||||
-rw-r--r-- | libavcodec/version.h | 2 |
6 files changed, 24 insertions, 2 deletions
diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 494c76da76..0573454c7b 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -849,6 +849,7 @@ OBJS-$(CONFIG_HEVC_NVDEC_HWACCEL) += nvdec_hevc.o OBJS-$(CONFIG_HEVC_QSV_HWACCEL) += qsvdec_h2645.o OBJS-$(CONFIG_HEVC_VAAPI_HWACCEL) += vaapi_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_VIDEOTOOLBOX_HWACCEL) += videotoolbox.o OBJS-$(CONFIG_MPEG1_XVMC_HWACCEL) += mpegvideo_xvmc.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index e0adb71951..e9df7049de 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -87,6 +87,7 @@ static void register_all(void) REGISTER_HWACCEL(HEVC_VIDEOTOOLBOX, hevc_videotoolbox); REGISTER_HWACCEL(MJPEG_CUVID, mjpeg_cuvid); REGISTER_HWACCEL(MPEG1_CUVID, mpeg1_cuvid); + REGISTER_HWACCEL(MPEG1_NVDEC, mpeg1_nvdec); REGISTER_HWACCEL(MPEG1_XVMC, mpeg1_xvmc); REGISTER_HWACCEL(MPEG1_VDPAU, mpeg1_vdpau); REGISTER_HWACCEL(MPEG1_VIDEOTOOLBOX, mpeg1_videotoolbox); diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index 2b213eebcd..5a51d09bb0 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -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[] = { +#if CONFIG_MPEG1_NVDEC_HWACCEL + AV_PIX_FMT_CUDA, +#endif #if CONFIG_MPEG1_XVMC_HWACCEL AV_PIX_FMT_XVMC, #endif diff --git a/libavcodec/nvdec.c b/libavcodec/nvdec.c index 97ff605f0f..d5cf1058cb 100644 --- a/libavcodec/nvdec.c +++ b/libavcodec/nvdec.c @@ -54,6 +54,7 @@ static int map_avcodec_id(enum AVCodecID id) switch (id) { case AV_CODEC_ID_H264: return cudaVideoCodec_H264; 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_VC1: return cudaVideoCodec_VC1; case AV_CODEC_ID_VP9: return cudaVideoCodec_VP9; diff --git a/libavcodec/nvdec_mpeg12.c b/libavcodec/nvdec_mpeg12.c index db9cebeddd..e29d085a79 100644 --- a/libavcodec/nvdec_mpeg12.c +++ b/libavcodec/nvdec_mpeg12.c @@ -1,5 +1,5 @@ /* - * MPEG-2 HW decode acceleration through NVDEC + * MPEG-1/2 HW decode acceleration through NVDEC * * Copyright (c) 2017 Philip Langdale * @@ -105,3 +105,19 @@ AVHWAccel ff_mpeg2_nvdec_hwaccel = { .priv_data_size = sizeof(NVDECContext), }; #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 diff --git a/libavcodec/version.h b/libavcodec/version.h index 5b25a9a8ac..ff54670ea9 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,7 +29,7 @@ #define LIBAVCODEC_VERSION_MAJOR 58 #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, \ LIBAVCODEC_VERSION_MINOR, \ |