Lines Matching defs:data
139 // unsigned char *data = stbi_load(filename, &x, &y, &n, 0);
140 // // ... process data if not NULL ...
144 // stbi_image_free(data);
153 // to the pixel data, or NULL on an allocation failure or if the image is
154 // corrupt or invalid. The pixel data consists of *y scanlines of *x pixels,
251 // The three functions you must define are "read" (reads some bytes of data),
252 // "skip" (skips some bytes of data), "eof" (reports if the stream is at the end).
294 // float *data = stbi_loadf(filename, &x, &y, &n, 0);
304 // file for details) containing image data, you can query for the "most
321 // says there's premultiplied data (currently only happens in iPhone images,
362 // denial-of-service attacks on untrusted data, as one could generate a
411 int (*read) (void *user,char *data,int size); // fill 'data' with 'size' bytes. return number of bytes actually read
413 int (*eof) (void *user); // returns nonzero if we are at end of file/data
848 static int stbi__stdio_read(void *user, char *data, int size)
850 return (int) fread(data,1,size,(FILE*) user);
1105 static float *stbi__ldr_to_hdr(stbi_uc *data, int x, int y, int comp);
1109 static stbi_uc *stbi__hdr_to_ldr(float *data, int x, int y, int comp);
1460 unsigned char *data;
1470 data = stbi__load_and_postprocess_8bit(s, x, y, comp, req_comp);
1471 if (data)
1472 return stbi__ldr_to_hdr(data, *x, *y, req_comp ? req_comp : *comp);
1741 // assume data buffer is malloced, so malloc a new one and free that one
1753 static unsigned char *stbi__convert_format(unsigned char *data, int img_n, int req_comp, unsigned int x, unsigned int y)
1758 if (req_comp == img_n) return data;
1763 STBI_FREE(data);
1768 unsigned char *src = data + j * x * img_n ;
1788 default: STBI_ASSERT(0); STBI_FREE(data); STBI_FREE(good); return stbi__errpuc("unsupported", "Unsupported format conversion");
1793 STBI_FREE(data);
1810 static stbi__uint16 *stbi__convert_format16(stbi__uint16 *data, int img_n, int req_comp, unsigned int x, unsigned int y)
1815 if (req_comp == img_n) return data;
1820 STBI_FREE(data);
1825 stbi__uint16 *src = data + j * x * img_n ;
1845 default: STBI_ASSERT(0); STBI_FREE(data); STBI_FREE(good); return (stbi__uint16*) stbi__errpuc("unsupported", "Unsupported format conversion");
1850 STBI_FREE(data);
1856 static float *stbi__ldr_to_hdr(stbi_uc *data, int x, int y, int comp)
1860 if (!data) return NULL;
1862 if (output == NULL) { STBI_FREE(data); return stbi__errpf("outofmem", "Out of memory"); }
1867 output[i*comp + k] = (float) (pow(data[i*comp+k]/255.0f, stbi__l2h_gamma) * stbi__l2h_scale);
1872 output[i*comp + n] = data[i*comp + n]/255.0f;
1875 STBI_FREE(data);
1882 static stbi_uc *stbi__hdr_to_ldr(float *data, int x, int y, int comp)
1886 if (!data) return NULL;
1888 if (output == NULL) { STBI_FREE(data); return stbi__errpuc("outofmem", "Out of memory"); }
1893 float z = (float) pow(data[i*comp+k]*stbi__h2l_scale_i, stbi__h2l_gamma_i) * 255 + 0.5f;
1899 float z = data[i*comp+k] * 255 + 0.5f;
1905 STBI_FREE(data);
1970 stbi_uc *data;
1996 void (*idct_block_kernel)(stbi_uc *out, int out_stride, short data[64]);
2208 static int stbi__jpeg_decode_block(stbi__jpeg *j, short data[64], stbi__huffman *hdc, stbi__huffman *hac, stbi__int16 *fac, int b, stbi__uint16 *dequant)
2218 memset(data,0,64*sizeof(data[0]));
2225 data[0] = (short) (dc * dequant[0]);
2243 data[zig] = (short) ((r >> 8) * dequant[zig]);
2256 data[zig] = (short) (stbi__extend_receive(j,s) * dequant[zig]);
2263 static int stbi__jpeg_decode_block_prog_dc(stbi__jpeg *j, short data[64], stbi__huffman *hdc, int b)
2273 memset(data,0,64*sizeof(data[0])); // 0 all the ac values now
2282 data[0] = (short) (dc * (1 << j->succ_low));
2286 data[0] += (short) (1 << j->succ_low);
2293 static int stbi__jpeg_decode_block_prog_ac(stbi__jpeg *j, short data[64], stbi__huffman *hac, stbi__int16 *fac)
2320 data[zig] = (short) ((r >> 8) * (1 << shift));
2338 data[zig] = (short) (stbi__extend_receive(j,s) * (1 << shift));
2350 short *p = &data[stbi__jpeg_dezigzag[k]];
2390 short *p = &data[stbi__jpeg_dezigzag[k++]];
2465 static void stbi__idct_block(stbi_uc *out, int out_stride, short data[64])
2469 short *d = data;
2528 static void stbi__idct_simd(stbi_uc *out, int out_stride, short data[64])
2627 row0 = _mm_load_si128((const __m128i *) (data + 0*8));
2628 row1 = _mm_load_si128((const __m128i *) (data + 1*8));
2629 row2 = _mm_load_si128((const __m128i *) (data + 2*8));
2630 row3 = _mm_load_si128((const __m128i *) (data + 3*8));
2631 row4 = _mm_load_si128((const __m128i *) (data + 4*8));
2632 row5 = _mm_load_si128((const __m128i *) (data + 5*8));
2633 row6 = _mm_load_si128((const __m128i *) (data + 6*8));
2634 row7 = _mm_load_si128((const __m128i *) (data + 7*8));
2709 static void stbi__idct_simd(stbi_uc *out, int out_stride, short data[64])
2798 row0 = vld1q_s16(data + 0*8);
2799 row1 = vld1q_s16(data + 1*8);
2800 row2 = vld1q_s16(data + 2*8);
2801 row3 = vld1q_s16(data + 3*8);
2802 row4 = vld1q_s16(data + 4*8);
2803 row5 = vld1q_s16(data + 5*8);
2804 row6 = vld1q_s16(data + 6*8);
2805 row7 = vld1q_s16(data + 7*8);
2953 STBI_SIMD_ALIGN(short, data[64]);
2955 // non-interleaved data, we just need to process one block at a time,
2964 if (!stbi__jpeg_decode_block(z, data, z->huff_dc+z->img_comp[n].hd, z->huff_ac+ha, z->fast_ac[ha], n, z->dequant[z->img_comp[n].tq])) return 0;
2965 z->idct_block_kernel(z->img_comp[n].data+z->img_comp[n].w2*j*8+i*8, z->img_comp[n].w2, data);
2966 // every data block is an MCU, so countdown the restart interval
2969 // if it's NOT a restart, then just bail, so we get corrupt data
2970 // rather than no data
2979 STBI_SIMD_ALIGN(short, data[64]);
2992 if (!stbi__jpeg_decode_block(z, data, z->huff_dc+z->img_comp[n].hd, z->huff_ac+ha, z->fast_ac[ha], n, z->dequant[z->img_comp[n].tq])) return 0;
2993 z->idct_block_kernel(z->img_comp[n].data+z->img_comp[n].w2*y2+x2, z->img_comp[n].w2, data);
3012 // non-interleaved data, we just need to process one block at a time,
3020 short *data = z->img_comp[n].coeff + 64 * (i + j * z->img_comp[n].coeff_w);
3022 if (!stbi__jpeg_decode_block_prog_dc(z, data, &z->huff_dc[z->img_comp[n].hd], n))
3026 if (!stbi__jpeg_decode_block_prog_ac(z, data, &z->huff_ac[ha], z->fast_ac[ha]))
3029 // every data block is an MCU, so countdown the restart interval
3051 short *data = z->img_comp[n].coeff + 64 * (x2 + y2 * z->img_comp[n].coeff_w);
3052 if (!stbi__jpeg_decode_block_prog_dc(z, data, &z->huff_dc[z->img_comp[n].hd], n))
3071 static void stbi__jpeg_dequantize(short *data, stbi__uint16 *dequant)
3075 data[i] *= dequant[i];
3081 // dequantize and idct the data
3088 short *data = z->img_comp[n].coeff + 64 * (i + j * z->img_comp[n].coeff_w);
3089 stbi__jpeg_dequantize(data, z->dequant[z->img_comp[n].tq]);
3090 z->idct_block_kernel(z->img_comp[n].data+z->img_comp[n].w2*j*8+i*8, z->img_comp[n].w2, data);
3247 z->img_comp[i].data = NULL;
3276 z->img_comp[i].data = NULL;
3324 // the bogus oversized data from using interleaved MCUs and their
3326 // discard the extra data until colorspace conversion
3339 z->img_comp[i].data = (stbi_uc*) (((size_t) z->img_comp[i].raw_data + 15) & ~15);
3910 r->line0 = r->line1 = z->img_comp[k].data;
4233 if (b >= STBI__ZNSYMS) return -1; // some data was corrupt somewhere!
4245 return -1; /* report error for unexpected end of data. */
4314 if (z >= 286) return stbi__err("bad huffman code","Corrupt PNG"); // per DEFLATE, length codes 286 and 287 must not appear in compressed data
4319 if (z < 0 || z >= 30) return stbi__err("bad huffman code","Corrupt PNG"); // per DEFLATE, distance codes 30 and 31 must not appear in compressed data
4394 // drain the bit-packed data into header
4579 // - avoids problem of streaming data between subsystems
4649 // create the png data from post-deflated data
4672 // but issue #276 reported a PNG in the wild that had extra data at the end (all zeros),
4782 // png guarante byte alignment, if width is not multiple of 8/4/2 we'll decode dummy trailing data that will be skipped in the later loop
4785 // note that the final byte might overshoot and write more data than desired.
4786 // we can allocate enough data that this never writes out of memory, but it
4787 // could also overwrite the next scanline. can it overwrite non-empty data
4847 // force the image data from big-endian to platform-native.
4849 // on the data being untouched, but could probably be done
5203 // initial guess for decoded data size to avoid unnecessary reallocs
5354 stbi__get32le(s); // discard data offset
5520 stbi__get32le(s); // discard offset of profile data
5521 stbi__get32le(s); // discard size of profile data
5565 // the header ends or implies a large amount of extra data, reject the file as malformed
5859 // Note that this saves the data in RGB(A) order, so it doesn't need to be swapped later
5888 // image data
5929 // skip to the data's starting position (offset usually = 0)
5947 // any data to skip? (offset usually = 0)
5968 // load the data
5992 // load however much data we did have
6009 // read in the data raw
6018 // copy data
6049 // swap RGB - if the source data was RGB16, it already is in the right order
6099 if (len > nleft) return 0; // corrupt data
6111 if (len > nleft) return 0; // corrupt data
6182 // Skip the reserved data.
6185 // Find out if the data is compressed.
6208 // Initialize the data to zero.
6211 // Finally, the image data.
6221 // The RLE-compressed data is preceded by a 2-byte data count for each row in the data,
6225 // Read the RLE data by channel.
6231 // Fill this channel with default data.
6235 // Read the RLE data.
6238 return stbi__errpuc("corrupt", "bad RLE data");
6244 // We're at the raw image data. It's each channel in order (Red, Green, Blue, Alpha, ...)
6247 // Read the data by channel.
6250 // Fill this channel with default data.
6394 // this will (should...) cater for even some bizarre stuff like having data
7194 if (strncmp(token, "-Y ", 3)) return stbi__errpf("unsupported data layout", "Unsupported HDR format");
7198 if (strncmp(token, "+X ", 3)) return stbi__errpf("unsupported data layout", "Unsupported HDR format");
7214 // Read data
7219 // Load image data
7220 // image data is stored as some number of sca
7222 // Read flat data
7232 // Read RLE-encoded data
7240 // not run-length encoded, so we have to actually use THIS data as a decoded
7273 if ((count == 0) || (count > nleft)) { STBI_FREE(hdr_data); STBI_FREE(scanline); return stbi__errpf("corrupt", "bad RLE data in HDR"); }
7278 if ((count == 0) || (count > nleft)) { STBI_FREE(hdr_data); STBI_FREE(scanline); return stbi__errpf("corrupt", "bad RLE data in HDR"); }
7495 // Does not support ASCII image data (formats P2 and P3)