mirror of
https://mirror.skon.top/https://github.com/FFmpeg/FFmpeg
synced 2026-04-21 05:11:59 +08:00
tests/checkasm/sw_ops: fix check_scale()
This was not actually testing integer path. Additionally, for integer scales, there is a special fast path for expansion from bits to full range, which we should separate from the random value test.
This commit is contained in:
@@ -799,13 +799,21 @@ static void check_linear(void)
|
||||
|
||||
static void check_scale(void)
|
||||
{
|
||||
for (SwsPixelType t = F32; t < SWS_PIXEL_TYPE_NB; t++) {
|
||||
for (SwsPixelType t = U8; t < SWS_PIXEL_TYPE_NB; t++) {
|
||||
const char *type = ff_sws_pixel_type_name(t);
|
||||
const int bits = ff_sws_pixel_type_size(t) * 8;
|
||||
if (ff_sws_pixel_type_is_int(t)) {
|
||||
/* Ensure the result won't exceed the value range */
|
||||
const unsigned max = (1 << bits) - 1;
|
||||
const unsigned scale = rnd() & max;
|
||||
|
||||
/* Test fixed fast path for expansion from bits to full range */
|
||||
CHECK_COMMON_RANGE(FMT("scale_full_%s", type), 1, t, t, {
|
||||
.op = SWS_OP_SCALE,
|
||||
.type = t,
|
||||
.scale = {{ max, 1 }},
|
||||
});
|
||||
|
||||
/* Ensure the result won't exceed the value range */
|
||||
const unsigned scale = rnd() & (max >> 1);
|
||||
const unsigned range = max / (scale ? scale : 1);
|
||||
CHECK_COMMON_RANGE(FMT("scale_%s", type), range, t, t, {
|
||||
.op = SWS_OP_SCALE,
|
||||
|
||||
Reference in New Issue
Block a user