mirror of
https://github.com/webmproject/libwebp.git
synced 2025-04-26 02:36:45 +02:00
Some renaming/comments related to palette in lossless encoder.
Change-Id: Iaab32912f4c31e809d7a49fd748099d8c0c3e7d9
This commit is contained in:
parent
4d02d5863f
commit
3d33ecd12b
@ -41,9 +41,11 @@ static int CompareColors(const void* p1, const void* p2) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int CreatePalette256(const uint32_t* const argb, int num_pix,
|
// If number of colors in the image is less than or equal to MAX_PALETTE_SIZE,
|
||||||
uint32_t palette[MAX_PALETTE_SIZE],
|
// creates a palette and returns true, else returns false.
|
||||||
int* const palette_size) {
|
static int AnalyzeAndCreatePalette(const uint32_t* const argb, int num_pix,
|
||||||
|
uint32_t palette[MAX_PALETTE_SIZE],
|
||||||
|
int* const palette_size) {
|
||||||
int i, key;
|
int i, key;
|
||||||
int num_colors = 0;
|
int num_colors = 0;
|
||||||
uint8_t in_use[MAX_PALETTE_SIZE * 4] = { 0 };
|
uint8_t in_use[MAX_PALETTE_SIZE * 4] = { 0 };
|
||||||
@ -137,8 +139,9 @@ static int VP8LEncAnalyze(VP8LEncoder* const enc) {
|
|||||||
enc->use_cross_color_ = 1;
|
enc->use_cross_color_ = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
enc->use_palette_ = CreatePalette256(pic->argb, pic->width * pic->height,
|
enc->use_palette_ =
|
||||||
enc->palette_, &enc->palette_size_);
|
AnalyzeAndCreatePalette(pic->argb, pic->width * pic->height,
|
||||||
|
enc->palette_, &enc->palette_size_);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1062,6 +1065,9 @@ static WebPEncodingError AllocateTransformBuffer(VP8LEncoder* const enc,
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Note: Expects "enc->palette_" to be set properly.
|
||||||
|
// Also, "enc->palette_" will be modified after this call and should not be used
|
||||||
|
// later.
|
||||||
static WebPEncodingError ApplyPalette(VP8LBitWriter* const bw,
|
static WebPEncodingError ApplyPalette(VP8LBitWriter* const bw,
|
||||||
VP8LEncoder* const enc,
|
VP8LEncoder* const enc,
|
||||||
int width, int height, int quality) {
|
int width, int height, int quality) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user