mirror of
https://github.com/webmproject/libwebp.git
synced 2025-07-13 06:24:27 +02:00
Introduce a 'fast' alpha mode
.. where only 2 filtering modes are potentially tried, instead of all of them. This is fast than the exhaustive 'best' mode, and not much worse. Options for cwebp are: -alpha_filter none -alpha_filter fast (<- default) -alpha_filter best (<- slow) Change-Id: I8cb90ee11b8f981811e013ea4ad5bf72ba3ea7d4
This commit is contained in:
@ -14,6 +14,7 @@
|
||||
|
||||
#include "./vp8enci.h"
|
||||
#include "../utils/alpha.h"
|
||||
#include "../utils/filters.h"
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
extern "C" {
|
||||
@ -33,10 +34,15 @@ int VP8EncFinishAlpha(VP8Encoder* enc) {
|
||||
const WebPPicture* pic = enc->pic_;
|
||||
uint8_t* tmp_data = NULL;
|
||||
size_t tmp_size = 0;
|
||||
const WEBP_FILTER_TYPE filter =
|
||||
(config->alpha_filtering == 0) ? WEBP_FILTER_NONE :
|
||||
(config->alpha_filtering == 1) ? WEBP_FILTER_FAST :
|
||||
WEBP_FILTER_BEST;
|
||||
|
||||
assert(pic->a);
|
||||
if (!EncodeAlpha(pic->a, pic->width, pic->height, pic->a_stride,
|
||||
config->alpha_quality, config->alpha_compression,
|
||||
config->alpha_filtering, &tmp_data, &tmp_size)) {
|
||||
filter, &tmp_data, &tmp_size)) {
|
||||
return 0;
|
||||
}
|
||||
if (tmp_size != (uint32_t)tmp_size) { // Sanity check.
|
||||
|
Reference in New Issue
Block a user