Lines Matching refs:pic
209 static void SnapTopLeftPosition(const WebPPicture* const pic, in SnapTopLeftPosition() argument
211 if (!pic->use_argb) { in SnapTopLeftPosition()
212 const int is_yuv422 = IS_YUV_CSP(pic->colorspace, WEBP_YUV422); in SnapTopLeftPosition()
213 if (IS_YUV_CSP(pic->colorspace, WEBP_YUV420) || is_yuv422) { in SnapTopLeftPosition()
221 static int AdjustAndCheckRectangle(const WebPPicture* const pic, in AdjustAndCheckRectangle() argument
224 SnapTopLeftPosition(pic, left, top); in AdjustAndCheckRectangle()
227 if ((*left) + width > pic->width) return 0; in AdjustAndCheckRectangle()
228 if ((*top) + height > pic->height) return 0; in AdjustAndCheckRectangle()
320 int WebPPictureCrop(WebPPicture* pic, in WebPPictureCrop() argument
324 if (pic == NULL) return 0; in WebPPictureCrop()
325 if (!AdjustAndCheckRectangle(pic, &left, &top, width, height)) return 0; in WebPPictureCrop()
327 WebPPictureGrabSpecs(pic, &tmp); in WebPPictureCrop()
332 if (!pic->use_argb) { in WebPPictureCrop()
333 const int y_offset = top * pic->y_stride + left; in WebPPictureCrop()
334 const int uv_offset = (top / 2) * pic->uv_stride + left / 2; in WebPPictureCrop()
335 CopyPlane(pic->y + y_offset, pic->y_stride, in WebPPictureCrop()
337 CopyPlane(pic->u + uv_offset, pic->uv_stride, in WebPPictureCrop()
339 CopyPlane(pic->v + uv_offset, pic->uv_stride, in WebPPictureCrop()
343 const int a_offset = top * pic->a_stride + left; in WebPPictureCrop()
344 CopyPlane(pic->a + a_offset, pic->a_stride, in WebPPictureCrop()
355 CopyPlane(pic->u0 + top * pic->uv0_stride + left_pos, pic->uv0_stride, in WebPPictureCrop()
357 CopyPlane(pic->v0 + top * pic->uv0_stride + left_pos, pic->uv0_stride, in WebPPictureCrop()
363 (const uint8_t*)(pic->argb + top * pic->argb_stride + left); in WebPPictureCrop()
364 CopyPlane(src, pic->argb_stride * 4, in WebPPictureCrop()
368 WebPPictureFree(pic); in WebPPictureCrop()
369 *pic = tmp; in WebPPictureCrop()
398 int WebPPictureRescale(WebPPicture* pic, int width, int height) { in WebPPictureRescale() argument
403 if (pic == NULL) return 0; in WebPPictureRescale()
404 prev_width = pic->width; in WebPPictureRescale()
405 prev_height = pic->height; in WebPPictureRescale()
417 WebPPictureGrabSpecs(pic, &tmp); in WebPPictureRescale()
422 if (!pic->use_argb) { in WebPPictureRescale()
429 RescalePlane(pic->y, prev_width, prev_height, pic->y_stride, in WebPPictureRescale()
431 RescalePlane(pic->u, in WebPPictureRescale()
432 HALVE(prev_width), HALVE(prev_height), pic->uv_stride, in WebPPictureRescale()
435 RescalePlane(pic->v, in WebPPictureRescale()
436 HALVE(prev_width), HALVE(prev_height), pic->uv_stride, in WebPPictureRescale()
441 RescalePlane(pic->a, prev_width, prev_height, pic->a_stride, in WebPPictureRescale()
448 pic->u0, (prev_width + s / 2) / s, prev_height, pic->uv0_stride, in WebPPictureRescale()
451 pic->v0, (prev_width + s / 2) / s, prev_height, pic->uv0_stride, in WebPPictureRescale()
462 RescalePlane((const uint8_t*)pic->argb, prev_width, prev_height, in WebPPictureRescale()
463 pic->argb_stride * 4, in WebPPictureRescale()
468 WebPPictureFree(pic); in WebPPictureRescale()
470 *pic = tmp; in WebPPictureRescale()
876 void WebPCleanupTransparentArea(WebPPicture* pic) { in WebPCleanupTransparentArea() argument
881 if (pic == NULL) return; in WebPCleanupTransparentArea()
883 a_ptr = pic->a; in WebPCleanupTransparentArea()
886 w = pic->width / SIZE; in WebPCleanupTransparentArea()
887 h = pic->height / SIZE; in WebPCleanupTransparentArea()
891 const int off_a = (y * pic->a_stride + x) * SIZE; in WebPCleanupTransparentArea()
892 const int off_y = (y * pic->y_stride + x) * SIZE; in WebPCleanupTransparentArea()
893 const int off_uv = (y * pic->uv_stride + x) * SIZE2; in WebPCleanupTransparentArea()
894 if (is_transparent_area(a_ptr + off_a, pic->a_stride, SIZE)) { in WebPCleanupTransparentArea()
896 values[0] = pic->y[off_y]; in WebPCleanupTransparentArea()
897 values[1] = pic->u[off_uv]; in WebPCleanupTransparentArea()
898 values[2] = pic->v[off_uv]; in WebPCleanupTransparentArea()
901 flatten(pic->y + off_y, values[0], pic->y_stride, SIZE); in WebPCleanupTransparentArea()
902 flatten(pic->u + off_uv, values[1], pic->uv_stride, SIZE2); in WebPCleanupTransparentArea()
903 flatten(pic->v + off_uv, values[2], pic->uv_stride, SIZE2); in WebPCleanupTransparentArea()
1056 WebPPicture pic; in Encode() local
1062 !WebPPictureInit(&pic)) { in Encode()
1067 pic.use_argb = !!lossless; in Encode()
1068 pic.width = width; in Encode()
1069 pic.height = height; in Encode()
1070 pic.writer = WebPMemoryWrite; in Encode()
1071 pic.custom_ptr = &wrt; in Encode()
1074 ok = import(&pic, rgba, stride) && WebPEncode(&config, &pic); in Encode()
1075 WebPPictureFree(&pic); in Encode()