diff mbox series

[FFmpeg-devel,v2,6/8] avcodec/dovi_rpu: add ext_blocks array to DOVIContext

Message ID 20240323192440.38264-7-ffmpeg@haasn.xyz
State Accepted
Commit 3a1916c38aa44374fbcc24ec647d0beaf6152deb
Headers show
Series Dolby Vision extension block parsing | expand

Checks

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

Commit Message

Niklas Haas March 23, 2024, 7:19 p.m. UTC
From: Niklas Haas <git@haasn.dev>

---
 libavcodec/dovi_rpu.c | 3 +++
 libavcodec/dovi_rpu.h | 6 ++++++
 2 files changed, 9 insertions(+)
diff mbox series

Patch

diff --git a/libavcodec/dovi_rpu.c b/libavcodec/dovi_rpu.c
index d584d99590a..6097bd5422f 100644
--- a/libavcodec/dovi_rpu.c
+++ b/libavcodec/dovi_rpu.c
@@ -47,6 +47,7 @@  void ff_dovi_ctx_unref(DOVIContext *s)
 {
     for (int i = 0; i < FF_ARRAY_ELEMS(s->vdr); i++)
         ff_refstruct_unref(&s->vdr[i]);
+    ff_refstruct_unref(&s->ext_blocks);
     av_free(s->rpu_buf);
 
     *s = (DOVIContext) {
@@ -58,6 +59,7 @@  void ff_dovi_ctx_flush(DOVIContext *s)
 {
     for (int i = 0; i < FF_ARRAY_ELEMS(s->vdr); i++)
         ff_refstruct_unref(&s->vdr[i]);
+    ff_refstruct_unref(&s->ext_blocks);
 
     *s = (DOVIContext) {
         .logctx = s->logctx,
@@ -76,6 +78,7 @@  void ff_dovi_ctx_replace(DOVIContext *s, const DOVIContext *s0)
     s->dv_profile = s0->dv_profile;
     for (int i = 0; i <= DOVI_MAX_DM_ID; i++)
         ff_refstruct_replace(&s->vdr[i], s0->vdr[i]);
+    ff_refstruct_replace(&s->ext_blocks, s0->ext_blocks);
 }
 
 void ff_dovi_update_cfg(DOVIContext *s, const AVDOVIDecoderConfigurationRecord *cfg)
diff --git a/libavcodec/dovi_rpu.h b/libavcodec/dovi_rpu.h
index 8dcc65bb40a..9f26f332ceb 100644
--- a/libavcodec/dovi_rpu.h
+++ b/libavcodec/dovi_rpu.h
@@ -44,6 +44,12 @@  typedef struct DOVIContext {
     const AVDOVIDataMapping *mapping;
     const AVDOVIColorMetadata *color;
 
+    /**
+     * Currently active extension blocks, updates on every ff_dovi_rpu_parse()
+     */
+    AVDOVIDmData *ext_blocks;
+    int num_ext_blocks;
+
     /**
      * Private fields internal to dovi_rpu.c
      */