вс, 6 нояб. 2022 г., 00:52 Igor Vladimirsky <sitelve@gmail.com>:


ср, 2 нояб. 2022 г. в 12:53, Andrew Randrianasulu <randrianasulu@gmail.com>:
So, as Igor noticed CinGG's divide and subtract modes do not behave like they behaved in Cin HV/CV/CVE I digged into matter a bit and found few confusing (for me, amateur) things...... 
 But moreover, according to documentation CinGG composites tracks a bit backward comparing to photo editors:


 I found this in my archive.

Very cool, thanks!

So, for your specific preferences does inverting S and D in overlayframe.h for subtract and divide return familiar behavior, especially with  huge use of reroute/inversion? I do not think making it new default unconditionally will be good, because some modes compositing this way and some - that way add too much confusion, but a) you can use personal patch and hopefully b) I'll find some way to make this behavior configurable ....



In 2016,  I asked GoodGuy about the Divide blend mode.
I showed him a quote from from Changelog 2.1 https://github.com/cinelerra-cv-team/cinelerra-cv/blob/master/cinelerra/CHANGELOG.2.1
Quote:" For overlaying, divide behavior is the same as the Gimp.
New overlaying algorithm: Max takes the maximum r, g, and b values."

GG's answer:
------------------------------------
"This is the math form Gimp currently uses:
STD_BLEND + (Sa == 0.0 || Dc / Sc > Da / Sa ?  Sa * Da : Dc * Sa * Sa / Sc)

HV 4.6.1 (and CV) actually uses:
(Sc > 0 ? Dc / Sc : 1)

Cin5 actually uses:
(Dc > 0 ? Sc / Dc : 0)

So, none of these look like Gimp. But Divide is a bit squirrelly.  
It can fail on a per pixel basis because of divide by zero.  
I prefer src (top track) / dst (btm track) with divide by zero as black (not white).  
I think this is the way most would like to see it work, since it is a stack of operations, and it easier to work up from zero, than down from 1."

---------------------------------------

----------------------------------------

This is from CGG'code
Cinelerra-GG
// DIVIDE       [Sa + Da - Sa*Da, Sc*(1 - Da) + Dc*(1 - Sa) +  Sc / Dc]
// SUBTRACT     [(Sa - Da), (Sc - Dc)]


But in HV and CV*, the Subtract and Divide blend modes work the same way as GIMP, Photoshop, Adobe Premiere Pro, EDIUS

GIMP
Divide mode multiplies each pixel value in the lower layer by 256 and then divides that by the corresponding pixel value of the upper layer plus one.
Subtract mode subtracts the pixel values of the upper layer from the pixel values of the lower layer.

Photoshop
https://photoblogstop.com/photoshop/photoshop-blend-modes-explained
Divide
Background layer ÷ Active layer = Quotient
Subtract
B minus A

Adobe Premiere Pro
https://helpx.adobe.com/premiere-pro/using/blending-modes.html
Divide
Divides underlying color by source color. If the source color is white, the result color is the underlying color. Result color values can be greater than 1.0 in 32-bpc projects.
Subtract
Subtracts the source file from the underlying color. If the source color is black, the result color is the underlying color. Result color values can be less than 0 in 32-bpc project

EDIUS (quote from its manual)
Subtract
Subtracts the overlay color values from the background.