further cleanups

This commit is contained in:
Ingo Weyrich
2020-08-15 22:36:10 +02:00
parent 07d26c16ed
commit e67b02da8b
5 changed files with 19 additions and 25 deletions

View File

@@ -140,6 +140,7 @@ public:
{
buffer.clear();
rows.clear();
width = 0;
}
// use with indices

View File

@@ -1864,17 +1864,6 @@ BENCHFUN
memset((int*)vectorscope, 0, size * size * sizeof(vectorscope[0][0]));
vectorscopeScale = (x2 - x1) * (y2 - y1);
const int lab_img_size = (hListener->vectorscopeType() == 1) ? vectorscopeScale : 0;
std::unique_ptr<float[]> a;
std::unique_ptr<float[]> b;
if (lab_img_size) {
a.reset(new float[lab_img_size]);
b.reset(new float[lab_img_size]);
std::unique_ptr<float []> L(new float[lab_img_size]);
ipf.rgb2lab(*workimg, x1, y1, x2 - x1, y2 - y1, L.get(), a.get(), b.get(), params->icm);
}
if (hListener->vectorscopeType() == 0) { // HS
for (int i = y1; i < y2; ++i) {
int ofs = (i * pW + x1) * 3;
@@ -1893,6 +1882,10 @@ BENCHFUN
}
}
} else if (hListener->vectorscopeType() == 1) { // CH
const std::unique_ptr<float[]> a(new float[vectorscopeScale]);
const std::unique_ptr<float[]> b(new float[vectorscopeScale]);
const std::unique_ptr<float[]> L(new float[vectorscopeScale]);
ipf.rgb2lab(*workimg, x1, y1, x2 - x1, y2 - y1, L.get(), a.get(), b.get(), params->icm);
for (int i = y1; i < y2; ++i) {
for (int j = x1, ofs_lab = (i - y1) * (x2 - x1); j < x2; ++j, ++ofs_lab) {
const int col = (size / 96000.f) * a[ofs_lab] + size / 2;
@@ -1908,11 +1901,11 @@ BENCHFUN
void ImProcCoordinator::updateWaveforms()
{
if (!workimg) {
// Resize to zero.
waveformRed(0, 0);
waveformGreen(0, 0);
waveformBlue(0, 0);
waveformLuma(0, 0);
// free memory
waveformRed.free();
waveformGreen.free();
waveformBlue.free();
waveformLuma.free();
return;
}

View File

@@ -344,11 +344,11 @@ public:
/** 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;
virtual bool updateHistogram(void) const = 0;
/** Returns if the listener wants the vectorscope to be updated. */
virtual bool updateVectorscope(void) = 0;
virtual bool updateVectorscope(void) const = 0;
/** Returns if the listener wants the waveform to be updated. */
virtual bool updateWaveform(void) = 0;
virtual bool updateWaveform(void) const = 0;
/** Returns the vectorscope type: 0 for H-S and 1 for H-C. */
virtual int vectorscopeType(void) const = 0;
};

View File

@@ -2269,13 +2269,13 @@ void EditorPanel::setObservable(rtengine::HistogramObservable* observable)
histogram_observable = observable;
}
bool EditorPanel::updateHistogram(void)
bool EditorPanel::updateHistogram(void) const
{
return histogram_scope_type == HistogramPanelListener::HISTOGRAM
|| histogram_scope_type == HistogramPanelListener::NONE;
}
bool EditorPanel::updateVectorscope(void)
bool EditorPanel::updateVectorscope(void) const
{
return
histogram_scope_type == HistogramPanelListener::VECTORSCOPE_HS
@@ -2283,7 +2283,7 @@ bool EditorPanel::updateVectorscope(void)
|| histogram_scope_type == HistogramPanelListener::NONE;
}
bool EditorPanel::updateWaveform(void)
bool EditorPanel::updateWaveform(void) const
{
return histogram_scope_type == HistogramPanelListener::WAVEFORM
|| histogram_scope_type == HistogramPanelListener::NONE;

View File

@@ -143,9 +143,9 @@ public:
const array2D<int>& waveformLuma
) override;
void setObservable(rtengine::HistogramObservable* observable) override;
bool updateHistogram(void) override;
bool updateVectorscope(void) override;
bool updateWaveform(void) override;
bool updateHistogram(void) const override;
bool updateVectorscope(void) const override;
bool updateWaveform(void) const override;
int vectorscopeType(void) const override;
// HistogramPanelListener