//图像预处理引擎
#ifndef _IMAGE_PREPROCESS_ENGINE_H
#define _IMAGE_PREPROCESS_ENGINE_H

#include <iostream>
#include <chrono>
#include <cmath>
#include <utility>
#include <thread>
#include <chrono>
#include <functional>
#include <atomic>
#include <time.h>
#include <sys/time.h>
#include <unistd.h>
#include <queue>
#include <mutex>
#include <semaphore.h>
#include <algorithm>
#include <string>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <vector>
#include <memory>

#include <opencv2/opencv.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>

#include "EngineBase.h"
#include "EngineFactory.h"
#include "MyYaml.h"
#include "myutils.h"
#include "AppCommon.h"

#include "cuda_utils.h"
#include "logging.h"
#include "yolov5_common.h"
#include "utils.h"
#include "calibrator.h"
#include "preprocess.h"

class ImagePreprocessEngine : public ai_matrix::EngineBase
{
public:
    ImagePreprocessEngine();
    ~ImagePreprocessEngine();

    APP_ERROR Init() override;
    APP_ERROR DeInit() override;
    APP_ERROR Process() override;

private:
    std::string strPort0_;

    unsigned int width_, height_;

    cudaStream_t* image_preprocess_stream_ = nullptr;   //图像预处理CUDA流
    uint8_t* img_host_ = nullptr;    //相关内存分配
    uint8_t* img_device_ = nullptr;
};


ENGINE_REGIST(ImagePreprocessEngine)
#endif


