I created some Blend Algebra functions for the purpose of imitating the corresponding algorithms in Gimp (legacy 8-bit version). They are 4 functions that, reading from the manual, have different formulas from Gimp, as opposed to all the rest. I actually also included “multiply” which has the same formula as Gimp, which I used as a comparison. I attach the 4 “*.ba” functions.

For the test I used the Big Buck Bunny video in h264 and pixel format yuv420p. This is the “bottom” or background track.
The “top” track, on the other hand, is a DNxHR yuv422p video and space color BT709.

I used the X11 driver and compared the color models: RGBA-FLOAT; YUVA-8 and YUV-8.

I used the overlays: Addition; Subtract; Divide and Multiply that are present in the patchbay and compared them with the corresponding Blend Algebra overlays (present in SysLib), based on the formulas in the patchbay and those I created (put in UserLib):

==>SysLib
arith_addition.ba; arith_subtract.ba; arith_multiply.ba and arith_divide.ba

==>UserLib
gimp_addition.ba; gimp_subtract.ba; gimp_multiply.ba and gimp_divide.ba


                            TEST
Since the mailing-list had turned up problems with the YUV color model and transparencies, I did the following tests:


-SUBTRACT-
                        RGBA-FLOAT              YUVA-8              YUV-8

Patchbay -->                OK      !=             OK       =       OK

arith_ -->                  OK       =             OK       =       OK (top)

gimp_ -->                   OK (inv) =             OK (inv) =       OK

- With the patchbay the result obtained is different whether you use RGBA-FLOT or YUV(A)-8.
- With arith_ YUV-8 the plugin works only if you use Top as the track order, while the other two color models work with both track orders.
- With gimp_ RGB-FLOAT and YUVA-8 they work with both “Bottm first” and “Top first,” but give different results. The result can be explained by the subtraction properties where the order of the elements is important. YUV-8 gives the same result with both.


-ADDITION-
                        RGBA-FLOAT              YUVA-8              YUV-8

Patchbay -->                OK       =             OK       =       OK

arith_ -->                  OK       =             OK       =       OK

gimp_ -->                   OK       =             OK       =       OK (Top)



-MULTIPLY-
                        RGBA-FLOAT              YUVA-8              YUV-8

Patchbay -->                OK      !=             OK (B//N) =       OK (B/N)

arith_ -->                  OK       =             OK        =       OK

gimp_ -->                   OK       =             OK        =       OK (top)


With the Patchbay YUV(A) it seems to do the correct multiply, but the result is in Black & White.



-DIVIDE-
                        RGBA-FLOAT              YUVA-8              YUV-8

Patchbay -->                OK      !=             OK       =       OK

arith_ -->                  OK (inv) =             OK (inv) =       OK
                            !=
gimp_ -->                   OK (inv) =             OK (inv) =       OK

In RGBA-FLOAT the result is different between arith_ and gimp_, although I take into account the inversion “Bottom first” and “Top first.” So it is not for YUVA-8, which still has inversion, and for YUV, which does not have inversion either.



There are several strange, or rather, inconsistent results. Some are explainable by the formulas used, others I can't interpret.
The next step is to try to reproduce Igor Vladimirsky's tutorial using gimp_ algorithms, since it doesn't work with patchbay. I will postpone for a few days due to lack of time, though.
