shithub: opus

ref: ffd1b0b137e82197f8f995e03763a65b36079eba
dir: /src/mapping_matrix.c/

View raw version
/* Copyright (c) 2017 Google Inc.
   Written by Andrew Allen */
/*
   Redistribution and use in source and binary forms, with or without
   modification, are permitted provided that the following conditions
   are met:

   - Redistributions of source code must retain the above copyright
   notice, this list of conditions and the following disclaimer.

   - Redistributions in binary form must reproduce the above copyright
   notice, this list of conditions and the following disclaimer in the
   documentation and/or other materials provided with the distribution.

   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
   OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include "arch.h"
#include "float_cast.h"
#include "opus_private.h"
#include "opus_defines.h"
#include "mapping_matrix.h"

#define MATRIX_INDEX(nb_rows, row, col) (nb_rows * col + row)

opus_int32 mapping_matrix_get_size(int rows, int cols)
{
  opus_int32 size;

  /* Mapping Matrix must only support up to 255 channels in or out.
   * Additionally, the total cell count must be <= 65004 octets in order
   * for the matrix to be stored in an OGG header.
   */
  if (rows > 255 || cols > 255)
      return 0;
  size = rows * (opus_int32)cols * sizeof(opus_int16);
  if (size > 65004)
    return 0;

  return align(sizeof(MappingMatrix)) + align(size);
}

opus_int16 *mapping_matrix_get_data(const MappingMatrix *matrix)
{
  /* void* cast avoids clang -Wcast-align warning */
  return (opus_int16*)(void*)((char*)matrix + align(sizeof(MappingMatrix)));
}

void mapping_matrix_init(MappingMatrix * const matrix,
  int rows, int cols, int gain, const opus_int16 *data, opus_int32 data_size)
{
  int i;
  opus_int16 *ptr;

#if !defined(ENABLE_ASSERTIONS)
  (void)data_size;
#endif
  celt_assert(align(data_size) == align(rows * cols * sizeof(opus_int16)));

  matrix->rows = rows;
  matrix->cols = cols;
  matrix->gain = gain;
  ptr = mapping_matrix_get_data(matrix);
  for (i = 0; i < rows * cols; i++)
  {
     ptr[i] = data[i];
  }
}

#ifndef DISABLE_FLOAT_API
void mapping_matrix_multiply_channel_in_float(
    const MappingMatrix *matrix,
    const float *input,
    int input_rows,
    opus_val16 *output,
    int output_row,
    int output_rows,
    int frame_size)
{
  /* Matrix data is ordered col-wise. */
  opus_int16* matrix_data;
  int i, col;

  celt_assert(input_rows <= matrix->cols && output_rows <= matrix->rows);

  matrix_data = mapping_matrix_get_data(matrix);

  for (i = 0; i < frame_size; i++)
  {
    float tmp = 0;
    for (col = 0; col < input_rows; col++)
    {
      tmp +=
        matrix_data[MATRIX_INDEX(matrix->rows, output_row, col)] *
        input[MATRIX_INDEX(input_rows, col, i)];
    }
#if defined(FIXED_POINT)
    output[output_rows * i] = FLOAT2INT16((1/32768.f)*tmp);
#else
    output[output_rows * i] = (1/32768.f)*tmp;
#endif
  }
}

void mapping_matrix_multiply_channel_out_float(
    const MappingMatrix *matrix,
    const opus_val16 *input,
    int input_row,
    int input_rows,
    float *output,
    int output_rows,
    int frame_size
)
{
  /* Matrix data is ordered col-wise. */
  opus_int16* matrix_data;
  int i, row;
  float input_sample;

  celt_assert(input_rows <= matrix->cols && output_rows <= matrix->rows);

  matrix_data = mapping_matrix_get_data(matrix);

  for (i = 0; i < frame_size; i++)
  {
#if defined(FIXED_POINT)
    input_sample = (1/32768.f)*input[input_rows * i];
#else
    input_sample = input[input_rows * i];
#endif
    for (row = 0; row < output_rows; row++)
    {
      float tmp =
        (1/32768.f)*matrix_data[MATRIX_INDEX(matrix->rows, row, input_row)] *
        input_sample;
      output[MATRIX_INDEX(output_rows, row, i)] += tmp;
    }
  }
}
#endif /* DISABLE_FLOAT_API */

void mapping_matrix_multiply_channel_in_short(
    const MappingMatrix *matrix,
    const opus_int16 *input,
    int input_rows,
    opus_val16 *output,
    int output_row,
    int output_rows,
    int frame_size)
{
  /* Matrix data is ordered col-wise. */
  opus_int16* matrix_data;
  int i, col;

  celt_assert(input_rows <= matrix->cols && output_rows <= matrix->rows);

  matrix_data = mapping_matrix_get_data(matrix);

  for (i = 0; i < frame_size; i++)
  {
    opus_val32 tmp = 0;
    for (col = 0; col < input_rows; col++)
    {
#if defined(FIXED_POINT)
      tmp +=
        ((opus_int32)matrix_data[MATRIX_INDEX(matrix->rows, output_row, col)] *
        (opus_int32)input[MATRIX_INDEX(input_rows, col, i)]) >> 8;
#else
      tmp +=
        matrix_data[MATRIX_INDEX(matrix->rows, output_row, col)] *
        input[MATRIX_INDEX(input_rows, col, i)];
#endif
    }
#if defined(FIXED_POINT)
    output[output_rows * i] = (opus_int16)((tmp + 64) >> 7);
#else
    output[output_rows * i] = (1/(32768.f*32768.f))*tmp;
#endif
  }
}

