]> git.sesse.net Git - kdenlive/commitdiff
Audio Spectrum: Consecutive overmodulated frames better detectable
authorSimon A. Eugster <simon.eu@gmail.com>
Sat, 29 Jan 2011 18:07:07 +0000 (18:07 +0000)
committerSimon A. Eugster <simon.eu@gmail.com>
Sat, 29 Jan 2011 18:07:07 +0000 (18:07 +0000)
svn path=/trunk/kdenlive/; revision=5361

src/audioscopes/audiospectrum.cpp

index 2d0bb243d36595864f6d79462403400ba9bace8f..e5778c3d361ae33c992c28306335b2bad29a3ffe 100644 (file)
@@ -39,6 +39,7 @@
 #define MAX_FREQ_VALUE 96000
 #define MIN_FREQ_VALUE 1000
 #define ALPHA_MOVING_AVG 0.125
+#define MAX_OVM_COLOR 0.7
 
 AudioSpectrum::AudioSpectrum(QWidget *parent) :
     AbstractAudioScopeWidget(true, parent),
@@ -166,6 +167,7 @@ QImage AudioSpectrum::renderAudioScope(uint, const QVector<int16_t> audioFrame,
 
 
 #ifdef DETECT_OVERMODULATION
+        // TODO Color: 1 if currently overmodulated, max 0.8 else
         bool overmodulated = false;
         int overmodulateCount = 0;
 
@@ -252,6 +254,11 @@ QImage AudioSpectrum::renderAudioScope(uint, const QVector<int16_t> audioFrame,
                         (int) (f * col.blue() + (1-f) * spec.blue()),
                         spec.alpha()
                         );
+            // Limit the maximum colorization for non-overmodulated frames to better
+            // recognize consecutively overmodulated frames
+            if (colorizeFactor > MAX_OVM_COLOR) {
+                colorizeFactor = MAX_OVM_COLOR;
+            }
         }
 #endif