From e03186791019783b33be2d2a7559e82fe03b7eef Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 17 Sep 2024 15:36:10 +0200 Subject: [PATCH 1/2] issue 1181: correct complexity counting of bitstream-related functions; changes are in positions of WMC_TOOL_SKI --- lib_com/bitstream.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib_com/bitstream.c b/lib_com/bitstream.c index 47fbbb9db2..f4b3b58ba0 100644 --- a/lib_com/bitstream.c +++ b/lib_com/bitstream.c @@ -1428,7 +1428,6 @@ uint16_t get_indice_1( return st->bit_stream[pos]; } -#define WMC_TOOL_SKIP /*-------------------------------------------------------------------* * reset_indices_enc() @@ -1468,6 +1467,8 @@ void reset_indices_dec( return; } +#define WMC_TOOL_SKIP + /*-------------------------------------------------------------------* * write_indices_to_stream() * @@ -1838,6 +1839,9 @@ void convertBytestreamToSerial( } } + +#undef WMC_TOOL_SKIP + /*-------------------------------------------------------------------* * decoder_selectCodec() * @@ -2788,6 +2792,7 @@ ivas_error preview_indices( } #endif +#define WMC_TOOL_SKIP /*-------------------------------------------------------------------* * read_indices() @@ -3050,6 +3055,8 @@ ivas_error read_indices( return error; } +#undef WMC_TOOL_SKIP + /*-------------------------------------------------------------------* * get_rfFrameType() * @@ -3467,5 +3474,3 @@ void dtx_read_padding_bits( return; } - -#undef WMC_TOOL_SKIP -- GitLab From f7b6f915aa20279d09a8c3c6e0eb03e4de712e86 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 1 Oct 2024 14:42:40 +0200 Subject: [PATCH 2/2] completely remove WMC_TOOL_SKIP from bitstream.c file + correct comments --- lib_com/bitstream.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/lib_com/bitstream.c b/lib_com/bitstream.c index f4b3b58ba0..babb9f3e0e 100644 --- a/lib_com/bitstream.c +++ b/lib_com/bitstream.c @@ -1467,7 +1467,6 @@ void reset_indices_dec( return; } -#define WMC_TOOL_SKIP /*-------------------------------------------------------------------* * write_indices_to_stream() @@ -1840,8 +1839,6 @@ void convertBytestreamToSerial( } -#undef WMC_TOOL_SKIP - /*-------------------------------------------------------------------* * decoder_selectCodec() * @@ -2519,8 +2516,8 @@ void ivas_set_bitstream_pointers( return; } - #ifdef DEBUGGING + /*-------------------------------------------------------------------* * preview_indices() * @@ -2790,15 +2787,15 @@ ivas_error preview_indices( return error; } -#endif -#define WMC_TOOL_SKIP +#endif /*-------------------------------------------------------------------* * read_indices() * - * Read indices from an ITU-T G.192 bitstream to the buffer - * Simulate packet losses by inserting frame erasures + * Detect SID, NO_DATA, BFI, etc. and set bitstream pointers + * Set ivas_total_brate + * Note: each bit is represented in bitsream buffer as a uint16_t of value 0 or 1 *-------------------------------------------------------------------*/ /*! r: 1 = reading OK, 0 = problem */ @@ -2843,8 +2840,8 @@ ivas_error read_indices( /* convert the frame length to total bitrate */ total_brate = (int32_t) ( num_bits * FRAMES_PER_SEC ); - /* verify that a valid num bits value is present in the G.192 file */ - /* only AMRWB, EVS or IVAS bitrates or 0(NO DATA) are allowed in G.192 file frame reading */ + /* verify that a valid num bits value is present */ + /* only AMRWB, EVS or IVAS bitrates or 0(NO DATA) are allowed */ if ( st_ivas->ivas_format != MONO_FORMAT ) { k = 0; @@ -2863,7 +2860,7 @@ ivas_error read_indices( } else if ( k == SIZE_IVAS_BRATE_TBL ) { - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error, illegal bitrate (%d) in the G.192 frame ! Exiting ! \n", total_brate ); + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error, illegal bitrate (%d) detected! Exiting ! \n", total_brate ); } else { @@ -2876,12 +2873,12 @@ ivas_error read_indices( if ( rate2EVSmode( total_brate, NULL ) < 0 ) /* negative value means that a valid rate was not found */ { - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error, illegal bitrate (%d) in the G.192 frame ! Exiting ! \n", total_brate ); + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error, illegal bitrate (%d) detected! Exiting ! \n", total_brate ); } } - /* G.192 RX DTX handler*/ - /* handle SID_FIRST, SID_BAD, SPEECH_LOST, NO_DATA as properly as possible for the ITU-T G.192 format */ + /* RX DTX handler*/ + /* handle SID_FIRST, SID_BAD, SPEECH_LOST, NO_DATA */ /* (total_brate, bfi , st_CNG) = rx_handler(received frame type, [previous frame type], past CNG state, past core) */ curr_ft_good_sp = 0; curr_ft_bad_sp = 0; @@ -3041,7 +3038,6 @@ ivas_error read_indices( /* GOOD frame */ if ( st_ivas->bfi == 0 || st_ivas->bfi == FRAMEMODE_FUTURE ) { - /* GOOD frame - convert ITU-T G.192 words to short values */ st_ivas->hDecoderConfig->ivas_total_brate = total_brate; } @@ -3055,7 +3051,6 @@ ivas_error read_indices( return error; } -#undef WMC_TOOL_SKIP /*-------------------------------------------------------------------* * get_rfFrameType() -- GitLab