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 83BE247CA8 for ; Tue, 17 Oct 2023 12:43:12 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9CE7068C9B4; Tue, 17 Oct 2023 15:43:09 +0300 (EEST) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.151]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1DA9A68C02A for ; Tue, 17 Oct 2023 15:43:01 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697546587; x=1729082587; h=from:to:subject:date:message-id:references:in-reply-to: content-transfer-encoding:mime-version; bh=UrxckdwWFSj7/11dAD4Sr3WGZXQ2KOktoz5AyPOMwfE=; b=m4zKVvukxozIWn61XVjyUd+FxaENzctuUhp4a3eOf7ExJq8CLGx/uas8 jvBL59MmF7clg6UJwT5rh3iCYDzl96Yhy36eDix9QikcYNPsIaEW/IVc+ uuRZhIf8zUvHJu/SgBzusmTJ31MlHiKk86sQId4ek/v5PnANv0nbhk5XX SmjLUWLlovCvJfRhfMj9bTYzpvHb4Yut9lHgZBvX7VEH9N3jvB8X81A3n Agf9d0cJ2q+k70ScwO0FfhZzYudf7TvBEdclLgWS5q3q+1UqvsHwF6Igh wH9uvNYiVkUkemj4g605f4/H5GhEU4y3zOBXTWnTcbQktogZeJwCYZnTX g==; X-IronPort-AV: E=McAfee;i="6600,9927,10865"; a="366032006" X-IronPort-AV: E=Sophos;i="6.03,232,1694761200"; d="scan'208";a="366032006" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Oct 2023 05:42:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10865"; a="826426341" X-IronPort-AV: E=Sophos;i="6.03,232,1694761200"; d="scan'208";a="826426341" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by fmsmga004.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 17 Oct 2023 05:42:59 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Tue, 17 Oct 2023 05:42:59 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32 via Frontend Transport; Tue, 17 Oct 2023 05:42:59 -0700 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.169) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.32; Tue, 17 Oct 2023 05:42:58 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SZB4U1jNhRwD9Bklr2u/zR3vp00FUu5lQG+pUXS+vAoeMDRHBstf/Vpf6Tr5TffUCI3hEQCotdEWym2YVVezUN0C+xHhDVMeyjvZosa8eYXbIm9ftVjk/diH5XmBQczEXte20BiqvbzcwphThcwjip32/cISAV5/eOr5O0Izhp5efGVsPTAur7uLeIX9+3wE9hzUdG3wDVjP2RamP0TzTpRGp4a0Mc50MuXUewK/dL0XsY0kvdkoMx0HJTWJUPMTiRjcaKkXDj3Ms494lHDuKqOk0drVfQLLcKMo3jKORakCdXawzYIVhjZCJVnNS11m/iF55BwTMP4h3YZ998eSFw== 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=0HxHJbBRn3HoubkkE+/OCVUjnps+LLu+GNBZGYA4Bic=; b=b/CGLzcQ4OQBUAKpk0lBn8a/2hwyx3FBbeuW4hSVWA0rNDeZiJO41sUvjzn77IBEjskmYvwDOJCgpixoAUyMRWapgRyVHjo08wnOjJMKC7AIboV7p8dPqzAT4KGkqL1aDtUXdvXwI7FekZPpnBao0abv7/ON7IARPZkCuQSQDQZFiz9qkK0qJB6NOxI4qmqnKuYJ9xfSAE1XXGd5dnXcofBWkK/L2j0eRT8xy/thxVSVKMgh0hFvKCaXV74U3k6AyHtqOv5OfVfkiEWcUnQhoKZdwd9SAsFBlhQAt3NNq5rMe1Eg5RkHBjBoIYTmnwKHyZAAY+tAgrfT0mNCvubv1g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from DM6PR11MB2681.namprd11.prod.outlook.com (2603:10b6:5:bd::33) by IA1PR11MB6513.namprd11.prod.outlook.com (2603:10b6:208:3a3::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.36; Tue, 17 Oct 2023 12:42:56 +0000 Received: from DM6PR11MB2681.namprd11.prod.outlook.com ([fe80::aebb:cf3b:d3ba:1241]) by DM6PR11MB2681.namprd11.prod.outlook.com ([fe80::aebb:cf3b:d3ba:1241%6]) with mapi id 15.20.6907.021; Tue, 17 Oct 2023 12:42:56 +0000 From: "Dai, Jianhui J" To: FFmpeg development discussions and patches Thread-Topic: [FFmpeg-devel] [PATCH v1] avcodec/cbs: Keep ff_cbs_trace_syntax_element Thread-Index: Adn6remfkCjk64uBRNWNs04RIhyP1QAe6MvQAVMIIgAAIAPR8A== Date: Tue, 17 Oct 2023 12:42:56 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DM6PR11MB2681:EE_|IA1PR11MB6513:EE_ x-ms-office365-filtering-correlation-id: 9351a971-ffa9-4ea0-d278-08dbcf0e965a x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 2nzy01CWgA2Mt1orwkZ9cKX0hpW31VXZB55n/7RRVVsL8/EcgIXuqpYijkF3ZdVfpXHXcp5LvUuxh+OmeRoSTdVr1a8r+CaCp0qAwcW9jrqZesVu/D4RJHx9gS2H+/Z2CkLecJFoJ1aGtdITBA/yXljO/B0ivsqGR2uD9vPA05hiUs4D/NEigqPI/+oMhpefcxLmVKC+CsneaWi5rOGkcqHwrpE4LJslh9xA3TDfUTLRcTlvrqu+0X7YilIa8XjD8sax/nFs3iw9gs9QZSv0KOHW6EOX8akWYh0U7Wp4yva66hG7RQE3UbgHioO+elfBo2hBJEyB7OlAdfqredlgt7FgBwtixXbSw69r+YfVcfczbmwhjBRuKoYjWmJVkVnejRf+2dhZiv4N9b5FZinVjt/N0pYldG9Tc2uUfkZA3Bz0uVE93FKwX4zGh4l0A1IdZm0tNrYl0tHhw0r3cInWQ1V9ErKlLxqBS/kSSiNeJWJbunTHDKqNHfb0mDbEzGsH5R+p74kEn5kr8cJ8YJ9B9IBmWbvN9KArO03y+HWCHJOs5cvfJNYWS5l5rxEduc0d53k+AQlMpFgf7c1/oogu1s3WjNDsniQ0sFt27AxDG90= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR11MB2681.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(136003)(376002)(346002)(396003)(39860400002)(366004)(230922051799003)(1800799009)(186009)(64100799003)(451199024)(966005)(478600001)(76116006)(66476007)(66446008)(66556008)(316002)(66899024)(6916009)(64756008)(66946007)(26005)(122000001)(71200400001)(38070700005)(86362001)(33656002)(82960400001)(83380400001)(38100700002)(6506007)(55016003)(53546011)(7696005)(9686003)(2906002)(41300700001)(5660300002)(8936002)(8676002)(52536014); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?+Piz8Qed/o53TLNqOiOsiF3P2QK3D5mJZOqUlkgDkCBh152TRP+CywgbOsYk?= =?us-ascii?Q?dMvBiC7zt8bUiZqZKsdTR/zZj070faxVNc1D+bLI8yyE6ZDh88bobdUxtPwE?= =?us-ascii?Q?46xT6C5HQSUEx7aRjRVm6SG+NN5+sLAxb+wFDCWOyfEsQQEfhJvRZciUvZxs?= =?us-ascii?Q?2x/Vjdy+Fmda1NV82H4Y5OyvOsTM1k1r1W3ySZqWO/VEj5kUOQUFQ9vysXP8?= =?us-ascii?Q?50XWa7lFQICMAtwAoKQGAaUw9RpE5Uqv4n3/vr92ya33gXXuywjqTewdnlmk?= =?us-ascii?Q?7cJP5kHzUICu5mkthJoZxDu7qaMYZd7ghVlawpmsJPNsJrRvsLYUGq69MC3f?= =?us-ascii?Q?WyWq0QBfw4aS9P+YIBydyOnYcamjz6VMkzsxWPq2y1EhFJsR0+iqHR2p9cwJ?= =?us-ascii?Q?QptfbgWQFEYoZJzbMW1vOU8Fbkx8r+5HF/+jkJ1yA6xLWJnGb6/eHaHK9pBb?= =?us-ascii?Q?Gj4JkpJn/bojQEbLB2weTx9zyXxVw8BQ/REz4dMRQmEe1G1YBJJcC0AxDJdn?= =?us-ascii?Q?VoohOgg+zXgdtSR3tZEKgcflk7BVP/Alksb7QP75CqMzM3oJpM7PVD9TaXMU?= =?us-ascii?Q?H6ISt3q7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+/Oi90hsmKf7XW/nQ?= =?us-ascii?Q?900EWHBT3ckaare9AczYYvIlPH2f0jOyrQvumTURsNitd9VHxomvTXicRwT5?= =?us-ascii?Q?rHuAIpr5k5KF8ELfkW18xawnsIVKWgFyExDHBAI/?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR11MB2681.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9351a971-ffa9-4ea0-d278-08dbcf0e965a X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Oct 2023 12:42:56.1580 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: lR1x2AQBQfrMkoj7LB5Q4En3dLupKi7AhfrLYbjy7AhMaqAwuQAV4zugy0AXPEYYIYnfFrWf3UyMJD5Ea3Ptxg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR11MB6513 X-OriginatorOrg: intel.com Subject: Re: [FFmpeg-devel] [PATCH v1] avcodec/cbs: Keep ff_cbs_trace_syntax_element 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: > -----Original Message----- > From: ffmpeg-devel On Behalf Of Mark > Thompson > Sent: Tuesday, October 17, 2023 5:14 AM > To: ffmpeg-devel@ffmpeg.org > Subject: Re: [FFmpeg-devel] [PATCH v1] avcodec/cbs: Keep > ff_cbs_trace_syntax_element > > On 10/10/2023 04:30, Dai, Jianhui J wrote: > >> -----Original Message----- > >> From: Dai, Jianhui J > >> Sent: Tuesday, October 10, 2023 10:57 AM > >> To: ffmpeg-devel@ffmpeg.org > >> Subject: [PATCH v1] avcodec/cbs: Keep ff_cbs_trace_syntax_element > >> > >> Split ff_cbs_trace_syntax_element from ff_cbs_trace_read_log to > >> decouple the tracing from GetBitContext. This allows CBS > >> implementations that do not have a GetBitContext to directly use > >> ff_cbs_trace_syntax_element to trace syntax elements. > >> > >> Signed-off-by: Jianhui Dai > >> --- > >> libavcodec/cbs.c | 41 +++++++++++++++++++++++++-------------- > >> libavcodec/cbs_internal.h | 4 ++++ > >> 2 files changed, 30 insertions(+), 15 deletions(-) > >> > >> diff --git a/libavcodec/cbs.c b/libavcodec/cbs.c index > >> cdd7adebeb..2f2cfcfb31 > >> 100644 > >> --- a/libavcodec/cbs.c > >> +++ b/libavcodec/cbs.c > >> @@ -498,26 +498,18 @@ void ff_cbs_trace_header(CodedBitstreamContext > >> *ctx, > >> av_log(ctx->log_ctx, ctx->trace_level, "%s\n", name); } > >> > >> -void ff_cbs_trace_read_log(void *trace_context, > >> - GetBitContext *gbc, int length, > >> - const char *str, const int *subscripts, > >> - int64_t value) > >> +void ff_cbs_trace_syntax_element(CodedBitstreamContext *ctx, int position, > >> + const char *str, const int *subscripts, > >> + const char *bits, int64_t value) > >> { > >> - CodedBitstreamContext *ctx = trace_context; > >> char name[256]; > >> - char bits[256]; > >> size_t name_len, bits_len; > >> int pad, subs, i, j, k, n; > >> - int position; > >> - > >> - av_assert0(value >= INT_MIN && value <= UINT32_MAX); > >> > >> - position = get_bits_count(gbc); > >> + if (!ctx->trace_enable) > >> + return; > >> > >> - av_assert0(length < 256); > >> - for (i = 0; i < length; i++) > >> - bits[i] = get_bits1(gbc) ? '1' : '0'; > >> - bits[length] = 0; > >> + av_assert0(value >= INT_MIN && value <= UINT32_MAX); > >> > >> subs = subscripts ? subscripts[0] : 0; > >> n = 0; > >> @@ -545,7 +537,7 @@ void ff_cbs_trace_read_log(void *trace_context, > >> av_assert0(n == subs); > >> > >> name_len = strlen(name); > >> - bits_len = length; > >> + bits_len = strlen(bits); > >> > >> if (name_len + bits_len > 60) > >> pad = bits_len + 2; > >> @@ -556,6 +548,25 @@ void ff_cbs_trace_read_log(void *trace_context, > >> position, name, pad, bits, value); } > >> > >> +void ff_cbs_trace_read_log(void *trace_context, > >> + GetBitContext *gbc, int length, > >> + const char *str, const int *subscripts, > >> + int64_t value) { > >> + CodedBitstreamContext *ctx = trace_context; > >> + char bits[256]; > >> + int position; > >> + > >> + position = get_bits_count(gbc); > >> + > >> + av_assert0(length < 256); > >> + for (int i = 0; i < length; i++) > >> + bits[i] = get_bits1(gbc) ? '1' : '0'; > >> + bits[length] = 0; > >> + > >> + ff_cbs_trace_syntax_element(ctx, position, str, subscripts, > >> +bits, value); } > >> + > >> void ff_cbs_trace_write_log(void *trace_context, > >> PutBitContext *pbc, int length, > >> const char *str, const int *subscripts, > >> diff --git a/libavcodec/cbs_internal.h b/libavcodec/cbs_internal.h > >> index 07220f1f3e..ff90ce467d 100644 > >> --- a/libavcodec/cbs_internal.h > >> +++ b/libavcodec/cbs_internal.h > >> @@ -158,6 +158,10 @@ typedef struct CodedBitstreamType { void > >> ff_cbs_trace_header(CodedBitstreamContext *ctx, > >> const char *name); > >> > >> +void ff_cbs_trace_syntax_element(CodedBitstreamContext *ctx, int position, > >> + const char *name, const int *subscripts, > >> + const char *bitstring, int64_t > >> +value); > >> + > >> > >> // Helper functions for read/write of common bitstream elements, > >> including // generation of trace output. The simple functions are > >> equivalent to > > > > @Mark Thompson > > Could you please take a look if it's a valid change based on your last refactor? > > It's intended to use for the reviewing cbs_vp8 patch. > > The simple answer here is to forge a GetBitContext pointing at the right place, like > the write tracing does. > > However: for your VP8 case, I'm a bit unclear why it isn't using get_bits already? > The setup seems to be to stop normal parsing at the end of the uncompressed > header and then read bytes through a pointer for the range coder rather than > continuing with the bit reader. > > If the range decoder used the GetBitContext to read the input instead of reading > bytes from the array then your problem would be solved. Doing that would also > allow it to renormalise directly after each read rather than reading by bytes, so > the actual bits consumed for each symbol would be visible in tracing. > Thanks for the suggestion. Using GetBitContext in the range decoder could solve this problem. > (I admit I'm not very clear what your motivation for making a read-only CBS > implementation for VP8 is, and that might guide the best answer. If it's tracing > then showing the consumed bits precisely seems useful, but if it's something else > then that's less relevant.) > I previously worked on a hardware VP8 encoding issue, and I needed to dump all the VP8 bitstream syntax elements for debugging. To do this, I implemented the cbs VP8 for trace header filter. I am looking to upstream it if anyone else needs it for the same purpose. > Thanks, > > - Mark > _______________________________________________ > 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". _______________________________________________ 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".