From 1aa4e3d6ba2c817c92f37bebde07cc104a937ec7 Mon Sep 17 00:00:00 2001 From: Urvang Joshi Date: Wed, 11 Nov 2015 10:33:26 -0800 Subject: [PATCH] WebPAnimDecoder: add an option to enable multi-threaded decoding. Change-Id: I3ff12bc07fc5a1b57a6950afa0e5f54a12985e75 --- src/demux/anim_decode.c | 2 ++ src/webp/demux.h | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/demux/anim_decode.c b/src/demux/anim_decode.c index 29aa12b7..050c5cdb 100644 --- a/src/demux/anim_decode.c +++ b/src/demux/anim_decode.c @@ -47,6 +47,7 @@ struct WebPAnimDecoder { static void DefaultDecoderOptions(WebPAnimDecoderOptions* const dec_options) { dec_options->color_mode = MODE_RGBA; + dec_options->use_threads = 0; } int WebPAnimDecoderOptionsInitInternal(WebPAnimDecoderOptions* dec_options, @@ -76,6 +77,7 @@ static int ApplyDecoderOptions(const WebPAnimDecoderOptions* const dec_options, WebPInitDecoderConfig(config); config->output.colorspace = mode; config->output.is_external_memory = 1; + config->options.use_threads = dec_options->use_threads; // Note: config->output.u.RGBA is set at the time of decoding each frame. return 1; } diff --git a/src/webp/demux.h b/src/webp/demux.h index 306090e0..aac258b5 100644 --- a/src/webp/demux.h +++ b/src/webp/demux.h @@ -55,7 +55,7 @@ extern "C" { #endif -#define WEBP_DEMUX_ABI_VERSION 0x0103 // MAJOR(8b) + MINOR(8b) +#define WEBP_DEMUX_ABI_VERSION 0x0104 // MAJOR(8b) + MINOR(8b) // Note: forward declaring enumerations is not allowed in (strict) C and C++, // the types are left here for reference. @@ -251,7 +251,8 @@ struct WebPAnimDecoderOptions { // Output colorspace. Only the following modes are supported: // MODE_RGBA, MODE_BGRA, MODE_rgbA and MODE_bgrA. WEBP_CSP_MODE color_mode; - uint32_t padding[8]; // Padding for later use. + int use_threads; // If true, use multi-threaded decoding. + uint32_t padding[7]; // Padding for later use. }; // Internal, version-checked, entry point.