mirror of
https://github.com/webmproject/libwebp.git
synced 2025-07-13 06:24:27 +02:00
silently expose use_delta_palette in the WebPConfig API
is just a placeholder for now, unless WEBP_USE_EXPERIMENTAL_FEATURES is defined. Change-Id: I087cb49781560bc1a7fbb01b136d36115c97ef72
This commit is contained in:
@ -53,9 +53,7 @@ int WebPConfigInitInternal(WebPConfig* config,
|
||||
config->thread_level = 0;
|
||||
config->low_memory = 0;
|
||||
config->near_lossless = 100;
|
||||
#ifdef WEBP_EXPERIMENTAL_FEATURES
|
||||
config->delta_palettization = 0;
|
||||
#endif // WEBP_EXPERIMENTAL_FEATURES
|
||||
config->use_delta_palette = 0;
|
||||
|
||||
// TODO(skal): tune.
|
||||
switch (preset) {
|
||||
@ -121,11 +119,9 @@ int WebPValidateConfig(const WebPConfig* config) {
|
||||
if (config->thread_level < 0 || config->thread_level > 1) return 0;
|
||||
if (config->low_memory < 0 || config->low_memory > 1) return 0;
|
||||
if (config->exact < 0 || config->exact > 1) return 0;
|
||||
#ifdef WEBP_EXPERIMENTAL_FEATURES
|
||||
if (config->delta_palettization < 0 || config->delta_palettization > 1) {
|
||||
if (config->use_delta_palette < 0 || config->use_delta_palette > 1) {
|
||||
return 0;
|
||||
}
|
||||
#endif // WEBP_EXPERIMENTAL_FEATURES
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1454,7 +1454,7 @@ WebPEncodingError VP8LEncodeStream(const WebPConfig* const config,
|
||||
int use_near_lossless = 0;
|
||||
int hdr_size = 0;
|
||||
int data_size = 0;
|
||||
int use_delta_palettization = 0;
|
||||
int use_delta_palette = 0;
|
||||
|
||||
if (enc == NULL) {
|
||||
err = VP8_ENC_ERROR_OUT_OF_MEMORY;
|
||||
@ -1481,7 +1481,7 @@ WebPEncodingError VP8LEncodeStream(const WebPConfig* const config,
|
||||
}
|
||||
|
||||
#ifdef WEBP_EXPERIMENTAL_FEATURES
|
||||
if (config->delta_palettization) {
|
||||
if (config->use_delta_palette) {
|
||||
enc->use_predict_ = 1;
|
||||
enc->use_cross_color_ = 0;
|
||||
enc->use_subtract_green_ = 0;
|
||||
@ -1495,7 +1495,7 @@ WebPEncodingError VP8LEncodeStream(const WebPConfig* const config,
|
||||
if (err != VP8_ENC_OK) goto Error;
|
||||
err = EncodeDeltaPalettePredictorImage(bw, enc, quality, low_effort);
|
||||
if (err != VP8_ENC_OK) goto Error;
|
||||
use_delta_palettization = 1;
|
||||
use_delta_palette = 1;
|
||||
}
|
||||
}
|
||||
#endif // WEBP_EXPERIMENTAL_FEATURES
|
||||
@ -1504,14 +1504,14 @@ WebPEncodingError VP8LEncodeStream(const WebPConfig* const config,
|
||||
if (enc->use_palette_) {
|
||||
err = EncodePalette(bw, low_effort, enc);
|
||||
if (err != VP8_ENC_OK) goto Error;
|
||||
err = MapImageFromPalette(enc, use_delta_palettization);
|
||||
err = MapImageFromPalette(enc, use_delta_palette);
|
||||
if (err != VP8_ENC_OK) goto Error;
|
||||
// If using a color cache, do not have it bigger than the number of colors.
|
||||
if (use_cache && enc->palette_size_ < (1 << MAX_COLOR_CACHE_BITS)) {
|
||||
enc->cache_bits_ = BitsLog2Floor(enc->palette_size_) + 1;
|
||||
}
|
||||
}
|
||||
if (!use_delta_palettization) {
|
||||
if (!use_delta_palette) {
|
||||
// In case image is not packed.
|
||||
if (enc->argb_ == NULL) {
|
||||
err = MakeInputImageCopy(enc);
|
||||
|
@ -20,7 +20,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define WEBP_ENCODER_ABI_VERSION 0x020b // MAJOR(8b) + MINOR(8b)
|
||||
#define WEBP_ENCODER_ABI_VERSION 0x020c // MAJOR(8b) + MINOR(8b)
|
||||
|
||||
// Note: forward declaring enumerations is not allowed in (strict) C and C++,
|
||||
// the types are left here for reference.
|
||||
@ -141,12 +141,8 @@ struct WebPConfig {
|
||||
// RGB information for better compression. The default
|
||||
// value is 0.
|
||||
|
||||
#ifdef WEBP_EXPERIMENTAL_FEATURES
|
||||
int delta_palettization;
|
||||
uint32_t pad[2]; // padding for later use
|
||||
#else
|
||||
int use_delta_palette; // reserved for future lossless feature
|
||||
uint32_t pad[3]; // padding for later use
|
||||
#endif // WEBP_EXPERIMENTAL_FEATURES
|
||||
};
|
||||
|
||||
// Enumerate some predefined settings for WebPConfig, depending on the type
|
||||
|
Reference in New Issue
Block a user