forked from len0rd/rockbox
Sync opus codec to upstream git
Change-Id: I0cfcc0005c4ad7bfbb1aaf454188ce70fb043dc1
This commit is contained in:
parent
75d9393796
commit
14c6bb798d
286 changed files with 48931 additions and 1278 deletions
|
@ -33,6 +33,9 @@
|
|||
#include "opus.h"
|
||||
#include "celt.h"
|
||||
|
||||
#include <stdarg.h> /* va_list */
|
||||
#include <stddef.h> /* offsetof */
|
||||
|
||||
struct OpusRepacketizer {
|
||||
unsigned char toc;
|
||||
int nb_frames;
|
||||
|
@ -48,12 +51,59 @@ typedef struct ChannelLayout {
|
|||
unsigned char mapping[256];
|
||||
} ChannelLayout;
|
||||
|
||||
typedef enum {
|
||||
MAPPING_TYPE_NONE,
|
||||
MAPPING_TYPE_SURROUND,
|
||||
MAPPING_TYPE_AMBISONICS
|
||||
} MappingType;
|
||||
|
||||
struct OpusMSEncoder {
|
||||
ChannelLayout layout;
|
||||
int arch;
|
||||
int lfe_stream;
|
||||
int application;
|
||||
int variable_duration;
|
||||
MappingType mapping_type;
|
||||
opus_int32 bitrate_bps;
|
||||
/* Encoder states go here */
|
||||
/* then opus_val32 window_mem[channels*120]; */
|
||||
/* then opus_val32 preemph_mem[channels]; */
|
||||
};
|
||||
|
||||
struct OpusMSDecoder {
|
||||
ChannelLayout layout;
|
||||
/* Decoder states go here */
|
||||
};
|
||||
|
||||
int opus_multistream_encoder_ctl_va_list(struct OpusMSEncoder *st, int request,
|
||||
va_list ap);
|
||||
int opus_multistream_decoder_ctl_va_list(struct OpusMSDecoder *st, int request,
|
||||
va_list ap);
|
||||
|
||||
int validate_layout(const ChannelLayout *layout);
|
||||
int get_left_channel(const ChannelLayout *layout, int stream_id, int prev);
|
||||
int get_right_channel(const ChannelLayout *layout, int stream_id, int prev);
|
||||
int get_mono_channel(const ChannelLayout *layout, int stream_id, int prev);
|
||||
|
||||
typedef void (*opus_copy_channel_in_func)(
|
||||
opus_val16 *dst,
|
||||
int dst_stride,
|
||||
const void *src,
|
||||
int src_stride,
|
||||
int src_channel,
|
||||
int frame_size,
|
||||
void *user_data
|
||||
);
|
||||
|
||||
typedef void (*opus_copy_channel_out_func)(
|
||||
void *dst,
|
||||
int dst_stride,
|
||||
int dst_channel,
|
||||
const opus_val16 *src,
|
||||
int src_stride,
|
||||
int frame_size,
|
||||
void *user_data
|
||||
);
|
||||
|
||||
#define MODE_SILK_ONLY 1000
|
||||
#define MODE_HYBRID 1001
|
||||
|
@ -90,14 +140,6 @@ int encode_size(int size, unsigned char *data);
|
|||
|
||||
opus_int32 frame_size_select(opus_int32 frame_size, int variable_duration, opus_int32 Fs);
|
||||
|
||||
opus_int32 compute_frame_size(const void *analysis_pcm, int frame_size,
|
||||
int variable_duration, int C, opus_int32 Fs, int bitrate_bps,
|
||||
int delay_compensation, downmix_func downmix
|
||||
#ifndef DISABLE_FLOAT_API
|
||||
, float *subframe_mem
|
||||
#endif
|
||||
);
|
||||
|
||||
opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_size,
|
||||
unsigned char *data, opus_int32 out_data_bytes, int lsb_depth,
|
||||
const void *analysis_pcm, opus_int32 analysis_size, int c1, int c2,
|
||||
|
@ -107,10 +149,16 @@ int opus_decode_native(OpusDecoder *st, const unsigned char *data, opus_int32 le
|
|||
opus_val16 *pcm, int frame_size, int decode_fec, int self_delimited,
|
||||
opus_int32 *packet_offset, int soft_clip);
|
||||
|
||||
/* Make sure everything's aligned to sizeof(void *) bytes */
|
||||
/* Make sure everything is properly aligned. */
|
||||
static OPUS_INLINE int align(int i)
|
||||
{
|
||||
return (i+(int)sizeof(void *)-1)&-(int)sizeof(void *);
|
||||
struct foo {char c; union { void* p; opus_int32 i; opus_val32 v; } u;};
|
||||
|
||||
unsigned int alignment = offsetof(struct foo, u);
|
||||
|
||||
/* Optimizing compilers should optimize div and multiply into and
|
||||
for all sensible alignment values. */
|
||||
return ((i + alignment - 1) / alignment) * alignment;
|
||||
}
|
||||
|
||||
int opus_packet_parse_impl(const unsigned char *data, opus_int32 len,
|
||||
|
@ -123,4 +171,30 @@ opus_int32 opus_repacketizer_out_range_impl(OpusRepacketizer *rp, int begin, int
|
|||
|
||||
int pad_frame(unsigned char *data, opus_int32 len, opus_int32 new_len);
|
||||
|
||||
int opus_multistream_encode_native
|
||||
(
|
||||
struct OpusMSEncoder *st,
|
||||
opus_copy_channel_in_func copy_channel_in,
|
||||
const void *pcm,
|
||||
int analysis_frame_size,
|
||||
unsigned char *data,
|
||||
opus_int32 max_data_bytes,
|
||||
int lsb_depth,
|
||||
downmix_func downmix,
|
||||
int float_api,
|
||||
void *user_data
|
||||
);
|
||||
|
||||
int opus_multistream_decode_native(
|
||||
struct OpusMSDecoder *st,
|
||||
const unsigned char *data,
|
||||
opus_int32 len,
|
||||
void *pcm,
|
||||
opus_copy_channel_out_func copy_channel_out,
|
||||
int frame_size,
|
||||
int decode_fec,
|
||||
int soft_clip,
|
||||
void *user_data
|
||||
);
|
||||
|
||||
#endif /* OPUS_PRIVATE_H */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue