tone_mapping.h (1153B)
1 // Copyright (c) the JPEG XL Project Authors. All rights reserved. 2 // 3 // Use of this source code is governed by a BSD-style 4 // license that can be found in the LICENSE file. 5 6 #ifndef LIB_EXTRAS_TONE_MAPPING_H_ 7 #define LIB_EXTRAS_TONE_MAPPING_H_ 8 9 #include "lib/jxl/codec_in_out.h" 10 11 namespace jxl { 12 13 // Important: after calling this, the result will contain many out-of-gamut 14 // colors. It is very strongly recommended to call GamutMap afterwards to 15 // rectify this. 16 Status ToneMapTo(std::pair<float, float> display_nits, CodecInOut* io, 17 ThreadPool* pool = nullptr); 18 19 // `preserve_saturation` indicates to what extent to favor saturation over 20 // luminance when mapping out-of-gamut colors to Rec. 2020. 0 preserves 21 // luminance at the complete expense of saturation, while 1 gives the most 22 // saturated color with the same hue that Rec. 2020 can represent even if it 23 // means lowering the luminance. Values in between correspond to linear mixtures 24 // of those two extremes. 25 Status GamutMap(CodecInOut* io, float preserve_saturation, 26 ThreadPool* pool = nullptr); 27 28 } // namespace jxl 29 30 #endif // LIB_EXTRAS_TONE_MAPPING_H_