diff --git a/tests/checkasm/sw_gbrp.c b/tests/checkasm/sw_gbrp.c
index d843730f3e..744dfb9dab 100644
--- a/tests/checkasm/sw_gbrp.c
+++ b/tests/checkasm/sw_gbrp.c
@@ -71,7 +71,6 @@ static void check_output_yuv2gbrp(void)
 #define FILTER_SIZES 4
     static const int filter_sizes[] = {1, 4, 8, 16};
 #define LARGEST_INPUT_SIZE 512
-#define INPUT_SIZES 6
     static const int input_sizes[] = {8, 24, 128, 144, 256, 512};
     uint8_t *dst0[4];
     uint8_t *dst1[4];
@@ -138,7 +137,7 @@ static void check_output_yuv2gbrp(void)
 
     for (fmi = 0; fmi < FF_ARRAY_ELEMS(planar_fmts); fmi++) {
         for (fsi = 0; fsi < FILTER_SIZES; fsi++) {
-            for (isi = 0; isi < INPUT_SIZES; isi++ ) {
+            for (isi = 0; isi < FF_ARRAY_ELEMS(input_sizes); isi++ ) {
                 desc = av_pix_fmt_desc_get(planar_fmts[fmi]);
                 ctx->dstFormat = planar_fmts[fmi];
 
@@ -185,7 +184,6 @@ static void check_output_yuv2gbrp(void)
 }
 
 #undef LARGEST_INPUT_SIZE
-#undef INPUT_SIZES
 
 static void check_input_planar_rgb_to_y(void)
 {
@@ -194,7 +192,6 @@ static void check_input_planar_rgb_to_y(void)
     int fmi, isi;
     int dstW, byte_size;
 #define LARGEST_INPUT_SIZE 512
-#define INPUT_SIZES 6
     static const int input_sizes[] = {8, 24, 128, 144, 256, 512};
     const uint8_t *src[4];
     int32_t rgb2yuv[9] = {0};
@@ -226,7 +223,7 @@ static void check_input_planar_rgb_to_y(void)
         fail();
 
     for (fmi = 0; fmi < FF_ARRAY_ELEMS(planar_fmts); fmi++) {
-        for (isi = 0; isi < INPUT_SIZES; isi++ ) {
+        for (isi = 0; isi < FF_ARRAY_ELEMS(input_sizes); isi++ ) {
             desc = av_pix_fmt_desc_get(planar_fmts[fmi]);
             ctx->srcFormat = planar_fmts[fmi];
             ctx->dstFormat = AV_PIX_FMT_YUVA444P16;
@@ -253,7 +250,6 @@ static void check_input_planar_rgb_to_y(void)
 }
 
 #undef LARGEST_INPUT_SIZE
-#undef INPUT_SIZES
 
 static void check_input_planar_rgb_to_uv(void)
 {
@@ -262,7 +258,6 @@ static void check_input_planar_rgb_to_uv(void)
     int fmi, isi;
     int dstW, byte_size;
 #define LARGEST_INPUT_SIZE 512
-#define INPUT_SIZES 6
     static const int input_sizes[] = {8, 24, 128, 144, 256, 512};
     const uint8_t *src[4];
     int32_t rgb2yuv[9] = {0};
@@ -297,7 +292,7 @@ static void check_input_planar_rgb_to_uv(void)
         fail();
 
     for (fmi = 0; fmi < FF_ARRAY_ELEMS(planar_fmts); fmi++) {
-        for (isi = 0; isi < INPUT_SIZES; isi++ ) {
+        for (isi = 0; isi < FF_ARRAY_ELEMS(input_sizes); isi++ ) {
             desc = av_pix_fmt_desc_get(planar_fmts[fmi]);
             ctx->srcFormat = planar_fmts[fmi];
             ctx->dstFormat = AV_PIX_FMT_YUVA444P16;
@@ -326,7 +321,6 @@ static void check_input_planar_rgb_to_uv(void)
 }
 
 #undef LARGEST_INPUT_SIZE
-#undef INPUT_SIZES
 
 static void check_input_planar_rgb_to_a(void)
 {
@@ -335,7 +329,6 @@ static void check_input_planar_rgb_to_a(void)
     int fmi, isi;
     int dstW, byte_size;
 #define LARGEST_INPUT_SIZE 512
-#define INPUT_SIZES 6
     static const int input_sizes[] = {8, 24, 128, 144, 256, 512};
     const uint8_t *src[4];
     int32_t rgb2yuv[9] = {0};
@@ -367,7 +360,7 @@ static void check_input_planar_rgb_to_a(void)
         fail();
 
     for (fmi = 0; fmi < FF_ARRAY_ELEMS(planar_fmts); fmi++) {
-        for (isi = 0; isi < INPUT_SIZES; isi++ ) {
+        for (isi = 0; isi < FF_ARRAY_ELEMS(input_sizes); isi++ ) {
             desc = av_pix_fmt_desc_get(planar_fmts[fmi]);
             if (!(desc->flags & AV_PIX_FMT_FLAG_ALPHA))
                 continue;
diff --git a/tests/checkasm/sw_range_convert.c b/tests/checkasm/sw_range_convert.c
index 08029103d1..1f04988097 100644
--- a/tests/checkasm/sw_range_convert.c
+++ b/tests/checkasm/sw_range_convert.c
@@ -32,7 +32,6 @@ static void check_lumConvertRange(int from)
 {
     const char *func_str = from ? "lumRangeFromJpeg" : "lumRangeToJpeg";
 #define LARGEST_INPUT_SIZE 512
-#define INPUT_SIZES 6
     static const int input_sizes[] = {8, 24, 128, 144, 256, 512};
     struct SwsContext *ctx;
 
@@ -50,7 +49,7 @@ static void check_lumConvertRange(int from)
     ctx->srcRange = from;
     ctx->dstRange = !from;
 
-    for (int dstWi = 0; dstWi < INPUT_SIZES; dstWi++) {
+    for (int dstWi = 0; dstWi < FF_ARRAY_ELEMS(input_sizes); dstWi++) {
         int width = input_sizes[dstWi];
         for (int i = 0; i < width; i++) {
             uint8_t r = rnd();
@@ -70,13 +69,11 @@ static void check_lumConvertRange(int from)
     sws_freeContext(ctx);
 }
 #undef LARGEST_INPUT_SIZE
-#undef INPUT_SIZES
 
 static void check_chrConvertRange(int from)
 {
     const char *func_str = from ? "chrRangeFromJpeg" : "chrRangeToJpeg";
 #define LARGEST_INPUT_SIZE 512
-#define INPUT_SIZES 6
     static const int input_sizes[] = {8, 24, 128, 144, 256, 512};
     struct SwsContext *ctx;
 
@@ -96,7 +93,7 @@ static void check_chrConvertRange(int from)
     ctx->srcRange = from;
     ctx->dstRange = !from;
 
-    for (int dstWi = 0; dstWi < INPUT_SIZES; dstWi++) {
+    for (int dstWi = 0; dstWi < FF_ARRAY_ELEMS(input_sizes); dstWi++) {
         int width = input_sizes[dstWi];
         for (int i = 0; i < width; i++) {
             uint8_t r = rnd();
@@ -119,7 +116,6 @@ static void check_chrConvertRange(int from)
     sws_freeContext(ctx);
 }
 #undef LARGEST_INPUT_SIZE
-#undef INPUT_SIZES
 
 void checkasm_check_sw_range_convert(void)
 {
diff --git a/tests/checkasm/sw_scale.c b/tests/checkasm/sw_scale.c
index 32a5d1c1ac..ba4ce2f26b 100644
--- a/tests/checkasm/sw_scale.c
+++ b/tests/checkasm/sw_scale.c
@@ -104,7 +104,6 @@ static void check_yuv2yuv1(int accurate)
     int dstW, offset;
     size_t fail_offset;
     const int input_sizes[] = {8, 24, 128, 144, 256, 512};
-    const int INPUT_SIZES = sizeof(input_sizes)/sizeof(input_sizes[0]);
     #define LARGEST_INPUT_SIZE 512
 
     const int offsets[] = {0, 3, 8, 11, 16, 19};
@@ -129,7 +128,7 @@ static void check_yuv2yuv1(int accurate)
         fail();
 
     ff_sws_init_scale(ctx);
-    for (isi = 0; isi < INPUT_SIZES; ++isi) {
+    for (isi = 0; isi < FF_ARRAY_ELEMS(input_sizes); ++isi) {
         dstW = input_sizes[isi];
         for (osi = 0; osi < OFFSET_SIZES; osi++) {
             offset = offsets[osi];
@@ -168,7 +167,6 @@ static void check_yuv2yuvX(int accurate)
     const int FILTER_SIZES = sizeof(filter_sizes)/sizeof(filter_sizes[0]);
 #define LARGEST_INPUT_SIZE 512
     static const int input_sizes[] = {8, 24, 128, 144, 256, 512};
-    const int INPUT_SIZES = sizeof(input_sizes)/sizeof(input_sizes[0]);
     const char *accurate_str = (accurate) ? "accurate" : "approximate";
 
     declare_func_emms(AV_CPU_FLAG_MMX, void, const int16_t *filter,
@@ -195,7 +193,7 @@ static void check_yuv2yuvX(int accurate)
         fail();
 
     ff_sws_init_scale(ctx);
-    for(isi = 0; isi < INPUT_SIZES; ++isi){
+    for(isi = 0; isi < FF_ARRAY_ELEMS(input_sizes); ++isi){
         dstW = input_sizes[isi];
         for(osi = 0; osi < 64; osi += 16){
             if (dstW <= osi)
@@ -270,8 +268,7 @@ static void check_hscale(void)
     };
 
 #define LARGEST_INPUT_SIZE 512
-#define INPUT_SIZES 6
-    static const int input_sizes[INPUT_SIZES] = {8, 24, 128, 144, 256, 512};
+    static const int input_sizes[] = {8, 24, 128, 144, 256, 512};
 
     int i, j, fsi, hpi, width, dstWi;
     struct SwsContext *ctx;
@@ -301,7 +298,7 @@ static void check_hscale(void)
 
     for (hpi = 0; hpi < HSCALE_PAIRS; hpi++) {
         for (fsi = 0; fsi < FILTER_SIZES; fsi++) {
-            for (dstWi = 0; dstWi < INPUT_SIZES; dstWi++) {
+            for (dstWi = 0; dstWi < FF_ARRAY_ELEMS(input_sizes); dstWi++) {
                 width = filter_sizes[fsi];
 
                 ctx->srcBpc = hscale_pairs[hpi][0];
