Re: [Cbor] cbor-packed: Circumfix expansion

Carsten Bormann <cabo@tzi.org> Mon, 01 February 2021 12:24 UTC

Return-Path: <cabo@tzi.org>
X-Original-To: cbor@ietfa.amsl.com
Delivered-To: cbor@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id B94873A10DC; Mon, 1 Feb 2021 04:24:34 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.899
X-Spam-Level:
X-Spam-Status: No, score=-1.899 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3sAKawuOI5mu; Mon, 1 Feb 2021 04:24:30 -0800 (PST)
Received: from gabriel-vm-2.zfn.uni-bremen.de (gabriel-vm-2.zfn.uni-bremen.de [134.102.50.17]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 246D93A10DB; Mon, 1 Feb 2021 04:24:28 -0800 (PST)
Received: from [192.168.217.118] (p5089a828.dip0.t-ipconnect.de [80.137.168.40]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gabriel-vm-2.zfn.uni-bremen.de (Postfix) with ESMTPSA id 4DTnF70yFJzyTK; Mon, 1 Feb 2021 13:24:27 +0100 (CET)
Content-Type: text/plain; charset="utf-8"
Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\))
From: Carsten Bormann <cabo@tzi.org>
In-Reply-To: <YBfspfVS6GzWkWO6@hephaistos.amsuess.com>
Date: Mon, 01 Feb 2021 13:24:26 +0100
Cc: draft-ietf-cbor-packed@ietf.org, cbor@ietf.org
X-Mao-Original-Outgoing-Id: 633875066.6087739-c904e9ed1eee2600196c9c2592c1f844
Content-Transfer-Encoding: quoted-printable
Message-Id: <C0700EED-C8A9-4826-BD4E-D277BAA4B797@tzi.org>
References: <YBfspfVS6GzWkWO6@hephaistos.amsuess.com>
To: Christian Amsüss <christian@amsuess.com>
X-Mailer: Apple Mail (2.3608.120.23.2.4)
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/Hl6tUTlFtcK4EvVye7d3LHWlrWk>
Subject: Re: [Cbor] cbor-packed: Circumfix expansion
X-BeenThere: cbor@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Concise Binary Object Representation \(CBOR\)" <cbor.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/cbor>, <mailto:cbor-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cbor/>
List-Post: <mailto:cbor@ietf.org>
List-Help: <mailto:cbor-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/cbor>, <mailto:cbor-request@ietf.org?subject=subscribe>
X-List-Received-Date: Mon, 01 Feb 2021 12:24:35 -0000

https://tools.ietf.org/html/draft-bormann-lpwan-cbor-template-02

is the most general form of this that I have written up.
This assumes that the SCHC environment does the referencing, so it only defines the referee (template), not the referent (invocation).
The example has only one parameter, but could have more.

Can we package that in a way that is useful for cbor-packed?

(I do see the complexity issue.)

Grüße, Carsten



> On 2021-02-01, at 12:57, Christian Amsüss <christian@amsuess.com> wrote:
> 
> Hello Carsten, hello CBOR group,
> 
> it occurred to me that a variant of compression is unexplored. Suppose
> we have data like (please mentally replace strings with appropriate
> numbers) in SenML assuming draft-groves-core-senml-bto:
> 
> [{"bn": "urn:dev:ow:X", "bu": "V", "v": 1.992, "t": 1.6e9, "bto": 2},
> /* bto indicates all the following items are offset by 2 seconds each */
> {"v": 1.986},
> {"v": 1.874},
> {"v": 1.423},
> ...
> ]
> 
> It'd be tempting to write that as
> 
> TBD51([{"v": TBD(0)}], [], [],
>  [{"bn": "urn:dev:ow:X", "bu": "V", "v": 2.047, "t": 1.6e9, "bto": 2},
>   TBD6'(
>     5([-7, 64(h'feefb6...')]) /* [0xfe, 0xef, 0xb6, ...] x 2^-7 */
>   )])
> 
> which is combining bigfloats and arrays (if they, on their own, can they
> be combined that way; otherwise one might be tempted to use second-table
> units) to expand to
> 
> TBD51([{"v": TBD(0)}], [], [],
>  [{"bn": "urn:dev:ow:X", "bu": "V", "v": 2.047, "t": 1.6e9, "bto": 2},
>   TBD6'(
>     [1.986, 1.874, 1.423]
>   )])
> 
> and then would use circumfix expansion (a variant on the shared item)
> to expand the array into the original one-element dictionary sets. The
> rough rule could be that when the nth circumfix expansion is triggered,
> the rump is iterated over expanded into the nth shared item (or picked
> from another table -- details) with its occurrence of a given tag TBD
> replaced with the rump's item at that position.
> 
> One straightforward application is like in the example -- generating
> repetitive entries from data that can be sent right from some sampling
> buffer by using typed arrays.
> 
> The straightforward reason not to do this is that it's more complex even
> on the decompressor (let alone on the compressor, but that might usually
> use manual compression anyway).
> 
> I'm not saying we *should* do this (that's what I hope to get from
> starting discussion here) -- but if nothing else, it could help shape a
> "what kind of compressions are in scope and what's out of scope"
> paragraph.
> 
> BR
> Christian
> 
> -- 
> To use raw power is to make yourself infinitely vulnerable to greater powers.
>  -- Bene Gesserit axiom