Commit d1816da1 authored by vaclav's avatar vaclav
Browse files

clang-format

parent 22b14831
Loading
Loading
Loading
Loading
Loading
+57 −40
Original line number Diff line number Diff line
@@ -11,9 +11,7 @@
#include "options.h"
#include "functions.h"

void processAdjustGlobalGain_fl(LC3_INT* gg_idx, LC3_INT gg_idx_min, LC3_INT gg_idx_off, LC3_FLOAT* gain, LC3_INT target, LC3_INT nBits, LC3_INT* gainChange, LC3_INT fs_idx
    , LC3_INT16 hrmode, LC3_INT16 frame_dms
    )
void processAdjustGlobalGain_fl( LC3_INT *gg_idx, LC3_INT gg_idx_min, LC3_INT gg_idx_off, LC3_FLOAT *gain, LC3_INT target, LC3_INT nBits, LC3_INT *gainChange, LC3_INT fs_idx, LC3_INT16 hrmode, LC3_INT16 frame_dms )
{
    LC3_FLOAT delta = 0;
    LC3_INT delta2 = 0;
@@ -26,24 +24,35 @@ void processAdjustGlobalGain_fl(LC3_INT* gg_idx, LC3_INT gg_idx_min, LC3_INT gg_
        if ( target < 520 )
        {
            factor = 3;
        } else {
        }
        else
        {
            factor = 4;
        }
    } else if (frame_dms == 50)
    }
    else if ( frame_dms == 50 )
    {
        factor = 2;
    } else
    }
    else
    {
        factor = 1;
    }

    if (nBits < gg_p1[fs_idx]) {
    if ( nBits < gg_p1[fs_idx] )
    {
        delta = ( nBits + 48.0 ) / 16.0;
    } else if (nBits < gg_p2[fs_idx]) {
    }
    else if ( nBits < gg_p2[fs_idx] )
    {
        delta = ( nBits + gg_d[fs_idx] ) * gg_c[fs_idx];
    } else if (nBits < gg_p3[fs_idx]) {
    }
    else if ( nBits < gg_p3[fs_idx] )
    {
        delta = nBits / 48.0;
    } else {
    }
    else
    {
        delta = gg_p3[fs_idx] / 48.0;
    }

@@ -52,14 +61,17 @@ void processAdjustGlobalGain_fl(LC3_INT* gg_idx, LC3_INT gg_idx_min, LC3_INT gg_

    *gainChange = 0;

    if (*gg_idx == 255 && nBits > target) {
    if ( *gg_idx == 255 && nBits > target )
    {
        *gainChange = 1;
    }

    if ((*gg_idx < 255 && nBits > target) || (*gg_idx > 0 && nBits < target - delta2)) {
    if ( ( *gg_idx < 255 && nBits > target ) || ( *gg_idx > 0 && nBits < target - delta2 ) )
    {
        if ( hrmode )
        {
            if (nBits > target) {
            if ( nBits > target )
            {
                gg_idx_inc = (int) factor * ( ( ( nBits - target ) / delta ) + 1 );
                gg_idx_inc = MIN( gg_idx_inc, 10 * factor );

@@ -70,11 +82,16 @@ void processAdjustGlobalGain_fl(LC3_INT* gg_idx, LC3_INT gg_idx_min, LC3_INT gg_
        }
        else
        {
            if (nBits < target - delta2) {
            if ( nBits < target - delta2 )
            {
                *gg_idx = *gg_idx - 1;
            } else if (*gg_idx == 254 || nBits < target + delta) {
            }
            else if ( *gg_idx == 254 || nBits < target + delta )
            {
                *gg_idx = *gg_idx + 1;
            } else {
            }
            else
            {
                *gg_idx = *gg_idx + 2;
            }
        }
+2035 −1329

File changed.

Preview size limit exceeded, changes collapsed.

+593 −473

File changed.

Preview size limit exceeded, changes collapsed.

+58 −42
Original line number Diff line number Diff line
@@ -11,8 +11,7 @@
#include "options.h"
#include "functions.h"

void attack_detector_fl(LC3_FLOAT* in, LC3_INT frame_size, LC3_INT fs, LC3_INT* lastAttackPosition, LC3_FLOAT* accNrg, LC3_INT* attackFlag,
                        LC3_FLOAT* attdec_filter_mem, LC3_INT attackHandlingOn, LC3_INT attdec_nblocks, LC3_INT attdec_hangover_threshold)
void attack_detector_fl( LC3_FLOAT *in, LC3_INT frame_size, LC3_INT fs, LC3_INT *lastAttackPosition, LC3_FLOAT *accNrg, LC3_INT *attackFlag, LC3_FLOAT *attdec_filter_mem, LC3_INT attackHandlingOn, LC3_INT attdec_nblocks, LC3_INT attdec_hangover_threshold )
{
    LC3_FLOAT f_sig[160] = { 0 }, block_nrg[4] = { 0 }, sum = 0, tmpEne = 0, *ptr = NULL, tmp[162] = { 0 };
    LC3_INT i = 0, j = 0, attackPosition = 0;
@@ -23,33 +22,44 @@ void attack_detector_fl(LC3_FLOAT* in, LC3_INT frame_size, LC3_INT fs, LC3_INT*
    ptr = &tmp[2];



    if (attackHandlingOn) {
    if ( attackHandlingOn )
    {
        /* Decimate 96, 48 and 32 kHz signals to 16 kHz */
        if (fs == 96000) {
            for (i = 0; i < frame_size;) {
        if ( fs == 96000 )
        {
            for ( i = 0; i < frame_size; )
            {
                ptr[j] = in[i] + in[i + 1] + in[i + 2] + in[i + 3] + in[i + 4] + in[i + 5];
                i = i + 6;
                j++;
            }
            mval = 1e-5;
        } else if (fs == 48000) {
        }
        else if ( fs == 48000 )
        {
            j = 0;
            for (i = 0; i < frame_size;) {
            for ( i = 0; i < frame_size; )
            {
                ptr[j] = ( in[i] + in[i + 1] + in[i + 2] );
                i = i + 3;
                j++;
            }
        } else if (fs == 32000) {
        }
        else if ( fs == 32000 )
        {
            j = 0;
            for (i = 0; i < frame_size;) {
            for ( i = 0; i < frame_size; )
            {
                ptr[j] = ( in[i] + in[i + 1] );
                i = i + 2;
                j++;
            }
        } else if (fs == 24000) {
        }
        else if ( fs == 24000 )
        {
            j = 0;
            for (i = 0; i < frame_size;) {
            for ( i = 0; i < frame_size; )
            {
                ptr[j] = ( in[i] + ( in[i + 1] + in[i + 2] ) / 2.0 );
                i = i + 3;
                j++;
@@ -63,7 +73,8 @@ void attack_detector_fl(LC3_FLOAT* in, LC3_INT frame_size, LC3_INT fs, LC3_INT*
        attdec_filter_mem[0] = ptr[frame_size_16k - 2];
        attdec_filter_mem[1] = ptr[frame_size_16k - 1];

        for (i = 159; i >= 0; i--) {
        for ( i = 159; i >= 0; i-- )
        {
            tmpEne = 0;

            tmpEne += ptr[i] * 0.375;
@@ -73,9 +84,11 @@ void attack_detector_fl(LC3_FLOAT* in, LC3_INT frame_size, LC3_INT fs, LC3_INT*
            f_sig[i] = tmpEne;
        }

        for (i = 0; i < attdec_nblocks; i++) {
        for ( i = 0; i < attdec_nblocks; i++ )
        {
            sum = 0;
            for (j = 0; j < 40; j++) {
            for ( j = 0; j < 40; j++ )
            {
                sum += f_sig[j + i * 40] * f_sig[j + i * 40];
            }

@@ -85,10 +98,12 @@ void attack_detector_fl(LC3_FLOAT* in, LC3_INT frame_size, LC3_INT fs, LC3_INT*
        *attackFlag = 0;
        attackPosition = -1;

        for (i = 0; i < attdec_nblocks; i++) {
        for ( i = 0; i < attdec_nblocks; i++ )
        {
            tmpEne = block_nrg[i] / 8.5;

            if (tmpEne > MAX(*accNrg, mval)) {
            if ( tmpEne > MAX( *accNrg, mval ) )
            {
                *attackFlag = 1;
                attackPosition = i + 1;
            }
@@ -96,7 +111,8 @@ void attack_detector_fl(LC3_FLOAT* in, LC3_INT frame_size, LC3_INT fs, LC3_INT*
            *accNrg = MAX( block_nrg[i], 0.25 * ( *accNrg ) );
        }

        if (*lastAttackPosition > attdec_hangover_threshold) {
        if ( *lastAttackPosition > attdec_hangover_threshold )
        {
            *attackFlag = 1;
        }

+1983 −1869

File changed.

Preview size limit exceeded, changes collapsed.

Loading