View Issue Details

IDProjectCategoryView StatusLast Update
0000559Cinelerra-GG[All Projects] Bugpublic2021-11-09 08:21
ReporterPhyllisSmith Assigned ToPhyllisSmith  
PriorityhighSeverityminorReproducibilityhave not tried
Status feedbackResolutionopen 
Product Version 
Target VersionFixed in Version 
Summary0000559: Fade In/Fade out flash bug
Description"Fade black flash" bug reported in the Mailing List around March 7/8, 2021. More information follows from IgorB:

    I confirm the bug reported by Camille.
    Here two videos about Title effect and Image with Dissolve Transition:
    https://streamable.com/86y59m
    https://streamable.com/ywcaee

    This is my trick to solve it:
    https://streamable.com/vkp9ou
TagsNo tags attached.

Activities

IgorBeg

IgorBeg

2021-11-09 08:21

reporter   ~0005161

Thank you so much, @PhyllisSmith !
PhyllisSmith

PhyllisSmith

2021-11-07 22:14

manager   ~0005151

@IgorBeg
If you want, you can delete you video now as I downloaded it and see the problem.
The freelancer I was working with got real busy, but I will try to get a better fix - at least for the Titler.
IgorBeg

IgorBeg

2021-11-03 07:57

reporter   ~0005130

@PhyllisSmith
About Title plugin and its FadeIn/FadeOut I have done two tests, comparing Cin_20210930 release and Cin_20211031. Tests use YUVA-8bit Colour Model.

I made a video where the two Compositors can be compared face to face, same project and same conditions. On the top, left side, you can see the Compositor of the Cin_20210930 release; on the top, right side, you can see the Compositor of the Cin_20211031 release.

The duration of the Fade In and Fade Out is 2 seconds.
The first part of the video (Overlay Mode = Normal) show that Cin_20211031 works fine (although there seems to be a problem with the alpha channel), meanwhile Cin_20210930 doesn't.
The second part of the video (Overlay Mode --> Arithmetic = Subtract) show that Cin_20211031 doesn't work (and alpha channel also has problems, for me) but Cin_20210930 works fine.

 I hope it is clearer.

To see/download the video, link to
http://www.visi1.org/temp/Cin_Title-FadeInOut_compare-20210930-vs-20211031.ogg
I am sorry, "streamable.com" site doesn't work without registration anymore.
I will leave that file there for some days. Let me know when you have downloaded the file, please. So I can delete it from host.


In RGBA-FLOAT Color Model,
the flash that I saw in Cin_20211013 on the first frame of the Title, with FadeIn/FadeOut, doesn't happen anymore. Good.

(My Operating System is UbuntuStudio_16.04_64bit, and I am using CinGG-x86_64-older_distros.AppImage)
IgorBeg

IgorBeg

2021-10-23 08:11

reporter   ~0005113

Sorry @PhyllisSmith, I see you are speaking about Title plugin. I haven't tried Title plugin and its FadeIn/FadeOut with different Overlay modes in Patchbay.
Using your "cin-20211013_pluginsLoad_fade-older_distros.AppImage", I can see that Title plugin with FadeIn/FadeOut do a kind of flash on the first frame of the Title when the FadeIn/FadeOut occur but only in RGBA-FLOAT Color Model. May be the Freelancer have fixed that?

In my https://www.cinelerra-gg.org/bugtracker/view.php?id=559#c5090 post I spoke about Dissolve Transition on the PNGs using Overlay Modes in Patchbay; and you can see my test Project.

Finally, I don't use patches made by developers because I am afraid to break my things and, because I am really, really, ignorant in Linux, I prefer to avoid that. I should do an image of my system with Clonezilla_DVD (as sometimes I do) before, but it would take time. Sorry.

If you can, and you have time, could you make an other "older_distros.AppImage" for me? I could test it. Thanks!
PhyllisSmith

PhyllisSmith

2021-10-23 01:17

manager   ~0005112

@IgorBeg
I am still trying to confirm your results using the patch in the last note.
I have found that the patch fixes the Arithmetic/Subtract overlay function. See attached. Correct me if I am wrong

incorrect.png (223,055 bytes)
incorrect.png (223,055 bytes)
correct.png (201,604 bytes)
correct.png (201,604 bytes)
PhyllisSmith

PhyllisSmith

2021-10-21 03:43

manager   ~0005099

@Andrew-R
The freelancer did fix the RGBA-FLOAT issue with Dissolve (X11 driver only, not X11-OpenGL) and it is attached.
I have downloaded your patch and will look at it tomorrow. I have tried to run Igor's test case but am pretty much totally confused by the results -- I do not see the issue at all.

