You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
Originally reported on Google Code with ID 13
Reported by fodevaux on 2010-01-20 15:04:55
The text was updated successfully, but these errors were encountered: