|  |  |  | @ -281,18 +281,21 @@ void SpectraCamera::camera_open(VisionIpcServer *v, cl_device_id device_id, cl_c | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |   if (!enabled) return; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |   buf.out_img_width = sensor->frame_width / sensor->out_scale; | 
			
		
	
		
			
				
					|  |  |  |  |   buf.out_img_height = (sensor->hdr_offset > 0 ? (sensor->frame_height - sensor->hdr_offset) / 2 : sensor->frame_height) / sensor->out_scale; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |   // size is driven by all the HW that handles frames,
 | 
			
		
	
		
			
				
					|  |  |  |  |   // the video encoder has certain alignment requirements in this case
 | 
			
		
	
		
			
				
					|  |  |  |  |   stride = VENUS_Y_STRIDE(COLOR_FMT_NV12, sensor->frame_width); | 
			
		
	
		
			
				
					|  |  |  |  |   y_height = VENUS_Y_SCANLINES(COLOR_FMT_NV12, sensor->frame_height); | 
			
		
	
		
			
				
					|  |  |  |  |   uv_height = VENUS_UV_SCANLINES(COLOR_FMT_NV12, sensor->frame_height); | 
			
		
	
		
			
				
					|  |  |  |  |   stride = VENUS_Y_STRIDE(COLOR_FMT_NV12, buf.out_img_width); | 
			
		
	
		
			
				
					|  |  |  |  |   y_height = VENUS_Y_SCANLINES(COLOR_FMT_NV12, buf.out_img_height); | 
			
		
	
		
			
				
					|  |  |  |  |   uv_height = VENUS_UV_SCANLINES(COLOR_FMT_NV12, buf.out_img_height); | 
			
		
	
		
			
				
					|  |  |  |  |   uv_offset = stride*y_height; | 
			
		
	
		
			
				
					|  |  |  |  |   yuv_size = uv_offset + stride*uv_height; | 
			
		
	
		
			
				
					|  |  |  |  |   if (cc.output_type != ISP_RAW_OUTPUT) { | 
			
		
	
		
			
				
					|  |  |  |  |     uv_offset = ALIGNED_SIZE(uv_offset, 0x1000); | 
			
		
	
		
			
				
					|  |  |  |  |     yuv_size = uv_offset + ALIGNED_SIZE(stride*uv_height, 0x1000); | 
			
		
	
		
			
				
					|  |  |  |  |   } | 
			
		
	
		
			
				
					|  |  |  |  |   assert(stride == VENUS_UV_STRIDE(COLOR_FMT_NV12, sensor->frame_width)); | 
			
		
	
		
			
				
					|  |  |  |  |   assert(stride == VENUS_UV_STRIDE(COLOR_FMT_NV12, buf.out_img_width)); | 
			
		
	
		
			
				
					|  |  |  |  |   assert(y_height/2 == uv_height); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |   open = true; | 
			
		
	
	
		
			
				
					|  |  |  | @ -645,14 +648,14 @@ void SpectraCamera::config_bps(int idx, int request_id) { | 
			
		
	
		
			
				
					|  |  |  |  |     io_cfg[1].mem_handle[0] = buf_handle_yuv[idx]; | 
			
		
	
		
			
				
					|  |  |  |  |     io_cfg[1].mem_handle[1] = buf_handle_yuv[idx]; | 
			
		
	
		
			
				
					|  |  |  |  |     io_cfg[1].planes[0] = (struct cam_plane_cfg){ | 
			
		
	
		
			
				
					|  |  |  |  |       .width = sensor->frame_width, | 
			
		
	
		
			
				
					|  |  |  |  |       .height = sensor->frame_height, | 
			
		
	
		
			
				
					|  |  |  |  |       .width = buf.out_img_width, | 
			
		
	
		
			
				
					|  |  |  |  |       .height = buf.out_img_height, | 
			
		
	
		
			
				
					|  |  |  |  |       .plane_stride = stride, | 
			
		
	
		
			
				
					|  |  |  |  |       .slice_height = y_height, | 
			
		
	
		
			
				
					|  |  |  |  |     }; | 
			
		
	
		
			
				
					|  |  |  |  |     io_cfg[1].planes[1] = (struct cam_plane_cfg){ | 
			
		
	
		
			
				
					|  |  |  |  |       .width = sensor->frame_width, | 
			
		
	
		
			
				
					|  |  |  |  |       .height = sensor->frame_height/2, | 
			
		
	
		
			
				
					|  |  |  |  |       .width = buf.out_img_width, | 
			
		
	
		
			
				
					|  |  |  |  |       .height = buf.out_img_height / 2, | 
			
		
	
		
			
				
					|  |  |  |  |       .plane_stride = stride, | 
			
		
	
		
			
				
					|  |  |  |  |       .slice_height = uv_height, | 
			
		
	
		
			
				
					|  |  |  |  |     }; | 
			
		
	
	
		
			
				
					|  |  |  | @ -737,7 +740,7 @@ void SpectraCamera::config_ife(int idx, int request_id, bool init) { | 
			
		
	
		
			
				
					|  |  |  |  |     bool is_raw = cc.output_type != ISP_IFE_PROCESSED; | 
			
		
	
		
			
				
					|  |  |  |  |     if (!is_raw) { | 
			
		
	
		
			
				
					|  |  |  |  |       if (init) { | 
			
		
	
		
			
				
					|  |  |  |  |         buf_desc[0].length = build_initial_config((unsigned char*)ife_cmd.ptr + buf_desc[0].offset, cc, sensor.get(), patches); | 
			
		
	
		
			
				
					|  |  |  |  |         buf_desc[0].length = build_initial_config((unsigned char*)ife_cmd.ptr + buf_desc[0].offset, cc, sensor.get(), patches, buf.out_img_width, buf.out_img_height); | 
			
		
	
		
			
				
					|  |  |  |  |       } else { | 
			
		
	
		
			
				
					|  |  |  |  |         buf_desc[0].length = build_update((unsigned char*)ife_cmd.ptr + buf_desc[0].offset, cc, sensor.get(), patches); | 
			
		
	
		
			
				
					|  |  |  |  |       } | 
			
		
	
	
		
			
				
					|  |  |  | @ -844,14 +847,14 @@ void SpectraCamera::config_ife(int idx, int request_id, bool init) { | 
			
		
	
		
			
				
					|  |  |  |  |       io_cfg[0].mem_handle[0] = buf_handle_yuv[idx]; | 
			
		
	
		
			
				
					|  |  |  |  |       io_cfg[0].mem_handle[1] = buf_handle_yuv[idx]; | 
			
		
	
		
			
				
					|  |  |  |  |       io_cfg[0].planes[0] = (struct cam_plane_cfg){ | 
			
		
	
		
			
				
					|  |  |  |  |         .width = sensor->frame_width, | 
			
		
	
		
			
				
					|  |  |  |  |         .height = sensor->frame_height, | 
			
		
	
		
			
				
					|  |  |  |  |         .width = buf.out_img_width, | 
			
		
	
		
			
				
					|  |  |  |  |         .height = buf.out_img_height, | 
			
		
	
		
			
				
					|  |  |  |  |         .plane_stride = stride, | 
			
		
	
		
			
				
					|  |  |  |  |         .slice_height = y_height, | 
			
		
	
		
			
				
					|  |  |  |  |       }; | 
			
		
	
		
			
				
					|  |  |  |  |       io_cfg[0].planes[1] = (struct cam_plane_cfg){ | 
			
		
	
		
			
				
					|  |  |  |  |         .width = sensor->frame_width, | 
			
		
	
		
			
				
					|  |  |  |  |         .height = sensor->frame_height/2, | 
			
		
	
		
			
				
					|  |  |  |  |         .width = buf.out_img_width, | 
			
		
	
		
			
				
					|  |  |  |  |         .height = buf.out_img_height / 2, | 
			
		
	
		
			
				
					|  |  |  |  |         .plane_stride = stride, | 
			
		
	
		
			
				
					|  |  |  |  |         .slice_height = uv_height, | 
			
		
	
		
			
				
					|  |  |  |  |       }; | 
			
		
	
	
		
			
				
					|  |  |  | @ -993,6 +996,9 @@ bool SpectraCamera::openSensor() { | 
			
		
	
		
			
				
					|  |  |  |  |   LOGD("-- Probing sensor %d", cc.camera_num); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |   auto init_sensor_lambda = [this](SensorInfo *s) { | 
			
		
	
		
			
				
					|  |  |  |  |     if (s->image_sensor == cereal::FrameData::ImageSensor::OS04C10 && cc.output_type == ISP_IFE_PROCESSED) { | 
			
		
	
		
			
				
					|  |  |  |  |       ((OS04C10*)s)->ife_downscale_configure(); | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  |     sensor.reset(s); | 
			
		
	
		
			
				
					|  |  |  |  |     return (sensors_init() == 0); | 
			
		
	
		
			
				
					|  |  |  |  |   }; | 
			
		
	
	
		
			
				
					|  |  |  | @ -1065,8 +1071,8 @@ void SpectraCamera::configISP() { | 
			
		
	
		
			
				
					|  |  |  |  |     .data[0] = (struct cam_isp_out_port_info){ | 
			
		
	
		
			
				
					|  |  |  |  |       .res_type = CAM_ISP_IFE_OUT_RES_FULL, | 
			
		
	
		
			
				
					|  |  |  |  |       .format = CAM_FORMAT_NV12, | 
			
		
	
		
			
				
					|  |  |  |  |       .width = sensor->frame_width, | 
			
		
	
		
			
				
					|  |  |  |  |       .height = sensor->frame_height + sensor->extra_height, | 
			
		
	
		
			
				
					|  |  |  |  |       .width = buf.out_img_width, | 
			
		
	
		
			
				
					|  |  |  |  |       .height = buf.out_img_height + sensor->extra_height, | 
			
		
	
		
			
				
					|  |  |  |  |       .comp_grp_id = 0x0, .split_point = 0x0, .secure_mode = 0x0, | 
			
		
	
		
			
				
					|  |  |  |  |     }, | 
			
		
	
		
			
				
					|  |  |  |  |   }; | 
			
		
	
	
		
			
				
					|  |  |  | @ -1141,8 +1147,8 @@ void SpectraCamera::configICP() { | 
			
		
	
		
			
				
					|  |  |  |  |     }, | 
			
		
	
		
			
				
					|  |  |  |  |     .out_res[0] = (struct cam_icp_res_info){ | 
			
		
	
		
			
				
					|  |  |  |  |       .format = 0x3,  // YUV420NV12
 | 
			
		
	
		
			
				
					|  |  |  |  |       .width = sensor->frame_width, | 
			
		
	
		
			
				
					|  |  |  |  |       .height = sensor->frame_height, | 
			
		
	
		
			
				
					|  |  |  |  |       .width = buf.out_img_width, | 
			
		
	
		
			
				
					|  |  |  |  |       .height = buf.out_img_height, | 
			
		
	
		
			
				
					|  |  |  |  |       .fps = 20, | 
			
		
	
		
			
				
					|  |  |  |  |     }, | 
			
		
	
		
			
				
					|  |  |  |  |   }; | 
			
		
	
	
		
			
				
					|  |  |  | 
 |