diff mbox series

[FFmpeg-devel,2/2] avcodec/av1dec: make CBS parse only the OBU types we care about

Message ID 20230307120551.461-1-jamrial@gmail.com
State Accepted
Commit 68a858fcc913c4939798c7b6580a814184a1089b
Headers show
Series [FFmpeg-devel] avcodec/av1dec: parse and export Metadata OBUs | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

James Almer March 7, 2023, 12:05 p.m. UTC
Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/av1dec.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
diff mbox series

Patch

diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c
index 87b63eef84..a0720454c9 100644
--- a/libavcodec/av1dec.c
+++ b/libavcodec/av1dec.c
@@ -752,6 +752,16 @@  static int update_context_with_frame_header(AVCodecContext *avctx,
     return 0;
 }
 
+static const CodedBitstreamUnitType decompose_unit_types[] = {
+    AV1_OBU_FRAME,
+    AV1_OBU_FRAME_HEADER,
+    AV1_OBU_METADATA,
+    AV1_OBU_REDUNDANT_FRAME_HEADER,
+    AV1_OBU_SEQUENCE_HEADER,
+    AV1_OBU_TEMPORAL_DELIMITER,
+    AV1_OBU_TILE_GROUP,
+};
+
 static av_cold int av1_decode_init(AVCodecContext *avctx)
 {
     AV1DecContext *s = avctx->priv_data;
@@ -781,6 +791,9 @@  static av_cold int av1_decode_init(AVCodecContext *avctx)
     if (ret < 0)
         return ret;
 
+    s->cbc->decompose_unit_types    = decompose_unit_types;
+    s->cbc->nb_decompose_unit_types = FF_ARRAY_ELEMS(decompose_unit_types);
+
     s->itut_t35_fifo = av_fifo_alloc2(1, sizeof(AV1RawMetadataITUTT35),
                                       AV_FIFO_FLAG_AUTO_GROW);
     if (!s->itut_t35_fifo)