fadeInOut.dissolve.overlayframe.h.v2.patch (1,228 bytes)
diff --git a/cinelerra-5.1/cinelerra/overlayframe.h b/cinelerra-5.1/cinelerra/overlayframe.h
index 13c2e4b..4f0f686 100644
--- a/cinelerra-5.1/cinelerra/overlayframe.h
+++ b/cinelerra-5.1/cinelerra/overlayframe.h
@@ -321,6 +321,19 @@ ZTYP(float);	ZTYP(double);
   } \
   ALPHA_STORE(out, ofs, mx)
 
+#define ALPHA4_STORE(out, ofs, mx) \
+  r = aclip(r, mx); \
+  g = ofs ? cclip(g, mx) : aclip(g, mx); \
+  b = ofs ? cclip(b, mx) : aclip(b, mx); \
+    double alpha_in = 1.0*a*opcty/mx, alpha_out = 1.0*out3*trnsp/mx, total = alpha_in + (1 - alpha_in) * alpha_out; \
+    r = (r * alpha_in + out0 * (1 - alpha_in) * alpha_out) / total; r = aclip(r, mx); \
+    g = (g * alpha_in + out1 * (1 - alpha_in) * alpha_out) / total; g = ofs ? cclip(g, mx) : aclip(g, mx); \
+    b = (b * alpha_in + out2 * (1 - alpha_in) * alpha_out) / total; b = ofs ? cclip(b, mx) : aclip(b, mx); \
+    a = total; \
+  ALPHA_STORE(out, ofs, mx); \
+  out[3] = aclip(a, mx)
+
+/*
 #define ALPHA4_STORE(out, ofs, mx) \
   r = aclip(r, mx); \
   g = ofs ? cclip(g, mx) : aclip(g, mx); \
@@ -333,6 +346,7 @@ ZTYP(float);	ZTYP(double);
   } \
   ALPHA_STORE(out, ofs, mx); \
   out[3] = aclip(a, mx)
+*/
 
 #define BLEND_SWITCH(FN) \
 	switch( mode ) { \
Andrew-R

Andrew-R

2021-10-21 00:59

reporter   ~0005098

hack

0032-Add-hackish-new-overlay-blend-modes.patch (7,926 bytes)
From 4e20a974d17fd0165d227ca74d5755faf53fad14 Mon Sep 17 00:00:00 2001
From: Andrew Randrianasulu <[email protected]>
Date: Fri, 2 Jul 2021 23:23:29 +0300
Subject: [PATCH 32/72] Add hackish new overlay/blend modes

---
 cinelerra-5.1/cinelerra/overlayframe.C   |  2 -
 cinelerra-5.1/cinelerra/overlayframe.h   | 86 ++++++++++++++++++++++++
 cinelerra-5.1/cinelerra/overlayframe.inc |  5 +-
 cinelerra-5.1/cinelerra/patchbay.C       |  3 +
 cinelerra-5.1/cinelerra/vpatchgui.C      |  6 ++
 5 files changed, 99 insertions(+), 3 deletions(-)

diff --git a/cinelerra-5.1/cinelerra/overlayframe.C b/cinelerra-5.1/cinelerra/overlayframe.C
index 270755cc..801ae9d3 100644
--- a/cinelerra-5.1/cinelerra/overlayframe.C
+++ b/cinelerra-5.1/cinelerra/overlayframe.C
@@ -351,5 +351,3 @@ int OverlayFrame::overlay(VFrame *output, VFrame *input,
 	}
 	return 0;
 }
-
-
diff --git a/cinelerra-5.1/cinelerra/overlayframe.h b/cinelerra-5.1/cinelerra/overlayframe.h
index 13c2e4bd..ace2fa02 100644
--- a/cinelerra-5.1/cinelerra/overlayframe.h
+++ b/cinelerra-5.1/cinelerra/overlayframe.h
@@ -45,6 +45,9 @@
 #define ONE 1
 #define TWO 2
 
+// Sa = source alpha, Sc = source color
+// Da = dst alpha, Dc = dst color
+
 // NORMAL	[Sa + Da * (1 - Sa), Sc * Sa + Dc * (1 - Sa)])
 #define ALPHA_NORMAL(mx, Sa, Da) (Sa + (Da * (mx - Sa)) / mx)
 #define COLOR_NORMAL(mx, Sc, Sa, Dc, Da) ((Sc * Sa + Dc * (mx - Sa)) / mx)
@@ -220,6 +223,86 @@
   (mabs(Sc * Da - Dc * Sa) / mx))
 #define CHROMA_DIFFERENCE COLOR_DIFFERENCE
 
