Part Number: TDA4VP-Q1
Hi,
I'm trying to encode some H.265 video streams with a resolution of 960x540 using the V4L2 API. However, as of TDA4 TI SDK version 9.2.00.05 and version 6.1.80 of ti-linux.kernel, I am experiencing some issues with that. Here's a more detailed description of my problem including links to the relevant driver code snippets:
Just using VIDIOC_S_FMT with a resolution of 960x540 doesn’t work and I end up with an invalid bitstream since the height dimension is not divisable by 8. Note that calling VIDIOC_S_FMT with a 960x544 resolution and manually setting a conformance window of 960x540 using VIDIOC_S_SELECTION shows no effect since the WAVE5 driver implements VIDIOC_S_SELECTION as a stub.
I've investigated a little bit and saw that the driver itself is supposed to set a conformance window if a non-conformant resolution is passed via VIDIOC_S_FMT. However, in the case of H.265 this is only done if the stream is rotated and/or mirrored (excluding the identity transformation of horizontal+vertical flip and 180° rotation). I did confirm this by enabling V4L2_CID_HFLIP which resulted in a working H.265 stream with a resolution of 960x544 where the conformance window was set to 960x540.
While I didn’t try out a newer kernel version, the supposed bug still seems to be present in what I think is the most recent ti-linux-kernel branch (ti-linux-6.18.y).
Note that the implementation of VIDIOC_S_SELECTION was updated. However, if I followed the code correctly, it doesn’t actually set a conformance window but just updates the resolution that was previously passed via VIDIOC_S_FMT (in the encoder initialization code conf_win.width/conf_win.height are -- contrary to the naming -- actually used to set up the stream dimensions).
Is there a known workaround for this issue that would allow me to encode H.265 streams with the non-conformant 960x540 resolution?
Thanks,
Martin