WebPAnimDecoder: add an option to enable multi-threaded decoding.

Change-Id: I3ff12bc07fc5a1b57a6950afa0e5f54a12985e75
This commit is contained in:
Urvang Joshi 2015-11-11 10:33:26 -08:00
parent 3584abca16
commit 1aa4e3d6ba
2 changed files with 5 additions and 2 deletions

View File

@ -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;
}

View File

@ -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.