void mapping_matrix_multiply_channel_out_short(
    const MappingMatrix *matrix,
    const opus_val16 *input,
    int input_row,
    int input_rows,
    opus_int16 *output,
    int output_rows,
    int frame_size)
{
  /* Matrix data is ordered col-wise. */
  opus_int16* matrix_data;
  int i, row;
  opus_int32 input_sample;

  celt_assert(input_rows <= matrix->cols && output_rows <= matrix->rows);

  matrix_data = mapping_matrix_get_data(matrix);

  for (i = 0; i < frame_size; i++)
  {
#if defined(FIXED_POINT)
    input_sample = (opus_int32)input[input_rows * i];
#else
    input_sample = (opus_int32)FLOAT2INT16(input[input_rows * i]);
#endif
    for (row = 0; row < output_rows; row++)
    {
      opus_int32 tmp =
        (opus_int32)matrix_data[MATRIX_INDEX(matrix->rows, row, input_row)] *
        input_sample;
      output[MATRIX_INDEX(output_rows, row, i)] += (tmp + 16384) >> 15;
    }
  }
}

const MappingMatrix mapping_matrix_foa_mixing = { 6, 6, 0 };
const opus_int16 mapping_matrix_foa_mixing_data[36] = {
     16384,      0, -16384,  23170,      0,      0,  16384,  23170,
     16384,      0,      0,      0,  16384,      0, -16384, -23170,
         0,      0,  16384, -23170,  16384,      0,      0,      0,
         0,      0,      0,      0,  32767,      0,      0,      0,
         0,      0,      0,  32767
};

const MappingMatrix mapping_matrix_soa_mixing = { 11, 11, 0 };
const opus_int16 mapping_matrix_soa_mixing_data[121] = {
     10923,   7723,  13377, -13377,  11585,   9459,   7723, -16384,
     -6689,      0,      0,  10923,   7723,  13377,  13377, -11585,
      9459,   7723,  16384,  -6689,      0,      0,  10923, -15447,
     13377,      0,      0, -18919,   7723,      0,  13377,      0,
         0,  10923,   7723, -13377, -13377,  11585,  -9459,   7723,
     16384,  -6689,      0,      0,  10923,  -7723,      0,  13377,
    -16384,      0, -15447,      0,   9459,      0,      0,  10923,
     -7723,      0, -13377,  16384,      0, -15447,      0,   9459,
         0,      0,  10923,  15447,      0,      0,      0,      0,
    -15447,      0, -18919,      0,      0,  10923,   7723, -13377,
     13377, -11585,  -9459,   7723, -16384,  -6689,      0,      0,
     10923, -15447, -13377,      0,      0,  18919,   7723,      0,
     13377,      0,      0,      0,      0,      0,      0,      0,
         0,      0,      0,      0,  32767,      0,      0,      0,
         0,      0,      0,      0,      0,      0,      0,      0,
     32767
};

const MappingMatrix mapping_matrix_toa_mixing = { 18, 18, 0 };
const opus_int16 mapping_matrix_toa_mixing_data[324] = {
      8208,      0,   -881,  14369,      0,      0,  -8192,  -4163,
     13218,      0,      0,      0,  11095,  -8836,  -6218,  14833,
         0,      0,   8208, -10161,    881,  10161, -13218,  -2944,
     -8192,   2944,      0, -10488,  -6218,   6248, -11095,  -6248,
         0, -10488,      0,      0,   8208,  10161,    881, -10161,
    -13218,   2944,  -8192,  -2944,      0,  10488,  -6218,  -6248,
    -11095,   6248,      0,  10488,      0,      0,   8176,   5566,
    -11552,   5566,   9681, -11205,   8192, -11205,      0,   4920,
    -15158,   9756,  -3334,   9756,      0,  -4920,      0,      0,
      8176,   7871,  11552,      0,      0,  15846,   8192,      0,
     -9681,  -6958,      0,  13797,   3334,      0, -15158,      0,
         0,      0,   8176,      0,  11552,   7871,      0,      0,
      8192,  15846,   9681,      0,      0,      0,   3334,  13797,
     15158,   6958,      0,      0,   8176,   5566, -11552,  -5566,
     -9681, -11205,   8192,  11205,      0,   4920,  15158,   9756,
     -3334,  -9756,      0,   4920,      0,      0,   8208,  14369,
      -881,      0,      0,  -4163,  -8192,      0, -13218, -14833,
         0,  -8836,  11095,      0,   6218,      0,      0,      0,
      8208,  10161,    881,  10161,  13218,   2944,  -8192,   2944,
         0,  10488,   6218,  -6248, -11095,  -6248,      0, -10488,
         0,      0,   8208, -14369,   -881,      0,      0,   4163,
     -8192,      0, -13218,  14833,      0,   8836,  11095,      0,
      6218,      0,      0,      0,   8208,      0,   -881, -14369,
         0,      0,  -8192,   4163,  13218,      0,      0,      0,
     11095,   8836,  -6218, -14833,      0,      0,   8176,  -5566,
    -11552,   5566,  -9681,  11205,   8192, -11205,      0,  -4920,
     15158,  -9756,  -3334,   9756,      0,  -4920,      0,      0,
      8176,      0,  11552,  -7871,      0,      0,   8192, -15846,
      9681,      0,      0,      0,   3334, -13797,  15158,  -6958,
         0,      0,   8176,  -7871,  11552,      0,      0, -15846,
      8192,      0,  -9681,   6958,      0, -13797,   3334,      0,
    -15158,      0,      0,      0,   8176,  -5566, -11552,  -5566,
      9681,  11205,   8192,  11205,      0,  -4920, -15158,  -9756,
     -3334,  -9756,      0,   4920,      0,      0,   8208, -10161,
       881, -10161,  13218,  -2944,  -8192,  -2944,      0, -10488,
      6218,   6248, -11095,   6248,      0,  10488,      0,      0,
         0,      0,      0,      0,      0,      0,      0,      0,
         0,      0,      0,      0,      0,      0,      0,      0,
     32767,      0,      0,      0,      0,      0,      0,      0,
         0,      0,      0,      0,      0,      0,      0,      0,
         0,      0,      0,  32767
};

