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 0659D42A23 for ; Mon, 11 Apr 2022 20:08:02 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6AA2768B299; Mon, 11 Apr 2022 23:08:00 +0300 (EEST) Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1279668B245 for ; Mon, 11 Apr 2022 23:07:54 +0300 (EEST) Received: from localhost (213-47-68-29.cable.dynamic.surfer.at [213.47.68.29]) (Authenticated sender: michael@niedermayer.cc) by mail.gandi.net (Postfix) with ESMTPSA id 1EB8EFF807 for ; Mon, 11 Apr 2022 20:07:52 +0000 (UTC) Date: Mon, 11 Apr 2022 22:07:51 +0200 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20220411200751.GH2829255@pb2> References: <20220411133148.10292-1-michael@niedermayer.cc> MIME-Version: 1.0 In-Reply-To: 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: multipart/mixed; boundary="===============4076263236131782856==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============4076263236131782856== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="97qm/Y7auEYqde3X" Content-Disposition: inline --97qm/Y7auEYqde3X Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Apr 11, 2022 at 07:34:40PM +0200, Paul B Mahol wrote: > On Mon, Apr 11, 2022 at 3:32 PM Michael Niedermayer > wrote: >=20 > > 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 =3D av_frame_alloc(); > > + if (!frame) > > + return NULL; > > + > > + frame->width =3D link->w; > > + frame->height =3D link->h; > > + frame->format =3D link->format; > > + ret =3D 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 =3D inlink->dst->priv; > > AVFilterLink *outlink =3D inlink->dst->outputs[0]; > > - AVFrame *out; > > + AVFrame *out =3D getframe(outlink); > > + if (!out) > > + goto fail; > > > > - out =3D ff_get_video_buffer(outlink, outlink->w, outlink->h); > > - if (!out) { > > + av_frame_copy_props(out, in); > > + > > + if (in->linesize[0] !=3D out->linesize[0]) { > > + AVFrame *in2 =3D getframe(outlink); > > + if (!in2) > > + goto fail; > > + av_frame_copy(in2, in); > > av_frame_free(&in); > > - return AVERROR(ENOMEM); > > + in =3D 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, AVFr= ame > > *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 *outli= nk) > > frame->sample_aspect_ratio =3D (AVRational) {1, 1}; > > frame->pts =3D 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? i did miss that frei0r_src exists >=20 > That handle frei0r source filters. I ll send a better patch thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If you fake or manipulate statistics in a paper in physics you will never get a job again. If you fake or manipulate statistics in a paper in medicin you will get a job for life at the pharma industry. --97qm/Y7auEYqde3X Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEIAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCYlSKkQAKCRBhHseHBAsP q2tlAJ0XoKHwB+eQrs/dYeXYYth/QwabJACfSWlBAmxN+Y5I9vIxx58jBHNGgX4= =jBKr -----END PGP SIGNATURE----- --97qm/Y7auEYqde3X-- --===============4076263236131782856== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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". --===============4076263236131782856==--