mirror of
https://github.com/webmproject/libwebp.git
synced 2024-11-20 04:18:26 +01:00
Alpha encoding: never filter in case of NO_COMPRESSION
This is because, filtering would never affect compression density for this case. Change-Id: I4bb14d3eb7da0a3805fda140eb1dfbf9ccc134f5
This commit is contained in:
parent
86daf77c47
commit
8cf0701eb0
@ -217,6 +217,8 @@ static void InitFilterTrial(FilterTrial* const score) {
|
||||
VP8BitWriterInit(&score->bw, 0);
|
||||
}
|
||||
|
||||
// TODO(urvang): This method name is misleading. Should be renamed to
|
||||
// ApplyFiltersAndEncode() perhaps.
|
||||
static int ApplyFilters(const uint8_t* alpha, int width, int height,
|
||||
size_t data_size, int method, int filter,
|
||||
int reduce_levels, int effort_level,
|
||||
@ -224,8 +226,11 @@ static int ApplyFilters(const uint8_t* alpha, int width, int height,
|
||||
WebPAuxStats* const stats) {
|
||||
int ok = 1;
|
||||
uint8_t* filtered_alpha = NULL;
|
||||
uint32_t try_map = GetFilterMap(alpha, width, height, filter, effort_level);
|
||||
uint32_t try_map =
|
||||
GetFilterMap(alpha, width, height, filter, effort_level);
|
||||
|
||||
// TODO(urvang): In case of no filtering, this malloc is unnecessary. Also,
|
||||
// the whole loop below should be avoided in that case.
|
||||
filtered_alpha = (uint8_t*)malloc(data_size);
|
||||
ok = (filtered_alpha != NULL);
|
||||
|
||||
@ -296,6 +301,11 @@ static int EncodeAlpha(VP8Encoder* const enc,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (method == ALPHA_NO_COMPRESSION) {
|
||||
// Don't filter, as filtering will make no impact on compressed size.
|
||||
filter = WEBP_FILTER_NONE;
|
||||
}
|
||||
|
||||
quant_alpha = (uint8_t*)malloc(data_size);
|
||||
if (quant_alpha == NULL) {
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user