Lines Matching refs:io
25 static int EmitYUV(const VP8Io* const io, WebPDecParams* const p) { in EmitYUV() argument
28 uint8_t* const y_dst = buf->y + io->mb_y * buf->y_stride; in EmitYUV()
29 uint8_t* const u_dst = buf->u + (io->mb_y >> 1) * buf->u_stride; in EmitYUV()
30 uint8_t* const v_dst = buf->v + (io->mb_y >> 1) * buf->v_stride; in EmitYUV()
31 const int mb_w = io->mb_w; in EmitYUV()
32 const int mb_h = io->mb_h; in EmitYUV()
37 memcpy(y_dst + j * buf->y_stride, io->y + j * io->y_stride, mb_w); in EmitYUV()
40 memcpy(u_dst + j * buf->u_stride, io->u + j * io->uv_stride, uv_w); in EmitYUV()
41 memcpy(v_dst + j * buf->v_stride, io->v + j * io->uv_stride, uv_w); in EmitYUV()
43 return io->mb_h; in EmitYUV()
47 static int EmitSampledRGB(const VP8Io* const io, WebPDecParams* const p) { in EmitSampledRGB() argument
50 uint8_t* const dst = buf->rgba + io->mb_y * buf->stride; in EmitSampledRGB()
51 WebPSamplerProcessPlane(io->y, io->y_stride, in EmitSampledRGB()
52 io->u, io->v, io->uv_stride, in EmitSampledRGB()
53 dst, buf->stride, io->mb_w, io->mb_h, in EmitSampledRGB()
55 return io->mb_h; in EmitSampledRGB()
62 static int EmitRGB(const VP8Io* const io, WebPDecParams* const p) {
65 uint8_t* dst = buf->rgba + io->mb_y * buf->stride;
66 const uint8_t* y_src = io->y;
67 const uint8_t* u_src = io->u;
68 const uint8_t* v_src = io->v;
70 const int mb_w = io->mb_w;
71 const int last = io->mb_h;
75 y_src += io->y_stride;
76 u_src += io->uv_stride;
77 v_src += io->uv_stride;
80 return io->mb_h;
88 static int EmitFancyRGB(const VP8Io* const io, WebPDecParams* const p) { in EmitFancyRGB() argument
89 int num_lines_out = io->mb_h; // a priori guess in EmitFancyRGB()
91 uint8_t* dst = buf->rgba + io->mb_y * buf->stride; in EmitFancyRGB()
93 const uint8_t* cur_y = io->y; in EmitFancyRGB()
94 const uint8_t* cur_u = io->u; in EmitFancyRGB()
95 const uint8_t* cur_v = io->v; in EmitFancyRGB()
98 int y = io->mb_y; in EmitFancyRGB()
99 const int y_end = io->mb_y + io->mb_h; in EmitFancyRGB()
100 const int mb_w = io->mb_w; in EmitFancyRGB()
116 cur_u += io->uv_stride; in EmitFancyRGB()
117 cur_v += io->uv_stride; in EmitFancyRGB()
119 cur_y += 2 * io->y_stride; in EmitFancyRGB()
120 upsample(cur_y - io->y_stride, cur_y, in EmitFancyRGB()
125 cur_y += io->y_stride; in EmitFancyRGB()
126 if (io->crop_top + y_end < io->crop_bottom) { in EmitFancyRGB()
148 static int EmitAlphaYUV(const VP8Io* const io, WebPDecParams* const p) { in EmitAlphaYUV() argument
149 const uint8_t* alpha = io->a; in EmitAlphaYUV()
151 const int mb_w = io->mb_w; in EmitAlphaYUV()
152 const int mb_h = io->mb_h; in EmitAlphaYUV()
153 uint8_t* dst = buf->a + io->mb_y * buf->a_stride; in EmitAlphaYUV()
159 alpha += io->width; in EmitAlphaYUV()
172 static int GetAlphaSourceRow(const VP8Io* const io, in GetAlphaSourceRow() argument
174 int start_y = io->mb_y; in GetAlphaSourceRow()
175 *num_rows = io->mb_h; in GetAlphaSourceRow()
179 if (io->fancy_upsampling) { in GetAlphaSourceRow()
188 *alpha -= io->width; in GetAlphaSourceRow()
190 if (io->crop_top + io->mb_y + io->mb_h == io->crop_bottom) { in GetAlphaSourceRow()
192 *num_rows = io->crop_bottom - io->crop_top - start_y; in GetAlphaSourceRow()
198 static int EmitAlphaRGB(const VP8Io* const io, WebPDecParams* const p) { in EmitAlphaRGB() argument
199 const uint8_t* alpha = io->a; in EmitAlphaRGB()
201 const int mb_w = io->mb_w; in EmitAlphaRGB()
207 const int start_y = GetAlphaSourceRow(io, &alpha, &num_rows); in EmitAlphaRGB()
219 alpha += io->width; in EmitAlphaRGB()
231 static int EmitAlphaRGBA4444(const VP8Io* const io, WebPDecParams* const p) { in EmitAlphaRGBA4444() argument
232 const uint8_t* alpha = io->a; in EmitAlphaRGBA4444()
234 const int mb_w = io->mb_w; in EmitAlphaRGBA4444()
238 const int start_y = GetAlphaSourceRow(io, &alpha, &num_rows); in EmitAlphaRGBA4444()
255 alpha += io->width; in EmitAlphaRGBA4444()
280 static int EmitRescaledYUV(const VP8Io* const io, WebPDecParams* const p) { in EmitRescaledYUV() argument
281 const int mb_h = io->mb_h; in EmitRescaledYUV()
285 if (WebPIsAlphaMode(p->output->colorspace) && io->a != NULL) { in EmitRescaledYUV()
290 WebPMultRows((uint8_t*)io->y, io->y_stride, in EmitRescaledYUV()
291 io->a, io->width, io->mb_w, mb_h, 0); in EmitRescaledYUV()
293 num_lines_out = Rescale(io->y, io->y_stride, mb_h, scaler); in EmitRescaledYUV()
294 Rescale(io->u, io->uv_stride, uv_mb_h, &p->scaler_u); in EmitRescaledYUV()
295 Rescale(io->v, io->uv_stride, uv_mb_h, &p->scaler_v); in EmitRescaledYUV()
299 static int EmitRescaledAlphaYUV(const VP8Io* const io, WebPDecParams* const p) { in EmitRescaledAlphaYUV() argument
300 if (io->a != NULL) { in EmitRescaledAlphaYUV()
304 const int num_lines_out = Rescale(io->a, io->width, io->mb_h, &p->scaler_a); in EmitRescaledAlphaYUV()
313 static int InitYUVRescaler(const VP8Io* const io, WebPDecParams* const p) { in InitYUVRescaler() argument
316 const int out_width = io->scaled_width; in InitYUVRescaler()
317 const int out_height = io->scaled_height; in InitYUVRescaler()
320 const int uv_in_width = (io->mb_w + 1) >> 1; in InitYUVRescaler()
321 const int uv_in_height = (io->mb_h + 1) >> 1; in InitYUVRescaler()
336 WebPRescalerInit(&p->scaler_y, io->mb_w, io->mb_h, in InitYUVRescaler()
338 io->mb_w, out_width, io->mb_h, out_height, in InitYUVRescaler()
353 WebPRescalerInit(&p->scaler_a, io->mb_w, io->mb_h, in InitYUVRescaler()
355 io->mb_w, out_width, io->mb_h, out_height, in InitYUVRescaler()
389 static int EmitRescaledRGB(const VP8Io* const io, WebPDecParams* const p) { in EmitRescaledRGB() argument
390 const int mb_h = io->mb_h; in EmitRescaledRGB()
397 io->y + j * io->y_stride, io->y_stride); in EmitRescaledRGB()
400 io->u + uv_j * io->uv_stride, io->uv_stride); in EmitRescaledRGB()
403 io->v + uv_j * io->uv_stride, io->uv_stride); in EmitRescaledRGB()
477 static int EmitRescaledAlphaRGB(const VP8Io* const io, WebPDecParams* const p) { in EmitRescaledAlphaRGB() argument
478 if (io->a != NULL) { in EmitRescaledAlphaRGB()
482 while (j < io->mb_h) { in EmitRescaledAlphaRGB()
483 j += WebPRescalerImport(scaler, io->mb_h - j, in EmitRescaledAlphaRGB()
484 io->a + j * io->width, io->width); in EmitRescaledAlphaRGB()
491 static int InitRGBRescaler(const VP8Io* const io, WebPDecParams* const p) { in InitRGBRescaler() argument
493 const int out_width = io->scaled_width; in InitRGBRescaler()
494 const int out_height = io->scaled_height; in InitRGBRescaler()
495 const int uv_in_width = (io->mb_w + 1) >> 1; in InitRGBRescaler()
496 const int uv_in_height = (io->mb_h + 1) >> 1; in InitRGBRescaler()
515 WebPRescalerInit(&p->scaler_y, io->mb_w, io->mb_h, in InitRGBRescaler()
517 io->mb_w, out_width, io->mb_h, out_height, in InitRGBRescaler()
521 io->mb_w, 2 * out_width, io->mb_h, 2 * out_height, in InitRGBRescaler()
525 io->mb_w, 2 * out_width, io->mb_h, 2 * out_height, in InitRGBRescaler()
530 WebPRescalerInit(&p->scaler_a, io->mb_w, io->mb_h, in InitRGBRescaler()
532 io->mb_w, out_width, io->mb_h, out_height, in InitRGBRescaler()
549 static int CustomSetup(VP8Io* io) { in CustomSetup() argument
550 WebPDecParams* const p = (WebPDecParams*)io->opaque; in CustomSetup()
559 if (!WebPIoInitFromOptions(p->options, io, is_alpha ? MODE_YUV : MODE_YUVA)) { in CustomSetup()
565 if (io->use_scaling) { in CustomSetup()
566 const int ok = is_rgb ? InitRGBRescaler(io, p) : InitYUVRescaler(io, p); in CustomSetup()
573 if (io->fancy_upsampling) { in CustomSetup()
575 const int uv_width = (io->mb_w + 1) >> 1; in CustomSetup()
576 p->memory = WebPSafeMalloc(1ULL, (size_t)(io->mb_w + 2 * uv_width)); in CustomSetup()
581 p->tmp_u = p->tmp_y + io->mb_w; in CustomSetup()
612 static int CustomPut(const VP8Io* io) { in CustomPut() argument
613 WebPDecParams* const p = (WebPDecParams*)io->opaque; in CustomPut()
614 const int mb_w = io->mb_w; in CustomPut()
615 const int mb_h = io->mb_h; in CustomPut()
617 assert(!(io->mb_y & 1)); in CustomPut()
622 num_lines_out = p->emit(io, p); in CustomPut()
624 p->emit_alpha(io, p); in CustomPut()
632 static void CustomTeardown(const VP8Io* io) { in CustomTeardown() argument
633 WebPDecParams* const p = (WebPDecParams*)io->opaque; in CustomTeardown()
641 void WebPInitCustomIo(WebPDecParams* const params, VP8Io* const io) { in WebPInitCustomIo() argument
642 io->put = CustomPut; in WebPInitCustomIo()
643 io->setup = CustomSetup; in WebPInitCustomIo()
644 io->teardown = CustomTeardown; in WebPInitCustomIo()
645 io->opaque = params; in WebPInitCustomIo()