static int EmitRescaledRGB(const VP8Io* const io, WebPDecParams* const p) { const int mb_h = io->mb_h; const int uv_mb_h = (mb_h + 1) >> 1; int j = 0, uv_j = 0; int num_lines_out = 0; while (j < mb_h) { const int y_lines_in = WebPRescalerImport(p->scaler_y, mb_h - j, io->y + j * io->y_stride, io->y_stride); j += y_lines_in; if (WebPRescaleNeededLines(p->scaler_u, uv_mb_h - uv_j)) { const int u_lines_in = WebPRescalerImport(p->scaler_u, uv_mb_h - uv_j, io->u + uv_j * io->uv_stride, io->uv_stride); const int v_lines_in = WebPRescalerImport(p->scaler_v, uv_mb_h - uv_j, io->v + uv_j * io->uv_stride, io->uv_stride); (void)v_lines_in; // remove a gcc warning assert(u_lines_in == v_lines_in); uv_j += u_lines_in; } num_lines_out += ExportRGB(p, p->last_y + num_lines_out); } return num_lines_out; }
static int Rescale(const uint8_t* src, int src_stride, int new_lines, WebPRescaler* const wrk) { int num_lines_out = 0; while (new_lines > 0) { // import new contributions of source rows. const int lines_in = WebPRescalerImport(wrk, new_lines, src, src_stride); src += lines_in * src_stride; new_lines -= lines_in; num_lines_out += WebPRescalerExport(wrk); // emit output row(s) } return num_lines_out; }
static int Rescale(const uint8_t* src, int src_stride, int new_lines, WebPRescaler* const wrk) { int num_lines_out = 0; while (new_lines > 0) { const int lines_in = WebPRescalerImport(wrk, new_lines, src, src_stride); src += lines_in * src_stride; new_lines -= lines_in; num_lines_out += WebPRescalerExport(wrk); } return num_lines_out; }
static int EmitRescaledAlphaRGB(const VP8Io* const io, WebPDecParams* const p) { if (io->a != NULL) { WebPRescaler* const scaler = &p->scaler_a; int j = 0; int pos = 0; while (j < io->mb_h) { j += WebPRescalerImport(scaler, io->mb_h - j, io->a + j * io->width, io->width); pos += p->emit_alpha_row(p, pos); } } return 0; }
static int EmitRescaledRGB(const VP8Io* const io, WebPDecParams* const p) { const int mb_h = io->mb_h; const int uv_mb_h = (mb_h + 1) >> 1; int j = 0, uv_j = 0; int num_lines_out = 0; while (j < mb_h) { const int y_lines_in = WebPRescalerImport(&p->scaler_y, mb_h - j, io->y + j * io->y_stride, io->y_stride); const int u_lines_in = WebPRescalerImport(&p->scaler_u, uv_mb_h - uv_j, io->u + uv_j * io->uv_stride, io->uv_stride); const int v_lines_in = WebPRescalerImport(&p->scaler_v, uv_mb_h - uv_j, io->v + uv_j * io->uv_stride, io->uv_stride); (void)v_lines_in; assert(u_lines_in == v_lines_in); j += y_lines_in; uv_j += u_lines_in; num_lines_out += ExportRGB(p, num_lines_out); } return num_lines_out; }
static int EmitRescaledAlphaRGB(const VP8Io* const io, WebPDecParams* const p, int expected_num_out_lines) { if (io->a != NULL) { WebPRescaler* const scaler = p->scaler_a; int lines_left = expected_num_out_lines; const int y_end = p->last_y + lines_left; while (lines_left > 0) { const int row_offset = scaler->src_y - io->mb_y; WebPRescalerImport(scaler, io->mb_h + io->mb_y - scaler->src_y, io->a + row_offset * io->width, io->width); lines_left -= p->emit_alpha_row(p, y_end - lines_left, lines_left); } } return 0; }