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 74E134435D for ; Tue, 6 Sep 2022 12:19:39 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4DE5F68BB3B; Tue, 6 Sep 2022 15:19:36 +0300 (EEST) Received: from mail-oa1-f47.google.com (mail-oa1-f47.google.com [209.85.160.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id F3CBD68B20B for ; Tue, 6 Sep 2022 15:19:29 +0300 (EEST) Received: by mail-oa1-f47.google.com with SMTP id 586e51a60fabf-127dca21a7dso362104fac.12 for ; Tue, 06 Sep 2022 05:19:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:references:to:from :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date; bh=Lngaud/8fX4gnRYHXmKzYGivVHi4SImAd2gAqKeS6yo=; b=c4tbZk+j3zGkl1YogMz0JCa+ctXAOFZ5HeaZYylvcqZccN8HiibNEz/Ba5SFomxSdJ DhpfgbqIrd2iFMcAqqkW1Ai655PCFEhpjf7ijBIqUtuZucUqiqjCidM+dAJv3W3l/Gqp NlaAcA7TjsMpf48VGRzls+9f0tGS4gAG5FoOmvEdnUpNIyujphvL7CphMevFtqKVHOjG 9vkjyqQre7f15UASTrcbuBonJupAoLbAzJLBcB9jKI05jrIbf6xwIR/MYN6ISGVu//+D nYIL5hlFkvXm53QpgJnMnRUK9dcfAB98gWZBxh7Sh2c7Kitg1a+GLbB4rOszIPmO61Hn 58Uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:references:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date; bh=Lngaud/8fX4gnRYHXmKzYGivVHi4SImAd2gAqKeS6yo=; b=K5Szp9WPCkMAgfyNj3IutI4hNmdLpGhE9HaW870TaOioQ5Lo5Ms40tT2CYbT+TkkTy 1KXECbGMO851CzTwccoM2E+YRFPiOYLkrRKSbLSilsfijZRwrgocXf6SakLc7RVLQrU8 GSMGicFsa/ephaVKiLjavm5qT/S4LqbNNlalEAQo/DCL8G8W5wZFPNHEeqlgPsl0Xekf DSG9Bv5b0q6cBnp+8fLr7HItVI5SGyaDz4ukMBieipgn+JFBehStLrwIT52ZAyCL0Pba ihlCgQuBqCfsGOvL/JjGa8mW0zDRjjbkz5bql3jQLJVZ4wl8Upr+EByz705EIP9H8Fxi tdqw== X-Gm-Message-State: ACgBeo0EXxu0BbvhRZEG8HCpEVPb0JxhJ8JzSbkLlte8BRB+lhY3NJoG hA9Dv2k6uyHG/kZwEIQ8NVnA0/oEfHk= X-Google-Smtp-Source: AA6agR4ARUCXN/xjM16xqBFyH69S8nr5uFqhDXK/EZeGrzbaBNzBLSnVfkmYjlhL5B2wbaFlrId0xg== X-Received: by 2002:a05:6808:300f:b0:2f9:81c1:7691 with SMTP id ay15-20020a056808300f00b002f981c17691mr9793654oib.208.1662466768096; Tue, 06 Sep 2022 05:19:28 -0700 (PDT) Received: from [192.168.0.11] ([191.97.187.183]) by smtp.gmail.com with ESMTPSA id k14-20020a4ab08e000000b0044893e6a2a4sm4039542oon.11.2022.09.06.05.19.26 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 06 Sep 2022 05:19:27 -0700 (PDT) Message-ID: <3984b025-1baf-07fb-e270-de7dde740975@gmail.com> Date: Tue, 6 Sep 2022 09:19:26 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.13.0 Content-Language: en-US From: James Almer To: ffmpeg-devel@ffmpeg.org References: <20220905025556.552-1-jamrial@gmail.com> In-Reply-To: <20220905025556.552-1-jamrial@gmail.com> Subject: Re: [FFmpeg-devel] [PATCH] avfilter/vf_scale: overwrite the width and eight expressions with the original values 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 9/4/2022 11:55 PM, James Almer wrote: > Instead of the potentially adjusted ones. Otherwise, if config_props() is > called again and if using force_original_aspect_ratio, the already adjusted > values could be altered again. > > Example command line > scale=size=1920x1000:force_original_aspect_ratio=decrease:force_divisible_by=2 > > user value 1920x1000 -> 1920x798 on init_dict() -> 1918x798 on frame > change when eval_mode == EVAL_MODE_INIT, which after e645a1ddb9 could be at the > very first frame. > > Signed-off-by: James Almer > --- > libavfilter/vf_scale.c | 20 ++++++++++---------- > 1 file changed, 10 insertions(+), 10 deletions(-) > > diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c > index 996f7aaa5b..2b12cf283c 100644 > --- a/libavfilter/vf_scale.c > +++ b/libavfilter/vf_scale.c > @@ -491,19 +491,19 @@ static int config_props(AVFilterLink *outlink) > if ((ret = scale_eval_dimensions(ctx)) < 0) > goto fail; > > - ff_scale_adjust_dimensions(inlink, &scale->w, &scale->h, > + outlink->w = scale->w; > + outlink->h = scale->h; > + > + ff_scale_adjust_dimensions(inlink, &outlink->w, &outlink->h, > scale->force_original_aspect_ratio, > scale->force_divisible_by); > > - if (scale->w > INT_MAX || > - scale->h > INT_MAX || > - (scale->h * inlink->w) > INT_MAX || > - (scale->w * inlink->h) > INT_MAX) > + if (outlink->w > INT_MAX || > + outlink->h > INT_MAX || > + (outlink->h * inlink->w) > INT_MAX || > + (outlink->w * inlink->h) > INT_MAX) > av_log(ctx, AV_LOG_ERROR, "Rescaled value for width or height is too big.\n"); > > - outlink->w = scale->w; > - outlink->h = scale->h; > - > /* TODO: make algorithm configurable */ > > scale->input_is_pal = desc->flags & AV_PIX_FMT_FLAG_PAL; > @@ -718,9 +718,9 @@ static int scale_frame(AVFilterLink *link, AVFrame *in, AVFrame **frame_out) > goto scale; > > if (scale->eval_mode == EVAL_MODE_INIT) { > - snprintf(buf, sizeof(buf)-1, "%d", outlink->w); > + snprintf(buf, sizeof(buf) - 1, "%d", scale->w); > av_opt_set(scale, "w", buf, 0); > - snprintf(buf, sizeof(buf)-1, "%d", outlink->h); > + snprintf(buf, sizeof(buf) - 1, "%d", scale->h); > av_opt_set(scale, "h", buf, 0); > > ret = scale_parse_expr(ctx, NULL, &scale->w_pexpr, "width", scale->w_expr); Will apply. _______________________________________________ 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".