Guest User

Untitled

a guest
Oct 16th, 2018
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. void transpose(uint8_t* buffer, const uint32_t width, const uint32_t height)
  2. {
  3. const size_t stride = width * sizeof(uint32_t);
  4.  
  5. for (uint32_t i = 0; i < height; i++)
  6. {
  7. uint32_t* row = (uint32_t*)(buffer + (stride * i));
  8. uint8_t* section = buffer + (i * sizeof(uint32_t));
  9.  
  10. for (uint32_t j = i + 1; j < height; j++)
  11. {
  12. const uint32_t tmp = row[j];
  13. row[j] = *((uint32_t*)(section + (stride * j)));
  14. *((uint32_t*)(section + (stride * j))) = tmp;
  15. }
  16. }
  17. }
Add Comment
Please, Sign In to add comment