From patchwork Wed Feb 14 12:05:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 46263 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:c493:b0:19e:cdac:8cce with SMTP id eo19csp331169pzb; Wed, 14 Feb 2024 04:04:42 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVuW3AnZP1rgsgDuE4nFJRPDwtVEnyXITJSSKgZ70ugw4Rrlt5QXzjMDcR5ypuwCd/2TTnamWkagXido7P7RrqD1mVTyFpVK2bLSQ== X-Google-Smtp-Source: AGHT+IEKPzmQwxFpYqJtgkIKZ2ydGKi7WFWV7ThTQhV5WcrLnYSeRzc1SC4X+6jf/rrWyETMEPR4 X-Received: by 2002:a17:906:3591:b0:a3d:3781:6edc with SMTP id o17-20020a170906359100b00a3d37816edcmr1300738ejb.55.1707912282116; Wed, 14 Feb 2024 04:04:42 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVmTjxcA+r3HP5jF1l69bJI5R5c7FQar9OEG9qyYWLJyWDk4pEwTROW6flqVCabAXzfASoNex+vxg91FGbmPL85MmUXpnbK+YT0/6njJ+oiJBu1boUn7nDpF1rPP2M+mnAVQy3aBJ/a4QggqUZCC9N122UcpQ5CMlplNnOxodSaeujiNdNTOASdo7HljlrrDFt/1OQsFs24XgZ4NH8rA+DiMDRTyk1/58OqWQYE4Ihy2dISo4nPM8zrOhKeyt/nZ9Zp8aNU4o2Bhmtm7rg1dJKsQAqq3FwGWlG25WaNTK+K8PqbP9SNqkFGCKnv+jeedVZYivOFDPr0Jyww6E9zFwwjJ7Q35uJZpTekWDFC9m9jUt1U6WcbvDAp0tJo4gRNMbnVH4KVSIklGqZOBli5V14PkB9kXKwNkO2uZl2eGccGH52NicsLMpaADCKZsL9MaZfPpjMLr2FHuSjk/1Q7dl3F2c6nGMONwu61+lL2d2mq0zIZM4KzWNXk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h7bc/PplsUoKKk8V7ncIowVz778p Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id pk5-20020a170906d7a500b00a3d18b8d38csi1198650ejb.595.2024.02.14.04.04.30; Wed, 14 Feb 2024 04:04:42 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b=YHQufXv3; arc=fail (body hash mismatch); spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5B1EB68D1CF; Wed, 14 Feb 2024 14:04:13 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05olkn2018.outbound.protection.outlook.com [40.92.89.18]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2118B68D1BB for ; Wed, 14 Feb 2024 14:04:10 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VWAs+320o0i5evucJ7RB8YjVWUhzl/+zUqpKFiC6JSs6soxAiVwtc30OiWqZ7HNGKhAcgYOk/ZcBHwnXGAmiI1kBupi+y87QdEqRTBG47RZ141WLhAwYr/UO2q8PT84vomb5aELa5MzzkuedVv3I5MEhqDffhw8CuDbIf/8yczkMxlkJ3QFm00829F6ELUw+bv4a1SetQqZSVuSH6Rj6T3mJnQWIpW2CM1RhdXKLLLdL1c50idqyfFrzIJzwg1G86H6B4lzt3MZT/iMsOs7tJtUPgFKAs+XCO7/na1z2y3hBLplRrRYzPq/wGaaRRJxnamG6db5DM6SQh32QIpUwGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=Q0xRhpIktF0rsRFCaDqJxw9zkMi7/fQMfHT7mV7rS3Q=; b=P8T1xLRufhu5siO/jagmExK5G3X9Kfu1v7nT71q5Qc0s8RGFQg/2DHx9muLSWTF0RUqXLABHGJAjxMIN9iKH1xtE17YhpG2mJZdzxaz2d9hu2Z9JwrLqjrODDDIs9TRyNuzlOARMZ2Ymq0x2az2tdIXV/13v+3tYcRoa0G+nRCPZO+CR071EQXMeImhuyHu7G9cEzXlxHLwzNTSBrTs66KbCHYyA7FckEMVrVqd2VBUL+Jt35GFcvAU8s9NYOYaHSp3AwcUy86Z5w0yfA2Rl4l3Zb9lO+mkiFRrbAgreSI0XIUjgsxvRmoMsCltc5kArVSuUxPcMea1KAwe5xwLvvQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Q0xRhpIktF0rsRFCaDqJxw9zkMi7/fQMfHT7mV7rS3Q=; b=YHQufXv3lqPJsMD4JAZRJFM8890iCjrgnEPMw/oIq3m0c8lX73UoZ/TcYorviQ0v6Sc+T5mgoTJw24vJKjseSY0lugZyJ6UDGlwrttBCfjHXLi3JyDnoVThppRNw1jgGliuuOqVBg/ldox6Y/d6dnq6LYwS20aTjw/yh86MUitZqSGrNi2A5Yih9HBvLMiguv5yc6ye4af7TRhCnovkY74BKRB2iHe23pb56Ijz44662MWIU7sF0lFNxnym514aeMgiRYIFBZIXUGJi3MOfJ5VYQjnPaO8eyJqg1C58CRy/TjInY59PTe8x7jexEf4V2jHJBWkLQyp2XHbF0w3dxkQ== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by DU2P250MB0173.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:27c::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.39; Wed, 14 Feb 2024 12:04:05 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::65aa:deb0:a18e:d48d]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::65aa:deb0:a18e:d48d%5]) with mapi id 15.20.7270.036; Wed, 14 Feb 2024 12:04:05 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 14 Feb 2024 13:05:34 +0100 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [husQLO5XFDg+JHGuCyJNy60hokhD1ngkbuC1JHTlo2E=] X-ClientProxiedBy: FR3P281CA0169.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a0::8) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20240214120534.587472-4-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|DU2P250MB0173:EE_ X-MS-Office365-Filtering-Correlation-Id: 1bd724b3-7edb-461d-d960-08dc2d550a56 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DA+fUIWVr/WO3sv66uPWjHw9vGbMc9fDkpP3z7OQX5BWxltR6xoK4iqenytlNoliZCVxBteMTa9bf1SGIZ+rNaH9XkAlaYyrP1Fp9biqXxy1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bot30faAUfICaHiqtrZDFB1d8yM+BvDxTf8hGPnHWc1aVlIcHIpKRONScm3ask7t/chPKihqKVsj0Pi9y9FrzoiQALLzns7NacA83o1Y2iw7C9zxQSCm8J6iVFI49n4qvPXX4UTLMp1IbhVy3jDUpVXZWGSu1uOkIvUAkgeUfRH//WTy3yyxSvMHtqgg7cwofDiLn5Ilj2H7A8kDczle+0lcZXKy2pg66+Qg8rn1wdBZe9lYRh2SSKiZXokvSLINzzvinCgK3h7yYAGYZjJX7jzvhklQlMfLIy77/lLy8bFdGcHlrFmwsTukTZ7sYiXSSSBZdvl5fWQAA6/Dorp+yVjEHAhrq/fmmY64sdvteB8uk0pjMDyHYLHp12eYMYG6jqq5Tc4uMt8EK5+bY0W7yajVrAW6NYVvFadX5qrT7EoNgbYtMnn3Pw5voFpEhobvIcqUgh7JZBVLpf8vzwOufuccBb4UJqWdFpVQaB3mRxFBbIJdBQ6m4pBfC4xJ0p0zQnT+z7z2EAy2Q+FhOGvpY7kWNBORonwOirLoxOaIQPNgzsBDvIg1CnbW6S/oLDuJu3bwvXaK3j/j13ZGhsNtdRyJfktG5nLoFciwYItsIW3LB0Tkw57FjAb9zebaElVoMDfYEi2Um/G90C1+nJ3SjUC+Wxi214E79kjSezDXBS9dD2za8+7+mIvFzBmF68vxNU/E42vKTLfTSrk1VR0PlYeA+tMBXRROvUvwbteumHFqHv4MhNedNV33QBcs07QWVCfK3YjRXk3J+ilbbLiUEx8AdZVj90ry1mg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1bd724b3-7edb-461d-d960-08dc2d550a56 X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Feb 2024 12:04:05.0594 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2P250MB0173 Subject: [FFmpeg-devel] [PATCH 5/5] avfilter/signature_lookup: Avoid branch when adding to linked list 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 Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: g7lOtDiT+QiM Signed-off-by: Andreas Rheinhardt --- libavfilter/signature_lookup.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/libavfilter/signature_lookup.c b/libavfilter/signature_lookup.c index ff0d23c5c7..9c69c02fbf 100644 --- a/libavfilter/signature_lookup.c +++ b/libavfilter/signature_lookup.c @@ -187,7 +187,7 @@ static MatchingInfo* get_matching_parameters(AVFilterContext *ctx, SignatureCont size_t i, j, k, l, hmax = 0, score; int framerate, offset, l1dist; double m; - MatchingInfo *cands = NULL, *c = NULL; + MatchingInfo cands = { 0 }, *c = &cands; struct { uint8_t size; @@ -295,16 +295,10 @@ static MatchingInfo* get_matching_parameters(AVFilterContext *ctx, SignatureCont for (i = 0; i < MAX_FRAMERATE; i++) { for (j = 0; j < HOUGH_MAX_OFFSET; j++) { if (hmax < hspace[i][j].score) { - if (c == NULL) { - c = av_malloc(sizeof(MatchingInfo)); - cands = c; - } else { - c->next = av_malloc(sizeof(MatchingInfo)); - c = c->next; - - } + c->next = av_malloc(sizeof(MatchingInfo)); + c = c->next; if (!c) { - sll_free(&cands); + sll_free(&cands.next); goto error; } c->framerateratio = (i+1.0) / 30; @@ -325,7 +319,7 @@ static MatchingInfo* get_matching_parameters(AVFilterContext *ctx, SignatureCont error: av_freep(&hspace); av_free(hspaces); - return cands; + return cands.next; } static int iterate_frame(double frr, FineSignature **a, FineSignature **b, int fcount, int *bcount, int dir)