This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit 324617b26f4b4e074caff12af5d7493db16bec46
Author:     marcos ashton <[email protected]>
AuthorDate: Tue Mar 31 22:20:04 2026 +0100
Commit:     michaelni <[email protected]>
CommitDate: Thu Jul 2 13:48:58 2026 +0000

    tests/fate/libavutil: add FATE test for dovi_meta
    
    Test av_dovi_alloc, av_dovi_metadata_alloc, and av_dovi_find_level.
    Verifies that the four inline offset-based accessors (get_header,
    get_mapping, get_color, get_ext) return pointers consistent with
    the offset fields, that find_level returns the first matching ext
    block or NULL for a missing level, and OOM paths via av_max_alloc.
    
    Coverage for libavutil/dovi_meta.c: 63.16% -> 100.00%
---
 .forgejo/CODEOWNERS         |   2 +
 libavutil/Makefile          |   1 +
 libavutil/tests/.gitignore  |   1 +
 libavutil/tests/dovi_meta.c | 138 ++++++++++++++++++++++++++++++++++++++++++++
 tests/fate/libavutil.mak    |   4 ++
 tests/ref/fate/dovi_meta    |  22 +++++++
 6 files changed, 168 insertions(+)

diff --git a/.forgejo/CODEOWNERS b/.forgejo/CODEOWNERS
index 3ada7b3e18..5d600d2593 100644
--- a/.forgejo/CODEOWNERS
+++ b/.forgejo/CODEOWNERS
@@ -235,6 +235,7 @@ tests/checkasm/riscv/.* @Courmisch
 libavutil/tests/ambient_viewing_environment.* @MarcosAsh
 libavutil/tests/buffer.* @MarcosAsh
 libavutil/tests/csp.* @MarcosAsh
+libavutil/tests/dovi_meta.* @MarcosAsh
 libavutil/tests/hdr_dynamic_vivid_metadata.* @MarcosAsh
 libavutil/tests/tdrdi.* @MarcosAsh
 libavutil/tests/timestamp.* @MarcosAsh
@@ -242,6 +243,7 @@ tests/ref/.*drawvg.* @ayosec
 tests/ref/fate/ambient_viewing_environment @MarcosAsh
 tests/ref/fate/buffer @MarcosAsh
 tests/ref/fate/csp @MarcosAsh
+tests/ref/fate/dovi_meta @MarcosAsh
 tests/ref/fate/hdr_dynamic_vivid_metadata @MarcosAsh
 tests/ref/fate/sub-mcc.* @programmerjake
 tests/ref/fate/tdrdi @MarcosAsh
diff --git a/libavutil/Makefile b/libavutil/Makefile
index 2e8a5de551..5aed6900e6 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -278,6 +278,7 @@ TESTPROGS = adler32                                         
            \
             detection_bbox                                              \
             dict                                                        \
             display                                                     \
+            dovi_meta                                                   \
             encryption_info                                             \
             error                                                       \
             eval                                                        \
diff --git a/libavutil/tests/.gitignore b/libavutil/tests/.gitignore
index 38aa09022b..0b66e4b662 100644
--- a/libavutil/tests/.gitignore
+++ b/libavutil/tests/.gitignore
@@ -21,6 +21,7 @@
 /detection_bbox
 /dict
 /display
+/dovi_meta
 /error
 /encryption_info
 /eval
