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 992DD48869 for ; Tue, 18 Jun 2024 19:59:38 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3D47468D5B0; Tue, 18 Jun 2024 22:59:34 +0300 (EEST) Received: from haasn.dev (haasn.dev [78.46.187.166]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 869F768CA80 for ; Tue, 18 Jun 2024 22:59:27 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haasn.xyz; s=mail; t=1718740203; bh=Nu9iw9+GSC2qO20+Ex+s5CKMba+LW8JE2VP1sv0scrs=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Gf45/lq60s9bXJzXMVuI7L9q0X6Zv5w2vJdlo6so/N9ntt0pPJuVh9mqjtOqJeibr goTvshrqofTRwrFdJWpkwLeqL4vRWK+nOI5bnQCC5ohRz6h+IfXrjPzYxL3Aq/ltPb BjuhUGOmT3hCmByH4U/s87cc69Cm6CJ2cd5OmiB4= Received: from haasn.dev (unknown [10.30.0.2]) by haasn.dev (Postfix) with ESMTP id B8A53403F0; Tue, 18 Jun 2024 21:50:03 +0200 (CEST) Date: Tue, 18 Jun 2024 21:50:03 +0200 Message-ID: <20240618215003.GB26831@haasn.xyz> From: Niklas Haas To: ffmpeg-devel@ffmpeg.org In-Reply-To: <20240618194221.26073-4-ffmpeg@haasn.xyz> References: <20240618194221.26073-1-ffmpeg@haasn.xyz> <20240618194221.26073-4-ffmpeg@haasn.xyz> MIME-Version: 1.0 Content-Disposition: inline Subject: Re: [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: On Tue, 18 Jun 2024 21:35:33 +0200 Niklas Haas wrote: > 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 > I just noticed this check is wrong either way, because the `vdr_rpu_id` is also included as part of `mapping`. If we reshuffle VDR IDs, we also need to change the contents of `mapping` when updating the vdrs, as well as omitting it when doing the `memcmp`. Effectively this loop currently does nothing, since the only field that can succeed is in the case `i == mapping->vdr_rpu_id`. Will fix for v2. _______________________________________________ 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".