commit 4575071bbb87ed5f61299c1707dd3b69c5fa0ed4
Author: Jakub Bogusz <[email protected]>
Date:   Mon May 27 20:15:06 2024 +0200

    - added nvenc patch (prepare for nv-codec SDK 12.2); added avisynth support

 ffmpeg-nvenc.patch | 107 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 ffmpeg.spec        |   7 ++++
 2 files changed, 114 insertions(+)
---
diff --git a/ffmpeg.spec b/ffmpeg.spec
index aff2a8b..66c2e62 100644
--- a/ffmpeg.spec
+++ b/ffmpeg.spec
@@ -17,6 +17,7 @@
 %bcond_without amr             # AMR-NB/WB de/encoding via libopencore-amrnb/wb
 %bcond_without aom             # AV1 viden de/encoding via libaom
 %bcond_without aribb24         # ARIB text and caption decoding via libaribb24
+%bcond_without avisynth        # AviSynth scripts support
 %bcond_without avs             # AVS encoding via xavs
 %bcond_without avs2            # AVS2 de/encoding via libdavs2/libxavs2
 %bcond_without bs2b            # BS2B audio filter support
@@ -146,7 +147,9 @@ Patch1:             %{name}-atadenoise.patch
 Patch2:                opencv4.patch
 Patch3:                v4l2-request-hwdec.patch
 Patch4:                %{name}-vulkan1.3.280.patch
+Patch5:                %{name}-nvenc.patch
 URL:           https://ffmpeg.org/
+%{?with_avisynth:BuildRequires:        AviSynthPlus-devel >= 3.7.3}
 %{?with_decklink:BuildRequires:        Blackmagic_DeckLink_SDK >= 10.11}
 %{?with_openal:BuildRequires:  OpenAL-devel >= 1.1}
 %{?with_opencl:BuildRequires:  OpenCL-devel >= 1.2}
@@ -382,6 +385,8 @@ Requires:   twolame-libs >= 0.3.10
 %{?with_zmq:Requires:  zeromq >= 4.2.1}
 %{?with_zimg:Requires: zimg >= 2.7.0}
 %{?with_zvbi:Requires: zvbi >= 0.2.28}
+# dlopened
+%{?with_avisynth:Suggests:     AviSynthPlus >= 3.7.3}
 
 %description libs
 This package contains the ffmpeg shared libraries:
@@ -570,6 +575,7 @@ Dokumentacja pakietu FFmpeg w formacie HTML.
 %patch3 -p1
 %endif
 %patch4 -p1
+%patch5 -p1
 
 # package the grep result for mplayer, the result formatted as 
./mplayer/configure
 cat <<EOF > ffmpeg-avconfig
@@ -653,6 +659,7 @@ EOF
        --disable-stripping \
        %{!?with_doc:--disable-doc} \
        --enable-avfilter \
+       %{?with_avisynth:--enable-avisynth} \
        %{?with_chromaprint:--enable-chromaprint} \
        %{?with_cudasdk:--enable-cuda-nvcc} \
        %{?with_decklink:--enable-decklink} \
