Skip to content

Commit

Permalink
PNG: don’t write cLLi chunk if the maximum luminance is 10 000 (libjx…
Browse files Browse the repository at this point in the history
  • Loading branch information
sboukortt authored Nov 25, 2024
1 parent 706f78a commit 5ea4ea1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/extras/enc/apng.cc
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,10 @@ void MaybeAddGAMA(const JxlColorEncoding& c_enc, png_structp png_ptr,
void MaybeAddCLLi(const JxlColorEncoding& c_enc, const float intensity_target,
png_structp png_ptr, png_infop info_ptr) {
if (c_enc.transfer_function != JXL_TRANSFER_FUNCTION_PQ) return;
if (intensity_target == 10'000) return;

const uint32_t max_content_light_level =
static_cast<uint32_t>(10000.f * Clamp1(intensity_target, 0.f, 10000.f));
static_cast<uint32_t>(10'000.f * Clamp1(intensity_target, 0.f, 10'000.f));
png_byte chunk_data[8] = {};
png_save_uint_32(chunk_data, max_content_light_level);
// Leave MaxFALL set to 0.
Expand Down

0 comments on commit 5ea4ea1

Please sign in to comment.