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')
-rw-r--r--source/blender/imbuf/IMB_colormanagement.h1
-rw-r--r--source/blender/imbuf/intern/colormanagement.c8
-rw-r--r--source/blender/imbuf/intern/divers.c28
-rw-r--r--source/blender/imbuf/intern/indexer.c4
4 files changed, 23 insertions, 18 deletions
diff --git a/source/blender/imbuf/IMB_colormanagement.h b/source/blender/imbuf/IMB_colormanagement.h
index 2f0d2f9b449..0818dd653a1 100644
--- a/source/blender/imbuf/IMB_colormanagement.h
+++ b/source/blender/imbuf/IMB_colormanagement.h
@@ -341,6 +341,7 @@ const char *IMB_colormanagement_look_get_indexed_name(int index);
int IMB_colormanagement_colorspace_get_named_index(const char *name);
const char *IMB_colormanagement_colorspace_get_indexed_name(int index);
+const char *IMB_colormanagement_colorspace_get_name(const struct ColorSpace *colorspace);
const char *IMB_colormanagement_view_get_default_name(const char *display_name);
void IMB_colormanagement_colorspace_from_ibuf_ftype(
diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c
index a58c2ba4c44..b62bdd5521d 100644
--- a/source/blender/imbuf/intern/colormanagement.c
+++ b/source/blender/imbuf/intern/colormanagement.c
@@ -2213,10 +2213,11 @@ void IMB_colormanagement_imbuf_to_byte_texture(unsigned char *out_buffer,
const struct ImBuf *ibuf,
const bool store_premultiplied)
{
- /* Byte buffer storage, only for sRGB and data texture since other
+ /* Byte buffer storage, only for sRGB, scene linear and data texture since other
* color space conversions can't be done on the GPU. */
BLI_assert(ibuf->rect && ibuf->rect_float == NULL);
BLI_assert(IMB_colormanagement_space_is_srgb(ibuf->rect_colorspace) ||
+ IMB_colormanagement_space_is_scene_linear(ibuf->rect_colorspace) ||
IMB_colormanagement_space_is_data(ibuf->rect_colorspace));
const unsigned char *in_buffer = (unsigned char *)ibuf->rect;
@@ -3174,6 +3175,11 @@ const char *IMB_colormanagement_colorspace_get_indexed_name(int index)
return "";
}
+const char *IMB_colormanagement_colorspace_get_name(const ColorSpace *colorspace)
+{
+ return colorspace->name;
+}
+
void IMB_colormanagement_colorspace_from_ibuf_ftype(
ColorManagedColorspaceSettings *colorspace_settings, ImBuf *ibuf)
{
diff --git a/source/blender/imbuf/intern/divers.c b/source/blender/imbuf/intern/divers.c
index 588c92d748d..13c8f0887b3 100644
--- a/source/blender/imbuf/intern/divers.c
+++ b/source/blender/imbuf/intern/divers.c
@@ -695,9 +695,6 @@ void IMB_buffer_byte_from_byte(uchar *rect_to,
void IMB_rect_from_float(ImBuf *ibuf)
{
- float *buffer;
- const char *from_colorspace;
-
/* verify we have a float buffer */
if (ibuf->rect_float == NULL) {
return;
@@ -710,24 +707,21 @@ void IMB_rect_from_float(ImBuf *ibuf)
}
}
- if (ibuf->float_colorspace == NULL) {
- from_colorspace = IMB_colormanagement_role_colorspace_name_get(COLOR_ROLE_SCENE_LINEAR);
- }
- else {
- from_colorspace = ibuf->float_colorspace->name;
- }
+ const char *from_colorspace = (ibuf->float_colorspace == NULL) ?
+ IMB_colormanagement_role_colorspace_name_get(
+ COLOR_ROLE_SCENE_LINEAR) :
+ ibuf->float_colorspace->name;
+ const char *to_colorspace = (ibuf->rect_colorspace == NULL) ?
+ IMB_colormanagement_role_colorspace_name_get(
+ COLOR_ROLE_DEFAULT_BYTE) :
+ ibuf->rect_colorspace->name;
- buffer = MEM_dupallocN(ibuf->rect_float);
+ float *buffer = MEM_dupallocN(ibuf->rect_float);
/* first make float buffer in byte space */
const bool predivide = IMB_alpha_affects_rgb(ibuf);
- IMB_colormanagement_transform(buffer,
- ibuf->x,
- ibuf->y,
- ibuf->channels,
- from_colorspace,
- ibuf->rect_colorspace->name,
- predivide);
+ IMB_colormanagement_transform(
+ buffer, ibuf->x, ibuf->y, ibuf->channels, from_colorspace, to_colorspace, predivide);
/* convert from float's premul alpha to byte's straight alpha */
if (IMB_alpha_affects_rgb(ibuf)) {
diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c
index cbc5d984755..00396c01d99 100644
--- a/source/blender/imbuf/intern/indexer.c
+++ b/source/blender/imbuf/intern/indexer.c
@@ -1098,6 +1098,7 @@ static int indexer_performance_get_decode_rate(FFmpegIndexBuilderContext *contex
while (av_read_frame(context->iFormatCtx, packet) >= 0) {
if (packet->stream_index != context->videoStream) {
+ av_packet_unref(packet);
continue;
}
@@ -1121,6 +1122,7 @@ static int indexer_performance_get_decode_rate(FFmpegIndexBuilderContext *contex
if (end > start + time_period) {
break;
}
+ av_packet_unref(packet);
}
av_packet_free(&packet);
@@ -1145,6 +1147,7 @@ static int indexer_performance_get_max_gop_size(FFmpegIndexBuilderContext *conte
while (av_read_frame(context->iFormatCtx, packet) >= 0) {
if (packet->stream_index != context->videoStream) {
+ av_packet_unref(packet);
continue;
}
packet_index++;
@@ -1158,6 +1161,7 @@ static int indexer_performance_get_max_gop_size(FFmpegIndexBuilderContext *conte
if (packet_index > packets_max) {
break;
}
+ av_packet_unref(packet);
}
av_packet_free(&packet);