
There are 7 messages in this thread.
You are currently looking at messages 0 to 7.
hello guys, I need some help from you. I am doing a DSP project and for that I need to do some C coding for the conversion of sample data which is in floating point representation to fixed point representation. the sample data is in floating point like 0.224128 2.299965 0.448350 -1.779926 My DSP algorithm is implemented in C and is supposed to be using fixed point representation. The above data is intended to be converted to fixed integer format.I request you to help me out regarding this conversion.I will be very glad if u give me some hints or algorithms for this conversion.______________________________
riya wrote: > hello guys, > > I need some help from you. I am doing a DSP project and for that I need > to do some C coding for the conversion of sample data which is in > floating point representation to fixed point representation. > the sample data is in floating point like > 0.224128 > 2.299965 > 0.448350 > -1.779926 > My DSP algorithm is implemented in C and is supposed to be using fixed > point representation. > The above data is intended to be converted to fixed integer format.I > request you to help me out regarding this conversion.I will be very > glad if u give me some hints or algorithms for this conversion. > xFixed = xFloat * someGain; If your compiler is strict try xFixed = (int)(xFloat * someGain); Surely this is what you already knew, not what you want? -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Posting from Google? See http://cfaj.freeshell.org/google/______________________________
"riya" <r...@gmail.com> wrote in message news:1...@o13g2000cwo.googlegroups.com... > hello guys, > > I need some help from you. I am doing a DSP project and for that I need > to do some C coding for the conversion of sample data which is in > floating point representation to fixed point representation. > the sample data is in floating point like > 0.224128 > 2.299965 > 0.448350 > -1.779926 > My DSP algorithm is implemented in C and is supposed to be using fixed > point representation. > The above data is intended to be converted to fixed integer format.I > request you to help me out regarding this conversion.I will be very > glad if u give me some hints or algorithms for this conversion. Read this - it will give you an excellent start. If you have questions after reading it, ask again http://personal.bellsouth.net/~yatesc/fp.pdf Decide on what precision you need for your fixed point data before trying to write code. Cheers Bhaskar______________________________
"Bhaskar Thiagarajan" <b...@deja.com> writes: > "riya" <r...@gmail.com> wrote in message > news:1...@o13g2000cwo.googlegroups.com... >> hello guys, >> >> I need some help from you. I am doing a DSP project and for that I need >> to do some C coding for the conversion of sample data which is in >> floating point representation to fixed point representation. >> the sample data is in floating point like >> 0.224128 >> 2.299965 >> 0.448350 >> -1.779926 >> My DSP algorithm is implemented in C and is supposed to be using fixed >> point representation. >> The above data is intended to be converted to fixed integer format.I >> request you to help me out regarding this conversion.I will be very >> glad if u give me some hints or algorithms for this conversion. > > Read this - it will give you an excellent start. If you have questions after > reading it, ask again > http://personal.bellsouth.net/~yatesc/fp.pdf Thanks Bhaskar. That's an old link. Try this: http://www.digitalsignallabs.com/fp.pdf -- % Randy Yates % "With time with what you've learned, %% Fuquay-Varina, NC % they'll kiss the ground you walk %%% 919-577-9882 % upon." %%%% <y...@ieee.org> % '21st Century Man', *Time*, ELO http://home.earthlink.net/~yatescr______________________________
"Randy Yates" <y...@ieee.org> wrote in message news:m...@ieee.org... > "Bhaskar Thiagarajan" <b...@deja.com> writes: > > > "riya" <r...@gmail.com> wrote in message > > news:1...@o13g2000cwo.googlegroups.com... > >> hello guys, <snip> > > Read this - it will give you an excellent start. If you have questions after > > reading it, ask again > > http://personal.bellsouth.net/~yatesc/fp.pdf > > Thanks Bhaskar. That's an old link. Try this: > > http://www.digitalsignallabs.com/fp.pdf > -- > % Randy Yates % "With time with what you've learned, Well - the old one still seems to work. I'll update my bookmarks with the new one. I tried your new one and checked out the homepage of digitalsignallabs - most links there don't work (perhaps you are already aware of this). Cheers Bhaskar______________________________
Practically you need to define the following for each set of numbers that you want to represent in fixed-point: 1. their dynamic range, 2. the required resolution, That would give you an idea of the number of bits needed (mantissa), and the representation format (exponent, block exponent or block float, Q15, Q14, Q28, Q31 etc.) For practical approach you may check the introduction of ITU-T's G.728 regarding fixed-point arithmetic. riya wrote: > hello guys, > > I need some help from you. I am doing a DSP project and for that I need > to do some C coding for the conversion of sample data which is in > floating point representation to fixed point representation. > the sample data is in floating point like > 0.224128 > 2.299965 > 0.448350 > -1.779926 > My DSP algorithm is implemented in C and is supposed to be using fixed > point representation. > The above data is intended to be converted to fixed integer format.I > request you to help me out regarding this conversion.I will be very > glad if u give me some hints or algorithms for this conversion. >______________________________
It can be very instructive to write a program in C to do the conversions. It's useful for checking fixed-point and floating-point code wriiten in assembler for a DSP, which is what I had to do, once. Leon______________________________