Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > sci.electronics.design > #542566

Re: Video data compression for serial link

From Martin Brown <'''newspam'''@nezumi.demon.co.uk>
Newsgroups sci.electronics.design
Subject Re: Video data compression for serial link
Date 2019-05-09 08:44 +0100
Organization Aioe.org NNTP Server
Message-ID <qb0lom$1ua9$1@gioia.aioe.org> (permalink)
References <XVmxE.157951$bA.69332@fx26.iad> <4E8yE.187821$iy4.135150@fx06.am4> <4pHAE.8376$bW5.4409@fx47.iad> <qavhah$13t9$1@gioia.aioe.org> <7ZLAE.2892$GV5.2707@fx46.iad>

Show all headers | View raw


On 09/05/2019 03:09, bitrex wrote:
> On 5/8/19 5:22 PM, Martin Brown wrote:
>> On 08/05/2019 21:57, bitrex wrote:
>>> On 4/30/19 11:45 PM, david eather wrote:
>>>>
>>>>
>>>> On 29/04/2019 5:11 am, bitrex wrote:
>>>>> I have a client who needs to send 10 bit greyscale video data
>>>>> over a serial link from a PC to an ARM Cortex uP. Right now just 
>>>>> using a KISS implementation, constant-overhead-byte-stuffing 
>>>>> protocol, two bytes per value, with a simple CRC-type checksum 
>>>>> appended to each scanline the link needs to be around 384kbps to 
>>>>> support the amount of
>>>>> data required to transmit.
>>>>>
>>>>> the hardware is on-paper capable of that but in practice the lash 
>>>>> up is unstable, there's a bottleneck somewhere, most likely on the 
>>>>> PC side as it's not a "real" hardware serial port but virtualized 
>>>>> via USB and it has to go thru all the multiple layers of 
>>>>> abstraction from the application until it finally gets spit out; 
>>>>> the application code isn't even complied it's from a scripting 
>>>>> language.
>>>>>
>>>>> Using compiled C/C++ that can do system calls directly will 
>>>>> probably help but I'm also looking for ways to compress the serial 
>>>>> stream bandwidth. For 10 bit greyscale data I was thinking that 
>>>>> just something like u-law or A-law encoding could significantly 
>>>>> reduce the bandwidth without resorting to more compute-intensive 
>>>>> bespoke video compression algorithms. Primary requirement is that 
>>>>> the link needs to be very fault-tolerant and reliable for long term 
>>>>> operation
>>>>
>>>> you want a look up table like this. It might not solve all your 
>>>> problems but at least it will halve the required bit rate which 
>>>> should improve things. Note the darkness details (up to 63) are not 
>>>> compressed at all.
>>>
>>>
>>> Hi David, sorry for the delay in my reply - if you're around can you 
>>> tell me how you came up with that table? And/or how to adapt to a 
>>> different bit depth?
>>
>> A formula that will work to give the same transform approximately is:
>>
>> x = int( 0.5 + 0.998*y*(4096+y)/(4096+16*y))
>>
>> maps 0<y<1024 onto 0<x<255 linearly at first and then sort of log.
>>
>> Did it behave OK when you halved the datarate?
>>
>>
> 
> I'm testing it out this week. The requirement was the final deliverable 
> be written in C++ anyway so that was the priority and almost finished, now.

There are a whole family of such curves of the form

x = int( 0.5+k*y*(A+By)/(A+Cy))

for 0<y<Y and linear for small y and to scale by 1/N at the top end

requires

Y/N = Y*(A+BY)/(A+CY)

A+CY = AN+NBY

hence C = (N-1)A/Y + NB

Making A bigger extends linearity at the low end, increasing C extends 
linearity at the high end.

Beware of C<-1 where it isn't monotonic any more.

> The client's own scripting-language template for what they want was 
> kinda kludge-y it's been re-written in a modular way such that it's easy 
> to "plug-in" various encodings and compression schemes to test

The simplest one would be to drop the most significant byte. TBH I'm 
surprised a scripting language can keep up with a video stream at all.

-- 
Regards,
Martin Brown

