Commit 76197112 authored by vaclav's avatar vaclav
Browse files

fix: missing instance in porting

parent 8001cf02
Loading
Loading
Loading
Loading
Loading
+41 −5
Original line number Diff line number Diff line
@@ -116,6 +116,7 @@ static void masa_metadata_direction_alignment_fx( MASA_ENCODER_HANDLE hMasa );
 *
 * open and initialize MASA encoder
 *-----------------------------------------------------------------------*/

ivas_error ivas_masa_enc_open_fx(
    Encoder_Struct *st_ivas /* i/o: IVAS encoder handle          */
)
@@ -261,11 +262,13 @@ ivas_error ivas_masa_enc_open_fx(
    return error;
}


/*-----------------------------------------------------------------------*
 * ivas_masa_enc_close()
 *
 * close MASA encoder
 *-----------------------------------------------------------------------*/

void ivas_masa_enc_close_fx(
    MASA_ENCODER_HANDLE *hMasa /* i/o: MASA metadata structure      */
)
@@ -303,6 +306,7 @@ void ivas_masa_enc_close_fx(
    return;
}


/*-----------------------------------------------------------------------*
 * ivas_masa_encode()
 *
@@ -862,6 +866,8 @@ ivas_error ivas_masa_encode_fx(

    return IVAS_ERR_OK;
}


/*-----------------------------------------------------------------------*
 * ivas_masa_estimate_energy_fx()
 *
@@ -1046,7 +1052,6 @@ ivas_error ivas_masa_enc_config_fx(
            }
        }


        /* Inspect metadata for parameter changes that affect coding. */
        detect_metadata_composition_fx( hMasa, &joinedSubframes, &coherencePresent, &isActualTwoDir );

