Refactor CopyPlane() and CopyPixels() methods: put them in utils.

Change-Id: I0e1533df557a0fa42c670e3b826fc0675c36e0a5
This commit is contained in:
Urvang Joshi
2015-11-12 15:28:09 -08:00
committed by James Zern
parent 6ecd72f845
commit 397863bd66
6 changed files with 67 additions and 83 deletions

View File

@ -82,7 +82,6 @@ static int EncodeLossless(const uint8_t* const data, int width, int height,
return 0;
}
return 1;
}
// -----------------------------------------------------------------------------
@ -166,16 +165,6 @@ static int EncodeAlphaInternal(const uint8_t* const data, int width, int height,
// -----------------------------------------------------------------------------
// TODO(skal): move to dsp/ ?
static void CopyPlane(const uint8_t* src, int src_stride,
uint8_t* dst, int dst_stride, int width, int height) {
while (height-- > 0) {
memcpy(dst, src, width);
src += src_stride;
dst += dst_stride;
}
}
static int GetNumColors(const uint8_t* data, int width, int height,
int stride) {
int j;
@ -326,7 +315,7 @@ static int EncodeAlpha(VP8Encoder* const enc,
}
// Extract alpha data (width x height) from raw_data (stride x height).
CopyPlane(pic->a, pic->a_stride, quant_alpha, width, width, height);
WebPCopyPlane(pic->a, pic->a_stride, quant_alpha, width, width, height);
if (reduce_levels) { // No Quantization required for 'quality = 100'.
// 16 alpha levels gives quite a low MSE w.r.t original alpha plane hence