FireWire Trademark
DV Transmission over IEEE-1394 - Tips and Tricks
Google
Linux1394 Web  

 

Introduction

 

The transmission of DV data over IEEE-1394 involves the packaging and presentation of data within Common Isochronous Packets (CIPs). CIPs are used to package raw DV data, and describe the contents and presentation time of the data. A CIP consists of a CIP header and data packet. An empty CIP is a CIP header with no attached data packet, and is used for rate control of the DV data.

Setting the IEEE-1394 isochronous header tag field to 1 indicates that CIP-based data is contained in the isochronous payload.

A CIP header for DV data is as follows:

 

31

30

29

28

27

26

25

24

23

22

21

20

19

18

17

16

15

14

13

12

11

10

9

8

7

6

5

4

3

2

1 0

 

0

0

SID

DBS

FN

QPC

0

rsv

DBC

1

0

FMT

FDF

SYT

 

SID = Source Node ID

DBS = Data Block Size (0x78 for DV NTSC)

FN, QPC, SPH, rsv = 0

DBC = Data Block Counter, 8-bit counter that is incremented for each packet that has a valid data payload (empty CIPs do not increment this counter)

FMT = Format (DV = 0)

FDF = Format Dependent Field (set to 0)

SYT = Represents the "presentation time" of the data to the camcorder, and should be set to two to three cycles ahead of the current IEEE-1394 isochronous cycle time. This "presentation" time is only set in the first CIP header of a complete DV frame. For all other CIP headers, the SYT is set to 0xffff. Format is identical to the lower 16 bits of the IEEE-1394 isochronous cycle time (upper 4 bits are mod 16, lower 12 bits are mod 3072). These upper 4 bits represent cycle count (8KHz), and the lower 12 bits represent cycle offset (24.576MHz mod 3072).

 

The two important points for ensuring proper DV transmission are:

- Make sure the DV transmission data rate is accurate (through use of EmptyCIPs)

- Set the SYT field in the CIP header (first in a DV frame) to the proper "presentation time" for the DV data.

 

Getting the DV Data Rate Right

 

CIP headers without CIP data payloads (Empty CIPs) must be attached periodically in order to adjust for the difference in data rate between CIP data payload size times 8000 (cycles per second for IEEE-1394) and the true data rate of the DV device. These empty CIPs bring the transmission data rate down to the rate expected by the DV device.

 

Empty CIP insertion must be calculated in advance of transmission (when creating the isochronous transmission DMA program). If this Empty CIP insertion rate is not finely adjusted to match data rates expected by the DV device, jitter will occur.

 

After initial values for the CIP headers are calculated and inserted, Empty CIPs must be created and the insertion rate described (by the isochronous transmission DMA program). Empty CIPs contain exactly the same data as the next CIP header to be transmitted. Therefore, it is only necessary to describe an algoritm do decide when to insert these Empty CIPs into the data stream.

 

Following are some calculations and algorithm for deciding when to insert Empty CIPs into an NTSC DV data stream (PAL actually results in much nicer even numbers):

 

DV payload size = 480 bytes

DV payload size + CIP header = 488 bytes

DV frame size = 480 x 250 = 120000 bytes

 

Frame rate (NTSC) = 29.97 frames/sec

Raw data rate required for DV = 29.97 x 120000 = 3596400 bytes/second

IEEE-1394 isoc cycles = 8000/sec

Average DV payload size for proper data rate should be 3596400 / 8000 = 449.55

 

This is less than the 480 byte payloads actually being sent per cycle on the IEEE-1394 bus. (480 x 8000 = 3840000, which is too high a data rate). In order to "bring-down" the data rate to match exactly what the camcorder expects, we must insert Empty CIPs.

 

Empty CIP ratio = (3840000 - 3596400) / 3840000 = 2436 / 38400 = around 1 header per 15 packets

 

Use a modified I+N/D algorithm to determine when to insert Empty CIP headers. An Empty CIP header should look exactly like the header of the next full CIP.

 

Here is some pseudo code for DV NTSC transmission of full and empty CIPs.

 

CIP_I = 488 bytes (full CIP packet)

CIP_S = 8 bytes (empty CIP header)

CIP_N = 2436

CIP_D = 38400