@@ -1089,7 +1094,6 @@ ivas_error ivas_masa_enc_config_fx(
    {
        set32_fx( hMasa->data.importanceWeight_fx, ONE_IN_Q30 /*1.0f Q30*/, MASA_FREQUENCY_BANDS );


        IF( EQ_16( hMasa->config.numCodingBands, 5 ) )
        {
            hMasa->data.importanceWeight_fx[4] = 751619277 /*0.7f q30*/;
@@ -1258,10 +1262,8 @@ ivas_error ivas_masa_enc_config_fx(
        }
    }


    masa_sample_rate_band_correction_fx( &( hMasa->config ), hMasa->data.band_mapping, hQMetaData, maxBand, (UWord8) GE_32( masa_total_brate, IVAS_384k ), NULL );


    IF( GE_16( hMasa->config.numTwoDirBands, hMasa->config.numCodingBands ) )
    {
        hMasa->config.numTwoDirBands = hMasa->config.numCodingBands;
@@ -1304,13 +1306,17 @@ ivas_error ivas_masa_enc_config_fx(
        }
        move16();
    }

    return error;
}


/*-----------------------------------------------------------------------*
 * ivas_masa_surrcoh_signicant()
 *
 * Determine if surrounding coherence is significant in this frame and should be encoded
 *-----------------------------------------------------------------------*/

UWord8 ivas_masa_surrcoh_signicant_fx(
    Word32 surroundingCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS],   /* i  : Surround coherence     Q31 */
    Word32 diffuse_to_total_ratio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i  : Diffuse to total ratio Q31 */
@@ -1381,6 +1387,7 @@ UWord8 ivas_masa_surrcoh_signicant_fx(
    return 0;
}


/*-----------------------------------------------------------------------*
 * Local functions
 *-----------------------------------------------------------------------*/
@@ -1707,6 +1714,7 @@ static void combine_freqbands_and_subframes_fx(
 *
 *
 *-------------------------------------------------------------------*/

void ivas_masa_combine_directions_fx(
    MASA_ENCODER_HANDLE hMasa )
{
@@ -2385,6 +2393,7 @@ static void compensate_energy_ratios_fx(
    return;
}


/* If the bit budget is very low, reduce metadata further to either 1 subframe and 5 bands, or 1 band and 4 subframes, based on which works better */
static void reduce_metadata_further_fx(
    MASA_ENCODER_HANDLE hMasa,
@@ -2992,6 +3001,7 @@ static Word16 encode_lfe_to_total_energy_ratio_fx(
 *
 * Reconfigure IVAS MASA encoder
 *-------------------------------------------------------------------*/

void ivas_masa_enc_reconfigure_fx(
    Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */
)
@@ -3071,11 +3081,13 @@ void ivas_masa_enc_reconfigure_fx(
    return;
}


/*-------------------------------------------------------------------*
 * average_masa_metadata()
 *
 * Average MASA metadata frame subframe contents: applies aggregation over time
 *-------------------------------------------------------------------*/

static void average_masa_metadata_fx(
    MASA_METADATA_FRAME *hMeta,
    Word32 energy[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS],   /*i Q(31 - energy_e) */
@@ -3238,6 +3250,7 @@ static void average_masa_metadata_fx(
 *
 * Copy MASA metadata frame subframe contents
 *-------------------------------------------------------------------*/

static void copy_masa_metadata_subframe_fx(
    const MASA_METADATA_HANDLE hMetaFrom, /* i  : MASA frame metdata to be copied      */
    const UWord8 sfFrom,                  /* i  : subframe index of the copy source    */
@@ -3270,11 +3283,13 @@ static void copy_masa_metadata_subframe_fx(
    return;
}


/*-------------------------------------------------------------------*
 * copy_masa_metadata()
 *
 * Copy MASA metada frame contents
 *-------------------------------------------------------------------*/

static void copy_masa_metadata_fx(
    const MASA_METADATA_HANDLE hMetaFrom, /* i  : MASA frame metadata to be copied     */
    MASA_METADATA_HANDLE hMetaTo          /* o  : MASA frame metadata copy destination */
@@ -3313,6 +3328,7 @@ static void copy_masa_metadata_fx(
    return;
}


/*-------------------------------------------------------------------*
 * are_masa_subframes_similar()
 *
@@ -3428,6 +3444,7 @@ static UWord8 are_masa_subframes_similar_fx(
    }
}


/*-------------------------------------------------------------------*
 * detect_framing_async()
 *
@@ -3435,6 +3452,7 @@ static UWord8 are_masa_subframes_similar_fx(
 * Analysis result is stored in hMasa->data.sync_state, and
 * potentially hMasa->masaMetadata is modified
 *-------------------------------------------------------------------*/

static void detect_framing_async_fx(
    MASA_ENCODER_HANDLE hMasa /* i/o: MASA encoder structure */
)
@@ -3580,12 +3598,14 @@ static void detect_framing_async_fx(
    return;
}


/*-------------------------------------------------------------------*
 * masa_metadata_direction_alignment()
 *
 * In 2dir MASA metadata, determine the ordering of the directional
 * fields such that the azi/ele change across time is minimized.
 *-------------------------------------------------------------------*/

static void masa_metadata_direction_alignment_fx(
    MASA_ENCODER_HANDLE hMasa /* i/o: MASA encoder handle */
)
@@ -4058,6 +4078,8 @@ void ivas_merge_masa_metadata_fx(

    return;
}


static void quantize_ratio_ism_vector_ivas_fx(
    const Word16 *ratio_ism, /* ratio_ism_e */
    Word16 ratio_ism_e,
@@ -4243,6 +4265,8 @@ static void quantize_ratio_ism_vector_ivas_fx(

    return;
}


static Word16 index_slice_enum_fx(
    const Word16 *ratio_ism_idx,
    const Word16 nchan_ism )
@@ -4308,6 +4332,8 @@ static void transform_difference_index_ivas_fx(

    return;
}


static void transform_index_and_GR_encode_ivas_fx(
    Word16 *diff_idx,         /* i  : differenc eindex to encode    */
    const Word16 len,         /* i  : input length                  */
@@ -4329,6 +4355,8 @@ static void transform_index_and_GR_encode_ivas_fx(

    return;
}


static Word16 try_differential_fx(
    const Word16 numCodingBands,
    const Word32 *masa_to_total_energy_ratio, /* Q30 */
@@ -4384,6 +4412,7 @@ static Word16 try_differential_fx(
    return nbits0;
}


static void differential_coding_first_subframe_ivas_fx(
    BSTR_ENC_HANDLE hMetaData,
    const Word32 *masa_to_total_energy_ratio, // Q30
@@ -4422,6 +4451,8 @@ static void differential_coding_first_subframe_ivas_fx(

    return;
}


static void independent_coding_ratio_ism_idx_fx(
    Word16 ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], /* i  : ISM ratios                */
    const Word32 *masa_to_total_energy_ratio,                    /* i  : MASA to total ratios, Q30 */
@@ -4445,6 +4476,7 @@ static void independent_coding_ratio_ism_idx_fx(
    return;
}


static void remove_sep_obj_fx(
    Word16 *diff_idx,        /* i/o: array of difference of indexes                        */
    const Word16 nchan_ism,  /* i  : number of objects                                     */
@@ -4462,6 +4494,7 @@ static void remove_sep_obj_fx(
    return;
}


static void estimate_bits_subband_ism_ratio_fx(
    const Word16 *ratio_ism_idx,
    const Word16 *ratio_ism_idx_ref, /* ( i/o ) */
@@ -4506,6 +4539,7 @@ static void estimate_bits_subband_ism_ratio_fx(
    return;
}


static Word16 encode_ratio_ism_subframe_fx(
    Word16 ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS],
    const Word16 nchan_ism,
@@ -5290,11 +5324,13 @@ static void ivas_encode_masaism_metadata_fx(
    return;
}


/*-------------------------------------------------------------------*
 * ivas_merge_masa_transports()
 *
 * Merge MASA transport channels
 *-------------------------------------------------------------------*/

void ivas_merge_masa_transports_fx(
    Word32 data_in_f1_fx[][L_FRAME48k], // Qx
    Word32 *data_in_f2_fx[],            // Qx
+30 −7
Original line number Diff line number Diff line
@@ -51,9 +51,11 @@

#define OMASA_FEC_MAX 5


/*-------------------------------------------------------------------------
 * Local function prototypes
 *------------------------------------------------------------------------*/

static void ivas_omasa_param_est_enc_fx(
    OMASA_ENC_HANDLE hOMasa,
    OMASA_ENCODER_DATA_HANDLE hOmasaData,
@@ -219,13 +221,13 @@ ivas_error ivas_omasa_enc_open_fx(
    return error;
}


/*--------------------------------------------------------------------------*
 * ivas_omasa_enc_close()
 *
 * Close OMASA handle
 *--------------------------------------------------------------------------*/


void ivas_omasa_enc_close_fx(
    OMASA_ENC_HANDLE *hOMasa /* i/o: encoder OMASA handle */
)
@@ -360,6 +362,7 @@ ivas_error ivas_omasa_enc_config_fx(

        ivas_write_format_fx( st_ivas );

        /* OMASA encoder handle */
        test();
        test();
        IF( NE_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) && st_ivas->hOMasa == NULL )
@@ -375,6 +378,24 @@ ivas_error ivas_omasa_enc_config_fx(
            st_ivas->hOMasa = NULL;
        }

#ifdef FIX_1161_REDUCE_OMASA_HEAP
        /* OMASA energy handle */
        test();
        test();
        IF( NE_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) && st_ivas->hMasa->data.hOmasaData->hOmasaEnergy == NULL )
        {
            IF( ( st_ivas->hMasa->data.hOmasaData->hOmasaEnergy = (OMASA_ENCODER_ENERGY_HANDLE) malloc( sizeof( OMASA_ENCODER_ENERGY_STATE ) ) ) == NULL )
            {
                return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for OMASA energy handle\n" ) );
            }
        }
        ELSE IF( EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) && st_ivas->hMasa->data.hOmasaData->hOmasaEnergy != NULL )
        {
            free( st_ivas->hMasa->data.hOmasaData->hOmasaEnergy );
            st_ivas->hMasa->data.hOmasaData->hOmasaEnergy = NULL;
        }

#endif
        st_ivas->hCPE[0]->element_brate = L_sub( ivas_total_brate, ism_total_brate );
        move32();

@@ -410,6 +431,7 @@ ivas_error ivas_omasa_enc_config_fx(
 *
 * Frame-by-frame config for oMASA
 *--------------------------------------------------------------------------*/

void ivas_omasa_set_config_fx(
    OMASA_ENC_HANDLE hOMasa,   /* i/o: OMASA encoder handle */
    MASA_ENCODER_HANDLE hMasa, /* i  : MASA encoder handle  */
@@ -966,6 +988,7 @@ Word16 ivas_omasa_ener_brate_fx(
    Word16 energy_ism_e, energy_masa_e;
    Word32 temp_32;
    Word16 temp, temp_e;

    flag_omasa_ener_brate = 0;
    energy_ism_e = 0;
    energy_masa_e = 0;