From fe41177675e1419318d6af81885ab725e6903307 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Mardelle Date: Sat, 13 Apr 2013 21:31:16 +0200 Subject: [PATCH] Fix scopes: http://kdenlive.org/mantis/view.php?id=3052 --- effects/dust.xml | 2 +- effects/grain.xml | 2 +- effects/oldfilm.xml | 4 ++-- src/colorcorrection/histogramgenerator.cpp | 2 +- src/colorcorrection/rgbparadegenerator.cpp | 2 +- src/colorcorrection/vectorscopegenerator.cpp | 4 ++-- src/colorcorrection/waveformgenerator.cpp | 11 ++++++----- src/renderer.cpp | 2 +- src/scopes/colorscopes/abstractgfxscopewidget.cpp | 2 +- 9 files changed, 16 insertions(+), 15 deletions(-) diff --git a/effects/dust.xml b/effects/dust.xml index 863cf461..aaef73bc 100644 --- a/effects/dust.xml +++ b/effects/dust.xml @@ -3,7 +3,7 @@ Dust Add dust and specks to the video, as in old movies Marco Gittler - + Maximal Diameter diff --git a/effects/grain.xml b/effects/grain.xml index 6fa29b25..6b6ea549 100644 --- a/effects/grain.xml +++ b/effects/grain.xml @@ -3,7 +3,7 @@ Grain Grain over the image Marco Gittler - + Noise diff --git a/effects/oldfilm.xml b/effects/oldfilm.xml index 10293de1..c9054026 100644 --- a/effects/oldfilm.xml +++ b/effects/oldfilm.xml @@ -6,7 +6,7 @@ Y-Delta - + % of picture have a delta @@ -15,7 +15,7 @@ Brightness down - + Brightness every diff --git a/src/colorcorrection/histogramgenerator.cpp b/src/colorcorrection/histogramgenerator.cpp index 2681c504..05a41f59 100644 --- a/src/colorcorrection/histogramgenerator.cpp +++ b/src/colorcorrection/histogramgenerator.cpp @@ -44,7 +44,7 @@ QImage HistogramGenerator::calculateHistogram(const QSize ¶deSize, const QIm const uint ww = paradeSize.width(); const uint wh = paradeSize.height(); const uint byteCount = iw*ih; - const uint stepsize = 4*accelFactor; + const uint stepsize = image.depth() / 8 *accelFactor; const uchar *bits = image.bits(); QRgb *col; diff --git a/src/colorcorrection/rgbparadegenerator.cpp b/src/colorcorrection/rgbparadegenerator.cpp index f8ad5cd0..e81cdc45 100644 --- a/src/colorcorrection/rgbparadegenerator.cpp +++ b/src/colorcorrection/rgbparadegenerator.cpp @@ -89,7 +89,7 @@ QImage RGBParadeGenerator::calculateRGBParade(const QSize ¶deSize, const QIm } const uchar *bits = image.bits(); - const uint stepsize = 4*accelFactor; + const uint stepsize = image.depth() / 8 *accelFactor; for (uint i = 0, x = 0; i < byteCount; i += stepsize) { col = (QRgb *)bits; diff --git a/src/colorcorrection/vectorscopegenerator.cpp b/src/colorcorrection/vectorscopegenerator.cpp index 1c8e08db..f398e648 100644 --- a/src/colorcorrection/vectorscopegenerator.cpp +++ b/src/colorcorrection/vectorscopegenerator.cpp @@ -138,11 +138,11 @@ QImage VectorscopeGenerator::calculateVectorscope(const QSize &vectorscopeSize, QPoint pt; QRgb px; - const int stepsize = 4 * accelFactor; + const int stepsize = image.depth() / 8 * accelFactor; // Just an average for the number of image pixels per scope pixel. // NOTE: byteCount() has to be replaced by (img.bytesPerLine()*img.height()) for Qt 4.5 to compile, see: http://doc.trolltech.org/4.6/qimage.html#bytesPerLine - double avgPxPerPx = (double) 4*(image.bytesPerLine()*image.height())/scope.size().width()/scope.size().height()/accelFactor; + double avgPxPerPx = (double) image.depth() / 8 *(image.bytesPerLine()*image.height())/scope.size().width()/scope.size().height()/accelFactor; for (int i = 0; i < (image.bytesPerLine()*image.height()); i+= stepsize) { QRgb *col = (QRgb *) bits; diff --git a/src/colorcorrection/waveformgenerator.cpp b/src/colorcorrection/waveformgenerator.cpp index 971471e7..a1d2162f 100644 --- a/src/colorcorrection/waveformgenerator.cpp +++ b/src/colorcorrection/waveformgenerator.cpp @@ -76,8 +76,9 @@ QImage WaveformGenerator::calculateWaveform(const QSize &waveformSize, const QIm const float wPrediv = (float)(ww-1)/(iw-1); const uchar *bits = image.bits(); + const int bpp = image.depth() / 8; - for (uint i = 0, x = 0; i < byteCount; i += 4) { + for (uint i = 0, x = 0; i < byteCount; i += bpp) { Q_ASSERT(bits < image.bits() + byteCount); @@ -96,13 +97,13 @@ QImage WaveformGenerator::calculateWaveform(const QSize &waveformSize, const QIm dx = x*wPrediv; waveValues[(int)dx][(int)dy]++; - bits += 4; - x += 4; + bits += bpp; + x += bpp; if (x > iw) { x -= iw; if (accelFactor > 1) { - bits += 4*iw*(accelFactor-1); - i += 4*iw*(accelFactor-1); + bits += bpp*iw*(accelFactor-1); + i += bpp*iw*(accelFactor-1); } } } diff --git a/src/renderer.cpp b/src/renderer.cpp index 9a2a314c..b5d87ddf 100644 --- a/src/renderer.cpp +++ b/src/renderer.cpp @@ -1899,7 +1899,7 @@ void Render::showFrame(Mlt::Frame* frame) delete frame; emit showImageSignal(qimage); if (sendFrameForAnalysis) { - emit frameUpdated(qimage);//.rgbSwapped()); + emit frameUpdated(qimage); } } else delete frame; showFrameSemaphore.release(); diff --git a/src/scopes/colorscopes/abstractgfxscopewidget.cpp b/src/scopes/colorscopes/abstractgfxscopewidget.cpp index 39343490..cfc771af 100644 --- a/src/scopes/colorscopes/abstractgfxscopewidget.cpp +++ b/src/scopes/colorscopes/abstractgfxscopewidget.cpp @@ -54,7 +54,7 @@ void AbstractGfxScopeWidget::mouseReleaseEvent(QMouseEvent *event) void AbstractGfxScopeWidget::slotRenderZoneUpdated(const QImage frame) { QMutexLocker lock(&m_mutex); - m_scopeImage = frame; + m_scopeImage = frame.rgbSwapped(); AbstractScopeWidget::slotRenderZoneUpdated(); } -- 2.39.2