forked from bartvdbraak/blender
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!
This commit is contained in:
parent
107bbee4c7
commit
e142ae77ca
@ -39,6 +39,7 @@ extern "C" {
|
||||
|
||||
struct Image;
|
||||
struct ImBuf;
|
||||
struct ImbFormatOptions;
|
||||
struct anim;
|
||||
struct Scene;
|
||||
struct Object;
|
||||
@ -80,8 +81,8 @@ void BKE_image_path_from_imtype(
|
||||
const char imtype, const bool use_ext, const bool use_frames, const char *suffix);
|
||||
int BKE_image_path_ensure_ext_from_imformat(char *string, const struct ImageFormatData *im_format);
|
||||
int BKE_image_path_ensure_ext_from_imtype(char *string, const char imtype);
|
||||
char BKE_image_ftype_to_imtype(const int ftype);
|
||||
int BKE_image_imtype_to_ftype(const char imtype);
|
||||
char BKE_image_ftype_to_imtype(const int ftype, const struct ImbFormatOptions *options);
|
||||
int BKE_image_imtype_to_ftype(const char imtype, struct ImbFormatOptions *r_options);
|
||||
|
||||
bool BKE_imtype_is_movie(const char imtype);
|
||||
int BKE_imtype_supports_zbuf(const char imtype);
|
||||
@ -270,7 +271,7 @@ bool BKE_image_has_anim(struct Image *image);
|
||||
bool BKE_image_has_packedfile(struct Image *image);
|
||||
bool BKE_image_is_animated(struct Image *image);
|
||||
bool BKE_image_is_dirty(struct Image *image);
|
||||
void BKE_image_file_format_set(struct Image *image, int ftype);
|
||||
void BKE_image_file_format_set(struct Image *image, int ftype, const struct ImbFormatOptions *options);
|
||||
bool BKE_image_has_loaded_ibuf(struct Image *image);
|
||||
struct ImBuf *BKE_image_get_ibuf_with_name(struct Image *image, const char *name);
|
||||
struct ImBuf *BKE_image_get_first_ibuf(struct Image *image);
|
||||
|
@ -2785,10 +2785,13 @@ void dynamicPaint_outputSurfaceImage(DynamicPaintSurface *surface, char *filenam
|
||||
}
|
||||
|
||||
/* Set output format, png in case exr isn't supported */
|
||||
ibuf->ftype = PNG | 95;
|
||||
ibuf->ftype = IMB_FTYPE_PNG;
|
||||
ibuf->foptions.quality = 15;
|
||||
|
||||
#ifdef WITH_OPENEXR
|
||||
if (format == R_IMF_IMTYPE_OPENEXR) { /* OpenEXR 32-bit float */
|
||||
ibuf->ftype = OPENEXR | OPENEXR_COMPRESS;
|
||||
ibuf->ftype = IMB_FTYPE_OPENEXR;
|
||||
ibuf->foptions.flag |= OPENEXR_COMPRESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -916,7 +916,7 @@ static void image_memorypack_multiview(Image *ima)
|
||||
for (i = 0, iv = ima->views.first; iv; iv = iv->next, i++) {
|
||||
ImBuf *ibuf = image_get_cached_ibuf_for_index_frame(ima, i, 0);
|
||||
|
||||
ibuf->ftype = PNG;
|
||||
ibuf->ftype = IMB_FTYPE_PNG;
|
||||
ibuf->planes = R_IMF_PLANES_RGBA;
|
||||
|
||||
/* if the image was a R_IMF_VIEWS_STEREO_3D we force _L, _R suffices */
|
||||
@ -976,7 +976,7 @@ void BKE_image_memorypack(Image *ima)
|
||||
|
||||
image_free_packedfiles(ima);
|
||||
|
||||
ibuf->ftype = PNG;
|
||||
ibuf->ftype = IMB_FTYPE_PNG;
|
||||
ibuf->planes = R_IMF_PLANES_RGBA;
|
||||
|
||||
IMB_saveiff(ibuf, ibuf->name, IB_rect | IB_mem);
|
||||
@ -1208,82 +1208,92 @@ void BKE_image_all_free_anim_ibufs(int cfra)
|
||||
|
||||
/* *********** READ AND WRITE ************** */
|
||||
|
||||
int BKE_image_imtype_to_ftype(const char imtype)
|
||||
int BKE_image_imtype_to_ftype(const char imtype, ImbFormatOptions *r_options)
|
||||
{
|
||||
memset(r_options, 0, sizeof(*r_options));
|
||||
|
||||
if (imtype == R_IMF_IMTYPE_TARGA)
|
||||
return TGA;
|
||||
else if (imtype == R_IMF_IMTYPE_RAWTGA)
|
||||
return RAWTGA;
|
||||
return IMB_FTYPE_TGA;
|
||||
else if (imtype == R_IMF_IMTYPE_RAWTGA) {
|
||||
r_options->flag = RAWTGA;
|
||||
return IMB_FTYPE_TGA;
|
||||
}
|
||||
else if (imtype == R_IMF_IMTYPE_IRIS)
|
||||
return IMAGIC;
|
||||
return IMB_FTYPE_IMAGIC;
|
||||
#ifdef WITH_HDR
|
||||
else if (imtype == R_IMF_IMTYPE_RADHDR)
|
||||
return RADHDR;
|
||||
return IMB_FTYPE_RADHDR;
|
||||
#endif
|
||||
else if (imtype == R_IMF_IMTYPE_PNG)
|
||||
return PNG | 15;
|
||||
else if (imtype == R_IMF_IMTYPE_PNG) {
|
||||
r_options->quality = 15;
|
||||
return IMB_FTYPE_PNG;
|
||||
}
|
||||
#ifdef WITH_DDS
|
||||
else if (imtype == R_IMF_IMTYPE_DDS)
|
||||
return DDS;
|
||||
return IMB_FTYPE_DDS;
|
||||
#endif
|
||||
else if (imtype == R_IMF_IMTYPE_BMP)
|
||||
return BMP;
|
||||
return IMB_FTYPE_BMP;
|
||||
#ifdef WITH_TIFF
|
||||
else if (imtype == R_IMF_IMTYPE_TIFF)
|
||||
return TIF;
|
||||
return IMB_FTYPE_TIF;
|
||||
#endif
|
||||
else if (imtype == R_IMF_IMTYPE_OPENEXR || imtype == R_IMF_IMTYPE_MULTILAYER)
|
||||
return OPENEXR;
|
||||
return IMB_FTYPE_OPENEXR;
|
||||
#ifdef WITH_CINEON
|
||||
else if (imtype == R_IMF_IMTYPE_CINEON)
|
||||
return CINEON;
|
||||
return IMB_FTYPE_CINEON;
|
||||
else if (imtype == R_IMF_IMTYPE_DPX)
|
||||
return DPX;
|
||||
return IMB_FTYPE_DPX;
|
||||
#endif
|
||||
#ifdef WITH_OPENJPEG
|
||||
else if (imtype == R_IMF_IMTYPE_JP2)
|
||||
return JP2;
|
||||
return IMB_FTYPE_JP2;
|
||||
#endif
|
||||
else
|
||||
return JPG | 90;
|
||||
else {
|
||||
r_options->quality = 90;
|
||||
return IMB_FTYPE_JPG;
|
||||
}
|
||||
}
|
||||
|
||||
char BKE_image_ftype_to_imtype(const int ftype)
|
||||
char BKE_image_ftype_to_imtype(const int ftype, const ImbFormatOptions *options)
|
||||
{
|
||||
if (ftype == 0)
|
||||
return R_IMF_IMTYPE_TARGA;
|
||||
else if (ftype == IMAGIC)
|
||||
else if (ftype == IMB_FTYPE_IMAGIC)
|
||||
return R_IMF_IMTYPE_IRIS;
|
||||
#ifdef WITH_HDR
|
||||
else if (ftype & RADHDR)
|
||||
else if (ftype == IMB_FTYPE_RADHDR)
|
||||
return R_IMF_IMTYPE_RADHDR;
|
||||
#endif
|
||||
else if (ftype & PNG)
|
||||
else if (ftype == IMB_FTYPE_PNG)
|
||||
return R_IMF_IMTYPE_PNG;
|
||||
#ifdef WITH_DDS
|
||||
else if (ftype & DDS)
|
||||
else if (ftype == IMB_FTYPE_DDS)
|
||||
return R_IMF_IMTYPE_DDS;
|
||||
#endif
|
||||
else if (ftype & BMP)
|
||||
else if (ftype == IMB_FTYPE_BMP)
|
||||
return R_IMF_IMTYPE_BMP;
|
||||
#ifdef WITH_TIFF
|
||||
else if (ftype & TIF)
|
||||
else if (ftype == IMB_FTYPE_TIF)
|
||||
return R_IMF_IMTYPE_TIFF;
|
||||
#endif
|
||||
else if (ftype & OPENEXR)
|
||||
else if (ftype == IMB_FTYPE_OPENEXR)
|
||||
return R_IMF_IMTYPE_OPENEXR;
|
||||
#ifdef WITH_CINEON
|
||||
else if (ftype & CINEON)
|
||||
else if (ftype == IMB_FTYPE_CINEON)
|
||||
return R_IMF_IMTYPE_CINEON;
|
||||
else if (ftype & DPX)
|
||||
else if (ftype == IMB_FTYPE_DPX)
|
||||
return R_IMF_IMTYPE_DPX;
|
||||
#endif
|
||||
else if (ftype & TGA)
|
||||
return R_IMF_IMTYPE_TARGA;
|
||||
else if (ftype & RAWTGA)
|
||||
return R_IMF_IMTYPE_RAWTGA;
|
||||
else if (ftype == IMB_FTYPE_TGA) {
|
||||
if (options && (options->flag & RAWTGA))
|
||||
return R_IMF_IMTYPE_RAWTGA;
|
||||
else
|
||||
return R_IMF_IMTYPE_TARGA;
|
||||
}
|
||||
#ifdef WITH_OPENJPEG
|
||||
else if (ftype & JP2)
|
||||
else if (ftype == IMB_FTYPE_JP2)
|
||||
return R_IMF_IMTYPE_JP2;
|
||||
#endif
|
||||
else
|
||||
@ -1590,38 +1600,41 @@ void BKE_imformat_defaults(ImageFormatData *im_format)
|
||||
|
||||
void BKE_imbuf_to_image_format(struct ImageFormatData *im_format, const ImBuf *imbuf)
|
||||
{
|
||||
int ftype = imbuf->ftype & ~IB_CUSTOM_FLAGS_MASK;
|
||||
int custom_flags = imbuf->ftype & IB_CUSTOM_FLAGS_MASK;
|
||||
int ftype = imbuf->ftype;
|
||||
int custom_flags = imbuf->foptions.flag;
|
||||
char quality = imbuf->foptions.quality;
|
||||
|
||||
BKE_imformat_defaults(im_format);
|
||||
|
||||
/* file type */
|
||||
|
||||
if (ftype == IMAGIC)
|
||||
if (ftype == IMB_FTYPE_IMAGIC)
|
||||
im_format->imtype = R_IMF_IMTYPE_IRIS;
|
||||
|
||||
#ifdef WITH_HDR
|
||||
else if (ftype == RADHDR)
|
||||
else if (ftype == IMB_FTYPE_RADHDR)
|
||||
im_format->imtype = R_IMF_IMTYPE_RADHDR;
|
||||
#endif
|
||||
|
||||
else if (ftype == PNG) {
|
||||
else if (ftype == IMB_FTYPE_PNG) {
|
||||
im_format->imtype = R_IMF_IMTYPE_PNG;
|
||||
|
||||
if (custom_flags & PNG_16BIT)
|
||||
im_format->depth = R_IMF_CHAN_DEPTH_16;
|
||||
|
||||
im_format->compress = quality;
|
||||
}
|
||||
|
||||
#ifdef WITH_DDS
|
||||
else if (ftype == DDS)
|
||||
else if (ftype == IMB_FTYPE_DDS)
|
||||
im_format->imtype = R_IMF_IMTYPE_DDS;
|
||||
#endif
|
||||
|
||||
else if (ftype == BMP)
|
||||
else if (ftype == IMB_FTYPE_BMP)
|
||||
im_format->imtype = R_IMF_IMTYPE_BMP;
|
||||
|
||||
#ifdef WITH_TIFF
|
||||
else if (ftype == TIF) {
|
||||
else if (ftype == IMB_FTYPE_TIF) {
|
||||
im_format->imtype = R_IMF_IMTYPE_TIFF;
|
||||
if (custom_flags & TIF_16BIT)
|
||||
im_format->depth = R_IMF_CHAN_DEPTH_16;
|
||||
@ -1629,7 +1642,7 @@ void BKE_imbuf_to_image_format(struct ImageFormatData *im_format, const ImBuf *i
|
||||
#endif
|
||||
|
||||
#ifdef WITH_OPENEXR
|
||||
else if (ftype == OPENEXR) {
|
||||
else if (ftype == IMB_FTYPE_OPENEXR) {
|
||||
im_format->imtype = R_IMF_IMTYPE_OPENEXR;
|
||||
if (custom_flags & OPENEXR_HALF)
|
||||
im_format->depth = R_IMF_CHAN_DEPTH_16;
|
||||
@ -1641,41 +1654,40 @@ void BKE_imbuf_to_image_format(struct ImageFormatData *im_format, const ImBuf *i
|
||||
#endif
|
||||
|
||||
#ifdef WITH_CINEON
|
||||
else if (ftype == CINEON)
|
||||
else if (ftype == IMB_FTYPE_CINEON)
|
||||
im_format->imtype = R_IMF_IMTYPE_CINEON;
|
||||
else if (ftype == DPX)
|
||||
else if (ftype == IMB_FTYPE_DPX)
|
||||
im_format->imtype = R_IMF_IMTYPE_DPX;
|
||||
#endif
|
||||
|
||||
else if (ftype == TGA) {
|
||||
im_format->imtype = R_IMF_IMTYPE_TARGA;
|
||||
else if (ftype == IMB_FTYPE_TGA) {
|
||||
if (custom_flags & RAWTGA)
|
||||
im_format->imtype = R_IMF_IMTYPE_RAWTGA;
|
||||
else
|
||||
im_format->imtype = R_IMF_IMTYPE_TARGA;
|
||||
}
|
||||
else if (ftype == RAWTGA) {
|
||||
im_format->imtype = R_IMF_IMTYPE_RAWTGA;
|
||||
}
|
||||
|
||||
#ifdef WITH_OPENJPEG
|
||||
else if (ftype & JP2) {
|
||||
else if (ftype == IMB_FTYPE_JP2) {
|
||||
im_format->imtype = R_IMF_IMTYPE_JP2;
|
||||
im_format->quality = custom_flags & ~JPG_MSK;
|
||||
im_format->quality = quality;
|
||||
|
||||
if (ftype & JP2_16BIT)
|
||||
if (custom_flags & JP2_16BIT)
|
||||
im_format->depth = R_IMF_CHAN_DEPTH_16;
|
||||
else if (ftype & JP2_12BIT)
|
||||
else if (custom_flags & JP2_12BIT)
|
||||
im_format->depth = R_IMF_CHAN_DEPTH_12;
|
||||
|
||||
if (ftype & JP2_YCC)
|
||||
if (custom_flags & JP2_YCC)
|
||||
im_format->jp2_flag |= R_IMF_JP2_FLAG_YCC;
|
||||
|
||||
if (ftype & JP2_CINE) {
|
||||
if (custom_flags & JP2_CINE) {
|
||||
im_format->jp2_flag |= R_IMF_JP2_FLAG_CINE_PRESET;
|
||||
if (ftype & JP2_CINE_48FPS)
|
||||
if (custom_flags & JP2_CINE_48FPS)
|
||||
im_format->jp2_flag |= R_IMF_JP2_FLAG_CINE_48;
|
||||
}
|
||||
|
||||
if (ftype & JP2_JP2)
|
||||
if (custom_flags & JP2_JP2)
|
||||
im_format->jp2_codec = R_IMF_JP2_CODEC_JP2;
|
||||
else if (ftype & JP2_J2K)
|
||||
else if (custom_flags & JP2_J2K)
|
||||
im_format->jp2_codec = R_IMF_JP2_CODEC_J2K;
|
||||
else
|
||||
BLI_assert(!"Unsupported jp2 codec was specified in file type");
|
||||
@ -1684,7 +1696,7 @@ void BKE_imbuf_to_image_format(struct ImageFormatData *im_format, const ImBuf *i
|
||||
|
||||
else {
|
||||
im_format->imtype = R_IMF_IMTYPE_JPEG90;
|
||||
im_format->quality = custom_flags & ~JPG_MSK;
|
||||
im_format->quality = quality;
|
||||
}
|
||||
|
||||
/* planes */
|
||||
@ -2162,46 +2174,46 @@ void BKE_imbuf_write_prepare(ImBuf *ibuf, ImageFormatData *imf)
|
||||
char quality = imf->quality;
|
||||
|
||||
if (imtype == R_IMF_IMTYPE_IRIS) {
|
||||
ibuf->ftype = IMAGIC;
|
||||
ibuf->ftype = IMB_FTYPE_IMAGIC;
|
||||
}
|
||||
#ifdef WITH_HDR
|
||||
else if (imtype == R_IMF_IMTYPE_RADHDR) {
|
||||
ibuf->ftype = RADHDR;
|
||||
ibuf->ftype = IMB_FTYPE_RADHDR;
|
||||
}
|
||||
#endif
|
||||
else if (ELEM(imtype, R_IMF_IMTYPE_PNG, R_IMF_IMTYPE_FFMPEG, R_IMF_IMTYPE_H264, R_IMF_IMTYPE_THEORA, R_IMF_IMTYPE_XVID)) {
|
||||
ibuf->ftype = PNG;
|
||||
ibuf->ftype = IMB_FTYPE_PNG;
|
||||
|
||||
if (imtype == R_IMF_IMTYPE_PNG) {
|
||||
if (imf->depth == R_IMF_CHAN_DEPTH_16)
|
||||
ibuf->ftype |= PNG_16BIT;
|
||||
ibuf->foptions.flag |= PNG_16BIT;
|
||||
|
||||
ibuf->ftype |= compress;
|
||||
ibuf->foptions.quality = compress;
|
||||
}
|
||||
|
||||
}
|
||||
#ifdef WITH_DDS
|
||||
else if (imtype == R_IMF_IMTYPE_DDS) {
|
||||
ibuf->ftype = DDS;
|
||||
ibuf->ftype = IMB_FTYPE_DDS;
|
||||
}
|
||||
#endif
|
||||
else if (imtype == R_IMF_IMTYPE_BMP) {
|
||||
ibuf->ftype = BMP;
|
||||
ibuf->ftype = IMB_FTYPE_BMP;
|
||||
}
|
||||
#ifdef WITH_TIFF
|
||||
else if (imtype == R_IMF_IMTYPE_TIFF) {
|
||||
ibuf->ftype = TIF;
|
||||
ibuf->ftype = IMB_FTYPE_TIF;
|
||||
|
||||
if (imf->depth == R_IMF_CHAN_DEPTH_16)
|
||||
ibuf->ftype |= TIF_16BIT;
|
||||
ibuf->foptions.flag |= TIF_16BIT;
|
||||
}
|
||||
#endif
|
||||
#ifdef WITH_OPENEXR
|
||||
else if (ELEM(imtype, R_IMF_IMTYPE_OPENEXR, R_IMF_IMTYPE_MULTILAYER)) {
|
||||
ibuf->ftype = OPENEXR;
|
||||
ibuf->ftype = IMB_FTYPE_OPENEXR;
|
||||
if (imf->depth == R_IMF_CHAN_DEPTH_16)
|
||||
ibuf->ftype |= OPENEXR_HALF;
|
||||
ibuf->ftype |= (imf->exr_codec & OPENEXR_COMPRESS);
|
||||
ibuf->foptions.flag |= OPENEXR_HALF;
|
||||
ibuf->foptions.flag |= (imf->exr_codec & OPENEXR_COMPRESS);
|
||||
|
||||
if (!(imf->flag & R_IMF_FLAG_ZBUF))
|
||||
ibuf->zbuf_float = NULL; /* signal for exr saving */
|
||||
@ -2210,68 +2222,70 @@ void BKE_imbuf_write_prepare(ImBuf *ibuf, ImageFormatData *imf)
|
||||
#endif
|
||||
#ifdef WITH_CINEON
|
||||
else if (imtype == R_IMF_IMTYPE_CINEON) {
|
||||
ibuf->ftype = CINEON;
|
||||
ibuf->ftype = IMB_FTYPE_CINEON;
|
||||
if (imf->cineon_flag & R_IMF_CINEON_FLAG_LOG) {
|
||||
ibuf->ftype |= CINEON_LOG;
|
||||
ibuf->foptions.flag |= CINEON_LOG;
|
||||
}
|
||||
if (imf->depth == R_IMF_CHAN_DEPTH_16) {
|
||||
ibuf->ftype |= CINEON_16BIT;
|
||||
ibuf->foptions.flag |= CINEON_16BIT;
|
||||
}
|
||||
else if (imf->depth == R_IMF_CHAN_DEPTH_12) {
|
||||
ibuf->ftype |= CINEON_12BIT;
|
||||
ibuf->foptions.flag |= CINEON_12BIT;
|
||||
}
|
||||
else if (imf->depth == R_IMF_CHAN_DEPTH_10) {
|
||||
ibuf->ftype |= CINEON_10BIT;
|
||||
ibuf->foptions.flag |= CINEON_10BIT;
|
||||
}
|
||||
}
|
||||
else if (imtype == R_IMF_IMTYPE_DPX) {
|
||||
ibuf->ftype = DPX;
|
||||
ibuf->ftype = IMB_FTYPE_DPX;
|
||||
if (imf->cineon_flag & R_IMF_CINEON_FLAG_LOG) {
|
||||
ibuf->ftype |= CINEON_LOG;
|
||||
ibuf->foptions.flag |= CINEON_LOG;
|
||||
}
|
||||
if (imf->depth == R_IMF_CHAN_DEPTH_16) {
|
||||
ibuf->ftype |= CINEON_16BIT;
|
||||
ibuf->foptions.flag |= CINEON_16BIT;
|
||||
}
|
||||
else if (imf->depth == R_IMF_CHAN_DEPTH_12) {
|
||||
ibuf->ftype |= CINEON_12BIT;
|
||||
ibuf->foptions.flag |= CINEON_12BIT;
|
||||
}
|
||||
else if (imf->depth == R_IMF_CHAN_DEPTH_10) {
|
||||
ibuf->ftype |= CINEON_10BIT;
|
||||
ibuf->foptions.flag |= CINEON_10BIT;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else if (imtype == R_IMF_IMTYPE_TARGA) {
|
||||
ibuf->ftype = TGA;
|
||||
ibuf->ftype = IMB_FTYPE_TGA;
|
||||
}
|
||||
else if (imtype == R_IMF_IMTYPE_RAWTGA) {
|
||||
ibuf->ftype = RAWTGA;
|
||||
ibuf->ftype = IMB_FTYPE_TGA;
|
||||
ibuf->foptions.flag = RAWTGA;
|
||||
}
|
||||
#ifdef WITH_OPENJPEG
|
||||
else if (imtype == R_IMF_IMTYPE_JP2) {
|
||||
if (quality < 10) quality = 90;
|
||||
ibuf->ftype = JP2 | quality;
|
||||
ibuf->ftype = IMB_FTYPE_JP2;
|
||||
ibuf->foptions.quality = quality;
|
||||
|
||||
if (imf->depth == R_IMF_CHAN_DEPTH_16) {
|
||||
ibuf->ftype |= JP2_16BIT;
|
||||
ibuf->foptions.flag |= JP2_16BIT;
|
||||
}
|
||||
else if (imf->depth == R_IMF_CHAN_DEPTH_12) {
|
||||
ibuf->ftype |= JP2_12BIT;
|
||||
ibuf->foptions.flag |= JP2_12BIT;
|
||||
}
|
||||
|
||||
if (imf->jp2_flag & R_IMF_JP2_FLAG_YCC) {
|
||||
ibuf->ftype |= JP2_YCC;
|
||||
ibuf->foptions.flag |= JP2_YCC;
|
||||
}
|
||||
|
||||
if (imf->jp2_flag & R_IMF_JP2_FLAG_CINE_PRESET) {
|
||||
ibuf->ftype |= JP2_CINE;
|
||||
ibuf->foptions.flag |= JP2_CINE;
|
||||
if (imf->jp2_flag & R_IMF_JP2_FLAG_CINE_48)
|
||||
ibuf->ftype |= JP2_CINE_48FPS;
|
||||
ibuf->foptions.flag |= JP2_CINE_48FPS;
|
||||
}
|
||||
|
||||
if (imf->jp2_codec == R_IMF_JP2_CODEC_JP2)
|
||||
ibuf->ftype |= JP2_JP2;
|
||||
ibuf->foptions.flag |= JP2_JP2;
|
||||
else if (imf->jp2_codec == R_IMF_JP2_CODEC_J2K)
|
||||
ibuf->ftype |= JP2_J2K;
|
||||
ibuf->foptions.flag |= JP2_J2K;
|
||||
else
|
||||
BLI_assert(!"Unsupported jp2 codec was specified in im_format->jp2_codec");
|
||||
}
|
||||
@ -2279,7 +2293,8 @@ void BKE_imbuf_write_prepare(ImBuf *ibuf, ImageFormatData *imf)
|
||||
else {
|
||||
/* R_IMF_IMTYPE_JPEG90, etc. default we save jpegs */
|
||||
if (quality < 10) quality = 90;
|
||||
ibuf->ftype = JPG | quality;
|
||||
ibuf->ftype = IMB_FTYPE_JPG;
|
||||
ibuf->foptions.quality = quality;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3141,7 +3156,7 @@ static ImBuf *load_sequence_single(Image *ima, ImageUser *iuser, int frame, cons
|
||||
if (ibuf) {
|
||||
#ifdef WITH_OPENEXR
|
||||
/* handle multilayer case, don't assign ibuf. will be handled in BKE_image_acquire_ibuf */
|
||||
if (ibuf->ftype == OPENEXR && ibuf->userdata) {
|
||||
if (ibuf->ftype == IMB_FTYPE_OPENEXR && ibuf->userdata) {
|
||||
/* handle singlelayer multiview case assign ibuf based on available views */
|
||||
if (IMB_exr_has_singlelayer_multiview(ibuf->userdata)) {
|
||||
image_create_multiview(ima, ibuf, frame);
|
||||
@ -3437,7 +3452,7 @@ static ImBuf *load_image_single(
|
||||
|
||||
if (ibuf) {
|
||||
#ifdef WITH_OPENEXR
|
||||
if (ibuf->ftype == OPENEXR && ibuf->userdata) {
|
||||
if (ibuf->ftype == IMB_FTYPE_OPENEXR && ibuf->userdata) {
|
||||
if (IMB_exr_has_singlelayer_multiview(ibuf->userdata)) {
|
||||
/* handle singlelayer multiview case assign ibuf based on available views */
|
||||
image_create_multiview(ima, ibuf, cfra);
|
||||
@ -4480,12 +4495,13 @@ bool BKE_image_is_dirty(Image *image)
|
||||
return is_dirty;
|
||||
}
|
||||
|
||||
void BKE_image_file_format_set(Image *image, int ftype)
|
||||
void BKE_image_file_format_set(Image *image, int ftype, const ImbFormatOptions *options)
|
||||
{
|
||||
#if 0
|
||||
ImBuf *ibuf = BKE_image_acquire_ibuf(image, NULL, NULL);
|
||||
if (ibuf) {
|
||||
ibuf->ftype = ftype;
|
||||
ibuf->foptions = options;
|
||||
}
|
||||
BKE_image_release_ibuf(image, ibuf, NULL);
|
||||
#endif
|
||||
@ -4497,6 +4513,7 @@ void BKE_image_file_format_set(Image *image, int ftype)
|
||||
while (!IMB_moviecacheIter_done(iter)) {
|
||||
ImBuf *ibuf = IMB_moviecacheIter_getImBuf(iter);
|
||||
ibuf->ftype = ftype;
|
||||
ibuf->foptions = *options;
|
||||
IMB_moviecacheIter_step(iter);
|
||||
}
|
||||
IMB_moviecacheIter_free(iter);
|
||||
|
@ -229,7 +229,7 @@ static ImBuf *movieclip_load_sequence_file(MovieClip *clip, MovieClipUser *user,
|
||||
|
||||
#ifdef WITH_OPENEXR
|
||||
if (ibuf) {
|
||||
if (ibuf->ftype == OPENEXR && ibuf->userdata) {
|
||||
if (ibuf->ftype == IMB_FTYPE_OPENEXR && ibuf->userdata) {
|
||||
IMB_exr_close(ibuf->userdata);
|
||||
ibuf->userdata = NULL;
|
||||
}
|
||||
@ -1322,8 +1322,8 @@ static void movieclip_build_proxy_ibuf(MovieClip *clip, ImBuf *ibuf, int cfra, i
|
||||
IMB_scaleImBuf(scaleibuf, (short)rectx, (short)recty);
|
||||
|
||||
quality = clip->proxy.quality;
|
||||
scaleibuf->ftype = JPG | quality;
|
||||
|
||||
scaleibuf->ftype = IMB_FTYPE_JPG;
|
||||
scaleibuf->foptions.quality = quality;
|
||||
/* unsupported feature only confuses other s/w */
|
||||
if (scaleibuf->planes == 32)
|
||||
scaleibuf->planes = 24;
|
||||
|
@ -1752,7 +1752,8 @@ static void seq_proxy_build_frame(const SeqRenderData *context, Sequence *seq, i
|
||||
/* depth = 32 is intentionally left in, otherwise ALPHA channels
|
||||
* won't work... */
|
||||
quality = seq->strip->proxy->quality;
|
||||
ibuf->ftype = JPG | quality;
|
||||
ibuf->ftype = IMB_FTYPE_JPG;
|
||||
ibuf->foptions.quality = quality;
|
||||
|
||||
/* unsupported feature only confuses other s/w */
|
||||
if (ibuf->planes == 32)
|
||||
|
@ -932,7 +932,7 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
|
||||
bool has_alpha = true;
|
||||
|
||||
if (ibuf) {
|
||||
int imtype = BKE_image_ftype_to_imtype(ibuf->ftype);
|
||||
int imtype = BKE_image_ftype_to_imtype(ibuf->ftype, &ibuf->foptions);
|
||||
char valid_channels = BKE_imtype_valid_channels(imtype, false);
|
||||
|
||||
has_alpha = (valid_channels & IMA_CHAN_FLAG_ALPHA) != 0;
|
||||
|
@ -1469,12 +1469,11 @@ static int save_image_options_init(SaveImageOptions *simopts, SpaceImage *sima,
|
||||
else {
|
||||
if (ima->source == IMA_SRC_GENERATED) {
|
||||
simopts->im_format.imtype = R_IMF_IMTYPE_PNG;
|
||||
simopts->im_format.compress = ibuf->foptions.quality;
|
||||
}
|
||||
else {
|
||||
BKE_imbuf_to_image_format(&simopts->im_format, ibuf);
|
||||
simopts->im_format.quality = ibuf->ftype & 0xff;
|
||||
}
|
||||
simopts->im_format.quality = ibuf->ftype & 0xff;
|
||||
}
|
||||
|
||||
simopts->im_format.planes = ibuf->planes;
|
||||
@ -1619,6 +1618,7 @@ static void save_imbuf_post(ImBuf *ibuf, ImBuf *colormanaged_ibuf)
|
||||
* original one, so file type of image is being properly updated.
|
||||
*/
|
||||
ibuf->ftype = colormanaged_ibuf->ftype;
|
||||
ibuf->foptions = colormanaged_ibuf->foptions;
|
||||
ibuf->planes = colormanaged_ibuf->planes;
|
||||
|
||||
IMB_freeImBuf(colormanaged_ibuf);
|
||||
|
@ -425,7 +425,7 @@ void Canvas::loadMap(const char *iFileName, const char *iMapName, unsigned int i
|
||||
stringstream filename;
|
||||
filename << base;
|
||||
filename << i << ".bmp";
|
||||
qtmp->ftype = BMP;
|
||||
qtmp->ftype = IMB_FTYPE_BMP;
|
||||
IMB_saveiff(qtmp, const_cast<char *>(filename.str().c_str()), 0);
|
||||
}
|
||||
|
||||
|
@ -268,7 +268,7 @@ void SteerableViewMap::saveSteerableViewMap() const
|
||||
//soc qtmp.save(base+QString::number(i)+"-"+QString::number(j)+".png", "PNG");
|
||||
filename << base;
|
||||
filename << i << "-" << j << ".png";
|
||||
ibuf->ftype = PNG;
|
||||
ibuf->ftype = IMB_FTYPE_PNG;
|
||||
IMB_saveiff(ibuf, const_cast<char *>(filename.str().c_str()), 0);
|
||||
}
|
||||
#if 0
|
||||
|
@ -677,7 +677,7 @@ int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, bool compare, boo
|
||||
}
|
||||
|
||||
#ifdef WITH_DDS
|
||||
if (ibuf->ftype & DDS)
|
||||
if (ibuf->ftype == IMB_FTYPE_DDS)
|
||||
GPU_create_gl_tex_compressed(bind, rect, rectw, recth, mipmap, ima, ibuf);
|
||||
else
|
||||
#endif
|
||||
|
@ -65,6 +65,80 @@ typedef struct DDSData {
|
||||
* Also; add new variables to the end to save pain!
|
||||
*
|
||||
*/
|
||||
|
||||
/* ibuf->ftype flag, main image types */
|
||||
enum eImbTypes {
|
||||
IMB_FTYPE_PNG = 1,
|
||||
IMB_FTYPE_TGA,
|
||||
IMB_FTYPE_JPG,
|
||||
IMB_FTYPE_BMP,
|
||||
IMB_FTYPE_OPENEXR,
|
||||
IMB_FTYPE_IMAGIC,
|
||||
#ifdef WITH_OPENIMAGEIO
|
||||
IMB_FTYPE_PSD,
|
||||
#endif
|
||||
#ifdef WITH_OPENJPEG
|
||||
IMB_FTYPE_JP2,
|
||||
#endif
|
||||
#ifdef WITH_HDR
|
||||
IMB_FTYPE_RADHDR,
|
||||
#endif
|
||||
#ifdef WITH_TIFF
|
||||
IMB_FTYPE_TIF,
|
||||
#endif
|
||||
#ifdef WITH_CINEON
|
||||
IMB_FTYPE_CINEON,
|
||||
IMB_FTYPE_DPX,
|
||||
#endif
|
||||
|
||||
#ifdef WITH_DDS
|
||||
IMB_FTYPE_DDS,
|
||||
#endif
|
||||
};
|
||||
|
||||
/* ibuf->foptions flag, type specific options.
|
||||
* Some formats include compression rations on some bits */
|
||||
|
||||
#define OPENEXR_HALF (1 << 8 )
|
||||
/* careful changing this, it's used in DNA as well */
|
||||
#define OPENEXR_COMPRESS (15)
|
||||
|
||||
#ifdef WITH_CINEON
|
||||
#define CINEON_LOG (1 << 8)
|
||||
#define CINEON_16BIT (1 << 7)
|
||||
#define CINEON_12BIT (1 << 6)
|
||||
#define CINEON_10BIT (1 << 5)
|
||||
#endif
|
||||
|
||||
#ifdef WITH_OPENJPEG
|
||||
#define JP2_12BIT (1 << 9)
|
||||
#define JP2_16BIT (1 << 8)
|
||||
#define JP2_YCC (1 << 7)
|
||||
#define JP2_CINE (1 << 6)
|
||||
#define JP2_CINE_48FPS (1 << 5)
|
||||
#define JP2_JP2 (1 << 4)
|
||||
#define JP2_J2K (1 << 3)
|
||||
#endif
|
||||
|
||||
#define PNG_16BIT (1 << 10)
|
||||
|
||||
#define RAWTGA 1
|
||||
|
||||
#define JPG_STD 0
|
||||
#define JPG_VID 1
|
||||
#define JPG_JST 2
|
||||
#define JPG_MAX 3
|
||||
#define JPG_MSK 0x03
|
||||
|
||||
#ifdef WITH_TIFF
|
||||
#define TIF_16BIT (1 << 8 )
|
||||
#endif
|
||||
|
||||
typedef struct ImbFormatOptions {
|
||||
short flag;
|
||||
char quality; /* quality serves dual purpose as quality number for jpeg or compression amount for png */
|
||||
} ImbFormatOptions;
|
||||
|
||||
typedef struct ImBuf {
|
||||
struct ImBuf *next, *prev; /**< allow lists of ImBufs, for caches or flipbooks */
|
||||
|
||||
@ -113,7 +187,8 @@ typedef struct ImBuf {
|
||||
void *userdata; /* temporary storage */
|
||||
|
||||
/* file information */
|
||||
int ftype; /* file type we are going to save as */
|
||||
enum eImbTypes ftype; /* file type we are going to save as */
|
||||
ImbFormatOptions foptions; /* file format specific flags */
|
||||
char name[IB_FILENAME_SIZE]; /* filename associated with this image */
|
||||
char cachename[IB_FILENAME_SIZE]; /* full filename used for reading from cache */
|
||||
|
||||
@ -175,73 +250,6 @@ typedef struct ImBuf {
|
||||
#define IB_thumbnail (1 << 15)
|
||||
#define IB_multiview (1 << 16)
|
||||
|
||||
/*
|
||||
* The bit flag is stored in the ImBuf.ftype variable.
|
||||
* Note that the lower 11 bits is used for storing custom flags
|
||||
*/
|
||||
#define IB_CUSTOM_FLAGS_MASK 0x7ff
|
||||
|
||||
#ifdef WITH_OPENIMAGEIO
|
||||
#define PSD (1 << 31)
|
||||
#endif
|
||||
|
||||
#define PNG (1 << 30)
|
||||
#define TGA (1 << 28)
|
||||
#define JPG (1 << 27)
|
||||
#define BMP (1 << 26)
|
||||
|
||||
#ifdef WITH_QUICKTIME
|
||||
#define QUICKTIME (1 << 25)
|
||||
#endif
|
||||
|
||||
#ifdef WITH_HDR
|
||||
#define RADHDR (1 << 24)
|
||||
#endif
|
||||
#ifdef WITH_TIFF
|
||||
#define TIF (1 << 23)
|
||||
#define TIF_16BIT (1 << 8 )
|
||||
#endif
|
||||
|
||||
#define OPENEXR (1 << 22)
|
||||
#define OPENEXR_HALF (1 << 8 )
|
||||
#define OPENEXR_COMPRESS (15)
|
||||
|
||||
#ifdef WITH_CINEON
|
||||
#define CINEON (1 << 21)
|
||||
#define DPX (1 << 20)
|
||||
#define CINEON_LOG (1 << 8)
|
||||
#define CINEON_16BIT (1 << 7)
|
||||
#define CINEON_12BIT (1 << 6)
|
||||
#define CINEON_10BIT (1 << 5)
|
||||
#endif
|
||||
|
||||
#ifdef WITH_DDS
|
||||
#define DDS (1 << 19)
|
||||
#endif
|
||||
|
||||
#ifdef WITH_OPENJPEG
|
||||
#define JP2 (1 << 18)
|
||||
#define JP2_12BIT (1 << 17)
|
||||
#define JP2_16BIT (1 << 16)
|
||||
#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 PNG_16BIT (1 << 10)
|
||||
|
||||
#define RAWTGA (TGA | 1)
|
||||
|
||||
#define JPG_STD (JPG | (0 << 8))
|
||||
#define JPG_VID (JPG | (1 << 8))
|
||||
#define JPG_JST (JPG | (2 << 8))
|
||||
#define JPG_MAX (JPG | (3 << 8))
|
||||
#define JPG_MSK (0xffffff00)
|
||||
|
||||
#define IMAGIC 0732
|
||||
|
||||
/**
|
||||
* \name Imbuf preset profile tags
|
||||
* \brief Some predefined color space profiles that 8 bit imbufs can represent
|
||||
|
@ -409,7 +409,8 @@ ImBuf *IMB_allocImBuf(unsigned int x, unsigned int y, uchar planes, unsigned int
|
||||
ibuf->x = x;
|
||||
ibuf->y = y;
|
||||
ibuf->planes = planes;
|
||||
ibuf->ftype = PNG | 15; /* the 15 means, set compression to low ratio but not time consuming */
|
||||
ibuf->ftype = IMB_FTYPE_PNG;
|
||||
ibuf->foptions.quality = 15; /* the 15 means, set compression to low ratio but not time consuming */
|
||||
ibuf->channels = 4; /* float option, is set to other values when buffers get assigned */
|
||||
ibuf->ppm[0] = ibuf->ppm[1] = IMB_DPI_DEFAULT / 0.0254f; /* IMB_DPI_DEFAULT -> pixels-per-meter */
|
||||
|
||||
|
@ -271,7 +271,7 @@ struct ImBuf *imb_bmp_decode(const unsigned char *mem, size_t size, int flags, c
|
||||
if (ibuf) {
|
||||
ibuf->ppm[0] = xppm;
|
||||
ibuf->ppm[1] = yppm;
|
||||
ibuf->ftype = BMP;
|
||||
ibuf->ftype = IMB_FTYPE_BMP;
|
||||
}
|
||||
|
||||
return(ibuf);
|
||||
|
@ -86,7 +86,7 @@ static struct ImBuf *imb_load_dpx_cineon(
|
||||
}
|
||||
|
||||
logImageClose(image);
|
||||
ibuf->ftype = use_cineon ? CINEON : DPX;
|
||||
ibuf->ftype = use_cineon ? IMB_FTYPE_CINEON : IMB_FTYPE_DPX;
|
||||
|
||||
if (flags & IB_alphamode_detect)
|
||||
ibuf->flags |= IB_alphamode_premul;
|
||||
@ -115,17 +115,17 @@ static int imb_save_dpx_cineon(ImBuf *ibuf, const char *filename, int use_cineon
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ibuf->ftype & CINEON_10BIT)
|
||||
if (ibuf->foptions.flag & CINEON_10BIT)
|
||||
bitspersample = 10;
|
||||
else if (ibuf->ftype & CINEON_12BIT)
|
||||
else if (ibuf->foptions.flag & CINEON_12BIT)
|
||||
bitspersample = 12;
|
||||
else if (ibuf->ftype & CINEON_16BIT)
|
||||
else if (ibuf->foptions.flag & CINEON_16BIT)
|
||||
bitspersample = 16;
|
||||
else
|
||||
bitspersample = 8;
|
||||
|
||||
logImage = logImageCreate(filename, use_cineon, ibuf->x, ibuf->y, bitspersample, (depth == 4),
|
||||
(ibuf->ftype & CINEON_LOG), -1, -1, -1, "Blender");
|
||||
(ibuf->foptions.flag & CINEON_LOG), -1, -1, -1, "Blender");
|
||||
|
||||
if (logImage == NULL) {
|
||||
printf("DPX/Cineon: error creating file.\n");
|
||||
|
@ -1958,7 +1958,7 @@ ImBuf *IMB_colormanagement_imbuf_for_write(ImBuf *ibuf, bool save_as_render, boo
|
||||
* should be pretty safe since this image buffer is supposed to be used for
|
||||
* saving only and ftype would be overwritten a bit later by BKE_imbuf_write
|
||||
*/
|
||||
colormanaged_ibuf->ftype = BKE_image_imtype_to_ftype(image_format_data->imtype);
|
||||
colormanaged_ibuf->ftype = BKE_image_imtype_to_ftype(image_format_data->imtype, &colormanaged_ibuf->foptions);
|
||||
|
||||
/* if file format isn't able to handle float buffer itself,
|
||||
* we need to allocate byte buffer and store color managed
|
||||
|
@ -142,7 +142,7 @@ struct ImBuf *imb_load_dds(const unsigned char *mem, size_t size, int flags, cha
|
||||
ibuf = IMB_allocImBuf(dds.width(), dds.height(), bits_per_pixel, 0);
|
||||
if (ibuf == 0) return(0); /* memory allocation failed */
|
||||
|
||||
ibuf->ftype = DDS;
|
||||
ibuf->ftype = IMB_FTYPE_DDS;
|
||||
ibuf->dds_data.fourcc = dds.fourCC();
|
||||
ibuf->dds_data.nummipmaps = dds.mipmapCount();
|
||||
|
||||
|
@ -53,41 +53,41 @@
|
||||
|
||||
static int imb_ftype_default(const ImFileType *type, ImBuf *ibuf)
|
||||
{
|
||||
return (ibuf->ftype & type->filetype);
|
||||
return (ibuf->ftype == type->filetype);
|
||||
}
|
||||
static int imb_ftype_iris(const ImFileType *type, ImBuf *ibuf)
|
||||
{
|
||||
(void)type;
|
||||
return (ibuf->ftype == IMAGIC);
|
||||
return (ibuf->ftype == IMB_FTYPE_IMAGIC);
|
||||
}
|
||||
|
||||
const ImFileType IMB_FILE_TYPES[] = {
|
||||
{NULL, NULL, imb_is_a_jpeg, NULL, imb_ftype_default, imb_load_jpeg, NULL, imb_savejpeg, NULL, 0, JPG, COLOR_ROLE_DEFAULT_BYTE},
|
||||
{NULL, NULL, imb_is_a_png, NULL, imb_ftype_default, imb_loadpng, NULL, imb_savepng, NULL, 0, PNG, COLOR_ROLE_DEFAULT_BYTE},
|
||||
{NULL, NULL, imb_is_a_bmp, NULL, imb_ftype_default, imb_bmp_decode, NULL, imb_savebmp, NULL, 0, BMP, COLOR_ROLE_DEFAULT_BYTE},
|
||||
{NULL, NULL, imb_is_a_targa, NULL, imb_ftype_default, imb_loadtarga, NULL, imb_savetarga, NULL, 0, TGA, COLOR_ROLE_DEFAULT_BYTE},
|
||||
{NULL, NULL, imb_is_a_iris, NULL, imb_ftype_iris, imb_loadiris, NULL, imb_saveiris, NULL, 0, IMAGIC, COLOR_ROLE_DEFAULT_BYTE},
|
||||
{NULL, NULL, imb_is_a_jpeg, NULL, imb_ftype_default, imb_load_jpeg, NULL, imb_savejpeg, NULL, 0, IMB_FTYPE_JPG, COLOR_ROLE_DEFAULT_BYTE},
|
||||
{NULL, NULL, imb_is_a_png, NULL, imb_ftype_default, imb_loadpng, NULL, imb_savepng, NULL, 0, IMB_FTYPE_PNG, COLOR_ROLE_DEFAULT_BYTE},
|
||||
{NULL, NULL, imb_is_a_bmp, NULL, imb_ftype_default, imb_bmp_decode, NULL, imb_savebmp, NULL, 0, IMB_FTYPE_BMP, COLOR_ROLE_DEFAULT_BYTE},
|
||||
{NULL, NULL, imb_is_a_targa, NULL, imb_ftype_default, imb_loadtarga, NULL, imb_savetarga, NULL, 0, IMB_FTYPE_TGA, COLOR_ROLE_DEFAULT_BYTE},
|
||||
{NULL, NULL, imb_is_a_iris, NULL, imb_ftype_iris, imb_loadiris, NULL, imb_saveiris, NULL, 0, IMB_FTYPE_IMAGIC, COLOR_ROLE_DEFAULT_BYTE},
|
||||
#ifdef WITH_CINEON
|
||||
{NULL, NULL, imb_is_dpx, NULL, imb_ftype_default, imb_load_dpx, NULL, imb_save_dpx, NULL, IM_FTYPE_FLOAT, DPX, COLOR_ROLE_DEFAULT_FLOAT},
|
||||
{NULL, NULL, imb_is_cineon, NULL, imb_ftype_default, imb_load_cineon, NULL, imb_save_cineon, NULL, IM_FTYPE_FLOAT, CINEON, COLOR_ROLE_DEFAULT_FLOAT},
|
||||
{NULL, NULL, imb_is_dpx, NULL, imb_ftype_default, imb_load_dpx, NULL, imb_save_dpx, NULL, IM_FTYPE_FLOAT, IMB_FTYPE_DPX, COLOR_ROLE_DEFAULT_FLOAT},
|
||||
{NULL, NULL, imb_is_cineon, NULL, imb_ftype_default, imb_load_cineon, NULL, imb_save_cineon, NULL, IM_FTYPE_FLOAT, IMB_FTYPE_CINEON, COLOR_ROLE_DEFAULT_FLOAT},
|
||||
#endif
|
||||
#ifdef WITH_TIFF
|
||||
{imb_inittiff, NULL, imb_is_a_tiff, NULL, imb_ftype_default, imb_loadtiff, NULL, imb_savetiff, imb_loadtiletiff, 0, TIF, COLOR_ROLE_DEFAULT_BYTE},
|
||||
{imb_inittiff, NULL, imb_is_a_tiff, NULL, imb_ftype_default, imb_loadtiff, NULL, imb_savetiff, imb_loadtiletiff, 0, IMB_FTYPE_TIF, COLOR_ROLE_DEFAULT_BYTE},
|
||||
#endif
|
||||
#ifdef WITH_HDR
|
||||
{NULL, NULL, imb_is_a_hdr, NULL, imb_ftype_default, imb_loadhdr, NULL, imb_savehdr, NULL, IM_FTYPE_FLOAT, RADHDR, COLOR_ROLE_DEFAULT_FLOAT},
|
||||
{NULL, NULL, imb_is_a_hdr, NULL, imb_ftype_default, imb_loadhdr, NULL, imb_savehdr, NULL, IM_FTYPE_FLOAT, IMB_FTYPE_RADHDR, COLOR_ROLE_DEFAULT_FLOAT},
|
||||
#endif
|
||||
#ifdef WITH_OPENEXR
|
||||
{imb_initopenexr, NULL, imb_is_a_openexr, NULL, imb_ftype_default, imb_load_openexr, NULL, imb_save_openexr, NULL, IM_FTYPE_FLOAT, OPENEXR, COLOR_ROLE_DEFAULT_FLOAT},
|
||||
{imb_initopenexr, NULL, imb_is_a_openexr, NULL, imb_ftype_default, imb_load_openexr, NULL, imb_save_openexr, NULL, IM_FTYPE_FLOAT, IMB_FTYPE_OPENEXR, COLOR_ROLE_DEFAULT_FLOAT},
|
||||
#endif
|
||||
#ifdef WITH_OPENJPEG
|
||||
{NULL, NULL, imb_is_a_jp2, NULL, imb_ftype_default, imb_jp2_decode, NULL, imb_savejp2, NULL, IM_FTYPE_FLOAT, JP2, COLOR_ROLE_DEFAULT_BYTE},
|
||||
{NULL, NULL, imb_is_a_jp2, NULL, imb_ftype_default, imb_jp2_decode, NULL, imb_savejp2, NULL, IM_FTYPE_FLOAT, IMB_FTYPE_JP2, COLOR_ROLE_DEFAULT_BYTE},
|
||||
#endif
|
||||
#ifdef WITH_DDS
|
||||
{NULL, NULL, imb_is_a_dds, NULL, imb_ftype_default, imb_load_dds, NULL, NULL, NULL, 0, DDS, COLOR_ROLE_DEFAULT_BYTE},
|
||||
{NULL, NULL, imb_is_a_dds, NULL, imb_ftype_default, imb_load_dds, NULL, NULL, NULL, 0, IMB_FTYPE_DDS, COLOR_ROLE_DEFAULT_BYTE},
|
||||
#endif
|
||||
#ifdef WITH_OPENIMAGEIO
|
||||
{NULL, NULL, NULL, imb_is_a_photoshop, imb_ftype_default, NULL, imb_load_photoshop, NULL, NULL, IM_FTYPE_FLOAT, PSD, COLOR_ROLE_DEFAULT_FLOAT},
|
||||
{NULL, NULL, NULL, imb_is_a_photoshop, imb_ftype_default, NULL, imb_load_photoshop, NULL, NULL, IM_FTYPE_FLOAT, IMB_FTYPE_PSD, COLOR_ROLE_DEFAULT_FLOAT},
|
||||
#endif
|
||||
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0}
|
||||
};
|
||||
|
@ -45,6 +45,8 @@
|
||||
#include "IMB_colormanagement.h"
|
||||
#include "IMB_colormanagement_intern.h"
|
||||
|
||||
#define IMAGIC 0732
|
||||
|
||||
typedef struct {
|
||||
unsigned short imagic; /* stuff saved on disk . . */
|
||||
unsigned short type;
|
||||
@ -299,7 +301,7 @@ struct ImBuf *imb_loadiris(const unsigned char *mem, size_t size, int flags, cha
|
||||
|
||||
if (flags & IB_test) {
|
||||
ibuf = IMB_allocImBuf(image.xsize, image.ysize, 8 * image.zsize, 0);
|
||||
if (ibuf) ibuf->ftype = IMAGIC;
|
||||
if (ibuf) ibuf->ftype = IMB_FTYPE_IMAGIC;
|
||||
return(ibuf);
|
||||
}
|
||||
|
||||
@ -526,7 +528,7 @@ struct ImBuf *imb_loadiris(const unsigned char *mem, size_t size, int flags, cha
|
||||
|
||||
}
|
||||
|
||||
ibuf->ftype = IMAGIC;
|
||||
ibuf->ftype = IMB_FTYPE_IMAGIC;
|
||||
|
||||
test_endian_zbuf(ibuf);
|
||||
|
||||
@ -701,7 +703,7 @@ static int output_iris(unsigned int *lptr, int xsize, int ysize, int zsize, cons
|
||||
lumbuf = (unsigned int *)MEM_mallocN(xsize * sizeof(int), "iris lumbuf");
|
||||
|
||||
memset(image, 0, sizeof(IMAGE));
|
||||
image->imagic = IMAGIC;
|
||||
image->imagic = IMB_FTYPE_IMAGIC;
|
||||
image->type = RLE(1);
|
||||
if (zsize > 1)
|
||||
image->dim = 3;
|
||||
|
@ -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");
|
||||
|
@ -55,10 +55,10 @@
|
||||
#include "IMB_colormanagement_intern.h"
|
||||
|
||||
// #define IS_jpg(x) (x->ftype & JPG) // UNUSED
|
||||
#define IS_stdjpg(x) ((x->ftype & JPG_MSK) == JPG_STD)
|
||||
// #define IS_vidjpg(x) ((x->ftype & JPG_MSK) == JPG_VID) // UNUSED
|
||||
#define IS_jstjpg(x) ((x->ftype & JPG_MSK) == JPG_JST)
|
||||
#define IS_maxjpg(x) ((x->ftype & JPG_MSK) == JPG_MAX)
|
||||
#define IS_stdjpg(x) ((x->foptions.flag & JPG_MSK) == JPG_STD)
|
||||
// #define IS_vidjpg(x) ((x->foptions & JPG_MSK) == JPG_VID) // UNUSED
|
||||
#define IS_jstjpg(x) ((x->foptions.flag & JPG_MSK) == JPG_JST)
|
||||
#define IS_maxjpg(x) ((x->foptions.flag & JPG_MSK) == JPG_MAX)
|
||||
|
||||
/* the types are from the jpeg lib */
|
||||
static void jpeg_error(j_common_ptr cinfo) ATTR_NORETURN;
|
||||
@ -85,7 +85,7 @@ static ImBuf *ibJpegImageFromCinfo(struct jpeg_decompress_struct *cinfo, int fla
|
||||
*/
|
||||
|
||||
static int jpeg_default_quality;
|
||||
static int ibuf_ftype;
|
||||
static int ibuf_foptions;
|
||||
|
||||
int imb_is_a_jpeg(const unsigned char *mem)
|
||||
{
|
||||
@ -269,8 +269,8 @@ static boolean handle_app1(j_decompress_ptr cinfo)
|
||||
if (length < 16) {
|
||||
for (i = 0; i < length; i++) INPUT_BYTE(cinfo, neogeo[i], return false);
|
||||
length = 0;
|
||||
if (STREQLEN(neogeo, "NeoGeo", 6)) memcpy(&ibuf_ftype, neogeo + 6, 4);
|
||||
ibuf_ftype = BIG_LONG(ibuf_ftype);
|
||||
if (STREQLEN(neogeo, "NeoGeo", 6)) memcpy(&ibuf_foptions, neogeo + 6, 4);
|
||||
ibuf_foptions = BIG_LONG(ibuf_foptions);
|
||||
}
|
||||
INPUT_SYNC(cinfo); /* do before skip_input_data */
|
||||
if (length > 0) (*cinfo->src->skip_input_data)(cinfo, length);
|
||||
@ -290,7 +290,7 @@ static ImBuf *ibJpegImageFromCinfo(struct jpeg_decompress_struct *cinfo, int fla
|
||||
char *str, *key, *value;
|
||||
|
||||
/* install own app1 handler */
|
||||
ibuf_ftype = 0;
|
||||
ibuf_foptions = 0;
|
||||
jpeg_set_marker_processor(cinfo, 0xe1, handle_app1);
|
||||
cinfo->dct_method = JDCT_FLOAT;
|
||||
jpeg_save_markers(cinfo, JPEG_COM, 0xffff);
|
||||
@ -304,11 +304,11 @@ static ImBuf *ibJpegImageFromCinfo(struct jpeg_decompress_struct *cinfo, int fla
|
||||
|
||||
jpeg_start_decompress(cinfo);
|
||||
|
||||
if (ibuf_ftype == 0) {
|
||||
ibuf_ftype = JPG_STD;
|
||||
if (ibuf_foptions == 0) {
|
||||
ibuf_foptions = JPG_STD;
|
||||
if (cinfo->max_v_samp_factor == 1) {
|
||||
if (cinfo->max_h_samp_factor == 1) ibuf_ftype = JPG_MAX;
|
||||
else ibuf_ftype = JPG_VID;
|
||||
if (cinfo->max_h_samp_factor == 1) ibuf_foptions = JPG_MAX;
|
||||
else ibuf_foptions = JPG_VID;
|
||||
}
|
||||
}
|
||||
|
||||
@ -435,7 +435,8 @@ next_stamp_marker:
|
||||
|
||||
jpeg_destroy((j_common_ptr) cinfo);
|
||||
if (ibuf) {
|
||||
ibuf->ftype = ibuf_ftype;
|
||||
ibuf->ftype = IMB_FTYPE_JPG;
|
||||
ibuf->foptions.flag = ibuf_foptions;
|
||||
}
|
||||
}
|
||||
|
||||
@ -485,9 +486,9 @@ static void write_jpeg(struct jpeg_compress_struct *cinfo, struct ImBuf *ibuf)
|
||||
jpeg_start_compress(cinfo, true);
|
||||
|
||||
strcpy(neogeo, "NeoGeo");
|
||||
ibuf_ftype = BIG_LONG(ibuf->ftype);
|
||||
ibuf_foptions = BIG_LONG((((int)ibuf->foptions.flag) << 8) | (int)ibuf->foptions.quality);
|
||||
|
||||
memcpy(neogeo + 6, &ibuf_ftype, 4);
|
||||
memcpy(neogeo + 6, &ibuf_foptions, 4);
|
||||
jpeg_write_marker(cinfo, 0xe1, (JOCTET *) neogeo, 10);
|
||||
|
||||
if (ibuf->metadata) {
|
||||
@ -562,7 +563,7 @@ static int init_jpeg(FILE *outfile, struct jpeg_compress_struct *cinfo, struct I
|
||||
{
|
||||
int quality;
|
||||
|
||||
quality = ibuf->ftype & 0xff;
|
||||
quality = ibuf->foptions.quality;
|
||||
if (quality <= 0) quality = jpeg_default_quality;
|
||||
if (quality > 100) quality = 100;
|
||||
|
||||
@ -687,6 +688,7 @@ static int save_jstjpeg(const char *name, struct ImBuf *ibuf)
|
||||
|
||||
tbuf = IMB_allocImBuf(ibuf->x, ibuf->y / 2, 24, IB_rect);
|
||||
tbuf->ftype = ibuf->ftype;
|
||||
tbuf->foptions = ibuf->foptions;
|
||||
tbuf->flags = ibuf->flags;
|
||||
|
||||
oldy = ibuf->y;
|
||||
|
@ -268,7 +268,7 @@ struct ImBuf *imb_load_photoshop(const char *filename, int flags, char colorspac
|
||||
return NULL;
|
||||
|
||||
/* ImBuf always needs 4 channels */
|
||||
ibuf->ftype = PSD;
|
||||
ibuf->ftype = IMB_FTYPE_PSD;
|
||||
ibuf->channels = 4;
|
||||
ibuf->planes = (3 + (is_alpha ? 1 : 0)) * 4 << basesize;
|
||||
|
||||
|
@ -391,7 +391,7 @@ static bool imb_save_openexr_half(ImBuf *ibuf, const char *name, const int flags
|
||||
{
|
||||
Header header(width, height);
|
||||
|
||||
openexr_header_compression(&header, ibuf->ftype & OPENEXR_COMPRESS);
|
||||
openexr_header_compression(&header, ibuf->foptions.flag & OPENEXR_COMPRESS);
|
||||
openexr_header_metadata(&header, ibuf);
|
||||
|
||||
/* create views when possible */
|
||||
@ -508,7 +508,7 @@ static bool imb_save_openexr_float(ImBuf *ibuf, const char *name, const int flag
|
||||
{
|
||||
Header header(width, height);
|
||||
|
||||
openexr_header_compression(&header, ibuf->ftype & OPENEXR_COMPRESS);
|
||||
openexr_header_compression(&header, ibuf->foptions.flag & OPENEXR_COMPRESS);
|
||||
openexr_header_metadata(&header, ibuf);
|
||||
|
||||
/* create views when possible */
|
||||
@ -580,7 +580,7 @@ int imb_save_openexr(struct ImBuf *ibuf, const char *name, int flags)
|
||||
return(0);
|
||||
}
|
||||
|
||||
if (ibuf->ftype & OPENEXR_HALF)
|
||||
if (ibuf->foptions.flag & OPENEXR_HALF)
|
||||
return (int) imb_save_openexr_half(ibuf, name, flags, 1, NULL, NULL);
|
||||
else {
|
||||
/* when no float rect, we save as half (16 bits is sufficient) */
|
||||
@ -602,7 +602,7 @@ static bool imb_save_openexr_multiview(ImBuf *ibuf, const char *name, const int
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ibuf->ftype & OPENEXR_HALF)
|
||||
if (ibuf->foptions.flag & OPENEXR_HALF)
|
||||
return imb_save_openexr_half(ibuf, name, flags, totviews, getview, getbuffer);
|
||||
else {
|
||||
/* when no float rect, we save as half (16 bits is sufficient) */
|
||||
@ -1944,7 +1944,7 @@ struct ImBuf *imb_load_openexr(const unsigned char *mem, size_t size, int flags,
|
||||
ibuf->ppm[1] = ibuf->ppm[0] * (double)file->header(0).pixelAspectRatio();
|
||||
}
|
||||
|
||||
ibuf->ftype = OPENEXR;
|
||||
ibuf->ftype = IMB_FTYPE_OPENEXR;
|
||||
|
||||
if (!(flags & IB_test)) {
|
||||
|
||||
|
@ -140,7 +140,7 @@ int imb_savepng(struct ImBuf *ibuf, const char *name, int flags)
|
||||
int i, bytesperpixel, color_type = PNG_COLOR_TYPE_GRAY;
|
||||
FILE *fp = NULL;
|
||||
|
||||
bool is_16bit = (ibuf->ftype & PNG_16BIT) != 0;
|
||||
bool is_16bit = (ibuf->foptions.flag & PNG_16BIT) != 0;
|
||||
bool has_float = (ibuf->rect_float != NULL);
|
||||
int channels_in_float = ibuf->channels ? ibuf->channels : 4;
|
||||
|
||||
@ -149,7 +149,7 @@ int imb_savepng(struct ImBuf *ibuf, const char *name, int flags)
|
||||
|
||||
/* use the jpeg quality setting for compression */
|
||||
int compression;
|
||||
compression = (int)(((float)(ibuf->ftype & 0xff) / 11.1111f));
|
||||
compression = (int)(((float)(ibuf->foptions.quality) / 11.1111f));
|
||||
compression = compression < 0 ? 0 : (compression > 9 ? 9 : compression);
|
||||
|
||||
if (ibuf->float_colorspace) {
|
||||
@ -606,9 +606,9 @@ ImBuf *imb_loadpng(const unsigned char *mem, size_t size, int flags, char colors
|
||||
ibuf = IMB_allocImBuf(width, height, 8 * bytesperpixel, 0);
|
||||
|
||||
if (ibuf) {
|
||||
ibuf->ftype = PNG;
|
||||
ibuf->ftype = IMB_FTYPE_PNG;
|
||||
if (bit_depth == 16)
|
||||
ibuf->ftype |= PNG_16BIT;
|
||||
ibuf->foptions.flag |= PNG_16BIT;
|
||||
|
||||
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_pHYs)) {
|
||||
int unit_type;
|
||||
|
@ -241,7 +241,7 @@ struct ImBuf *imb_loadhdr(const unsigned char *mem, size_t size, int flags, char
|
||||
else ibuf = IMB_allocImBuf(width, height, 32, (flags & IB_rect) | IB_rectfloat);
|
||||
|
||||
if (ibuf == NULL) return NULL;
|
||||
ibuf->ftype = RADHDR;
|
||||
ibuf->ftype = IMB_FTYPE_RADHDR;
|
||||
|
||||
if (flags & IB_alphamode_detect)
|
||||
ibuf->flags |= IB_alphamode_premul;
|
||||
|
@ -264,7 +264,7 @@ int imb_savetarga(struct ImBuf *ibuf, const char *name, int flags)
|
||||
buf[2] = 11;
|
||||
}
|
||||
|
||||
if (ibuf->ftype == RAWTGA) buf[2] &= ~8;
|
||||
if (ibuf->foptions.flag & RAWTGA) buf[2] &= ~8;
|
||||
|
||||
buf[8] = 0;
|
||||
buf[9] = 0;
|
||||
@ -289,7 +289,7 @@ int imb_savetarga(struct ImBuf *ibuf, const char *name, int flags)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ibuf->ftype == RAWTGA) {
|
||||
if (ibuf->foptions.flag & RAWTGA) {
|
||||
ok = dumptarga(ibuf, fildes);
|
||||
}
|
||||
else {
|
||||
@ -568,7 +568,9 @@ ImBuf *imb_loadtarga(const unsigned char *mem, size_t mem_size, int flags, char
|
||||
else ibuf = IMB_allocImBuf(tga.xsize, tga.ysize, (tga.pixsize + 0x7) & ~0x7, IB_rect);
|
||||
|
||||
if (ibuf == NULL) return NULL;
|
||||
ibuf->ftype = (tga.imgtyp < 4) ? RAWTGA : TGA;
|
||||
ibuf->ftype = IMB_FTYPE_TGA;
|
||||
if (tga.imgtyp < 4)
|
||||
ibuf->foptions.flag |= RAWTGA;
|
||||
mem = mem + 18 + tga.numid;
|
||||
|
||||
cp[0] = 0xff;
|
||||
|
@ -439,7 +439,7 @@ static ImBuf *thumb_create_ex(
|
||||
IMB_metadata_change_field(img, "Thumb::Image::Width", cwidth);
|
||||
IMB_metadata_change_field(img, "Thumb::Image::Height", cheight);
|
||||
}
|
||||
img->ftype = PNG;
|
||||
img->ftype = IMB_FTYPE_PNG;
|
||||
img->planes = 32;
|
||||
|
||||
if (IMB_saveiff(img, temp, IB_rect | IB_metadata)) {
|
||||
|
@ -559,7 +559,7 @@ ImBuf *imb_loadtiff(const unsigned char *mem, size_t size, int flags, char color
|
||||
|
||||
ibuf = IMB_allocImBuf(width, height, ib_depth, 0);
|
||||
if (ibuf) {
|
||||
ibuf->ftype = TIF;
|
||||
ibuf->ftype = IMB_FTYPE_TIF;
|
||||
}
|
||||
else {
|
||||
fprintf(stderr,
|
||||
@ -720,7 +720,7 @@ int imb_savetiff(ImBuf *ibuf, const char *name, int flags)
|
||||
return (0);
|
||||
}
|
||||
|
||||
if ((ibuf->ftype & TIF_16BIT) && ibuf->rect_float)
|
||||
if ((ibuf->foptions.flag & TIF_16BIT) && ibuf->rect_float)
|
||||
bitspersample = 16;
|
||||
else
|
||||
bitspersample = 8;
|
||||
|
@ -212,7 +212,7 @@ int IMB_ispic_type(const char *name)
|
||||
|
||||
/* XXX move this exception */
|
||||
if ((BIG_LONG(((int *)buf)[0]) & 0xfffffff0) == 0xffd8ffe0)
|
||||
return JPG;
|
||||
return IMB_FTYPE_JPG;
|
||||
|
||||
for (type = IMB_FILE_TYPES; type < IMB_FILE_TYPES_LAST; type++) {
|
||||
if (type->is_a) {
|
||||
|
@ -211,7 +211,7 @@ static int rna_Image_file_format_get(PointerRNA *ptr)
|
||||
{
|
||||
Image *image = (Image *)ptr->data;
|
||||
ImBuf *ibuf = BKE_image_acquire_ibuf(image, NULL, NULL);
|
||||
int imtype = BKE_image_ftype_to_imtype(ibuf ? ibuf->ftype : 0);
|
||||
int imtype = BKE_image_ftype_to_imtype(ibuf ? ibuf->ftype : 0, ibuf ? &ibuf->foptions : NULL);
|
||||
|
||||
BKE_image_release_ibuf(image, ibuf, NULL);
|
||||
|
||||
@ -222,8 +222,9 @@ static void rna_Image_file_format_set(PointerRNA *ptr, int value)
|
||||
{
|
||||
Image *image = (Image *)ptr->data;
|
||||
if (BKE_imtype_is_movie(value) == 0) { /* should be able to throw an error here */
|
||||
int ftype = BKE_image_imtype_to_ftype(value);
|
||||
BKE_image_file_format_set(image, ftype);
|
||||
ImbFormatOptions options;
|
||||
int ftype = BKE_image_imtype_to_ftype(value, &options);
|
||||
BKE_image_file_format_set(image, ftype, &options);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -170,7 +170,7 @@ bool BL_Texture::InitFromImage(int unit, Image *img, bool mipmap)
|
||||
glGenTextures(1, (GLuint*)&mTexture);
|
||||
|
||||
#ifdef WITH_DDS
|
||||
if (ibuf->ftype & DDS)
|
||||
if (ibuf->ftype == IMB_FTYPE_DDS)
|
||||
InitGLCompressedTex(ibuf, mipmap);
|
||||
else
|
||||
InitGLTex(ibuf->rect, ibuf->x, ibuf->y, mipmap);
|
||||
|
Loading…
Reference in New Issue
Block a user