Improve performance of histogram/waveform updates

Only perform calculations for the currently shown scope.
Cache the waveform so it can be reused when the scope is resized.
Increase speed of waveform rendering.
This commit is contained in:
Lawrence Lee
2020-07-26 13:27:17 -07:00
parent 99b7a557c9
commit 6df69b3786
7 changed files with 228 additions and 69 deletions

View File

@@ -302,6 +302,8 @@ public:
virtual void sizeChanged(int w, int h, int ow, int oh) = 0;
};
class HistogramObservable;
/** This listener is used when the histogram of the final image has changed. */
class HistogramListener
{
@@ -334,6 +336,21 @@ public:
const int waveformGreen[][256],
const int waveformBlue[][256]
) = 0;
/** Tells which observable is notifying the listener. */
virtual void setObservable(HistogramObservable* observable) = 0;
/** Returns if the listener wants the histogram to be updated. */
virtual bool updateHistogram(void) = 0;
/** Returns if the listener wants the waveform to be updated. */
virtual bool updateWaveform(void) = 0;
};
class HistogramObservable
{
public:
/** Tells the observable to update the histogram data. */
virtual void updateHistogram() = 0;
/** Tells the observable to update the waveform data. */
virtual void updateWaveform() = 0;
};
/** This listener is used when the auto exposure has been recomputed (e.g. when the clipping ratio changed). */