Calculating 1394 isochronous bandwidth usage

18 views
Skip to first unread message

BruteForce

unread,
Oct 8, 2007, 8:06:43 AM10/8/07
to FireAPI
1394 bandwidth usage is a function of TWO parameters:
(1) Packet size
(2) Transmission Speed

A 1024 bytes packet transmitted at S400 uses double the bandwidth of a
1024 bytes packet transmitted at S800.

It is important to understand that apart from speed, packet size is
the other determining factor, not the image size and fps combination.
It is incorrect to calculate the size of the image in bytes, then
multiply by fps and determine the bandwidth usage. The reason why it
is incorrect (giving smaller results than what is actually needed) is
that the cameras do no transmit packets in a uniform fashion. Rather
they transmit some bigger packets and then they do not transmit
anything at all for several isochronous cycles. So your ImageSize*fps
might yield 20Mbps, but the camera e.g. transmits 40Mbps half of the
time and zero Mbps the other half of the time.

Let's see a real life example:

> My application requires using two 1394 monochrome cameras,
> each 1032 x 776 x 8bits x 30 FPS.

Let us analyze this case, which is a Format 7 image.
There are 8125 isochronous cycles every second.
We want 30 fps which means that we have one frame every 8125/30 = 270
isochronous cycles.

This means that the camera can break up a single frame into a maximum
of 270 packets (this is theoretical because various cameras may not be
able to have the next F7 frame prepared to transmit on the next iso
cycle).
This means (1036*776=803936 bytes)/270 = 2977.5 bytes per packet,
which should be rounded up to the next F7 step of the camera (usually
4 bytes). So assuming that the F7 step is 4 bytes, we get 2980 bytes.

The S800 maximum iso packet size is 8192, which would result in
(1036*776=803936 bytes)/8192 = 98.13 packets, which is 99 packets (the
last packet has the same size, but contains little data and then
garbage).

So our options range from 99*8192 to 270*2980, at S800.

>From that point on, there are 2 ways to calculate the bandwidth usage,
and it is suggested you use both in order to cross-check your
calculations.

========
Method A
========
The 1394 standard defines the available bandwidth as 4915 bandwidth
units.
Each bandwidth unit represents the time to send one quadlet of data at
the S1600 data rate, roughly 20 nanoseconds.
This means that one quadlet of data (4 bytes) requires 2 bandwidth
units.
This means that 4915 units permit the transmission of 4915*4/2=9830
payload bytes per iso cycle.
The 4915 number has been calculated talking into account the overheads
(iso headers/CRC, iso gaps) so that a max of 100 microseconds of the
isochronous cycle would be used on the bus for iso traffic (the
remaining 25 microseconds are for asynchronous traffic).

A packet of 2980 bytes requires (2980/4)*2 = 1490 units, or 1490/4915
= 30.3% of the iso bandwidth.
A packet of 8192 bytes requires (8192/4)*2 = 4096 units, or 4096/4915
= 83.3% of the iso bandwidth.

For two cameras, you have to allocate 4915/2=2457 units for each one,
which means a maximum F7 packet size of 4914 bytes.

========
Method B
========
1 sec ==> 800Mbit = 100MByte.
Dividing by 8125 cycles gives 100MB/8125 = 12905 bytes per iso cycle.
Out of this only 100/125 is for iso ==> (100/125)*12905 = 10324 bytes
for iso traffic per iso cycle (without taking packet headers/CRC and
iso gaps into consideration).

So at 2980 bytes you are using 2980/10324 = 28.86% of the bandwidth.
At 8192 bytes you are using 8192/10324 = 79.34% of the bandwidth.

Since you need 2 cameras, you should choose a packet size that is less
than 10324/2 = 5162 bytes.

As you can see the "natural" way of calculating bandwidth gives
slightly greater numbers than the method provided by the 1394
standard, because it does not take into consideration the protocol
overheads.

Dimitris Staikos
Unibrain

Reply all
Reply to author
Forward
0 new messages