blob: ec561b2759c0f72f1ed6efb1b309d210d6e16568 [file] [log] [blame]
#include "samples/risp4ml/common/utils.h"
#include "samples/risp4ml/isp_stages/blc.h"
#include "samples/risp4ml/isp_stages/demosaic.h"
#include "samples/risp4ml/isp_stages/dg.h"
#include "samples/risp4ml/isp_stages/downscale.h"
#include "samples/risp4ml/isp_stages/gamma.h"
#include "samples/risp4ml/isp_stages/wbg.h"
#include "samples/risp4ml/pipeline/pipeline.h"
void isp_pipeline(ImageU8 *input, ImageU8 *output) {
Image *input_image =
image_new(input->num_channels, input->height, input->width);
// shift the 8bits wide input to 16bits (the processing pipeline bitwidth)
uint32_t input_dimensions =
input->num_channels * input->height * input->width;
for (uint32_t i = 0; i < input_dimensions; ++i) {
input_image->data[i] = input->data[i] << kRawPipelineFraction; // 8
}
Image *image1 = image_new(input->num_channels, input->height, input->width);
blc_process(input_image, image1);
image_delete(input_image);
Image *image2 = image_new(input->num_channels, input->height, input->width);
dg_process(image1, image2);
image_delete(image1);
Image *image3 = image_new(input->num_channels, input->height, input->width);
wbg_process(image2, image3);
image_delete(image2);
Image *image4 = image_new(output->num_channels, input->height, input->width);
demosaic_process(image3, image4);
image_delete(image3);
Image *image5 = image_new(output->num_channels, input->height, input->width);
gamma_process(image4, image5);
image_delete(image4);
set_downscale_factor(image5, output);
downscale_process(image5, output);
image_delete(image5);
}