From d2e8e742eb0030f10c180fdca37db202d9fbbbf5 Mon Sep 17 00:00:00 2001 From: Calixte Denizet Date: Thu, 8 Aug 2024 14:39:09 +0200 Subject: [PATCH] [Editor] Pass a buffer instead of a typed array when passing image data to the model --- src/display/editor/stamp.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/display/editor/stamp.js b/src/display/editor/stamp.js index fc15ea7270b79..12e9f65ff28fd 100644 --- a/src/display/editor/stamp.js +++ b/src/display/editor/stamp.js @@ -169,7 +169,9 @@ class StampEditor extends AnnotationEditor { const response = await mlManager.guess({ name: "altText", request: { - data, + // Pass a buffer to avoid copy, see "run" method in: + // https://searchfox.org/mozilla-central/source/toolkit/components/ml/actors/MLEngineParent.sys.mjs + data: data.buffer, width, height, channels: data.length / (width * height),