Lines Matching +full:convert +full:- +full:source +full:- +full:map
2 * Copyright 2022 The Android Open Source Project
8 * http://www.apache.org/licenses/LICENSE-2.0
41 // ISO/TS 22028-5
48 // Describes the tone-mapping operation & gain-map encoding parameters.
77 // represented by this 7-parameter piecewise function:
98 inline Color operator-=(Color& lhs, const Color& rhs) {
99 lhs.r -= rhs.r;
100 lhs.g -= rhs.g;
101 lhs.b -= rhs.b;
109 inline Color operator-(const Color& lhs, const Color& rhs) {
111 return temp -= rhs;
120 inline Color operator-=(Color& lhs, const float rhs) {
121 lhs.r -= rhs;
122 lhs.g -= rhs;
123 lhs.b -= rhs;
143 inline Color operator-(const Color& lhs, const float rhs) {
145 return temp -= rhs;
164 // round-to-nearest-even: add last bit after truncated mantissa in floatToHalf()
171 return (b & 0x80000000) >> 16 | (e > 112) * ((((e - 112) << 10) & 0x7C00) | m >> 13) | in floatToHalf()
172 ((e < 113) & (e > 101)) * ((((0x007FF000 + m) >> (125 - e)) + 1) >> 1) | in floatToHalf()
181 float value = static_cast<float>(idx) / static_cast<float>(kGainFactorNumEntries - 1); in GainLUT()
182 float logBoost = log2(metadata->minContentBoost) * (1.0f - value) + in GainLUT()
183 log2(metadata->maxContentBoost) * value; in GainLUT()
189 float boostFactor = displayBoost > 0 ? displayBoost / metadata->maxContentBoost : 1.0f; in GainLUT()
191 float value = static_cast<float>(idx) / static_cast<float>(kGainFactorNumEntries - 1); in GainLUT()
192 float logBoost = log2(metadata->minContentBoost) * (1.0f - value) + in GainLUT()
193 log2(metadata->maxContentBoost) * value; in GainLUT()
201 int32_t idx = static_cast<int32_t>(gain * (kGainFactorNumEntries - 1) + 0.5); in getGainFactor()
203 idx = CLIP3(idx, 0, kGainFactorNumEntries - 1); in getGainFactor()
231 // Image :-
241 // Gain Map (for 4 scale factor) :-
265 * IEC 61966-2-1/Amd 1:2003.
272 * Convert from OETF'd srgb RGB to YUV, according to ITU-R BT.709-6.
274 * BT.709 YUV<->RGB matrix is used to match expectations for DataSpace.
279 * Convert from OETF'd srgb YUV to RGB, according to ITU-R BT.709-6.
281 * BT.709 YUV<->RGB matrix is used to match expectations for DataSpace.
286 * Convert from srgb to linear, according to IEC 61966-2-1/Amd 1:2003.
296 * Convert from linear to srgb, according to IEC 61966-2-1/Amd 1:2003.
307 // Display-P3 transformations
310 * Calculated the luminance of a linear RGB P3 pixel, according to SMPTE EG 432-1.
317 * Convert from OETF'd P3 RGB to YUV, according to ITU-R BT.601-7.
319 * BT.601 YUV<->RGB matrix is used to match expectations for DataSpace.
324 * Convert from OETF'd P3 YUV to RGB, according to ITU-R BT.601-7.
326 * BT.601 YUV<->RGB matrix is used to match expectations for DataSpace.
331 // BT.2100 transformations - according to ITU-R BT.2100-2
341 * Convert from OETF'd BT.2100 RGB to YUV, according to ITU-R BT.2100-2.
343 * BT.2100 YUV<->RGB matrix is used to match expectations for DataSpace.
348 * Convert from OETF'd BT.2100 YUV to RGB, according to ITU-R BT.2100-2.
350 * BT.2100 YUV<->RGB matrix is used to match expectations for DataSpace.
355 * Convert from scene luminance to HLG.
368 * Convert from HLG to scene luminance.
381 * Convert from scene luminance to PQ.
394 * Convert from PQ to scene luminance in nits.
410 * Convert between color spaces with linear RGB data, according to ITU-R BT.2407 and EG 432-1.
429 * Get the conversion to apply to the HDR image for gain map generation
434 * Convert between YUV encodings, according to ITU-R BT.709-6, ITU-R BT.601-7, and ITU-R BT.2100-2.
436 * Bt.709 and Bt.2100 have well-defined YUV encodings; Display-P3's is less well defined, but is
481 // Gain map calculations
484 * Calculate the 8-bit unsigned integer gain value for the given SDR and HDR
527 * Expect narrow-range image data for P010.
533 * pixels and the map scale factor.
535 Color sampleYuv420(jr_uncompressed_ptr map, size_t map_scale_factor, size_t x, size_t y);
539 * pixels and the map scale factor.
541 * Expect narrow-range image data for P010.
543 Color sampleP010(jr_uncompressed_ptr map, size_t map_scale_factor, size_t x, size_t y);
546 * Sample the gain value for the map from a given x,y coordinate on a scale
547 * that is map scale factor larger than the map size.
549 float sampleMap(jr_uncompressed_ptr map, float map_scale_factor, size_t x, size_t y);
550 float sampleMap(jr_uncompressed_ptr map, size_t map_scale_factor, size_t x, size_t y,
552 Color sampleMap3Channel(jr_uncompressed_ptr map, float map_scale_factor, size_t x, size_t y,
554 Color sampleMap3Channel(jr_uncompressed_ptr map, size_t map_scale_factor, size_t x, size_t y,
558 * Convert from Color to RGBA1010102.
565 * Convert from Color to F16.