From 8dc6acd192500e63693ef681201d330521b8eefb Mon Sep 17 00:00:00 2001 From: nyanmisaka Date: Mon, 11 Nov 2024 20:27:43 +0800 Subject: [PATCH 1/4] Fix artifacts caused by delayed release of MppPacket data Signed-off-by: nyanmisaka --- ...ipeline-for-rockchip-rk3588-platform.patch | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/debian/patches/0047-add-full-hwa-pipeline-for-rockchip-rk3588-platform.patch b/debian/patches/0047-add-full-hwa-pipeline-for-rockchip-rk3588-platform.patch index e5d2347d97..cec925f9a2 100644 --- a/debian/patches/0047-add-full-hwa-pipeline-for-rockchip-rk3588-platform.patch +++ b/debian/patches/0047-add-full-hwa-pipeline-for-rockchip-rk3588-platform.patch @@ -1901,7 +1901,7 @@ Index: FFmpeg/libavcodec/rkmppenc.c =================================================================== --- /dev/null +++ FFmpeg/libavcodec/rkmppenc.c -@@ -0,0 +1,1114 @@ +@@ -0,0 +1,1116 @@ +/* + * Copyright (c) 2023 Huseyin BIYIK + * Copyright (c) 2023 NyanMisaka @@ -2662,12 +2662,6 @@ Index: FFmpeg/libavcodec/rkmppenc.c + return ret; +} + -+static void rkmpp_free_packet_buf(void *opaque, uint8_t *data) -+{ -+ MppPacket mpp_pkt = opaque; -+ mpp_packet_deinit(&mpp_pkt); -+} -+ +static int rkmpp_get_packet(AVCodecContext *avctx, AVPacket *packet, int timeout) +{ + RKMPPEncContext *r = avctx->priv_data; @@ -2698,13 +2692,15 @@ Index: FFmpeg/libavcodec/rkmppenc.c + } + av_log(avctx, AV_LOG_DEBUG, "Received a packet\n"); + -+ packet->data = mpp_packet_get_data(mpp_pkt); -+ packet->size = mpp_packet_get_length(mpp_pkt); -+ packet->buf = av_buffer_create(packet->data, packet->size, rkmpp_free_packet_buf, -+ mpp_pkt, AV_BUFFER_FLAG_READONLY); -+ if (!packet->buf) { -+ ret = AVERROR(ENOMEM); -+ goto exit; ++ /* freeing MppPacket data in buffer callbacks is not supported in async mode */ ++ { ++ size_t mpp_pkt_length = mpp_packet_get_length(mpp_pkt); ++ ++ if ((ret = ff_get_encode_buffer(avctx, packet, mpp_pkt_length, 0)) < 0) { ++ av_log(avctx, AV_LOG_ERROR, "ff_get_encode_buffer failed: %d\n", ret); ++ goto exit; ++ } ++ memcpy(packet->data, mpp_packet_get_data(mpp_pkt), mpp_pkt_length); + } + + packet->time_base.num = avctx->time_base.num; @@ -2718,6 +2714,7 @@ Index: FFmpeg/libavcodec/rkmppenc.c + ret = AVERROR_EXTERNAL; + goto exit; + } ++ mpp_packet_deinit(&mpp_pkt); + + mpp_meta_get_s32(mpp_meta, KEY_OUTPUT_INTRA, &key_frame); + if (key_frame) @@ -2796,6 +2793,11 @@ Index: FFmpeg/libavcodec/rkmppenc.c + r->cfg_init = 0; + r->async_frames = 0; + ++ if (r->mcfg) { ++ mpp_enc_cfg_deinit(r->mcfg); ++ r->mcfg = NULL; ++ } ++ + if (r->mapi) { + r->mapi->reset(r->mctx); + mpp_destroy(r->mctx); @@ -3267,7 +3269,7 @@ Index: FFmpeg/libavcodec/rkmppenc.h +static const FFCodecDefault rkmpp_enc_defaults[] = { + { "b", "2M" }, + { "g", "250" }, -+ { NULL } ++ { NULL }, +}; + +#define DEFINE_RKMPP_ENCODER(x, X, xx) \ From 30e7ff1c20bca5c569768a5295e4d73bd552ca65 Mon Sep 17 00:00:00 2001 From: nyanmisaka Date: Mon, 11 Nov 2024 02:09:52 +0800 Subject: [PATCH 2/4] Update dependencies Signed-off-by: nyanmisaka --- builder/scripts.d/50-rkmpp.sh | 2 +- builder/scripts.d/50-svtav1.sh | 6 +++--- docker-build-win64.sh | 3 +-- docker-build.sh | 14 ++++---------- msys2/PKGBUILD/40-mingw-w64-svt-av1/PKGBUILD | 2 +- 5 files changed, 10 insertions(+), 17 deletions(-) diff --git a/builder/scripts.d/50-rkmpp.sh b/builder/scripts.d/50-rkmpp.sh index 90026ae7cc..4f0f160c46 100755 --- a/builder/scripts.d/50-rkmpp.sh +++ b/builder/scripts.d/50-rkmpp.sh @@ -1,7 +1,7 @@ #!/bin/bash SCRIPT_REPO="https://github.com/nyanmisaka/mpp.git" -SCRIPT_COMMIT="ba5c98ac8dbf485de9f03e625e1dd024afdc2eb9" +SCRIPT_COMMIT="110d2660a18855656205cdda8f40527c8a9cc3c1" SCRIPT_BRANCH="jellyfin-mpp" ffbuild_enabled() { diff --git a/builder/scripts.d/50-svtav1.sh b/builder/scripts.d/50-svtav1.sh index e37e183de4..00f7da0907 100755 --- a/builder/scripts.d/50-svtav1.sh +++ b/builder/scripts.d/50-svtav1.sh @@ -1,7 +1,7 @@ #!/bin/bash SCRIPT_REPO="https://gitlab.com/AOMediaCodec/SVT-AV1.git" -SCRIPT_COMMIT="34d4d591d87aeba6d347f09bfb5a7429fe58bd46" +SCRIPT_COMMIT="6e69def4ec283fe0b71195671245c3b768bebdef" ffbuild_enabled() { [[ $TARGET == win32 ]] && return -1 @@ -16,10 +16,10 @@ ffbuild_dockerbuild() { mkdir -p build && cd build if [[ $TARGET == mac* ]]; then - cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$FFBUILD_PREFIX" -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=OFF -DBUILD_APPS=OFF -DENABLE_AVX512=ON .. + cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$FFBUILD_PREFIX" -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=OFF -DBUILD_APPS=OFF .. else - cmake -DCMAKE_TOOLCHAIN_FILE="$FFBUILD_CMAKE_TOOLCHAIN" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$FFBUILD_PREFIX" -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=OFF -DBUILD_APPS=OFF -DENABLE_AVX512=ON .. + cmake -DCMAKE_TOOLCHAIN_FILE="$FFBUILD_CMAKE_TOOLCHAIN" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$FFBUILD_PREFIX" -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=OFF -DBUILD_APPS=OFF .. fi make -j$(nproc) make install diff --git a/docker-build-win64.sh b/docker-build-win64.sh index 37e780fe39..c224bd7b5e 100755 --- a/docker-build-win64.sh +++ b/docker-build-win64.sh @@ -456,7 +456,7 @@ popd popd # SVT-AV1 -git clone -b v2.2.1 --depth=1 https://gitlab.com/AOMediaCodec/SVT-AV1.git +git clone -b v2.3.0 --depth=1 https://gitlab.com/AOMediaCodec/SVT-AV1.git pushd SVT-AV1 mkdir build pushd build @@ -464,7 +464,6 @@ cmake \ -DCMAKE_TOOLCHAIN_FILE=${FF_CMAKE_TOOLCHAIN} \ -DCMAKE_INSTALL_PREFIX=${FF_DEPS_PREFIX} \ -DCMAKE_BUILD_TYPE=Release \ - -DENABLE_AVX512=ON \ -DBUILD_{SHARED_LIBS,TESTING,APPS,DEC}=OFF \ .. make -j$(nproc) diff --git a/docker-build.sh b/docker-build.sh index 2bced3d865..563bceb3ce 100755 --- a/docker-build.sh +++ b/docker-build.sh @@ -253,20 +253,14 @@ prepare_extra_common() { # SVT-AV1 pushd ${SOURCE_DIR} - git clone -b v2.2.1 --depth=1 https://gitlab.com/AOMediaCodec/SVT-AV1.git + git clone -b v2.3.0 --depth=1 https://gitlab.com/AOMediaCodec/SVT-AV1.git pushd SVT-AV1 mkdir build pushd build - if [ "${ARCH}" = "amd64" ]; then - svtav1_avx512="-DENABLE_AVX512=ON" - else - svtav1_avx512="-DENABLE_AVX512=OFF" - fi cmake \ ${CMAKE_TOOLCHAIN_OPT} \ -DCMAKE_INSTALL_PREFIX=${TARGET_DIR} \ -DCMAKE_BUILD_TYPE=Release \ - $svtav1_avx512 \ -DBUILD_SHARED_LIBS=ON \ -DBUILD_{TESTING,APPS,DEC}=OFF \ .. @@ -382,7 +376,7 @@ prepare_extra_amd64() { # GMMLIB pushd ${SOURCE_DIR} - git clone -b intel-gmmlib-22.5.2 --depth=1 https://github.com/intel/gmmlib.git + git clone -b intel-gmmlib-22.5.3 --depth=1 https://github.com/intel/gmmlib.git pushd gmmlib mkdir build && pushd build cmake -DCMAKE_INSTALL_PREFIX=${TARGET_DIR} .. @@ -439,7 +433,7 @@ prepare_extra_amd64() { # VPL-GPU-RT (RT only) # Provides VPL runtime (libmfx-gen.so.1.2) for 11th Gen Tiger Lake and newer pushd ${SOURCE_DIR} - git clone -b intel-onevpl-24.4.1 --depth=1 https://github.com/intel/vpl-gpu-rt.git + git clone -b intel-onevpl-24.4.2 --depth=1 https://github.com/intel/vpl-gpu-rt.git pushd vpl-gpu-rt mkdir build && pushd build cmake -DCMAKE_INSTALL_PREFIX=${TARGET_DIR} \ @@ -459,7 +453,7 @@ prepare_extra_amd64() { # Full Feature Build: ENABLE_KERNELS=ON(Default) ENABLE_NONFREE_KERNELS=ON(Default) # Free Kernel Build: ENABLE_KERNELS=ON ENABLE_NONFREE_KERNELS=OFF pushd ${SOURCE_DIR} - git clone -b intel-media-24.4.1 --depth=1 https://github.com/intel/media-driver.git + git clone -b intel-media-24.4.2 --depth=1 https://github.com/intel/media-driver.git pushd media-driver # enable vc1 decode on dg2 (note that mtl+ is not supported) wget -q -O - https://github.com/intel/media-driver/commit/d5dd47b.patch | git apply diff --git a/msys2/PKGBUILD/40-mingw-w64-svt-av1/PKGBUILD b/msys2/PKGBUILD/40-mingw-w64-svt-av1/PKGBUILD index 2485aa4d0e..793842fc2d 100644 --- a/msys2/PKGBUILD/40-mingw-w64-svt-av1/PKGBUILD +++ b/msys2/PKGBUILD/40-mingw-w64-svt-av1/PKGBUILD @@ -3,7 +3,7 @@ _realname=SVT-AV1 pkgbase=mingw-w64-jellyfin-svt-av1 pkgname=("${MINGW_PACKAGE_PREFIX}-jellyfin-svt-av1") -pkgver=2.2.1 +pkgver=2.3.0 pkgrel=1 pkgdesc="Scalable Video Technology AV1 encoder and decoder (mingw-w64)" arch=('any') From cda8c4df232ccee783aa864bd213728f8bc89958 Mon Sep 17 00:00:00 2001 From: nyanmisaka Date: Mon, 11 Nov 2024 16:46:03 +0800 Subject: [PATCH 3/4] Disable lto on win64 gcc portable build for now Signed-off-by: nyanmisaka --- docker-build-win64.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docker-build-win64.sh b/docker-build-win64.sh index c224bd7b5e..72609acf1f 100755 --- a/docker-build-win64.sh +++ b/docker-build-win64.sh @@ -384,7 +384,7 @@ pushd x264 --host=${FF_TOOLCHAIN} \ --cross-prefix=${FF_CROSS_PREFIX} \ --disable-cli \ - --enable-{static,lto,strip,pic} + --enable-{static,strip,pic} make -j$(nproc) make install popd @@ -592,7 +592,6 @@ fi --disable-w32threads \ --enable-pthreads \ --enable-shared \ - --enable-lto=auto \ --enable-gpl \ --enable-version3 \ --enable-schannel \ From 4e94c66b6a67d739bd6e08282ef8c181b1953a49 Mon Sep 17 00:00:00 2001 From: nyanmisaka Date: Mon, 11 Nov 2024 02:10:03 +0800 Subject: [PATCH 4/4] Bump version to 7.0.2-6 Signed-off-by: nyanmisaka --- build.yaml | 2 +- debian/changelog | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/build.yaml b/build.yaml index 65dc843513..da4c8e159c 100644 --- a/build.yaml +++ b/build.yaml @@ -1,7 +1,7 @@ --- # We just wrap `build` so this is really it name: "jellyfin-ffmpeg" -version: "7.0.2-5" +version: "7.0.2-6" packages: - bullseye-amd64 - bullseye-armhf diff --git a/debian/changelog b/debian/changelog index b1bdeff4e9..f5bf6ccb99 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +jellyfin-ffmpeg (7.0.2-6) unstable; urgency=medium + + * Use dynamic pool for VPL QSV hwupload to save VRAM + * Fix artifacts caused by delayed release of MppPacket data + * Update dependencies + + -- nyanmisaka Sun, 10 Nov 2024 22:03:57 +0800 + jellyfin-ffmpeg (7.0.2-5) unstable; urgency=medium * Add bsf options to drop the DoVi and HDR10Plus metadata