×

Discussion Board

Results 1 to 8 of 8

Thread: G729 problem

  1. #1
    Regular Contributor
    Join Date
    Feb 2007
    Posts
    56

    G729 problem

    hi

    I'm using The APS for full duplex audio with g729 codec.
    I need help with the encoding and decoding of the buffer
    that comes from the aps server. Can anyone give me code or
    example that explain how to use it?

    Regards,
    Noam

  2. #2
    Registered User
    Join Date
    Oct 2006
    Posts
    21

    Re: G729 problem

    hi,

    you need to reduce the packet comes from APS (24 byte) to a g729 standard packet of 10 bite in according to the APS docs and the rfc 3551 contening the description of g729 frame

    remember: APS in little endian, g729 is big endian


    regards.

    alessandro

  3. #3
    Regular Contributor
    Join Date
    Feb 2007
    Posts
    56

    Re: G729 problem

    hi

    could you please send me a sample code?

    Regards,
    Noam

  4. #4
    Registered User
    Join Date
    Oct 2006
    Posts
    21

    Re: G729 problem

    const TDesC8& CStreamerEngine::g729Compress(TAPSCommBuffer aFrame){

    TBuf8<10> frame;
    TBuf8<1>temp;
    TBuf8<1>temp2;
    TBuf8<1>temp3;
    TUint8 z;
    TUint8* k;
    TUint8 z2;
    TUint8* k2;
    TUint8 z3;
    TUint8* k3;

    aFrame.iBuffer.Delete(0,2);




    temp.Copy(aFrame.iBuffer.Mid(0,1));
    k=(TUint8*) temp.Ptr();
    z=*k;
    frame.Append(z); //primo byte

    temp.Copy(aFrame.iBuffer.Mid(3,1));
    k=(TUint8*) temp.Ptr();
    z=*k;
    z=z<<6;


    temp2.Copy(aFrame.iBuffer.Mid(2,1));
    k2=(TUint8*) temp2.Ptr();
    z2=*k2;
    z2=z2>>2;
    z=z+z2;
    frame.Append(z); //secondo byte


    temp.Copy(aFrame.iBuffer.Mid(2,1));
    k=(TUint8*) temp.Ptr();
    z=*k;
    z=z<<6;


    temp2.Copy(aFrame.iBuffer.Mid(4,1));
    k2=(TUint8*) temp2.Ptr();
    z2=*k2;
    z2 = z2>>2;
    z= z + z2;
    frame.Append(z); // terzo byte

    temp2.Copy(aFrame.iBuffer.Mid(4,1));
    k=(TUint8*) temp2.Ptr();
    z=*k;
    z=z<<6;


    temp.Copy(aFrame.iBuffer.Mid(6,1));

    k2 = (TUint8*) temp.Ptr();
    z2=*k2;
    z2 = z2<<5;

    temp3.Copy(aFrame.iBuffer.Mid(9,1));

    k3 = (TUint8*) temp3.Ptr();
    z3=*k3;
    z = z + z3 + z2;

    frame.Append(z); // quarto byte

    temp3.Copy(aFrame.iBuffer.Mid(8,1));
    k2 = (TUint8*) temp3.Ptr();
    z2=*k2;

    frame.Append(z2); //quinto byte

    temp.Copy(aFrame.iBuffer.Mid(10,1));

    k = (TUint8*) temp.Ptr();
    z=*k;
    z = z <<4;

    temp2.Copy(aFrame.iBuffer.Mid(12,1));

    k2 = (TUint8*) temp2.Ptr();
    z2=*k2;
    z2= z2>> 3;

    z = z +z2;

    frame.Append(z); //sesto byte

    temp2.Copy(aFrame.iBuffer.Mid(12,1));
    k = (TUint8*) temp2.Ptr();
    z=*k;

    z = z << 5;

    temp.Copy(aFrame.iBuffer.Mid(14,1));

    k2 = (TUint8*) temp.Ptr();
    z2=*k2;
    z = z +z2;

    frame.Append(z); //settimo byte



    temp.Copy(aFrame.iBuffer.Mid(17,1));

    k2 = (TUint8*) temp.Ptr();
    z2=*k2;
    z2=z2<<3;

    temp2.Copy(aFrame.iBuffer.Mid(16,1));

    k = (TUint8*) temp2.Ptr();
    z=*k;
    z=z>>5;
    z=z+z2;
    frame.Append(z); //ottavo byte

    temp.Copy(aFrame.iBuffer.Mid(16,1));

    k2 = (TUint8*) temp.Ptr();
    z2=*k2;

    z2 = z2 <<3;

    temp2.Copy(aFrame.iBuffer.Mid(18,1));

    k = (TUint8*) temp2.Ptr();
    z=*k;
    z = z >>1;

    z = z + z2;

    frame.Append(z); //nono byte

    temp2.Copy(aFrame.iBuffer.Mid(18,1));
    k = (TUint8*) temp2.Ptr();
    z=*k;

    z = z <<7;

    temp.Copy(aFrame.iBuffer.Mid(20,1));

    k2 = (TUint8*) temp.Ptr();
    z2=*k2;

    z = z + z2;

    frame.Append(z); //decimo byte

    return frame;
    }

  5. #5
    Regular Contributor
    Join Date
    Feb 2007
    Posts
    56

    Re: G729 problem

    Hi alessandro

    thank you very much for your help. it works !!!!!
    could you please post the reverse function (g729 from the network
    to the aps).

    thanks again,
    Noam

  6. #6
    Registered User
    Join Date
    Oct 2006
    Posts
    21

    Re: G729 problem

    TAPSCommBuffer CStreamerEngine::g729Expand(const TDesC8& frame){

    TBuf8<30> aFrame;

    aFrame.Copy(frame);
    TBuf8<1>temp;
    TBuf8<1>temp2;
    TBuf8<1>temp3;

    TUint8 z;
    TUint8* k;
    TUint8 z2;
    TUint8* k2;


    TInt8 null=0x00;

    TAPSCommBuffer aps;

    TInt8 a= 0x00;
    TInt8 b= 0x01;
    aps.iBuffer.Append(b);
    aps.iBuffer.Append(a);


    temp.Copy(aFrame.Mid(0,1)); //primo byte
    k=(TUint8*) temp.Ptr();
    z=*k;
    aps.iBuffer.Append(z);
    aps.iBuffer.Append(null); //secondo byte

    temp.Copy(aFrame.Mid(1,1));
    k=(TUint8*) temp.Ptr();
    z=*k;
    z=z<<2;
    temp2.Copy(aFrame.Mid(2,1));
    k2=(TUint8*) temp2.Ptr();
    z2=*k2;
    z2=z2>>6;
    z=z+z2;
    aps.iBuffer.Append(z); //terzo byte

    temp.Copy(aFrame.Mid(1,1));
    k=(TUint8*) temp.Ptr();
    z=*k;
    z = z>>6;
    aps.iBuffer.Append(z); //quarto byte

    temp.Copy(aFrame.Mid(2,1));
    k=(TUint8*) temp.Ptr();
    z=*k;
    z = z<<2;
    temp2.Copy(aFrame.Mid(3,1));
    k2=(TUint8*) temp2.Ptr();
    z2=*k2;
    z2 =z2>>6;
    z = z + z2;
    aps.iBuffer.Append(z); //quinto byte
    aps.iBuffer.Append(null); //sesto byte

    temp2.Copy(aFrame.Mid(3,1));
    k=(TUint8*) temp2.Ptr();
    z=*k;
    z =z<<2;
    z =z>>5;
    aps.iBuffer.Append(z); //settimo byte
    aps.iBuffer.Append(null); //ottavo byte

    temp2.Copy(aFrame.Mid(3,1));
    k=(TUint8*) temp2.Ptr();
    z=*k;
    z = z<<3;
    z = z>>3;
    aps.iBuffer.Append(z); //nono byte

    temp.Copy(aFrame.Mid(4,1));
    k2=(TUint8*) temp.Ptr();
    z2=*k2;
    aps.iBuffer.Append(z2); //decimo byte

    temp.Copy(aFrame.Mid(5,1));
    k2=(TUint8*) temp.Ptr();
    z2=*k2;
    z2 =z2>>4;
    aps.iBuffer.Append(z2); //undicesimo byte
    aps.iBuffer.Append(null); //dodicesimo byte

    temp.Copy(aFrame.Mid(5,1));
    k2=(TUint8*) temp.Ptr();
    z2=*k2;
    z2 =z2<<4;
    z2 =z2>>1;
    temp2.Copy(aFrame.Mid(6,1));
    k=(TUint8*) temp2.Ptr();
    z=*k;
    z =z>>5;

    z=z + z2;
    aps.iBuffer.Append(z); //tredicesimo byte
    aps.iBuffer.Append(null); //14 esimo byte

    temp.Copy(aFrame.Mid(6,1));
    k2=(TUint8*) temp.Ptr();
    z2=*k2;
    z2 =z2<<3;
    z2 =z2>>3;

    aps.iBuffer.Append(z2); //15 esimo byte
    aps.iBuffer.Append(null); //16 esimo byte

    temp.Copy(aFrame.Mid(7,1));
    k=(TUint8*) temp.Ptr();
    z=*k;
    z=z<<5;

    temp2.Copy(aFrame.Mid(8,1));
    k2=(TUint8*) temp2.Ptr();
    z2=*k2;
    z2=z2>>3;
    z2=z2+z;
    aps.iBuffer.Append(z2); //17 esimo byte

    temp.Copy(aFrame.Mid(7,1));
    k=(TUint8*) temp.Ptr();
    z=*k;
    z=z>>3;
    aps.iBuffer.Append(z); //18 esimo byte


    temp.Copy(aFrame.Mid(8,1));
    k2=(TUint8*) temp.Ptr();
    z2=*k2;
    z2=z2<<5;
    z2=z2>>4;
    temp2.Copy(aFrame.Mid(9,1));
    k=(TUint8*) temp2.Ptr();
    z=*k;
    z=z>>7;
    z = z + z2;
    aps.iBuffer.Append(z); //19 esimo byte
    aps.iBuffer.Append(null); //20 esimo byte

    temp.Copy(aFrame.Mid(9,1));
    k2=(TUint8*) temp.Ptr();
    z2=*k2;

    z2=z2<<1;
    z2=z2>>1;
    aps.iBuffer.Append(z2); //21 esimo byte
    aps.iBuffer.Append(null); //22 esimo byte

    return aps;
    }



  7. #7
    Regular Contributor
    Join Date
    Feb 2007
    Posts
    56

    Re: G729 problem

    Mille grazie !

    Mi avete aiutate molto !

    Noam.

  8. #8
    Registered User
    Join Date
    Nov 2007
    Posts
    31

    Re: G729 problem

    hi ! i have same problem with g729 coding, i can coding and decoding frames , i deleted header ( first 2 bytes from APS frame) and when i want to play it on phone i hear a noise when no data transmitted ( packets without voice )
    Someone know importance for this 2 bytes ?
    Thanks in advence.

Similar Threads

  1. Problem with eglSwapBuffers and heap corruption
    By greatape in forum Symbian Media (Closed)
    Replies: 2
    Last Post: 2007-05-24, 03:35
  2. netcards - Problem with opening adapter
    By kernj in forum Symbian Tools & SDKs
    Replies: 5
    Last Post: 2007-01-10, 08:56
  3. WAP service problem on Apache
    By bigg_o in forum Browsing and Mark-ups
    Replies: 3
    Last Post: 2005-04-17, 16:05
  4. Problem: S60 SDK for CW in PC with .NET
    By anttij in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 1
    Last Post: 2005-02-28, 11:36
  5. wireless problem
    By sash_mca in forum Mobile Web Site Development
    Replies: 0
    Last Post: 2003-06-06, 11:34

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •