From patchwork Tue Oct 11 13:13:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 38689 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:4a86:b0:9d:28a3:170e with SMTP id fn6csp858079pzb; Tue, 11 Oct 2022 06:14:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7X7iFhT7e6JzywqTuPsGnWrkhUUoRNLsuvQoPaUamiWsZuOhThXxdirlcOagMlpie9Cmag X-Received: by 2002:a05:6402:33c4:b0:448:e63e:4f40 with SMTP id a4-20020a05640233c400b00448e63e4f40mr22474941edc.203.1665494041167; Tue, 11 Oct 2022 06:14:01 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id sb5-20020a1709076d8500b0078d9f02b452si8282437ejc.861.2022.10.11.06.14.00; Tue, 11 Oct 2022 06:14:01 -0700 (PDT) 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=CSl04FQr; 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 C7F4D68BCB0; Tue, 11 Oct 2022 16:13:56 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-oln040092074054.outbound.protection.outlook.com [40.92.74.54]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EEDFA68B6D3 for ; Tue, 11 Oct 2022 16:13:49 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PiztzzK3qRC+9kWKYfI26no2wVdwJUjhsX26t2pixp/B1TXX7otJu5EjVDVjBc6SmGsVHd2d+knIv7UQG4osRod6/JOS6hfeaiqMhOVaYM69hi/FQqJuMOZty8krdoP6u2d86oESA3BbytEucuaZq92Kf8bYOQmOoCB2NzHI9KPIq7WE9PNbqSjORQvLZwng9MsyRMUZRwurbxjo56YB4K50H1nCtawiegHM9TgAIhQGP/4HcJLChrle0NyIH9eCYqRBGe3rUMf5y2wMDIWF8D5+a8rcs9hekhiBCA2ibnQNFt0PQVN/fCp08U80rn4XxMYMz6TAsjVRq1wieRgaOg== 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=/HY8sSlP9ak5JvCapQRn5rrvnPF1VO7WgGPOxypwnNw=; b=Fux09qE4kncycvjvU/mgYDrCEidyec1BVSGtOBYLcFV7IuaKEhiOdIZ0sle0INTxmHrgZl1YDyumrq2KthNOeMV/TqsHTjvH8eFhkovt3eKwZ7xeZrHL8aPQGvQSLAUfevDqfkcRqFbwA+mTOAfUJU1lAp4KrN/XRhE4cs+5Rt11FCUV5CUOhVFq6QAq/Rhl2tTu75NDfdocv0q7QqQzm8XbxiXfChq0YYagUvuUqbD+yZIsjEfds24PZ+89wVwpCtRFP2bTYIOiOIwTZvAc5K0fTSrjgN/aUYTAhb0f51rljPKrYa55sLxMYeLRj5a9mjMQhLuUVyr+l4IS4V8eiw== 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=/HY8sSlP9ak5JvCapQRn5rrvnPF1VO7WgGPOxypwnNw=; b=CSl04FQrw6hpW72Xpe415LfN/BKzIYIEaEgDGNpsZ50gfLXdDcedIwaX7xKE3FMuinsHDp+frHLvMNpl/Hnh++tNmtBt94Bpdamik8kwBFYYIZPY2D9OTJy+PNVwxY3mgmuuUf129gMMKqtl8OuDgTWZDr/XqiDmDrsaT3djC2crNuFdCXZHKhW+aaUC0n8aZkmZKYwrAYPo6vdq0FZNcNpZBoxpjNRjJFbMbBwOa21rb0q6EWdg8sF9jSHoUUxrg86xW1gblCBZxsaqBr6ri35RlXVYZHuSzo8MPRKpaq1AvrgXL+ZkUO6i6W5zxcFiqM1QPfYdXjNngnULkq6d3A== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by PAVP250MB1001.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:302::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.15; Tue, 11 Oct 2022 13:13:48 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::f9d7:680f:70c4:44fe]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::f9d7:680f:70c4:44fe%7]) with mapi id 15.20.5709.015; Tue, 11 Oct 2022 13:13:48 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 11 Oct 2022 15:13:47 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 X-TMN: [a1EWfAXKLk+83lp1kKMzXr+QPk3rCo/r53omOCxUCkA=] X-ClientProxiedBy: FR0P281CA0133.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:97::11) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20221011131350.798335-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|PAVP250MB1001:EE_ X-MS-Office365-Filtering-Correlation-Id: e583d5ce-4af0-40fa-748a-08daab8a6ecd X-MS-Exchange-SLBlob-MailProps: AZnQBsB9XmrX3tRgoAVQMyLtzc9VHIfAiZwZqTpo9P2aPEferaFq6nfwusmLeSH+FT6RRuGg5jz6ZZN1w85zqdDCko96pXBEaRC2KGQeypC+Oo10Fr92TsXyAzme+nf3updU7M5AMnPOhE0zlpBpaSbze3aUv5VYOroJ3ubkSO+7+iyxgZb2+ktPW3RfZAN+DzRcsrL8sw0kyIO/M+whg/fcJaN0UyAPF3R0bJ1GPtSbh0iG1cmS7E0U9qJam9phGrmB+DGpMuN2YYNT6gQMevvBzq/Fk1Zg3lw6QOZr/q/DzNeCSlg7/g0TIXSmkgkH1pFzvkSapgQV6BCUloj+eF57UZ/AWMewZbDGnU4CTtjyx89kSxNB0oQ7hJn1Onq32Ooq2jPa7dicRP3fuv4etkF52h82AI33KF6S9+tqFSr8rNzGdTWmXogmAwtf3rB+UUCalp1jT0CLTUYSKU8KXidbzHrtaCZl6k0XdT+I7pgHjXitBsiDicGjY+cxrr2mw4n/XBd8MdGRixUamkAtOPo7YhfNkombmL3UjSPvTgsN6D8a0zGmexg1ofXfESl7xZvNeCcYxh64KJhqG76SKOie6z9KI/1hZzIoexKJIl4UaDVSJ+yF3u1/8BElysuTJWMNS4peXYkXf+ti4Bk/nxRJGMW0JOOwUVAqoCOOBpDzZvk7oW6snYZ0AXOWgQ5JQbrX1IXXQUcNCU+PqrAk5E0SHiNu7bkXB57hjhCeu3h1Vf0R5umvf3SJMrCLY7npQr7UPW4uNU0= X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: guhV4LVQsf/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daab8a6ecd X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2022 13:13:48.1640 (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: PAVP250MB1001 Subject: [FFmpeg-devel] [PATCH 1/4] avcodec/svq1enc: Inline constants 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: M6ad77kKNFFL Signed-off-by: Andreas Rheinhardt --- libavcodec/svq1.h | 7 +++++++ libavcodec/svq1enc.c | 13 +++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/libavcodec/svq1.h b/libavcodec/svq1.h index 0ebc73a933..af8a7dfa04 100644 --- a/libavcodec/svq1.h +++ b/libavcodec/svq1.h @@ -42,6 +42,13 @@ #define SVQ1_BLOCK_INTER_4V 2 #define SVQ1_BLOCK_INTRA 3 +#define SVQ1_BLOCK_SKIP_CODE 1 +#define SVQ1_BLOCK_SKIP_LEN 1 +#define SVQ1_BLOCK_INTER_CODE 1 +#define SVQ1_BLOCK_INTER_LEN 2 +#define SVQ1_BLOCK_INTRA_CODE 0 +#define SVQ1_BLOCK_INTRA_LEN 3 + extern const int8_t *const ff_svq1_inter_codebooks[6]; extern const int8_t *const ff_svq1_intra_codebooks[6]; diff --git a/libavcodec/svq1enc.c b/libavcodec/svq1enc.c index ef6655c2f7..79e9e578ac 100644 --- a/libavcodec/svq1enc.c +++ b/libavcodec/svq1enc.c @@ -390,9 +390,8 @@ static int svq1_encode_plane(SVQ1EncContext *s, int plane, init_put_bits(&s->reorder_pb[i], reorder_buffer[0][i], 7 * 32); if (s->pict_type == AV_PICTURE_TYPE_P) { - const uint8_t *vlc = ff_svq1_block_type_vlc[SVQ1_BLOCK_INTRA]; - put_bits(&s->reorder_pb[5], vlc[1], vlc[0]); - score[0] = vlc[1] * lambda; + put_bits(&s->reorder_pb[5], SVQ1_BLOCK_INTRA_LEN, SVQ1_BLOCK_INTRA_CODE); + score[0] = SVQ1_BLOCK_INTRA_LEN * lambda; } score[0] += encode_block(s, src + 16 * x, NULL, temp, stride, 5, 64, lambda, 1); @@ -406,7 +405,6 @@ static int svq1_encode_plane(SVQ1EncContext *s, int plane, best = 0; if (s->pict_type == AV_PICTURE_TYPE_P) { - const uint8_t *vlc = ff_svq1_block_type_vlc[SVQ1_BLOCK_INTER]; int mx, my, pred_x, pred_y, dxy; int16_t *motion_ptr; @@ -417,7 +415,7 @@ static int svq1_encode_plane(SVQ1EncContext *s, int plane, init_put_bits(&s->reorder_pb[i], reorder_buffer[1][i], 7 * 32); - put_bits(&s->reorder_pb[5], vlc[1], vlc[0]); + put_bits(&s->reorder_pb[5], SVQ1_BLOCK_INTER_LEN, SVQ1_BLOCK_INTER_CODE); s->m.pb = s->reorder_pb[5]; mx = motion_ptr[0]; @@ -442,14 +440,13 @@ static int svq1_encode_plane(SVQ1EncContext *s, int plane, decoded, stride, 5, 64, lambda, 0); best = score[1] <= score[0]; - vlc = ff_svq1_block_type_vlc[SVQ1_BLOCK_SKIP]; score[2] = s->mecc.sse[0](NULL, src + 16 * x, ref, stride, 16); - score[2] += vlc[1] * lambda; + score[2] += SVQ1_BLOCK_SKIP_LEN * lambda; if (score[2] < score[best] && mx == 0 && my == 0) { best = 2; s->hdsp.put_pixels_tab[0][0](decoded, ref, stride, 16); - put_bits(&s->pb, vlc[1], vlc[0]); + put_bits(&s->pb, SVQ1_BLOCK_SKIP_LEN, SVQ1_BLOCK_SKIP_CODE); } } From patchwork Tue Oct 11 13:18:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 38692 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:4a86:b0:9d:28a3:170e with SMTP id fn6csp861144pzb; Tue, 11 Oct 2022 06:18:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4qJHfN339q2exyVUEupy4ZBON2cLmGhAQjg2NWWK1X/L0t2uEvVTHXHOwCopM6rHZuyEoH X-Received: by 2002:a17:907:80b:b0:77a:86a1:db52 with SMTP id wv11-20020a170907080b00b0077a86a1db52mr19534347ejb.294.1665494336965; Tue, 11 Oct 2022 06:18:56 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id sh37-20020a1709076ea500b0073dd47c3873si1735001ejc.878.2022.10.11.06.18.56; Tue, 11 Oct 2022 06:18:56 -0700 (PDT) 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=H7OS2GfZ; 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 634CF68BCF2; Tue, 11 Oct 2022 16:18:54 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05olkn2039.outbound.protection.outlook.com [40.92.91.39]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 46CA468BC50 for ; Tue, 11 Oct 2022 16:18:47 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nNwvtC1vsyoeUpvKKnDoO4h3ZXqxzrUag61vVX60jTEqM6CfEnnH2gLSaAoSK3YHUBcjWQG9SUGnMedVNE1xcp/e9gHF1OaXbnkQm8x+EnWN2M44ixh19erqZuVhfwMIlX8ZiTC2x+eU1EeclMWwAmUOqv4ez6SyNCB8El/USm9WS8+uMEQyPlVB1I3jyFEuj2EuI58BcvjTz8OXR06TDpBDIHyc/Wh+NbXxroL2j63dGIfrcntiAjAyPq0jh3BwXFluBWDwyzQeN5qGJ+fFig3VKRju/ndUA6rYWu5SA3lSK/bYvWJ1cuV9+SYQwR6Q4d4Wd1L8ZNfGULfPAvVj9Q== 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=ggEVTij10VH0DMBpJxNJ/57rJ0kiEtWDA3qvQf0roUU=; b=ntcaIyIrzkTEkQJ+In/EuZOPPa0hRDx5ftCQF4/xSritKTHtiso97OefncLD+DLKqdsoXfEq/hwgUZVD3UZpXon3JFu8Zp1vhIW6LctDnHC44k6FF9R6dXKntnyB+23sMx83Iq8QWVfMuWscQ55TtrnyosvyK/nEfqWn+6AY10HiJ901taV/9LEGL5Ig6J0WAZeKlHXKIWbINpG1CFFzCkvph8zJ2QtRIcOOA5BH3wi3/9/xgvfm/nJg1D4wIBUIHpUKbpOWPWxqU89Oh4PunsYZRXxZGzsp3UAcNDmOqFFp7D+5rTs+NJATJ6P+aXsFFdzTxlR+VxxnaM3jyzfYBw== 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=ggEVTij10VH0DMBpJxNJ/57rJ0kiEtWDA3qvQf0roUU=; b=H7OS2GfZYlYM6z5n2uXbawvaOm2MR1NSH3PDmX24tcvGrinkyoQaRpd1qK+oe3l/u+aYmwZ/zLZUEbhLkv+tt5DL+G2pE/UPXaY1qcsvDdsFewXn2VYnpF6Sm9M93/7LsrD6MhGMO0A6S1XSrLsAjrYGn5OUKu7UjaSrRalRY/8eWnSudgsYmcCA1fFZhCBuhp5StZHXF0oCIt4RWShphHElICfDNc5if34UorpMmgncwd5bKC0UDGulyTOUZ8yyCXyg0OxLtR52P9su0dv/CQWLC4NMVSuIua3CJj8u/+HEuIshK4aB3iQ+qw2VkK/FgLGUMX9aV3/eXpDctc5oNw== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by PR3P250MB0340.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:17f::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.15; Tue, 11 Oct 2022 13:18:45 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::f9d7:680f:70c4:44fe]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::f9d7:680f:70c4:44fe%7]) with mapi id 15.20.5709.015; Tue, 11 Oct 2022 13:18:45 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 11 Oct 2022 15:18:46 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [CNMMgOA6aEiJNi8ZeNobGjybr6Eh+J0EFVwiHVBD1dM=] X-ClientProxiedBy: FR3P281CA0048.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:4a::20) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20221011131848.798459-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|PR3P250MB0340:EE_ X-MS-Office365-Filtering-Correlation-Id: 5b1965f6-8cef-43b3-3249-08daab8b202a X-MS-Exchange-SLBlob-MailProps: ZILSnhm0P3kF9Z1W9BPVdBUiZmKrnp+J8CaVNoelKeQz9b1lBDJICYkU62c8rOKm6W2afhawxyU0QxBR2N26eWsUXnl+NWZ8/mdIybfXt9oeovxaKjyvuVsF7A9+lq02Sf0/byuKdgul0MbcV0FbHFnBodhzXMoDdDrP6zcJOx0qtXFh0i8Q+qH8UU0ZqQhXmc2FHfh8YpU2FcNxPuQzsw71VskjM+tfuQCFQXHNW12rvG3R0PbtExFLLOcLFMcOj/yCTutpwf6S52cbUDvzjOpynr58+K265s101nkyxCIGUftZYaQmGY5VVnqi1wUY3YFThZkO6bjs76HhzGOb+6v8DUpnAFOL2+Ycay1xP+OkNOHwtOuRF9P0oRoSxfcCW17oXBpG+ZCLW1PdwhfRciKUIxxujxAYBZGMQZAdzgcenAWFvc9Qr1hSwHogKZ1TJ1VVvoPKNnx2YddTLj9A2aevMEATIvnpABPqaB9n0y1v4zUYbU/jzBCcCgQjonkML/jQDEKrjjthh5fKu8oAgOEaT9EBIy8TcwSJqgSI+WsYTSrHqXw7qJxRYLcstc848831mnUA+fNRzM7wAceVgOE3mjM/meKTzjXqqRHrk6UvcEQhPbwRkCTL0uNaUv77pZEi4NjzwU+Iv29b7ffWd4HSuyMYvIVW7RpU9k5lCBbLZjNR8jaki5ARyK/0KwJZtHpzrE5nvxX2CFYRyp43y08sgb1BDJrl4VxMPgiCE8jtI8hUnsi55FOsUv3vPCCI7WuxWpyjvmMmZ4tFRqzj+yQMLejSjpRR X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NRwGmLTUj46o+Vr3jrFEsSBvG9MQGOWHLNLrIIWXzWI7xW6/DcFW4pyzj4U1VSMKeYrKzos5YEMJe70YzFOMW9DhFdRfzbXru7QRJo74TVfmEnVAzcgz2N4fyjomgQ+vtJjuu+t9fSazXGwHXkex3u9t8AohQqXWofApYT/+dK+0vmE7Mz9VsbyiuCAGKUrU6JVaVBFpB74Eh8fPv+a/wkVUXFYbLcJe8oeQNEgM2xQUhev6nKTPHtsAlPoT7YV29cFI8b7+tjrjxnLm96fBFFnHJVRuI5eRqawx5hmfiNi+/5ablA30kBpWclJUMHVgw5J9b6+MioziAmXMtZzLMAR16Uxjj/37C/wS7IskByriGwkSzrGQ17XwyL7lqwFLBobyUZiZ2AaRBcB4lxtegUqhzpr/wwZXLVC0rplEVwYI1ipKRNpVEM4YZRxBlZFwth5tmYR+DdqzcayX/InDZWu3pVNl9LSFZKmYiR1cusxtCVM7gU7FDmX+rCAV7RMcs2nKfF96mCFqt5bPYt+Oek1YygMPoV5+4+6fI+3dAXFv0RKoRYM53p2qGNIk/nPD0Kkc5+fmf8mhW7MqqxyoaLRdmaY3rk/302UDKLUL+RyXUk/c2ECWq/fcOocWyx3l3uO90DXrD1CKDY8iHc5FanRRbnA/9pUk/aP9GE+EEzS/t/spbdBsK1zvli7nc2wZ X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: kQby2YbHBfqyxggGHuuWRe7cX3ZZWEGW5nq/31GLUzyYrjUpis91DY92q9Rdf0zZ8xOZyvDCyw+WqRDR9q5jJuNWICMfxaPz1wSVhPmmKoCpWicrqqUQWd08ggjXPWNBH9gOZYOa6H+xMCrWOKG3SjTCnfmswtFDx0Rn03OGotZO6FqvWECvfdxeKbqJiXpETzULOGvpbqYAk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RAkZUU2EbkPlne0RoY+eV7dNpbvhXJnXKPBtNv11xWCQWIa23JOmKSoEZArU5 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5b1965f6-8cef-43b3-3249-08daab8b202a X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2022 13:18:45.6973 (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: PR3P250MB0340 Subject: [FFmpeg-devel] [PATCH 2/4] avcodec/svq1enc: Add SVQ1EncDSPContext, make codec context private 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: oPo751qCHvQ0 Currently, SVQ1EncContext is defined in a header that is also included by the arch-specific code that initializes the one and only dsp function that this encoder uses directly. But the arch-specific functions to set this dsp function do not need anything from SVQ1EncContext. This commit therefore adds a small SVQ1EncDSPContext whose only member is said function pointer and renames svq1enc.h to svq1encdsp.h to avoid exposing unnecessary internals to these init functions (and the whole mpegvideo with it). Signed-off-by: Andreas Rheinhardt --- libavcodec/ppc/svq1enc_altivec.c | 4 +- libavcodec/svq1enc.c | 60 ++++++++++++++++++++-- libavcodec/svq1enc.h | 86 -------------------------------- libavcodec/svq1encdsp.h | 34 +++++++++++++ libavcodec/x86/svq1enc_init.c | 4 +- 5 files changed, 93 insertions(+), 95 deletions(-) delete mode 100644 libavcodec/svq1enc.h create mode 100644 libavcodec/svq1encdsp.h diff --git a/libavcodec/ppc/svq1enc_altivec.c b/libavcodec/ppc/svq1enc_altivec.c index aa66b40996..5721bede34 100644 --- a/libavcodec/ppc/svq1enc_altivec.c +++ b/libavcodec/ppc/svq1enc_altivec.c @@ -27,7 +27,7 @@ #include "libavutil/ppc/cpu.h" #include "libavutil/ppc/util_altivec.h" -#include "libavcodec/svq1enc.h" +#include "libavcodec/svq1encdsp.h" #if HAVE_ALTIVEC static int ssd_int8_vs_int16_altivec(const int8_t *pix1, const int16_t *pix2, @@ -71,7 +71,7 @@ static int ssd_int8_vs_int16_altivec(const int8_t *pix1, const int16_t *pix2, } #endif /* HAVE_ALTIVEC */ -av_cold void ff_svq1enc_init_ppc(SVQ1EncContext *c) +av_cold void ff_svq1enc_init_ppc(SVQ1EncDSPContext *c) { #if HAVE_ALTIVEC if (!PPC_ALTIVEC(av_get_cpu_flags())) diff --git a/libavcodec/svq1enc.c b/libavcodec/svq1enc.c index 79e9e578ac..67a6de5cc0 100644 --- a/libavcodec/svq1enc.c +++ b/libavcodec/svq1enc.c @@ -37,11 +37,61 @@ #include "internal.h" #include "mpegutils.h" #include "packet_internal.h" +#include "put_bits.h" #include "svq1.h" -#include "svq1enc.h" +#include "svq1encdsp.h" #include "svq1enc_cb.h" + #include "libavutil/avassert.h" +#include "libavutil/frame.h" +#include "libavutil/mem_internal.h" + +typedef struct SVQ1EncContext { + /* FIXME: Needed for motion estimation, should not be used for anything + * else, the idea is to make the motion estimation eventually independent + * of MpegEncContext, so this will be removed then. */ + MpegEncContext m; + AVCodecContext *avctx; + MECmpContext mecc; + HpelDSPContext hdsp; + AVFrame *current_picture; + AVFrame *last_picture; + PutBitContext pb; + + /* Some compression statistics */ + enum AVPictureType pict_type; + int quality; + + /* why ooh why this sick breadth first order, + * everything is slower and more complex */ + PutBitContext reorder_pb[6]; + + int frame_width; + int frame_height; + + /* Y plane block dimensions */ + int y_block_width; + int y_block_height; + + /* U & V plane (C planes) block dimensions */ + int c_block_width; + int c_block_height; + + DECLARE_ALIGNED(16, int16_t, encoded_block_levels)[6][7][256]; + + uint16_t *mb_type; + uint32_t *dummy; + int16_t (*motion_val8[3])[2]; + int16_t (*motion_val16[3])[2]; + + int64_t rd_total; + + uint8_t *scratchbuf; + + int motion_est; + SVQ1EncDSPContext svq1encdsp; +} SVQ1EncContext; static void svq1_write_header(SVQ1EncContext *s, int frame_type) { @@ -154,7 +204,7 @@ static int encode_block(SVQ1EncContext *s, uint8_t *src, uint8_t *ref, int sqr, diff, score; vector = codebook + stage * size * 16 + i * size; - sqr = s->ssd_int8_vs_int16(vector, block[stage], size); + sqr = s->svq1encdsp.ssd_int8_vs_int16(vector, block[stage], size); diff = block_sum[stage] - sum; score = sqr - (diff * (int64_t)diff >> (level + 3)); // FIXME: 64 bits slooow if (score < best_vector_score) { @@ -558,7 +608,7 @@ static av_cold int svq1_encode_init(AVCodecContext *avctx) s->y_block_height * sizeof(int16_t)); s->dummy = av_mallocz((s->y_block_width + 1) * s->y_block_height * sizeof(int32_t)); - s->ssd_int8_vs_int16 = ssd_int8_vs_int16_c; + s->svq1encdsp.ssd_int8_vs_int16 = ssd_int8_vs_int16_c; if (!s->m.me.temp || !s->m.me.scratchpad || !s->m.me.map || !s->m.me.score_map || !s->mb_type || !s->dummy) { @@ -566,9 +616,9 @@ static av_cold int svq1_encode_init(AVCodecContext *avctx) } #if ARCH_PPC - ff_svq1enc_init_ppc(s); + ff_svq1enc_init_ppc(&s->svq1encdsp); #elif ARCH_X86 - ff_svq1enc_init_x86(s); + ff_svq1enc_init_x86(&s->svq1encdsp); #endif ff_h263_encode_init(&s->m); // mv_penalty diff --git a/libavcodec/svq1enc.h b/libavcodec/svq1enc.h deleted file mode 100644 index bb6af082d5..0000000000 --- a/libavcodec/svq1enc.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * SVQ1 encoder - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_SVQ1ENC_H -#define AVCODEC_SVQ1ENC_H - -#include - -#include "libavutil/frame.h" -#include "libavutil/mem_internal.h" - -#include "avcodec.h" -#include "hpeldsp.h" -#include "me_cmp.h" -#include "mpegvideo.h" -#include "put_bits.h" - -typedef struct SVQ1EncContext { - /* FIXME: Needed for motion estimation, should not be used for anything - * else, the idea is to make the motion estimation eventually independent - * of MpegEncContext, so this will be removed then. */ - MpegEncContext m; - AVCodecContext *avctx; - MECmpContext mecc; - HpelDSPContext hdsp; - AVFrame *current_picture; - AVFrame *last_picture; - PutBitContext pb; - - /* Some compression statistics */ - enum AVPictureType pict_type; - int quality; - - /* why ooh why this sick breadth first order, - * everything is slower and more complex */ - PutBitContext reorder_pb[6]; - - int frame_width; - int frame_height; - - /* Y plane block dimensions */ - int y_block_width; - int y_block_height; - - /* U & V plane (C planes) block dimensions */ - int c_block_width; - int c_block_height; - - DECLARE_ALIGNED(16, int16_t, encoded_block_levels)[6][7][256]; - - uint16_t *mb_type; - uint32_t *dummy; - int16_t (*motion_val8[3])[2]; - int16_t (*motion_val16[3])[2]; - - int64_t rd_total; - - uint8_t *scratchbuf; - - int motion_est; - - int (*ssd_int8_vs_int16)(const int8_t *pix1, const int16_t *pix2, - intptr_t size); -} SVQ1EncContext; - -void ff_svq1enc_init_ppc(SVQ1EncContext *c); -void ff_svq1enc_init_x86(SVQ1EncContext *c); - -#endif /* AVCODEC_SVQ1ENC_H */ diff --git a/libavcodec/svq1encdsp.h b/libavcodec/svq1encdsp.h new file mode 100644 index 0000000000..91b36735d7 --- /dev/null +++ b/libavcodec/svq1encdsp.h @@ -0,0 +1,34 @@ +/* + * SVQ1 encoder DSP + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_SVQ1ENCDSP_H +#define AVCODEC_SVQ1ENCDSP_H + +#include + +typedef struct SVQ1EncDSPContext { + int (*ssd_int8_vs_int16)(const int8_t *pix1, const int16_t *pix2, + intptr_t size); +} SVQ1EncDSPContext; + +void ff_svq1enc_init_ppc(SVQ1EncDSPContext *c); +void ff_svq1enc_init_x86(SVQ1EncDSPContext *c); + +#endif /* AVCODEC_SVQ1ENCDSP_H */ diff --git a/libavcodec/x86/svq1enc_init.c b/libavcodec/x86/svq1enc_init.c index 787a5245f3..daf573beba 100644 --- a/libavcodec/x86/svq1enc_init.c +++ b/libavcodec/x86/svq1enc_init.c @@ -22,12 +22,12 @@ #include "libavutil/attributes.h" #include "libavutil/cpu.h" #include "libavutil/x86/cpu.h" -#include "libavcodec/svq1enc.h" +#include "libavcodec/svq1encdsp.h" int ff_ssd_int8_vs_int16_sse2(const int8_t *pix1, const int16_t *pix2, intptr_t size); -av_cold void ff_svq1enc_init_x86(SVQ1EncContext *c) +av_cold void ff_svq1enc_init_x86(SVQ1EncDSPContext *c) { int cpu_flags = av_get_cpu_flags(); From patchwork Tue Oct 11 13:18:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 38693 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:4a86:b0:9d:28a3:170e with SMTP id fn6csp861262pzb; Tue, 11 Oct 2022 06:19:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM76FfyrXa72VS26zJG81JLPHkEl7dY4CkkJIGdaFSLuD0vW96jk2H76i7l9N6CZdTfllV9b X-Received: by 2002:a05:6402:3589:b0:45c:28ea:ce17 with SMTP id y9-20020a056402358900b0045c28eace17mr8689257edc.290.1665494352017; Tue, 11 Oct 2022 06:19:12 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id b4-20020aa7d484000000b00456cc6e1017si11657774edr.109.2022.10.11.06.19.11; Tue, 11 Oct 2022 06:19:12 -0700 (PDT) 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=oThY+FpS; 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 745E268BD04; Tue, 11 Oct 2022 16:19:09 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-oln040092073056.outbound.protection.outlook.com [40.92.73.56]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CA52468BCAC for ; Tue, 11 Oct 2022 16:19:02 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CwtdU90To0Hz7NzWsjxasgnDPuq4yb9RP5C3xA87V5EflhAbOKaCsDIhrPv1WXx5eIuhcWTSwADWXoGvSvI1kb8bDQCG3gvdmjLqYUxx2kP3t7qb+p4xjOhOuXEYeSjjdKWOrjM/8TEg+0IKVSnJFBU/DJzabED+WTNmKbKWmg8lX8Ws7slww7U6KO0TRx+AL/qSNV9VilxigaTUJUWuiPDoaRqap4NJkIZH95IGfWZrzhzpUeTCwdwOlG1LwReA5IcoMYuYObwy2X4ZEj80lTtgoN8RsH0RnT9pYkn1b2aWzCy/GWz9ZVfh04VJhZsLwxU//wR9f0HElExDzv0P3g== 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=jPH9MSHXrJfy1Z6PE3hfF+Eibem1bozyHLxhkr+8H10=; b=hwwmqoYvmqPLqYCNhHF/+z5nVvtBf/qSxoZ50XCSOQxTBQHj1PvZ3xiSREBUX0KaTQkSL/cUEdAmKsm5skLBuBY4Gv/Da7iqEO3a8ouoXHxiHkiJrJXX+Ycw5TPN3bCnXKr3GZbRsKsbH4GB+ycBdh1J+xVs48K7CEdprh1/5Yjnp+dFANygbAwoNuEFwgKgbdiO7Psl2kfPuCSftIQEEWoGIP7XxXqeNDKqCiFN7K8WnMrG3i4NgE92x/RTiPPXB7wslYFarvFfJBOWbEn8mwnSHIPfv9wahMxsxXdhXEZPbcQX3k8S7cacuntYqA7cfzzVBjc1gVGMQiyxzq09og== 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=jPH9MSHXrJfy1Z6PE3hfF+Eibem1bozyHLxhkr+8H10=; b=oThY+FpSk5mqddw6LkxTJfF25iKlISAEu7lqZfyWhMhUyEmFGDnk60JieGxYUKfNUBU+/A0t7DdA9+cmTuPa51x9CfLq4rD+UYwhzsbR9rIwHZ5pMIRpobIJ5zpz9ooAFo1dG0BA92SFXuWAR/T8ozluiLBK5mm5K04SsOjbhOfMDkR+ET5hOnC9NO6Xcz4kAUXmE9l5Q8mz0WWPIPVTvsJrz9ksBIUMoN59fC7pLvVduocfPeJsJqfkxYg+OQgryODbNg4m7+4j9JgzVBPMBUXUpMr8gwcitvtcluMlHTc2E39vNKVK+7jndxewGGp84bFvEddCh+ro0GpKWerVpQ== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by PR3P250MB0340.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:17f::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.15; Tue, 11 Oct 2022 13:19:01 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::f9d7:680f:70c4:44fe]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::f9d7:680f:70c4:44fe%7]) with mapi id 15.20.5709.015; Tue, 11 Oct 2022 13:19:01 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 11 Oct 2022 15:18:47 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [FnfIXCXcuCe05nu5/IBBhFlXYhG+9EhuWYER+McEKZo=] X-ClientProxiedBy: FR3P281CA0048.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:4a::20) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20221011131848.798459-2-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|PR3P250MB0340:EE_ X-MS-Office365-Filtering-Correlation-Id: 966cc614-1aa2-4148-db84-08daab8b2984 X-MS-Exchange-SLBlob-MailProps: EgT5Wr3QDKyUDEYghf57NwGfQF3oPT0m4MDqn6y9CddxSscAGgtGTJghBS87UEkcGS+Veq2HF5kRRgKzd7alWJiGwTUPxyElr8cNE5h1N/mgGrCY3K4pIM5UKG3jH2D7huyHO6FGZc93i2OIFLcMJnL60HL/kwceC1Svbnp7ehYVnfShb3SSZP1Oi8LIuv5iJ5yor+0Gaq6MnD4J4U7T/zQ9oZ+rP0PB4kYTFPpzyhtKdb3ksoUe1uzhTklnY5rtpg0svG+0EgmBlCeAPmn0H94QTx5lT/t+MFyDEWZIYZaXTgBR5RgxLy1+1aEGjl/50RwD/HLBWxNEooxDXvnJBF51uBGGkZE4HklRB/x/xaf/UxGsvq5tH8SEVWwcTi3a/4imnMFuTiARZvHmJvOXgC6KRIlffZd5wR6KhQ5por9We5MGeesXM3lXKIQZ5OFCnmixjny8YOP82+ueP3eI54SKuan4nJzTfSHREmy4G9qHlFqOrNkOG+mmOmYSpnpBDPluyQBG5KOlTufWcGlRxKh264ZBTh9g1HNAYSWyxcqaolmJ1PUzJuVcFgT8n5A5KJU6dI8Kz/ZL9aVRZWTMFEtT9n3LcugeZUVrmMEV3NBvPz4YR2MWt8S2PpU/diozgm+r1XqOomaevg4RYJlNPA1ql/yuUqdd+Y7hfUYM6mKbVjPfRHyM71aC7+o6BbFuzsIs6NpAHiKKfx7IxdY/9raSsU1X6BKsLfYOrj5q6eU= X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: r1+niVhKVRvZh2xlnnMm2xnSvRLFTQPWhUca4JzAcZ9lRa1wldk5bzW+M70ydsUEIKhvqk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: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2022 13:19:01.3910 (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: PR3P250MB0340 Subject: [FFmpeg-devel] [PATCH 3/4] avcodec/svq1: Set hidden visibility 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: r0dMrHhx+J0O The encoder uses ff_svq1_inter_mean_vlc + 256 and setting hidden visibility allows to bake this "+ 256" into the general offset of ff_svq1_inter_mean_vlc and the code accessing it. For certain arches, this is also required for the compiler to not produce overtly pessimistic code that can't be fixed up by the linker lateron. Signed-off-by: Andreas Rheinhardt --- libavcodec/svq1.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavcodec/svq1.h b/libavcodec/svq1.h index af8a7dfa04..0ccf17c253 100644 --- a/libavcodec/svq1.h +++ b/libavcodec/svq1.h @@ -37,6 +37,8 @@ #include +#include "libavutil/attributes_internal.h" + #define SVQ1_BLOCK_SKIP 0 #define SVQ1_BLOCK_INTER 1 #define SVQ1_BLOCK_INTER_4V 2 @@ -49,6 +51,7 @@ #define SVQ1_BLOCK_INTRA_CODE 0 #define SVQ1_BLOCK_INTRA_LEN 3 +FF_VISIBILITY_PUSH_HIDDEN extern const int8_t *const ff_svq1_inter_codebooks[6]; extern const int8_t *const ff_svq1_intra_codebooks[6]; @@ -59,5 +62,6 @@ extern const uint16_t ff_svq1_intra_mean_vlc[256][2]; extern const uint16_t ff_svq1_inter_mean_vlc[512][2]; extern const uint16_t ff_svq1_frame_size_table[7][2]; +FF_VISIBILITY_POP_HIDDEN #endif /* AVCODEC_SVQ1_H */ From patchwork Tue Oct 11 13:18:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 38694 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:4a86:b0:9d:28a3:170e with SMTP id fn6csp861319pzb; Tue, 11 Oct 2022 06:19:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM58qKegdt+mCrZIW6Z9qetwN4gS/oHcxGHpD1dryOQ5RRB5KRTrhCOqSdslYoJwGjOkawMu X-Received: by 2002:a17:907:7f93:b0:781:dbee:dece with SMTP id qk19-20020a1709077f9300b00781dbeedecemr18806959ejc.323.1665494360608; Tue, 11 Oct 2022 06:19:20 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id w7-20020a056402128700b004597f82e556si12004667edv.201.2022.10.11.06.19.19; Tue, 11 Oct 2022 06:19:20 -0700 (PDT) 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=L1dzfguJ; 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 D735468BD11; Tue, 11 Oct 2022 16:19:10 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-oln040092073056.outbound.protection.outlook.com [40.92.73.56]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2380268BCAC for ; Tue, 11 Oct 2022 16:19:08 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OXsqbF16d5STsvTN7odNzqh4SMOp/G0xmjqQyLleOvh4zwuz4xwX90dY0cU3Wdp9SuoIh3Ga/zY+EZCq8+fBig0NS6ixts8u3hmNNIYlXwi+DO9rN52Afmk+CtmYO9aqJTXDhNZfIfp0nLvy0wwQZCELnCDU+AXLwKTmWAkLHqixk6o2O3c+hZMLAP5bjSi/p6qDPBegqv7n/AQ1s70nrtnUilFIYp9rzHGCuYa8e1lT27rw3ZYNVSPeG+YH0TOTfM3dNiZSop1pWnP1YhjuVugr8V4nZ31M2hyQWa/4qqDVf57PueNNlJVjqNQtg33az0ROkwRZGpMFMJlHqtlmCA== 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=B6dPaxw6zZBtyLkxk5kgxE/uTbSeTgVRKb3VUxo2Ixo=; b=SyfZHFzgIoE1TWFqjnrtWN1zenr6eJ0u/Qo93XixdRwX0Q9IKZSgoU2rhmq+Dm2VNnh01R6sczTCuuSFF6vjlUBtSKnQiwjy7/K9jEaA5RUmJZ/aXlrohE0IlyBCdgNNaDVP+t5c/4riylzzRQjfj5zgQJ6tzuTcaJSP6+v4MGdWbF172XZbs0GOGn3sLqFLb4WLolaQx4WMTzcOUbvPcxtCbBIP3MitFFEVf2Zo10tzwuYxBTyuwACMQG4Q7drWxMR9T5NmbsPUV8Vdu/usDlIhtyzrk+HY4pxd1XLB+F6+7vHMZUOnNojoUEnllM4IFsu642a33/rL5reoKzL2Ig== 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=B6dPaxw6zZBtyLkxk5kgxE/uTbSeTgVRKb3VUxo2Ixo=; b=L1dzfguJ6iI3ab5Ty9LyxBn6WxfKZA44zVYYvahc0SVF3kwIrPLHwFpJ8SU5ciOc76cX6c7OuyNrwiPx7Ti8zpOZ4c63fcW60AxF2ss3enfpslu/ev3CWgPlurDcg4LmWrNv3pJiPEJqNHdO9W4r9UakalBc5g23FBP36nN027q2xuFEXd0flCKenvp+8M6wkpypcOdppnSIeAtfPVHnFJTU9gFrrP/ARy6S41j68z40Xz917rF/dirRqGB/K0wrZHHJagysEaSrmo296bf9A1K3hw5efojddcyIu1DY6sae395RzYkTIpd2Xl2qYZNrh8J2lerivE8J+jAUGrK25g== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by PR3P250MB0340.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:17f::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.15; Tue, 11 Oct 2022 13:19:04 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::f9d7:680f:70c4:44fe]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::f9d7:680f:70c4:44fe%7]) with mapi id 15.20.5709.015; Tue, 11 Oct 2022 13:19:04 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 11 Oct 2022 15:18:48 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [yVUN+c+h1tz1tEisZuu61RZJhxe6+s//RtsSG8IqZJM=] X-ClientProxiedBy: FR3P281CA0048.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:4a::20) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20221011131848.798459-3-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|PR3P250MB0340:EE_ X-MS-Office365-Filtering-Correlation-Id: f3e7fc8e-8987-4d2f-3241-08daab8b2b45 X-MS-Exchange-SLBlob-MailProps: ZILSnhm0P3kF9Z1W9BPVdBUiZmKrnp+J8CaVNoelKeQz9b1lBDJICTKpc2RB+3MqnodhIxerRPcgEnnB/RDNyVA3egfYIQpdwauzboyrd2qswUaL7aVa6A2Ftl75NrBugEIZ51Ovom01SdbLDOmOP2R+JpcvNeDE1ndz5erFyle2M7PMPyFIu5xYHGs7QeeNDUsu+jOslqq0hQwTOlwdNCsfI0wCMkWbbYELy3cLPn6GaBRQ6FnN/GiEwaYiCgYNKxgezIYFzGkzblJ0PpJaxY7FFcJme4lvR4Hb6r/RoO8lgRqyk5xqkr3UotnzkWX23LGvfpIZtlaafVQeVyF9Zu8dr9lKSklHSxkdDLpOj19N/BjbS/ufT1AXeEqdLUlceELaSn4y1UCh7OeeXDr8qiiA6XK7LdSPRCei6Aby2NegqMTRJEqTRFCY2w+8ZCTm0iwHIm1k3ztZKRfEdVupeS5uDpBh5buL+8ffbhPbxSBNNbFHqcDX9Jz1jMlx2JbUqIKZRK1E9PiJiBt1ff31lSwIOKqB5+cj0uRnuBmkFVEuUHZEwHi+lmZR7KZHVDrEY81p4XLfDjWykX6GTTDgpN/ZW8ZdRV4qFFDCPuG4jCGP/LA7BMJfdfpRySAWVpI79fZudHQxlvzPoxBxXIyOhIJopOnC146LyUTCdNH4fTt94Jw3F1sl+dQf/CwrVIfIlolGpoXRNVzyt5jwPGchHacGjWfz6ptQWhnHTmTl9wzLcC7oZs0fishVt1u2wHZRj702f9USfXXsauo8NUeNeGgIX9KT0D/E X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vx+rRei0coeKiMkTib8pg1T+EP3YjRfHphnrG8XDAG7qEiks0dgx9OMRA0p/cUr3cIW000bSVj9k5xTGg+7tXs+HE7i130tjhFUcvHSSiKqm0cA/sQ0fSHwOvcBgHXHosf/wvgw0BMdOpGt3Hwf+giv3vxy5vw7/RDqGRpJKiS8MHsD+RULONNP3Vfchhb3EgtRIlgn2kKB2n15E+N3gozsSEsW3TdSptXpcolV0hIz2OWH9mFCaeOYgwqDDTkjfMK27kG1DSLeX+XQ3qOCtZutOn7JGS63Z0711AE3DUxvgvqr/lzjVVvy368AvokZgdTOuKNbimwBCYm2BAm2qa/YJycYexmEB6N/F3MBaJc+Z68Wox+DOWRqktPwyhnQTeAicnRr8snVmr7jaBZXJess3ZiltlTdqHVcxv/hkXMOi9MJdaKKUFnx0z08O6WNRZIzUkT2nQO+IuchxqYvLk+yjlfK0YAUzwVnYX4FQvsm+vcTkClUoIF2uwOnOSeI3qQTg3DUxtdKj9wFPB+xMTNTVdsC4AehsTb+dwdWpy+HfnYR3D/bk+J/6xAzkSRS8ZICzIzEnKXep0diUyNst2TkFOTgZMA5E1uDqfS/f6ZxpIyGSx8BNwghm2zcfmtrPvoOnJiET7v1dkrIv+Yztrb8wf9HpeSTYVNNao3dg6JcfLw44F5jjfbU0cLFPTWtC X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6whZTtc9Ym1kP6I/HE6O/9eWnnj3gbHvJd3Yf/o455qTWvZDFs76LSebMNJo6Nmbxo6QbUtWTH/TWJm+OzGKGI+adBnsnM2lq/jHokCgKb0XS/pGCmY8Bv91s1aBxb1HLpRpF6kMFemM8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VIqhZxHL5bO8Rf37ZiP2unWXiVJEpHuP+LaSDq2T1vUCeI9NXiFV2OWIDkeTuQkmGZiWG5ZPvWk8HwjijUHI7CxZt3LCjRoXK2ljfHMmjhO262bvaxoJ9ajJgvy X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f3e7fc8e-8987-4d2f-3241-08daab8b2b45 X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2022 13:19:04.3136 (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: PR3P250MB0340 Subject: [FFmpeg-devel] [PATCH 4/4] avcodec/svq1enc: Move PutBitContext from context to stack 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: yy9qbNWq9oS2 This is more natural, because said context is only used for the duration of one call to svq1_encode_frame(). Signed-off-by: Andreas Rheinhardt --- libavcodec/svq1enc.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/libavcodec/svq1enc.c b/libavcodec/svq1enc.c index 67a6de5cc0..75adbe7ea0 100644 --- a/libavcodec/svq1enc.c +++ b/libavcodec/svq1enc.c @@ -56,7 +56,6 @@ typedef struct SVQ1EncContext { HpelDSPContext hdsp; AVFrame *current_picture; AVFrame *last_picture; - PutBitContext pb; /* Some compression statistics */ enum AVPictureType pict_type; @@ -93,38 +92,38 @@ typedef struct SVQ1EncContext { SVQ1EncDSPContext svq1encdsp; } SVQ1EncContext; -static void svq1_write_header(SVQ1EncContext *s, int frame_type) +static void svq1_write_header(SVQ1EncContext *s, PutBitContext *pb, int frame_type) { int i; /* frame code */ - put_bits(&s->pb, 22, 0x20); + put_bits(pb, 22, 0x20); /* temporal reference (sure hope this is a "don't care") */ - put_bits(&s->pb, 8, 0x00); + put_bits(pb, 8, 0x00); /* frame type */ - put_bits(&s->pb, 2, frame_type - 1); + put_bits(pb, 2, frame_type - 1); if (frame_type == AV_PICTURE_TYPE_I) { /* no checksum since frame code is 0x20 */ /* no embedded string either */ /* output 5 unknown bits (2 + 2 + 1) */ - put_bits(&s->pb, 5, 2); /* 2 needed by quicktime decoder */ + put_bits(pb, 5, 2); /* 2 needed by quicktime decoder */ i = ff_match_2uint16((void*)ff_svq1_frame_size_table, FF_ARRAY_ELEMS(ff_svq1_frame_size_table), s->frame_width, s->frame_height); - put_bits(&s->pb, 3, i); + put_bits(pb, 3, i); if (i == 7) { - put_bits(&s->pb, 12, s->frame_width); - put_bits(&s->pb, 12, s->frame_height); + put_bits(pb, 12, s->frame_width); + put_bits(pb, 12, s->frame_height); } } /* no checksum or extra data (next 2 bits get 0) */ - put_bits(&s->pb, 2, 0); + put_bits(pb, 2, 0); } #define QUALITY_THRESHOLD 100 @@ -298,6 +297,7 @@ static void init_block_index(MpegEncContext *s){ } static int svq1_encode_plane(SVQ1EncContext *s, int plane, + PutBitContext *pb, const unsigned char *src_plane, unsigned char *ref_plane, unsigned char *decoded_plane, @@ -425,7 +425,7 @@ static int svq1_encode_plane(SVQ1EncContext *s, int plane, int score[4] = { 0, 0, 0, 0 }, best; uint8_t *temp = s->scratchbuf; - if (put_bytes_left(&s->pb, 0) < 3000) { // FIXME: check size + if (put_bytes_left(pb, 0) < 3000) { // FIXME: check size av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n"); return -1; } @@ -496,7 +496,7 @@ static int svq1_encode_plane(SVQ1EncContext *s, int plane, if (score[2] < score[best] && mx == 0 && my == 0) { best = 2; s->hdsp.put_pixels_tab[0][0](decoded, ref, stride, 16); - put_bits(&s->pb, SVQ1_BLOCK_SKIP_LEN, SVQ1_BLOCK_SKIP_CODE); + put_bits(pb, SVQ1_BLOCK_SKIP_LEN, SVQ1_BLOCK_SKIP_CODE); } } @@ -521,7 +521,7 @@ static int svq1_encode_plane(SVQ1EncContext *s, int plane, if (best != 2) for (i = 5; i >= 0; i--) - ff_copy_bits(&s->pb, reorder_buffer[best][i], + ff_copy_bits(pb, reorder_buffer[best][i], count[best][i]); if (best == 0) s->hdsp.put_pixels_tab[0][0](decoded, temp, stride, 16); @@ -630,6 +630,7 @@ static int svq1_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pict, int *got_packet) { SVQ1EncContext *const s = avctx->priv_data; + PutBitContext pb; int i, ret; ret = ff_alloc_packet(avctx, pkt, s->y_block_width * s->y_block_height * @@ -660,8 +661,6 @@ static int svq1_encode_frame(AVCodecContext *avctx, AVPacket *pkt, FFSWAP(AVFrame*, s->current_picture, s->last_picture); - init_put_bits(&s->pb, pkt->data, pkt->size); - if (avctx->gop_size && (avctx->frame_number % avctx->gop_size)) s->pict_type = AV_PICTURE_TYPE_P; else @@ -670,9 +669,10 @@ static int svq1_encode_frame(AVCodecContext *avctx, AVPacket *pkt, ff_side_data_set_encoder_stats(pkt, pict->quality, NULL, 0, s->pict_type); - svq1_write_header(s, s->pict_type); + init_put_bits(&pb, pkt->data, pkt->size); + svq1_write_header(s, &pb, s->pict_type); for (i = 0; i < 3; i++) { - int ret = svq1_encode_plane(s, i, + int ret = svq1_encode_plane(s, i, &pb, pict->data[i], s->last_picture->data[i], s->current_picture->data[i], @@ -692,13 +692,13 @@ static int svq1_encode_frame(AVCodecContext *avctx, AVPacket *pkt, } } - // align_put_bits(&s->pb); - while (put_bits_count(&s->pb) & 31) - put_bits(&s->pb, 1, 0); + // align_put_bits(&pb); + while (put_bits_count(&pb) & 31) + put_bits(&pb, 1, 0); - flush_put_bits(&s->pb); + flush_put_bits(&pb); - pkt->size = put_bytes_output(&s->pb); + pkt->size = put_bytes_output(&pb); if (s->pict_type == AV_PICTURE_TYPE_I) pkt->flags |= AV_PKT_FLAG_KEY; *got_packet = 1;