|
|
|
@ -3,6 +3,7 @@ |
|
|
|
|
#include <fcntl.h> |
|
|
|
|
#include <unistd.h> |
|
|
|
|
#include "common/timing.h" |
|
|
|
|
#include "common/params.h" |
|
|
|
|
#include "driving.h" |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -53,6 +54,18 @@ void model_init(ModelState* s, cl_device_id device_id, cl_context context, int t |
|
|
|
|
s->traffic_convention = (float*)malloc(TRAFFIC_CONVENTION_LEN * sizeof(float)); |
|
|
|
|
for (int i = 0; i < TRAFFIC_CONVENTION_LEN; i++) s->traffic_convention[i] = 0.0; |
|
|
|
|
s->m->addTrafficConvention(s->traffic_convention, TRAFFIC_CONVENTION_LEN); |
|
|
|
|
|
|
|
|
|
char *string; |
|
|
|
|
const int result = read_db_value(NULL, "IsRHD", &string, NULL); |
|
|
|
|
if (result == 0) { |
|
|
|
|
bool is_rhd = string[0] == '1'; |
|
|
|
|
free(string); |
|
|
|
|
if (is_rhd) { |
|
|
|
|
s->traffic_convention[1] = 1.0; |
|
|
|
|
} else { |
|
|
|
|
s->traffic_convention[0] = 1.0; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
// Build Vandermonde matrix
|
|
|
|
@ -68,7 +81,7 @@ void model_init(ModelState* s, cl_device_id device_id, cl_context context, int t |
|
|
|
|
ModelDataRaw model_eval_frame(ModelState* s, cl_command_queue q, |
|
|
|
|
cl_mem yuv_cl, int width, int height, |
|
|
|
|
mat3 transform, void* sock, |
|
|
|
|
float *desire_in, float *traffic_convention_in) { |
|
|
|
|
float *desire_in) { |
|
|
|
|
#ifdef DESIRE |
|
|
|
|
if (desire_in != NULL) { |
|
|
|
|
for (int i = 0; i < DESIRE_LEN; i++) { |
|
|
|
@ -84,13 +97,6 @@ ModelDataRaw model_eval_frame(ModelState* s, cl_command_queue q, |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#ifdef TRAFFIC_CONVENTION |
|
|
|
|
if (traffic_convention_in != NULL) { |
|
|
|
|
for (int i = 0; i < TRAFFIC_CONVENTION_LEN; i++) { |
|
|
|
|
s->traffic_convention[i] = traffic_convention_in[i]; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
//for (int i = 0; i < OUTPUT_SIZE + TEMPORAL_SIZE; i++) { printf("%f ", s->output[i]); } printf("\n");
|
|
|
|
|
|
|
|
|
|