Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > sci.electronics.design > #546779
| From | Martin Brown <'''newspam'''@nezumi.demon.co.uk> |
|---|---|
| Newsgroups | sci.electronics.design |
| Subject | Re: data compression algorithm |
| Date | 2019-06-11 14:47 +0100 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <qdobec$1utp$1@gioia.aioe.org> (permalink) |
| References | <8JbLE.9929$t_3.6270@fx18.iad> <jplqfe5rq7af3b0bctjts5tta1pqucptp3@4ax.com> <qdl3ah$1ar5$1@gioia.aioe.org> <squLE.1215$Fk3.584@fx21.iad> |
On 10/06/2019 16:11, bitrex wrote:
> On 6/10/19 4:10 AM, Martin Brown wrote:
>> On 09/06/2019 20:03, John Larkin wrote:
>>> On Sun, 9 Jun 2019 13:54:11 -0400, bitrex <user@example.net> wrote:
>>>
>>>> In the vein of suggestions made by Martin Brown, David Eather, et al a
>>>> while back, this is idea for a lossy compressor/decompressor
>>>> designed to
>>>> compress 10 bits of greyscale image data down to 8 in a
>>>> semi-logarithmic
>>>> way.
>>>>
>>>> To avoid taking a square root on the output side the lossy
>>>> "decompressor", such as it is, is two iterations of a modified Newton's
>>>> method to compute the inverse.
>>>>
>>>> Since the compression function is nearly linear when its input is
>>>> small-valued using the 8 bit compressed value as the starting guess for
>>>> the inverse helps prevent Newton from hunting over across the
>>>> discontinuity in the input function, on the wrong side of the Y axis
>>>>
>>>>
>>>> #include <cstdint>
>>>>
>>>> //family of curves of the form x = int( 0.5+k*y*(A + By)/(A + Cy))
>>>>
>>>> constexpr auto compress(uint16_t y) -> uint8_t {
>>>> //tweak "k" to taste to avoid overflow
>>>> return 0.5 + 0.997 * y * (4096 + y) / (4096 + 32 * y);
>>>> }
>>
>> You really ought to do it in scaled integer arithmetic! Or lookup table.
>>
>> 0.5 converted to a fraction over A+Cy gives
>>
>> x = int( (A/2 + y*(A+C/2 + By))/(A' + Cy)
>>
>> k can be absorbed into A' ~ 4108
>
> The encoding side is running on a desktop-class PC don't need any lookup
> table there.
If you have plenty of time on the encode side you might want to consider
another more costly form of data adaptive 12 bit to 8 bit encoding which
is based on greedy histogram equalisation. It requires an array to count
the frequency of every pixel value in the image and then multiple sweeps
of that to determine a histogram equalisation with ever increasing bin
widths to allocate the bins.
Initially you start with binsize=1 and Nbins= 256
target = Npixels/Nbins
It works very well on images with a lot of baseline values and a few
features. You have to transmit a lookup table with the byte values.
It is very good for looking for systematic errors on flat fields.
BTW You haven't said if the 8 bit comms was able to keep up.
--
Regards,
Martin Brown
Back to sci.electronics.design | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
data compression algorithm bitrex <user@example.net> - 2019-06-09 13:54 -0400
Re: data compression algorithm John Larkin <jjlarkin@highlandtechnology.com> - 2019-06-09 12:03 -0700
Re: data compression algorithm bitrex <user@example.net> - 2019-06-09 17:27 -0400
Re: data compression algorithm bitrex <user@example.net> - 2019-06-09 17:31 -0400
Re: data compression algorithm John Doe <always.look@message.header> - 2019-06-09 22:05 +0000
Re: data compression algorithm bitrex <user@example.net> - 2019-06-09 18:10 -0400
Re: data compression algorithm John Larkin <jjlarkin@highlandtechnology.com> - 2019-06-09 16:36 -0700
Re: data compression algorithm bitrex <user@example.net> - 2019-06-09 19:43 -0400
Re: data compression algorithm John Larkin <jjlarkin@highlandtechnology.com> - 2019-06-10 07:12 -0700
Re: data compression algorithm Rick C <gnuarm.deletethisbit@gmail.com> - 2019-06-10 07:32 -0700
Re: data compression algorithm bitrex <user@example.net> - 2019-06-10 10:42 -0400
Re: data compression algorithm bitrex <user@example.net> - 2019-06-10 10:49 -0400
Re: data compression algorithm Martin Brown <'''newspam'''@nezumi.demon.co.uk> - 2019-06-10 09:10 +0100
Re: data compression algorithm John Larkin <jjlarkin@highlandtechnology.com> - 2019-06-10 07:17 -0700
Re: data compression algorithm bitrex <user@example.net> - 2019-06-10 11:03 -0400
Re: data compression algorithm bitrex <user@example.net> - 2019-06-10 11:11 -0400
Re: data compression algorithm John Doe <always.look@message.header> - 2019-06-10 17:23 +0000
Re: data compression algorithm bitrex <user@example.net> - 2019-06-10 15:07 -0400
Re: data compression algorithm bitrex <user@example.net> - 2019-06-10 15:31 -0400
Re: data compression algorithm John Doe <always.look@message.header> - 2019-06-11 15:07 +0000
Re: data compression algorithm bitrex <user@example.net> - 2019-06-11 11:40 -0400
Re: data compression algorithm John Larkin <jjlarkin@highland_snip_technology.com> - 2019-06-11 10:13 -0700
Re: data compression algorithm bitrex <user@example.net> - 2019-06-11 14:41 -0400
Re: data compression algorithm Martin Brown <'''newspam'''@nezumi.demon.co.uk> - 2019-06-11 14:47 +0100
Re: data compression algorithm bitrex <user@example.net> - 2019-06-11 11:41 -0400
Re: data compression algorithm Winfield Hill <winfieldhill@yahoo.com> - 2019-06-11 10:28 -0700
Re: data compression algorithm bitrex <user@example.net> - 2019-06-11 14:31 -0400
Re: data compression algorithm Martin Brown <'''newspam'''@nezumi.demon.co.uk> - 2019-06-11 19:56 +0100
Re: data compression algorithm bitrex <user@example.net> - 2019-06-11 15:32 -0400
Re: data compression algorithm Martin Brown <'''newspam'''@nezumi.demon.co.uk> - 2019-06-12 09:11 +0100
Re: data compression algorithm bitrex <user@example.net> - 2019-06-12 11:33 -0400
Re: data compression algorithm bitrex <user@example.net> - 2019-06-11 11:42 -0400
Re: data compression algorithm John Larkin <jjlarkin@highland_snip_technology.com> - 2019-06-11 13:16 -0700
Re: data compression algorithm bitrex <user@example.net> - 2019-06-11 17:20 -0400
Re: data compression algorithm bitrex <user@example.net> - 2019-06-11 17:30 -0400
Re: data compression algorithm david eather <eatDELETEher@tpg.com.au> - 2019-06-12 11:05 +1000
csiph-web