|
|
|
@ -5,11 +5,11 @@ |
|
|
|
|
|
|
|
|
|
#include "common/clutil.h" |
|
|
|
|
|
|
|
|
|
DrivingModelFrame::DrivingModelFrame(cl_device_id device_id, cl_context context) : ModelFrame(device_id, context) { |
|
|
|
|
DrivingModelFrame::DrivingModelFrame(cl_device_id device_id, cl_context context, int temporal_skip) : ModelFrame(device_id, context) { |
|
|
|
|
input_frames = std::make_unique<uint8_t[]>(buf_size); |
|
|
|
|
input_frames_cl = CL_CHECK_ERR(clCreateBuffer(context, CL_MEM_READ_WRITE, buf_size, NULL, &err)); |
|
|
|
|
img_buffer_20hz_cl = CL_CHECK_ERR(clCreateBuffer(context, CL_MEM_READ_WRITE, 5*frame_size_bytes, NULL, &err)); |
|
|
|
|
region.origin = 4 * frame_size_bytes; |
|
|
|
|
img_buffer_20hz_cl = CL_CHECK_ERR(clCreateBuffer(context, CL_MEM_READ_WRITE, (temporal_skip+1)*frame_size_bytes, NULL, &err)); |
|
|
|
|
region.origin = temporal_skip * frame_size_bytes; |
|
|
|
|
region.size = frame_size_bytes; |
|
|
|
|
last_img_cl = CL_CHECK_ERR(clCreateSubBuffer(img_buffer_20hz_cl, CL_MEM_READ_WRITE, CL_BUFFER_CREATE_TYPE_REGION, ®ion, &err)); |
|
|
|
|
|
|
|
|
@ -20,7 +20,7 @@ DrivingModelFrame::DrivingModelFrame(cl_device_id device_id, cl_context context) |
|
|
|
|
cl_mem* DrivingModelFrame::prepare(cl_mem yuv_cl, int frame_width, int frame_height, int frame_stride, int frame_uv_offset, const mat3& projection) { |
|
|
|
|
run_transform(yuv_cl, MODEL_WIDTH, MODEL_HEIGHT, frame_width, frame_height, frame_stride, frame_uv_offset, projection); |
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 4; i++) { |
|
|
|
|
for (int i = 0; i < temporal_skip; i++) { |
|
|
|
|
CL_CHECK(clEnqueueCopyBuffer(q, img_buffer_20hz_cl, img_buffer_20hz_cl, (i+1)*frame_size_bytes, i*frame_size_bytes, frame_size_bytes, 0, nullptr, nullptr)); |
|
|
|
|
} |
|
|
|
|
loadyuv_queue(&loadyuv, q, y_cl, u_cl, v_cl, last_img_cl); |
|
|
|
|