Add support to recomb operation for 4x4 matrices

This commit is contained in:
Denice
2024-07-02 17:06:26 +07:00
committed by Lovell Fuller
parent eab7dc1b49
commit 60c5c5083d
14 changed files with 74 additions and 34 deletions

View File

@@ -609,7 +609,7 @@ class PipelineWorker : public Napi::AsyncWorker {
}
// Recomb
if (baton->recombMatrix != NULL) {
if (!baton->recombMatrix.empty()) {
image = sharp::Recomb(image, baton->recombMatrix);
}
@@ -1613,10 +1613,11 @@ Napi::Value pipeline(const Napi::CallbackInfo& info) {
}
}
if (options.Has("recombMatrix")) {
baton->recombMatrix = std::unique_ptr<double[]>(new double[9]);
Napi::Array recombMatrix = options.Get("recombMatrix").As<Napi::Array>();
for (unsigned int i = 0; i < 9; i++) {
baton->recombMatrix[i] = sharp::AttrAsDouble(recombMatrix, i);
unsigned int matrixElements = recombMatrix.Length();
baton->recombMatrix.resize(matrixElements);
for (unsigned int i = 0; i < matrixElements; i++) {
baton->recombMatrix[i] = sharp::AttrAsDouble(recombMatrix, i);
}
}
baton->colourspacePipeline = sharp::AttrAsEnum<VipsInterpretation>(