blob: 26e36b5dbf29037092ee3c7c8f480b7574072388 [file] [log] [blame]
#include "samples/risp4ml/common/utils.h"
#include "samples/risp4ml/isp_stages/blc.h"
static BlcParams blc_params = {.enable = true,
.offsets = {2048, 2048, 2048, 2048}};
void set_blc_params(BlcParams* params) { blc_params = *params; }
void blc_process(Image* input, Image* output) {
if (!blc_params.enable) {
*output = *input;
return;
}
uint16_t height = input->height;
uint16_t width = input->width;
for (uint16_t y = 0; y < height; ++y) {
const pixel_type_t* in_line = image_row(input, 0, y);
pixel_type_t* out_line = image_row(output, 0, y);
for (uint16_t x = 0; x < width; ++x) {
BayerIndex bayer_index = GetBayerIndex(kBayerType, x, y);
out_line[x] =
SubUnsignedZeroClamp(in_line[x], blc_params.offsets[bayer_index]);
}
}
}