Bug 455598

Summary: JXL ticks-per-second (tps) is inverted
Product: [Applications] krita Reporter: Alvin Wong <alvin>
Component: AnimationAssignee: amyspark <amy>
Status: RESOLVED FIXED    
Severity: normal CC: amy
Priority: NOR    
Version: nightly build (please specify the git hash!)   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Alvin Wong 2022-06-19 10:08:39 UTC
From the docs https://libjxl.readthedocs.io/en/latest/api_common.html#structJxlAnimationHeader :

tps_numerator - Numerator of ticks per second of a single animation frame time unit
tps_denominator - Denominator of ticks per second of a single animation frame time unit

Say you have a 4 fps animation, it should be tps_numerator = 4 and tps_denominator = 1. However, the current exporter is doing the inverse.
Comment 1 amyspark 2022-06-20 18:24:00 UTC
> Say you have a 4 fps animation, it should be tps_numerator = 4 and tps_denominator = 1. However, the current exporter is doing the inverse.

It's worse. If we have a 4 fps animation, it should duration = 1, tps_numerator = 4, tps_denominator = 1. But instead, libjxl sets tps_numerator = 1000, tps_denominator = 1, and then duration = 250.

In other words, the tps ratio is completely decoupled from the actual framerate, and this makes the format just as cursed as WebP...
Comment 2 Bug Janitor Service 2022-06-20 21:12:26 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/krita/-/merge_requests/1481
Comment 3 amyspark 2022-06-28 18:51:19 UTC
Git commit f74380a690a13a44a0f1a86ae1e9ef57f6d8541a by L. E. Segovia.
Committed on 28/06/2022 at 17:31.
Pushed by lsegovia into branch 'master'.

JPEG XL: fix interpretation of tps_numerator/tps_denominator
Related: bug 455597

M  +4    -2    plugins/impex/jxl/JPEGXLExport.cpp
M  +30   -10   plugins/impex/jxl/JPEGXLImport.cpp
M  +-    --    plugins/impex/jxl/tests/data/sources/DX-MON/loading_16.jxl

https://invent.kde.org/graphics/krita/commit/f74380a690a13a44a0f1a86ae1e9ef57f6d8541a
Comment 4 amyspark 2022-06-28 18:52:45 UTC
Git commit 8090850fe0feeefa58bc05d0996ad9d87dee953e by L. E. Segovia.
Committed on 28/06/2022 at 18:51.
Pushed by lsegovia into branch 'krita/5.1'.

JPEG XL: fix interpretation of tps_numerator/tps_denominator
Related: bug 455597
(cherry picked from commit f74380a690a13a44a0f1a86ae1e9ef57f6d8541a)

M  +4    -2    plugins/impex/jxl/JPEGXLExport.cpp
M  +30   -10   plugins/impex/jxl/JPEGXLImport.cpp
M  +-    --    plugins/impex/jxl/tests/data/sources/DX-MON/loading_16.jxl

https://invent.kde.org/graphics/krita/commit/8090850fe0feeefa58bc05d0996ad9d87dee953e