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

Git pushed a commit to branch master
in repository ffmpeg.

commit 215799e369c80cfa3e54239ea9eed334fdd5709a
Author:     marcos ashton <[email protected]>
AuthorDate: Thu Apr 9 15:31:50 2026 +0100
Commit:     michaelni <[email protected]>
CommitDate: Tue Apr 28 16:17:47 2026 +0000

    tests/fate/libavutil: add FATE test for hdr_dynamic_vivid_metadata
    
    Test av_dynamic_hdr_vivid_alloc and
    av_dynamic_hdr_vivid_create_side_data. Verifies zero defaults,
    write/read-back of system_start_code, num_windows, and
    color transform params (min/avg/var/max RGB), frame side
    data attachment, and OOM paths via av_max_alloc.
    
    Coverage for libavutil/hdr_dynamic_vivid_metadata.c: 0.00% -> 100.00%
---
 .forgejo/CODEOWNERS                          |   2 +
 libavutil/Makefile                           |   1 +
 libavutil/tests/hdr_dynamic_vivid_metadata.c | 100 +++++++++++++++++++++++++++
 tests/fate/libavutil.mak                     |   4 ++
 tests/ref/fate/hdr_dynamic_vivid_metadata    |  14 ++++
 5 files changed, 121 insertions(+)

diff --git a/.forgejo/CODEOWNERS b/.forgejo/CODEOWNERS
index 96bee17dff..65976a6d61 100644
--- a/.forgejo/CODEOWNERS
+++ b/.forgejo/CODEOWNERS
@@ -233,8 +233,10 @@ doc/.* @GyanD
 # =====
 tests/checkasm/riscv/.* @Courmisch
 libavutil/tests/buffer.* @MarcosAsh
+libavutil/tests/hdr_dynamic_vivid_metadata.* @MarcosAsh
 tests/ref/.*drawvg.* @ayosec
 tests/ref/fate/buffer @MarcosAsh
+tests/ref/fate/hdr_dynamic_vivid_metadata @MarcosAsh
 tests/ref/fate/sub-mcc.* @programmerjake
 
 # Forgejo
diff --git a/libavutil/Makefile b/libavutil/Makefile
index 903e5cdcad..122123f375 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -281,6 +281,7 @@ TESTPROGS = adler32                                         
            \
             fifo                                                        \
             film_grain_params                                           \
             hash                                                        \
+            hdr_dynamic_vivid_metadata                                  \
             hmac                                                        \
             hwdevice                                                    \
             integer                                                     \
