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 DRM is enabled the pluginname is softhddrm
|
||||
VAAPI ?= 0
|
||||
CUVID ?= 0
|
||||
CUVID ?= 1
|
||||
|
||||
# if you enable DRM then the plugin will only run without X server
|
||||
# only valid for VAAPI
|
||||
@ -28,7 +28,10 @@ LIBPLACEBO ?= 1
|
||||
LIBPLACEBO_GL ?= 0
|
||||
|
||||
# use YADIF deint - only available with cuvid
|
||||
YADIF = 1
|
||||
YADIF = 0
|
||||
|
||||
# use BWDIF deint - only available with cuvid
|
||||
BWDIF = 1
|
||||
|
||||
# use gamma correction
|
||||
#GAMMA ?= 0
|
||||
@ -185,6 +188,9 @@ LIBS += -lEGL -lGL
|
||||
ifeq ($(YADIF),1)
|
||||
CONFIG += -DYADIF # Yadif only with CUVID
|
||||
endif
|
||||
ifeq ($(BWDIF),1)
|
||||
CONFIG += -DBWDIF # Bwdif only with CUVID
|
||||
endif
|
||||
endif
|
||||
|
||||
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.
|
||||
|
||||
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
|
||||
jojo61
|
||||
|
25
codec.c
25
codec.c
@ -265,7 +265,7 @@ void CodecVideoOpen(VideoDecoder *decoder, int codec_id) {
|
||||
|
||||
pthread_mutex_lock(&CodecLockMutex);
|
||||
// open codec
|
||||
#ifdef YADIF
|
||||
#if defined(YADIF) || defined(BWDIF)
|
||||
deint = 2;
|
||||
#endif
|
||||
|
||||
@ -370,7 +370,7 @@ void CodecVideoOpen(VideoDecoder *decoder, int codec_id) {
|
||||
|
||||
// reset buggy ffmpeg/libav flag
|
||||
decoder->GetFormatDone = 0;
|
||||
#if defined(YADIF)
|
||||
#if defined(YADIF) || defined(BWDIF)
|
||||
decoder->filter = 0;
|
||||
#endif
|
||||
}
|
||||
@ -446,7 +446,7 @@ void DisplayPts(AVCodecContext * video_ctx, AVFrame * frame)
|
||||
*/
|
||||
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 push_filters(AVCodecContext *dec_ctx, void *decoder, AVFrame *frame);
|
||||
#endif
|
||||
@ -570,6 +570,25 @@ next_part:
|
||||
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
|
||||
// DisplayPts(video_ctx, frame);
|
||||
VideoRenderFrame(decoder->HwDecoder, video_ctx, frame);
|
||||
|
@ -7,7 +7,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: VDR \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"
|
||||
"Last-Translator: blabla\n"
|
||||
"Language-Team: blabla\n"
|
||||
@ -162,10 +162,6 @@ msgstr ""
|
||||
msgid "audio: '%s' output module isn't supported\n"
|
||||
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"
|
||||
msgstr ""
|
||||
|
||||
@ -196,9 +192,6 @@ msgstr ""
|
||||
msgid "codec: can't allocate video decoder frame buffer\n"
|
||||
msgstr ""
|
||||
|
||||
msgid "video: Init of YADIF Filter failed\n"
|
||||
msgstr ""
|
||||
|
||||
msgid "codec: can't allocate audio decoder\n"
|
||||
msgstr ""
|
||||
|
||||
|
@ -1131,6 +1131,16 @@ void cMenuSetupSoft::Create(void) {
|
||||
"Y",
|
||||
};
|
||||
#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 resolution[RESOLUTIONS] = {"576i", "720p", "fake 1080", "1080", "2160p"};
|
||||
@ -1248,7 +1258,7 @@ void cMenuSetupSoft::Create(void) {
|
||||
#ifdef PLACEBO
|
||||
Add(new cMenuEditStraItem(tr("Scaling"), &Scaling[i], scalers, scaling));
|
||||
#endif
|
||||
#ifdef YADIF
|
||||
#if defined(YADIF) || defined(BWDIF)
|
||||
if (i == 0 || i == 2 || i == 3) {
|
||||
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>
|
||||
|
||||
#if defined(YADIF) || defined(VAAPI)
|
||||
#if defined(YADIF) || defined(BWDIF) || defined(VAAPI)
|
||||
#include <libavfilter/buffersink.h>
|
||||
#include <libavfilter/buffersrc.h>
|
||||
#include <libavutil/opt.h>
|
||||
@ -243,11 +243,18 @@ typedef enum _video_resolutions_ {
|
||||
///
|
||||
/// Video deinterlace modes.
|
||||
///
|
||||
#ifdef YADIF
|
||||
typedef enum _video_deinterlace_modes_ {
|
||||
VideoDeinterlaceCuda, ///< Cuda build in deinterlace
|
||||
VideoDeinterlaceYadif, ///< Yadif deinterlace
|
||||
} VideoDeinterlaceModes;
|
||||
|
||||
#endif
|
||||
#ifdef BWDIF
|
||||
typedef enum _video_deinterlace_modes_ {
|
||||
VideoDeinterlaceCuda, ///< Cuda build in deinterlace
|
||||
VideoDeinterlaceBwdif, ///< Bwdif deinterlace
|
||||
} VideoDeinterlaceModes;
|
||||
#endif
|
||||
///
|
||||
/// Video scaleing modes.
|
||||
///
|
||||
@ -1414,7 +1421,7 @@ typedef struct _cuvid_decoder_ {
|
||||
int SyncOnAudio; ///< flag sync to audio
|
||||
int64_t PTS; ///< video PTS clock
|
||||
|
||||
#if defined(YADIF) || defined(VAAPI)
|
||||
#if defined(YADIF) || defined(BWDIF) || defined(VAAPI)
|
||||
AVFilterContext *buffersink_ctx;
|
||||
AVFilterContext *buffersrc_ctx;
|
||||
AVFilterGraph *filter_graph;
|
||||
@ -2666,7 +2673,7 @@ static unsigned CuvidGetVideoSurface(CuvidDecoder *decoder, const AVCodecContext
|
||||
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);
|
||||
|
||||
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";
|
||||
enum AVPixelFormat pix_fmts[] = {format, AV_PIX_FMT_NONE};
|
||||
#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];
|
||||
int ret = 0;
|
||||
@ -2757,7 +2768,7 @@ int init_filters(AVCodecContext *dec_ctx, CuvidDecoder *decoder, AVFrame *frame)
|
||||
Debug(3, "Cannot create buffer sink\n");
|
||||
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);
|
||||
if (ret < 0) {
|
||||
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"));
|
||||
}
|
||||
#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);
|
||||
decoder->InputAspect = video_ctx->sample_aspect_ratio;
|
||||
|
Loading…
x
Reference in New Issue
Block a user