Status: New Owner: ---- Labels: Type-Defect Priority-Medium New issue 288 by nikola.m...@gmail.com: Image decoding uses too much memory with crop and and alpha channel https://bugs.chromium.org/p/webp/issues/detail?id=288 What steps will reproduce the problem? 1. Try decoding a small cropped region of a 4096x4096 image, encoded with lossy RGB and lossless alpha channel (default options for cwebp) WebPDecoderConfig config; WebPInitDecoderConfig(&config); config.output.colorspace = MODE_bgrA; // premultiplied alpha config.output.u.RGBA.rgba = (uint8_t*)toPtr; config.output.u.RGBA.stride = toScanlineSizeBytes; config.output.u.RGBA.size = toSizeBytes; config.output.is_external_memory = 1; config.options.use_cropping = true; config.options.crop_left = 0; config.options.crop_top = 0; config.options.crop_width = 100; config.options.crop_height = 100; config.options.no_fancy_upsampling = true; config.options.bypass_filtering = true; WebPDecode((uint8_t *)fromPtr, fromSizeBytes, &config); What is the expected output? What do you see instead? Expected: image decodes and uses small amount of memory (e.g. 40k, 100k) Actual: phone application crashes with out of memory because alpha channel decoding allocates 67 MB of memory. What version of the product are you using? On what operating system? Any Please provide any additional information below. According to the Advanced Decoding API section here: https://developers.google.com/speed/webp/docs/api decoding should use only memory related to the output size, not decode the complete input when cropping is applied. I tried with lossy alpha to no effect. The function doing the allocation is: static int AllocateInternalBuffers32b(VP8LDecoder* const dec, int final_width) in libwebp\dec\vp8l.c -- You received this message because: 1. The project was configured to send all issue notifications to this address You may adjust your notification preferences at: https://bugs.chromium.org/hosting/settings
Comment #1 on issue 288 by nikola.m...@gmail.com: Image decoding uses too much memory with crop and and alpha channel https://bugs.chromium.org/p/webp/issues/detail?id=288#c1 I have a spritesheet encoded as .webp in order to reduce memory/storage size for thousands of files. I only need to load part of the sprites at runtime, thus using webp to achieve this. -- You received this message because: 1. The project was configured to send all issue notifications to this address You may adjust your notification preferences at: https://bugs.chromium.org/hosting/settings