Fix #131097: Color space settings of >8bpp movie images do not work

With exception of Sequencer, everywhere else in Blender it is assumed
that float images are in linear color space.

Movie files with more than 8 bit/channel precision are now loaded into
float images (since 39c4c7cf3f), but the "load and use them as an
image" code path was not making sure that they are converted to linear
color space.

Pull Request: https://projects.blender.org/blender/blender/pulls/131141
This commit is contained in:
Aras Pranckevicius
2024-11-29 17:25:57 +01:00
committed by Aras Pranckevicius
parent eaf596c49c
commit f1664e1777
4 changed files with 14 additions and 0 deletions

View File

@@ -4169,6 +4169,7 @@ static ImBuf *load_movie_single(Image *ima, ImageUser *iuser, int frame, const i
ibuf = IMB_makeSingleUser(IMB_anim_absolute(ia->anim, fra, IMB_TC_RECORD_RUN, IMB_PROXY_NONE));
if (ibuf) {
colormanage_imbuf_make_linear(ibuf, ima->colorspace_settings.name);
image_init_after_load(ima, iuser, ibuf);
}
}

View File

@@ -55,6 +55,7 @@
#include "BKE_node_tree_update.hh"
#include "BKE_tracking.h"
#include "IMB_colormanagement.hh"
#include "IMB_imbuf.hh"
#include "IMB_imbuf_types.hh"
#include "IMB_moviecache.hh"
@@ -608,6 +609,9 @@ static ImBuf *movieclip_load_movie_file(MovieClip *clip,
int fra = framenr - clip->start_frame + clip->frame_offset;
ibuf = IMB_anim_absolute(clip->anim, fra, IMB_Timecode_Type(tc), IMB_Proxy_Size(proxy));
if (ibuf) {
colormanage_imbuf_make_linear(ibuf, clip->colorspace_settings.name);
}
}
return ibuf;

View File

@@ -361,6 +361,14 @@ int IMB_anim_get_image_width(ImBufAnim *anim);
int IMB_anim_get_image_height(ImBufAnim *anim);
bool IMB_get_gop_decode_time(ImBufAnim *anim);
/**
* Fetches a frame from a movie at given frame position.
*
* Movies that are <= 8 bits/color channel are returned as byte images;
* higher bit depth movies are returned as float images. Note that the
* color space is returned as-is, i.e. a float image might not be in
* linear space.
*/
ImBuf *IMB_anim_absolute(ImBufAnim *anim,
int position,
IMB_Timecode_Type tc /* = 1 = IMB_TC_RECORD_RUN */,

View File

@@ -1148,6 +1148,7 @@ void colormanage_imbuf_make_linear(ImBuf *ibuf, const char *from_colorspace)
from_colorspace,
to_colorspace,
predivide);
ibuf->float_buffer.colorspace = nullptr;
}
}