diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak
index 72d95ae415..83396297c6 100644
--- a/tests/fate/filter-video.mak
+++ b/tests/fate/filter-video.mak
@@ -489,6 +489,12 @@ fate-filter-scalechroma: CMD = framecrc -flags bitexact -s 352x288 -pix_fmt yuv4
 FATE_FILTER_VSYNTH-$(CONFIG_VFLIP_FILTER) += fate-filter-vflip
 fate-filter-vflip: CMD = video_filter "vflip"
 
+FATE_FILTER_VSYNTH-$(CONFIG_COLORLEVELS_FILTER) += fate-filter-colorlevels
+fate-filter-colorlevels: CMD = framecrc -c:v pgmyuv -i $(SRC) -vf format=rgb24,colorlevels -flags +bitexact -sws_flags +accurate_rnd+bitexact
+
+FATE_FILTER_VSYNTH-$(CONFIG_COLORLEVELS_FILTER) += fate-filter-colorlevels-16
+fate-filter-colorlevels-16: CMD = framecrc -c:v pgmyuv -i $(SRC) -vf format=rgb48,colorlevels -pix_fmt rgb48le -flags +bitexact -sws_flags +accurate_rnd+bitexact
+
 FATE_FILTER_VSYNTH-$(CONFIG_COLORMATRIX_FILTER) += fate-filter-colormatrix1
 fate-filter-colormatrix1: CMD = video_filter "colormatrix=bt601:smpte240m,colormatrix=smpte240m:fcc,colormatrix=fcc:bt601,colormatrix=bt601:fcc,colormatrix=fcc:smpte240m,colormatrix=smpte240m:bt709"
 
