  #define POLYFIT_DEGREE 4
  #define SPEED_PERCENTILES 10
  #define DESIRE_LEN 8
  #define TRAFFIC_CONVENTION_LEN 2
  #define DESIRE_PRED_SIZE 32
  #define OTHER_META_SIZE 4
  #define LEAD_MDN_N 5 // probs for 5 groups
  #define MDN_VALS 4 // output xyva for each lead group
  #define SELECTION 3 //output 3 group (lead now, in 2s and 6s)
  #define MDN_GROUP_SIZE 11
  #define TIME_DISTANCE 100
 
</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 </s> remove 
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> add  </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 read_path(PathData& p, const cereal::ModelData::PathData::Reader &pathp) {
  p = {};

  p.prob = pathp.getProb();
  p.std = pathp.getStd();

  auto polyp = pathp.getPoly();
  for (int i = 0; i < POLYFIT_DEGREE; i++) {
    p.poly[i] = polyp[i];
  }

  // Compute points locations
  for (int i = 0; i < MODEL_PATH_DISTANCE; i++) {
    p.points[i] = p.poly[0] * (i*i*i) + p.poly[1] * (i*i)+ p.poly[2] * i + p.poly[3];
  }

  p.validLen = pathp.getValidLen();
}

static void read_model(ModelData &d, const cereal::ModelData::Reader &model) {
  d = {};
  read_path(d.path, model.getPath());
  read_path(d.left_lane, model.getLeftLane());
  read_path(d.right_lane, model.getRightLane());
  auto leadd = model.getLead();
  d.lead = (LeadData){
      .dist = leadd.getDist(), .prob = leadd.getProb(), .std = leadd.getStd(),
  };
}

 </s> add 
  #define POLYFIT_DEGREE 4
  #define SPEED_PERCENTILES 10
  #define DESIRE_LEN 8
  #define TRAFFIC_CONVENTION_LEN 2


  #define LEAD_MDN_N 5 // probs for 5 groups
  #define MDN_VALS 4 // output xyva for each lead group
  #define SELECTION 3 //output 3 group (lead now, in 2s and 6s)
  #define MDN_GROUP_SIZE 11
  #define TIME_DISTANCE 100
keep keep keep keep replace replace keep keep keep keep keep
 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/modeld/models/driving.h