const MappingMatrix mapping_matrix_fifthoa_mixing = { 38, 38, 0 };
const opus_int16 mapping_matrix_fifthoa_mixing_data[1444] = {
      9244,      0,  16011,      0,      0,      0,  20670,      0,
         0,      0,      0,      0,  24456,      0,      0,      0,
         0,      0,      0,      0,  27731,      0,      0,      0,
         0,      0,      0,      0,      0,      0,  30658,      0,
         0,      0,      0,      0,      0,      0,   9244,      0,
     -7023,  14388,      0,      0,  -4369, -14113,  14456,      0,
         0,      0,  10931,   -510, -16777,  14032,      0,      0,
         0,      0,  -5119,  14286,   4343, -18465,  13375,      0,
         0,      0,      0,      0,  -6494, -12222,  11762,   8514,
    -19458,  12606,      0,      0,   9244, -14129,   5093,   5547,
    -10946, -10050,  -7197,   3946, -11791,   7142,  -9213,   6529,
     -9702,  -2564,  -9924, -14847,  16521,   6816,   2765,  14104,
      1118,  -5538,   2978, -14169,   1229,   4866,  17431,   -528,
     10640,   2642,  10437,  -1037,  11461,   1098,   1297,  15738,
         0,      0,   9244,   1129, -14775,   6063,    956,  -2329,
     16069, -12511,   2478,    580,  -2334,   3440, -14198,  18478,
     -6050,    941,    303,  -1605,   4107,  -4224,   9829, -22688,
     10647,  -2605,    335,    145,   -928,   3203,  -6017,   4508,
     -3813,  24212, -15600,   5199,  -1024,    110,      0,      0,
      9244,   1159,  12997,   9277,   1502,   2104,  10097,  16840,
      5916,   1402,   3225,   2488,   2929,  19916,  12707,   3585,
      1137,   3415,   4699,   2078,  -5442,  16635,  18512,   8732,
      2096,    850,   3062,   5734,   5226,    961, -11729,   7689,
     20588,  14659,   5643,   1187,      0,      0,   9244,  -4663,
     -3082, -15003,   9772,   2007,  -9186,   6458,  14200, -14358,
     -4976,   3554,   6625,  11434,  -7232, -11298,  17761,   8291,
     -6268,  -3369,   6713, -10838,  -9108,   6524,   6793, -19531,
    -11339,   7935,   7335,  -2205,  -9215,  -7095,  10659,   6244,
     -4337,  -1251,      0,      0,   9244, -13516,   7680,  -3831,
      7232, -14497,  -3201,  -4109, -11732,   8828,   9178,  -1902,
    -10849,   -539, -14889,   9627, -10860,  12704,   3824,  12334,
     -7105,   3496,  -6204,  13853,   5461,  -2110, -17278,   7838,
     -4714,  13901,   4098,   3940,   7648,   8547,   8688, -10986,
         0,      0,   9244,   8114,  -9861,   9657,  10944, -11174,
      1426, -13300,   1916,   8179, -17833,   6806,   8310,   8100,
     -3121,  -4742,   2683, -15112,  15689,   2359, -11591,   2807,
      2746,   8763,  -7430,  -2252,  -5481,  16370,  -4081,  -9695,
      5872, -11539,   -714,  -9492,  15178,  -6127,      0,      0,
      9244,   9934,  -9216,  -8529, -11832, -12785,    -63,  10977,
     -1811,   5594,  18019,   6101,   9456,  -5238,   2758,   8971,
      2743,  -9659, -13517,   5330, -10737,  -4576,  -2069, -15492,
     -8750,  -7226,  -5237,   9192,   -181, -12277,   2816,  10541,
       -28,  14742,  16704,   3103,      0,      0,   9244, -10067,
     -8882,  -8724,  12266,  12488,   -794,  10821,  -1763,  -6022,
    -18002,  -5072,   9913,  -4396,   2587,   9368,  -2768,  10021,
     12260,  -6469, -10113,  -5605,  -1762, -15590,  -9430,   7801,
      5092,  -8835,   2293,  12315,   1223,  10672,   -330,  13745,
     17350,   3564,      0,      0,   9244,  -6486,  12992,  -6744,
      6109, -11769,  10081, -12237,    238,  -2884,  13115, -13908,
      2901, -14461,    512,   2565,    186,  -7020,  19095, -11598,
     -5473, -12059,    745,   6243,  -2385,    931,    501, -11778,
     21214,  -5331, -11746,  -5543,    828,  10475,  -6418,   1133,
         0,      0,   9244,   3863,   5238, -14628,  -7892,   2826,
     -7016, -10702,  13900,  11410,  -6831,  -1679,  -9861,   6360,
     12032, -11661, -14041,  11200,   1713,  -3895,    658,  14750,
     -3018, -11445,   8380,  15576, -15237,   -346,   7690,   -924,
     10317,   3498, -13546,    354,   9093,  -4477,      0,      0,
      9244,  -8418,  13183,   3419,  -4019, -15499,  10686,   6294,
     -4132,   1420,  -8755, -18818,   3926,   7642,  -9002,  -3235,
      2126,   3507, -13038, -16570,  -4338,   6729, -13405,  -7992,
        59,    443,   5805,   6006, -15012,  -9061, -11045,   3680,
    -15434, -13686,    161,   1185,      0,      0,   9244,  -5288,
      6774, -13509,   9977,  -5003,  -4785, -12780,  10790, -12942,
     11168,    519, -10890,   1326,  12079,  -6274,  13780, -16427,
      2186,   5352,  -4328,  13672,   2365,  -7964,   1081, -12569,
     19337,  -6557,  -8575,   4085,   7277,  10434,  -9274,  -3179,
      1517,   3817,      0,      0,   9244,   9661,   7818,  10094,
     13619,  10548,  -2942,  11021,    597,   9663,  17595,   1737,
    -10795,   1815,    772,  -8470,   1041,  14156,   7891,  -8597,
     -7499,  -8983,    346, -12407, -11848,  -6810,   1686,   9182,
     -8307, -10248,   3539, -10707,   -364,  -8048, -19188,  -8493,
         0,      0,   9244,  -7164,  -1021,  14282, -14289,   1021,
    -10209,  -2036,  10660, -18920,   2411,   6565,   2323, -13088,
     -1799,   3366, -19498,   3619,  12022,  -1859,   9978,   3706,
     -8969,   -644,  -5794, -15523,   4124,  15113,  -3949,  -6265,
     -3596,  12491,   2946,  -2689,   1225, -14571,      0,      0,
      9244, -12187,    772, -10354,  17624,  -1315, -10263,  -1117,
     -2886,  -9938,   2250,  11268,  -1763,   9573,   -368,  16506,
     -6510,  -1438, -15014,   2402,  10158,   2041,   2458,   2389,
    -19346,  19861,  -1042,   8067,  -3705, -10931,   2743,  -9287,
       607, -13400,  -3096,   7924,      0,      0,   9244,  15546,
     -2367,  -3011,  -6538,  -5139,  -9657,    996, -16243, -15706,
      2557, -12952,   5226,   2509,   6354,  10157,  13593,   6966,
      4796,   8960,   8184,  -1736,  11914,  -4505,  14149,  11727,
     -6666,  10461,  -3963,  10146,  -7649,  -1965,  -9845,  -6765,
     -6938, -16634,      0,      0,   9244,   3099,  12983,  -8841,
     -3826,   5619,  10054, -16032,   4788,   3283,  -8209,   6632,
      2856, -18922,  10273,  -2056,  -2345,   7987, -11940,   5516,
     -5521, -15739,  14941,  -5002,    530,   1466,  -6307,  13389,
    -13243,   2513, -11773,  -7170,  16572,  -8384,   1426,    169,
         0,      0,   9244, -15768,  -2008,  -1917,   4221,   4423,
     -9847,    538, -17106,  17651,  -1401,  13589,   4481,   1652,
      5677,   6702,  -9242,  -6642,  -3253,  -7827,   8793,   -951,
     13182,  -2522,  17587, -17005,   3845, -12562,   2213, -11473,
     -6689,  -1395,  -8970,  -4770,  -7317, -11754,      0,      0,
      9244, -13344,  -3829,   7975, -14863,   7137,  -8561,  -4265,
     -7993,   -802,   9406,   8912,   7938,  -5326,   5058, -17681,
     15207,    575,   7718, -11361,   4847,   6790,   4150,  12687,
    -10050,  16730, -12063,    322, -12921,  -3313, -10267,   1980,
     -6948,   7113,   7973,   8042,      0,      0,   9244,   7792,
     -1021,  13949,  15180,  -1111, -10209,  -1989,   9348,  19199,
     -2562,  -7140,   2324, -12783,  -1577,    817,  18164,  -3674,
    -12772,   2022,   9978,   3620,  -7865,   -156,  -9155,  11925,
     -3842, -15336,   4196,   6814,  -3597,  12199,   2584,   -653,
      1937, -17637,      0,      0,   9244,  -4811, -15145,  -1958,
      1316,  10176,  17406,   4142,  -1348,    264,  -3293, -15633,
    -17047,  -6363,   3375,    605,   -227,   -749,   5998,  20334,
     14481,   8277,  -6146,  -1717,      6,     27,    713,   1543,
     -9197, -23573, -10164,  -9596,   9425,   3539,    -17,    -72,
         0,      0,   9244,  -7366,   8261,  11568, -11901,  -8499,
     -2080,  13348,   5556, -12049, -16247,  -2283, -10529,   3585,
      7585,  -1578,  -8464, -18652,  -8903,   5914,  -8688,  -9287,
      4156,  -2443,  -7089,  -2994, -14486, -13950,   5422,   8460,
      1638, -13286,  -2531,  -1827, -12132,  -9457,      0,      0,
      9244,  11716,    699, -10889, -17818,   1143, -10276,  -1062,
     -1306,  12058,  -2057, -10855,  -1596,  10089,   -151,  15043,
      2978,   1578,  15226,  -2091,  10202,   1943,   1116,   1969,
    -20211, -17637,    431,  -9826,   3392,  10573,   2486,  -9826,
       249, -12260,  -2925,  12131,      0,      0,   9244,   4362,
     -4594, -14704,  -8957,  -2799,  -7782,   9435,  13770,  12937,
      6800,  -2400,   9082,   8091, -10454, -11023, -15787, -11137,
      3286,   4154,   2659, -14003,  -5051,   9490,   7000,  17206,
     15025,  -2777,  -8491,    -42, -10626,    142,  13053,   2367,
     -6662,  -2232,      0,      0,   9244,   -753, -11934, -10647,
      1119,   1255,   6891,  17745,   7876,  -1204,  -2207,  -1252,
      2024, -17707, -15532,  -5600,   1128,   2692,   2800,    683,
     -9927,   9662,  19706,  12523,   3890,   -979,  -2789,  -3993,
     -2440,    207,  12695,   2921, -17174, -18575,  -9616,  -2657,
         0,      0,   9244,   4791, -15002,  -2887,  -1932, -10038,
     16885,   6049,  -1021,     46,   4789,  15191, -15922,  -9154,
      2531,    823,    252,   -130,  -8609, -19336,  12614,  11652,
     -4549,  -2314,   -172,   -102,   -784,    265,  12975,  21741,
     -7552, -13101,   6856,   4711,    535,    -47,      0,      0,
      9244, -12154, -10395,    755,  -1281,  17645,   2735,  -1096,
    -10275,   8359,   2201, -12594,   7084,    782,  17650,  -1574,
      1685, -16282,  -2165,   -531, -11879,     33, -17359,   3065,
      6652,  -5212,  -3629,  19365,    966,  13181,   8244,   -819,
      7746,  -3646, -14324,   1670,      0,      0,   9244,  -6962,
    -11199,   9081,  -8829,  10888,   4833, -14203,   2375,  -6524,
     16339,  -9417,   4737,  12284,  -4394,  -2692,  -2684,  13690,
    -18539,   2831, -11438,  -3693,   4986,   5649,  -4628,    514,
      6225, -18410,  12672,   5311,  11170,  -6928,  -3408,  -7596,
     10737,  -3977,      0,      0,   9244,  12099, -10405,   1294,
      2187, -17583,   2760,  -1881, -10106,  -8058,  -3761,  12583,
      7059,   1346,  17377,  -2668,  -2829,  15711,   3706,    468,
    -11880,     50, -17124,   5201,   6230,   4698,   6098, -18716,
     -1666, -13088,   8285,  -1400,   7696,  -6196, -13429,   2771,
         0,      0,   9244,   8603,  13393,   1723,   2070,  16091,
     11359,   3223,  -4961,  -2638,   4581,  20106,   5100,   4027,
    -10979,  -1778,  -1314,  -6621,   6988,  18702,  -2965,   3746,
    -16746,  -4462,   1301,    585,  -3647, -11589,   8351,  11847,
    -10050,   2373, -20011,  -7810,   3608,    888,      0,      0,
      9244,  14252,  -1959,   7027,  13986,  -3899,  -9871,  -1922,
    -10737,  -3693,  -4528, -12334,   4377,  -6081,   3476, -18538,
    -19222,   1356, -10843,   6913,   8869,   3408,   8324,   6805,
     -5142, -13648,   7801,   2650,   7171,  10505,  -6549,   5179,
     -5505,  13300,   2087,  15579,      0,      0,   9244,  11323,
      9022,  -6836, -10810,  14267,   -490,  -8613,  -5690,    639,
    -16117,   6224,  -9732,  -3758,  -8483,  10882,   7873,   1080,
    -11447,  -6791, -10389,   4100,  -6025,  18396,  -5408,  -7537,
     14715,    984,   1267, -13941,  -1890,   8416,    667,  16763,
    -10106,  -3419,      0,      0,   9244,    872,   4834,  15239,
      1855,    588,  -7509,  10287,  16163,   2858,   1482,   -444,
     -9393,  -7758,  12910,  16507,   3838,   2588,   -582,   -851,
      1929, -14880,  -5067,  14950,  16499,   4773,   3843,   -426,
     -1785,    -82,  10578,  -1435, -15555,  -2459,  16520,  16251,
         0,      0,   9244,  14762,   5967,   1673,   3450,  12303,
     -6028,   1395, -15023, -14572,   3402,  -4217, -10507,   -478,
    -14814,  -5132,  -6634, -16293,    -82, -15276,  -1706,  -1732,
       359,  -5738,  13682,  12504,  -8201,  -3024,  -3291,  -7384,
      9272,   -837,  14328,  -1065,  16913,   7915,      0,      0,
         0,      0,      0,      0,      0,      0,      0,      0,
         0,      0,      0,      0,      0,      0,      0,      0,
         0,      0,      0,      0,      0,      0,      0,      0,
         0,      0,      0,      0,      0,      0,      0,      0,
         0,      0,      0,      0,      0,      0,      0,      0,
         0,      0,      0,      0,      0,      0,      0,      0,
         0,      0,      0,      0,      0,      0,      0,      0,
         0,      0,      0,      0,      0,      0,      0,      0,
         0,      0,      0,      0,      0,      0,      0,      0,
         0,      0,      0,      0
};

