Loading lib_enc/igf_enc_fx.c +125 −3 Original line number Diff line number Diff line Loading @@ -1368,6 +1368,7 @@ static Word16 IGF_WriteWhiteningTile_fx( } #endif #ifndef FIX_2346_DUPLICATED_IGF_FUNCTIONS /**********************************************************************/ /* writes the whitening levels **************************************************************************/ Loading Loading @@ -1465,10 +1466,127 @@ static void IGF_WriteWhiteningLevels_fx( IGF_write_bits( hBstr, pBitOffset, 0, 1 ); } } } #else /**********************************************************************/ /* writes the whitening levels **************************************************************************/ return; /* o: Q0 | total number of bits written */ static Word16 IGF_WriteWhiteningLevels_fx( const IGF_ENC_INSTANCE_HANDLE hInstance, /* i : | instance handle of IGF encoder */ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ Word16 *pBitOffset, /* i : | ptr to bitOffset counter */ const Word16 igfGridIdx, /* i : Q0 | igf grid index see declaration of IGF_GRID_IDX for details */ const Word16 isIndepFlag /* i : Q0 | if 1 frame is independent, 0 = frame is coded with data from previous frame */ ) { IGF_ENC_PRIVATE_DATA_HANDLE hPrivateData; H_IGF_GRID hGrid; Word16 p; Word16 nTiles; Word16 isSame; Word32 tmp32; Word16 totBitCount; Word16 startBitCount; totBitCount = 0; move16(); isSame = 1; move16(); startBitCount = *pBitOffset; move16(); hPrivateData = &hInstance->igfData; hGrid = &hPrivateData->igfInfo.grid[igfGridIdx]; nTiles = hGrid->nTiles; move16(); IF( isIndepFlag ) { isSame = 0; move16(); } ELSE { p = 0; move16(); tmp32 = 0; move32(); test(); WHILE( ( LT_16( p, nTiles ) ) && ( tmp32 == 0 ) ) { test(); tmp32 = L_sub( hPrivateData->igfCurrWhiteningLevel[p], hPrivateData->igfPrevWhiteningLevel[p] ); if ( tmp32 != 0 ) { isSame = 0; move16(); } p++; } } IF( isSame ) { IGF_write_bits( hBstr, pBitOffset, 1, 1 ); } ELSE { IF( !isIndepFlag ) { IGF_write_bits( hBstr, pBitOffset, 0, 1 ); } IGF_WriteWhiteningTile_fx( hBstr, pBitOffset, hPrivateData->igfCurrWhiteningLevel[0] ); p = 1; move16(); tmp32 = 0; move32(); test(); IF( EQ_16( hPrivateData->igfInfo.bitRateIndex, IGF_BITRATE_SWB_48000_CPE ) || EQ_16( hPrivateData->igfInfo.bitRateIndex, IGF_BITRATE_FB_48000_CPE ) ) { isSame = 1; move16(); } ELSE { if ( LT_16( p, nTiles ) ) { isSame = 1; move16(); } test(); WHILE( ( LT_16( p, nTiles ) ) && ( tmp32 == 0 ) ) { test(); tmp32 = L_sub( hPrivateData->igfCurrWhiteningLevel[p], hPrivateData->igfCurrWhiteningLevel[p - 1] ); if ( tmp32 != 0 ) { isSame = 0; move16(); } p++; } } test(); IF( !isSame ) { IGF_write_bits( hBstr, pBitOffset, 1, 1 ); FOR( p = 1; p < nTiles; p++ ) { IGF_WriteWhiteningTile_fx( hBstr, pBitOffset, hPrivateData->igfCurrWhiteningLevel[p] ); } } ELSE IF( NE_16( hPrivateData->igfInfo.bitRateIndex, IGF_BITRATE_SWB_48000_CPE ) && NE_16( hPrivateData->igfInfo.bitRateIndex, IGF_BITRATE_FB_48000_CPE ) ) { IGF_write_bits( hBstr, pBitOffset, 0, 1 ); } } totBitCount = sub( *pBitOffset, startBitCount ); return totBitCount; } #endif #ifndef FIX_2346_DUPLICATED_IGF_FUNCTIONS /**********************************************************************/ /* write flattening trigger Loading Loading @@ -3911,7 +4029,7 @@ static Word16 IGF_WriteWhiteningTile_ivas_fx( return totBitCount; } #endif #ifndef FIX_2346_DUPLICATED_IGF_FUNCTIONS /*-------------------------------------------------------------------* * IGF_WriteWhiteningLevels_fx() * Loading Loading @@ -4039,7 +4157,7 @@ static Word16 IGF_WriteWhiteningLevels_ivas_fx( return totBitCount; } #endif #ifndef FIX_2346_DUPLICATED_IGF_FUNCTIONS /*-------------------------------------------------------------------* * IGF_WriteFlatteningTrigger_fx() Loading Loading @@ -4107,7 +4225,11 @@ Word16 IGFEncWriteBitstream_ivas_fx( IGF_WriteEnvelope_ivas( hIGFEnc, hBstr, pBitOffset, igfGridIdx, isIndepFlag, &igfAllZero ); #endif #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS IGF_WriteWhiteningLevels_fx( hIGFEnc, hBstr, pBitOffset, igfGridIdx, isIndepFlag ); #else IGF_WriteWhiteningLevels_ivas_fx( hIGFEnc, hBstr, pBitOffset, igfGridIdx, isIndepFlag ); #endif #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS IGF_WriteFlatteningTrigger_fx( hIGFEnc, hBstr, pBitOffset ); Loading Loading
lib_enc/igf_enc_fx.c +125 −3 Original line number Diff line number Diff line Loading @@ -1368,6 +1368,7 @@ static Word16 IGF_WriteWhiteningTile_fx( } #endif #ifndef FIX_2346_DUPLICATED_IGF_FUNCTIONS /**********************************************************************/ /* writes the whitening levels **************************************************************************/ Loading Loading @@ -1465,10 +1466,127 @@ static void IGF_WriteWhiteningLevels_fx( IGF_write_bits( hBstr, pBitOffset, 0, 1 ); } } } #else /**********************************************************************/ /* writes the whitening levels **************************************************************************/ return; /* o: Q0 | total number of bits written */ static Word16 IGF_WriteWhiteningLevels_fx( const IGF_ENC_INSTANCE_HANDLE hInstance, /* i : | instance handle of IGF encoder */ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ Word16 *pBitOffset, /* i : | ptr to bitOffset counter */ const Word16 igfGridIdx, /* i : Q0 | igf grid index see declaration of IGF_GRID_IDX for details */ const Word16 isIndepFlag /* i : Q0 | if 1 frame is independent, 0 = frame is coded with data from previous frame */ ) { IGF_ENC_PRIVATE_DATA_HANDLE hPrivateData; H_IGF_GRID hGrid; Word16 p; Word16 nTiles; Word16 isSame; Word32 tmp32; Word16 totBitCount; Word16 startBitCount; totBitCount = 0; move16(); isSame = 1; move16(); startBitCount = *pBitOffset; move16(); hPrivateData = &hInstance->igfData; hGrid = &hPrivateData->igfInfo.grid[igfGridIdx]; nTiles = hGrid->nTiles; move16(); IF( isIndepFlag ) { isSame = 0; move16(); } ELSE { p = 0; move16(); tmp32 = 0; move32(); test(); WHILE( ( LT_16( p, nTiles ) ) && ( tmp32 == 0 ) ) { test(); tmp32 = L_sub( hPrivateData->igfCurrWhiteningLevel[p], hPrivateData->igfPrevWhiteningLevel[p] ); if ( tmp32 != 0 ) { isSame = 0; move16(); } p++; } } IF( isSame ) { IGF_write_bits( hBstr, pBitOffset, 1, 1 ); } ELSE { IF( !isIndepFlag ) { IGF_write_bits( hBstr, pBitOffset, 0, 1 ); } IGF_WriteWhiteningTile_fx( hBstr, pBitOffset, hPrivateData->igfCurrWhiteningLevel[0] ); p = 1; move16(); tmp32 = 0; move32(); test(); IF( EQ_16( hPrivateData->igfInfo.bitRateIndex, IGF_BITRATE_SWB_48000_CPE ) || EQ_16( hPrivateData->igfInfo.bitRateIndex, IGF_BITRATE_FB_48000_CPE ) ) { isSame = 1; move16(); } ELSE { if ( LT_16( p, nTiles ) ) { isSame = 1; move16(); } test(); WHILE( ( LT_16( p, nTiles ) ) && ( tmp32 == 0 ) ) { test(); tmp32 = L_sub( hPrivateData->igfCurrWhiteningLevel[p], hPrivateData->igfCurrWhiteningLevel[p - 1] ); if ( tmp32 != 0 ) { isSame = 0; move16(); } p++; } } test(); IF( !isSame ) { IGF_write_bits( hBstr, pBitOffset, 1, 1 ); FOR( p = 1; p < nTiles; p++ ) { IGF_WriteWhiteningTile_fx( hBstr, pBitOffset, hPrivateData->igfCurrWhiteningLevel[p] ); } } ELSE IF( NE_16( hPrivateData->igfInfo.bitRateIndex, IGF_BITRATE_SWB_48000_CPE ) && NE_16( hPrivateData->igfInfo.bitRateIndex, IGF_BITRATE_FB_48000_CPE ) ) { IGF_write_bits( hBstr, pBitOffset, 0, 1 ); } } totBitCount = sub( *pBitOffset, startBitCount ); return totBitCount; } #endif #ifndef FIX_2346_DUPLICATED_IGF_FUNCTIONS /**********************************************************************/ /* write flattening trigger Loading Loading @@ -3911,7 +4029,7 @@ static Word16 IGF_WriteWhiteningTile_ivas_fx( return totBitCount; } #endif #ifndef FIX_2346_DUPLICATED_IGF_FUNCTIONS /*-------------------------------------------------------------------* * IGF_WriteWhiteningLevels_fx() * Loading Loading @@ -4039,7 +4157,7 @@ static Word16 IGF_WriteWhiteningLevels_ivas_fx( return totBitCount; } #endif #ifndef FIX_2346_DUPLICATED_IGF_FUNCTIONS /*-------------------------------------------------------------------* * IGF_WriteFlatteningTrigger_fx() Loading Loading @@ -4107,7 +4225,11 @@ Word16 IGFEncWriteBitstream_ivas_fx( IGF_WriteEnvelope_ivas( hIGFEnc, hBstr, pBitOffset, igfGridIdx, isIndepFlag, &igfAllZero ); #endif #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS IGF_WriteWhiteningLevels_fx( hIGFEnc, hBstr, pBitOffset, igfGridIdx, isIndepFlag ); #else IGF_WriteWhiteningLevels_ivas_fx( hIGFEnc, hBstr, pBitOffset, igfGridIdx, isIndepFlag ); #endif #ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS IGF_WriteFlatteningTrigger_fx( hIGFEnc, hBstr, pBitOffset ); Loading