From patchwork Tue Oct 6 14:28:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 22743 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 75F0F44AF3D for ; Tue, 6 Oct 2020 18:28:23 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4A1A468B6D3; Tue, 6 Oct 2020 18:28:23 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ed1-f66.google.com (mail-ed1-f66.google.com [209.85.208.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 69E9A68B435 for ; Tue, 6 Oct 2020 18:28:17 +0300 (EEST) Received: by mail-ed1-f66.google.com with SMTP id dn5so14014908edb.10 for ; Tue, 06 Oct 2020 08:28:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=mZ9mhQw5gLRNJhVlgyYoUUpSDHtyaUi+alzm9wIZdgo=; b=tM8K18P7/qToMVU05sofG+Y509n57VIdvks00mGHHjib3BYBsTkIMOY+w/SraQb/H6 dNOf0HEOnxgTXqKl+oa3jLBeB/imhaFQYyjE9Vb9OIOCj5lBi100JpzscEZaZbEQMEmG L6FGCvp9D1tFwxWXVwDxzSXtVgaZ7MbwW1EJx6meHarpo5Gz5CZNIVGT7grZoxhy5mYo HJQdxF/WUGiPJ1fxUMPudRigtvv5fwMKecGnWH3YraoyYgXtQUEOjC+lKv/91pnBmtKX TDzjmPTS08i+HxUReEeJdNN9cDiME13u/8Mv9ZYXtx5cKMcAMc/3apvSG7s//whOO2Lv Mtkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=mZ9mhQw5gLRNJhVlgyYoUUpSDHtyaUi+alzm9wIZdgo=; b=iLX2bjo6V/vCekoVlRuSQh67eRR7h7wLNdwAFlJ8E2ArTw2lZzjdPqvC3Sr9lM4to1 AsATNpSJTP41sr4XUuEa5jWrMShWaCJgqEAZfIuBnUljw2Z6+DMZs+x3adzADh9TnORB SMYgi9bdN673D5Qc2d7EpPXNypBj0w5b73SwV77B1WmLChfFcuq+KlJBdQUbZbF/ZtE7 Vd7jhhwPqPxnHtf9lMeJs+wIqECRlr1A6h0mDAwHGeRZ5ZaCTV1yIKt1aLJRqEaIPlts Olj9UsrA0xD2aE95A3uKqDszH4PNQtRx/Xjuf+zNbO8MFRMi3rafthZDQyJ/vNDXPVf3 QgCA== X-Gm-Message-State: AOAM533ABVbXfO/koAtYOMbZKPkjxU3a9gKI/3PhBLa+ELdp0FiWQMUR N6HI0PJPAyQIyIrXvzZroNccCUh/VeM= X-Google-Smtp-Source: ABdhPJy1W8GYa/gVxspRGXkqT55VAFQlY3qrSsYvXbyZgY6DERnmqQ+IZKnGUp0djZlBBIlLNKfFKQ== X-Received: by 2002:a17:906:c109:: with SMTP id do9mr5440449ejc.142.1601994528587; Tue, 06 Oct 2020 07:28:48 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id z20sm2249781eji.104.2020.10.06.07.28.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Oct 2020 07:28:47 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 6 Oct 2020 16:28:38 +0200 Message-Id: <20201006142840.289130-1-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/3] avfilter/vf_minterpolate: Reject too small dimensions X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" The latter code relies upon the dimensions to be not too small; otherwise one will call av_clip() with min > max lateron which aborts in case ASSERT_LEVEL is >= 2 or one will get a nonsense result that may lead to a heap-buffer-overflow/underflow. The latter has happened in ticket #8248 which this commit fixes. Signed-off-by: Andreas Rheinhardt --- libavfilter/vf_minterpolate.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavfilter/vf_minterpolate.c b/libavfilter/vf_minterpolate.c index c9ce80420d..e1fe5e32b5 100644 --- a/libavfilter/vf_minterpolate.c +++ b/libavfilter/vf_minterpolate.c @@ -363,6 +363,11 @@ static int config_input(AVFilterLink *inlink) } if (mi_ctx->mi_mode == MI_MODE_MCI) { + if (mi_ctx->b_width < 2 || mi_ctx->b_height < 2) { + av_log(inlink->dst, AV_LOG_ERROR, "Height or width < %d\n", + 2 * mi_ctx->mb_size); + return AVERROR(EINVAL); + } mi_ctx->pixel_mvs = av_mallocz_array(width * height, sizeof(PixelMVS)); mi_ctx->pixel_weights = av_mallocz_array(width * height, sizeof(PixelWeights)); mi_ctx->pixel_refs = av_mallocz_array(width * height, sizeof(PixelRefs)); From patchwork Tue Oct 6 14:28:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 22740 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 9A710449F4D for ; Tue, 6 Oct 2020 17:30:48 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 791D768B6BF; Tue, 6 Oct 2020 17:30:48 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ej1-f68.google.com (mail-ej1-f68.google.com [209.85.218.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4026168B2F8 for ; Tue, 6 Oct 2020 17:30:42 +0300 (EEST) Received: by mail-ej1-f68.google.com with SMTP id md26so17936494ejb.10 for ; Tue, 06 Oct 2020 07:30:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FUXgA3KYAmUBC1esfyOC53sIuvzgiYuD7JJtPLEWejM=; b=uvM1Nb7etGZG8NUVIcii3NsL3Ow/QDG8zEWJj1++BPCtFy0GlPFeSRd18f+Tljzr6b veF+E59weUZPrK5JVMRormdtqOcBFfCowOrysYCHeMuAK2qw76y0kI6dQwUAZY7HUQZi HlPg8IldA69qXCUIaYiQc41dsJt2RQ1taI8CSeFglY8yavBYylA9laAa6OyS2w1lqOXb Zrr/Ls43KqU9bgn0EZOZHwFMX+tQEIA1ACW7LPDjEP9cMVPZGMVSy2Jfmen9H1mwkQQT 1iW7HtJgXRQyB/4CZdds240Va6AAxDnDXbHACtCHzWfxjx3Ydqzc/Yr8zDbiNiRJJysA N09g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FUXgA3KYAmUBC1esfyOC53sIuvzgiYuD7JJtPLEWejM=; b=D1owNmazMrdx7O4q1YCApIUjeEkJgMYfXtfz3lDm8NZB+B6Lq9NyJoU+vAb3IpR7DS aIbfKri8dfomYWh2ZFa1dwzQJgv7jCN9pmEDDh5wpNabgCXevcS2cc7pVsGiACVcaIRp /SQ0oLO5ZvReMBEwVlBvd5v8SxbOus6IdpNKDmab3jhCdyZN82b/QFr4rLbRALkVZiJf ZPfPOKZYWbRTdOc9rzR53voOa2i7mMbp58XsUL8gBuD9TqSElzEx/HNX6YAXQolJ5Kkl oPgYRmg62eNK0JXF+QPN3cXIamjjlkQyK4k14moiQwxS73ZdoO9k1fHvX+C9zvaI8Yww Lskw== X-Gm-Message-State: AOAM533xHH2CNyogpV3K49MHsR7eXGaPRqn8vPdunf8idVWFTjXNUVaI Y0Zv07U7F1Jt9Oin63/D9ASSt8McO7Y= X-Google-Smtp-Source: ABdhPJzbuilFu+b3NMZQOUq7ewF2BJP8Gbhrz565ciQASw6opeAGuM/kmlEZ4ZInuoGZPYpXTPb1Dg== X-Received: by 2002:a17:906:f8d5:: with SMTP id lh21mr5327211ejb.185.1601994641204; Tue, 06 Oct 2020 07:30:41 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id z20sm2249781eji.104.2020.10.06.07.30.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Oct 2020 07:30:40 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 6 Oct 2020 16:28:39 +0200 Message-Id: <20201006142840.289130-2-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201006142840.289130-1-andreas.rheinhardt@gmail.com> References: <20201006142840.289130-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/3] avfilter/vf_minterpolate: Fix left shift of negative value X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" This has happened when initializing the motion estimation context if width or height of the video was smaller than the block size used for motion estimation and if the motion interpolation mode indicates not to use motion estimation. The solution is of course to only initialize the motion estimation context if the interpolation mode uses motion estimation. Signed-off-by: Andreas Rheinhardt --- libavfilter/vf_minterpolate.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/libavfilter/vf_minterpolate.c b/libavfilter/vf_minterpolate.c index e1fe5e32b5..bf45662913 100644 --- a/libavfilter/vf_minterpolate.c +++ b/libavfilter/vf_minterpolate.c @@ -368,6 +368,15 @@ static int config_input(AVFilterLink *inlink) 2 * mi_ctx->mb_size); return AVERROR(EINVAL); } + ff_me_init_context(me_ctx, mi_ctx->mb_size, mi_ctx->search_param, + width, height, 0, (mi_ctx->b_width - 1) << mi_ctx->log2_mb_size, + 0, (mi_ctx->b_height - 1) << mi_ctx->log2_mb_size); + + if (mi_ctx->me_mode == ME_MODE_BIDIR) + me_ctx->get_cost = &get_sad_ob; + else if (mi_ctx->me_mode == ME_MODE_BILAT) + me_ctx->get_cost = &get_sbad_ob; + mi_ctx->pixel_mvs = av_mallocz_array(width * height, sizeof(PixelMVS)); mi_ctx->pixel_weights = av_mallocz_array(width * height, sizeof(PixelWeights)); mi_ctx->pixel_refs = av_mallocz_array(width * height, sizeof(PixelRefs)); @@ -395,13 +404,6 @@ static int config_input(AVFilterLink *inlink) return AVERROR(EINVAL); } - ff_me_init_context(me_ctx, mi_ctx->mb_size, mi_ctx->search_param, width, height, 0, (mi_ctx->b_width - 1) << mi_ctx->log2_mb_size, 0, (mi_ctx->b_height - 1) << mi_ctx->log2_mb_size); - - if (mi_ctx->me_mode == ME_MODE_BIDIR) - me_ctx->get_cost = &get_sad_ob; - else if (mi_ctx->me_mode == ME_MODE_BILAT) - me_ctx->get_cost = &get_sbad_ob; - return 0; fail: for (i = 0; i < NB_FRAMES; i++) @@ -830,9 +832,10 @@ static int inject_frame(AVFilterLink *inlink, AVFrame *avf_in) return 0; } -static int detect_scene_change(MIContext *mi_ctx) +static int detect_scene_change(AVFilterContext *ctx) { - AVMotionEstContext *me_ctx = &mi_ctx->me_ctx; + MIContext *mi_ctx = ctx->priv; + AVFilterLink *input = ctx->inputs[0]; uint8_t *p1 = mi_ctx->frames[1].avf->data[0]; ptrdiff_t linesize1 = mi_ctx->frames[1].avf->linesize[0]; uint8_t *p2 = mi_ctx->frames[2].avf->data[0]; @@ -841,9 +844,9 @@ static int detect_scene_change(MIContext *mi_ctx) if (mi_ctx->scd_method == SCD_METHOD_FDIFF) { double ret = 0, mafd, diff; uint64_t sad; - mi_ctx->sad(p1, linesize1, p2, linesize2, me_ctx->width, me_ctx->height, &sad); + mi_ctx->sad(p1, linesize1, p2, linesize2, input->w, input->h, &sad); emms_c(); - mafd = (double) sad * 100.0 / (me_ctx->height * me_ctx->width) / (1 << mi_ctx->bitdepth); + mafd = (double) sad * 100.0 / (input->h * input->w) / (1 << mi_ctx->bitdepth); diff = fabs(mafd - mi_ctx->prev_mafd); ret = av_clipf(FFMIN(mafd, diff), 0, 100.0); mi_ctx->prev_mafd = mafd; @@ -1191,7 +1194,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *avf_in) if (!mi_ctx->frames[0].avf) return 0; - mi_ctx->scene_changed = detect_scene_change(mi_ctx); + mi_ctx->scene_changed = detect_scene_change(ctx); for (;;) { AVFrame *avf_out; From patchwork Tue Oct 6 14:28:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 22741 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id ADCC5449F4D for ; Tue, 6 Oct 2020 17:30:49 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9AF5168B6CB; Tue, 6 Oct 2020 17:30:49 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ej1-f65.google.com (mail-ej1-f65.google.com [209.85.218.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1FAFB68B6BB for ; Tue, 6 Oct 2020 17:30:43 +0300 (EEST) Received: by mail-ej1-f65.google.com with SMTP id p15so17960188ejm.7 for ; Tue, 06 Oct 2020 07:30:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=e4r1TD2N2w7W+2G3wWGNuWOOusWOzQ31CCacXUmV6Xc=; b=DJ3/Zw0Eow/7nsesAXbI+6nmvso/ICvEN2i9lHHa1ekThzUlaMnJC1NMRihN490pMw muN2yjnOUBY/bsnOqpaE5BWshP6mrQbx9dU0Zvolw4RXrgZjQR5BtIYKwVMMYRrOceph HkK5rgXyUi5uamDYuF4tf/XJipoN3MkxTd1m1+RjMVJVkiyADeHxMjwugFFkH8uw+zDq X9rDCY1EsveV2LuhZbR9aGz0Azzzy/6Fb80merXIFsgNKBCKxFwyScJtZxkiwhkHfIx+ fr+iT3Q0nneDVVc5bpOSJZ1KhYkQzv5if66/Q9oLh2vS5ECkrPIMcB7K/CJ8gCGa9Tjk 00tQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=e4r1TD2N2w7W+2G3wWGNuWOOusWOzQ31CCacXUmV6Xc=; b=ozgWjzUjnM/A/BaZeLiggROQe36shxfJosgAqDI4oGLttTDO+3iBNH6OXKVCZQlEdQ twJkKmy9sFLefRTWShVIYKv88nOHuhkXW+ku5xa9NUlLXa5kQdAmmZAXzVnIKhrkisiA 78gHqHuyScMvCAxDuS+PKVIbqoY/nSQgACzKDxmOo1WqvUtcxYBYtkaBsUIPsDT9Sqcd kIUV4hDnngyuVrIUmmxZNJ+vr+oEuk9JnqZUFaJYsVnCHd6SK+LaTUHYSjpZV3EJZSxz 0TSrttXvkFgK2N6ZVGNZb1uPERV0a+mRl3JesjzdIYTmsTuaYd2r99CDhSaFL+cAnfSg e+Jw== X-Gm-Message-State: AOAM531zMK5kTJRHYfUz8GTXGUWmEqdpfhyogzYKBkTbuBZ30xRYHW1D OPj4Nh2TQLhhF0RmvywRubbdmOwpHUc= X-Google-Smtp-Source: ABdhPJwPHYVWe9o2uf8i46XvxaWQqJioWffUsIOnztmgj+SvAY0l7vpg5qtrobKRNTEsLFUDzwNpjQ== X-Received: by 2002:a17:907:11d0:: with SMTP id va16mr5313634ejb.22.1601994642309; Tue, 06 Oct 2020 07:30:42 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id z20sm2249781eji.104.2020.10.06.07.30.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Oct 2020 07:30:41 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 6 Oct 2020 16:28:40 +0200 Message-Id: <20201006142840.289130-3-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201006142840.289130-1-andreas.rheinhardt@gmail.com> References: <20201006142840.289130-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/3] avfilter/vf_minterpolate: Remove redundant code for freeing X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" ad73b32d2922f4237405043d19763229aee0e59e added some code for freeing in the input's config_props function, yet this is unnecessary as uninit is called anyway if config_props fails. Signed-off-by: Andreas Rheinhardt --- libavfilter/vf_minterpolate.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/libavfilter/vf_minterpolate.c b/libavfilter/vf_minterpolate.c index bf45662913..969463f021 100644 --- a/libavfilter/vf_minterpolate.c +++ b/libavfilter/vf_minterpolate.c @@ -340,7 +340,7 @@ static int config_input(AVFilterLink *inlink) const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format); const int height = inlink->h; const int width = inlink->w; - int i, ret = 0; + int i; mi_ctx->log2_chroma_h = desc->log2_chroma_h; mi_ctx->log2_chroma_w = desc->log2_chroma_w; @@ -380,10 +380,8 @@ static int config_input(AVFilterLink *inlink) mi_ctx->pixel_mvs = av_mallocz_array(width * height, sizeof(PixelMVS)); mi_ctx->pixel_weights = av_mallocz_array(width * height, sizeof(PixelWeights)); mi_ctx->pixel_refs = av_mallocz_array(width * height, sizeof(PixelRefs)); - if (!mi_ctx->pixel_mvs || !mi_ctx->pixel_weights || !mi_ctx->pixel_refs) { - ret = AVERROR(ENOMEM); - goto fail; - } + if (!mi_ctx->pixel_mvs || !mi_ctx->pixel_weights || !mi_ctx->pixel_refs) + return AVERROR(ENOMEM); if (mi_ctx->me_mode == ME_MODE_BILAT) if (!(mi_ctx->int_blocks = av_mallocz_array(mi_ctx->b_count, sizeof(Block)))) @@ -405,13 +403,6 @@ static int config_input(AVFilterLink *inlink) } return 0; -fail: - for (i = 0; i < NB_FRAMES; i++) - av_freep(&mi_ctx->frames[i].blocks); - av_freep(&mi_ctx->pixel_mvs); - av_freep(&mi_ctx->pixel_weights); - av_freep(&mi_ctx->pixel_refs); - return ret; } static int config_output(AVFilterLink *outlink)