AC3 (Dolby Digital) Headers

This is just a quick reference to the frame header of an AC3 stream. There is no intention to fully explain AC3, for that you should read standard A/52b, available from ATSC.org (Advanced Television Systems Committee).

An AC3 frame has the following structure:
syncframe()
{
      syncinfo();
      bsi()
;
      for(blk=0, blk<6, blk++)
      {
            audblk();
      }
      auxdata();
      errorcheck()
;
} // end of syncframe

Syncinfo

byte 0byte 1 byte 2byte 3 byte 4
76543210 76543210 76543210 76543210 76543210
Syncword - 0B77
CRC1
fscod
frmsizcod
CRC1 applies to the first 5/8 of the frame

fscod sampling rate values
valuesampling rate
0048K
0144.1K
1032K
11reserved

frmsizcod frame size code
valuenominal bit rate16-bit words per syncframe
Fs=32KFs=44.1KFs=48K
00000032Kbps966964
00000132Kbps967064
00001040Kbps1208780
00001140Kbps1208880
00010048Kbps14410496
00010148Kbps14410596
00011056Kbps168121112
00011156Kbps168122112
00100064Kbps192139128
00100164Kbps192140128
00101080Kbps240174160
00101180Kbps240175160
00110096Kbps288208192
00110196Kbps288209192
001110112Kbps336243224
001111112Kbps336244224
010000128Kbps384278256
010001128Kbps384279256
010010160Kbps480348320
010011160Kbps480349320
010100192Kbps576417384
010101192Kbps576418384
010110224Kbps672487448
010111224Kbps672488448
011000256Kbps768557512
011001256Kbps768558512
011010320Kbps960696640
011011320Kbps960697640
011100384Kbps1152835768
011101384Kbps1152836768
011110448Kbps1344975896
011111448Kbps1344976896
100000512Kbps153611141024
100001512Kbps153611151024
100010576Kbps172812531152
100011576Kbps172812541152
100100640Kbps192013931280
100101640Kbps192013941280
100110 to 111111
reserved

BSI

The BSI contains many conditionally included fields, so there is no fixed alignment.
standard (A52) variablebit lengthalternate (A52a) variable
bsid = 8 in this version5bsid = 6 in this version
bsmod3no change
acmod3:
if((acmod & 0x1) && (acmod != 0x1)) /* 3 front channels */ {cmixlev}2:
if(acmod & 0x4) /* if a surround channel exists */ {surmixlev}2:
if(acmod == 0x2) /* if in 2/0 mode */ {dsurmod}2:
lfeon1:
dialnorm5:
compre1:
if(compre) {compr}8:
lancode1:
if(langcode) {langcod}8:
audioprodie1:
if(audioprodie) {mixlevel}5:
if(audioprodie) {roomtyp}2:
if(acmod == 0) /* 1+1 mode, so some items need a second value */ :
{ :
    dialnorm25:
    compr2e1:
    if(compr2e) {compr2}8:
    lancod2e1:
    if(langcod2e) {langcod2}8:
    audioprodi2e1:
    if(audioprodi2e) {mixlevel2}5:
    if(audioprodi2e) {roomtyp2}2:
} :
copyrightb1:
origbs1no change
timecod1e1xbsi1e
if(timecod1e) {timecod1}14if(xbsi1e) {
dmixmod (2 bits)
ltrtcmixlev (3 bits)
ltrtsurmixlev (3 bits)
lorocmixlev (3 bits)
lorosurmixlev (3 bits)
}
timecod2e1xbsi2e
if(timecod2e) {timecod2}14if(xbsi2e) {
dsurexmod (2 bits)
dheadphonmod (2 bits)
adconvtyp (1 bit)
xbsi2 (8 bits - reserved for future expansion)
encinfo (1 bit - reserved for encoder use)
}
addbsie1no change
if(addbsie) {addbsil}6:
if(addbsie) {addbsi}8*addbsilno change

