Bug 455597

Summary: Too many non-keyframes when importing some jxl
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 09:53:08 UTC
Some jxl files produce too many non-keyframes on import.

For example, input.jxl from https://github.com/libjxl/conformance/tree/master/testcases/animation_icos4d appears to be using a ticks-per-second (tps) of 1000/1 in the animation header (i.e. 1 ms per tick), but each frame is spaced 50 ms apart. Ideally, it should be imported as a 20 fps animation of 48 frames, with no non-keyframes at all.

The JPEG XL importer instead chooses to import it with 2351 frames with #2350 being the end frame #, in which only 2% of the frames are keyframes. (The end frame # should also be 2399 if imported correctly, since the last frame shall also hold for 50 ms, but that's another matter.) This would also make the imported animation use 1000 fps, which is way out of range of what Krita accepts. (The importer is also interpreting the tps value incorrectly, but this too is a separate matter.)

Debug output from Krita:

krita.file: Info
krita.file: Size: 128 x 128
krita.file: Depth: 8 0
krita.file: Number of channels: 3
krita.file: Has alpha 1 8 0
krita.file: Has animation: 1 loops: 0 tick: 1000 1
krita.file: JxlDecoderGetICCProfileSize succeeded, ICC profile available
krita.file: Animation detected, framerate: 1000 1
krita.file: Importing frame @ 0
krita.file: Importing frame @ 50
krita.file: Importing frame @ 100
krita.file: Importing frame @ 150
krita.file: Importing frame @ 200
krita.file: Importing frame @ 250
krita.file: Importing frame @ 300
krita.file: Importing frame @ 350
krita.file: Importing frame @ 400
krita.file: Importing frame @ 450
krita.file: Importing frame @ 500
krita.file: Importing frame @ 550
krita.file: Importing frame @ 600
krita.file: Importing frame @ 650
krita.file: Importing frame @ 700
krita.file: Importing frame @ 750
krita.file: Importing frame @ 800
krita.file: Importing frame @ 850
krita.file: Importing frame @ 900
krita.file: Importing frame @ 950
krita.file: Importing frame @ 1000
krita.file: Importing frame @ 1050
krita.file: Importing frame @ 1100
krita.file: Importing frame @ 1150
krita.file: Importing frame @ 1200
krita.file: Importing frame @ 1250
krita.file: Importing frame @ 1300
krita.file: Importing frame @ 1350
krita.file: Importing frame @ 1400
krita.file: Importing frame @ 1450
krita.file: Importing frame @ 1500
krita.file: Importing frame @ 1550
krita.file: Importing frame @ 1600
krita.file: Importing frame @ 1650
krita.file: Importing frame @ 1700
krita.file: Importing frame @ 1750
krita.file: Importing frame @ 1800
krita.file: Importing frame @ 1850
krita.file: Importing frame @ 1900
krita.file: Importing frame @ 1950
krita.file: Importing frame @ 2000
krita.file: Importing frame @ 2050
krita.file: Importing frame @ 2100
krita.file: Importing frame @ 2150
krita.file: Importing frame @ 2200
krita.file: Importing frame @ 2250
krita.file: Importing frame @ 2300
krita.file: Importing frame @ 2350
Comment 1 Bug Janitor Service 2022-06-20 21:12:28 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/krita/-/merge_requests/1481
Comment 2 amyspark 2022-06-28 18:51:03 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 455598

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 3 amyspark 2022-06-28 18:51:28 UTC
Git commit aeaaa6df3dbb95185f0077baa5ce13d2f559c444 by L. E. Segovia.
Committed on 28/06/2022 at 17:31.
Pushed by lsegovia into branch 'master'.

JPEG XL: fix keying of frametimes

Based on WebP, which kinda behaves the same.

M  +15   -5    plugins/impex/jxl/JPEGXLImport.cpp

https://invent.kde.org/graphics/krita/commit/aeaaa6df3dbb95185f0077baa5ce13d2f559c444
Comment 4 amyspark 2022-06-28 18:52:37 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 455598
(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
Comment 5 amyspark 2022-06-28 18:52:53 UTC
Git commit 514c4723bf8a1ef4f5780e27fc5f6ae345cf20c3 by L. E. Segovia.
Committed on 28/06/2022 at 18:51.
Pushed by lsegovia into branch 'krita/5.1'.

JPEG XL: fix keying of frametimes

Based on WebP, which kinda behaves the same.
(cherry picked from commit aeaaa6df3dbb95185f0077baa5ce13d2f559c444)

M  +15   -5    plugins/impex/jxl/JPEGXLImport.cpp

https://invent.kde.org/graphics/krita/commit/514c4723bf8a1ef4f5780e27fc5f6ae345cf20c3