summaryrefslogtreecommitdiff
path: root/applications/codec
diff options
context:
space:
mode:
authorMathieu Malaterre <mathieu.malaterre@gmail.com>2012-03-01 15:52:30 +0000
committerMathieu Malaterre <mathieu.malaterre@gmail.com>2012-03-01 15:52:30 +0000
commitb3b2ee0925aedfcbef45713b0b3a915206b216d4 (patch)
treebb9f938471591edf9a94859373e224cc39807b6f /applications/codec
parent58cfcaff9fbd4e02aaded5b5b06a9e573a7bc38e (diff)
[1.5] j2k_to_image does not support writing image with precision less than 8bits. Simply give up for now. Thanks to winfried for report. Also add static keyword for undeclared function in convert.h
Diffstat (limited to 'applications/codec')
-rw-r--r--applications/codec/convert.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/applications/codec/convert.c b/applications/codec/convert.c
index 73ed9d09..4189d83f 100644
--- a/applications/codec/convert.c
+++ b/applications/codec/convert.c
@@ -104,7 +104,7 @@ static unsigned short get_ushort(unsigned short val) {
#define TGA_HEADER_SIZE 18
-int tga_readheader(FILE *fp, unsigned int *bits_per_pixel,
+static int tga_readheader(FILE *fp, unsigned int *bits_per_pixel,
unsigned int *width, unsigned int *height, int *flip_image)
{
int palette_size;
@@ -179,7 +179,7 @@ int tga_readheader(FILE *fp, unsigned int *bits_per_pixel,
return 1;
}
-int tga_writeheader(FILE *fp, int bits_per_pixel, int width, int height,
+static int tga_writeheader(FILE *fp, int bits_per_pixel, int width, int height,
opj_bool flip_image)
{
unsigned short image_w, image_h, us0;
@@ -993,6 +993,10 @@ int imagetobmp(opj_image_t * image, const char *outfile) {
FILE *fdest = NULL;
int adjustR, adjustG, adjustB;
+ if (image->comps[0].prec < 8) {
+ fprintf(stderr, "Unsupported number of components: %d\n", image->comps[0].prec);
+ return 1;
+ }
if (image->numcomps == 3 && image->comps[0].dx == image->comps[1].dx
&& image->comps[1].dx == image->comps[2].dx
&& image->comps[0].dy == image->comps[1].dy
@@ -1181,7 +1185,7 @@ PGX IMAGE FORMAT
<<-- <<-- <<-- <<-- */
-unsigned char readuchar(FILE * f)
+static unsigned char readuchar(FILE * f)
{
unsigned char c1;
if ( !fread(&c1, 1, 1, f) )
@@ -1192,7 +1196,7 @@ unsigned char readuchar(FILE * f)
return c1;
}
-unsigned short readushort(FILE * f, int bigendian)
+static unsigned short readushort(FILE * f, int bigendian)
{
unsigned char c1, c2;
if ( !fread(&c1, 1, 1, f) )
@@ -1211,7 +1215,7 @@ unsigned short readushort(FILE * f, int bigendian)
return (c2 << 8) + c1;
}
-unsigned int readuint(FILE * f, int bigendian)
+static unsigned int readuint(FILE * f, int bigendian)
{
unsigned char c1, c2, c3, c4;
if ( !fread(&c1, 1, 1, f) )