cine-handler 0.2.0__py3-none-macosx_11_0_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cine_handler-0.2.0.dist-info/METADATA +153 -0
- cine_handler-0.2.0.dist-info/RECORD +19 -0
- cine_handler-0.2.0.dist-info/WHEEL +5 -0
- cine_handler-0.2.0.dist-info/licenses/LICENSE +21 -0
- cine_handler-0.2.0.dist-info/top_level.txt +1 -0
- cine_reader/__init__.py +36 -0
- cine_reader/_binary.py +308 -0
- cine_reader/_lookup.py +76 -0
- cine_reader/_native.py +269 -0
- cine_reader/cine.py +859 -0
- cine_reader/frame_decode.py +57 -0
- cine_reader/headers.py +498 -0
- cine_reader/image_ops.py +112 -0
- cine_reader/libs/build-info.json +16 -0
- cine_reader/libs/libcine_core.dylib +0 -0
- cine_reader/py.typed +0 -0
- cine_reader/stats.py +94 -0
- cine_reader/unpack.py +51 -0
- cine_reader/writer.py +424 -0
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cine-handler
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Streaming Rust-backed reader and writer for Vision Research Phantom .cine files
|
|
5
|
+
Author: Rees Verleur
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/rverleur/cine-reader
|
|
8
|
+
Project-URL: Repository, https://github.com/rverleur/cine-reader
|
|
9
|
+
Project-URL: Documentation, https://github.com/rverleur/cine-reader/blob/main/python/API.md
|
|
10
|
+
Project-URL: Issues, https://github.com/rverleur/cine-reader/issues
|
|
11
|
+
Project-URL: Releases, https://github.com/rverleur/cine-reader/releases
|
|
12
|
+
Project-URL: MATLAB Implementation, https://github.com/rverleur/cine-reader/tree/main/Matlab
|
|
13
|
+
Keywords: phantom,cine,high-speed-camera,imaging
|
|
14
|
+
Classifier: Development Status :: 4 - Beta
|
|
15
|
+
Classifier: Intended Audience :: Science/Research
|
|
16
|
+
Classifier: Operating System :: MacOS
|
|
17
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
18
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering :: Image Processing
|
|
22
|
+
Requires-Python: >=3.9
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Requires-Dist: numpy>=1.24
|
|
26
|
+
Provides-Extra: images
|
|
27
|
+
Requires-Dist: Pillow>=9; extra == "images"
|
|
28
|
+
Provides-Extra: video
|
|
29
|
+
Requires-Dist: av>=12; extra == "video"
|
|
30
|
+
Provides-Extra: media
|
|
31
|
+
Requires-Dist: Pillow>=9; extra == "media"
|
|
32
|
+
Requires-Dist: av>=12; extra == "media"
|
|
33
|
+
Provides-Extra: dev
|
|
34
|
+
Requires-Dist: setuptools>=77.0.3; extra == "dev"
|
|
35
|
+
Requires-Dist: wheel; extra == "dev"
|
|
36
|
+
Requires-Dist: build>=1.2; extra == "dev"
|
|
37
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
38
|
+
Requires-Dist: twine>=5.0; extra == "dev"
|
|
39
|
+
Requires-Dist: Pillow>=9; extra == "dev"
|
|
40
|
+
Requires-Dist: av>=12; extra == "dev"
|
|
41
|
+
Requires-Dist: ruff==0.17.6; extra == "dev"
|
|
42
|
+
Requires-Dist: miss-hit==0.9.44; extra == "dev"
|
|
43
|
+
Dynamic: license-file
|
|
44
|
+
|
|
45
|
+
# cine-handler
|
|
46
|
+
|
|
47
|
+
Read, process, trim and write Vision Research Phantom `.cine` files from Python.
|
|
48
|
+
A portable Rust backend handles I/O, decoding, encoding and pixel processing;
|
|
49
|
+
NumPy supplies the array interface. Frames load on demand, with no GPU or
|
|
50
|
+
special CPU instruction set required.
|
|
51
|
+
|
|
52
|
+
**Package name:** `cine-handler` · **Python import:** `cine_reader`
|
|
53
|
+
|
|
54
|
+
## Installation
|
|
55
|
+
|
|
56
|
+
```sh
|
|
57
|
+
python -m pip install --only-binary=:all: cine-handler
|
|
58
|
+
# Include image-file and video conversion:
|
|
59
|
+
python -m pip install --only-binary=:all: "cine-handler[media]"
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Wheels include the native library. No Rust, C compiler or MATLAB installation
|
|
63
|
+
is needed. Version 0.2.0 supplies Apple Silicon macOS (ARM64, macOS 11+), Windows
|
|
64
|
+
x64 and Linux x64/glibc 2.28+ backends. Use 64-bit Python 3.9 or newer; dependency
|
|
65
|
+
wheels may require newer OS versions. Intel macOS, Windows ARM64, Linux ARM64 and
|
|
66
|
+
musl/Alpine are not included targets.
|
|
67
|
+
|
|
68
|
+
A downloaded/cloned GitHub checkout or source archive also installs without
|
|
69
|
+
compilers because it contains the same verified backends:
|
|
70
|
+
|
|
71
|
+
```sh
|
|
72
|
+
python -m pip install ".[media]"
|
|
73
|
+
# For working directly in an IDE checkout:
|
|
74
|
+
python -m pip install -e ".[media]"
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
`images` installs Pillow, `video` installs PyAV, and `media` installs both. PyAV
|
|
78
|
+
wheels bundle FFmpeg libraries, so ordinary video conversion needs no separate
|
|
79
|
+
`ffmpeg` or `ffprobe` executable. If you have the older `cine-reader` distribution,
|
|
80
|
+
uninstall it first: it shares the `cine_reader` import name.
|
|
81
|
+
|
|
82
|
+
## Read frames
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
from cine_reader import Cine
|
|
86
|
+
|
|
87
|
+
with Cine("capture.cine", canonical=True) as cine:
|
|
88
|
+
print(cine.total_frames, cine.frame_rate)
|
|
89
|
+
for number in range(cine.first_frame_number, cine.last_frame_number + 1):
|
|
90
|
+
cine.load_frame(number)
|
|
91
|
+
frame = cine.image
|
|
92
|
+
# Analyze one frame at a time.
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Opening reads bounded metadata. Pixels, offsets and raw payloads load when
|
|
96
|
+
requested. Acquisition frame numbers can be negative. `canonical=True` gives
|
|
97
|
+
top-down coordinates and RGB channel order; the default retains the previous
|
|
98
|
+
reader's storage row order and BGR convention. Raw CFA/Bayer frames remain 2D
|
|
99
|
+
unless `debayer=True`; `remove_dead_pixels=True` enables pixel repair.
|
|
100
|
+
|
|
101
|
+
## Write arrays, images and video
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
import numpy as np
|
|
105
|
+
from cine_reader import write_cine, write_cine_from_images, write_cine_from_video
|
|
106
|
+
|
|
107
|
+
frames = [np.full((64, 96), value, dtype=np.uint16) for value in (0, 100, 200)]
|
|
108
|
+
write_cine("normal.cine", frames, frame_rate=1000)
|
|
109
|
+
write_cine("packed.cine", frames, encoding="packed10", frame_rate=1000)
|
|
110
|
+
write_cine_from_images("photos.cine", ["001.png", "002.png"], frame_rate=30)
|
|
111
|
+
write_cine_from_video("video.cine", "input.mp4")
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
`write_cine` accepts sequences, frame-first NumPy stacks or generators;
|
|
115
|
+
`CineWriter` provides incremental writing. Normal encoding preserves uint8/uint16
|
|
116
|
+
mono and RGB samples. Packed10 quantizes linear12 values with Phantom's nonlinear
|
|
117
|
+
lookup table: uint16 input must be in `0..4095`, uint8 is scaled, and RGB is sampled
|
|
118
|
+
into a Bayer mosaic. Use normal RGB to preserve every input color sample.
|
|
119
|
+
Writers consume top-down RGB coordinates; read back with `canonical=True`.
|
|
120
|
+
|
|
121
|
+
Known counts write directly. Unknown counts spool to disk and make one final
|
|
122
|
+
copy, keeping RAM bounded. Existing destinations are never overwritten.
|
|
123
|
+
|
|
124
|
+
## Processing and formats
|
|
125
|
+
|
|
126
|
+
- Reads CINE v0/v1, normal8/16/24/48, packed10 and packed12, mono and raw CFA.
|
|
127
|
+
- Trims encoded frames without decoding, preserving relevant metadata.
|
|
128
|
+
- Repairs dead pixels, demosaics Bayer frames, averages recordings and estimates
|
|
129
|
+
robust backgrounds through Rust.
|
|
130
|
+
- Mean uses one accumulator; top-k retains bounded samples. Explicit MAD and
|
|
131
|
+
batch loading intentionally hold a stack.
|
|
132
|
+
|
|
133
|
+
Proprietary compressed CCI is unsupported. Generated files follow the CINE
|
|
134
|
+
format reference and pass independent FFmpeg checks. Direct PCC opening/playback
|
|
135
|
+
has not yet been verified.
|
|
136
|
+
|
|
137
|
+
## Documentation and examples
|
|
138
|
+
|
|
139
|
+
- [Python installation and usage](https://github.com/rverleur/cine-reader/blob/v0.2.0/python/README.md)
|
|
140
|
+
- [Python API](https://github.com/rverleur/cine-reader/blob/v0.2.0/python/API.md)
|
|
141
|
+
- [Runnable Python examples](https://github.com/rverleur/cine-reader/tree/v0.2.0/python/examples)
|
|
142
|
+
- [Developer setup and native builds](https://github.com/rverleur/cine-reader/blob/v0.2.0/docs/BUILDING.md)
|
|
143
|
+
- [Validation results and limitations](https://github.com/rverleur/cine-reader/blob/v0.2.0/docs/VALIDATION.md)
|
|
144
|
+
- [Changes in 0.2.0](https://github.com/rverleur/cine-reader/blob/v0.2.0/CHANGELOG.md)
|
|
145
|
+
|
|
146
|
+
The [repository](https://github.com/rverleur/cine-reader) also supplies a MATLAB
|
|
147
|
+
interface and standalone Rust library/CLI. Python wheels contain only the Python
|
|
148
|
+
interface and its matching native library. MATLAB users install the checkout's
|
|
149
|
+
prebuilt gateway with `install_cine_backend`; see the
|
|
150
|
+
[MATLAB guide](https://github.com/rverleur/cine-reader/blob/v0.2.0/Matlab/README.md).
|
|
151
|
+
|
|
152
|
+
Project code is MIT licensed. This package is an independent implementation and
|
|
153
|
+
does not require Vision Research software for its supported formats.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
cine_handler-0.2.0.dist-info/licenses/LICENSE,sha256=2ZSEOXP7fTkn_lgLruKD11Qn0Iy5AvcokA0rD7yte0c,1069
|
|
2
|
+
cine_reader/__init__.py,sha256=9d1P9XqBP8bHdQ8kx0ntBubR3TvwXAYKGZ5GLUQrVCg,1015
|
|
3
|
+
cine_reader/_binary.py,sha256=9CbT-XGTRKqmeEg9sndj0bjeD_fkGekP1IZ0AZwgU-Y,13689
|
|
4
|
+
cine_reader/_lookup.py,sha256=kFHnaBg3kZW5NvezcXEff4AzfOpY_ch89wT1EcN_yVQ,6689
|
|
5
|
+
cine_reader/_native.py,sha256=B8nzdS__bI38daa0FVsbYEFoQhbWYLyMmendRFoo7Ag,9797
|
|
6
|
+
cine_reader/cine.py,sha256=2TV-b3Tn3kqEDILt87EcQ894tIRe9wBFIJHGrwXN4aM,32795
|
|
7
|
+
cine_reader/frame_decode.py,sha256=Lz_k37tJOHgDRvdC8SByUi9s0vhpRoeSemHnG7C21Bs,1917
|
|
8
|
+
cine_reader/headers.py,sha256=3nALRVTH8UGQ0ZnC2tQ1ySZdH8QafGGVEAsWs-jOqR0,25579
|
|
9
|
+
cine_reader/image_ops.py,sha256=0Ou8hV2w-d91NNSuRGRgCb-KLHXBPn7rDIrahBG5wi0,3737
|
|
10
|
+
cine_reader/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
11
|
+
cine_reader/stats.py,sha256=Q3_F4K4dzZ3K4Tpb1xw6lHPhYBJ1NezTT_mzBb3pnuQ,3348
|
|
12
|
+
cine_reader/unpack.py,sha256=7J1pw-0BrCSKCjDt3qB6ebJEqHnXnpTCZoIn9AciE-A,1534
|
|
13
|
+
cine_reader/writer.py,sha256=ETc26FYd3ue9xNg0ze0nduMyM7iT7evInUNNYvQ4qeM,15631
|
|
14
|
+
cine_reader/libs/build-info.json,sha256=BJXYRdynWyWPwQpuPNdKkLM2rbdWyMhFfomfJmft6xA,684
|
|
15
|
+
cine_reader/libs/libcine_core.dylib,sha256=RKh6oNZFNj2jY_2aqRWenrIUD3iujToaekj09-p546g,483408
|
|
16
|
+
cine_handler-0.2.0.dist-info/METADATA,sha256=7Vs-ibQBW4p_X-hurIXJ6e0w67KHg_lo0bvz0kxICMM,6908
|
|
17
|
+
cine_handler-0.2.0.dist-info/WHEEL,sha256=4KNxTElBILrkFQeJpqVYjlB8fBsDGM4Jni4DJVcWhew,106
|
|
18
|
+
cine_handler-0.2.0.dist-info/top_level.txt,sha256=fzYCDywFXn0Dz-kWKamVkcnIm_5hZxj7ZHtrJ5HnHks,12
|
|
19
|
+
cine_handler-0.2.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Rees Verleur
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
cine_reader
|
cine_reader/__init__.py
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"""cine_reader package."""
|
|
2
|
+
|
|
3
|
+
from .cine import Cine
|
|
4
|
+
from .headers import BitmapHeader, CineHeader, ImageOffsets, Setup
|
|
5
|
+
from .image_ops import (
|
|
6
|
+
demosaic_bilinear,
|
|
7
|
+
replace_dead_pixels,
|
|
8
|
+
replace_dead_pixels_bayer,
|
|
9
|
+
replace_dead_pixels_mono,
|
|
10
|
+
replace_dead_pixels_rgb,
|
|
11
|
+
)
|
|
12
|
+
from .stats import average_from_frame_iter, robust_background_mad_stack, robust_background_topk
|
|
13
|
+
from .unpack import unpack_10bit_data, unpack_10bit_numpy
|
|
14
|
+
from .writer import CineWriter, write_cine, write_cine_from_images, write_cine_from_video
|
|
15
|
+
|
|
16
|
+
__all__ = [
|
|
17
|
+
"Cine",
|
|
18
|
+
"CineWriter",
|
|
19
|
+
"write_cine",
|
|
20
|
+
"write_cine_from_images",
|
|
21
|
+
"write_cine_from_video",
|
|
22
|
+
"CineHeader",
|
|
23
|
+
"BitmapHeader",
|
|
24
|
+
"ImageOffsets",
|
|
25
|
+
"Setup",
|
|
26
|
+
"unpack_10bit_data",
|
|
27
|
+
"unpack_10bit_numpy",
|
|
28
|
+
"replace_dead_pixels",
|
|
29
|
+
"replace_dead_pixels_mono",
|
|
30
|
+
"replace_dead_pixels_bayer",
|
|
31
|
+
"replace_dead_pixels_rgb",
|
|
32
|
+
"demosaic_bilinear",
|
|
33
|
+
"average_from_frame_iter",
|
|
34
|
+
"robust_background_mad_stack",
|
|
35
|
+
"robust_background_topk",
|
|
36
|
+
]
|
cine_reader/_binary.py
ADDED
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
"""Validate prebuilt backends using only Python's standard library.
|
|
2
|
+
|
|
3
|
+
This module is also loaded directly by setup.py, before NumPy is installed.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
import hashlib
|
|
9
|
+
import json
|
|
10
|
+
import os
|
|
11
|
+
import platform
|
|
12
|
+
import re
|
|
13
|
+
import struct
|
|
14
|
+
from pathlib import Path
|
|
15
|
+
|
|
16
|
+
ABI_VERSION = 1
|
|
17
|
+
MANIFEST_NAME = "build-info.json"
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class BinaryError(RuntimeError):
|
|
21
|
+
"""A matching, verified native backend is unavailable."""
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def linux_libc() -> tuple[str, str]:
|
|
25
|
+
"""Identify libc without invoking ldd, a shell, or any external program."""
|
|
26
|
+
try:
|
|
27
|
+
name, version = os.confstr("CS_GNU_LIBC_VERSION").split()
|
|
28
|
+
if name == "glibc":
|
|
29
|
+
return name, version
|
|
30
|
+
except (AttributeError, OSError, TypeError, ValueError):
|
|
31
|
+
pass
|
|
32
|
+
name, version = platform.libc_ver()
|
|
33
|
+
if name in ("glibc", "musl"):
|
|
34
|
+
return name, version
|
|
35
|
+
if any(Path("/lib").glob("ld-musl-*.so.1")):
|
|
36
|
+
return "musl", ""
|
|
37
|
+
raise BinaryError(
|
|
38
|
+
"Cannot identify Linux libc; refusing to select a possibly incompatible binary."
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def host_target() -> str:
|
|
43
|
+
machine = platform.machine().lower()
|
|
44
|
+
machine = {"amd64": "x86_64", "arm64": "aarch64"}.get(machine, machine)
|
|
45
|
+
if struct.calcsize("P") != 8 or machine not in ("x86_64", "aarch64"):
|
|
46
|
+
raise BinaryError(f"No prebuilt CINE backend supports this Python architecture: {machine}.")
|
|
47
|
+
system = platform.system()
|
|
48
|
+
if system == "Darwin":
|
|
49
|
+
return f"{machine}-apple-darwin"
|
|
50
|
+
if system == "Windows":
|
|
51
|
+
return f"{machine}-pc-windows-msvc"
|
|
52
|
+
if system == "Linux":
|
|
53
|
+
name, _ = linux_libc()
|
|
54
|
+
return f"{machine}-unknown-linux-{'gnu' if name == 'glibc' else 'musl'}"
|
|
55
|
+
raise BinaryError(f"No prebuilt CINE backend supports {system}.")
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def library_name(target: str) -> str:
|
|
59
|
+
if target.endswith("-apple-darwin"):
|
|
60
|
+
return "libcine_core.dylib"
|
|
61
|
+
if target.endswith("-pc-windows-msvc"):
|
|
62
|
+
return "cine_core.dll"
|
|
63
|
+
if target.endswith(("-unknown-linux-gnu", "-unknown-linux-musl")):
|
|
64
|
+
return "libcine_core.so"
|
|
65
|
+
raise BinaryError(f"Unsupported native target: {target}.")
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def file_digest(path: Path) -> str:
|
|
69
|
+
digest = hashlib.sha256()
|
|
70
|
+
with path.open("rb") as stream:
|
|
71
|
+
for block in iter(lambda: stream.read(1024 * 1024), b""):
|
|
72
|
+
digest.update(block)
|
|
73
|
+
return digest.hexdigest()
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def source_fingerprint(root: Path) -> str:
|
|
77
|
+
"""Hash portable build inputs, independent of checkout paths and CRLF conversion."""
|
|
78
|
+
required = ("Cargo.toml", "Cargo.lock", "rust/cine-core/Cargo.toml")
|
|
79
|
+
files = {root / name for name in required}
|
|
80
|
+
for name in ("rust/cine-core/src", "rust/cine-core/include"):
|
|
81
|
+
directory = root / name
|
|
82
|
+
if not directory.is_dir():
|
|
83
|
+
raise BinaryError(f"Cannot validate prebuilt backend: missing source directory {name}.")
|
|
84
|
+
files.update(path for path in directory.rglob("*") if path.is_file())
|
|
85
|
+
for name in (
|
|
86
|
+
"rust/cine-core/build.rs",
|
|
87
|
+
"rust-toolchain",
|
|
88
|
+
"rust-toolchain.toml",
|
|
89
|
+
".cargo/config",
|
|
90
|
+
".cargo/config.toml",
|
|
91
|
+
):
|
|
92
|
+
if (root / name).is_file():
|
|
93
|
+
files.add(root / name)
|
|
94
|
+
digest = hashlib.sha256()
|
|
95
|
+
for path in sorted(files, key=lambda item: item.relative_to(root).as_posix()):
|
|
96
|
+
try:
|
|
97
|
+
data = path.read_bytes()
|
|
98
|
+
except OSError as error:
|
|
99
|
+
raise BinaryError(f"Cannot validate native source input {path}: {error}") from error
|
|
100
|
+
if path.suffix in (".rs", ".h", ".toml", ".lock") or path.name in (
|
|
101
|
+
"config",
|
|
102
|
+
"rust-toolchain",
|
|
103
|
+
):
|
|
104
|
+
data = data.replace(b"\r\n", b"\n")
|
|
105
|
+
digest.update(path.relative_to(root).as_posix().encode("utf-8") + b"\0")
|
|
106
|
+
digest.update(len(data).to_bytes(8, "big"))
|
|
107
|
+
digest.update(data)
|
|
108
|
+
return digest.hexdigest()
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
def version_tuple(value: str) -> tuple[int, ...]:
|
|
112
|
+
if not isinstance(value, str) or not re.fullmatch(r"\d+\.\d+(?:\.\d+)?", value):
|
|
113
|
+
raise BinaryError(f"Invalid native compatibility version: {value!r}.")
|
|
114
|
+
parts = tuple(int(part) for part in value.split("."))
|
|
115
|
+
return parts + (0,) * (3 - len(parts))
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def _native_header(path: Path, target: str) -> tuple[int, ...] | None:
|
|
119
|
+
"""Check machine headers and read a Mach-O deployment minimum without tools."""
|
|
120
|
+
arm = target.startswith("aarch64-")
|
|
121
|
+
with path.open("rb") as stream:
|
|
122
|
+
header = stream.read(64)
|
|
123
|
+
if target.endswith("-apple-darwin"):
|
|
124
|
+
cpu = 0x0100000C if arm else 0x01000007
|
|
125
|
+
if len(header) < 32 or header[:4] != b"\xcf\xfa\xed\xfe":
|
|
126
|
+
raise BinaryError(f"{path.name} is not a native 64-bit Mach-O library.")
|
|
127
|
+
if struct.unpack_from("<I", header, 4)[0] != cpu:
|
|
128
|
+
raise BinaryError(f"{path.name} has the wrong processor architecture.")
|
|
129
|
+
commands, command_bytes = struct.unpack_from("<II", header, 16)
|
|
130
|
+
if command_bytes > path.stat().st_size - 32:
|
|
131
|
+
raise BinaryError("Malformed Mach-O load commands.")
|
|
132
|
+
stream.seek(32)
|
|
133
|
+
commands_data = stream.read(command_bytes)
|
|
134
|
+
position = 0
|
|
135
|
+
minimum = None
|
|
136
|
+
for _ in range(commands):
|
|
137
|
+
if position + 8 > len(commands_data):
|
|
138
|
+
raise BinaryError("Malformed Mach-O load command.")
|
|
139
|
+
command, size = struct.unpack_from("<II", commands_data, position)
|
|
140
|
+
if size < 8 or position + size > len(commands_data):
|
|
141
|
+
raise BinaryError("Malformed Mach-O load command size.")
|
|
142
|
+
if command in (0x24, 0x32): # LC_VERSION_MIN_MACOSX / LC_BUILD_VERSION
|
|
143
|
+
offset = 8 if command == 0x24 else 12
|
|
144
|
+
if size < offset + 4:
|
|
145
|
+
raise BinaryError("Malformed Mach-O deployment version.")
|
|
146
|
+
if (
|
|
147
|
+
command == 0x32
|
|
148
|
+
and struct.unpack_from("<I", commands_data, position + 8)[0] != 1
|
|
149
|
+
):
|
|
150
|
+
raise BinaryError(
|
|
151
|
+
"Mach-O library targets an Apple platform other than macOS."
|
|
152
|
+
)
|
|
153
|
+
value = struct.unpack_from("<I", commands_data, position + offset)[0]
|
|
154
|
+
minimum = (value >> 16, (value >> 8) & 255, value & 255)
|
|
155
|
+
position += size
|
|
156
|
+
if minimum is None:
|
|
157
|
+
raise BinaryError("Mach-O library does not declare a deployment minimum.")
|
|
158
|
+
return minimum
|
|
159
|
+
if "-windows-" in target:
|
|
160
|
+
if len(header) < 64 or header[:2] != b"MZ":
|
|
161
|
+
raise BinaryError(f"{path.name} is not a Windows PE library.")
|
|
162
|
+
stream.seek(struct.unpack_from("<I", header, 60)[0])
|
|
163
|
+
pe = stream.read(6)
|
|
164
|
+
if len(pe) != 6 or pe[:4] != b"PE\0\0":
|
|
165
|
+
raise BinaryError("Malformed Windows PE header.")
|
|
166
|
+
machine = struct.unpack_from("<H", pe, 4)[0]
|
|
167
|
+
expected = 0xAA64 if arm else 0x8664
|
|
168
|
+
else:
|
|
169
|
+
if len(header) < 20 or header[:6] != b"\x7fELF\x02\x01":
|
|
170
|
+
raise BinaryError(f"{path.name} is not a 64-bit little-endian ELF library.")
|
|
171
|
+
machine = struct.unpack_from("<H", header, 18)[0]
|
|
172
|
+
expected = 183 if arm else 62
|
|
173
|
+
if machine != expected:
|
|
174
|
+
raise BinaryError(f"{path.name} has the wrong processor architecture.")
|
|
175
|
+
return None
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
def validate_library(directory: Path, root: Path | None = None) -> tuple[Path, dict]:
|
|
179
|
+
target = host_target()
|
|
180
|
+
try:
|
|
181
|
+
metadata = json.loads((directory / MANIFEST_NAME).read_text(encoding="utf-8"))
|
|
182
|
+
except (OSError, ValueError) as error:
|
|
183
|
+
raise BinaryError(
|
|
184
|
+
f"Missing or invalid prebuilt manifest in {directory}: {error}"
|
|
185
|
+
) from error
|
|
186
|
+
if (
|
|
187
|
+
not isinstance(metadata, dict)
|
|
188
|
+
or type(metadata.get("schema_version")) is not int
|
|
189
|
+
or metadata["schema_version"] != 1
|
|
190
|
+
):
|
|
191
|
+
raise BinaryError("Unsupported prebuilt manifest schema.")
|
|
192
|
+
if metadata.get("target") != target:
|
|
193
|
+
raise BinaryError(f"Prebuilt backend target does not match {target}.")
|
|
194
|
+
if type(metadata.get("abi_version")) is not int or metadata["abi_version"] != ABI_VERSION:
|
|
195
|
+
raise BinaryError("Prebuilt backend ABI does not match this Python interface.")
|
|
196
|
+
fingerprint = metadata.get("source_fingerprint")
|
|
197
|
+
if not isinstance(fingerprint, str) or not re.fullmatch(r"[0-9a-f]{64}", fingerprint):
|
|
198
|
+
raise BinaryError("Prebuilt backend has an invalid Rust source fingerprint.")
|
|
199
|
+
if root is not None and metadata.get("source_fingerprint") != source_fingerprint(root):
|
|
200
|
+
raise BinaryError("Prebuilt backend is stale: its Rust source fingerprint does not match.")
|
|
201
|
+
path = directory / library_name(target)
|
|
202
|
+
artifacts = metadata.get("artifacts")
|
|
203
|
+
if not isinstance(artifacts, dict):
|
|
204
|
+
raise BinaryError("Prebuilt manifest artifacts must be a mapping.")
|
|
205
|
+
record = artifacts.get(path.name)
|
|
206
|
+
if not isinstance(record, dict):
|
|
207
|
+
raise BinaryError(f"Prebuilt manifest does not describe {path.name}.")
|
|
208
|
+
if not path.is_file() or path.stat().st_size != record.get("size"):
|
|
209
|
+
raise BinaryError(f"Prebuilt library is missing or has an incorrect size: {path}.")
|
|
210
|
+
if file_digest(path) != record.get("sha256"):
|
|
211
|
+
raise BinaryError(f"Prebuilt library checksum mismatch: {path}.")
|
|
212
|
+
minimum = _native_header(path, target)
|
|
213
|
+
if minimum is not None:
|
|
214
|
+
declared = version_tuple(metadata.get("macos_deployment_target"))
|
|
215
|
+
if declared < minimum or (target.startswith("aarch64-") and declared < (11, 0, 0)):
|
|
216
|
+
raise BinaryError("Prebuilt manifest understates the macOS deployment minimum.")
|
|
217
|
+
if version_tuple(platform.mac_ver()[0]) < declared:
|
|
218
|
+
raise BinaryError("This prebuilt backend requires a newer macOS version.")
|
|
219
|
+
if "-linux-" in target:
|
|
220
|
+
actual_name, actual_version = linux_libc()
|
|
221
|
+
compatibility = metadata.get("libc")
|
|
222
|
+
if not isinstance(compatibility, dict) or compatibility.get("name") != actual_name:
|
|
223
|
+
raise BinaryError("Prebuilt backend uses a different Linux libc.")
|
|
224
|
+
required = compatibility.get("minimum_version")
|
|
225
|
+
if required:
|
|
226
|
+
if not actual_version or version_tuple(actual_version) < version_tuple(required):
|
|
227
|
+
raise BinaryError(f"This backend requires {actual_name} {required} or newer.")
|
|
228
|
+
else:
|
|
229
|
+
raise BinaryError("Linux backend is missing its minimum libc version.")
|
|
230
|
+
return path, metadata
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
def select_prebuilt(root: Path) -> tuple[Path, dict]:
|
|
234
|
+
directory = root / "binaries" / host_target()
|
|
235
|
+
try:
|
|
236
|
+
return validate_library(directory, root)
|
|
237
|
+
except BinaryError as error:
|
|
238
|
+
raise BinaryError(
|
|
239
|
+
f"{error} Install a matching cine-handler wheel or obtain a checkout containing "
|
|
240
|
+
f"a current prebuilt backend in {directory}. Maintainers can explicitly set "
|
|
241
|
+
"CINE_BUILD_RUST=1 to compile during installation."
|
|
242
|
+
) from error
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
def check_build_environment(root: Path) -> None:
|
|
246
|
+
forbidden = (
|
|
247
|
+
"CARGO_BUILD_TARGET",
|
|
248
|
+
"RUSTFLAGS",
|
|
249
|
+
"CARGO_ENCODED_RUSTFLAGS",
|
|
250
|
+
"RUSTC",
|
|
251
|
+
"RUSTC_WRAPPER",
|
|
252
|
+
"RUSTC_WORKSPACE_WRAPPER",
|
|
253
|
+
)
|
|
254
|
+
if any(os.environ.get(key) for key in forbidden) or any(
|
|
255
|
+
key.startswith("CARGO_TARGET_") and key.endswith("_RUSTFLAGS") and value
|
|
256
|
+
for key, value in os.environ.items()
|
|
257
|
+
):
|
|
258
|
+
raise BinaryError(
|
|
259
|
+
"Native distributable builds require default Rust compiler/CPU/target settings."
|
|
260
|
+
)
|
|
261
|
+
directories = [root, *root.parents]
|
|
262
|
+
configs = [
|
|
263
|
+
parent / ".cargo" / name for parent in directories for name in ("config", "config.toml")
|
|
264
|
+
]
|
|
265
|
+
cargo_home = Path(os.environ.get("CARGO_HOME", str(Path.home() / ".cargo")))
|
|
266
|
+
configs.extend(cargo_home / name for name in ("config", "config.toml"))
|
|
267
|
+
for config in configs:
|
|
268
|
+
if not config.is_file():
|
|
269
|
+
continue
|
|
270
|
+
settings = re.sub(r"(?m)#.*$", "", config.read_text(encoding="utf-8"))
|
|
271
|
+
# This checked-in setting links the Windows C runtime statically; it
|
|
272
|
+
# introduces no CPU instruction requirement and makes wheels standalone.
|
|
273
|
+
if config.resolve() == (root / ".cargo/config.toml").resolve():
|
|
274
|
+
settings = re.sub(
|
|
275
|
+
r"(?m)^\s*\[target\.(?:x86_64|aarch64)-pc-windows-msvc\]\s*"
|
|
276
|
+
r'rustflags\s*=\s*\[\s*"-C"\s*,\s*"target-feature=\+crt-static"\s*\]',
|
|
277
|
+
"",
|
|
278
|
+
settings,
|
|
279
|
+
)
|
|
280
|
+
if re.search(
|
|
281
|
+
r"(?m)^\s*(?:target|rustflags|rustc-wrapper|rustc-workspace-wrapper)\s*=", settings
|
|
282
|
+
):
|
|
283
|
+
raise BinaryError(
|
|
284
|
+
f"Custom Rust target/compiler flags in {config} require a separate build."
|
|
285
|
+
)
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
def make_manifest(root: Path, target: str, files: list[Path], **provenance) -> dict:
|
|
289
|
+
metadata = {
|
|
290
|
+
"schema_version": 1,
|
|
291
|
+
"abi_version": ABI_VERSION,
|
|
292
|
+
"target": target,
|
|
293
|
+
"source_fingerprint": source_fingerprint(root),
|
|
294
|
+
"artifacts": {
|
|
295
|
+
path.name: {"size": path.stat().st_size, "sha256": file_digest(path)} for path in files
|
|
296
|
+
},
|
|
297
|
+
**provenance,
|
|
298
|
+
}
|
|
299
|
+
if target.endswith("-apple-darwin"):
|
|
300
|
+
metadata["macos_deployment_target"] = os.environ.get("MACOSX_DEPLOYMENT_TARGET", "11.0")
|
|
301
|
+
if "-linux-" in target:
|
|
302
|
+
name, version = linux_libc()
|
|
303
|
+
if not version:
|
|
304
|
+
raise BinaryError(
|
|
305
|
+
"Cannot record a portable Linux build without identifying libc's version."
|
|
306
|
+
)
|
|
307
|
+
metadata["libc"] = {"name": name, "minimum_version": version}
|
|
308
|
+
return metadata
|
cine_reader/_lookup.py
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"""Lookup table copied from Vision Research 10-bit unpack C implementation."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import numpy as np
|
|
6
|
+
|
|
7
|
+
# Preserve the reference table's 16-code rows for comparison with the format manual.
|
|
8
|
+
# fmt: off
|
|
9
|
+
LOOKUP_TABLE = np.array([
|
|
10
|
+
2, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 17, 18,
|
|
11
|
+
19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 33,
|
|
12
|
+
34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 48,
|
|
13
|
+
49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 63,
|
|
14
|
+
64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
|
|
15
|
+
79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
|
|
16
|
+
94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
|
|
17
|
+
110, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
|
|
18
|
+
125, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 137, 138,
|
|
19
|
+
139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154,
|
|
20
|
+
156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 167, 168, 169, 170, 171, 172,
|
|
21
|
+
173, 175, 176, 177, 178, 179, 181, 182, 183, 184, 186, 187, 188, 189, 191, 192,
|
|
22
|
+
193, 194, 196, 197, 198, 200, 201, 202, 204, 205, 206, 208, 209, 210, 212, 213,
|
|
23
|
+
215, 216, 217, 219, 220, 222, 223, 225, 226, 227, 229, 230, 232, 233, 235, 236,
|
|
24
|
+
238, 239, 241, 242, 244, 245, 247, 249, 250, 252, 253, 255, 257, 258, 260, 261,
|
|
25
|
+
263, 265, 266, 268, 270, 271, 273, 275, 276, 278, 280, 281, 283, 285, 287, 288,
|
|
26
|
+
290, 292, 294, 295, 297, 299, 301, 302, 304, 306, 308, 310, 312, 313, 315, 317,
|
|
27
|
+
319, 321, 323, 325, 327, 328, 330, 332, 334, 336, 338, 340, 342, 344, 346, 348,
|
|
28
|
+
350, 352, 354, 356, 358, 360, 362, 364, 366, 368, 370, 372, 374, 377, 379, 381,
|
|
29
|
+
383, 385, 387, 389, 391, 394, 396, 398, 400, 402, 404, 407, 409, 411, 413, 416,
|
|
30
|
+
418, 420, 422, 425, 427, 429, 431, 434, 436, 438, 441, 443, 445, 448, 450, 452,
|
|
31
|
+
455, 457, 459, 462, 464, 467, 469, 472, 474, 476, 479, 481, 484, 486, 489, 491,
|
|
32
|
+
494, 496, 499, 501, 504, 506, 509, 511, 514, 517, 519, 522, 524, 527, 529, 532,
|
|
33
|
+
535, 537, 540, 543, 545, 548, 551, 553, 556, 559, 561, 564, 567, 570, 572, 575,
|
|
34
|
+
578, 581, 583, 586, 589, 592, 594, 597, 600, 603, 606, 609, 611, 614, 617, 620,
|
|
35
|
+
623, 626, 629, 632, 635, 637, 640, 643, 646, 649, 652, 655, 658, 661, 664, 667,
|
|
36
|
+
670, 673, 676, 679, 682, 685, 688, 691, 694, 698, 701, 704, 707, 710, 713, 716,
|
|
37
|
+
719, 722, 726, 729, 732, 735, 738, 742, 745, 748, 751, 754, 758, 761, 764, 767,
|
|
38
|
+
771, 774, 777, 781, 784, 787, 790, 794, 797, 800, 804, 807, 811, 814, 817, 821,
|
|
39
|
+
824, 828, 831, 834, 838, 841, 845, 848, 852, 855, 859, 862, 866, 869, 873, 876,
|
|
40
|
+
880, 883, 887, 890, 894, 898, 901, 905, 908, 912, 916, 919, 923, 927, 930, 934,
|
|
41
|
+
938, 941, 945, 949, 952, 956, 960, 964, 967, 971, 975, 979, 982, 986, 990, 994,
|
|
42
|
+
998, 1001, 1005, 1009, 1013, 1017, 1021, 1025, 1028, 1032, 1036, 1040, 1044, 1048, 1052, 1056,
|
|
43
|
+
1060, 1064, 1068, 1072, 1076, 1080, 1084, 1088, 1092, 1096, 1100, 1104, 1108, 1112, 1116, 1120,
|
|
44
|
+
1124, 1128, 1132, 1137, 1141, 1145, 1149, 1153, 1157, 1162, 1166, 1170, 1174, 1178, 1183, 1187,
|
|
45
|
+
1191, 1195, 1200, 1204, 1208, 1212, 1217, 1221, 1225, 1230, 1234, 1238, 1243, 1247, 1251, 1256,
|
|
46
|
+
1260, 1264, 1269, 1273, 1278, 1282, 1287, 1291, 1295, 1300, 1304, 1309, 1313, 1318, 1322, 1327,
|
|
47
|
+
1331, 1336, 1340, 1345, 1350, 1354, 1359, 1363, 1368, 1372, 1377, 1382, 1386, 1391, 1396, 1400,
|
|
48
|
+
1405, 1410, 1414, 1419, 1424, 1428, 1433, 1438, 1443, 1447, 1452, 1457, 1462, 1466, 1471, 1476,
|
|
49
|
+
1481, 1486, 1490, 1495, 1500, 1505, 1510, 1515, 1520, 1524, 1529, 1534, 1539, 1544, 1549, 1554,
|
|
50
|
+
1559, 1564, 1569, 1574, 1579, 1584, 1589, 1594, 1599, 1604, 1609, 1614, 1619, 1624, 1629, 1634,
|
|
51
|
+
1639, 1644, 1649, 1655, 1660, 1665, 1670, 1675, 1680, 1685, 1691, 1696, 1701, 1706, 1711, 1717,
|
|
52
|
+
1722, 1727, 1732, 1738, 1743, 1748, 1753, 1759, 1764, 1769, 1775, 1780, 1785, 1791, 1796, 1801,
|
|
53
|
+
1807, 1812, 1818, 1823, 1828, 1834, 1839, 1845, 1850, 1856, 1861, 1867, 1872, 1878, 1883, 1889,
|
|
54
|
+
1894, 1900, 1905, 1911, 1916, 1922, 1927, 1933, 1939, 1944, 1950, 1956, 1961, 1967, 1972, 1978,
|
|
55
|
+
1984, 1989, 1995, 2001, 2007, 2012, 2018, 2024, 2030, 2035, 2041, 2047, 2053, 2058, 2064, 2070,
|
|
56
|
+
2076, 2082, 2087, 2093, 2099, 2105, 2111, 2117, 2123, 2129, 2135, 2140, 2146, 2152, 2158, 2164,
|
|
57
|
+
2170, 2176, 2182, 2188, 2194, 2200, 2206, 2212, 2218, 2224, 2231, 2237, 2243, 2249, 2255, 2261,
|
|
58
|
+
2267, 2273, 2279, 2286, 2292, 2298, 2304, 2310, 2317, 2323, 2329, 2335, 2341, 2348, 2354, 2360,
|
|
59
|
+
2366, 2373, 2379, 2385, 2392, 2398, 2404, 2411, 2417, 2423, 2430, 2436, 2443, 2449, 2455, 2462,
|
|
60
|
+
2468, 2475, 2481, 2488, 2494, 2501, 2507, 2514, 2520, 2527, 2533, 2540, 2546, 2553, 2559, 2566,
|
|
61
|
+
2572, 2579, 2586, 2592, 2599, 2605, 2612, 2619, 2625, 2632, 2639, 2645, 2652, 2659, 2666, 2672,
|
|
62
|
+
2679, 2686, 2693, 2699, 2706, 2713, 2720, 2726, 2733, 2740, 2747, 2754, 2761, 2767, 2774, 2781,
|
|
63
|
+
2788, 2795, 2802, 2809, 2816, 2823, 2830, 2837, 2844, 2850, 2857, 2864, 2871, 2878, 2885, 2893,
|
|
64
|
+
2900, 2907, 2914, 2921, 2928, 2935, 2942, 2949, 2956, 2963, 2970, 2978, 2985, 2992, 2999, 3006,
|
|
65
|
+
3013, 3021, 3028, 3035, 3042, 3049, 3057, 3064, 3071, 3078, 3086, 3093, 3100, 3108, 3115, 3122,
|
|
66
|
+
3130, 3137, 3144, 3152, 3159, 3166, 3174, 3181, 3189, 3196, 3204, 3211, 3218, 3226, 3233, 3241,
|
|
67
|
+
3248, 3256, 3263, 3271, 3278, 3286, 3294, 3301, 3309, 3316, 3324, 3331, 3339, 3347, 3354, 3362,
|
|
68
|
+
3370, 3377, 3385, 3393, 3400, 3408, 3416, 3423, 3431, 3439, 3447, 3454, 3462, 3470, 3478, 3486,
|
|
69
|
+
3493, 3501, 3509, 3517, 3525, 3533, 3540, 3548, 3556, 3564, 3572, 3580, 3588, 3596, 3604, 3612,
|
|
70
|
+
3620, 3628, 3636, 3644, 3652, 3660, 3668, 3676, 3684, 3692, 3700, 3708, 3716, 3724, 3732, 3740,
|
|
71
|
+
3749, 3757, 3765, 3773, 3781, 3789, 3798, 3806, 3814, 3822, 3830, 3839, 3847, 3855, 3863, 3872,
|
|
72
|
+
3880, 3888, 3897, 3905, 3913, 3922, 3930, 3938, 3947, 3955, 3963, 3972, 3980, 3989, 3997, 4006,
|
|
73
|
+
4014, 4022, 4031, 4039, 4048, 4056, 4064, 4095, 4095, 4095, 4095, 4095, 4095, 4095, 4095, 4095,
|
|
74
|
+
], dtype=np.uint16)
|
|
75
|
+
|
|
76
|
+
# fmt: on
|