9 Filtering */ 13.9 Filtering */
| 128 | /* 9 Filtering */ |
| 129 | /* 13.9 Filtering */ |
| 130 | static 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 | |
| 155 | static void Png_Reconstruct(cc_uint8 type, cc_uint8 bytesPerPixel, cc_uint8* line, cc_uint8* prior, cc_uint32 lineLen) { |
| 156 | cc_uint32 i, j; |