Cover High tier negotiation and independent KEY probes

This commit is contained in:
evgeny committed 2026-10-19 23:33:51 +02:00
1 parent 7122d70ea6
commit f2d67990f8
2 files changed
+17 -5

No files matched your search

+2 -2
View File
@@ -1,5 +1,5 @@
/* Общая проверка независимого KEY (configuration + Annex B AU). Не переписывает поток.
* Проверяет ограниченный набор для звонков: AVC Baseline/CB, HEVC Main/Main tier,
* Проверяет ограниченный набор для звонков: AVC Baseline/CB, HEVC Main с Main/High tier,
* progressive 8-bit 4:2:0, один spatial/temporal layer, без reorder. DPB — по Annex A.
* HEVC допускает dependent segments внутри IDR и явный pic_output_flag=1;
* первый слайс независимый, адреса остальных — в границах CTB геометрии SPS.
@@ -16,7 +16,7 @@ struct call_video_bitstream {
};
int call_video_inspect_key(int codec, const uint8_t *data, size_t length, struct call_video_bitstream *out);
int call_video_check_key(const struct call_video_format *format, const uint8_t *data, size_t length);
/* KEY-проба 1280x720 либо 1920x1080, включая обратную ориентацию.
/* KEY-проба 1280x720 либо 1920x1080, включая обратную ориентацию. HEVC High tier — level 4.
* Буфер 8192 байт достаточен; возвращает размер или -1 с диагностикой. */
int call_video_probe_key(int codec, int profile, unsigned width, unsigned height, uint8_t *out, size_t capacity);
#ifdef __cplusplus
+15 -3
View File
@@ -29,9 +29,18 @@ static void capabilities(void) {
CHECK(decoded.decode[1].pixels_per_second == b.decode[1].pixels_per_second && !decoded.encode[0].width);
CHECK(decoded.decode[1].maximum_bps == 4000000 && decoded.decode[1].profiles == 1 && decoded.decode[1].level == 123);
CHECK(call_video_caps_parse(wire, 40, &decoded) == -1); // Старый wire format не поддерживается.
wire[63] = 2; CHECK(call_video_caps_parse(wire, sizeof(wire), &decoded) == -1); wire[63] = 1;
wire[63] = 4; CHECK(call_video_caps_parse(wire, sizeof(wire), &decoded) == -1); wire[63] = 1;
wire[0] = 0xff; struct call_video_caps saved = decoded;
CHECK(call_video_caps_parse(wire, sizeof(wire), &decoded) == -1 && !memcmp(&saved, &decoded, sizeof(saved)));
a.encode[1].profiles = CALL_VIDEO_MAIN_HIGH_TIER;
b.decode[1].pixels_per_second = limit.pixels_per_second;
CHECK(choose(&a, &b, CALL_VIDEO_H265, 640, 480, 30) == 0);
b.decode[1].profiles |= CALL_VIDEO_MAIN_HIGH_TIER;
struct call_video_format high = mode(CALL_VIDEO_H265, 640, 480, 30);
CHECK(call_video_choose(&a, &b, &high) == CALL_VIDEO_H265 && high.profile == CALL_VIDEO_MAIN_HIGH_TIER && high.level == 120);
CHECK(call_video_format_supported(&a, &b, &high));
high.level = 93; CHECK(!call_video_format_valid(&high));
b.decode[1].level = 93; CHECK(!call_video_caps_valid(&b));
puts("video: directional capabilities, HEVC preference, AVC fallback, pixel-rate limits PASS");
}
static void portrait_limits(void) {
@@ -159,7 +168,7 @@ static void rejected(void) {
static void bitstreams(void) {
uint8_t bytes[8192]; struct call_video_bitstream s;
for (int codec = 1; codec <= 2; ++codec) {
for (int profile = 1; profile <= (codec == 1 ? 2 : 1); ++profile)
for (int profile = 1; profile <= 2; ++profile)
for (int fullhd = 0; fullhd <= 1; ++fullhd) for (int portrait = 0; portrait <= 1; portrait++) {
unsigned w = fullhd ? 1920 : 1280, h = fullhd ? 1080 : 720;
int size = call_video_probe_key(codec, profile, portrait ? h : w, portrait ? w : h, bytes, sizeof(bytes)); CHECK(size > 0);
@@ -168,10 +177,13 @@ static void bitstreams(void) {
codec, profile, portrait ? h : w, portrait ? w : h, size);
CHECK(!inspected);
CHECK(s.width == (portrait ? h : w) && s.height == (portrait ? w : h)
&& s.profile == (unsigned)profile && s.level == (codec == 1 ? (fullhd ? 40u : 31u) : (fullhd ? 120u : 93u)));
&& s.profile == (unsigned)profile && s.level == (codec == 1 ? (fullhd ? 40u : 31u) : (fullhd || profile == 2 ? 120u : 93u)));
CHECK(s.dpb >= 3);
struct call_video_format f = {1, s.width, s.height, 30, 0, codec, s.level, 4000000, profile};
CHECK(!call_video_check_key(&f, bytes, size));
if (codec == CALL_VIDEO_H265 && profile == CALL_VIDEO_MAIN_HIGH_TIER) {
f.profile = CALL_VIDEO_MAIN; CHECK(call_video_check_key(&f, bytes, size) < 0); f.profile = profile;
}
f.width = 640; CHECK(call_video_check_key(&f, bytes, size) < 0);
struct call_video_bitstream saved = s;
for (int i = 0; i < 32; ++i) {