summaryrefslogtreecommitdiff
path: root/lib/rbcodec/codecs/libopus/opus_private.h
diff options
context:
space:
mode:
authorNils Wallménius <nils@rockbox.org>2013-05-20 22:25:57 +0200
committerNils Wallménius <nils@rockbox.org>2013-08-31 08:30:51 +0200
commit580b307fd791c0997a8831bc800bba87797bfb7e (patch)
tree807846056f06fd944a750ce41217a877910ebd59 /lib/rbcodec/codecs/libopus/opus_private.h
parent74761b70acd96cecc0d35450dd56a98ad9ee7d3d (diff)
downloadrockbox-580b307fd791c0997a8831bc800bba87797bfb7e.tar.gz
rockbox-580b307fd791c0997a8831bc800bba87797bfb7e.zip
Sync opus codec to upstream git
Sync opus codec to upstream commit 02fed471a4568852d6618e041c4f2af0d7730ee2 (August 30 2013) This brings in a lot of optimizations but also makes the diff between our codec and the upstream much smaller as most of our optimizations have been upstreamed or supeceded. Speedups across the board for CELT mode files: 64kbps 128kbps H300 9.82MHz 15.48MHz c200 4.86MHz 9.63MHz fuze v1 10.32MHz 15.92MHz For the silk mode test file (16kbps) arm targets get a speedup of about 2MHz while the H300 is 7.8MHz slower, likely because it's now using the pseudostack more rather than the real stack which is in iram. Patches to get around that are upcomming. Change-Id: Ifecf963e461c51ac42e09dac1e91bc4bc3b12fa3
Diffstat (limited to 'lib/rbcodec/codecs/libopus/opus_private.h')
-rw-r--r--lib/rbcodec/codecs/libopus/opus_private.h37
1 files changed, 34 insertions, 3 deletions
diff --git a/lib/rbcodec/codecs/libopus/opus_private.h b/lib/rbcodec/codecs/libopus/opus_private.h
index 52482bc18c..9d8210b5f0 100644
--- a/lib/rbcodec/codecs/libopus/opus_private.h
+++ b/lib/rbcodec/codecs/libopus/opus_private.h
@@ -31,15 +31,29 @@
31 31
32#include "arch.h" 32#include "arch.h"
33#include "opus.h" 33#include "opus.h"
34#include "celt.h"
34 35
35struct OpusRepacketizer { 36struct OpusRepacketizer {
36 unsigned char toc; 37 unsigned char toc;
37 int nb_frames; 38 int nb_frames;
38 const unsigned char *frames[48]; 39 const unsigned char *frames[48];
39 short len[48]; 40 opus_int16 len[48];
40 int framesize; 41 int framesize;
41}; 42};
42 43
44typedef struct ChannelLayout {
45 int nb_channels;
46 int nb_streams;
47 int nb_coupled_streams;
48 unsigned char mapping[256];
49} ChannelLayout;
50
51int validate_layout(const ChannelLayout *layout);
52int get_left_channel(const ChannelLayout *layout, int stream_id, int prev);
53int get_right_channel(const ChannelLayout *layout, int stream_id, int prev);
54int get_mono_channel(const ChannelLayout *layout, int stream_id, int prev);
55
56
43 57
44#define MODE_SILK_ONLY 1000 58#define MODE_SILK_ONLY 1000
45#define MODE_HYBRID 1001 59#define MODE_HYBRID 1001
@@ -68,16 +82,33 @@ struct OpusRepacketizer {
68#define OPUS_SET_FORCE_MODE_REQUEST 11002 82#define OPUS_SET_FORCE_MODE_REQUEST 11002
69#define OPUS_SET_FORCE_MODE(x) OPUS_SET_FORCE_MODE_REQUEST, __opus_check_int(x) 83#define OPUS_SET_FORCE_MODE(x) OPUS_SET_FORCE_MODE_REQUEST, __opus_check_int(x)
70 84
85typedef void (*downmix_func)(const void *, float *, int, int, int);
86void downmix_float(const void *_x, float *sub, int subframe, int offset, int C);
87void downmix_int(const void *_x, float *sub, int subframe, int offset, int C);
88
89int optimize_framesize(const opus_val16 *x, int len, int C, opus_int32 Fs,
90 int bitrate, opus_val16 tonality, opus_val32 *mem, int buffering,
91 downmix_func downmix);
71 92
72int encode_size(int size, unsigned char *data); 93int encode_size(int size, unsigned char *data);
73 94
95opus_int32 frame_size_select(opus_int32 frame_size, int variable_duration, opus_int32 Fs);
96
97opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_size,
98 unsigned char *data, opus_int32 out_data_bytes, int lsb_depth
99#ifndef FIXED_POINT
100 , AnalysisInfo *analysis_info
101#endif
102 );
103
74int opus_decode_native(OpusDecoder *st, const unsigned char *data, opus_int32 len, 104int opus_decode_native(OpusDecoder *st, const unsigned char *data, opus_int32 len,
75 opus_val16 *pcm, int frame_size, int decode_fec, int self_delimited, int *packet_offset); 105 opus_val16 *pcm, int frame_size, int decode_fec, int self_delimited,
106 int *packet_offset, int soft_clip);
76 107
77/* Make sure everything's aligned to sizeof(void *) bytes */ 108/* Make sure everything's aligned to sizeof(void *) bytes */
78static inline int align(int i) 109static inline int align(int i)
79{ 110{
80 return (i+sizeof(void *)-1)&-((int)sizeof(void *)); 111 return (i+(int)sizeof(void *)-1)&-(int)sizeof(void *);
81} 112}
82 113
83opus_int32 opus_repacketizer_out_range_impl(OpusRepacketizer *rp, int begin, int end, unsigned char *data, opus_int32 maxlen, int self_delimited); 114opus_int32 opus_repacketizer_out_range_impl(OpusRepacketizer *rp, int begin, int end, unsigned char *data, opus_int32 maxlen, int self_delimited);