Guard the lossless encoder (in flux) under a flag

Change-Id: I6dd8fd17089c199001c06b1afde14233dc3e3234
This commit is contained in:
Urvang Joshi
2012-04-11 09:52:13 +00:00
committed by James Zern
parent 09f7532cce
commit 6b38378acb
16 changed files with 82 additions and 4 deletions

View File

@ -19,8 +19,10 @@ extern "C" {
#include <stdlib.h>
#include "./lossless.h"
#include "../dec/vp8li.h"
#include "../enc/histogram.h"
#ifdef USE_LOSSLESS_ENCODER
#include "../enc/histogram.h"
// A lookup table for small values of log(int) to be used in entropy
// computation.
@ -122,6 +124,8 @@ double VP8LFastLog(int v) {
return log(v);
}
#endif
//------------------------------------------------------------------------------
// Image transforms.
@ -288,6 +292,7 @@ static const PredictorFunc kPredictors[16] = {
Predictor0, Predictor0 // <- padding security sentinels
};
#ifdef USE_LOSSLESS_ENCODER
// TODO(vikasa): Replace 256 etc with defines.
static double PredictionCostSpatial(const int* counts,
int weight_0, double exp_val) {
@ -472,6 +477,8 @@ void VP8LResidualImage(int width, int height, int bits,
}
}
#endif
// Inverse prediction.
static void PredictorInverseTransform(const VP8LTransform* const transform,
int y_start, int y_end, uint32_t* data) {
@ -524,6 +531,7 @@ static void PredictorInverseTransform(const VP8LTransform* const transform,
}
}
#ifdef USE_LOSSLESS_ENCODER
void VP8LSubtractGreenFromBlueAndRed(uint32_t* argb_data, int num_pixs) {
int i;
for (i = 0; i < num_pixs; ++i) {
@ -534,6 +542,7 @@ void VP8LSubtractGreenFromBlueAndRed(uint32_t* argb_data, int num_pixs) {
argb_data[i] = (argb & 0xff00ff00) | (new_r << 16) | new_b;
}
}
#endif
// Add green to blue and red channels (i.e. perform the inverse transform of
// 'subtract green').
@ -606,6 +615,7 @@ static WEBP_INLINE uint32_t TransformColor(const Multipliers* const m,
return (argb & 0xff00ff00u) | (new_red << 16) | (new_blue);
}
#ifdef USE_LOSSLESS_ENCODER
static WEBP_INLINE int SkipRepeatedPixels(const uint32_t* const argb,
int ix, int xsize) {
const uint32_t v = argb[ix];
@ -844,6 +854,7 @@ void VP8LColorSpaceTransform(int width, int height, int bits, int step,
}
}
}
#endif
// Color space inverse transform.
static void ColorSpaceInverseTransform(const VP8LTransform* const transform,

View File

@ -33,6 +33,7 @@ void VP8LInverseTransform(const struct VP8LTransform* const transform,
int row_start, int row_end,
uint32_t* const data_in, uint32_t* const data_out);
#ifdef USE_LOSSLESS_ENCODER
// Subtracts green from blue and red channels.
void VP8LSubtractGreenFromBlueAndRed(uint32_t* argb_data, int num_pixs);
@ -41,6 +42,8 @@ void VP8LResidualImage(int width, int height, int bits,
void VP8LColorSpaceTransform(int width, int height, int bits, int step,
uint32_t* const argb, uint32_t* image);
#endif
//------------------------------------------------------------------------------
// Color space conversion.
@ -52,21 +55,23 @@ void VP8LConvertFromBGRA(const uint32_t* const in_data, int num_pixels,
//------------------------------------------------------------------------------
// Misc methods.
// Faster logarithm for small integers, with the property of log(0) == 0.
double VP8LFastLog(int v);
// Computes sampled size of 'size' when sampling using 'sampling bits'.
static WEBP_INLINE uint32_t VP8LSubSampleSize(uint32_t size,
uint32_t sampling_bits) {
return (size + (1 << sampling_bits) - 1) >> sampling_bits;
}
#ifdef USE_LOSSLESS_ENCODER
// Faster logarithm for small integers, with the property of log(0) == 0.
double VP8LFastLog(int v);
// In-place difference of each component with mod 256.
static WEBP_INLINE uint32_t VP8LSubPixels(uint32_t a, uint32_t b) {
const uint32_t alpha_and_green = (a & 0xff00ff00u) - (b & 0xff00ff00u);
const uint32_t red_and_blue = (a & 0x00ff00ffu) - (b & 0x00ff00ffu);
return (alpha_and_green & 0xff00ff00u) | (red_and_blue & 0x00ff00ffu);
}
#endif
//------------------------------------------------------------------------------