diff mbox series

[FFmpeg-devel,4/6] avcodec/av1: Add upper bound for the size of a sane sequence header

Message ID DB6PR0101MB22143E20A60A1DED534E72728FB39@DB6PR0101MB2214.eurprd01.prod.exchangelabs.com
State Accepted
Commit a367e435d816dfe6939ab9932e87c089fb1f3f73
Headers show
Series [FFmpeg-devel,1/6] avformat/matroskaenc: Split assembling CodecPrivate from writing it | expand

Checks

Context Check Description
yinshiyou/configure_loongarch64 warning Failed to apply patch
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Andreas Rheinhardt June 21, 2022, 2:34 a.m. UTC
It will be used by the Matroska muxer to reserve a certain number
of bytes for the CodecPrivate in case no extradata is initially
available (as it is for the libaom-av1 encoder).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/av1.h | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/libavcodec/av1.h b/libavcodec/av1.h
index 951a18ecb2..384f7cddc7 100644
--- a/libavcodec/av1.h
+++ b/libavcodec/av1.h
@@ -175,4 +175,10 @@  enum {
     AV1_RESTORE_SWITCHABLE = 3,
 };
 
+// Sequence Headers are actually unbounded because one can use
+// an arbitrary number of leading zeroes when encoding via uvlc.
+// The following estimate is based around using the lowest number
+// of bits for uvlc encoding.
+#define AV1_SANE_SEQUENCE_HEADER_MAX_BITS           3138
+
 #endif /* AVCODEC_AV1_H */