Speedup WebP lossless compression for low effort (m=0) mode with following:

- Disable Cross-Color transform.
- Evaluate predictors #11 (paeth), #12 and #13 only.

Change-Id: I857264c85c61c3957d4fb45ae32d261d947c8bed
This commit is contained in:
Pascal Massimino
2014-12-17 11:52:11 +01:00
parent 9275d91c79
commit 31a9cf6417
3 changed files with 16 additions and 10 deletions

View File

@ -758,9 +758,12 @@ static WEBP_INLINE void UpdateHisto(int histo_argb[4][256], uint32_t argb) {
static int GetBestPredictorForTile(int width, int height,
int tile_x, int tile_y, int bits,
int low_effort,
const int accumulated[4][256],
const uint32_t* const argb_scratch) {
const int kNumPredModes = 14;
const int kPredModePaeth = 11;
const int start_mode = low_effort ? kPredModePaeth : 0;
const int col_start = tile_x << bits;
const int row_start = tile_y << bits;
const int tile_size = 1 << bits;
@ -769,7 +772,7 @@ static int GetBestPredictorForTile(int width, int height,
float best_diff = MAX_DIFF_COST;
int best_mode = 0;
int mode;
for (mode = 0; mode < kNumPredModes; ++mode) {
for (mode = start_mode; mode < kNumPredModes; ++mode) {
const uint32_t* current_row = argb_scratch;
const VP8LPredictorFunc pred_func = VP8LPredictors[mode];
float cur_diff;
@ -839,7 +842,7 @@ static void CopyTileWithPrediction(int width, int height,
}
}
void VP8LResidualImage(int width, int height, int bits,
void VP8LResidualImage(int width, int height, int bits, int low_effort,
uint32_t* const argb, uint32_t* const argb_scratch,
uint32_t* const image) {
const int max_tile_size = 1 << bits;
@ -870,7 +873,7 @@ void VP8LResidualImage(int width, int height, int bits,
all_x_max = width;
}
pred = GetBestPredictorForTile(width, height, tile_x, tile_y, bits,
(const int (*)[256])histo,
low_effort, (const int (*)[256])histo,
argb_scratch);
image[tile_y * tiles_per_row + tile_x] = 0xff000000u | (pred << 8);
CopyTileWithPrediction(width, height, tile_x, tile_y, bits, pred,

View File

@ -98,7 +98,7 @@ void VP8LColorIndexInverseTransformAlpha(
const struct VP8LTransform* const transform, int y_start, int y_end,
const uint8_t* src, uint8_t* dst);
void VP8LResidualImage(int width, int height, int bits,
void VP8LResidualImage(int width, int height, int bits, int low_effort,
uint32_t* const argb, uint32_t* const argb_scratch,
uint32_t* const image);