From 1170833f20885171370538a851223beeb2895edd Mon Sep 17 00:00:00 2001 From: rigaya Date: Sun, 5 Jan 2025 21:27:51 +0900 Subject: [PATCH] =?UTF-8?q?--vpp-libplacebo-tonemapping=E3=81=A7=E4=B8=80?= =?UTF-8?q?=E9=83=A8=E3=81=AE=E3=83=91=E3=83=A9=E3=83=A1=E3=83=BC=E3=82=BF?= =?UTF-8?q?=E3=81=8C=E6=AD=A3=E5=B8=B8=E3=81=AB=E5=8B=95=E4=BD=9C=E3=81=97?= =?UTF-8?q?=E3=81=AA=E3=81=84=E5=95=8F=E9=A1=8C=E3=82=92=E4=BF=AE=E6=AD=A3?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VCECore/rgy_filter_libplacebo.cpp | 15 +++++++++++++++ VCECore/rgy_filter_libplacebo.h | 2 ++ VCECore/rgy_libplacebo.cpp | 8 ++++++++ VCECore/rgy_libplacebo.h | 8 ++++++++ VCECore/rgy_version.h | 6 +++--- VCEEnc/VCEEnc_readme.txt | 6 ++++++ 6 files changed, 42 insertions(+), 3 deletions(-) diff --git a/VCECore/rgy_filter_libplacebo.cpp b/VCECore/rgy_filter_libplacebo.cpp index e4d30aa..980c296 100644 --- a/VCECore/rgy_filter_libplacebo.cpp +++ b/VCECore/rgy_filter_libplacebo.cpp @@ -1775,6 +1775,11 @@ RGY_ERR RGYFilterLibplaceboToneMapping::setLibplaceboParam(const RGYFilterParam m_tonemap.plCspDst.hdr.min_luma = prm->toneMapping.dst_min; } m_tonemap.colorMapParams = std::make_unique(m_pl->p_color_map_default_params()); + m_tonemap.colorMapParams->tone_mapping_function = m_pl->p_find_tone_map_function()(tchar_to_string(get_cx_desc(list_vpp_libplacebo_tone_mapping_function, (int)prm->toneMapping.tonemapping_function)).c_str()); + if (!m_tonemap.colorMapParams->tone_mapping_function) { + AddMessage(RGY_LOG_ERROR, _T("Invalid tone mapping function.\n")); + return RGY_ERR_INVALID_PARAM; + } m_tonemap.colorMapParams->tone_constants.knee_adaptation = prm->toneMapping.tone_constants.st2094.knee_adaptation; m_tonemap.colorMapParams->tone_constants.knee_minimum = prm->toneMapping.tone_constants.st2094.knee_min; m_tonemap.colorMapParams->tone_constants.knee_maximum = prm->toneMapping.tone_constants.st2094.knee_max; @@ -1806,6 +1811,16 @@ RGY_ERR RGYFilterLibplaceboToneMapping::setLibplaceboParam(const RGYFilterParam #if PL_API_VER >= 349 m_tonemap.peakDetectParams->black_cutoff = prm->toneMapping.black_cutoff; #endif + m_tonemap.sigmoidParams = std::make_unique(m_pl->p_sigmoid_default_params()); + m_tonemap.ditherParams = std::make_unique(m_pl->p_dither_default_params()); + m_tonemap.renderParams = std::make_unique(m_pl->p_render_default_params()); + m_tonemap.renderParams->color_map_params = m_tonemap.colorMapParams.get(); + m_tonemap.renderParams->peak_detect_params = (prm->toneMapping.dynamic_peak_detection) ? m_tonemap.peakDetectParams.get() : nullptr; + m_tonemap.renderParams->sigmoid_params = m_tonemap.sigmoidParams.get(); + m_tonemap.renderParams->dither_params = m_tonemap.ditherParams.get(); + m_tonemap.renderParams->cone_params = nullptr; + m_tonemap.renderParams->color_adjustment = nullptr; + m_tonemap.renderParams->deband_params = nullptr; if (!ENABLE_LIBDOVI) { if (prm->toneMapping.use_dovi > 0) { diff --git a/VCECore/rgy_filter_libplacebo.h b/VCECore/rgy_filter_libplacebo.h index 64e50c9..32dd9e3 100644 --- a/VCECore/rgy_filter_libplacebo.h +++ b/VCECore/rgy_filter_libplacebo.h @@ -307,6 +307,8 @@ struct RGYLibplaceboToneMappingParams { bool use_dovi; std::unique_ptr colorMapParams; std::unique_ptr peakDetectParams; + std::unique_ptr sigmoidParams; + std::unique_ptr ditherParams; std::unique_ptr plDoviMeta; std::unique_ptr reprSrc; std::unique_ptr reprDst; diff --git a/VCECore/rgy_libplacebo.cpp b/VCECore/rgy_libplacebo.cpp index 3cd2bac..6a14818 100644 --- a/VCECore/rgy_libplacebo.cpp +++ b/VCECore/rgy_libplacebo.cpp @@ -45,8 +45,11 @@ RGYLibplaceboLoader::RGYLibplaceboLoader() : m_pl_color_space_srgb(nullptr), m_pl_color_space_hdr10(nullptr), m_pl_hdr_metadata_empty(nullptr), + m_pl_render_default_params(nullptr), m_pl_peak_detect_default_params(nullptr), m_pl_color_map_default_params(nullptr), + m_pl_sigmoid_default_params(nullptr), + m_pl_dither_default_params(nullptr), #if ENABLE_D3D11 m_pl_d3d11_create(nullptr), m_pl_d3d11_destroy(nullptr), @@ -83,6 +86,7 @@ RGYLibplaceboLoader::RGYLibplaceboLoader() : m_pl_find_filter_config(nullptr), m_pl_hdr_rescale(nullptr), m_pl_lut_parse_cube(nullptr), + m_pl_find_tone_map_function(nullptr), m_pl_find_gamut_map_function(nullptr), m_pl_raw_primaries_get(nullptr), m_pl_raw_primaries_merge(nullptr), @@ -119,8 +123,11 @@ bool RGYLibplaceboLoader::load() { if (!loadFunc("pl_color_space_srgb", (void**)&m_pl_color_space_srgb)) return false; if (!loadFunc("pl_color_space_hdr10", (void**)&m_pl_color_space_hdr10)) return false; if (!loadFunc("pl_hdr_metadata_empty", (void**)&m_pl_hdr_metadata_empty)) return false; + if (!loadFunc("pl_render_default_params", (void**)&m_pl_render_default_params)) return false; if (!loadFunc("pl_peak_detect_default_params", (void**)&m_pl_peak_detect_default_params)) return false; if (!loadFunc("pl_color_map_default_params", (void**)&m_pl_color_map_default_params)) return false; + if (!loadFunc("pl_sigmoid_default_params", (void**)&m_pl_sigmoid_default_params)) return false; + if (!loadFunc("pl_dither_default_params", (void**)&m_pl_dither_default_params)) return false; // 新しいメンバ変数の関数ポインタを取得して格納するコードを追加 #if ENABLE_D3D11 @@ -165,6 +172,7 @@ bool RGYLibplaceboLoader::load() { if (!loadFunc("pl_hdr_rescale", (void**)&m_pl_hdr_rescale)) return false; if (!loadFunc("pl_lut_parse_cube", (void**)&m_pl_lut_parse_cube)) return false; + if (!loadFunc("pl_find_tone_map_function", (void**)&m_pl_find_tone_map_function)) return false; if (!loadFunc("pl_find_gamut_map_function", (void**)&m_pl_find_gamut_map_function)) return false; if (!loadFunc("pl_raw_primaries_get", (void**)&m_pl_raw_primaries_get)) return false; if (!loadFunc("pl_raw_primaries_merge", (void**)&m_pl_raw_primaries_merge)) return false; diff --git a/VCECore/rgy_libplacebo.h b/VCECore/rgy_libplacebo.h index 50017f1..a46b376 100644 --- a/VCECore/rgy_libplacebo.h +++ b/VCECore/rgy_libplacebo.h @@ -66,8 +66,11 @@ class RGYLibplaceboLoader { pl_color_space *m_pl_color_space_srgb; pl_color_space *m_pl_color_space_hdr10; pl_hdr_metadata *m_pl_hdr_metadata_empty; + pl_render_params *m_pl_render_default_params; pl_peak_detect_params *m_pl_peak_detect_default_params; pl_color_map_params *m_pl_color_map_default_params; + pl_sigmoid_params *m_pl_sigmoid_default_params; + pl_dither_params *m_pl_dither_default_params; #if ENABLE_D3D11 decltype(&pl_d3d11_create) m_pl_d3d11_create; @@ -114,6 +117,7 @@ class RGYLibplaceboLoader { decltype(&pl_hdr_rescale) m_pl_hdr_rescale; decltype(&pl_lut_parse_cube) m_pl_lut_parse_cube; + decltype(&pl_find_tone_map_function) m_pl_find_tone_map_function; decltype(&pl_find_gamut_map_function) m_pl_find_gamut_map_function; decltype(&pl_raw_primaries_get) m_pl_raw_primaries_get; decltype(&pl_raw_primaries_merge) m_pl_raw_primaries_merge; @@ -137,8 +141,11 @@ class RGYLibplaceboLoader { pl_color_space p_color_space_srgb() const { return *m_pl_color_space_srgb; } pl_color_space p_color_space_hdr10() const { return *m_pl_color_space_hdr10; } pl_hdr_metadata p_hdr_metadata_empty() const { return *m_pl_hdr_metadata_empty; } + pl_render_params p_render_default_params() const { return *m_pl_render_default_params; } pl_peak_detect_params p_peak_detect_default_params() const { return *m_pl_peak_detect_default_params; } pl_color_map_params p_color_map_default_params() const { return *m_pl_color_map_default_params; } + pl_sigmoid_params p_sigmoid_default_params() const { return *m_pl_sigmoid_default_params; } + pl_dither_params p_dither_default_params() const { return *m_pl_dither_default_params; } #if ENABLE_D3D11 auto p_d3d11_create() const { return m_pl_d3d11_create; } @@ -176,6 +183,7 @@ class RGYLibplaceboLoader { auto p_find_filter_config() const { return m_pl_find_filter_config; } auto p_hdr_rescale() const { return m_pl_hdr_rescale; } auto p_lut_parse_cube() const { return m_pl_lut_parse_cube; } + auto p_find_tone_map_function() const { return m_pl_find_tone_map_function; } auto p_find_gamut_map_function() const { return m_pl_find_gamut_map_function; } auto p_raw_primaries_get() const { return m_pl_raw_primaries_get; } auto p_raw_primaries_merge() const { return m_pl_raw_primaries_merge; } diff --git a/VCECore/rgy_version.h b/VCECore/rgy_version.h index 8041456..2744fb1 100644 --- a/VCECore/rgy_version.h +++ b/VCECore/rgy_version.h @@ -29,9 +29,9 @@ #ifndef __RGY_VERSION_H__ #define __RGY_VERSION_H__ -#define VER_FILEVERSION 0,8,25,0 -#define VER_STR_FILEVERSION "8.25" -#define VER_STR_FILEVERSION_TCHAR _T("8.25") +#define VER_FILEVERSION 0,8,26,0 +#define VER_STR_FILEVERSION "8.26" +#define VER_STR_FILEVERSION_TCHAR _T("8.26") #ifdef _M_IX86 diff --git a/VCEEnc/VCEEnc_readme.txt b/VCEEnc/VCEEnc_readme.txt index 127b090..f1c8f37 100644 --- a/VCEEnc/VCEEnc_readme.txt +++ b/VCEEnc/VCEEnc_readme.txt @@ -187,6 +187,12 @@ Radeon RX7900XT 今後の更新で設定ファイルの互換性がなくなるかもしれません。 【どうでもいいメモ】 +2025.01.06 (8.26) +- --vpp-libplacebo-tonemappingで一部のパラメータが正常に動作しない問題を修正。 +- tsファイルなどで途中からエンコードする場合に、OpenGOPが使用されているとtrim位置がずれてしまう問題を修正。 + trim補正量の計算時にOpenGOPで最初のキーフレーム後にその前のフレームが来るケースを考慮できていなかった。 +- --trimでAviutlのtrimエクスポートプラグインの表記を受け取れるように。 + 2025.01.03 (8.25) - 8.24で--dolby-vision-rpuをファイルから読む場合に壊してしまっていたのを修正。