Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: ADC (Adaptive Differential Coding) My Experimental Lossy Audio Codec (Read 13992 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Re: ADC (Adaptive Differential Coding) My Experimental Lossy Audio Codec

Reply #50
@Nania Francesco Do you have an explanation for this awfully buggy sound?

Re: ADC (Adaptive Differential Coding) My Experimental Lossy Audio Codec

Reply #51
Klymins I don't know how to thank you. I also released version 0.31 thanks to you. The crazy thing is that I had to double-check all the functions that were mathematically perfect. The error, you won't believe, was in the fact that I allocated the memory inside a function and not in global mode. Absurd gcc makes these jokes. I took the opportunity to improve something. Unfortunately I don't think it is compatible with the previous version.


http://heartofcomp.altervista.org/ADCodec.htm

Re: ADC (Adaptive Differential Coding) My Experimental Lossy Audio Codec

Reply #52
Klymins I don't know how to thank you. I also released version 0.31 thanks to you. The crazy thing is that I had to double-check all the functions that were mathematically perfect. The error, you won't believe, was in the fact that I allocated the memory inside a function and not in global mode. Absurd gcc makes these jokes. I took the opportunity to improve something. Unfortunately I don't think it is compatible with the previous version.


http://heartofcomp.altervista.org/ADCodec.htm

Thanks.

Re: ADC (Adaptive Differential Coding) My Experimental Lossy Audio Codec

Reply #53
I provide you with the analysis tool that also uses ADC internally to test yourselves with the classic canons and wav files!

Re: ADC (Adaptive Differential Coding) My Experimental Lossy Audio Codec

Reply #54
As others do and respecting the limit of the maximum 30 seconds imposed, I publish some compression tests (option c 180)

Re: ADC (Adaptive Differential Coding) My Experimental Lossy Audio Codec

Reply #55
I managed to eliminate the defects of hiss and strange noises due to the quantization used so far. I changed the quantization and prediction engine. The quality is currently superior in quality and purity to mp3 256 kbps with 5-10% better compression. I have listened to hundreds of tests and have not encountered any particular difficulties. The compression speed is obviously 10 times that of mp3! Soon I hope to release a version that I think is almost the definitive one.

Re: ADC (Adaptive Differential Coding) My Experimental Lossy Audio Codec

Reply #56
Currently the ADC core is able to compete with the most famous codecs. The ADC has been set up to avoid the background noise and anomalies of the past. The ADC, unlike codecs based on frequency transformations and cuts, bases its compression power on a predictor powerful enough to reduce the differences with the actual values ​​and on a system that somehow predicts the differences. At this point I must clarify that ADPCM uses tables while ADC does not. I created a version of the program that replaces the ADPCM core (simple) obtaining superior results in terms of cleanliness, stability and also in terms of PSNR (DB). I listened to the differences in particular between MP3 (VBR and CBR) and ADC. The result in my opinion and from my listening is that the MP3, by removing many frequencies, apparently seems to maintain a certain cleanliness of the sound and a low bitrate but loses in terms of spatiality, stereophony and amplitude of the signal compared to the ADC. ADC uses bit range encoder compression (like fpaq so to speak) to achieve superior results. I hope to release the new version soon.

For the more skeptical and critical I put online the test program I mentioned which only uses 4 bits per channel (ADPCM style).


Re: ADC (Adaptive Differential Coding) My Experimental Lossy Audio Codec

Reply #58
I added the Windows XP sp1/2 version here

Re: ADC (Adaptive Differential Coding) My Experimental Lossy Audio Codec

Reply #59
So what this codec uses for predicting and modelling future/past audio samples?
Please remove my account from this forum.

Re: ADC (Adaptive Differential Coding) My Experimental Lossy Audio Codec

Reply #60
So what this codec uses for predicting and modelling future/past audio samples?

Good question. Also, I found that test4.adc starts with "adp J ”   RIFF”8I WAVEfmt" by Notepad of Windows, isn't that weird for such an experimental codec?

Re: ADC (Adaptive Differential Coding) My Experimental Lossy Audio Codec

Reply #61
It should start with "adc..." ?
Please remove my account from this forum.

Re: ADC (Adaptive Differential Coding) My Experimental Lossy Audio Codec

Reply #62
It should start with "adc..." ?

Yes, and what surprised me more is the RIFF header (I think) there.

 

Re: ADC (Adaptive Differential Coding) My Experimental Lossy Audio Codec

Reply #63
As for the heder structure, I haven't yet defined it well. The RIFF writing you see is due to the fact that I am currently recording the header of the Wav file to keep the structure of the wave source file in decompression.



struct WAVEHeader
{
    char  chunkID[4] = {'R','I','F','F'};       // Contains the letters "RIFF" in ASCII form
    long  chunkSize;                            // 4 + (8 + SubChunk1Size) + (8 + SubChunk2Size)
    char  format[4]  = {'W','A','V','E'};       // Contains the letters "WAVE" in ASCII form

    char  subchunk1ID[4] = {'f','m','t',' '};   // Contains the letters "fmt " in ASCII form
    long  subchunk1Size  = 16;                  // 16 for PCM
    short audioFormat;                          // PCM = 1 Values other than 1 indicate some form of compression
    short numChannels;                          // Mono = 1, Stereo = 2, etc
    long  FreqRate;                           // 8000, 44100, etc.
    long  byteRate;                             // shortRate * NumChannels * BitsPershort/8
    short blockAlign;                           // NumChannels * BitsPershort/8
    short bitsPershort;                        // 8 bits = 8, 16 bits = 16, etc

    char  subchunk2ID[4] = {'d','a','t','a'};   // Contains the letters "data" in ASCII form
    long  subchunk2Size;                        // This is the number of bytes in the data
};


struct ADCHeader
{
    char  chunkID[4] = {'A','D','C',' '};   // Contains the letters "adp " in ASCII form
    unsigned long  dataSize;                         // This is the number of bytes in the data
    unsigned long  direct_dataSize;                         // This is the number of bytes in the data
};




The structure allows me to load most .wav files


Second clarification. Unlike what I said, I had to put the predictor aside for the following reasons. It managed to get much closer to the ideal values ​​to be subtracted from the current value but it caused an anomaly. The difference data are somehow directly proportional to the wave values ​​themselves. Introducing a changing factor does not improve compression if I use multiple data writing keys.  Secondly, the predictor slowed down my compression and decompression. It follows that the predictor is nothing other than the compressed previous value. At this stage I am working on a new version which I believe will be one of the last before the definitive one. To increase the quality I will definitely have to slow down the compression but not the decompression. Once the core has been defined I will be able to think of a version that uses a VBR system. Of course, being a system that processes differences between wave values, I cannot obtain very low bitrates (<128 kbit) but I would be happy to obtain it. To do this I would have to do what mp3, AAC does, i.e. filter and remove the inaudible frequencies. This would result in very complex code.

Re: ADC (Adaptive Differential Coding) My Experimental Lossy Audio Codec

Reply #64
As for the heder structure, I haven't yet defined it well. The RIFF writing you see is due to the fact that I am currently recording the header of the Wav file to keep the structure of the wave source file in decompression.



struct WAVEHeader
{
    char  chunkID[4] = {'R','I','F','F'};       // Contains the letters "RIFF" in ASCII form
    long  chunkSize;                            // 4 + (8 + SubChunk1Size) + (8 + SubChunk2Size)
    char  format[4]  = {'W','A','V','E'};       // Contains the letters "WAVE" in ASCII form

    char  subchunk1ID[4] = {'f','m','t',' '};   // Contains the letters "fmt " in ASCII form
    long  subchunk1Size  = 16;                  // 16 for PCM
    short audioFormat;                          // PCM = 1 Values other than 1 indicate some form of compression
    short numChannels;                          // Mono = 1, Stereo = 2, etc
    long  FreqRate;                           // 8000, 44100, etc.
    long  byteRate;                             // shortRate * NumChannels * BitsPershort/8
    short blockAlign;                           // NumChannels * BitsPershort/8
    short bitsPershort;                        // 8 bits = 8, 16 bits = 16, etc

    char  subchunk2ID[4] = {'d','a','t','a'};   // Contains the letters "data" in ASCII form
    long  subchunk2Size;                        // This is the number of bytes in the data
};


struct ADCHeader
{
    char  chunkID[4] = {'A','D','C',' '};   // Contains the letters "adp " in ASCII form
    unsigned long  dataSize;                         // This is the number of bytes in the data
    unsigned long  direct_dataSize;                         // This is the number of bytes in the data
};




The structure allows me to load most .wav files


Second clarification. Unlike what I said, I had to put the predictor aside for the following reasons. It managed to get much closer to the ideal values ​​to be subtracted from the current value but it caused an anomaly. The difference data are somehow directly proportional to the wave values ​​themselves. Introducing a changing factor does not improve compression if I use multiple data writing keys.  Secondly, the predictor slowed down my compression and decompression. It follows that the predictor is nothing other than the compressed previous value. At this stage I am working on a new version which I believe will be one of the last before the definitive one. To increase the quality I will definitely have to slow down the compression but not the decompression. Once the core has been defined I will be able to think of a version that uses a VBR system. Of course, being a system that processes differences between wave values, I cannot obtain very low bitrates (<128 kbit) but I would be happy to obtain it. To do this I would have to do what mp3, AAC does, i.e. filter and remove the inaudible frequencies. This would result in very complex code.

Is the specification of this codec published? If yes, where is it? If no, will you publish it? If yes, where? If no, can you at least give a brief description of the working principles of this codec so people can have an opinion about it?

Also, how does {'A','D','C',' '} result in "adp "?

Re: ADC (Adaptive Differential Coding) My Experimental Lossy Audio Codec

Reply #65
The question seems to be partly aimed at getting me exposed on the core of coding. If you consider ADPCM as the mother of all lossy codecs in a certain sense all lossy codecs are similar in some way to ADPCM. All codecs have similarities by touching a sequence of data. ADPCM uses a table of 89 values ​​to represent the differences. The differences between the current value and the last encoded value is passed to an encoder that divides (shift >>) if the value is greater than the value represented by the channel state in the table of 89 values ​​up to three times (including the previously mentioned shift) using 3 bits (8 values), one bit is used to define whether with a "+" sign or a "-" sign. Once encoded, the status is updated based on the nibble (absolute 3-bit value mentioned above). If the nibble is greater than 4 the state increases and if the value is less it decreases by only one array position. The latest version of ADC and the one I'm working on uses various tables as I attempted with the published version (adcodec) to include the table values ​​with a function in the state itself. This test then proved unstable, creating in some specific cases background noise and various hiss due to the failure to cover the range of differences to be encoded. In ADC the coding occurs differently from ADPCM as it does not use shift in quantization . I can't tell you anything else.

Re: ADC (Adaptive Differential Coding) My Experimental Lossy Audio Codec

Reply #66
So is it going to be patented if everything is secret?

What is the latency/delay of encoder?

Is it using frequency domain in any way?
Please remove my account from this forum.

Re: ADC (Adaptive Differential Coding) My Experimental Lossy Audio Codec

Reply #67
I don't want to patent. I think I can only open the code when I have completed the core stabilization to give it enough audio quality to be considered a good overall quality codec.


If by latency you mean phase shift compared to the real signal this is in real time. At the moment I'm trying various ways for the update blocks but it seems that I will have to settle on values ​​higher than one hundredth of a second per channel
 based on the sampling rate.

It uses a difference domain encoding between values ​​over time and does not use any frequency domain.

Re: ADC (Adaptive Differential Coding) My Experimental Lossy Audio Codec

Reply #68
The new version does better with background noise, but still performs very poorly with certain signals. For example the nice test sample from https://hydrogenaud.io/index.php/topic,120193.0.html shows horrible performance near the beginning.

Re: ADC (Adaptive Differential Coding) My Experimental Lossy Audio Codec

Reply #69
I tried v0.60 right now with the default -q value and detected that it sounds terrible! The same sample (Melodi 6 from Supper Zill) encoded and decoded with the new version is attached below (with the original one of course). I absoulutely wouldn't use this codec for anything; it sounds terrible!

Re: ADC (Adaptive Differential Coding) My Experimental Lossy Audio Codec

Reply #70
I tried v0.60 right now with the default -q value and detected that it sounds terrible! The same sample (Melodi 6 from Supper Zill) encoded and decoded with the new version is attached below (with the original one of course). I absoulutely wouldn't use this codec for anything; it sounds terrible!

It's tonal and low-res content. After "upscale" 8bit to 16bit, then "compress" with q3 at ~17kps i got something worse. q16 is decent but you have a still too high noise floor.

Quality of CD-res (16b/44K) files is "better", but is still bad at q3, using high rates for normal standards (>160kbps, the transparency threshold for most codecs). Higher Q values are acceptable, but have problems with loud things, and you still have a noise floor, that couldn't be a problem at first appearence, but when going lower and using extreme samples... (I'm testing now with simple transparent AAC >256 kbps, I have very few lossless things, but I already noticed "small" problems there).
Anyway this, is... quite rare. I will say than higher settings are okay, for casual listening and "simple" decoding maybe. Even being quite larger than Vorbis/AAC/Opus/MP3, going around 300kbps or higher to get rid of distortion. And there's still not silence (though you wouldn't notice it with q10 or so). But the trick is here, just simple noise without much algorithms, as QOA. Noise at higher frequencies is harder to notice. Is smaller than lossless, and it sounds ok. Just as some ADPCM variant would do. Looking at foobar2000 spectrum I can't see serious changes, since it's tuned for audible content and doesn't show the complete dB range as Spek.
So... this codec isn't aimed to compete at lower (bit)rates, and it doesn't work too well with low-sampled content.

