/*
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

// SSD post-processing pipeline

#include "ssd_postprocess/pipeline.h"

#include <stdlib.h>

#include "ssd_postprocess/box.h"
#include "ssd_postprocess/nms.h"

void ssd_postprocess_pipeline(uint8_t** model_out, Boxes* boxes,
                              const int max_faces, const float iou_threshold) {
  Boxes boxes_before_nms = {.num_boxes = 0, .box = NULL};
  // decode and extract detected boxes
  get_detected_boxes(model_out, &boxes_before_nms);
  // non-max suppression
  nms(&boxes_before_nms, boxes, max_faces, iou_threshold);

  if (boxes_before_nms.box) {
    free(boxes_before_nms.box);
  }
}
