Where does the preview delay mainly come from?
zipswich opened this issue · 3 comments
zipswich commented
The delay for resolution 4656x3496 is about 1000ms.
I took a look at do_preview void UVCPreview::do_preview(uvc_stream_ctrl_t *ctrl) in UVCPreview.cpp.
for ( ; LIKELY(isRunning()) ; ) {
frame_mjpeg = waitPreviewFrame();
if (LIKELY(frame_mjpeg)) {
//The following takes no time
frame = get_frame(frame_mjpeg->width * frame_mjpeg->height * 2);
//The following takes 150ms
result = uvc_mjpeg2yuyv(frame_mjpeg, frame); // MJPEG => yuyv
//The following takes no time
recycle_frame(frame_mjpeg);
if (LIKELY(!result)) {
//The following takes 200 ms for uvc_mjpeg2yuyv(frame_mjpeg, frame)
frame = draw_preview_one(frame, &mPreviewWindow, uvc_any2rgbx, 4);
//The entire process takes 350ms for uvc_mjpeg2yuyv(frame_mjpeg, frame)
addCaptureFrame(frame);
} else {
recycle_frame(frame);
}
}
}
Each iteration in the loop takes about 350ms, so the major part of the 1000ms delay is from somewhere else. Could anyone offer a tip on this?
liu408309046 commented
Is there any solution? I have encountered a similar problem. When the resolution is set to a large one, the preview delay is very high
shengjunhu commented
Is there any solution? I have encountered a similar problem. When the resolution is set to a large one, the preview delay is very high
What is the maximum resolution you use ? Decoding is time-consuming during rendering.