Skip to content

Commit 38195b7

Browse files
richardssamrex4539apetrynet
authored
OAPV and HTJ2K docs (#106)
* Adding in better docs for libaom-av1. (#91) Signed-off-by: [email protected] <[email protected]> Co-authored-by: [email protected] <[email protected]> Signed-off-by: [email protected] <[email protected]> * Docs update (#92) * AV1 update Signed-off-by: [email protected] <[email protected]> * Adding section for sws-scale. Signed-off-by: [email protected] <[email protected]> * Clarifying why colormatrix isnt great, also adding zscale for completeness. Signed-off-by: [email protected] <[email protected]> * Adding some extra notes on what the graphs are showing, also added the allintra flag. Signed-off-by: [email protected] <[email protected]> * Updating the color tests, removing some un-necessary tests. Signed-off-by: [email protected] <[email protected]> * Adding in some more reference-results images that are needed by the AV1 page. Signed-off-by: [email protected] <[email protected]> --------- Signed-off-by: [email protected] <[email protected]> Co-authored-by: [email protected] <[email protected]> Signed-off-by: [email protected] <[email protected]> * Docs update rgb (#93) * Remove period. Signed-off-by: [email protected] <[email protected]> * Remove the wedge_results folder. Signed-off-by: [email protected] <[email protected]> * Breaking out separate section for RGB encoding, removing it from QuickStart. Signed-off-by: [email protected] <[email protected]> * Initial commit of bit-depth testing, trying to determine how well the codec tracks Luminance. Signed-off-by: [email protected] <[email protected]> * Fleshing out the bit-depth comparison, giving a high level summary. Signed-off-by: [email protected] <[email protected]> * Adding some zscale links, and other formatting changes. Signed-off-by: [email protected] <[email protected]> * Fixing broken link. Signed-off-by: [email protected] <[email protected]> --------- Signed-off-by: [email protected] <[email protected]> Co-authored-by: [email protected] <[email protected]> Signed-off-by: [email protected] <[email protected]> * Broken link fixes (#94) * Broken link fixes. Signed-off-by: [email protected] <[email protected]> * Minor tweak commenting on speed improvement. Signed-off-by: [email protected] <[email protected]> * Tweak copy-results to get data from relative paths. Signed-off-by: [email protected] <[email protected]> --------- Signed-off-by: [email protected] <[email protected]> Co-authored-by: [email protected] <[email protected]> Signed-off-by: [email protected] <[email protected]> * Fixing more broken links. (#95) Signed-off-by: [email protected] <[email protected]> Co-authored-by: [email protected] <[email protected]> Signed-off-by: [email protected] <[email protected]> * Broken link fixes3 (#96) * Missing file. Signed-off-by: [email protected] <[email protected]> * Fixing broken links. Signed-off-by: [email protected] <[email protected]> --------- Signed-off-by: [email protected] <[email protected]> Co-authored-by: [email protected] <[email protected]> Signed-off-by: [email protected] <[email protected]> * docker ffmpeg7 (#89) * Enable bit-depth in older version of x264. Signed-off-by: [email protected] <[email protected]> * Adding docker for ffmpeg-7.0 Signed-off-by: [email protected] <[email protected]> --------- Signed-off-by: [email protected] <[email protected]> Co-authored-by: [email protected] <[email protected]> Signed-off-by: [email protected] <[email protected]> * Vp8 (#97) * Adding some vp8 tests, still a WIP. Signed-off-by: [email protected] <[email protected]> * We dont actually need the yml file for a still. Signed-off-by: [email protected] <[email protected]> * Remove irrevelant table. Signed-off-by: [email protected] <[email protected]> * Fix links Signed-off-by: [email protected] <[email protected]> * Updated VP9 section Signed-off-by: [email protected] <[email protected]> * Adding very basic rav1e test. Signed-off-by: [email protected] <[email protected]> * Minor update to rav1, in testing its not great. Signed-off-by: [email protected] <[email protected]> * Update with arnr-strength. Signed-off-by: [email protected] <[email protected]> * Minor tweaks to vp8 setup. Signed-off-by: Sam Richards <[email protected]> * -qscale 3 does not map to 90% compression. Signed-off-by: [email protected] <[email protected]> * Adding a graph for preset. Signed-off-by: [email protected] <[email protected]> * Added a codec web test page to test a variety of codecs. Signed-off-by: [email protected] <[email protected]> * Fixes to make it legal html. Signed-off-by: [email protected] <[email protected]> * Make sure the labels are right. Signed-off-by: [email protected] <[email protected]> * Adding more tests, that were used in the ASWF open source days presentation. Signed-off-by: [email protected] <[email protected]> * Add a note about alpha for vp9. Signed-off-by: [email protected] <[email protected]> * Add a crf value for the quickstart. Signed-off-by: [email protected] <[email protected]> * Adding VP8 Docs. Signed-off-by: [email protected] <[email protected]> * Changing the preset to 5 from 9, addresses some artifacts. Signed-off-by: [email protected] <[email protected]> * Defining the column ordering of the graphs. Signed-off-by: [email protected] <[email protected]> --------- Signed-off-by: [email protected] <[email protected]> Signed-off-by: Sam Richards <[email protected]> Co-authored-by: [email protected] <[email protected]> Signed-off-by: [email protected] <[email protected]> * ASWF open-source-days update (#98) * Adding link to Nextgen white-paper. Signed-off-by: [email protected] <[email protected]> * The readme links were not working on the home page, so cut them out and added a link to the main encoding guidelines. Signed-off-by: [email protected] <[email protected]> * Updates adding in lossless encoding. Signed-off-by: [email protected] <[email protected]> --------- Signed-off-by: [email protected] <[email protected]> Co-authored-by: [email protected] <[email protected]> Signed-off-by: [email protected] <[email protected]> * Tweak to main index. (#99) Signed-off-by: [email protected] <[email protected]> Co-authored-by: [email protected] <[email protected]> Signed-off-by: [email protected] <[email protected]> * Playbacktest (#100) * Added some tests of playback, using some code from ffmpeg to test seeking to a frame and extracting some individual frames. Signed-off-by: [email protected] <[email protected]> * Comparing different intraframe encoding options. Signed-off-by: [email protected] <[email protected]> * Adding PC tests. Signed-off-by: Sam Richards <[email protected]> * Adding lots of timing information. Signed-off-by: [email protected] <[email protected]> * Adding optimization for build. Signed-off-by: [email protected] <[email protected]> * Adding more timing breakdown. Signed-off-by: [email protected] <[email protected]> --------- Signed-off-by: [email protected] <[email protected]> Signed-off-by: Sam Richards <[email protected]> Co-authored-by: [email protected] <[email protected]> Signed-off-by: [email protected] <[email protected]> * Ffmpeg 7.1 (#101) * Dont need the yml files for single frames. Signed-off-by: Sam Richards <[email protected]> * Define an order to the frames. Signed-off-by: Sam Richards <[email protected]> * Adding both types of docker container for ffmpeg 7.1 This includes patches for htj2k decoding. Signed-off-by: Sam Richards <[email protected]> --------- Signed-off-by: Sam Richards <[email protected]> Co-authored-by: [email protected] <[email protected]> Signed-off-by: [email protected] <[email protected]> * Fix typos (#102) Signed-off-by: Dimitris Apostolou <[email protected]> Signed-off-by: [email protected] <[email protected]> * Reorg host config (#90) * We have been recording the host-config already, this fix displays it on the results. Signed-off-by: [email protected] <[email protected]> * Allow you to specify a directory of config files. Signed-off-by: [email protected] <[email protected]> * Update enctests/testframework/main.py Simpler way to grab a directories worth of files. Co-authored-by: Daniel Flehner Heen <[email protected]> Signed-off-by: Sam Richards <[email protected]> --------- Signed-off-by: [email protected] <[email protected]> Signed-off-by: Sam Richards <[email protected]> Co-authored-by: [email protected] <[email protected]> Co-authored-by: Daniel Flehner Heen <[email protected]> Signed-off-by: [email protected] <[email protected]> * Htj2k fixes (#103) * Adding jpeg2000 codec. Signed-off-by: [email protected] <[email protected]> * WIP, Had problems running this in a docker container, since the timing returned didnt make sense, so we have a clock version and a non-clock version. Also am experimenting with the thread-type. Signed-off-by: [email protected] <[email protected]> * A bit more docker ffmpeg-7.1 cleanup dont need aces now, since it comes with OCIO. Signed-off-by: [email protected] <[email protected]> * Adding the terrific parallel-frames flag, for faster conversion. Signed-off-by: [email protected] <[email protected]> * Added tests for htj2k, currently relying on ppm files. Signed-off-by: [email protected] <[email protected]> * Wrapper script for generating h2k files and then wrapping in mxf (or mov) file. Signed-off-by: [email protected] <[email protected]> * Frame range fix. Signed-off-by: [email protected] <[email protected]> (cherry picked from commit 13fbea652773b0c65027914efca741c0dd7052ad) Signed-off-by: [email protected] <[email protected]> * Lets just use DPX files since they are supported. Signed-off-by: [email protected] <[email protected]> (cherry picked from commit c999d88c4225eb0d9285a47b4d6ca320fb6181a9) Signed-off-by: [email protected] <[email protected]> * Update new model location. Signed-off-by: [email protected] <[email protected]> (cherry picked from commit 02646963e6fd7c2fc2dd2f176cecfaed50defba6) Signed-off-by: [email protected] <[email protected]> * Update env location so it works on both osx and docker/rockylinux Signed-off-by: [email protected] <[email protected]> (cherry picked from commit 2df535f36b50e7f8c6ec0c4aa907052b31fbdd8a) Signed-off-by: [email protected] <[email protected]> * This is measuring fps rates, purely using ffmpeg. (cherry picked from commit 685b9cc) Signed-off-by: [email protected] <[email protected]> * Adding a bunch of htj2k tests. Signed-off-by: [email protected] <[email protected]> * Adding a dwab test. Signed-off-by: [email protected] <[email protected]> * Wrappers to help map htj2k and dwab into the encoding framework. Signed-off-by: [email protected] <[email protected]> * Adding some of the 4k media as reference. Signed-off-by: [email protected] <[email protected]> * Adding support for cambi. Signed-off-by: [email protected] <[email protected]> * Put each bit of media in a separate folder. Signed-off-by: [email protected] <[email protected]> * UPgrade to use the vmaf3 code, and do some better comparisons. Signed-off-by: [email protected] <[email protected]> * New templates for vmaf3. Signed-off-by: [email protected] <[email protected]> * Handle the cambi and other parameters into the template better. Signed-off-by: [email protected] <[email protected]> * Special case to handle QFactor= parameters, although this would work with any "=" parameter. Signed-off-by: [email protected] <[email protected]> * comments, and labeling. Signed-off-by: [email protected] <[email protected]> * Dont need this varient. Signed-off-by: [email protected] <[email protected]> * Adding the vmaf3 test. Signed-off-by: [email protected] <[email protected]> * Too extreme, makes graph hard to read. Signed-off-by: [email protected] <[email protected]> * Note for getting exr versions of some of the files. Signed-off-by: [email protected] <[email protected]> * Enable ffplay, so we can do some of the playback testing on the VM. Signed-off-by: [email protected] <[email protected]> * Improve units here and there. Signed-off-by: [email protected] <[email protected]> --------- Signed-off-by: [email protected] <[email protected]> * Initial round of oapv tests. Signed-off-by: [email protected] <[email protected]> * WIP to replace pyseq with fileseq Signed-off-by: Sam Richards <[email protected]> Signed-off-by: [email protected] <[email protected]> * Building ffmpeg (with or without apv) natively on windows using msys2, to get the better performance benchmarks. Signed-off-by: Sam Richards <[email protected]> Signed-off-by: [email protected] <[email protected]> * Running 4k tests for apv. Signed-off-by: Sam Richards <[email protected]> Signed-off-by: [email protected] <[email protected]> * Pip install. Signed-off-by: [email protected] <[email protected]> * Encoding args. Signed-off-by: [email protected] <[email protected]> * New style. Signed-off-by: [email protected] <[email protected]> * VP9 change from speed to cpu-used. Signed-off-by: [email protected] <[email protected]> * Wrapper cleanup. Signed-off-by: [email protected] <[email protected]> * Playback tests, think vanilla ffmpeg probably fine though. Signed-off-by: [email protected] <[email protected]> * Wrapper to build 10-bit and 12-bit versions. Signed-off-by: [email protected] <[email protected]> * Switch to using fileseq. Signed-off-by: [email protected] <[email protected]> * Re-working of tests, got cleaner and faster vmaf3. Addewd psnr and frame-extraction. Added better compare GUI. Signed-off-by: [email protected] <[email protected]> * Added apv tests. Signed-off-by: [email protected] <[email protected]> * Added htj2k tests. Signed-off-by: [email protected] <[email protected]> * Updating indexes and formatting pages. Signed-off-by: [email protected] <[email protected]> * Cleanup. Signed-off-by: [email protected] <[email protected]> * Using 10-bit and 12-bit data where appropriate. Signed-off-by: [email protected] <[email protected]> * Adding openapv Signed-off-by: [email protected] <[email protected]> * Updated scripts. Signed-off-by: [email protected] <[email protected]> * New configs. Signed-off-by: [email protected] <[email protected]> * Its ProRes not Prores. Signed-off-by: [email protected] <[email protected]> * CPU Used repeated. Signed-off-by: [email protected] <[email protected]> * Adding OpenAPV and HTJ2K WIP. Signed-off-by: [email protected] <[email protected]> * Support single frames. Signed-off-by: [email protected] <[email protected]> * Adding metadata page. Signed-off-by: [email protected] <[email protected]> * Updating index. Signed-off-by: [email protected] <[email protected]> * Add transcoding notes. Signed-off-by: [email protected] <[email protected]> * UPdated docs. Signed-off-by: [email protected] <[email protected]> * Renamed from htj2k_prep to media_prep Signed-off-by: [email protected] <[email protected]> * Updated sync to encode site. Signed-off-by: [email protected] <[email protected]> * Enhanced sync page. Signed-off-by: [email protected] <[email protected]> * Updated tests. Signed-off-by: [email protected] <[email protected]> * Update notes. Signed-off-by: [email protected] <[email protected]> * More tests to ignore. Signed-off-by: [email protected] <[email protected]> --------- Signed-off-by: [email protected] <[email protected]> Signed-off-by: Sam Richards <[email protected]> Signed-off-by: Dimitris Apostolou <[email protected]> Signed-off-by: Sam Richards <[email protected]> Co-authored-by: Dimitris Apostolou <[email protected]> Co-authored-by: Daniel Flehner Heen <[email protected]>
1 parent f76f89c commit 38195b7

File tree

72 files changed

+4901
-510
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+4901
-510
lines changed

.gitignore

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,3 +146,25 @@ tmp
146146
enctests/wedge_results
147147
framerate/circle_grad/jpg
148148
framerate/circle_grad/png
149+
enctests/sources/enc_sources/chimera_cars_srgb_dpx_16
150+
enctests/sources/enc_sources/chimera_coaster_srgb_dpx_16
151+
enctests/sources/enc_sources/chimera_dancers
152+
enctests/sources/enc_sources/chimera_fountains_srgb_dpx_16
153+
enctests/sources/enc_sources/chimera_wind_srgb_dpx_16
154+
enctests/sources/hdr_sources/oldhtj2k
155+
enctests/sources/enc_sources/chimera_cars_raw
156+
enctests/sources/enc_sources/chimera_cars_srgb_dpx_10
157+
enctests/sources/enc_sources/chimera_cars_srgb_dpx_12
158+
enctests/sources/enc_sources/chimera_coaster_12bit_tif
159+
enctests/sources/enc_sources/chimera_coaster_raw
160+
enctests/sources/enc_sources/chimera_coaster_srgb_dpx_10
161+
enctests/sources/enc_sources/chimera_coaster_srgb_dpx_12
162+
enctests/sources/enc_sources/chimera_fountains_raw
163+
enctests/sources/enc_sources/chimera_fountains_srgb_dpx_10
164+
enctests/sources/enc_sources/chimera_fountains_srgb_dpx_12
165+
enctests/sources/enc_sources/chimera_wind_srgb_dpx_12
166+
enctests/sources/hdr_sources/sparks2_cct_tif
167+
enctests/sources/hdr_sources/sparks2_htj2k_0.01
168+
enctests/sources/hdr_sources/sparks2_htj2k_0.025
169+
enctests/[email protected]/encode.taurich.org/results
170+
enctests/sources/enc_sources/chimera_wind_srgb_tif_12

EncodeHTJ2K.md

Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
---
2+
layout: default
3+
nav_order: 4.5
4+
title: JPEG2000 HTJ2K Encoding
5+
parent: Codec Comparisons
6+
---
7+
8+
# HTJ2K - High Throughput JPEG 2000
9+
10+
HTJ2K is an extremely interesting extension of the JPEG-2000 standard that is widely used in digital cinema, which promises significantly faster encoding and decoding for a small hit to compression efficiency.
11+
12+
The key advantages of HTJ2K include:
13+
14+
1. Visually lossless compression with high throughput.
15+
2. 10x-30x faster than Jpeg2000.
16+
3. Resolution scalability, lower resolutions extracted without needing to fully decode the file.
17+
4. Frame-based (intra-frame) compression. Each frame is encoded independently, which is ideal for random-access playback and scrubbing. Since each frame is encoded separately, and then stitched together into a container the compression can easily be parallelized.
18+
5. Support for 10-16-bit precision, JPEG-2000 can go higher, but many of the tools do not natively support it.
19+
6. Open-standards and royalty-free - Based on ISO/IEC 15444-15.
20+
7. GPU support (although not yet open-sourced).
21+
8. Compression is wavelet based, which for live-action is considered superior to the DCT compression of ProRes.
22+
23+
The Digital Cinema Initiative (DCI) Spec uses the older J2K standard, with:
24+
25+
* 12-bit per color component
26+
* CIE XYZ color space
27+
* 250 Mbit/s regardless of whether its 2k (2048x1080) or 4k (4096x2160) 24 fps.
28+
* 500Mbit/s for [high-frame rate](https://www.dcimovies.com/recommended-practice) (60/96/120 fps)
29+
30+
The rate control has limited support in the open-source tools.
31+
32+
[HTJ2K](https://lists.aswf.io/g/openexr-dev/attachment/5389/0/openexr+ht-v10.pdf) is now available in OpenEXR as a lossless compression option, which offers better compression sizes and faster encoding and decoding than PIZ. This is an example of HTJ2K usage with floating point, which is supported by the format, but not widely used.
33+
34+
See -
35+
36+
* [https://github.com/chafey/HTJ2KResources](https://github.com/chafey/HTJ2KResources)
37+
* [https://htj2k.com/](https://htj2k.com/)
38+
* [HTJ2K Discord Server](https://discord.gg/U4Zbq7RGDn)
39+
40+
## File Extensions
41+
42+
Typically the intermediate HTJ2K file uses a J2C extension. Wrapping the resulting image sequence into a MXF or MOV file allows you to store any metadata in those file-formats.
43+
44+
There are not many options for additional metadata in j2c files, other than a comment parameter.
45+
46+
## HTJ2K Encoding
47+
48+
HTJ2K can be encoded with BlackMagic Resolve which is using Kakadu. Other open source encoders include -
49+
50+
* [https://github.com/aous72/OpenJPH](https://github.com/aous72/OpenJPH)
51+
* Up to 16-bit. (see below), includes SSE3 and AVX512 acceleration.
52+
* [https://github.com/osamu620/OpenHTJ2K](https://github.com/osamu620/OpenHTJ2K)
53+
* Up to 12 bit only, does include QFactor (see below).
54+
* [https://github.com/GrokImageCompression/grok](https://github.com/GrokImageCompression/grok)
55+
* Fork of OpenJPEG does include some rate control.
56+
57+
The above are all per frame encoders, see below for [oiiotool](#openimageio-htj2k) integration which can handle image sequences.
58+
59+
Commercial Decoders
60+
61+
* [https://comprimato.com/products/comprimato-jpeg2000/](https://comprimato.com/products/comprimato-jpeg2000/) (GPU and software)
62+
* [https://kakadusoftware.com/toolkit/kakadu-ht/](https://kakadusoftware.com/toolkit/kakadu-ht/) (GPU and software)
63+
* [https://docs.nvidia.com/cuda/nvjpeg2000/index.html](https://docs.nvidia.com/cuda/nvjpeg2000/index.html) (GPU)
64+
65+
### OpenJPH - ojph_compress
66+
67+
Ojph_compress is part of the OpenJPH library. It can read pgm, ppm, pfm, dpx, tif and raw files, and generate j2c compressed files. But it can only do a single frame at a time.
68+
69+
An example:
70+
```
71+
ojph_compress -i INPUTFRAME.0001.tif -o OUTPUTFRAME.0001.j2c -qstep 0.001
72+
```
73+
74+
### OpenImageIO HTJ2K
75+
76+
[OpenImageIO](https://openimageio.readthedocs.io/en/latest/oiiotool.html) has been updated to support HTJ2K, using the OpenJPH library. OpenJPH does need to be already built and pkg-config needs to be able to find it. Currently it is merged with the main branch, but there is not a release for it (should be later this year).
77+
The advantage of using OIIO over ojph_compress are:
78+
79+
* Colorspace conversion rather than requiring an additional step.
80+
* Built in batch-conversion.
81+
* More options for image source, including OpenEXR.
82+
83+
Creating HTJ2K files can be done on the command line with oiiotool, e.g.:
84+
```
85+
oiiotool -t STARTFRAME-ENDFRAME –parallel-frames -i INPUTFRAMESEQ.%05d.tif \
86+
–compression htj2k --attrib jph:qstep 0.001 -o OUTPUTFRAMESEQ.%05d.j2c
87+
```
88+
Without the jph:qstep flag, lossless mode is used, which is typically quite a bit smaller than many other compression schemes, but not typically small enough for reviews.
89+
90+
| *–attrib jph:qstep 0.0001* | Interval size used to quantize wavelet coefficients. There is a rough mapping between this and the meaningful bit-depth of the resulting picture, qstep \= 2^(- bit-depth) If this is not defined, lossless compression is used. (See below). |
91+
| *–attrib jph:block_size 64,64* | The older JPEG2000 standard used to default to 32,32 but this does seem to result in a smaller file, this is the default for OIIO. |
92+
| *–attrib jph:prog_order RPCL* | (see [below](#progression-order)). |
93+
94+
While JPEG2000 can support YCrCb this openimageio implementation assumes that we are only generating RGB results.
95+
96+
### HTJ2K Wrapping J2C files in container
97+
98+
There are a number of advantages to having the J2C files in a container:
99+
100+
* Easier to transport a single file, rather than an image sequence.
101+
* Allows additional metadata to be stored in the container header.
102+
* In some cases seek time could be improved with the right container by creating an index table to seek into the container faster, although this may require additional development to support it.
103+
104+
FFMPEG provides the ability to add j2c files to a container with the following command:
105+
```
106+
ffmpeg -f image2 -r 24 -i JPEGFILES.%05d.j2c -vcodec copy outputfile.mov
107+
```
108+
109+
### Encoding Guidelines Benchmarks
110+
111+
Below are some charts showing how different qstep values affect, encode time, file-size and quality.
112+
113+
| ![](enctests/reference-results/htj2k-qstep-test-encode_time.png) This is showing Qstep values against encoding time. |
114+
| ![](enctests/reference-results/htj2k-qstep-test-filesize.png) This is showing Qstep values against file size. |
115+
| ![](enctests/reference-results/htj2k-qstep-test-vmaf_harmonic_mean.png) This is showing Qstep values against VMAF harmonic mean |
116+
| ![](enctests/reference-results/htj2k-qstep-test-psnr_y_harmonic_mean.png) This is showing Qstep values against PSNR |
117+
118+
NOTE - qstep default = 1/(2^bit-depth) so default for above 8-bit 0.00390625, 10-bit image would be 0.000976562 and 12-bits it would need to be 0.000244. So you really want to have at least a value of .002 or less.
119+
120+
So we probably want something close to or below 0.001 as a starting value for 10-bit data or at least between 0.001 and 0.003.
121+
122+
## QFactor
123+
124+
As an alternative to setting the qstep, with the [https://github.com/osamu620/OpenHTJ2K](https://github.com/osamu620/OpenHTJ2K) encoder you also have the option of setting the quality with a [QFactor](https://ds.jpeg.org/documents/jpeg2000/wg1n100430-098-COM-Guideline_on_controlling_JPEG_2000_image_quality_using_a_single_parameter.pdf) flag. This is closer to the Jpeg 0-100 quality flag. It is also a little more refined than setting qstep allowing it to use different qsteps for different sub-bands of the image.
125+
126+
In testing it with OpenHTJ2K and it does feel nicer than the fractional qstep. However, for our needs we typically would want something between 99 and 100.
127+
128+
| ![](enctests/reference-results/htj2k-qfactor-test-encode_time.png) This is showing QFactor values against encoding time. |
129+
| ![](enctests/reference-results/htj2k-qfactor-filesize.png) This is showing QFactor values against file size. |
130+
| ![](enctests/reference-results/htj2k-qfactor-test-vmaf_harmonic_mean.png) This is showing QFactor values against VMAF harmonic mean |
131+
| ![](enctests/reference-results/htj2k-qfactor-test-psnr_y_harmonic_mean.png) This is showing QFactor values against psnr y harmonic mean |
132+
133+
See - [Controlling JPEG 2000 image quality using a single parameter (Qfactor)](https://ds.jpeg.org/documents/jpeg2000/wg1n100430-098-COM-Guideline_on_controlling_JPEG_2000_image_quality_using_a_single_parameter.pdf) for more info.
134+
135+
## Progression Order {#progression-order}
136+
137+
The progression order (typically a prog_order flag in openjph, or jph:prog_order
138+
In OIIO) defines how the compressed image data is organized in the code-stream.
139+
140+
| Flag | Meaning | When to use it |
141+
| :---- | :---- | :---- |
142+
| LRCP | Layer -\> Resolution -\> Component -\> Position | Good for progressive quality over full image, particularly useful if you have multiple layers (not currently supported by OIIO). |
143+
| RLCP | Resolution -\> Layer -\> Component -\> Position | Prioritizes lower resolutions first, allows you to load all of the layers at a lower resolution and then |
144+
| RPCL | Resolution -\> Position -\> Component -\> Layer | Optimized for random access and tiling. |
145+
| PCRL | Position -\> Component -\> Resolution -\> Layer | Less common, spatial prioritisation, good for large images where you are viewing zoomed in sections of it. |
146+
| CPRL | Component -\> Position -\> Resolution -\> Layer | Used when components are needed separately, e.g. YUV where you might just want Y first, rarely used in VFX. |
147+
148+
Of these settings picking either RPCL or LRCP are the two most common progression orders. OIIO does not currently support layers, so really LRCP and RLCP are very similar.
149+
150+
For many cases position can be ignored, unless you start generating particularly large images where you are only interested in part of that large picture. For example having a 360-video where you are only viewing part of the overall picture. This may be where you would also want to tweak the precincts parameters of the codec. This is definately an area that JPEG2000 comes into its own, since
151+
152+
## HTJ2K Decoding and Playback
153+
154+
HTJ2K decoding has already been included in the OpenJpeg 2.5 library, which is widely used by ffmpeg and OIIO. However it is using a slower older version of the code that became OpenJPH, so is not suitable for playback. Similarly, ffmpeg has its own decoder that can read htj2k files, but does not have the throughput that OpenJPH has.
155+
156+
Playback is somewhat limited, but [OpenRV](https://github.com/AcademySoftwareFoundation/OpenRV) recently added HTJ2K support both as image sequences of J2C files, as well as wrapped in MXF, MOV or MP4 containers.
157+
158+
The tests below are with OpenRV 3.0 configured with 12 threads and a 4GB buffer.
159+
The test was to pick a frame rate where openRV is able to load a buffer at a rate sufficient to play long image sequences without stuttering or pausing (i.e. it can load the cache at least as fast as the playback).
160+
161+
| | M2 MAX Macbook Pro | Intel I9-Windows |
162+
| :---- | :---- | :---- |
163+
| HTJ2K qstep=0.0009 4K | 35 fps | |
164+
| HTJ2K qstep=0.001 4K | 35 fps | 43 fps |
165+
| HTJ2K qstep=0.002 8K | 6 fps | 11 fps |
166+
| HTJ2K qstep=0.002 8K loading 4K resolution | 40 fps | |
167+
168+
Note, the higher performance on windows is from the additional optimization on windows hardware, having said that the performance for 4k playback is acceptable for cinema content and does have quite a bit of optimization compared to OpenJPEG and FFMPEG.
169+
It's also worth pointing out that improved playback performance can be achieved using [Kakadu](https://kakadusoftware.com/) and [Comprimato](https://comprimato.com/) commercial decoders, although pure GPU based ones may not perform too well within openRV.
170+
171+
[Blackmagic Resolve](https://www.blackmagicdesign.com/uk/products/davinciresolve) can also playback HTJ2K J2C image sequence files. It does not appear to be able to recognise J2C files in containers though.
172+
173+
## Future work
174+
175+
* Adding HTJ2K to other players such as XStudio
176+
* Adding resolution control to be able to load ½ and ¼ resolution images from the source.
177+
* Auto switching resolutions based on playback performance.
178+
* Floating point support, and HDR support. (Good to get feedback on this).
179+
* Being able to load HTJ2K files from a S3 bucket, contained in a MXF file.
180+

0 commit comments

Comments
 (0)