1diff -urNp opus-1.0.3/celt/bands.c opus-1.0.3-dec/celt/bands.c
2--- opus-1.0.3/celt/bands.c	2013-07-11 07:16:52.000000000 +0300
3+++ opus-1.0.3-dec/celt/bands.c	2017-03-03 08:10:00.000000000 +0300
4@@ -295,6 +295,7 @@ void anti_collapse(const CELTMode *m, ce
5    }
6 }
7
8+#ifdef OPUS_ENABLE_ENCODER
9 static void intensity_stereo(const CELTMode *m, celt_norm *X, celt_norm *Y, const celt_ener *bandE, int bandID, int N)
10 {
11    int i = bandID;
12@@ -332,6 +333,7 @@ static void stereo_split(celt_norm *X, c
13       Y[j] = r-l;
14    }
15 }
16+#endif /* OPUS_ENABLE_ENCODER */
17
18 static void stereo_merge(celt_norm *X, celt_norm *Y, opus_val16 mid, int N)
19 {
20@@ -675,11 +677,14 @@ static unsigned quant_band(int encode, c
21          int sign=0;
22          if (*remaining_bits>=1<<BITRES)
23          {
24+            #ifdef OPUS_ENABLE_ENCODER
25             if (encode)
26             {
27                sign = x[0]<0;
28                ec_enc_bits(ec, sign, 1);
29-            } else {
30+            } else
31+            #endif
32+            {
33                sign = ec_dec_bits(ec, 1);
34             }
35             *remaining_bits -= 1<<BITRES;
36@@ -714,8 +719,10 @@ static unsigned quant_band(int encode, c
37          static const unsigned char bit_interleave_table[16]={
38            0,1,1,1,2,3,3,3,2,3,3,3,2,3,3,3
39          };
40+         #ifdef OPUS_ENABLE_ENCODER
41          if (encode)
42             haar1(X, N>>k, 1<<k);
43+         #endif
44          if (lowband)
45             haar1(lowband, N>>k, 1<<k);
46          fill = bit_interleave_table[fill&0xF]|bit_interleave_table[fill>>4]<<2;
47@@ -726,8 +733,10 @@ static unsigned quant_band(int encode, c
48       /* Increasing the time resolution */
49       while ((N_B&1) == 0 && tf_change<0)
50       {
51+         #ifdef OPUS_ENABLE_ENCODER
52          if (encode)
53             haar1(X, N_B, B);
54+         #endif
55          if (lowband)
56             haar1(lowband, N_B, B);
57          fill |= fill<<B;
58@@ -742,8 +751,10 @@ static unsigned quant_band(int encode, c
59       /* Reorganize the samples in time order instead of frequency order */
60       if (B0>1)
61       {
62+         #ifdef OPUS_ENABLE_ENCODER
63          if (encode)
64             deinterleave_hadamard(X, N_B>>recombine, B0<<recombine, longBlocks);
65+         #endif
66          if (lowband)
67             deinterleave_hadamard(lowband, N_B>>recombine, B0<<recombine, longBlocks);
68       }
69@@ -779,6 +790,7 @@ static unsigned quant_band(int encode, c
70       qn = compute_qn(N, b, offset, pulse_cap, stereo);
71       if (stereo && i>=intensity)
72          qn = 1;
73+      #ifdef OPUS_ENABLE_ENCODER
74       if (encode)
75       {
76          /* theta is the atan() of the ratio between the (normalized)
77@@ -787,11 +799,14 @@ static unsigned quant_band(int encode, c
78             2) they are orthogonal. */
79          itheta = stereo_itheta(X, Y, stereo, N);
80       }
81+      #endif
82       tell = ec_tell_frac(ec);
83       if (qn!=1)
84       {
85+         #ifdef OPUS_ENABLE_ENCODER
86          if (encode)
87             itheta = (itheta*qn+8192)>>14;
88+         #endif
89
90          /* Entropy coding of the angle. We use a uniform pdf for the
91             time split, a step for stereo, and a triangular one for the rest. */
92@@ -802,10 +817,13 @@ static unsigned quant_band(int encode, c
93             int x0 = qn/2;
94             int ft = p0*(x0+1) + x0;
95             /* Use a probability of p0 up to itheta=8192 and then use 1 after */
96+            #ifdef OPUS_ENABLE_ENCODER
97             if (encode)
98             {
99                ec_encode(ec,x<=x0?p0*x:(x-1-x0)+(x0+1)*p0,x<=x0?p0*(x+1):(x-x0)+(x0+1)*p0,ft);
100-            } else {
101+            } else
102+            #endif
103+            {
104                int fs;
105                fs=ec_decode(ec,ft);
106                if (fs<(x0+1)*p0)
107@@ -817,13 +835,16 @@ static unsigned quant_band(int encode, c
108             }
109          } else if (B0>1 || stereo) {
110             /* Uniform pdf */
111+            #ifdef OPUS_ENABLE_ENCODER
112             if (encode)
113                ec_enc_uint(ec, itheta, qn+1);
114             else
115+            #endif
116                itheta = ec_dec_uint(ec, qn+1);
117          } else {
118             int fs=1, ft;
119             ft = ((qn>>1)+1)*((qn>>1)+1);
120+            #ifdef OPUS_ENABLE_ENCODER
121             if (encode)
122             {
123                int fl;
124@@ -833,7 +854,9 @@ static unsigned quant_band(int encode, c
125                 ft - ((qn + 1 - itheta)*(qn + 2 - itheta)>>1);
126
127                ec_encode(ec, fl, fl+fs, ft);
128-            } else {
129+            } else
130+            #endif
131+            {
132                /* Triangular pdf */
133                int fl=0;
134                int fm;
135@@ -857,6 +880,7 @@ static unsigned quant_band(int encode, c
136             }
137          }
138          itheta = (opus_int32)itheta*16384/qn;
139+         #ifdef OPUS_ENABLE_ENCODER
140          if (encode && stereo)
141          {
142             if (itheta==0)
143@@ -864,9 +888,11 @@ static unsigned quant_band(int encode, c
144             else
145                stereo_split(X, Y, N);
146          }
147+         #endif
148          /* NOTE: Renormalising X and Y *may* help fixed-point a bit at very high rate.
149                   Let's do that at higher complexity */
150       } else if (stereo) {
151+         #ifdef OPUS_ENABLE_ENCODER
152          if (encode)
153          {
154             inv = itheta > 8192;
155@@ -878,11 +904,14 @@ static unsigned quant_band(int encode, c
156             }
157             intensity_stereo(m, X, Y, bandE, i, N);
158          }
159+         #endif
160          if (b>2<<BITRES && *remaining_bits > 2<<BITRES)
161          {
162+            #ifdef OPUS_ENABLE_ENCODER
163             if (encode)
164                ec_enc_bit_logp(ec, inv, 2);
165             else
166+            #endif
167                inv = ec_dec_bit_logp(ec, 2);
168          } else
169             inv = 0;
170@@ -941,12 +970,15 @@ static unsigned quant_band(int encode, c
171          y2 = c ? X : Y;
172          if (sbits)
173          {
174+            #ifdef OPUS_ENABLE_ENCODER
175             if (encode)
176             {
177                /* Here we only need to encode a sign for the side */
178                sign = x2[0]*y2[1] - x2[1]*y2[0] < 0;
179                ec_enc_bits(ec, sign, 1);
180-            } else {
181+            } else
182+            #endif
183+            {
184                sign = ec_dec_bits(ec, 1);
185             }
186          }
187@@ -1057,6 +1089,7 @@ static unsigned quant_band(int encode, c
188          int K = get_pulses(q);
189
190          /* Finally do the actual quantization */
191+         #ifdef OPUS_ENABLE_ENCODER
192          if (encode)
193          {
194             cm = alg_quant(X, N, K, spread, B, ec
195@@ -1064,7 +1097,9 @@ static unsigned quant_band(int encode, c
196                  , gain
197 #endif
198                  );
199-         } else {
200+         } else
201+         #endif
202+         {
203             cm = alg_unquant(X, N, K, spread, B, ec, gain);
204          }
205       } else {
206diff -urNp opus-1.0.3/celt/celt.c opus-1.0.3-dec/celt/celt.c
207--- opus-1.0.3/celt/celt.c	2013-07-11 07:16:52.000000000 +0300
208+++ opus-1.0.3-dec/celt/celt.c	2017-03-03 08:10:00.000000000 +0300
209@@ -135,6 +135,7 @@ static int resampling_factor(opus_int32
210    return ret;
211 }
212
213+#ifdef OPUS_ENABLE_ENCODER
214 /** Encoder state
215  @brief Encoder state
216  */
217@@ -282,6 +283,7 @@ OPUS_CUSTOM_NOSTATIC int opus_custom_enc
218
219    return OPUS_OK;
220 }
221+#endif /* OPUS_ENABLE_ENCODER */
222
223 #ifdef CUSTOM_MODES
224 void opus_custom_encoder_destroy(CELTEncoder *st)
225@@ -302,6 +304,7 @@ static inline opus_val16 SIG2WORD16(celt
226 #endif
227 }
228
229+#ifdef OPUS_ENABLE_ENCODER
230 static int transient_analysis(const opus_val32 * OPUS_RESTRICT in, int len, int C,
231                               int overlap)
232 {
233@@ -419,6 +422,7 @@ static void compute_mdcts(const CELTMode
234       } while (++c<C);
235    }
236 }
237+#endif /* OPUS_ENABLE_ENCODER */
238
239 /** Compute the IMDCT and apply window for all sub-frames and
240     all channels in a frame */
241@@ -545,6 +549,7 @@ static const signed char tf_select_table
242       {0, -2, 0, -3,    3, 0, 1,-1},
243 };
244
245+#ifdef OPUS_ENABLE_ENCODER
246 static opus_val32 l1_metric(const celt_norm *tmp, int N, int LM, int width)
247 {
248    int i, j;
249@@ -746,6 +751,7 @@ static void tf_encode(int start, int end
250       tf_res[i] = tf_select_table[LM][4*isTransient+2*tf_select+tf_res[i]];
251    /*printf("%d %d ", isTransient, tf_select); for(i=0;i<end;i++)printf("%d ", tf_res[i]);printf("\n");*/
252 }
253+#endif /* OPUS_ENABLE_ENCODER */
254
255 static void tf_decode(int start, int end, int isTransient, int *tf_res, int LM, ec_dec *dec)
256 {
257@@ -797,6 +803,7 @@ static void init_caps(const CELTMode *m,
258    }
259 }
260
261+#ifdef OPUS_ENABLE_ENCODER
262 static int alloc_trim_analysis(const CELTMode *m, const celt_norm *X,
263       const opus_val16 *bandLogE, int end, int LM, int C, int N0)
264 {
265@@ -1912,6 +1919,7 @@ bad_request:
266    va_end(ap);
267    return OPUS_UNIMPLEMENTED;
268 }
269+#endif /* OPUS_ENABLE_ENCODER */
270
271 /**********************************************************************/
272 /*                                                                    */
273diff -urNp opus-1.0.3/celt/cwrs.c opus-1.0.3-dec/celt/cwrs.c
274--- opus-1.0.3/celt/cwrs.c	2013-07-11 07:16:52.000000000 +0300
275+++ opus-1.0.3-dec/celt/cwrs.c	2017-03-03 08:10:00.000000000 +0300
276@@ -587,6 +587,7 @@ void get_required_bits(opus_int16 *_bits
277 }
278 #endif /* CUSTOM_MODES */
279
280+#ifdef OPUS_ENABLE_ENCODER
281 void encode_pulses(const int *_y,int _n,int _k,ec_enc *_enc){
282   opus_uint32 i;
283   celt_assert(_k>0);
284@@ -620,6 +621,7 @@ void encode_pulses(const int *_y,int _n,
285   }
286 #endif
287 }
288+#endif /* OPUS_ENABLE_ENCODER */
289
290 void decode_pulses(int *_y,int _n,int _k,ec_dec *_dec)
291 {
292diff -urNp opus-1.0.3/celt/laplace.c opus-1.0.3-dec/celt/laplace.c
293--- opus-1.0.3/celt/laplace.c	2013-03-12 19:43:58.000000000 +0200
294+++ opus-1.0.3-dec/celt/laplace.c	2017-03-03 08:10:00.000000000 +0300
295@@ -48,6 +48,7 @@ static unsigned ec_laplace_get_freq1(uns
296    return ft*(opus_int32)(16384-decay)>>15;
297 }
298
299+#ifdef OPUS_ENABLE_ENCODER
300 void ec_laplace_encode(ec_enc *enc, int *value, unsigned fs, int decay)
301 {
302    unsigned fl;
303@@ -90,6 +91,7 @@ void ec_laplace_encode(ec_enc *enc, int
304    }
305    ec_encode_bin(enc, fl, fl+fs, 15);
306 }
307+#endif /* OPUS_ENABLE_ENCODER */
308
309 int ec_laplace_decode(ec_dec *dec, unsigned fs, int decay)
310 {
311diff -urNp opus-1.0.3/celt/quant_bands.c opus-1.0.3-dec/celt/quant_bands.c
312--- opus-1.0.3/celt/quant_bands.c	2013-07-11 07:16:52.000000000 +0300
313+++ opus-1.0.3-dec/celt/quant_bands.c	2017-03-03 08:10:00.000000000 +0300
314@@ -139,6 +139,7 @@ static const unsigned char e_prob_model[
315
316 static const unsigned char small_energy_icdf[3]={2,1,0};
317
318+#ifdef OPUS_ENABLE_ENCODER
319 static opus_val32 loss_distortion(const opus_val16 *eBands, opus_val16 *oldEBands, int start, int end, int len, int C)
320 {
321    int c, i;
322@@ -418,6 +419,7 @@ void quant_energy_finalise(const CELTMod
323       }
324    }
325 }
326+#endif /* OPUS_ENABLE_ENCODER */
327
328 void unquant_coarse_energy(const CELTMode *m, int start, int end, opus_val16 *oldEBands, int intra, ec_dec *dec, int C, int LM)
329 {
330diff -urNp opus-1.0.3/celt/rate.c opus-1.0.3-dec/celt/rate.c
331--- opus-1.0.3/celt/rate.c	2013-07-11 07:16:52.000000000 +0300
332+++ opus-1.0.3-dec/celt/rate.c	2017-03-03 08:10:00.000000000 +0300
333@@ -343,6 +343,7 @@ static inline int interp_bits2pulses(con
334         This ensures that we have enough bits to code the skip flag.*/
335       if (band_bits >= IMAX(thresh[j], alloc_floor+(1<<BITRES)))
336       {
337+         #ifdef OPUS_ENABLE_ENCODER
338          if (encode)
339          {
340             /*This if() block is the only part of the allocation function that
341@@ -360,7 +361,9 @@ static inline int interp_bits2pulses(con
342                break;
343             }
344             ec_enc_bit_logp(ec, 0, 1);
345-         } else if (ec_dec_bit_logp(ec, 1)) {
346+         } else
347+         #endif /* OPUS_ENABLE_ENCODER */
348+         if (ec_dec_bit_logp(ec, 1)) {
349             break;
350          }
351          /*We used a bit to skip this band.*/
352@@ -387,12 +390,14 @@ static inline int interp_bits2pulses(con
353    /* Code the intensity and dual stereo parameters. */
354    if (intensity_rsv > 0)
355    {
356+      #ifdef OPUS_ENABLE_ENCODER
357       if (encode)
358       {
359          *intensity = IMIN(*intensity, codedBands);
360          ec_enc_uint(ec, *intensity-start, codedBands+1-start);
361       }
362       else
363+      #endif
364          *intensity = start+ec_dec_uint(ec, codedBands+1-start);
365    }
366    else
367@@ -404,9 +409,11 @@ static inline int interp_bits2pulses(con
368    }
369    if (dual_stereo_rsv > 0)
370    {
371+      #ifdef OPUS_ENABLE_ENCODER
372       if (encode)
373          ec_enc_bit_logp(ec, *dual_stereo, 1);
374       else
375+      #endif
376          *dual_stereo = ec_dec_bit_logp(ec, 1);
377    }
378    else
379diff -urNp opus-1.0.3/celt/vq.c opus-1.0.3-dec/celt/vq.c
380--- opus-1.0.3/celt/vq.c	2013-05-27 01:54:05.000000000 +0300
381+++ opus-1.0.3-dec/celt/vq.c	2017-03-03 08:10:00.000000000 +0300
382@@ -151,6 +151,7 @@ static unsigned extract_collapse_mask(in
383    return collapse_mask;
384 }
385
386+#ifdef OPUS_ENABLE_ENCODER
387 unsigned alg_quant(celt_norm *X, int N, int K, int spread, int B, ec_enc *enc
388 #ifdef RESYNTH
389    , opus_val16 gain
390@@ -316,6 +317,7 @@ unsigned alg_quant(celt_norm *X, int N,
391    RESTORE_STACK;
392    return collapse_mask;
393 }
394+#endif /* OPUS_ENABLE_ENCODER */
395
396 /** Decode pulse vector and combine the result with the pitch vector to produce
397     the final normalised signal in the current band. */
398diff -urNp opus-1.0.3/celt_sources.mk opus-1.0.3-dec/celt_sources.mk
399--- opus-1.0.3/celt_sources.mk	2013-07-11 07:16:52.000000000 +0300
400+++ opus-1.0.3-dec/celt_sources.mk	2017-03-03 08:10:00.000000000 +0300
401@@ -3,7 +3,6 @@ celt/celt.c \
402 celt/cwrs.c \
403 celt/entcode.c \
404 celt/entdec.c \
405-celt/entenc.c \
406 celt/kiss_fft.c \
407 celt/laplace.c \
408 celt/mathops.c \
409@@ -14,3 +13,5 @@ celt/celt_lpc.c \
410 celt/quant_bands.c \
411 celt/rate.c \
412 celt/vq.c
413+
414+CELT_SOURCES_ENC = celt/entenc.c
415diff -urNp opus-1.0.3/opus_sources.mk opus-1.0.3-dec/opus_sources.mk
416--- opus-1.0.3/opus_sources.mk	2013-07-11 07:16:52.000000000 +0300
417+++ opus-1.0.3-dec/opus_sources.mk	2017-03-03 08:10:00.000000000 +0300
418@@ -1,5 +1,6 @@
419-OPUS_SOURCES = src/opus.c \
420-src/opus_decoder.c \
421+OPUS_SOURCES = src/opus_decoder.c \
422+src/opus_multistream.c
423+
424+OPUS_SOURCES_ENC = src/opus.c \
425 src/opus_encoder.c \
426-src/opus_multistream.c \
427 src/repacketizer.c
428diff -urNp opus-1.0.3/silk/code_signs.c opus-1.0.3-dec/silk/code_signs.c
429--- opus-1.0.3/silk/code_signs.c	2013-07-11 07:16:52.000000000 +0300
430+++ opus-1.0.3-dec/silk/code_signs.c	2017-03-03 08:10:00.000000000 +0300
431@@ -37,6 +37,7 @@ POSSIBILITY OF SUCH DAMAGE.
432 #define silk_enc_map(a)                  ( silk_RSHIFT( (a), 15 ) + 1 )
433 #define silk_dec_map(a)                  ( silk_LSHIFT( (a),  1 ) - 1 )
434
435+#ifdef OPUS_ENABLE_ENCODER
436 /* Encodes signs of excitation */
437 void silk_encode_signs(
438     ec_enc                      *psRangeEnc,                        /* I/O  Compressor data structure                   */
439@@ -70,6 +71,7 @@ void silk_encode_signs(
440         q_ptr += SHELL_CODEC_FRAME_LENGTH;
441     }
442 }
443+#endif /* OPUS_ENABLE_ENCODER */
444
445 /* Decodes signs of excitation */
446 void silk_decode_signs(
447diff -urNp opus-1.0.3/silk/shell_coder.c opus-1.0.3-dec/silk/shell_coder.c
448--- opus-1.0.3/silk/shell_coder.c	2013-07-11 07:16:52.000000000 +0300
449+++ opus-1.0.3-dec/silk/shell_coder.c	2017-03-03 08:10:00.000000000 +0300
450@@ -45,6 +45,7 @@ static inline void combine_pulses(
451     }
452 }
453
454+#ifdef OPUS_ENABLE_ENCODER
455 static inline void encode_split(
456     ec_enc                      *psRangeEnc,    /* I/O  compressor data structure                   */
457     const opus_int              p_child1,       /* I    pulse amplitude of first child subframe     */
458@@ -56,6 +57,7 @@ static inline void encode_split(
459         ec_enc_icdf( psRangeEnc, p_child1, &shell_table[ silk_shell_code_table_offsets[ p ] ], 8 );
460     }
461 }
462+#endif /* OPUS_ENABLE_ENCODER */
463
464 static inline void decode_split(
465     opus_int                    *p_child1,      /* O    pulse amplitude of first child subframe     */
466@@ -74,6 +76,7 @@ static inline void decode_split(
467     }
468 }
469
470+#ifdef OPUS_ENABLE_ENCODER
471 /* Shell encoder, operates on one shell code frame of 16 pulses */
472 void silk_shell_encoder(
473     ec_enc                      *psRangeEnc,                    /* I/O  compressor data structure                   */
474@@ -113,7 +116,7 @@ void silk_shell_encoder(
475     encode_split( psRangeEnc, pulses0[ 12 ], pulses1[ 6 ], silk_shell_code_table0 );
476     encode_split( psRangeEnc, pulses0[ 14 ], pulses1[ 7 ], silk_shell_code_table0 );
477 }
478-
479+#endif /* OPUS_ENABLE_ENCODER */
480
481 /* Shell decoder, operates on one shell code frame of 16 pulses */
482 void silk_shell_decoder(
483diff -urNp opus-1.0.3/silk_sources.mk opus-1.0.3-dec/silk_sources.mk
484--- opus-1.0.3/silk_sources.mk	2013-03-12 19:43:58.000000000 +0200
485+++ opus-1.0.3-dec/silk_sources.mk	2017-03-03 08:10:00.000000000 +0300
486@@ -9,15 +9,8 @@ silk/decode_indices.c \
487 silk/decode_pulses.c \
488 silk/decoder_set_fs.c \
489 silk/dec_API.c \
490-silk/enc_API.c \
491-silk/encode_indices.c \
492-silk/encode_pulses.c \
493 silk/gain_quant.c \
494-silk/interpolate.c \
495-silk/LP_variable_cutoff.c \
496 silk/NLSF_decode.c \
497-silk/NSQ.c \
498-silk/NSQ_del_dec.c \
499 silk/PLC.c \
500 silk/shell_coder.c \
501 silk/tables_gain.c \
502@@ -27,25 +20,8 @@ silk/tables_NLSF_CB_WB.c \
503 silk/tables_other.c \
504 silk/tables_pitch_lag.c \
505 silk/tables_pulses_per_block.c \
506-silk/VAD.c \
507-silk/control_audio_bandwidth.c \
508-silk/quant_LTP_gains.c \
509-silk/VQ_WMat_EC.c \
510-silk/HP_variable_cutoff.c \
511-silk/NLSF_encode.c \
512-silk/NLSF_VQ.c \
513 silk/NLSF_unpack.c \
514-silk/NLSF_del_dec_quant.c \
515-silk/process_NLSFs.c \
516-silk/stereo_LR_to_MS.c \
517 silk/stereo_MS_to_LR.c \
518-silk/check_control_input.c \
519-silk/control_SNR.c \
520-silk/init_encoder.c \
521-silk/control_codec.c \
522-silk/A2NLSF.c \
523-silk/ana_filt_bank_1.c \
524-silk/biquad_alt.c \
525 silk/bwexpander_32.c \
526 silk/bwexpander.c \
527 silk/debug.c \
528@@ -61,22 +37,47 @@ silk/NLSF_stabilize.c \
529 silk/NLSF_VQ_weights_laroia.c \
530 silk/pitch_est_tables.c \
531 silk/resampler.c \
532-silk/resampler_down2_3.c \
533-silk/resampler_down2.c \
534 silk/resampler_private_AR2.c \
535 silk/resampler_private_down_FIR.c \
536 silk/resampler_private_IIR_FIR.c \
537 silk/resampler_private_up2_HQ.c \
538 silk/resampler_rom.c \
539-silk/sigm_Q15.c \
540 silk/sort.c \
541 silk/sum_sqr_shift.c \
542-silk/stereo_decode_pred.c \
543+silk/stereo_decode_pred.c
544+
545+SILK_SOURCES_ENC = \
546+silk/enc_API.c \
547+silk/encode_indices.c \
548+silk/encode_pulses.c \
549+silk/interpolate.c \
550+silk/LP_variable_cutoff.c \
551+silk/NSQ.c \
552+silk/NSQ_del_dec.c \
553+silk/VAD.c \
554+silk/control_audio_bandwidth.c \
555+silk/quant_LTP_gains.c \
556+silk/VQ_WMat_EC.c \
557+silk/HP_variable_cutoff.c \
558+silk/NLSF_encode.c \
559+silk/NLSF_VQ.c \
560+silk/NLSF_del_dec_quant.c \
561+silk/process_NLSFs.c \
562+silk/stereo_LR_to_MS.c \
563+silk/check_control_input.c \
564+silk/control_SNR.c \
565+silk/init_encoder.c \
566+silk/control_codec.c \
567+silk/A2NLSF.c \
568+silk/ana_filt_bank_1.c \
569+silk/biquad_alt.c \
570+silk/resampler_down2_3.c \
571+silk/resampler_down2.c \
572+silk/sigm_Q15.c \
573 silk/stereo_encode_pred.c \
574 silk/stereo_find_predictor.c \
575 silk/stereo_quant_pred.c
576
577-
578 SILK_SOURCES_FIXED = \
579 silk/fixed/LTP_analysis_filter_FIX.c \
580 silk/fixed/LTP_scale_ctrl_FIX.c \
581diff -urNp opus-1.0.3/src/opus_multistream.c opus-1.0.3-dec/src/opus_multistream.c
582--- opus-1.0.3/src/opus_multistream.c	2017-03-02 05:51:10.000000000 +0300
583+++ opus-1.0.3-dec/src/opus_multistream.c	2017-03-03 08:10:00.000000000 +0300
584@@ -50,6 +50,7 @@ typedef struct {
585    unsigned char mapping[8];
586 } VorbisLayout;
587
588+#ifdef OPUS_ENABLE_ENCODER
589 /* Index is nb_channel-1*/
590 static const VorbisLayout vorbis_mappings[8] = {
591       {1, 0, {0}},                      /* 1: mono */
592@@ -69,6 +70,7 @@ struct OpusMSEncoder {
593    int lfe_stream;
594    /* Encoder states go here */
595 };
596+#endif /* OPUS_ENABLE_ENCODER */
597
598 struct OpusMSDecoder {
599    ChannelLayout layout;
600@@ -133,6 +135,7 @@ static int get_mono_channel(const Channe
601    return -1;
602 }
603
604+#ifdef OPUS_ENABLE_ENCODER
605 static int validate_encoder_layout(const ChannelLayout *layout)
606 {
607    int s;
608@@ -832,6 +835,7 @@ void opus_multistream_encoder_destroy(Op
609 {
610     opus_free(st);
611 }
612+#endif /* OPUS_ENABLE_ENCODER */
613
614
615 /* DECODER */
616diff -urNp opus-1.0.3-dec/configure.ac~ opus-1.0.3-dec/configure.ac
617--- opus-1.0.3-dec/configure.ac~	2013-07-11 07:20:57.000000000 +0300
618+++ opus-1.0.3-dec/configure.ac	2017-03-03 08:11:00.000000000 +0300
619@@ -180,6 +180,13 @@ if test "$HAVE_DOXYGEN" != "yes" -o "$ac
620 fi
621 AM_CONDITIONAL(HAVE_DOXYGEN, [test $HAVE_DOXYGEN = yes])
622
623+ac_enable_encoder="no";
624+AC_ARG_ENABLE(encoder, [  --enable-encoder           compile with encoder support],
625+[if test "$enableval" = yes; then
626+  ac_enable_encoder="yes";
627+  AC_DEFINE([OPUS_ENABLE_ENCODER], [1], [Compile with encoder support])
628+fi])
629+
630 saved_CFLAGS="$CFLAGS"
631 CFLAGS="$CFLAGS -fvisibility=hidden"
632 AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden])
633@@ -241,6 +248,7 @@ AC_SUBST(SIZE32)
634
635 AM_CONDITIONAL([FIXED_POINT], [test x$ac_enable_fixed = xyes])
636 AM_CONDITIONAL([CUSTOM_MODES], [test x$ac_enable_custom_modes = xyes])
637+AM_CONDITIONAL([USE_ENCODER], [test x$ac_enable_encoder = xyes])
638
639 dnl subsitutions for the pkg-config files
640 if test x$ac_enable_float = xyes; then
641@@ -280,6 +288,7 @@ AC_MSG_RESULT([
642       Floating point support: ........ ${ac_enable_float}
643       Fast float approximations: ..... ${float_approx}
644       Fixed point debugging: ......... ${ac_enable_fixed_debug}
645+      Encoder support: ............... ${ac_enable_encoder}
646       Custom modes: .................. ${ac_enable_custom_modes}
647       Assertion checking: ............ ${ac_enable_assertions}
648       Fuzzing: ....................... ${ac_enable_fuzzing}
649diff -urNp opus-1.0.3-dec/Makefile.unix~ opus-1.0.3-dec/Makefile.unix
650--- opus-1.0.3-dec/Makefile.unix~	2013-07-11 07:16:52.000000000 +0300
651+++ opus-1.0.3-dec/Makefile.unix	2017-03-03 08:11:00.000000000 +0300
652@@ -3,6 +3,9 @@
653 # Uncomment this for fixed-point build
654 #FIXED_POINT=1
655
656+# Uncomment this to include the opus encoder
657+#USE_ENCODER=1
658+
659 # It is strongly recommended to uncomment one of these
660 # VAR_ARRAYS: Use C99 variable-length arrays for stack allocation
661 # USE_ALLOCA: Use alloca() for stack allocation
662@@ -26,11 +29,17 @@ include silk_sources.mk
663 include celt_sources.mk
664 include opus_sources.mk
665
666+ifdef USE_ENCODER
667+CFLAGS := -DOPUS_ENABLE_ENCODER $(CFLAGS)
668+CELT_SOURCES += $(CELT_SOURCES_ENC)
669+SILK_SOURCES += $(SILK_SOURCES_ENC)
670+OPUS_SOURCES += $(OPUS_SOURCES_ENC)
671 ifdef FIXED_POINT
672 SILK_SOURCES += $(SILK_SOURCES_FIXED)
673 else
674 SILK_SOURCES += $(SILK_SOURCES_FLOAT)
675 endif
676+endif
677
678 EXESUFFIX =
679 LIBPREFIX = lib
680diff -urNp opus-1.0.3-dec/Makefile.am~ opus-1.0.3-dec/Makefile.am
681--- opus-1.0.3-dec/Makefile.am~	2013-07-11 07:16:52.000000000 +0300
682+++ opus-1.0.3-dec/Makefile.am	2017-03-03 08:11:00.000000000 +0300
683@@ -10,11 +10,16 @@ include celt_sources.mk
684 include silk_sources.mk
685 include opus_sources.mk
686
687+if USE_ENCODER
688+CELT_SOURCES += $(CELT_SOURCES_ENC)
689+SILK_SOURCES += $(SILK_SOURCES_ENC)
690+OPUS_SOURCES += $(OPUS_SOURCES_ENC)
691 if FIXED_POINT
692 SILK_SOURCES += $(SILK_SOURCES_FIXED)
693 else
694 SILK_SOURCES += $(SILK_SOURCES_FLOAT)
695 endif
696+endif
697
698 include celt_headers.mk
699 include silk_headers.mk
700@@ -27,6 +32,8 @@ pkginclude_HEADERS = include/opus.h incl
701
702 noinst_HEADERS = $(OPUS_HEAD) $(SILK_HEAD) $(CELT_HEAD)
703
704+# many demo/test programs rely on encoder, ifdef is a lazy way around
705+if USE_ENCODER
706 noinst_PROGRAMS = opus_demo repacketizer_demo opus_compare tests/test_opus_api tests/test_opus_encode tests/test_opus_decode celt/tests/test_unit_cwrs32 celt/tests/test_unit_dft celt/tests/test_unit_entropy celt/tests/test_unit_laplace celt/tests/test_unit_mathops celt/tests/test_unit_mdct celt/tests/test_unit_rotation celt/tests/test_unit_types
707
708 TESTS = celt/tests/test_unit_types celt/tests/test_unit_mathops celt/tests/test_unit_entropy celt/tests/test_unit_laplace celt/tests/test_unit_dft celt/tests/test_unit_mdct celt/tests/test_unit_rotation celt/tests/test_unit_cwrs32 tests/test_opus_api tests/test_opus_decode tests/test_opus_encode
709@@ -81,6 +88,7 @@ noinst_PROGRAMS += opus_custom_demo
710 opus_custom_demo_SOURCES = celt/opus_custom_demo.c
711 opus_custom_demo_LDADD = libopus.la -lm
712 endif
713+endif
714
715 EXTRA_DIST = version.mk \
716 	     opus.pc.in \
717