# Understanding ToF data post processing

Source: https://forum.modalai.com/topic/1910/understanding-tof-data-post-processing
Category: General Questions (https://forum.modalai.com/category/2/general-questions)
Posted: 2023-03-06 13:35:14 UTC by Rowan Dempster
Replies: 5 · Views: 793

## Rowan Dempster · 2023-03-06 13:35:14 UTC

Hi, I've been working with the ToF sensor under [version 0.8.1 of the camera server](https://gitlab.com/voxl-public/voxl-sdk/services/apq8096-camera-server/-/tree/v0.8.1). I understand that there is some post-processing being done on the ToF data, what I am mainly interested in is the logic that throws away some of the data (the zeroed points in the point cloud). 

Looking at the code, is [RoyaleDataDone](https://gitlab.com/voxl-public/voxl-sdk/services/apq8096-camera-server/-/blob/v0.8.1/include/api_interface/hal3/hal3_camera.h#L395) the first function that get's called in ModalAI's codebase, and does all of the post processing happen inside closed source PMD libraries? Or is the mentioned "TOF bridge" that does the post-processing also ModalAI's code that I can look at to understand the post-processing procedure?

## Reply by Rowan Dempster · 2023-03-06 21:15:23 UTC

After some digging it looks like control passes out of open source at [TOFProcessRAW16](https://gitlab.com/voxl-public/voxl-sdk/services/apq8096-camera-server/-/blob/v0.8.1/src/api_interface/hal3/hal3_camera_mgr_tof.cpp#L490) and passes back into open source at [RoyaleDataDone](https://gitlab.com/voxl-public/voxl-sdk/services/apq8096-camera-server/-/blob/v0.8.1/src/api_interface/hal3/hal3_camera_mgr_tof.cpp#L521). In between these calls I assume that "PMD closed source post processing" is being performed which uses anywhere between 5% and 25% of CPU on the VOXL depending on the ToF FPS.

## Reply by Chad Sweet (ModalAI staff) · 2023-03-06 21:22:28 UTC

yes, that sounds correct

## Reply by Rowan Dempster · 2023-03-07 13:43:07 UTC (in reply to Chad Sweet)

@Chad-Sweet Any idea if 25% CPU is the minimum achievable for 30FPS? I want to run the ToF at the highest FPU possible, but using 1/4 of the CPU to process a sensor is prohibitory.

## Reply by Rowan Dempster · 2023-03-07 16:03:30 UTC (in reply to Chad Sweet)

@Chad-Sweet Is `royale-331-spectre-4-7 - 0.0.3` the latest version of the PMD SDK? If not, is it possible to update to the latest version to get any efficiency improvements released by PMD?

## Reply by Chad Sweet (ModalAI staff) · 2023-03-07 16:33:08 UTC

No, it is not the latest.

It's a few months of work on our end to update the SDK. We may try it later this year, but no formal plans to do so
