Discussion
Loading...

Post

Log in
  • About
  • Code of conduct
  • Privacy
  • Users
  • Instances
  • About Bonfire
Biason::Julio::new();
@juliobiason@functional.cafe  ·  activity timestamp 2 months ago
#define IMAGING_PIXEL_RGB(im, x, y) ((im)->image[(y)][(x) * 4])
#define IMAGING_PIXEL_RGBA(im, x, y) ((im)->image[(y)][(x) * 4])
#define IMAGING_PIXEL_CMYK(im, x, y) ((im)->image[(y)][(x) * 4])

I'm still wondering why would you keep the image in Y-by-X in memory, but still access it X-by-Y.

  • Copy link
  • Flag this post
  • Block
Biason::Julio::new();
@juliobiason@functional.cafe replied  ·  activity timestamp 2 months ago

I was wondering if there was any optimization in keeping this memory layout, but it seems it is actually worse?

'Cause when you need to read all the channels for one pixel, they are not in a contiguous memory segment, they are spread apart (although being small enough, they could always fit the L1 cache size).

  • Copy link
  • Flag this comment
  • Block
Log in

bonfire.cafe

A space for Bonfire maintainers and contributors to communicate

bonfire.cafe: About · Code of conduct · Privacy · Users · Instances
Bonfire social · 1.0.0-rc.2.11 no JS en
Automatic federation enabled
  • Explore
  • About
  • Members
  • Code of Conduct