mirror of
https://github.com/webmproject/libwebp.git
synced 2025-04-25 10:16:45 +02:00
Merge "fix -print_psnr / ssim options"
This commit is contained in:
commit
bab30fcab5
@ -1045,8 +1045,22 @@ int main(int argc, const char *argv[]) {
|
|||||||
if (!quiet && !short_output && print_distortion >= 0) { // print distortion
|
if (!quiet && !short_output && print_distortion >= 0) { // print distortion
|
||||||
static const char* distortion_names[] = { "PSNR", "SSIM", "LSIM" };
|
static const char* distortion_names[] = { "PSNR", "SSIM", "LSIM" };
|
||||||
float values[5];
|
float values[5];
|
||||||
WebPPictureDistortion(&picture, &original_picture,
|
// Comparison is performed in YUVA colorspace.
|
||||||
print_distortion, values);
|
if (original_picture.use_argb &&
|
||||||
|
!WebPPictureARGBToYUVA(&original_picture, WEBP_YUV420A)) {
|
||||||
|
fprintf(stderr, "Error while converting original picture to YUVA.\n");
|
||||||
|
goto Error;
|
||||||
|
}
|
||||||
|
if (picture.use_argb &&
|
||||||
|
!WebPPictureARGBToYUVA(&picture, WEBP_YUV420A)) {
|
||||||
|
fprintf(stderr, "Error while converting compressed picture to YUVA.\n");
|
||||||
|
goto Error;
|
||||||
|
}
|
||||||
|
if (!WebPPictureDistortion(&picture, &original_picture,
|
||||||
|
print_distortion, values)) {
|
||||||
|
fprintf(stderr, "Error while computing the distortion.\n");
|
||||||
|
goto Error;
|
||||||
|
}
|
||||||
fprintf(stderr, "%s: Y:%.2f U:%.2f V:%.2f A:%.2f Total:%.2f\n",
|
fprintf(stderr, "%s: Y:%.2f U:%.2f V:%.2f A:%.2f Total:%.2f\n",
|
||||||
distortion_names[print_distortion],
|
distortion_names[print_distortion],
|
||||||
values[0], values[1], values[2], values[3], values[4]);
|
values[0], values[1], values[2], values[3], values[4]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user