WIP: IMB: Allow BW images in byte to float conversion #118622
|
@ -374,11 +374,6 @@ void cpack_to_rgb(uint col, float *r_r, float *r_g, float *r_b)
|
|||
*r_b = (float)((col >> 16) & 0xFF) * (1.0f / 255.0f);
|
||||
}
|
||||
|
||||
float uchar_to_float(const uchar value)
|
||||
{
|
||||
return ((float)value) * (1.0f / 255.0f);
|
||||
}
|
||||
|
||||
void rgb_uchar_to_float(float r_col[3], const uchar col_ub[3])
|
||||
{
|
||||
r_col[0] = ((float)col_ub[0]) * (1.0f / 255.0f);
|
||||
|
|
|
@ -776,6 +776,14 @@ void IMB_float_from_rect(ImBuf *ibuf)
|
|||
return;
|
||||
}
|
||||
|
||||
OmarEmaraDev marked this conversation as resolved
Outdated
|
||||
/* For color spaces other than sRGB and linear, we force full RGBA channels since color space
|
||||
* conversion might introduce color shifts even for greyscale images. */
|
||||
if (!(IMB_colormanagement_space_is_srgb(ibuf->byte_buffer.colorspace) ||
|
||||
IMB_colormanagement_space_is_scene_linear(ibuf->byte_buffer.colorspace)))
|
||||
{
|
||||
ibuf->channels = 4;
|
||||
}
|
||||
|
||||
IMB_assign_float_buffer(ibuf, rect_float, IB_TAKE_OWNERSHIP);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Shouldn't we initialize
ibuf->channels
based on the number of planes in theelse
branch here? Otherwise it could left uninitialized, or initialized to some default value which is not necessarily corresponding to the desired value?Yah, sorry. Was remnant from the time where I though channels was shared between both byte and float buffers.