[Cin] Some tests on blending

Andrea paz gamberucci.andrea at gmail.com
Wed Apr 2 10:32:21 CEST 2025


I have included some small adds in the manual that deal with HDR. See
if they fit. There would also be to change the Blend Algebra examples
file written by Georgy.

[Part to append to the file
https://cinelerra-gg.org/download/testing/BlendPluginExamples/Examples.txt]:


Example 6.
----------

To tonemapping an HDR media and report its values within the range (0, 1.0):

BLEND_PROGRAM_INIT

COLORSPACE_RGB
PARALLEL_SAFE

BLEND_PROGRAM_PROC

float mult;

mult = KEY_A-0.5;
if (mult >= 0) mult = 1+mult*10;
else mult = 1/(1-mult*10);

R(0) = R(0)*mult;
G(0) = G(0)*mult;
B(0) = B(0)*mult;

BLEND_PROGRAM_END


First attach this blend program to your track above the other plugin
which you want to make not to clip. Switch clipping off in the blend
program dialog. This blend program will use the alpha slider (which
can have the value between 0.0 and 1.0) in the following manner:

0.5 (exactly in the middle): no RGB change
0.6: R,G,B are multiplied by 2
0.7: multiplied by 3
...
1.0: multiplied by 6
0.4: multiplied by 1/2 (i.e. divided by 2)
0.3: multiplied by 1/3
...
0.0: multiplied by 1/6 (divided by 6)

If you set it, for example, to 0.4 here, your R,G,B values will be
divided by 2, so that the color values up to 2.0 will be scaled down
into the clip range. If you can have values up to, let's say, 5.0,
then set the alpha slider to 0.1 to scale down by 5, etc.

Then attach the plugin you need to work unclipped, your histogram or
whatever. Pay attention that all the color values your plugin gets
now, are scaled down uniformly.

Then attach the same blend program once more, under your needed
plugin. This time set the alpha slider to 0.6 (if it is 0.4 in the
upper one), or to 0.9 (if the upper one is 0.1), i.e. displace it from
the middle in the opposite direction. The unclipped values coming from
your working plugin will be scaled back by the same amount.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hdr.tar.gz
Type: application/gzip
Size: 153659 bytes
Desc: not available
URL: <https://lists.cinelerra-gg.org/pipermail/cin/attachments/20250402/31ef964f/attachment-0001.bin>


More information about the Cin mailing list