diff --git a/lib_com/options.h b/lib_com/options.h index 7b42e8dfa305976a15b603b102b0ef41466cf676..2365f6bc8b91b63680caeec5cb334b3d49324dd6 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -162,14 +162,13 @@ #define IGF_MEMORY_ALLOC_OPT /* FhG: Issue 157: allocate IGF encoder structure only when needed */ #define FIX_732_PLANAR_SBA_OSBA /* Dlb : issue 732: fix for crash in planar mode in OSBA format*/ - #define FIX_708_DPID_COMMAND_LINE /* issue 708: sanity checks for '-dpid' command-line */ #define FIX_730_DPID_NOT_SET_CORRECTLY /* Eri: issue 730: write dpid read from file in correct index, print informative error message when DPID specified is not found. */ - #define FIX_RAM_COUNTING_5MS_RENDERING /* FhG: fix for correct RAM reporting with 5ms rendering */ #define FIX_786_ERROR_ISM_METADATA_READ /* VA: fix error reading past the last line of .csv metadata files */ +#define FIX_632_USAN_ERROR_NULL_POINTER /* FhG: issue 632 USAN offset to null pointer proto_diffuse_buffer_f in dirac rendering*/ +#define FIX_759_CODE_COVERAGE_OSBA /* VA: issue 759: remove obsolete code in the OSBA encoder */ -#define FIX_632_USAN_ERROR_NULL_POINTER /* FhG: issue 632 USAN offset to null pointer proto_diffuse_buffer_f in dirac rendering*/ /* #################### End BE switches ################################## */ /* #################### Start NON-BE switches ############################ */ diff --git a/lib_enc/ivas_enc.c b/lib_enc/ivas_enc.c index 85426f310dee102fdbe62cb66ad228b79170047b..f9f02b51b57a1c33b3eb47e34f2b5da952131fc8 100644 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -60,7 +60,9 @@ ivas_error ivas_enc( IVAS_FORMAT ivas_format; ENCODER_CONFIG_HANDLE hEncoderConfig; BSTR_ENC_HANDLE hMetaData; +#ifndef FIX_759_CODE_COVERAGE_OSBA Encoder_State *st; /* used for bitstream handling */ +#endif int16_t nb_bits_metadata[MAX_SCE + 1]; float *data_f[MAX_INPUT_CHANNELS + MAX_NUM_OBJECTS]; int32_t ivas_total_brate; @@ -226,6 +228,7 @@ ivas_error ivas_enc( return error; } #endif +#ifndef FIX_759_CODE_COVERAGE_OSBA st = ( st_ivas->nSCE > 0 ) ? st_ivas->hSCE[0]->hCoreCoder[0] : st_ivas->hCPE[0]->hCoreCoder[0]; /* Write SBA planar flag */ @@ -233,6 +236,7 @@ ivas_error ivas_enc( /* Write SBA order */ push_indice( st->hBstr, IND_SMODE, hEncoderConfig->sba_order, SBA_ORDER_BITS ); +#endif } else { @@ -410,15 +414,20 @@ ivas_error ivas_enc( #endif if ( st_ivas->nchan_transport == 1 ) { +#ifndef FIX_759_CODE_COVERAGE_OSBA st = st_ivas->hSCE[st_ivas->nSCE - 1]->hCoreCoder[0]; +#endif hMetaData = st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData; } else { +#ifndef FIX_759_CODE_COVERAGE_OSBA st = st_ivas->hCPE[0]->hCoreCoder[0]; +#endif hMetaData = st_ivas->hCPE[st_ivas->nCPE - 1]->hMetaData; } +#ifndef FIX_759_CODE_COVERAGE_OSBA if ( st_ivas->hEncoderConfig->ivas_total_brate < IVAS_24k4 ) { /* Write SBA planar flag */ @@ -435,13 +444,14 @@ ivas_error ivas_enc( /* write the number of objects in ISM_SBA format*/ push_next_indice( hMetaData, hEncoderConfig->nchan_ism - 1, NO_BITS_MASA_ISM_NO_OBJ ); - +#endif /* SBA metadata encoding and SBA metadata bitstream writing */ if ( ( error = ivas_spar_enc( st_ivas, data_f, input_frame, nb_bits_metadata, hMetaData ) ) != IVAS_ERR_OK ) { return error; } +#ifndef FIX_759_CODE_COVERAGE_OSBA /* core-coding of transport channels */ if ( st_ivas->nSCE == 1 ) { @@ -464,6 +474,7 @@ ivas_error ivas_enc( return error; } } +#endif #ifdef FIX_732_PLANAR_SBA_OSBA hEncoderConfig->sba_planar = planar_sba_orig; #endif @@ -472,26 +483,34 @@ ivas_error ivas_enc( { n = hEncoderConfig->nchan_ism; +#ifndef FIX_759_CODE_COVERAGE_OSBA st = st_ivas->hCPE[0]->hCoreCoder[0]; +#endif hMetaData = st_ivas->hCPE[st_ivas->nCPE - 1]->hMetaData; +#ifndef FIX_759_CODE_COVERAGE_OSBA if ( hEncoderConfig->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode != ISM_MODE_NONE ) { /* write the number of objects in ISM_SBA format*/ push_next_indice( hMetaData, hEncoderConfig->nchan_ism - 1, NO_BITS_MASA_ISM_NO_OBJ ); } - +#endif +#ifdef FIX_759_CODE_COVERAGE_OSBA + if ( ( error = ivas_ism_metadata_enc( &st_ivas->hEncoderConfig->ivas_total_brate, n, st_ivas->hEncoderConfig->nchan_ism, st_ivas->hIsmMetaData, NULL, hMetaData, &nb_bits_metadata[1], 0, st_ivas->ism_mode, NULL, st_ivas->hEncoderConfig->ism_extended_metadata_flag, -1, 0, NULL, st_ivas->hCPE[0]->hCoreCoder[0]->ini_frame ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_ism_metadata_enc( &st_ivas->hEncoderConfig->ivas_total_brate, n, st_ivas->hEncoderConfig->nchan_ism, st_ivas->hIsmMetaData, NULL, hMetaData, &nb_bits_metadata[1], 0, st_ivas->ism_mode, NULL, st_ivas->hEncoderConfig->ism_extended_metadata_flag, -1, 0, NULL, st->ini_frame ) ) != IVAS_ERR_OK ) +#endif { return error; } +#ifndef FIX_759_CODE_COVERAGE_OSBA /* Write SBA planar flag */ push_indice( st->hBstr, IND_SMODE, hEncoderConfig->sba_planar, SBA_PLANAR_BITS ); /* Write SBA order */ push_indice( st->hBstr, IND_SMODE, hEncoderConfig->sba_order, SBA_ORDER_BITS ); - +#endif /* SBA metadata encoding and SBA metadata bitstream writing */ if ( ( error = ivas_spar_enc( st_ivas, &data_f[n], input_frame, nb_bits_metadata, hMetaData ) ) != IVAS_ERR_OK ) { @@ -501,6 +520,7 @@ ivas_error ivas_enc( /* get SBA TCs */ ivas_sba_getTCs( &data_f[n], st_ivas, input_frame ); +#ifndef FIX_759_CODE_COVERAGE_OSBA /* encode SBA transport channels */ if ( st_ivas->nchan_transport == 1 ) { @@ -523,7 +543,33 @@ ivas_error ivas_enc( return error; } } +#endif } + +#ifdef FIX_759_CODE_COVERAGE_OSBA + /* core-coding of transport channels */ + if ( st_ivas->nSCE == 1 ) + { + if ( ( error = ivas_sce_enc( st_ivas, 0, data_f[0], input_frame, nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else if ( st_ivas->nCPE == 1 ) /* Stereo DMX */ + { + if ( ( error = ivas_cpe_enc( st_ivas, 0, data_f[0], data_f[1], input_frame, nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else if ( st_ivas->nCPE > 1 ) /* FOA/HOA format */ + { + if ( ( error = ivas_mct_enc( st_ivas, data_f, input_frame, nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) + { + return error; + } + } +#endif } else if ( ivas_format == MC_FORMAT ) { diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index 4b229f64460f29c8a4acf24e3a57406c42d799f8..5bf18e1ea7eefab8ba9146bbe6fe959b61b178f6 100644 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -337,10 +337,48 @@ ivas_error ivas_spar_enc( ) { ENCODER_CONFIG_HANDLE hEncoderConfig; +#ifdef FIX_759_CODE_COVERAGE_OSBA + Encoder_State *st0; /* used for bitstream handling */ +#endif ivas_error error; error = IVAS_ERR_OK; hEncoderConfig = st_ivas->hEncoderConfig; +#ifdef FIX_759_CODE_COVERAGE_OSBA + st0 = ( st_ivas->nSCE > 0 ) ? st_ivas->hSCE[0]->hCoreCoder[0] : st_ivas->hCPE[0]->hCoreCoder[0]; + + /* Write SBA signaling bits */ + if ( hEncoderConfig->ivas_format == SBA_FORMAT || ( hEncoderConfig->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_SBA_MODE_DISC ) ) + { + /* Write SBA planar flag */ + push_indice( st0->hBstr, IND_SMODE, hEncoderConfig->sba_planar, SBA_PLANAR_BITS ); + + /* Write SBA order */ + push_indice( st0->hBstr, IND_SMODE, hEncoderConfig->sba_order, SBA_ORDER_BITS ); + } + else /* ism_mode == ISM_MODE_NONE */ + { + if ( hEncoderConfig->ivas_total_brate < IVAS_24k4 ) + { + /* Write SBA planar flag */ + push_indice( st0->hBstr, IND_SMODE, hEncoderConfig->sba_planar, SBA_PLANAR_BITS ); + + /* hack to indicate OSBA bitstream at VLBR */ + push_indice( st0->hBstr, IND_SMODE, 0, SBA_ORDER_BITS ); + } + else + { + /* Write SBA order */ + push_indice( st0->hBstr, IND_SMODE, hEncoderConfig->sba_order, SBA_ORDER_BITS ); + } + } + + if ( hEncoderConfig->ivas_format == SBA_ISM_FORMAT ) + { + /* write the number of objects in ISM_SBA format*/ + push_indice( hMetaData, IND_ISM_NUM_OBJECTS, hEncoderConfig->nchan_ism - 1, NO_BITS_MASA_ISM_NO_OBJ ); + } +#endif /* front VAD */ if ( ( error = front_vad_spar( st_ivas->hSpar, data_f[0], hEncoderConfig, input_frame ) ) != IVAS_ERR_OK ) @@ -353,6 +391,7 @@ ivas_error ivas_spar_enc( ivas_sba_zero_vert_comp( data_f, st_ivas->sba_analysis_order, hEncoderConfig->sba_planar, input_frame ); } + /* SPAR encoder */ if ( ( error = ivas_spar_enc_process( st_ivas, hEncoderConfig, hMetaData, st_ivas->hSpar->front_vad_flag, data_f ) ) != IVAS_ERR_OK ) { return error;