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 6E65E41193 for ; Tue, 15 Feb 2022 09:19:14 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DE39E68B280; Tue, 15 Feb 2022 11:19:11 +0200 (EET) Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AB19168B1B0 for ; Tue, 15 Feb 2022 11:19:05 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 221A0240179 for ; Tue, 15 Feb 2022 10:19:05 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id H-cbpfnTWQbx for ; Tue, 15 Feb 2022 10:19:03 +0100 (CET) Received: from lain.red.khirnov.net (lain.red.khirnov.net [IPv6:2001:67c:1138:4306::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "lain.red.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 933C5240175 for ; Tue, 15 Feb 2022 10:19:03 +0100 (CET) Received: by lain.red.khirnov.net (Postfix, from userid 1000) id C1AD01601AD; Tue, 15 Feb 2022 10:19:03 +0100 (CET) From: Anton Khirnov To: FFmpeg development discussions and patches In-Reply-To: References: <20210115045832.76405-1-borbarak@fb.com> =?utf-8?q?=3CMN2PR15MB2?= =?utf-8?q?605F2669A411F794B6C2B40B5A70=40MN2PR15MB2605=2Enamprd15=2Eprod=2E?= =?utf-8?q?outlook=2Ecom=3E_=3CMR3WgJJ--3-2=40lynne=2Eee=3E_=3CMN2PR15MB2605?= =?utf-8?q?997AC36969E5639782C4B5A30=40MN2PR15MB2605=2Enamprd15=2Eprod=2Eout?= =?utf-8?q?look=2Ecom=3E?= <3fa8e9b2-6824-eb3a-2390-22fd024efa9f@mail.de> <164363001951.23111.4989616914372511566@lain.red.khirnov.net> <164491528780.19727.15494655440668021866@lain.red.khirnov.net> Mail-Followup-To: FFmpeg development discussions and patches Date: Tue, 15 Feb 2022 10:19:03 +0100 Message-ID: <164491674376.9519.6645598749712710969@lain.red.khirnov.net> User-Agent: alot/0.8.1 MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH] avfilter: Added siti filter 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: Quoting Paul B Mahol (2022-02-15 10:10:17) > On Tue, Feb 15, 2022 at 9:55 AM Anton Khirnov wrote: > > > Quoting Thilo Borgmann (2022-02-12 11:55:39) > > > Am 31.01.22 um 12:55 schrieb James Almer: > > > +static int config_input(AVFilterLink *inlink) > > > +{ > > > + // Video input data avilable > > > + AVFilterContext *ctx = inlink->dst; > > > + SiTiContext *s = ctx->priv; > > > + int max_pixsteps[4]; > > > + size_t pixel_sz; > > > + size_t data_sz; > > > + size_t gradient_sz; > > > + size_t motion_sz; > > > + > > > + const AVPixFmtDescriptor *desc = > > av_pix_fmt_desc_get(inlink->format); > > > + av_image_fill_max_pixsteps(max_pixsteps, NULL, desc); > > > + > > > + s->pixel_depth = max_pixsteps[0]; > > > + s->width = inlink->w; > > > + s->height = inlink->h; > > > + pixel_sz = s->pixel_depth == 1 ? sizeof(uint8_t) : sizeof(uint16_t); > > > + data_sz = s->width * pixel_sz * s->height; > > > + > > > + s->prev_frame = av_malloc(data_sz); > > > + > > > + gradient_sz = (s->width - 2) * sizeof(double) * (s->height - 2); > > > + s->gradient_matrix = (double*)av_malloc(gradient_sz); > > > + > > > + motion_sz = s->width * sizeof(double) * s->height; > > > + s->motion_matrix = (double*)av_malloc(motion_sz); > > > > useless casts > > > > > + > > > + if (!s->prev_frame || ! s->gradient_matrix || !s->motion_matrix) { > > > + av_freep(&s->prev_frame); > > > + av_freep(&s->gradient_matrix); > > > + av_freep(&s->motion_matrix); > > > > You don't need to free them on failure, that will be done in uninit. But > > you should free them at the beginning of this function, because > > config_input can be called multiple times. > > > > In which scenarios? When its called, uninit is also called before. > Was thinking to add better support for frame w/h changes when midstream > filtering.... Actually I'm not sure it currently will be called more than once, but IIRC the code was supposed to assume it, precisely for future parameter change support. -- Anton Khirnov _______________________________________________ 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".