Prusa MINI Firmware overview
|
|
void PNGAPI | png_save_uint_32 (png_bytep buf, png_uint_32 i) |
|
void PNGAPI | png_save_uint_16 (png_bytep buf, unsigned int i) |
|
void PNGAPI | png_write_sig (png_structrp png_ptr) |
|
static void | png_write_chunk_header (png_structrp png_ptr, png_uint_32 chunk_name, png_uint_32 length) |
|
void PNGAPI | png_write_chunk_start (png_structrp png_ptr, png_const_bytep chunk_string, png_uint_32 length) |
|
void PNGAPI | png_write_chunk_data (png_structrp png_ptr, png_const_bytep data, size_t length) |
|
void PNGAPI | png_write_chunk_end (png_structrp png_ptr) |
|
static void | png_write_complete_chunk (png_structrp png_ptr, png_uint_32 chunk_name, png_const_bytep data, size_t length) |
|
void PNGAPI | png_write_chunk (png_structrp png_ptr, png_const_bytep chunk_string, png_const_bytep data, size_t length) |
|
static png_alloc_size_t | png_image_size (png_structrp png_ptr) |
|
static void | optimize_cmf (png_bytep data, png_alloc_size_t data_size) |
|
static int | png_deflate_claim (png_structrp png_ptr, png_uint_32 owner, png_alloc_size_t data_size) |
|
void | png_free_buffer_list (png_structrp png_ptr, png_compression_bufferp *listp) |
|
static void | png_text_compress_init (compression_state *comp, png_const_bytep input, png_alloc_size_t input_len) |
|
static int | png_text_compress (png_structrp png_ptr, png_uint_32 chunk_name, compression_state *comp, png_uint_32 prefix_len) |
|
static void | png_write_compressed_data_out (png_structrp png_ptr, compression_state *comp) |
|
void | png_write_IHDR (png_structrp png_ptr, png_uint_32 width, png_uint_32 height, int bit_depth, int color_type, int compression_type, int filter_type, int interlace_type) |
|
void | png_write_PLTE (png_structrp png_ptr, png_const_colorp palette, png_uint_32 num_pal) |
|
void | png_compress_IDAT (png_structrp png_ptr, png_const_bytep input, png_alloc_size_t input_len, int flush) |
|
void | png_write_IEND (png_structrp png_ptr) |
|
void | png_write_gAMA_fixed (png_structrp png_ptr, png_fixed_point file_gamma) |
|
void | png_write_sRGB (png_structrp png_ptr, int srgb_intent) |
|
void | png_write_iCCP (png_structrp png_ptr, png_const_charp name, png_const_bytep profile) |
|
void | png_write_sPLT (png_structrp png_ptr, png_const_sPLT_tp spalette) |
|
void | png_write_sBIT (png_structrp png_ptr, png_const_color_8p sbit, int color_type) |
|
void | png_write_cHRM_fixed (png_structrp png_ptr, const png_xy *xy) |
|
void | png_write_tRNS (png_structrp png_ptr, png_const_bytep trans_alpha, png_const_color_16p tran, int num_trans, int color_type) |
|
void | png_write_bKGD (png_structrp png_ptr, png_const_color_16p back, int color_type) |
|
void | png_write_eXIf (png_structrp png_ptr, png_bytep exif, int num_exif) |
|
void | png_write_hIST (png_structrp png_ptr, png_const_uint_16p hist, int num_hist) |
|
void | png_write_tEXt (png_structrp png_ptr, png_const_charp key, png_const_charp text, size_t text_len) |
|
void | png_write_zTXt (png_structrp png_ptr, png_const_charp key, png_const_charp text, int compression) |
|
void | png_write_iTXt (png_structrp png_ptr, int compression, png_const_charp key, png_const_charp lang, png_const_charp lang_key, png_const_charp text) |
|
void | png_write_oFFs (png_structrp png_ptr, png_int_32 x_offset, png_int_32 y_offset, int unit_type) |
|
void | png_write_pCAL (png_structrp png_ptr, png_charp purpose, png_int_32 X0, png_int_32 X1, int type, int nparams, png_const_charp units, png_charpp params) |
|
void | png_write_sCAL_s (png_structrp png_ptr, int unit, png_const_charp width, png_const_charp height) |
|
void | png_write_pHYs (png_structrp png_ptr, png_uint_32 x_pixels_per_unit, png_uint_32 y_pixels_per_unit, int unit_type) |
|
void | png_write_tIME (png_structrp png_ptr, png_const_timep mod_time) |
|
void | png_write_start_row (png_structrp png_ptr) |
|
void | png_write_finish_row (png_structrp png_ptr) |
|
void | png_do_write_interlace (png_row_infop row_info, png_bytep row, int pass) |
|
static void | png_write_filtered_row (png_structrp png_ptr, png_bytep filtered_row, size_t row_bytes) |
|
static size_t | png_setup_sub_row (png_structrp png_ptr, png_uint_32 bpp, size_t row_bytes, size_t lmins) |
|
static void | png_setup_sub_row_only (png_structrp png_ptr, png_uint_32 bpp, size_t row_bytes) |
|
static size_t | png_setup_up_row (png_structrp png_ptr, size_t row_bytes, size_t lmins) |
|
static void | png_setup_up_row_only (png_structrp png_ptr, size_t row_bytes) |
|
static size_t | png_setup_avg_row (png_structrp png_ptr, png_uint_32 bpp, size_t row_bytes, size_t lmins) |
|
static void | png_setup_avg_row_only (png_structrp png_ptr, png_uint_32 bpp, size_t row_bytes) |
|
static size_t | png_setup_paeth_row (png_structrp png_ptr, png_uint_32 bpp, size_t row_bytes, size_t lmins) |
|
static void | png_setup_paeth_row_only (png_structrp png_ptr, png_uint_32 bpp, size_t row_bytes) |
|
void | png_write_find_filter (png_structrp png_ptr, png_row_infop row_info) |
|
◆ png_save_uint_32()
26 buf[0] = (png_byte)((
i >> 24) & 0xffU);
27 buf[1] = (png_byte)((
i >> 16) & 0xffU);
28 buf[2] = (png_byte)((
i >> 8) & 0xffU);
29 buf[3] = (png_byte)(
i & 0xffU);
◆ png_save_uint_16()
39 buf[0] = (png_byte)((
i >> 8) & 0xffU);
40 buf[1] = (png_byte)(
i & 0xffU);
◆ png_write_sig()
53 png_byte png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10};
55 #ifdef PNG_IO_STATE_SUPPORTED
62 (
size_t)(8 -
png_ptr->sig_bytes));
◆ png_write_chunk_header()
78 #if defined(PNG_DEBUG) && (PNG_DEBUG > 0)
86 #ifdef PNG_IO_STATE_SUPPORTED
99 png_ptr->chunk_name = chunk_name;
106 #ifdef PNG_IO_STATE_SUPPORTED
◆ png_write_chunk_start()
◆ png_write_chunk_data()
◆ png_write_chunk_end()
152 #ifdef PNG_IO_STATE_SUPPORTED
◆ png_write_complete_chunk()
◆ png_write_chunk()
◆ png_image_size()
211 if (
png_ptr->rowbytes < 32768 && h < 32768)
223 for (cb_base=0, pass=0; pass<=6; ++pass)
235 return (
png_ptr->rowbytes+1) * h;
◆ optimize_cmf()
255 if (data_size <= 16384)
257 unsigned int z_cmf =
data[0];
259 if ((z_cmf & 0x0f) == 8 && (z_cmf & 0xf0) <= 0x70)
261 unsigned int z_cinfo;
262 unsigned int half_z_window_size;
264 z_cinfo = z_cmf >> 4;
265 half_z_window_size = 1U << (z_cinfo + 7);
267 if (data_size <= half_z_window_size)
273 half_z_window_size >>= 1;
276 while (z_cinfo > 0 && data_size <= half_z_window_size);
278 z_cmf = (z_cmf & 0x0f) | (z_cinfo << 4);
280 data[0] = (png_byte)z_cmf;
281 tmp =
data[1] & 0xe0;
282 tmp += 0x1f - ((z_cmf << 8) + tmp) % 0x1f;
283 data[1] = (png_byte)tmp;
◆ png_deflate_claim()
297 #if defined(PNG_WARNINGS_SUPPORTED) || defined(PNG_ERROR_TEXT_SUPPORTED)
310 #if PNG_RELEASE_BUILD
327 int level =
png_ptr->zlib_level;
328 int method =
png_ptr->zlib_method;
329 int windowBits =
png_ptr->zlib_window_bits;
330 int memLevel =
png_ptr->zlib_mem_level;
337 strategy =
png_ptr->zlib_strategy;
348 #ifdef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED
349 level =
png_ptr->zlib_text_level;
350 method =
png_ptr->zlib_text_method;
351 windowBits =
png_ptr->zlib_text_window_bits;
352 memLevel =
png_ptr->zlib_text_mem_level;
353 strategy =
png_ptr->zlib_text_strategy;
371 if (data_size <= 16384)
378 unsigned int half_window_size = 1U << (windowBits-1);
380 while (data_size + 262 <= half_window_size)
382 half_window_size >>= 1;
389 (
png_ptr->zlib_set_level != level ||
390 png_ptr->zlib_set_method != method ||
391 png_ptr->zlib_set_window_bits != windowBits ||
392 png_ptr->zlib_set_mem_level != memLevel ||
393 png_ptr->zlib_set_strategy != strategy))
407 png_ptr->zstream.avail_out = 0;
◆ png_free_buffer_list()
void png_free_buffer_list |
( |
png_structrp |
png_ptr, |
|
|
png_compression_bufferp * |
listp |
|
) |
| |
441 png_compression_bufferp list = *listp;
449 png_compression_bufferp next = list->next;
454 while (list !=
NULL);
◆ png_text_compress_init()
◆ png_text_compress()
515 png_compression_bufferp *
end = &
png_ptr->zbuffer_list;
525 output_len =
png_ptr->zstream.avail_out;
531 if (avail_in > input_len)
532 avail_in = (
uInt)input_len;
534 input_len -= avail_in;
536 png_ptr->zstream.avail_in = avail_in;
538 if (
png_ptr->zstream.avail_out == 0)
540 png_compression_buffer *next;
557 next =
png_voidcast(png_compression_bufferp, png_malloc_base
571 png_ptr->zstream.next_out = next->output;
573 output_len +=
png_ptr->zstream.avail_out;
586 input_len +=
png_ptr->zstream.avail_in;
594 output_len -=
png_ptr->zstream.avail_out;
595 png_ptr->zstream.avail_out = 0;
619 #ifdef PNG_WRITE_OPTIMIZE_CMF_SUPPORTED
◆ png_write_compressed_data_out()
642 png_compression_buffer *next =
png_ptr->zbuffer_list;
646 if (avail > output_len)
653 if (output_len == 0 || next ==
NULL)
657 output = next->output;
◆ png_write_IHDR()
677 int is_invalid_depth;
691 #ifdef PNG_WRITE_16BIT_SUPPORTED
698 "Invalid bit depth for grayscale image");
703 is_invalid_depth = (bit_depth != 8);
704 #ifdef PNG_WRITE_16BIT_SUPPORTED
705 is_invalid_depth = (is_invalid_depth && bit_depth != 16);
707 if (is_invalid_depth)
729 is_invalid_depth = (bit_depth != 8);
730 #ifdef PNG_WRITE_16BIT_SUPPORTED
731 is_invalid_depth = (is_invalid_depth && bit_depth != 16);
733 if (is_invalid_depth)
740 is_invalid_depth = (bit_depth != 8);
741 #ifdef PNG_WRITE_16BIT_SUPPORTED
742 is_invalid_depth = (is_invalid_depth && bit_depth != 16);
744 if (is_invalid_depth)
783 #ifdef PNG_WRITE_INTERLACING_SUPPORTED
795 png_ptr->bit_depth = (png_byte)bit_depth;
796 png_ptr->color_type = (png_byte)color_type;
797 png_ptr->interlaced = (png_byte)interlace_type;
798 #ifdef PNG_MNG_FEATURES_SUPPORTED
799 png_ptr->filter_type = (png_byte)filter_type;
801 png_ptr->compression_type = (png_byte)compression_type;
815 buf[8] = (png_byte)bit_depth;
816 buf[9] = (png_byte)color_type;
817 buf[10] = (png_byte)compression_type;
818 buf[11] = (png_byte)filter_type;
819 buf[12] = (png_byte)interlace_type;
◆ png_write_PLTE()
858 num_pal == 0) || num_pal > max_palette_length)
875 "Ignoring request to write a PLTE chunk in grayscale PNG");
884 #ifdef PNG_POINTER_INDEXING_SUPPORTED
886 for (
i = 0, pal_ptr = palette;
i < num_pal;
i++, pal_ptr++)
888 buf[0] = pal_ptr->red;
889 buf[1] = pal_ptr->green;
890 buf[2] = pal_ptr->blue;
900 for (
i = 0;
i < num_pal;
i++)
902 buf[0] = pal_ptr[
i].red;
903 buf[1] = pal_ptr[
i].green;
904 buf[2] = pal_ptr[
i].blue;
◆ png_compress_IDAT()
975 if (avail > input_len)
976 avail = (
uInt)input_len;
978 png_ptr->zstream.avail_in = avail;
984 input_len +=
png_ptr->zstream.avail_in;
991 if (
png_ptr->zstream.avail_out == 0)
999 #ifdef PNG_WRITE_OPTIMIZE_CMF_SUPPORTED
1046 #ifdef PNG_WRITE_OPTIMIZE_CMF_SUPPORTED
1054 png_ptr->zstream.avail_out = 0;
◆ png_write_IEND()
◆ png_write_gAMA_fixed()
◆ png_write_sRGB()
1107 "Invalid sRGB rendering intent specified");
1109 buf[0]=(png_byte)srgb_intent;
◆ png_write_iCCP()
1122 png_byte new_name[81];
1131 if (profile ==
NULL)
1136 if (profile_len < 132)
1140 if (temp > 3 && (profile_len & 0x03))
1146 if (profile_len != embedded_profile_len)
◆ png_write_sPLT()
1182 png_byte new_name[80];
1183 png_byte entrybuf[10];
1184 size_t entry_size = (spalette->depth == 8 ? 6 : 10);
1185 size_t palette_size = entry_size * (size_t)spalette->nentries;
1207 #ifdef PNG_POINTER_INDEXING_SUPPORTED
1208 for (ep = spalette->entries; ep<spalette->entries + spalette->nentries; ep++)
1210 if (spalette->depth == 8)
1212 entrybuf[0] = (png_byte)ep->red;
1213 entrybuf[1] = (png_byte)ep->green;
1214 entrybuf[2] = (png_byte)ep->blue;
1215 entrybuf[3] = (png_byte)ep->alpha;
1231 ep=spalette->entries;
1232 for (
i = 0;
i>spalette->nentries;
i++)
1234 if (spalette->depth == 8)
1236 entrybuf[0] = (png_byte)ep[
i].
red;
1237 entrybuf[1] = (png_byte)ep[
i].green;
1238 entrybuf[2] = (png_byte)ep[
i].blue;
1239 entrybuf[3] = (png_byte)ep[
i].alpha;
◆ png_write_sBIT()
1278 if (sbit->red == 0 || sbit->red > maxbits ||
1279 sbit->green == 0 || sbit->green > maxbits ||
1280 sbit->blue == 0 || sbit->blue > maxbits)
1287 buf[1] = sbit->green;
1288 buf[2] = sbit->blue;
1294 if (sbit->gray == 0 || sbit->gray >
png_ptr->usr_bit_depth)
1300 buf[0] = sbit->gray;
1306 if (sbit->alpha == 0 || sbit->alpha >
png_ptr->usr_bit_depth)
1312 buf[
size++] = sbit->alpha;
◆ png_write_cHRM_fixed()
◆ png_write_tRNS()
1357 if (num_trans <= 0 || num_trans > (
int)
png_ptr->num_palette)
1360 "Invalid number of transparent colors specified");
1372 if (tran->gray >= (1 <<
png_ptr->bit_depth))
1375 "Ignoring attempt to write tRNS chunk out-of-range for bit_depth");
1390 #ifdef PNG_WRITE_16BIT_SUPPORTED
1391 if (
png_ptr->bit_depth == 8 && (buf[0] | buf[2] | buf[4]) != 0)
1393 if ((buf[0] | buf[2] | buf[4]) != 0)
1397 "Ignoring attempt to write 16-bit tRNS chunk when bit_depth is 8");
◆ png_write_bKGD()
1427 back->index >=
png_ptr->num_palette)
1433 buf[0] = back->index;
1442 #ifdef PNG_WRITE_16BIT_SUPPORTED
1443 if (
png_ptr->bit_depth == 8 && (buf[0] | buf[2] | buf[4]) != 0)
1445 if ((buf[0] | buf[2] | buf[4]) != 0)
1449 "Ignoring attempt to write 16-bit bKGD chunk "
1450 "when bit_depth is 8");
1460 if (back->gray >= (1 <<
png_ptr->bit_depth))
1463 "Ignoring attempt to write bKGD chunk out-of-range for bit_depth");
◆ png_write_eXIf()
1486 for (
i = 0;
i < num_exif;
i++)
◆ png_write_hIST()
1506 if (num_hist > (
int)
png_ptr->num_palette)
1508 png_debug2(3,
"num_hist = %d, num_palette = %d", num_hist,
1517 for (
i = 0;
i < num_hist;
i++)
◆ png_write_tEXt()
1534 png_byte new_key[80];
1543 if (text ==
NULL || *text ==
'\0')
1547 text_len = strlen(text);
◆ png_write_zTXt()
1577 png_byte new_key[81];
1602 text ==
NULL ? 0 : strlen(text));
◆ png_write_iTXt()
1628 size_t lang_len, lang_key_len;
1629 png_byte new_key[82];
1640 switch (compression)
1644 compression = new_key[++key_len] = 0;
1649 compression = new_key[++key_len] = 1;
1669 if (lang ==
NULL) lang =
"";
1670 lang_len = strlen(lang)+1;
1671 if (lang_key ==
NULL) lang_key =
"";
1672 lang_key_len = strlen(lang_key)+1;
1673 if (text ==
NULL) text =
"";
1675 prefix_len = key_len;
1679 prefix_len = (
png_uint_32)(prefix_len + lang_len);
1684 prefix_len = (
png_uint_32)(prefix_len + lang_key_len);
1688 if (compression != 0)
1711 if (compression != 0)
◆ png_write_oFFs()
1736 buf[8] = (png_byte)unit_type;
◆ png_write_pCAL()
1749 size_t units_len, total_len;
1752 png_byte new_purpose[80];
1755 png_debug1(1,
"in png_write_pCAL (%d parameters)", nparams);
1762 if (purpose_len == 0)
1767 png_debug1(3,
"pCAL purpose length = %d", (
int)purpose_len);
1768 units_len = strlen(units) + (nparams == 0 ? 0 : 1);
1769 png_debug1(3,
"pCAL units length = %d", (
int)units_len);
1770 total_len = purpose_len + units_len + 10;
1778 for (
i = 0;
i < nparams;
i++)
1780 params_len[
i] = strlen(params[
i]) + (
i == nparams - 1 ? 0 : 1);
1781 png_debug2(3,
"pCAL parameter %d length = %lu",
i,
1782 (
unsigned long)params_len[
i]);
1783 total_len += params_len[
i];
1786 png_debug1(3,
"pCAL total length = %d", (
int)total_len);
1791 buf[8] = (png_byte)
type;
1792 buf[9] = (png_byte)nparams;
1796 for (
i = 0;
i < nparams;
i++)
◆ png_write_sCAL_s()
1813 size_t wlen, hlen, total_len;
1817 wlen = strlen(
width);
1818 hlen = strlen(height);
1819 total_len = wlen + hlen + 2;
1827 buf[0] = (png_byte)
unit;
1828 memcpy(buf + 1,
width, wlen + 1);
1829 memcpy(buf + wlen + 2, height, hlen);
1831 png_debug1(3,
"sCAL total length = %u", (
unsigned int)total_len);
◆ png_write_pHYs()
1852 buf[8] = (png_byte)unit_type;
◆ png_write_tIME()
1869 if (mod_time->month > 12 || mod_time->month < 1 ||
1870 mod_time->day > 31 || mod_time->day < 1 ||
1871 mod_time->hour > 23 || mod_time->second > 60)
1878 buf[2] = mod_time->month;
1879 buf[3] = mod_time->day;
1880 buf[4] = mod_time->hour;
1881 buf[5] = mod_time->minute;
1882 buf[6] = mod_time->second;
◆ png_write_start_row()
1892 #ifdef PNG_WRITE_INTERLACING_SUPPORTED
1896 static const png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
1899 static const png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
1902 static const png_byte png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};
1905 static const png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
1909 int usr_pixel_depth;
1911 #ifdef PNG_WRITE_FILTER_SUPPORTED
1917 usr_pixel_depth =
png_ptr->usr_channels *
png_ptr->usr_bit_depth;
1922 png_ptr->maximum_pixel_depth = (png_byte)usr_pixel_depth;
1929 #ifdef PNG_WRITE_FILTER_SUPPORTED
1946 int num_filters = 0;
1962 if (num_filters > 1)
1972 png_calloc(
png_ptr, buf_size));
1975 #ifdef PNG_WRITE_INTERLACING_SUPPORTED
1982 png_pass_ystart[0]) / png_pass_yinc[0];
1985 png_pass_start[0]) / png_pass_inc[0];
◆ png_write_finish_row()
2007 #ifdef PNG_WRITE_INTERLACING_SUPPORTED
2011 static const png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
2014 static const png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
2017 static const png_byte png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};
2020 static const png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
2023 png_debug(1,
"in png_write_finish_row");
2032 #ifdef PNG_WRITE_INTERLACING_SUPPORTED
2053 png_pass_inc[
png_ptr->pass] - 1 -
2054 png_pass_start[
png_ptr->pass]) /
2058 png_pass_yinc[
png_ptr->pass] - 1 -
2059 png_pass_ystart[
png_ptr->pass]) /
◆ png_do_write_interlace()
2101 static const png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
2104 static const png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
2106 png_debug(1,
"in png_do_write_interlace");
2128 for (
i = png_pass_start[pass];
i < row_width;
2129 i += png_pass_inc[pass])
2131 sp = row + (size_t)(
i >> 3);
2132 value = (
int)(*sp >> (7 - (
int)(
i & 0x07))) & 0x01;
2133 d |= (value << shift);
2138 *dp++ = (png_byte)d;
2166 for (
i = png_pass_start[pass];
i < row_width;
2167 i += png_pass_inc[pass])
2169 sp = row + (size_t)(
i >> 2);
2170 value = (*sp >> ((3 - (
int)(
i & 0x03)) << 1)) & 0x03;
2171 d |= (value << shift);
2176 *dp++ = (png_byte)d;
2202 for (
i = png_pass_start[pass];
i < row_width;
2203 i += png_pass_inc[pass])
2205 sp = row + (size_t)(
i >> 1);
2206 value = (*sp >> ((1 - (
int)(
i & 0x01)) << 2)) & 0x0f;
2207 d |= (value << shift);
2212 *dp++ = (png_byte)d;
2240 for (
i = png_pass_start[pass];
i < row_width;
2241 i += png_pass_inc[pass])
2244 sp = row + (size_t)
i * pixel_bytes;
2248 memcpy(dp, sp, pixel_bytes);
2258 png_pass_inc[pass] - 1 -
2259 png_pass_start[pass]) /
◆ png_write_filtered_row()
2750 png_debug(1,
"in png_write_filtered_row");
2752 png_debug1(2,
"filter = %d", filtered_row[0]);
2756 #ifdef PNG_WRITE_FILTER_SUPPORTED
2771 #ifdef PNG_WRITE_FLUSH_SUPPORTED
2774 if (
png_ptr->flush_dist > 0 &&
◆ png_setup_sub_row()
2294 sum += 128 -
abs((
int)v - 128);
2296 sum += (v < 128) ? v : 256 - v;
2300 for (lp =
png_ptr->row_buf + 1;
i < row_bytes;
2301 i++, rp++, lp++, dp++)
2303 v = *dp = (png_byte)(((
int)*rp - (
int)*lp) & 0xff);
2305 sum += 128 -
abs((
int)v - 128);
2307 sum += (v < 128) ? v : 256 - v;
◆ png_setup_sub_row_only()
2332 for (lp =
png_ptr->row_buf + 1;
i < row_bytes;
2333 i++, rp++, lp++, dp++)
2335 *dp = (png_byte)(((
int)*rp - (
int)*lp) & 0xff);
◆ png_setup_up_row()
static size_t png_setup_up_row |
( |
png_structrp |
png_ptr, |
|
|
size_t |
row_bytes, |
|
|
size_t |
lmins |
|
) |
| |
|
static |
2350 pp =
png_ptr->prev_row + 1;
i < row_bytes;
2351 i++, rp++, pp++, dp++)
2353 v = *dp = (png_byte)(((
int)*rp - (
int)*pp) & 0xff);
2355 sum += 128 -
abs((
int)v - 128);
2357 sum += (v < 128) ? v : 256 - v;
◆ png_setup_up_row_only()
2375 pp =
png_ptr->prev_row + 1;
i < row_bytes;
2376 i++, rp++, pp++, dp++)
2378 *dp = (png_byte)(((
int)*rp - (
int)*pp) & 0xff);
◆ png_setup_avg_row()
2394 pp =
png_ptr->prev_row + 1;
i < bpp;
i++)
2396 v = *dp++ = (png_byte)(((
int)*rp++ - ((
int)*pp++ / 2)) & 0xff);
2399 sum += 128 -
abs((
int)v - 128);
2401 sum += (v < 128) ? v : 256 - v;
2405 for (lp =
png_ptr->row_buf + 1;
i < row_bytes;
i++)
2407 v = *dp++ = (png_byte)(((
int)*rp++ - (((
int)*pp++ + (
int)*lp++) / 2))
2411 sum += 128 -
abs((
int)v - 128);
2413 sum += (v < 128) ? v : 256 - v;
◆ png_setup_avg_row_only()
2432 pp =
png_ptr->prev_row + 1;
i < bpp;
i++)
2434 *dp++ = (png_byte)(((
int)*rp++ - ((
int)*pp++ / 2)) & 0xff);
2437 for (lp =
png_ptr->row_buf + 1;
i < row_bytes;
i++)
2439 *dp++ = (png_byte)(((
int)*rp++ - (((
int)*pp++ + (
int)*lp++) / 2))
◆ png_setup_paeth_row()
2456 pp =
png_ptr->prev_row + 1;
i < bpp;
i++)
2458 v = *dp++ = (png_byte)(((
int)*rp++ - (
int)*pp++) & 0xff);
2461 sum += 128 -
abs((
int)v - 128);
2463 sum += (v < 128) ? v : 256 - v;
2467 for (lp =
png_ptr->row_buf + 1, cp =
png_ptr->prev_row + 1;
i < row_bytes;
2470 int a,
b, c, pa, pb, pc, p;
2484 pa = p < 0 ? -p : p;
2485 pb = pc < 0 ? -pc : pc;
2486 pc = (p + pc) < 0 ? -(p + pc) : p + pc;
2489 p = (pa <= pb && pa <=pc) ?
a : (pb <= pc) ?
b : c;
2491 v = *dp++ = (png_byte)(((
int)*rp++ - p) & 0xff);
2494 sum += 128 -
abs((
int)v - 128);
2496 sum += (v < 128) ? v : 256 - v;
◆ png_setup_paeth_row_only()
2515 pp =
png_ptr->prev_row + 1;
i < bpp;
i++)
2517 *dp++ = (png_byte)(((
int)*rp++ - (
int)*pp++) & 0xff);
2520 for (lp =
png_ptr->row_buf + 1, cp =
png_ptr->prev_row + 1;
i < row_bytes;
2523 int a,
b, c, pa, pb, pc, p;
2537 pa = p < 0 ? -p : p;
2538 pb = pc < 0 ? -pc : pc;
2539 pc = (p + pc) < 0 ? -(p + pc) : p + pc;
2542 p = (pa <= pb && pa <=pc) ?
a : (pb <= pc) ?
b : c;
2544 *dp++ = (png_byte)(((
int)*rp++ - p) & 0xff);
◆ png_write_find_filter()
2552 #ifndef PNG_WRITE_FILTER_SUPPORTED
2555 unsigned int filter_to_do =
png_ptr->do_filter;
2560 size_t row_bytes = row_info->
rowbytes;
2562 png_debug(1,
"in png_write_find_filter");
2606 filter_to_do &= 0U-filter_to_do;
2620 for (
i = 0, rp = row_buf + 1;
i < row_bytes;
i++, rp++)
2624 sum += 128 -
abs((
int)v - 128);
2626 sum += (v < 128) ? v : 256 - v;
2645 size_t lmins = mins;
2671 size_t lmins = mins;
2697 size_t lmins = mins;
2723 size_t lmins = mins;
#define Z_MEM_ERROR
Definition: zlib.h:183
#define PNG_MNG_FEATURES_SUPPORTED
Definition: pnglibconf.h:44
const typedef png_byte * png_const_bytep
Definition: pngconf.h:580
#define PNG_FLAG_MNG_EMPTY_PLTE
Definition: png.h:857
#define PNG_AFTER_IDAT
Definition: png.h:646
#define PNG_FLAG_ZLIB_CUSTOM_STRATEGY
Definition: pngpriv.h:679
png_alloc_size_t input_len
Definition: pngwutil.c:472
#define png_sCAL
Definition: pngpriv.h:867
#define PNG_TEXT_COMPRESSION_zTXt
Definition: png.h:589
png_uint_32 output_len
Definition: pngwutil.c:473
#define PNG_OFFSET_LAST
Definition: png.h:694
#define png_eXIf
Definition: pngpriv.h:854
void png_write_tEXt(png_structrp png_ptr, png_const_charp key, png_const_charp text, size_t text_len)
Definition: pngwutil.c:1530
#define png_tRNS
Definition: pngpriv.h:873
int ZEXPORT deflateEnd(z_streamp strm)
Definition: deflate.c:1076
#define PNG_UINT_31_MAX
Definition: png.h:649
#define PNG_HAVE_PLTE
Definition: png.h:645
Definition: pngwutil.c:469
#define png_PLTE
Definition: pngpriv.h:851
void PNGAPI png_free(png_const_structrp png_ptr, png_voidp ptr)
Definition: pngmem.c:232
#define png_zTXt
Definition: pngpriv.h:874
#define PNG_FILTER_AVG
Definition: png.h:1468
#define png_iTXt
Definition: pngpriv.h:862
png_const_structrp png_const_inforp int * unit
Definition: png.h:2161
#define PNG_IO_CHUNK_CRC
Definition: png.h:2428
png_const_bytep input
Definition: pngwutil.c:471
#define pd
Definition: screen_filebrowser.cpp:39
#define PNG_INTERLACE_NONE
Definition: png.h:687
uint8_t type
Definition: UsbCore.h:184
#define Z_FINISH
Definition: zlib.h:172
#define abs(x)
Definition: wiring_constants.h:32
#define Z_STREAM_ERROR
Definition: zlib.h:181
uint8_t data[8]
Definition: masstorage.h:49
#define PNG_EQUATION_LAST
Definition: png.h:701
png_byte * png_bytep
Definition: pngconf.h:579
uint8_t i
Definition: screen_test_graph.c:72
#define PNG_PASS_COLS(width, pass)
Definition: png.h:2468
static int png_text_compress(png_structrp png_ptr, png_uint_32 chunk_name, compression_state *comp, png_uint_32 prefix_len)
Definition: pngwutil.c:488
static png_alloc_size_t png_image_size(png_structrp png_ptr)
Definition: pngwutil.c:204
static int png_deflate_claim(png_structrp png_ptr, png_uint_32 owner, png_alloc_size_t data_size)
Definition: pngwutil.c:292
const typedef png_color * png_const_colorp
Definition: png.h:485
#define PNG_COLOR_TYPE_RGB_ALPHA
Definition: png.h:671
png_const_structrp png_const_inforp int png_fixed_point * width
Definition: png.h:2161
#define PNG_FILTER_TYPE_BASE
Definition: png.h:682
#define PNG_NO_FILTERS
Definition: png.h:1464
void png_free_buffer_list(png_structrp png_ptr, png_compression_bufferp *listp)
Definition: pngwutil.c:439
#define png_debug2(l, m, p1, p2)
Definition: pngdebug.h:151
static void png_setup_sub_row_only(png_structrp png_ptr, png_uint_32 bpp, size_t row_bytes)
Definition: pngwutil.c:2318
#define PNG_SIZE_MAX
Definition: png.h:651
static void png_setup_avg_row_only(png_structrp png_ptr, png_uint_32 bpp, size_t row_bytes)
Definition: pngwutil.c:2423
#define png_iCCP
Definition: pngpriv.h:861
#define png_tEXt
Definition: pngpriv.h:871
#define PNG_INTRAPIXEL_DIFFERENCING
Definition: png.h:683
#define png_voidcast(type, value)
Definition: pngpriv.h:494
#define PNG_IO_SIGNATURE
Definition: png.h:2425
#define NULL
Definition: usbd_def.h:53
png_uint_32 width
Definition: png.h:756
#define png_IEND
Definition: pngpriv.h:849
png_structrp png_ptr
Definition: png.h:1083
#define png_sPLT
Definition: pngpriv.h:868
#define PNG_IO_WRITING
Definition: png.h:2424
#define PNG_Z_DEFAULT_STRATEGY
Definition: pnglibconf.h:215
#define PNG_COLOR_TYPE_RGB
Definition: png.h:670
void PNGAPI png_save_int_32(png_bytep buf, png_int_32 i)
Definition: png.c:726
#define PNG_FLAG_MNG_FILTER_64
Definition: png.h:858
end
Definition: createSpeedLookupTable.py:33
#define pw
Definition: screen_home.cpp:76
unsigned int png_uint_32
Definition: pngconf.h:511
#define PNG_TEXT_COMPRESSION_NONE
Definition: png.h:588
png_uint_16(PNGAPI png_get_uint_16)(png_const_bytep buf)
Definition: pngrutil.c:102
#define PNG_MAX_PALETTE_LENGTH
Definition: png.h:725
void png_write_data(png_structrp png_ptr, png_const_bytep data, size_t length)
Definition: pngwio.c:33
#define PNG_HAVE_IHDR
Definition: png.h:644
#define PNG_HAVE_IDAT
Definition: pngpriv.h:626
static void png_write_filtered_row(png_structrp png_ptr, png_bytep filtered_row, size_t row_bytes)
Definition: pngwutil.c:2747
#define Z_NO_FLUSH
Definition: zlib.h:168
png_structrp int png_fixed_point red
Definition: png.h:1083
#define PNG_ITXT_COMPRESSION_zTXt
Definition: png.h:591
#define PNGZ_MSG_CAST(s)
Definition: pngstruct.h:40
void png_calculate_crc(png_structrp png_ptr, png_const_bytep ptr, size_t length)
Definition: png.c:139
#define ZLIB_IO_MAX
Definition: pngstruct.h:56
png_uint_32 png_check_keyword(png_structrp png_ptr, png_const_charp key, png_bytep new_key)
Definition: pngset.c:1726
#define PNG_COLOR_TYPE_GRAY
Definition: png.h:668
#define PNG_FILTER_NONE
Definition: png.h:1465
#define png_debug(l, m)
Definition: pngdebug.h:145
#define PNG_POINTER_INDEXING_SUPPORTED
Definition: pnglibconf.h:45
#define PNG_ITXT_COMPRESSION_NONE
Definition: png.h:590
#define PNG_INTERLACE
Definition: pngpriv.h:643
void png_write_finish_row(png_structrp png_ptr)
Definition: pngwutil.c:2005
#define PNG_CHUNK_FROM_STRING(s)
Definition: pngpriv.h:879
#define png_IDAT
Definition: pngpriv.h:848
void
Definition: png.h:1083
void PNGAPI png_write_chunk_data(png_structrp png_ptr, png_const_bytep data, size_t length)
Definition: pngwutil.c:127
#define PNG_COMPRESSION_TYPE_BASE
Definition: png.h:678
#define Z_OK
Definition: zlib.h:177
#define PNG_FILTER_VALUE_NONE
Definition: png.h:1476
#define png_IHDR
Definition: pngpriv.h:850
#define png_cHRM
Definition: pngpriv.h:853
#define PNG_FILTER_UP
Definition: png.h:1467
static void png_setup_paeth_row_only(png_structrp png_ptr, png_uint_32 bpp, size_t row_bytes)
Definition: pngwutil.c:2506
#define PNG_FILTER_VALUE_AVG
Definition: png.h:1479
static void png_text_compress_init(compression_state *comp, png_const_bytep input, png_alloc_size_t input_len)
Definition: pngwutil.c:478
list a
Definition: createSpeedLookupTable.py:29
#define PNG_FILTER_VALUE_PAETH
Definition: png.h:1480
#define PNG_HAVE_IEND
Definition: pngpriv.h:628
void png_zstream_error(png_structrp png_ptr, int ret)
Definition: png.c:998
#define png_get_uint_32(buf)
Definition: png.h:2598
#define PNG_FILTER_PAETH
Definition: png.h:1469
#define PNG_PASS_ROWS(height, pass)
Definition: png.h:2466
#define PNG_FILTER_VALUE_UP
Definition: png.h:1478
#define Z_STREAM_END
Definition: zlib.h:178
void PNGAPI png_save_uint_16(png_bytep buf, unsigned int i)
Definition: pngwutil.c:37
png_byte pixel_depth
Definition: png.h:761
#define PNG_INTERLACE_ADAM7
Definition: png.h:688
void png_reset_crc(png_structrp png_ptr)
Definition: png.c:127
#define PNG_IO_CHUNK_DATA
Definition: png.h:2427
#define Z_DEFAULT_STRATEGY
Definition: zlib.h:200
#define PNG_FILTER_VALUE_SUB
Definition: png.h:1477
#define deflateInit2(strm, level, method, windowBits, memLevel, strategy)
Definition: zlib.h:1797
static size_t png_setup_avg_row(png_structrp png_ptr, png_uint_32 bpp, size_t row_bytes, size_t lmins)
Definition: pngwutil.c:2383
else png_error(png_ptr, "png_image_write_to_memory: PNG too big")
#define png_hIST
Definition: pngpriv.h:860
#define png_debug1(l, m, p1)
Definition: pngdebug.h:148
#define png_oFFs
Definition: pngpriv.h:863
#define PNG_FLAG_ZSTREAM_INITIALIZED
Definition: pngpriv.h:680
size_t png_alloc_size_t
Definition: pngconf.h:557
static void png_write_compressed_data_out(png_structrp png_ptr, compression_state *comp)
Definition: pngwutil.c:637
static size_t png_setup_paeth_row(png_structrp png_ptr, png_uint_32 bpp, size_t row_bytes, size_t lmins)
Definition: pngwutil.c:2445
#define png_pHYs
Definition: pngpriv.h:865
static size_t png_setup_sub_row(png_structrp png_ptr, png_uint_32 bpp, size_t row_bytes, size_t lmins)
Definition: pngwutil.c:2279
#define PNG_ROWBYTES(pixel_bits, width)
Definition: pngpriv.h:738
png_byte output[1024]
Definition: pngwutil.c:474
size_t * png_size_tp
Definition: pngconf.h:593
#define png_sBIT
Definition: pngpriv.h:866
#define PNG_COLOR_MASK_COLOR
Definition: png.h:664
#define PNG_HAVE_PNG_SIGNATURE
Definition: pngpriv.h:636
static void png_write_complete_chunk(png_structrp png_ptr, png_uint_32 chunk_name, png_const_bytep data, size_t length)
Definition: pngwutil.c:175
void png_compress_IDAT(png_structrp png_ptr, png_const_bytep input, png_alloc_size_t input_len, int flush)
Definition: pngwutil.c:931
#define PNG_CSTRING_FROM_CHUNK(s, c)
Definition: pngpriv.h:893
int ZEXPORT deflate(z_streamp strm, int flush)
Definition: deflate.c:763
#define png_gAMA
Definition: pngpriv.h:856
void PNGAPI png_save_uint_32(png_bytep buf, png_uint_32 i)
Definition: pngwutil.c:24
int
Definition: createSpeedLookupTable.py:15
int ZEXPORT deflateReset(z_streamp strm)
Definition: deflate.c:505
#define PNG_sRGB_INTENT_LAST
Definition: png.h:719
#define png_pCAL
Definition: pngpriv.h:864
static const char * filters[]
Definition: screen_filebrowser.cpp:44
static void optimize_cmf(png_bytep data, png_alloc_size_t data_size)
Definition: pngwutil.c:250
void PNGAPI png_write_chunk_end(png_structrp png_ptr)
Definition: pngwutil.c:146
unsigned int uInt
Definition: zconf.h:393
#define png_tIME
Definition: pngpriv.h:872
#define PNG_RESOLUTION_LAST
Definition: png.h:712
void PNGAPI png_write_flush(png_structrp png_ptr)
Definition: pngwrite.c:920
size_t png_safecat(png_charp buffer, size_t bufsize, size_t pos, png_const_charp string)
Definition: pngerror.c:112
png_uint_32 length
Definition: png.c:2247
#define PNG_FILTER_SUB
Definition: png.h:1466
static void png_write_chunk_header(png_structrp png_ptr, png_uint_32 chunk_name, png_uint_32 length)
Definition: pngwutil.c:73
void png_app_warning(png_const_structrp png_ptr, png_const_charp error_message)
Definition: pngerror.c:392
size_t rowbytes
Definition: png.h:757
list b
Definition: createSpeedLookupTable.py:30
#define PNGZ_INPUT_CAST(b)
Definition: pngstruct.h:41
#define PNG_COLOR_TYPE_GRAY_ALPHA
Definition: png.h:672
static size_t png_setup_up_row(png_structrp png_ptr, size_t row_bytes, size_t lmins)
Definition: pngwutil.c:2340
void PNGAPI png_warning(png_const_structrp png_ptr, png_const_charp warning_message)
Definition: pngerror.c:216
#define png_bKGD
Definition: pngpriv.h:852
#define PNG_ALL_FILTERS
Definition: png.h:1471
#define PNG_COLOR_MASK_ALPHA
Definition: png.h:665
#define PNG_STRING_FROM_CHUNK(s, c)
Definition: pngpriv.h:886
#define PNG_Z_DEFAULT_NOFILTER_STRATEGY
Definition: pnglibconf.h:214
#define PNG_COLOR_TYPE_PALETTE
Definition: png.h:669
#define png_sRGB
Definition: pngpriv.h:869
static png_bytep size_t size
Definition: pngwrite.c:2170
#define PNG_IO_CHUNK_HDR
Definition: png.h:2426
static void png_setup_up_row_only(png_structrp png_ptr, size_t row_bytes)
Definition: pngwutil.c:2367