From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 537374C267 for ; Sun, 8 Feb 2026 19:54:34 +0000 (UTC) Authentication-Results: ffbox; dkim=fail (body hash mismatch (got b'uhn6KBIvvgQynmbXchwzmB2oKiaPtl9zmXkBqoED5uY=', expected b'ftCn1wtdzmPu4J2SePAsMpDMwjAwiYtjp8IoX4iqL8o=')) header.d=twosigma.com header.a=rsa-sha256; dkim=fail (body hash mismatch (got b'uhn6KBIvvgQynmbXchwzmB2oKiaPtl9zmXkBqoED5uY=', expected b'4W4Wyk/9xOWKw610hTWPlkBwRkxsxnl3oQ/SZ9S6ang=')) header.d=twosigmainternal.onmicrosoft.com header.a=rsa-sha256 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1770580466; h=to : date : message-id : mime-version : content-type : reply-to : subject : list-id : list-archive : list-archive : list-help : list-owner : list-post : list-subscribe : list-unsubscribe : from : cc : content-transfer-encoding : from; bh=XepTpkujKJIYhpNuRWSSl868y8pE5H8JYp8ofX8tnVg=; b=hSdoaXcXvokhDyBj3lfjaoHtqNWcAe5Vz1t5tkpQtmYJ/wmtesYae19hhYdD14DXmevvu tCJoZ2YE3LDxiZm6o17bM0ZoSlF9vzR9Bt7McxcMScgbVllA8oCQ71Mb0AZRbd1k027lPvH 2xYKGeh55qx+wEDrbGqKPxdkAG3lTv88KNBvGioc1BLABQGWV3R5Uh3znDqPYGu80P9I2Ir WoH2IN9Wumj6zKaaf2amPR4z+eh7z6VmftYGfSJEft0NbUCyn+LrcDqkKx+J7ycP61bbVtD qGZrwqNNIDVSQmcwXGjk2c1K+gDF15mBFV9qVF0foaYLOX/Uyw2zprg6x/bw== Received: from [172.20.0.4] (unknown [172.20.0.4]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id CB57E6910F1; Sun, 8 Feb 2026 21:54:26 +0200 (EET) ARC-Seal: i=2; cv=fail; a=rsa-sha256; d=ffmpeg.org; s=arc; t=1770580446; b=TeKE37lGgHEAtZo53d9BLDoaWoJqpIkjnrfqTJF+yT5Szw+BN7xUdz5ZfTvdx4IHQa+Up xAkUDMOuLwmzRLv5Ky3DN+XH+BI3LT8h/+ftBqdUHQIpJOs4+N40rKo1q22wPfpyA4YlCQv ZdGRyPGt/GwymffVREDUEpdG4mVFkJGnyHKxDb1bbGuzbQWzMCRkQGdMK7ZtDVVoDzrzFyN ZrT9qNi+kgQMDJ8gMH4Dsr72UX27ca+x6U5sKk38kiwvamWQ/RddIkQm1zo/EMvGSqF6rgn wKlOCbob0Vbw8TTG8AOnWKuN8xKjkpaYuVEvHFH2o0NIRH79UAVifqm3stpw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=ffmpeg.org; s=arc; t=1770580446; h=from : sender : reply-to : subject : date : message-id : to : cc : mime-version : content-type : content-transfer-encoding : content-id : content-description : resent-date : resent-from : resent-sender : resent-to : resent-cc : resent-message-id : in-reply-to : references : list-id : list-help : list-unsubscribe : list-subscribe : list-post : list-owner : list-archive; bh=uhn6KBIvvgQynmbXchwzmB2oKiaPtl9zmXkBqoED5uY=; b=QAlX1JLMvlfjzWXULDwc1wHF/TfHlP8vh4rm47ePjXCQnX3et+ULTISLQMZcSaqcbQcwb CcMFWMvJTtBqohAENwjQLFi6DH+kSilaeC1TBqRGsTDFHRXz/Fitcao6T3nkDLGHqXFOtww Kh4kdX4FTQ5QYuuiRO5fCQED211KeUfNtMmgrdrFgc8aNYY3bNj4jPHKI1hDwB6HYZU6F6E qibimAmkgph+WFEHMuTxen2k0pEbSsUmMMVZvO3R8UJZcnRkAt80PkcuZybcQ9QIGBcM74q LWVLcbKgwyjbgC8lG9PnY9yoRQr/r49nqT5TwjrY2oZTDeK0IPlO2nQMvUfA== ARC-Authentication-Results: i=2; ffmpeg.org; dkim=pass header.d=twosigma.com; arc=fail; dmarc=pass header.from=twosigma.com policy.dmarc=none Authentication-Results: ffmpeg.org; dkim=pass header.d=twosigma.com; arc=fail (Most recent ARC-Message-Signature did not validate); dmarc=pass (Used From Domain Record) header.from=twosigma.com policy.dmarc=none Received: from mxo1.dft.dmz.twosigma.com (mxo1.dft.dmz.twosigma.com [208.77.212.183]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 38C5969109E for ; Fri, 6 Feb 2026 23:37:47 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by mxo1.dft.dmz.twosigma.com (Postfix) with ESMTP id 4f76rS6ZtNzC18C for ; Fri, 6 Feb 2026 21:37:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=twosigma.com; s=202008; t=1770413864; bh=ftCn1wtdzmPu4J2SePAsMpDMwjAwiYtjp8IoX4iqL8o=; h=From:To:Subject:Date:From; b=BUgsrUPRSKgzXkHt+2AP+p3km6k9LQaewBCC0fEG3ONUrZcdMk9aSKauHQ4+51XAD s/Jsg/vOiCnVp2IM+gYO4hZu7vHRQyc+OhxbHv3D/gmE+nJx+lMXD1iJSCOOI2SkfG uwgD32QHj6MufgfAcNLY5feFFy9ZkoYglEyYgLE/xxGnrI2MchhbU/ZoUbnunAvn7m fkumbnqGyAsZpGpDRh/H5mxqwwLRnEtr6T5eAYaFOg+AN8ZEorpNDHuIKvlQaP0esz e3OpI0VTKAm8pe6Bg4x5mZyvZ5/LfDV+sUV80B2cvIa3urpcLG+9LCLlLKeVSvWoIj 9nv6SOw/TyiDQ== X-Virus-Scanned: Debian amavisd-new at twosigma.com Received: from mxo1.dft.dmz.twosigma.com ([127.0.0.1]) by localhost (mxo1.dft.dmz.twosigma.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id e2Wex6LjrTt8 for ; Fri, 6 Feb 2026 21:37:44 +0000 (UTC) Received: from gsdft-exhy04.ad.twosigma.com (gsdft-exhy04.ad.twosigma.com [172.23.53.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mxo1.dft.dmz.twosigma.com (Postfix) with ESMTPS id 4f76rS5lT3zC159 for ; Fri, 6 Feb 2026 21:37:44 +0000 (UTC) Received: from gsdft-exhy04.ad.twosigma.com (172.23.53.23) by gsdft-exhy04.ad.twosigma.com (172.23.53.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.29; Fri, 6 Feb 2026 16:37:44 -0500 Received: from dsdft-exet01.dft.dmz.twosigma.com (172.22.49.105) by gsdft-exhy04.ad.twosigma.com (172.23.53.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.29 via Frontend Transport; Fri, 6 Feb 2026 16:37:44 -0500 Received: from BL2PR08CU001.outbound.protection.outlook.com (172.22.48.4) by edge1.twosigma.com (172.22.49.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.29; Fri, 6 Feb 2026 21:37:44 +0000 Received: from MW4PR08MB8257.namprd08.prod.outlook.com (2603:10b6:303:1b9::11) by BY5PR08MB6182.namprd08.prod.outlook.com (2603:10b6:a03:1e1::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9587.12; Fri, 6 Feb 2026 21:37:41 +0000 Received: from MW4PR08MB8257.namprd08.prod.outlook.com ([fe80::24e8:a9fe:1d6d:9bb5]) by MW4PR08MB8257.namprd08.prod.outlook.com ([fe80::24e8:a9fe:1d6d:9bb5%4]) with mapi id 15.20.9587.013; Fri, 6 Feb 2026 21:37:40 +0000 To: "ffmpeg-devel@ffmpeg.org" Thread-Topic: [PATCH] lavfi/mpdecimate: fix three bugs in keep_count logic Thread-Index: AdyXsDtVujoRt109SY6unJkexKUgDA== Date: Fri, 6 Feb 2026 21:37:40 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MW4PR08MB8257:EE_|BY5PR08MB6182:EE_ x-ms-office365-filtering-correlation-id: a2abed08-0b49-4ebd-2161-08de65c7f43e x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|1800799024|376014|366016|8096899003|38070700021; x-microsoft-antispam-message-info: =?us-ascii?Q?JWW3BgPpyn5UZyq8VDxmyfp55m6osgUibyDCPHHW5nW4XBUN2WYyE60frh7l?= =?us-ascii?Q?x7NBjhnvfsEFvO9B21OfFgzmEf5oN36UEoIM7LtFLYC/YPeBeUla4JBe7o1g?= =?us-ascii?Q?qfFW+8pEsio5yD/zk0vn6imoY5btGmHBXqEEmal/Q400dx4Fcv4jpZKOC3rj?= =?us-ascii?Q?17kGmCV1edGPbTS1ZT6YyfXuToMwxm6hRjyBuiN6cyM5pBubK7nRF/YifBrO?= =?us-ascii?Q?Y2zaUSFv4jmdmY9VqxCwnBV8cFiZCjGZwDlRFPhXRa5NkYuzyA00EpX94cBp?= =?us-ascii?Q?IpftDBOYK0wePQt1MKetumMjlMUC6ctkDPpi1Pp9Z6ksnv8Zlas1u6dOCqAi?= =?us-ascii?Q?S4X9lasZq4AP7Jjj7Khiz9RoTtv4AnJJW2GLMqQmdZN0KPAZfjhKCRGgRw0n?= =?us-ascii?Q?jF7XsEqe3A+5orTiZnkHDAvzlvrX5WN4NFjd2hMqaucrv2Pr/OphAHDk1qfg?= =?us-ascii?Q?I0buSGFyPPVMSVxMYh4RciWg7PD1oRZ201NyvRwzIShvqbW34++qMclLjPEx?= =?us-ascii?Q?O4zCM3lAqRTIgMKcS8mxvTXjl9LjSadvPxaVy4MnbejLmnqhloI3S+TSkpZs?= =?us-ascii?Q?pU7zMt7TEpjsw2nVL0YCv+Pdnl/4sD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D5nn24J4ERzwW7/sZKJwvKYhuBWNr1XSqVXcle3m6oDxGB2HKv5YGLlS/zru?= =?us-ascii?Q?dddbDGySmxt+daqo64KrD9GHaqE9OxQ2Np/osBD/9PQLKjzKiBiI4LDXu5zl?= =?us-ascii?Q?1100Yv7FX/M+g3P9H5H3AUQ=3D?= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW4PR08MB8257.namprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(366016)(8096899003)(38070700021);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?Yl37qeFx3X7HMelyxS7DMcg63MchlDh18vU5YMNKZ9bfI617WVZJNag3sjYq?= =?us-ascii?Q?rbh+LqFzFhrXFriTEOGc/gZMMzYGu8tWhEZECmoU1SbpYdplKDwM9TZCCXbp?= =?us-ascii?Q?z6+MDKnNctewS0KpZI8UzmmsxQziSRT8dinZ73/tQAt1qIClcaWB3zkBGBGX?= =?us-ascii?Q?y+q6n94SBBVS5UYa/d9i2TP+QUidClzBXIqyaeYb2qGvDx0WzW8UcLWXRpuk?= =?us-ascii?Q?cgevX+GadcIuSpMorsBpa7jUfDreXwRzG8rzScNeZiytAmDzcL5grUop9R08?= =?us-ascii?Q?5Kn/GRwU/oTRdt/1MOHhNuy1UZ6fGtC/I3Z8MbubWe6A3nl+0QKgRiot4r6Z?= =?us-ascii?Q?+myWbDVArkf263Bfg5ziOgkpk+Y/gbkOScJkf6DuXUR3uTf2WzsArICJtG4E?= =?us-ascii?Q?smAv83hLFK8nAzOUkGg78hzpAoGTqyOg/hvklixXkZYeO3iv52Cm6A6Q90A4?= =?us-ascii?Q?jO5lRl2XFWIZa75JajNX657hFjjVbtjNWKEQRlMtaquBbUBI3iDhQ1hIC5FL?= =?us-ascii?Q?V3MhjFfJdj7oGXN82C3uJ/4OLv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= =?us-ascii?Q?ZXS57mba+Xuf3NZ0VGpYVBR3sNHbPKo9mB4biv1Lz9D/tundB7wbMr2MDkvq?= =?us-ascii?Q?tF0y+VeTeFAhiQtpm4FTO8n14hsWkTDJMucsg0VcWEFpWV++L5NgnY9RHjDy?= =?us-ascii?Q?kJuFkdupCSB8IEFbOTwrJO5Q8ta1xucRjCS+qv4znTpXC2pCMqlwq8ue/224?= =?us-ascii?Q?wfdO7DrOy18WHczCYOsBSkc5eSQlCSnYybiZSIVIrpgVu8+GCDoHry4MHtED?= =?us-ascii?Q?cONYY1KJQ22OTFiNRqwZ/6BDHnAWifkBsu2XfzH+A5hWWiOZwpc1oLJWI2gq?= =?us-ascii?Q?Vsh9IZ1hZQ=3D=3D?= arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ObetKNq9pRZjjS7vQ8l2OhxPFY4OnrD/EduMjJHfazT3vSZaAQCW7IH/avOeM0Yh59fZOa37v591uObNb5D/wSWi60gqBVhYf4JKayWR9GfNlGxWNGGrsxiBsXDm3omPo0FSSFbYE1lHumeshVlPtE0lZbpxK1b62/EJQ7Drj9WriMIREqrd3TTI4/Ta2zfyxy2pELk4p6maRbXC/mlMqD7lKynukHTdZL06P0eD6c3HxyEo9CX1tRLErX+VVvohyyRhVgVLKYCHeeJQCIse4ts8O8JB+v9/oRvxrLFcvocsXfE/Nn9d7JJHQYMtmzF53loWbeuCb1jaGfd78L5Akg== arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4W4Wyk/9xOWKw610hTWPlkBwRkxsxnl3oQ/SZ9S6ang=; b=NtUNHzCbSZHa7cCPrXc0fG4ZGXsikMZh+kgntebZWqf8GSy3WA+sx+XglJrJAc85KIy5Bkp3x1K+Nf0t48nfsFIbHGSqk8+gMuPXRDuqJ9EHxqq8N5Er+tm4mCTd2yxd1xw2PoOD1i3hzkD0ygaDdW5cxQAXjv521znalYEmSPqXATAiNgjKLeZKg0I8JywzBbK7JY1eCgL8bv8+vzo4wB2TXsi374edRkmEHd8MWTEwJsAGqTSd7fj6Bt90BsGEe9rSZngCaQOqNLCHD/UfelJhrJWow/0GnowprFx5rlNDftweUvLW0s3bur1InMP+HDVo96ehZgKjSeFyeD4o7Q== arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=twosigma.com; dmarc=pass action=none header.from=twosigma.com; dkim=pass header.d=twosigma.com; arc=none dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=twosigmainternal.onmicrosoft.com; s=selector1-twosigmainternal-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4W4Wyk/9xOWKw610hTWPlkBwRkxsxnl3oQ/SZ9S6ang=; b=QCAqwzeyvivl2OOQwHC2r6rIHbxuBeknTmTD/8wZe+DasV2FylL+cYj7dG0Dk+2DKARRpvhvRKdJA5gos4nThVTPYOeJhqI3VBtUmRZ4hFYeLgLbt+MIy/+642oyfUHiFUa4ve5Ai0Pzsr0rrWydAnV3BR7GWsTv3BxBPBhKUqs= x-ms-exchange-crosstenant-authas: Internal x-ms-exchange-crosstenant-authsource: MW4PR08MB8257.namprd08.prod.outlook.com x-ms-exchange-crosstenant-network-message-id: a2abed08-0b49-4ebd-2161-08de65c7f43e x-ms-exchange-crosstenant-originalarrivaltime: 06 Feb 2026 21:37:40.3682 (UTC) x-ms-exchange-crosstenant-fromentityheader: Hosted x-ms-exchange-crosstenant-id: 43fb3c01-4eda-479a-96f3-4fb85967560f x-ms-exchange-crosstenant-mailboxtype: HOSTED x-ms-exchange-crosstenant-userprincipalname: jObt+c/nI12cKsQ7xzlHGckBU825pS9tiipK1MfgTk1l9nlKcQfPXrG0cPvd/6nZfcZUfesGf2/a4nkW1qeivg== x-ms-exchange-transport-crosstenantheadersstamped: BY5PR08MB6182 x-originatororg: twosigma.com MIME-Version: 1.0 X-MailFrom: SRS0=jqoT=AK=twosigma.com=Dana.Feng@ffmpeg.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-ffmpeg-devel.ffmpeg.org-0; header-match-ffmpeg-devel.ffmpeg.org-1; header-match-ffmpeg-devel.ffmpeg.org-2; header-match-ffmpeg-devel.ffmpeg.org-3; emergency; member-moderation Message-ID-Hash: CTMKKWTVECACLGE3WBRIATNSNUFRU7L5 X-Message-ID-Hash: CTMKKWTVECACLGE3WBRIATNSNUFRU7L5 X-Mailman-Approved-At: Sun, 08 Feb 2026 19:53:58 +0000 Content-Type: text/plain; charset="us-ascii" X-Content-Filtered-By: Mailman/MimeDel 3.3.10 X-Mailman-Version: 3.3.10 Precedence: list Reply-To: FFmpeg development discussions and patches Subject: [FFmpeg-devel] [PATCH] lavfi/mpdecimate: fix three bugs in keep_count logic List-Id: FFmpeg development discussions and patches Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Dana Feng via ffmpeg-devel Cc: Dana Feng Content-Transfer-Encoding: 7bit Archived-At: List-Archive: List-Post: Fix the following issues with the keep option: 1. No similarity check during keep period: The code returned early during the keep period without checking if the frame was actually similar to the reference. 2. keep_count doesn't reset on different frames: The counter should track "consecutive similar frames," but when a different frame arrived mid-count, keep_count didn't reset to 0. It only reset after going negative (after a drop), causing the counter to accumulate across non-consecutive similar frames and drop frames earlier than expected. 3. Reference frame drift: When similar frames were kept due to keep_count, they became the new reference. Over time, tiny differences (sensor noise, compression artifacts) accumulated. Frame N got compared to frame N-1 instead of the last different frame, allowing gradual scene changes to slip through undetected. Now decimate_frame() checks similarity first, then applies keep_count logic, returning distinct values: 1 = drop (similar, over keep threshold) 0 = keep (different frame) - updates reference, resets keep_count -1 = keep (similar, under keep threshold) - preserves reference Signed-off-by: Dana Feng danaf@twosigma.com --- libavfilter/vf_mpdecimate.c | 49 +++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 15 deletions(-) diff --git a/libavfilter/vf_mpdecimate.c b/libavfilter/vf_mpdecimate.c index 0fc95556b7..5b1654f671 100644 --- a/libavfilter/vf_mpdecimate.c +++ b/libavfilter/vf_mpdecimate.c @@ -109,19 +109,18 @@ static int diff_planes(AVFilterContext *ctx, /** * Tell if the frame should be decimated, for example if it is no much * different with respect to the reference frame ref. + * + * @return 1 if frame should be dropped (similar, over keep threshold), + * 0 if frame should be kept (different), + * -1 if frame should be kept (similar, under keep threshold) */ static int decimate_frame(AVFilterContext *ctx, AVFrame *cur, AVFrame *ref) { DecimateContext *decimate = ctx->priv; + int is_similar; int plane; - if (decimate->max_keep_count > 0 && - decimate->keep_count > -1 && - decimate->keep_count < decimate->max_keep_count) { - decimate->keep_count++; - return 0; - } if (decimate->max_drop_count > 0 && decimate->drop_count >= decimate->max_drop_count) return 0; @@ -129,6 +128,7 @@ static int decimate_frame(AVFilterContext *ctx, (decimate->drop_count-1) > decimate->max_drop_count) return 0; + is_similar = 1; for (plane = 0; ref->data[plane] && ref->linesize[plane]; plane++) { /* use 8x8 SAD even on subsampled planes. The blocks won't match up with * luma blocks, but hopefully nobody is depending on this to catch @@ -141,8 +141,21 @@ static int decimate_frame(AVFilterContext *ctx, cur->data[plane], cur->linesize[plane], ref->data[plane], ref->linesize[plane], AV_CEIL_RSHIFT(ref->width, hsub), - AV_CEIL_RSHIFT(ref->height, vsub))) - return 0; + AV_CEIL_RSHIFT(ref->height, vsub))) { + is_similar = 0; + break; + } + } + + if (!is_similar) + return 0; /* Frame is different - keep it */ + + /* Frame is similar - apply keep_count logic */ + if (decimate->max_keep_count > 0 && + decimate->keep_count > -1 && + decimate->keep_count < decimate->max_keep_count) { + decimate->keep_count++; + return -1; /* Similar but under keep threshold - keep without updating ref */ } return 1; @@ -200,29 +213,35 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *cur) DecimateContext *decimate = inlink->dst->priv; AVFilterLink *outlink = inlink->dst->outputs[0]; int ret; + int result = decimate->ref ? decimate_frame(inlink->dst, cur, decimate->ref) : 0; - if (decimate->ref && decimate_frame(inlink->dst, cur, decimate->ref)) { + if (result == 1) { + /* Drop: similar frame, over keep threshold */ decimate->drop_count = FFMAX(1, decimate->drop_count+1); - decimate->keep_count = -1; // do not keep any more frames until non-similar frames are detected + decimate->keep_count = -1; + } else if (result == -1) { + /* Keep: similar frame, under keep threshold - don't update ref */ + decimate->drop_count = FFMIN(-1, decimate->drop_count-1); + if ((ret = ff_filter_frame(outlink, cur)) < 0) + return ret; } else { + /* Keep: different frame - update ref and reset keep_count */ av_frame_free(&decimate->ref); decimate->ref = cur; decimate->drop_count = FFMIN(-1, decimate->drop_count-1); - if (decimate->keep_count < 0) // re-enable counting similar frames to ignore before dropping - decimate->keep_count = 0; - + decimate->keep_count = 0; if ((ret = ff_filter_frame(outlink, av_frame_clone(cur))) < 0) return ret; } av_log(inlink->dst, AV_LOG_DEBUG, "%s pts:%s pts_time:%s drop_count:%d keep_count:%d\n", - decimate->drop_count > 0 ? "drop" : "keep", + result > 0 ? "drop" : "keep", av_ts2str(cur->pts), av_ts2timestr(cur->pts, &inlink->time_base), decimate->drop_count, decimate->keep_count); - if (decimate->drop_count > 0) + if (result > 0) av_frame_free(&cur); return 0; -- 2.39.5 _______________________________________________ ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org