#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 *img_bayer =
      image_new(input->num_channels, input->height, input->width);
  // shift the 8bits wide input to 16bits (the processing pipeline bitwidth)
  const uint32_t input_dimensions =
      input->num_channels * input->height * input->width;
  for (uint32_t i = 0; i < input_dimensions; ++i) {
    img_bayer->data[i] = input->data[i] << kRawPipelineFraction;  // 8
  }

  // black level offset (in-place)
  blc_process(img_bayer);

  // digital gain (in-place)
  dg_process(img_bayer);

  // white balance gain (in-place)
  wbg_process(img_bayer);

  // demosaic
  Image *img_color =
      image_new(output->num_channels, input->height, input->width);
  demosaic_process(img_bayer, img_color);
  image_delete(img_bayer);

  // gamma correction (in-place)
  gamma_process(img_color);

  // downscaler
  set_downscale_factor(img_color, output);
  downscale_process(img_color, output);
  image_delete(img_color);
}
