From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id B99C5446BC for ; Fri, 21 Oct 2022 22:17:46 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7190468BE7C; Sat, 22 Oct 2022 01:17:43 +0300 (EEST) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05olkn2029.outbound.protection.outlook.com [40.92.91.29]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D039B68BD91 for ; Sat, 22 Oct 2022 01:17:36 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YOg9xf2uyvWGP/Sr6HNuUA8soqdzjJ7MQFM4gvSxzUMfelTYoOIV/fpbJPs/L0VtgK9TDMOZWctCeB5mHRreBZe+z3HPtqzrSxHsBbo5XekNec7s9PRLnA2fwvD/fAr7rT3GVsBRxVqWyySsBVlrb/caau/8HMuZnSx7uK5foXkKHnBKGgXCE+owUM6my3sG0ymWvnBJwqW9Te2wsnkb6nQtkHSBaLNzdZXufwRMx3NYF07bJ3YD3ln59Z2NzzOFZGXc39+ty0YwAkz/5vTVrsGX6mAgAFLCG99brCtggvSjv7Vm80r1ZEaR5Jtb72hMwtrvX/yZHJ5IXS7iceSJxA== 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=O7B7cXJ3CTl3Fu/Ew5a097drc7r8d2Qxaa9byYUKnOk=; b=NgvDnq2VZY/RLrQwUFKLvvaknGDV6UgF3fKKEaDBnVjkE3GIUYZV5zBo5oxxIVgXgyDx7olAoOSEfm9LP0zib6mbaAU+gErmoiIt3qn10LmQMSNxoFfIvltQV7WeWeuWF2KcDJQjJ9oXES2fJ7eEJlHaDVyrBVw1FfWn2imuMaBeHygnpX4Mie9Da4MPgsKHG0MPP150mOiJMEgnFp29/hyXQoQM5aW/f7y6Rg+sNW5Rgl+QW6p13JAC6tmkLQJ+dOaxzd25661BgPmOReDCGxSRglxWuIGkl8Ldq0UwGt4k7YZnlF2Jy6INO0qyGRNwes7vim4yjd02HQ3aSnWXyA== 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=O7B7cXJ3CTl3Fu/Ew5a097drc7r8d2Qxaa9byYUKnOk=; b=vOxux5IfofHZFoOI2MJYggK6q7at7deQYf2h4Z58gqX90pni/yKk+sIldAGOMEhAd7kWvyX0iFAOmi+cNKx42nMQtmGJJAcKKMfU30aTS9le2ztEf+ynSJwDEITDHsaNPV4gxMJwX/HizXPdEsws0IZjiNTzuzxxZmAB1YQnBngA969qMSDUzJv0OSAHZeih+wqkqguc7+mp8hd5nAKuDJM+5vvvWMVmR70Ms+y9gmggyN1gMylyzmL833RAp1QHTpzjtSvZq1Uv1pbBlVsy8VOKBsZegEOeMNxjst6nqE6a1AdIsReVBh+VdNuMmFtN4bLGi476jDwlAcJwEH9j3A== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by DU0P250MB1041.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:424::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.29; Fri, 21 Oct 2022 22:17:35 +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; Fri, 21 Oct 2022 22:17:34 +0000 Message-ID: Date: Sat, 22 Oct 2022 00:17:44 +0200 Content-Language: en-US To: ffmpeg-devel@ffmpeg.org References: From: Andreas Rheinhardt In-Reply-To: X-TMN: [dGtbBUBflLC9sOPGYoNIMI3ILHX7NDjeAumm96aXxmo=] X-ClientProxiedBy: FR0P281CA0068.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:49::13) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|DU0P250MB1041:EE_ X-MS-Office365-Filtering-Correlation-Id: 1e13c2d9-6a15-4ab6-b0fa-08dab3b20d87 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dqz/J0+5VKFT0Y2SmjDuACq0ERIyo2DRd7lb6SDScDRBdhbIafhXSjCpL8zrYjKhDuIgPYUPRB+wAq9fZ0zCfRCh/+2yYvIPh+ttCa7vfPUNdnzrR8ESFC2lw9YoDez4uFN1V8u3xAXFUiF/fFEeJKN5nrajPu4YPKGKEtA7DVAuzZtm1jMTRZJ46cTeYfu+DiOYao7pxWi6Cp9zR72yc/iOkdczFRuF3Zfxp5rSAUyEHghKfYt5sIQT5bIfzeIADFX4md2PITfV8wFNYo8Ej2eczXNnlIbwGH4GrBf/Ctf0SisTOc0vLunhU+udVyfV5xEuYSmgrngWl6jwWd8SbqFmvj80mJFTWFOfFktKJwEGFgJRkDw7gX3l8luYkaILebBiS6o3Si7VAKoRIAap1DBG1X2xz7yqCfwtQN3tMpeLXuWtFp0KUsnIMCxOIjqQB/7rmGvwLcmDDq4f2r6dkent8daj1tqUPgW/1Ja3Z0KgRRK23y5hJ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0OXY5Wk95ajNkVlBG?= =?utf-8?B?YVlITjdyQllCZnJMdXNBczB3Z2Z5Rk9YMmhPRDliZVZFM0VZRmJML0t4T0pz?= =?utf-8?B?WTBlelkyYkdtaXd6czVqeExkK0E3cjZjMVozZ09xK28rYUZndTRKNVozVUVn?= =?utf-8?B?eGNQTUZkYVhqWWRTT2p6MWRHYWVmTFlwblp3T29oWTJCVFU5R3hqSXFIMmZY?= =?utf-8?Q?edTsrM57LZ/7nHdn2aK4r3/rU7NrwOZy4O/88gR?= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1e13c2d9-6a15-4ab6-b0fa-08dab3b20d87 X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2022 22:17:34.0924 (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: DU0P250MB1041 Subject: Re: [FFmpeg-devel] [PATCH 1/2] avcodec/cbs: Remove CBS_CONTENT_TYPE_POD 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Andreas Rheinhardt: > It is equivalent to CBS_CONTENT_TYPE_INTERNAL_REFS > with nb_offsets equal to zero. > > Signed-off-by: Andreas Rheinhardt > --- > libavcodec/cbs.c | 18 ++++-------------- > libavcodec/cbs_internal.h | 21 ++++++++++++--------- > 2 files changed, 16 insertions(+), 23 deletions(-) > > diff --git a/libavcodec/cbs.c b/libavcodec/cbs.c > index 8d6e3c3442..504197e06d 100644 > --- a/libavcodec/cbs.c > +++ b/libavcodec/cbs.c > @@ -839,12 +839,10 @@ void ff_cbs_delete_unit(CodedBitstreamFragment *frag, > static void cbs_default_free_unit_content(void *opaque, uint8_t *data) > { > const CodedBitstreamUnitTypeDescriptor *desc = opaque; > - if (desc->content_type == CBS_CONTENT_TYPE_INTERNAL_REFS) { > - int i; > - for (i = 0; i < desc->type.ref.nb_offsets; i++) { > - void **ptr = (void**)(data + desc->type.ref.offsets[i]); > - av_buffer_unref((AVBufferRef**)(ptr + 1)); > - } > + > + for (int i = 0; i < desc->type.ref.nb_offsets; i++) { > + void **ptr = (void**)(data + desc->type.ref.offsets[i]); > + av_buffer_unref((AVBufferRef**)(ptr + 1)); > } > av_free(data); > } > @@ -981,14 +979,6 @@ static int cbs_clone_unit_content(CodedBitstreamContext *ctx, > return AVERROR(ENOSYS); > > switch (desc->content_type) { > - case CBS_CONTENT_TYPE_POD: > - ref = av_buffer_alloc(desc->content_size); > - if (!ref) > - return AVERROR(ENOMEM); > - memcpy(ref->data, unit->content, desc->content_size); > - err = 0; > - break; > - > case CBS_CONTENT_TYPE_INTERNAL_REFS: > err = cbs_clone_internal_refs_unit_content(&ref, unit, desc); > break; > diff --git a/libavcodec/cbs_internal.h b/libavcodec/cbs_internal.h > index 5ccba3c901..045df91744 100644 > --- a/libavcodec/cbs_internal.h > +++ b/libavcodec/cbs_internal.h > @@ -31,9 +31,7 @@ > > > enum CBSContentType { > - // Unit content is a simple structure. > - CBS_CONTENT_TYPE_POD, > - // Unit content contains some references to other structures, but all > + // Unit content may contain some references to other structures, but all > // managed via buffer reference counting. The descriptor defines the > // structure offsets of every buffer reference. > CBS_CONTENT_TYPE_INTERNAL_REFS, > @@ -78,9 +76,12 @@ typedef const struct CodedBitstreamUnitTypeDescriptor { > size_t content_size; > > union { > + // This union's state is determined by content_type: > + // ref for CBS_CONTENT_TYPE_INTERNAL_REFS, > + // complex for CBS_CONTENT_TYPE_COMPLEX. > struct { > - // Number of entries in the ref_offsets array. Only nonzero > - // if the content_type is CBS_CONTENT_TYPE_INTERNAL_REFS. > + // Number of entries in the ref_offsets array. > + // May be zero, then the structure is POD-like. > int nb_offsets; > // The structure must contain two adjacent elements: > // type *field; > @@ -191,18 +192,20 @@ int ff_cbs_write_signed(CodedBitstreamContext *ctx, PutBitContext *pbc, > #define MIN_INT_BITS(length) (-(INT64_C(1) << ((length) - 1))) > > #define TYPE_LIST(...) { __VA_ARGS__ } > -#define CBS_UNIT_TYPE_POD(type, structure) { \ > +#define CBS_UNIT_TYPE_POD(type_, structure) { \ > .nb_unit_types = 1, \ > - .unit_type.list = { type }, \ > - .content_type = CBS_CONTENT_TYPE_POD, \ > + .unit_type.list = { type_ }, \ > + .content_type = CBS_CONTENT_TYPE_INTERNAL_REFS, \ > .content_size = sizeof(structure), \ > + .type.ref = { .nb_offsets = 0 }, \ > } > #define CBS_UNIT_RANGE_POD(range_start, range_end, structure) { \ > .nb_unit_types = CBS_UNIT_TYPE_RANGE, \ > .unit_type.range.start = range_start, \ > .unit_type.range.end = range_end, \ > - .content_type = CBS_CONTENT_TYPE_POD, \ > + .content_type = CBS_CONTENT_TYPE_INTERNAL_REFS, \ > .content_size = sizeof(structure), \ > + .type.ref = { .nb_offsets = 0 }, \ > } > > #define CBS_UNIT_TYPES_INTERNAL_REF(types, structure, ref_field) { \ Will apply this patchset tonight unless there are objections. - Andreas _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".