const MappingMatrix mapping_matrix_foa_demixing = { 6, 6, 0 };
const opus_int16 mapping_matrix_foa_demixing_data[36] = {
     16384,  16384,  16384,  16384,      0,      0,      0,  23170,
         0, -23170,      0,      0, -16384,  16384, -16384,  16384,
         0,      0,  23170,      0, -23170,      0,      0,      0,
         0,      0,      0,      0,  32767,      0,      0,      0,
         0,      0,      0,  32767
};

const MappingMatrix mapping_matrix_soa_demixing = { 11, 11, 3050 };
const opus_int16 mapping_matrix_soa_demixing_data[121] = {
      2771,   2771,   2771,   2771,   2771,   2771,   2771,   2771,
      2771,      0,      0,  10033,  10033, -20066,  10033,  14189,
     14189, -28378,  10033, -20066,      0,      0,   3393,   3393,
      3393,  -3393,      0,      0,      0,  -3393,  -3393,      0,
         0, -17378,  17378,      0, -17378, -24576,  24576,      0,
     17378,      0,      0,      0, -14189,  14189,      0, -14189,
    -28378,  28378,      0,  14189,      0,      0,      0,   2399,
      2399,  -4799,  -2399,      0,      0,      0,  -2399,   4799,
         0,      0,   1959,   1959,   1959,   1959,  -3918,  -3918,
     -3918,   1959,   1959,      0,      0,  -4156,   4156,      0,
      4156,      0,      0,      0,  -4156,      0,      0,      0,
      8192,   8192, -16384,   8192,  16384,  16384, -32768,   8192,
    -16384,      0,      0,      0,      0,      0,      0,      0,
         0,      0,      0,      0,   8312,      0,      0,      0,
         0,      0,      0,      0,      0,      0,      0,      0,
      8312
};