+// REFLECT [Sa * Sa / (1 - Da]
+#define ALPHA_REFLECT(mx, Sa, Da) (Sa * Sa  * (mx - Da) / mx)
+#define COLOR_REFLECT(mx, Sc, Sa, Dc, Da) (Sc * Sc * (mx - Dc) / mx)
+#define CHROMA_REFLECT COLOR_REFLECT
+
+// AVERAGE [ Sa + Da)/2 , (Sc + Dc)/2 ]
+#define ALPHA_AVERAGE(mx, Sa, Da) ((Sa + Da) / 2)
+#define COLOR_AVERAGE(mx, Sc, Sa,  Dc, Da) ((Sc + Dc) / 2 )
+#define CHROMA_AVERAGE COLOR_AVERAGE
+
+#define GAMMA 2.4
+static inline double mpow(double a, double b) { return pow(a, b); }
+
+inline double poly7(double x, double a, double b, double c, double d,
+                              double e, double f, double g, double h) {
+    double ab, cd, ef, gh, abcd, efgh, x2, x4;
+    x2 = x*x; x4 = x2*x2;
+    ab = a*x + b; cd = c*x + d;
+    ef = e*x + f; gh = g*x + h;
+    abcd = ab*x2 + cd; efgh = ef*x2 + gh;
+    return abcd*x4 + efgh;
+}
+
+inline double srgb_to_linear(double x) {
+    if (x <= 0.04045) return x / 12.92;
+
+    // Polynomial approximation of ((x+0.055)/1.055)^2.4.
+    return poly7(x, 0.15237971711927983387,
+                   -0.57235993072870072762,
+                    0.92097986411523535821,
+                   -0.90208229831912012386,
+                    0.88348956209696805075,
+                    0.48110797889132134175,
+                    0.03563925285274562038,
+                    0.00084585397227064120);
+}
+
+inline double linear_to_srgb(double x) {
+    if (x <= 0.0031308) return x * 12.92;
+
+    // Piecewise polynomial approximation (divided by x^3)
+    // of 1.055 * x^(1/2.4) - 0.055.
+    if (x <= 0.0523) return poly7(x, -6681.49576364495442248881,
+                                      1224.97114922729451791383,
+                                      -100.23413743425112443219,
+                                         6.60361150127077944916,
+                                         0.06114808961060447245,
+                                        -0.00022244138470139442,
+                                         0.00000041231840827815,
+                                        -0.00000000035133685895) / (x*x*x);
+
+    return poly7(x, -0.18730034115395793881,
+                     0.64677431008037400417,
+                    -0.99032868647877825286,
+                     1.20939072663263713636,
+                     0.33433459165487383613,
+                    -0.01345095746411287783,
+                     0.00044351684288719036,
+                    -0.00000664263587520855) / (x*x*x);
+}
+
+// from https://stackoverflow.com/questions/6475373/optimizations-for-pow-with-const-non-integer-exponent
+
+
+
+//#define LINEAR2SRGB(in) (in <= 0.0031308 ? 12.92 * in : 1.055 * mpow(in, 1.0/GAMMA) - 0.055)
+//#define SRGB2LINEAR(in) (in <= 0.04045 ? in / 12.92 : mpow((in + 0.055) / 1.055, GAMMA))
+
+#define A_BLEND(top, bottom, alpha, max) \
+        max * linear_to_srgb(srgb_to_linear(1. * top / max)+ srgb_to_linear(1. * bottom / max)*(1.0 - (1. * alpha / max)))
+
+// Change lines:
+// #define ALPHA_NORMAL(mx, Sa, Da) (Sa + (Da * (mx - Sa)) / mx)
+// #define COLOR_NORMAL(mx, Sc, Sa, Dc, Da) ((Sc * Sa + Dc * (mx - Sa)) / mx)
+// To:
+#define ALPHA_NORMALS(mx, Sa, Da) ((Sa + (mx - Sa)*(mx - Sa)) / mx)
+#define COLOR_NORMALS(mx, Sc, Sa, Dc, Da) A_BLEND(Sc, Dc, Sa, mx)
+#define CHROMA_NORMALS COLOR_NORMALS
+
+
 static inline int   mabs(int32_t v) { return abs(v); }
 static inline int   mabs(int64_t v) { return llabs(v); }
 static inline float mabs(float v)   { return fabsf(v); }
