Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > sci.electronics.design > #541278
| Subject | Re: Video data compression for serial link |
|---|---|
| Newsgroups | sci.electronics.design |
| References | <XVmxE.157951$bA.69332@fx26.iad> <c68b44e2-829b-4710-8027-5b8293847386@googlegroups.com> <B8GxE.398358$oy5.350898@fx06.iad> <qa943s$67m$1@gioia.aioe.org> |
| From | bitrex <user@example.net> |
| Message-ID | <MB_xE.1039424$VB3.619629@fx45.iad> (permalink) |
| Organization | frugalusenet - www.frugalusenet.com |
| Date | 2019-04-30 12:20 -0400 |
On 4/30/19 5:22 AM, Martin Brown wrote: > On 29/04/2019 18:04, bitrex wrote: >> On 4/29/19 7:10 AM, gnuarm.deletethisbit@gmail.com wrote: >>> On Sunday, April 28, 2019 at 3:11:55 PM UTC-4, 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. > > Windoze is nothing like an RTOS and has always been dodgy at fast serial > data since forever. My money is on a FIFO buffer overflow whilst the PC > is off doing something "more important" - screen updating or disk IO. >>>> >>>> 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 >>> >>> What does "unstable" mean? Do you loose data or are there simply >>> variable delays? Do you buffer up data in the CPU for display? I >>> would think you'd want to understand the problem before you try to >>> find a cure. >> >> The KISS communication implementation works perfectly fine for a while >> and then both the uP and PC app lock and it fails utterly. >> transmission stops. annoying problem to diagnose. Logging the data on >> the link doesn't show anything unusual just prior to it happening. > > OK the first thing to try is drop the most significant bytes entirely > and live with bullseye effects on the highlights to see if as a proof of > concept halving the volume of data will bring it back under control. > > If that works then you have two basic KISS choices: > > Transform the 10 bit data into 8 bit data using a lookup table > > y' = INT(8*sqrt(y)+0.5) would do for a start > > Or since you know you must have an average step of 4 and have 1024 > levels to transform into 256 output levels choose something like > > if (y<65) y' = y > else y' = A + (y-64)/5 > > As a piecewise linear approximation to a nonlinear tranform that > preserves all the dynamic range at the low end at the expense of > highlight detail. Better approximations are available and you might want > to think carefully about rounding rules to preserve details. > > The other option if you have a bit more time to spare on the encoding > side is for each line OR the high bytes together and based on that > result send a scaled version and a tag in the line CRC to say whether > the line scaling is 1x, 2x or 4x. > >> About all I can say at this point is that it doesn't happen (at least >> not over the course of a day's runtime) at lower data rates. And that >> since the transmission is only one-way I don't see any good reason for >> the PC application to lock up other than the issue originating on that >> side of things. > > How locked up it is? Is it just the user application that is > unresponsive or has the thing really gone AWOL inside a driver? > > How fast are you running the serial link? > >>> I don't think the eye has the same sensitivity to light as the ear >>> does to sound. uLaw works by approximating a log relationship which >>> matches human sensitivity to sound. More resolution is given to soft >>> sounds extending the effective number of bits than what is transmitted. >> >> all human senses are more-or-less logarithmic in response. the >> difference in actual brightness between walking outside into a bright >> spring morning like today, from say an office lit in a usual >> office-way with ceiling fluorescents is like, a million times brighter >> outside (sorry not really an optics-guy I don't know the appropriate >> unit to use, here.) but we don't go blind >> >>> If you are convinced the problem is too high bandwidth, I agree with >>> Hul, you are adding 6 bits of overhead by having empty bits on each >>> word. With Hul's packing you can shove the CRC and a sync bit into a >>> 32 bit word and get a 60% bandwidth increase. If you need to, do the >>> data reshuffling and CRC check in a small FPGA and present the CPU a >>> FIFO interface via SPI like signals where the overhead isn't important. >>> >> >> In any case it was just an idea on how two bytes of data could be >> stuffed into one, in fact since the data is only 10 bits I'd first >> just try right shifting 2 on the way out then left shifting on reception. >> >> It may be that the re-write of the transmission code in C solves the >> immediate problem so some of my request is just for my reference if >> further optimization should be necessary. Byte-packing, at the very >> least, doesn't seem like premature optimization regardless. > > I think making the transmission code go even faster will almost > certainly make things worse if the problem is due to buffer overflow in > the PC end serial receiver. >> >> I've been doing a CRC for each line rather than each frame as the >> client doesn't need pixel-by-pixel correctness, if a line is wrong >> then just dump it and wait for the next frame. > > Quick and dirty test is send only the least significant byte and see if > that ever locks up. At least then you have a working baseline again. > > The other trick might be to run the PC side in a debugger and hope to > catch the trap inside the errant driver. There may be options on the > fake serial implementation driver to make its IO buffers deeper. > > Good serial drivers are possible on a PC but not in Windoze. The OS/2 > serial driver was capable of implementing full 16550 hardware FIFO > behaviour on the crudest bare metal original stone age serial ports. > Thank you Martin, you have good suggestions here that will take me some time to explore but I'll update when I have more answers. The good news is this design will be talking to Macs or Linux machines only - no Windows here.
Back to sci.electronics.design | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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