Link to home
Start Free TrialLog in
Avatar of naseeam
naseeamFlag for United States of America

asked on

How to use compression to change bit depth of a video signal?

I need to use compression to change bit depth of a video signal.  

Our Focal Plane Array(FPA) is Vanadium Oxide(VOx) Resistive Microbolometers Uncooled Thermal Infrared Detector.  The output of this image sensor is 14-bit, Wide Dynamic Range(WDR), raw, monochrome, 640 x 480 resolution.  The pixels of this video signal will be processed by Image Signal Processor(ISP).  ISP input is 12-bits.  Therefore, I need to compress FPA output to 12 bits and then input into ISP.

How to perform global tone mapping using two methods, PWL and LUT (curve defined by lut) based mapping.  I need to tone map 14 bit data to 12 bit.  What does PWL stand for?  Please provide sufficient information so I can achieve this.  It's suppose to be similar to gamma compression.  I can do gamma correction in matlab.  Can this tone mapping also be done in matlab?  If yes, please provide some examples.
Avatar of d-glitch
d-glitch
Flag of United States of America image

PWL means piece-wise linear, and LUT means look-up table.  There are many on-line references.

In your case, you have to come up with a function that converts a 14-bit input to a 12-bit output.

The LUT is the most flexible.  It is fast, but it takes up an enormous amount of space, 16K x 12 bit.

One common PWL technique would be logarithmic compression.  In your 14-to-12 bit case, you might choose a 9-bit mantissa and a 3-bit exponent.  This is fast to implement:
  1. Calculate the exponent by counting and truncating the first 0 thru 7 leading zeroes.
  2. Calculate the mantissa by taking the next nine bits, which may include some leading zeroes.
Avatar of naseeam

ASKER

global tone mapping can be done using Two methods as follows:
1.  PWL
2.  LUT(curve defined by lut) based mapping

I know  I have to come up with a function or algorithm.  I was told it is similar to gamma correction.  I can do gamma correction in matlab but
how I can learn to do what I need to do?


>> One common PWL technique would be logarithmic compression
I don't get it.  output of my infrared sensor is 14-bit non-negative integers.   And you are asking me to map to 12-bit floating point.  The ISP that is going to treat 12-bit binary numbers as non-negative integers.
Log compression maps 14-bit non-negative integers to 12-bit non-negative integers.  It is computationally fast bit manipulation that trades size for resolution.  It de-emphasizes small differences between larger values and preserves small differences between small values.
Binary logs and exponents are not floating point functions.

Mantissa in bold on the left.  Exponent in bold on the right.
===============================================================================
11 1111 1110 0000   thru   11 1111 1111 1111   all map to    000 1111111   [32 values]
00 1111 1111 1000   thru   00 1111 1111 1111   all map to    010 1111111    [8 values]
00 0000 1111 1110                                                      maps to    101 0111110    [1 value]

Note that the simplest 14- to 12-bit PWL mapping is just dropping the two LSB's.
Avatar of naseeam

ASKER

11 1111 1110 0000(16,352)  thru  11 1111 1111 1111(16,383)  all map to 000 1111111(127)  ?

I didn't understand how mantissa and exponent operate in your example?

>> Note that the simplest 14- to 12-bit PWL mapping is just dropping the two LSB's.
The sensor manufacturer says if we drop two LSB's, Noise Equivalent Temperature Difference(NETD) will increase by a factor of 4.
I was not suggesting that drop two bits.  That was just an example of a possible PWL algorithm.

Have you asked vendor about log compression?   They will probably tell you it's the best you can do.  These are the techniques NASA used in the Pioneer missions in the 1970's.  

How are you going to implement this compression?  Microprocessors, CPLD's, or DSP's?  Parallel or serial?  What ISP are you using?  Why are you limited to 12 bits?  What are the requirements of the entire system?
ASKER CERTIFIED SOLUTION
Avatar of d-glitch
d-glitch
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of naseeam

ASKER

Expert continuously answered follow-up questions.  Great responses.

>> Have you asked vendor about log compression?
Not yet.  

>> How are you going to implement this compression?
In 'C' programming language

>> What ISP are you using?
ISP inside TI DM505 chip

>> Why are you limited to 12 bits?
ISP Hardware limitation.  ISP in linear mode accepts up to 12-bit input.