summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpierre lamot <pierre.lamot@openwide.fr>2015-01-20 15:39:08 +0100
committerCedric BAIL <cedric@osg.samsung.com>2015-02-05 16:38:06 +0100
commit17e73dca0560013ce00277c8cf399461b26442b9 (patch)
tree24788c55c03728844e748129cba995dd3b612c36
parent66c0f3261dab904fce533b0f7d30b1b374abd658 (diff)
evas: jpeg decoders alows a difference of 1 bit per component.
The required precision of decompressed images allows a difference of 1 bit for each pixel compoment [1] . Such difference has been noticed on OSX when using libjpeg9 from macports. evas_suite images tests has been modified to compare jpeg images with this tolerance. Other image formats are still compare with exact precision [1] http://en.wikipedia.org/wiki/JPEG#Required_precision Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
-rw-r--r--src/tests/evas/evas_test_image.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/tests/evas/evas_test_image.c b/src/tests/evas/evas_test_image.c
index ed339e6d14..cb3ff690e6 100644
--- a/src/tests/evas/evas_test_image.c
+++ b/src/tests/evas/evas_test_image.c
@@ -356,8 +356,9 @@ START_TEST(evas_object_image_all_loader_data)
356 for (i = 0; i < sizeof (exts) / sizeof (exts[0]); i++) 356 for (i = 0; i < sizeof (exts) / sizeof (exts[0]); i++)
357 { 357 {
358 struct stat st; 358 struct stat st;
359 int w, h, r_w, r_h; 359 int w, h, s, r_w, r_h, r_s;
360 const uint32_t *d, *r_d; 360 const uint32_t *d, *r_d;
361 Evas_Colorspace c, r_c;
361 362
362 eina_strbuf_reset(str); 363 eina_strbuf_reset(str);
363 364
@@ -368,6 +369,8 @@ START_TEST(evas_object_image_all_loader_data)
368 evas_object_image_file_set(obj, eina_strbuf_string_get(str), NULL); 369 evas_object_image_file_set(obj, eina_strbuf_string_get(str), NULL);
369 fail_if(evas_object_image_load_error_get(obj) != EVAS_LOAD_ERROR_NONE); 370 fail_if(evas_object_image_load_error_get(obj) != EVAS_LOAD_ERROR_NONE);
370 evas_object_image_size_get(obj, &w, &h); 371 evas_object_image_size_get(obj, &w, &h);
372 s = evas_object_image_stride_get(obj);
373 c = evas_object_image_colorspace_get(obj);
371 d = evas_object_image_data_get(obj, EINA_FALSE); 374 d = evas_object_image_data_get(obj, EINA_FALSE);
372 375
373 eina_strbuf_reset(str); 376 eina_strbuf_reset(str);
@@ -376,10 +379,26 @@ START_TEST(evas_object_image_all_loader_data)
376 evas_object_image_file_set(ref, eina_strbuf_string_get(str), NULL); 379 evas_object_image_file_set(ref, eina_strbuf_string_get(str), NULL);
377 fail_if(evas_object_image_load_error_get(ref) != EVAS_LOAD_ERROR_NONE); 380 fail_if(evas_object_image_load_error_get(ref) != EVAS_LOAD_ERROR_NONE);
378 evas_object_image_size_get(ref, &r_w, &r_h); 381 evas_object_image_size_get(ref, &r_w, &r_h);
382 r_s = evas_object_image_stride_get(ref);
383 r_c = evas_object_image_colorspace_get(ref);
379 r_d = evas_object_image_data_get(ref, EINA_FALSE); 384 r_d = evas_object_image_data_get(ref, EINA_FALSE);
380 385
381 fail_if(w != r_w || h != r_h); 386 fail_if(w != r_w || h != r_h);
382 fail_if(memcmp(d, r_d, w * h * 4)); 387 fail_if(s != r_s);
388 fail_if(c != r_c);
389 fail_if(w*4 != s);
390 if (strcmp(exts[i], "jpeg") == 0 || strcmp(exts[i], "jpg") == 0)
391 {
392 //jpeg norm allows a variation of 1 bit per component
393 for (int j = 0; j < s * h; j++)
394 {
395 fail_if(abs(((char*)d)[j] - ((char*)r_d)[j]) > 1);
396 }
397 }
398 else
399 {
400 fail_if(memcmp(d, r_d, w * h * 4));
401 }
383 } 402 }
384 403
385 evas_object_del(obj); 404 evas_object_del(obj);