diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2015-07-13 14:58:17 +0300 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2015-07-13 14:58:17 +0300 |
commit | e142ae77cadf04103fbc643f21cf60891862f6a8 (patch) | |
tree | 142e25fccd5ba3e748a1652706e7e4f1220ca289 /source/blender/imbuf/intern/jp2.c | |
parent | 107bbee4c763c95ea5d07a3b2f08bfe3b6adb24c (diff) |
Imbuf types refactor.
ImBuf types were getting stored as bitflags in a 32bit integer which had
already run out of space. Solved the problem by separating file type to
an ftype enum, and file specific options to foptions.
Reviewed by Campbell, thanks a lot!
Diffstat (limited to 'source/blender/imbuf/intern/jp2.c')
-rw-r--r-- | source/blender/imbuf/intern/jp2.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/source/blender/imbuf/intern/jp2.c b/source/blender/imbuf/intern/jp2.c index 11733222e2f..7cb7636573b 100644 --- a/source/blender/imbuf/intern/jp2.c +++ b/source/blender/imbuf/intern/jp2.c @@ -232,11 +232,11 @@ struct ImBuf *imb_jp2_decode(const unsigned char *mem, size_t size, int flags, c return NULL; } - ibuf->ftype = JP2; + ibuf->ftype = IMB_FTYPE_JP2; if (is_jp2) - ibuf->ftype |= JP2_JP2; + ibuf->foptions.flag |= JP2_JP2; else - ibuf->ftype |= JP2_J2K; + ibuf->foptions.flag |= JP2_J2K; if (use_float) { float *rect_float = ibuf->rect_float; @@ -587,12 +587,12 @@ static opj_image_t *ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters) chanel_colormanage_cb = linearrgb_to_srgb; } - if (ibuf->ftype & JP2_CINE) { + if (ibuf->foptions.flag & JP2_CINE) { if (ibuf->x == 4096 || ibuf->y == 2160) parameters->cp_cinema = CINEMA4K_24; else { - if (ibuf->ftype & JP2_CINE_48FPS) { + if (ibuf->foptions.flag & JP2_CINE_48FPS) { parameters->cp_cinema = CINEMA2K_48; } else { @@ -613,10 +613,10 @@ static opj_image_t *ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters) } else { /* Get settings from the imbuf */ - color_space = (ibuf->ftype & JP2_YCC) ? CLRSPC_SYCC : CLRSPC_SRGB; + color_space = (ibuf->foptions.flag & JP2_YCC) ? CLRSPC_SYCC : CLRSPC_SRGB; - if (ibuf->ftype & JP2_16BIT) prec = 16; - else if (ibuf->ftype & JP2_12BIT) prec = 12; + if (ibuf->foptions.flag & JP2_16BIT) prec = 16; + else if (ibuf->foptions.flag & JP2_12BIT) prec = 12; else prec = 8; /* 32bit images == alpha channel */ @@ -952,7 +952,7 @@ static opj_image_t *ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters) /* Found write info at http://users.ece.gatech.edu/~slabaugh/personal/c/bitmapUnix.c */ int imb_savejp2(struct ImBuf *ibuf, const char *name, int flags) { - int quality = ibuf->ftype & 0xff; + int quality = ibuf->foptions.quality; int bSuccess; opj_cparameters_t parameters; /* compression parameters */ @@ -992,9 +992,9 @@ int imb_savejp2(struct ImBuf *ibuf, const char *name, int flags) opj_cinfo_t *cinfo = NULL; /* get a JP2 compressor handle */ - if (ibuf->ftype & JP2_JP2) + if (ibuf->foptions.flag & JP2_JP2) cinfo = opj_create_compress(CODEC_JP2); - else if (ibuf->ftype & JP2_J2K) + else if (ibuf->foptions.flag & JP2_J2K) cinfo = opj_create_compress(CODEC_J2K); else BLI_assert(!"Unsupported codec was specified in save settings"); |