Skip to content

Commit

Permalink
--vpp-libplacebo-tonemappingで一部のパラメータが正常に動作しない問題を修正。
Browse files Browse the repository at this point in the history
  • Loading branch information
rigaya committed Jan 6, 2025
1 parent f9ead58 commit 1170833
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 3 deletions.
15 changes: 15 additions & 0 deletions VCECore/rgy_filter_libplacebo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<pl_color_map_params>(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;
Expand Down Expand Up @@ -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<pl_sigmoid_params>(m_pl->p_sigmoid_default_params());
m_tonemap.ditherParams = std::make_unique<pl_dither_params>(m_pl->p_dither_default_params());
m_tonemap.renderParams = std::make_unique<pl_render_params>(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) {
Expand Down
2 changes: 2 additions & 0 deletions VCECore/rgy_filter_libplacebo.h
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,8 @@ struct RGYLibplaceboToneMappingParams {
bool use_dovi;
std::unique_ptr<pl_color_map_params> colorMapParams;
std::unique_ptr<pl_peak_detect_params> peakDetectParams;
std::unique_ptr<pl_sigmoid_params> sigmoidParams;
std::unique_ptr<pl_dither_params> ditherParams;
std::unique_ptr<pl_dovi_metadata> plDoviMeta;
std::unique_ptr<pl_color_repr> reprSrc;
std::unique_ptr<pl_color_repr> reprDst;
Expand Down
8 changes: 8 additions & 0 deletions VCECore/rgy_libplacebo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 8 additions & 0 deletions VCECore/rgy_libplacebo.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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; }
Expand Down Expand Up @@ -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; }
Expand Down
6 changes: 3 additions & 3 deletions VCECore/rgy_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions VCEEnc/VCEEnc_readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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をファイルから読む場合に壊してしまっていたのを修正。

Expand Down

0 comments on commit 1170833

Please sign in to comment.