diff --git a/How to build.md b/How to build.md index f67c32b..bd00ae3 100644 --- a/How to build.md +++ b/How to build.md @@ -113,8 +113,8 @@ To build the library with OpenCL support, run \ `git clone https://github.com/FFmpeg/FFmpeg ffmpeg` \ `cd ffmpeg` -#### Checkout FFmpeg version 6.0 tag -`git checkout -b n6.0 n6.0` +#### Checkout FFmpeg version n7.1 tag +`git checkout -b n7.1 n7.1` #### Copy vf_raisr.c to ffmpeg libavfilter folder `cp ../Video-Super-Resolution-Library/ffmpeg/vf_raisr.c libavfilter/` \ @@ -122,9 +122,7 @@ To use raisr_opencl you need to copy vf_raisr_opencl.c as well \ `cp ../Video-Super-Resolution-Library/ffmpeg/vf_raisr_opencl.c libavfilter/` #### Apply patch -`git am ../Video-Super-Resolution-Library/ffmpeg/0001-ffmpeg-raisr-filter.patch` \ -To use raisr_opencl you need to apply patch 0002 as well \ -`git am ../Video-Super-Resolution-Library/ffmpeg/0002-libavfilter-raisr_opencl-Add-raisr_opencl-filter.patch` +`git am ../Video-Super-Resolution-Library/ffmpeg/0001-Upgrade-Raisr-ffmpeg-plugin-to-n7.1-from-n6.1.1.patch` #### Configure FFmpeg When `DCMAKE_INSTALL_PREFIX` isn't used, the ffmpeg configure command is as: \ diff --git a/docker/Flex/Dockerfile.ubuntu22.04 b/docker/Flex/Dockerfile.ubuntu22.04 index 4a49e29..cff5b62 100644 --- a/docker/Flex/Dockerfile.ubuntu22.04 +++ b/docker/Flex/Dockerfile.ubuntu22.04 @@ -16,7 +16,7 @@ ARG GMMLIB_VER=22.4.1 ARG LIBVA2_VER=2.22.0 ARG LIBVA_UTILS_VER=2.22.0 ARG MEDIA_DRIVER_VER=24.2.5 -ARG FFMPEG_VER="n6.1.1" +ARG FFMPEG_VER="n7.1" ARG SVT_AV1_REPO=https://gitlab.com/AOMediaCodec/SVT-AV1/-/archive/${SVT_AV1_VER}/SVT-AV1-${SVT_AV1_VER}.tar.gz ARG SVT_VP9_REPO=https://github.com/OpenVisualCloud/SVT-VP9/archive/refs/tags/${SVT_VP9_VER}.tar.gz diff --git a/docker/Xeon/Dockerfile.centos9 b/docker/Xeon/Dockerfile.centos9 index e72aae9..9a5547a 100644 --- a/docker/Xeon/Dockerfile.centos9 +++ b/docker/Xeon/Dockerfile.centos9 @@ -10,7 +10,7 @@ FROM quay.io/centos/centos:stream9 AS build ARG DL_PREFIX=/opt ARG PREFIX=/opt/build ARG LD_LIBRARY_PATH="/opt/build/lib:/opt/build/lib64:/usr/local/lib:/usr/local/lib64" -ARG FFMPEG_COMMIT_ID="n6.1.1" +ARG FFMPEG_COMMIT_ID="n7.1" ENV TZ="Europe/Warsaw" ARG ONEAPI_LINK="https://registrationcenter-download.intel.com/akdlm/IRC_NAS/046b1402-c5b8-4753-9500-33ffb665123f/l_ipp_oneapi_p_2021.10.1.16_offline.sh" diff --git a/docker/Xeon/Dockerfile.rockylinux9 b/docker/Xeon/Dockerfile.rockylinux9 index 8b7a812..30251fa 100644 --- a/docker/Xeon/Dockerfile.rockylinux9 +++ b/docker/Xeon/Dockerfile.rockylinux9 @@ -17,7 +17,7 @@ RUN echo "ERROR!" && exit 1 ARG DL_PREFIX=/opt ARG PREFIX=/opt/build ARG LD_LIBRARY_PATH="/opt/build/lib:/opt/build/lib64:/usr/local/lib:/usr/local/lib64" -ARG FFMPEG_COMMIT_ID="n6.1.1" +ARG FFMPEG_COMMIT_ID="n7.1" ENV TZ="Europe/Warsaw" ARG NASM_RPM_LINK="https://rpmfind.net/linux/centos-stream/9-stream/CRB/x86_64/os/Packages/nasm-2.15.03-7.el9.x86_64.rpm" diff --git a/docker/Xeon/Dockerfile.rockylinux9-mini b/docker/Xeon/Dockerfile.rockylinux9-mini index 9b4aa15..f93348b 100644 --- a/docker/Xeon/Dockerfile.rockylinux9-mini +++ b/docker/Xeon/Dockerfile.rockylinux9-mini @@ -12,7 +12,7 @@ FROM ${IMAGE_CACHE_REGISTRY}/${IMAGE_NAME} AS build ARG DL_PREFIX=/opt ARG PREFIX=/opt/build ARG LD_LIBRARY_PATH="/opt/build/lib:/opt/build/lib64:/usr/local/lib:/usr/local/lib64" -ARG FFMPEG_COMMIT_ID="n6.1.1" +ARG FFMPEG_COMMIT_ID="n7.1" ENV TZ="Europe/Warsaw" ARG NASM_RPM_LINK="https://rpmfind.net/linux/centos-stream/9-stream/CRB/x86_64/os/Packages/nasm-2.15.03-7.el9.x86_64.rpm" diff --git a/docker/Xeon/Dockerfile.ubuntu18.04 b/docker/Xeon/Dockerfile.ubuntu18.04 index 0d708a6..e57f1d0 100644 --- a/docker/Xeon/Dockerfile.ubuntu18.04 +++ b/docker/Xeon/Dockerfile.ubuntu18.04 @@ -14,7 +14,7 @@ ARG DL_PREFIX=/opt ARG LD_LIBRARY_PATH="/opt/build/lib:/opt/build/lib64:${LD_LIBRARY_PATH}" ENV DEBIAN_FRONTEND="noninteractive" ENV TZ="Europe/Warsaw" -ARG FFMPEG_COMMIT_ID="n6.1.1" +ARG FFMPEG_COMMIT_ID="n7.1" WORKDIR ${DL_PREFIX}/ffmpeg SHELL ["/bin/bash", "-ex", "-o", "pipefail", "-c"] @@ -25,7 +25,6 @@ RUN rm /etc/apt/sources.list.d/oneAPI.list && \ apt-get install --no-install-recommends -y \ git tar ca-certificates \ libx265-dev \ - libx264-dev \ zlib1g-dev \ nasm \ gcc-9 \ @@ -40,6 +39,16 @@ RUN rm /etc/apt/sources.list.d/oneAPI.list && \ tar -zx --strip-components=1 -C "${DL_PREFIX}/ffmpeg" +# build and install x264 from source +WORKDIR ${DL_PREFIX} +RUN git clone https://github.com/mirror/x264 -b stable --depth 1 + +WORKDIR ${DL_PREFIX}/x264 +RUN ./configure --enable-shared && \ + make -j "$(nproc)" && \ + make install && \ + ldconfig + COPY . ${DL_PREFIX}/Video-Super-Resolution-Library WORKDIR ${DL_PREFIX}/Video-Super-Resolution-Library diff --git a/docker/Xeon/Dockerfile.ubuntu20.04 b/docker/Xeon/Dockerfile.ubuntu20.04 index 3bad5d1..e1af2fd 100644 --- a/docker/Xeon/Dockerfile.ubuntu20.04 +++ b/docker/Xeon/Dockerfile.ubuntu20.04 @@ -14,7 +14,7 @@ ARG DL_PREFIX=/opt ARG LD_LIBRARY_PATH="/opt/build/lib:/opt/build/lib64:${LD_LIBRARY_PATH}" ENV DEBIAN_FRONTEND="noninteractive" ENV TZ="Europe/Warsaw" -ARG FFMPEG_COMMIT_ID="n6.1.1" +ARG FFMPEG_COMMIT_ID="n7.1" WORKDIR ${DL_PREFIX}/ffmpeg SHELL ["/bin/bash", "-ex", "-o", "pipefail", "-c"] diff --git a/docker/Xeon/Dockerfile.ubuntu22.04 b/docker/Xeon/Dockerfile.ubuntu22.04 index 994f940..2dc7c1a 100644 --- a/docker/Xeon/Dockerfile.ubuntu22.04 +++ b/docker/Xeon/Dockerfile.ubuntu22.04 @@ -14,7 +14,7 @@ ARG DL_PREFIX=/opt ARG LD_LIBRARY_PATH="/opt/build/lib:/opt/build/lib64:${LD_LIBRARY_PATH}" ENV DEBIAN_FRONTEND="noninteractive" ENV TZ="Europe/Warsaw" -ARG FFMPEG_COMMIT_ID="n6.1.1" +ARG FFMPEG_COMMIT_ID="n7.1" WORKDIR ${DL_PREFIX}/ffmpeg SHELL ["/bin/bash", "-ex", "-o", "pipefail", "-c"] diff --git a/ffmpeg/0001-ffmpeg-raisr-filter.patch b/ffmpeg/0001-Upgrade-Raisr-ffmpeg-plugin-to-n7.1-from-n6.1.1.patch similarity index 50% rename from ffmpeg/0001-ffmpeg-raisr-filter.patch rename to ffmpeg/0001-Upgrade-Raisr-ffmpeg-plugin-to-n7.1-from-n6.1.1.patch index 0ba63ef..6203b67 100644 --- a/ffmpeg/0001-ffmpeg-raisr-filter.patch +++ b/ffmpeg/0001-Upgrade-Raisr-ffmpeg-plugin-to-n7.1-from-n6.1.1.patch @@ -1,20 +1,20 @@ -From 467d3dded4549645b16710807562e84a075739c5 Mon Sep 17 00:00:00 2001 +From d2cd96acaaa6211ea8d8aa5025fb9e655f78b212 Mon Sep 17 00:00:00 2001 From: Xiaoxia Liang -Date: Mon, 24 Jul 2023 11:49:13 +0800 -Subject: [PATCH 1/2] FFmpeg Raisr filter for n6.0. +Date: Thu, 3 Apr 2025 17:40:44 +0000 +Subject: [PATCH] Upgrade Raisr ffmpeg plugin to n7.1 from n6.1.1 Signed-off-by: Xiaoxia Liang --- - configure | 12 ++++++++++++ - libavfilter/Makefile | 1 + - libavfilter/allfilters.c | 1 + - 3 files changed, 14 insertions(+) + configure | 13 +++++++++++++ + libavfilter/Makefile | 2 ++ + libavfilter/allfilters.c | 2 ++ + 3 files changed, 17 insertions(+) diff --git a/configure b/configure -index b6616f00b6..f87716611b 100755 +index d77a55b653..2f90d21aa0 100755 --- a/configure +++ b/configure -@@ -240,6 +240,7 @@ External library support: +@@ -241,6 +241,7 @@ External library support: --enable-libgsm enable GSM de/encoding via libgsm [no] --enable-libiec61883 enable iec61883 via libiec61883 [no] --enable-libilbc enable iLBC de/encoding via libilbc [no] @@ -22,7 +22,7 @@ index b6616f00b6..f87716611b 100755 --enable-libjack enable JACK audio sound server [no] --enable-libjxl enable JPEG XL de/encoding via libjxl [no] --enable-libklvanc enable Kernel Labs VANC processing [no] -@@ -1823,6 +1824,7 @@ EXTERNAL_LIBRARY_LIST=" +@@ -1926,6 +1927,7 @@ EXTERNAL_LIBRARY_LIST=" libgsm libiec61883 libilbc @@ -30,7 +30,15 @@ index b6616f00b6..f87716611b 100755 libjack libjxl libklvanc -@@ -6667,6 +6669,16 @@ enabled libopus && { +@@ -3962,6 +3964,7 @@ transpose_opencl_filter_deps="opencl" + transpose_vaapi_filter_deps="vaapi VAProcPipelineCaps_rotation_flags" + transpose_vt_filter_deps="videotoolbox VTPixelRotationSessionCreate" + transpose_vulkan_filter_deps="vulkan spirv_compiler" ++raisr_opencl_filter_deps="opencl" + unsharp_opencl_filter_deps="opencl" + uspp_filter_deps="gpl avcodec" + vaguedenoiser_filter_deps="gpl" +@@ -6978,6 +6981,16 @@ enabled libopus && { } } enabled libplacebo && require_pkg_config libplacebo "libplacebo >= 4.192.0" libplacebo/vulkan.h pl_vulkan_create @@ -45,31 +53,41 @@ index b6616f00b6..f87716611b 100755 + die "ERROR: Intel IPP not found" +fi enabled libpulse && require_pkg_config libpulse libpulse pulse/pulseaudio.h pa_context_new - enabled librabbitmq && require_pkg_config librabbitmq "librabbitmq >= 0.7.1" amqp.h amqp_new_connection - enabled librav1e && require_pkg_config librav1e "rav1e >= 0.5.0" rav1e.h rav1e_context_new + enabled libqrencode && require_pkg_config libqrencode libqrencode qrencode.h QRcode_encodeString + enabled libquirc && require libquirc quirc.h quirc_decode -lquirc diff --git a/libavfilter/Makefile b/libavfilter/Makefile -index b3d3d981dd..13126f7f48 100644 +index 91487afb21..dbf1114d78 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile -@@ -425,6 +425,7 @@ OBJS-$(CONFIG_PSEUDOCOLOR_FILTER) += vf_pseudocolor.o - OBJS-$(CONFIG_PSNR_FILTER) += vf_psnr.o framesync.o +@@ -440,6 +440,7 @@ OBJS-$(CONFIG_PSNR_FILTER) += vf_psnr.o framesync.o OBJS-$(CONFIG_PULLUP_FILTER) += vf_pullup.o OBJS-$(CONFIG_QP_FILTER) += vf_qp.o + OBJS-$(CONFIG_QUIRC_FILTER) += vf_quirc.o +OBJS-$(CONFIG_RAISR_FILTER) += vf_raisr.o OBJS-$(CONFIG_RANDOM_FILTER) += vf_random.o OBJS-$(CONFIG_READEIA608_FILTER) += vf_readeia608.o OBJS-$(CONFIG_READVITC_FILTER) += vf_readvitc.o +@@ -563,6 +564,7 @@ OBJS-$(CONFIG_XBR_FILTER) += vf_xbr.o + OBJS-$(CONFIG_XCORRELATE_FILTER) += vf_convolve.o framesync.o + OBJS-$(CONFIG_XFADE_FILTER) += vf_xfade.o + OBJS-$(CONFIG_XFADE_OPENCL_FILTER) += vf_xfade_opencl.o opencl.o opencl/xfade.o ++OBJS-$(CONFIG_RAISR_OPENCL_FILTER) += vf_raisr_opencl.o opencl.o + OBJS-$(CONFIG_XFADE_VULKAN_FILTER) += vf_xfade_vulkan.o vulkan.o vulkan_filter.o + OBJS-$(CONFIG_XMEDIAN_FILTER) += vf_xmedian.o framesync.o + OBJS-$(CONFIG_XPSNR_FILTER) += vf_xpsnr.o framesync.o diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c -index d7db46c2af..0dc81faaed 100644 +index 9819f0f95b..92a384ca68 100644 --- a/libavfilter/allfilters.c +++ b/libavfilter/allfilters.c -@@ -401,6 +401,7 @@ extern const AVFilter ff_vf_pseudocolor; - extern const AVFilter ff_vf_psnr; - extern const AVFilter ff_vf_pullup; +@@ -415,6 +415,8 @@ extern const AVFilter ff_vf_pullup; extern const AVFilter ff_vf_qp; + extern const AVFilter ff_vf_qrencode; + extern const AVFilter ff_vf_quirc; +extern const AVFilter ff_vf_raisr; ++extern const AVFilter ff_vf_raisr_opencl; extern const AVFilter ff_vf_random; extern const AVFilter ff_vf_readeia608; extern const AVFilter ff_vf_readvitc; -- 2.34.1 + diff --git a/ffmpeg/0002-libavfilter-raisr_opencl-Add-raisr_opencl-filter.patch b/ffmpeg/0002-libavfilter-raisr_opencl-Add-raisr_opencl-filter.patch deleted file mode 100644 index 70caa8a..0000000 --- a/ffmpeg/0002-libavfilter-raisr_opencl-Add-raisr_opencl-filter.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 954f1cada458477e977adfb42c354fce289a1576 Mon Sep 17 00:00:00 2001 -From: Liang Xiaoxia -Date: Fri, 4 Aug 2023 10:56:36 +0800 -Subject: [PATCH 2/2] FFmpeg Raisr-OpenCL filter for n6.0 - -Signed-off-by: Liang Xiaoxia ---- - configure | 1 + - libavfilter/Makefile | 1 + - libavfilter/allfilters.c | 1 + - 3 files changed, 3 insertions(+) - -diff --git a/configure b/configure -index f87716611b..a3c22079a8 100755 ---- a/configure -+++ b/configure -@@ -3754,6 +3754,7 @@ transpose_opencl_filter_deps="opencl" - transpose_vt_filter_deps="videotoolbox VTPixelRotationSessionCreate" - transpose_vulkan_filter_deps="vulkan spirv_compiler" - unsharp_opencl_filter_deps="opencl" -+raisr_opencl_filter_deps="opencl" - uspp_filter_deps="gpl avcodec" - vaguedenoiser_filter_deps="gpl" - vflip_vulkan_filter_deps="vulkan spirv_compiler" -diff --git a/libavfilter/Makefile b/libavfilter/Makefile -index 13126f7f48..c138e2565b 100644 ---- a/libavfilter/Makefile -+++ b/libavfilter/Makefile -@@ -546,6 +546,7 @@ OBJS-$(CONFIG_XBR_FILTER) += vf_xbr.o - OBJS-$(CONFIG_XCORRELATE_FILTER) += vf_convolve.o framesync.o - OBJS-$(CONFIG_XFADE_FILTER) += vf_xfade.o - OBJS-$(CONFIG_XFADE_OPENCL_FILTER) += vf_xfade_opencl.o opencl.o opencl/xfade.o -+OBJS-$(CONFIG_RAISR_OPENCL_FILTER) += vf_raisr_opencl.o opencl.o - OBJS-$(CONFIG_XFADE_VULKAN_FILTER) += vf_xfade_vulkan.o vulkan.o vulkan_filter.o - OBJS-$(CONFIG_XMEDIAN_FILTER) += vf_xmedian.o framesync.o - OBJS-$(CONFIG_XSTACK_FILTER) += vf_stack.o framesync.o -diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c -index 0dc81faaed..ef5ce4df9c 100644 ---- a/libavfilter/allfilters.c -+++ b/libavfilter/allfilters.c -@@ -403,6 +403,7 @@ extern const AVFilter ff_vf_pullup; - extern const AVFilter ff_vf_qp; - extern const AVFilter ff_vf_raisr; - extern const AVFilter ff_vf_random; -+extern const AVFilter ff_vf_raisr_opencl; - extern const AVFilter ff_vf_readeia608; - extern const AVFilter ff_vf_readvitc; - extern const AVFilter ff_vf_realtime; --- -2.34.1 diff --git a/ffmpeg/vf_raisr.c b/ffmpeg/vf_raisr.c index 6fffd37..7237a4a 100644 --- a/ffmpeg/vf_raisr.c +++ b/ffmpeg/vf_raisr.c @@ -31,7 +31,6 @@ #include "libavutil/pixfmt.h" #include "avfilter.h" #include "formats.h" -#include "internal.h" #include "video.h" #include "raisr/RaisrHandler.h" #include "raisr/RaisrDefaults.h" diff --git a/ffmpeg/vf_raisr_opencl.c b/ffmpeg/vf_raisr_opencl.c index 06557cb..bb4fba7 100644 --- a/ffmpeg/vf_raisr_opencl.c +++ b/ffmpeg/vf_raisr_opencl.c @@ -22,7 +22,6 @@ #include "raisr/RaisrDefaults.h" #include "libavutil/opt.h" #include "avfilter.h" -#include "internal.h" #include "opencl.h" #include "libavutil/pixdesc.h" #include "video.h" @@ -157,8 +156,9 @@ static int raisr_filter_config_input(AVFilterLink *inlink) { AVHWFramesContext *input_frames; int err; + FilterLink *inl = ff_filter_link(inlink); - input_frames = (AVHWFramesContext*)inlink->hw_frames_ctx->data; + input_frames = (AVHWFramesContext*)inl->hw_frames_ctx->data; if (input_frames->format != AV_PIX_FMT_OPENCL) return AVERROR(EINVAL); @@ -178,6 +178,7 @@ static int raisr_opencl_config_output(AVFilterLink *outlink) { AVFilterContext *avctx = outlink->src; AVFilterLink *inlink = avctx->inputs[0]; + FilterLink *inl = ff_filter_link(inlink); RaisrOpenCLContext *ctx = avctx->priv; AVHWFramesContext *input_frames; const AVPixFmtDescriptor *desc; @@ -187,7 +188,7 @@ static int raisr_opencl_config_output(AVFilterLink *outlink) if (err < 0) return err; - input_frames = (AVHWFramesContext*)inlink->hw_frames_ctx->data; + input_frames = (AVHWFramesContext*)inl->hw_frames_ctx->data; ctx->sw_format = (enum AVPixelFormat)input_frames->sw_format; desc = av_pix_fmt_desc_get(ctx->sw_format); if (desc && desc->comp[0].depth != ctx->bits) { diff --git a/scripts/01_pull_resources.sh b/scripts/01_pull_resources.sh index 35edcb7..8d5d133 100755 --- a/scripts/01_pull_resources.sh +++ b/scripts/01_pull_resources.sh @@ -52,8 +52,8 @@ if [ ! -d "ffmpeg" ];then fi pushd ffmpeg -git checkout -b n6.0 n6.0 -git am ../Video-Super-Resolution-Library/ffmpeg/0001-ffmpeg-raisr-filter.patch +git checkout -b n7.1 n7.1 +git am ../Video-Super-Resolution-Library/ffmpeg/0001-Upgrade-Raisr-ffmpeg-plugin-to-n7.1-from-n6.1.1.patch popd # pull nasm used for build x264