anim_diff: add a -raw_comparison flag

If this flag is not used, RGB is premultiplied before comparison.
Otherwise, the raw R/G/B values are compared, which can be a problem
in transparent area (alpha=0 R/G/B=anything)

Change-Id: I131cc10ec92414ad508b81f599a60d0097cac470
This commit is contained in:
Pascal Massimino
2015-07-07 22:45:49 +00:00
committed by James Zern
parent 155c1b222b
commit acb297e9c2
3 changed files with 40 additions and 12 deletions

View File

@ -40,8 +40,10 @@ bool ReadAnimatedImage(const char filename[], AnimatedImage* const image,
bool dump_frames, const char dump_folder[]);
// Given two RGBA buffers, calculate max pixel difference and PSNR.
// If 'premultiply' is true, R/G/B values will be pre-multiplied by the
// transparency before comparison.
void GetDiffAndPSNR(const uint8_t rgba1[], const uint8_t rgba2[],
uint32_t width, uint32_t height, int* const max_diff,
double* const psnr);
uint32_t width, uint32_t height, bool premultiply,
int* const max_diff, double* const psnr);
#endif // WEBP_EXAMPLES_ANIM_UTIL_H_