Share normative HRD limits with the bitstream validator

This commit is contained in:
evgeny committed 2026-10-14 23:15:11 +02:00
1 parent ea5ef4abc2
commit aad77cf415
2 files changed
+6

No files matched your search

+5
View File
@@ -119,6 +119,11 @@ unsigned call_video_dpb_limit(int codec, unsigned level, unsigned width, unsigne
unsigned frames = dpb_mbs[l - avc_levels] / (((width + 15) / 16) * ((height + 15) / 16));
return frames < 16 ? frames : 16;
}
int call_video_hrd_valid(int codec, unsigned level, int nal, uint64_t bitrate, uint64_t cpb) {
const struct video_level *l = level <= 255 ? level_find(codec, level) : NULL;
unsigned factor = nal ? (codec == CALL_VIDEO_H264 ? 1200 : 1100) : 1000;
return l && bitrate && cpb && bitrate <= (uint64_t)l->kbps * factor && cpb <= (uint64_t)l->cpb_kbits * factor;
}
int call_video_format_supported(const struct call_video_caps *sender, const struct call_video_caps *receiver,
const struct call_video_format *f) {
return call_video_caps_valid(sender) && call_video_caps_valid(receiver) && call_video_format_valid(f)
+1
View File
@@ -64,6 +64,7 @@ int call_video_format_supported(const struct call_video_caps *sender, const stru
int call_video_format_valid(const struct call_video_format *format);
/* Нормативный предел DPB в кадрах по coded geometry и level; 0 при неверном уровне. */
unsigned call_video_dpb_limit(int codec, unsigned level, unsigned width, unsigned height);
int call_video_hrd_valid(int codec, unsigned level, int nal, uint64_t bitrate, uint64_t cpb);
int call_video_same_format(const struct call_video_format *a, const struct call_video_format *b);
int call_video_caps_encode(const struct call_video_caps *caps, uint8_t out[CALL_VIDEO_CAPS_BYTES]);
int call_video_caps_parse(const uint8_t *data, size_t length, struct call_video_caps *out);