@@ -366,6 +449,9 @@ ZTYP(float);	ZTYP(double);
 	case TRANSFER_HARDLIGHT:	FN(HARDLIGHT); \
 	case TRANSFER_SOFTLIGHT:	FN(SOFTLIGHT); \
 	case TRANSFER_DIFFERENCE:	FN(DIFFERENCE); \
+	case TRANSFER_REFLECT:		FN(REFLECT); \
+	case TRANSFER_AVERAGE:		FN(AVERAGE); \
+	case TRANSFER_NORMALS:		FN(NORMALS); \
 	}
 
 class OverlayKernel
diff --git a/cinelerra-5.1/cinelerra/overlayframe.inc b/cinelerra-5.1/cinelerra/overlayframe.inc
index 5f84036d..f155eb4a 100644
--- a/cinelerra-5.1/cinelerra/overlayframe.inc
+++ b/cinelerra-5.1/cinelerra/overlayframe.inc
@@ -24,7 +24,7 @@
 
 // Modes
 
-#define TRANSFER_TYPES 30
+#define TRANSFER_TYPES 33
 
 #define TRANSFER_NORMAL		0
 #define TRANSFER_ADDITION	1
@@ -56,6 +56,9 @@
 #define TRANSFER_HARDLIGHT	27
 #define TRANSFER_SOFTLIGHT	28
 #define TRANSFER_DIFFERENCE	29
+#define TRANSFER_REFLECT	30
+#define TRANSFER_AVERAGE	31
+#define TRANSFER_NORMALS	32
 
 
 // Interpolation types
diff --git a/cinelerra-5.1/cinelerra/patchbay.C b/cinelerra-5.1/cinelerra/patchbay.C
index c2ae534d..bc593617 100644
--- a/cinelerra-5.1/cinelerra/patchbay.C
+++ b/cinelerra-5.1/cinelerra/patchbay.C
@@ -218,6 +218,9 @@ void PatchBay::create_objects()
 		"mode_hardlight",
 		"mode_softlight",
 		"mode_difference",
+		"mode_reflect",
+		"mode_average",
+		"mode_normals",
 	};
 	for( int mode=0; mode<TRANSFER_TYPES; ++mode ) {
 		mode_icons[mode] = new BC_Pixmap(this,
diff --git a/cinelerra-5.1/cinelerra/vpatchgui.C b/cinelerra-5.1/cinelerra/vpatchgui.C
index 53ec27fb..d8e64c5c 100644
--- a/cinelerra-5.1/cinelerra/vpatchgui.C
+++ b/cinelerra-5.1/cinelerra/vpatchgui.C
@@ -354,6 +354,9 @@ void VModePatch::create_objects()
 	submenu->add_submenuitem(new VModeSubMenuItem(submenu, mode_to_text(TRANSFER_DIVIDE),   TRANSFER_DIVIDE));
 	submenu->add_submenuitem(new VModeSubMenuItem(submenu, mode_to_text(TRANSFER_MULTIPLY), TRANSFER_MULTIPLY));
 	submenu->add_submenuitem(new VModeSubMenuItem(submenu, mode_to_text(TRANSFER_REPLACE),  TRANSFER_REPLACE));
+	submenu->add_submenuitem(new VModeSubMenuItem(submenu, mode_to_text(TRANSFER_REFLECT),  TRANSFER_REFLECT));
+	submenu->add_submenuitem(new VModeSubMenuItem(submenu, mode_to_text(TRANSFER_AVERAGE),  TRANSFER_AVERAGE));
+	submenu->add_submenuitem(new VModeSubMenuItem(submenu, mode_to_text(TRANSFER_NORMALS),  TRANSFER_NORMALS));
 	add_item(mode_item = new VModePatchItem(this, _("PorterDuff..."), -1));
 	mode_item->add_submenu(submenu = new VModePatchSubMenu(mode_item));
 	submenu->add_submenuitem(new VModeSubMenuItem(submenu, mode_to_text(TRANSFER_DST),	TRANSFER_DST));
@@ -436,6 +439,9 @@ const char* VModePatch::mode_to_text(int mode)
 	case TRANSFER_HARDLIGHT:	return _("Hardlight");
 	case TRANSFER_SOFTLIGHT:	return _("Softlight");
 	case TRANSFER_DIFFERENCE:	return _("Difference");
+	case TRANSFER_REFLECT:		return _("Reflect");
+	case TRANSFER_AVERAGE:		return _("Average");
+	case TRANSFER_NORMALS:		return _("NormalS");
 	}
 	return _("Normal");
 }
-- 
2.33.1

Andrew-R

Andrew-R

2021-10-21 00:57

reporter   ~0005097

may be (if problem really in converting sRGB<>linear, as suggested by earlier patch) we can extract same conversion into new plugin?

