From: Paulo V. <vic...@gm...> - 2008-01-17 17:12:34
|
Hi, I am trying to use g729 lib with iaxclient 2.0.1=85 I saw gsm code (codec_gsm.c ) as a model=85 I got some doubts, could you give some insight?: encode ( struct iaxc_audio_codec *c, int *inlen, short *in, int *outlen, unsigned char *out ) { struct state * encstate =3D (struct state *) c->encstate; /* need to encode minimum of 160 bytes to 33 byte output */ while( (*inlen >=3D 160) && (*outlen >=3D 33) ) { =09gsm_encode(encstate->gsmstate, in, out); =09/* we used 160 bytes of input, and 33 bytes of output */ =09*inlen -=3D 160; =09in +=3D 160; //Paulo: 320 bytes apart =09*outlen -=3D 33; =09out +=3D 33; } The comment: "need to encode minimum of 160 bytes to 33 byte output" Does it really mean: "need to encode minimum of 160 *samples*, 16 bits , i.e., 320 bytes" ?? Does gsm_encode method consume 160 bytes or 320 bytes (in +=3D 160)? (32-bit computer) The g.729 lib encodes an 80 words (160 bytes/frame) speech frame into a 10 bytes packed bit stream Thus, for him, I am supposed to have: while( (*inlen >=3D 80) && (*outlen >=3D 10) ) { =09=09va_g729a_encoder(in, out); =09=09 =09*inlen -=3D 80; =09in +=3D 80; =09*outlen -=3D 10; =09out +=3D 10; } Do you agree? Could you help me out ? Thanks Paulo |
From: Mihai B. <mi...@ha...> - 2008-01-17 17:40:23
Attachments:
smime.p7s
|
Hello Paulo, On Jan 17, 2008, at 12:12 PM, Paulo Vicentini wrote: > > The comment: > "need to encode minimum of 160 bytes to 33 byte output" > > Does it really mean: "need to encode minimum of 160 *samples*, 16 bits > , i.e., 320 bytes" ?? > > Does gsm_encode method consume 160 bytes or 320 bytes (in += 160)? > (32-bit computer) > > The g.729 lib encodes an 80 words (160 bytes/frame) speech frame into > a 10 bytes packed bit stream > Thus, for him, I am supposed to have: > > while( (*inlen >= 80) && (*outlen >= 10) ) { > va_g729a_encoder(in, out); > > *inlen -= 80; > in += 80; > *outlen -= 10; > out += 10; > } > Do you agree? > Could you help me out ? Yes, that means 160 samples, 320 bytes. For g729, your approach seems to be correct. Mihai |
From: Paulo V. <vic...@gm...> - 2008-01-17 19:29:44
|
Okay, thank you for answering. other question: struct iaxc_audio_codec *codec_audio_gsm_new(){ =85 =85 c->minimum_frame_size =3D 160; Do you mean (input) frame size measured in samples/frame, rigth? So that codec_audio_g729a_new() { =85=85 c->minimum_frame_size =3D 80; //80 samples/frame I have compiled iaxclient with g729 support but I am facing very poor voice quality with it. (thru gsm, quality it's okay) I am trying to find out what is wrong=85 Thanks in advanced Paulo On Jan 17, 2008 3:40 PM, Mihai Balea <mi...@ha...> wrote: > Hello Paulo, > > On Jan 17, 2008, at 12:12 PM, Paulo Vicentini wrote: > > > > The comment: > > "need to encode minimum of 160 bytes to 33 byte output" > > > > Does it really mean: "need to encode minimum of 160 *samples*, 16 bits > > , i.e., 320 bytes" ?? > > > > Does gsm_encode method consume 160 bytes or 320 bytes (in +=3D 160)? > > (32-bit computer) > > > > The g.729 lib encodes an 80 words (160 bytes/frame) speech frame into > > a 10 bytes packed bit stream > > Thus, for him, I am supposed to have: > > > > while( (*inlen >=3D 80) && (*outlen >=3D 10) ) { > > va_g729a_encoder(in, out); > > > > *inlen -=3D 80; > > in +=3D 80; > > *outlen -=3D 10; > > out +=3D 10; > > } > > Do you agree? > > Could you help me out ? > > Yes, that means 160 samples, 320 bytes. For g729, your approach > seems to be correct. > > Mihai > > |
From: Mihai B. <mi...@ha...> - 2008-01-17 23:37:29
Attachments:
smime.p7s
|
What do you mean by poor quality? can you provide more details? Thanks Mihai On Jan 17, 2008, at 2:29 PM, Paulo Vicentini wrote: > > I have compiled iaxclient with g729 support but I am facing very poor > voice quality with it. > (thru gsm, quality it's okay) > > I am trying to find out what is wrong… |
From: Paulo V. <vic...@gm...> - 2008-01-18 14:22:22
|
Hi, It seems that my g.729 encode /decode is not working properly va_g729a_encoder(in, out) expects raw 16 bit mono PCM sampled (8KHz) speech input, in which I think portaudio delivers it. ... I hear the encoded voice, sent to the other peer thru network, with distortion and the received and decoded one even worst. I am not using PLC or FEC. static int encode ( struct iaxc_audio_codec *c, int *inlen, short *in, int *outlen, unsigned char *out ) { =09va_g729a_init_encoder(); while( (*inlen >=3D 80) && (*outlen >=3D 10) ) { =09=09va_g729a_encoder(in, out); =09=09 =09*inlen -=3D 80; =09in +=3D 80; =09*outlen -=3D 10; =09out +=3D 10; } return 0; } static int decode ( struct iaxc_audio_codec *c, int *inlen, unsigned char *in, int *outlen, short *out ) { =09va_g729a_init_decoder(); =09 while( (*inlen >=3D 10) && (*outlen >=3D 80) ) { =09 =09=09va_g729a_decoder(in, out, 0); =09=09 =09=09*inlen -=3D 10; =09=09in +=3D 10; =09=09*outlen -=3D 80; =09=09out +=3D 80; =09} return 0; } static void destroy ( struct iaxc_audio_codec *c) { free(c); } struct iaxc_audio_codec *codec_audio_g729a_new() { =09 struct iaxc_audio_codec *c =3D (struct iaxc_audio_codec *)calloc(1, sizeof(struct iaxc_audio_codec)); if(!c) return c; strcpy(c->name,"g729"); c->format =3D IAXC_FORMAT_G729A; c->encode =3D encode; c->decode =3D decode; c->destroy =3D destroy; c->minimum_frame_size =3D 80; return c; } Tks On 1/17/08, Mihai Balea <mi...@ha...> wrote: > What do you mean by poor quality? can you provide more details? > > Thanks > Mihai > > > On Jan 17, 2008, at 2:29 PM, Paulo Vicentini wrote: > > > > > > I have compiled iaxclient with g729 support but I am facing very poor > > voice quality with it. > > (thru gsm, quality it's okay) > > > > > I am trying to find out what is wrong=85 > > |
From: Steve K. <st...@st...> - 2008-01-18 15:11:31
|
Paulo, I think your problem is you reinitialize the encoder and decoder with each frame. We obviously don't have the documentation for your particular g729 implementation, but that looks wrong. -SteveK Paulo Vicentini wrote: > Hi, > It seems that my g.729 encode /decode is not working properly > va_g729a_encoder(in, out) expects raw 16 bit mono PCM sampled (8KHz) > speech input, in which I think portaudio delivers it. > ... > I hear the encoded voice, sent to the other peer thru network, with > distortion and the received and decoded one even worst. > I am not using PLC or FEC. > > static int encode ( struct iaxc_audio_codec *c, > int *inlen, short *in, int *outlen, unsigned char *out ) { > > > va_g729a_init_encoder(); > > while( (*inlen >= 80) && (*outlen >= 10) ) { > > va_g729a_encoder(in, out); > > *inlen -= 80; > in += 80; > *outlen -= 10; > out += 10; > } > > return 0; > } > > > static int decode ( struct iaxc_audio_codec *c, > int *inlen, unsigned char *in, int *outlen, short *out ) { > > > va_g729a_init_decoder(); > > while( (*inlen >= 10) && (*outlen >= 80) ) { > > va_g729a_decoder(in, out, 0); > > *inlen -= 10; > in += 10; > *outlen -= 80; > out += 80; > } > > return 0; > } > > static void destroy ( struct iaxc_audio_codec *c) { > free(c); > } > > > struct iaxc_audio_codec *codec_audio_g729a_new() { > > struct iaxc_audio_codec *c = (struct iaxc_audio_codec *)calloc(1, > sizeof(struct iaxc_audio_codec)); > > if(!c) return c; > > strcpy(c->name,"g729"); > c->format = IAXC_FORMAT_G729A; > c->encode = encode; > c->decode = decode; > c->destroy = destroy; > > c->minimum_frame_size = 80; > > > return c; > } > > Tks > > > > On 1/17/08, Mihai Balea <mi...@ha...> wrote: > >> What do you mean by poor quality? can you provide more details? >> >> Thanks >> Mihai >> >> >> On Jan 17, 2008, at 2:29 PM, Paulo Vicentini wrote: >> >> >> >> >> >> I have compiled iaxclient with g729 support but I am facing very poor >> >> voice quality with it. >> >> (thru gsm, quality it's okay) >> >> >> >> >> I am trying to find out what is wrong… >> >> >> > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Iaxclient-devel mailing list > Iax...@li... > https://lists.sourceforge.net/lists/listinfo/iaxclient-devel > |
From: Paulo V. <vic...@gm...> - 2008-01-18 16:00:11
|
Well noticed. I initialized them once and it does the trick. Thanks for your backings! Paulo Vicentini On 1/18/08, Steve Kann <st...@st...> wrote: > > Paulo, > > I think your problem is you reinitialize the encoder and decoder with > each frame. We obviously don't have the documentation for your particula= r > g729 implementation, but that looks wrong. > > -SteveK > > > Paulo Vicentini wrote: > Hi, It seems that my g.729 encode /decode is not working properly > va_g729a_encoder(in, out) expects raw 16 bit mono PCM sampled (8KHz) speech > input, in which I think portaudio delivers it. ... I hear the encoded voice, > sent to the other peer thru network, with distortion and the received and > decoded one even worst. I am not using PLC or FEC. static int encode ( > struct iaxc_audio_codec *c, int *inlen, short *in, int *outlen, unsigned > char *out ) { va_g729a_init_encoder(); while( (*inlen >=3D 80) && > (*outlen >=3D 10) ) { va_g729a_encoder(in, out); *inlen -=3D 80; in +=3D > 80; *outlen -=3D 10; out +=3D 10; } return 0; } static int decode ( > struct iaxc_audio_codec *c, int *inlen, unsigned char *in, int *outlen, > short *out ) { va_g729a_init_decoder(); while( (*inlen >=3D 10) && > (*outlen >=3D 80) ) { va_g729a_decoder(in, out, 0); *inlen -=3D 10; in +=3D > 10; *outlen -=3D 80; out +=3D 80; } return 0; } static void destroy ( > struct iaxc_audio_codec *c) { free(c); } struct iaxc_audio_codec > *codec_audio_g729a_new() { struct iaxc_audio_codec *c =3D (struct > iaxc_audio_codec *)calloc(1, sizeof(struct iaxc_audio_codec)); if(!c) > return c; strcpy(c->name,"g729"); c->format =3D IAXC_FORMAT_G729A; > c->encode =3D encode; c->decode =3D decode; c->destroy =3D destroy; > c->minimum_frame_size =3D 80; return c; } Tks On 1/17/08, Mihai Balea > <mi...@ha...> wrote: > What do you mean by poor quality? can you provide more > details? Thanks Mihai On Jan 17, 2008, at 2:29 PM, Paulo Vicentini > wrote: I have compiled iaxclient with g729 support but I am facing very > poor voice quality with it. (thru gsm, quality it's okay) I am trying > to find out what is wrong=85 > ------------------------------------------------------------------------- This > SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) > Visual Studio > 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Iaxclient-devel > mailing > list Iax...@li... https://lists.sourceforge.net/lists/listinfo/iaxclient-devel > > |