#pragma once #include typedef enum Test_Pattern { TEST_PATTERN_BARS, /* SMPTE 75% colour bars */ TEST_PATTERN_RAMP, /* greyscale ramp, left to right */ TEST_PATTERN_GRID, /* white grid lines on black */ } Test_Pattern; typedef enum Test_Fmt { TEST_FMT_YUV420, /* planar YUV 4:2:0 */ TEST_FMT_YUV422, /* planar YUV 4:2:2 */ TEST_FMT_BGRA, /* packed BGRA 8:8:8:8 */ } Test_Fmt; typedef struct Test_Frame { uint8_t *plane[3]; /* Y/Cb/Cr; only plane[0] used for BGRA */ int stride[3]; /* bytes per row for each plane */ int width; int height; Test_Fmt fmt; } Test_Frame; /* * Allocate a Test_Frame with correctly-sized plane buffers. * Width and height must be >= 2 and even. * Returns NULL on allocation failure. */ Test_Frame *test_image_alloc(int width, int height, Test_Fmt fmt); /* Fill all planes of f with the given pattern. */ void test_image_generate(Test_Frame *f, Test_Pattern pat); void test_image_free(Test_Frame *f);