Metadata-Version: 2.4
Name: ojph
Version: 0.10.1
Summary: OpenJPH Bindings for Python and Numpy
Home-page: https://github.com/ramonaoptics/ojph
Author: Mark Harfouche
Author-email: mark@ramonaoptics.com
License: BSD-3-Clause
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: Free Threading :: 3 - Stable
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Requires-Dist: numpy>=2.1
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license
Dynamic: license-file
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

OpenJPH bindings

## Requirements

These bindings link against [OpenJPH](https://github.com/aous72/OpenJPH) and
require a version containing PR
[#312](https://github.com/aous72/OpenJPH/pull/312) ("Removes direct access to
COC segment marker"). That change was merged after the 0.30.1 release and, at
the time of writing, is only available on OpenJPH `main` (unreleased). Building
against OpenJPH 0.30.1 or earlier is not supported.

## Free-threaded Python

`ojph` supports free-threaded (PEP 703) CPython 3.13t/3.14t: the extension
declares that it does not need the GIL, so importing it leaves the GIL
disabled. Wheels are published for `cp314t`, and the test suite runs on a
free-threaded interpreter in CI.

The decode and encode hot paths already release the GIL, so a thread pool
scales across cores on a free-threaded interpreter:

```python
from concurrent.futures import ThreadPoolExecutor
from ojph.ojph_bindings import read_j2c_into

with ThreadPoolExecutor() as pool:
    pool.map(lambda t: read_j2c_into(t.data, t.out, t.level), tiles)
```

As with a file object, a single `Codestream`, infile or outfile object must not
be shared between threads without external synchronisation. Give each thread its
own; a compressed buffer that is only *read* can safely be shared.
