diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 7d84adbb12c971c785f1f08baeff0bd98035fb9b..0512cf27e6e4f8004af29f667e3097e234dd26a0 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1319,7 +1319,11 @@ typedef enum #define PANNING_ELE_RESOLUTION 5 #define EFAP_MAX_CHAN_NUM 5 /* Maximum number of channels that constitute a polygon, 4 or 5 */ +#ifdef ALLRAD_OPTIM +#define EFAP_MAX_POLY_SET 50 /* Upper bound on number of polygons; with a Speaker setup of 16.0, we obtain 44 polygons/triangles in the matlab implementation. */ +#else #define EFAP_MAX_POLY_SET 70 /* Upper bound on number of polygons; with a Speaker setup of 26.0, we obtain 54 polygons/triangles in the matlab implementation. */ +#endif #define EFAP_MODE_EFAP 0 /* EFAP Panning */ #define EFAP_MODE_EFIP 1 /* EFIP Panning */ diff --git a/lib_com/options.h b/lib_com/options.h index 87edfc787edce348c10670ba0a1dcf337012b3b2..27d1004fbdb8b7ae9a0c74f55b122e96995faaba 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -152,6 +152,7 @@ #define FIX_155_HP20_ISSUE /* Issue 155: apply hp20 on all input channels instead of just 2 channels */ #define EFAP_FIX_POLY /* Issue 167: fix bug in EFAP polygon selection */ #define SBA_HOA_HBR_IMPROV /* issue 91: Improvements to SBA high bitrate HOA3 coding */ +#define ALLRAD_OPTIM /* Issue 159: Optimize memory allocation for ALLRAD */ #define FIX_I178_HQ_BUFFER_OVERRUN /* issue 178: Buffer overrun in HQ core decoder -- spectral filling buffer did not account for extended transition frame in IVAS */ #define PRINT_SBA_ORDER /* Issue 179: print-out also the SBA order of IVAS SBA format to stdout */ diff --git a/lib_dec/ivas_allrad_dec.c b/lib_dec/ivas_allrad_dec.c index d4301c07ace13144d07d34b30e1468d9e9c6a6a5..13e4f3c2410bae840e59d1d2908bb83012764c94 100644 --- a/lib_dec/ivas_allrad_dec.c +++ b/lib_dec/ivas_allrad_dec.c @@ -108,7 +108,11 @@ ivas_error ivas_sba_get_hoa_dec_matrix( /* Allocate memory */ assert( *hoa_dec_mtx == NULL && "hoa_dec_mtx != NULL" ); +#ifdef ALLRAD_OPTIM + if ( ( *hoa_dec_mtx = (float *) count_malloc( SBA_NHARM_HOA3 * ( hOutSetup.nchan_out_woLFE ) * sizeof( float ) ) ) == NULL ) +#else if ( ( *hoa_dec_mtx = (float *) count_malloc( SBA_NHARM_HOA3 * MAX_OUTPUT_CHANNELS * sizeof( float ) ) ) == NULL ) +#endif { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "ALLRAD: Cannot allocate memory!" ) ); }