01-28-2024, 04:28 PM
(01-28-2024, 07:16 AM)SMcNeill Wrote: A better way may be to just get values directly.Leave it Steve to think even deeper. Very interesting and of course so simple I completely overlooked it.
$Checking:off
Alpha = _MEMGET(m, o +3, _unsigned _byte)
Red = _MEMGET(m, o + 2, unsigned byte)
Green... o + 1
Blue ... o
$Checking:on
No shifting, no calculations. Just a direct value read.
(When then goes to the speed question: is it faster to just read 4 values directly, or to only read one and then math it?)
I'd *think* a simple direct read would be faster, but with cacheing and all nowadays... I'd swear to nothing!
One thing I noticed here is that because of the way you are reading offset values it appears that the bytes are ordered in BGRA. Is that correct Steve, was my bit manipulation efforts reading in the data backwards?