![]() |
![]() |
#21 |
Registered User
![]() Join Date: May 2022
Location: Adelaide
Posts: 111
|
How do I apply delta encoding? What file format is it? Can I do it in Audacity?
|
![]() |
![]() |
#22 | |
Registered User
![]() Join Date: Aug 2022
Location: UK
Posts: 1,841
|
Quote:
2. Read the next sample 3. Delta = sample - current 4. Choose the quantized delta value from your table that gets you closest to the the actual sample value. 5. Current = Current + quantized delta 6. Repeat from 2. The idea here is that each quantised delta step is usually going to undershoot or overshoot the desired target but it's always correcting towards it rather than just drifting off all over the place. |
|
![]() |
![]() |
#23 | |
Registered User
![]() Join Date: May 2022
Location: Adelaide
Posts: 111
|
Quote:
|
|
![]() |
![]() |
#24 |
Registered User
![]() Join Date: Sep 2022
Location: Switzerland
Posts: 68
|
|
![]() |
![]() |
#25 |
Registered User
![]() Join Date: Aug 2022
Location: UK
Posts: 1,841
|
Yeah, except you just directly look up the quantised delta value from the table. The value you store in the compressed stream is just the nybble index position of the quantized delta value in the table.
|
![]() |
![]() |
#26 | |
Registered User
![]() Join Date: Aug 2022
Location: UK
Posts: 1,841
|
Quote:
|
|
![]() |
![]() |
#27 |
Registered User
![]() Join Date: Sep 2019
Location: Finland
Posts: 278
|
Off topic:
This AGA demo by Union from 1995 had a whole Pink Floyd tune encoded into it: https://www.pouet.net/prod.php?which=7824 |
![]() |
![]() |
#28 |
Registered User
Join Date: May 2020
Location: Germany
Posts: 20
|
All this talk about 4-bit delta and XPK SQSH compression reminds me of a program that I wrote a few (well almost exactly 26
![]() http://aminet.net/package/mus/play/psmp = IFF-8SVX player (source code included) |
![]() |
![]() |
#29 | |
Registered User
Join Date: Jun 2010
Location: PL
Posts: 2,316
|
Quote:
Name can be confusing with https://en.wikipedia.org/wiki/WavPack but seem that Wilhelm Noeker was first. Last edited by pandy71; 22 January 2023 at 23:48. |
|
![]() |
![]() |
#30 |
Registered User
![]() Join Date: Aug 2022
Location: UK
Posts: 1,841
|
Many years ago, I wrote an adaptive, frame based delta encoder for 16 bit audio, intended for sound effects and speech. It had frames encoded as 0, 1, 2, 3, 4 or 5 bits per sample packed into 16 bit words. 0 was a special case for silence encoding (used in noise gated speech). A stream had a uniform output frame length, e.g 1024 samples, but this applied to that stream only. Each frame had a header that contained the actual delta decode table (only as many as the distinct number of values present) followed by the packed data. Although this was somewhat wasteful, the point was that the encoder was free to choose the best N delta values for the set of input samples in the fram. Costs were assigned to each bit depth, 5 being the most expensive (from a compression perspective) while the overall RMS quantisation noise of the output compared to the input was scored for quality. The encoder, with an overall quality parameter value, would weigh the encoding cost against the quantisation error cost and try to find the best fit.
This was all compression time overhead. Decompressing was the same as described in earlier posts, except that the delta table wasn't global, but unique per frame. The encoder actually had a UI. Screenshot, showing the analysis of a single frame: https://github.com/0xABADCAFE/ancien...shot/xdac1.png Last edited by Karlos; 23 January 2023 at 00:35. |
![]() |
![]() |
#31 |
Registered User
![]() Join Date: Aug 2022
Location: UK
Posts: 1,841
|
I should revisit and simplify that some time. For one thing, when you have a frame of hundreds or samples your delta values, when sorted ascending, always follow a sigmoidal sort of shape. Rather than storing the delta values maybe the parameters of the curve of best fit could be used. That does imply more runtime effort to decode, bur there'd be better compression of the frame overall.
|
![]() |
![]() |
#32 |
Registered User
![]() Join Date: May 2022
Location: Adelaide
Posts: 111
|
Does anyone know where I can get the source code for a media player or something? I want a sample to pick apart and build a working set of audio functions.
|
![]() |
![]() |
#33 | |||
Registered User
![]() Join Date: Feb 2017
Location: Denmark
Posts: 579
|
Quote:
Quote:
Quote:
|
|||
![]() |
![]() |
#34 | |
Registered User
![]() Join Date: Aug 2022
Location: UK
Posts: 1,841
|
Quote:
Damn I wouldn't call that crap readable, it was like my first day ![]() It's based on a very early C++ framework, before I found my preferred style and had much understanding how to wield it properly. On the plus side, the UI was fully hardware rendered, using a drawing library on top of Warp3D in that example. It's running on an unreleased driver iteration that actually does line drawing on the GPU I had. All the shading (which reflects the signal intensity ranges) are Gouraud shaded rectangles and the character glyphs are actually alpha blended textures. It's coming back to me now. The lower graph shows the distinct, ordered deltas as the yellow plot, their population as the blue plot (almost always flat you'll notice) and the best fit curve based on the chosen 16 values in white. The overlay of this graph doesn't look that ideal but that's because the horizontal coordinates of each point don't take any weighting of the input values into consideration, they are just evenly spaced. Last edited by Karlos; 23 January 2023 at 21:41. |
|
![]() |
![]() |
#35 |
Registered User
![]() Join Date: Aug 2022
Location: UK
Posts: 1,841
|
On a semi related note, I do have an improved 8 bit format intended for Paula specifically but I've not implemented playback for real, only simulation. If you are interested, it's here https://github.com/0xABADCAFE/paula-hdr
It's very different. Rather than being a second rate 16-bit alternative, it aims to be the best 8-bit. 16 bit data are converted to 8 bit, using gain adjusted frames. The gain adjustment at runtime is intended to happen via Paula channel volume modulation being applied in hardware. So every frame has 8-bit precision but a gain that changes the channel volume. The simulation produces excellent results but I've not implemented it for Paula yet. Last edited by Karlos; 23 January 2023 at 21:43. |
![]() |
![]() |
#36 | |
Defendit numerus
![]() Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,079
|
Quote:
Also sure it's faster (than 14-bit) and sounds better than normal 8 bit, but it only works for two maximum usable channels. In any case I'd like to hear the results, it might be unexpectedly good ![]() An alternative method that had been floating around in my mind a while back was to use copper to apply volume to individual channels. But it would be annoying because it would require mixing on a frequenncy multiple of video line in order not to lose any other effects with the copper. Theoretically the result would be absolutely similar to amplitude modulation on a single sample per 4 channels. EDIT: *actually with modulator channel at doubled frequency you could do it per sample, but then the modulated channel is at half max frequency.. Last edited by ross; 24 January 2023 at 16:49. |
|
![]() |
![]() |
#37 | |
Registered User
![]() Join Date: Aug 2022
Location: UK
Posts: 1,841
|
Quote:
See: https://github.com/0xABADCAFE/paula-...ee/master/data The encoded.raw file is 44kHz signed 8 bit with the volume sample (0-64) followed by 16 8-bit signed samples to be played at that volume. It's also mono. The decoded.raw file is the simulation output where we assume no latency applying the volume modulation in hardware. It's 44kHz 16 bit, mono, little endian encoded because I just did the prototyping on my pc initially. Based on subtracting it from the original 16 bit input and measuring the RMS error, it seems pretty decent. The original input file is the one that's labelled test_raw16bit_LE.raw Obviously the real file format would have a header and would probably arrange the data in a way better suited for playback under the proposed channel modulation scheme. Last edited by Karlos; 24 January 2023 at 17:49. |
|
![]() |
![]() |
#38 |
Registered User
![]() Join Date: Aug 2022
Location: UK
Posts: 1,841
|
Just thinking a moment. Let's say the automatic gain adjustment idea works, i.e. using hardware volume modulation updated every "frame". The 8 bit PCM data itself is always as close to normalised in intensity. It makes me wonder if you could then compress that to 4 bit using the basic techniques we've been describing so far. You'd still have better dynamic range than 8 bit overall and much smaller data than 16 bit.
|
![]() |
![]() |
#39 |
Registered User
![]() Join Date: Mar 2012
Location: Norfolk, UK
Posts: 1,095
|
I saw a blog post today and immediately thought of this thread:
https://phoboslab.org/log/2023/02/qo...io-compression Maybe it could be adapted for Amiga use - or maybe not - but either way there's some good information there - I hope it least makes for interesting reading. |
![]() |
![]() |
#40 | |
Defendit numerus
![]() Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,079
|
Quote:
From a quick look the only sticking point would be a multiplication per sample (data structures designed for 64-bit architectures can simply be redesigned). For sure for a (fast?) 020+ machine. |
|
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Compressed filelist.txt | jbl007 | project.Amiga File Server | 1 | 11 November 2017 22:54 |
fs-uae and cd32 compressed audio | deejay | support.FS-UAE | 3 | 24 March 2014 20:17 |
ADF file compressed with RAR | pucci | support.WinUAE | 5 | 16 October 2011 12:37 |
Compressed HDF saving | BippyM | request.UAE Wishlist | 5 | 17 October 2005 23:12 |
Multi-Disk Compressed ADF? | TheOutrider | support.WinUAE | 10 | 02 October 2003 10:44 |
|
|