make input data be 'const' for VP8LInverseTransform()

Change-Id: I5b5b1e29bca6c42704df141b21632a0d0fcb07cf
This commit is contained in:
Pascal Massimino 2012-05-23 07:21:53 -07:00
parent 27f417ab66
commit 9a721c6d24
2 changed files with 10 additions and 14 deletions

View File

@ -890,14 +890,11 @@ static void ColorSpaceInverseTransform(const VP8LTransform* const transform,
// Separate out pixels packed together using pixel-bundling. // Separate out pixels packed together using pixel-bundling.
static void ColorIndexInverseTransform( static void ColorIndexInverseTransform(
const VP8LTransform* const transform, const VP8LTransform* const transform,
int y_start, int y_end, int y_start, int y_end, const uint32_t* src, uint32_t* dst) {
uint32_t* const data_in, uint32_t* const data_out) {
int y; int y;
const int bits_per_pixel = 8 >> transform->bits_; const int bits_per_pixel = 8 >> transform->bits_;
const int width = transform->xsize_; const int width = transform->xsize_;
const uint32_t* const color_map = transform->data_; const uint32_t* const color_map = transform->data_;
uint32_t* dst = data_out;
const uint32_t* src = data_in;
if (bits_per_pixel < 8) { if (bits_per_pixel < 8) {
const int pixels_per_byte = 1 << transform->bits_; const int pixels_per_byte = 1 << transform->bits_;
const int count_mask = pixels_per_byte - 1; const int count_mask = pixels_per_byte - 1;
@ -926,29 +923,28 @@ static void ColorIndexInverseTransform(
void VP8LInverseTransform(const VP8LTransform* const transform, void VP8LInverseTransform(const VP8LTransform* const transform,
int row_start, int row_end, int row_start, int row_end,
uint32_t* const data_in, uint32_t* const data_out) { const uint32_t* const in, uint32_t* const out) {
assert(row_start < row_end); assert(row_start < row_end);
assert(row_end <= transform->ysize_); assert(row_end <= transform->ysize_);
switch (transform->type_) { switch (transform->type_) {
case SUBTRACT_GREEN: case SUBTRACT_GREEN:
AddGreenToBlueAndRed(transform, row_start, row_end, data_out); AddGreenToBlueAndRed(transform, row_start, row_end, out);
break; break;
case PREDICTOR_TRANSFORM: case PREDICTOR_TRANSFORM:
PredictorInverseTransform(transform, row_start, row_end, data_out); PredictorInverseTransform(transform, row_start, row_end, out);
if (row_end != transform->ysize_) { if (row_end != transform->ysize_) {
// The last predicted row in this iteration will be the top-pred row // The last predicted row in this iteration will be the top-pred row
// for the first row in next iteration. // for the first row in next iteration.
const int width = transform->xsize_; const int width = transform->xsize_;
memcpy(data_out - width, data_out + (row_end - row_start - 1) * width, memcpy(out - width, out + (row_end - row_start - 1) * width,
width * sizeof(*data_out)); width * sizeof(*out));
} }
break; break;
case CROSS_COLOR_TRANSFORM: case CROSS_COLOR_TRANSFORM:
ColorSpaceInverseTransform(transform, row_start, row_end, data_out); ColorSpaceInverseTransform(transform, row_start, row_end, out);
break; break;
case COLOR_INDEXING_TRANSFORM: case COLOR_INDEXING_TRANSFORM:
ColorIndexInverseTransform(transform, row_start, row_end, ColorIndexInverseTransform(transform, row_start, row_end, in, out);
data_in, data_out);
break; break;
} }
} }

View File

@ -27,11 +27,11 @@ struct VP8LTransform; // Defined in dec/vp8li.h.
// Performs inverse transform of data given transform information, start and end // Performs inverse transform of data given transform information, start and end
// rows. Transform will be applied to rows [row_start, row_end[. // rows. Transform will be applied to rows [row_start, row_end[.
// The data_in & data_out are source and destination data pointers respectively // The *in and *out pointers refer to source and destination data respectively
// corresponding to the intermediate row (row_start). // corresponding to the intermediate row (row_start).
void VP8LInverseTransform(const struct VP8LTransform* const transform, void VP8LInverseTransform(const struct VP8LTransform* const transform,
int row_start, int row_end, int row_start, int row_end,
uint32_t* const data_in, uint32_t* const data_out); const uint32_t* const in, uint32_t* const out);
#ifdef USE_LOSSLESS_ENCODER #ifdef USE_LOSSLESS_ENCODER
// Subtracts green from blue and red channels. // Subtracts green from blue and red channels.