MCPcopy Create free account
hub / github.com/ClassiCube/ClassiCube / Png_ReconstructFirst

Function Png_ReconstructFirst

src/Bitmap.c:130–153  ·  view source on GitHub ↗

9 Filtering */ 13.9 Filtering */

Source from the content-addressed store, hash-verified

128/* 9 Filtering */
129/* 13.9 Filtering */
130static void Png_ReconstructFirst(cc_uint8 type, cc_uint8 bytesPerPixel, cc_uint8* line, cc_uint32 lineLen) {
131 /* First scanline is a special case, where all values in prior array are 0 */
132 cc_uint32 i, j;
133
134 switch (type) {
135 case PNG_FILTER_SUB:
136 for (i = bytesPerPixel, j = 0; i < lineLen; i++, j++) {
137 line[i] += line[j];
138 }
139 return;
140
141 case PNG_FILTER_AVERAGE:
142 for (i = bytesPerPixel, j = 0; i < lineLen; i++, j++) {
143 line[i] += (line[j] >> 1);
144 }
145 return;
146
147 case PNG_FILTER_PAETH:
148 for (i = bytesPerPixel, j = 0; i < lineLen; i++, j++) {
149 line[i] += line[j];
150 }
151 return;
152 }
153}
154
155static void Png_Reconstruct(cc_uint8 type, cc_uint8 bytesPerPixel, cc_uint8* line, cc_uint8* prior, cc_uint32 lineLen) {
156 cc_uint32 i, j;

Callers 1

Png_DecodeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected