Skip to content

RAW: optimize importing by using tiles

Hey! This is a MR to testflight a simple rework that improves the loading of RAW files, outside of the OpenGL optimizations in !1686 (closed).

Tested using the following file:

Canon	EOS 5DS R	RAW (3:2)	52.66	RAW, Auto WB	co	2019-01-22	Canon - EOS 5DS R - RAW (3:2).CR2
c09afb557ab67ee2d23be151c38535b0b9d7aeca (57.82MB)

Switching out the horizontal line iterator in favour of the tile accessor, a pattern only used in masks and other pairing functions, brings as much as 2x faster conversion times:

Before After
Captura_de_pantalla_2023-01-02_181921 Captura_de_pantalla_2023-01-02_181906

For ease of benchmarking and of backtracing (if ever the need arises), I've moved the loop to a small lambda that should be inlined under -O1 and higher.

Test Plan

Build Krita. Benchmark your favorite RAW's loading times before and after the change.

Make sure to contain the readLayer into a distinguishable function, like a lambda, and exclude the time taken in the dialog and in the GUI update.

Formalities Checklist

  • I confirmed this builds.
  • I confirmed Krita ran and the relevant functions work.
  • I tested the relevant unit tests and can confirm they are not broken. (If not possible, don't hesitate to ask for help!)
  • I made sure my commits build individually and have good descriptions as per KDE guidelines.
  • I made sure my code conforms to the standards set in the HACKING file.
  • I can confirm the code is licensed and attributed appropriately, and that unattributed code is mine, as per KDE Licensing Policy.

Merge request reports