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
path: root/source
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2013-09-02 17:54:12 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2013-09-02 17:54:12 +0400
commit529c6d0eeb845da8706db6ab0bb27a1ae3907d9b (patch)
tree3317fc54b131d7132aff24490be4ddefbe49950f /source
parent79759d8368d9b1767ffa61a8506f91027a3e41a0 (diff)
Fix #36124: VSE - Input Color option does not work for video files
Byte images and movies will now fully follow input color space. Before this non-sRGB input colorspace for byte images and movies behave really doggy (results in preview and final render were totally different). To prevent data loss, if byte image is set not stored in sequencer's space it'll be internally converted to float buffer. In theory some setups might be rendering a bit different now, but new behavior is totally expected and someone used non-sRGB input space for byte images/movies had Convert Float enabled anyway.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/sequencer.c50
-rw-r--r--source/blender/imbuf/IMB_colormanagement.h3
-rw-r--r--source/blender/imbuf/intern/colormanagement.c15
3 files changed, 49 insertions, 19 deletions
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index a2ebdae572d..a88818dedcd 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -417,33 +417,41 @@ void BKE_sequencer_editing_free(Scene *scene)
static void sequencer_imbuf_assign_spaces(Scene *scene, ImBuf *ibuf)
{
- IMB_colormanagement_assign_float_colorspace(ibuf, scene->sequencer_colorspace_settings.name);
+ if (ibuf->rect_float) {
+ IMB_colormanagement_assign_float_colorspace(ibuf, scene->sequencer_colorspace_settings.name);
+ }
}
void BKE_sequencer_imbuf_to_sequencer_space(Scene *scene, ImBuf *ibuf, int make_float)
{
const char *from_colorspace = IMB_colormanagement_role_colorspace_name_get(COLOR_ROLE_SCENE_LINEAR);
const char *to_colorspace = scene->sequencer_colorspace_settings.name;
+ const char *float_colorspace = IMB_colormanagement_get_float_colorspace(ibuf);
if (!ibuf->rect_float) {
- if (make_float && ibuf->rect) {
- /* when converting byte buffer to float in sequencer we need to make float
- * buffer be in sequencer's working space, which is currently only doable
- * from linear space.
- *
- */
-
- /*
- * OCIO_TODO: would be nice to support direct single transform from byte to sequencer's
- */
-
- IMB_float_from_rect(ibuf);
+ if (ibuf->rect) {
+ const char *byte_colorspace = IMB_colormanagement_get_rect_colorspace(ibuf);
+ if (make_float || !STREQ(to_colorspace, byte_colorspace)) {
+ /* If byte space is not in sequencer's working space, we deliver float color space,
+ * this is to to prevent data loss.
+ */
+
+ /* when converting byte buffer to float in sequencer we need to make float
+ * buffer be in sequencer's working space, which is currently only doable
+ * from linear space.
+ */
+
+ /*
+ * OCIO_TODO: would be nice to support direct single transform from byte to sequencer's
+ */
+
+ IMB_float_from_rect(ibuf);
+ }
+ else {
+ return;
+ }
}
else {
- /* if there's only byte buffer in image it's already in compositor's working space,
- * nothing to do here
- */
-
return;
}
}
@@ -452,8 +460,10 @@ void BKE_sequencer_imbuf_to_sequencer_space(Scene *scene, ImBuf *ibuf, int make_
if (ibuf->rect)
imb_freerectImBuf(ibuf);
- IMB_colormanagement_transform_threaded(ibuf->rect_float, ibuf->x, ibuf->y, ibuf->channels,
- from_colorspace, to_colorspace, TRUE);
+ if (!STREQ(float_colorspace, to_colorspace)) {
+ IMB_colormanagement_transform_threaded(ibuf->rect_float, ibuf->x, ibuf->y, ibuf->channels,
+ from_colorspace, to_colorspace, TRUE);
+ }
}
}
@@ -2668,6 +2678,8 @@ static ImBuf *do_render_strip_uncached(SeqRenderData context, Sequence *seq, flo
seq->strip->proxy ? seq->strip->proxy->tc : IMB_TC_RECORD_RUN,
seq_rendersize_to_proxysize(context.preview_render_size));
+ BKE_sequencer_imbuf_to_sequencer_space(context.scene, ibuf, FALSE);
+
/* we don't need both (speed reasons)! */
if (ibuf && ibuf->rect_float && ibuf->rect)
imb_freerectImBuf(ibuf);
diff --git a/source/blender/imbuf/IMB_colormanagement.h b/source/blender/imbuf/IMB_colormanagement.h
index 3d2eab56d14..e2def417b95 100644
--- a/source/blender/imbuf/IMB_colormanagement.h
+++ b/source/blender/imbuf/IMB_colormanagement.h
@@ -62,6 +62,9 @@ void IMB_colormanagement_check_is_data(struct ImBuf *ibuf, const char *name);
void IMB_colormanagement_assign_float_colorspace(struct ImBuf *ibuf, const char *name);
void IMB_colormanagement_assign_rect_colorspace(struct ImBuf *ibuf, const char *name);
+const char *IMB_colormanagement_get_float_colorspace(struct ImBuf *ibuf);
+const char *IMB_colormanagement_get_rect_colorspace(struct ImBuf *ibuf);
+
/* ** Color space transformation functions ** */
void IMB_colormanagement_transform(float *buffer, int width, int height, int channels,
const char *from_colorspace, const char *to_colorspace, int predivide);
diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c
index 2c4863c3598..7c3a19a1ff1 100644
--- a/source/blender/imbuf/intern/colormanagement.c
+++ b/source/blender/imbuf/intern/colormanagement.c
@@ -1134,6 +1134,21 @@ void IMB_colormanagement_assign_rect_colorspace(ImBuf *ibuf, const char *name)
ibuf->colormanage_flag &= ~IMB_COLORMANAGE_IS_DATA;
}
+const char *IMB_colormanagement_get_float_colorspace(ImBuf *ibuf)
+{
+ if (ibuf->float_colorspace) {
+ return ibuf->float_colorspace->name;
+ }
+ else {
+ return IMB_colormanagement_role_colorspace_name_get(COLOR_ROLE_SCENE_LINEAR);
+ }
+}
+
+const char *IMB_colormanagement_get_rect_colorspace(ImBuf *ibuf)
+{
+ return ibuf->rect_colorspace->name;
+}
+
/*********************** Threaded display buffer transform routines *************************/
typedef struct DisplayBufferThread {