Avnu / tsn-doc

Documentation on TSN Linux components, interfaces and usage
BSD 3-Clause "New" or "Revised" License
37 stars 21 forks source link

Could you please give more details for calc-cbs-params.py #15

Closed zeerd closed 4 years ago

zeerd commented 4 years ago

Hello!

I could not understand, why

  1. H.264 profile High, 1920x1080, 30fps means rate=8000,psize=1470
  2. PCM 16-bit sample, 48 kHz, stereo, 12 frames perAVTPDU means rate=4000,psize=48

How should I get those values? Is there more formulas to calc them?

Thanks.

edersondisouza commented 4 years ago

Hi @zeerd,

For the audio part, it comes directly from the audio characteristics:

So, we have 48000 2 2 = 192000 bytes to send per second. Now, on the AVTP side, we've chosen to send this stream using a Class B stream (with measurement interval of 250us, 4000 times per second): 192000 / 4000 = 48 bytes per AVTPDU. Note that the 12 frames per AVTPDU is another side of the Stream Reservation (SR) Class we've chosen. Another SR class is A, with measurement interval of 125us, thus 8000 times per second. Had we chosen a class A stream, rate would be 8000 and psize=24. It is also possible to send more than one AVTPDU per measurement. That effectively multiplies the rate we're working with.

For video, it's a bit more complex. In our example, though, the choices were actually simple: we decided to use a Class A stream, with rate 8000. As video frames can be pretty big, we simply used the maximum size available for AVTP CVF payload: 1470. That comes from the MTU, 1500, less CVF header, 30 bytes.

Note that for CVF, not all videos with H.264 profile High, with 1920x1080@30 will work correctly with the reservation done. While a look on the H.264 standard will show that such video will have a maximum bitrate of 20 Mbits/s (and that should nicely fit on our reserved bandwidth, 8000*1470≃90Mbits/s), some videos can have spikes on data transmission (think of a really big keyframe), thus requiring one to transmit more than one AVTPDU per transmission interval, so increasing the rate.

More information about SR classes can be found at IEEE 1722 or IEEE802.1Q.

Let me know if anything still unclear =D

zeerd commented 4 years ago

Thank you! It's clear.

I got a mistake. I forgot the concept of measurement intervals, and used to thought the rate was calculated from the data of audio/video stream.

But, by the discuss of IEEE 1722 and TSpec of 802.1Q, if we using some special stream(maybe bigger) , we might still need to calculate them.

aguedes commented 4 years ago

It seems the issue has been clarified so I'm closing it.