Add monochrome tests and fix monochrome

This commit is contained in:
Joose Sainio 2021-04-23 12:24:00 +03:00
parent 42edbd031f
commit 0cc1bf197f
9 changed files with 31 additions and 13 deletions

View file

@ -1149,8 +1149,8 @@ static void filter_deblock_unit(encoder_state_t * const state,
// Chroma pixel coordinates. // Chroma pixel coordinates.
const int32_t x_c = x >> 1; const int32_t x_c = x >> 1;
const int32_t y_c = y >> 1; const int32_t y_c = y >> 1;
if ((state->encoder_control->chroma_format != KVZ_CSP_400 && is_on_8x8_grid(x_c, y_c, dir) && (x_c + 4) % 32) if (state->encoder_control->chroma_format != KVZ_CSP_400 && (is_on_8x8_grid(x_c, y_c, dir && (x_c + 4) % 32)
|| (x == state->tile->frame->width - 8 && dir == 1 && y_c % 8 == 0)) { || (x == state->tile->frame->width - 8 && dir == 1 && y_c % 8 == 0))) {
filter_deblock_edge_chroma(state, x_c, y_c, length, dir, tu_boundary); filter_deblock_edge_chroma(state, x_c, y_c, length, dir, tu_boundary);
} }
} }

View file

@ -639,7 +639,7 @@ static double search_cu(encoder_state_t * const state, int x, int y, int depth,
NULL, lcu); NULL, lcu);
// TODO: This heavily relies to square CUs // TODO: This heavily relies to square CUs
if (depth != 4 || (x % 8 && y % 8) && state->encoder_control->chroma_format != KVZ_CSP_400) { if ((depth != 4 || (x % 8 && y % 8)) && state->encoder_control->chroma_format != KVZ_CSP_400) {
// There is almost no benefit to doing the chroma mode search for // There is almost no benefit to doing the chroma mode search for
// rd2. Possibly because the luma mode search already takes chroma // rd2. Possibly because the luma mode search already takes chroma
// into account, so there is less of a chanse of luma mode being // into account, so there is less of a chanse of luma mode being

View file

@ -2,7 +2,8 @@
TESTS = $(check_PROGRAMS) \ TESTS = $(check_PROGRAMS) \
test_external_symbols.sh \ test_external_symbols.sh \
test_intra.sh \ test_intra.sh \
test_invalid_input.sh test_invalid_input.sh \
test_monochrome.sh
#test_tools.sh #test_tools.sh
#test_weird_shapes.sh #test_weird_shapes.sh
@ -10,6 +11,7 @@ EXTRA_DIST = \
test_external_symbols.sh \ test_external_symbols.sh \
test_intra.sh \ test_intra.sh \
test_invalid_input.sh \ test_invalid_input.sh \
test_monochrome.sh \
#test_tools.sh \ #test_tools.sh \
#test_weird_shapes.sh \ #test_weird_shapes.sh \
util.sh util.sh

View file

@ -6,7 +6,7 @@ set -eu
. "${0%/*}/util.sh" . "${0%/*}/util.sh"
common_args='256x128 10 -p1 --preset=ultrafast --threads=0 --no-wpp --no-tmvp --no-deblock --sao=0 --alf=full --cpuid=0 --pu-depth-intra 0-4' common_args='256x128 10 yuv420p -p1 --preset=ultrafast --threads=0 --no-wpp --no-tmvp --no-deblock --sao=0 --alf=full --cpuid=0 --pu-depth-intra 0-4'
valgrind_test $common_args --rd=1 valgrind_test $common_args --rd=1
valgrind_test $common_args --rd=2 --no-transform-skip --qp 37 valgrind_test $common_args --rd=2 --no-transform-skip --qp 37
valgrind_test $common_args --rd=2 --no-transform-skip --qp 37 --rdoq valgrind_test $common_args --rd=2 --no-transform-skip --qp 37 --rdoq

View file

@ -5,4 +5,4 @@
set -eu set -eu
. "${0%/*}/util.sh" . "${0%/*}/util.sh"
encode_test 1x65 1 1 encode_test 1x65 1 yuv420p 1

12
tests/test_monochrome.sh Executable file
View file

@ -0,0 +1,12 @@
#!/bin/sh
# Test all-intra coding.
set -eu
. "${0%/*}/util.sh"
common_args='256x128 10 gray --hash none --preset=ultrafast --input-format P400 --threads=0 --no-wpp --no-tmvp --no-deblock --sao=0 --cpuid=0 --pu-depth-intra 0-4'
valgrind_test $common_args --rd=1 -p1
valgrind_test $common_args --rd=2 -p1
valgrind_test $common_args --rd=2 -p1 --deblock 0:0

View file

@ -5,7 +5,7 @@
set -eu set -eu
. "${0%/*}/util.sh" . "${0%/*}/util.sh"
common_args='264x130 10 -p0 -r1 --threads=2 --wpp --owf=1 --rd=0' common_args='264x130 10 yuv420p -p0 -r1 --threads=2 --wpp --owf=1 --rd=0'
valgrind_test $common_args --no-rdoq --no-deblock --no-sao --no-signhide --subme=1 --pu-depth-intra=2-3 valgrind_test $common_args --no-rdoq --no-deblock --no-sao --no-signhide --subme=1 --pu-depth-intra=2-3
valgrind_test $common_args --no-rdoq --no-signhide --subme=0 valgrind_test $common_args --no-rdoq --no-signhide --subme=0

View file

@ -3,6 +3,6 @@
set -eu set -eu
. "${0%/*}/util.sh" . "${0%/*}/util.sh"
valgrind_test 16x16 10 --threads=0 --no-wpp --preset=veryslow valgrind_test 16x16 10 yuv420p --threads=0 --no-wpp --preset=veryslow
valgrind_test 256x16 10 --threads=0 --no-wpp --preset=veryslow valgrind_test 256x16 10 yuv420p --threads=0 --no-wpp --preset=veryslow
valgrind_test 16x256 10 --threads=0 --no-wpp --preset=veryslow valgrind_test 16x256 10 yuv420p --threads=0 --no-wpp --preset=veryslow

View file

@ -22,7 +22,7 @@ prepare() {
cleanup cleanup
print_and_run \ print_and_run \
ffmpeg -f lavfi -i "mandelbrot=size=${1}" \ ffmpeg -f lavfi -i "mandelbrot=size=${1}" \
-vframes "${2}" -pix_fmt yuv420p -f yuv4mpegpipe \ -vframes "${2}" -pix_fmt "${3}" -f yuv4mpegpipe \
"${yuvfile}" "${yuvfile}"
} }
@ -31,8 +31,10 @@ valgrind_test() {
shift shift
frames="$1" frames="$1"
shift shift
format="$1"
shift
prepare "${dimensions}" "${frames}" prepare "${dimensions}" "${frames}" "${format}"
# If $KVZ_TEST_VALGRIND is defined and equal to "1", run the test with # If $KVZ_TEST_VALGRIND is defined and equal to "1", run the test with
# valgrind. Otherwise, run without valgrind. # valgrind. Otherwise, run without valgrind.
@ -59,10 +61,12 @@ encode_test() {
shift shift
frames="$1" frames="$1"
shift shift
format="$1"
shift
expected_status="$1" expected_status="$1"
shift shift
prepare "${dimensions}" "${frames}" prepare "${dimensions}" "${frames}" "${format}"
set +e set +e
print_and_run \ print_and_run \