High Throughput JPEG 2000 standard, officially ITU-T Rec T.814, shortly HTJ2K, is a modified version of JPEG2000 (shortly J2K), the reference to HTJ2K standard . According to the paper “High Throughput JPEG 2000 (HTJ2K): Algorithm, Performance and Potential”, by David Taubman et al., 2020, HTJ2K is a royalty free standard.
The one significant drawback of the original JPEG 2000 is computational complexity. Therefore HTJ2K is 10 times faster than the original JPEG2000 in both encoding and decoding. The price paid for the dramatic reduction in complexity of HTJ2K is a modest penalty in compression efficiency (typically 6% to 10%).
Currently (Feb. 2023), as far as i can see no player (even ffplay) supports HTJ2K decoding. Therefore to encode and to decode HTJ2K images you need the open-source reference encoder and decoder.
Getting HTJ2K Open Source Code (OpenHTJ2K)
git clone https://github.com/osamu620/OpenHTJ2K.git
sources are located at the folder OpenHTJ2K
Building OpenHTJ2K in Windows
Enter to the folder OpenHTJ2K, create the folder ‘build‘ and then enter to the new directory ‘build‘, then run the following (i have Visual Studio 2019) command:
cmake -G”Visual Studio 16 2019″ -A”x64″ ..
the VS solution open_htj2k.sln is created in the folder ‘build’, open it and build in the Release mode, the exe-files (open_htj2k_dec.exe, open_htj2k_enc.exe) are created (by default) at OpenHTJ2K\build\bin\Release
Running HTJ2K Encoder and Decoder
Input image formats are PGM (monochrome/gray), PPM (RGB24)
For example, to convert the frame 300 from an yuv-sequence (in the format yuv420p) into pgm-image i use ffmpeg tool:
ffmpeg -video_size 1920×1080 -r 60 -pixel_format yuv420p -i fifa17.yuv -ss 5s -y -frames 1 fifa1080p.pgm
Note: ‘-ss 5s’ instructs ffmpeg to go to 60*5 frame and extract it (since ‘-frames 1’), here ’60’ is the frame-rate ‘-r 60’
fifa1080p.pgm (notice that PGM is gray image format):
To convert the frame 300 from in the yuv-sequence (in the format yuv420p) into color ppm-image, use ‘ppm‘ as the output file extension in order to instruct ffmpeg that the output format is ‘ppm’ (by default RGB24)
ffmpeg -video_size 1920×1080 -r 60 -pixel_format yuv420p -i 50_Fifa17.yuv -ss 5s -y -frames 1 fifa1080p.ppm
Run HTJ2K Encoder
on pgm-image:
open_htj2k_enc.exe -i input1080p.pgm -o fifa1080p.j2k Qfactor=80 Cycc=no
quality factor Qfactor=80, the range of Qfactor from 1 (worst) to 100 (best).
Cycc=no – not apply RGB->YCbCr color space conversion since the image is monochrome.
on ppm-image (RGB24):
open_htj2k_enc.exe -i fifa1080p.ppm -o output1080p.j2k Qfactor=80 Cycc=yes
Cycc=yes – apply RGB->YCbCr color space conversion
Run HTJ2K Decoder
If the compressed image is monochrome (PGM) it’s worth to store the decoded image in the format PGM (gray-image):
open_htj2k_dec.exe -i fifa1080p.j2k -o test.pgm
to verify run ‘ffplay test.pgm‘
if compressed image is YCbCr or RGB24 it’s worth to decode it to PPM (RGB24) format:
open_htj2k_dec.exe -i output1080p.j2k -o test.ppm
to verify run ‘ffplay test.ppm‘
23+ years’ programming and theoretical experience in the computer science fields such as video compression, media streaming and artificial intelligence (co-author of several papers and patents).
the author is looking for new job, my resume