bsmod bitstream mode
bsmodacmodType of Service
000anymain audio service: complete main (CM)
001anymain audio service: music and effects (ME)
010anyassociated service: visually impaired (VI)
011anyassociated service: hearing impaired (HI)
100anyassociated service: dialog (D)
101anyassociated service: commentary (C)
110anyassociated service: emergency (E)
111001associated service: voice over (VO)
111010 to 111main audio service: karaoke

acmod audio coding mode
acmodaudio coding modenfchansChannel Array Order
0001+12Ch1, Ch2
0011/01C
0102/02L, R
0113/03L, C, R
1002/13L, R, S
1013/14L, C, R, S
1102/24L, R, SL, SR
1113/25L, C, R, SL, SR

cmixlev - center mix level (acmod 3, 5, 7)
valuecenter mix level
000.707 (-3.0 dB)
010.595 (-4.5 dB)
100.500 (-6.0 dB)
11reserved

surmixlev - surround mix level (acmod 4, 5, 6, 7)
valuesurround mix level
000.707 (-3.0 dB)
010.500 (-6.0 dB)
100
11reserved

dsurmod - dolby surround mode (acmod 2)
valueindication
00not indicated
01Not Dolby Surround encoded
10Dolby Surround encoded
11reserved

lfeon - Low frequency effects (LFE) on, 0=off, 1=on
dialnorm - Dialog normalization, average level, in -dB, of dialog channel with respect to digital 100%. The value of 0 is reserved, and decoders should use -31 dB
compre and compr - see section 7.7.2 of A52A
langcode and langcod - reserved
audproie - audio production information exists
mixlevel - mixing level, the absolute acoustic sound pressure level of an individual channel during the final mixing session. The peak mixing level is 80 + the 5-bit value dB SPL.

roomtyp - The type and calibration of the mixing room used for the final mixing session.
roomtypType of Mixing Room
00not indicated
01large room, X curve monitor
10small room, flat monitor
11reserved

dialnorm2, compr2e, compr2, langcod2e, langcod2, audprodi2e, mixlevel2, roomtyp2 - same as above, but for Ch2 of 1+1 mode.
copyrightb - copyright bit, 0=not protected by copyright, 1=protected by copyright.
origbs - original bit stream, 1=original, 0=copy

timecod1e, timecod1 - most significant 14 bits of time code, as follows:
131211109876543210
hours (0-23)
minutes (0-59)
seconds/8 (0-7)

timecod2e, timecod2 - least significant 14 bits of time code, as follows:
131211109876543210
seconds mod 8 (0-7)
frames (0-29)
1/64 frames (0-63)

addbsie - flag for presence of additional bit stream information.
addbsil - length in bytes of additional bit stream information.
addbsi - additional bit stream information, up to 64 bytes.

Fields of alternate (A52a) BSI


dmixmod - preferred stereo downmix mode
dmixmodIndication
00not indicated
01Lt/Rt downmix preferred
10Lo/Ro downmix preferred
11reserved

ltrtcmixlev - Lt/Rt Center Mix Level
ltrtsurmixlev - Lt/Rt Surround Mix Level
lorocmixlev - Lo/Ro Center Mix Level
lorosurmixlev - Lo/Ro Surround Mix Level
valuelevel
0001.414 (+3.0 dB)
0011.189 (+1.5 dB)
0101.000 (0.0 dB)
0110.841 (-1.5 dB)
1000.707 (-3.0 dB)
1010.595 (-4.5 dB)
1100.500 (-6.0 dB)
1110.000 (-inf dB)

dsurexmod - Dolby Surround EX Mode
dsurexmodIndication
00not indicated
01Not Dolby Surround EX encoded
10Dolby Surround EX encoded
11reserved

dheadphonmod - Dolby Headphone Mode
dheadphonmodIndication
00not indicated
01Not Dolby Headphone encoded
10Dolby Headphone encoded
11reserved

adconvtyp - A/D Converter zType
adconvtypIndication
0Standard
1HDCD
DVD-Video info home Copyright © 2001 - 2014 MPUCoder, all rights reserved.