Skip to content

Commit ba3f0a1

Browse files
committed
Merge renaming of mDCv to mDCV and cLLi to cLLI from 'master'.
2 parents c5d5a4e + 17d08dd commit ba3f0a1

File tree

2 files changed

+46
-45
lines changed

2 files changed

+46
-45
lines changed

lodepng.cpp

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
2-
LodePNG version 20241228
2+
LodePNG version 20250506
33
4-
Copyright (c) 2005-2024 Lode Vandevenne
4+
Copyright (c) 2005-2025 Lode Vandevenne
55
66
This software is provided 'as-is', without any express or implied
77
warranty. In no event will the authors be held liable for any damages
@@ -48,7 +48,7 @@ Rename this file to lodepng.cpp to use it for C++, or to lodepng.c to use it for
4848
#pragma clang diagnostic ignored "-Wshorten-64-to-32" /*implicit conversions*/
4949
#endif
5050

51-
const char* LODEPNG_VERSION_STRING = "20241228";
51+
const char* LODEPNG_VERSION_STRING = "20250506";
5252

5353
/*
5454
This source file is divided into the following large parts. The code sections
@@ -5149,8 +5149,8 @@ static unsigned readChunk_cICP(LodePNGInfo* info, const unsigned char* data, siz
51495149
return 0; /* OK */
51505150
}
51515151

