예제 #1
0
파일: plcg711.c 프로젝트: dormclub/tjphone
/*
* A good frame was received and decoded.
* If right after an erasure, do an overlap add with the synthetic signal.
* Add the frame to history buffer.
*/
void PLC_addtohistory(G711_PLC_state *PLC, short *s)
{
  if (erasecnt) {
    short overlapbuf[FRAMESZ];
    /*
    * longer erasures require longer overlaps
    * to smooth the transition between the synthetic
    * and real signal.
    */
    int olen = poverlap + (erasecnt - 1) * EOVERLAPINCR;
    if (olen > FRAMESZ)
      olen = FRAMESZ;
    getfespeech(PLC, overlapbuf, olen);
    overlapaddatend(PLC, s, overlapbuf, olen);
    erasecnt = 0;
  }
  savespeech(PLC, s);
}
예제 #2
0
파일: plcg711.c 프로젝트: dormclub/tjphone
void PLC_dofe(G711_PLC_state *PLC, short *out)
{
  if (erasecnt == 0) {
    ippsCopy_16s(history, pitchbuf, HISTORYLEN); /* get history */
    pitch = findpitch(PLC);                     /* find pitch */
    poverlap = pitch >> 2;                     /* OLA 1/4 wavelength */
    /* save original last poverlap samples */
    ippsCopy_16s(pitchbufend - poverlap, lastq, poverlap);
    poffset = 0;                     /* create pitch buffer with 1 period */
    pitchblen = pitch;
    pitchbufstart = pitchbufend - pitchblen;
    overlapadd(lastq, pitchbufstart - poverlap,
      pitchbufend - poverlap, poverlap);
    /* update last 1/4 wavelength in history buffer */
    ippsCopy_16s(pitchbufend - poverlap, &history[HISTORYLEN-poverlap],
      poverlap);
    getfespeech(PLC, out, FRAMESZ);               /* get synthesized speech */
  } else if (erasecnt == 1 || erasecnt == 2) {
예제 #3
0
/*
 * Generate the synthetic signal.
 * At the beginning of an erasure determine the pitch, and extract
 * one pitch period from the tail of the signal. Do an OLA for 1/4
 * of the pitch to smooth the signal. Then repeat the extracted signal
 * for the length of the erasure. If the erasure continues for more than
 * 10 ms, increase the number of periods in the pitchbuffer. At the end
 * of an erasure, do an OLA with the start of the first good frame.
 * The gain decays as the erasure gets longer.
 */
void LowcFE::dofe(short *out)
{
    pitchbufend = &pitchbuf[HISTORYLEN];

    if (erasecnt == 0) {
 	convertsf(history, pitchbuf, HISTORYLEN); /* get history */
	pitch = findpitch(); /* find pitch */
	poverlap = pitch >> 2; /* OLA 1/4 wavelength */
	/* save original last poverlap samples */
	copyf(pitchbufend - poverlap, lastq, poverlap);
	poffset = 0; /* create pitch buffer with 1 period */
	pitchblen = pitch;
	pitchbufstart = pitchbufend - pitchblen;
	overlapadd(lastq, pitchbufstart - poverlap,
		   pitchbufend - poverlap, poverlap);
	/* update last 1/4 wavelength in history buffer */
	convertfs(pitchbufend - poverlap, &history[HISTORYLEN-poverlap],
		  poverlap);
	getfespeech(out, FRAMESZ); /* get synthesized speech */
    } else if (erasecnt == 1 || erasecnt == 2) {