About formula of color space conversion in i.MX6DQ

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

About formula of color space conversion in i.MX6DQ

475 Views
keitanagashima
Senior Contributor I

Dear All,

Hello. Refer to "37.4.9.5 Color Space Conversion unit - CSC" in MCIMX6DQRM(Rev.2).

Could you explain below formula?

(I couldn't understand the below formula.)

===========

A more explicit formula:

S[i] = (sum(A[i][j]*In[j]) >> 4) + (B[i] << 2) + (1 << (3-E[i]))

Out[i] = Clip(S[i] >> 4-E[i])

===========

Best Regards,

Keita

Labels (3)
0 Kudos
2 Replies

350 Views
art
NXP Employee
NXP Employee

Let's assume the RGB -> YUV conversion.

So, the Section 37.4.9.5 says that the main operation in the color space conversion procedure is the multiplication of the 3x3 color conversion coefficients matrix to the input pixel that is represented as (R G B) 3-dimensional vector and following addition of 3-dimensional vector of offsets.

So, the meanings of the formula components are as follows.

i and j  are the summing indexes that vary e.g. from 1 to 3.

A[i][j] are the color conversion coefficients, so, the matrix looks as follows.

A[1][1] = CSC_A0    A[1][2] = CSC_A1    A[1][3] = CSC_A2

A[2][1] = CSC_A3    A[2][2] = CSC_A4    A[2][3] = CSC_A5

A[3][1] = CSC_A6    A[3][2] = CSC_A7    A[3][3] = CSC_A8

As the Section 37.4.9.5 says, each CSC_Ax coefficient is 10-bit signed number with 8 fractional digits.

In[j] are the components of input pixel, here In[1] is R component, In[2] is G component and In[3] is B component. Each component is 8-bit unsigned integer value.

B[i] are the components of offset vector, here B[1] = CSC_B0, B[2] = CSC_B1 and B[3] = CSC_B2.

As the Section 37.4.9.5 says, each CSC_Bx coefficient is 14-bit signed number with 2 fractional

digits.

E[i] are the components of scale factors vector, here E[1] = CSC_S0, E[2] = CSC_S1 and E[3] = CSC_S2. Each scale factor can take the values of 0, 1, 2 or -1 and is encoded by 2 bits.

S[i] are the components of intermediate sum vector.

Out[i] are the components of the output pixel. Assuming RGB -> YUV conversion, Out[1] is Y component, Out[2] is U component and Out[3] is V component.

Clip() operation means clipping the argument to 8-bit unsigned integer value.

>> and << operations mean right and left bit shifting operations, correspondingly, to the specified number of bits.


Have a great day,
Artur

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

350 Views
keitanagashima
Senior Contributor I

Dear Artur,

Hello. Sorry for my delay reply.

I couldn't understand about meaning of shifted ">> 4", "<< 2" and "<< (3-E[i])".

Could you explain the shifted meaning?

Best Regards,

Keita

0 Kudos