Commit 510f03e9 authored by multrus's avatar multrus
Browse files

Merge branch 'ivas_basop_issue_2551' into 'main'

Fixed Issue 2551: "Harmonize function pair tcx_scalar_quantization_fx()"

Closes #2551

See merge request !2985
parents 890c2fc7 3349a87b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -100,6 +100,7 @@
#define FIX_2402_REPL_EVS_ARI_CODEC_ENC                 /* FhG: basop issue 2402: replace EVS arith encoder with IVAS arith encoder */
#define FIX_BASOP_2546_HARMONIZE_TCX_SCALAR             /* FhG: Fix issue 2546 Harmonize function tcx_scalar_quantization_rateloop*/
#define FIX_BASOP_2532_cx_e                             /* FhG: Fix issue 2532 about additional exponent variable*/
#define FIX_BASOP_2551_HARM_SCALAR_QUAN                 /* FhG: issue 2551: Harmonize function pair tcx_scalar_quantization_fx*/
#define HARMONIZE_2543_SQ_gain                          /* FhG: Harmonize SQ_gain */
#define FIX_ISSUE_2533_EXTRA_CONDITION                  /* FhG: Fix issue basop 2533 removing the extra condition*/
#define HARMONIZE_2537_SetTCXModeInfo                   /* FhG: Harmonize SetTCXModeInfo  - IVAS_VERSION OBVIOUSLY NOT FITTING FOR EVS - pipes not green */
+15 −1
Original line number Diff line number Diff line
@@ -8547,7 +8547,7 @@ void ari_start_encoding_14bits_fx(
void ari_start_encoding_14bits_ivas_fx(
#endif
    Tastat *s );

#ifndef FIX_BASOP_2551_HARM_SCALAR_QUAN
void tcx_scalar_quantization_ivas_fx(
    Word32 *x,                     /* i: input coefficients            */
    Word16 x_e,                    /* i: exponent                      */
@@ -8558,6 +8558,20 @@ void tcx_scalar_quantization_ivas_fx(
    Word16 offset,                 /* i: rounding offset (deadzone)    */
    Word8 const *memQuantZeros_fx, /* i: coefficients to be set to 0   */
    const Word16 alfe_flag );
#else
void tcx_scalar_quantization_fx(
    Word32 *x,                     /* i: input coefficients            */
    Word16 x_e,                    /* i: exponent                      */
    Word16 *xq,                    /* o: quantized coefficients        */
    Word16 L_frame,                /* i: frame length                  */
    Word16 gain,                   /* i: quantization gain             */
    Word16 gain_e,                 /* i: quantization gain exponent    */
    Word16 offset,                 /* i: rounding offset (deadzone)    */
    Word8 const *memQuantZeros_fx, /* i: coefficients to be set to 0   */
    const Word16 alfe_flag,
    const Word16 element_mode );
#endif // !FIX_BASOP_2551_HARM_SCALAR_QUAN


Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx(
    Word16 *x,                /* Spectral coefficients Q0*/
+49 −5
Original line number Diff line number Diff line
@@ -1445,6 +1445,7 @@ void QuantizeSpectrum_fx(
                                     &sqGain_e );
#endif

#ifndef FIX_BASOP_2551_HARM_SCALAR_QUAN
                tcx_scalar_quantization_fx( OriginalSpectrum, OriginalSpectrum_e,
                                            sqQ,
                                            L_spec,
@@ -1452,6 +1453,17 @@ void QuantizeSpectrum_fx(
                                            hTcxCfg->sq_rounding,
                                            hTcxEnc->memQuantZeros,
                                            tcxonly );
#else
                tcx_scalar_quantization_fx( OriginalSpectrum, OriginalSpectrum_e,
                                            sqQ,
                                            L_spec,
                                            sqGain, sqGain_e,
                                            hTcxCfg->sq_rounding,
                                            hTcxEnc->memQuantZeros,
                                            tcxonly,
                                            st->element_mode );
#endif // !FIX_BASOP_2551_HARM_SCALAR_QUAN


                /* Estimate original bitrate */
                stop = 0;
@@ -1546,7 +1558,7 @@ void QuantizeSpectrum_fx(
#endif

                /* Quantize spectrum */

#ifndef FIX_BASOP_2551_HARM_SCALAR_QUAN
                tcx_scalar_quantization_fx( spectrum, *spectrum_e,
                                            sqQ,
                                            L_spec,
@@ -1554,6 +1566,16 @@ void QuantizeSpectrum_fx(
                                            hTcxCfg->sq_rounding,
                                            hTcxEnc->memQuantZeros,
                                            tcxonly );
#else
                tcx_scalar_quantization_fx( spectrum, *spectrum_e,
                                            sqQ,
                                            L_spec,
                                            sqGain, sqGain_e,
                                            hTcxCfg->sq_rounding,
                                            hTcxEnc->memQuantZeros,
                                            tcxonly,
                                            st->element_mode );
#endif // !FIX_BASOP_2551_HARM_SCALAR_QUAN

                /* Estimate bitrate */
                stop = 0;
@@ -1763,7 +1785,7 @@ void QuantizeSpectrum_fx(
            {
                sqGain = tmp1;
                sqGain_e = s;

#ifndef FIX_BASOP_2551_HARM_SCALAR_QUAN
                tcx_scalar_quantization_fx( spectrum, *spectrum_e,
                                            sqQ,
                                            L_spec,
@@ -1771,6 +1793,18 @@ void QuantizeSpectrum_fx(
                                            hTcxCfg->sq_rounding,
                                            hTcxEnc->memQuantZeros,
                                            tcxonly );
#else
                tcx_scalar_quantization_fx( spectrum, *spectrum_e,
                                            sqQ,
                                            L_spec,
                                            sqGain, sqGain_e,
                                            hTcxCfg->sq_rounding,
                                            hTcxEnc->memQuantZeros,
                                            tcxonly,
                                            st->element_mode );

#endif // !FIX_BASOP_2551_HARM_SCALAR_QUAN


                move16();
                stop = 1;
@@ -3079,8 +3113,11 @@ void QuantizeTCXSpectrum_fx(
            sqGain_fx = SQ_gain_ivas_fx( spectrum_fx, *spectrum_e, ( mult( hTcxEnc->tcx_target_bits_fac, shl( sqTargetBits, 1 ) ) ), L_spec, &sqGain_e );
#endif

#ifndef FIX_BASOP_2551_HARM_SCALAR_QUAN
            tcx_scalar_quantization_ivas_fx( spectrum_fx, *spectrum_e, sqQ, L_spec, sqGain_fx, sqGain_e, st->hTcxCfg->sq_rounding, hTcxEnc->memQuantZeros, st->tcxonly );

#else
            tcx_scalar_quantization_fx( spectrum_fx, *spectrum_e, sqQ, L_spec, sqGain_fx, sqGain_e, st->hTcxCfg->sq_rounding, hTcxEnc->memQuantZeros, st->tcxonly, st->element_mode );
#endif // !FIX_BASOP_2551_HARM_SCALAR_QUAN
            /* Estimate original bitrate */
            stop = 0;
            move16();
@@ -3175,8 +3212,11 @@ void QuantizeTCXSpectrum_fx(
#endif
            }
            /* Quantize spectrum */
#ifndef FIX_BASOP_2551_HARM_SCALAR_QUAN
            tcx_scalar_quantization_ivas_fx( spectrum_fx, *spectrum_e, sqQ, L_spec, sqGain_fx, sqGain_e, st->hTcxCfg->sq_rounding, hTcxEnc->memQuantZeros, st->tcxonly );

#else
            tcx_scalar_quantization_fx( spectrum_fx, *spectrum_e, sqQ, L_spec, sqGain_fx, sqGain_e, st->hTcxCfg->sq_rounding, hTcxEnc->memQuantZeros, st->tcxonly, st->element_mode );
#endif
            /* Estimate bitrate */
            stop = 0;
            move16();
@@ -3445,8 +3485,12 @@ void QuantizeTCXSpectrum_fx(
            move16();
            sqGain_e = 1;
            move16();

#ifndef FIX_BASOP_2551_HARM_SCALAR_QUAN
            tcx_scalar_quantization_ivas_fx( spectrum_fx, *spectrum_e, sqQ, L_spec, sqGain_fx, sqGain_e, st->hTcxCfg->sq_rounding, hTcxEnc->memQuantZeros, st->tcxonly );
#else
            tcx_scalar_quantization_fx( spectrum_fx, *spectrum_e, sqQ, L_spec, sqGain_fx, sqGain_e, st->hTcxCfg->sq_rounding, hTcxEnc->memQuantZeros, st->tcxonly, st->element_mode );
#endif // !FIX_BASOP_2551_HARM_SCALAR_QUAN

            stop = 1;
            IF( st->element_mode > EVS_MONO )
            {
+5 −0
Original line number Diff line number Diff line
@@ -969,7 +969,12 @@ static Word16 QuantSpecEstimateBits_fx(
    Word16 stop, sqBits, nEncoded;
    Word16 lastnz;

#ifndef FIX_BASOP_2551_HARM_SCALAR_QUAN
    tcx_scalar_quantization_ivas_fx( spec_fx, spec_e, sqQ, length, G_fx, G_e, 16384 /*Q15*/, NULL, 1 );
#else
    // This flag could potentially be anything except EVS_MONO. In case of future errors consider passing down the flag from higher function calls.
    tcx_scalar_quantization_fx( spec_fx, spec_e, sqQ, length, G_fx, G_e, 16384 /*Q15*/, NULL, 1, IVAS_SCE );
#endif // !FIX_BASOP_2551_HARM_SCALAR_QUAN

    stop = 0;
    move16();
+3 −0
Original line number Diff line number Diff line
@@ -1143,6 +1143,7 @@ Word16 SQ_gain_estimate_fx(
    Word16 *gain_e  /* o  : SQ gain exponent          */
);

#ifndef FIX_BASOP_2551_HARM_SCALAR_QUAN
void tcx_scalar_quantization_fx(
    Word32 *x,                  /* i  : i   coefficients              */
    Word16 x_e,                 /* i  : exponent                      */
@@ -1153,6 +1154,8 @@ void tcx_scalar_quantization_fx(
    Word16 offset,              /* i  : rounding offset (deadzone)    */
    Word8 const *memQuantZeros, /* i  : coefficients to be set to 0   */
    const Word16 alfe_flag );
#endif // !FIX_BASOP_2551_HARM_SCALAR_QUAN

#ifndef FIX_BASOP_2546_HARMONIZE_TCX_SCALAR
Word16 tcx_scalar_quantization_rateloop_fx(
    Word32 *x,                  /* i  : i   coefficients              */
Loading