• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024, Alliance for Open Media. All rights reserved
3  *
4  * This source code is subject to the terms of the BSD 3-Clause Clear License
5  * and the Alliance for Open Media Patent License 1.0. If the BSD 3-Clause Clear
6  * License was not distributed with this source code in the LICENSE file, you
7  * can obtain it at www.aomedia.org/license/software-license/bsd-3-c-c. If the
8  * Alliance for Open Media Patent License 1.0 was not distributed with this
9  * source code in the PATENTS file, you can obtain it at
10  * www.aomedia.org/license/patent.
11  */
12 #ifndef OBU_LEB128_H_
13 #define OBU_LEB128_H_
14 
15 #include <cstdint>
16 
17 namespace iamf_tools {
18 
19 /*!\brief IAMF spec requires a ULEB128 or a SLEB128 be encoded in <= 8 bytes.
20  */
21 inline constexpr int kMaxLeb128Size = 8;
22 
23 /*!\brief IAMF spec requires an entire OBU to be <= 2 MB.
24  */
25 constexpr uint32_t kEntireObuSizeMaxTwoMegabytes = (1 << 21);
26 
27 /*!\brief Decoded `leb128` in IAMF. */
28 typedef uint32_t DecodedUleb128;
29 
30 /*!\brief Decoded `sleb128` in IAMF. */
31 typedef int32_t DecodedSleb128;
32 
33 /*!\brief Type of audio samples for internal computation.
34  *
35  * Typically this should be used as a value in the range of [-1.0, 1.0].
36  */
37 typedef double InternalSampleType;
38 
39 /*!\brief Timestamp for use in internal computations.
40  *
41  * Typically this represents a duration of ticks, based on the sample rate used
42  * for timing purposes in an IA Sequence. I.e. if the sample rate is 48 kHz,
43  * then a timestamp of 1000 represents `1000/48000Hz ~= .02083s`.
44  */
45 typedef int32_t InternalTimestamp;
46 
47 }  // namespace iamf_tools
48 
49 #endif  // OBU_LEB128_H_
50