Commit e20ea87a authored by vaclav's avatar vaclav
Browse files

remove JBM_MEMORY_OPT_FLUSH

parent 22d14f05
Loading
Loading
Loading
Loading
+0 −11
Original line number Diff line number Diff line
@@ -2410,11 +2410,7 @@ static ivas_error decodeG192(
                /* Read main parameters from the bitstream to set-up the decoder */
                hHrtfBinary->binaural_renderer_old = hHrtfBinary->binaural_renderer;
                hHrtfBinary->binaural_renderer_sec_old = hHrtfBinary->binaural_renderer_sec;
#ifdef JBM_MEMORY_OPT_FLUSH
                if ( ( error = IVAS_DEC_ReadFormat( hIvasDec, NULL, 0, &hHrtfBinary->binaural_renderer, &hHrtfBinary->binaural_renderer_sec, &hHrtfBinary->hrtf_set_audio_cfg ) ) != IVAS_ERR_OK )
#else
                if ( ( error = IVAS_DEC_ReadFormat( hIvasDec, &hHrtfBinary->binaural_renderer, &hHrtfBinary->binaural_renderer_sec, &hHrtfBinary->hrtf_set_audio_cfg ) ) != IVAS_ERR_OK )
#endif
                {
                    return error;
                }
@@ -3338,16 +3334,9 @@ static ivas_error decodeVoIP(
            if ( bitstreamReadDone == true )
            {
                /* Read main parameters from the bitstream to set-up the decoder */
#ifdef JBM_MEMORY_OPT_FLUSH
                /* + flush samples (compensate for renderer granularity change in JBM) */
#endif
                hHrtf->binaural_renderer_old = hHrtf->binaural_renderer;
                hHrtf->binaural_renderer_sec_old = hHrtf->binaural_renderer_sec;
#ifdef JBM_MEMORY_OPT_FLUSH
                if ( ( error = IVAS_DEC_ReadFormat( hIvasDec, pcmBuf, nSamplesRendered, &hHrtf->binaural_renderer, &hHrtf->binaural_renderer_sec, &hHrtf->hrtf_set_audio_cfg ) ) != IVAS_ERR_OK )
#else
                if ( ( error = IVAS_DEC_ReadFormat( hIvasDec, &hHrtf->binaural_renderer, &hHrtf->binaural_renderer_sec, &hHrtf->hrtf_set_audio_cfg ) ) != IVAS_ERR_OK )
#endif
                {
                    return error;
                }
+0 −1
Original line number Diff line number Diff line
@@ -162,7 +162,6 @@
#define TMP_FIX_1119_SPLIT_RENDERING_VOIP               /* FhG: Add error check for unsupported config: split rendering with VoIP mode */
#define FIX_1314_STEREO_TO_EXT                          /* VA: issue 1314: set RENDERER_DISABLE for stereo to EXT output */
#define JBM_MEMORY_OPT                                  /* VA: issue 916: optimization of RAM in the JBM decoder */
#define JBM_MEMORY_OPT_FLUSH

/* #################### End BE switches ################################## */

+1 −15
Original line number Diff line number Diff line
@@ -1434,9 +1434,6 @@ ivas_error ivas_jbm_dec_flush_renderer(
    int16_t n_samples_still_available;
    int16_t n_slots_still_available;
    int16_t n_samples_to_render;
#ifdef JBM_MEMORY_OPT_FLUSH
    uint16_t offset;
#endif
    DECODER_TC_BUFFER_HANDLE hTcBuffer;
    float *p_output[MAX_CICP_CHANNELS + MAX_NUM_OBJECTS];

@@ -1445,9 +1442,6 @@ ivas_error ivas_jbm_dec_flush_renderer(
        return IVAS_ERR_OK;
    }

#ifdef JBM_MEMORY_OPT_FLUSH
    offset = *nSamplesRendered * st_ivas->hDecoderConfig->nchan_out;
#endif
    *nSamplesRendered = 0;
    hTcBuffer = st_ivas->hTcBuffer;

@@ -1682,18 +1676,10 @@ ivas_error ivas_jbm_dec_flush_renderer(
#ifdef DEBUGGING
            st_ivas->noClipping +=
#endif
#ifdef JBM_MEMORY_OPT_FLUSH
                ivas_syn_output( p_output, *nSamplesRendered, st_ivas->hDecoderConfig->nchan_out, (int16_t *) data + offset );
#else
                ivas_syn_output( p_output, *nSamplesRendered, st_ivas->hDecoderConfig->nchan_out, (int16_t *) data );
#endif
            break;
        case PCM_FLOAT32:
#ifdef JBM_MEMORY_OPT_FLUSH
            ivas_syn_output_f( p_output, *nSamplesRendered, st_ivas->hDecoderConfig->nchan_out, (float *) data + offset );
#else
            ivas_syn_output_f( p_output, *nSamplesRendered, st_ivas->hDecoderConfig->nchan_out, (float *) data );
#endif
            break;
        default:
            error = IVAS_ERR_UNKNOWN;
+3 −36
Original line number Diff line number Diff line
@@ -100,9 +100,7 @@ struct IVAS_DEC
    int16_t CNG;                /* RXDTX handler: CNG=1, nonCNG=0 */

    uint16_t nSamplesFlushed;
#ifndef JBM_MEMORY_OPT_FLUSH
    void *flushbuffer;
#endif
    IVAS_DEC_PCM_TYPE pcmType;
    bool hasBeenPreparedRendering;
};
@@ -180,9 +178,7 @@ ivas_error IVAS_DEC_Open(
    hIvasDec->hasDecodedFirstGoodFrame = false;
    hIvasDec->isInitialized = false;
    hIvasDec->updateOrientation = false;
#ifndef JBM_MEMORY_OPT_FLUSH
    hIvasDec->flushbuffer = NULL;
#endif
    hIvasDec->pcmType = IVAS_DEC_PCM_INVALID;
    hIvasDec->nSamplesFlushed = 0;
    hIvasDec->hasBeenPreparedRendering = false;
@@ -364,12 +360,10 @@ void IVAS_DEC_Close(
        free( ( *phIvasDec )->apaExecBuffer );
    }
#endif
#ifndef JBM_MEMORY_OPT_FLUSH
    if ( ( *phIvasDec )->flushbuffer != NULL )
    {
        free( ( *phIvasDec )->flushbuffer );
    }
#endif

    free( *phIvasDec );
    *phIvasDec = NULL;
@@ -413,7 +407,7 @@ static IVAS_DEC_BS_FORMAT mapIvasFormat(
    return IVAS_DEC_BS_UNKOWN;
}

#ifndef JBM_MEMORY_OPT_FLUSH

/*---------------------------------------------------------------------*
 * create_flush_buffer()
 *
@@ -435,7 +429,7 @@ static ivas_error create_flush_buffer(

    return IVAS_ERR_OK;
}
#endif


/*---------------------------------------------------------------------*
 * IVAS_DEC_Configure( )
@@ -818,16 +812,12 @@ ivas_error IVAS_DEC_EnableVoIP(
    }
#endif

#ifdef JBM_MEMORY_OPT_FLUSH
    hIvasDec->pcmType = IVAS_DEC_PCM_INT16;
#else
    /* init flush buffer (needed for binaural outputs) */
    if ( ( error = create_flush_buffer( hIvasDec ) ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "\nError in create_flush_buffer , code: %d\n", error );
        return error;
    }
#endif

    return IVAS_ERR_OK;
}
@@ -975,10 +965,6 @@ static IVAS_BIN_RENDERER_TYPE renderer_type_to_mode(

ivas_error IVAS_DEC_ReadFormat(
    IVAS_DEC_HANDLE hIvasDec,                      /* i/o: IVAS decoder handle                      */
#ifdef JBM_MEMORY_OPT_FLUSH
    void *pcmBuf,                    /* o  : output synthesis signal                  */
    const uint16_t nSamplesRendered, /* i  : number of samples rendered               */
#endif
    IVAS_BIN_RENDERER_TYPE *binaural_renderer,     /* o  : binaural renderer type                   */
    IVAS_BIN_RENDERER_TYPE *binaural_renderer_sec, /* o  : secondary binaural renderer type         */
    IVAS_AUDIO_CONFIG *hrtf_set_audio_cfg          /* o  : HRTF set audio config.                   */
@@ -1100,12 +1086,7 @@ ivas_error IVAS_DEC_ReadFormat(
            /* when granularity goes down, render what still fits in the new granularity */
            if ( tc_granularity_new < st_ivas->hTcBuffer->n_samples_granularity )
            {
#ifdef JBM_MEMORY_OPT_FLUSH
                hIvasDec->nSamplesFlushed = nSamplesRendered;
                if ( ( error = ivas_jbm_dec_flush_renderer( st_ivas, tc_granularity_new, renderer_type_old, intern_config_old, &st_ivas->hIntSetup, mc_mode_old, ism_mode_old, &hIvasDec->nSamplesFlushed, pcm_type_API_to_internal( hIvasDec->pcmType ), pcmBuf ) ) != IVAS_ERR_OK )
#else
                if ( ( error = ivas_jbm_dec_flush_renderer( st_ivas, tc_granularity_new, renderer_type_old, intern_config_old, &st_ivas->hIntSetup, mc_mode_old, ism_mode_old, &hIvasDec->nSamplesFlushed, pcm_type_API_to_internal( hIvasDec->pcmType ), hIvasDec->flushbuffer ) ) != IVAS_ERR_OK )
#endif
                {
                    return error;
                }
@@ -1833,14 +1814,9 @@ ivas_error IVAS_DEC_GetSamplesRenderer(
        nOutChannels = (uint8_t) st_ivas->hDecoderConfig->nchan_out;
        hIvasDec->hasBeenFedFrame = false;

#ifdef JBM_MEMORY_OPT_FLUSH
        /* JBM rate switching: take into account possibly flushed samples (samples were written to pcmBuf[] in ivas_jbm_dec_flush_renderer()) */
#else
        /* check for possible flushed samples from a rate switch */
#endif
        if ( hIvasDec->nSamplesFlushed > 0 )
        {
#ifndef JBM_MEMORY_OPT_FLUSH
#ifdef DEBUGGING
            assert( hIvasDec->pcmType == pcmType );
#endif
@@ -1858,7 +1834,6 @@ ivas_error IVAS_DEC_GetSamplesRenderer(
            {
                assert( 0 && "wrong PCM type for the flush buffer!" );
            }
#endif
#endif
            nSamplesRendered = hIvasDec->nSamplesFlushed;
            hIvasDec->nSamplesFlushed = 0;
@@ -1939,9 +1914,6 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream(

    numPoses = hSplitBinRend->splitrend.multiBinPoseData.num_poses;

#ifdef JBM_MEMORY_OPT_FLUSH
    hIvasDec->pcmType = IVAS_DEC_PCM_FLOAT;
#else
    /* init flush buffer for rate switch if not already initizalized */
    if ( hIvasDec->flushbuffer == NULL )
    {
@@ -1953,7 +1925,6 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream(
        hIvasDec->pcmType = IVAS_DEC_PCM_FLOAT;
        set_zero( (float *) hIvasDec->flushbuffer, numPoses * BINAURAL_CHANNELS * hIvasDec->nSamplesFrame / IVAS_MAX_PARAM_SPATIAL_SUBFRAMES );
    }
#endif

    if ( st_ivas->hDecoderConfig->render_framesize != IVAS_RENDER_FRAMESIZE_20MS &&
         ( st_ivas->hRenderConfig->split_rend_config.poseCorrectionMode == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE ||
@@ -3426,9 +3397,6 @@ ivas_error IVAS_DEC_EnableTsm(

    hIvasDec->st_ivas->hDecoderConfig->Opt_tsm = 1;

#ifdef JBM_MEMORY_OPT_FLUSH
    hIvasDec->pcmType = IVAS_DEC_PCM_INT16;
#else
    /* init flush buffer if necessary (only needed for binaural) */
    output_config = hIvasDec->st_ivas->hDecoderConfig->output_config;
    if ( hIvasDec->flushbuffer == NULL && ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
@@ -3438,7 +3406,6 @@ ivas_error IVAS_DEC_EnableTsm(
            return error;
        }
    }
#endif

    return IVAS_ERR_OK;
}
+0 −4
Original line number Diff line number Diff line
@@ -154,10 +154,6 @@ ivas_error IVAS_DEC_FeedFrame_Serial(

ivas_error IVAS_DEC_ReadFormat(
    IVAS_DEC_HANDLE hIvasDec,                   /* i/o: IVAS decoder handle                                                     */
#ifdef JBM_MEMORY_OPT_FLUSH
    void *pcmBuf,                               /* o  : output synthesis signal                                                 */
    const uint16_t nSamplesRendered,            /* i  : number of samples rendered                                              */
#endif
    IVAS_BIN_RENDERER_TYPE *binaural_renderer,  /* o  : binaural renderer type                                                  */
    IVAS_BIN_RENDERER_TYPE *binaural_renderer_sec,/* o: secondary binaural renderer type                                        */
    IVAS_AUDIO_CONFIG *hrtf_set_audio_cfg       /* o  : HRTF set audio config.                                                  */