14.28 round 1: the cache, the job's brightness and the scope's bytes pinned
This commit is contained in:
6 files changed
+75
-1
No files matched your search
@@ -0,0 +1,58 @@
|
||||
#include "AddressSpaceLimit.h"
|
||||
#include "Document/BrushStroke.h"
|
||||
#include "Document/EditorSession.h"
|
||||
#include "Document/Filters.h"
|
||||
#include <QtTest>
|
||||
#include <malloc.h>
|
||||
|
||||
// What a8630e4 spares: a second measure, a second picture.
|
||||
class CameraRawFoldFailureTests : public QObject {
|
||||
Q_OBJECT
|
||||
private slots:
|
||||
void aMeasuredSourceIsNotDrawnAgain();
|
||||
void theScopeReadsPremultipliedBytesInPlace();
|
||||
};
|
||||
|
||||
void CameraRawFoldFailureTests::aMeasuredSourceIsNotDrawnAgain()
|
||||
{
|
||||
QImage gray = BrushRaster::context(2048, 2048, false);
|
||||
gray.fill(QColor(64, 64, 64));
|
||||
EditorSession session;
|
||||
session.createDocument(2048, 2048);
|
||||
session.insert(ImportedImage(gray, gray.scaled(96, 96), QStringLiteral("Gray")));
|
||||
session.beginFilter(FilterKind::cameraRaw);
|
||||
const FilterEdit &edit = session.filterEdit().value();
|
||||
QCOMPARE(edit.previewSource.size(), QSize(2048, 2048));
|
||||
QVERIFY(std::abs(edit.previewBrightness().brightest - 64) < 0.01);
|
||||
double again = 0;
|
||||
{
|
||||
// No room for a 16 MB redraw: the reading stays.
|
||||
const AddressSpaceLimit limit(2ll << 20);
|
||||
again = edit.previewBrightness().brightest;
|
||||
}
|
||||
QVERIFY(std::abs(again - 64) < 0.01);
|
||||
}
|
||||
|
||||
void CameraRawFoldFailureTests::theScopeReadsPremultipliedBytesInPlace()
|
||||
{
|
||||
QImage gray = BrushRaster::context(4096, 4096, false);
|
||||
gray.fill(QColor(64, 64, 64));
|
||||
std::optional<CameraRawScope> scope;
|
||||
{
|
||||
// A 64 MB copy cannot fit; bytes read in place.
|
||||
const AddressSpaceLimit limit(2ll << 20);
|
||||
scope = CameraRawScope::make(gray);
|
||||
}
|
||||
QCOMPARE(scope.value().red[64], 2048.0 * 2048.0);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
// Large asks map memory the limit counts.
|
||||
mallopt(M_MMAP_THRESHOLD, 64 * 1024);
|
||||
QApplication app(argc, argv);
|
||||
CameraRawFoldFailureTests tests;
|
||||
return QTest::qExec(&tests, argc, argv);
|
||||
}
|
||||
|
||||
#include "CameraRawFoldFailureTests.moc"
|
||||
@@ -14,6 +14,7 @@ private slots:
|
||||
void aPointColourOrRefineSaturationKeepsTheCurvePass();
|
||||
void aKnownBrightnessIsReadBeforeCalibration();
|
||||
void aSessionMeasuresItsPreviewSourceOnce();
|
||||
void aJobsBrightnessReachesTheGrade();
|
||||
void everyBandIsMeasuredAndCounted();
|
||||
void calibrationsBlueHueTurnsAndItsSaturationSaturates();
|
||||
};
|
||||
@@ -158,6 +159,18 @@ void CameraRawFoldTests::aSessionMeasuresItsPreviewSourceOnce()
|
||||
QVERIFY(!session.filterEdit().value().previewJob().cameraRawBrightness);
|
||||
}
|
||||
|
||||
// A job's brightness is the one the grade reads.
|
||||
void CameraRawFoldTests::aJobsBrightnessReachesTheGrade()
|
||||
{
|
||||
const QImage gray = image(4, 4, 128 / 255.0, 128 / 255.0, 128 / 255.0);
|
||||
FilterSettings settings;
|
||||
settings.cameraRaw.shadows = 100;
|
||||
FilterJob job{FilterKind::cameraRaw, gray, settings, 1, std::nullopt, QTransform()};
|
||||
job.cameraRawBrightness = CameraRawTables::Brightness{60, 60, 60};
|
||||
const QImage handed = settings.cameraRaw.apply(gray, std::nullopt, 1, 0, -1, false, CameraRawTables::Brightness{60, 60, 60});
|
||||
QVERIFY(pixels(PixelFilter::run(job)) == pixels(handed) && pixels(handed) != pixels(settings.cameraRaw.apply(gray)));
|
||||
}
|
||||
|
||||
// Forty rows of gray: every band's rows reach the sums.
|
||||
void CameraRawFoldTests::everyBandIsMeasuredAndCounted()
|
||||
{
|
||||
|
||||
@@ -317,6 +317,7 @@ compositor_test(ColorAdjustmentTests)
|
||||
compositor_test(CameraRawTests)
|
||||
compositor_test(CameraRawTablesTests)
|
||||
compositor_test(CameraRawFoldTests)
|
||||
compositor_test(CameraRawFoldFailureTests)
|
||||
target_include_directories(CameraRawFoldTests PRIVATE ${OMAPHOTO_KERNELS})
|
||||
target_include_directories(CameraRawTablesTests PRIVATE ${OMAPHOTO_KERNELS})
|
||||
compositor_test(CameraRawColorNoiseTests)
|
||||
|
||||
Reference in new issue
Block a user