From d26481f24bd214a289434f187a742f1c680483cc Mon Sep 17 00:00:00 2001 From: mayeut Date: Wed, 27 Jan 2016 12:13:16 +0100 Subject: [PATCH] Fixes 1st image crash of #704 Prevents color_esycc_to_rgb to be applied when different subsampling are used. --- src/bin/common/color.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/bin/common/color.c b/src/bin/common/color.c index 0f2b8dac..4b0e6dc4 100644 --- a/src/bin/common/color.c +++ b/src/bin/common/color.c @@ -745,6 +745,19 @@ void color_esycc_to_rgb(opj_image_t *image) int max_value = (1 << image->comps[0].prec) - 1; if(image->numcomps < 3) return; + if((image->comps[0].dx == image->comps[1].dx) + && (image->comps[1].dx == image->comps[2].dx) + && (image->comps[0].dy == image->comps[1].dy) + && (image->comps[1].dy == image->comps[2].dy))/* same sub-sampling */ + { + // go on + } + else + { + fprintf(stderr,"%s:%d:color_esycc_to_rgb\n\tCAN NOT CONVERT\n", __FILE__,__LINE__); + return; + } + w = image->comps[0].w; h = image->comps[0].h;