const MappingMatrix mapping_matrix_toa_demixing = { 18, 18, 0 };
const opus_int16 mapping_matrix_toa_demixing_data[324] = {
      8192,   8192,   8192,   8192,   8192,   8192,   8192,   8192,
      8192,   8192,   8192,   8192,   8192,   8192,   8192,   8192,
         0,      0,      0,  -9779,   9779,   6263,   8857,      0,
      6263,  13829,   9779, -13829,      0,  -6263,      0,  -8857,
     -6263,  -9779,      0,      0,  -3413,   3413,   3413, -11359,
     11359,  11359, -11359,  -3413,   3413,  -3413,  -3413, -11359,
     11359,  11359, -11359,   3413,      0,      0,  13829,   9779,
     -9779,   6263,      0,   8857,  -6263,      0,   9779,      0,
    -13829,   6263,  -8857,      0,  -6263,  -9779,      0,      0,
         0, -15617, -15617,   6406,      0,      0,  -6406,      0,
     15617,      0,      0,  -6406,      0,      0,   6406,  15617,
         0,      0,      0,  -5003,   5003, -10664,  15081,      0,
    -10664,  -7075,   5003,   7075,      0,  10664,      0, -15081,
     10664,  -5003,      0,      0,  -8176,  -8176,  -8176,   8208,
      8208,   8208,   8208,  -8176,  -8176,  -8176,  -8176,   8208,
      8208,   8208,   8208,  -8176,      0,      0,  -7075,   5003,
     -5003, -10664,      0,  15081,  10664,      0,   5003,      0,
      7075, -10664, -15081,      0,  10664,  -5003,      0,      0,
     15617,      0,      0,      0,  -6406,   6406,      0, -15617,
         0, -15617,  15617,      0,   6406,  -6406,      0,      0,
         0,      0,      0, -11393,  11393,   2993,  -4233,      0,
      2993, -16112,  11393,  16112,      0,  -2993,      0,   4233,
     -2993, -11393,      0,      0,      0,  -9974,  -9974, -13617,
         0,      0,  13617,      0,   9974,      0,      0,  13617,
         0,      0, -13617,   9974,      0,      0,      0,   5579,
     -5579,  10185,  14403,      0,  10185,  -7890,  -5579,   7890,
         0, -10185,      0, -14403, -10185,   5579,      0,      0,
     11826, -11826, -11826,   -901,    901,    901,   -901,  11826,
    -11826,  11826,  11826,   -901,    901,    901,   -901, -11826,
         0,      0,  -7890,  -5579,   5579,  10185,      0,  14403,
    -10185,      0,  -5579,      0,   7890,  10185, -14403,      0,
    -10185,   5579,      0,      0,  -9974,      0,      0,      0,
    -13617,  13617,      0,   9974,      0,   9974,  -9974,      0,
     13617, -13617,      0,      0,      0,      0,  16112, -11393,
     11393,  -2993,      0,   4233,   2993,      0, -11393,      0,
    -16112,  -2993,  -4233,      0,   2993,  11393,      0,      0,
         0,      0,      0,      0,      0,      0,      0,      0,
         0,      0,      0,      0,      0,      0,      0,      0,
     32767,      0,      0,      0,      0,      0,      0,      0,
         0,      0,      0,      0,      0,      0,      0,      0,
         0,      0,      0,  32767
};