5152-
static unsigned readChunk_mDCv(LodePNGInfo* info, const unsigned char* data, size_t chunkLength) {
5153-
if(chunkLength != 24) return 119; /*invalid mDCv chunk size*/
5152+
static unsigned readChunk_mDCV(LodePNGInfo* info, const unsigned char* data, size_t chunkLength) {
5153+
if(chunkLength != 24) return 119; /*invalid mDCV chunk size*/
51545154

51555155
info->mdcv_defined = 1;
51565156
info->mdcv_red_x = 256u * data[0] + data[1];
@@ -5167,8 +5167,8 @@ static unsigned readChunk_mDCv(LodePNGInfo* info, const unsigned char* data, siz
51675167
return 0; /* OK */
51685168
}
51695169

5170-
static unsigned readChunk_cLLi(LodePNGInfo* info, const unsigned char* data, size_t chunkLength) {
5171-
if(chunkLength != 8) return 120; /*invalid cLLi chunk size*/
5170+
static unsigned readChunk_cLLI(LodePNGInfo* info, const unsigned char* data, size_t chunkLength) {
5171+
if(chunkLength != 8) return 120; /*invalid cLLI chunk size*/
51725172

51735173
info->clli_defined = 1;
51745174
info->clli_max_cll = 16777216u * data[0] + 65536u * data[1] + 256u * data[2] + data[3];
@@ -5264,10 +5264,10 @@ unsigned lodepng_inspect_chunk(LodePNGState* state, size_t pos,
52645264
error = readChunk_iCCP(&state->info_png, &state->decoder, data, chunkLength);
52655265
} else if(lodepng_chunk_type_equals(chunk, "cICP")) {
52665266
error = readChunk_cICP(&state->info_png, data, chunkLength);
5267-
} else if(lodepng_chunk_type_equals(chunk, "mDCv")) {
5268-
error = readChunk_mDCv(&state->info_png, data, chunkLength);
5269-
} else if(lodepng_chunk_type_equals(chunk, "cLLi")) {
5270-
error = readChunk_cLLi(&state->info_png, data, chunkLength);
5267+
} else if(lodepng_chunk_type_equals(chunk, "mDCV")) {
5268+
error = readChunk_mDCV(&state->info_png, data, chunkLength);
5269+
} else if(lodepng_chunk_type_equals(chunk, "cLLI")) {
5270+
error = readChunk_cLLI(&state->info_png, data, chunkLength);
52715271
} else if(lodepng_chunk_type_equals(chunk, "eXIf")) {
52725272
error = readChunk_eXIf(&state->info_png, data, chunkLength);
52735273
} else if(lodepng_chunk_type_equals(chunk, "sBIT")) {
@@ -5420,11 +5420,11 @@ unsigned lodepng_decode_chunks(void** idat_out, size_t* idatsize_out, unsigned*
54205420
} else if(lodepng_chunk_type_equals(chunk, "cICP")) {
54215421
state->error = readChunk_cICP(&state->info_png, data, chunkLength);
54225422
if(state->error) break;
5423-
} else if(lodepng_chunk_type_equals(chunk, "mDCv")) {
5424-
state->error = readChunk_mDCv(&state->info_png, data, chunkLength);
5423+
} else if(lodepng_chunk_type_equals(chunk, "mDCV")) {
5424+
state->error = readChunk_mDCV(&state->info_png, data, chunkLength);
54255425
if(state->error) break;
5426-
} else if(lodepng_chunk_type_equals(chunk, "cLLi")) {
5427-
state->error = readChunk_cLLi(&state->info_png, data, chunkLength);
5426+
} else if(lodepng_chunk_type_equals(chunk, "cLLI")) {
5427+
state->error = readChunk_cLLI(&state->info_png, data, chunkLength);
54285428
if(state->error) break;
54295429
} else if(lodepng_chunk_type_equals(chunk, "eXIf")) {
54305430
state->error = readChunk_eXIf(&state->info_png, data, chunkLength);
@@ -6039,7 +6039,7 @@ static unsigned addChunk_cICP(ucvector* out, const LodePNGInfo* info) {
60396039
return 0;
60406040
}
60416041

6042-
static unsigned addChunk_mDCv(ucvector* out, const LodePNGInfo* info) {
6042+
static unsigned addChunk_mDCV(ucvector* out, const LodePNGInfo* info) {
60436043
unsigned char* chunk;
60446044
/* Allow up to 65535 since they are 16-bit ints. */
60456045
if(info->mdcv_red_x > 65535) return 118;
@@ -6050,7 +6050,7 @@ static unsigned addChunk_mDCv(ucvector* out, const LodePNGInfo* info) {
60506050
if(info->mdcv_blue_y > 65535) return 118;
60516051
if(info->mdcv_white_x > 65535) return 118;
60526052
if(info->mdcv_white_y > 65535) return 118;
6053-
CERROR_TRY_RETURN(lodepng_chunk_init(&chunk, out, 24, "mDCv"));
6053+
CERROR_TRY_RETURN(lodepng_chunk_init(&chunk, out, 24, "mDCV"));
60546054
chunk[8 + 0] = (unsigned char)((info->mdcv_red_x) >> 8u);
60556055
chunk[8 + 1] = (unsigned char)(info->mdcv_red_x);
60566056
chunk[8 + 2] = (unsigned char)((info->mdcv_red_y) >> 8u);
@@ -6073,9 +6073,9 @@ static unsigned addChunk_mDCv(ucvector* out, const LodePNGInfo* info) {
60736073
return 0;
60746074
}
60756075

6076-
static unsigned addChunk_cLLi(ucvector* out, const LodePNGInfo* info) {
6076+
static unsigned addChunk_cLLI(ucvector* out, const LodePNGInfo* info) {
60776077
unsigned char* chunk;
6078-
CERROR_TRY_RETURN(lodepng_chunk_init(&chunk, out, 8, "cLLi"));
6078+
CERROR_TRY_RETURN(lodepng_chunk_init(&chunk, out, 8, "cLLI"));
60796079
lodepng_set32bitInt(chunk + 8 + 0, info->clli_max_cll);
60806080
lodepng_set32bitInt(chunk + 8 + 4, info->clli_max_fall);
60816081
lodepng_chunk_generate_crc(chunk);
@@ -6755,11 +6755,11 @@ unsigned lodepng_encode(unsigned char** out, size_t* outsize,
67556755
if(state->error) goto cleanup;
67566756
}
67576757
if(info.mdcv_defined) {
6758-
state->error = addChunk_mDCv(&outv, &info);
6758+
state->error = addChunk_mDCV(&outv, &info);
67596759
if(state->error) goto cleanup;
67606760
}
67616761
if(info.clli_defined) {
6762-
state->error = addChunk_cLLi(&outv, &info);
6762+
state->error = addChunk_cLLI(&outv, &info);
67636763
if(state->error) goto cleanup;
67646764
}
67656765
if(info.iccp_defined) {
@@ -7091,9 +7091,9 @@ const char* lodepng_error_text(unsigned code) {
70917091
case 115: return "sBIT value out of range";
70927092
case 116: return "cICP value out of range";
70937093
case 117: return "invalid cICP chunk size";
7094-
case 118: return "mDCv value out of range";
7095-
case 119: return "invalid mDCv chunk size";
7096-
case 120: return "invalid cLLi chunk size";
7094+
case 118: return "mDCV value out of range";
7095+
case 119: return "invalid mDCV chunk size";
7096+
case 120: return "invalid cLLI chunk size";
70977097
case 121: return "invalid chunk type name: may only contain [a-zA-Z]";
70987098
case 122: return "invalid chunk type name: third character must be uppercase";
70997099
case 123: return "destination buffer too small";

lodepng.h

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
2-
LodePNG version 20241228
2+
LodePNG version 20250506
33
4-
Copyright (c) 2005-2024 Lode Vandevenne
4+
Copyright (c) 2005-2025 Lode Vandevenne
55
66
This software is provided 'as-is', without any express or implied
77
warranty. In no event will the authors be held liable for any damages
@@ -670,15 +670,15 @@ typedef struct LodePNGInfo {
670670
unsigned cicp_video_full_range_flag; /* Video full range flag value */
671671

672672
/*
673-
mDCv chunk: Mastering Display Color Volume.
673+
mDCV chunk: Mastering Display Color Volume.
674674
Optional, typically used in conjunction with certain HDR color spaces that can
675675
be represented by the cICP chunk.
676676
See the PNG specification, third edition, for more information on this chunk.
677677
All the red, green, blue and white x and y values are encoded as 16-bit
678678
integers and therefore must be in range 0-65536. The min and max luminance
679679
values are 32-bit integers.
680680
*/
681-
unsigned mdcv_defined; /* Whether a mDCv chunk is present (0 = not present, 1 = present). */
681+
unsigned mdcv_defined; /* Whether an mDCV chunk is present (0 = not present, 1 = present). */
682682
/* Mastering display color primary chromaticities (CIE 1931 x,y of R,G,B) */
683683
unsigned mdcv_red_x; /* Red x times 50000 */
684684
unsigned mdcv_red_y; /* Red y times 50000 */
@@ -694,13 +694,13 @@ typedef struct LodePNGInfo {
694694
unsigned mdcv_min_luminance; /* Min luminance in cd/m^2 times 10000 */
695695

696696
/*
697-
cLLi chunk: Content Light Level Information.
697+
cLLI chunk: Content Light Level Information.
698698
Optional, typically used in conjunction with certain HDR color spaces that can
699699
be represented by the cICP chunk.
700700
See the PNG specification, third edition, for more information on this chunk.
701701
The clli_max_cll and clli_max_fall values are 32-bit integers.
702702
*/
703-
unsigned clli_defined; /* Whether a cLLi chunk is present (0 = not present, 1 = present). */
703+
unsigned clli_defined; /* Whether a cLLI chunk is present (0 = not present, 1 = present). */
704704
unsigned clli_max_cll; /* Maximum Content Light Level (MaxCLL) in cd/m^2 times 10000 */
705705
unsigned clli_max_fall; /* Maximum Frame-Average Light Level (MaxFALL) in cd/m^2 times 10000 */
706706

@@ -1279,7 +1279,7 @@ unsigned compress(std::vector<unsigned char>& out, const std::vector<unsigned ch
12791279
[X] converting color to 16-bit per channel types
12801280
[X] support color profile chunk types (but never let them touch RGB values by default)
12811281
[ ] support all second edition public PNG chunk types (almost done except sPLT and hIST)
1282-
[X] support non-animation third edition public PNG chunk types: eXIf, cICP, mDCv, cLLi
1282+
[X] support non-animation third edition public PNG chunk types: eXIf, cICP, mDCV, cLLI
12831283
[ ] make sure encoder generates no chunks with size > (2^31)-1
12841284
[ ] partial decoding (stream processing)
12851285
[X] let the "isFullyOpaque" function check color keys and transparent palettes too
@@ -2019,12 +2019,13 @@ symbol.
20192019
Not all changes are listed here, the commit history in github lists more:
20202020
https://github.com/lvandeve/lodepng
20212021
2022-
*) 16 apr 2025: added public lodepng_decode_chunks and lodepng_finish_decode
2023-
functions. With these a user can separate decode of all the chunks, so as
2024-
to learn all the details of the file, from decompression, and possible
2025-
conversion, of the image data.
2022+
*) 6 may 2025: renamed mDCv to mDCV and cLLi to cLLI as per the recent rename
2023+
in the draft png third edition spec. Please note that while the third
2024+
edition is not finalized, backwards-incompatible changes to its features are
2025+
possible.
20262026
*) 16 apr 2025: Separated chunk decoding from image decoding and expansion.
2027-
2027+
so a user can first decode all the chunks to learn details of the file
2028+
then decompress and, possibly, convert the image data.
20282029
*) 23 dec 2024: added support for the mDCv and cLLi chunks (for png third
20292030
edition spec)
20302031
*) 22 dec 2024: added support for the cICP chunk (for png third edition spec)
@@ -2035,7 +2036,7 @@ Not all changes are listed here, the commit history in github lists more:
20352036
*) 27 jun 2021: added warnings that file reading/writing functions don't support
20362037
wide-character filenames (support for this is not planned, opening files is
20372038
not the core part of PNG decoding/decoding and is platform dependent).
2038-
*) 17 okt 2020: prevent decoding too large text/icc chunks by default.
2039+
*) 17 oct 2020: prevent decoding too large text/icc chunks by default.
20392040
*) 06 mar 2020: simplified some of the dynamic memory allocations.
20402041
*) 12 jan 2020: (!) added 'end' argument to lodepng_chunk_next to allow correct
20412042
overflow checks.
@@ -2057,7 +2058,7 @@ Not all changes are listed here, the commit history in github lists more:
20572058
*) 09 apr 2016: Fixed colorkey usage detection, and better file loading (within
20582059
the limits of pure C90).
20592060
*) 08 dec 2015: Made load_file function return error if file can't be opened.
2060-
*) 24 okt 2015: Bugfix with decoding to palette output.
2061+
*) 24 oct 2015: Bugfix with decoding to palette output.
20612062
*) 18 apr 2015: Boundary PM instead of just package-merge for faster encoding.
20622063
*) 24 aug 2014: Moved to github
20632064
*) 23 aug 2014: Reduced needless memory usage of decoder.
@@ -2071,8 +2072,8 @@ Not all changes are listed here, the commit history in github lists more:
20712072
prefix for the custom allocators and made it possible with a new #define to
20722073
use custom ones in your project without needing to change lodepng's code.
20732074
*) 28 jan 2013: Bugfix with color key.
2074-
*) 27 okt 2012: Tweaks in text chunk keyword length error handling.
2075-
*) 8 okt 2012: (!) Added new filter strategy (entropy) and new auto color mode.
2075+
*) 27 oct 2012: Tweaks in text chunk keyword length error handling.
2076+
*) 8 oct 2012: (!) Added new filter strategy (entropy) and new auto color mode.
20762077
(no palette). Better deflate tree encoding. New compression tweak settings.
20772078
Faster color conversions while decoding. Some internal cleanups.
20782079
*) 23 sep 2012: Reduced warnings in Visual Studio a little bit.
@@ -2088,7 +2089,7 @@ Not all changes are listed here, the commit history in github lists more:
20882089
*) 6 nov 2011: (!) By default, the encoder now automatically chooses the best
20892090
PNG color model and bit depth, based on the amount and type of colors of the
20902091
raw image. For this, autoLeaveOutAlphaChannel replaced by auto_choose_color.
2091-
*) 9 okt 2011: simpler hash chain implementation for the encoder.
2092+
*) 9 oct 2011: simpler hash chain implementation for the encoder.
20922093
*) 8 sep 2011: lz77 encoder lazy matching instead of greedy matching.
20932094
*) 23 aug 2011: tweaked the zlib compression parameters after benchmarking.
20942095
A bug with the PNG filtertype heuristic was fixed, so that it chooses much
@@ -2103,8 +2104,8 @@ Not all changes are listed here, the commit history in github lists more:
21032104
*) 13 nov 2010: added LodePNG_InfoColor_hasPaletteAlpha and
21042105
LodePNG_InfoColor_canHaveAlpha functions for convenience.
21052106
*) 7 nov 2010: added LodePNG_error_text function to get error code description.
2106-
*) 30 okt 2010: made decoding slightly faster
2107-
*) 26 okt 2010: (!) changed some C function and struct names (more consistent).
2107+
*) 30 oct 2010: made decoding slightly faster
2108+
*) 26 oct 2010: (!) changed some C function and struct names (more consistent).
21082109
Reorganized the documentation and the declaration order in the header.
21092110
*) 08 aug 2010: only changed some comments and external samples.
21102111
*) 05 jul 2010: fixed bug thanks to warnings in the new gcc version.
@@ -2163,8 +2164,8 @@ Not all changes are listed here, the commit history in github lists more:
21632164
Removed some code duplication in the decoder. Fixed little bug in an example.
21642165
*) 09 dec 2006: (!) Placed output parameters of public functions as first parameter.
21652166
Fixed a bug of the decoder with 16-bit per color.
2166-
*) 15 okt 2006: Changed documentation structure
2167-
*) 09 okt 2006: Encoder class added. It encodes a valid PNG image from the
2167+
*) 15 oct 2006: Changed documentation structure
2168+
*) 09 oct 2006: Encoder class added. It encodes a valid PNG image from the
21682169
given image buffer, however for now it's not compressed.
21692170
*) 08 sep 2006: (!) Changed to interface with a Decoder class
21702171
*) 30 jul 2006: (!) LodePNG_InfoPng , width and height are now retrieved in different

0 commit comments

Comments
 (0)