-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
can VCHI frame timestamp values be made opaque? (not usec) #1883
Comments
The firmware does process timestamps under a number of situations. The ones that immediately come to mind are:
|
I remember for deinterlace at least, we added a mode for this. The firmware commit for this (back in Sep 2021)
and the kernel side is here. |
I guess the negative is about the s64 vs u64 ? but, I assume this means that the firmware does not actually do anything with the timestamps (for all the roles?) and so I could just pass this along without the 1000 div in bcm2835-codec ? or is that only for the deinterlacer? |
popcornmix knows more about the deinterlacing use case as it gets used in Kodi / Libreelec. Based on a quick read through of the current configurations, I think you're safe removing the timestamp conversion. |
Deinterlace is a little more complex, as it typically doubles the framerate, so the additional frames get an interpolated timestamp (e.g. As v4l2 wanted I think with the settings the downstream v4l2 driver uses, we are just copying timestamps, so you don't need to scale them, and could in fact use opaque values (like frame counter). |
ok, good news, I'll definately give it a try; also, wont both of these frames have an identicaly timestamp then? would that be problematic? maybe if someone selects deinterlace on purpose, i guess they would expect double timestamp frames? |
It's not a problem for the v4l2 kernel driver. It's up to userspace to handle this. |
So, i found this old commit raspberrypi/linux@17fa469 where it introduces the nsec -> usec conversion due to encoding rate control (not sure decoder has a similar issue?) But, how would encoding rate control work if the timestamps were frame counters instead of actual timings? I'm basically reverting this commit, but then in the newer firmwares, i donno if this breaks encoder rate control... |
That conversion was added before the G_PARM/S_PARM ioctls were added in raspberrypi/linux@e6c4cec. The encoder rate control algorithm will work with either timestamps or a predefined framerate. Based on a quick check it looks like the framerate takes precedence over timestamps, so that should work fine as the V4L2 driver will always set a framerate (defaults to 30fps). |
that's awesome news, i had already reverted it on my version, and it seemed to work, but i didn't test any rate control yet. PS: a bit off-topic, but i have off-by-one on fluster decoder testing (vs the software decoder), is there a config setting i can use to fix this? |
Off-by-one on the individual pixels so CRCs fail? |
thx! btw: should we close this? or are you planning on reverting this on the raspberry pi kernel too? I'll have this reverted when i do my next RFC on bcm2835-codec on linux-media |
I'm not intending on updating anything here, but will adapt to whatever gets merged upstream as and when it happens. FWIW I'd suggest renaming it to bcm2835-m2m when you next upstream it to make Nicolas happier. Yes only 2 use cases are codecs, but they all follow the memory-to-memory interface. |
fair enough |
While upstreaming bcm2835-codec, Nicolas Dufresne noted that the timestamp in v4l2 is not necessarily an actual time value (in nsec). In fact, GStreamer actually uses a frame counter for this field. (see https://lore.kernel.org/linux-media/[email protected]/T/#m4521f17f9e75074ff3993df4a23c146c26f6e2a6 )
I don't know how the firmware handle the mmal(VCHI?) timestamp values, does it actually calculate something with these timestamps?
If it doesn't, it might be easy enough to get a fix in the firmware to not "interprete" these timestamp values, which would make the mmal code a lot simpler and could avoid potential issues (eg: GStreamer)
The code does state in comment that the mmal timestamps are usec, so if it does need usec timestamps and it needs this for a specific calculation, maybe we can add an extra field?
The text was updated successfully, but these errors were encountered: