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 62FB742A14 for ; Mon, 11 Apr 2022 17:32:33 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C245868B297; Mon, 11 Apr 2022 20:32:30 +0300 (EEST) Received: from mail-yb1-f170.google.com (mail-yb1-f170.google.com [209.85.219.170]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 84290688166 for ; Mon, 11 Apr 2022 20:32:24 +0300 (EEST) Received: by mail-yb1-f170.google.com with SMTP id v77so10659419ybi.12 for ; Mon, 11 Apr 2022 10:32:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=w0ECLUTviYU4HDt2FhLUOkp4uXXJpJbBMXH4l5F3wBU=; b=gVFRYr7GVYh5Cfw+XSDQ4GQ+92DX9Lem1W0jA7Wo9D6RZ8JzUw0xpHF6jdr6g3wasg rYEAoRDEhvoXdpBES0uEgr1SM10vnSqmC2iHdpRLP3syjkfJlXKvZxvLNMZ82mybIj5u sE5w9L85Veq3J3ryJa/PhXOYAdXYDBw9p+sI6PzzAFlLpEiT2g2eZTyhuJYNOOh2rCtp z3FMEzGxAIHoEsT2R3QV1M8Aa5TdZkGW6KBosVnhoABae8CAWcO1bx0MpfS1Pgq0tIp0 Z6Cu90PHjdXqJpb3Sdrnmz/l2uhow37RHGkCcbEgL+4ia90c5bLx1VUcocf7cbBy4Q0E LZwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=w0ECLUTviYU4HDt2FhLUOkp4uXXJpJbBMXH4l5F3wBU=; b=Q5/q4bqAlA1Q6tsxgzWIGUJ5oluICz+yk8t7yIdK8Kfp6f/i8UD3EqNcwYIr6UBR5Q FEyDqI6Hg/qXnyK+MAUH5Uk5JMq1KDQkCfjvB1rxeL6VvloCTXzqFEMmz0Q1bDa44SWu vCG83WmuL+8HM6U2eROyamDZEOaeCjtAMBtOPwmMQEgsGEikv6CF8e542hodOAU1a3Th ErcU33qzqba9GZuGQBHh2JAPDrH2BPGmc9RBwNd3nANYDZsGUuFsvepxG+TaCa7/ow39 xpw3j2ygVrjyeHEbsjgBOw435GC8+SkKSG2NR7IHr2oJLKISIcrQjCCY5UNzNHL4XmUC 9c5Q== X-Gm-Message-State: AOAM5322e9qEhUK8wYix8S/DNnCcl/n6b8ZhaGrdBmTRWF1UOCfDILnb 1OKc4U5RL1HcaP8tTTftecluU35bZi2UaKV9Bag5yygyrM0= X-Google-Smtp-Source: ABdhPJwHMUYHqMsqzX+J6t+i6QNlncRy8q1lY9KiAd5E/jUja/0afzSHJXrVkR2ARfZbBk+OWnKEcCjNhwXmuV80zj8= X-Received: by 2002:a25:8551:0:b0:62c:2928:6f06 with SMTP id f17-20020a258551000000b0062c29286f06mr23181721ybn.586.1649698343084; Mon, 11 Apr 2022 10:32:23 -0700 (PDT) MIME-Version: 1.0 References: <20220411133148.10292-1-michael@niedermayer.cc> In-Reply-To: <20220411133148.10292-1-michael@niedermayer.cc> From: Paul B Mahol Date: Mon, 11 Apr 2022 19:34:40 +0200 Message-ID: To: FFmpeg development discussions and patches X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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-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 Mon, Apr 11, 2022 at 3:32 PM 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); > + 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]); > > Why this is removed? That handle frei0r source filters. > return ff_filter_frame(outlink, frame); > } > > -- > 2.17.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". > _______________________________________________ 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".