Record & log the image pre-processing time.

Change-Id: If0ecec3046e87fe0021446a98f3e94c7e0576bb8
This commit is contained in:
Vikas Arora 2014-07-28 16:04:54 -07:00
parent d2cc61b7dd
commit e09e9ff6e5

View File

@ -999,7 +999,7 @@ int main(int argc, const char *argv[]) {
picture.user_data = (void*)in_file; picture.user_data = (void*)in_file;
} }
// Compress // Crop & resize.
if (verbose) { if (verbose) {
StopwatchReset(&stop_watch); StopwatchReset(&stop_watch);
} }
@ -1016,12 +1016,22 @@ int main(int argc, const char *argv[]) {
goto Error; goto Error;
} }
} }
if (verbose && (crop != 0 || (resize_w | resize_h) > 0)) {
const double preproc_time = StopwatchReadAndReset(&stop_watch);
fprintf(stderr, "Time to crop/resize picture: %.3fs\n", preproc_time);
}
if (picture.extra_info_type > 0) { if (picture.extra_info_type > 0) {
AllocExtraInfo(&picture); AllocExtraInfo(&picture);
} }
if (print_distortion >= 0) { // Save original picture for later comparison if (print_distortion >= 0) { // Save original picture for later comparison
WebPPictureCopy(&picture, &original_picture); WebPPictureCopy(&picture, &original_picture);
} }
// Compress.
if (verbose) {
StopwatchReset(&stop_watch);
}
if (!WebPEncode(&config, &picture)) { if (!WebPEncode(&config, &picture)) {
fprintf(stderr, "Error! Cannot encode picture as WebP\n"); fprintf(stderr, "Error! Cannot encode picture as WebP\n");
fprintf(stderr, "Error code: %d (%s)\n", fprintf(stderr, "Error code: %d (%s)\n",