Skip to content

Commit

Permalink
Merge pull request mozilla#18580 from calixteman/alt_text_pass_buffer
Browse files Browse the repository at this point in the history
[Editor] Pass a buffer instead of a typed array when passing image data to the model
  • Loading branch information
calixteman authored Aug 8, 2024
2 parents 999403f + d2e8e74 commit 40aa593
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/display/editor/stamp.js
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit 40aa593

Please sign in to comment.