fancy chroma upscaling

When FANCY_UPSCALING is defined, use a smoothing filter for upscaling
the U/V chroma fields. The filter used is a separable t[1 3 3 1] x [1 3 3 1]
filter. It can be easily changed in macros MIX_*.

The upscaling code reside on the thing shell between user and core
decoding (in webp.c), and not in the core decoder. As such, this smoothing
process can still be offloaded to GPU in some future and is not integral
part of the decoding process.

Coincidentaly: changed the way data is tranfered to user. For profile 2 (no
filtering), it used to be on a per-block basis. Now, for all profiles, we
emit rows of pixels (between 8 and 24 in height) when they are ready.
This makes the upscaling code much easier.

Will update the test vectors MD5 sums soon (as they'll be broken
after this change)

Change-Id: I2640ff12596cb8b843a4a376d7347447d9b9f778
This commit is contained in:
Pascal Massimino
2010-11-03 14:27:51 -07:00
parent 5a936a0a21
commit 6a37a2aaa9
5 changed files with 294 additions and 119 deletions

View File

@ -40,28 +40,36 @@ extern "C" {
typedef struct VP8Io VP8Io;
struct VP8Io {
// set by VP8GetHeaders()
int width, height; // picture dimensions, in pixels
int width, height; // picture dimensions, in pixels
// set before calling put()
int mb_x, mb_y; // position of the current sample (in pixels)
int mb_w, mb_h; // size of the current sample (usually 16x16)
const uint8_t *y, *u, *v; // samples to copy
int y_stride; // stride for luma
int uv_stride; // stride for chroma
int mb_y; // position of the current rows (in pixels)
int mb_h; // number of rows in the sample
const uint8_t *y, *u, *v; // rows to copy (in yuv420 format)
int y_stride; // row stride for luma
int uv_stride; // row stride for chroma
void* opaque; // user data
// called when fresh samples are available (1 block of 16x16 pixels)
// called when fresh samples are available. Currently, samples are in
// YUV420 format, and can be up to width x 24 in size (depending on the
// in-loop filtering level, e.g.).
void (*put)(const VP8Io* io);
// called just before starting to decode the blocks
void (*setup)(const VP8Io* io);
// called just before starting to decode the blocks.
// Should returns 0 in case of error.
int (*setup)(VP8Io* io);
// called just after block decoding is finished
// called just after block decoding is finished (or when an error occurred).
void (*teardown)(const VP8Io* io);
// this is a recommendation for the user-side yuv->rgb converter. This flag
// is set when calling setup() hook and can be overwritten by it. It then
// can be taken into consideration during the put() method.
int fancy_upscaling;
// Input buffer.
uint32_t data_size;
uint32_t data_size;
const uint8_t* data;
};