This library contains helpers for frame-related tests. This includes common frame dumping as well as frame comparison helpers.
bool igt_frame_dump_is_enabled (
Get whether frame dumping is enabled.
void igt_write_compared_frames_to_png (
const char *reference_suffix,
const char *capture_suffix);
Write previously compared frames to png files.
bool igt_check_analog_frame_match (
Checks that the analog image contained in the chamelium frame dump matches the given framebuffer.
In order to determine whether the frame matches the reference, the following reasoning is implemented:
The absolute error for each color value of the reference is collected.
The average absolute error is calculated for each color value of the reference and must not go above 60 (23.5 % of the total range).
A linear fit for the average absolute error from the pixel value is calculated, as a DAC-ADC chain is expected to have a linear error curve.
The linear fit is correlated with the actual average absolute error for the frame and the correlation coefficient is checked to be > 0.985, indicating a match with the expected error trend.
Most errors (e.g. due to scaling, rotation, color space, etc) can be reliably detected this way, with a minimized number of false-positives. However, the brightest values (250 and up) are ignored as the error trend is often not linear there in practice due to clamping.
bool igt_check_checkerboard_frame_match (
Checks that the reference frame matches the captured frame using a method designed for checkerboard patterns. These patterns are made of consecutive rectangular shapes with alternating solid colors.
The intent of this method is to cover cases where the captured result is not pixel-perfect due to features such as scaling or YUV conversion and subsampling. Such effects are mostly noticeable on the edges of the patterns, so they are detected and excluded from the comparison.
The algorithm works with two major steps. First, the edges of the reference pattern are detected on the x and y axis independently. The detection is done by calculating an absolute difference with a span of a few pixels before and after the current position on the given axis, accumulated for each color component. If the sum is above a given threshold on one of the axis, the position is marked as an edge. In the second step, the pixel values are compared per-component, excluding positions that were marked as edges or that are at a transition between an edge and a non-edge. An error threshold (for each individual color component) is used to mark the position as erroneous or not. The ratio of erroneous pixels over compared pixels (that does not count excluded pixels) is then calculated and compared to the error rate threshold to determine whether the frames match or not.