📄 umc_dv_decoder_tables.cpp
字号:
0x0170, 2, 7, 0x0171, 2, -7,
0x0172, 2, 8, 0x0173, 2, -8,
0x0174, 2, 9, 0x0175, 2, -9,
0x0176, 2, 10, 0x0177, 2, -10,
0x0178, 2, 11, 0x0179, 2, -11,
0x017a, 1, 15, 0x017b, 1, -15,
0x017c, 1, 16, 0x017d, 1, -16,
0x017e, 1, 17, 0x017f, 1, -17,
/* Combinations (0,0) through (6,0) have special codes.
They are filled to handle errors in a DV stream */
0x0180 + 0, 0, 0, 0x0180 + 1, 0, 0,
0x0180 + 2, 2, 0, 0x0180 + 3, 3, 0,
0x0180 + 4, 4, 0, 0x0180 + 5, 5, 0,
0x0180 + 6, 6, 0, 0x0180 + 7, 7, 0, 0x0180 + 8, 8, 0, 0x0180 + 9, 9, 0,/* 1 */
0x0180 + 10, 10, 0, 0x0180 + 11, 11, 0, 0x0180 + 12, 12, 0, 0x0180 + 13, 13, 0,/* 2 */
0x0180 + 14, 14, 0, 0x0180 + 15, 15, 0, 0x0180 + 16, 16, 0, 0x0180 + 17, 17, 0,/* 3 */
0x0180 + 18, 18, 0, 0x0180 + 19, 19, 0, 0x0180 + 20, 20, 0, 0x0180 + 21, 21, 0,/* 4 */
0x0180 + 22, 22, 0, 0x0180 + 23, 23, 0, 0x0180 + 24, 24, 0, 0x0180 + 25, 25, 0,/* 5 */
0x0180 + 26, 26, 0, 0x0180 + 27, 27, 0, 0x0180 + 28, 28, 0, 0x0180 + 29, 29, 0,/* 6 */
0x0180 + 30, 30, 0, 0x0180 + 31, 31, 0, 0x0180 + 32, 32, 0, 0x0180 + 33, 33, 0,/* 7 */
0x0180 + 34, 34, 0, 0x0180 + 35, 35, 0, 0x0180 + 36, 36, 0, 0x0180 + 37, 37, 0,/* 8 */
0x0180 + 38, 38, 0, 0x0180 + 39, 39, 0, 0x0180 + 40, 40, 0, 0x0180 + 41, 41, 0,/* 9 */
0x0180 + 42, 42, 0, 0x0180 + 43, 43, 0, 0x0180 + 44, 44, 0, 0x0180 + 45, 45, 0,/* 10 */
0x0180 + 46, 46, 0, 0x0180 + 47, 47, 0, 0x0180 + 48, 48, 0, 0x0180 + 49, 49, 0,/* 11 */
0x0180 + 50, 50, 0, 0x0180 + 51, 51, 0, 0x0180 + 52, 52, 0, 0x0180 + 53, 53, 0,/* 12 */
0x0180 + 54, 54, 0, 0x0180 + 55, 55, 0, 0x0180 + 56, 56, 0, 0x0180 + 57, 57, 0,/* 13 */
0x0180 + 58, 58, 0, 0x0180 + 59, 59, 0, 0x0180 + 60, 60, 0, 0x0180 + 61, 61, 0,/* 14 (14*4=56) */
/* We fill these codes as well to handle errors in a DV stream */
0x0180 + 62, 62, 0, 0x0180 + 63, 63, 0,
-1 /* end of table */
};
static Ipp32u lineTable[ ]=
{ //0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 3, 3, 4, 4, 5, 5,
5, 5, 4, 4, 3, 3, 2, 2, 1, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, // V
7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 0, 0, 0, 0,
//0, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8,
8, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 0,
//0, 0, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8
// 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 0, 0
13, 12, 12, 8, 8, 11, 11, 6, 6, 5, 5, 4, 4, 10, 9, 9
};
Ipp32s DVVideoDecoder::DVCreateADequantizeTable()
{
Ipp16u lpBuffer[14 *64], *lpBuffer1;
Ipp32s i,j;
/* this pretty table was designed to
avoid coincidencies with any GPL code */
Ipp32u tabl1[] =
{
0,
1,
8, 16, 9, 2, 3, 10, 17,
24, 32, 25, 18, 11,
4, 5, 12, 19, 26,
33, 40, 48, 41, 34,
27, 20, 13, 6, 7,
14, 21, 28, 35, 42,
49, 56, 57, 50, 43,
36, 29, 22, 15, 23, 30, 37,
44, 51, 58,
59, 52, 45,
38, 31, 39,
46, 53, 60,
61, 54, 47,
55, 62, 63
};
Ipp32u tabl2[] =
{
0,
32,
1, 33, 8, 40, 2, 34, 9,
41, 16, 48, 24, 56,
17, 49, 10, 42, 3,
35, 4, 36, 11, 43,
18, 50, 25, 57, 26,
58, 19, 51, 12, 44,
5, 37, 6, 38, 13,
45, 20, 52, 27, 59, 28, 60,
21, 53, 14,
46, 7, 39,
15, 47, 22,
54, 29, 61,
30, 62, 23,
55, 31, 63
};
static Ipp64f TablW0[] =
{
(0.5/*2500076*/),(_W0*_W1/2),(_W0*_W2/2),(_W0*_W3/2),(_W0*_W4/2),(_W0*_W5/2),(_W0*_W6/2),(_W0*_W7/2),
(_W1*_W0/2),(_W1*_W1/2),(_W1*_W2/2),(_W1*_W3/2),(_W1*_W4/2),(_W1*_W5/2),(_W1*_W6/2),(_W1*_W7/2),
(_W2*_W0/2),(_W2*_W1/2),(_W2*_W2/2),(_W2*_W3/2),(_W2*_W4/2),(_W2*_W5/2),(_W2*_W6/2),(_W2*_W7/2),
(_W3*_W0/2),(_W3*_W1/2),(_W3*_W2/2),(_W3*_W3/2),(_W3*_W4/2),(_W3*_W5/2),(_W3*_W6/2),(_W3*_W7/2),
(_W4*_W0/2),(_W4*_W1/2),(_W4*_W2/2),(_W4*_W3/2),(_W4*_W4/2),(_W4*_W5/2),(_W4*_W6/2),(_W4*_W7/2),
(_W5*_W0/2),(_W5*_W1/2),(_W5*_W2/2),(_W5*_W3/2),(_W5*_W4/2),(_W5*_W5/2),(_W5*_W6/2),(_W5*_W7/2),
(_W6*_W0/2),(_W6*_W1/2),(_W6*_W2/2),(_W6*_W3/2),(_W6*_W4/2),(_W6*_W5/2),(_W6*_W6/2),(_W6*_W7/2),
(_W7*_W0/2),(_W7*_W1/2),(_W7*_W2/2),(_W7*_W3/2),(_W7*_W4/2),(_W7*_W5/2),(_W7*_W6/2),(_W7*_W7/2)
};
static Ipp64f TablW1[] =
{
(0.5/*2500076*/),(_W0*_W1/2),(_W0*_W2/2),(_W0*_W3/2),(_W0*_W4/2),(_W0*_W5/2),(_W0*_W6/2),(_W0*_W7/2),
(_W2*_W0/2),(_W2*_W1/2),(_W2*_W2/2),(_W2*_W3/2),(_W2*_W4/2),(_W2*_W5/2),(_W2*_W6/2),(_W2*_W7/2),
(_W4*_W0/2),(_W4*_W1/2),(_W4*_W2/2),(_W4*_W3/2),(_W4*_W4/2),(_W4*_W5/2),(_W4*_W6/2),(_W4*_W7/2),
(_W6*_W0/2),(_W6*_W1/2),(_W6*_W2/2),(_W6*_W3/2),(_W6*_W4/2),(_W6*_W5/2),(_W6*_W6/2),(_W6*_W7/2),
(_W0*_W0/2),(_W0*_W1/2),(_W0*_W2/2),(_W0*_W3/2),(_W0*_W4/2),(_W0*_W5/2),(_W0*_W6/2),(_W0*_W7/2),
(_W2*_W0/2),(_W2*_W1/2),(_W2*_W2/2),(_W2*_W3/2),(_W2*_W4/2),(_W2*_W5/2),(_W2*_W6/2),(_W2*_W7/2),
(_W4*_W0/2),(_W4*_W1/2),(_W4*_W2/2),(_W4*_W3/2),(_W4*_W4/2),(_W4*_W5/2),(_W4*_W6/2),(_W4*_W7/2),
(_W6*_W0/2),(_W6*_W1/2),(_W6*_W2/2),(_W6*_W3/2),(_W6*_W4/2),(_W6*_W5/2),(_W6*_W6/2),(_W6*_W7/2),
};
// clear returned pointer (may be error occurs)
m_lpADequantizeLineTable = NULL;
m_lpADequantizeTable = NULL;
// alloc aligned memory
if( m_pMemoryAllocator->Alloc(&m_DequantizeTableMID,
SIZE_TABLE_A_DEQUANTIZE * 2,
UMC_ALLOC_PERSISTENT,
16) != UMC_OK)
return UMC_ERR_ALLOC;
lpBuffer1 = (Ipp16u*)m_pMemoryAllocator->Lock(m_DequantizeTableMID);
if(lpBuffer1 == NULL)
return UMC_ERR_ALLOC;
// fill adaptive dequantization values (see blue book)
INIT_A_D_E( 0, 1, 1, 1, 1)
INIT_A_D_E( 1, 1, 1, 1, 2)
INIT_A_D_E( 2, 1, 1, 2, 2)
INIT_A_D_E( 3, 1, 2, 2, 4)
INIT_A_D_E( 4, 2, 2, 4, 4)
INIT_A_D_E( 5, 2, 4, 4, 8)
INIT_A_D_E( 6, 4, 4, 8, 8)
INIT_A_D_E( 7, 4, 8, 8, 16)
INIT_A_D_E( 8, 8, 8, 16, 16)
INIT_A_D_E( 9, 2, 2, 2, 2)//0
INIT_A_D_E( 10, 2, 2, 2, 4)//1
//2- 4
//3- 5
//4- 6
INIT_A_D_E( 11, 4, 8, 8, 16)//5
//6- 8
INIT_A_D_E( 12, 8, 16, 16, 32)//7
INIT_A_D_E( 13, 16, 16, 32, 32)//8
for(j=0;j<14;j++)
for(i=0;i<64;i++)
lpBuffer1[j * 64 + tabl1[i]] = (Ipp16u) (lpBuffer[j* 64 + i] * (Ipp32s)(((Ipp64f) (1 << 8)) / TablW0[tabl1[i]]));
for( j=0;j<14;j++)
for(i=0;i<64;i++)
lpBuffer1[64 * 14 + j * 64 + tabl2[i]] = (Ipp16u) (lpBuffer[j* 64 + i]*(Ipp32s)(((Ipp64f) (1 << 8 )) / TablW1[tabl2[i]]));
m_pMemoryAllocator->Unlock(m_DequantizeTableMID);
m_lpADequantizeLineTable = lineTable;
return 0;
} //Ipp32s DVCreateADequantizeTable(Ipp32u **m_lpADequantizeTable)
/* this pretty table was designed to
avoid coincidences with any GPL code */
Ipp32u DVVideoDecoder::_INTERNAL_DEZIGZAG_TABLE_0[] =
{
0,
1,
8, 16, 9, 2, 3, 10, 17,
24, 32, 25, 18, 11,
4, 5, 12, 19, 26,
33, 40, 48, 41, 34,
27, 20, 13, 6, 7,
14, 21, 28, 35, 42,
49, 56, 57, 50, 43,
36, 29, 22, 15, 23, 30, 37,
44, 51, 58,
59, 52, 45,
38, 31, 39,
46, 53, 60,
61, 54, 47,
55, 62, 63,
0, 32, 1, 33, 8, 40, 2, 34,
9, 41, 16, 48, 24, 56, 17, 49,
10, 42, 3, 35, 4, 36, 11, 43,
18, 50, 25, 57, 26, 58, 19, 51,
12, 44, 5, 37, 6, 38, 13, 45,
20, 52, 27, 59, 28, 60, 21, 53,
14, 46, 7, 39, 15, 47, 22, 54,
29, 61, 30, 62, 23, 55, 31, 63
};
#undef INIT_A_D_E
#undef SIZE_TABLE_A_DEQUANTIZE
#undef _INTERNAL_CS1
#undef _INTERNAL_CS2
#undef _INTERNAL_CS3
#undef _INTERNAL_CS4
#undef _INTERNAL_CS5
#undef _INTERNAL_CS6
#undef _INTERNAL_CS7
#undef _W0
#undef _W1
#undef _W2
#undef _W3
#undef _W4
#undef _W5
#undef _W6
#undef _W7
} // end namespace UMC
#endif //(UMC_ENABLE_DV_VIDEO_DECODER)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -