Skip to content

Make images smaller using best-in-class codecs, right in the browser.

JavaScript

Add comment to thread_level in wp2

Ingvar Stepanyan4f4eaf01b709
diff --git a/codecs/wp2/enc/wp2_enc.cpp b/codecs/wp2/enc/wp2_enc.cpp
index 9b1ac2b7..2d8b1fef 100644
--- a/codecs/wp2/enc/wp2_enc.cpp
+++ b/codecs/wp2/enc/wp2_enc.cpp
@@ -43,6 +43,7 @@ val encode(std::string image_in, int image_width, int image_height, WP2Options o
}
WP2::MemoryWriter memory_writer;
+ // In WebP2, thread_level is number of *extra* threads to use (0 for no multithreading).
config.thread_level = emscripten_num_logical_cores() - 1;
status = WP2::Encode(src, &memory_writer, config);
if (status != WP2_STATUS_OK) {