mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-02 03:52:11 +08:00
d9d57e5d6f
* Revert "Replace ThneedModel with TinygradModel (#33532)" This reverts commitda952e9b64. * Revert "camerad: move E + D cams image pipelines to the IFE (#33959)" This reverts commitf2a1cce42b.
38 lines
1006 B
C++
38 lines
1006 B
C++
#pragma once
|
|
|
|
#include <cfloat>
|
|
#include <cstdlib>
|
|
|
|
#include <memory>
|
|
|
|
#define CL_USE_DEPRECATED_OPENCL_1_2_APIS
|
|
#ifdef __APPLE__
|
|
#include <OpenCL/cl.h>
|
|
#else
|
|
#include <CL/cl.h>
|
|
#endif
|
|
|
|
#include "common/mat.h"
|
|
#include "selfdrive/modeld/transforms/loadyuv.h"
|
|
#include "selfdrive/modeld/transforms/transform.h"
|
|
|
|
class ModelFrame {
|
|
public:
|
|
ModelFrame(cl_device_id device_id, cl_context context);
|
|
~ModelFrame();
|
|
uint8_t* prepare(cl_mem yuv_cl, int width, int height, int frame_stride, int frame_uv_offset, const mat3& transform, cl_mem *output);
|
|
|
|
const int MODEL_WIDTH = 512;
|
|
const int MODEL_HEIGHT = 256;
|
|
const int MODEL_FRAME_SIZE = MODEL_WIDTH * MODEL_HEIGHT * 3 / 2;
|
|
const int buf_size = MODEL_FRAME_SIZE * 2;
|
|
const size_t frame_size_bytes = MODEL_FRAME_SIZE * sizeof(uint8_t);
|
|
|
|
private:
|
|
Transform transform;
|
|
LoadYUVState loadyuv;
|
|
cl_command_queue q;
|
|
cl_mem y_cl, u_cl, v_cl, img_buffer_20hz_cl, last_img_cl;
|
|
cl_buffer_region region;
|
|
std::unique_ptr<uint8_t[]> input_frames;
|
|
}; |