ЇЄ ЄєЇCODING own hands ЇєЄ ЄєЇ
(C) MoNz7eR ^ Sa9e
So, ADPCM: lossy compression, but if you compress 16bit
original (whole chip is that higher quality than the original,
refer to mean word length, the better the resulting archive
file) and 4bit to use the archive, then it sounds even on a PC
strongly (slightly worse than MP3), and if the select 2bit
juzat, then sinter from the MCC using the same solid sound (I
mean the output signal 8-7bit!)
Theme, such as a basis take a simple delta packer,
word length of 1bit. (Fig. 1)
^ -. o
|; O \ o
|; O \ o
|, 'O:: o
o-o-o -------- (------ o ---------->
| \ O _, o
| ~. o_-~ o
| ~-____-' O
|
[Figure 1]
He tends to catch up with the changing signal using the same
displacements X. Type
if INsignal> PACsignal, then bit = 1, and
if INsignal
| \ O_,
| ~. O o-~
| ~-____-'
| O °
+ - - - - - - - - --O-- - - - etc.
[Figure 2]
I've got the original plates of the increments, torn from
PC'shnogo Encoder'a, so that files spakovannye with this board,
play anywhere (if you have the correct header file). One
problem in Speke, to pick up the signal amplitude, so that
quick unpacking (a source, is approximately 20 kHz at MCC
with unpacking of 2bit!!!) after additions not jumped beyond
(Not crossed zero and changed sign), and the method - just
rulny!
As a result, for packing each sample (more precisely, the
difference between samples from the original and the comparator
- from the packed signal) was analyzed as follows: at the
beginning of the stored first value Original [pac (0) = in
(0)]. Then:
let bit1 = 0: let bit0 = 0: let d (n) = in (n) - pac (n)
if d (n) <0 then bit1 = 1: let d (n) = ABS d (n)
if d (n)> tabl (i) then bit0 = 1: let i = i + 2 else i = i - 1
(For mnogobitnogo compression instead of -1 and 2 using a table
heap values)
if i <0 then i = 0
pac (n +1) = pac (n) + (-1) * bit1 + bit0 * tabl (i) + tabl (i)
/ 2
and all ... the whole principle, of course, without a tabl
(i) it does not work By the way for the experiment can Generate
its own, it begins with the number 7, then Xn +1 = Xn * 1,1
("models" like). Why do directly with such large numbers?
Because compress should be at least 16it signal, or
peresemplirovanny 8bit'ny signal from the filtered frequency
cutoff (1 / 2 frequency sampling).
And we have to unpack:
OUT (0) Save. first sampling signal
OUT (n +1) = OUT (n) + (-1) * bit1 + bit0 * tabl (i) + tabl (i)
/ 2 if bit0 = 1 then i = i + 2 else i = i - 1 (i> = 0!)
Like, absolutely everything ...
By the way, ADPCM stands for Adaptive Differencial
Pulse Code Modulation!