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 EmitFancyRGB(const VP8Io* const io, WebPDecParams* const p) { in EmitFancyRGB() argument
63 int num_lines_out = io->mb_h; // a priori guess in EmitFancyRGB()
65 uint8_t* dst = buf->rgba + io->mb_y * buf->stride; in EmitFancyRGB()
67 const uint8_t* cur_y = io->y; in EmitFancyRGB()
68 const uint8_t* cur_u = io->u; in EmitFancyRGB()
69 const uint8_t* cur_v = io->v; in EmitFancyRGB()
72 int y = io->mb_y; in EmitFancyRGB()
73 const int y_end = io->mb_y + io->mb_h; in EmitFancyRGB()
74 const int mb_w = io->mb_w; in EmitFancyRGB()
90 cur_u += io->uv_stride; in EmitFancyRGB()
91 cur_v += io->uv_stride; in EmitFancyRGB()
93 cur_y += 2 * io->y_stride; in EmitFancyRGB()
94 upsample(cur_y - io->y_stride, cur_y, in EmitFancyRGB()
99 cur_y += io->y_stride; in EmitFancyRGB()
100 if (io->crop_top + y_end < io->crop_bottom) { in EmitFancyRGB()
122 static int EmitAlphaYUV(const VP8Io* const io, WebPDecParams* const p, in EmitAlphaYUV() argument
124 const uint8_t* alpha = io->a; in EmitAlphaYUV()
126 const int mb_w = io->mb_w; in EmitAlphaYUV()
127 const int mb_h = io->mb_h; in EmitAlphaYUV()
128 uint8_t* dst = buf->a + io->mb_y * buf->a_stride; in EmitAlphaYUV()
135 alpha += io->width; in EmitAlphaYUV()
148 static int GetAlphaSourceRow(const VP8Io* const io, in GetAlphaSourceRow() argument
150 int start_y = io->mb_y; in GetAlphaSourceRow()
151 *num_rows = io->mb_h; in GetAlphaSourceRow()
155 if (io->fancy_upsampling) { in GetAlphaSourceRow()
164 *alpha -= io->width; in GetAlphaSourceRow()
166 if (io->crop_top + io->mb_y + io->mb_h == io->crop_bottom) { in GetAlphaSourceRow()
168 *num_rows = io->crop_bottom - io->crop_top - start_y; in GetAlphaSourceRow()
174 static int EmitAlphaRGB(const VP8Io* const io, WebPDecParams* const p, in EmitAlphaRGB() argument
176 const uint8_t* alpha = io->a; in EmitAlphaRGB()
178 const int mb_w = io->mb_w; in EmitAlphaRGB()
184 const int start_y = GetAlphaSourceRow(io, &alpha, &num_rows); in EmitAlphaRGB()
187 const int has_alpha = WebPDispatchAlpha(alpha, io->width, mb_w, in EmitAlphaRGB()
200 static int EmitAlphaRGBA4444(const VP8Io* const io, WebPDecParams* const p, in EmitAlphaRGBA4444() argument
202 const uint8_t* alpha = io->a; in EmitAlphaRGBA4444()
204 const int mb_w = io->mb_w; in EmitAlphaRGBA4444()
208 const int start_y = GetAlphaSourceRow(io, &alpha, &num_rows); in EmitAlphaRGBA4444()
224 alpha += io->width; in EmitAlphaRGBA4444()
251 static int EmitRescaledYUV(const VP8Io* const io, WebPDecParams* const p) { in EmitRescaledYUV() argument
252 const int mb_h = io->mb_h; in EmitRescaledYUV()
256 if (WebPIsAlphaMode(p->output->colorspace) && io->a != NULL) { in EmitRescaledYUV()
261 WebPMultRows((uint8_t*)io->y, io->y_stride, in EmitRescaledYUV()
262 io->a, io->width, io->mb_w, mb_h, 0); in EmitRescaledYUV()
264 num_lines_out = Rescale(io->y, io->y_stride, mb_h, scaler); in EmitRescaledYUV()
265 Rescale(io->u, io->uv_stride, uv_mb_h, &p->scaler_u); in EmitRescaledYUV()
266 Rescale(io->v, io->uv_stride, uv_mb_h, &p->scaler_v); in EmitRescaledYUV()
270 static int EmitRescaledAlphaYUV(const VP8Io* const io, WebPDecParams* const p, in EmitRescaledAlphaYUV() argument
272 if (io->a != NULL) { in EmitRescaledAlphaYUV()
276 const int num_lines_out = Rescale(io->a, io->width, io->mb_h, &p->scaler_a); in EmitRescaledAlphaYUV()
287 static int InitYUVRescaler(const VP8Io* const io, WebPDecParams* const p) { in InitYUVRescaler() argument
290 const int out_width = io->scaled_width; in InitYUVRescaler()
291 const int out_height = io->scaled_height; in InitYUVRescaler()
294 const int uv_in_width = (io->mb_w + 1) >> 1; in InitYUVRescaler()
295 const int uv_in_height = (io->mb_h + 1) >> 1; in InitYUVRescaler()
310 WebPRescalerInit(&p->scaler_y, io->mb_w, io->mb_h, in InitYUVRescaler()
322 WebPRescalerInit(&p->scaler_a, io->mb_w, io->mb_h, in InitYUVRescaler()
357 static int EmitRescaledRGB(const VP8Io* const io, WebPDecParams* const p) { in EmitRescaledRGB() argument
358 const int mb_h = io->mb_h; in EmitRescaledRGB()
365 io->y + j * io->y_stride, io->y_stride); in EmitRescaledRGB()
370 io->u + uv_j * io->uv_stride, io->uv_stride); in EmitRescaledRGB()
373 io->v + uv_j * io->uv_stride, io->uv_stride); in EmitRescaledRGB()
445 static int EmitRescaledAlphaRGB(const VP8Io* const io, WebPDecParams* const p, in EmitRescaledAlphaRGB() argument
447 if (io->a != NULL) { in EmitRescaledAlphaRGB()
452 const int row_offset = scaler->src_y - io->mb_y; in EmitRescaledAlphaRGB()
453 WebPRescalerImport(scaler, io->mb_h + io->mb_y - scaler->src_y, in EmitRescaledAlphaRGB()
454 io->a + row_offset * io->width, io->width); in EmitRescaledAlphaRGB()
461 static int InitRGBRescaler(const VP8Io* const io, WebPDecParams* const p) { in InitRGBRescaler() argument
463 const int out_width = io->scaled_width; in InitRGBRescaler()
464 const int out_height = io->scaled_height; in InitRGBRescaler()
465 const int uv_in_width = (io->mb_w + 1) >> 1; in InitRGBRescaler()
466 const int uv_in_height = (io->mb_h + 1) >> 1; in InitRGBRescaler()
485 WebPRescalerInit(&p->scaler_y, io->mb_w, io->mb_h, in InitRGBRescaler()
498 WebPRescalerInit(&p->scaler_a, io->mb_w, io->mb_h, in InitRGBRescaler()
516 static int CustomSetup(VP8Io* io) { in CustomSetup() argument
517 WebPDecParams* const p = (WebPDecParams*)io->opaque; in CustomSetup()
526 if (!WebPIoInitFromOptions(p->options, io, is_alpha ? MODE_YUV : MODE_YUVA)) { in CustomSetup()
532 if (io->use_scaling) { in CustomSetup()
533 const int ok = is_rgb ? InitRGBRescaler(io, p) : InitYUVRescaler(io, p); in CustomSetup()
541 if (io->fancy_upsampling) { in CustomSetup()
543 const int uv_width = (io->mb_w + 1) >> 1; in CustomSetup()
544 p->memory = WebPSafeMalloc(1ULL, (size_t)(io->mb_w + 2 * uv_width)); in CustomSetup()
549 p->tmp_u = p->tmp_y + io->mb_w; in CustomSetup()
578 static int CustomPut(const VP8Io* io) { in CustomPut() argument
579 WebPDecParams* const p = (WebPDecParams*)io->opaque; in CustomPut()
580 const int mb_w = io->mb_w; in CustomPut()
581 const int mb_h = io->mb_h; in CustomPut()
583 assert(!(io->mb_y & 1)); in CustomPut()
588 num_lines_out = p->emit(io, p); in CustomPut()
590 p->emit_alpha(io, p, num_lines_out); in CustomPut()
598 static void CustomTeardown(const VP8Io* io) { in CustomTeardown() argument
599 WebPDecParams* const p = (WebPDecParams*)io->opaque; in CustomTeardown()
607 void WebPInitCustomIo(WebPDecParams* const params, VP8Io* const io) { in WebPInitCustomIo() argument
608 io->put = CustomPut; in WebPInitCustomIo()
609 io->setup = CustomSetup; in WebPInitCustomIo()
610 io->teardown = CustomTeardown; in WebPInitCustomIo()
611 io->opaque = params; in WebPInitCustomIo()