From 16d5eb14bb29fb726cc37acf71c4602757cdcb36 Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Wed, 16 Nov 2011 11:52:36 +0000 Subject: [PATCH] ok - longstanding issue. quality of jpeg encode and decode dropped quickly when uf your-encoded anything due to using IFAST decoder (and encoder). this does drop speed for decode and encode (except encoding < 60% quality where it now uses IFAST), but we don't see progressively worse artifacts. SVN revision: 65293 --- legacy/evas/ChangeLog | 7 ++++++- legacy/evas/NEWS | 1 + .../src/modules/loaders/jpeg/evas_image_load_jpeg.c | 4 ++-- .../src/modules/savers/jpeg/evas_image_save_jpeg.c | 12 ++++++++++++ 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/legacy/evas/ChangeLog b/legacy/evas/ChangeLog index a016be1ffb..3bc5521bb0 100644 --- a/legacy/evas/ChangeLog +++ b/legacy/evas/ChangeLog @@ -496,6 +496,11 @@ * Add evas_object_freeze_events_set/get to discard the object events. they will be useful some cases such as transition. -2011-11-02 Nicolas Aguirre +2011-11-02 Nicolas Aguirre * Add gl_cocoa engine +2011-11-16 Carsten Haitzler (The Rasterman) + + * JPEG encode and decode in eet now uses ISLOW (not IFAST) due to + noticable quality losses in the chase for speed. It will use + IFAST for quality less than 60 when encoding diff --git a/legacy/evas/NEWS b/legacy/evas/NEWS index 5619d52c1e..9b02a71e3a 100644 --- a/legacy/evas/NEWS +++ b/legacy/evas/NEWS @@ -102,6 +102,7 @@ Improvements: * text to display missing unicode char instead of missing glyphs * internal file code to use eina_file more * jpeg loader to use eina_file + * jpeg encode and decode quality improved at expense of speed Removals: diff --git a/legacy/evas/src/modules/loaders/jpeg/evas_image_load_jpeg.c b/legacy/evas/src/modules/loaders/jpeg/evas_image_load_jpeg.c index 98de80316e..0dbababd69 100644 --- a/legacy/evas/src/modules/loaders/jpeg/evas_image_load_jpeg.c +++ b/legacy/evas/src/modules/loaders/jpeg/evas_image_load_jpeg.c @@ -284,7 +284,7 @@ evas_image_load_file_head_jpeg_internal(Image_Entry *ie, jpeg_read_header(&cinfo, TRUE); cinfo.do_fancy_upsampling = FALSE; cinfo.do_block_smoothing = FALSE; - cinfo.dct_method = JDCT_IFAST; + cinfo.dct_method = JDCT_ISLOW; // JDCT_FLOAT JDCT_IFAST(quality loss) cinfo.dither_mode = JDITHER_ORDERED; jpeg_start_decompress(&cinfo); @@ -545,7 +545,7 @@ evas_image_load_file_data_jpeg_internal(Image_Entry *ie, jpeg_read_header(&cinfo, TRUE); cinfo.do_fancy_upsampling = FALSE; cinfo.do_block_smoothing = FALSE; - cinfo.dct_method = JDCT_IFAST; + cinfo.dct_method = JDCT_ISLOW; // JDCT_FLOAT JDCT_IFAST(quality loss) cinfo.dither_mode = JDITHER_ORDERED; if (ie->scale > 1) diff --git a/legacy/evas/src/modules/savers/jpeg/evas_image_save_jpeg.c b/legacy/evas/src/modules/savers/jpeg/evas_image_save_jpeg.c index 27d48e2831..247f0af2a2 100644 --- a/legacy/evas/src/modules/savers/jpeg/evas_image_save_jpeg.c +++ b/legacy/evas/src/modules/savers/jpeg/evas_image_save_jpeg.c @@ -84,8 +84,20 @@ save_image_jpeg(RGBA_Image *im, const char *file, int quality) cinfo.image_height = im->cache_entry.h; cinfo.input_components = 3; cinfo.in_color_space = JCS_RGB; + cinfo.optimize_coding = FALSE; + cinfo.dct_method = JDCT_ISLOW; // JDCT_FLOAT JDCT_IFAST(quality loss) + if (quality < 60) cinfo.dct_method = JDCT_IFAST; jpeg_set_defaults(&cinfo); jpeg_set_quality(&cinfo, quality, TRUE); + if (quality >= 90) + { + cinfo.comp_info[0].h_samp_factor = 1; + cinfo.comp_info[0].v_samp_factor = 1; + cinfo.comp_info[1].h_samp_factor = 1; + cinfo.comp_info[1].v_samp_factor = 1; + cinfo.comp_info[2].h_samp_factor = 1; + cinfo.comp_info[2].v_samp_factor = 1; + } jpeg_start_compress(&cinfo, TRUE); ptr = im->image.data; while (cinfo.next_scanline < cinfo.image_height)