I made some hackpatch adding specialized overlay mode for this case but guess track-long conversion not always best idea?
PhyllisSmith

PhyllisSmith

2021-10-19 01:06

manager   ~0005093

@IgorBeg
I do not think it is better as it breaks things.
Anyway, a fix for the Title plugin for RGBA-FLOAT when using the X11 Video Driver has been checked into GIT. Good thing Igor checked this for Dissolve because it led me to do more testing in the Titler and find this bug (worked correctly with X11-OpenGL driver BUT more importantly, it rendered incorrectly because like X11 that uses software.
IgorBeg

IgorBeg

2021-10-18 07:24

reporter   ~0005092

@Andrea_Paz
Thanks for your confirm and the videos.

@PhyllisSmith
I am sorry for all those differences. I think that it will be hard to fix that, I hope I am wrong.
If other users think that it is better to have an "usable" Dissolve transition (for PNGs, pictures) in Normal Mode we could keep the Freelancer version. I don't know how many users use the Overlay Mode in their Projects,... I do.
PhyllisSmith

PhyllisSmith

2021-10-17 15:18

manager   ~0005091

@IgorBeg
Worse than I thought. Yes, the test project will help tremendously. Thank you
IgorBeg

IgorBeg

2021-10-17 12:16

reporter   ~0005090

Test with cin-20211013_pluginsLoad_fade-older_distros.AppImage

A PNG with Dissolve transition must have a video track below with a clip/PNG, or a Gradient plugin, otherwise Dissolve transition is not performed. With a video clip it works right.

Also Anti-aliasing on the PNG with alpha channel (for example a text) doesn't work if there isn't a video track below with a clip/PNG; but this last thing didn't work before either.

==============================
Overlay Mode tests in YUVA-8bit.
Tests made with two video tracks:
- Top track with two PNGs with Alpha channel (PNG_1 and PNG_2, both with only a text of a different colour). Insert the Dissolve transition at the beginning of the first clip, between the two clips, and at the end of the second clip.
- Bottom track uses the Gradient Plugin (first colour: purple; second colour: white).

Arithmetic...->
- Divide (behaviour slightly different by before)
- Replace (It doesn't perform the Dissolve transition; the old version yes)
PorteDuff...->
- Src (It doesn't perform the Dissolve transition; the old version yes)
- SrcAtop (It doesn't perform the Dissolve transition; the old version yes)
- SrcIn (It doesn't perform the Dissolve transition; the old version yes)
- SrcOver (It doesn't perform the Dissolve transition; the old version yes)
Logical...->
- Min (It doesn't perform the Dissolve transition; the old version yes)
- Max (It doesn't perform the Dissolve transition; the old version yes)
- Lighten (It doesn't perform the Dissolve transition; the old version yes)
- AND (It doesn't perform the Dissolve transition; the old version yes)
- OR (It doesn't perform the Dissolve transition; the old version yes)
Graphic Art...->
- Overlay (It doesn't perform the Dissolve transition; the old version yes)
- Screen (It doesn't perform the Dissolve transition; the old version yes)
- Burn (behaviour slightly different by before)
- Dodge (behaviour slightly different by before)
- Difference (It doesn't perform the Dissolve transition; the old version yes)
- Hardlight (It doesn't perform the Dissolve transition; the old version yes)
- Softlight (It doesn't perform the Dissolve transition; the old version yes)

Note: in some tests, using different Modes, show that Anti-Aliasing on PNG with text, it seems to work inside the Dissolve transition but don't outside. In the old version Anti-Aliasing doesn't work both inside and outside the Dissolve transition.

I added my test Project if it can help.

FadeIN-FadeOUT_ForTest-02.tar.gz (26,348 bytes)
Andrea_Paz

Andrea_Paz

2021-10-17 11:43

manager   ~0005089

Here my test. I confirm IgorBeg's results:

https://streamable.com/4lr8tr
https://streamable.com/tsdgcp
https://streamable.com/y3dot9
PhyllisSmith

PhyllisSmith

2021-10-16 15:24

manager   ~0005088

@IgorBeg
Since the freelancer does not have a fix yet, if you have time, could you continue to test RGBA-8bit because at least then we can see if there are even more problems. Thanks for your time.
IgorBeg

IgorBeg

2021-10-15 07:30

reporter   ~0005080

PhyllisSmith wrote:
I need to test more options myself before asking others to do so -- sorry

Don't worry for that,... thank you.
Okay, I will wait for your new AppImage. Thanks for your time.
PhyllisSmith

PhyllisSmith

2021-10-14 15:52

manager   ~0005077

@IgorBeg
Please wait for a new AppImage before testing further if you have time this weekend. The Freelancer is working on a fix.
Thank you so much for finding this bug (and it is in the Title plugin too) as it was an omission. I need to test more options myself before asking others to do so -- sorry.
IgorBeg

IgorBeg

2021-10-14 07:58

reporter   ~0005076

Thanks @PhyllisSmith for the cin-20211013_pluginsLoad_fade-older_distros.AppImage.
I have only done quick tests, sorry. More tests this week end, I hope.
It seems to work fine except for RGBA-FLOAT colour model. I didn't try the different modes in PatchBay.

In my fist test I am using two video tracks:
- Top track with two PNGs with Alpha channel (PNG_1 and PNG_2, both with only a text of a different colour). Insert the Dissolve transition at the beginning of the first clip, between the two clips, and at the end of the second clip.
- Bottom track uses the Gradient Plugin (first colour: purple; second colour: white).

Change the Colour Model (Settings-> Format-> Video Section ==> Color Model): YUVA-8, RGBA-8, RGBA-FLOAT.
In RGBA-FLOAT instead of the gradient I see the white colour.
PhyllisSmith

PhyllisSmith

2021-10-13 01:41

manager   ~0005067

@IgorBeg
I made a new AppImage on Ubuntu 16 that includes the Dissolve fade in/out patch if you have time to test it. It is my biggest concern because the patch change overlayframe.h which is included in 13 Cinelerra files and 23 plugins/transitions. I just wrote over the last testing file. This fix ONLY fixes it for the X11 Video Driver (not OpenGL yet).

https://cinelerra-gg.org/download/testing/cin_pluginsLoad_fade-older_distros.AppImage

@Andrea_Paz
I know you are busy too, but if you have any time to test, it would be appreciated. Especially the SRC OVER... stuff in the patch bay. This AppImage also includes Andrew's LV2 patch to MatN's modifications.
IgorBeg

IgorBeg

2021-10-12 07:37

reporter   ~0005061

Thanks @PhyllisSmith for the 20211010_AppImage https://cinelerra-gg.org/download/testing/cin_pluginsLoad_fade-older_distros.AppImage.
I tested the Title's fade issue as it was shown in "Cin_20201031_TitleFadeINOUT_issue_1.ogv" video, link to https://streamable.com/86y59m (2021-03-09, anymore available): it was for Title effect and its own dissolve feature.
For me it works very good.
Thanks Phyllis and Freelancer!

PS:
Sorry, I didn't try the "fadeInOut.dissolve.overlayframe.h.patch" patch.
Andrea_Paz

Andrea_Paz

2021-10-11 08:12

manager   ~0005047

My test is OK: I don't see any shadows in the title as seen in IgorBeg's video. But, I'm not sure how the Fade issue works, and I don't know if the test I did is appropriate.
PhyllisSmith

PhyllisSmith

2021-10-11 00:25

manager   ~0005043

Here is the patch to fix the Dissolve fade in/fade out. This one NEEDS LOTS OF TESTING. It is attached. All you have to do for people who do their own builds to apply the patch is:
1) go to the cinelerra-5.1/cinelerra directory
2) patch < fadeInOut.dissolve.overlayframe.h.patch
You will have to "make clean" and do a full build because it modified overlayframe.h which is used in many, many places. Makes me nervous.

fadeInOut.dissolve.overlayframe.h.patch (1,116 bytes)
diff --git a/cinelerra-5.1/cinelerra/overlayframe.h b/cinelerra-5.1/cinelerra/overlayframe.h
index 13c2e4b..f72e518 100644
--- a/cinelerra-5.1/cinelerra/overlayframe.h
+++ b/cinelerra-5.1/cinelerra/overlayframe.h
@@ -321,6 +321,21 @@ ZTYP(float);	ZTYP(double);
   } \
   ALPHA_STORE(out, ofs, mx)
 
+#define ALPHA4_STORE(out, ofs, mx) \
+  r = aclip(r, mx); \
+  g = ofs ? cclip(g, mx) : aclip(g, mx); \
+  b = ofs ? cclip(b, mx) : aclip(b, mx); \
+  if( trnsp ) { \
+    double alpha_in = 1.0*a*opcty/mx, alpha_out = 1.0*out3*trnsp/mx, total = alpha_in + alpha_out; \
+    r = (r * alpha_in + out0 * alpha_out) / total; \
+    g = (g * alpha_in + out1 * alpha_out) / total; \
+    b = (b * alpha_in + out2 * alpha_out) / total; \
+    a = (a * opcty + out3 * trnsp) / mx; \
+  } \
+  ALPHA_STORE(out, ofs, mx); \
+  out[3] = aclip(a, mx)
+
+/*
 #define ALPHA4_STORE(out, ofs, mx) \
   r = aclip(r, mx); \
   g = ofs ? cclip(g, mx) : aclip(g, mx); \
@@ -333,6 +348,7 @@ ZTYP(float);	ZTYP(double);
   } \
   ALPHA_STORE(out, ofs, mx); \
   out[3] = aclip(a, mx)
+*/
 
 #define BLEND_SWITCH(FN) \
 	switch( mode ) { \
PhyllisSmith

PhyllisSmith

2021-10-10 21:33

manager   ~0005042

@IgorBeg
There is also a fix for the Dissolve fade in/out problem but it is not included in this AppImage. It modifies overlayframe.h so potentially could affect SRC OVER, SRC ... Also, it only works when using X11 as the driver BUT as Andrea always points out to me and is stated in the manual, the transitions are better used with software instead of OpenGL.
PhyllisSmith

PhyllisSmith

2021-10-10 19:22

manager   ~0005039

@IgorBeg
A different freelancer has submitted a code fix for the fade in/fade out problem in the Title plugin.
The fix is localized and should not affect old project and using multiple effects to maintain compatibility.
If you have time to verify the fix, I would really appreciate it as I am not very good at doing a thorough test and compatibility must be maintained. Thank you. This AppImage also contain prevention of reload of plugins on every startup.

https://cinelerra-gg.org/download/testing/cin_pluginsLoad_fade-older_distros.AppImage

@Andrea_Paz
This fix is included in the other AppImage too so if you have a good test case to use, it would be so helpful also.

https://cinelerra-gg.org/download/testing/cin_pluginsLoad_fade-newer_distros.AppImage
PhyllisSmith

PhyllisSmith

2021-06-25 19:57

manager   ~0004862

Last edited: 2021-06-25 20:55

View 2 revisions

@IgorBeg
Thank you so much for the feedback. I will try to duplicate your gradient example to see what you are talking about.
@Andrew-R has been looking at this also and suggested perhaps we could special case for the Titler and Dissolve to use the new code and everything else keep using the old code. It would be hard for me to figure out how to do this though.

At least the mod fixes the reported bug, but it looks like we can not use it as is because of too much destruction.

Also, if I start with my current $HOME/.bcast5, the problem still occurs. If I start with a new one, the mod fixes the problem so there is some setting in Cinelerra_rc that retains the bad flash somehow.

IgorBeg

IgorBeg

2021-06-25 09:37

reporter   ~0004861

Thanks for the AppImage.
My tests compare Cin_20201031_static with Cin_20210624_AppImage.
I am using two my test xml (Project) files.

In my tests I am using a Gradient effect as bottom (background) video track.
Bottom track with Gradient Effect: Shape=Linear; Angle=83; Rate=Log; InnerRadius=3; OuterRadius=46; InnerColor= ffffffff; OuterColor=ff2a0c66.

In Cin_20210624_AppImage there is a different behaviour from YUVA8 to RGBA8, and there is a strange banding effect. Those there aren't on Cin_20201031_static release.

Changing some "OverlayMode" in Patchbay the behaviour is different for the two releases. So, an old project would no longer be compatible with the new Cin version.

If I add "Color3Way" effect on a top video track where there are PNGs (with Alpha channel) and Dissolve transitions that effect is transferred to the bottom video track and it changes the old behaviour.

The new mod works fine "alone", but with usual effects and an old Project, unfortunately you lose compatibility.

I could make some screencasts but I need a lot of time and I think I might just confuse you.
PhyllisSmith

PhyllisSmith

2021-06-23 22:23

manager   ~0004860

@IgorBeg
I need your testing expertise. A Freelancer has provided a fix but I can not tell for sure if it is totally correct and has no side effects.
Could you test it really well using the file at: https://cinelerra-gg.org/download/testing/cin_for_older_distros.AppImage ?
When I test on Fedora, using the black_flash demo provided by Camille, it seems to work (both Title plugin and Dissolve Transition).
When I test on Ubuntu 14, I had to start with a "fresh" copy of .bcast5 to get it to work correctly.

Some concern I have is that the modification is in overlayframe.h which is used in several places in Cinelerra.
Anyone is welcome to test and the "for older distros" works on the newer distros just as well.

If Andrew or anyone else who does their own builds, wants to rebuild change the following lines in overlayframe.h.

After line:
#define TWO 2

Add:
#define GAMMA 2.4
static inline double mpow(double a, double b) { return pow(a, b); }

#define LINEAR2SRGB(in) (in <= 0.0031308 ? 12.92 * in : 1.055 * mpow(in, 1.0/GAMMA) - 0.055)
#define SRGB2LINEAR(in) (in <= 0.04045 ? in / 12.92 : mpow((in + 0.055) / 1.055, GAMMA))

#define A_BLEND(top, bottom, alpha, max) \
        max * LINEAR2SRGB(SRGB2LINEAR(1. * top / max)+ SRGB2LINEAR(1. * bottom / max)*(1.0 - (1. * alpha / max)))

Change lines:
#define ALPHA_NORMAL(mx, Sa, Da) (Sa + (Da * (mx - Sa)) / mx)
#define COLOR_NORMAL(mx, Sc, Sa, Dc, Da) ((Sc * Sa + Dc * (mx - Sa)) / mx)
To:
#define ALPHA_NORMAL(mx, Sa, Da) ((Sa + (mx - Sa)*(mx - Sa)) / mx)
#define COLOR_NORMAL(mx, Sc, Sa, Dc, Da) A_BLEND(Sc, Dc, Sa, mx)
RafaMar

RafaMar

2021-03-10 14:47

reporter   ~0004670

When you insert an effect on an empty track the fade fades as if it were on a black background, it interprets the alpha as black where there is transparency, which is what produces the fade.
To avoid the unwanted effect produced by the fade over black (because there is no content) it is best to leave the fade in out of the effect at 0 and use the fade line to perform these, so there is no problem with the alpha channel.
Watch the following video
https://streamable.com/quj37w

Issue History

Date Modified Username Field Change
2021-03-09 20:44 PhyllisSmith New Issue
2021-03-10 14:47 RafaMar Note Added: 0004670
2021-06-23 22:12 PhyllisSmith Description Updated View Revisions
2021-06-23 22:23 PhyllisSmith Assigned To => PhyllisSmith
2021-06-23 22:23 PhyllisSmith Status new => feedback
2021-06-23 22:23 PhyllisSmith Note Added: 0004860
2021-06-25 09:37 IgorBeg Note Added: 0004861
2021-06-25 19:57 PhyllisSmith Note Added: 0004862
2021-06-25 20:55 PhyllisSmith Note Edited: 0004862 View Revisions
2021-10-10 19:22 PhyllisSmith Note Added: 0005039
2021-10-10 21:33 PhyllisSmith Note Added: 0005042
2021-10-11 00:25 PhyllisSmith File Added: fadeInOut.dissolve.overlayframe.h.patch
2021-10-11 00:25 PhyllisSmith Note Added: 0005043
2021-10-11 08:12 Andrea_Paz Note Added: 0005047
2021-10-12 07:37 IgorBeg Note Added: 0005061
2021-10-13 01:41 PhyllisSmith Note Added: 0005067
2021-10-14 07:58 IgorBeg Note Added: 0005076
2021-10-14 15:52 PhyllisSmith Note Added: 0005077
2021-10-15 07:30 IgorBeg Note Added: 0005080
2021-10-16 15:24 PhyllisSmith Note Added: 0005088
2021-10-17 11:43 Andrea_Paz Note Added: 0005089
2021-10-17 12:16 IgorBeg File Added: FadeIN-FadeOUT_ForTest-02.tar.gz
2021-10-17 12:16 IgorBeg Note Added: 0005090
2021-10-17 15:18 PhyllisSmith Note Added: 0005091
2021-10-18 07:24 IgorBeg Note Added: 0005092
2021-10-19 01:06 PhyllisSmith Note Added: 0005093
2021-10-21 00:57 Andrew-R Note Added: 0005097
2021-10-21 00:59 Andrew-R File Added: 0032-Add-hackish-new-overlay-blend-modes.patch
2021-10-21 00:59 Andrew-R Note Added: 0005098
2021-10-21 03:43 PhyllisSmith File Added: fadeInOut.dissolve.overlayframe.h.v2.patch
2021-10-21 03:43 PhyllisSmith Note Added: 0005099
2021-10-23 01:17 PhyllisSmith File Added: incorrect.png
2021-10-23 01:17 PhyllisSmith File Added: correct.png
2021-10-23 01:17 PhyllisSmith Note Added: 0005112
2021-10-23 08:11 IgorBeg Note Added: 0005113
2021-11-03 07:57 IgorBeg Note Added: 0005130
2021-11-07 22:14 PhyllisSmith Note Added: 0005151
2021-11-09 08:21 IgorBeg Note Added: 0005161