Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2012-12-23 17:57:09 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2012-12-23 17:57:09 +0400
commit851cb9b3455369fb9796e3c27e05e5e88f4f36b0 (patch)
tree6454b382d6e4919ac0590e32f4cc2f153657e1c0 /source/blender/imbuf/intern/jp2.c
parent60ffe9f8ec9cc30e59e2a4e65fbb6b0f5f2e3297 (diff)
Added support of J2K codec for Jpeg2000 writing
This codec is absolutely needed to generate DCP using OpenDCP, before that external application to convert JP2 to J2K was used which slowed down export a lot. New codec is exposed to image format settings panel and called Codec. Default one is JP2 which creates files with .jp2 extension, new one is called J2K which creates with .j2c extension. Other changes: - Fixed avi jpeg warning which was treating as error here. - Made it so extension is detecting from ImageFormatData instead of image file type, which makes it possible to have different extension for the same file type depending on it's settings. IRIS format should still be changed (depending on number of channels it'll be .bw, .rgb or .rgba extension) - Default image format settings would be set from image buffer when re-saving it. Makes it possible to easily open .j2c file and save it using J2K codec (without this change it'll save as .jp2 using JP2 codec)
Diffstat (limited to 'source/blender/imbuf/intern/jp2.c')
-rw-r--r--source/blender/imbuf/intern/jp2.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/source/blender/imbuf/intern/jp2.c b/source/blender/imbuf/intern/jp2.c
index 3a2bf99c75c..8d6218a389e 100644
--- a/source/blender/imbuf/intern/jp2.c
+++ b/source/blender/imbuf/intern/jp2.c
@@ -228,6 +228,10 @@ struct ImBuf *imb_jp2_decode(unsigned char *mem, size_t size, int flags, char co
}
ibuf->ftype = JP2;
+ if (is_jp2)
+ ibuf->ftype |= JP2_JP2;
+ else
+ ibuf->ftype |= JP2_J2K;
if (use_float) {
float *rect_float = ibuf->rect_float;
@@ -852,9 +856,15 @@ int imb_savejp2(struct ImBuf *ibuf, const char *name, int flags)
int codestream_length;
opj_cio_t *cio = NULL;
FILE *f = NULL;
+ opj_cinfo_t *cinfo = NULL;
/* get a JP2 compressor handle */
- opj_cinfo_t *cinfo = opj_create_compress(CODEC_JP2);
+ if (ibuf->ftype & JP2_JP2)
+ cinfo = opj_create_compress(CODEC_JP2);
+ else if (ibuf->ftype & JP2_J2K)
+ cinfo = opj_create_compress(CODEC_J2K);
+ else
+ BLI_assert(!"Unsupported codec was specified in save settings");
/* catch events using our callbacks and give a local context */
opj_set_event_mgr((opj_common_ptr)cinfo, &event_mgr, stderr);