From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 9DD5A4B8EB for ; Tue, 18 Jun 2024 19:43:00 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id CA34668D778; Tue, 18 Jun 2024 22:42:35 +0300 (EEST) Received: from haasn.dev (haasn.dev [78.46.187.166]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4A76168D5B5 for ; Tue, 18 Jun 2024 22:42:24 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haasn.xyz; s=mail; t=1718739744; bh=YE49y59sPE9rVpxdT4D5GYWLVZIyF68syustNeNA/Uc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YmdbSsM4pmWg+iP0sefOdeA77iZV80ReABDyIPZFIwOIO6oy9T6IRBpxEyuNhBZWv TzXaNQ2v/p0/6POT5x/nbgqNkRq+zFZu5r34DxGRkZuwY0ERWUF1AA0SPaqblzVN6r SWVhL8XZY4pg2t7hj62tO0hlhvDhHLfKIjewtMmc= Received: from haasn.dev (unknown [10.30.0.2]) by haasn.dev (Postfix) with ESMTP id 09B6D42835; Tue, 18 Jun 2024 21:42:24 +0200 (CEST) From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Tue, 18 Jun 2024 21:35:33 +0200 Message-ID: <20240618194221.26073-4-ffmpeg@haasn.xyz> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240618194221.26073-1-ffmpeg@haasn.xyz> References: <20240618194221.26073-1-ffmpeg@haasn.xyz> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/8] avcodec/dovi_rpuenc: try to re-use existing vdr_rpu_id X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Niklas Haas Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: From: Niklas Haas 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 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".