Lines Matching full:pic
207 static void SnapTopLeftPosition(const WebPPicture* const pic,
209 if (!pic->use_argb) {
210 const int is_yuv422 = IS_YUV_CSP(pic->colorspace, WEBP_YUV422);
211 if (IS_YUV_CSP(pic->colorspace, WEBP_YUV420) || is_yuv422) {
219 static int AdjustAndCheckRectangle(const WebPPicture* const pic,
222 SnapTopLeftPosition(pic, left, top);
225 if ((*left) + width > pic->width) return 0;
226 if ((*top) + height > pic->height) return 0;
318 int WebPPictureCrop(WebPPicture* pic,
322 if (pic == NULL) return 0;
323 if (!AdjustAndCheckRectangle(pic, &left, &top, width, height)) return 0;
325 WebPPictureGrabSpecs(pic, &tmp);
330 if (!pic->use_argb) {
331 const int y_offset = top * pic->y_stride + left;
332 const int uv_offset = (top / 2) * pic->uv_stride + left / 2;
333 CopyPlane(pic->y + y_offset, pic->y_stride,
335 CopyPlane(pic->u + uv_offset, pic->uv_stride,
337 CopyPlane(pic->v + uv_offset, pic->uv_stride,
341 const int a_offset = top * pic->a_stride + left;
342 CopyPlane(pic->a + a_offset, pic->a_stride,
353 CopyPlane(pic->u0 + top * pic->uv0_stride + left_pos, pic->uv0_stride,
355 CopyPlane(pic->v0 + top * pic->uv0_stride + left_pos, pic->uv0_stride,
361 (const uint8_t*)(pic->argb + top * pic->argb_stride + left);
362 CopyPlane(src, pic->argb_stride * 4,
366 WebPPictureFree(pic);
367 *pic = tmp;
396 int WebPPictureRescale(WebPPicture* pic, int width, int height) {
401 if (pic == NULL) return 0;
402 prev_width = pic->width;
403 prev_height = pic->height;
415 WebPPictureGrabSpecs(pic, &tmp);
420 if (!pic->use_argb) {
427 RescalePlane(pic->y, prev_width, prev_height, pic->y_stride,
429 RescalePlane(pic->u,
430 HALVE(prev_width), HALVE(prev_height), pic->uv_stride,
433 RescalePlane(pic->v,
434 HALVE(prev_width), HALVE(prev_height), pic->uv_stride,
439 RescalePlane(pic->a, prev_width, prev_height, pic->a_stride,
446 pic->u0, (prev_width + s / 2) / s, prev_height, pic->uv0_stride,
449 pic->v0, (prev_width + s / 2) / s, prev_height, pic->uv0_stride,
460 RescalePlane((const uint8_t*)pic->argb, prev_width, prev_height,
461 pic->argb_stride * 4,
467 WebPPictureFree(pic);
469 *pic = tmp;
875 void WebPCleanupTransparentArea(WebPPicture* pic) {
880 if (pic == NULL) return;
882 a_ptr = pic->a;
885 w = pic->width / SIZE;
886 h = pic->height / SIZE;
890 const int off_a = (y * pic->a_stride + x) * SIZE;
891 const int off_y = (y * pic->y_stride + x) * SIZE;
892 const int off_uv = (y * pic->uv_stride + x) * SIZE2;
893 if (is_transparent_area(a_ptr + off_a, pic->a_stride, SIZE)) {
895 values[0] = pic->y[off_y];
896 values[1] = pic->u[off_uv];
897 values[2] = pic->v[off_uv];
900 flatten(pic->y + off_y, values[0], pic->y_stride, SIZE);
901 flatten(pic->u + off_uv, values[1], pic->uv_stride, SIZE2);
902 flatten(pic->v + off_uv, values[2], pic->uv_stride, SIZE2);
1055 WebPPicture pic;
1061 !WebPPictureInit(&pic)) {
1066 pic.use_argb = !!lossless;
1067 pic.width = width;
1068 pic.height = height;
1069 pic.writer = WebPMemoryWrite;
1070 pic.custom_ptr = &wrt;
1073 ok = import(&pic, rgba, stride) && WebPEncode(&config, &pic);
1074 WebPPictureFree(&pic);