// initialize ROM variables Void initROM() { Int i, c; // g_aucConvertToBit[ x ]: log2(x/4), if x=4 -> 0, x=8 -> 1, x=16 -> 2, ... ::memset( g_aucConvertToBit, -1, sizeof( g_aucConvertToBit ) ); c=0; for ( i=4; i<MAX_CU_SIZE; i*=2 ) { g_aucConvertToBit[ i ] = c; c++; } g_aucConvertToBit[ i ] = c; // g_auiFrameScanXY[ g_aucConvertToBit[ transformSize ] ]: zigzag scan array for transformSize c=2; for ( i=0; i<MAX_CU_DEPTH; i++ ) { #if !REMOVE_ZIGZAG_SCAN g_auiFrameScanXY[ i ] = new UInt[ c*c ]; g_auiFrameScanX [ i ] = new UInt[ c*c ]; g_auiFrameScanY [ i ] = new UInt[ c*c ]; initFrameScanXY( g_auiFrameScanXY[i], g_auiFrameScanX[i], g_auiFrameScanY[i], c, c ); #endif g_auiSigLastScan[0][i] = new UInt[ c*c ]; g_auiSigLastScan[1][i] = new UInt[ c*c ]; g_auiSigLastScan[2][i] = new UInt[ c*c ]; g_auiSigLastScan[3][i] = new UInt[ c*c ]; initSigLastScan( g_auiSigLastScan[0][i], g_auiSigLastScan[1][i], g_auiSigLastScan[2][i], g_auiSigLastScan[3][i], c, c, i); c <<= 1; } #if !REMOVE_NSQT g_sigScanNSQT[0] = new UInt[ 64 ]; // 4x16 g_sigScanNSQT[1] = new UInt[ 256 ]; // 8x32 g_sigScanNSQT[2] = new UInt[ 64 ]; // 16x4 g_sigScanNSQT[3] = new UInt[ 256 ]; // 32x8 static int diagScanX[ 16 ] = { 0, 0, 1, 0, 1, 2, 0, 1, 2, 3, 1, 2, 3, 2, 3, 3 }; static int diagScanY[ 16 ] = { 0, 1, 0, 2, 1, 0, 3, 2, 1, 0, 3, 2, 1, 3, 2, 3 }; Int j; // 4x16 scan for (i = 0; i < 4; i++) { for (j = 0; j < 16; j++) { g_sigScanNSQT[ 0 ][ 16 * i + j ] = 16 * i + 4 * diagScanY[ j ] + diagScanX[ j ]; } } // 8x32 scan for (i = 0; i < 16; i++) { Int x = g_sigCGScanNSQT[ 1 ][ i ] & 1; Int y = g_sigCGScanNSQT[ 1 ][ i ] >> 1; for (j = 0; j < 16; j++) { g_sigScanNSQT[ 1 ][ 16 * i + j ] = 32 * y + 4 * x + 8 * diagScanY[ j ] + diagScanX[ j ]; } } // 16x4 scan for (i = 0; i < 4; i++) { for (j = 0; j < 16; j++) { g_sigScanNSQT[ 2 ][ 16 * i + j ] = 4 * i + 16 * diagScanY[ j ] + diagScanX[ j ]; } } // 32x8 scan for (i = 0; i < 16; i++) { Int x = g_sigCGScanNSQT[ 3 ][ i ] & 7; Int y = g_sigCGScanNSQT[ 3 ][ i ] >> 3; for (j = 0; j < 16; j++) { g_sigScanNSQT[ 3 ][ 16 * i + j ] = 128 * y + 4 * x + 32 * diagScanY[ j ] + diagScanX[ j ]; } } #endif }
// initialize ROM variables Void initROM() { Int i, c; // g_aucConvertToBit[ x ]: log2(x/4), if x=4 -> 0, x=8 -> 1, x=16 -> 2, ... ::memset( g_aucConvertToBit, -1, sizeof( g_aucConvertToBit ) ); c=0; for ( i=4; i<MAX_CU_SIZE; i*=2 ) { g_aucConvertToBit[ i ] = c; c++; } g_aucConvertToBit[ i ] = c; // g_auiFrameScanXY[ g_aucConvertToBit[ transformSize ] ]: zigzag scan array for transformSize c=2; for ( i=0; i<MAX_CU_DEPTH; i++ ) { g_auiFrameScanXY[ i ] = new UInt[ c*c ]; g_auiFrameScanX [ i ] = new UInt[ c*c ]; g_auiFrameScanY [ i ] = new UInt[ c*c ]; initFrameScanXY( g_auiFrameScanXY[i], g_auiFrameScanX[i], g_auiFrameScanY[i], c, c ); g_auiSigLastScan[0][i] = new UInt[ c*c ]; g_auiSigLastScan[1][i] = new UInt[ c*c ]; g_auiSigLastScan[2][i] = new UInt[ c*c ]; #if DIAG_SCAN g_auiSigLastScan[3][i] = new UInt[ c*c ]; initSigLastScan( g_auiSigLastScan[0][i], g_auiSigLastScan[1][i], g_auiSigLastScan[2][i], g_auiSigLastScan[3][i], c, c, i); #else initSigLastScan( g_auiSigLastScan[0][i], g_auiSigLastScan[1][i], g_auiSigLastScan[2][i], c, c, i); #endif c <<= 1; } #if NSQT_DIAG_SCAN g_sigScanNSQT[0] = new UInt[ 64 ]; // 4x16 g_sigScanNSQT[1] = new UInt[ 256 ]; // 8x32 g_sigScanNSQT[2] = new UInt[ 64 ]; // 16x4 g_sigScanNSQT[3] = new UInt[ 256 ]; // 32x8 static int diagScanX[ 16 ] = { 0, 0, 1, 0, 1, 2, 0, 1, 2, 3, 1, 2, 3, 2, 3, 3 }; static int diagScanY[ 16 ] = { 0, 1, 0, 2, 1, 0, 3, 2, 1, 0, 3, 2, 1, 3, 2, 3 }; Int j; // 4x16 scan for (i = 0; i < 4; i++) { for (j = 0; j < 16; j++) { g_sigScanNSQT[ 0 ][ 16 * i + j ] = 16 * i + 4 * diagScanY[ j ] + diagScanX[ j ]; } } // 8x32 scan for (i = 0; i < 16; i++) { Int x = g_sigCGScanNSQT[ 1 ][ i ] & 1; Int y = g_sigCGScanNSQT[ 1 ][ i ] >> 1; for (j = 0; j < 16; j++) { g_sigScanNSQT[ 1 ][ 16 * i + j ] = 32 * y + 4 * x + 8 * diagScanY[ j ] + diagScanX[ j ]; } } // 16x4 scan for (i = 0; i < 4; i++) { for (j = 0; j < 16; j++) { g_sigScanNSQT[ 2 ][ 16 * i + j ] = 4 * i + 16 * diagScanY[ j ] + diagScanX[ j ]; } } // 32x8 scan for (i = 0; i < 16; i++) { Int x = g_sigCGScanNSQT[ 3 ][ i ] & 7; Int y = g_sigCGScanNSQT[ 3 ][ i ] >> 3; for (j = 0; j < 16; j++) { g_sigScanNSQT[ 3 ][ 16 * i + j ] = 128 * y + 4 * x + 32 * diagScanY[ j ] + diagScanX[ j ]; } } #else #if NSQT #if NSQT_TX_ORDER UInt uiWidth[ 4 ] = { 16, 32, 4, 8 }; UInt uiHeight[ 4 ] = { 4, 8, 16, 32 }; for ( i = 0; i < 4; i++ ) #else UInt uiWidth[ 2 ] = { 16, 32 }; UInt uiHeight[ 2 ] = { 4, 8 }; for ( i = 0; i < 2; i++ ) #endif { UInt uiW = uiWidth[ i ]; UInt uiH = uiHeight[ i ]; g_auiNonSquareSigLastScan[ i ] = new UInt[ uiW * uiH ]; initNonSquareSigLastScan( g_auiNonSquareSigLastScan[ i ], uiW, uiH); } #endif #endif }