This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Several issues with DMAI encoding application

Other Parts Discussed in Thread: OMAP3530

Hello,

I am developing an DMAI application that captures video through OMAP3530 ISP and encodes it via H.264 codec. Some issues and questions arose, that I'd like to discuss.

Buffer setup:
The DMAI capture module isn't quite compatible with our non-TI eval boards. So I capture video by using the V4L2 API directly in V4L2_MEMORY_USERPTR mode. Because the Venc1_process() functions requires a Buffer_Handle as input buffer, I create an array of some Buffer_Handles and get their user pointers for enqueuing via VIDIOC_QBUF ioctl. When dequeuing, I extract the index from v4l2_buffer struct in order to identify the Buffer_Handle in the array and pass it as input buffer to Venc1_process(). The current results indicate, that this method works in general.
If you have any objections or advice regarding this solution, don't hold it back please. :-)

Address translation errors:
When I ran this application with CE_DEBUG=2, I noticed some address translation errors. Example is in the attached text file.
1680.CE_DEBUG.txt

These errors always occur 3 times after Venc1_process() exits. As mentioned in this post, I disabled the reconChromaFormat, but the errors still persist. Where do these errors originate from and how could I eliminate them (if I should)? To my knowledge they appear not to have any bad effect on the application.

Playback speed of H264 stream:
Another more pressing issue is the playback speed of the produced H264 stream. When I mux the *.h264 with mkvmerge and play it, the video runs at approx. 150-200% of its normal speed. I noticed, that the targetFrameRate and refFrameRate in the encoder parameters were not set and thus defaulted to 30000. I changed these to 25000. My setup captures from a DVD player, that delivers 50 fields per second. I configured V4L2 to capture both fields interlaced in one buffer, so I am dequeuing 25 frames per second.
Changing the framerate parameters did not affect the playback speed of the created H264 file.
Why is the H264 bitstream running too fast and how can I fix it? Some time ago, I tested the encoding by using a YUV file as source. The output had a normal playback speed.

Changing the framerate had two strange side effects.

a)
The time needed for encoding one frame increased a little. I use the DMAI Time module for measuring the elapsed time. Normally, the encoding time stayed within the 29 - 31 ms range. With the framerate params changed, we now have 32 - 36 ms. I definitely have to keep the encoding time below 33 ms because the target product will deliver a 30 fps video for realtime encoding.

I can not see, how the framerate setting would affect performance of the encoder. Do you?
When I change the framerate back to 30000, the encoder keeps encoding at ~35 ms per frame. I am using codecs-omap3530 version 4.00.00.00 and codec-engine version 2.26.02.11.

When I tested the encoding process with the before mentioned YUV file as source, I was using codec-engine version 2.26.01.09. Can the performance change between versions?


b)
When I change the framerate parameters to 25000, I can dequeue 6 buffers via V4L2. After that, VIDIOC_DQBUF failes with EINVAL. My guess would be, the driver runs out of buffers in the incoming buffer queue. When I change the framerate back to 30000, the program works again.
I find it very strange, that changing encoder parameters has some apparent sideffect on a V4L2 based video driver. What do you think about this?


Some advice or help for these issues will be highly appreciated.

Kind regards,
Andreas