Commit d760bd0b authored by sagnowski's avatar sagnowski
Browse files

Fix BE in encoder

parent 7f549400
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -69,7 +69,7 @@ void stereo_dmx_evs_enc(
    STEREO_DMX_EVS_ENC_HANDLE hStereoDmxEVS,                    /* i/o: Stereo downmix for EVS encoder handle   */
    const int32_t input_Fs,                                     /* i  : input sampling rate                     */
#ifdef FLOAT_INTERFACE_ENC
    float data[CPE_CHANNELS],                                   /* i/o: input signal                            */
    float *data,                                                /* i/o: input signal                            */
#else
    int16_t data[CPE_CHANNELS * L_FRAME48k],                    /* i/o: input signal                            */
#endif
+5 −1
Original line number Diff line number Diff line
@@ -164,7 +164,11 @@
#define FIX_299_ISM_BWS                                 /* VA: issue 299 - fix Band-width switching issues in ISM format */

#define FLOAT_INTERFACE_ENC
#define FLOAT_INTERFACE_DEC_REND
#ifdef FLOAT_INTERFACE_ENC
#define FLOAT_INTERFACE_ENC_BE_HACKS
#endif

// #define FLOAT_INTERFACE_DEC_REND

/* ################## End DEVELOPMENT switches ######################### */
/* clang-format on */
+25 −2
Original line number Diff line number Diff line
@@ -788,7 +788,7 @@ void stereo_dmx_evs_enc(
    STEREO_DMX_EVS_ENC_HANDLE hStereoDmxEVS, /* i/o: Stereo downmix for EVS encoder handle  */
    const int32_t input_Fs,                  /* i  : input sampling rate                    */
#ifdef FLOAT_INTERFACE_ENC
    float data[CPE_CHANNELS],                /* i/o: input signal                           */
    float *data,                             /* i/o: input signal                           */
#else
    int16_t data[CPE_CHANNELS * L_FRAME48k], /* i/o: input signal                           */
#endif
@@ -798,6 +798,10 @@ void stereo_dmx_evs_enc(
    float dmx_weight, corr;
#ifdef FLOAT_INTERFACE_ENC
    float* data_f[CPE_CHANNELS];
#ifdef FLOAT_INTERFACE_ENC_BE_HACKS
    int16_t n;
    int16_t tmp;
#endif
#else
    int16_t n;
    float data_f[CPE_CHANNELS][L_FRAME48k];
@@ -809,6 +813,14 @@ void stereo_dmx_evs_enc(

#ifdef FLOAT_INTERFACE_ENC
    save_channel_pointers(data, 2, input_frame, data_f);

#ifdef FLOAT_INTERFACE_ENC_BE_HACKS
    /* Truncate input float values to keep BE with EVS - originally `data` was of type `int16_t*` */
    for ( n = 0; n < input_frame * 2; ++n )
    {
        data[n] = (int16_t) data[n];
    }
#endif
#else
    for ( n = 0; n < input_frame; n++ )
    {
@@ -836,7 +848,18 @@ void stereo_dmx_evs_enc(
    create_M_signal( data_f[0], data_f[1], dmx_data, dmx_weight, input_frame, hStereoDmxEVS->s_wnd,
                     hStereoDmxEVS->dmx_weight, hStereoDmxEVS->pre_dmx_energy, hStereoDmxEVS->aux_dmx_energy );

#ifndef FLOAT_INTERFACE_ENC
#ifdef FLOAT_INTERFACE_ENC
#ifdef FLOAT_INTERFACE_ENC_BE_HACKS
    /* Round-off float values to keep BE with EVS - originally `data` was of type `int16_t*` */
    for ( n = 0; n < input_frame; ++n )
    {
        mvr2s(&dmx_data[n], &tmp, 1);
        dmx_data[n] = tmp;
    }
#endif

    mvr2r( dmx_data, data, n_samples );
#else
    mvr2s( dmx_data, data, n_samples );
#endif