Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Side by Side Diff: silk/shell_coder.c

Issue 107243004: Updating Opus to release 1.1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/opus
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « silk/resampler_private_down_FIR.c ('k') | silk/structs.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /*********************************************************************** 1 /***********************************************************************
2 Copyright (c) 2006-2011, Skype Limited. All rights reserved. 2 Copyright (c) 2006-2011, Skype Limited. All rights reserved.
3 Redistribution and use in source and binary forms, with or without 3 Redistribution and use in source and binary forms, with or without
4 modification, are permitted provided that the following conditions 4 modification, are permitted provided that the following conditions
5 are met: 5 are met:
6 - Redistributions of source code must retain the above copyright notice, 6 - Redistributions of source code must retain the above copyright notice,
7 this list of conditions and the following disclaimer. 7 this list of conditions and the following disclaimer.
8 - Redistributions in binary form must reproduce the above copyright 8 - Redistributions in binary form must reproduce the above copyright
9 notice, this list of conditions and the following disclaimer in the 9 notice, this list of conditions and the following disclaimer in the
10 documentation and/or other materials provided with the distribution. 10 documentation and/or other materials provided with the distribution.
(...skipping 15 matching lines...) Expand all
26 ***********************************************************************/ 26 ***********************************************************************/
27 27
28 #ifdef HAVE_CONFIG_H 28 #ifdef HAVE_CONFIG_H
29 #include "config.h" 29 #include "config.h"
30 #endif 30 #endif
31 31
32 #include "main.h" 32 #include "main.h"
33 33
34 /* shell coder; pulse-subframe length is hardcoded */ 34 /* shell coder; pulse-subframe length is hardcoded */
35 35
36 static inline void combine_pulses( 36 static OPUS_INLINE void combine_pulses(
37 opus_int *out, /* O combined pulses vector [len] */ 37 opus_int *out, /* O combined pulses vector [len] */
38 const opus_int *in, /* I input vector [2 * len] */ 38 const opus_int *in, /* I input vector [2 * len] */
39 const opus_int len /* I number of OUTPUT samples */ 39 const opus_int len /* I number of OUTPUT samples */
40 ) 40 )
41 { 41 {
42 opus_int k; 42 opus_int k;
43 for( k = 0; k < len; k++ ) { 43 for( k = 0; k < len; k++ ) {
44 out[ k ] = in[ 2 * k ] + in[ 2 * k + 1 ]; 44 out[ k ] = in[ 2 * k ] + in[ 2 * k + 1 ];
45 } 45 }
46 } 46 }
47 47
48 static inline void encode_split( 48 static OPUS_INLINE void encode_split(
49 ec_enc *psRangeEnc, /* I/O compressor data structur e */ 49 ec_enc *psRangeEnc, /* I/O compressor data structur e */
50 const opus_int p_child1, /* I pulse amplitude of first child subframe */ 50 const opus_int p_child1, /* I pulse amplitude of first child subframe */
51 const opus_int p, /* I pulse amplitude of curre nt subframe */ 51 const opus_int p, /* I pulse amplitude of curre nt subframe */
52 const opus_uint8 *shell_table /* I table of shell cdfs */ 52 const opus_uint8 *shell_table /* I table of shell cdfs */
53 ) 53 )
54 { 54 {
55 if( p > 0 ) { 55 if( p > 0 ) {
56 ec_enc_icdf( psRangeEnc, p_child1, &shell_table[ silk_shell_code_table_o ffsets[ p ] ], 8 ); 56 ec_enc_icdf( psRangeEnc, p_child1, &shell_table[ silk_shell_code_table_o ffsets[ p ] ], 8 );
57 } 57 }
58 } 58 }
59 59
60 static inline void decode_split( 60 static OPUS_INLINE void decode_split(
61 opus_int *p_child1, /* O pulse amplitude of first child subframe */ 61 opus_int *p_child1, /* O pulse amplitude of first child subframe */
62 opus_int *p_child2, /* O pulse amplitude of secon d child subframe */ 62 opus_int *p_child2, /* O pulse amplitude of secon d child subframe */
63 ec_dec *psRangeDec, /* I/O Compressor data structur e */ 63 ec_dec *psRangeDec, /* I/O Compressor data structur e */
64 const opus_int p, /* I pulse amplitude of curre nt subframe */ 64 const opus_int p, /* I pulse amplitude of curre nt subframe */
65 const opus_uint8 *shell_table /* I table of shell cdfs */ 65 const opus_uint8 *shell_table /* I table of shell cdfs */
66 ) 66 )
67 { 67 {
68 if( p > 0 ) { 68 if( p > 0 ) {
69 p_child1[ 0 ] = ec_dec_icdf( psRangeDec, &shell_table[ silk_shell_code_t able_offsets[ p ] ], 8 ); 69 p_child1[ 0 ] = ec_dec_icdf( psRangeDec, &shell_table[ silk_shell_code_t able_offsets[ p ] ], 8 );
70 p_child2[ 0 ] = p - p_child1[ 0 ]; 70 p_child2[ 0 ] = p - p_child1[ 0 ];
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 decode_split( &pulses2[ 2 ], &pulses2[ 3 ], psRangeDec, pulses3[ 1 ], silk _shell_code_table2 ); 142 decode_split( &pulses2[ 2 ], &pulses2[ 3 ], psRangeDec, pulses3[ 1 ], silk _shell_code_table2 );
143 143
144 decode_split( &pulses1[ 4 ], &pulses1[ 5 ], psRangeDec, pulses2[ 2 ], silk _shell_code_table1 ); 144 decode_split( &pulses1[ 4 ], &pulses1[ 5 ], psRangeDec, pulses2[ 2 ], silk _shell_code_table1 );
145 decode_split( &pulses0[ 8 ], &pulses0[ 9 ], psRangeDec, pulses1[ 4 ], silk _shell_code_table0 ); 145 decode_split( &pulses0[ 8 ], &pulses0[ 9 ], psRangeDec, pulses1[ 4 ], silk _shell_code_table0 );
146 decode_split( &pulses0[ 10 ], &pulses0[ 11 ], psRangeDec, pulses1[ 5 ], silk _shell_code_table0 ); 146 decode_split( &pulses0[ 10 ], &pulses0[ 11 ], psRangeDec, pulses1[ 5 ], silk _shell_code_table0 );
147 147
148 decode_split( &pulses1[ 6 ], &pulses1[ 7 ], psRangeDec, pulses2[ 3 ], silk _shell_code_table1 ); 148 decode_split( &pulses1[ 6 ], &pulses1[ 7 ], psRangeDec, pulses2[ 3 ], silk _shell_code_table1 );
149 decode_split( &pulses0[ 12 ], &pulses0[ 13 ], psRangeDec, pulses1[ 6 ], silk _shell_code_table0 ); 149 decode_split( &pulses0[ 12 ], &pulses0[ 13 ], psRangeDec, pulses1[ 6 ], silk _shell_code_table0 );
150 decode_split( &pulses0[ 14 ], &pulses0[ 15 ], psRangeDec, pulses1[ 7 ], silk _shell_code_table0 ); 150 decode_split( &pulses0[ 14 ], &pulses0[ 15 ], psRangeDec, pulses1[ 7 ], silk _shell_code_table0 );
151 } 151 }
OLDNEW
« no previous file with comments | « silk/resampler_private_down_FIR.c ('k') | silk/structs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698