[Cinelerra-commits] r1039 - trunk/hvirtual/plugins/titler

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Johannes Sixt <johannes.sixt@telecom.at>
Date:  
To: cinelerra-commits
Subject: [Cinelerra-commits] r1039 - trunk/hvirtual/plugins/titler
Author: j6t
Date: 2007-11-25 20:54:05 +0100 (Sun, 25 Nov 2007)
New Revision: 1039

Modified:
trunk/hvirtual/plugins/titler/title.C
Log:
Fixed titler bug: occasional full intensity flash at last frame

Bug: Titles configured to fade out sometimes flashed the title at full
intensity at the last frame of the effect range.

The problem was a boundary condition of the alpha calculation such that if
the last frame of the effect was exactly aligned with a frame boundary,
alpha would be set to 1 instead of 0.

Also changed some integer truncation to rounding, although this wasn't
related to the bug.

[j6t: use lroundf(...) instead of (int)roundf(...)]

Patch by Craig Lawson.


Modified: trunk/hvirtual/plugins/titler/title.C
===================================================================
--- trunk/hvirtual/plugins/titler/title.C    2007-10-29 19:25:16 UTC (rev 1038)
+++ trunk/hvirtual/plugins/titler/title.C    2007-11-25 19:54:05 UTC (rev 1039)
@@ -1845,33 +1845,26 @@
    alpha = 0x100;
    if(!EQUIV(config.fade_in, 0))
    {
-        int fade_len = (int)(config.fade_in * PluginVClient::project_frame_rate);
-        int fade_position = get_source_position() -
-            config.prev_keyframe_position;
+        int fade_len = lroundf(config.fade_in * PluginVClient::project_frame_rate);
+        int fade_position = get_source_position() - config.prev_keyframe_position;


        if(fade_position >= 0 && fade_position < fade_len)
        {
-            alpha = (int)((float)0x100 *
-                fade_position /
-                fade_len + 0.5);
+            alpha = lroundf(256.0f * fade_position / fade_len);
        }
    }
//printf("TitleMain::overlay_mask 1\n");

    if(!EQUIV(config.fade_out, 0))
    {
-        int fade_len = (int)(config.fade_out *
-            PluginVClient::project_frame_rate);
-        int fade_position = config.next_keyframe_position -
-            get_source_position();
+        int fade_len = lroundf(config.fade_out * PluginVClient::project_frame_rate);
+        int fade_position = config.next_keyframe_position - get_source_position();


-        if(fade_position > 0 && fade_position < fade_len)
+        if(fade_position >= 0 && fade_position < fade_len)
        {
-            alpha = (int)((float)0x100 *
-                fade_position /
-                fade_len + 0.5);
+            alpha = lroundf(256.0f * fade_position / fade_len);
        }
    }
//printf("TitleMain::overlay_mask 1\n");


_______________________________________________
Cinelerra-commits mailing list
Cinelerra-commits@???
https://init.linpro.no/mailman/skolelinux.no/listinfo/cinelerra-commits