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:
Diffstat (limited to 'source/blender/imbuf')
-rw-r--r--source/blender/imbuf/IMB_imbuf_types.h2
-rw-r--r--source/blender/imbuf/intern/jp2.c12
2 files changed, 13 insertions, 1 deletions
diff --git a/source/blender/imbuf/IMB_imbuf_types.h b/source/blender/imbuf/IMB_imbuf_types.h
index 28e62d496b2..433123914ce 100644
--- a/source/blender/imbuf/IMB_imbuf_types.h
+++ b/source/blender/imbuf/IMB_imbuf_types.h
@@ -217,6 +217,8 @@ typedef struct ImBuf {
#define JP2_YCC (1 << 15)
#define JP2_CINE (1 << 14)
#define JP2_CINE_48FPS (1 << 13)
+#define JP2_JP2 (1 << 12)
+#define JP2_J2K (1 << 11)
#endif
#define RAWTGA (TGA | 1)
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);