/*
 * Copyright (c) 2025 EdgeImpulse Inc.
 *
 * Generated by Edge Impulse and licensed under the applicable Edge Impulse
 * Terms of Service. Community and Professional Terms of Service
 * (https://edgeimpulse.com/legal/terms-of-service) or Enterprise Terms of
 * Service (https://edgeimpulse.com/legal/enterprise-terms-of-service),
 * according to your product plan subscription (the “License”).
 *
 * This software, documentation and other associated files (collectively referred
 * to as the “Software”) is a single SDK variation generated by the Edge Impulse
 * platform and requires an active paid Edge Impulse subscription to use this
 * Software for any purpose.
 *
 * You may NOT use this Software unless you have an active Edge Impulse subscription
 * that meets the eligibility requirements for the applicable License, subject to
 * your full and continued compliance with the terms and conditions of the License,
 * including without limitation any usage restrictions under the applicable License.
 *
 * If you do not have an active Edge Impulse product plan subscription, or if use
 * of this Software exceeds the usage limitations of your Edge Impulse product plan
 * subscription, you are not permitted to use this Software and must immediately
 * delete and erase all copies of this Software within your control or possession.
 * Edge Impulse reserves all rights and remedies available to enforce its rights.
 *
 * Unless required by applicable law or agreed to in writing, the Software 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, disclaimers and limitations under the License.
 */

#ifndef _EI_CLASSIFIER_MODEL_VARIABLES_H_
#define _EI_CLASSIFIER_MODEL_VARIABLES_H_

/**
 * @file
 *  Auto-generated complete impulse definitions. The ei_impulse_handle_t should
 *  be passed to ei_run_classifier() function to use this specific impulse.
 *  This file should only be included in ei_run_classifier.h file.
 */

#include <stdint.h>
#include "model_metadata.h"

#include "tflite-model/tflite_learn_773197_3_compiled.h"
#include "edge-impulse-sdk/classifier/ei_model_types.h"
#include "edge-impulse-sdk/classifier/inferencing_engines/engines.h"
#include "edge-impulse-sdk/classifier/postprocessing/ei_postprocessing_common.h"

const char* ei_classifier_inferencing_categories_773197_1[] = { "ambient", "blink", "cover" };

EI_CLASSIFIER_DSP_AXES_INDEX_TYPE ei_dsp_config_773197_2_axes[] = { 0 };
const uint32_t ei_dsp_config_773197_2_axes_size = 1;
ei_dsp_config_spectral_analysis_t ei_dsp_config_773197_2 = {
    2, // uint32_t blockId
    4, // int implementationVersion
    1, // int length of axes
    1.0f, // float scale-axes
    1, // int input-decimation-ratio
    "none", // select filter-type
    3.0f, // float filter-cutoff
    6, // int filter-order
    "FFT", // select analysis-type
    16, // int fft-length
    3, // int spectral-peaks-count
    0.1f, // float spectral-peaks-threshold
    "0.1, 0.5, 1.0, 2.0, 5.0", // string spectral-power-edges
    true, // boolean do-log
    true, // boolean do-fft-overlap
    1, // int wavelet-level
    "db4", // select wavelet
    false // boolean extra-low-freq
};

const uint8_t ei_dsp_blocks_773197_1_size = 1;
ei_model_dsp_t ei_dsp_blocks_773197_1[ei_dsp_blocks_773197_1_size] = {
    { // DSP block 2
        2,
        13, // output size
        &extract_spectral_analysis_features, // DSP function pointer
        (void*)&ei_dsp_config_773197_2, // pointer to config struct
        ei_dsp_config_773197_2_axes, // array of offsets into the input stream, one for each axis
        ei_dsp_config_773197_2_axes_size, // number of axes
        1, // version
        nullptr, // factory function
        nullptr, // data normalization config
    }
};
const ei_config_tflite_eon_graph_t ei_config_graph_773197_3 = {
    .implementation_version = 1,
    .model_init = &tflite_learn_773197_3_init,
    .model_invoke = &tflite_learn_773197_3_invoke,
    .model_reset = &tflite_learn_773197_3_reset,
    .model_input = &tflite_learn_773197_3_input,
    .model_output = &tflite_learn_773197_3_output,
};

