Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void transpose(uint8_t* buffer, const uint32_t width, const uint32_t height)
- {
- const size_t stride = width * sizeof(uint32_t);
- for (uint32_t i = 0; i < height; i++)
- {
- uint32_t* row = (uint32_t*)(buffer + (stride * i));
- uint8_t* section = buffer + (i * sizeof(uint32_t));
- for (uint32_t j = i + 1; j < height; j++)
- {
- const uint32_t tmp = row[j];
- row[j] = *((uint32_t*)(section + (stride * j)));
- *((uint32_t*)(section + (stride * j))) = tmp;
- }
- }
- }
Add Comment
Please, Sign In to add comment