are the OpenCV calls blocking (think hardware compression)?

I am using the OpenCV4Tegra version of OpenCV on the Tegra K1 Jetson. I am capturing video frames over USB. I am calling cvEncodeImage() to perform JPEG compression on the captured images. The question I have regards blocking of code during execution.

If a separate processing unit is compressing the current frame, I would like to use that time to stream the previous frame(s) to a hard drive. I am using cvEncodeImage() and not cvSaveImage() because I need to continue processing the image, even though I have written it to disk.

For example, I can see the blocking nature of the following sequence of calls because the results of the first call (compression) feed into the second function call (write)

CvMat *mat1 = cvEncodeImage(".jpg", img1);
myImageWriter(mat1, “file1.foo”);

Can I do something to the effect?

CvMat mat1 = cvEncodeImage(".jpg", img1); / hopefully non-blocking */
CvMat mat2 = cvEncodeImage(".jpg", img2); / hopefully non-blocking. probably must wait for previous compression to finish /
myImageWriter(mat1, “file1.foo”); /
can this execute at same time as previous line? or does it have to wait for the previous function call to complete? /
myImageWriter(mat2, “file2.foo”); /
ok. this definitely has to wait until encode is complete for 2nd image */

Thanks. Also, if I am in the wrong section, please advise that, too.

You may want to ask in the embedded systems forum:

https://devtalk.nvidia.com/default/board/139/embedded-systems

I answered my own question here. The calls appear blocking, so do the streaming in different threads. On thread compresses; the other writes to disk.