const uint8_t ei_output_tensors_indices_773197_3[1] = { 0 };
const uint8_t ei_output_tensors_size_773197_3 = 1;
ei_learning_block_config_tflite_graph_t ei_learning_block_config_773197_3 = {
    .implementation_version = 1,
    .block_id = 3,
    .output_tensors_indices = ei_output_tensors_indices_773197_3,
    .output_tensors_size = ei_output_tensors_size_773197_3,
    .quantized = 1,
    .compiled = 1,
    .graph_config = (void*)&ei_config_graph_773197_3,
    .dequantize_output = 0,
};

const uint8_t ei_learning_blocks_773197_1_size = 1;
const uint32_t ei_learning_block_773197_3_inputs[1] = { 2 };
const uint8_t ei_learning_block_773197_3_inputs_size = 1;
const ei_learning_block_t ei_learning_blocks_773197_1[ei_learning_blocks_773197_1_size] = {
    {
        3,
        &run_nn_inference,
        (void*)&ei_learning_block_config_773197_3,
        EI_CLASSIFIER_IMAGE_SCALING_NONE,
        ei_learning_block_773197_3_inputs,
        ei_learning_block_773197_3_inputs_size,
    },
};

ei_fill_result_classification_i8_config_t ei_fill_result_classification_i8_config_773197_3 = {
    .zero_point = -128,
    .scale = 0.00390625
};

const size_t ei_postprocessing_blocks_773197_1_size = 1;
const ei_postprocessing_block_t ei_postprocessing_blocks_773197_1[ei_postprocessing_blocks_773197_1_size] = {
    {
        .block_id = 3,
        .type = EI_CLASSIFIER_MODE_CLASSIFICATION,
        .init_fn = NULL,
        .deinit_fn = NULL,
        .postprocess_fn = &process_classification_i8,
        .display_fn = NULL,
        .config = (void*)&ei_fill_result_classification_i8_config_773197_3,
        .input_block_id = 3
    },
};

const ei_impulse_t impulse_773197_1 = {
    .project_id = 773197,
    .project_owner = "Gowtham236",
    .project_name = "Light gesture Recognizer",
    .impulse_id = 1,
    .impulse_name = "Impulse #1",
    .deploy_version = 2,

    .nn_input_frame_size = 13,
    .raw_sample_count = 100,
    .raw_samples_per_frame = 1,
    .dsp_input_frame_size = 100 * 1,
    .input_width = 0,
    .input_height = 0,
    .input_frames = 0,
    .interval_ms = 10,
    .frequency = 100,

    .dsp_blocks_size = ei_dsp_blocks_773197_1_size,
    .dsp_blocks = ei_dsp_blocks_773197_1,

    .learning_blocks_size = ei_learning_blocks_773197_1_size,
    .learning_blocks = ei_learning_blocks_773197_1,

    .postprocessing_blocks_size = ei_postprocessing_blocks_773197_1_size,
    .postprocessing_blocks = ei_postprocessing_blocks_773197_1,

    .inferencing_engine = EI_CLASSIFIER_TFLITE,

    .sensor = EI_CLASSIFIER_SENSOR_FUSION,
    .fusion_string = "adc",
    .slice_size = (100/4),
    .slices_per_model_window = 4,

    .has_anomaly = EI_ANOMALY_TYPE_UNKNOWN,
    .label_count = 3,
    .categories = ei_classifier_inferencing_categories_773197_1
};

ei_impulse_handle_t impulse_handle_773197_1 = ei_impulse_handle_t( &impulse_773197_1 );
ei_impulse_handle_t& ei_default_impulse = impulse_handle_773197_1;
constexpr auto& ei_classifier_inferencing_categories = ei_classifier_inferencing_categories_773197_1;
const auto ei_dsp_blocks_size = ei_dsp_blocks_773197_1_size;
ei_model_dsp_t *ei_dsp_blocks = ei_dsp_blocks_773197_1;

#endif // _EI_CLASSIFIER_MODEL_VARIABLES_H_
