From patchwork Mon Sep 6 12:42:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 30040 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp3721652iov; Mon, 6 Sep 2021 05:43:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzUchyi46iMTW1hGFtuVgROIOgvWxgwMMUc2Wk8V3w+pv/K8JKEmFUb1yJ1UBSYfjj9i5J6 X-Received: by 2002:a05:6402:2792:: with SMTP id b18mr13186896ede.173.1630932202329; Mon, 06 Sep 2021 05:43:22 -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 9si7983665ejo.527.2021.09.06.05.43.21; Mon, 06 Sep 2021 05:43:22 -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=YcvHupSA; 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 94FBF687F27; Mon, 6 Sep 2021 15:43:19 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-oln040092065075.outbound.protection.outlook.com [40.92.65.75]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4C0606898FB for ; Mon, 6 Sep 2021 15:43:12 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YfrZg/V7gHibVpjnrWEam9hrA86ItgtG5fvlI0Iv1DTHZqo9KPTst1RWVAS4IwnfBmVbxDfpwHhmCqWtHttDLj9QQUicrqZmLsjYtu3+oA+dkJC9i+I1RYG2V9ylje97aHybc1g7iLZWgROSxCezJa1bxJh53MKwRPS5KL3QYQLUqjPGqqd+xZirXaPqurNyFbDDT3qHr0/TyxBsRRdiNGLJW6NKMa4inlFDH5TJ/p/p75GjBE7Em0v1Sf/hXc/ticvPlRfuC2cFhjDBOYgtq+8KtV7kdwz74QjOnYYaIxixTqmg+KOA2DaeVBnBak5wb/sm/2yP7EeO7Km6T40uQg== 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; bh=nkTduQY8OMyboMCMa49Rn/tBLqn+xIdSPjRtL3wLUh0=; b=b90jaIXRuySNJW/uJi/DLw7mvqL6KiT/CKAlTt/ReXS+KVBd81jujyRNx9M13JKYC25jt4LLa3DaG7GMOHL02rO80rzdHrTydf1z/g8xxHtz4ngx5qTOGxhTzihof12FvIpttNJbmj6smZEEMeSxzL53oeHhErxP0Zz37r+Sz74Nd/BnCcBGvdfrHcjAXaRehGhY1u+yUtILNo4pwpL1Kytivw3cWmHRmVSEWciYIwnm9H7LbQhWCY93r3r+uEQ8UsWbRcOoknDgmXq/GapZobpJbHN89dFQbXV/R6UKvMfHUFHS+TQVnCr0PisRo9GrDxvQNHT6666Oi9uTTErA8w== 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=nkTduQY8OMyboMCMa49Rn/tBLqn+xIdSPjRtL3wLUh0=; b=YcvHupSAC03nIYB7NQ56MS6nPlMe0o64dICJVfloNY6lOLlQxkg/D81lhbeUXpAeAF3vFjZkIIpopiBe6C9e1XYINMmwe314t/ygu/hbevjXXhBdm2PHP7uxKIKEjnPzjjpmmnEFw0Qa1SmJPHBHuF9rHQG42WQA9+S1NgOAl6Nqb7s1QtNUtpf0RxnIm6BlVYvSb58zSiR0TLK+dVarYYsQOMTwfSDsNBkyd7LJN5kxwbDuZzsV6Gf5lkYFg91gl0bi2+QaQ6lkdIsrzwtiO82X8YbUWJQAIL01LYBiSs1kgRDbQfkxgq26bL8uxxF8V3RztYOuLkI+u72FmOmY2Q== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AS8PR03MB7143.eurprd03.prod.outlook.com (2603:10a6:20b:23e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.17; Mon, 6 Sep 2021 12:43:10 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::787b:2156:ca99:fe00]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::787b:2156:ca99:fe00%3]) with mapi id 15.20.4478.025; Mon, 6 Sep 2021 12:43:10 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 6 Sep 2021 14:42:52 +0200 Message-ID: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: X-TMN: [e55BNpe0V8mmf++nnlw2s4x89BxCot4b] X-ClientProxiedBy: AM0PR01CA0084.eurprd01.prod.exchangelabs.com (2603:10a6:208:10e::25) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20210906124301.4161498-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.142.38) by AM0PR01CA0084.eurprd01.prod.exchangelabs.com (2603:10a6:208:10e::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.19 via Frontend Transport; Mon, 6 Sep 2021 12:43:10 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2889e966-1243-4a20-ad29-08d97133e238 X-MS-Exchange-SLBlob-MailProps: f36zkjAOy3VUVVWLySYu7wcJ/apWCCTniyrjKvU0aCv/YmlNtkvGdQZZ/F/91+lUelkxwBWm9YhXURpJiWH44VUyeIHAdQvV8ylmNz2bVOPX2oeeKloC7lU6m2lbp4KQdGEfzF5cDWTypMDx8JabFVYl2fmQnNWbJBiMSdllzAc972+wEJqrzFqcD8O+TiY199ZP63joU3fZZWZNFYg+eXq7LCugVSnEjGV1z9uzdjxBrYRFLdePxzNTvYDJcGzrvhhtiGjWrqEW6e4NK5mypjNAp9tI4C+SMQKqC7mSCwGjUaWKkQki4HEu29S1p3abLToQSXBcmK4UVCGuR0MmPnwdRx+erj93Ja06vj9iAiWMhoKCk2C6V2Y/c13RsAN3lpymntD1yKUQEgN1u5R20F0dpzdhoGORkirDUNdwG7qy7Vab6eb1nURdPsZ/aOwngwfsANS3n+/XsFAXbs2V4aqw2Pv79UqVMl6j8iRK+Nd8O51tbkElzVazyxE6LgNvQW2zHC2g3C2qMh3TRpg/3lXSZsl7Diux/uA3wMRgGyT7In5e0nrf8JEf45T2h7NX8gNe4obslyLR4BQZ9BSnrSGkULHvGJiUtglUFekWK5d+rRJ0zIoCq2NrW8upvg/VJ0wSi7LFsVAjjo5/5q0AirrmpRR08rHeM7jLvR22R4F8Bs6CJ8FaaorRbx+Jfsf7oYbvRrd/AEYIVnBCbXrZP1KFEvbvliLYoEecNrGoDIY= X-MS-TrafficTypeDiagnostic: AS8PR03MB7143: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Tl74wZ4o2hKIGIRfFwAsV7ZrCdAd5ZYtC6QZZ928yLFFzEi71HT6guL+Fe2jiOqOUVrnFSkpmK3d8lYri4PWLkPc1+AFun9rJL7ztdyD0VUY9oO3uXrnK1zrSRIrgYcEr3tCP/aoUsxa+xZ48sSZt6M/PnkRcsHHf2o8TA4JXzDZFuOnuJ33mi0aenbq7ypWuI4Cu6dKdOuI4MpJSGxD2Pkxg/dzL28+ZumTi89bmp32ELuMrsmplY1xwQUXqLDsUv9CGTmKpfUx/dzFgg1flG0o+6cZdQ/HLayTxAVo0dg80mNo7Qdpp8bs2n78zLxCQ1hCyJBjZs9t+17IbQiBlcj84/Y/eb/Aw/pAFVTGFTWsuBglj7gNOeeA5AxB2u846FX4yQFbwS4MNdrdIOLMS5UaeL7B4Cs/ZMIOBy2tJNm3tab/OEvo6yikyZNgeHuk X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: hIst/4S0zH6s90nnt4VO1jo/guBTf6FqqszQN3LxwPSlB1TcZiC+x1zXHHb/JADEicaHbUxS2eCMsLdsgnolmYzw6hMwIvVLrGk7ZjJUSt/QZkUtV+0nMDa6JB14O0PX72VcNi/I5OAWvPKNNrfaLQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2889e966-1243-4a20-ad29-08d97133e238 X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Sep 2021 12:43:10.4711 (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: AS8PR03MB7143 Subject: [FFmpeg-devel] [PATCH 02/11] avcodec/cbs: Make ff_cbs_alloc_unit_data() static 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: aJUxdve7Vqc0 Forgotten in 7c92eaace2b338e0b3acc18e1543b365610578fd. Signed-off-by: Andreas Rheinhardt --- libavcodec/cbs.c | 41 +++++++++++++++++++++++------------------ libavcodec/cbs.h | 9 --------- 2 files changed, 23 insertions(+), 27 deletions(-) diff --git a/libavcodec/cbs.c b/libavcodec/cbs.c index f6e371ddef..d7aa67c3af 100644 --- a/libavcodec/cbs.c +++ b/libavcodec/cbs.c @@ -315,6 +315,28 @@ int ff_cbs_read(CodedBitstreamContext *ctx, data, size, 0); } +/** + * Allocate a new internal data buffer of the given size in the unit. + * + * The data buffer will have input padding. + */ +static int cbs_alloc_unit_data(CodedBitstreamUnit *unit, + size_t size) +{ + av_assert0(!unit->data && !unit->data_ref); + + unit->data_ref = av_buffer_alloc(size + AV_INPUT_BUFFER_PADDING_SIZE); + if (!unit->data_ref) + return AVERROR(ENOMEM); + + unit->data = unit->data_ref->data; + unit->data_size = size; + + memset(unit->data + size, 0, AV_INPUT_BUFFER_PADDING_SIZE); + + return 0; +} + static int cbs_write_unit_data(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit) { @@ -360,7 +382,7 @@ static int cbs_write_unit_data(CodedBitstreamContext *ctx, flush_put_bits(&pbc); - ret = ff_cbs_alloc_unit_data(unit, put_bytes_output(&pbc)); + ret = cbs_alloc_unit_data(unit, put_bytes_output(&pbc)); if (ret < 0) return ret; @@ -693,23 +715,6 @@ int ff_cbs_alloc_unit_content(CodedBitstreamUnit *unit, return 0; } -int ff_cbs_alloc_unit_data(CodedBitstreamUnit *unit, - size_t size) -{ - av_assert0(!unit->data && !unit->data_ref); - - unit->data_ref = av_buffer_alloc(size + AV_INPUT_BUFFER_PADDING_SIZE); - if (!unit->data_ref) - return AVERROR(ENOMEM); - - unit->data = unit->data_ref->data; - unit->data_size = size; - - memset(unit->data + size, 0, AV_INPUT_BUFFER_PADDING_SIZE); - - return 0; -} - static int cbs_insert_unit(CodedBitstreamFragment *frag, int position) { diff --git a/libavcodec/cbs.h b/libavcodec/cbs.h index bd97d163b1..87ea14cd07 100644 --- a/libavcodec/cbs.h +++ b/libavcodec/cbs.h @@ -380,15 +380,6 @@ int ff_cbs_alloc_unit_content(CodedBitstreamUnit *unit, int ff_cbs_alloc_unit_content2(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit); - -/** - * Allocate a new internal data buffer of the given size in the unit. - * - * The data buffer will have input padding. - */ -int ff_cbs_alloc_unit_data(CodedBitstreamUnit *unit, - size_t size); - /** * Insert a new unit into a fragment with the given content. *