@ -16,10 +16,6 @@
# include "selfdrive/modeld/transforms/loadyuv.h"
# include "selfdrive/modeld/transforms/loadyuv.h"
# include "selfdrive/modeld/transforms/transform.h"
# include "selfdrive/modeld/transforms/transform.h"
constexpr int MODEL_WIDTH = 512 ;
constexpr int MODEL_HEIGHT = 256 ;
constexpr int MODEL_FRAME_SIZE = MODEL_WIDTH * MODEL_HEIGHT * 3 / 2 ;
const bool send_raw_pred = getenv ( " SEND_RAW_PRED " ) ! = NULL ;
const bool send_raw_pred = getenv ( " SEND_RAW_PRED " ) ! = NULL ;
void softmax ( const float * input , float * output , size_t len ) ;
void softmax ( const float * input , float * output , size_t len ) ;
@ -27,14 +23,17 @@ float softplus(float input);
float sigmoid ( float input ) ;
float sigmoid ( float input ) ;
class ModelFrame {
class ModelFrame {
public :
public :
ModelFrame ( cl_device_id device_id , cl_context context ) ;
ModelFrame ( cl_device_id device_id , cl_context context ) ;
~ ModelFrame ( ) ;
~ ModelFrame ( ) ;
float * prepare ( cl_mem yuv_cl , int width , int height , const mat3 & transform , cl_mem * output ) ;
float * prepare ( cl_mem yuv_cl , int width , int height , 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 int buf_size = MODEL_FRAME_SIZE * 2 ;
private :
private :
Transform transform ;
Transform transform ;
LoadYUVState loadyuv ;
LoadYUVState loadyuv ;
cl_command_queue q ;
cl_command_queue q ;