Cleanup: Various clang-tidy warnings in imbuf
Pull Request: https://projects.blender.org/blender/blender/pulls/133734
This commit is contained in:
@@ -9,7 +9,6 @@
|
||||
*/
|
||||
|
||||
#include "BLI_compiler_compat.h"
|
||||
#include "BLI_sys_types.h"
|
||||
|
||||
#include "BLI_math_matrix_types.hh"
|
||||
|
||||
@@ -70,7 +69,7 @@ BLI_INLINE float IMB_colormanagement_get_luminance(const float rgb[3]);
|
||||
/**
|
||||
* Byte equivalent of #IMB_colormanagement_get_luminance().
|
||||
*/
|
||||
BLI_INLINE unsigned char IMB_colormanagement_get_luminance_byte(const unsigned char[3]);
|
||||
BLI_INLINE unsigned char IMB_colormanagement_get_luminance_byte(const unsigned char rgb[3]);
|
||||
|
||||
/**
|
||||
* Conversion between scene linear and other color spaces.
|
||||
@@ -549,4 +548,4 @@ void IMB_colormanagement_wavelength_to_rgb_table(float *r_table, int width);
|
||||
|
||||
/** \} */
|
||||
|
||||
#include "intern/colormanagement_inline.h"
|
||||
#include "intern/colormanagement_inline.h" // IWYU pragma: export
|
||||
|
||||
@@ -47,14 +47,14 @@ enum eImbFileType {
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef enum IMB_Proxy_Size {
|
||||
enum IMB_Proxy_Size {
|
||||
IMB_PROXY_NONE = 0,
|
||||
IMB_PROXY_25 = 1,
|
||||
IMB_PROXY_50 = 2,
|
||||
IMB_PROXY_75 = 4,
|
||||
IMB_PROXY_100 = 8,
|
||||
IMB_PROXY_MAX_SLOT = 4,
|
||||
} IMB_Proxy_Size;
|
||||
};
|
||||
ENUM_OPERATORS(IMB_Proxy_Size, IMB_PROXY_100);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -6,8 +6,6 @@
|
||||
|
||||
#include "DNA_vec_types.h" /* for rcti */
|
||||
|
||||
#include "BLI_sys_types.h"
|
||||
|
||||
#include "IMB_imbuf_enums.h"
|
||||
|
||||
struct ColormanageCache;
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
*/
|
||||
|
||||
#include "BLI_ghash.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
/* Cache system for movie data - now supports storing ImBufs only
|
||||
* Supposed to provide unified cache system for movie clips, sequencer and
|
||||
|
||||
@@ -8,12 +8,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "BLI_sys_types.h"
|
||||
#include "DNA_listBase.h"
|
||||
|
||||
struct ImBuf;
|
||||
struct OCIO_ConstCPUProcessorRc;
|
||||
typedef struct OCIO_ConstCPUProcessorRc *OCIO_ConstCPUProcessorRcPtr;
|
||||
using OCIO_ConstCPUProcessorRcPtr = struct OCIO_ConstCPUProcessorRc *;
|
||||
|
||||
extern float imbuf_luma_coefficients[3];
|
||||
extern float imbuf_scene_linear_to_xyz[3][3];
|
||||
|
||||
@@ -149,7 +149,7 @@ ImBuf *imb_thumbnail_jpeg(const char *filepath,
|
||||
/** \name Format: BMP (#IMB_FTYPE_BMP)
|
||||
* \{ */
|
||||
|
||||
bool imb_is_a_bmp(const unsigned char *buf, size_t size);
|
||||
bool imb_is_a_bmp(const unsigned char *mem, size_t size);
|
||||
ImBuf *imb_load_bmp(const unsigned char *mem,
|
||||
size_t size,
|
||||
int flags,
|
||||
@@ -163,7 +163,7 @@ bool imb_save_bmp(ImBuf *ibuf, const char *filepath, int flags);
|
||||
/** \name Format: CINEON (#IMB_FTYPE_CINEON)
|
||||
* \{ */
|
||||
|
||||
bool imb_is_a_cineon(const unsigned char *buf, size_t size);
|
||||
bool imb_is_a_cineon(const unsigned char *mem, size_t size);
|
||||
bool imb_save_cineon(ImBuf *buf, const char *filepath, int flags);
|
||||
ImBuf *imb_load_cineon(const unsigned char *mem,
|
||||
size_t size,
|
||||
@@ -176,7 +176,7 @@ ImBuf *imb_load_cineon(const unsigned char *mem,
|
||||
/** \name Format: DPX (#IMB_FTYPE_DPX)
|
||||
* \{ */
|
||||
|
||||
bool imb_is_a_dpx(const unsigned char *buf, size_t size);
|
||||
bool imb_is_a_dpx(const unsigned char *mem, size_t size);
|
||||
bool imb_save_dpx(ImBuf *ibuf, const char *filepath, int flags);
|
||||
ImBuf *imb_load_dpx(const unsigned char *mem,
|
||||
size_t size,
|
||||
@@ -189,7 +189,7 @@ ImBuf *imb_load_dpx(const unsigned char *mem,
|
||||
/** \name Format: HDR (#IMB_FTYPE_RADHDR)
|
||||
* \{ */
|
||||
|
||||
bool imb_is_a_hdr(const unsigned char *buf, size_t size);
|
||||
bool imb_is_a_hdr(const unsigned char *mem, size_t size);
|
||||
ImBuf *imb_load_hdr(const unsigned char *mem,
|
||||
size_t size,
|
||||
int flags,
|
||||
@@ -202,7 +202,7 @@ bool imb_save_hdr(ImBuf *ibuf, const char *filepath, int flags);
|
||||
/** \name Format: TIFF (#IMB_FTYPE_TIF)
|
||||
* \{ */
|
||||
|
||||
bool imb_is_a_tiff(const unsigned char *buf, size_t size);
|
||||
bool imb_is_a_tiff(const unsigned char *mem, size_t size);
|
||||
/**
|
||||
* Loads a TIFF file.
|
||||
* \param mem: Memory containing the TIFF file.
|
||||
@@ -238,7 +238,7 @@ bool imb_save_tiff(ImBuf *ibuf, const char *filepath, int flags);
|
||||
/** \name Format: WEBP (#IMB_FTYPE_WEBP)
|
||||
* \{ */
|
||||
|
||||
bool imb_is_a_webp(const unsigned char *buf, size_t size);
|
||||
bool imb_is_a_webp(const unsigned char *mem, size_t size);
|
||||
ImBuf *imb_loadwebp(const unsigned char *mem,
|
||||
size_t size,
|
||||
int flags,
|
||||
@@ -259,7 +259,7 @@ bool imb_savewebp(ImBuf *ibuf, const char *filepath, int flags);
|
||||
|
||||
void imb_init_dds();
|
||||
|
||||
bool imb_is_a_dds(const unsigned char *buf, size_t size);
|
||||
bool imb_is_a_dds(const unsigned char *mem, size_t size);
|
||||
|
||||
ImBuf *imb_load_dds(const unsigned char *mem,
|
||||
size_t size,
|
||||
@@ -272,7 +272,7 @@ ImBuf *imb_load_dds(const unsigned char *mem,
|
||||
/** \name Format: PSD (#IMB_FTYPE_PSD)
|
||||
* \{ */
|
||||
|
||||
bool imb_is_a_psd(const unsigned char *buf, size_t size);
|
||||
bool imb_is_a_psd(const unsigned char *mem, size_t size);
|
||||
|
||||
ImBuf *imb_load_psd(const unsigned char *mem,
|
||||
size_t size,
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "BLI_sys_types.h"
|
||||
#include <cstdint>
|
||||
|
||||
struct ImBuf;
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
/* It's become a bit messy... Basically, only the IMB_ prefixed files
|
||||
* should remain. */
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
|
||||
#include "IMB_imbuf.hh"
|
||||
@@ -24,7 +25,6 @@
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BLI_threads.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "GPU_texture.hh"
|
||||
|
||||
@@ -341,9 +341,7 @@ bool imb_enlargeencodedbufferImBuf(ImBuf *ibuf)
|
||||
}
|
||||
|
||||
uint newsize = 2 * ibuf->encoded_buffer_size;
|
||||
if (newsize < 10000) {
|
||||
newsize = 10000;
|
||||
}
|
||||
newsize = std::max<uint>(newsize, 10000);
|
||||
|
||||
ImBufByteBuffer new_buffer;
|
||||
if (!imb_alloc_buffer(new_buffer, newsize, 1, 1, sizeof(uint8_t), true)) {
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
*/
|
||||
|
||||
#include "logImageCore.h"
|
||||
#include <cmath>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
|
||||
@@ -169,9 +168,9 @@ bool imb_save_cineon(ImBuf *buf, const char *filepath, int flags)
|
||||
return imb_save_dpx_cineon(buf, filepath, 1, flags);
|
||||
}
|
||||
|
||||
bool imb_is_a_cineon(const uchar *buf, size_t size)
|
||||
bool imb_is_a_cineon(const uchar *mem, size_t size)
|
||||
{
|
||||
return logImageIsCineon(buf, size);
|
||||
return logImageIsCineon(mem, size);
|
||||
}
|
||||
|
||||
ImBuf *imb_load_cineon(const uchar *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE])
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
#include "BLI_fileops.h"
|
||||
#include "BLI_string.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ extern "C" {
|
||||
#define CINEON_UNDEFINED_R32 0x7F800000
|
||||
#define CINEON_UNDEFINED_CHAR 0
|
||||
|
||||
typedef struct {
|
||||
struct CineonFileHeader {
|
||||
unsigned int magic_num;
|
||||
unsigned int offset;
|
||||
unsigned int gen_hdr_size;
|
||||
@@ -36,9 +36,9 @@ typedef struct {
|
||||
char creation_date[12];
|
||||
char creation_time[12];
|
||||
char reserved[36];
|
||||
} CineonFileHeader;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
struct CineonElementHeader {
|
||||
uchar descriptor1;
|
||||
uchar descriptor2;
|
||||
uchar bits_per_sample;
|
||||
@@ -49,9 +49,9 @@ typedef struct {
|
||||
float ref_low_quantity;
|
||||
unsigned int ref_high_data;
|
||||
float ref_high_quantity;
|
||||
} CineonElementHeader;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
struct CineonImageHeader {
|
||||
uchar orientation;
|
||||
uchar elements_per_image;
|
||||
unsigned short filler;
|
||||
@@ -73,9 +73,9 @@ typedef struct {
|
||||
unsigned int line_padding;
|
||||
unsigned int element_padding;
|
||||
char reserved2[20];
|
||||
} CineonImageHeader;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
struct CineonOriginationHeader {
|
||||
int x_offset;
|
||||
int y_offset;
|
||||
char file_name[100];
|
||||
@@ -88,9 +88,9 @@ typedef struct {
|
||||
float y_input_samples_per_mm;
|
||||
float input_device_gamma;
|
||||
char reserved[40];
|
||||
} CineonOriginationHeader;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
struct CineonFilmHeader {
|
||||
uchar film_code;
|
||||
uchar film_type;
|
||||
uchar edge_code_perforation_offset;
|
||||
@@ -103,14 +103,14 @@ typedef struct {
|
||||
char attribute[32];
|
||||
char slate[200];
|
||||
char reserved[740];
|
||||
} CineonFilmHeader;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
struct CineonMainHeader {
|
||||
CineonFileHeader fileHeader;
|
||||
CineonImageHeader imageHeader;
|
||||
CineonOriginationHeader originationHeader;
|
||||
CineonFilmHeader filmHeader;
|
||||
} CineonMainHeader;
|
||||
};
|
||||
|
||||
void cineonSetVerbose(int);
|
||||
LogImageFile *cineonOpen(const uchar *byteStuff, int fromMemory, size_t bufferSize);
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <math.h>
|
||||
#include <cmath>
|
||||
|
||||
#include "logImageCore.h"
|
||||
|
||||
@@ -23,10 +23,10 @@ extern "C" {
|
||||
#define DPX_UNDEFINED_U16 0xFFFF
|
||||
#define DPX_UNDEFINED_U32 0xFFFFFFFF
|
||||
#define DPX_UNDEFINED_R32 NAN
|
||||
#define IS_DPX_UNDEFINED_R32(x) isnan(x)
|
||||
#define IS_DPX_UNDEFINED_R32(x) std::isnan(x)
|
||||
#define DPX_UNDEFINED_CHAR 0
|
||||
|
||||
typedef struct {
|
||||
struct DpxFileHeader {
|
||||
unsigned int magic_num;
|
||||
unsigned int offset;
|
||||
char version[8];
|
||||
@@ -42,9 +42,9 @@ typedef struct {
|
||||
char copyright[200];
|
||||
unsigned int key;
|
||||
char reserved[104];
|
||||
} DpxFileHeader;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
struct DpxElementHeader {
|
||||
unsigned int data_sign;
|
||||
unsigned int ref_low_data;
|
||||
float ref_low_quantity;
|
||||
@@ -60,18 +60,18 @@ typedef struct {
|
||||
unsigned int line_padding;
|
||||
unsigned int element_padding;
|
||||
char description[32];
|
||||
} DpxElementHeader;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
struct DpxImageHeader {
|
||||
unsigned short orientation;
|
||||
unsigned short elements_per_image;
|
||||
unsigned int pixels_per_line;
|
||||
unsigned int lines_per_element;
|
||||
DpxElementHeader element[8];
|
||||
char reserved[52];
|
||||
} DpxImageHeader;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
struct DpxOrientationHeader {
|
||||
unsigned int x_offset;
|
||||
unsigned int y_offset;
|
||||
float x_center;
|
||||
@@ -85,9 +85,9 @@ typedef struct {
|
||||
unsigned short border_validity[4];
|
||||
unsigned int pixel_aspect_ratio[2];
|
||||
char reserved[28];
|
||||
} DpxOrientationHeader;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
struct DpxFilmHeader {
|
||||
char film_manufacturer_id[2];
|
||||
char film_type[2];
|
||||
char edge_code_perforation_offset[2];
|
||||
@@ -102,9 +102,9 @@ typedef struct {
|
||||
char frame_identification[32];
|
||||
char slate_info[100];
|
||||
char reserved[56];
|
||||
} DpxFilmHeader;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
struct DpxTelevisionHeader {
|
||||
unsigned int time_code;
|
||||
unsigned int user_bits;
|
||||
unsigned char interlace;
|
||||
@@ -122,15 +122,15 @@ typedef struct {
|
||||
float white_level;
|
||||
float integration_times;
|
||||
unsigned char reserved[76];
|
||||
} DpxTelevisionHeader;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
struct DpxMainHeader {
|
||||
DpxFileHeader fileHeader;
|
||||
DpxImageHeader imageHeader;
|
||||
DpxOrientationHeader orientationHeader;
|
||||
DpxFilmHeader filmHeader;
|
||||
DpxTelevisionHeader televisionHeader;
|
||||
} DpxMainHeader;
|
||||
};
|
||||
|
||||
void dpxSetVerbose(int verbosity);
|
||||
LogImageFile *dpxOpen(const unsigned char *byteStuff, int fromMemory, size_t bufferSize);
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdio.h>
|
||||
#include <cstdio>
|
||||
|
||||
#include "BLI_compiler_compat.h"
|
||||
#include "BLI_sys_types.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
# define PATHSEP_CHAR '\\'
|
||||
@@ -41,7 +41,7 @@ enum format {
|
||||
format_Cineon,
|
||||
};
|
||||
|
||||
typedef struct LogImageElement {
|
||||
struct LogImageElement {
|
||||
int depth;
|
||||
int bitsPerSample;
|
||||
int dataOffset;
|
||||
@@ -53,9 +53,9 @@ typedef struct LogImageElement {
|
||||
float refLowQuantity;
|
||||
float refHighQuantity;
|
||||
float maxValue; /* = 2^bitsPerSample - 1 (used internally, doesn't come from the file header) */
|
||||
} LogImageElement;
|
||||
};
|
||||
|
||||
typedef struct LogImageFile {
|
||||
struct LogImageFile {
|
||||
/* specified in header */
|
||||
int width;
|
||||
int height;
|
||||
@@ -79,7 +79,7 @@ typedef struct LogImageFile {
|
||||
|
||||
/* DPX or Cineon ? */
|
||||
int srcFormat;
|
||||
} LogImageFile;
|
||||
};
|
||||
|
||||
/* The SMPTE defines this code:
|
||||
* 0 - User-defined
|
||||
@@ -207,9 +207,7 @@ BLI_INLINE unsigned short swap_ushort(unsigned short x, int swap)
|
||||
if (swap != 0) {
|
||||
return (x >> 8) | (x << 8);
|
||||
}
|
||||
else {
|
||||
return x;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
BLI_INLINE unsigned int swap_uint(unsigned int x, int swap)
|
||||
@@ -217,9 +215,7 @@ BLI_INLINE unsigned int swap_uint(unsigned int x, int swap)
|
||||
if (swap != 0) {
|
||||
return (x >> 24) | ((x << 8) & 0x00FF0000) | ((x >> 8) & 0x0000FF00) | (x << 24);
|
||||
}
|
||||
else {
|
||||
return x;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
BLI_INLINE float swap_float(float x, int swap)
|
||||
@@ -237,9 +233,7 @@ BLI_INLINE float swap_float(float x, int swap)
|
||||
dat2.b[3] = dat1.b[0];
|
||||
return dat2.f;
|
||||
}
|
||||
else {
|
||||
return x;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
/* Other */
|
||||
@@ -249,12 +243,10 @@ BLI_INLINE unsigned int clamp_uint(unsigned int x, unsigned int low, unsigned in
|
||||
if (x > high) {
|
||||
return high;
|
||||
}
|
||||
else if (x < low) {
|
||||
if (x < low) {
|
||||
return low;
|
||||
}
|
||||
else {
|
||||
return x;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
BLI_INLINE float clamp_float(float x, float low, float high)
|
||||
@@ -262,12 +254,10 @@ BLI_INLINE float clamp_float(float x, float low, float high)
|
||||
if (x > high) {
|
||||
return high;
|
||||
}
|
||||
else if (x < low) {
|
||||
if (x < low) {
|
||||
return low;
|
||||
}
|
||||
else {
|
||||
return x;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
BLI_INLINE unsigned int float_uint(float value, unsigned int max)
|
||||
@@ -275,12 +265,10 @@ BLI_INLINE unsigned int float_uint(float value, unsigned int max)
|
||||
if (value < 0.0f) {
|
||||
return 0;
|
||||
}
|
||||
else if (value > (1.0f - 0.5f / (float)max)) {
|
||||
if (value > (1.0f - 0.5f / (float)max)) {
|
||||
return max;
|
||||
}
|
||||
else {
|
||||
return (unsigned int)(((float)max * value) + 0.5f);
|
||||
}
|
||||
return (unsigned int)(((float)max * value) + 0.5f);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
#include "logImageCore.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <cstdlib>
|
||||
|
||||
int logimage_fseek(LogImageFile *logFile, intptr_t offset, int origin);
|
||||
int logimage_fwrite(const void *buffer, size_t size, unsigned int count, LogImageFile *logFile);
|
||||
|
||||
@@ -28,9 +28,9 @@
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
#include "BLI_math_color.h"
|
||||
#include "BLI_math_color.hh"
|
||||
#include "BLI_path_utils.hh"
|
||||
#include "BLI_rect.h"
|
||||
#include "BLI_string.h"
|
||||
#include "BLI_task.h"
|
||||
@@ -947,8 +947,7 @@ static OCIO_ConstCPUProcessorRcPtr *colorspace_to_scene_linear_cpu_processor(
|
||||
colorspace->name, global_role_scene_linear);
|
||||
|
||||
if (processor != nullptr) {
|
||||
colorspace->to_scene_linear = (OCIO_ConstCPUProcessorRcPtr *)OCIO_processorGetCPUProcessor(
|
||||
processor);
|
||||
colorspace->to_scene_linear = OCIO_processorGetCPUProcessor(processor);
|
||||
OCIO_processorRelease(processor);
|
||||
}
|
||||
}
|
||||
@@ -970,8 +969,7 @@ static OCIO_ConstCPUProcessorRcPtr *colorspace_from_scene_linear_cpu_processor(
|
||||
global_role_scene_linear, colorspace->name);
|
||||
|
||||
if (processor != nullptr) {
|
||||
colorspace->from_scene_linear = (OCIO_ConstCPUProcessorRcPtr *)
|
||||
OCIO_processorGetCPUProcessor(processor);
|
||||
colorspace->from_scene_linear = OCIO_processorGetCPUProcessor(processor);
|
||||
OCIO_processorRelease(processor);
|
||||
}
|
||||
}
|
||||
@@ -1010,8 +1008,7 @@ static OCIO_ConstCPUProcessorRcPtr *display_from_scene_linear_processor(
|
||||
}
|
||||
|
||||
if (processor != nullptr) {
|
||||
display->from_scene_linear = (OCIO_ConstCPUProcessorRcPtr *)OCIO_processorGetCPUProcessor(
|
||||
processor);
|
||||
display->from_scene_linear = OCIO_processorGetCPUProcessor(processor);
|
||||
OCIO_processorRelease(processor);
|
||||
}
|
||||
}
|
||||
@@ -1049,8 +1046,7 @@ static OCIO_ConstCPUProcessorRcPtr *display_to_scene_linear_processor(ColorManag
|
||||
}
|
||||
|
||||
if (processor != nullptr) {
|
||||
display->to_scene_linear = (OCIO_ConstCPUProcessorRcPtr *)OCIO_processorGetCPUProcessor(
|
||||
processor);
|
||||
display->to_scene_linear = OCIO_processorGetCPUProcessor(processor);
|
||||
OCIO_processorRelease(processor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,12 +9,10 @@
|
||||
|
||||
#include "BLI_rect.h"
|
||||
#include "BLI_task.hh"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "IMB_filter.hh"
|
||||
#include "IMB_imbuf.hh"
|
||||
#include "IMB_imbuf_types.hh"
|
||||
#include "imbuf.hh"
|
||||
|
||||
#include "IMB_colormanagement.hh"
|
||||
#include "IMB_colormanagement_intern.hh"
|
||||
|
||||
@@ -17,8 +17,6 @@
|
||||
#include "IMB_imbuf.hh"
|
||||
#include "IMB_imbuf_types.hh"
|
||||
|
||||
#include "imbuf.hh"
|
||||
|
||||
static void filtcolum(uchar *point, int y, int skip)
|
||||
{
|
||||
uint c1, c2, c3, error;
|
||||
@@ -168,7 +166,7 @@ static void imb_filterN(ImBuf *out, ImBuf *in)
|
||||
const float *row1 = (y == 0) ? row2 : row2 - channels * rowlen;
|
||||
const float *row3 = (y == in->y - 1) ? row2 : row2 + channels * rowlen;
|
||||
|
||||
float *cp = (float *)out->float_buffer.data + y * channels * rowlen;
|
||||
float *cp = out->float_buffer.data + y * channels * rowlen;
|
||||
|
||||
for (int x = 0; x < rowlen; x++) {
|
||||
const float *r11, *r13, *r21, *r23, *r31, *r33;
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
|
||||
#include "oiio/openimageio_support.hh"
|
||||
|
||||
@@ -44,9 +43,9 @@ void imb_init_dds()
|
||||
}
|
||||
}
|
||||
|
||||
bool imb_is_a_dds(const uchar *buf, size_t size)
|
||||
bool imb_is_a_dds(const uchar *mem, size_t size)
|
||||
{
|
||||
return imb_oiio_check(buf, size, "dds");
|
||||
return imb_oiio_check(mem, size, "dds");
|
||||
}
|
||||
|
||||
ImBuf *imb_load_dds(const uchar *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE])
|
||||
|
||||
@@ -7,13 +7,11 @@
|
||||
* \ingroup imbuf
|
||||
*/
|
||||
|
||||
#include <cmath>
|
||||
#include <cstdlib>
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BLI_task.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "IMB_colormanagement.hh"
|
||||
#include "IMB_imbuf.hh"
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <cstdlib>
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifndef WIN32
|
||||
@@ -17,8 +16,6 @@
|
||||
#endif
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifndef WIN32
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
* \ingroup imbuf
|
||||
*/
|
||||
|
||||
#include "BLI_math_vector.h"
|
||||
#include "IMB_colormanagement.hh"
|
||||
#include "IMB_interp.hh"
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
* \ingroup imbuf
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
|
||||
#include "BLI_fileops.h"
|
||||
@@ -309,9 +310,7 @@ ImBuf *imb_loadiris(const uchar *mem, size_t size, int flags, char colorspace[IM
|
||||
if (!ibuf) {
|
||||
goto fail_rle;
|
||||
}
|
||||
if (ibuf->planes > 32) {
|
||||
ibuf->planes = 32;
|
||||
}
|
||||
ibuf->planes = std::min<int>(ibuf->planes, 32);
|
||||
base = (uint *)ibuf->byte_buffer.data;
|
||||
|
||||
if (badorder) {
|
||||
@@ -419,9 +418,7 @@ ImBuf *imb_loadiris(const uchar *mem, size_t size, int flags, char colorspace[IM
|
||||
if (!ibuf) {
|
||||
goto fail_uncompressed;
|
||||
}
|
||||
if (ibuf->planes > 32) {
|
||||
ibuf->planes = 32;
|
||||
}
|
||||
ibuf->planes = std::min<int>(ibuf->planes, 32);
|
||||
|
||||
base = (uint *)ibuf->byte_buffer.data;
|
||||
|
||||
@@ -925,7 +922,7 @@ static int compressrow(const uchar *lbuf, uchar *rlebuf, const int z, const int
|
||||
}
|
||||
}
|
||||
*optr++ = 0;
|
||||
return optr - (uchar *)rlebuf;
|
||||
return optr - rlebuf;
|
||||
}
|
||||
|
||||
bool imb_saveiris(ImBuf *ibuf, const char *filepath, int /*flags*/)
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
#include "openjpeg.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
|
||||
#define JP2_FILEHEADER_SIZE 12
|
||||
@@ -417,9 +418,7 @@ static ImBuf *imb_load_jp2_stream(opj_stream_t *stream,
|
||||
}
|
||||
|
||||
i = image->numcomps;
|
||||
if (i > 4) {
|
||||
i = 4;
|
||||
}
|
||||
i = std::min<uint>(i, 4);
|
||||
|
||||
while (i) {
|
||||
i--;
|
||||
@@ -694,9 +693,7 @@ static void cinema_setup_encoder(opj_cparameters_t *parameters,
|
||||
switch (parameters->cp_cinema) {
|
||||
case OPJ_CINEMA2K_24:
|
||||
case OPJ_CINEMA2K_48:
|
||||
if (parameters->numresolution > 6) {
|
||||
parameters->numresolution = 6;
|
||||
}
|
||||
parameters->numresolution = std::min(parameters->numresolution, 6);
|
||||
if (!((image->comps[0].w == 2048) || (image->comps[0].h == 1080))) {
|
||||
fprintf(stdout,
|
||||
"Image coordinates %u x %u is not 2K compliant.\nJPEG Digital Cinema Profile-3 "
|
||||
|
||||
@@ -662,9 +662,7 @@ static int init_jpeg(FILE *outfile, jpeg_compress_struct *cinfo, ImBuf *ibuf)
|
||||
if (quality <= 0) {
|
||||
quality = jpeg_default_quality;
|
||||
}
|
||||
if (quality > 100) {
|
||||
quality = 100;
|
||||
}
|
||||
quality = std::min(quality, 100);
|
||||
|
||||
jpeg_create_compress(cinfo);
|
||||
jpeg_stdio_dest(cinfo, outfile);
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "IMB_allocimbuf.hh"
|
||||
#include "IMB_colormanagement_intern.hh"
|
||||
#include "IMB_filetype.hh"
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include "BLI_ghash.h"
|
||||
#include "BLI_mempool.h"
|
||||
#include "BLI_string.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "IMB_moviecache.hh"
|
||||
|
||||
|
||||
@@ -6,11 +6,14 @@
|
||||
#include <OpenImageIO/imagebuf.h>
|
||||
#include <OpenImageIO/imagebufalgo.h>
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
#include <algorithm>
|
||||
|
||||
#include "BLI_listbase.h"
|
||||
#include "BLI_string.h"
|
||||
|
||||
#include "BKE_idprop.hh"
|
||||
#include "DNA_ID.h" /* ID property definitions. */
|
||||
|
||||
#include "DNA_ID.h"
|
||||
#include "IMB_allocimbuf.hh"
|
||||
#include "IMB_colormanagement.hh"
|
||||
#include "IMB_metadata.hh"
|
||||
@@ -52,9 +55,7 @@ class ImBufMemWriter : public Filesystem::IOProxy {
|
||||
|
||||
memcpy(ibuf_->encoded_buffer.data + offset, buf, size);
|
||||
|
||||
if (end > ibuf_->encoded_size) {
|
||||
ibuf_->encoded_size = end;
|
||||
}
|
||||
ibuf_->encoded_size = std::max<size_t>(end, ibuf_->encoded_size);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
@@ -4,11 +4,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
/* Include our own math header first to avoid warnings about M_PI
|
||||
* redefinition between OpenImageIO and Windows headers. */
|
||||
#include "BLI_math_base.h"
|
||||
#include "BLI_math_base.h" // IWYU pragma: keep
|
||||
#include "BLI_sys_types.h"
|
||||
|
||||
#include <OpenImageIO/filesystem.h>
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <set>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
/* The OpenEXR version can reliably be found in this header file from OpenEXR,
|
||||
@@ -75,11 +74,12 @@
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
#include "BLI_fileops.h"
|
||||
#include "BLI_math_base.hh"
|
||||
#include "BLI_math_color.h"
|
||||
#include "BLI_mmap.h"
|
||||
#include "BLI_path_utils.hh"
|
||||
#include "BLI_string.h"
|
||||
#include "BLI_threads.h"
|
||||
|
||||
#include "BKE_idprop.hh"
|
||||
@@ -760,7 +760,7 @@ void *IMB_exr_get_handle_name(const char *name)
|
||||
void IMB_exr_add_view(void *handle, const char *name)
|
||||
{
|
||||
ExrHandle *data = (ExrHandle *)handle;
|
||||
data->multiView->push_back(name);
|
||||
data->multiView->emplace_back(name);
|
||||
}
|
||||
|
||||
static int imb_exr_get_multiView_id(StringVector &views, const std::string &name)
|
||||
@@ -1660,11 +1660,11 @@ static std::vector<MultiViewChannelName> exr_channels_in_multi_part_file(
|
||||
for (int p = 0; p < file.parts(); p++) {
|
||||
const ChannelList &c = file.header(p).channels();
|
||||
|
||||
std::string part_view = "";
|
||||
std::string part_view;
|
||||
if (file.header(p).hasView()) {
|
||||
part_view = file.header(p).view();
|
||||
}
|
||||
std::string part_name = "";
|
||||
std::string part_name;
|
||||
if (file.header(p).hasName()) {
|
||||
part_name = file.header(p).name();
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdio.h>
|
||||
#include <cstdio>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
@@ -6,8 +6,6 @@
|
||||
* \ingroup openexr
|
||||
*/
|
||||
|
||||
#include "openexr_api.h"
|
||||
|
||||
#include "IMB_openexr.hh"
|
||||
|
||||
void *IMB_exr_get_handle()
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#include "BLI_mmap.h"
|
||||
#include "BLI_path_utils.hh" /* For assertions. */
|
||||
#include "BLI_string.h"
|
||||
#include "BLI_utildefines.h"
|
||||
#include <cstdlib>
|
||||
|
||||
#include "IMB_allocimbuf.hh"
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
* \ingroup imbuf
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdlib>
|
||||
|
||||
#include "BLI_math_base.h"
|
||||
@@ -340,23 +341,15 @@ void IMB_rectclip(ImBuf *dbuf,
|
||||
}
|
||||
|
||||
tmp = dbuf->x - *destx;
|
||||
if (*width > tmp) {
|
||||
*width = tmp;
|
||||
}
|
||||
*width = std::min(*width, tmp);
|
||||
tmp = dbuf->y - *desty;
|
||||
if (*height > tmp) {
|
||||
*height = tmp;
|
||||
}
|
||||
*height = std::min(*height, tmp);
|
||||
|
||||
if (sbuf) {
|
||||
tmp = sbuf->x - *srcx;
|
||||
if (*width > tmp) {
|
||||
*width = tmp;
|
||||
}
|
||||
*width = std::min(*width, tmp);
|
||||
tmp = sbuf->y - *srcy;
|
||||
if (*height > tmp) {
|
||||
*height = tmp;
|
||||
}
|
||||
*height = std::min(*height, tmp);
|
||||
}
|
||||
|
||||
if ((*height <= 0) || (*width <= 0)) {
|
||||
@@ -422,34 +415,22 @@ static void imb_rectclip3(ImBuf *dbuf,
|
||||
}
|
||||
|
||||
tmp = dbuf->x - *destx;
|
||||
if (*width > tmp) {
|
||||
*width = tmp;
|
||||
}
|
||||
*width = std::min(*width, tmp);
|
||||
tmp = dbuf->y - *desty;
|
||||
if (*height > tmp) {
|
||||
*height = tmp;
|
||||
}
|
||||
*height = std::min(*height, tmp);
|
||||
|
||||
if (obuf) {
|
||||
tmp = obuf->x - *origx;
|
||||
if (*width > tmp) {
|
||||
*width = tmp;
|
||||
}
|
||||
*width = std::min(*width, tmp);
|
||||
tmp = obuf->y - *origy;
|
||||
if (*height > tmp) {
|
||||
*height = tmp;
|
||||
}
|
||||
*height = std::min(*height, tmp);
|
||||
}
|
||||
|
||||
if (sbuf) {
|
||||
tmp = sbuf->x - *srcx;
|
||||
if (*width > tmp) {
|
||||
*width = tmp;
|
||||
}
|
||||
*width = std::min(*width, tmp);
|
||||
tmp = sbuf->y - *srcy;
|
||||
if (*height > tmp) {
|
||||
*height = tmp;
|
||||
}
|
||||
*height = std::min(*height, tmp);
|
||||
}
|
||||
|
||||
if ((*height <= 0) || (*width <= 0)) {
|
||||
@@ -813,7 +794,7 @@ void IMB_rectblend(ImBuf *dbuf,
|
||||
else {
|
||||
for (x = width; x > 0; x--, dr++, outr++, sr++, cmr++) {
|
||||
uchar *src = (uchar *)sr;
|
||||
float mask = float(mask_max) * float(*cmr);
|
||||
float mask = mask_max * float(*cmr);
|
||||
|
||||
if (texmaskrect) {
|
||||
mask *= (float(*tmr++) / 65535.0f);
|
||||
@@ -911,7 +892,7 @@ void IMB_rectblend(ImBuf *dbuf,
|
||||
/* No destination mask buffer, do regular blend with mask-texture if present. */
|
||||
else {
|
||||
for (x = width; x > 0; x--, drf += 4, orf += 4, srf += 4, cmr++) {
|
||||
float mask = float(mask_max) * float(*cmr);
|
||||
float mask = mask_max * float(*cmr);
|
||||
|
||||
if (texmaskrect) {
|
||||
mask *= (float(*tmr++) / 65535.0f);
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
|
||||
#include "IMB_imbuf.hh"
|
||||
#include "IMB_imbuf_types.hh"
|
||||
#include "imbuf.hh"
|
||||
|
||||
bool IMB_rotate_orthogonal(ImBuf *ibuf, int degrees)
|
||||
{
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
* \ingroup imbuf
|
||||
*/
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include "BLI_math_vector.hh"
|
||||
#include "BLI_task.hh"
|
||||
#include "BLI_utildefines.h"
|
||||
@@ -127,8 +125,8 @@ static void imb_half_y_no_alloc(ImBuf *ibuf2, ImBuf *ibuf1)
|
||||
|
||||
_p1 = ibuf1->byte_buffer.data;
|
||||
dest = ibuf2->byte_buffer.data;
|
||||
_p1f = (float *)ibuf1->float_buffer.data;
|
||||
destf = (float *)ibuf2->float_buffer.data;
|
||||
_p1f = ibuf1->float_buffer.data;
|
||||
destf = ibuf2->float_buffer.data;
|
||||
|
||||
for (y = ibuf2->y; y > 0; y--) {
|
||||
if (do_rect) {
|
||||
|
||||
@@ -12,15 +12,10 @@
|
||||
#include "IMB_imbuf.hh"
|
||||
#include "IMB_imbuf_types.hh"
|
||||
|
||||
#include "imbuf.hh"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BLI_math_vector.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_userdef_types.h"
|
||||
|
||||
/* prototypes */
|
||||
struct Stereo3DData;
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
@@ -6,13 +6,9 @@
|
||||
* \ingroup imbuf
|
||||
*/
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
#include "BLI_listbase.h" /* Needed due to import of BLO_readfile.hh */
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BLO_readfile.hh"
|
||||
|
||||
#include "BKE_idtype.hh"
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
*/
|
||||
|
||||
#include "BLI_hash_md5.hh"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "IMB_imbuf.hh"
|
||||
#include "IMB_imbuf_types.hh"
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
|
||||
#include "BLI_fileops.h"
|
||||
#include "BLI_path_utils.hh"
|
||||
#include "BLI_utildefines.h"
|
||||
#ifdef _WIN32
|
||||
# include "BLI_winstuff.h"
|
||||
#endif
|
||||
|
||||
@@ -33,11 +33,9 @@ static bool imb_is_grayscale_texture_format_compatible(const ImBuf *ibuf)
|
||||
* and can therefore be optimized. */
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
/* TODO: Support gray-scale byte buffers.
|
||||
* The challenge is that Blender always stores byte images as RGBA. */
|
||||
return false;
|
||||
}
|
||||
/* TODO: Support gray-scale byte buffers.
|
||||
* The challenge is that Blender always stores byte images as RGBA. */
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Only #IMBuf's with color-space that do not modify the chrominance of the texture data relative
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
#include "BLI_fileops.h"
|
||||
#include "BLI_mmap.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "IMB_allocimbuf.hh"
|
||||
#include "IMB_colormanagement.hh"
|
||||
@@ -30,9 +29,9 @@
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
bool imb_is_a_webp(const uchar *buf, size_t size)
|
||||
bool imb_is_a_webp(const uchar *mem, size_t size)
|
||||
{
|
||||
if (WebPGetInfo(buf, size, nullptr, nullptr)) {
|
||||
if (WebPGetInfo(mem, size, nullptr, nullptr)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include <cstdlib>
|
||||
|
||||
#include "BLI_path_utils.hh" /* For assertions. */
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "IMB_colormanagement.hh"
|
||||
#include "IMB_filetype.hh"
|
||||
|
||||
@@ -820,7 +820,7 @@ static MovieProxyBuilder *index_ffmpeg_create_context(MovieReader *anim,
|
||||
}
|
||||
}
|
||||
|
||||
return (MovieProxyBuilder *)context;
|
||||
return context;
|
||||
}
|
||||
|
||||
static void index_rebuild_ffmpeg_finish(MovieProxyBuilder *context, const bool stop)
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
* \ingroup imbuf
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
#include <cctype>
|
||||
#include <climits>
|
||||
#include <cmath>
|
||||
@@ -14,7 +15,6 @@
|
||||
#include <cstdlib>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "BLI_math_base.hh"
|
||||
#include "BLI_path_utils.hh"
|
||||
#include "BLI_string.h"
|
||||
#include "BLI_threads.h"
|
||||
@@ -871,9 +871,7 @@ static int64_t ffmpeg_get_seek_pts(MovieReader *anim, int64_t pts_to_search)
|
||||
*/
|
||||
int64_t seek_pts = pts_to_search - (ffmpeg_steps_per_frame_get(anim) * 3);
|
||||
|
||||
if (seek_pts < 0) {
|
||||
seek_pts = 0;
|
||||
}
|
||||
seek_pts = std::max<int64_t>(seek_pts, 0);
|
||||
return seek_pts;
|
||||
}
|
||||
|
||||
|
||||
@@ -280,7 +280,7 @@ static AVFrame *generate_video_frame(MovieWriter *context, const ImBuf *image)
|
||||
|
||||
/* Convert to the output pixel format, if it's different that Blender's internal one. */
|
||||
if (context->img_convert_frame != nullptr) {
|
||||
BLI_assert(context->img_convert_ctx != NULL);
|
||||
BLI_assert(context->img_convert_ctx != nullptr);
|
||||
/* Ensure the frame we are scaling to is writable as well. */
|
||||
av_frame_make_writable(context->current_frame);
|
||||
ffmpeg_sws_scale_frame(context->img_convert_ctx, context->current_frame, rgb_frame);
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
# if defined(_MSC_VER) && !defined(_USE_MATH_DEFINES)
|
||||
# define _USE_MATH_DEFINES
|
||||
# endif
|
||||
# include <cmath>
|
||||
# include <cmath> // IWYU pragma: keep
|
||||
|
||||
extern "C" {
|
||||
# include <libavcodec/codec_id.h>
|
||||
|
||||
Reference in New Issue
Block a user