quickdebayer.c 665 B

1234567891011121314151617181920212223242526272829
  1. #include "quickdebayer.h"
  2. // Fast but bad debayer method that scales and rotates by skipping source pixels and
  3. // doesn't interpolate any values at all
  4. void
  5. quick_debayer_bggr8(const uint8_t *source, uint8_t *destination, int width, int height, int skip)
  6. {
  7. int byteskip = 2 * skip;
  8. int input_size = width * height;
  9. int i;
  10. int j=0;
  11. int row_left = width;
  12. // B G
  13. // G R
  14. for(i=0;i<input_size;) {
  15. destination[j++] = source[i+width+1];
  16. destination[j++] = source[i+1];
  17. destination[j++] = source[i];
  18. i = i + byteskip;
  19. row_left = row_left - byteskip;
  20. if(row_left <= 0){
  21. row_left = width;
  22. i = i+width;
  23. i = i + (width * 2 * (skip-1));
  24. }
  25. }
  26. }