Commit a79e252a authored by vaclav's avatar vaclav
Browse files

Merge branch 'main' into...

Merge branch 'main' into 234-complexity-numbers-for-ivas-evs-mode-are-extremely-high-for-vbr-and-rate-switching-modes
parents 4761cfdb 9e2d3dcd
Loading
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -176,9 +176,10 @@
#define NTT_REDUC_COMP_POC                              /* NTT Contribution 10: Complexity reduction of phase spectrum in stereo downmix*/
#define FIX_ISM_DECODER_PRINTOUT                        /* Issue 229: fix ISM decoder printout */
#define FIX_ITD_CNG                                     /* Eri: Fix for CNG ITD */

#define FIX_VBR_COMPLEXITY                              /* Issue 234: fix extremely high complexity numbers for IVAS EVS mode */



/* ################## End DEVELOPMENT switches ######################### */
/* clang-format on */
#endif
+1 −0
Original line number Diff line number Diff line
@@ -438,6 +438,7 @@ ivas_error ivas_core_enc(
        dbgwrite( &tmpF, sizeof( float ), 1, input_frame, fname( debug_dir, "extl_brate", n, id, ENC ) );

        dbgwrite( &st->coder_type, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "coder_type", n, id, ENC ) );
        dbgwrite( &st->coder_type_raw, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "coder_type_raw", n, id, ENC ) );
        dbgwrite( &st->clas, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "clas", n, id, ENC ) );
        dbgwrite( &st->cng_type, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "cng_type", n, id, ENC ) );
        dbgwrite( &st->L_frame, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "L_frame", n, id, ENC ) );
+3 −3
Original line number Diff line number Diff line
0, 30 -30, 60, -60, 90, -90, 135, -135, 180, 0,  45, -45, 90, -90, 0,  135, -135, 180,   0,  45, -45
0, 30, -30, 60, -60, 90, -90, 135, -135, 180, 0,  45, -45, 90, -90, 0,  135, -135, 180,   0,  45, -45
0,  0,   0,  0,   0,  0,   0,   0,    0,   0, 35, 35,  35, 35,  35, 90,  35,   35,  35, -15, -15, -15
3, 9
+0 −0

File mode changed from 100644 to 100755.

+24 −3
Original line number Diff line number Diff line
@@ -32,9 +32,10 @@

import logging
import math
from typing import Optional, Tuple
from typing import Callable, Iterable, Optional, Tuple

import numpy as np
import multiprocessing as mp
import scipy.signal as sig

main_logger = logging.getLogger("__main__")
@@ -409,7 +410,7 @@ def limiter(x: np.ndarray, fs: int):
        fr_sig[idx_min] = -32768


def get_framewise(x: np.ndarray, chunk_size: int) -> np.ndarray:
def get_framewise(x: np.ndarray, chunk_size: int, zero_pad=False) -> np.ndarray:
    """Generator to yield a signal frame by frame
        If array size is not a multiple of chunk_size, last frame contains the remainder

@@ -419,6 +420,8 @@ def get_framewise(x: np.ndarray, chunk_size: int) -> np.ndarray:
        Input reference array
    chunk_size: int
        Size of frames to yield
    zero_pad: bool
        Whether to zero pad the last chunk if there are not enough samples

    Yields
    -------
@@ -429,4 +432,22 @@ def get_framewise(x: np.ndarray, chunk_size: int) -> np.ndarray:
    for i in range(n_frames):
        yield x[i * chunk_size : (i + 1) * chunk_size, :]
    if x.shape[0] % chunk_size:
        yield x[n_frames * chunk_size :, :]
        last_chunk = x[n_frames * chunk_size :, :]
        if zero_pad:
            yield np.pad(last_chunk, [[0, chunk_size - (x.shape[0] % chunk_size)], [0, 0]])
        else:
            yield last_chunk


def process_async(files: Iterable, func: Callable, **kwargs):
    """Applies a function asynchronously to an array of audio files/filenames using a multiprocessing pool"""

    p = mp.pool(mp.cpu_count())
    results = []
    for f in files:
        results.append(p.apply_async(func, args=(f, kwargs)))
    p.close()
    p.join()
    for r in results:
        r.get()
    return results
Loading