Commit 894ae474 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Merge branch 'qmetadata_penalty_calc' into 'main'

Alternative to qmetadata penalty calculation.

See merge request !286
parents 90ee154b c5f57006
Loading
Loading
Loading
Loading
Loading
+53 −0
Original line number Diff line number Diff line
@@ -526,9 +526,14 @@ ivas_error only_reduce_bits_direction_fx(
    Word16 *bits_dir0;

    Word16 bits_sph_idx_orig[MASA_MAXIMUM_CODING_SUBBANDS][MAX_PARAM_SPATIAL_SUBFRAMES];
#ifdef FIX_QMETADATA_PENALTY 
    Word32 penalty[MASA_MAXIMUM_CODING_SUBBANDS];
    Word16 tmp;
#else
    Word16 penalty[MASA_MAXIMUM_CODING_SUBBANDS];
    Word16 shift, tmp, tmp_e, flag;
    Word32 tmp_32;
#endif
    FOR( j = 0; j < coding_subbands; j++ )
    {
        FOR( k = 0; k < no_subframes; k++ )
@@ -612,6 +617,53 @@ ivas_error only_reduce_bits_direction_fx(
    }
    ELSE
    {
#ifdef FIX_QMETADATA_PENALTY    

        Word16 m, sorted, index1, index2;

        FOR( j = 0; j < coding_subbands; j++ )
        {
            ind_order[j] = j;
            move16();
        }
        sorted = 0;
        move16();
        FOR( m = coding_subbands - 1; m && !sorted; m-- )
        {
            sorted = 1;
            move16();
            FOR( j = 0; j < m; j++ )
            {
                index1 = ind_order[j];
                index2 = ind_order[j + 1];
                tmp = 0;
                move16();
                FOR( k = 0; k < no_subframes; k++ )
                {
                    tmp = add( tmp, sub( bits_sph_idx_orig[index1][k], q_direction->band_data[index1].bits_sph_idx[k] ) );
                }
                penalty[0] = L_shr( W_extract_l( W_mult_32_16( tmp, bits_sph_idx_orig[index2][0] ) ), 1 );
                tmp = 0;
                move16();
                FOR( k = 0; k < no_subframes; k++ )
                {
                    tmp = add( tmp, sub( bits_sph_idx_orig[index2][k], q_direction->band_data[index2].bits_sph_idx[k] ) );
            }
                penalty[1] = L_shr( W_extract_l( W_mult_32_16( tmp, bits_sph_idx_orig[index1][0] ) ), 1 );
                IF( LT_32( penalty[0], penalty[1] ) )
            {
                    sorted = 0;
                    move16();
                    ind_order[j] = index2;
                    move16();
                    ind_order[j + 1] = index1;
                    move16();
            }
        }
        }
        
    
#else
        FOR( j = 0; j < coding_subbands; j++ )
        {
            penalty[j] = 0;
@@ -669,6 +721,7 @@ ivas_error only_reduce_bits_direction_fx(
            }
        }
        sort_desc_ind_16_fx( penalty, coding_subbands, ind_order );
#endif
    }

    *reduce_bits_out = negate( reduce_bits );
+2 −0
Original line number Diff line number Diff line
@@ -121,6 +121,8 @@

#define FIX_ISSUE_723_INFO_TCX_NOISE /*FhG: Issue 723: fix for IGF that introduces wrong noise filling behavion*/

#define FIX_QMETADATA_PENALTY /* Nokia: transform penalty calculation in qmetadata into integer operations */

/* ##################### End NON-BE switches ########################### */
#define FIX_740_HQ_CORE_OVA // Proposed fix to solve overlap and add issue for HQ_CORE
#define FIX_746  // proposed fix to solve low bit-rate frame boundaries issues