mirror of
https://github.com/jojo61/vdr-plugin-softhdcuvid.git
synced 2025-03-01 10:39:28 +00:00
bwdif
This commit is contained in:
parent
3f06eaea84
commit
6c8a98eafb
10
Makefile
10
Makefile
@ -16,7 +16,7 @@
|
|||||||
# if CUVID is enabled the pluginname is softhdcuvid
|
# if CUVID is enabled the pluginname is softhdcuvid
|
||||||
# if DRM is enabled the pluginname is softhddrm
|
# if DRM is enabled the pluginname is softhddrm
|
||||||
VAAPI ?= 0
|
VAAPI ?= 0
|
||||||
CUVID ?= 0
|
CUVID ?= 1
|
||||||
|
|
||||||
# if you enable DRM then the plugin will only run without X server
|
# if you enable DRM then the plugin will only run without X server
|
||||||
# only valid for VAAPI
|
# only valid for VAAPI
|
||||||
@ -28,7 +28,10 @@ LIBPLACEBO ?= 1
|
|||||||
LIBPLACEBO_GL ?= 0
|
LIBPLACEBO_GL ?= 0
|
||||||
|
|
||||||
# use YADIF deint - only available with cuvid
|
# use YADIF deint - only available with cuvid
|
||||||
YADIF = 1
|
YADIF = 0
|
||||||
|
|
||||||
|
# use BWDIF deint - only available with cuvid
|
||||||
|
BWDIF = 1
|
||||||
|
|
||||||
# use gamma correction
|
# use gamma correction
|
||||||
#GAMMA ?= 0
|
#GAMMA ?= 0
|
||||||
@ -185,6 +188,9 @@ LIBS += -lEGL -lGL
|
|||||||
ifeq ($(YADIF),1)
|
ifeq ($(YADIF),1)
|
||||||
CONFIG += -DYADIF # Yadif only with CUVID
|
CONFIG += -DYADIF # Yadif only with CUVID
|
||||||
endif
|
endif
|
||||||
|
ifeq ($(BWDIF),1)
|
||||||
|
CONFIG += -DBWDIF # Bwdif only with CUVID
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(GAMMA),1)
|
ifeq ($(GAMMA),1)
|
||||||
|
@ -59,7 +59,7 @@ It also needs the NVIDIA driver 410.48 or newer as well as CUDA 10.
|
|||||||
|
|
||||||
I recommend to use libplacebo. It has much better scaler and does colorconversion for HDR the correct way.
|
I recommend to use libplacebo. It has much better scaler and does colorconversion for HDR the correct way.
|
||||||
|
|
||||||
If your FFMEG supports it then you can enable YADIF in the Makefile and select between the buildin NVIDIA CUDA deinterlacer and the YADIF cuda deinterlacer.
|
If your FFMEG supports it then you can enable YADIF or BWDIF in the Makefile and select between the buildin NVIDIA CUDA deinterlacer and the YADIF or BWDIF cuda deinterlacer.
|
||||||
|
|
||||||
Good luck
|
Good luck
|
||||||
jojo61
|
jojo61
|
||||||
|
25
codec.c
25
codec.c
@ -265,7 +265,7 @@ void CodecVideoOpen(VideoDecoder *decoder, int codec_id) {
|
|||||||
|
|
||||||
pthread_mutex_lock(&CodecLockMutex);
|
pthread_mutex_lock(&CodecLockMutex);
|
||||||
// open codec
|
// open codec
|
||||||
#ifdef YADIF
|
#if defined(YADIF) || defined(BWDIF)
|
||||||
deint = 2;
|
deint = 2;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -370,7 +370,7 @@ void CodecVideoOpen(VideoDecoder *decoder, int codec_id) {
|
|||||||
|
|
||||||
// reset buggy ffmpeg/libav flag
|
// reset buggy ffmpeg/libav flag
|
||||||
decoder->GetFormatDone = 0;
|
decoder->GetFormatDone = 0;
|
||||||
#if defined(YADIF)
|
#if defined(YADIF) || defined(BWDIF)
|
||||||
decoder->filter = 0;
|
decoder->filter = 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -446,7 +446,7 @@ void DisplayPts(AVCodecContext * video_ctx, AVFrame * frame)
|
|||||||
*/
|
*/
|
||||||
extern int CuvidTestSurfaces();
|
extern int CuvidTestSurfaces();
|
||||||
|
|
||||||
#if defined YADIF || defined(VAAPI)
|
#if defined(YADIF) || defined(BWDIF) || defined(VAAPI)
|
||||||
extern int init_filters(AVCodecContext *dec_ctx, void *decoder, AVFrame *frame);
|
extern int init_filters(AVCodecContext *dec_ctx, void *decoder, AVFrame *frame);
|
||||||
extern int push_filters(AVCodecContext *dec_ctx, void *decoder, AVFrame *frame);
|
extern int push_filters(AVCodecContext *dec_ctx, void *decoder, AVFrame *frame);
|
||||||
#endif
|
#endif
|
||||||
@ -570,6 +570,25 @@ next_part:
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef BWDIF
|
||||||
|
if (decoder->filter) {
|
||||||
|
if (decoder->filter == 1) {
|
||||||
|
if (init_filters(video_ctx, decoder->HwDecoder, frame) < 0) {
|
||||||
|
Debug(3,"video: Init of BWDIF Filter failed\n");
|
||||||
|
decoder->filter = 0;
|
||||||
|
} else {
|
||||||
|
Debug(3, "Init BWDIF ok\n");
|
||||||
|
decoder->filter = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (frame->interlaced_frame && decoder->filter == 2 &&
|
||||||
|
(frame->height != 720)) { // broken ZDF sends Interlaced flag
|
||||||
|
ret = push_filters(video_ctx, decoder->HwDecoder, frame);
|
||||||
|
// av_frame_unref(frame);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
// DisplayPts(video_ctx, frame);
|
// DisplayPts(video_ctx, frame);
|
||||||
VideoRenderFrame(decoder->HwDecoder, video_ctx, frame);
|
VideoRenderFrame(decoder->HwDecoder, video_ctx, frame);
|
||||||
|
@ -7,7 +7,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: VDR \n"
|
"Project-Id-Version: VDR \n"
|
||||||
"Report-Msgid-Bugs-To: <see README>\n"
|
"Report-Msgid-Bugs-To: <see README>\n"
|
||||||
"POT-Creation-Date: 2021-12-30 10:23+0100\n"
|
"POT-Creation-Date: 2023-12-02 19:49+0100\n"
|
||||||
"PO-Revision-Date: blabla\n"
|
"PO-Revision-Date: blabla\n"
|
||||||
"Last-Translator: blabla\n"
|
"Last-Translator: blabla\n"
|
||||||
"Language-Team: blabla\n"
|
"Language-Team: blabla\n"
|
||||||
@ -162,10 +162,6 @@ msgstr ""
|
|||||||
msgid "audio: '%s' output module isn't supported\n"
|
msgid "audio: '%s' output module isn't supported\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#, c-format
|
|
||||||
msgid "audio: %6dHz supports %d %d %d %d %d %d %d %d channels\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "codec: can't allocate vodeo decoder\n"
|
msgid "codec: can't allocate vodeo decoder\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@ -196,9 +192,6 @@ msgstr ""
|
|||||||
msgid "codec: can't allocate video decoder frame buffer\n"
|
msgid "codec: can't allocate video decoder frame buffer\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgid "video: Init of YADIF Filter failed\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "codec: can't allocate audio decoder\n"
|
msgid "codec: can't allocate audio decoder\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -1131,6 +1131,16 @@ void cMenuSetupSoft::Create(void) {
|
|||||||
"Y",
|
"Y",
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef BWDIF
|
||||||
|
static const char *const deinterlace[] = {
|
||||||
|
"Cuda",
|
||||||
|
"Bwdif",
|
||||||
|
};
|
||||||
|
static const char *const deinterlace_short[] = {
|
||||||
|
"C",
|
||||||
|
"B",
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
static const char *const audiodrift[] = {"None", "PCM", "AC-3", "PCM + AC-3"};
|
static const char *const audiodrift[] = {"None", "PCM", "AC-3", "PCM + AC-3"};
|
||||||
static const char *const resolution[RESOLUTIONS] = {"576i", "720p", "fake 1080", "1080", "2160p"};
|
static const char *const resolution[RESOLUTIONS] = {"576i", "720p", "fake 1080", "1080", "2160p"};
|
||||||
@ -1248,7 +1258,7 @@ void cMenuSetupSoft::Create(void) {
|
|||||||
#ifdef PLACEBO
|
#ifdef PLACEBO
|
||||||
Add(new cMenuEditStraItem(tr("Scaling"), &Scaling[i], scalers, scaling));
|
Add(new cMenuEditStraItem(tr("Scaling"), &Scaling[i], scalers, scaling));
|
||||||
#endif
|
#endif
|
||||||
#ifdef YADIF
|
#if defined(YADIF) || defined(BWDIF)
|
||||||
if (i == 0 || i == 2 || i == 3) {
|
if (i == 0 || i == 2 || i == 3) {
|
||||||
Add(new cMenuEditStraItem(tr("Deinterlace"), &Deinterlace[i], 2, deinterlace));
|
Add(new cMenuEditStraItem(tr("Deinterlace"), &Deinterlace[i], 2, deinterlace));
|
||||||
}
|
}
|
||||||
|
34
video.c
34
video.c
@ -199,7 +199,7 @@ typedef void *EGLImageKHR;
|
|||||||
|
|
||||||
#include <libswscale/swscale.h>
|
#include <libswscale/swscale.h>
|
||||||
|
|
||||||
#if defined(YADIF) || defined(VAAPI)
|
#if defined(YADIF) || defined(BWDIF) || defined(VAAPI)
|
||||||
#include <libavfilter/buffersink.h>
|
#include <libavfilter/buffersink.h>
|
||||||
#include <libavfilter/buffersrc.h>
|
#include <libavfilter/buffersrc.h>
|
||||||
#include <libavutil/opt.h>
|
#include <libavutil/opt.h>
|
||||||
@ -243,11 +243,18 @@ typedef enum _video_resolutions_ {
|
|||||||
///
|
///
|
||||||
/// Video deinterlace modes.
|
/// Video deinterlace modes.
|
||||||
///
|
///
|
||||||
|
#ifdef YADIF
|
||||||
typedef enum _video_deinterlace_modes_ {
|
typedef enum _video_deinterlace_modes_ {
|
||||||
VideoDeinterlaceCuda, ///< Cuda build in deinterlace
|
VideoDeinterlaceCuda, ///< Cuda build in deinterlace
|
||||||
VideoDeinterlaceYadif, ///< Yadif deinterlace
|
VideoDeinterlaceYadif, ///< Yadif deinterlace
|
||||||
} VideoDeinterlaceModes;
|
} VideoDeinterlaceModes;
|
||||||
|
#endif
|
||||||
|
#ifdef BWDIF
|
||||||
|
typedef enum _video_deinterlace_modes_ {
|
||||||
|
VideoDeinterlaceCuda, ///< Cuda build in deinterlace
|
||||||
|
VideoDeinterlaceBwdif, ///< Bwdif deinterlace
|
||||||
|
} VideoDeinterlaceModes;
|
||||||
|
#endif
|
||||||
///
|
///
|
||||||
/// Video scaleing modes.
|
/// Video scaleing modes.
|
||||||
///
|
///
|
||||||
@ -1414,7 +1421,7 @@ typedef struct _cuvid_decoder_ {
|
|||||||
int SyncOnAudio; ///< flag sync to audio
|
int SyncOnAudio; ///< flag sync to audio
|
||||||
int64_t PTS; ///< video PTS clock
|
int64_t PTS; ///< video PTS clock
|
||||||
|
|
||||||
#if defined(YADIF) || defined(VAAPI)
|
#if defined(YADIF) || defined(BWDIF) || defined(VAAPI)
|
||||||
AVFilterContext *buffersink_ctx;
|
AVFilterContext *buffersink_ctx;
|
||||||
AVFilterContext *buffersrc_ctx;
|
AVFilterContext *buffersrc_ctx;
|
||||||
AVFilterGraph *filter_graph;
|
AVFilterGraph *filter_graph;
|
||||||
@ -2666,7 +2673,7 @@ static unsigned CuvidGetVideoSurface(CuvidDecoder *decoder, const AVCodecContext
|
|||||||
return CuvidGetVideoSurface0(decoder);
|
return CuvidGetVideoSurface0(decoder);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(VAAPI) || defined(YADIF)
|
#if defined(VAAPI) || defined(YADIF) || defined(BWDIF)
|
||||||
static void CuvidSyncRenderFrame(CuvidDecoder *decoder, const AVCodecContext *video_ctx, AVFrame *frame);
|
static void CuvidSyncRenderFrame(CuvidDecoder *decoder, const AVCodecContext *video_ctx, AVFrame *frame);
|
||||||
|
|
||||||
int push_filters(AVCodecContext *dec_ctx, CuvidDecoder *decoder, AVFrame *frame) {
|
int push_filters(AVCodecContext *dec_ctx, CuvidDecoder *decoder, AVFrame *frame) {
|
||||||
@ -2705,6 +2712,10 @@ int init_filters(AVCodecContext *dec_ctx, CuvidDecoder *decoder, AVFrame *frame)
|
|||||||
const char *filters_descr = "yadif_cuda=1:0:1"; // mode=send_field,parity=tff,deint=interlaced";
|
const char *filters_descr = "yadif_cuda=1:0:1"; // mode=send_field,parity=tff,deint=interlaced";
|
||||||
enum AVPixelFormat pix_fmts[] = {format, AV_PIX_FMT_NONE};
|
enum AVPixelFormat pix_fmts[] = {format, AV_PIX_FMT_NONE};
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef BWDIF
|
||||||
|
const char *filters_descr = "bwdif_cuda=1:0:1"; // mode=send_field,parity=tff,deint=interlaced";
|
||||||
|
enum AVPixelFormat pix_fmts[] = {format, AV_PIX_FMT_NONE};
|
||||||
|
#endif
|
||||||
|
|
||||||
char args[512];
|
char args[512];
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
@ -2757,7 +2768,7 @@ int init_filters(AVCodecContext *dec_ctx, CuvidDecoder *decoder, AVFrame *frame)
|
|||||||
Debug(3, "Cannot create buffer sink\n");
|
Debug(3, "Cannot create buffer sink\n");
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
#ifdef YADIF
|
#if defined(YADIF) || defined(BWDIF)
|
||||||
ret = av_opt_set_int_list(decoder->buffersink_ctx, "pix_fmts", pix_fmts, AV_PIX_FMT_NONE, AV_OPT_SEARCH_CHILDREN);
|
ret = av_opt_set_int_list(decoder->buffersink_ctx, "pix_fmts", pix_fmts, AV_PIX_FMT_NONE, AV_OPT_SEARCH_CHILDREN);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
Debug(3, "Cannot set output pixel format\n");
|
Debug(3, "Cannot set output pixel format\n");
|
||||||
@ -2988,6 +2999,19 @@ static enum AVPixelFormat Cuvid_get_format(CuvidDecoder *decoder, AVCodecContext
|
|||||||
Fatal(_("codec: can't set option deint to video codec!\n"));
|
Fatal(_("codec: can't set option deint to video codec!\n"));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef BWDIF
|
||||||
|
if (VideoDeinterlace[decoder->Resolution] == VideoDeinterlaceBwdif) {
|
||||||
|
deint = 0;
|
||||||
|
ist->filter = 1; // init bwdif_cuda
|
||||||
|
} else {
|
||||||
|
deint = 2;
|
||||||
|
ist->filter = 0;
|
||||||
|
}
|
||||||
|
CuvidMessage(2, "deint = %s\n", deint == 0 ? "Bwdif" : "Cuda");
|
||||||
|
if (av_opt_set_int(video_ctx->priv_data, "deint", deint, 0) < 0) { // adaptive
|
||||||
|
Fatal(_("codec: can't set option deint to video codec!\n"));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
CuvidMessage(2, "GetFormat Init ok %dx%d\n", video_ctx->width, video_ctx->height);
|
CuvidMessage(2, "GetFormat Init ok %dx%d\n", video_ctx->width, video_ctx->height);
|
||||||
decoder->InputAspect = video_ctx->sample_aspect_ratio;
|
decoder->InputAspect = video_ctx->sample_aspect_ratio;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user