Skip to content

New image iterators#5404

Merged
dacap merged 3 commits into
aseprite:mainfrom
dacap:new-image-iterators
Sep 1, 2025
Merged

New image iterators#5404
dacap merged 3 commits into
aseprite:mainfrom
dacap:new-image-iterators

Conversation

@dacap

@dacap dacap commented Sep 1, 2025

Copy link
Copy Markdown
Member

These are some old experiments to add new kind of image iterators (ReadIterator/WriteIterator) and for future plans to change the internal Image representation (#2174). Check the changes in image_tests.cpp and image_benchmark.cpp for details.

Running C:\builds\aseprite-vc17-x64\bin\image_benchmark.exe
Run on (32 X 3187 MHz CPU s)
CPU Caches:
  L1 Data 48 KiB (x16)
  L1 Instruction 32 KiB (x16)
  L2 Unified 2048 KiB (x16)
  L3 Unified 36864 KiB (x1)
-------------------------------------------------------------------------------------
Benchmark                                           Time             CPU   Iterations
-------------------------------------------------------------------------------------
BM_ForXYGetPixel/0/1024/1024/real_time        1268648 ns      1271474 ns          553
BM_ForXYGetPixel/1/1024/1024/real_time        1263419 ns      1190753 ns          538
BM_ForXYGetPixel/2/1024/1024/real_time        1308777 ns      1250000 ns          550
BM_ForXYGetPixel/3/1024/1024/real_time        4789125 ns      4708904 ns          146
BM_ForEachPixel/0/1024/1024/real_time          304592 ns       300875 ns         2285
BM_ForEachPixel/1/1024/1024/real_time          322249 ns       316237 ns         2174
BM_ForEachPixel/2/1024/1024/real_time          308642 ns       290981 ns         2309
BM_ForEachPixel/3/1024/1024/real_time          567082 ns       573730 ns         1280
BM_ForXYGetPixelFast/0/1024/1024/real_time     287612 ns       286812 ns         2506
BM_ForXYGetPixelFast/1/1024/1024/real_time     274138 ns       265752 ns         2587
BM_ForXYGetPixelFast/2/1024/1024/real_time     262254 ns       256434 ns         2681
BM_ForXYGetPixelFast/3/1024/1024/real_time    1269483 ns      1278409 ns          550
BM_ReadIterator/0/1024/1024/real_time          190902 ns       184267 ns         3731
BM_ReadIterator/1/1024/1024/real_time          188554 ns       191923 ns         3745
BM_ReadIterator/2/1024/1024/real_time          189507 ns       189777 ns         3705

We can set DOC_USE_BITMAP_AS_1BPP=0 to use 8bpp to simplify iteration
of bitmap pixel format using a 8bpp buffer just like indexed mode.
@dacap dacap self-assigned this Sep 1, 2025

@aseprite-bot aseprite-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

Comment thread src/doc/image_benchmark.cpp
Comment thread src/doc/image_iterators2.h Outdated
Comment thread src/doc/image_iterators2.h Outdated
Comment thread src/doc/image_iterators2.h
Comment thread src/doc/image_iterators2.h
Comment thread src/doc/image_iterators2.h
Comment thread src/doc/image_tests.cpp
Comment thread src/doc/image_tests.cpp Outdated
Comment thread src/doc/image_tests.cpp Outdated
@dacap dacap force-pushed the new-image-iterators branch from c7205a5 to ace9558 Compare September 1, 2025 19:32
@dacap dacap merged commit 20b11a0 into aseprite:main Sep 1, 2025
12 checks passed
@dacap dacap deleted the new-image-iterators branch September 1, 2025 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants