cleanup WebPPicture struct and API

* add a real proper pointer for holding memory chunk pointer
  (instead of using y and argb fields)
* polish the doc with details
* add a WebPPictureView() that extract a view from a picture
  without any copy (kind of a fast-crop).
* properly snap the top-left corner for Crop/View. Previously,
  the luma position was not snapped, and was off compared to the chroma.

Change-Id: I8a3620c7f5fc6f7d1f8dd89d9da167c91e237439
This commit is contained in:
Pascal Massimino
2012-06-21 00:30:43 -07:00
parent 9144a18643
commit 31b68fe639
3 changed files with 145 additions and 39 deletions

View File

@ -1023,9 +1023,12 @@ int main(int argc, const char *argv[]) {
if (verbose) {
StopwatchReadAndReset(&stop_watch);
}
if (crop != 0 && !WebPPictureCrop(&picture, crop_x, crop_y, crop_w, crop_h)) {
fprintf(stderr, "Error! Cannot crop picture\n");
goto Error;
if (crop != 0) {
// We use self-cropping using a view.
if (!WebPPictureView(&picture, crop_x, crop_y, crop_w, crop_h, &picture)) {
fprintf(stderr, "Error! Cannot crop picture\n");
goto Error;
}
}
if ((resize_w | resize_h) > 0) {
if (!WebPPictureRescale(&picture, resize_w, resize_h)) {