diff --git a/libavutil/tests/hdr_dynamic_vivid_metadata.c 
b/libavutil/tests/hdr_dynamic_vivid_metadata.c
new file mode 100644
index 0000000000..ece1f5b29f
--- /dev/null
+++ b/libavutil/tests/hdr_dynamic_vivid_metadata.c
@@ -0,0 +1,100 @@
+/*
+ * 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 <stdio.h>
+
+#include "libavutil/frame.h"
+#include "libavutil/hdr_dynamic_vivid_metadata.h"
+#include "libavutil/mem.h"
+
+int main(void)
+{
+    AVDynamicHDRVivid *vivid;
+    AVFrame *frame;
+    size_t size;
+
+    /* av_dynamic_hdr_vivid_alloc */
+    printf("Testing av_dynamic_hdr_vivid_alloc()\n");
+    vivid = av_dynamic_hdr_vivid_alloc(&size);
+    if (vivid) {
+        printf("alloc: OK, size>0=%s\n", size > 0 ? "yes" : "no");
+        printf("defaults: system_start_code=%u, num_windows=%u\n",
+               vivid->system_start_code, vivid->num_windows);
+
+        /* write and read back */
+        vivid->system_start_code = 0x01;
+        vivid->num_windows = 1;
+        vivid->params[0].minimum_maxrgb = (AVRational){ 100, 1 };
+        vivid->params[0].average_maxrgb = (AVRational){ 500, 1 };
+        vivid->params[0].variance_maxrgb = (AVRational){ 200, 1 };
+        vivid->params[0].maximum_maxrgb = (AVRational){ 1000, 1 };
+        printf("write: system_start_code=%u, num_windows=%u\n",
+               vivid->system_start_code, vivid->num_windows);
+        printf("params[0]: min=%d/%d avg=%d/%d var=%d/%d max=%d/%d\n",
+               vivid->params[0].minimum_maxrgb.num,
+               vivid->params[0].minimum_maxrgb.den,
+               vivid->params[0].average_maxrgb.num,
+               vivid->params[0].average_maxrgb.den,
+               vivid->params[0].variance_maxrgb.num,
+               vivid->params[0].variance_maxrgb.den,
+               vivid->params[0].maximum_maxrgb.num,
+               vivid->params[0].maximum_maxrgb.den);
+        av_free(vivid);
+    }
+
+    /* alloc with NULL size */
+    vivid = av_dynamic_hdr_vivid_alloc(NULL);
+    printf("alloc (no size): %s\n", vivid ? "OK" : "FAIL");
+    av_free(vivid);
+
+    /* av_dynamic_hdr_vivid_create_side_data */
+    printf("\nTesting av_dynamic_hdr_vivid_create_side_data()\n");
+    frame = av_frame_alloc();
+    if (frame) {
+        vivid = av_dynamic_hdr_vivid_create_side_data(frame);
+        if (vivid) {
+            printf("side_data: OK\n");
+            vivid->system_start_code = 0x02;
+            printf("side_data write: system_start_code=%u\n",
+                   vivid->system_start_code);
+        } else {
+            printf("side_data: FAIL\n");
+        }
+        av_frame_free(&frame);
+    }
+
+    /* OOM paths via av_max_alloc */
+    printf("\nTesting OOM paths\n");
+    av_max_alloc(1);
+    vivid = av_dynamic_hdr_vivid_alloc(&size);
+    printf("alloc OOM: %s\n", vivid ? "FAIL" : "OK");
+    av_free(vivid);
+    av_max_alloc(INT_MAX);
+
+    frame = av_frame_alloc();
+    if (frame) {
+        av_max_alloc(1);
+        vivid = av_dynamic_hdr_vivid_create_side_data(frame);
+        printf("side_data OOM: %s\n", vivid ? "FAIL" : "OK");
+        av_max_alloc(INT_MAX);
+        av_frame_free(&frame);
+    }
+
+    return 0;
+}
diff --git a/tests/fate/libavutil.mak b/tests/fate/libavutil.mak
index af78a803e5..f29fab29b4 100644
--- a/tests/fate/libavutil.mak
+++ b/tests/fate/libavutil.mak
@@ -103,6 +103,10 @@ FATE_LIBAVUTIL += fate-hash
 fate-hash: libavutil/tests/hash$(EXESUF)
 fate-hash: CMD = run libavutil/tests/hash$(EXESUF)
 
+FATE_LIBAVUTIL += fate-hdr_dynamic_vivid_metadata
+fate-hdr_dynamic_vivid_metadata: 
libavutil/tests/hdr_dynamic_vivid_metadata$(EXESUF)
+fate-hdr_dynamic_vivid_metadata: CMD = run 
libavutil/tests/hdr_dynamic_vivid_metadata$(EXESUF)
+
 FATE_LIBAVUTIL += fate-hmac
 fate-hmac: libavutil/tests/hmac$(EXESUF)
 fate-hmac: CMD = run libavutil/tests/hmac$(EXESUF)
diff --git a/tests/ref/fate/hdr_dynamic_vivid_metadata 
b/tests/ref/fate/hdr_dynamic_vivid_metadata
new file mode 100644
index 0000000000..f4e8c4f811
--- /dev/null
+++ b/tests/ref/fate/hdr_dynamic_vivid_metadata
@@ -0,0 +1,14 @@
+Testing av_dynamic_hdr_vivid_alloc()
+alloc: OK, size>0=yes
+defaults: system_start_code=0, num_windows=0
+write: system_start_code=1, num_windows=1
+params[0]: min=100/1 avg=500/1 var=200/1 max=1000/1
+alloc (no size): OK
+
+Testing av_dynamic_hdr_vivid_create_side_data()
+side_data: OK
+side_data write: system_start_code=2
+
+Testing OOM paths
+alloc OOM: OK
+side_data OOM: OK

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

Reply via email to