Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/imbuf/intern')
-rw-r--r--source/blender/imbuf/intern/IMB_indexer.h12
-rw-r--r--source/blender/imbuf/intern/anim_movie.c4
-rw-r--r--source/blender/imbuf/intern/cineon/CMakeLists.txt3
-rw-r--r--source/blender/imbuf/intern/cineon/cineonfile.h0
-rw-r--r--source/blender/imbuf/intern/cineon/cineonlib.c2
-rw-r--r--source/blender/imbuf/intern/cineon/dpxfile.h0
-rw-r--r--source/blender/imbuf/intern/cineon/logImageLib.h0
-rw-r--r--source/blender/imbuf/intern/colormanagement.c137
-rw-r--r--source/blender/imbuf/intern/imageprocess.c4
-rw-r--r--source/blender/imbuf/intern/oiio/openimageio_api.cpp5
-rw-r--r--source/blender/imbuf/intern/oiio/openimageio_api.h4
-rw-r--r--source/blender/imbuf/intern/openexr/openexr_api.cpp1
12 files changed, 82 insertions, 90 deletions
diff --git a/source/blender/imbuf/intern/IMB_indexer.h b/source/blender/imbuf/intern/IMB_indexer.h
index 6173ffa9b78..bac46740f0f 100644
--- a/source/blender/imbuf/intern/IMB_indexer.h
+++ b/source/blender/imbuf/intern/IMB_indexer.h
@@ -72,14 +72,14 @@ struct anim_index {
struct anim_index_builder;
typedef struct anim_index_builder {
- FILE * fp;
+ FILE *fp;
char name[FILE_MAX];
char temp_name[FILE_MAX];
void *private_data;
- void (*delete_priv_data)(struct anim_index_builder * idx);
- void (*proc_frame)(struct anim_index_builder * idx,
+ void (*delete_priv_data)(struct anim_index_builder *idx);
+ void (*proc_frame)(struct anim_index_builder *idx,
unsigned char *buffer,
int data_size,
struct anim_index_entry *entry);
@@ -87,14 +87,14 @@ typedef struct anim_index_builder {
anim_index_builder *IMB_index_builder_create(const char *name);
void IMB_index_builder_add_entry(
- anim_index_builder * fp,
+ anim_index_builder *fp,
int frameno, unsigned long long seek_pos,
unsigned long long seek_pos_dts,
unsigned long long pts);
void IMB_index_builder_proc_frame(
- anim_index_builder * fp,
- unsigned char * buffer,
+ anim_index_builder *fp,
+ unsigned char *buffer,
int data_size,
int frameno, unsigned long long seek_pos,
unsigned long long seek_pos_dts,
diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c
index 63790cf7d25..271e52da1d4 100644
--- a/source/blender/imbuf/intern/anim_movie.c
+++ b/source/blender/imbuf/intern/anim_movie.c
@@ -477,7 +477,7 @@ static int startffmpeg(struct anim *anim)
const int *inv_table;
#endif
- if (anim == 0) return(-1);
+ if (anim == NULL) return(-1);
streamcount = anim->streamindex;
@@ -960,7 +960,7 @@ static ImBuf *ffmpeg_fetchibuf(struct anim *anim, int position,
int new_frame_index = 0; /* To quiet gcc barking... */
int old_frame_index = 0; /* To quiet gcc barking... */
- if (anim == 0) return (0);
+ if (anim == NULL) return (0);
av_log(anim->pFormatCtx, AV_LOG_DEBUG, "FETCH: pos=%d\n", position);
diff --git a/source/blender/imbuf/intern/cineon/CMakeLists.txt b/source/blender/imbuf/intern/cineon/CMakeLists.txt
index 0028cdb4701..c96db4e4a3d 100644
--- a/source/blender/imbuf/intern/cineon/CMakeLists.txt
+++ b/source/blender/imbuf/intern/cineon/CMakeLists.txt
@@ -39,12 +39,9 @@ set(INC_SYS
set(SRC
cin_debug_stuff.h
- cineonfile.h
cineonlib.h
- dpxfile.h
dpxlib.h
logImageCore.h
- logImageLib.h
logmemfile.h
cineon_dpx.c
diff --git a/source/blender/imbuf/intern/cineon/cineonfile.h b/source/blender/imbuf/intern/cineon/cineonfile.h
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/source/blender/imbuf/intern/cineon/cineonfile.h
+++ /dev/null
diff --git a/source/blender/imbuf/intern/cineon/cineonlib.c b/source/blender/imbuf/intern/cineon/cineonlib.c
index fddfa2618c2..b80a381ebbb 100644
--- a/source/blender/imbuf/intern/cineon/cineonlib.c
+++ b/source/blender/imbuf/intern/cineon/cineonlib.c
@@ -40,8 +40,6 @@
#include "BLI_math_base.h"
#include "BLI_utildefines.h"
-#include "logImageLib.h"
-
#include "MEM_guardedalloc.h"
/*
diff --git a/source/blender/imbuf/intern/cineon/dpxfile.h b/source/blender/imbuf/intern/cineon/dpxfile.h
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/source/blender/imbuf/intern/cineon/dpxfile.h
+++ /dev/null
diff --git a/source/blender/imbuf/intern/cineon/logImageLib.h b/source/blender/imbuf/intern/cineon/logImageLib.h
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/source/blender/imbuf/intern/cineon/logImageLib.h
+++ /dev/null
diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c
index cf9cc0c2e6f..3c1a96e4005 100644
--- a/source/blender/imbuf/intern/colormanagement.c
+++ b/source/blender/imbuf/intern/colormanagement.c
@@ -1300,21 +1300,19 @@ static void display_buffer_init_handle(void *handle_v, int start_line, int tot_l
handle->float_colorspace = init_data->float_colorspace;
}
-static float *display_buffer_apply_get_linear_buffer(DisplayBufferThread *handle, bool *is_straight_alpha)
+static void display_buffer_apply_get_linear_buffer(DisplayBufferThread *handle, int start_scanline, int num_scanlines,
+ float *linear_buffer, bool *is_straight_alpha)
{
- float *linear_buffer = NULL;
-
int channels = handle->channels;
int width = handle->width;
- int height = handle->tot_line;
+ int height = num_scanlines;
+ int scanline_offset = channels * start_scanline * width;
int buffer_size = channels * width * height;
bool is_data = handle->is_data;
bool is_data_display = handle->cm_processor->is_data_result;
- linear_buffer = MEM_callocN(buffer_size * sizeof(float), "color conversion linear buffer");
-
if (!handle->buffer) {
unsigned char *byte_buffer = handle->byte_buffer;
@@ -1326,7 +1324,7 @@ static float *display_buffer_apply_get_linear_buffer(DisplayBufferThread *handle
int i;
/* first convert byte buffer to float, keep in image space */
- for (i = 0, fp = linear_buffer, cp = byte_buffer;
+ for (i = 0, fp = linear_buffer, cp = byte_buffer + scanline_offset;
i < width * height;
i++, fp += channels, cp += channels)
{
@@ -1359,7 +1357,7 @@ static float *display_buffer_apply_get_linear_buffer(DisplayBufferThread *handle
const char *from_colorspace = handle->float_colorspace;
const char *to_colorspace = global_role_scene_linear;
- memcpy(linear_buffer, handle->buffer, buffer_size * sizeof(float));
+ memcpy(linear_buffer, handle->buffer + scanline_offset, buffer_size * sizeof(float));
if (!is_data && !is_data_display) {
IMB_colormanagement_transform(linear_buffer, width, height, channels,
@@ -1373,17 +1371,12 @@ static float *display_buffer_apply_get_linear_buffer(DisplayBufferThread *handle
* before converting it into display byte buffer, so we need to
* make sure original's ImBuf buffers wouldn't be modified by
* using duplicated buffer here
- *
- * NOTE: MEM_dupallocN can't be used because buffer could be
- * specified as an offset inside allocated buffer
*/
- memcpy(linear_buffer, handle->buffer, buffer_size * sizeof(float));
+ memcpy(linear_buffer, handle->buffer + scanline_offset, buffer_size * sizeof(float));
*is_straight_alpha = false;
}
-
- return linear_buffer;
}
static void *do_display_buffer_apply_thread(void *handle_v)
@@ -1410,46 +1403,69 @@ static void *do_display_buffer_apply_thread(void *handle_v)
}
}
else {
- bool is_straight_alpha;
- float *linear_buffer = display_buffer_apply_get_linear_buffer(handle, &is_straight_alpha);
- bool predivide = is_straight_alpha == false;
+#define SCANLINE_BLOCK_SIZE 64
+ /* TODO(sergey): Instead of nasty scanline-blocking in per-scanline-block thread we might
+ * better to use generic task scheduler, but that would need extra testing
+ * before deploying into production.
+ */
- if (is_data) {
- /* special case for data buffers - no color space conversions,
- * only generate byte buffers
- */
- }
- else {
- /* apply processor */
- IMB_colormanagement_processor_apply(cm_processor, linear_buffer, width, height, channels,
- predivide);
- }
+ int scanlines = (height + SCANLINE_BLOCK_SIZE - 1) / SCANLINE_BLOCK_SIZE;
+ int i;
+ float *linear_buffer = MEM_mallocN(channels * width * SCANLINE_BLOCK_SIZE * sizeof(float),
+ "color conversion linear buffer");
+
+ for (i = 0; i < scanlines; i ++) {
+ int start_scanline = i * SCANLINE_BLOCK_SIZE;
+ int num_scanlines = (i == scanlines - 1) ?
+ (height - SCANLINE_BLOCK_SIZE * i) :
+ SCANLINE_BLOCK_SIZE;
+ int scanline_offset = channels * start_scanline * width;
+ int scanline_offset4 = 4 * start_scanline * width;
+ bool is_straight_alpha, predivide;
+
+ display_buffer_apply_get_linear_buffer(handle, start_scanline, num_scanlines,
+ linear_buffer, &is_straight_alpha);
+ predivide = is_straight_alpha == false;
+
+ if (is_data) {
+ /* special case for data buffers - no color space conversions,
+ * only generate byte buffers
+ */
+ }
+ else {
+ /* apply processor */
+ IMB_colormanagement_processor_apply(cm_processor, linear_buffer, width, num_scanlines, channels,
+ predivide);
+ }
- /* copy result to output buffers */
- if (display_buffer_byte) {
- /* do conversion */
- IMB_buffer_byte_from_float(display_buffer_byte, linear_buffer,
- channels, dither, IB_PROFILE_SRGB, IB_PROFILE_SRGB,
- predivide, width, height, width, width);
- }
+ /* copy result to output buffers */
+ if (display_buffer_byte) {
+ /* do conversion */
+ IMB_buffer_byte_from_float(display_buffer_byte + scanline_offset4, linear_buffer,
+ channels, dither, IB_PROFILE_SRGB, IB_PROFILE_SRGB,
+ predivide, width, num_scanlines, width, width);
+ }
- if (display_buffer) {
- memcpy(display_buffer, linear_buffer, width * height * channels * sizeof(float));
+ if (display_buffer) {
+ memcpy(display_buffer + scanline_offset, linear_buffer, width * num_scanlines * channels * sizeof(float));
- if (is_straight_alpha && channels == 4) {
- int i;
- float *fp;
+ if (is_straight_alpha && channels == 4) {
+ int i;
+ float *fp;
- for (i = 0, fp = display_buffer;
- i < width * height;
- i++, fp += channels)
- {
- straight_to_premul_v4(fp);
+ for (i = 0, fp = display_buffer;
+ i < width * num_scanlines;
+ i++, fp += channels)
+ {
+ straight_to_premul_v4(fp);
+ }
}
}
}
MEM_freeN(linear_buffer);
+
+#undef SCANLINE_BLOCK_SIZE
}
return NULL;
@@ -3132,36 +3148,3 @@ void IMB_colormanagement_finish_glsl_draw(void)
{
OCIO_finishGLSLDraw(global_glsl_state.ocio_glsl_state);
}
-
-/* ** Color space conversion using GLSL shader ** */
-
-/**
- * Configures GLSL shader for conversion from space defined by role
- * to scene linear space
- *
- * Will create appropriate OCIO processor and setup GLSL shader,
- * so further 2D texture usage will use this conversion.
- *
- * Role is an pseudonym for a color space, see bottom of file
- * IMB_colormanagement.h for list of available roles.
- *
- * When there's no need to apply transform on 2D textures, use
- * IMB_colormanagement_finish_glsl_transform().
- */
-bool IMB_colormanagement_setup_transform_from_role_glsl(int role, bool predivide)
-{
- OCIO_ConstProcessorRcPtr *processor;
- ColorSpace *colorspace;
-
- colorspace = colormanage_colorspace_get_roled(role);
-
- processor = colorspace_to_scene_linear_processor(colorspace);
-
- return OCIO_setupGLSLDraw(&global_glsl_state.transform_ocio_glsl_state, processor, NULL, predivide);
-}
-
-/* Finish GLSL-based color space conversion */
-void IMB_colormanagement_finish_glsl_transform(void)
-{
- OCIO_finishGLSLDraw(global_glsl_state.transform_ocio_glsl_state);
-}
diff --git a/source/blender/imbuf/intern/imageprocess.c b/source/blender/imbuf/intern/imageprocess.c
index bde17e17419..71d5f5150ad 100644
--- a/source/blender/imbuf/intern/imageprocess.c
+++ b/source/blender/imbuf/intern/imageprocess.c
@@ -232,6 +232,10 @@ void nearest_interpolation_color(struct ImBuf *in, unsigned char outI[4], float
/* sample area entirely outside image? */
if (x1 < 0 || x1 > in->x - 1 || y1 < 0 || y1 > in->y - 1) {
+ if (outI)
+ outI[0] = outI[1] = outI[2] = outI[3] = 0;
+ if (outF)
+ outF[0] = outF[1] = outF[2] = outF[3] = 0.0f;
return;
}
diff --git a/source/blender/imbuf/intern/oiio/openimageio_api.cpp b/source/blender/imbuf/intern/oiio/openimageio_api.cpp
index fe74b8f7cce..ec9c8fdbb4d 100644
--- a/source/blender/imbuf/intern/oiio/openimageio_api.cpp
+++ b/source/blender/imbuf/intern/oiio/openimageio_api.cpp
@@ -275,6 +275,11 @@ struct ImBuf *imb_load_photoshop(const char *filename, int flags, char colorspac
}
}
+int OIIO_getVersionHex(void)
+{
+ return openimageio_version();
+}
+
} // export "C"
diff --git a/source/blender/imbuf/intern/oiio/openimageio_api.h b/source/blender/imbuf/intern/oiio/openimageio_api.h
index ad11f4bcfe3..df1122584bd 100644
--- a/source/blender/imbuf/intern/oiio/openimageio_api.h
+++ b/source/blender/imbuf/intern/oiio/openimageio_api.h
@@ -39,12 +39,16 @@ extern "C" {
#include <stdio.h>
+struct ImBuf;
+
int imb_is_a_photoshop (const char *name);
int imb_save_photoshop (struct ImBuf *ibuf, const char *name, int flags);
struct ImBuf *imb_load_photoshop (const char *name, int flags, char *colorspace);
+int OIIO_getVersionHex(void);
+
#ifdef __cplusplus
}
diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp
index 922c865a0d5..b25a224e16c 100644
--- a/source/blender/imbuf/intern/openexr/openexr_api.cpp
+++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp
@@ -36,6 +36,7 @@
#include <string>
#include <set>
#include <errno.h>
+#include <algorithm>
#include <openexr_api.h>