summaryrefslogtreecommitdiff
path: root/applications/codec
diff options
context:
space:
mode:
authorMathieu Malaterre <mathieu.malaterre@gmail.com>2012-04-23 13:35:01 +0000
committerMathieu Malaterre <mathieu.malaterre@gmail.com>2012-04-23 13:35:01 +0000
commitce9d5083ef778a66a8acad7b8ae8d658a560b0d8 (patch)
treeac779ab3df8589bdb8ee58a517002cd2d6a1c259 /applications/codec
parentbaa7e32f9cd4bb8a627278768931dcc01f1518c6 (diff)
[1.5] Integrate patch from winfried posted on the mailing list. See here for more info: https://groups.google.com/group/openjpeg/msg/6488859a0dce77
Diffstat (limited to 'applications/codec')
-rw-r--r--applications/codec/convert.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/applications/codec/convert.c b/applications/codec/convert.c
index e715629a..8efaad6d 100644
--- a/applications/codec/convert.c
+++ b/applications/codec/convert.c
@@ -1011,7 +1011,7 @@ int imagetobmp(opj_image_t * image, const char *outfile) {
int adjustR, adjustG, adjustB;
if (image->comps[0].prec < 8) {
- fprintf(stderr, "Unsupported number of components: %d\n", image->comps[0].prec);
+ fprintf(stderr, "Unsupported precision: %d\n", image->comps[0].prec);
return 1;
}
if (image->numcomps >= 3 && image->comps[0].dx == image->comps[1].dx
@@ -2484,16 +2484,19 @@ opj_image_t* tiftoimage(const char *filename, opj_cparameters_t *parameters)
w= tiWidth;
h= tiHeight;
- if(tiBps != 8 && tiBps != 16 && tiBps != 12) tiBps = 0;
- if(tiPhoto != 1 && tiPhoto != 2) tiPhoto = 0;
-
- if( !tiBps || !tiPhoto)
{
- if( !tiBps)
+ unsigned short b = tiBps, p = tiPhoto;
+
+ if(tiBps != 8 && tiBps != 16 && tiBps != 12) b = 0;
+ if(tiPhoto != 1 && tiPhoto != 2) p = 0;
+
+ if( !b || !p)
+ {
+ if( !b)
fprintf(stderr,"imagetotif: Bits=%d, Only 8 and 16 bits"
" implemented\n",tiBps);
else
- if( !tiPhoto)
+ if( !p)
fprintf(stderr,"tiftoimage: Bad color format %d.\n\tOnly RGB(A)"
" and GRAY(A) has been implemented\n",(int) tiPhoto);
@@ -2501,8 +2504,8 @@ opj_image_t* tiftoimage(const char *filename, opj_cparameters_t *parameters)
TIFFClose(tif);
return NULL;
+ }
}
-
{/* From: tiff-4.0.x/libtiff/tif_getimage.c : */
uint16* sampleinfo;
uint16 extrasamples;