Back to sci.electronics.design | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Video data compression for serial link bitrex <user@example.net> - 2019-04-28 15:11 -0400
  Re: Video data compression for serial link whit3rd <whit3rd@gmail.com> - 2019-04-28 13:12 -0700
  Re: Video data compression for serial link Hul Tytus <ht@panix.com> - 2019-04-28 20:25 +0000
    Re: Video data compression for serial link bitrex <user@example.net> - 2019-04-28 16:31 -0400
      Re: Video data compression for serial link Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2019-04-29 14:16 +0300
  Re: Video data compression for serial link gnuarm.deletethisbit@gmail.com - 2019-04-29 04:10 -0700
    Re: Video data compression for serial link bitrex <user@example.net> - 2019-04-29 13:04 -0400
      Re: Video data compression for serial link Joe Chisolm <jchisolm6@earthlink.net> - 2019-04-29 13:20 -0500
      Re: Video data compression for serial link dplatt@coop.radagast.org (Dave Platt) - 2019-04-29 11:21 -0700
        Re: Video data compression for serial link DecadentLinuxUserNumeroUno@decadence.org - 2019-04-29 18:56 +0000
          Re: Video data compression for serial link DecadentLinuxUserNumeroUno@decadence.org - 2019-04-29 19:13 +0000
          Re: Video data compression for serial link Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2019-04-29 22:41 +0300
            Re: Video data compression for serial link DecadentLinuxUserNumeroUno@decadence.org - 2019-04-30 00:53 +0000
              Re: Video data compression for serial link Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2019-04-30 10:24 +0300
                Re: Video data compression for serial link DecadentLinuxUserNumeroUno@decadence.org - 2019-04-30 09:59 +0000
                Re: Video data compression for serial link Rick C <gnuarm.deletethisbit@gmail.com> - 2019-05-08 17:59 -0700
                Re: Video data compression for serial link dplatt@coop.radagast.org (Dave Platt) - 2019-05-09 10:42 -0700
                Re: Video data compression for serial link upsidedown@downunder.com - 2019-05-09 06:56 +0300
          Re: Video data compression for serial link dplatt@coop.radagast.org (Dave Platt) - 2019-04-29 12:58 -0700
            Re: Video data compression for serial link bitrex <user@example.net> - 2019-04-29 16:33 -0400
              Re: Video data compression for serial link dplatt@coop.radagast.org (Dave Platt) - 2019-04-30 18:02 -0700
                Re: Video data compression for serial link bitrex <user@example.net> - 2019-04-30 21:13 -0400
                Re: Video data compression for serial link Lasse Langwadt Christensen <langwadt@fonz.dk> - 2019-04-30 18:32 -0700
            Re: Video data compression for serial link DecadentLinuxUserNumeroUno@decadence.org - 2019-04-30 00:59 +0000
              Re: Video data compression for serial link Lasse Langwadt Christensen <langwadt@fonz.dk> - 2019-04-29 18:27 -0700
      Re: Video data compression for serial link Martin Brown <'''newspam'''@nezumi.demon.co.uk> - 2019-04-30 10:22 +0100
        Re: Video data compression for serial link bitrex <user@example.net> - 2019-04-30 12:20 -0400
        Re: Video data compression for serial link upsidedown@downunder.com - 2019-04-30 20:19 +0300
          Re: Video data compression for serial link DecadentLinuxUserNumeroUno@decadence.org - 2019-04-30 22:04 +0000
            Re: Video data compression for serial link whit3rd <whit3rd@gmail.com> - 2019-04-30 16:30 -0700
              Re: Video data compression for serial link Martin Brown <'''newspam'''@nezumi.demon.co.uk> - 2019-05-01 08:49 +0100
                Re: Video data compression for serial link bitrex <user@example.net> - 2019-05-01 10:28 -0400
  Re: Video data compression for serial link upsidedown@downunder.com - 2019-04-30 13:50 +0300
  Re: Video data compression for serial link david eather <eatDELETEher@tpg.com.au> - 2019-05-01 13:45 +1000
    Re: Video data compression for serial link bitrex <user@example.net> - 2019-05-08 16:57 -0400
      Re: Video data compression for serial link Martin Brown <'''newspam'''@nezumi.demon.co.uk> - 2019-05-08 22:22 +0100
        Re: Video data compression for serial link bitrex <user@example.net> - 2019-05-08 22:09 -0400
          Re: Video data compression for serial link bitrex <user@example.net> - 2019-05-08 22:11 -0400
          Re: Video data compression for serial link Martin Brown <'''newspam'''@nezumi.demon.co.uk> - 2019-05-09 08:44 +0100
            Re: Video data compression for serial link bitrex <user@example.net> - 2019-05-09 10:41 -0400
            Re: Video data compression for serial link bitrex <user@example.net> - 2019-05-09 10:52 -0400
        Re: Video data compression for serial link david eather <eatDELETEher@tpg.com.au> - 2019-05-10 14:30 +1000
          Re: Video data compression for serial link jrwalliker@gmail.com - 2019-05-10 04:30 -0700
            Re: Video data compression for serial link Martin Brown <'''newspam'''@nezumi.demon.co.uk> - 2019-05-14 11:17 +0100
              Re: Video data compression for serial link upsidedown@downunder.com - 2019-05-14 14:51 +0300
                Re: Video data compression for serial link Martin Brown <'''newspam'''@nezumi.demon.co.uk> - 2019-05-14 13:45 +0100

csiph-web