From 185fcf7b029ac05fb4d85f84fabd939484f116b7 Mon Sep 17 00:00:00 2001 From: nyanmisaka Date: Thu, 26 Oct 2023 00:50:36 +0800 Subject: [PATCH] Fix the brightness issue in HLG-2-SDR tonemap Signed-off-by: nyanmisaka --- debian/patches/0005-add-cuda-tonemap-impl.patch | 8 ++++---- ...-bt2390-eetf-and-code-refactor-to-opencl-tonemap.patch | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/debian/patches/0005-add-cuda-tonemap-impl.patch b/debian/patches/0005-add-cuda-tonemap-impl.patch index 147a49d3de3..86aef675ca5 100644 --- a/debian/patches/0005-add-cuda-tonemap-impl.patch +++ b/debian/patches/0005-add-cuda-tonemap-impl.patch @@ -244,12 +244,12 @@ Index: jellyfin-ffmpeg/libavfilter/colorspace.c + +// linearizer for HLG/ARIB-B67 +float eotf_arib_b67(float x) { -+ return ootf_1_2(inverse_oetf_arib_b67(x)); ++ return ootf_1_2(inverse_oetf_arib_b67(x)) * 5.0f; +} + +// delinearizer for HLG/ARIB-B67 +float inverse_eotf_arib_b67(float x) { -+ return oetf_arib_b67(inverse_ootf_1_2(x)); ++ return oetf_arib_b67(inverse_ootf_1_2(x / 5.0f)); +} + +// delinearizer for BT709, BT2020-10 @@ -468,12 +468,12 @@ Index: jellyfin-ffmpeg/libavfilter/cuda/colorspace_common.h + +// linearizer for HLG/ARIB-B67 +static __inline__ __device__ float eotf_arib_b67(float x) { -+ return ootf_1_2(inverse_oetf_arib_b67(x)); ++ return ootf_1_2(inverse_oetf_arib_b67(x)) * 5.0f; +} + +// delinearizer for HLG/ARIB-B67 +static __inline__ __device__ float inverse_eotf_arib_b67(float x) { -+ return oetf_arib_b67(inverse_ootf_1_2(x)); ++ return oetf_arib_b67(inverse_ootf_1_2(x / 5.0f)); +} + +// delinearizer for BT709, BT2020-10 diff --git a/debian/patches/0008-add-bt2390-eetf-and-code-refactor-to-opencl-tonemap.patch b/debian/patches/0008-add-bt2390-eetf-and-code-refactor-to-opencl-tonemap.patch index 9d45302b134..acfa3a6bb5a 100644 --- a/debian/patches/0008-add-bt2390-eetf-and-code-refactor-to-opencl-tonemap.patch +++ b/debian/patches/0008-add-bt2390-eetf-and-code-refactor-to-opencl-tonemap.patch @@ -214,12 +214,12 @@ Index: jellyfin-ffmpeg/libavfilter/opencl/colorspace_common.cl + +// linearizer for HLG/ARIB-B67 +float eotf_arib_b67(float x) { -+ return ootf_1_2(inverse_oetf_arib_b67(x)); ++ return ootf_1_2(inverse_oetf_arib_b67(x)) * 5.0f; +} + +// delinearizer for HLG/ARIB-B67 +float inverse_eotf_arib_b67(float x) { -+ return oetf_arib_b67(inverse_ootf_1_2(x)); ++ return oetf_arib_b67(inverse_ootf_1_2(x / 5.0f)); } -float inverse_eotf_bt1886(float c) {