  #define POLYFIT_DEGREE 4
  #define SPEED_PERCENTILES 10
  #define DESIRE_PRED_SIZE 32
  #define OTHER_META_SIZE 4
  
  typedef struct PathData {
    float points[MODEL_PATH_DISTANCE];
    float prob;
    float std;
    float stds[MODEL_PATH_DISTANCE];
    float poly[POLYFIT_DEGREE];
    float validLen;
  } PathData;
  
  typedef struct LeadData {
    float dist;
    float prob;
    float std;
    float rel_y;
    float rel_y_std;
    float rel_v;
    float rel_v_std;
    float rel_a;
    float rel_a_std;
  } LeadData;
  
  typedef struct ModelData {
    PathData path;
    PathData left_lane;
    PathData right_lane;
    LeadData lead;
    LeadData lead_future;
    float meta[OTHER_META_SIZE + DESIRE_PRED_SIZE];
    float speed[SPEED_PERCENTILES];
  } ModelData;
  
  #endif
 
</s> remove   // clamp to 5 and 192
  valid_len = fmin(192, fmax(5, data[MODEL_PATH_DISTANCE*2]));
 </s> add   // clamp to 5 and MODEL_PATH_DISTANCE
  valid_len = fmin(MODEL_PATH_DISTANCE, fmax(5, data[MODEL_PATH_DISTANCE*2])); </s> remove static void update_all_lane_lines_data(UIState *s, const PathData &path, model_path_vertices_data *pstart) {
  update_lane_line_data(s, path.points, 0.025*path.prob, pstart, path.validLen);
  float var = fmin(path.std, 0.7);
  update_lane_line_data(s, path.points, var, pstart + 1, path.validLen);
 </s> add static void update_all_lane_lines_data(UIState *s, const cereal::ModelData::PathData::Reader &path, const float *points, model_path_vertices_data *pstart) {
  update_lane_line_data(s, points, 0.025*path.getProb(), pstart, path.getValidLen());
  update_lane_line_data(s, points, fmin(path.getStd(), 0.7), pstart + 1, path.getValidLen()); </s> remove static void ui_draw_lane(UIState *s, const PathData *path, model_path_vertices_data *pstart, NVGcolor color) {
 </s> add static void ui_draw_lane(UIState *s,  model_path_vertices_data *pstart, NVGcolor color) { </s> remove #define MODEL_PATH_DISTANCE 192
#define POLYFIT_DEGREE 4
#define SPEED_PERCENTILES 10
 </s> add  </s> remove #ifndef MODELDATA_H
#define MODELDATA_H
 </s> add #pragma once
  #define POLYFIT_DEGREE 4
  #define SPEED_PERCENTILES 10
  #define DESIRE_PRED_SIZE 32
  #define OTHER_META_SIZE 4

































keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace
 ui: refactor model related functions (#2026)

* remove read_model

* remove structs for c-capnp

* remove duplicate #define from modeld

* add function fill_path_points

* fix Indentation

* use MODEL_PATH_DISTANCE instead of 192

* fix type

use validLen

* rename left_path_points&right_path_points to xxx_lane_points 
selfdrive/common/modeldata.h