/*
 * Header for pre post process parameters.
 *
 * Copyright (C) 2022 Kneron, Inc. All rights reserved.
 *
 */
#ifndef KNERON_PRE_POST_PROC_PARAMS_H
#define KNERON_PRE_POST_PROC_PARAMS_H

#include <stdint.h>
#include <stdbool.h>

#include "model_res.h"

typedef struct {
    float       prob_thresh;
    float       nms_thresh;
    uint32_t    max_detection_per_class;
    uint16_t    anchor_row;
    uint16_t    anchor_col;
    uint16_t    stride_size;
    uint16_t    reserved_size;
    uint32_t    data[40];
} kneron_pre_post_proc_params_yolo_t;

typedef struct
{
    // pre-proc config
    struct {
        uint32_t x;
        uint32_t y;
    } landmark[4];                  /**< license plate corner landmark */

    bool enable_hw_inproc;          /**< to enable hw inproc or run warp perspective transform instead */

    // post-proc config
    bool is_maxpool_in_model;       /**< is maxpool layer in ocr model */
    uint32_t ocr_rule_base_code;    /**< ocr rule base code for ocr correction (ref: enum OCR_RULE_BASE_CODE) */
    uint32_t max_ocr_number;        /**< max number of detected characters  */
    float ocr_score_threshold;      /**< score threshold for ocr character filter  */
    float ocr_iou_threshold;        /**< IoU threshold for ocr character bounding box filter  */
} kneron_pre_post_proc_params_car_plate_t;


typedef struct
{
    // pre-proc config
    float lm_result[LANDMARK_POINTS * 2];   /**< face landmark */
    int flip_face;                          /**< is face flip (0: not flip; 1: flip) */

    // post-proc config
    int run_sigmoid;                        /**< do sigmoid in post-processing (0: disable; 1: enable) */
} kneron_pre_post_proc_params_fr_t;

typedef struct
{
    // pre-proc config
    float lm_result[LANDMARK_POINTS * 2];   /**< face landmark */
    int flip_face;                          /**< is face flip (0: not flip; 1: flip) */
    int is_masked;                          /**< is face masked (0: unmasked; 1: masked) */

    // post-proc config
    int run_sigmoid;                        /**< do sigmoid in post-processing (0: disable; 1: enable) */
} kneron_pre_post_proc_params_fr_mask_t;

typedef struct
{
    // post-proc config
    float prob_threshold;                   /**< probability threshold */
    float iou_threshold;                    /**< IoU threshold */
} kneron_pre_post_proc_params_fcos_det_t;

#endif // KNERON_PRE_POST_PROC_PARAMS_H