mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-03-02 00:23:58 +08:00
* use cstring instead of string.h
* use cstdio instead of stdio.h
* remove inttypes.h
* use cstdlib instead of stdlib.h
* use cstdint instead of stdint.h
* #include <cstddef>
* cstdlib
* use cmath
* remove stddef.h
* use cassert
* use csignal
* use ctime
* use cerror
* rebase master
old-commit-hash: c53cb5d570
38 lines
1002 B
C
38 lines
1002 B
C
#pragma once
|
|
|
|
#include <cfloat>
|
|
#include <cstdlib>
|
|
|
|
#define CL_USE_DEPRECATED_OPENCL_1_2_APIS
|
|
#ifdef __APPLE__
|
|
#include <OpenCL/cl.h>
|
|
#else
|
|
#include <CL/cl.h>
|
|
#endif
|
|
|
|
#include "selfdrive/common/mat.h"
|
|
#include "selfdrive/modeld/transforms/loadyuv.h"
|
|
#include "selfdrive/modeld/transforms/transform.h"
|
|
|
|
const bool send_raw_pred = getenv("SEND_RAW_PRED") != NULL;
|
|
|
|
void softmax(const float* input, float* output, size_t len);
|
|
float softplus(float input);
|
|
float sigmoid(float input);
|
|
|
|
typedef struct ModelFrame {
|
|
Transform transform;
|
|
int width, height;
|
|
cl_mem y_cl, u_cl, v_cl;
|
|
LoadYUVState loadyuv;
|
|
cl_mem net_input;
|
|
size_t net_input_size;
|
|
} ModelFrame;
|
|
|
|
void frame_init(ModelFrame* frame, int width, int height,
|
|
cl_device_id device_id, cl_context context);
|
|
float *frame_prepare(ModelFrame* frame, cl_command_queue q,
|
|
cl_mem yuv_cl, int width, int height,
|
|
const mat3 &transform);
|
|
void frame_free(ModelFrame* frame);
|