Atom/rbarrand/export screenshot diff (#7300)

* Small refactor on ImageComparison utils.

Signed-off-by: hershey5045 <43485729+hershey5045@users.noreply.github.com>

* Add aznumeric cast.

Signed-off-by: hershey5045 <43485729+hershey5045@users.noreply.github.com>

* Correction on aznumeric cast.

Signed-off-by: hershey5045 <43485729+hershey5045@users.noreply.github.com>

* Add unit test for new image comparison function.

Signed-off-by: hershey5045 <43485729+hershey5045@users.noreply.github.com>

* Use span instead of array_view

Signed-off-by: hershey5045 <43485729+hershey5045@users.noreply.github.com>
monroegm-disable-blank-issue-2
hershey5045 4 years ago committed by GitHub
parent b455b915a8
commit 96dcd1fc26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -24,7 +24,7 @@ namespace AZ
};
//! Calculates the maximum difference of the rgb channels between two image buffers.
int16_t CalcMaxChannelDifference(AZStd::array_view<uint8_t> bufferA, AZStd::array_view<uint8_t> bufferB, size_t index);
int16_t CalcMaxChannelDifference(AZStd::span<const uint8_t> bufferA, AZStd::span<const uint8_t> bufferB, size_t index);
//! Compares two images and returns the RMS (root mean square) of the difference.
//! @param buffer[A|B] the raw buffer of image data

@ -14,7 +14,7 @@ namespace AZ
{
namespace Utils
{
int16_t CalcMaxChannelDifference(AZStd::array_view<uint8_t> bufferA, AZStd::array_view<uint8_t> bufferB, size_t index)
int16_t CalcMaxChannelDifference(AZStd::span<const uint8_t> bufferA, AZStd::span<const uint8_t> bufferB, size_t index)
{
// We use the max error from a single channel instead of accumulating the error from each channel.
// This normalizes differences so that for example black vs red has the same weight as black vs yellow.

Loading…
Cancel
Save