Commit: fdf24d8899e1d8704cea97ce334c5c642681c4ec Author: Antony Riakiotakis Date: Fri Aug 14 15:18:46 2015 +0200 Branches: KTX_support https://developer.blender.org/rBfdf24d8899e1d8704cea97ce334c5c642681c4ec
Merge branch 'master' into KTX_support Conflicts: source/blender/blenkernel/BKE_image.h source/blender/blenkernel/intern/dynamicpaint.c source/blender/blenkernel/intern/image.c source/blender/blenkernel/intern/movieclip.c source/blender/blenkernel/intern/sequencer.c source/blender/editors/space_image/image_buttons.c source/blender/editors/space_image/image_ops.c source/blender/gpu/intern/gpu_draw.c source/blender/imbuf/IMB_imbuf_types.h source/blender/imbuf/intern/allocimbuf.c source/blender/imbuf/intern/cineon/cineon_dpx.c source/blender/imbuf/intern/jp2.c source/blender/imbuf/intern/jpeg.c source/blender/imbuf/intern/openexr/openexr_api.cpp source/blender/imbuf/intern/png.c source/blender/imbuf/intern/targa.c source/blender/imbuf/intern/tiff.c source/blender/makesrna/intern/rna_image.c source/gameengine/Ketsji/BL_Texture.cpp =================================================================== =================================================================== diff --cc source/blender/blenkernel/intern/image.c index 87e1db6,ef760f2..7f9a35e --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@@ -1208,24 -1207,26 +1207,25 @@@ void BKE_image_all_free_anim_ibufs(int /* *********** READ AND WRITE ************** */ -- - int BKE_image_imtype_to_ftype(const char imtype, int *r_options) + 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; + return IMB_FTYPE_TGA; else if (imtype == R_IMF_IMTYPE_RAWTGA) { - *r_options = RAWTGA; - return TGA; + 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) { - *r_options = 15; - return PNG; + r_options->quality = 15; + return IMB_FTYPE_PNG; } #ifdef WITH_DDS else if (imtype == R_IMF_IMTYPE_DDS) @@@ -1292,13 -1293,9 +1292,13 @@@ char BKE_image_ftype_to_imtype(const in return R_IMF_IMTYPE_TARGA; } #ifdef WITH_OPENJPEG - else if (ftype == JP2) + else if (ftype == IMB_FTYPE_JP2) return R_IMF_IMTYPE_JP2; #endif +#ifdef WITH_KTX - else if (ftype == KTX) ++ else if (ftype == IMB_FTYPE_KTX) + return R_IMF_IMTYPE_KTX; +#endif else return R_IMF_IMTYPE_JPEG90; } @@@ -1701,14 -1694,9 +1704,14 @@@ void BKE_imbuf_to_image_format(struct I } #endif +#ifdef WITH_KTX - else if (ftype == KTX) { ++ else if (ftype == IMB_FTYPE_KTX) { + im_format->imtype = R_IMF_IMTYPE_KTX; + } +#endif else { im_format->imtype = R_IMF_IMTYPE_JPEG90; - im_format->quality = custom_flags & ~JPG_MSK; + im_format->quality = quality; } /* planes */ @@@ -2288,11 -2290,6 +2305,11 @@@ void BKE_imbuf_write_prepare(ImBuf *ibu BLI_assert(!"Unsupported jp2 codec was specified in im_format->jp2_codec"); } #endif +#ifdef WITH_KTX + else if (imtype == R_IMF_IMTYPE_KTX) { - ibuf->ftype = KTX; ++ ibuf->ftype = IMB_FTYPE_KTX; + } +#endif else { /* R_IMF_IMTYPE_JPEG90, etc. default we save jpegs */ if (quality < 10) quality = 90; diff --cc source/blender/imbuf/IMB_imbuf_types.h index 1d5e315,08ce9c0..a1c628d --- a/source/blender/imbuf/IMB_imbuf_types.h +++ b/source/blender/imbuf/IMB_imbuf_types.h @@@ -95,12 -92,8 +92,12 @@@ enum eImbTypes #endif #ifdef WITH_DDS - DDS, + IMB_FTYPE_DDS, #endif + +#ifdef WITH_KTX - KTX, ++ IMB_FTYPE_KTX, +#endif }; /* ibuf->foptions flag, type specific options. diff --cc source/blender/imbuf/intern/IMB_filetype.h index df000c2,2bd7cbc..70e3b56 --- a/source/blender/imbuf/intern/IMB_filetype.h +++ b/source/blender/imbuf/intern/IMB_filetype.h @@@ -121,13 -118,5 +118,13 @@@ void imb_loadtiletiff(struct ImBuf *ibu int tx, int ty, unsigned int *rect); int imb_savetiff(struct ImBuf *ibuf, const char *name, int flags); +/* ktx */ +void imb_initktx(void); - int check_ktx(unsigned char *mem); ++int check_ktx(const unsigned char *mem); +int imb_is_a_ktx(const char *filename); - struct ImBuf *imb_loadktx(unsigned char *mem, size_t size, int flags, char colorspace[]); ++struct ImBuf *imb_loadktx(const unsigned char *mem, size_t size, int flags, char *colorspace); +int imb_savektx(struct ImBuf *ibuf, const char *name, int flags); + + #endif /* __IMB_FILETYPE_H__ */ diff --cc source/blender/imbuf/intern/filetype.c index 9a48410,3d3e8a0..b9c05a2 --- a/source/blender/imbuf/intern/filetype.c +++ b/source/blender/imbuf/intern/filetype.c @@@ -62,36 -62,33 +62,36 @@@ static int imb_ftype_iris(const ImFileT } 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 +#ifdef WITH_KTX - {imb_initktx, NULL, check_ktx, imb_is_a_ktx, imb_ftype_default, imb_loadktx, NULL, imb_savektx, NULL, 0, KTX, COLOR_ROLE_DEFAULT_BYTE}, ++ {imb_initktx, NULL, check_ktx, imb_is_a_ktx, imb_ftype_default, imb_loadktx, NULL, imb_savektx, NULL, 0, IMB_FTYPE_KTX, COLOR_ROLE_DEFAULT_BYTE}, +#endif {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0} }; diff --cc source/blender/imbuf/intern/jp2.c index f3b5ade,570ca5b..00cc7ca --- a/source/blender/imbuf/intern/jp2.c +++ b/source/blender/imbuf/intern/jp2.c @@@ -231,12 -237,12 +237,12 @@@ struct ImBuf *imb_jp2_decode(const unsi return NULL; } - ibuf->ftype = JP2; + ibuf->ftype = IMB_FTYPE_JP2; if (is_jp2) - ibuf->foptions |= JP2_JP2; + ibuf->foptions.flag |= JP2_JP2; else - ibuf->foptions |= JP2_J2K; - + ibuf->foptions.flag |= JP2_J2K; - ++ if (use_float) { float *rect_float = ibuf->rect_float; @@@ -586,8 -597,8 +597,8 @@@ static opj_image_t *ibuftoimage(ImBuf * chanel_colormanage_cb = linearrgb_to_srgb; } - if (ibuf->foptions & JP2_CINE) { - + if (ibuf->foptions.flag & JP2_CINE) { - ++ if (ibuf->x == 4096 || ibuf->y == 2160) parameters->cp_cinema = CINEMA4K_24; else { diff --cc source/blender/imbuf/intern/ktx.c index 7da9227,0000000..9976ec4 mode 100644,000000..100644 --- a/source/blender/imbuf/intern/ktx.c +++ b/source/blender/imbuf/intern/ktx.c @@@ -1,136 -1,0 +1,136 @@@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none y @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs