Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JP2 Color Space modification by Matteo Italia #13

Closed
gcode-importer opened this issue Jan 20, 2010 · 1 comment
Closed

JP2 Color Space modification by Matteo Italia #13

gcode-importer opened this issue Jan 20, 2010 · 1 comment

Comments

@gcode-importer
Copy link

Originally reported on Google Code with ID 13

Hello all,

I propose a small improvement for the /OPJ_COLOR_SPACE/ enum: when
reading a jp2 file, the /color_space/ member of the /opj_image/
structure is correctly set to one of the supported color spaces or
/CLRSPC_UNKNOWN/ if it's one of the color modes that is not supported by
the library.
On the other hand, when reading a j2k file (which, as far as I know,
doesn't contain any color space information), the /color_space/ field is
set to 0 as a consequence of the initial zeroing that happens when the
/opj_image/ object is allocated, since, after that moment, that field is
left untouched by the j2k decoder.
What I propose is to make official this behavior, and add to the
/COLOR_SPACE/ enum the member /CLRSPC_UNSPECIFIED = 0/. In this way a
library user that use common code to decode j2k and jp2 files can
reliably distinguish if the color space is not specified by the file (so
guessing is ok, since there is no other option) or if it is unsupported
by the library: when absolute fidelity to the original file is required,
in this last case failing may be a better choice than guessing.
The modify is really simple: just change the enum (file openjpeg.h, line
147) in this way:

/**

Supported image color spaces

*/

typedef enum COLOR_SPACE {

    CLRSPC_UNKNOWN = -1,    /**< not supported by the library */

    CLRSPC_UNSPECIFIED = 0,        /** < not specified in the file */

    CLRSPC_SRGB = 1,        /**< sRGB */

    CLRSPC_GRAY = 2,        /**< grayscale */

    CLRSPC_SYCC = 3            /**< YUV */

} OPJ_COLOR_SPACE;

By the way, is OpenJPEG supposed to support also the ICC mode of jp2 in
the near future?

Regards,
Matteo Italia 


Reported by fodevaux on 2010-01-20 15:04:55

@gcode-importer
Copy link
Author

Issue solved with revisions 542 and 543
http://code.google.com/p/openjpeg/source/detail?r=542
http://code.google.com/p/openjpeg/source/detail?r=543


Reported by fodevaux on 2010-01-20 15:49:38

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant