From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 7CB514F3F3 for ; Mon, 16 Jun 2025 18:42:36 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 5950868DE25; Mon, 16 Jun 2025 21:42:32 +0300 (EEST) Received: from mout-p-103.mailbox.org (mout-p-103.mailbox.org [80.241.56.161]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 6292D68DAD5 for ; Mon, 16 Jun 2025 21:42:26 +0300 (EEST) Received: from smtp2.mailbox.org (smtp2.mailbox.org [10.196.197.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-103.mailbox.org (Postfix) with ESMTPS id 4bLf4b17GYz9scQ for ; Mon, 16 Jun 2025 20:42:23 +0200 (CEST) Message-ID: <1f947b78-683f-44cc-9a8d-a8a39cc5e62b@gyani.pro> Date: Tue, 17 Jun 2025 00:12:20 +0530 MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org References: <20250616180457.140213-1-ffmpeg@haasn.xyz> Content-Language: en-US From: Gyan Doshi In-Reply-To: <20250616180457.140213-1-ffmpeg@haasn.xyz> Subject: Re: [FFmpeg-devel] [PATCH] avfilter/vf_scale: set correct AVFrame SAR if reset_sar=1 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 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 2025-06-16 11:34 pm, Niklas Haas wrote: > From: Niklas Haas > > This otherwise generates an inconsistency between the frame state and the > link state, since the link state is set to 1:1 explicitly when `reset_sar` > is enabled, but this line of code unconditionally overwrote the output > frame SAR with the value that would be computed in the absence of `reset_sar`. > > cf. vf_scale_cuda, which does this correctly > --- > libavfilter/vf_scale.c | 12 ++++++++---- > 1 file changed, 8 insertions(+), 4 deletions(-) > > diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c > index 62aa872c77..aec765b441 100644 > --- a/libavfilter/vf_scale.c > +++ b/libavfilter/vf_scale.c > @@ -854,10 +854,14 @@ scale: > AV_SIDE_DATA_PROP_COLOR_DEPENDENT); > } > > - av_reduce(&out->sample_aspect_ratio.num, &out->sample_aspect_ratio.den, > - (int64_t)in->sample_aspect_ratio.num * outlink->h * link->w, > - (int64_t)in->sample_aspect_ratio.den * outlink->w * link->h, > - INT_MAX); > + if (scale->reset_sar) { > + out->sample_aspect_ratio = outlink->sample_aspect_ratio; > + } else { > + av_reduce(&out->sample_aspect_ratio.num, &out->sample_aspect_ratio.den, > + (int64_t)in->sample_aspect_ratio.num * outlink->h * link->w, > + (int64_t)in->sample_aspect_ratio.den * outlink->w * link->h, > + INT_MAX); > + } > > if (sws_is_noop(out, in)) { > av_frame_free(&out); LGTM Regards, Gyan _______________________________________________ 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".