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 5BB4F42A1B for ; Mon, 11 Apr 2022 18:02:10 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1813D68B2E5; Mon, 11 Apr 2022 21:02:07 +0300 (EEST) Received: from mail-ot1-f49.google.com (mail-ot1-f49.google.com [209.85.210.49]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 85A08688154 for ; Mon, 11 Apr 2022 21:02:00 +0300 (EEST) Received: by mail-ot1-f49.google.com with SMTP id e25-20020a0568301e5900b005b236d5d74fso11858365otj.0 for ; Mon, 11 Apr 2022 11:02:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :references:from:in-reply-to:content-transfer-encoding; bh=Uf2zTWDg8+WWltt9l54v4C2Vf+0cOIwX3qPB5l3ZiM4=; b=h/yVzEgIaXH3B0jSiN7XMOpOK36ycTVxIlJhWMhSUpfdGfxn10OQ1fUPFv3DYgWTjP 4Tii3CmR7M7MtzJVhkknkhq2RZ71bbqiyleuzJg/irBiSep+TDIwNC9pszyOG36qCoHN 3DPftl3F/vmOaaIuR1sphBkKetgJb2O/Ynq7F9cEKKc4A6tRNr21D3eEjiVmA1uBhi/S 0n+xdmRc2PHWaK4NBnMTJQRAEDxJ5NEDt48W/IpRk1WPyKIHBrVp62S801tVPP7oma6H 20a6eZwd32VLEGLjcWNw+9S+0SYx2o8r4aO8H9rURjGPMApPlWyJjRrZ+wwn5hv7WZkn l1Cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=Uf2zTWDg8+WWltt9l54v4C2Vf+0cOIwX3qPB5l3ZiM4=; b=v+GoEG93oUilEPcDlbzixtMA4GqG7KlL+Y3vQPGQNQ/YpIwvKKyuQDhmjFL/UKuDtd 8u1rtvFNbAAG0ByjZt0g59dPi0dB4HGnz2wxS0O6jh170+PL4tivTEKYDNRhCSDFeEuO W5rZWgK+aki5tQYBIju0s+MtzQ3SgzzC45sdQlSm86yELYnOIxSakRPjJ7cOZ5ziY4ed AGKl4BWifrcHDQZ7G3r06EztvcMMCXWtlfOtxrowXNCMxCboXvC8USxCFiN/78rGVJj6 9cg2L/2h25UJqsVdqbnlgQjIHMY49sVx+QDtLOwLUJEmV6QPTzGnt9bYQ239KLDO6Cw4 lWdA== X-Gm-Message-State: AOAM5325vkPJq+FJmw8wE+usygNLLVWB/aW0wozAt3fsjsRqtkX3IVuN 2wnd8wwKfjXDwXh71rDSMzr2Nj97j4A= X-Google-Smtp-Source: ABdhPJwv6Q5+x/4iHrfT0DXOzWpU4/wvnv62vgKCM2I/4BfQcHC9NApj9SGJPK98brChJaOil0I2iw== X-Received: by 2002:a9d:1e3:0:b0:5cb:425d:fd24 with SMTP id e90-20020a9d01e3000000b005cb425dfd24mr11886807ote.50.1649700118007; Mon, 11 Apr 2022 11:01:58 -0700 (PDT) Received: from [192.168.0.12] ([186.136.131.95]) by smtp.gmail.com with ESMTPSA id g6-20020a056870a24600b000da0df8b3cesm11982459oai.20.2022.04.11.11.01.56 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 11 Apr 2022 11:01:57 -0700 (PDT) Message-ID: <94526f48-fe7b-aa08-0e97-fc705b51d518@gmail.com> Date: Mon, 11 Apr 2022 15:01:57 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Content-Language: en-US To: ffmpeg-devel@ffmpeg.org References: <20220411133148.10292-1-michael@niedermayer.cc> From: James Almer In-Reply-To: <20220411133148.10292-1-michael@niedermayer.cc> Subject: Re: [FFmpeg-devel] [PATCH] avfilter/vf_frei0r: Copy to frame allocated according to frei0r requirements 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 4/11/2022 10:31 AM, Michael Niedermayer wrote: > Fixes: issues with non trivial linesize > > Signed-off-by: Michael Niedermayer > --- > libavfilter/vf_frei0r.c | 40 ++++++++++++++++++++++++++++++++-------- > 1 file changed, 32 insertions(+), 8 deletions(-) > > diff --git a/libavfilter/vf_frei0r.c b/libavfilter/vf_frei0r.c > index 9cd0098e73..c9b698897f 100644 > --- a/libavfilter/vf_frei0r.c > +++ b/libavfilter/vf_frei0r.c > @@ -349,18 +349,41 @@ static int query_formats(AVFilterContext *ctx) > return ff_set_common_formats(ctx, formats); > } > > +static AVFrame *getframe(AVFilterLink *link) > +{ > + int ret; > + AVFrame *frame = av_frame_alloc(); > + if (!frame) > + return NULL; > + > + frame->width = link->w; > + frame->height = link->h; > + frame->format = link->format; > + ret = av_frame_get_buffer(frame, 16); Maybe ff_get_video_buffer can be updated to accept an align argument which would be used instead of av_cpu_max_align() when not 0, so we don't lose the benefits of the frame pool it provides? > + if (ret < 0) > + av_frame_free(&frame); > + > + return frame; > +} > + > static int filter_frame(AVFilterLink *inlink, AVFrame *in) > { > Frei0rContext *s = inlink->dst->priv; > AVFilterLink *outlink = inlink->dst->outputs[0]; > - AVFrame *out; > + AVFrame *out = getframe(outlink); > + if (!out) > + goto fail; > > - out = ff_get_video_buffer(outlink, outlink->w, outlink->h); > - if (!out) { > + av_frame_copy_props(out, in); > + > + if (in->linesize[0] != out->linesize[0]) { > + AVFrame *in2 = getframe(outlink); > + if (!in2) > + goto fail; > + av_frame_copy(in2, in); > av_frame_free(&in); > - return AVERROR(ENOMEM); > + in = in2; > } > - av_frame_copy_props(out, in); > > s->update(s->instance, in->pts * av_q2d(inlink->time_base) * 1000, > (const uint32_t *)in->data[0], > @@ -369,6 +392,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) > av_frame_free(&in); > > return ff_filter_frame(outlink, out); > +fail: > + av_frame_free(&in); > + av_frame_free(&out); > + return AVERROR(ENOMEM); > } > > static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, > @@ -473,9 +500,6 @@ static int source_request_frame(AVFilterLink *outlink) > frame->sample_aspect_ratio = (AVRational) {1, 1}; > frame->pts = s->pts++; > > - s->update(s->instance, av_rescale_q(frame->pts, s->time_base, (AVRational){1,1000}), > - NULL, (uint32_t *)frame->data[0]); > - > return ff_filter_frame(outlink, frame); > } > _______________________________________________ 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".