Loading lib_com/ivas_cnst.h +4 −5 Original line number Diff line number Diff line Loading @@ -1141,14 +1141,13 @@ enum #define MASA_TRANSP_BITS 1 #define NO_BITS_MASA_ISM_NO_OBJ 2 #ifdef NONBE_1231_BASOP_819_THRESHOLD_MASA2TOTAL #define MASA2TOTAL_THR 0.9799999f #else #define MASA2TOTAL_THR 0.98f #endif #define BITS_MASA2TOTTAL_DCT0 6 #define STEP_M2T 0.1f #ifdef NONBE_1231_BASOP_819_THRESHOLD_MASA2TOTAL #define STEP_M2T_FX 214748365 // Q31 #endif #define MASA_HEADER_BITS 2 #define MASA_SUBFRAME_BITS 1 #define MASA_LOWBITRATE_MODE_BITS 1 Loading lib_com/ivas_prot.h +26 −0 Original line number Diff line number Diff line Loading @@ -756,6 +756,32 @@ int16_t get_igf_startline( float rand_triangular_signed( int16_t *seed ); #ifdef NONBE_1231_BASOP_819_THRESHOLD_MASA2TOTAL Word16 matrix_product_fx( const Word32 *X_fx, /* i : left hand matrix Qx*/ const Word16 rowsX, /* i : number of rows of the left hand matrix Q0*/ const Word16 colsX, /* i : number of columns of the left hand matrix Q0*/ const Word16 transpX, /* i : flag indicating the transposition of the left hand matrix prior to the multiplication Q0*/ const Word32 *Y_fx, /* i : right hand matrix Qy*/ const Word16 rowsY, /* i : number of rows of the right hand matrix Q0*/ const Word16 colsY, /* i : number of columns of the right hand matrix Q0*/ const Word16 transpY, /* i : flag indicating the transposition of the right hand matrix prior to the multiplication Q0*/ Word32 *Z_fx /* o : resulting matrix after the matrix multiplication Qx + Qy - 31*/ ); Word16 matrix_product_q30_fx( const Word32 *X_fx, /* i : left hand matrix Q31*/ const Word16 rowsX, /* i : number of rows of the left hand matrix Q0*/ const Word16 colsX, /* i : number of columns of the left hand matrix Q0*/ const Word16 transpX, /* i : flag indicating the transposition of the left hand matrix prior to the multiplication Q0*/ const Word32 *Y_fx, /* i : right hand matrix Q25*/ const Word16 rowsY, /* i : number of rows of the right hand matrix Q0*/ const Word16 colsY, /* i : number of columns of the right hand matrix Q0*/ const Word16 transpY, /* i : flag indicating the transposition of the right hand matrix prior to the multiplication Q0*/ Word32 *Z_fx /* o : resulting matrix after the matrix multiplication Q30*/ ); #endif void dtx_read_padding_bits( DEC_CORE_HANDLE st, Loading lib_com/ivas_rom_com.c +2 −2 Original line number Diff line number Diff line Loading @@ -2819,7 +2819,7 @@ const Word32 dct12_fx[12 * 12] = { // Q31 619978560, -335436960, 0, 335436960, -619978560, 810030848, -876602816, 810030848, -619978560, 335436960, 619978560, -869301376, 846752832, -810030848, 759350208, -695569984, 619978560, -533649696, 438301408, -335436960, 226989024, -114460880 }; #else #endif const float dct4[4*4] = { 0.5000f, 0.6533f, 0.5000f, 0.2706f, Loading Loading @@ -2864,7 +2864,7 @@ const float dct12[12*12]= 0.2887f, -0.3772f, 0.2887f, -0.1562f, -0.0000f, 0.1562f, -0.2887f, 0.3772f, -0.4082f, 0.3772f, -0.2887f, 0.1562f, 0.2887f, -0.4048f, 0.3943f, -0.3772f, 0.3536f, -0.3239f, 0.2887f, -0.2485f, 0.2041f, -0.1562f, 0.1057f, -0.0533f }; #endif /*----------------------------------------------------------------------------------* * ISM ROM tables *----------------------------------------------------------------------------------*/ Loading lib_com/ivas_rom_com.h +2 −2 Original line number Diff line number Diff line Loading @@ -330,12 +330,12 @@ extern const Word32 dct4_fx[]; extern const Word32 dct5_fx[]; extern const Word32 dct8_fx[]; extern const Word32 dct12_fx[]; #else #endif extern const float dct4[]; extern const float dct5[]; extern const float dct8[]; extern const float dct12[]; #endif /*----------------------------------------------------------------------------------* * ISM ROM tables *----------------------------------------------------------------------------------*/ Loading lib_com/ivas_tools.c +75 −73 Original line number Diff line number Diff line Loading @@ -41,6 +41,9 @@ #include "ivas_prot.h" #include "wmc_auto.h" #include "ivas_rom_com.h" #ifdef NONBE_1231_BASOP_819_THRESHOLD_MASA2TOTAL #include "basop_settings.h" #endif /*--------------------------------------------------------------- * sumAbs() Loading Loading @@ -1309,7 +1312,7 @@ Word16 matrix_product_fx( { x_idx = k + i * rowsX; /*Q0*/ y_idx = k + j * rowsY; /*Q0*/ ( *Zp_fx ) = *Zp_fx + ( X_fx[x_idx] * Y_fx[y_idx] ); /*Qx + Qy - 31*/ ( *Zp_fx ) = *Zp_fx + Mpy_32_32( X_fx[x_idx], Y_fx[y_idx] ); /*Qx + Qy - 31*/ } Zp_fx++; } Loading @@ -1330,7 +1333,7 @@ Word16 matrix_product_fx( { x_idx = i + k * rowsX; /*Q0*/ y_idx = j + k * rowsY; /*Q0*/ ( *Zp_fx ) = (*Zp_fx) + ( X_fx[x_idx] * Y_fx[y_idx] ); /*Qx + Qy - 31*/ ( *Zp_fx ) = ( *Zp_fx ) + Mpy_32_32( X_fx[x_idx], Y_fx[y_idx] ); /*Qx + Qy - 31*/ } Zp_fx++; } Loading @@ -1347,13 +1350,12 @@ Word16 matrix_product_fx( for ( i = 0; i < colsX; ++i ) { ( *Zp_fx ) = 0; move32(); for ( k = 0; k < colsX; ++k ) { x_idx = add( k, imult1616( i, rowsX ) ); /*Q0*/ y_idx = add( j, imult1616( k, rowsY ) ); /*Q0*/ ( *Zp_fx ) = L_add( *Zp_fx, Mpy_32_32( X_fx[x_idx], Y_fx[y_idx] ) ); /*Qx + Qy - 31*/ move32(); x_idx = k + i * rowsX; /*Q0*/ y_idx = j + k * rowsY; /*Q0*/ ( *Zp_fx ) = ( *Zp_fx ) + Mpy_32_32( X_fx[x_idx], Y_fx[y_idx] ); /*Qx + Qy - 31*/ } Zp_fx++; Loading @@ -1362,7 +1364,7 @@ Word16 matrix_product_fx( } else /* Regular case */ { if( NE_16( colsX, rowsY ) ) if ( colsX != rowsY ) { return EXIT_FAILURE; } Loading @@ -1375,9 +1377,9 @@ Word16 matrix_product_fx( for ( k = 0; k < colsX; ++k ) { x_idx = add( i, imult1616( k, rowsX ) ); /*Q0*/ y_idx = add( k, imult1616( j, rowsY ) ); /*Q0*/ ( *Zp_fx ) = L_add_sat( *Zp_fx, Mpy_32_32( X_fx[x_idx], Y_fx[y_idx] ) ); /*Qx + Qy - 31*/ x_idx = i + k * rowsX; /*Q0*/ y_idx = k + j * rowsY; /*Q0*/ ( *Zp_fx ) = ( *Zp_fx ) + Mpy_32_32( X_fx[x_idx], Y_fx[y_idx] ); /*Qx + Qy - 31 L_sat_add() */ // TODO: overflow of Z_fx to be checked move32(); } Loading Loading @@ -1427,7 +1429,7 @@ Word16 matrix_product_q30_fx( //( *Zp_fx ) = L_add( *Zp_fx, Mpy_32_32( X_fx[k + i * rowsX], Y_fx[k + j * rowsY] ) ); x_idx = k + i * rowsX; /* Q0 */ y_idx = k + j * rowsY; /* Q0 */ W_tmp += X_fx[x_idx] * Y_fx[y_idx]; /* Q56 */ W_tmp += ( (long long int) X_fx[x_idx] * (long long int) Y_fx[y_idx] ); /* Q56 */ } W_tmp = W_tmp << 6; /* W_shl( W_tmp, 6 ); */ /*Q62*/ ( *Zp_fx ) = ( W_tmp + 0x80000000 ) >> 32; /* W_round64_L( W_tmp ); */ /*Q30*/ Loading @@ -1453,7 +1455,7 @@ Word16 matrix_product_q30_fx( //( *Zp_fx ) = L_add( *Zp_fx, Mpy_32_32( X_fx[i + k * rowsX], Y_fx[j + k * rowsY] ) ); x_idx = i + k * rowsX; /*Q0*/ y_idx = j + k * rowsY; /*Q0*/ W_tmp += X_fx[x_idx]*Y_fx[y_idx]; /* Q56 */ W_tmp += ( (long long int) X_fx[x_idx] * (long long int) Y_fx[y_idx] ); /* Q56 */ } W_tmp = W_tmp << 6; /*Q62*/ ( *Zp_fx ) = ( W_tmp + 0x80000000 ) >> 32; /*Q30*/ Loading @@ -1478,7 +1480,7 @@ Word16 matrix_product_q30_fx( //( *Zp_fx ) = L_add( *Zp_fx, Mpy_32_32( X_fx[k + i * rowsX], Y_fx[j + k * rowsY] ) ); x_idx = k + i * rowsX; /*Q0*/ y_idx = j + k * rowsY; /*Q0*/ W_tmp += X_fx[x_idx] * Y_fx[y_idx]; // Q56 W_tmp += ( (long long int) X_fx[x_idx] * (long long int) Y_fx[y_idx] ); // Q56 } W_tmp = W_tmp << 6; /*Q62*/ ( *Zp_fx ) = ( W_tmp + 0x80000000 ) >> 32; /*Q30*/ Loading Loading @@ -1506,7 +1508,7 @@ Word16 matrix_product_q30_fx( //( *Zp_fx ) = L_add( *Zp_fx, Mpy_32_32( X_fx[i + k * rowsX], Y_fx[k + j * rowsY] ) ); x_idx = i + k * rowsX; /*Q0*/ y_idx = k + j * rowsY; /*Q0*/ W_tmp += X_fx[x_idx] * Y_fx[y_idx]; // Q56 W_tmp += ( (long long int) X_fx[x_idx] * (long long int) Y_fx[y_idx] ); // Q56 } W_tmp = W_tmp << 6; /*Q62*/ ( *Zp_fx ) = ( W_tmp + 0x80000000 ) >> 32; /*Q30*/ Loading Loading
lib_com/ivas_cnst.h +4 −5 Original line number Diff line number Diff line Loading @@ -1141,14 +1141,13 @@ enum #define MASA_TRANSP_BITS 1 #define NO_BITS_MASA_ISM_NO_OBJ 2 #ifdef NONBE_1231_BASOP_819_THRESHOLD_MASA2TOTAL #define MASA2TOTAL_THR 0.9799999f #else #define MASA2TOTAL_THR 0.98f #endif #define BITS_MASA2TOTTAL_DCT0 6 #define STEP_M2T 0.1f #ifdef NONBE_1231_BASOP_819_THRESHOLD_MASA2TOTAL #define STEP_M2T_FX 214748365 // Q31 #endif #define MASA_HEADER_BITS 2 #define MASA_SUBFRAME_BITS 1 #define MASA_LOWBITRATE_MODE_BITS 1 Loading
lib_com/ivas_prot.h +26 −0 Original line number Diff line number Diff line Loading @@ -756,6 +756,32 @@ int16_t get_igf_startline( float rand_triangular_signed( int16_t *seed ); #ifdef NONBE_1231_BASOP_819_THRESHOLD_MASA2TOTAL Word16 matrix_product_fx( const Word32 *X_fx, /* i : left hand matrix Qx*/ const Word16 rowsX, /* i : number of rows of the left hand matrix Q0*/ const Word16 colsX, /* i : number of columns of the left hand matrix Q0*/ const Word16 transpX, /* i : flag indicating the transposition of the left hand matrix prior to the multiplication Q0*/ const Word32 *Y_fx, /* i : right hand matrix Qy*/ const Word16 rowsY, /* i : number of rows of the right hand matrix Q0*/ const Word16 colsY, /* i : number of columns of the right hand matrix Q0*/ const Word16 transpY, /* i : flag indicating the transposition of the right hand matrix prior to the multiplication Q0*/ Word32 *Z_fx /* o : resulting matrix after the matrix multiplication Qx + Qy - 31*/ ); Word16 matrix_product_q30_fx( const Word32 *X_fx, /* i : left hand matrix Q31*/ const Word16 rowsX, /* i : number of rows of the left hand matrix Q0*/ const Word16 colsX, /* i : number of columns of the left hand matrix Q0*/ const Word16 transpX, /* i : flag indicating the transposition of the left hand matrix prior to the multiplication Q0*/ const Word32 *Y_fx, /* i : right hand matrix Q25*/ const Word16 rowsY, /* i : number of rows of the right hand matrix Q0*/ const Word16 colsY, /* i : number of columns of the right hand matrix Q0*/ const Word16 transpY, /* i : flag indicating the transposition of the right hand matrix prior to the multiplication Q0*/ Word32 *Z_fx /* o : resulting matrix after the matrix multiplication Q30*/ ); #endif void dtx_read_padding_bits( DEC_CORE_HANDLE st, Loading
lib_com/ivas_rom_com.c +2 −2 Original line number Diff line number Diff line Loading @@ -2819,7 +2819,7 @@ const Word32 dct12_fx[12 * 12] = { // Q31 619978560, -335436960, 0, 335436960, -619978560, 810030848, -876602816, 810030848, -619978560, 335436960, 619978560, -869301376, 846752832, -810030848, 759350208, -695569984, 619978560, -533649696, 438301408, -335436960, 226989024, -114460880 }; #else #endif const float dct4[4*4] = { 0.5000f, 0.6533f, 0.5000f, 0.2706f, Loading Loading @@ -2864,7 +2864,7 @@ const float dct12[12*12]= 0.2887f, -0.3772f, 0.2887f, -0.1562f, -0.0000f, 0.1562f, -0.2887f, 0.3772f, -0.4082f, 0.3772f, -0.2887f, 0.1562f, 0.2887f, -0.4048f, 0.3943f, -0.3772f, 0.3536f, -0.3239f, 0.2887f, -0.2485f, 0.2041f, -0.1562f, 0.1057f, -0.0533f }; #endif /*----------------------------------------------------------------------------------* * ISM ROM tables *----------------------------------------------------------------------------------*/ Loading
lib_com/ivas_rom_com.h +2 −2 Original line number Diff line number Diff line Loading @@ -330,12 +330,12 @@ extern const Word32 dct4_fx[]; extern const Word32 dct5_fx[]; extern const Word32 dct8_fx[]; extern const Word32 dct12_fx[]; #else #endif extern const float dct4[]; extern const float dct5[]; extern const float dct8[]; extern const float dct12[]; #endif /*----------------------------------------------------------------------------------* * ISM ROM tables *----------------------------------------------------------------------------------*/ Loading
lib_com/ivas_tools.c +75 −73 Original line number Diff line number Diff line Loading @@ -41,6 +41,9 @@ #include "ivas_prot.h" #include "wmc_auto.h" #include "ivas_rom_com.h" #ifdef NONBE_1231_BASOP_819_THRESHOLD_MASA2TOTAL #include "basop_settings.h" #endif /*--------------------------------------------------------------- * sumAbs() Loading Loading @@ -1309,7 +1312,7 @@ Word16 matrix_product_fx( { x_idx = k + i * rowsX; /*Q0*/ y_idx = k + j * rowsY; /*Q0*/ ( *Zp_fx ) = *Zp_fx + ( X_fx[x_idx] * Y_fx[y_idx] ); /*Qx + Qy - 31*/ ( *Zp_fx ) = *Zp_fx + Mpy_32_32( X_fx[x_idx], Y_fx[y_idx] ); /*Qx + Qy - 31*/ } Zp_fx++; } Loading @@ -1330,7 +1333,7 @@ Word16 matrix_product_fx( { x_idx = i + k * rowsX; /*Q0*/ y_idx = j + k * rowsY; /*Q0*/ ( *Zp_fx ) = (*Zp_fx) + ( X_fx[x_idx] * Y_fx[y_idx] ); /*Qx + Qy - 31*/ ( *Zp_fx ) = ( *Zp_fx ) + Mpy_32_32( X_fx[x_idx], Y_fx[y_idx] ); /*Qx + Qy - 31*/ } Zp_fx++; } Loading @@ -1347,13 +1350,12 @@ Word16 matrix_product_fx( for ( i = 0; i < colsX; ++i ) { ( *Zp_fx ) = 0; move32(); for ( k = 0; k < colsX; ++k ) { x_idx = add( k, imult1616( i, rowsX ) ); /*Q0*/ y_idx = add( j, imult1616( k, rowsY ) ); /*Q0*/ ( *Zp_fx ) = L_add( *Zp_fx, Mpy_32_32( X_fx[x_idx], Y_fx[y_idx] ) ); /*Qx + Qy - 31*/ move32(); x_idx = k + i * rowsX; /*Q0*/ y_idx = j + k * rowsY; /*Q0*/ ( *Zp_fx ) = ( *Zp_fx ) + Mpy_32_32( X_fx[x_idx], Y_fx[y_idx] ); /*Qx + Qy - 31*/ } Zp_fx++; Loading @@ -1362,7 +1364,7 @@ Word16 matrix_product_fx( } else /* Regular case */ { if( NE_16( colsX, rowsY ) ) if ( colsX != rowsY ) { return EXIT_FAILURE; } Loading @@ -1375,9 +1377,9 @@ Word16 matrix_product_fx( for ( k = 0; k < colsX; ++k ) { x_idx = add( i, imult1616( k, rowsX ) ); /*Q0*/ y_idx = add( k, imult1616( j, rowsY ) ); /*Q0*/ ( *Zp_fx ) = L_add_sat( *Zp_fx, Mpy_32_32( X_fx[x_idx], Y_fx[y_idx] ) ); /*Qx + Qy - 31*/ x_idx = i + k * rowsX; /*Q0*/ y_idx = k + j * rowsY; /*Q0*/ ( *Zp_fx ) = ( *Zp_fx ) + Mpy_32_32( X_fx[x_idx], Y_fx[y_idx] ); /*Qx + Qy - 31 L_sat_add() */ // TODO: overflow of Z_fx to be checked move32(); } Loading Loading @@ -1427,7 +1429,7 @@ Word16 matrix_product_q30_fx( //( *Zp_fx ) = L_add( *Zp_fx, Mpy_32_32( X_fx[k + i * rowsX], Y_fx[k + j * rowsY] ) ); x_idx = k + i * rowsX; /* Q0 */ y_idx = k + j * rowsY; /* Q0 */ W_tmp += X_fx[x_idx] * Y_fx[y_idx]; /* Q56 */ W_tmp += ( (long long int) X_fx[x_idx] * (long long int) Y_fx[y_idx] ); /* Q56 */ } W_tmp = W_tmp << 6; /* W_shl( W_tmp, 6 ); */ /*Q62*/ ( *Zp_fx ) = ( W_tmp + 0x80000000 ) >> 32; /* W_round64_L( W_tmp ); */ /*Q30*/ Loading @@ -1453,7 +1455,7 @@ Word16 matrix_product_q30_fx( //( *Zp_fx ) = L_add( *Zp_fx, Mpy_32_32( X_fx[i + k * rowsX], Y_fx[j + k * rowsY] ) ); x_idx = i + k * rowsX; /*Q0*/ y_idx = j + k * rowsY; /*Q0*/ W_tmp += X_fx[x_idx]*Y_fx[y_idx]; /* Q56 */ W_tmp += ( (long long int) X_fx[x_idx] * (long long int) Y_fx[y_idx] ); /* Q56 */ } W_tmp = W_tmp << 6; /*Q62*/ ( *Zp_fx ) = ( W_tmp + 0x80000000 ) >> 32; /*Q30*/ Loading @@ -1478,7 +1480,7 @@ Word16 matrix_product_q30_fx( //( *Zp_fx ) = L_add( *Zp_fx, Mpy_32_32( X_fx[k + i * rowsX], Y_fx[j + k * rowsY] ) ); x_idx = k + i * rowsX; /*Q0*/ y_idx = j + k * rowsY; /*Q0*/ W_tmp += X_fx[x_idx] * Y_fx[y_idx]; // Q56 W_tmp += ( (long long int) X_fx[x_idx] * (long long int) Y_fx[y_idx] ); // Q56 } W_tmp = W_tmp << 6; /*Q62*/ ( *Zp_fx ) = ( W_tmp + 0x80000000 ) >> 32; /*Q30*/ Loading Loading @@ -1506,7 +1508,7 @@ Word16 matrix_product_q30_fx( //( *Zp_fx ) = L_add( *Zp_fx, Mpy_32_32( X_fx[i + k * rowsX], Y_fx[k + j * rowsY] ) ); x_idx = i + k * rowsX; /*Q0*/ y_idx = k + j * rowsY; /*Q0*/ W_tmp += X_fx[x_idx] * Y_fx[y_idx]; // Q56 W_tmp += ( (long long int) X_fx[x_idx] * (long long int) Y_fx[y_idx] ); // Q56 } W_tmp = W_tmp << 6; /*Q62*/ ( *Zp_fx ) = ( W_tmp + 0x80000000 ) >> 32; /*Q30*/ Loading