Skip to content

Commit

Permalink
Cleaning up projection encode/decoder functions
Browse files Browse the repository at this point in the history
  • Loading branch information
jmvalin committed Oct 2, 2024
1 parent 96d3e7e commit 03df13e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 22 deletions.
15 changes: 5 additions & 10 deletions src/opus_projection_decoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,24 +210,19 @@ OpusProjectionDecoder *opus_projection_decoder_create(
}

#ifdef FIXED_POINT
int opus_projection_decode(OpusProjectionDecoder *st, const unsigned char *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));
}
#define OPTIONAL_CLIP 0
#else
#define OPTIONAL_CLIP 1
#endif

int opus_projection_decode(OpusProjectionDecoder *st, const unsigned char *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,
pcm, opus_projection_copy_channel_out_short, frame_size, decode_fec, OPTIONAL_CLIP,
get_dec_demixing_matrix(st));
}
#endif

#ifndef DISABLE_FLOAT_API
int opus_projection_decode_float(OpusProjectionDecoder *st, const unsigned char *data,
Expand Down
13 changes: 1 addition & 12 deletions src/opus_projection_encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,25 +393,14 @@ int opus_projection_encode(OpusProjectionEncoder *st, const opus_int16 *pcm,
}

#ifndef DISABLE_FLOAT_API
#ifdef FIXED_POINT
int opus_projection_encode_float(OpusProjectionEncoder *st, const float *pcm,
int frame_size, unsigned char *data,
opus_int32 max_data_bytes)
{
return opus_multistream_encode_native(get_multistream_encoder(st),
opus_projection_copy_channel_in_float, pcm, frame_size, data,
max_data_bytes, 16, downmix_float, 1, get_mixing_matrix(st));
max_data_bytes, MAX_ENCODING_DEPTH, downmix_float, 1, get_mixing_matrix(st));
}
#else
int opus_projection_encode_float(OpusProjectionEncoder *st, const float *pcm,
int frame_size, unsigned char *data,
opus_int32 max_data_bytes)
{
return opus_multistream_encode_native(get_multistream_encoder(st),
opus_projection_copy_channel_in_float, pcm, frame_size, data,
max_data_bytes, 24, downmix_float, 1, get_mixing_matrix(st));
}
#endif
#endif

void opus_projection_encoder_destroy(OpusProjectionEncoder *st)
Expand Down

0 comments on commit 03df13e

Please sign in to comment.