Added implementation for various lossless functions

- VP8LEncAnalyze, EvalAndApplySubtractGreen, ApplyPredictFilter,
  ApplyCrossColorFilter
- Added palette handling and transform buffer management in VP8LEncodeImage()
- Add Transforms (subtract Green, Predict, cross_color) to dsp/lossless.c.

These are more-or-less copied from src/lossless code.

After this Change, will implement the EncodeImageInternal() method.

Change-Id: Idf71f803c24b3b5ae3b5079b15e019721784611d
This commit is contained in:
Vikas Arora
2012-04-10 07:00:36 +00:00
committed by James Zern
parent 32714ce3be
commit 648be3939f
6 changed files with 989 additions and 208 deletions

View File

@ -21,7 +21,7 @@ extern "C" {
#endif
//------------------------------------------------------------------------------
// Inverse image transforms.
// Image transforms.
struct VP8LTransform; // Defined in dec/vp8li.h.
@ -33,23 +33,41 @@ void VP8LInverseTransform(const struct VP8LTransform* const transform,
int row_start, int row_end,
uint32_t* const data_in, uint32_t* const data_out);
// Subtracts green from blue and red channels.
void VP8LSubtractGreenFromBlueAndRed(uint32_t* argb_data, int num_pixs);
void VP8LResidualImage(int width, int height, int bits,
uint32_t* const argb, uint32_t* const image);
void VP8LColorSpaceTransform(int width, int height, int bits, int quality,
uint32_t* const argb, uint32_t* image);
//------------------------------------------------------------------------------
// Color space conversion.
// Converts from BGRA to other color spaces.
void VP8LConvertFromBGRA(const uint32_t* const in_data, int num_pixels,
WEBP_CSP_MODE out_colorspace,
uint8_t* const rgba);
WEBP_CSP_MODE out_colorspace,
uint8_t* const rgba);
//------------------------------------------------------------------------------
// 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;
}
// 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);
}
//------------------------------------------------------------------------------
#if defined(__cplusplus) || defined(c_plusplus)