This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 9b47495deefe5667f3a36ce2bad5dee70ed586bf Author: marcos ashton <[email protected]> AuthorDate: Thu Apr 9 15:32:33 2026 +0100 Commit: michaelni <[email protected]> CommitDate: Tue Apr 28 16:17:47 2026 +0000 tests/fate/libavutil: add FATE test for tdrdi Test av_tdrdi_alloc with 1 and 3 displays, and the inline av_tdrdi_get_display accessor. Verifies that the returned pointer matches entries_offset + idx * entry_size, tests write/read-back of display width exponent/mantissa and view ID fields, and OOM paths via av_max_alloc. Coverage for libavutil/tdrdi.c: 0.00% -> 100.00% --- .forgejo/CODEOWNERS | 2 ++ libavutil/Makefile | 1 + libavutil/tests/tdrdi.c | 92 ++++++++++++++++++++++++++++++++++++++++++++++++ tests/fate/libavutil.mak | 4 +++ tests/ref/fate/tdrdi | 14 ++++++++ 5 files changed, 113 insertions(+) diff --git a/.forgejo/CODEOWNERS b/.forgejo/CODEOWNERS index 65976a6d61..cd5fd87aa9 100644 --- a/.forgejo/CODEOWNERS +++ b/.forgejo/CODEOWNERS @@ -234,10 +234,12 @@ doc/.* @GyanD tests/checkasm/riscv/.* @Courmisch libavutil/tests/buffer.* @MarcosAsh libavutil/tests/hdr_dynamic_vivid_metadata.* @MarcosAsh +libavutil/tests/tdrdi.* @MarcosAsh tests/ref/.*drawvg.* @ayosec tests/ref/fate/buffer @MarcosAsh tests/ref/fate/hdr_dynamic_vivid_metadata @MarcosAsh tests/ref/fate/sub-mcc.* @programmerjake +tests/ref/fate/tdrdi @MarcosAsh # Forgejo # ======= diff --git a/libavutil/Makefile b/libavutil/Makefile index 122123f375..83ca133d04 100644 --- a/libavutil/Makefile +++ b/libavutil/Makefile @@ -309,6 +309,7 @@ TESTPROGS = adler32 \ softfloat \ spherical \ stereo3d \ + tdrdi \ timecode \ tree \ twofish \ diff --git a/libavutil/tests/tdrdi.c b/libavutil/tests/tdrdi.c new file mode 100644 index 0000000000..5daa32f404 --- /dev/null +++ b/libavutil/tests/tdrdi.c @@ -0,0 +1,92 @@ +/* + * 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/mem.h" +#include "libavutil/tdrdi.h" + +int main(void) +{ + AV3DReferenceDisplaysInfo *tdrdi; + AV3DReferenceDisplay *display; + size_t size; + + /* av_tdrdi_alloc with 1 display */ + printf("Testing av_tdrdi_alloc()\n"); + tdrdi = av_tdrdi_alloc(1, &size); + if (tdrdi) { + printf("alloc 1: size>0=%s, num_ref_displays=%u\n", + size > 0 ? "yes" : "no", tdrdi->num_ref_displays); + + display = av_tdrdi_get_display(tdrdi, 0); + /* pointer consistency check */ + if ((uint8_t *)display != (uint8_t *)tdrdi + tdrdi->entries_offset) + printf("display 0: pointer inconsistent with entries_offset\n"); + + /* write and read back */ + display->exponent_ref_display_width = 3; + display->mantissa_ref_display_width = 100; + display->left_view_id = 0; + display->right_view_id = 1; + display = av_tdrdi_get_display(tdrdi, 0); + printf("display 0: width_exp=%u width_man=%u left=%u right=%u\n", + display->exponent_ref_display_width, + display->mantissa_ref_display_width, + display->left_view_id, display->right_view_id); + av_free(tdrdi); + } + + /* alloc with multiple displays */ + printf("\nTesting multiple displays\n"); + tdrdi = av_tdrdi_alloc(3, &size); + if (tdrdi) { + printf("alloc 3: num_ref_displays=%u\n", tdrdi->num_ref_displays); + for (int i = 0; i < 3; i++) { + display = av_tdrdi_get_display(tdrdi, i); + /* verify stride consistency */ + if ((uint8_t *)display != (uint8_t *)tdrdi + tdrdi->entries_offset + + (size_t)i * tdrdi->entry_size) + printf("display %d: pointer inconsistent\n", i); + display->exponent_ref_display_width = i + 1; + } + for (int i = 0; i < 3; i++) { + display = av_tdrdi_get_display(tdrdi, i); + printf("display %d: width_exp=%u\n", i, + display->exponent_ref_display_width); + } + av_free(tdrdi); + } + + /* alloc with NULL size */ + tdrdi = av_tdrdi_alloc(1, NULL); + printf("\nalloc (no size): %s\n", tdrdi ? "OK" : "FAIL"); + av_free(tdrdi); + + /* OOM paths via av_max_alloc */ + printf("\nTesting OOM paths\n"); + av_max_alloc(1); + tdrdi = av_tdrdi_alloc(1, &size); + printf("alloc OOM: %s\n", tdrdi ? "FAIL" : "OK"); + av_free(tdrdi); + av_max_alloc(INT_MAX); + + return 0; +} diff --git a/tests/fate/libavutil.mak b/tests/fate/libavutil.mak index f29fab29b4..a83539a58f 100644 --- a/tests/fate/libavutil.mak +++ b/tests/fate/libavutil.mak @@ -188,6 +188,10 @@ FATE_LIBAVUTIL += fate-stereo3d fate-stereo3d: libavutil/tests/stereo3d$(EXESUF) fate-stereo3d: CMD = run libavutil/tests/stereo3d$(EXESUF) +FATE_LIBAVUTIL += fate-tdrdi +fate-tdrdi: libavutil/tests/tdrdi$(EXESUF) +fate-tdrdi: CMD = run libavutil/tests/tdrdi$(EXESUF) + FATE_LIBAVUTIL += fate-tree fate-tree: libavutil/tests/tree$(EXESUF) fate-tree: CMD = run libavutil/tests/tree$(EXESUF) diff --git a/tests/ref/fate/tdrdi b/tests/ref/fate/tdrdi new file mode 100644 index 0000000000..a94bf2e3b8 --- /dev/null +++ b/tests/ref/fate/tdrdi @@ -0,0 +1,14 @@ +Testing av_tdrdi_alloc() +alloc 1: size>0=yes, num_ref_displays=1 +display 0: width_exp=3 width_man=100 left=0 right=1 + +Testing multiple displays +alloc 3: num_ref_displays=3 +display 0: width_exp=1 +display 1: width_exp=2 +display 2: width_exp=3 + +alloc (no size): OK + +Testing OOM paths +alloc OOM: OK _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
