tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

mapping_matrix.h (4951B)


      1 /* Copyright (c) 2017 Google Inc.
      2   Written by Andrew Allen */
      3 /*
      4   Redistribution and use in source and binary forms, with or without
      5   modification, are permitted provided that the following conditions
      6   are met:
      7 
      8   - Redistributions of source code must retain the above copyright
      9   notice, this list of conditions and the following disclaimer.
     10 
     11   - Redistributions in binary form must reproduce the above copyright
     12   notice, this list of conditions and the following disclaimer in the
     13   documentation and/or other materials provided with the distribution.
     14 
     15   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     16   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     17   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     18   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
     19   OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     20   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     21   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
     22   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
     23   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
     24   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
     25   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     26 */
     27 
     28 /**
     29 * @file mapping_matrix.h
     30 * @brief Opus reference implementation mapping matrix API
     31 */
     32 
     33 #ifndef MAPPING_MATRIX_H
     34 #define MAPPING_MATRIX_H
     35 
     36 #include "opus_types.h"
     37 #include "opus_projection.h"
     38 
     39 #ifdef __cplusplus
     40 extern "C" {
     41 #endif
     42 
     43 typedef struct MappingMatrix
     44 {
     45    int rows; /* number of channels outputted from matrix. */
     46    int cols; /* number of channels inputted to matrix. */
     47    int gain; /* in dB. S7.8-format. */
     48    /* Matrix cell data goes here using col-wise ordering. */
     49 } MappingMatrix;
     50 
     51 opus_int32 mapping_matrix_get_size(int rows, int cols);
     52 
     53 opus_int16 *mapping_matrix_get_data(const MappingMatrix *matrix);
     54 
     55 void mapping_matrix_init(
     56    MappingMatrix * const matrix,
     57    int rows,
     58    int cols,
     59    int gain,
     60    const opus_int16 *data,
     61    opus_int32 data_size
     62 );
     63 
     64 #ifndef DISABLE_FLOAT_API
     65 void mapping_matrix_multiply_channel_in_float(
     66    const MappingMatrix *matrix,
     67    const float *input,
     68    int input_rows,
     69    opus_res *output,
     70    int output_row,
     71    int output_rows,
     72    int frame_size
     73 );
     74 
     75 void mapping_matrix_multiply_channel_out_float(
     76    const MappingMatrix *matrix,
     77    const opus_res *input,
     78    int input_row,
     79    int input_rows,
     80    float *output,
     81    int output_rows,
     82    int frame_size
     83 );
     84 #endif /* DISABLE_FLOAT_API */
     85 
     86 void mapping_matrix_multiply_channel_in_short(
     87    const MappingMatrix *matrix,
     88    const opus_int16 *input,
     89    int input_rows,
     90    opus_res *output,
     91    int output_row,
     92    int output_rows,
     93    int frame_size
     94 );
     95 
     96 void mapping_matrix_multiply_channel_out_short(
     97    const MappingMatrix *matrix,
     98    const opus_res *input,
     99    int input_row,
    100    int input_rows,
    101    opus_int16 *output,
    102    int output_rows,
    103    int frame_size
    104 );
    105 
    106 
    107 void mapping_matrix_multiply_channel_in_int24(
    108    const MappingMatrix *matrix,
    109    const opus_int32 *input,
    110    int input_rows,
    111    opus_res *output,
    112    int output_row,
    113    int output_rows,
    114    int frame_size
    115 );
    116 
    117 void mapping_matrix_multiply_channel_out_int24(
    118    const MappingMatrix *matrix,
    119    const opus_res *input,
    120    int input_row,
    121    int input_rows,
    122    opus_int32 *output,
    123    int output_rows,
    124    int frame_size
    125 );
    126 /* Pre-computed mixing and demixing matrices for 1st to 3rd-order ambisonics.
    127 *   foa: first-order ambisonics
    128 *   soa: second-order ambisonics
    129 *   toa: third-order ambisonics
    130 */
    131 extern const MappingMatrix mapping_matrix_foa_mixing;
    132 extern const opus_int16 mapping_matrix_foa_mixing_data[36];
    133 
    134 extern const MappingMatrix mapping_matrix_soa_mixing;
    135 extern const opus_int16 mapping_matrix_soa_mixing_data[121];
    136 
    137 extern const MappingMatrix mapping_matrix_toa_mixing;
    138 extern const opus_int16 mapping_matrix_toa_mixing_data[324];
    139 
    140 extern const MappingMatrix mapping_matrix_fourthoa_mixing;
    141 extern const opus_int16 mapping_matrix_fourthoa_mixing_data[729];
    142 
    143 extern const MappingMatrix mapping_matrix_fifthoa_mixing;
    144 extern const opus_int16 mapping_matrix_fifthoa_mixing_data[1444];
    145 
    146 extern const MappingMatrix mapping_matrix_foa_demixing;
    147 extern const opus_int16 mapping_matrix_foa_demixing_data[36];
    148 
    149 extern const MappingMatrix mapping_matrix_soa_demixing;
    150 extern const opus_int16 mapping_matrix_soa_demixing_data[121];
    151 
    152 extern const MappingMatrix mapping_matrix_toa_demixing;
    153 extern const opus_int16 mapping_matrix_toa_demixing_data[324];
    154 
    155 extern const MappingMatrix mapping_matrix_fourthoa_demixing;
    156 extern const opus_int16 mapping_matrix_fourthoa_demixing_data[729];
    157 
    158 extern const MappingMatrix mapping_matrix_fifthoa_demixing;
    159 extern const opus_int16 mapping_matrix_fifthoa_demixing_data[1444];
    160 
    161 #ifdef __cplusplus
    162 }
    163 #endif
    164 
    165 #endif /* MAPPING_MATRIX_H */