diff --git a/codecs/avif/enc/avif_enc.cpp b/codecs/avif/enc/avif_enc.cpp index ac949b96..0b096774 100644 --- a/codecs/avif/enc/avif_enc.cpp +++ b/codecs/avif/enc/avif_enc.cpp @@ -48,8 +48,8 @@ val encode(std::string buffer, int width, int height, AvifOptions options) { avifRGBImage srcRGB; avifRGBImageSetDefaults(&srcRGB, image); - avifRGBImageAllocatePixels(&srcRGB); - memcpy(srcRGB.pixels, rgba, width * height * 4); + srcRGB.pixels = rgba; + srcRGB.rowBytes = width * 4; avifImageRGBToYUV(image, &srcRGB); avifEncoder* encoder = avifEncoderCreate(); @@ -65,7 +65,6 @@ val encode(std::string buffer, int width, int height, AvifOptions options) { } auto js_result = Uint8Array.new_(typed_memory_view(output.size, output.data)); - avifRGBImageFreePixels(&srcRGB); avifImageDestroy(image); avifEncoderDestroy(encoder); return js_result; diff --git a/codecs/avif/enc/avif_enc.wasm b/codecs/avif/enc/avif_enc.wasm index 0ea1d4b3..8d62898b 100644 Binary files a/codecs/avif/enc/avif_enc.wasm and b/codecs/avif/enc/avif_enc.wasm differ