Micronas SC4: Difference between revisions

From MultimediaWiki
Jump to navigation Jump to search
No edit summary
 
(Fill some technical details)
Line 4: Line 4:
This is a simple speech codec supporting 32000, 16000, 11025 and 8000 Hz sampling rates.
This is a simple speech codec supporting 32000, 16000, 11025 and 8000 Hz sampling rates.


It uses adaptive 6-point filtering and 1-5 or 30-byte blocks (interleaved in case of stereo).
It uses adaptive 6-point filtering and 30-byte blocks expanding into 58 samples (interleaved in case of stereo).
 
Codec data starts with a 5-byte header followed by 30-byte data frame and after every 100 frames there's a special 4-byte marker inserted depending on sample rate:
* 8000/11025 Hz -> <code>00 00 01 1B</code>
* 16000/32000 Hz -> <code>00 00 02 2B</code>
 
Each frame consists of 58 nibbles (starting from high nibble) and <code>0x55</code> sync marker at the end.
 
Nibble is expanded into sample in the following way:
 
  diff_sign = nibble >> 3;
  diff = STEP_TABLE[nibble];
  step = diff + (last_step >> 2);
  adiff = ((diff >> 11) == 0) ? ((newstep & 0x7F) + 0x80) << 7 >> (14 - (diff >> 7)) : 0;
  delta = diff_sign ? -adiff : adiff;
  new_sample = pred + delta;
  update weights as weight[i] * 255/256 - sign3(delta) * stored_sign[i] / 128
  shift weights back, assign delta as new weight[0]
  update stored signs
  calculate new prediction from the new_sample and dot product of weights and stored signs
  clip and output sample
 
Step table:
  0x800, 0x004, 0x087, 0x0D5, 0x111, 0x143, 0x175, 0x1A9,
  0x1A9, 0x175, 0x143, 0x111, 0x0D5, 0x087, 0x004, 0x800
 


[[Category:Audio Codecs]]
[[Category:Audio Codecs]]
[[Category:Undiscovered Audio Codecs]]
[[Category:Undiscovered Audio Codecs]]

Revision as of 09:40, 8 September 2022

This is a simple speech codec supporting 32000, 16000, 11025 and 8000 Hz sampling rates.

It uses adaptive 6-point filtering and 30-byte blocks expanding into 58 samples (interleaved in case of stereo).

Codec data starts with a 5-byte header followed by 30-byte data frame and after every 100 frames there's a special 4-byte marker inserted depending on sample rate:

  • 8000/11025 Hz -> 00 00 01 1B
  • 16000/32000 Hz -> 00 00 02 2B

Each frame consists of 58 nibbles (starting from high nibble) and 0x55 sync marker at the end.

Nibble is expanded into sample in the following way:

 diff_sign = nibble >> 3;
 diff = STEP_TABLE[nibble];
 step = diff + (last_step >> 2);
 adiff = ((diff >> 11) == 0) ? ((newstep & 0x7F) + 0x80) << 7 >> (14 - (diff >> 7)) : 0;
 delta = diff_sign ? -adiff : adiff;
 new_sample = pred + delta;
 update weights as weight[i] * 255/256 - sign3(delta) * stored_sign[i] / 128
 shift weights back, assign delta as new weight[0]
 update stored signs
 calculate new prediction from the new_sample and dot product of weights and stored signs
 clip and output sample

Step table:

 0x800, 0x004, 0x087, 0x0D5, 0x111, 0x143, 0x175, 0x1A9,
 0x1A9, 0x175, 0x143, 0x111, 0x0D5, 0x087, 0x004, 0x800