const MappingMatrix mapping_matrix_fifthoa_demixing = { 38, 38, 0 };
const opus_int16 mapping_matrix_fifthoa_demixing_data[1444] = {
      3188,   3247,   3268,   3369,   3368,   3139,   3268,   3100,
      3211,   3368,   3100,   3247,   3211,   3369,   3368,   3369,
      3149,   3268,   3247,   3211,   3100,   3189,   3139,   3149,
      3100,   3188,   3368,   3149,   3189,   3247,   3268,   3139,
      3211,   3369,   3139,   3149,      0,      0,    118,    -48,
     -5012,    283,    334,  -1497,  -4584,   2909,   3389,  -3647,
     -2493,   1139,  -2882,  -1720,   3605,  -2544,  -4329,   5444,
      1286,  -5498,  -4584,   2510,  -1743,  -2557,   4168,   1447,
      -291,   1813,  -4075,  -2378,   4153,   2847,   4992,   3981,
       394,   5073,      0,      0,   5490,  -2235,   1508,  -5326,
      4610,  -1096,   2926,  -3427,  -3302,  -3079,   4227,   1731,
      4628,   2562,   2967,   -592,    144,   -677,   4617,   -756,
      -957,   -434,  -5139,   3037,    157,  -1394,  -4498,  -4985,
     -3662,  -4113,  -3757,   4629,   -570,   3357,   1606,   1803,
         0,      0,   -162,   5163,   2133,   2393,   3556,  -5142,
     -1537,   2976,  -3002,  -3351,  -2231,  -5231,   1294,  -4965,
      3495,   5230,  -3293,  -1360,  -2946,   -774,   2671,   4867,
      -660,   3720,  -3415,  -5113,  -3700,  -1212,    408,   3014,
       764,    592,   2481,  -2657,   5210,    785,      0,      0,
      -156,    339,  -4246,    510,    463,   3297,   2847,   3333,
     -4293,   4574,   1941,  -2987,  -1276,   3702,   5022,  -5250,
      5780,  -2676,  -1181,   1517,  -4852,   4878,    342,  -3924,
     -5704,  -2921,    379,   -657,   -361,  -3347,   1045,    796,
      5257,  -4005,    699,   1116,      0,      0,     47,   -140,
     -3292,  -1098,    652,    856,  -5261,  -3692,  -4471,   4522,
     -3863,   1093,  -5552,  -2016,   3831,    335,   -456,  -1533,
      2069,   1789,   2054,   -296,   3669,  -2820,    329,   -995,
       296,  -3302,   5771,   4283,  -6354,   5632,  -1372,   5006,
       238,   4041,      0,      0,   6764,  -1660,  -2730,   5726,
      3716,  -3216,   -934,    531,    -52,   -346,   3023,  -2819,
      4006,  -1617,  -1189,  -3749,  -3404,  -3593,   4041,  -3553,
     -2806,  -3445,   6024,   -712,  -3298,  -2504,   2548,   5565,
       941,   1849,   1208,   4010,  -3489,   -358,  -2511,  -1966,
         0,      0,    -65,  -5040,   1404,  -4456,   6241,   2189,
     -1717,  -4349,   4184,   3951,  -4042,  -3606,   2399,  -4563,
      4051,   -612,   -395,    348,  -5792,    392,  -1440,   -736,
      1399,   4359,   -518,   2970,   6556,   1952,   -518,  -4994,
      -925,    999,   -569,  -2935,   3460,    420,      0,      0,
        17,   5482,  -4123,    771,   2082,   5021,  -3962,    486,
      -584,   -793,      4,   5223,  -1417,   3674,     79,   3550,
      -938,  -5723,   1674,  -6163,  -2541,   3082,   -355,   1839,
      -615,   4602,   2832,   -359,  -3346,    668,  -3394,  -1583,
     -3775,  -2206,   5755,  -4962,      0,      0,   -328,    300,
      2471,    318,    525,  -4494,   2805,   2618,   2384,  -2363,
     -1038,   4086,    895,  -4622,   3218,  -6607,  -3381,  -5933,
      1398,   6394,   -447,   5695,     14,  -4511,   4329,   3691,
      -335,      0,   2932,  -2478,  -2945,   -577,   -599,   -230,
      1553,  -4736,      0,      0,   -324,    142,  -3253,   -867,
      1111,  -1883,   3379,  -6056,   6503,  -6841,   4280,  -2695,
     -2877,   4190,   6454,    655,   1062,    627,  -2669,   -798,
      3193,   -985,   -899,  -5483,   -549,   2315,   -559,   1302,
       901,   5747,  -1325,   1600,  -1384,  -5749,    624,   1110,
         0,      0,    322,    313,   2189,   1322,    237,    709,
      -305,   2464,   1501,  -1095,  -5113,  -1011,  -6799,    646,
       993,   1969,   3423,  -3996,   2628,   4451,   3433,  -2833,
     -6102,   -331,  -3769,     -4,   -707,   5962,  -4038,  -3737,
      4081,   7254,  -4113,   2152,     54,  -2151,      0,      0,
      7735,   4064,  -3884,  -5241,    578,   2230,  -3948,   2915,
      3556,   4011,    775,  -3520,   1986,  -3702,  -3825,    330,
      -906,   2085,   1155,   2176,   3006,    341,  -5533,  -3264,
      -903,   3115,    344,  -5060,   1525,   1805,   1927,   2350,
      1906,  -3203,  -2762,  -4163,      0,      0,    193,   -151,
     -1435,   6290,   7355,   4234,    170,   2869,  -1978,  -1376,
     -4988,   2345,   2742,    599,    939,  -4838,   2689,    991,
     -6908,    717,  -1543,  -4347,  -1834,   1493,   3135,   2903,
     -7019,  -2835,     93,   4395,    622,    871,  -2357,   -975,
     -2933,   -127,      0,      0,   -616,  -5969,  -3479,  -1652,
      4933,  -2446,  -5513,  -1452,    691,    739,    480,   4228,
     -2887,   3854,      9,   -502,    188,   1991,   3842,   2270,
      1663,   -174,   1291,   2456,     67,  -3267,  -5535,    484,
      5722,  -1643,   6501,  -3433,   1184,  -3247,   4102,  -4880,
         0,      0,   -466,   5264,  -4812,    683,   1684,  -4539,
      2916,  -1986,   2899,   3324,   1061,  -4398,   -746,  -2138,
     -3827,   1045,   6226,   3610,   -532,   1980,  -6001,    564,
      -210,  -1300,   5337,  -3606,  -1485,     38,     19,  -1295,
      -665,   -386,  -6773,   3651,   6154,  -1291,      0,      0,
       194,   -415,   5166,   -110,    626,   6744,  -2860,   1425,
      1101,  -1342,     80,  -4533,    250,   4232,   -119,  -6009,
     -2970,   5171,   -822,  -2611,   4527,   5948,    183,  -2590,
       837,  -5472,    371,    -44,    374,   -666,  -1234,   -627,
     -7354,   2606,   1340,  -1398,      0,      0,   -534,    148,
      2076,   -673,   1043,   3504,   4403,  -4972,  -3288,   3731,
     -2606,   3818,   1972,  -5603,   5115,   1186,  -1319,   1906,
      3019,  -1999,    343,  -1943,    207,  -6745,    913,  -4060,
       645,   -350,  -5668,   4766,   5575,  -1734,   1117,    161,
      1534,  -5690,      0,      0,   -138,    -36,   1557,   1325,
      1553,  -2231,   1189,   5297,  -5104,   4674,   6295,    499,
     -4724,    934,   2995,   4068,  -4701,   1759,  -4117,  -1253,
      2445,  -4092,   1653,  -2802,   5070,   1133,    790,  -2356,
      -935,  -6304,   1643,   2045,  -4259,  -3873,   -214,    216,
         0,      0,   -365,    423,   4889,  -1316,    118,   -951,
      4027,    114,   2961,  -3136,  -3013,   -883,  -6192,   1340,
     -3211,  -1193,   1377,   3129,   1596,  -2995,  -3195,    533,
      8502,   2487,  -1485,   1032,    301,  -8007,   -577,    888,
       298,   7779,   3121,  -1902,    -95,  -6402,      0,      0,
      9260,  -1846,    668,   2787,  -2256,   2700,  -2513,  -3738,
     -3676,  -3602,  -1803,    211,  -1702,  -1442,  -2700,   3458,
      2868,   2079,  -2113,   3178,   1277,   3578,   5240,  -2483,
      3325,   1021,  -4027,   3835,  -3758,  -3634,  -3171,  -1310,
      2510,  -3110,    713,    174,      0,      0,   -399,   4970,
     -2321,  -7744,   6495,  -3776,   1478,    759,  -1795,  -2233,
     -4060,   4932,   2771,   4762,  -3475,   1243,    830,   -651,
     -5359,   -436,   2382,   1360,   2561,  -3118,    858,  -4366,
      3933,   3646,    -44,  -1311,    -16,    924,   1197,   1416,
     -5036,   -377,      0,      0,    100,   1410,   1290,   3200,
      7091,  -3639,  -2641,   1118,     46,   -442,    794,   -975,
     -5033,    889,    438,  -3103,    895,   3555,   4673,   4795,
      1130,  -2409,  -2154,   1743,    160,  -2041,   7578,  -2007,
     -5737,   1987,  -5568,  -6413,   2429,  -1387,  -2441,    668,
         0,      0,    -37,  -6031,  -4435,   -904,   3290,   1807,
      4737,   2517,  -5906,  -5928,   1755,  -4300,  -2468,  -2204,
     -4837,   -673,   1445,  -1591,  -1632,  -1790,   4312,   -153,
      -688,  -1222,   1058,   3140,   4659,   -354,   1544,   1839,
      2180,  -1448,   2433,   6277,   5304,  -1693,      0,      0,
      -280,   4506,    808,   -477,    824,   3550,   1427,  -1857,
     -3004,  -3501,  -1204,   2680,    933,    778,  -4954,  -1978,
     -7459,   4688,    435,   7045,  -4054,  -3131,    258,  -3917,
     -6166,   1890,    928,    236,   1890,  -1098,   1985,    630,
     -2172,  -2131,   7080,   4811,      0,      0,   -301,    496,
      2808,    279,    667,  -7179,  -2661,   -526,  -2833,   1751,
      2850,   4829,   -907,  -4151,  -1125,  -3063,   8166,   5362,
     -1657,  -6018,   3266,   2552,   -865,   -432,  -6967,   6296,
      -169,    902,    443,   -582,    270,    236,  -3574,    799,
       472,    565,      0,      0,    805,  -2467,   6208,  -4592,
      -170,  -6701,  -5611,   3679,  -4242,   4562,   -724,  -5535,
      2416,   7355,   2761,   2700,   -349,   3822,  -2373,   1757,
     -5523,  -3446,   -588,  -5749,  -3986,   9804,  -3872,   5375,
     -2309,   5505,  -2767,  -1652,   1472,   6833,   2705,  -5104,
         0,      0,   -700,  -1179,   4403,    401,   1384,    940,
     -1342,   6013,   2577,  -3472,    472,   2884,   1450,  -3918,
      2850,   5084,   4991,   5393,    343,  -4926,  -3329,  -5372,
     -2674,  -6036,  -5073,   -837,    179,   2506,   7987,  -3647,
     -8203,  -1438,   1892,   2400,   1607,  -3612,      0,      0,
     -4707,  -4003,   9929,   -379,   5558,   3739,  -8790,    685,
      1938,  -5157,  13389,   7996,  -4120,  -9910,  -5080,   4805,
      5587,    775,  -5430,    299,  -9943,   3264,  -3691,  -3902,
     -1133,  -6200,   3182,   1545,   5468,   3686,  -2639,   4069,
      1164,   -186,  -1300,   -507,      0,      0,    844,   1005,
     -1059,    468,  -1280,  -2259,   6057,  -1694,  -5885,   5342,
     -5160,  -3749,  -1382,   4420,   -698,  -2000,  -3809,   3100,
      2685,  -4073,    532,    318,  -7822,   2415,   2901,   3400,
     -1340,   8449,   3685,    464,  -3342,   2424,   2305,  -2723,
        85,  -2622,      0,      0,  12088,   -266,   2562,   -435,
     -4348,  -2426,   3538,   1553,   1280,    884,  -4167,   2634,
     -6131,   2994,   3730,  -1570,   -602,  -1754,  -5125,  -2789,
     -2096,  -1921,  -2650,   2794,  -1080,  -1953,   2984,  -1531,
      2500,   1769,   1493,  -6757,  -2109,   2841,   1467,   2597,
         0,      0,  -3831,  -4094,   2448,  12721,   7737,   -665,
      -833,  -9258,   2971,  -2401,    791,   1873,   1073,   -587,
     -7440,   8055,   1531,  -4736,    617,  -1782,  -2983,   9664,
     -5058,  -5927,   1610,  -4489,   7033,  -8658,   6011,  -5673,
      5649,    812,   -271,  -1802,  -4500,   4392,      0,      0,
      -888,   -327,   3374,  -1084,   7959,   2431,   1899,  -2361,
     -1820,  -1378,  -1091,  -4437,  -3422,  -1106,  -3231,   3876,
       -41,  -5129,   6375,  -1849,  -3824,   5845,    618,  -1958,
      4233,   1345,  -1440,    -84,   3046,   -214,   5458,  -5566,
     -4387,  -3738,  -5740,   8657,      0,      0,   6979,   6240,
     -3686,   -982,  -2854,     79,   5860,   -357,   4618,   7392,
      -138,    971,  -5799,   2136,   4479,  -7005,  -5950,   1668,
     -6934,  -1164,   7011,  -5625,   2990,   6193,  -8075,   3568,
     -8309,   2236,  -5098,  -2121,  -4356,  -4238,   4956,  10231,
       693,  -5607,      0,      0,  -1349,  -7069,    -13,  -4927,
      1212,    652,   1361,   7745,   3404,   5070,  -2439,   -105,
      2333,   1494,  -4686,   1336,  -3628,   -882,   2475,   1736,
       -26,   -258,   2135,  -4452,    446,   -641,  -4704,   2605,
     -6437,   6662,  -4939,    990,  -1101,  -3782,   5029,   4753,
         0,      0,  -2876,   6410,   3518,   3950,   1272,    870,
     -2842,  -5837,   1533,  -2900,   1141,   -597,   1713,  -1989,
     -4820,  -4783,   4773,  -8796,   2240,  -4597,   3565,  -4853,
      -557,  -3975,   7366,  -4371,   3113,  -3549,   3552,  -5450,
      3869,   2514,   6737,  -4570,   6075,   3151,      0,      0,
         0,      0,      0,      0,      0,      0,      0,      0,
         0,      0,      0,      0,      0,      0,      0,      0,
         0,      0,      0,      0,      0,      0,      0,      0,
         0,      0,      0,      0,      0,      0,      0,      0,
         0,      0,      0,      0,      0,      0,      0,      0,
         0,      0,      0,      0,      0,      0,      0,      0,
         0,      0,      0,      0,      0,      0,      0,      0,
         0,      0,      0,      0,      0,      0,      0,      0,
         0,      0,      0,      0,      0,      0,      0,      0,
         0,      0,      0,      0
};