Lines Matching refs:io
28 static int EmitYUV(const VP8Io* const io, WebPDecParams* const p) { in EmitYUV() argument
31 uint8_t* const y_dst = buf->y + io->mb_y * buf->y_stride; in EmitYUV()
32 uint8_t* const u_dst = buf->u + (io->mb_y >> 1) * buf->u_stride; in EmitYUV()
33 uint8_t* const v_dst = buf->v + (io->mb_y >> 1) * buf->v_stride; in EmitYUV()
34 const int mb_w = io->mb_w; in EmitYUV()
35 const int mb_h = io->mb_h; in EmitYUV()
40 memcpy(y_dst + j * buf->y_stride, io->y + j * io->y_stride, mb_w); in EmitYUV()
43 memcpy(u_dst + j * buf->u_stride, io->u + j * io->uv_stride, uv_w); in EmitYUV()
44 memcpy(v_dst + j * buf->v_stride, io->v + j * io->uv_stride, uv_w); in EmitYUV()
46 return io->mb_h; in EmitYUV()
50 static int EmitSampledRGB(const VP8Io* const io, WebPDecParams* const p) { in EmitSampledRGB() argument
53 uint8_t* dst = buf->rgba + io->mb_y * buf->stride; in EmitSampledRGB()
54 const uint8_t* y_src = io->y; in EmitSampledRGB()
55 const uint8_t* u_src = io->u; in EmitSampledRGB()
56 const uint8_t* v_src = io->v; in EmitSampledRGB()
58 const int mb_w = io->mb_w; in EmitSampledRGB()
59 const int last = io->mb_h - 1; in EmitSampledRGB()
62 sample(y_src, y_src + io->y_stride, u_src, v_src, in EmitSampledRGB()
64 y_src += 2 * io->y_stride; in EmitSampledRGB()
65 u_src += io->uv_stride; in EmitSampledRGB()
66 v_src += io->uv_stride; in EmitSampledRGB()
72 return io->mb_h; in EmitSampledRGB()
79 static int EmitRGB(const VP8Io* const io, WebPDecParams* const p) {
82 uint8_t* dst = buf->rgba + io->mb_y * buf->stride;
83 const uint8_t* y_src = io->y;
84 const uint8_t* u_src = io->u;
85 const uint8_t* v_src = io->v;
87 const int mb_w = io->mb_w;
88 const int last = io->mb_h;
92 y_src += io->y_stride;
93 u_src += io->uv_stride;
94 v_src += io->uv_stride;
97 return io->mb_h;
105 static int EmitFancyRGB(const VP8Io* const io, WebPDecParams* const p) { in EmitFancyRGB() argument
106 int num_lines_out = io->mb_h; // a priori guess in EmitFancyRGB()
108 uint8_t* dst = buf->rgba + io->mb_y * buf->stride; in EmitFancyRGB()
110 const uint8_t* cur_y = io->y; in EmitFancyRGB()
111 const uint8_t* cur_u = io->u; in EmitFancyRGB()
112 const uint8_t* cur_v = io->v; in EmitFancyRGB()
115 int y = io->mb_y; in EmitFancyRGB()
116 const int y_end = io->mb_y + io->mb_h; in EmitFancyRGB()
117 const int mb_w = io->mb_w; in EmitFancyRGB()
133 cur_u += io->uv_stride; in EmitFancyRGB()
134 cur_v += io->uv_stride; in EmitFancyRGB()
136 cur_y += 2 * io->y_stride; in EmitFancyRGB()
137 upsample(cur_y - io->y_stride, cur_y, in EmitFancyRGB()
142 cur_y += io->y_stride; in EmitFancyRGB()
143 if (io->crop_top + y_end < io->crop_bottom) { in EmitFancyRGB()
165 static int EmitAlphaYUV(const VP8Io* const io, WebPDecParams* const p) { in EmitAlphaYUV() argument
166 const uint8_t* alpha = io->a; in EmitAlphaYUV()
168 const int mb_w = io->mb_w; in EmitAlphaYUV()
169 const int mb_h = io->mb_h; in EmitAlphaYUV()
170 uint8_t* dst = buf->a + io->mb_y * buf->a_stride; in EmitAlphaYUV()
176 alpha += io->width; in EmitAlphaYUV()
189 static int GetAlphaSourceRow(const VP8Io* const io, in GetAlphaSourceRow() argument
191 int start_y = io->mb_y; in GetAlphaSourceRow()
192 *num_rows = io->mb_h; in GetAlphaSourceRow()
196 if (io->fancy_upsampling) { in GetAlphaSourceRow()
205 *alpha -= io->width; in GetAlphaSourceRow()
207 if (io->crop_top + io->mb_y + io->mb_h == io->crop_bottom) { in GetAlphaSourceRow()
209 *num_rows = io->crop_bottom - io->crop_top - start_y; in GetAlphaSourceRow()
215 static int EmitAlphaRGB(const VP8Io* const io, WebPDecParams* const p) { in EmitAlphaRGB() argument
216 const uint8_t* alpha = io->a; in EmitAlphaRGB()
218 const int mb_w = io->mb_w; in EmitAlphaRGB()
224 const int start_y = GetAlphaSourceRow(io, &alpha, &num_rows); in EmitAlphaRGB()
236 alpha += io->width; in EmitAlphaRGB()
248 static int EmitAlphaRGBA4444(const VP8Io* const io, WebPDecParams* const p) { in EmitAlphaRGBA4444() argument
249 const uint8_t* alpha = io->a; in EmitAlphaRGBA4444()
251 const int mb_w = io->mb_w; in EmitAlphaRGBA4444()
255 const int start_y = GetAlphaSourceRow(io, &alpha, &num_rows); in EmitAlphaRGBA4444()
268 alpha += io->width; in EmitAlphaRGBA4444()
293 static int EmitRescaledYUV(const VP8Io* const io, WebPDecParams* const p) { in EmitRescaledYUV() argument
294 const int mb_h = io->mb_h; in EmitRescaledYUV()
296 const int num_lines_out = Rescale(io->y, io->y_stride, mb_h, &p->scaler_y); in EmitRescaledYUV()
297 Rescale(io->u, io->uv_stride, uv_mb_h, &p->scaler_u); in EmitRescaledYUV()
298 Rescale(io->v, io->uv_stride, uv_mb_h, &p->scaler_v); in EmitRescaledYUV()
302 static int EmitRescaledAlphaYUV(const VP8Io* const io, WebPDecParams* const p) { in EmitRescaledAlphaYUV() argument
303 if (io->a != NULL) { in EmitRescaledAlphaYUV()
304 Rescale(io->a, io->width, io->mb_h, &p->scaler_a); in EmitRescaledAlphaYUV()
309 static int InitYUVRescaler(const VP8Io* const io, WebPDecParams* const p) { in InitYUVRescaler() argument
312 const int out_width = io->scaled_width; in InitYUVRescaler()
313 const int out_height = io->scaled_height; in InitYUVRescaler()
316 const int uv_in_width = (io->mb_w + 1) >> 1; in InitYUVRescaler()
317 const int uv_in_height = (io->mb_h + 1) >> 1; in InitYUVRescaler()
332 WebPRescalerInit(&p->scaler_y, io->mb_w, io->mb_h, in InitYUVRescaler()
334 io->mb_w, out_width, io->mb_h, out_height, in InitYUVRescaler()
349 WebPRescalerInit(&p->scaler_a, io->mb_w, io->mb_h, in InitYUVRescaler()
351 io->mb_w, out_width, io->mb_h, out_height, in InitYUVRescaler()
384 static int EmitRescaledRGB(const VP8Io* const io, WebPDecParams* const p) { in EmitRescaledRGB() argument
385 const int mb_h = io->mb_h; in EmitRescaledRGB()
392 io->y + j * io->y_stride, io->y_stride); in EmitRescaledRGB()
395 io->u + uv_j * io->uv_stride, io->uv_stride); in EmitRescaledRGB()
398 io->v + uv_j * io->uv_stride, io->uv_stride); in EmitRescaledRGB()
468 static int EmitRescaledAlphaRGB(const VP8Io* const io, WebPDecParams* const p) { in EmitRescaledAlphaRGB() argument
469 if (io->a != NULL) { in EmitRescaledAlphaRGB()
473 while (j < io->mb_h) { in EmitRescaledAlphaRGB()
474 j += WebPRescalerImport(scaler, io->mb_h - j, in EmitRescaledAlphaRGB()
475 io->a + j * io->width, io->width); in EmitRescaledAlphaRGB()
482 static int InitRGBRescaler(const VP8Io* const io, WebPDecParams* const p) { in InitRGBRescaler() argument
484 const int out_width = io->scaled_width; in InitRGBRescaler()
485 const int out_height = io->scaled_height; in InitRGBRescaler()
486 const int uv_in_width = (io->mb_w + 1) >> 1; in InitRGBRescaler()
487 const int uv_in_height = (io->mb_h + 1) >> 1; in InitRGBRescaler()
505 WebPRescalerInit(&p->scaler_y, io->mb_w, io->mb_h, in InitRGBRescaler()
507 io->mb_w, out_width, io->mb_h, out_height, in InitRGBRescaler()
511 io->mb_w, 2 * out_width, io->mb_h, 2 * out_height, in InitRGBRescaler()
515 io->mb_w, 2 * out_width, io->mb_h, 2 * out_height, in InitRGBRescaler()
520 WebPRescalerInit(&p->scaler_a, io->mb_w, io->mb_h, in InitRGBRescaler()
522 io->mb_w, out_width, io->mb_h, out_height, in InitRGBRescaler()
538 static int CustomSetup(VP8Io* io) { in CustomSetup() argument
539 WebPDecParams* const p = (WebPDecParams*)io->opaque; in CustomSetup()
548 if (!WebPIoInitFromOptions(p->options, io, is_alpha ? MODE_YUV : MODE_YUVA)) { in CustomSetup()
552 if (io->use_scaling) { in CustomSetup()
553 const int ok = is_rgb ? InitRGBRescaler(io, p) : InitYUVRescaler(io, p); in CustomSetup()
561 if (io->fancy_upsampling) { in CustomSetup()
562 const int uv_width = (io->mb_w + 1) >> 1; in CustomSetup()
563 p->memory = malloc(io->mb_w + 2 * uv_width); in CustomSetup()
568 p->tmp_u = p->tmp_y + io->mb_w; in CustomSetup()
595 static int CustomPut(const VP8Io* io) { in CustomPut() argument
596 WebPDecParams* const p = (WebPDecParams*)io->opaque; in CustomPut()
597 const int mb_w = io->mb_w; in CustomPut()
598 const int mb_h = io->mb_h; in CustomPut()
600 assert(!(io->mb_y & 1)); in CustomPut()
605 num_lines_out = p->emit(io, p); in CustomPut()
607 p->emit_alpha(io, p); in CustomPut()
615 static void CustomTeardown(const VP8Io* io) { in CustomTeardown() argument
616 WebPDecParams* const p = (WebPDecParams*)io->opaque; in CustomTeardown()
624 void WebPInitCustomIo(WebPDecParams* const params, VP8Io* const io) { in WebPInitCustomIo() argument
625 io->put = CustomPut; in WebPInitCustomIo()
626 io->setup = CustomSetup; in WebPInitCustomIo()
627 io->teardown = CustomTeardown; in WebPInitCustomIo()
628 io->opaque = params; in WebPInitCustomIo()