diff --git a/tests/ref/fate/filter-colorlevels b/tests/ref/fate/filter-colorlevels
new file mode 100644
index 0000000000..ceb8cb2127
--- /dev/null
+++ b/tests/ref/fate/filter-colorlevels
@@ -0,0 +1,55 @@
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 352x288
+#sar 0: 0/1
+0,          0,          0,        1,   304128, 0x348bb7a0
+0,          1,          1,        1,   304128, 0xaf9634d7
+0,          2,          2,        1,   304128, 0x81161fd3
+0,          3,          3,        1,   304128, 0x6839b383
+0,          4,          4,        1,   304128, 0xa55299b8
+0,          5,          5,        1,   304128, 0x66fb65b3
+0,          6,          6,        1,   304128, 0xe6be2a99
+0,          7,          7,        1,   304128, 0xfb33cb55
+0,          8,          8,        1,   304128, 0x51ab3d74
+0,          9,          9,        1,   304128, 0x67dc44ee
+0,         10,         10,        1,   304128, 0x2eac3b50
+0,         11,         11,        1,   304128, 0xd4a4c377
+0,         12,         12,        1,   304128, 0x1eefe29c
+0,         13,         13,        1,   304128, 0x3a84d488
+0,         14,         14,        1,   304128, 0x70d3b165
+0,         15,         15,        1,   304128, 0x578e58d4
+0,         16,         16,        1,   304128, 0x08bba87e
+0,         17,         17,        1,   304128, 0xccc86c47
+0,         18,         18,        1,   304128, 0x70bf9aa2
+0,         19,         19,        1,   304128, 0x3fc3d5b5
+0,         20,         20,        1,   304128, 0xef52590b
+0,         21,         21,        1,   304128, 0x4f7adde0
+0,         22,         22,        1,   304128, 0xc076ef54
+0,         23,         23,        1,   304128, 0xed2bba2d
+0,         24,         24,        1,   304128, 0x6fce6367
+0,         25,         25,        1,   304128, 0x71fe3c07
+0,         26,         26,        1,   304128, 0x6395fc7c
+0,         27,         27,        1,   304128, 0xa800ea2c
+0,         28,         28,        1,   304128, 0x758dfa57
+0,         29,         29,        1,   304128, 0x7fbba7c6
+0,         30,         30,        1,   304128, 0x2842e2a7
+0,         31,         31,        1,   304128, 0xafc2787c
+0,         32,         32,        1,   304128, 0x01e9a76b
+0,         33,         33,        1,   304128, 0x32a2377b
+0,         34,         34,        1,   304128, 0x10e0af2f
+0,         35,         35,        1,   304128, 0x8ab789ca
+0,         36,         36,        1,   304128, 0x3a3a5c1d
+0,         37,         37,        1,   304128, 0xeecb3f50
+0,         38,         38,        1,   304128, 0x317f8a3f
+0,         39,         39,        1,   304128, 0x0b90ba72
+0,         40,         40,        1,   304128, 0x1d6a509e
+0,         41,         41,        1,   304128, 0x11416b22
+0,         42,         42,        1,   304128, 0x325014ed
+0,         43,         43,        1,   304128, 0xb36a830c
+0,         44,         44,        1,   304128, 0xf67fd957
+0,         45,         45,        1,   304128, 0x091ad040
+0,         46,         46,        1,   304128, 0xd6b4b00e
+0,         47,         47,        1,   304128, 0x440b3f2a
+0,         48,         48,        1,   304128, 0x7c329040
+0,         49,         49,        1,   304128, 0xf6619a69
diff --git a/tests/ref/fate/filter-colorlevels-16 b/tests/ref/fate/filter-colorlevels-16
new file mode 100644
index 0000000000..eb948a9d46
--- /dev/null
+++ b/tests/ref/fate/filter-colorlevels-16
@@ -0,0 +1,55 @@
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 352x288
+#sar 0: 0/1
+0,          0,          0,        1,   608256, 0x60865484
+0,          1,          1,        1,   608256, 0x3c9bad01
+0,          2,          2,        1,   608256, 0x809b6b5d
+0,          3,          3,        1,   608256, 0x4d873004
+0,          4,          4,        1,   608256, 0xff1651c8
+0,          5,          5,        1,   608256, 0x48fd0353
+0,          6,          6,        1,   608256, 0x184ce147
+0,          7,          7,        1,   608256, 0x9802722f
+0,          8,          8,        1,   608256, 0x9413376e
+0,          9,          9,        1,   608256, 0xfbb733e9
+0,         10,         10,        1,   608256, 0x573ae5a4
+0,         11,         11,        1,   608256, 0x8697c4a4
+0,         12,         12,        1,   608256, 0xc7b364c1
+0,         13,         13,        1,   608256, 0x512770ec
+0,         14,         14,        1,   608256, 0x2adee98f
+0,         15,         15,        1,   608256, 0xcfb7d642
+0,         16,         16,        1,   608256, 0xc303accb
+0,         17,         17,        1,   608256, 0xc738fee1
+0,         18,         18,        1,   608256, 0xd28c5669
+0,         19,         19,        1,   608256, 0xd3ce495a
+0,         20,         20,        1,   608256, 0x34fe368d
+0,         21,         21,        1,   608256, 0xbafe49a4
+0,         22,         22,        1,   608256, 0x68da4a93
+0,         23,         23,        1,   608256, 0xfd632bde
+0,         24,         24,        1,   608256, 0x92275713
+0,         25,         25,        1,   608256, 0xcb569e86
+0,         26,         26,        1,   608256, 0x84674f8a
+0,         27,         27,        1,   608256, 0xd8b7f0d5
+0,         28,         28,        1,   608256, 0xe3e6f966
+0,         29,         29,        1,   608256, 0x084d3d4c
+0,         30,         30,        1,   608256, 0x6e9c5c63
+0,         31,         31,        1,   608256, 0x71c71484
+0,         32,         32,        1,   608256, 0xa89dedd1
+0,         33,         33,        1,   608256, 0x4c481ca6
+0,         34,         34,        1,   608256, 0xa52bc63b
+0,         35,         35,        1,   608256, 0x59f0efa5
+0,         36,         36,        1,   608256, 0xafb82d42
+0,         37,         37,        1,   608256, 0x887b8458
+0,         38,         38,        1,   608256, 0x8a2c6984
+0,         39,         39,        1,   608256, 0xe75e4737
+0,         40,         40,        1,   608256, 0xe41ed81c
+0,         41,         41,        1,   608256, 0xbf816b8d
+0,         42,         42,        1,   608256, 0x8cd1af16
+0,         43,         43,        1,   608256, 0x31883468
+0,         44,         44,        1,   608256, 0x380c2bf8
+0,         45,         45,        1,   608256, 0x25e7483e
+0,         46,         46,        1,   608256, 0xe73edd67
+0,         47,         47,        1,   608256, 0x3e9670ef
+0,         48,         48,        1,   608256, 0xd5b871fd
+0,         49,         49,        1,   608256, 0xe075789f
