logoalt Hacker News

hcstoday at 5:38 AM1 replyview on HN

Pitch is the offset between the start of consecutive rows of pixels in the image, used to convert y coordinates into the start of any given row, so you access a pixel as buffer[y*pitch+x]. Often this is the image width, but can be greater depending on required alignment.


Replies

ggambettatoday at 6:49 AM

So at the end of each run increment the relevant pointer by (pitch - w) not pitch which I'm sure it's one of the bugs they saw all the time in this interview :)