Cleanup: rename OPENEXR_COMPRESS for clarity #128814

Merged
Aras Pranckevicius merged 1 commits from aras_p/blender:exr_mask_cleanup into main 2024-10-10 08:46:20 +02:00
7 changed files with 11 additions and 10 deletions

View File

@ -3430,7 +3430,7 @@ void dynamicPaint_outputSurfaceImage(DynamicPaintSurface *surface,
#ifdef WITH_OPENEXR
if (format == R_IMF_IMTYPE_OPENEXR) { /* OpenEXR 32-bit float */
ibuf->ftype = IMB_FTYPE_OPENEXR;
ibuf->foptions.flag |= OPENEXR_COMPRESS;
ibuf->foptions.flag = R_IMF_EXR_CODEC_ZIP;
}
else
#endif

View File

@ -649,7 +649,7 @@ void BKE_image_format_to_imbuf(ImBuf *ibuf, const ImageFormatData *imf)
if (imf->depth == R_IMF_CHAN_DEPTH_16) {
ibuf->foptions.flag |= OPENEXR_HALF;
}
ibuf->foptions.flag |= (imf->exr_codec & OPENEXR_COMPRESS);
ibuf->foptions.flag |= (imf->exr_codec & OPENEXR_CODEC_MASK);
ibuf->foptions.quality = quality;
}
#endif
@ -801,7 +801,7 @@ void BKE_image_format_from_imbuf(ImageFormatData *im_format, const ImBuf *imbuf)
if (custom_flags & OPENEXR_HALF) {
im_format->depth = R_IMF_CHAN_DEPTH_16;
}
if (custom_flags & OPENEXR_COMPRESS) {
if (custom_flags & OPENEXR_CODEC_MASK) {
im_format->exr_codec = R_IMF_EXR_CODEC_ZIP; /* Can't determine compression */
}
}

View File

@ -179,7 +179,7 @@ static void do_versions_image_settings_2_60(Scene *sce)
imf->depth = R_IMF_CHAN_DEPTH_8;
/* openexr */
imf->exr_codec = rd->quality & 7; /* strange but true! 0-4 are valid values, OPENEXR_COMPRESS */
imf->exr_codec = rd->quality & 7; /* 0-4 were valid values back then */
switch (imf->imtype) {
case R_IMF_IMTYPE_OPENEXR:

View File

@ -986,7 +986,7 @@ void uiTemplateImageSettings(uiLayout *layout, PointerRNA *imfptr, bool color_ma
if (ELEM(imf->imtype, R_IMF_IMTYPE_OPENEXR, R_IMF_IMTYPE_MULTILAYER)) {
uiItemR(col, imfptr, "exr_codec", UI_ITEM_NONE, nullptr, ICON_NONE);
if (ELEM(imf->exr_codec & OPENEXR_COMPRESS, R_IMF_EXR_CODEC_DWAA, R_IMF_EXR_CODEC_DWAB)) {
if (ELEM(imf->exr_codec & OPENEXR_CODEC_MASK, R_IMF_EXR_CODEC_DWAA, R_IMF_EXR_CODEC_DWAB)) {
uiItemR(col, imfptr, "quality", UI_ITEM_NONE, nullptr, ICON_NONE);
}
}

View File

@ -45,9 +45,10 @@ struct IDProperty;
* #ImBuf::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)
/* Lowest bits of foptions.flag / exr_codec contain actual codec enum. */
#define OPENEXR_CODEC_MASK (0xF)
#ifdef WITH_CINEON
# define CINEON_LOG (1 << 8)

View File

@ -479,7 +479,7 @@ static bool imb_save_openexr_half(ImBuf *ibuf, const char *filepath, const int f
Header header(width, height);
openexr_header_compression(
&header, ibuf->foptions.flag & OPENEXR_COMPRESS, ibuf->foptions.quality);
&header, ibuf->foptions.flag & OPENEXR_CODEC_MASK, ibuf->foptions.quality);
openexr_header_metadata(&header, ibuf);
/* create channels */
@ -581,7 +581,7 @@ static bool imb_save_openexr_float(ImBuf *ibuf, const char *filepath, const int
Header header(width, height);
openexr_header_compression(
&header, ibuf->foptions.flag & OPENEXR_COMPRESS, ibuf->foptions.quality);
&header, ibuf->foptions.flag & OPENEXR_CODEC_MASK, ibuf->foptions.quality);
openexr_header_metadata(&header, ibuf);
/* create channels */

View File

@ -414,7 +414,7 @@ typedef struct ImageFormatData {
/* --- format specific --- */
/** OpenEXR. */
/** OpenEXR: R_IMF_EXR_CODEC_* values in low OPENEXR_CODEC_MASK bits. */
char exr_codec;
/** CINEON. */