Commit bacb1e53 authored by kinuthia's avatar kinuthia
Browse files

Merge branch 'remove-unused-file-segsnr' into 'main'

remove unused file lib_debug/segsnr.c

See merge request !508
parents 425ab4c9 a5579a48
Loading
Loading
Loading
Loading
Loading

lib_debug/segsnr.c

deleted100644 → 0
+0 −105
Original line number Diff line number Diff line
/******************************************************************************************************

   (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
   Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
   Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
   Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
   contributors to this repository. All Rights Reserved.

   This software is protected by copyright law and by international treaties.
   The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB,
   Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
   Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
   Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
   contributors to this repository retain full ownership rights in their respective contributions in
   the software. This notice grants no license of any kind, including but not limited to patent
   license, nor is any license granted by implication, estoppel or otherwise.

   Contributors are required to enter into the IVAS codec Public Collaboration agreement before making
   contributions.

   This software is provided "AS IS", without any express or implied warranties. The software is in the
   development stage. It is intended exclusively for experts who have experience with such software and
   solely for the purpose of inspection. All implied warranties of non-infringement, merchantability
   and fitness for a particular purpose are hereby disclaimed and excluded.

   Any dispute, controversy or claim arising under or in relation to providing this software shall be
   submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in
   accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
   the United Nations Convention on Contracts on the International Sales of Goods.

*******************************************************************************************************/

#include <math.h>
#ifdef DEBUGGING
#include "debug.h"
#endif
#include "wmc_auto.h"
#include <stdint.h>
#include "options.h"
#include "prot.h"

#define WMC_TOOL_SKIP

#ifdef OUTPUT_SNR
/*_____________________________________________________________________
 |                                                                     |
 |  FUNCTION NAME segsnr                                               |
 |      Computes the segmential signal-to-noise ratio between the      |
 |      signal x and its estimate xe of length n samples. The segment  |
 |      length is nseg samples.                                        |
 |
 |  INPUT
 |      x[0:n-1]   Signal of n samples.
 |      xe[0:n-1]  Estimated signal of n samples.
 |      n          Signal length.
 |      nseg       Segment length, must be a submultiple of n.
 |
 |  RETURN VALUE
 |      snr        Segmential signal to noise ratio in dB.
 |_____________________________________________________________________|
*/

float segsnr( float x[], float xe[], int16_t n, int16_t nseg )
{
    float snr = 0.0f;
    float signal, noise, error, fac;
    int16_t i, j;
    LOOP( 1 );
    for ( i = 0; i < n; i += nseg )
    {
        signal = 1e-6f;
        MOVE( 2 );
        noise = 1e-6f;
        LOOP( 1 );
        for ( j = 0; j < nseg; j++ )
        {
            signal += ( *x ) * ( *x );
            MAC( 1 );
            error = *x++ - *xe++;
            ADD( 1 );
            noise += error * error;
            MAC( 1 );
        }
        snr += (float) log10( signal / noise );
        TRANS( 1 );
        DIV( 1 );
        ADD( 1 );
    }
    fac = ( (float) ( 10 * nseg ) ) / (float) n;
    DIV( 1 );
    MULT( 1 );
    snr = fac * snr;
    MULT( 1 );
    ADD( 1 );
    BRANCH( 1 );
    if ( snr < -99.0f )
    {
        snr = -99.0f;
        MOVE( 1 );
    }
    return ( snr );
}
#endif

#undef WMC_TOOL_SKIP