2x2的DC变换公式为: 
//
// dc_dct = | 1  1| * dc_diff * | 1  1|
//          | 1 -1|       | 1 -1|
//
static void dct2x2dc( int16_t d[2][2] )
{
    int tmp[2][2];
    tmp[0][0] = d[0][0] + d[0][1];
    tmp[1][0] = d[0][0] - d[0][1];
    tmp[0][1] = d[1][0] + d[1][1];
    tmp[1][1] = d[1][0] - d[1][1];
    d[0][0] = tmp[0][0] + tmp[0][1];
    d[0][1] = tmp[1][0] + tmp[1][1];
    d[1][0] = tmp[0][0] - tmp[0][1];
    d[1][1] = tmp[1][0] - tmp[1][1];
} 
这个是x264里面的,理解起来感觉比较麻烦 
void dct_2x2_dc(short dc_dct[2][2])
{
    short temp[2][2];
 
 // horizontal
    temp[0][0] = dc_dct[0][0] + dc_dct[0][1];
    temp[0][1] = dc_dct[0][0] - dc_dct[0][1];
    temp[1][0] = dc_dct[1][0] + dc_dct[1][1];
    temp[1][1] = dc_dct[1][0] - dc_dct[1][1];
 // vertical
    dc_dct[0][0] = temp[0][0] + temp[1][0];
    dc_dct[0][1] = temp[0][1] + temp[1][1];
    dc_dct[1][0] = temp[0][0] - temp[1][0];
    dc_dct[1][1] = temp[0][1] - temp[1][1];
}
这是我写的,理解起来是不是比较好懂? 
大家可知道他为什么那么写呢> 
			
			
			
						
			
 我要赚赏金
