| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -20,19 +20,9 @@ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					#ifdef QCOM2 | 
					 | 
					 | 
					 | 
					#ifdef QCOM2 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					const float y_offset = 150.0; | 
					 | 
					 | 
					 | 
					const float y_offset = 150.0; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					const float zoom = 1.1; | 
					 | 
					 | 
					 | 
					const float zoom = 1.1; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					const mat3 intrinsic_matrix = (mat3){{ | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  2648.0, 0.0, 1928.0/2, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  0.0, 2648.0, 1208.0/2, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  0.0,   0.0,   1.0 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					}}; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					#else | 
					 | 
					 | 
					 | 
					#else | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					const float y_offset = 0.0; | 
					 | 
					 | 
					 | 
					const float y_offset = 0.0; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					const float zoom = 2.35; | 
					 | 
					 | 
					 | 
					const float zoom = 2.35; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					const mat3 intrinsic_matrix = (mat3){{ | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  910., 0., 1164.0/2, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  0., 910., 874.0/2, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  0.,   0.,   1. | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					}}; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					#endif | 
					 | 
					 | 
					 | 
					#endif | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					// Projects a point in car to space to the corresponding point in full frame
 | 
					 | 
					 | 
					 | 
					// Projects a point in car to space to the corresponding point in full frame
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -41,7 +31,7 @@ bool calib_frame_to_full_frame(const UIState *s, float in_x, float in_y, float i | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  const float margin = 500.0f; | 
					 | 
					 | 
					 | 
					  const float margin = 500.0f; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  const vec3 pt = (vec3){{in_x, in_y, in_z}}; | 
					 | 
					 | 
					 | 
					  const vec3 pt = (vec3){{in_x, in_y, in_z}}; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  const vec3 Ep = matvecmul3(s->scene.view_from_calib, pt); | 
					 | 
					 | 
					 | 
					  const vec3 Ep = matvecmul3(s->scene.view_from_calib, pt); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  const vec3 KEp = matvecmul3(intrinsic_matrix, Ep); | 
					 | 
					 | 
					 | 
					  const vec3 KEp = matvecmul3(fcam_intrinsic_matrix, Ep); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  // Project.
 | 
					 | 
					 | 
					 | 
					  // Project.
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  float x = KEp.v[0] / KEp.v[2]; | 
					 | 
					 | 
					 | 
					  float x = KEp.v[0] / KEp.v[2]; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -618,8 +608,8 @@ void ui_nvg_init(UIState *s) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  } | 
					 | 
					 | 
					 | 
					  } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  s->video_rect = Rect{bdr_s, bdr_s, s->fb_w - 2 * bdr_s, s->fb_h - 2 * bdr_s}; | 
					 | 
					 | 
					 | 
					  s->video_rect = Rect{bdr_s, bdr_s, s->fb_w - 2 * bdr_s, s->fb_h - 2 * bdr_s}; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  float zx = zoom * 2 * intrinsic_matrix.v[2] / s->video_rect.w; | 
					 | 
					 | 
					 | 
					  float zx = zoom * 2 * fcam_intrinsic_matrix.v[2] / s->video_rect.w; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  float zy = zoom * 2 * intrinsic_matrix.v[5] / s->video_rect.h; | 
					 | 
					 | 
					 | 
					  float zy = zoom * 2 * fcam_intrinsic_matrix.v[5] / s->video_rect.h; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  const mat4 frame_transform = {{ | 
					 | 
					 | 
					 | 
					  const mat4 frame_transform = {{ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    zx, 0.0, 0.0, 0.0, | 
					 | 
					 | 
					 | 
					    zx, 0.0, 0.0, 0.0, | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -639,7 +629,7 @@ void ui_nvg_init(UIState *s) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  nvgScale(s->vg, zoom, zoom); | 
					 | 
					 | 
					 | 
					  nvgScale(s->vg, zoom, zoom); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  // 3) Put (0, 0) in top left corner of video
 | 
					 | 
					 | 
					 | 
					  // 3) Put (0, 0) in top left corner of video
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  nvgTranslate(s->vg, -intrinsic_matrix.v[2], -intrinsic_matrix.v[5]); | 
					 | 
					 | 
					 | 
					  nvgTranslate(s->vg, -fcam_intrinsic_matrix.v[2], -fcam_intrinsic_matrix.v[5]); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  nvgCurrentTransform(s->vg, s->car_space_transform); | 
					 | 
					 | 
					 | 
					  nvgCurrentTransform(s->vg, s->car_space_transform); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  nvgResetTransform(s->vg); | 
					 | 
					 | 
					 | 
					  nvgResetTransform(s->vg); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
  |