mirror of
https://github.com/webmproject/libwebp.git
synced 2025-02-21 19:32:52 +01:00
treat FILTER_NONE as a regular Unfilter[] call
Removes the hard-coded memcpy() in alpha-decoding. Change-Id: I1dfd98db206893d7715a79d05a1bd9272690471a
This commit is contained in:
parent
f6499943c4
commit
6b02f66015
@ -117,21 +117,12 @@ static int ALPHDecode(VP8Decoder* const dec, int row, int num_rows) {
|
|||||||
const uint8_t* deltas = dec->alpha_data_ + ALPHA_HEADER_LEN + row * width;
|
const uint8_t* deltas = dec->alpha_data_ + ALPHA_HEADER_LEN + row * width;
|
||||||
uint8_t* dst = dec->alpha_plane_ + row * width;
|
uint8_t* dst = dec->alpha_plane_ + row * width;
|
||||||
assert(deltas <= &dec->alpha_data_[dec->alpha_data_size_]);
|
assert(deltas <= &dec->alpha_data_[dec->alpha_data_size_]);
|
||||||
if (alph_dec->filter_ != WEBP_FILTER_NONE) {
|
assert(WebPUnfilters[alph_dec->filter_] != NULL);
|
||||||
assert(WebPUnfilters[alph_dec->filter_] != NULL);
|
for (y = 0; y < num_rows; ++y) {
|
||||||
for (y = 0; y < num_rows; ++y) {
|
WebPUnfilters[alph_dec->filter_](prev_line, deltas, dst, width);
|
||||||
WebPUnfilters[alph_dec->filter_](prev_line, deltas, dst, width);
|
prev_line = dst;
|
||||||
prev_line = dst;
|
dst += width;
|
||||||
dst += width;
|
deltas += width;
|
||||||
deltas += width;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (y = 0; y < num_rows; ++y) {
|
|
||||||
memcpy(dst, deltas, width * sizeof(*dst));
|
|
||||||
prev_line = dst;
|
|
||||||
dst += width;
|
|
||||||
deltas += width;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
dec->alpha_prev_line_ = prev_line;
|
dec->alpha_prev_line_ = prev_line;
|
||||||
} else { // alph_dec->method_ == ALPHA_LOSSLESS_COMPRESSION
|
} else { // alph_dec->method_ == ALPHA_LOSSLESS_COMPRESSION
|
||||||
|
@ -189,6 +189,12 @@ static void GradientFilter_C(const uint8_t* data, int width, int height,
|
|||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
static void NoneUnfilter_C(const uint8_t* prev, const uint8_t* in,
|
||||||
|
uint8_t* out, int width) {
|
||||||
|
(void)prev;
|
||||||
|
if (out != in) memcpy(out, in, width * sizeof(*out));
|
||||||
|
}
|
||||||
|
|
||||||
static void HorizontalUnfilter_C(const uint8_t* prev, const uint8_t* in,
|
static void HorizontalUnfilter_C(const uint8_t* prev, const uint8_t* in,
|
||||||
uint8_t* out, int width) {
|
uint8_t* out, int width) {
|
||||||
uint8_t pred = (prev == NULL) ? 0 : prev[0];
|
uint8_t pred = (prev == NULL) ? 0 : prev[0];
|
||||||
@ -240,7 +246,7 @@ extern void VP8FiltersInitNEON(void);
|
|||||||
extern void VP8FiltersInitSSE2(void);
|
extern void VP8FiltersInitSSE2(void);
|
||||||
|
|
||||||
WEBP_DSP_INIT_FUNC(VP8FiltersInit) {
|
WEBP_DSP_INIT_FUNC(VP8FiltersInit) {
|
||||||
WebPUnfilters[WEBP_FILTER_NONE] = NULL;
|
WebPUnfilters[WEBP_FILTER_NONE] = NoneUnfilter_C;
|
||||||
#if !WEBP_NEON_OMIT_C_CODE
|
#if !WEBP_NEON_OMIT_C_CODE
|
||||||
WebPUnfilters[WEBP_FILTER_HORIZONTAL] = HorizontalUnfilter_C;
|
WebPUnfilters[WEBP_FILTER_HORIZONTAL] = HorizontalUnfilter_C;
|
||||||
WebPUnfilters[WEBP_FILTER_VERTICAL] = VerticalUnfilter_C;
|
WebPUnfilters[WEBP_FILTER_VERTICAL] = VerticalUnfilter_C;
|
||||||
@ -279,6 +285,7 @@ WEBP_DSP_INIT_FUNC(VP8FiltersInit) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
assert(WebPUnfilters[WEBP_FILTER_NONE] != NULL);
|
||||||
assert(WebPUnfilters[WEBP_FILTER_HORIZONTAL] != NULL);
|
assert(WebPUnfilters[WEBP_FILTER_HORIZONTAL] != NULL);
|
||||||
assert(WebPUnfilters[WEBP_FILTER_VERTICAL] != NULL);
|
assert(WebPUnfilters[WEBP_FILTER_VERTICAL] != NULL);
|
||||||
assert(WebPUnfilters[WEBP_FILTER_GRADIENT] != NULL);
|
assert(WebPUnfilters[WEBP_FILTER_GRADIENT] != NULL);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user