diff --git a/ffmpeg-nvenc.patch b/ffmpeg-nvenc.patch
new file mode 100644
index 0000000..c92cd8b
--- /dev/null
+++ b/ffmpeg-nvenc.patch
@@ -0,0 +1,107 @@
+From 43b417d516b0fabbec1f02120d948f636b8a018e Mon Sep 17 00:00:00 2001
+From: Timo Rothenpieler <[email protected]>
+Date: Sun, 31 Mar 2024 18:25:15 +0200
+Subject: [PATCH] avcodec/nvenc: stop using long deprecated format specifiers
+
+---
+ libavcodec/nvenc.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
+index fd73af2a32..0cb3b87c67 100644
+--- a/libavcodec/nvenc.c
++++ b/libavcodec/nvenc.c
+@@ -1689,15 +1689,15 @@ static NV_ENC_BUFFER_FORMAT 
nvenc_map_buffer_format(enum AVPixelFormat pix_fmt)
+ {
+     switch (pix_fmt) {
+     case AV_PIX_FMT_YUV420P:
+-        return NV_ENC_BUFFER_FORMAT_YV12_PL;
++        return NV_ENC_BUFFER_FORMAT_YV12;
+     case AV_PIX_FMT_NV12:
+-        return NV_ENC_BUFFER_FORMAT_NV12_PL;
++        return NV_ENC_BUFFER_FORMAT_NV12;
+     case AV_PIX_FMT_P010:
+     case AV_PIX_FMT_P016:
+         return NV_ENC_BUFFER_FORMAT_YUV420_10BIT;
+     case AV_PIX_FMT_GBRP:
+     case AV_PIX_FMT_YUV444P:
+-        return NV_ENC_BUFFER_FORMAT_YUV444_PL;
++        return NV_ENC_BUFFER_FORMAT_YUV444;
+     case AV_PIX_FMT_GBRP16:
+     case AV_PIX_FMT_YUV444P16:
+         return NV_ENC_BUFFER_FORMAT_YUV444_10BIT;
+-- 
+2.25.1
+
+From 06c2a2c425f22e7dba5cad909737a631cc676e3f Mon Sep 17 00:00:00 2001
+From: Timo Rothenpieler <[email protected]>
+Date: Sun, 31 Mar 2024 18:39:49 +0200
+Subject: [PATCH] avcodec/nvenc: support SDK 12.2 bit depth API
+
+---
+ libavcodec/nvenc.c | 15 +++++++++++++++
+ libavcodec/nvenc.h |  5 +++++
+ 2 files changed, 20 insertions(+)
+
+diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
+index 0cb3b87c67..8327496937 100644
+--- a/libavcodec/nvenc.c
++++ b/libavcodec/nvenc.c
+@@ -1255,6 +1255,11 @@ static av_cold int 
nvenc_setup_h264_config(AVCodecContext *avctx)
+ 
+     h264->level = ctx->level;
+ 
++#ifdef NVENC_HAVE_NEW_BIT_DEPTH_API
++    h264->inputBitDepth = h264->outputBitDepth =
++        IS_10BIT(ctx->data_pix_fmt) ? NV_ENC_BIT_DEPTH_10 : 
NV_ENC_BIT_DEPTH_8;
++#endif
++
+     if (ctx->coder >= 0)
+         h264->entropyCodingMode = ctx->coder;
+ 
+@@ -1370,7 +1375,12 @@ static av_cold int 
nvenc_setup_hevc_config(AVCodecContext *avctx)
+ 
+     hevc->chromaFormatIDC = IS_YUV444(ctx->data_pix_fmt) ? 3 : 1;
+ 
++#ifdef NVENC_HAVE_NEW_BIT_DEPTH_API
++    hevc->inputBitDepth = hevc->outputBitDepth =
++        IS_10BIT(ctx->data_pix_fmt) ? NV_ENC_BIT_DEPTH_10 : 
NV_ENC_BIT_DEPTH_8;
++#else
+     hevc->pixelBitDepthMinus8 = IS_10BIT(ctx->data_pix_fmt) ? 2 : 0;
++#endif
+ 
+     hevc->level = ctx->level;
+ 
+@@ -1455,8 +1465,13 @@ static av_cold int 
nvenc_setup_av1_config(AVCodecContext *avctx)
+ 
+     av1->chromaFormatIDC = IS_YUV444(ctx->data_pix_fmt) ? 3 : 1;
+ 
++#ifdef NVENC_HAVE_NEW_BIT_DEPTH_API
++    av1->inputBitDepth = IS_10BIT(ctx->data_pix_fmt) ? NV_ENC_BIT_DEPTH_10 : 
NV_ENC_BIT_DEPTH_8;
++    av1->outputBitDepth = (IS_10BIT(ctx->data_pix_fmt) || ctx->highbitdepth) 
? NV_ENC_BIT_DEPTH_10 : NV_ENC_BIT_DEPTH_8;
++#else
+     av1->inputPixelBitDepthMinus8 = IS_10BIT(ctx->data_pix_fmt) ? 2 : 0;
+     av1->pixelBitDepthMinus8 = (IS_10BIT(ctx->data_pix_fmt) || 
ctx->highbitdepth) ? 2 : 0;
++#endif
+ 
+     if (ctx->b_ref_mode >= 0)
+         av1->useBFramesAsRef = ctx->b_ref_mode;
+diff --git a/libavcodec/nvenc.h b/libavcodec/nvenc.h
+index 48cdfc58aa..d99d8a0d76 100644
+--- a/libavcodec/nvenc.h
++++ b/libavcodec/nvenc.h
+@@ -83,6 +83,11 @@ typedef void ID3D11Device;
+ #define NVENC_NO_DEPRECATED_RC
+ #endif
+ 
++// SDK 12.2 compile time feature checks
++#if NVENCAPI_CHECK_VERSION(12, 2)
++#define NVENC_HAVE_NEW_BIT_DEPTH_API
++#endif
++
+ typedef struct NvencSurface
+ {
+     NV_ENC_INPUT_PTR input_surface;
+-- 
+2.25.1
+
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/ffmpeg.git/commitdiff/4575071bbb87ed5f61299c1707dd3b69c5fa0ed4

_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to