Commit 121988a4 authored by fotopoulou's avatar fotopoulou
Browse files

fix for issue 1329

parent 7d2306a7
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@
/* ################### Start DEBUGGING switches ########################### */

#ifndef RELEASE
/*#define DEBUGGING*/                          /* Activate debugging part of the code */
#define DEBUGGING                           /* Activate debugging part of the code */
#endif
/*#define WMOPS*/                               /* Activate complexity and memory counters */
/*#define WMOPS_PER_FRAME*/                     /* Output per-frame complexity (writes one float value per frame to the file "wmops_analysis") */
@@ -58,14 +58,14 @@

#ifdef DEBUGGING
/*#define DBG_BITSTREAM_ANALYSIS*/              /* Write bitstream with annotations to a text file */
/*#define DEBUG_MODE_INFO*/                     /* output most important parameters to the subdirectory "res/" */
#define DEBUG_MODE_INFO                    /* output most important parameters to the subdirectory "res/" */
#ifdef DEBUG_MODE_INFO
/*#define DEBUG_MODE_ACELP*/                    /* output most important ACELP core parameters to the subdirectory "res/" */
/*#define DEBUG_MODE_TCX*/                      /* output most important TCX core parameters to the subdirectory "res/" */
/*#define DEBUG_MODE_DFT*/                      /* output most important DFT stereo parameters to the subdirectory "res/" */
/*#define DEBUG_MODE_TD*/                       /* output most important TD stereo parameters to the subdirectory "res/ */
/*#define DEBUG_MODE_DIRAC*/                    /* output most important DIRAC parameters to the subdirectory "res/" */
/*#define DEBUG_MODE_MDCT*/                     /* output most important MDCT parameters to the subdirectory "res/" */
#define DEBUG_MODE_MDCT                     /* output most important MDCT parameters to the subdirectory "res/" */
/*#define DEBUG_MODE_PARAM_MC*/                 /* output Parametric MC paramters to the subdirectory "res/" */
/*#define DEBUG_MODE_PARAM_ISM*/                /* output Parametric ISM paramters to the subdirectory "res/" */
/*#define DEBUG_MODE_INFO_TWEAK*/               /* enable command line switch to specify subdirectory for debug info output inside "./res/" */
@@ -77,7 +77,7 @@
#endif

#ifdef DEBUG_MODE_MDCT
/*#define DEBUG_PLOT_BITS*/
#define DEBUG_PLOT_BITS
#endif

#ifdef DEBUG_MODE_DFT
@@ -176,6 +176,7 @@
#define NONBE_1250_MCMASA_LS_OUTPUT                     /* VA: issue 1250: fix crash in McMASA to custom LS output decoding */
#define NONBE_1302_FIX_OMASA_JBM_FLUSH                  /* VA: issue 1302: fix OMASA JBM bitrate switching flush in binaural output */
#define NONBE_1324_TC_BUFFER_MEMOERY_KEEP               /* VA: issue 1324: do not reset TSM memory in JBM bitrate switching */
#define NONBE_1329_FIX_OSBA_CRASH                       /* FhG: issue 1329: prevent assert when bit budget is low*/

/* ##################### End NON-BE switches ########################### */

+18 −6
Original line number Diff line number Diff line
@@ -411,6 +411,15 @@ void stereo_coder_tcx(

            nAvailBitsMS[k] = ( ( mct_on ? 2 * sts[0]->bits_frame_channel : sts[0]->bits_frame_nominal ) - sts[0]->side_bits_frame_channel - sts[1]->side_bits_frame_channel - ( nSubframes == 2 ? OFFSET_BITS_TCX10 : OFFSET_BITS_TCX20 ) ) / nSubframes;

#ifdef NONBE_1329_FIX_OSBA_CRASH
            if ( mct_on && nAvailBitsMS[k] < 0 ) /*Force M/S when bit-budget is low for MCT*/
            {
                hStereoMdct->mdct_stereo_mode[k] = 1;
                hStereoMdct->IGFStereoMode[k] = 1;
            }
            else
            {
#endif
                MsStereoDecision( sfbConf, sts[0]->hTcxEnc->spectrum[k], sts[1]->hTcxEnc->spectrum[k], inv_spectrum[0][k], inv_spectrum[1][k], &hStereoMdct->mdct_stereo_mode[k], &ms_mask[k][0], nAvailBitsMS[k] );

                if ( sts[0]->igf )
@@ -422,6 +431,9 @@ void stereo_coder_tcx(
                {
                    hStereoMdct->IGFStereoMode[k] = hStereoMdct->mdct_stereo_mode[k];
                }
#ifdef NONBE_1329_FIX_OSBA_CRASH
            }
#endif

            if ( hStereoMdct->mdct_stereo_mode[k] != SMDCT_DUAL_MONO || hStereoMdct->IGFStereoMode[k] != SMDCT_DUAL_MONO )
            {