39 FILE *
f = g_fopen(filename,
"rb");
46 fseek(
f, 0, SEEK_END);
47 size_t filesize = ftell(
f);
48 fseek(
f, 0, SEEK_SET);
50 void *read_buffer = g_malloc(filesize);
52 if(fread(read_buffer, 1, filesize,
f) != filesize)
62 if(!WebPGetInfo(read_buffer, filesize, &w, &h))
74 img->
dsc.
bpp = 4 *
sizeof(float);
77 img->
flags &= ~DT_IMAGE_RAW;
78 img->
flags &= ~DT_IMAGE_S_RAW;
79 img->
flags &= ~DT_IMAGE_HDR;
97 uint8_t *int_RGBA_buf = WebPDecodeRGBA(read_buffer, filesize, &w, &h);
108 for(
int i=0;
i < w*h*4;
i++)
110 intval = *(int_RGBA_buf+
i);
111 floatval = intval / 255.f;
112 *(mipbuf+
i) = floatval;
115 WebPFree(int_RGBA_buf);
117 wp_data.bytes = (uint8_t *)read_buffer;
118 wp_data.size = filesize;
119 mux = WebPMuxCreate(&wp_data, 0);
123 WebPMuxGetChunk(mux,
"ICCP", &icc_profile);
127 img->
profile = (uint8_t *)g_malloc0(icc_profile.size);
128 memcpy(img->
profile, icc_profile.bytes, icc_profile.size);
void dt_print(dt_debug_thread_t thread, const char *msg,...) __attribute__((format(printf
Print to stdout when thread is enabled, prefixed with seconds since startup.