Whatever, with higher Q settings you can sound mostly transparent, better when using "high-res" (not higher than 16bit but high sampling rates, huh). Another thing to bother that "audiophiles" with golden ears  :)) .

Again, q4 isn't good for nothing. Try higher ones, those are decent. And again, quite tonal content kills ADC; and QOA too.


((uh... sorry if this looks a bit messed up, I'm not any good for make long explanations. but the point is: ADC isn't good enough as pretended))

Re: ADC (Adaptive Differential Coding) My Experimental Lossy Audio Codec

Reply #71
I thank you for the test. At least you give me some useful information. Of course, the piece of music you chose is disturbing in my opinion. If you say this I can partially agree with you. I have nothing against frequency domain codecs like mp3, AAC or others. I'm just saying that when I listen to them I hear (perhaps among the few) something missing, and the noise suppression is strong in MP3 but it's an artifice. Mp3 takes an audio ecosystem, analyzes it, divides, cleans and compresses it. Is this sound I wonder? I'm looking for an alternative path, whether it's wrong or right. QOA is also interesting in my opinion.


I also thank Case.

Re: ADC (Adaptive Differential Coding) My Experimental Lossy Audio Codec

Reply #72
I'm currently working on the next version which will implement both compression, stability and kbit/s ratio and pnsr ratio!

Re: ADC (Adaptive Differential Coding) My Experimental Lossy Audio Codec

Reply #73
I managed to significantly improve the core and insert ABR/CBR style bitrate control (suitable for stereo format at the moment). For the VBR I hope to develop it soon. From my listening tests, at least I don't hear any differences with mp3 except that in this mode I don't want it to drop below 128 kbit/s. The strange thing is that using this method I can get results superior to the static option of defined bits for audio representation. I hope to release a version very soon.

Re: ADC (Adaptive Differential Coding) My Experimental Lossy Audio Codec

Reply #74
After a lot of hard work I managed to get this version 0.70 which I hope you like more than the previous ones. I managed to insert a CBR/ABR style bitrate control which certainly needs improvement but which does its job well.

I hope you can advise me. Greetings!

only from:
http://heartofcomp.altervista.org/ADCodec.htm