@@ -248,27 +248,32 @@ void encode(EncState *st, float *in, int *outSize, void *bits)
248
248
for (i = 0 ;i < st -> subframeSize ;i ++ )
249
249
exc [i ]= 0 ;
250
250
251
-
252
251
/* Compute zero response of A(z/g1) / ( A(z/g2) * Aq(z) ) */
253
252
for (i = 0 ;i < st -> lpcSize ;i ++ )
254
253
st -> mem4 [i ]= st -> mem5 [i ];
255
254
syn_filt_mem (exc , st -> interp_qlpc , exc , st -> subframeSize , st -> lpcSize , st -> mem4 );
256
255
for (i = 0 ;i < st -> lpcSize ;i ++ )
257
256
st -> mem4 [i ]= st -> mem5 [i ];
258
257
residue_mem (exc , st -> bw_lpc1 , res , st -> subframeSize , st -> lpcSize , st -> mem4 );
259
- syn_filt_mem (res , st -> bw_lpc2 , res , st -> subframeSize , st -> lpcSize , st -> mem3 );
258
+ for (i = 0 ;i < st -> lpcSize ;i ++ )
259
+ st -> mem4 [i ]= st -> mem2 [i ];
260
+ syn_filt_mem (res , st -> bw_lpc2 , res , st -> subframeSize , st -> lpcSize , st -> mem4 );
260
261
261
262
/* Compute weighted signal */
262
- residue_mem (sp , st -> bw_lpc1 , sw , st -> subframeSize , st -> lpcSize , st -> mem1 );
263
- syn_filt_mem (sw , st -> bw_lpc2 , sw , st -> subframeSize , st -> lpcSize , st -> mem2 );
264
-
263
+ residue (sp , st -> bw_lpc1 , sw , st -> subframeSize , st -> lpcSize );
265
264
for (i = 0 ;i < st -> lpcSize ;i ++ )
266
- st -> mem3 [i ]= sw [st -> subframeSize - i - 1 ];
265
+ st -> mem4 [i ]= st -> mem2 [i ];
266
+ syn_filt_mem (sw , st -> bw_lpc2 , sw , st -> subframeSize , st -> lpcSize , st -> mem4 );
267
+
268
+ /*for (i=0;i<st->lpcSize;i++)
269
+ st->mem3[i]=sw[st->subframeSize-i-1];*/
267
270
268
271
/* Compute target signal */
269
272
for (i = 0 ;i < st -> subframeSize ;i ++ )
270
273
target [i ]= sw [i ]- res [i ];
271
274
275
+ for (i = 0 ;i < st -> subframeSize ;i ++ )
276
+ exc [i ]= 0 ;
272
277
#if 1 /*If set to 0, we compute the excitation directly from the target, i.e. we're cheating */
273
278
274
279
/* Perform adaptive codebook search (3-tap pitch predictor) */
@@ -277,7 +282,7 @@ void encode(EncState *st, float *in, int *outSize, void *bits)
277
282
st -> subframeSize );
278
283
for (i = 0 ;i < st -> subframeSize ;i ++ )
279
284
exc [i ]= gain [0 ]* exc [i - pitch ]+ gain [1 ]* exc [i - pitch - 1 ]+ gain [2 ]* exc [i - pitch - 2 ];
280
- printf ("3tap pitch = %d, gains = [%f %f %f]\n" ,pitch , gain [0 ], gain [1 ], gain [2 ]);
285
+ printf ("3-tap pitch = %d, gains = [%f %f %f]\n" ,pitch , gain [0 ], gain [1 ], gain [2 ]);
281
286
282
287
/* Update target for adaptive codebook contribution */
283
288
residue_zero (exc , st -> bw_lpc1 , res , st -> subframeSize , st -> lpcSize );
@@ -315,8 +320,6 @@ void encode(EncState *st, float *in, int *outSize, void *bits)
315
320
/* Compute weighted signal again, from synthesized speech (not sure it's the right thing) */
316
321
residue_mem (sp , st -> bw_lpc1 , sw , st -> subframeSize , st -> lpcSize , st -> mem1 );
317
322
syn_filt_mem (sw , st -> bw_lpc2 , sw , st -> subframeSize , st -> lpcSize , st -> mem2 );
318
- for (i = 0 ;i < st -> lpcSize ;i ++ )
319
- st -> mem3 [i ]= sw [st -> subframeSize - i - 1 ];
320
323
}
321
324
322
325
/* Store the LSPs for interpolation in the next frame */
0 commit comments