Some bug-fixes for images with alpha.

- Fix the off-by-one diff when cropping with simple-filter.
- Fix a bug in incremental decoding in case of alpha.
- In VP8FinishRow(), do not decode alpha when y_start > y_end.
- Correct output of alpha channel for MODE_ARGB.
- Correct output of alpha channel for MODE_RGBA_4444.

Change-Id: I785763a2a704b973cc742ad93ffbb53699d1fc0a
This commit is contained in:
Urvang Joshi
2011-12-07 15:01:35 +05:30
parent 273a12a013
commit 8666a93aae
5 changed files with 84 additions and 10 deletions

View File

@ -155,6 +155,7 @@ typedef void (*WebPSampleLinePairFunc)(
uint8_t* top_dst, uint8_t* bottom_dst, int len);
extern const WebPSampleLinePairFunc WebPSamplers[/* MODE_LAST */];
extern const WebPSampleLinePairFunc WebPSamplersKeepAlpha[/* MODE_LAST */];
// YUV444->RGB converters
typedef void (*WebPYUV444Converter)(const uint8_t* y,

View File

@ -101,7 +101,7 @@ UPSAMPLE_FUNC(UpsampleBgraLinePair, VP8YuvToBgra, 4)
UPSAMPLE_FUNC(UpsampleArgbLinePair, VP8YuvToArgb, 4)
UPSAMPLE_FUNC(UpsampleRgba4444LinePair, VP8YuvToRgba4444, 2)
UPSAMPLE_FUNC(UpsampleRgb565LinePair, VP8YuvToRgb565, 2)
// These two don't erase the alpha value
// These variants don't erase the alpha value
UPSAMPLE_FUNC(UpsampleRgbKeepAlphaLinePair, VP8YuvToRgb, 4)
UPSAMPLE_FUNC(UpsampleBgrKeepAlphaLinePair, VP8YuvToBgr, 4)
UPSAMPLE_FUNC(UpsampleArgbKeepAlphaLinePair, VP8YuvToArgbKeepA, 4)
@ -146,6 +146,11 @@ SAMPLE_FUNC(SampleBgraLinePair, VP8YuvToBgra, 4)
SAMPLE_FUNC(SampleArgbLinePair, VP8YuvToArgb, 4)
SAMPLE_FUNC(SampleRgba4444LinePair, VP8YuvToRgba4444, 2)
SAMPLE_FUNC(SampleRgb565LinePair, VP8YuvToRgb565, 2)
// These variants don't erase the alpha value
SAMPLE_FUNC(SampleRgbKeepAlphaLinePair, VP8YuvToRgb, 4)
SAMPLE_FUNC(SampleBgrKeepAlphaLinePair, VP8YuvToBgr, 4)
SAMPLE_FUNC(SampleArgbKeepAlphaLinePair, VP8YuvToArgbKeepA, 4)
SAMPLE_FUNC(SampleRgba4444KeepAlphaLinePair, VP8YuvToRgba4444KeepA, 2)
#undef SAMPLE_FUNC
@ -159,6 +164,16 @@ const WebPSampleLinePairFunc WebPSamplers[MODE_LAST] = {
SampleRgb565LinePair // MODE_RGB_565
};
const WebPSampleLinePairFunc WebPSamplersKeepAlpha[MODE_LAST] = {
SampleRgbLinePair, // MODE_RGB
SampleRgbKeepAlphaLinePair, // MODE_RGBA
SampleBgrLinePair, // MODE_BGR
SampleBgrKeepAlphaLinePair, // MODE_BGRA
SampleArgbKeepAlphaLinePair, // MODE_ARGB
SampleRgba4444KeepAlphaLinePair, // MODE_RGBA_4444
SampleRgb565LinePair // MODE_RGB_565
};
//------------------------------------------------------------------------------
// YUV444 converter