Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > sci.electronics.design > #546555 > unrolled thread
| Started by | bitrex <user@example.net> |
|---|---|
| First post | 2019-06-09 13:54 -0400 |
| Last post | 2019-06-12 11:05 +1000 |
| Articles | 20 on this page of 36 — 8 participants |
Back to article view | Back to sci.electronics.design
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
Page 1 of 2 [1] 2 Next page →
| From | bitrex <user@example.net> |
|---|---|
| Date | 2019-06-09 13:54 -0400 |
| Subject | data compression algorithm |
| Message-ID | <8JbLE.9929$t_3.6270@fx18.iad> |
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);
}
auto decompress(uint8_t x) -> uint16_t {
auto f_y = [x](uint16_t y) { return compress(y) - x; };
auto f_y_prime = [](uint16_t y) {
return (16351.2 + 7.984 * y + 0.0311875 * y * y) / ((128 + y) *
(128 + y));
};
const uint16_t y_init = x;
auto y = y_init - f_y(y_init) / f_y_prime(y_init);
y = y - f_y(y) / f_y_prime(0.5*(y + y_init));
auto y_prime = y - f_y(y) / f_y_prime(y);
return y - f_y(y) / f_y_prime(0.5*(y + y_prime));
}
[toc] | [next] | [standalone]
| From | John Larkin <jjlarkin@highlandtechnology.com> |
|---|---|
| Date | 2019-06-09 12:03 -0700 |
| Message-ID | <jplqfe5rq7af3b0bctjts5tta1pqucptp3@4ax.com> |
| In reply to | #546555 |
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);
>}
>
>auto decompress(uint8_t x) -> uint16_t {
> auto f_y = [x](uint16_t y) { return compress(y) - x; };
>
> auto f_y_prime = [](uint16_t y) {
> return (16351.2 + 7.984 * y + 0.0311875 * y * y) / ((128 + y) *
>(128 + y));
> };
>
> const uint16_t y_init = x;
>
> auto y = y_init - f_y(y_init) / f_y_prime(y_init);
> y = y - f_y(y) / f_y_prime(0.5*(y + y_init));
> auto y_prime = y - f_y(y) / f_y_prime(y);
> return y - f_y(y) / f_y_prime(0.5*(y + y_prime));
>}
Lookup tables would be easy.
We do FPGA and uP based functions with lookups, and sometimes a bit of
interpolation. Like for DDS sine waves.
--
John Larkin Highland Technology, Inc
lunatic fringe electronics
[toc] | [prev] | [next] | [standalone]
| From | bitrex <user@example.net> |
|---|---|
| Date | 2019-06-09 17:27 -0400 |
| Message-ID | <QQeLE.127515$wz.38857@fx41.iad> |
| In reply to | #546566 |
On 6/9/19 3:03 PM, 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);
>> }
>>
>> auto decompress(uint8_t x) -> uint16_t {
>> auto f_y = [x](uint16_t y) { return compress(y) - x; };
>>
>> auto f_y_prime = [](uint16_t y) {
>> return (16351.2 + 7.984 * y + 0.0311875 * y * y) / ((128 + y) *
>> (128 + y));
>> };
>>
>> const uint16_t y_init = x;
>>
>> auto y = y_init - f_y(y_init) / f_y_prime(y_init);
>> y = y - f_y(y) / f_y_prime(0.5*(y + y_init));
>> auto y_prime = y - f_y(y) / f_y_prime(y);
>> return y - f_y(y) / f_y_prime(0.5*(y + y_prime));
>> }
>
>
> Lookup tables would be easy.
>
> We do FPGA and uP based functions with lookups, and sometimes a bit of
> interpolation. Like for DDS sine waves.
>
>
Plenty of compute cycles available on both sides, it's the link that's
the bottleneck, so the decode doesn't have to be especially fast. I do
avoid pulling in a floating point square root library function this way.
Can tweak the scaling pretty easy without making a new table
[toc] | [prev] | [next] | [standalone]
| From | bitrex <user@example.net> |
|---|---|
| Date | 2019-06-09 17:31 -0400 |
| Message-ID | <PUeLE.16778$LB7.11519@fx34.iad> |
| In reply to | #546588 |
On 6/9/19 5:27 PM, bitrex wrote:
> On 6/9/19 3:03 PM, 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);
>>> }
>>>
>>> auto decompress(uint8_t x) -> uint16_t {
>>> auto f_y = [x](uint16_t y) { return compress(y) - x; };
>>>
>>> auto f_y_prime = [](uint16_t y) {
>>> return (16351.2 + 7.984 * y + 0.0311875 * y * y) / ((128 + y) *
>>> (128 + y));
>>> };
>>>
>>> const uint16_t y_init = x;
>>>
>>> auto y = y_init - f_y(y_init) / f_y_prime(y_init);
>>> y = y - f_y(y) / f_y_prime(0.5*(y + y_init));
>>> auto y_prime = y - f_y(y) / f_y_prime(y);
>>> return y - f_y(y) / f_y_prime(0.5*(y + y_prime));
>>> }
>>
>>
>> Lookup tables would be easy.
>>
>> We do FPGA and uP based functions with lookups, and sometimes a bit of
>> interpolation. Like for DDS sine waves.
>>
>>
>
> Plenty of compute cycles available on both sides, it's the link that's
> the bottleneck, so the decode doesn't have to be especially fast. I do
> avoid pulling in a floating point square root library function this way.
> Can tweak the scaling pretty easy without making a new table
The New C++ can do a lot of work at compile time, and can even generate
lookup-tables on the fly at compile-time. It's easier to do with a
C++14-compliant compiler than C++11, it can be done with the latter but
it's obtuse and messy. Most (open source at least) embedded target
compilers (avr-gcc, arm-gcc) don't fully support C++14, yet.
[toc] | [prev] | [next] | [standalone]
| From | John Doe <always.look@message.header> |
|---|---|
| Date | 2019-06-09 22:05 +0000 |
| Message-ID | <qdjvrd$ttq$1@dont-email.me> |
| In reply to | #546590 |
A troll that replies to 90% of its own posts...
--
bitrex <user example.net> wrote:
> Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!feeder4.feed.usenet.farm!feed.usenet.farm!newsreader4.netcologne.de!news.netcologne.de!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.am4!peer.am4.highwinds-media.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx34.iad.POSTED!not-for-mail
> Subject: Re: data compression algorithm
> Newsgroups: sci.electronics.design
> References: <8JbLE.9929$t_3.6270 fx18.iad> <jplqfe5rq7af3b0bctjts5tta1pqucptp3 4ax.com> <QQeLE.127515$wz.38857 fx41.iad>
> From: bitrex <user example.net>
> User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0
> MIME-Version: 1.0
> In-Reply-To: <QQeLE.127515$wz.38857 fx41.iad>
> Content-Type: text/plain; charset=utf-8; format=flowed
> Content-Language: en-US
> Content-Transfer-Encoding: 8bit
> Lines: 62
> Message-ID: <PUeLE.16778$LB7.11519 fx34.iad>
> X-Complaints-To: abuse frugalusenet.com
> NNTP-Posting-Date: Sun, 09 Jun 2019 21:31:27 UTC
> Organization: frugalusenet - www.frugalusenet.com
> Date: Sun, 9 Jun 2019 17:31:27 -0400
> X-Received-Bytes: 3490
> X-Received-Body-CRC: 1075788681
> Xref: reader01.eternal-september.org sci.electronics.design:553196
>
> On 6/9/19 5:27 PM, bitrex wrote:
>> On 6/9/19 3:03 PM, 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);
>>>> }
>>>>
>>>> auto decompress(uint8_t x) -> uint16_t {
>>>> ¶ÿ¶ÿ auto f_y = [x](uint16_t y) { return compress(y) - x; };
>>>>
>>>> ¶ÿ¶ÿ auto f_y_prime = [](uint16_t y) {
>>>> ¶ÿ¶ÿ¶ÿ¶ÿ return (16351.2 + 7.984 * y + 0.0311875 * y * y) / ((128 + y) *
>>>> (128 + y));
>>>> ¶ÿ¶ÿ };
>>>>
>>>> ¶ÿ¶ÿ const uint16_t y_init = x;
>>>>
>>>> ¶ÿ¶ÿ auto y = y_init - f_y(y_init) / f_y_prime(y_init);
>>>> ¶ÿ¶ÿ y = y - f_y(y) / f_y_prime(0.5*(y + y_init));
>>>> ¶ÿ¶ÿ auto y_prime = y - f_y(y) / f_y_prime(y);
>>>> ¶ÿ¶ÿ return y - f_y(y) / f_y_prime(0.5*(y + y_prime));
>>>> }
>>>
>>>
>>> Lookup tables would be easy.
>>>
>>> We do FPGA and uP based functions with lookups, and sometimes a bit of
>>> interpolation. Like for DDS sine waves.
>>>
>>>
>>
>> Plenty of compute cycles available on both sides, it's the link that's
>> the bottleneck, so the decode doesn't have to be especially fast. I do
>> avoid pulling in a floating point square root library function this way.
>> Can tweak the scaling pretty easy without making a new table
>
> The New C++ can do a lot of work at compile time, and can even generate
> lookup-tables on the fly at compile-time. It's easier to do with a
> C++14-compliant compiler than C++11, it can be done with the latter but
> it's obtuse and messy. Most (open source at least) embedded target
> compilers (avr-gcc, arm-gcc) don't fully support C++14, yet.
>
>
[toc] | [prev] | [next] | [standalone]
| From | bitrex <user@example.net> |
|---|---|
| Date | 2019-06-09 18:10 -0400 |
| Message-ID | <9tfLE.19943$935.640@fx46.iad> |
| In reply to | #546591 |
On 6/9/19 6:05 PM, John Doe wrote: > A troll that replies to 90% of its own posts... > Better than posting 100% OT bullshit as you do
[toc] | [prev] | [next] | [standalone]
| From | John Larkin <jjlarkin@highlandtechnology.com> |
|---|---|
| Date | 2019-06-09 16:36 -0700 |
| Message-ID | <7u5rfe1fdnsufmdegmrai51ojqft8thmc6@4ax.com> |
| In reply to | #546591 |
On Sun, 9 Jun 2019 22:05:33 -0000 (UTC), John Doe <always.look@message.header> wrote: >A troll that replies to 90% of its own posts... Mutual admiration society? -- John Larkin Highland Technology, Inc lunatic fringe electronics
[toc] | [prev] | [next] | [standalone]
| From | bitrex <user@example.net> |
|---|---|
| Date | 2019-06-09 19:43 -0400 |
| Message-ID | <9QgLE.7140$BI2.6009@fx05.iad> |
| In reply to | #546601 |
On 6/9/19 7:36 PM, John Larkin wrote: > On Sun, 9 Jun 2019 22:05:33 -0000 (UTC), John Doe > <always.look@message.header> wrote: > >> A troll that replies to 90% of its own posts... > > Mutual admiration society? > > I do make real-world $$$ doing real-world engineering. there's no evidence to support "John Doe" does anything. why is he here, again?
[toc] | [prev] | [next] | [standalone]
| From | John Larkin <jjlarkin@highlandtechnology.com> |
|---|---|
| Date | 2019-06-10 07:12 -0700 |
| Message-ID | <e8psfe9ipkp3kkeveps4fqcahk3ok8bdt0@4ax.com> |
| In reply to | #546602 |
On Sun, 9 Jun 2019 19:43:01 -0400, bitrex <user@example.net> wrote: >On 6/9/19 7:36 PM, John Larkin wrote: >> On Sun, 9 Jun 2019 22:05:33 -0000 (UTC), John Doe >> <always.look@message.header> wrote: >> >>> A troll that replies to 90% of its own posts... >> >> Mutual admiration society? >> >> > >I do make real-world $$$ doing real-world engineering. Actually, several people who post to sed do that too. Five maybe. Post some links. We like to see what people actually do. -- John Larkin Highland Technology, Inc lunatic fringe electronics
[toc] | [prev] | [next] | [standalone]
| From | Rick C <gnuarm.deletethisbit@gmail.com> |
|---|---|
| Date | 2019-06-10 07:32 -0700 |
| Message-ID | <1048d25d-23a1-4184-a683-9dce60606b8b@googlegroups.com> |
| In reply to | #546652 |
On Monday, June 10, 2019 at 10:12:52 AM UTC-4, John Larkin wrote: > On Sun, 9 Jun 2019 19:43:01 -0400, bitrex <user@example.net> wrote: > > >On 6/9/19 7:36 PM, John Larkin wrote: > >> On Sun, 9 Jun 2019 22:05:33 -0000 (UTC), John Doe > >> <always.look@message.header> wrote: > >> > >>> A troll that replies to 90% of its own posts... > >> > >> Mutual admiration society? > >> > >> > > > >I do make real-world $$$ doing real-world engineering. > > Actually, several people who post to sed do that too. Five maybe. > > Post some links. We like to see what people actually do. This is what I make and sell. Look up Multiservice Interface module. https://www.juniper.net/documentation/en_US/ctp6.2/topics/concept/ctp-bundle-multiservices.html Sales are sporadic, but not insignificant. The hardware design is basic, but condensed with the module size only 4.5 x 0.85 inches. With the important stuff in an FPGA, a lot of functionality can be packed into a small module. The only tricky part of the hardware design was getting the maximum voltage swing from a single +12 volt supply. I managed to get an 8 volt swing on each of the differential outputs driving a 50 ohm load. Oh yeah, the FPGA also contains uLaw and Alaw compression. -- Rick C. - Get 1,000 miles of free Supercharging - Tesla referral code - https://ts.la/richard11209
[toc] | [prev] | [next] | [standalone]
| From | bitrex <user@example.net> |
|---|---|
| Date | 2019-06-10 10:42 -0400 |
| Message-ID | <F%tLE.10258$t_3.4546@fx18.iad> |
| In reply to | #546652 |
On 6/10/19 10:12 AM, John Larkin wrote: > On Sun, 9 Jun 2019 19:43:01 -0400, bitrex <user@example.net> wrote: > >> On 6/9/19 7:36 PM, John Larkin wrote: >>> On Sun, 9 Jun 2019 22:05:33 -0000 (UTC), John Doe >>> <always.look@message.header> wrote: >>> >>>> A troll that replies to 90% of its own posts... >>> >>> Mutual admiration society? >>> >>> >> >> I do make real-world $$$ doing real-world engineering. > > Actually, several people who post to sed do that too. Five maybe. > > Post some links. We like to see what people actually do. > > I kinda just did, I mostly do contract design work for the entertainment/music/visual and performing arts sector. this project is for controlling custom LED arrays for the "performing arts." Good clients though they tend to have either limited funds or a huge excess of funds, depending. I like the latter type the best from a financial perspective. "Well we all just wanna be big rock stars, live in hilltop houses, driving fifteen cars, the girls come easy and the drugs come cheap, and we'll all stay skinny cuz we just won't eat..."
[toc] | [prev] | [next] | [standalone]
| From | bitrex <user@example.net> |
|---|---|
| Date | 2019-06-10 10:49 -0400 |
| Message-ID | <D5uLE.22053$3T5.7877@fx45.iad> |
| In reply to | #546657 |
On 6/10/19 10:42 AM, bitrex wrote: > On 6/10/19 10:12 AM, John Larkin wrote: >> On Sun, 9 Jun 2019 19:43:01 -0400, bitrex <user@example.net> wrote: >> >>> On 6/9/19 7:36 PM, John Larkin wrote: >>>> On Sun, 9 Jun 2019 22:05:33 -0000 (UTC), John Doe >>>> <always.look@message.header> wrote: >>>> >>>>> A troll that replies to 90% of its own posts... >>>> >>>> Mutual admiration society? >>>> >>>> >>> >>> I do make real-world $$$ doing real-world engineering. >> >> Actually, several people who post to sed do that too. Five maybe. >> >> Post some links. We like to see what people actually do. >> >> > > I kinda just did, I mostly do contract design work for the > entertainment/music/visual and performing arts sector. this project is > for controlling custom LED arrays for the "performing arts." Good > clients though they tend to have either limited funds or a huge excess > of funds, depending. I like the latter type the best from a financial > perspective. > > "Well we all just wanna be big rock stars, > live in hilltop houses, driving fifteen cars, > the girls come easy and the drugs come cheap, > and we'll all stay skinny cuz we just won't eat..." I'm also a multi-instrumentalist (guitar, piano, drums when I'm feeling brave) and worked in the recording industry/music biz for a while as a younger man and had a small taste of that lifestyle but it's a younger man's game but it's way easier selling pick-axes than trying to mine gold yourself as you get older.
[toc] | [prev] | [next] | [standalone]
| From | Martin Brown <'''newspam'''@nezumi.demon.co.uk> |
|---|---|
| Date | 2019-06-10 09:10 +0100 |
| Message-ID | <qdl3ah$1ar5$1@gioia.aioe.org> |
| In reply to | #546566 |
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
>> auto decompress(uint8_t x) -> uint16_t {
>> auto f_y = [x](uint16_t y) { return compress(y) - x; };
>>
>> auto f_y_prime = [](uint16_t y) {
>> return (16351.2 + 7.984 * y + 0.0311875 * y * y) / ((128 + y) *
>> (128 + y));
>> };
>>
>> const uint16_t y_init = x;
>>
>> auto y = y_init - f_y(y_init) / f_y_prime(y_init);
>> y = y - f_y(y) / f_y_prime(0.5*(y + y_init));
>> auto y_prime = y - f_y(y) / f_y_prime(y);
>> return y - f_y(y) / f_y_prime(0.5*(y + y_prime));
>> }
>
>
> Lookup tables would be easy.
+1
I had always assumed that on the decode side the mapping for the 256
values transmitted would be converted back using a lookup table computed
locally or sent by the data source as a header on the image info.
Lookup tables are just so much easier. Also remember that you want to
return the mid value of the band of source data that mapped to a
particular 8 bit index or you will introduce bias.
>
> We do FPGA and uP based functions with lookups, and sometimes a bit of
> interpolation. Like for DDS sine waves.
--
Regards,
Martin Brown
[toc] | [prev] | [next] | [standalone]
| From | John Larkin <jjlarkin@highlandtechnology.com> |
|---|---|
| Date | 2019-06-10 07:17 -0700 |
| Message-ID | <9epsfe1lq5tm6tkjfjgthod6c4b8r4jvir@4ax.com> |
| In reply to | #546631 |
On Mon, 10 Jun 2019 09:10:58 +0100, Martin Brown
<'''newspam'''@nezumi.demon.co.uk> 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.
Hardware floating point is liberating too. Scaled integers take too
much thinking.
I wrote one math library that used signed 32.32 format, for a CPU
without floats. That was fast and handles most any real problems.
--
John Larkin Highland Technology, Inc
lunatic fringe electronics
[toc] | [prev] | [next] | [standalone]
| From | bitrex <user@example.net> |
|---|---|
| Date | 2019-06-10 11:03 -0400 |
| Message-ID | <ijuLE.1096$Fk3.1080@fx21.iad> |
| In reply to | #546653 |
On 6/10/19 10:17 AM, John Larkin wrote:
> On Mon, 10 Jun 2019 09:10:58 +0100, Martin Brown
> <'''newspam'''@nezumi.demon.co.uk> 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.
>
> Hardware floating point is liberating too. Scaled integers take too
> much thinking.
>
> I wrote one math library that used signed 32.32 format, for a CPU
> without floats. That was fast and handles most any real problems.
>
The decoding routine I posted runs in about 60 clock cycles even on an 8
bitter with no hardware FPU it's plenty fast as compared to a serial
baud rate. the benefit of the hassle of a lookup table are marginal. the
actual target device has a FPU.
I use lookup tables for the same use cases you do, like direct digital
synthesis.
There are C++ libraries for fixed point, using templates, so that all
the necessary operations for shifting and conversion get hardcoded at
compile time under-the-hood without having to think too hard.
[toc] | [prev] | [next] | [standalone]
| From | bitrex <user@example.net> |
|---|---|
| Date | 2019-06-10 11:11 -0400 |
| Message-ID | <squLE.1215$Fk3.584@fx21.iad> |
| In reply to | #546631 |
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.
>>> auto decompress(uint8_t x) -> uint16_t {
>>> auto f_y = [x](uint16_t y) { return compress(y) - x; };
>>>
>>> auto f_y_prime = [](uint16_t y) {
>>> return (16351.2 + 7.984 * y + 0.0311875 * y * y) / ((128 + y) *
>>> (128 + y));
>>> };
>>>
>>> const uint16_t y_init = x;
>>>
>>> auto y = y_init - f_y(y_init) / f_y_prime(y_init);
>>> y = y - f_y(y) / f_y_prime(0.5*(y + y_init));
>>> auto y_prime = y - f_y(y) / f_y_prime(y);
>>> return y - f_y(y) / f_y_prime(0.5*(y + y_prime));
>>> }
>>
>>
>> Lookup tables would be easy.
>
> +1
>
> I had always assumed that on the decode side the mapping for the 256
> values transmitted would be converted back using a lookup table computed
> locally or sent by the data source as a header on the image info.
>
> Lookup tables are just so much easier. Also remember that you want to
> return the mid value of the band of source data that mapped to a
> particular 8 bit index or you will introduce bias.
The "decoder" algorithm runs so fast as compared to the serial link
speed bottleneck that a lookup table is hardly worth the trouble, the uP
spends most of its time sitting around doing nothing anyway.
[toc] | [prev] | [next] | [standalone]
| From | John Doe <always.look@message.header> |
|---|---|
| Date | 2019-06-10 17:23 +0000 |
| Message-ID | <qdm3n9$o15$1@dont-email.me> |
| In reply to | #546661 |
The troll has already been told twice it needs to use
a lookup table...
--
bitrex <user example.net> wrote:
> Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.dns-netz.com!news.freedyn.net!newsreader4.netcologne.de!news.netcologne.de!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer02.am4!peer.am4.highwinds-media.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx21.iad.POSTED!not-for-mail
> Subject: Re: data compression algorithm
> Newsgroups: sci.electronics.design
> References: <8JbLE.9929$t_3.6270 fx18.iad> <jplqfe5rq7af3b0bctjts5tta1pqucptp3 4ax.com> <qdl3ah$1ar5$1 gioia.aioe.org>
> From: bitrex <user example.net>
> User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0
> MIME-Version: 1.0
> In-Reply-To: <qdl3ah$1ar5$1 gioia.aioe.org>
> Content-Type: text/plain; charset=utf-8; format=flowed
> Content-Language: en-US
> Content-Transfer-Encoding: 8bit
> Lines: 72
> Message-ID: <squLE.1215$Fk3.584 fx21.iad>
> X-Complaints-To: abuse frugalusenet.com
> NNTP-Posting-Date: Mon, 10 Jun 2019 15:11:20 UTC
> Organization: frugalusenet - www.frugalusenet.com
> Date: Mon, 10 Jun 2019 11:11:19 -0400
> X-Received-Bytes: 3670
> X-Received-Body-CRC: 1073836027
> Xref: reader01.eternal-september.org sci.electronics.design:553267
>
> 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.
>
>>>> auto decompress(uint8_t x) -> uint16_t {
>>>> ¶ÿ¶ÿ auto f_y = [x](uint16_t y) { return compress(y) - x; };
>>>>
>>>> ¶ÿ¶ÿ auto f_y_prime = [](uint16_t y) {
>>>> ¶ÿ¶ÿ¶ÿ¶ÿ return (16351.2 + 7.984 * y + 0.0311875 * y * y) / ((128 + y) *
>>>> (128 + y));
>>>> ¶ÿ¶ÿ };
>>>>
>>>> ¶ÿ¶ÿ const uint16_t y_init = x;
>>>>
>>>> ¶ÿ¶ÿ auto y = y_init - f_y(y_init) / f_y_prime(y_init);
>>>> ¶ÿ¶ÿ y = y - f_y(y) / f_y_prime(0.5*(y + y_init));
>>>> ¶ÿ¶ÿ auto y_prime = y - f_y(y) / f_y_prime(y);
>>>> ¶ÿ¶ÿ return y - f_y(y) / f_y_prime(0.5*(y + y_prime));
>>>> }
>>>
>>>
>>> Lookup tables would be easy.
>>
>> +1
>>
>> I had always assumed that on the decode side the mapping for the 256
>> values transmitted would be converted back using a lookup table computed
>> locally or sent by the data source as a header on the image info.
>>
>> Lookup tables are just so much easier. Also remember that you want to
>> return the mid value of the band of source data that mapped to a
>> particular 8 bit index or you will introduce bias.
>
> The "decoder" algorithm runs so fast as compared to the serial link
> speed bottleneck that a lookup table is hardly worth the trouble, the uP
> spends most of its time sitting around doing nothing anyway.
>
>
>
[toc] | [prev] | [next] | [standalone]
| From | bitrex <user@example.net> |
|---|---|
| Date | 2019-06-10 15:07 -0400 |
| Message-ID | <LTxLE.29649$cZ6.21786@fx47.iad> |
| In reply to | #546674 |
On 6/10/19 1:23 PM, John Doe wrote: > The troll has already been told twice it needs to use > a lookup table... > Your mama thought "Newton's method" was a method of birth control, which is why you're here u basement-living Nazi fuck
[toc] | [prev] | [next] | [standalone]
| From | bitrex <user@example.net> |
|---|---|
| Date | 2019-06-10 15:31 -0400 |
| Message-ID | <feyLE.21500$uq.306@fx31.iad> |
| In reply to | #546674 |
On 6/10/19 1:23 PM, John Doe wrote: > The troll has already been told twice it needs to use > a lookup table... > Speaking of the topic of birth control, I've been meaning to ask you, John - have you fucked any hot girls lately? Will you be marching in the Straight Pride parade this year? The reason I ask is, as I figure it, you have to have sex with women to be straight. You can't just "identify" with being straight, you know? I plan on bringing up this topic consistently in our little chats from now on as I kind of like it when the true defenders of the purity of the White genome have a little real-world credibility on the practical matter of how it's propagated
[toc] | [prev] | [next] | [standalone]
| From | John Doe <always.look@message.header> |
|---|---|
| Date | 2019-06-11 15:07 +0000 |
| Message-ID | <qdog49$qn8$3@dont-email.me> |
| In reply to | #546693 |
This troll loves responding twice to every post, even its own... -- bitrex <user example.net> wrote: > Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.uzoreto.com!newsreader4.netcologne.de!news.netcologne.de!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer04.fr7!futter-mich.highwinds-media.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx31.iad.POSTED!not-for-mail > Subject: Re: data compression algorithm > Newsgroups: sci.electronics.design,free.spam > References: <8JbLE.9929$t_3.6270 fx18.iad> <jplqfe5rq7af3b0bctjts5tta1pqucptp3 4ax.com> <qdl3ah$1ar5$1 gioia.aioe.org> <squLE.1215$Fk3.584 fx21.iad> <qdm3n9$o15$1 dont-email.me> > From: bitrex <user example.net> > User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 > MIME-Version: 1.0 > In-Reply-To: <qdm3n9$o15$1 dont-email.me> > Content-Type: text/plain; charset=utf-8; format=flowed > Content-Language: en-US > Content-Transfer-Encoding: 7bit > Lines: 16 > Message-ID: <feyLE.21500$uq.306 fx31.iad> > X-Complaints-To: abuse frugalusenet.com > NNTP-Posting-Date: Mon, 10 Jun 2019 19:31:23 UTC > Organization: frugalusenet - www.frugalusenet.com > Date: Mon, 10 Jun 2019 15:31:23 -0400 > X-Received-Bytes: 1721 > X-Received-Body-CRC: 3701672552 > Xref: reader01.eternal-september.org sci.electronics.design:553299 free.spam:12412 > > On 6/10/19 1:23 PM, John Doe wrote: >> The troll has already been told twice it needs to use >> a lookup table... >> > > Speaking of the topic of birth control, I've been meaning to ask you, > John - have you fucked any hot girls lately? Will you be marching in the > Straight Pride parade this year? > > The reason I ask is, as I figure it, you have to have sex with women to > be straight. You can't just "identify" with being straight, you know? > > I plan on bringing up this topic consistently in our little chats from > now on as I kind of like it when the true defenders of the purity of the > White genome have a little real-world credibility on the practical > matter of how it's propagated > >
[toc] | [prev] | [next] | [standalone]
Page 1 of 2 [1] 2 Next page →
Back to top | Article view | sci.electronics.design
csiph-web