FAQs

FAQ/013 KAM-500: Could you give us more information on the Audio format used by the KAD/VID/103?

August 18, 2014

The KAD/VID/103 uses the IMA ADPCM codec in a private transport stream of the MPEG-2 transport stream generated by the KAD/VID/103. Transport stream constants used in the VID/103

  • AUDIO PID is 1001
  • VIDEO PID is 1000
  • Length of the audio PES packets is 0x20E
  • Length of the audio PES header is 0x10

PES constants

  • MINPESHDRLGT is (9)
  • PESPTSOFFSET is (9)
  • PESHDRPTSLGT is (14)

IMA ADPCM algorithm

The first thing to note about this process is that Microsoft's implementation uses two distinct packet formats, one for mono and one for stereo. You need to know which type of packet you're attempting to decode before you start the decoding process. Normally this would be easy enough when processing something like a .wav file - you'd just read the header for the relevant information. For a Mono packet we get the following details

The Stereo packet is very similar, except has two channels instead of one and interleaves the encoded data.

Defines for the IMA ADPCM algorithm

  • #define AUDIOPACKETSIZE (1025)
  • #define AUDIOPACKETADJMAX ((AUDIOPACKETSIZE)/16)
  • #define AUDIOPACKETMS (64) // no. of milliseconds between audio packets
  • #define AUDIOPACKETTIME (5760) // no. of PTS ticks between normal audio pkts
  • #define SKIPPACKETS (5)
  • #define LARGEOUTOFSYNCH (SKIPPACKETS*AUDIOPACKETTIME)
  • #define MILLISECONDSYNCH (AUDIOPACKETTIME / AUDIOPACKETMS)

static ADPCMCOEFSET MSADPCM_CoeffSet[numCoef] = { {256, 0},{512, -256}, {0, 0}, {192, 64}, {240, 0}, {460, -208}, {392, -232} };
// pertinent tables for IMA ADPCM
static int adpcm_step[89] =
{
7, 8, 9, 10, 11, 12, 13, 14, 16, 17,
19, 21, 23, 25, 28, 31, 34, 37, 41, 45,
50, 55, 60, 66, 73, 80, 88, 97, 107, 118,
130, 143, 157, 173, 190, 209, 230, 253, 279, 307,
21 Feb. 2011 | FAQ/071
337, 371, 408, 449, 494, 544, 598, 658, 724, 796,
876, 963, 1060, 1166, 1282, 1411, 1552, 1707, 1878, 2066,
2272, 2499, 2749, 3024, 3327, 3660, 4026, 4428, 4871, 5358,
5894, 6484, 7132, 7845, 8630, 9493, 10442, 11487, 12635, 13899,
15289, 16818, 18500, 20350, 22385, 24623, 27086, 29794, 32767
};
static int adpcm_index[16] =
{
-1, -1, -1, -1, 2, 4, 6, 8,
-1, -1, -1, -1, 2, 4, 6, 8
};

Share This Article

  • Share on Linkedin
  • Share on Twitter
  • Share on Facebook
  • Share on Google+
Connect With Curtiss-Wright Connect With Curtiss-Wright Connect With Curtiss-Wright
Sales

CONTACT SALES

Contact our sales team today to learn more about our products and services.

YOUR LOCATION

PRODUCT INFORMATION

Support

GET SUPPORT

Our support team can help answer your questions - contact us today.

REQUEST TYPE

SELECT BY

SELECT Topic