121 {
124 return false;
125 }
126
130 return false;
131 }
132 bool isMultiChannel = (
flags & kIsMultiChannelMask) != 0;
133 bool useBaseColourSpace = (
flags & kUseBaseColourSpaceMask) != 0;
134
135 float baseHdrHeadroom = 0.f;
137 SkCodecPrintf(
"Failed to read ISO 21496-1 base HDR headroom.\n");
138 return false;
139 }
140 float altrHdrHeadroom = 0.f;
142 SkCodecPrintf(
"Failed to read ISO 21496-1 altr HDR headroom.\n");
143 return false;
144 }
145
146 float gainMapMin[3] = {0.f};
147 float gainMapMax[3] = {0.f};
148 float gamma[3] = {0.f};
149 float baseOffset[3] = {0.f};
150 float altrOffset[3] = {0.f};
151
152 int channelCount = isMultiChannel ? 3 : 1;
153 for (
int i = 0;
i < channelCount; ++
i) {
155 SkCodecPrintf(
"Failed to read ISO 21496-1 gainmap minimum.\n");
156 return false;
157 }
159 SkCodecPrintf(
"Failed to read ISO 21496-1 gainmap maximum.\n");
160 return false;
161 }
164 return false;
165 }
168 return false;
169 }
172 return false;
173 }
174 }
175
177 if (!useBaseColourSpace) {
179 }
180 if (baseHdrHeadroom < altrHdrHeadroom) {
182 info.fDisplayRatioSdr = std::exp2(baseHdrHeadroom);
183 info.fDisplayRatioHdr = std::exp2(altrHdrHeadroom);
184 } else {
186 info.fDisplayRatioHdr = std::exp2(baseHdrHeadroom);
187 info.fDisplayRatioSdr = std::exp2(altrHdrHeadroom);
188 }
189 for (
int i = 0;
i < 3; ++
i) {
190 int j =
i >= channelCount ? 0 :
i;
191 info.fGainmapRatioMin[
i] = std::exp2(gainMapMin[j]);
192 info.fGainmapRatioMax[
i] = std::exp2(gainMapMax[j]);
193 info.fGainmapGamma[
i] = 1.f / gamma[j];
194 switch (
info.fBaseImageType) {
196 info.fEpsilonSdr[
i] = baseOffset[j];
197 info.fEpsilonHdr[
i] = altrOffset[j];
198 break;
200 info.fEpsilonHdr[
i] = baseOffset[j];
201 info.fEpsilonSdr[
i] = altrOffset[j];
202 break;
203 }
204 }
205 return true;
206}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
#define SkCodecPrintf(...)
static bool read_rational_be(SkStream *s, float *value)
static bool read_positive_rational_be(SkStream *s, float *value)
static bool read_iso_gainmap_version(SkStream *s)
static sk_sp< SkColorSpace > MakeSRGB()
FlutterSemanticsFlag flags