From fb660f2b3e4f04766df2adb2f37353776e769059 Mon Sep 17 00:00:00 2001 From: evgeny Date: Mon, 19 Oct 2026 22:35:56 +0200 Subject: [PATCH] Select verified KEY fixtures by actual video geometry --- src/call/call_video_bitstream.c | 16 ++++++++-- src/call/call_video_bitstream.h | 4 +-- src/call/call_video_fullhd_fixtures.h | 42 ++++++++++++++++++++++++--- 3 files changed, 54 insertions(+), 8 deletions(-) diff --git a/src/call/call_video_bitstream.c b/src/call/call_video_bitstream.c index cd6f086d..2db063c3 100644 --- a/src/call/call_video_bitstream.c +++ b/src/call/call_video_bitstream.c @@ -1,6 +1,7 @@ #include "call_video_bitstream.h" #include "call_video_fixtures.h" #include "call_video_portrait_fixtures.h" +#include "call_video_fullhd_fixtures.h" #include "../../lib/debug_config.h" #include "../../lib/mem.h" #include @@ -324,15 +325,26 @@ int call_video_check_key(const struct call_video_format *f, const uint8_t *data, } return 0; } -int call_video_probe_key(int codec, int profile, int portrait, uint8_t *out, size_t capacity) { +int call_video_probe_key(int codec, int profile, unsigned width, unsigned height, uint8_t *out, size_t capacity) { + const int portrait = height > width; + const unsigned wide = portrait ? height : width, short_side = portrait ? width : height; const uint8_t *data = codec == 1 ? call_video_fixture_1 : call_video_fixture_2; size_t size = codec == 1 ? sizeof(call_video_fixture_1) : sizeof(call_video_fixture_2); if (portrait) { data = codec == 1 ? call_video_portrait_1 : call_video_portrait_2; size = codec == 1 ? sizeof(call_video_portrait_1) : sizeof(call_video_portrait_2); } + if (wide == 1920 && short_side == 1080) { + if (portrait) { + data = codec == 1 ? call_video_fullhd_1080_1920_1 : call_video_fullhd_1080_1920_2; + size = codec == 1 ? sizeof(call_video_fullhd_1080_1920_1) : sizeof(call_video_fullhd_1080_1920_2); + } else { + data = codec == 1 ? call_video_fullhd_1920_1080_1 : call_video_fullhd_1920_1080_2; + size = codec == 1 ? sizeof(call_video_fullhd_1920_1080_1) : sizeof(call_video_fullhd_1920_1080_2); + } + } else if (wide != 1280 || short_side != 720) return bad("probe key geometry"); if ((codec != 1 && codec != 2) || (profile != 1 && !(codec == 1 && profile == 2)) - || (portrait != 0 && portrait != 1) || !out || capacity < size) + || !out || capacity < size) return bad("probe key arguments"); memcpy(out, data, size); if (codec == 1 && profile == 1) out[10] &= ~64u; diff --git a/src/call/call_video_bitstream.h b/src/call/call_video_bitstream.h index feb1d071..08ec636d 100644 --- a/src/call/call_video_bitstream.h +++ b/src/call/call_video_bitstream.h @@ -16,9 +16,9 @@ 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 (portrait=0) либо 720x1280 (portrait=1). +/* KEY-проба 1280x720 либо 1920x1080, включая обратную ориентацию. * Буфер 8192 байт достаточен; возвращает размер или -1 с диагностикой. */ -int call_video_probe_key(int codec, int profile, int portrait, uint8_t *out, size_t capacity); +int call_video_probe_key(int codec, int profile, unsigned width, unsigned height, uint8_t *out, size_t capacity); #ifdef __cplusplus } #endif diff --git a/src/call/call_video_fullhd_fixtures.h b/src/call/call_video_fullhd_fixtures.h index caf143b0..5da14b5c 100644 --- a/src/call/call_video_fullhd_fixtures.h +++ b/src/call/call_video_fullhd_fixtures.h @@ -1,6 +1,3 @@ -Warning: truncated output (original token count: 21079) -Total output lines: 693 - /* fullhd, 30 fps, gray YUV420, ref=3, no B: tools/generate_call_video_portrait.py --fullhd. * Configuration + IDR; SEI исключены. */ #ifndef CALL_VIDEO_FULLHD_FIXTURES_H @@ -329,7 +326,44 @@ static const uint8_t call_video_fullhd_1920_1080_2[] = { 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x0…1079 tokens truncated…d7, 0x5d, 0x75, 0xd7, 0x5d, 0x75, 0xd7, + 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, + 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, + 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, + 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, + 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, + 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, + 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, + 0x00, 0x03, 0x02, 0x0a, +}; +static const uint8_t call_video_fullhd_1080_1920_1[] = { + 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0xc0, 0x28, 0xd9, 0x00, 0x44, 0x03, 0xc7, 0x97, 0xc0, 0x44, + 0x00, 0x00, 0x03, 0x00, 0x04, 0x00, 0x00, 0x03, 0x00, 0xf2, 0x3c, 0x60, 0xc9, 0x20, 0x00, 0x00, 0x00, 0x01, 0x68, 0xcb, + 0x83, 0xf2, 0x00, 0x00, 0x00, 0x01, 0x65, 0x88, 0x84, 0x3a, 0x26, 0x28, 0x0c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, + 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, + 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, + 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9d, + 0x75, 0xd7, 0x5d, 0x75, 0xd7, 0x5d, 0x75, 0xd7, 0x5d, 0x75, 0xd7, 0x5d, 0x75, 0xd7, 0x5d, 0x75, 0xd7, 0x5d, 0x75, 0xd7, + 0x5d, 0x75, 0xd7, 0x5d, 0x75, 0xd7, 0x5d, 0x75, 0xd7, 0x5d, 0x75, 0xd7, 0x5d, 0x75, 0xd7, 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