mirror of https://github.com/commaai/openpilot.git
fix(modeld): Fix for unpredictable behavior in commonmodel_pyx.pyx (#32482)
Avoid undefined behavior
Co-authored-by: 19igari <koki.igari@turing-motors.com>
old-commit-hash: 25cc8a96ef
This commit is contained in:
parent
6400f9644a
commit
5218ec9e60
|
@ -37,7 +37,11 @@ cdef class ModelFrame:
|
|||
def prepare(self, VisionBuf buf, float[:] projection, CLMem output):
|
||||
cdef mat3 cprojection
|
||||
memcpy(cprojection.v, &projection[0], 9*sizeof(float))
|
||||
cdef float * data = self.frame.prepare(buf.buf.buf_cl, buf.width, buf.height, buf.stride, buf.uv_offset, cprojection, output.mem)
|
||||
cdef float * data
|
||||
if output is None:
|
||||
data = self.frame.prepare(buf.buf.buf_cl, buf.width, buf.height, buf.stride, buf.uv_offset, cprojection, NULL)
|
||||
else:
|
||||
data = self.frame.prepare(buf.buf.buf_cl, buf.width, buf.height, buf.stride, buf.uv_offset, cprojection, output.mem)
|
||||
if not data:
|
||||
return None
|
||||
return np.asarray(<cnp.float32_t[:self.frame.buf_size]> data)
|
||||
|
|
Loading…
Reference in New Issue