Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed rgbtoyuvtest up #2009

Merged
merged 2 commits into from
Feb 15, 2024
Merged

Speed rgbtoyuvtest up #2009

merged 2 commits into from
Feb 15, 2024

Conversation

y-guyon
Copy link
Collaborator

@y-guyon y-guyon commented Feb 13, 2024

Please review only the second commit.

@vrabaud
Copy link
Collaborator

vrabaud commented Feb 13, 2024

Please keep the removed tests: maybe DISABLE them.

@y-guyon
Copy link
Collaborator Author

y-guyon commented Feb 13, 2024

Please keep the removed tests: maybe DISABLE them.

They are already tested with min/max rgb values:

// Exhaustive settings
// These tests would generate too many GoogleTest instances as parameterized
// tests (TEST_P) so loops are used instead.
TEST(RGBToYUVTest, ExhaustiveSettings) {
// Coverage of all configurations with all min/max input combinations.
for (int rgb_depth : {8, 10, 12, 16}) {
for (int yuv_depth : {8, 10, 12, 16}) {
for (avifRGBFormat rgb_format :
{AVIF_RGB_FORMAT_RGB, AVIF_RGB_FORMAT_RGBA, AVIF_RGB_FORMAT_ARGB,
AVIF_RGB_FORMAT_BGR, AVIF_RGB_FORMAT_BGRA, AVIF_RGB_FORMAT_ABGR}) {
for (avifPixelFormat yuv_format :
{AVIF_PIXEL_FORMAT_YUV444, AVIF_PIXEL_FORMAT_YUV422,
AVIF_PIXEL_FORMAT_YUV420, AVIF_PIXEL_FORMAT_YUV400}) {
for (avifRange yuv_range : {AVIF_RANGE_LIMITED, AVIF_RANGE_FULL}) {
for (decltype(AVIF_MATRIX_COEFFICIENTS_IDENTITY)
matrix_coefficients : {AVIF_MATRIX_COEFFICIENTS_IDENTITY,
AVIF_MATRIX_COEFFICIENTS_BT601}) {
if (matrix_coefficients == AVIF_MATRIX_COEFFICIENTS_IDENTITY &&
yuv_format != AVIF_PIXEL_FORMAT_YUV444) {
// See avifPrepareReformatState().
continue;
}
for (avifChromaDownsampling chroma_downsampling :
{AVIF_CHROMA_DOWNSAMPLING_AUTOMATIC,
AVIF_CHROMA_DOWNSAMPLING_FASTEST,
AVIF_CHROMA_DOWNSAMPLING_BEST_QUALITY,
AVIF_CHROMA_DOWNSAMPLING_AVERAGE,
AVIF_CHROMA_DOWNSAMPLING_SHARP_YUV}) {
if (chroma_downsampling == AVIF_CHROMA_DOWNSAMPLING_SHARP_YUV &&
yuv_depth > 12) {
// SharpYuvConvert() only supports YUV bit depths up to 12.
continue;
}
ConvertWholeRange(
rgb_depth, yuv_depth, rgb_format, yuv_format, yuv_range,
static_cast<avifMatrixCoefficients>(matrix_coefficients),
chroma_downsampling,
/*add_noise=*/true,
// Just try min and max values.
/*rgb_step=*/(1u << rgb_depth) - 1u,
// Barely check the results, this is mostly for coverage.
/*max_abs_average_diff=*/(1u << rgb_depth) - 1u,
/*min_psnr=*/5.0,
// Avoid spam.
/*log=*/false);
}
}
}
}
}
}
}
}

I do not think it is necessary to add a DISABLED test suite instantiation.

@y-guyon y-guyon requested a review from vrabaud February 15, 2024 10:23
@y-guyon y-guyon merged commit 132a747 into AOMediaCodec:main Feb 15, 2024
20 checks passed
@y-guyon y-guyon deleted the speed_rgbtoyuvtest branch February 15, 2024 10:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants