2020-09-15 00:03:41 +02:00
|
|
|
#include "quickdebayer.h"
|
|
|
|
|
|
|
|
// Fast but bad debayer method that scales and rotates by skipping source pixels and
|
|
|
|
// doesn't interpolate any values at all
|
|
|
|
|
|
|
|
void
|
|
|
|
quick_debayer_bggr8(const uint8_t *source, uint8_t *destination, int width, int height, int skip)
|
|
|
|
{
|
|
|
|
int byteskip = 2 * skip;
|
|
|
|
int input_size = width * height;
|
2020-09-16 13:39:12 +02:00
|
|
|
int output_size = (width/byteskip) * (height/byteskip);
|
2020-09-15 00:03:41 +02:00
|
|
|
int i;
|
|
|
|
int j=0;
|
|
|
|
int row_left = width;
|
|
|
|
|
|
|
|
// B G
|
|
|
|
// G R
|
|
|
|
for(i=0;i<input_size;) {
|
|
|
|
destination[j++] = source[i+width+1];
|
|
|
|
destination[j++] = source[i+1];
|
|
|
|
destination[j++] = source[i];
|
|
|
|
i = i + byteskip;
|
|
|
|
row_left = row_left - byteskip;
|
2020-09-16 13:39:12 +02:00
|
|
|
if(row_left < byteskip){
|
|
|
|
i = i + row_left;
|
2020-09-15 00:03:41 +02:00
|
|
|
row_left = width;
|
2020-09-16 13:39:12 +02:00
|
|
|
i = i + width;
|
2020-09-15 00:03:41 +02:00
|
|
|
i = i + (width * 2 * (skip-1));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|