5/19/2012

How to change mdp color space convert algorithm

Check http://en.wikipedia.org/wiki/YUV  and http://en.wikipedia.org/wiki/Luma_(video)#Rec._601_luma_versus_Rec._709_luma_coefficients

The floating point 3x3 matrix in wiki page is

[1  0  1.13983  1  -0.39465  -0.58060  1  2.03211  0]

And the matrix of MDP is 3x3 so we need to multiply each coeff by (1<<9)

 

1*(1<<9)= 512= 0x0200

0*(1<<9)= 0= 0x0000

1.13983*(1<<9)= 584= 0x0248

-0.39465*(1<<9)= -202= -0x00CA= 0xFF36  (2's complement in 16-bit)

……


Then

static uint32 csc_matrix_tab[9]

{0x0200, 0x0000, 0x0248, 0x0200, 0xff36, 0xfed7, 0x0200, 0x0410, 0x0000};

No comments:

Post a Comment