mirror of
https://github.com/webmproject/libwebp.git
synced 2025-07-17 06:19:54 +02:00
lossless: make prediction in encoder work per scanline
instead of per block. This prepares for a next CL that can make the predictors alter RGB value behind transparent pixels for denser encoding. Some predictors depend on the top-right pixel, and it must have been already processed to know its new RGB value, so requires per scanline instead of per block. Running the encode speed test on 1000 PNGs 10 times with default settings: Before: Compression (output/input): 2.3745/3.2667 bpp, Encode rate (raw data): 1.497 MP/s After: Compression (output/input): 2.3745/3.2667 bpp, Encode rate (raw data): 1.501 MP/s Same but with quality 0, method 0 and 30 iterations: Before: Compression (output/input): 2.9120/3.2667 bpp, Encode rate (raw data): 36.379 MP/s After: Compression (output/input): 2.9120/3.2667 bpp, Encode rate (raw data): 36.462 MP/s No effect on compressed size, this produces exactly same files. No significant measured effect on speed. Expected faster speed from better memory layout with scanline processing but slower speed due to needing to get predictor mode per pixel, may compensate each other. Change-Id: I40f766f1c1c19f87b62c1e2a1c4cd7627a2c3334
This commit is contained in:
committed by
Pascal Massimino
parent
5cd2ef4c4a
commit
239421c5ef
@ -1123,8 +1123,10 @@ static WebPEncodingError AllocateTransformBuffer(VP8LEncoder* const enc,
|
||||
if (enc->argb_ == NULL) {
|
||||
const int tile_size = 1 << enc->transform_bits_;
|
||||
const uint64_t image_size = width * height;
|
||||
// Ensure enough size for tiles, as well as for two scanlines and two
|
||||
// extra pixels for CopyImageWithPrediction.
|
||||
const uint64_t argb_scratch_size =
|
||||
enc->use_predict_ ? tile_size * width + width : 0;
|
||||
enc->use_predict_ ? tile_size * width + width + 2 : 0;
|
||||
const int transform_data_size =
|
||||
(enc->use_predict_ || enc->use_cross_color_)
|
||||
? VP8LSubSampleSize(width, enc->transform_bits_) *
|
||||
|
Reference in New Issue
Block a user