14 #include "evas_common.h"
15 #include "evas_private.h"
18 typedef struct _JPEG_error_mgr *emptr;
19 struct _JPEG_error_mgr
21 struct jpeg_error_mgr pub;
22 jmp_buf setjmp_buffer;
25 static void _JPEGFatalErrorHandler(j_common_ptr cinfo);
26 static void _JPEGErrorHandler(j_common_ptr cinfo);
27 static void _JPEGErrorHandler2(j_common_ptr cinfo, int msg_level);
29 static Eina_Bool evas_image_load_file_head_jpeg_internal(Image_Entry *ie,
32 int *error) EINA_ARG_NONNULL(1, 2, 3);
33 static Eina_Bool evas_image_load_file_data_jpeg_internal(Image_Entry *ie,
36 int *error) EINA_ARG_NONNULL(1, 2, 3);
37 #if 0 /* not used at the moment */
38 static int evas_image_load_file_data_jpeg_alpha_internal(Image_Entry *ie, FILE *f) EINA_ARG_NONNULL(1, 2);
41 static Eina_Bool evas_image_load_file_head_jpeg(Image_Entry *ie, const char *file, const char *key, int *error) EINA_ARG_NONNULL(1, 2, 4);
42 static Eina_Bool evas_image_load_file_data_jpeg(Image_Entry *ie, const char *file, const char *key, int *error) EINA_ARG_NONNULL(1, 2, 4);
44 static Evas_Image_Load_Func evas_image_load_jpeg_func =
47 evas_image_load_file_head_jpeg,
48 evas_image_load_file_data_jpeg
53 _JPEGFatalErrorHandler(j_common_ptr cinfo)
57 errmgr = (emptr) cinfo->err;
58 /* cinfo->err->output_message(cinfo);*/
59 longjmp(errmgr->setjmp_buffer, 1);
64 _JPEGErrorHandler(j_common_ptr cinfo __UNUSED__)
68 /* errmgr = (emptr) cinfo->err; */
69 /* cinfo->err->output_message(cinfo);*/
70 /* longjmp(errmgr->setjmp_buffer, 1);*/
75 _JPEGErrorHandler2(j_common_ptr cinfo __UNUSED__, int msg_level __UNUSED__)
79 /* errmgr = (emptr) cinfo->err; */
80 /* cinfo->err->output_message(cinfo);*/
81 /* longjmp(errmgr->setjmp_buffer, 1);*/
85 struct jpeg_membuf_src
87 struct jpeg_source_mgr pub;
89 const unsigned char *buf;
91 struct jpeg_membuf_src *self;
95 _evas_jpeg_membuf_src_init(j_decompress_ptr cinfo __UNUSED__)
100 _evas_jpeg_membuf_src_fill(j_decompress_ptr cinfo)
102 static const JOCTET jpeg_eoi[2] = { 0xFF, JPEG_EOI };
103 struct jpeg_membuf_src *src = (struct jpeg_membuf_src *)cinfo->src;
105 src->pub.bytes_in_buffer = sizeof(jpeg_eoi);
106 src->pub.next_input_byte = jpeg_eoi;
112 _evas_jpeg_membuf_src_skip(j_decompress_ptr cinfo,
115 struct jpeg_membuf_src *src = (struct jpeg_membuf_src *)cinfo->src;
118 rec = src->pub.bytes_in_buffer - num_bytes;
122 (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo));
126 src->pub.bytes_in_buffer -= num_bytes;
127 src->pub.next_input_byte += num_bytes;
132 _evas_jpeg_membuf_src_term(j_decompress_ptr cinfo)
134 struct jpeg_membuf_src *src = ((struct jpeg_membuf_src *)cinfo->src)->self;
141 _evas_jpeg_membuf_src(j_decompress_ptr cinfo,
142 void *map, size_t length)
144 struct jpeg_membuf_src *src;
146 src = calloc(1, sizeof(*src));
152 cinfo->src = &src->pub;
155 src->pub.init_source = _evas_jpeg_membuf_src_init;
156 src->pub.fill_input_buffer = _evas_jpeg_membuf_src_fill;
157 src->pub.skip_input_data = _evas_jpeg_membuf_src_skip;
158 src->pub.resync_to_restart = jpeg_resync_to_restart;
159 src->pub.term_source = _evas_jpeg_membuf_src_term;
160 src->pub.bytes_in_buffer = src->len;
161 src->pub.next_input_byte = src->buf;
167 evas_image_load_file_head_jpeg_internal(Image_Entry *ie,
168 void *map, size_t length,
171 unsigned int w, h, scalew, scaleh;
172 struct jpeg_decompress_struct cinfo;
173 struct _JPEG_error_mgr jerr;
175 cinfo.err = jpeg_std_error(&(jerr.pub));
176 jerr.pub.error_exit = _JPEGFatalErrorHandler;
177 jerr.pub.emit_message = _JPEGErrorHandler2;
178 jerr.pub.output_message = _JPEGErrorHandler;
179 if (setjmp(jerr.setjmp_buffer))
181 jpeg_destroy_decompress(&cinfo);
182 if (cinfo.saw_JFIF_marker)
183 *error = EVAS_LOAD_ERROR_CORRUPT_FILE;
185 *error = EVAS_LOAD_ERROR_UNKNOWN_FORMAT;
188 jpeg_create_decompress(&cinfo);
190 if (_evas_jpeg_membuf_src(&cinfo, map, length))
192 jpeg_destroy_decompress(&cinfo);
193 *error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
197 jpeg_read_header(&cinfo, TRUE);
198 cinfo.do_fancy_upsampling = FALSE;
199 cinfo.do_block_smoothing = FALSE;
200 cinfo.dct_method = JDCT_IFAST;
201 cinfo.dither_mode = JDITHER_ORDERED;
202 jpeg_start_decompress(&cinfo);
205 w = cinfo.output_width;
206 h = cinfo.output_height;
207 if ((w < 1) || (h < 1) || (w > IMG_MAX_SIZE) || (h > IMG_MAX_SIZE) ||
210 jpeg_destroy_decompress(&cinfo);
211 if (IMG_TOO_BIG(w, h))
212 *error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
214 *error = EVAS_LOAD_ERROR_GENERIC;
217 if (ie->load_opts.scale_down_by > 1)
219 w /= ie->load_opts.scale_down_by;
220 h /= ie->load_opts.scale_down_by;
222 else if (ie->load_opts.dpi > 0.0)
224 w = (w * ie->load_opts.dpi) / 90.0;
225 h = (h * ie->load_opts.dpi) / 90.0;
227 else if ((ie->load_opts.w > 0) && (ie->load_opts.h > 0))
229 unsigned int w2 = w, h2 = h;
230 if (ie->load_opts.w > 0)
232 w2 = ie->load_opts.w;
233 h2 = (ie->load_opts.w * h) / w;
234 if ((ie->load_opts.h > 0) && (h2 > ie->load_opts.h))
237 h2 = ie->load_opts.h;
238 w3 = (ie->load_opts.h * w) / h;
243 else if (ie->load_opts.h > 0)
245 h2 = ie->load_opts.h;
246 w2 = (ie->load_opts.h * w) / h;
254 if ((w != cinfo.output_width) || (h != cinfo.output_height))
256 scalew = cinfo.output_width / w;
257 scaleh = cinfo.output_height / h;
260 if (scaleh < scalew) ie->scale = scaleh;
262 if (ie->scale > 8) ie->scale = 8;
263 else if (ie->scale < 1) ie->scale = 1;
265 if (ie->scale == 3) ie->scale = 2;
266 else if (ie->scale == 5) ie->scale = 4;
267 else if (ie->scale == 6) ie->scale = 4;
268 else if (ie->scale == 7) ie->scale = 4;
273 jpeg_destroy_decompress(&cinfo);
274 jpeg_create_decompress(&cinfo);
276 if (_evas_jpeg_membuf_src(&cinfo, map, length))
278 jpeg_destroy_decompress(&cinfo);
279 *error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
283 jpeg_read_header(&cinfo, TRUE);
284 cinfo.do_fancy_upsampling = FALSE;
285 cinfo.do_block_smoothing = FALSE;
287 cinfo.scale_denom = ie->scale;
288 jpeg_calc_output_dimensions(&(cinfo));
289 jpeg_start_decompress(&cinfo);
292 ie->w = cinfo.output_width;
293 ie->h = cinfo.output_height;
295 // be nice and clip region to image. if its totally outside, fail load
296 if ((ie->load_opts.region.w > 0) && (ie->load_opts.region.h > 0))
298 RECTS_CLIP_TO_RECT(ie->load_opts.region.x, ie->load_opts.region.y,
299 ie->load_opts.region.w, ie->load_opts.region.h,
301 if ((ie->load_opts.region.w <= 0) || (ie->load_opts.region.h <= 0))
303 jpeg_destroy_decompress(&cinfo);
304 *error = EVAS_LOAD_ERROR_GENERIC;
307 ie->w = ie->load_opts.region.w;
308 ie->h = ie->load_opts.region.h;
310 /* end head decoding */
312 jpeg_destroy_decompress(&cinfo);
313 *error = EVAS_LOAD_ERROR_NONE;
321 struct timeval timev;
323 gettimeofday(&timev, NULL);
324 return (double)timev.tv_sec + (((double)timev.tv_usec) / 1000000);
329 evas_image_load_file_data_jpeg_internal(Image_Entry *ie,
330 void *map, size_t size,
334 struct jpeg_decompress_struct cinfo;
335 struct _JPEG_error_mgr jerr;
336 DATA8 *ptr, *line[16], *data;
338 unsigned int x, y, l, i, scans;
341 cinfo.err = jpeg_std_error(&(jerr.pub));
342 jerr.pub.error_exit = _JPEGFatalErrorHandler;
343 jerr.pub.emit_message = _JPEGErrorHandler2;
344 jerr.pub.output_message = _JPEGErrorHandler;
345 if (setjmp(jerr.setjmp_buffer))
347 jpeg_destroy_decompress(&cinfo);
348 *error = EVAS_LOAD_ERROR_CORRUPT_FILE;
351 jpeg_create_decompress(&cinfo);
353 if (_evas_jpeg_membuf_src(&cinfo, map, size))
355 jpeg_destroy_decompress(&cinfo);
356 *error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
360 jpeg_read_header(&cinfo, TRUE);
361 cinfo.do_fancy_upsampling = FALSE;
362 cinfo.do_block_smoothing = FALSE;
363 cinfo.dct_method = JDCT_IFAST;
364 cinfo.dither_mode = JDITHER_ORDERED;
369 cinfo.scale_denom = ie->scale;
372 /* Colorspace conversion options */
373 /* libjpeg can do the following conversions: */
374 /* GRAYSCLAE => RGB YCbCr => RGB and YCCK => CMYK */
375 switch (cinfo.jpeg_color_space)
382 cinfo.out_color_space = JCS_RGB;
386 cinfo.out_color_space = JCS_CMYK;
391 jpeg_calc_output_dimensions(&(cinfo));
392 jpeg_start_decompress(&cinfo);
394 w = cinfo.output_width;
395 h = cinfo.output_height;
397 if ((ie->load_opts.region.w > 0) && (ie->load_opts.region.h > 0))
400 #ifdef BUILD_LOADER_JPEG_REGION
401 cinfo.region_x = ie->load_opts.region.x;
402 cinfo.region_y = ie->load_opts.region.y;
403 cinfo.region_w = ie->load_opts.region.w;
404 cinfo.region_h = ie->load_opts.region.h;
407 if ((!region) && ((w != ie->w) || (h != ie->h)))
409 // race condition, the file could have change from when we call header
410 // this test will not solve the problem with region code.
411 jpeg_destroy_decompress(&cinfo);
412 *error = EVAS_LOAD_ERROR_GENERIC;
416 ((ie->w != ie->load_opts.region.w) || (ie->h != ie->load_opts.region.h)))
418 ie->w = ie->load_opts.region.w;
419 ie->h = ie->load_opts.region.h;
422 if (!(((cinfo.out_color_space == JCS_RGB) &&
423 ((cinfo.output_components == 3) || (cinfo.output_components == 1))) ||
424 ((cinfo.out_color_space == JCS_CMYK) && (cinfo.output_components == 4))))
426 jpeg_destroy_decompress(&cinfo);
427 *error = EVAS_LOAD_ERROR_UNKNOWN_FORMAT;
431 /* end head decoding */
433 if (cinfo.rec_outbuf_height > 16)
435 jpeg_destroy_decompress(&cinfo);
436 *error = EVAS_LOAD_ERROR_UNKNOWN_FORMAT;
439 data = alloca(w * 16 * cinfo.output_components);
440 evas_cache_image_surface_alloc(ie, ie->w, ie->h);
441 if (ie->flags.loaded)
443 jpeg_destroy_decompress(&cinfo);
444 *error = EVAS_LOAD_ERROR_NONE;
447 ptr2 = evas_cache_image_pixels(ie);
450 *error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
454 /* We handle first CMYK (4 components) */
455 if (cinfo.output_components == 4)
457 // FIXME: handle region
458 for (i = 0; (int)i < cinfo.rec_outbuf_height; i++)
459 line[i] = data + (i * w * 4);
460 for (l = 0; l < h; l += cinfo.rec_outbuf_height)
462 jpeg_read_scanlines(&cinfo, line, cinfo.rec_outbuf_height);
463 scans = cinfo.rec_outbuf_height;
464 if ((h - l) < scans) scans = h - l;
468 for (y = 0; y < scans; y++)
470 if (cinfo.saw_Adobe_marker)
472 for (x = 0; x < w; x++)
474 /* According to libjpeg doc, Photoshop inverse the values of C, M, Y and K, */
475 /* that is C is replaces by 255 - C, etc...*/
476 /* See the comment below for the computation of RGB values from CMYK ones. */
479 ((ptr[0] * ptr[3] / 255) << 16) |
480 ((ptr[1] * ptr[3] / 255) << 8) |
481 ((ptr[2] * ptr[3] / 255));
488 for (x = 0; x < w; x++)
490 /* Conversion from CMYK to RGB is done in 2 steps: */
491 /* CMYK => CMY => RGB (see http://www.easyrgb.com/index.php?X=MATH) */
492 /* after computation, if C, M, Y and K are between 0 and 1, we have: */
493 /* R = (1 - C) * (1 - K) * 255 */
494 /* G = (1 - M) * (1 - K) * 255 */
495 /* B = (1 - Y) * (1 - K) * 255 */
496 /* libjpeg stores CMYK values between 0 and 255, */
497 /* so we replace C by C * 255 / 255, etc... and we obtain: */
498 /* R = (255 - C) * (255 - K) / 255 */
499 /* G = (255 - M) * (255 - K) / 255 */
500 /* B = (255 - Y) * (255 - K) / 255 */
501 /* with C, M, Y and K between 0 and 255. */
504 (((255 - ptr[0]) * (255 - ptr[3]) / 255) << 16) |
505 (((255 - ptr[1]) * (255 - ptr[3]) / 255) << 8) |
506 (((255 - ptr[2]) * (255 - ptr[3]) / 255));
515 // if line # > region last line, break
516 if (l >= (ie->load_opts.region.y + ie->load_opts.region.h))
518 jpeg_destroy_decompress(&cinfo);
519 *error = EVAS_LOAD_ERROR_NONE;
522 // els if scan block intersects region start or later
523 else if ((l + scans) >
524 (ie->load_opts.region.y))
526 for (y = 0; y < scans; y++)
528 if (((y + l) >= ie->load_opts.region.y) &&
529 ((y + l) < (ie->load_opts.region.y + ie->load_opts.region.h)))
531 ptr += ie->load_opts.region.x;
532 if (cinfo.saw_Adobe_marker)
534 for (x = 0; x < ie->load_opts.region.w; x++)
536 /* According to libjpeg doc, Photoshop inverse the values of C, M, Y and K, */
537 /* that is C is replaces by 255 - C, etc...*/
538 /* See the comment below for the computation of RGB values from CMYK ones. */
541 ((ptr[0] * ptr[3] / 255) << 16) |
542 ((ptr[1] * ptr[3] / 255) << 8) |
543 ((ptr[2] * ptr[3] / 255));
550 for (x = 0; x < ie->load_opts.region.w; x++)
552 /* Conversion from CMYK to RGB is done in 2 steps: */
553 /* CMYK => CMY => RGB (see http://www.easyrgb.com/index.php?X=MATH) */
554 /* after computation, if C, M, Y and K are between 0 and 1, we have: */
555 /* R = (1 - C) * (1 - K) * 255 */
556 /* G = (1 - M) * (1 - K) * 255 */
557 /* B = (1 - Y) * (1 - K) * 255 */
558 /* libjpeg stores CMYK values between 0 and 255, */
559 /* so we replace C by C * 255 / 255, etc... and we obtain: */
560 /* R = (255 - C) * (255 - K) / 255 */
561 /* G = (255 - M) * (255 - K) / 255 */
562 /* B = (255 - Y) * (255 - K) / 255 */
563 /* with C, M, Y and K between 0 and 255. */
566 (((255 - ptr[0]) * (255 - ptr[3]) / 255) << 16) |
567 (((255 - ptr[1]) * (255 - ptr[3]) / 255) << 8) |
568 (((255 - ptr[2]) * (255 - ptr[3]) / 255));
573 ptr += (4 * (w - (ie->load_opts.region.x + ie->load_opts.region.w)));
582 /* We handle then RGB with 3 components */
583 else if (cinfo.output_components == 3)
590 printf("R| %p %5ix%5i %s: %5i %5i %5ix%5i - ",
594 ie->load_opts.region.x,
595 ie->load_opts.region.y,
596 ie->load_opts.region.w,
597 ie->load_opts.region.h);
601 for (i = 0; (int)i < cinfo.rec_outbuf_height; i++)
602 line[i] = data + (i * w * 3);
603 for (l = 0; l < h; l += cinfo.rec_outbuf_height)
605 jpeg_read_scanlines(&cinfo, line, cinfo.rec_outbuf_height);
606 scans = cinfo.rec_outbuf_height;
607 if ((h - l) < scans) scans = h - l;
611 for (y = 0; y < scans; y++)
613 for (x = 0; x < w; x++)
615 *ptr2 = ARGB_JOIN(0xff, ptr[0], ptr[1], ptr[2]);
623 // if line # > region last line, break
624 if (l >= (ie->load_opts.region.y + ie->load_opts.region.h))
626 jpeg_destroy_decompress(&cinfo);
629 printf("%3.3f\n", t);
631 *error = EVAS_LOAD_ERROR_NONE;
634 // else if scan block intersects region start or later
635 else if ((l + scans) >
636 (ie->load_opts.region.y))
638 for (y = 0; y < scans; y++)
640 if (((y + l) >= ie->load_opts.region.y) &&
641 ((y + l) < (ie->load_opts.region.y + ie->load_opts.region.h)))
643 ptr += (3 * ie->load_opts.region.x);
644 for (x = 0; x < ie->load_opts.region.w; x++)
646 *ptr2 = ARGB_JOIN(0xff, ptr[0], ptr[1], ptr[2]);
650 ptr += (3 * (w - (ie->load_opts.region.x + ie->load_opts.region.w)));
660 printf("%3.3f\n", t);
663 /* We finally handle RGB with 1 component */
664 else if (cinfo.output_components == 1)
666 for (i = 0; (int)i < cinfo.rec_outbuf_height; i++)
667 line[i] = data + (i * w);
668 for (l = 0; l < h; l += cinfo.rec_outbuf_height)
670 jpeg_read_scanlines(&cinfo, line, cinfo.rec_outbuf_height);
671 scans = cinfo.rec_outbuf_height;
672 if ((h - l) < scans) scans = h - l;
676 for (y = 0; y < scans; y++)
678 for (x = 0; x < w; x++)
680 *ptr2 = ARGB_JOIN(0xff, ptr[0], ptr[0], ptr[0]);
688 // if line # > region last line, break
689 if (l >= (ie->load_opts.region.y + ie->load_opts.region.h))
691 jpeg_destroy_decompress(&cinfo);
692 *error = EVAS_LOAD_ERROR_NONE;
695 // els if scan block intersects region start or later
696 else if ((l + scans) >
697 (ie->load_opts.region.y))
699 for (y = 0; y < scans; y++)
701 if (((y + l) >= ie->load_opts.region.y) &&
702 ((y + l) < (ie->load_opts.region.y + ie->load_opts.region.h)))
704 ptr += ie->load_opts.region.x;
705 for (x = 0; x < ie->load_opts.region.w; x++)
707 *ptr2 = ARGB_JOIN(0xff, ptr[0], ptr[0], ptr[0]);
711 ptr += w - (ie->load_opts.region.x + ie->load_opts.region.w);
720 /* end data decoding */
721 jpeg_finish_decompress(&cinfo);
722 jpeg_destroy_decompress(&cinfo);
723 *error = EVAS_LOAD_ERROR_NONE;
727 #if 0 /* not used at the moment */
729 evas_image_load_file_data_jpeg_alpha_internal(Image_Entry *ie, FILE *f, int *error)
732 struct jpeg_decompress_struct cinfo;
733 struct _JPEG_error_mgr jerr;
734 DATA8 *ptr, *line[16], *data;
736 int x, y, l, i, scans, prevy;
740 *error = EVAS_LOAD_ERROR_DOES_NOT_EXIST;
743 cinfo.err = jpeg_std_error(&(jerr.pub));
744 jerr.pub.error_exit = _JPEGFatalErrorHandler;
745 jerr.pub.emit_message = _JPEGErrorHandler2;
746 jerr.pub.output_message = _JPEGErrorHandler;
747 if (setjmp(jerr.setjmp_buffer))
749 jpeg_destroy_decompress(&cinfo);
750 *error = EVAS_LOAD_ERROR_CORRUPT_FILE;
753 jpeg_create_decompress(&cinfo);
754 jpeg_stdio_src(&cinfo, f);
755 jpeg_read_header(&cinfo, TRUE);
756 cinfo.do_fancy_upsampling = FALSE;
757 cinfo.do_block_smoothing = FALSE;
758 jpeg_start_decompress(&cinfo);
761 ie->w = w = cinfo.output_width;
762 ie->h = h = cinfo.output_height;
763 /* end head decoding */
765 if (cinfo.rec_outbuf_height > 16)
767 jpeg_destroy_decompress(&cinfo);
768 *error = EVAS_LOAD_ERROR_UNKNOWN_FORMAT;
771 data = alloca(w * 16 * 3);
772 if (!ie->flags.loaded)
774 jpeg_destroy_decompress(&cinfo);
775 *error = EVAS_LOAD_ERROR_NONE;
778 ptr2 = evas_cache_image_pixels(ie);
780 if (cinfo.output_components == 3)
782 for (i = 0; i < cinfo.rec_outbuf_height; i++)
783 line[i] = data + (i * w * 3);
784 for (l = 0; l < h; l += cinfo.rec_outbuf_height)
786 jpeg_read_scanlines(&cinfo, line, cinfo.rec_outbuf_height);
787 scans = cinfo.rec_outbuf_height;
788 if ((h - l) < scans) scans = h - l;
790 for (y = 0; y < scans; y++)
792 for (x = 0; x < w; x++)
795 ((*ptr2) & 0x00ffffff) |
796 (((ptr[0] + ptr[1] + ptr[2]) / 3) << 24);
803 else if (cinfo.output_components == 1)
805 for (i = 0; i < cinfo.rec_outbuf_height; i++)
806 line[i] = data + (i * w);
807 for (l = 0; l < h; l += cinfo.rec_outbuf_height)
809 jpeg_read_scanlines(&cinfo, line, cinfo.rec_outbuf_height);
810 scans = cinfo.rec_outbuf_height;
811 if ((h - l) < scans) scans = h - l;
813 for (y = 0; y < scans; y++)
815 for (x = 0; x < w; x++)
818 ((*ptr2) & 0x00ffffff) |
826 /* end data decoding */
827 jpeg_finish_decompress(&cinfo);
828 jpeg_destroy_decompress(&cinfo);
829 *error = EVAS_LOAD_ERROR_NONE;
835 evas_image_load_file_head_jpeg(Image_Entry *ie,
836 const char *file, const char *key __UNUSED__,
841 Eina_Bool val = EINA_FALSE;
843 f = eina_file_open(file, EINA_FALSE);
846 *error = EVAS_LOAD_ERROR_DOES_NOT_EXIST;
849 map = eina_file_map_all(f, EINA_FILE_WILLNEED);
852 *error = EVAS_LOAD_ERROR_DOES_NOT_EXIST;
856 val = evas_image_load_file_head_jpeg_internal(ie,
857 map, eina_file_size_get(f),
860 eina_file_map_free(f, map);
868 evas_image_load_file_data_jpeg(Image_Entry *ie,
869 const char *file, const char *key __UNUSED__,
874 Eina_Bool val = EINA_FALSE;
876 f = eina_file_open(file, EINA_FALSE);
879 *error = EVAS_LOAD_ERROR_DOES_NOT_EXIST;
882 map = eina_file_map_all(f, EINA_FILE_WILLNEED);
885 *error = EVAS_LOAD_ERROR_DOES_NOT_EXIST;
889 val = evas_image_load_file_data_jpeg_internal(ie,
890 map, eina_file_size_get(f),
893 eina_file_map_free(f, map);
901 module_open(Evas_Module *em)
904 em->functions = (void *)(&evas_image_load_jpeg_func);
909 module_close(Evas_Module *em __UNUSED__)
913 static Evas_Module_Api evas_modapi =
915 EVAS_MODULE_API_VERSION,
924 EVAS_MODULE_DEFINE(EVAS_MODULE_TYPE_IMAGE_LOADER, image_loader, jpeg);
926 #ifndef EVAS_STATIC_BUILD_JPEG
927 EVAS_EINA_MODULE_DEFINE(image_loader, jpeg);