feat(fps): support x-nv-video[0].clientRefreshRateX100 for requesting fractional NTSC framerates (#4019)

This commit is contained in:
Andy Grundman
2025-10-11 19:56:12 -04:00
committed by GitHub
parent 8dd75c4829
commit 6ed0c7a8f2
7 changed files with 80 additions and 1 deletions

View File

@@ -48,3 +48,31 @@ INSTANTIATE_TEST_SUITE_P(
TEST_P(EncoderTest, ValidateEncoder) {
// todo:: test something besides fixture setup
}
struct FramerateX100Test: testing::TestWithParam<std::tuple<std::int32_t, AVRational>> {};
TEST_P(FramerateX100Test, Run) {
const auto &[x100, expected] = GetParam();
auto res = video::framerateX100_to_rational(x100);
ASSERT_EQ(0, av_cmp_q(res, expected)) << "expected "
<< expected.num << "/" << expected.den
<< ", got "
<< res.num << "/" << res.den;
}
INSTANTIATE_TEST_SUITE_P(
FramerateX100Tests,
FramerateX100Test,
testing::Values(
std::make_tuple(2397, AVRational {24000, 1001}),
std::make_tuple(2398, AVRational {24000, 1001}),
std::make_tuple(2500, AVRational {25, 1}),
std::make_tuple(2997, AVRational {30000, 1001}),
std::make_tuple(3000, AVRational {30, 1}),
std::make_tuple(5994, AVRational {60000, 1001}),
std::make_tuple(6000, AVRational {60, 1}),
std::make_tuple(11988, AVRational {120000, 1001}),
std::make_tuple(23976, AVRational {240000, 1001}), // future NTSC 240hz?
std::make_tuple(9498, AVRational {4749, 50}) // from my LG 27GN950
)
);