diff --git a/libavutil/tests/dovi_meta.c b/libavutil/tests/dovi_meta.c
new file mode 100644
index 0000000000..cddc627ca9
--- /dev/null
+++ b/libavutil/tests/dovi_meta.c
@@ -0,0 +1,138 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <limits.h>
+#include <stdint.h>
+#include <stdio.h>
+
+#include "libavutil/dovi_meta.h"
+#include "libavutil/mem.h"
+
+int main(void)
+{
+    AVDOVIDecoderConfigurationRecord *cfg;
+    AVDOVIMetadata *md;
+    size_t size;
+
+    /* av_dovi_alloc */
+    printf("Testing av_dovi_alloc()\n");
+    cfg = av_dovi_alloc(&size);
+    if (cfg) {
+        printf("alloc: OK, size>0=%s, dv_profile=%d\n",
+               size > 0 ? "yes" : "no", cfg->dv_profile);
+        av_free(cfg);
+    } else {
+        printf("alloc: FAIL\n");
+    }
+
+    cfg = av_dovi_alloc(NULL);
+    printf("alloc (no size): %s\n", cfg ? "OK" : "FAIL");
+    av_free(cfg);
+
+    /* av_dovi_metadata_alloc */
+    printf("\nTesting av_dovi_metadata_alloc()\n");
+    md = av_dovi_metadata_alloc(&size);
+    if (md) {
+        AVDOVIRpuDataHeader *header;
+        AVDOVIDataMapping *mapping;
+        AVDOVIColorMetadata *color;
+
+        printf("alloc: OK, size>0=%s\n", size > 0 ? "yes" : "no");
+        printf("num_ext_blocks=%d\n", md->num_ext_blocks);
+
+        /* pointer consistency checks for inline accessors */
+        header = av_dovi_get_header(md);
+        if ((uint8_t *)header != (uint8_t *)md + md->header_offset)
+            printf("header: pointer inconsistent with header_offset\n");
+        printf("header_offset>0=%s, rpu_type=%d\n",
+               md->header_offset > 0 ? "yes" : "no",
+               header->rpu_type);
+
+        mapping = av_dovi_get_mapping(md);
+        if ((uint8_t *)mapping != (uint8_t *)md + md->mapping_offset)
+            printf("mapping: pointer inconsistent with mapping_offset\n");
+        printf("mapping_offset>0=%s, nlq_method_idc=%d\n",
+               md->mapping_offset > 0 ? "yes" : "no",
+               mapping->nlq_method_idc);
+
+        color = av_dovi_get_color(md);
+        if ((uint8_t *)color != (uint8_t *)md + md->color_offset)
+            printf("color: pointer inconsistent with color_offset\n");
+        printf("color_offset>0=%s, dm_metadata_id=%d\n",
+               md->color_offset > 0 ? "yes" : "no",
+               color->dm_metadata_id);
+
+        printf("ext_block_size>0=%s\n",
+               md->ext_block_size > 0 ? "yes" : "no");
+
+        av_free(md);
+    } else {
+        printf("alloc: FAIL\n");
+    }
+
+    md = av_dovi_metadata_alloc(NULL);
+    printf("alloc (no size): %s\n", md ? "OK" : "FAIL");
+    av_free(md);
+
+    /* av_dovi_find_level */
+    printf("\nTesting av_dovi_find_level()\n");
+    md = av_dovi_metadata_alloc(NULL);
+    if (md) {
+        AVDOVIDmData *ext, *found;
+
+        /* set up 3 ext blocks with different levels */
+        md->num_ext_blocks = 3;
+        ext = av_dovi_get_ext(md, 0);
+        if ((uint8_t *)ext != (uint8_t *)md + md->ext_block_offset)
+            printf("ext[0]: pointer inconsistent with ext_block_offset\n");
+        ext->level = 1;
+        ext = av_dovi_get_ext(md, 1);
+        ext->level = 5;
+        ext = av_dovi_get_ext(md, 2);
+        ext->level = 1;
+
+        found = av_dovi_find_level(md, 1);
+        printf("find level 1: %s\n", found && found->level == 1 ? "OK" : 
"FAIL");
+
+        found = av_dovi_find_level(md, 5);
+        printf("find level 5: %s\n", found && found->level == 5 ? "OK" : 
"FAIL");
+
+        /* first match -- should return ext[0], not ext[2] */
+        found = av_dovi_find_level(md, 1);
+        printf("find level 1 first match: %s\n",
+               found == av_dovi_get_ext(md, 0) ? "OK" : "FAIL");
+
+        found = av_dovi_find_level(md, 99);
+        printf("find level 99 (missing): %s\n", found == NULL ? "OK" : "FAIL");
+
+        av_free(md);
+    }
+
+    /* OOM paths via av_max_alloc */
+    printf("\nTesting OOM paths\n");
+    av_max_alloc(1);
+    cfg = av_dovi_alloc(&size);
+    printf("av_dovi_alloc OOM: %s\n", cfg ? "FAIL" : "OK");
+    av_free(cfg);
+    md = av_dovi_metadata_alloc(&size);
+    printf("av_dovi_metadata_alloc OOM: %s\n", md ? "FAIL" : "OK");
+    av_free(md);
+    av_max_alloc(INT_MAX);
+
+    return 0;
+}
diff --git a/tests/fate/libavutil.mak b/tests/fate/libavutil.mak
index a2ea57d939..1a31561b5e 100644
--- a/tests/fate/libavutil.mak
+++ b/tests/fate/libavutil.mak
@@ -90,6 +90,10 @@ FATE_LIBAVUTIL += fate-dict
 fate-dict: libavutil/tests/dict$(EXESUF)
 fate-dict: CMD = run libavutil/tests/dict$(EXESUF)
 
+FATE_LIBAVUTIL += fate-dovi_meta
+fate-dovi_meta: libavutil/tests/dovi_meta$(EXESUF)
+fate-dovi_meta: CMD = run libavutil/tests/dovi_meta$(EXESUF)
+
 FATE_LIBAVUTIL += fate-encryption-info
 fate-encryption-info: libavutil/tests/encryption_info$(EXESUF)
 fate-encryption-info: CMD = run libavutil/tests/encryption_info$(EXESUF)
diff --git a/tests/ref/fate/dovi_meta b/tests/ref/fate/dovi_meta
new file mode 100644
index 0000000000..3a5b07e01e
--- /dev/null
+++ b/tests/ref/fate/dovi_meta
@@ -0,0 +1,22 @@
+Testing av_dovi_alloc()
+alloc: OK, size>0=yes, dv_profile=0
+alloc (no size): OK
+
+Testing av_dovi_metadata_alloc()
+alloc: OK, size>0=yes
+num_ext_blocks=0
+header_offset>0=yes, rpu_type=0
+mapping_offset>0=yes, nlq_method_idc=0
+color_offset>0=yes, dm_metadata_id=0
+ext_block_size>0=yes
+alloc (no size): OK
+
+Testing av_dovi_find_level()
+find level 1: OK
+find level 5: OK
+find level 1 first match: OK
+find level 99 (missing): OK
+
+Testing OOM paths
+av_dovi_alloc OOM: OK
+av_dovi_metadata_alloc OOM: OK

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to