[FFmpeg-devel] [PATCH 3/8] avcodec/dovi_rpuenc: try to re-use existing vdr_rpu_id
Niklas Haas
ffmpeg at haasn.xyz
Tue Jun 18 22:35:33 EEST 2024
From: Niklas Haas <git at haasn.dev>
And only override it if we either have an exact match, or if we still
have unused metadata slots (to avoid an overwrite).
---
libavcodec/dovi_rpuenc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavcodec/dovi_rpuenc.c b/libavcodec/dovi_rpuenc.c
index 45fcd9a86c..0d49a128fd 100644
--- a/libavcodec/dovi_rpuenc.c
+++ b/libavcodec/dovi_rpuenc.c
@@ -463,12 +463,12 @@ int ff_dovi_rpu_generate(DOVIContext *s, const AVDOVIMetadata *metadata,
return AVERROR_INVALIDDATA;
}
- vdr_rpu_id = -1;
+ vdr_rpu_id = mapping->vdr_rpu_id;
for (int i = 0; i <= DOVI_MAX_DM_ID; i++) {
if (s->vdr[i] && !memcmp(s->vdr[i], mapping, sizeof(*mapping))) {
vdr_rpu_id = i;
break;
- } else if (vdr_rpu_id < 0 && (!s->vdr[i] || i == DOVI_MAX_DM_ID)) {
+ } else if (s->vdr[vdr_rpu_id] && !s->vdr[i]) {
vdr_rpu_id = i;
}
}
--
2.45.1
More information about the ffmpeg-devel
mailing list