AR0331
www.onsemi.com
21
Table 9. COMPANDING TABLE
Segment 1 Segment 2 Segment 3 Segment 4
Input Code Range 0 to 1023 1024 to 4095 4096 to 32767 32768 to 65535
Output Code
Range
0 to 1023 1024 to 2559 2560 to 3455 3456 to 3967
Companding
Formula
P
out
= P
in
P
out
= (P
in
− 1024)/2 + 1024 P
out
= (P
in
− 4096)/32 + 2560 P
out
= (P
in
− 32768)/64 + 3456
Decompanding
Formula
P
out
= P
in
P
out
= (P
in
− 1024)*2 + 1024 P
out
= (P
in
− 2560)*32 + 4096 P
out
= (P
in
− 3456)*64 + 32768
Table 9 illustrates the input and output codes as well as
companding and decompanding formulas for each of the
four colored segments in Figure 19.
Table 10. KNEE POINTS FOR COMPRESSION FROM 16 BITS TO 12 BITS
T1/T2
Exposure Ratio
(R1)
R0x3082[3:2]
P1
POUT1
= P1
P2
POUT2=
(P2 − P1)/2 + 1024
P3
POUT3=
(P3 − P2)/32 + 2560
PMAX
POUTMAX =
(PMAX − P3)/64 + 3456
4x, 8x, 16x, 32x
2
10
1024 2
12
2560
2
15
3456
2
16
3968
As described in Table 10, the AR0331 companding block
operates on 16-bit input only. For the exposure ratios that do
not result in 16-bits, bit shifting occurs before the data enters
the companding block. As a result of the bit shift, data needs
to be unshifted after linearization in order to obtain the
proper image. Table 11 provides the bit operation that
should occur to the data after linearization.
Table 11. BIT OPERATION AFTER LINEARIZATION
ratio_t1_t2 (R0x3082[3:2])/ratio_t1_t2_cb (R0x3084[3:2]) Bit Shift Operation after Linearization
4x Right Shift 2 Bits
8x Right Shift 1 Bit
16x No Shift
32x Left Shift 1 Bit
HDR-Specific Exposure Settings
In HDR mode, pixel values are stored in line buffers while
waiting for both exposures to be available for final pixel data
combination. There are 70 line buffers used to store
intermediate T1 data. Due to this limitation, the maximum
coarse integration time possible for a given exposure ratio is
equal to 70*T1/T2 lines.
For example, if R0x3082[3:2] = 2, the sensor is set to have
T1/T2 ratio = 16x. Therefore the maximum number of
integration lines is 70*16 = 1120 lines. If coarse integration
time is greater than this, the T2 integration time will stay at
70. The sensor will calculate the ratio internally, enabling the
linearization to be performed. If companding is being used,
then relinearization would still follow the programmed
ratio. For example if the T1/T2 ratio was programmed to 16x
but coarse integration was increased beyond 1120 then one
would still use the 16x relinearization formulas.
An additional limitation is the maximum number of
exposure lines in relation to the frame_length_lines register.
In linear mode, maximum coarse_integration_time =
frame_length_lines − 1. However in HDR mode, since the
coarse integration time register controls T1, the max coarse
integration time is frame_length_lines − 71.
Putting the two criteria listed above together, the formula
is as follows:
maximum coarse_integration_time + minimum(70
T1
T2
, frame_length_lines–71) (eq. 2)
There is a limitation of the minimum number of exposure
lines, which is one row time for linear mode. In HDR mode,
the minimum number of rows required is half of the ratio
T1/T2.