Permalink
Browse files

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.
  • Loading branch information...
philipl committed Nov 16, 2017
1 parent 4c7b023 commit 8bca292c3045a7f372299f71c8d88b541fe2a816
Showing with 27 additions and 3 deletions.
  1. +1 −1 Changelog
  2. +2 −0 configure
  3. +1 −0 libavcodec/Makefile
  4. +1 −0 libavcodec/allcodecs.c
  5. +3 −0 libavcodec/mpeg12dec.c
  6. +1 −0 libavcodec/nvdec.c
  7. +17 −1 libavcodec/nvdec_mpeg12.c
  8. +1 −1 libavcodec/version.h
View
@@ -13,7 +13,7 @@ version <next>:
- PCE support for extended channel layouts in the AAC encoder
- native aptX encoder and decoder
- 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
- mcompand audio filter
- acontrast audio filter
View
@@ -2704,6 +2704,8 @@ mjpeg_cuvid_hwaccel_select="mjpeg_cuvid_decoder"
mpeg_xvmc_hwaccel_deps="xvmc"
mpeg_xvmc_hwaccel_select="mpeg2video_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_select="mpeg1video_decoder"
mpeg1_videotoolbox_hwaccel_deps="videotoolbox"
View
@@ -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
View
@@ -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);
View
@@ -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
View
@@ -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;
View
@@ -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
View
@@ -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, \

0 comments on commit 8bca292

Please sign in to comment.