/* 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.
*/
int opus_projection_decoder_init(OpusProjectionDecoder *st, opus_int32 Fs, int channels, int streams, int coupled_streams, unsignedchar *demixing_matrix, opus_int32 demixing_matrix_size)
{ int nb_input_streams;
opus_int32 expected_matrix_size; int i, ret; unsignedchar mapping[255];
VARDECL(opus_int16, buf);
ALLOC_STACK;
OpusProjectionDecoder *opus_projection_decoder_create(
opus_int32 Fs, int channels, int streams, int coupled_streams, unsignedchar *demixing_matrix, opus_int32 demixing_matrix_size, int *error)
{ int size; int ret;
OpusProjectionDecoder *st;
/* Allocate space for the projection decoder. */
size = opus_projection_decoder_get_size(channels, streams, coupled_streams); if (!size) { if (error)
*error = OPUS_ALLOC_FAIL; return NULL;
}
st = (OpusProjectionDecoder *)opus_alloc(size); if (!st)
{ if (error)
*error = OPUS_ALLOC_FAIL; return NULL;
}
/* Initialize projection decoder with provided settings. */
ret = opus_projection_decoder_init(st, Fs, channels, streams, coupled_streams,
demixing_matrix, demixing_matrix_size); if (ret != OPUS_OK)
{
opus_free(st);
st = NULL;
} if (error)
*error = ret; return st;
}
#ifdef FIXED_POINT int opus_projection_decode(OpusProjectionDecoder *st, constunsignedchar *data,
opus_int32 len, opus_int16 *pcm, int frame_size, int decode_fec)
{ return opus_multistream_decode_native(get_multistream_decoder(st), data, len,
pcm, opus_projection_copy_channel_out_short, frame_size, decode_fec, 0,
get_dec_demixing_matrix(st));
} #else int opus_projection_decode(OpusProjectionDecoder *st, constunsignedchar *data,
opus_int32 len, opus_int16 *pcm, int frame_size, int decode_fec)
{ return opus_multistream_decode_native(get_multistream_decoder(st), data, len,
pcm, opus_projection_copy_channel_out_short, frame_size, decode_fec, 1,
get_dec_demixing_matrix(st));
} #endif
#ifndef DISABLE_FLOAT_API int opus_projection_decode_float(OpusProjectionDecoder *st, constunsignedchar *data,
opus_int32 len, float *pcm, int frame_size, int decode_fec)
{ return opus_multistream_decode_native(get_multistream_decoder(st), data, len,
pcm, opus_projection_copy_channel_out_float, frame_size, decode_fec, 0,
get_dec_demixing_matrix(st));
} #endif
int opus_projection_decoder_ctl(OpusProjectionDecoder *st, int request, ...)
{
va_list ap; int ret = OPUS_OK;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.