From 9ef43542f1f809be6dcfeee536cb4471316249f5 Mon Sep 17 00:00:00 2001 From: Alexander Ivash Date: Sun, 12 May 2024 23:27:13 +0200 Subject: [PATCH 1/7] add option to provide an option for color fill in some graphs #820 --- Source/Core/Core.h | 1 + Source/Core/VideoCore.cpp | 10 ++-- Source/GUI/Plot.cpp | 98 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 104 insertions(+), 5 deletions(-) diff --git a/Source/Core/Core.h b/Source/Core/Core.h index 53644fe8a..972d0c426 100755 --- a/Source/Core/Core.h +++ b/Source/Core/Core.h @@ -65,6 +65,7 @@ struct per_item const activefilter Filter; const char* color; const int thickness; + const char* fillInfo { nullptr }; }; struct stream_info diff --git a/Source/Core/VideoCore.cpp b/Source/Core/VideoCore.cpp index 6602ea8be..70087c868 100644 --- a/Source/Core/VideoCore.cpp +++ b/Source/Core/VideoCore.cpp @@ -271,11 +271,11 @@ struct per_group VideoPerGroup [Group_VideoMax]= const struct per_item VideoPerItem [Item_VideoMax]= { //Y - { Group_Y, Group_VideoMax, "Y MIN", "lavfi.signalstats.YMIN", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, "gray", 1 }, - { Group_Y, Group_VideoMax, "Y LOW", "lavfi.signalstats.YLOW", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, "green", 2 }, - { Group_Y, Group_VideoMax, "Y AVG", "lavfi.signalstats.YAVG", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, "yellow", 3 }, - { Group_Y, Group_VideoMax, "Y HIGH", "lavfi.signalstats.YHIGH", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, nullptr, -1 }, - { Group_Y, Group_VideoMax, "Y MAX", "lavfi.signalstats.YMAX", 0, true, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, nullptr, -1 }, + { Group_Y, Group_VideoMax, "Y MIN", "lavfi.signalstats.YMIN", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, "gray", 1, }, // "Y LOW;green;0.5" }, + { Group_Y, Group_VideoMax, "Y LOW", "lavfi.signalstats.YLOW", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, "green", 2, }, // "Y LOW;transparent;0.5" }, + { Group_Y, Group_VideoMax, "Y AVG", "lavfi.signalstats.YAVG", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, "yellow", 3, }, // "Y LOW;red;0.5" }, + { Group_Y, Group_VideoMax, "Y HIGH", "lavfi.signalstats.YHIGH", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, nullptr, -1, "Y AVG;yellow;0.8" }, + { Group_Y, Group_VideoMax, "Y MAX", "lavfi.signalstats.YMAX", 0, true, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, nullptr, -1, "Y HIGH;green;0.5" }, //U { Group_U, Group_VideoMax, "U MIN", "lavfi.signalstats.UMIN", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, nullptr, -1 }, { Group_U, Group_VideoMax, "U LOW", "lavfi.signalstats.ULOW", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, nullptr, -1 }, diff --git a/Source/GUI/Plot.cpp b/Source/GUI/Plot.cpp index 2c0dbef7b..6dfa56117 100644 --- a/Source/GUI/Plot.cpp +++ b/Source/GUI/Plot.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include "Core/FileInformation.h" #include @@ -250,7 +251,80 @@ class PlotCurve : public QwtPlotCurve { m_count = count; } + void setClipCurve(QwtPlotCurve* curve) { + m_clipCurve = curve; + } + + void setFillBrush(QBrush brush) { + m_fillBrush = brush; + } + protected: + virtual void drawCurve( QPainter* painter , int style, const QwtScaleMap& xMap, const QwtScaleMap& yMap, const QRectF& canvasRect, int from, int to ) const { + QwtPlotCurve::drawCurve(painter, style, xMap, yMap, canvasRect, from, to); + + if(m_clipCurve && !symbol()) + { + auto brush = m_fillBrush; + + if ( brush.style() == Qt::NoBrush ) + return; + + const bool doFit = ( testCurveAttribute( Fitted ) && curveFitter() ); + const bool doAlign = !doFit && QwtPainter::roundingAlignment( painter ); + + QwtPointMapper mapper; + + if ( doAlign ) + { + mapper.setFlag( QwtPointMapper::RoundPoints, true ); + mapper.setFlag( QwtPointMapper::WeedOutIntermediatePoints, + testPaintAttribute( FilterPointsAggressive ) ); + } + + mapper.setFlag( QwtPointMapper::WeedOutPoints, + testPaintAttribute( FilterPoints ) || + testPaintAttribute( FilterPointsAggressive ) ); + + mapper.setBoundingRect( canvasRect ); + QPolygonF polygon = mapper.toPolygonF( xMap, yMap, data(), from, to); + QPolygonF baselinePolygon = mapper.toPolygonF( xMap, yMap, m_clipCurve->data(), from, to); + + for(auto it = baselinePolygon.rbegin(); it != baselinePolygon.rend(); ++it) { + polygon += *it; + } + + if ( polygon.count() <= 2 ) // a line can't be filled + return; + + if ( !brush.color().isValid() ) + brush.setColor( this->pen().color() ); + + if ( testPaintAttribute(ClipPolygons) ) + { + const QRectF clipRect = qwtIntersectedClipRect( canvasRect, painter ); + QwtClipper::clipPolygonF( clipRect, polygon, true ); + } + + painter->save(); + + painter->setPen( Qt::NoPen ); + painter->setBrush( brush ); + + QwtPainter::drawPolygon( painter, polygon ); + + painter->restore(); + } + } + + virtual void fillCurve( QPainter *painter, const QwtScaleMap& xMap, const QwtScaleMap& yMap, const QRectF& canvasRect, QPolygonF& polygon) const { + QwtPlotCurve::fillCurve(painter, xMap, yMap, canvasRect, polygon); + } + + virtual void drawLines(QPainter* p, const QwtScaleMap& xMap, const QwtScaleMap& yMap, const QRectF& canvasRect, int from, int to) const { + QwtPlotCurve::drawLines(p, xMap, yMap, canvasRect, from, to); + } + void drawSymbols(QPainter *p, const QwtSymbol &s, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const { QwtPointMapper mapper; @@ -287,6 +361,8 @@ class PlotCurve : public QwtPlotCurve { private: int m_index; int m_count; + QBrush m_fillBrush; + QwtPlotCurve* m_clipCurve { nullptr }; }; //*************************************************************************** @@ -506,6 +582,7 @@ Plot::Plot( size_t streamPos, size_t Type, size_t Group, const FileInformation* // curves m_curves.reserve(PerStreamType[m_type].PerGroup[m_group].Count); + QMap curvesByName; for( unsigned j = 0; j < PerStreamType[m_type].PerGroup[m_group].Count; ++j ) { @@ -536,6 +613,27 @@ Plot::Plot( size_t streamPos, size_t Type, size_t Group, const FileInformation* curve->attach( this ); m_curves += curve; + + curvesByName[item.Name] = curve; + } + + for( unsigned j = 0; j < PerStreamType[m_type].PerGroup[m_group].Count; ++j ) + { + auto item = PerStreamType[m_type].PerItem[PerStreamType[m_type].PerGroup[m_group].Start + j]; + if(item.fillInfo) { + auto splitted = QString(item.fillInfo).split(";"); + auto curveName = splitted[0]; + auto color = QColor(splitted[1]); + auto alpha = QString(splitted[2]).toFloat(); + + color.setAlphaF(alpha); + auto curve = curvesByName[item.Name]; + curve->setFillBrush(QBrush(color)); + + auto fillCurve = curvesByName[curveName]; + + curve->setClipCurve(fillCurve); + } } PlotPicker* picker = new PlotPicker( this, &PerStreamType[m_type], m_group, &m_curves, fileInformation ); From 3d1cfd06b7637df49153dfb11819d83972b4fd9c Mon Sep 17 00:00:00 2001 From: Alexander Ivash Date: Sun, 16 Jun 2024 18:07:03 +0200 Subject: [PATCH 2/7] add support for using constant values as fill baseline --- Source/Core/VideoCore.cpp | 2 +- Source/GUI/Plot.cpp | 31 +++++++++++++++++++++++-------- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/Source/Core/VideoCore.cpp b/Source/Core/VideoCore.cpp index 70087c868..ab2e7643b 100644 --- a/Source/Core/VideoCore.cpp +++ b/Source/Core/VideoCore.cpp @@ -274,7 +274,7 @@ const struct per_item VideoPerItem [Item_VideoMax]= { Group_Y, Group_VideoMax, "Y MIN", "lavfi.signalstats.YMIN", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, "gray", 1, }, // "Y LOW;green;0.5" }, { Group_Y, Group_VideoMax, "Y LOW", "lavfi.signalstats.YLOW", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, "green", 2, }, // "Y LOW;transparent;0.5" }, { Group_Y, Group_VideoMax, "Y AVG", "lavfi.signalstats.YAVG", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, "yellow", 3, }, // "Y LOW;red;0.5" }, - { Group_Y, Group_VideoMax, "Y HIGH", "lavfi.signalstats.YHIGH", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, nullptr, -1, "Y AVG;yellow;0.8" }, + { Group_Y, Group_VideoMax, "Y HIGH", "lavfi.signalstats.YHIGH", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, nullptr, -1, "10.0;yellow;0.8" }, { Group_Y, Group_VideoMax, "Y MAX", "lavfi.signalstats.YMAX", 0, true, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, nullptr, -1, "Y HIGH;green;0.5" }, //U { Group_U, Group_VideoMax, "U MIN", "lavfi.signalstats.UMIN", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, nullptr, -1 }, diff --git a/Source/GUI/Plot.cpp b/Source/GUI/Plot.cpp index 6dfa56117..62bc185a2 100644 --- a/Source/GUI/Plot.cpp +++ b/Source/GUI/Plot.cpp @@ -251,8 +251,12 @@ class PlotCurve : public QwtPlotCurve { m_count = count; } - void setClipCurve(QwtPlotCurve* curve) { - m_clipCurve = curve; + void setFillCurve(QwtPlotCurve* curve) { + m_fillCurve = curve; + } + + void setFillBaseLine(float value) { + m_fillBaseline = value; } void setFillBrush(QBrush brush) { @@ -263,7 +267,7 @@ class PlotCurve : public QwtPlotCurve { virtual void drawCurve( QPainter* painter , int style, const QwtScaleMap& xMap, const QwtScaleMap& yMap, const QRectF& canvasRect, int from, int to ) const { QwtPlotCurve::drawCurve(painter, style, xMap, yMap, canvasRect, from, to); - if(m_clipCurve && !symbol()) + if((m_fillBaseline || m_fillCurve) && !symbol()) { auto brush = m_fillBrush; @@ -288,7 +292,13 @@ class PlotCurve : public QwtPlotCurve { mapper.setBoundingRect( canvasRect ); QPolygonF polygon = mapper.toPolygonF( xMap, yMap, data(), from, to); - QPolygonF baselinePolygon = mapper.toPolygonF( xMap, yMap, m_clipCurve->data(), from, to); + QPolygonF baselinePolygon; + if(m_fillCurve) + baselinePolygon = mapper.toPolygonF( xMap, yMap, m_fillCurve->data(), from, to); + else if(m_fillBaseline) { + baselinePolygon += QPointF(xMap.transform(qreal(from)), yMap.transform(m_fillBaseline.value())); + baselinePolygon += QPointF(xMap.transform(qreal(to)), yMap.transform(m_fillBaseline.value())); + } for(auto it = baselinePolygon.rbegin(); it != baselinePolygon.rend(); ++it) { polygon += *it; @@ -362,7 +372,8 @@ class PlotCurve : public QwtPlotCurve { int m_index; int m_count; QBrush m_fillBrush; - QwtPlotCurve* m_clipCurve { nullptr }; + QwtPlotCurve* m_fillCurve { nullptr }; + std::optional m_fillBaseline; }; //*************************************************************************** @@ -630,9 +641,13 @@ Plot::Plot( size_t streamPos, size_t Type, size_t Group, const FileInformation* auto curve = curvesByName[item.Name]; curve->setFillBrush(QBrush(color)); - auto fillCurve = curvesByName[curveName]; - - curve->setClipCurve(fillCurve); + if(curvesByName.contains(curveName)) { + auto fillCurve = curvesByName[curveName]; + curve->setFillCurve(fillCurve); + } else { + auto fillValue = curveName.toFloat(); + curve->setFillBaseLine(fillValue); + } } } From 380727149eaecaecc8027f3d479422769584e098 Mon Sep 17 00:00:00 2001 From: Alexander Ivash Date: Sun, 23 Jun 2024 16:32:41 +0200 Subject: [PATCH 3/7] reduce spacing between legend items --- Source/GUI/PlotLegend.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/GUI/PlotLegend.cpp b/Source/GUI/PlotLegend.cpp index 1f6d2eaf2..87912e4f5 100644 --- a/Source/GUI/PlotLegend.cpp +++ b/Source/GUI/PlotLegend.cpp @@ -51,6 +51,7 @@ PlotLegend::~PlotLegend() QWidget *PlotLegend::createWidget( const QwtLegendData &data ) const { QWidget *w = QwtLegend::createWidget( data ); + w->setMaximumHeight(10); QwtLegendLabel *label = dynamic_cast( w ); if ( label ) From 0d177d7f48f312e8e9ab3dc981759665d1ee25e4 Mon Sep 17 00:00:00 2001 From: Dave Rice Date: Sun, 23 Jun 2024 13:31:11 -0400 Subject: [PATCH 4/7] adjust fill colors --- Source/Core/VideoCore.cpp | 126 +++++++++++++++++++------------------- 1 file changed, 63 insertions(+), 63 deletions(-) diff --git a/Source/Core/VideoCore.cpp b/Source/Core/VideoCore.cpp index ab2e7643b..8f74696a9 100644 --- a/Source/Core/VideoCore.cpp +++ b/Source/Core/VideoCore.cpp @@ -271,44 +271,44 @@ struct per_group VideoPerGroup [Group_VideoMax]= const struct per_item VideoPerItem [Item_VideoMax]= { //Y - { Group_Y, Group_VideoMax, "Y MIN", "lavfi.signalstats.YMIN", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, "gray", 1, }, // "Y LOW;green;0.5" }, - { Group_Y, Group_VideoMax, "Y LOW", "lavfi.signalstats.YLOW", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, "green", 2, }, // "Y LOW;transparent;0.5" }, - { Group_Y, Group_VideoMax, "Y AVG", "lavfi.signalstats.YAVG", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, "yellow", 3, }, // "Y LOW;red;0.5" }, - { Group_Y, Group_VideoMax, "Y HIGH", "lavfi.signalstats.YHIGH", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, nullptr, -1, "10.0;yellow;0.8" }, - { Group_Y, Group_VideoMax, "Y MAX", "lavfi.signalstats.YMAX", 0, true, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, nullptr, -1, "Y HIGH;green;0.5" }, + { Group_Y, Group_VideoMax, "Y MIN", "lavfi.signalstats.YMIN", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, "silver", 1 }, + { Group_Y, Group_VideoMax, "Y LOW", "lavfi.signalstats.YLOW", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, "darkgreen", 1, "Y MIN;teal;0.2" }, + { Group_Y, Group_VideoMax, "Y AVG", "lavfi.signalstats.YAVG", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, "black", 1, "Y LOW;teal;0.8" }, + { Group_Y, Group_VideoMax, "Y HIGH", "lavfi.signalstats.YHIGH", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, "lightgreen", 1, "Y AVG;teal;0.8" }, + { Group_Y, Group_VideoMax, "Y MAX", "lavfi.signalstats.YMAX", 0, true, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, "gray", 1, "Y HIGH;teal;0.2" }, //U - { Group_U, Group_VideoMax, "U MIN", "lavfi.signalstats.UMIN", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, nullptr, -1 }, - { Group_U, Group_VideoMax, "U LOW", "lavfi.signalstats.ULOW", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, nullptr, -1 }, - { Group_U, Group_VideoMax, "U AVG", "lavfi.signalstats.UAVG", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, nullptr, -1 }, - { Group_U, Group_VideoMax, "U HIGH", "lavfi.signalstats.UHIGH", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, nullptr, -1 }, - { Group_U, Group_VideoMax, "U MAX", "lavfi.signalstats.UMAX", 0, true, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, nullptr, -1 }, + { Group_U, Group_VideoMax, "U MIN", "lavfi.signalstats.UMIN", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, "silver", 1 }, + { Group_U, Group_VideoMax, "U LOW", "lavfi.signalstats.ULOW", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, "darkblue", 1, "U MIN;darkblue;0.2" }, + { Group_U, Group_VideoMax, "U AVG", "lavfi.signalstats.UAVG", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, "black", 1, "U LOW;darkblue;0.8" }, + { Group_U, Group_VideoMax, "U HIGH", "lavfi.signalstats.UHIGH", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, "lightblue", 1, "U AVG;darkblue;0.8" }, + { Group_U, Group_VideoMax, "U MAX", "lavfi.signalstats.UMAX", 0, true, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, "gray", 1, "U HIGH;darkblue;0.2" }, //V - { Group_V, Group_VideoMax, "V MIN", "lavfi.signalstats.VMIN", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, nullptr, -1 }, - { Group_V, Group_VideoMax, "V LOW", "lavfi.signalstats.VLOW", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, nullptr, -1 }, - { Group_V, Group_VideoMax, "V AVG", "lavfi.signalstats.VAVG", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, nullptr, -1 }, - { Group_V, Group_VideoMax, "V HIGH", "lavfi.signalstats.VHIGH", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, nullptr, -1 }, - { Group_V, Group_VideoMax, "V MAX", "lavfi.signalstats.VMAX", 0, true, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, nullptr, -1 }, + { Group_V, Group_VideoMax, "V MIN", "lavfi.signalstats.VMIN", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, "silver", 1 }, + { Group_V, Group_VideoMax, "V LOW", "lavfi.signalstats.VLOW", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, "darkred", 1, "V MIN;darkred;0.2" }, + { Group_V, Group_VideoMax, "V AVG", "lavfi.signalstats.VAVG", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, "black", 1, "V LOW;darkred;0.8" }, + { Group_V, Group_VideoMax, "V HIGH", "lavfi.signalstats.VHIGH", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, "pink", 1, "V AVG;darkred;0.8" }, + { Group_V, Group_VideoMax, "V MAX", "lavfi.signalstats.VMAX", 0, true, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, "gray", 1, "V HIGH;darkred;0.2" }, //Diffs - { Group_VDiff, Group_Diffs, "V DIF", "lavfi.signalstats.VDIF", 5, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, nullptr, -1 }, - { Group_UDiff, Group_Diffs, "U DIF", "lavfi.signalstats.UDIF", 5, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, nullptr, -1 }, - { Group_YDiff, Group_Diffs, "Y DIF", "lavfi.signalstats.YDIF", 5, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, nullptr, -1 }, + { Group_VDiff, Group_Diffs, "V DIF", "lavfi.signalstats.VDIF", 5, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, "darkred", 1, "0;darkred;0.4" }, + { Group_UDiff, Group_Diffs, "U DIF", "lavfi.signalstats.UDIF", 5, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, "darkblue", 1, "0;darkblue;0.4" }, + { Group_YDiff, Group_Diffs, "Y DIF", "lavfi.signalstats.YDIF", 5, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, "darkgreen", 1, "0;teal;0.4" }, //Sat - { Group_Sat, Group_VideoMax, "SAT MIN", "lavfi.signalstats.SATMIN", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, nullptr, -1 }, - { Group_Sat, Group_VideoMax, "SAT LOW", "lavfi.signalstats.SATLOW", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, nullptr, -1 }, - { Group_Sat, Group_VideoMax, "SAT AVG", "lavfi.signalstats.SATAVG", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, nullptr, -1 }, - { Group_Sat, Group_VideoMax, "SAT HIGH", "lavfi.signalstats.SATHIGH", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, nullptr, -1 }, - { Group_Sat, Group_VideoMax, "SAT MAX", "lavfi.signalstats.SATMAX", 0, true, 88.7, 118.2, ActiveFilter_Video_signalstats, nullptr, -1 }, + { Group_Sat, Group_VideoMax, "SAT MIN", "lavfi.signalstats.SATMIN", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, "silver", 1, "0;white;1" }, + { Group_Sat, Group_VideoMax, "SAT LOW", "lavfi.signalstats.SATLOW", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, "lightred", 1, "SAT MIN;red;0.2" }, + { Group_Sat, Group_VideoMax, "SAT AVG", "lavfi.signalstats.SATAVG", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, "black", 1, "SAT LOW;red;0.4" }, + { Group_Sat, Group_VideoMax, "SAT HIGH", "lavfi.signalstats.SATHIGH", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, "darkred", 1, "SAT AVG;red;0.6" }, + { Group_Sat, Group_VideoMax, "SAT MAX", "lavfi.signalstats.SATMAX", 0, true, 88.7, 118.2, ActiveFilter_Video_signalstats, "gray", 1, "SAT HIGH;red;0.8" }, //Hue - { Group_Hue, Group_VideoMax, "HUE MED", "lavfi.signalstats.HUEMED", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, nullptr, -1 }, - { Group_Hue, Group_VideoMax, "HUE AVG", "lavfi.signalstats.HUEAVG", 0, true, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, nullptr, -1 }, + { Group_Hue, Group_VideoMax, "HUE MED", "lavfi.signalstats.HUEMED", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, "orange", 1 }, + { Group_Hue, Group_VideoMax, "HUE AVG", "lavfi.signalstats.HUEAVG", 0, true, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, "purple", 1 }, //Others - { Group_TOUT, Group_VideoMax, "TOUT", "lavfi.signalstats.TOUT", 8, false, 0.005, DBL_MAX, ActiveFilter_Video_signalstats, nullptr, -1 }, - { Group_VREP, Group_VideoMax, "VREP", "lavfi.signalstats.VREP", 8, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, nullptr, -1 }, - { Group_BRNG, Group_VideoMax, "BRNG", "lavfi.signalstats.BRNG", 8, true, 0.05, DBL_MAX, ActiveFilter_Video_signalstats, nullptr, -1 }, + { Group_TOUT, Group_VideoMax, "TOUT", "lavfi.signalstats.TOUT", 8, false, 0.005, DBL_MAX, ActiveFilter_Video_signalstats, "darkgray", 1, "0;whitesmoke;0.6" }, + { Group_VREP, Group_VideoMax, "VREP", "lavfi.signalstats.VREP", 8, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, "purple", 1, "0;purple;0.6" }, + { Group_BRNG, Group_VideoMax, "BRNG", "lavfi.signalstats.BRNG", 8, true, 0.05, DBL_MAX, ActiveFilter_Video_signalstats, "black", 1, "0;yellow;0.6" }, //Bitdepths - { Group_YUVB, Group_VideoMax, "V Active Bits", "lavfi.signalstats.VBITDEPTH", 0, true, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, nullptr, -1 }, - { Group_YUVB, Group_VideoMax, "U Active Bits", "lavfi.signalstats.UBITDEPTH", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, nullptr, -1 }, - { Group_YUVB, Group_VideoMax, "Y Active Bits", "lavfi.signalstats.YBITDEPTH", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, nullptr, -1 }, + { Group_YUVB, Group_VideoMax, "V Active Bits", "lavfi.signalstats.VBITDEPTH", 0, true, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, "darkred", 1, "0;darkred;0.4" }, + { Group_YUVB, Group_VideoMax, "U Active Bits", "lavfi.signalstats.UBITDEPTH", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, "darkblue", 1, "0;darkblue;0.4" }, + { Group_YUVB, Group_VideoMax, "Y Active Bits", "lavfi.signalstats.YBITDEPTH", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_signalstats, "darkgreen", 1, "0;teal;0.4" }, //Crop { Group_CropW, Group_VideoMax, "Crop Left", "lavfi.cropdetect.x1", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_cropdetect, nullptr, -1 }, { Group_CropW, Group_VideoMax, "Crop Right", "lavfi.cropdetect.x2", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_cropdetect, nullptr, -1 }, @@ -317,48 +317,48 @@ const struct per_item VideoPerItem [Item_VideoMax]= { Group_CropF, Group_VideoMax, "Crop Width", "lavfi.cropdetect.w", 0, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_cropdetect, nullptr, -1 }, { Group_CropF, Group_VideoMax, "Crop Height", "lavfi.cropdetect.h", 0, true, DBL_MAX, DBL_MAX, ActiveFilter_Video_cropdetect, nullptr, -1 }, //MSEf - { Group_MSE, Group_VideoMax, "MSEf V", "lavfi.psnr.mse.v", 2, true, DBL_MAX, DBL_MAX, ActiveFilter_Video_Psnr, nullptr, -1 }, - { Group_MSE, Group_VideoMax, "MSEf U", "lavfi.psnr.mse.u", 2, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_Psnr, nullptr, -1 }, - { Group_MSE, Group_VideoMax, "MSEf Y", "lavfi.psnr.mse.y", 2, false, 1000, DBL_MAX, ActiveFilter_Video_Psnr, nullptr, -1 }, + { Group_MSE, Group_VideoMax, "MSEf V", "lavfi.psnr.mse.v", 2, true, DBL_MAX, DBL_MAX, ActiveFilter_Video_Psnr, "darkred", 1 }, + { Group_MSE, Group_VideoMax, "MSEf U", "lavfi.psnr.mse.u", 2, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_Psnr, "darkblue", 1 }, + { Group_MSE, Group_VideoMax, "MSEf Y", "lavfi.psnr.mse.y", 2, false, 1000, DBL_MAX, ActiveFilter_Video_Psnr, "darkgreen", 1 }, //PSNRf - { Group_PSNR, Group_VideoMax, "PSNRf V", "lavfi.psnr.psnr.v", 2, true, DBL_MAX, DBL_MAX, ActiveFilter_Video_Psnr, nullptr, -1 }, - { Group_PSNR, Group_VideoMax, "PSNRf U", "lavfi.psnr.psnr.u", 2, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_Psnr, nullptr, -1 }, - { Group_PSNR, Group_VideoMax, "PSNRf Y", "lavfi.psnr.psnr.y", 2, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_Psnr, nullptr, -1 }, + { Group_PSNR, Group_VideoMax, "PSNRf V", "lavfi.psnr.psnr.v", 2, true, DBL_MAX, DBL_MAX, ActiveFilter_Video_Psnr, "darkred", 1 }, + { Group_PSNR, Group_VideoMax, "PSNRf U", "lavfi.psnr.psnr.u", 2, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_Psnr, "darkblue", 1 }, + { Group_PSNR, Group_VideoMax, "PSNRf Y", "lavfi.psnr.psnr.y", 2, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_Psnr, "darkgreen", 1 }, //SSIMf - { Group_SSIM, Group_VideoMax, "SSIMf All", "lavfi.ssim.All", 2, true, DBL_MAX, DBL_MAX, ActiveFilter_Video_Ssim, nullptr, -1 }, - { Group_SSIM, Group_VideoMax, "SSIMf V", "lavfi.ssim.V", 2, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_Ssim, nullptr, -1 }, - { Group_SSIM, Group_VideoMax, "SSIMf U", "lavfi.ssim.U", 2, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_Ssim, nullptr, -1 }, - { Group_SSIM, Group_VideoMax, "SSIMf Y", "lavfi.ssim.Y", 2, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_Ssim, nullptr, -1 }, + { Group_SSIM, Group_VideoMax, "SSIMf All", "lavfi.ssim.All", 2, true, DBL_MAX, DBL_MAX, ActiveFilter_Video_Ssim, "black", 1 }, + { Group_SSIM, Group_VideoMax, "SSIMf V", "lavfi.ssim.V", 2, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_Ssim, "darkred", 1 }, + { Group_SSIM, Group_VideoMax, "SSIMf U", "lavfi.ssim.U", 2, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_Ssim, "darkblue", 1 }, + { Group_SSIM, Group_VideoMax, "SSIMf Y", "lavfi.ssim.Y", 2, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_Ssim, "darkgreen", 1 }, //IDET.single - { Group_IDET_S, Group_VideoMax, "s.bff", "lavfi.idet.single.bff", 2, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_Idet, nullptr, -1 }, - { Group_IDET_S, Group_VideoMax, "s.tff", "lavfi.idet.single.tff", 2, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_Idet, nullptr, -1 }, - { Group_IDET_S, Group_VideoMax, "s.prog", "lavfi.idet.single.progressive", 2, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_Idet, nullptr, -1 }, - { Group_IDET_S, Group_VideoMax, "s.und", "lavfi.idet.single.undetermined", 2, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_Idet, nullptr, -1 }, + { Group_IDET_S, Group_VideoMax, "s.bff", "lavfi.idet.single.bff", 2, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_Idet, "royalblue", 2, "0;royalblue;1" }, + { Group_IDET_S, Group_VideoMax, "s.tff", "lavfi.idet.single.tff", 2, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_Idet, "gold", 2, "0;gold;1" }, + { Group_IDET_S, Group_VideoMax, "s.prog", "lavfi.idet.single.progressive", 2, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_Idet, "indigo", 2, "0;indigo;1" }, + { Group_IDET_S, Group_VideoMax, "s.und", "lavfi.idet.single.undetermined",2, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_Idet, "lightgray", 2, "0;lightgray;1" }, //IDET.multiple - { Group_IDET_M, Group_VideoMax, "m.bff", "lavfi.idet.multiple.bff", 2, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_Idet, nullptr, -1 }, - { Group_IDET_M, Group_VideoMax, "m.tff", "lavfi.idet.multiple.tff", 2, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_Idet, nullptr, -1 }, - { Group_IDET_M, Group_VideoMax, "m.prog", "lavfi.idet.multiple.progressive", 2, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_Idet, nullptr, -1 }, - { Group_IDET_M, Group_VideoMax, "m.und", "lavfi.idet.multiple.undetermined", 2, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_Idet, nullptr, -1 }, + { Group_IDET_M, Group_VideoMax, "m.bff", "lavfi.idet.multiple.bff", 2, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_Idet, "royalblue", 2, "0;royalblue;1" }, + { Group_IDET_M, Group_VideoMax, "m.tff", "lavfi.idet.multiple.tff", 2, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_Idet, "gold", 2, "0;gold;1" }, + { Group_IDET_M, Group_VideoMax, "m.prog", "lavfi.idet.multiple.progressive", 2, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_Idet, "indigo", 2, "0;indigo;1" }, + { Group_IDET_M, Group_VideoMax, "m.und", "lavfi.idet.multiple.undetermined",2, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_Idet, "lightgray", 2, "0;lightgray;1" }, //IDET.repeat - { Group_IDET_R, Group_VideoMax, "bottom", "lavfi.idet.repeated.bottom", 2, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_Idet, nullptr, -1 }, - { Group_IDET_R, Group_VideoMax, "top", "lavfi.idet.repeated.top", 2, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_Idet, nullptr, -1 }, - { Group_IDET_R, Group_VideoMax, "neither", "lavfi.idet.repeated.neither", 2, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_Idet, nullptr, -1 }, + { Group_IDET_R, Group_VideoMax, "bottom", "lavfi.idet.repeated.bottom",2, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_Idet, "royalblue", 2, "0;royalblue;1" }, + { Group_IDET_R, Group_VideoMax, "top", "lavfi.idet.repeated.top", 2, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_Idet, "gold", 2, "0;gold;1" }, + { Group_IDET_R, Group_VideoMax, "neither", "lavfi.idet.repeated.neither",2, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_Idet, "lightgray", 2, "0;lightgray;1" }, //DEFL - { Group_DEFL, Group_VideoMax, "flicker", "lavfi.deflicker.relative_change", 5, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_Deflicker, nullptr, -1 }, + { Group_DEFL, Group_VideoMax, "flicker", "lavfi.deflicker.relative_change", 5, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_Deflicker, "olive", 1, "0;olive;0.6" }, //ENTR - { Group_ENTR, Group_VideoMax, "V ENT", "lavfi.entropy.normalized_entropy.normal.V", 5, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_Entropy, nullptr, -1 }, - { Group_ENTR, Group_VideoMax, "U ENT", "lavfi.entropy.normalized_entropy.normal.U", 5, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_Entropy, nullptr, -1 }, - { Group_ENTR, Group_VideoMax, "Y ENT", "lavfi.entropy.normalized_entropy.normal.Y", 5, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_Entropy, nullptr, -1 }, + { Group_ENTR, Group_VideoMax, "V ENT", "lavfi.entropy.normalized_entropy.normal.V",5,false,DBL_MAX, DBL_MAX, ActiveFilter_Video_Entropy, "darkred", 1 }, + { Group_ENTR, Group_VideoMax, "U ENT", "lavfi.entropy.normalized_entropy.normal.U",5,false,DBL_MAX, DBL_MAX, ActiveFilter_Video_Entropy, "darkblue", 1 }, + { Group_ENTR, Group_VideoMax, "Y ENT", "lavfi.entropy.normalized_entropy.normal.Y",5,false,DBL_MAX, DBL_MAX, ActiveFilter_Video_Entropy, "darkgreen", 1 }, //ENTR-DIFF - { Group_ENTRD, Group_VideoMax, "V ENT DIF", "lavfi.entropy.normalized_entropy.diff.V", 5, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_EntropyDiff, nullptr, -1 }, - { Group_ENTRD, Group_VideoMax, "U ENT DIF", "lavfi.entropy.normalized_entropy.diff.U", 5, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_EntropyDiff, nullptr, -1 }, - { Group_ENTRD, Group_VideoMax, "Y ENT DIF", "lavfi.entropy.normalized_entropy.diff.Y", 5, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_EntropyDiff, nullptr, -1 }, + { Group_ENTRD, Group_VideoMax,"V ENT DIF","lavfi.entropy.normalized_entropy.diff.V", 5, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_EntropyDiff, "darkred", 1 }, + { Group_ENTRD, Group_VideoMax,"U ENT DIF","lavfi.entropy.normalized_entropy.diff.U", 5, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_EntropyDiff, "darkblue", 1 }, + { Group_ENTRD, Group_VideoMax,"Y ENT DIF","lavfi.entropy.normalized_entropy.diff.Y", 5, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_EntropyDiff, "darkgreen", 1 }, // pkt_duration_time & pkt_size - { Group_pkt_duration_time, Group_VideoMax, "pkt_duration_time", "pkt_duration_time", 5, false, DBL_MAX, DBL_MAX, (activefilter) -1, nullptr, -1 }, - { Group_pkt_size, Group_VideoMax, "pkt_size", "pkt_size", 0, false, DBL_MAX, DBL_MAX, (activefilter) -1, nullptr, -1 }, + { Group_pkt_duration_time, Group_VideoMax, "pkt_duration_time", "pkt_duration_time", 5, false, DBL_MAX, DBL_MAX, (activefilter) -1, "black", 1, "0;lawngreen;0.6" }, + { Group_pkt_size, Group_VideoMax, "pkt_size", "pkt_size", 0, false, DBL_MAX, DBL_MAX, (activefilter) -1, "black", 1, "0;maroon;0.6" }, // block and blur detections - { Group_blockdetect, Group_VideoMax, "blockiness", "lavfi.block", 6, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_blockdetect, nullptr, -1 }, - { Group_blurdetect, Group_VideoMax, "blurriness", "lavfi.blur", 6, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_blurdetect, nullptr, -1 }, + { Group_blockdetect, Group_VideoMax, "blockiness", "lavfi.block", 6, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_blockdetect, "black", 1, "0;plum;0.6" }, + { Group_blurdetect, Group_VideoMax, "blurriness", "lavfi.blur", 6, false, DBL_MAX, DBL_MAX, ActiveFilter_Video_blurdetect, "black", 1, "0;powderblue;0.6" }, // const std::size_t Group1; //Group // const std::size_t Group2; //Group From 26fd8560a2c54a7015787587756890d05b83d806 Mon Sep 17 00:00:00 2001 From: Alexander Ivash Date: Wed, 3 Jul 2024 22:14:18 +0200 Subject: [PATCH 5/7] fix legend truncation for panels --- Source/GUI/PlotLegend.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Source/GUI/PlotLegend.cpp b/Source/GUI/PlotLegend.cpp index 87912e4f5..d61d73847 100644 --- a/Source/GUI/PlotLegend.cpp +++ b/Source/GUI/PlotLegend.cpp @@ -7,7 +7,9 @@ //--------------------------------------------------------------------------- #include "GUI/PlotLegend.h" +#include #include +#include #include #include @@ -23,9 +25,10 @@ PlotLegend::PlotLegend( QWidget *parent ): setMaxColumns( 1 ); setContentsMargins( 0, 0, 0, 0 ); - QLayout* layout = contentsWidget()->layout(); + QwtDynGridLayout* layout = qobject_cast (contentsWidget()->layout()); layout->setAlignment( Qt::AlignLeft | Qt::AlignTop ); - layout->setSpacing( 0 ); + layout->setSpacing(0); + layout->setExpandingDirections(Qt::Horizontal); QScrollArea *scrollArea = findChild(); if ( scrollArea ) @@ -51,12 +54,15 @@ PlotLegend::~PlotLegend() QWidget *PlotLegend::createWidget( const QwtLegendData &data ) const { QWidget *w = QwtLegend::createWidget( data ); - w->setMaximumHeight(10); + auto icon = data.icon(); + if(!icon.isNull()) + w->setMaximumHeight(10); QwtLegendLabel *label = dynamic_cast( w ); if ( label ) { label->setMargin( 0 ); + label->setContentsMargins(0, 0, 0, 0); } return w; From 936aa8a361e2b1e7e92bfe7924774311bce2a6d8 Mon Sep 17 00:00:00 2001 From: Alexander Ivash Date: Wed, 3 Jul 2024 22:36:50 +0200 Subject: [PATCH 6/7] explicitely include --- Source/GUI/Plot.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/GUI/Plot.cpp b/Source/GUI/Plot.cpp index 62bc185a2..293ce2285 100644 --- a/Source/GUI/Plot.cpp +++ b/Source/GUI/Plot.cpp @@ -28,6 +28,7 @@ #include "Core/FileInformation.h" #include +#include static double stepSize( double distance, int numSteps ) { From 644b341d912542d04fbb9efbb4cc3ca8337cacc5 Mon Sep 17 00:00:00 2001 From: Alexander Ivash Date: Wed, 3 Jul 2024 22:49:29 +0200 Subject: [PATCH 7/7] fix fill is being filled even in yet unplotted areas --- Source/GUI/Plot.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Source/GUI/Plot.cpp b/Source/GUI/Plot.cpp index 293ce2285..fdc1b0740 100644 --- a/Source/GUI/Plot.cpp +++ b/Source/GUI/Plot.cpp @@ -297,8 +297,12 @@ class PlotCurve : public QwtPlotCurve { if(m_fillCurve) baselinePolygon = mapper.toPolygonF( xMap, yMap, m_fillCurve->data(), from, to); else if(m_fillBaseline) { - baselinePolygon += QPointF(xMap.transform(qreal(from)), yMap.transform(m_fillBaseline.value())); - baselinePolygon += QPointF(xMap.transform(qreal(to)), yMap.transform(m_fillBaseline.value())); + const PlotSeriesData* plotSeriesData = static_cast(data()); + auto fromSample = plotSeriesData->sample(from); + auto toSample = plotSeriesData->sample(to); + + baselinePolygon += QPointF(xMap.transform(qreal(fromSample.x())), yMap.transform(m_fillBaseline.value())); + baselinePolygon += QPointF(xMap.transform(qreal(toSample.x())), yMap.transform(m_fillBaseline.value())); } for(auto it = baselinePolygon.rbegin(); it != baselinePolygon.rend(); ++it) {