From b2c3575c8ffd0596634705d0bac2707cd9c20a07 Mon Sep 17 00:00:00 2001 From: Pascal Massimino Date: Wed, 23 Mar 2011 17:24:31 -0700 Subject: [PATCH] add a 'last_y' field to WebPDecParams this allows to keep an exact track of the last displayable pixel row Change-Id: I590306735a82b9249e7bc9fe64eeb3e5bea3376b --- src/dec/webp.c | 4 ++++ src/dec/webpi.h | 1 + 2 files changed, 5 insertions(+) diff --git a/src/dec/webp.c b/src/dec/webp.c index 7eee0144..7ba0ffcb 100644 --- a/src/dec/webp.c +++ b/src/dec/webp.c @@ -186,6 +186,7 @@ static int CustomPut(const VP8Io* io) { return 0; } + p->last_y = io->mb_y + io->mb_h; // a priori guess if (p->mode == MODE_YUV) { uint8_t* const y_dst = p->output + io->mb_y * p->stride; uint8_t* const u_dst = p->u + (io->mb_y >> 1) * p->u_stride; @@ -237,6 +238,9 @@ static int CustomPut(const VP8Io* io) { memcpy(p->top_y, cur_y, w * sizeof(*p->top_y)); memcpy(p->top_u, cur_u, uv_w * sizeof(*p->top_u)); memcpy(p->top_v, cur_v, uv_w * sizeof(*p->top_v)); + // The fancy upscaler leaves a row unfinished behind + // (except for the very last row) + p->last_y -= 1; } else { // Process the very last row of even-sized picture if (!(y_end & 1)) { diff --git a/src/dec/webpi.h b/src/dec/webpi.h index 9d53de47..0188861c 100644 --- a/src/dec/webpi.h +++ b/src/dec/webpi.h @@ -31,6 +31,7 @@ typedef struct { int u_stride; int v_stride; WEBP_CSP_MODE mode; + int last_y; // coordinate of the line that was last output } WebPDecParams; // If a RIFF container is detected, validate it and skip over it. Returns