cwebp: add a -sharp_yuv option for 'sharp' RGB->YUV conversion

Change-Id: I6edd5b44d693da50f702fa8218f14872874d91ba
This commit is contained in:
Pascal Massimino
2017-01-20 16:53:58 +01:00
parent 79bf46f120
commit 4689ce1635
6 changed files with 20 additions and 5 deletions

View File

@ -54,6 +54,7 @@ int WebPConfigInitInternal(WebPConfig* config,
config->low_memory = 0;
config->near_lossless = 100;
config->use_delta_palette = 0;
config->use_sharp_yuv = 0;
// TODO(skal): tune.
switch (preset) {
@ -122,6 +123,8 @@ int WebPValidateConfig(const WebPConfig* config) {
if (config->use_delta_palette < 0 || config->use_delta_palette > 1) {
return 0;
}
if (config->use_sharp_yuv < 0 || config->use_sharp_yuv > 1) return 0;
return 1;
}

View File

@ -342,7 +342,7 @@ int WebPEncode(const WebPConfig* config, WebPPicture* pic) {
if (pic->use_argb || pic->y == NULL || pic->u == NULL || pic->v == NULL) {
// Make sure we have YUVA samples.
if (config->preprocessing & 4) {
if (config->use_sharp_yuv || (config->preprocessing & 4)) {
if (!WebPPictureSharpARGBToYUVA(pic)) {
return 0;
}

View File

@ -20,7 +20,7 @@
extern "C" {
#endif
#define WEBP_ENCODER_ABI_VERSION 0x020d // MAJOR(8b) + MINOR(8b)
#define WEBP_ENCODER_ABI_VERSION 0x020e // MAJOR(8b) + MINOR(8b)
// Note: forward declaring enumerations is not allowed in (strict) C and C++,
// the types are left here for reference.
@ -142,7 +142,9 @@ struct WebPConfig {
// value is 0.
int use_delta_palette; // reserved for future lossless feature
uint32_t pad[3]; // padding for later use
int use_sharp_yuv; // if needed, use sharp (and slow) RGB->YUV conversion
uint32_t pad[2]; // padding for later use
};
// Enumerate some predefined settings for WebPConfig, depending on the type