1// Copyright 2024-2025 Google LLC 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15// Proto definitions for delta-coded storage of Ink strokes. 16 17syntax = "proto2"; 18 19package androidx.ink.storage.proto; 20 21// Efficiently encodes a sequence of numbers, compressed lossily using delta 22// coding (but sequences of integers can be represented exactly). The first 23// value in the represented sequence is equal to `offset + scale * deltas[0]`, 24// and each successive Nth value is equal to `value[N-1] + scale * deltas[N]`. 25// 26// When representing a sequence of integers, the `scale` and `offset` fields 27// must be integral (or omitted, and their default values used). Otherwise, 28// this can represent a sequence of floating point numbers at whatever level of 29// precision yields a good tradeoff between accuracy and gzip-compressibility of 30// the delta sequence. 31message CodedNumericRun { 32 repeated sint32 deltas = 1 [packed = true]; 33 optional float scale = 2 [default = 1]; 34 optional float offset = 3; 35} 36