> [...]
> The fact that the stopband is 70 dB or so.
Woops - I mis-stated that number. Eyeballing my graph again I'd
say 55 or 60 dB.
--
Randy Yates % "Midnight, on the water...
Digital Signal Labs % I saw... the ocean's daughter."
mailto://yates@ieee.org % 'Can't Get It Out Of My Head'
http://www.digitalsignallabs.com % *El Dorado*, Electric Light Orchestra
Reply by Randy Yates●November 24, 20102010-11-24
John McDermick <johnthedspguy@gmail.com> writes:
>> John, this filter doesn't look all that great:
>>
>
> Why does the filter look bad? What is it exactly that you are looking
> at that makes you say that the filter looks bad?
The fact that the stopband is 70 dB or so. If you need your images
to be attenuated more than that, you'll have to come up with a
better filter.
I was assuming the images at N * 16 kHz, +/- 440 Hz (N > 0), are what
you were referring to as "resampling artifacts" - perhaps I am mistaken.
Please clarify which part(s) of that spectrum constitute the "artifacts"
you are referring to.
--
Randy Yates % "Remember the good old 1980's, when
Digital Signal Labs % things were so uncomplicated?"
mailto://yates@ieee.org % 'Ticket To The Moon'
http://www.digitalsignallabs.com % *Time*, Electric Light Orchestra
Reply by Randy Yates●November 24, 20102010-11-24
robert bristow-johnson <rbj@audioimagination.com> writes:
> [...]
> the other part of the noisy-looking part of spectrum is probably from
> the roundoff error. i dunno where the odd-harmonic distortion comes
> from.
Yeah, I couldn't figure that out either. Perhaps it's requantization
error.
--
Randy Yates % "So now it's getting late,
Digital Signal Labs % and those who hesitate
mailto://yates@ieee.org % got no one..."
http://www.digitalsignallabs.com % 'Waterfall', *Face The Music*, ELO
Reply by rickman●November 24, 20102010-11-24
On Nov 23, 6:06�pm, John McDermick <johnthedsp...@gmail.com> wrote:
> >Try plotting the fixed
> >point output of the impulse input vs. the average of the fixed point
> >output. �That will show the noise floor in a relative way, but still
> >not in an absolute way.
>
> Do you mean plotting X - mean(X) �??? �...where X contains the
> magnitudes expressed in dB
>
> If so, here is the plot:
>
> http://img593.imageshack.us/img593/6756/fig4.png
I meant plotting X/mean(X). Or just plot X. That is what Randy did
for you. That tells you how well your filter works. Using the ratio
to the floating point filter just shows you where the floating point
filter is really good (or more accurately, ideal) rather than showing
where the fixed point filter is bad. Each of the peaks in your
initial graph corresponds to a null in the filter. So the floating
point filter does a better job of making nulls which results in the
peaks in your comparison graph. Do you really care about the nulls?
As Randy was saying, a stopband of -60 dB is not so fantastic. But if
that is good enough for your needs, I'd say you are done.
Rick
Reply by robert bristow-johnson●November 24, 20102010-11-24
On Nov 24, 12:49�am, John McDermick <johnthedsp...@gmail.com> wrote:
> > John, this filter doesn't look all that great:
>
> Why does the filter look bad? What is it exactly that you are looking
> at that makes you say that the filter looks bad?
well, the frequency response of the filter with coefficient you give
is consistent with the spectrum you show where the spectral lines of
images are only reduced by 60 or 70 dB. you understand that
quantizing the coefficients will change your frequency response
"slightly". from a dB perspective, the degradation of frequency
response will be more noticeable in the stopband where a small
numerical error results in more dB relative to the stopband energy
level.
the other part of the noisy-looking part of spectrum is probably from
the roundoff error. i dunno where the odd-harmonic distortion comes
from.
r b-j
Reply by Rune Allnor●November 24, 20102010-11-24
On Nov 23, 3:53�pm, John McDermick <johnthedsp...@gmail.com> wrote:
> How do you get rid of resampling artifacts?
>
> The P/Q fixed-point resampler algo I am working on takes as input a
> signal which has been upsampled by P (zero insertion) and low-pass
> filters the upsampled signal (fc = min[1/P,1/Q] ). In the final step
> every Qth filter output sample is kept. The artifacts seems to get
> worse when P/Q is much larger than 1...for example when P/Q = 6.
> The low-pass filter is an 8th order IIR filter split into 4 second-
> order sections.
>
> I fed the resampler with an impulse sampled at 16000Hz and compared
> the magnitude spectrum of the output with the magnitude spectrum of
> the output from a floating point resampler.
Don't do that. Compare apples with apples and oranges with oranges.
First represent thet input signal as a sequence of floating-point
numbers, and use the floating-point resampler on this sequence.
Compare spectra of these input and output signals.
Then resample the input signal to whatever fixed-pt precision
you use, and run it through the fixed-pt resampler. Note that in
this version the filter coefficients of your FIR also have to
be represented as fixed-pt numbers. Now compare these input
and output spectra.
Once you are done with this, compare the spectra of the floating pt
and fixed pt input signals. The difference is due to quantization
noise. There is nothing you can do about it, except understand
why it's there and what causes it.
Rune
Reply by John McDermick●November 24, 20102010-11-24
> John, this filter doesn't look all that great:
>
Why does the filter look bad? What is it exactly that you are looking
at that makes you say that the filter looks bad?
Reply by Randy Yates●November 23, 20102010-11-23
John McDermick <johnthedspguy@gmail.com> writes:
>> Resampling artifacts are folded aliases and requantization effects.
>> Set the cutoff frequency lower?
>
> I've tried, but it doesn't seem to help much.
>
>
>> What is the rationale for this configuration?
>> Why not a polyphase FIR ?
>
> I have considered a polyphase, but this implementation is more
> efficient in terms of memory and cycle consumption. Or maybe
> I am just overlooking something? Also, I am working with some
> "tight" filter requirements.
>
>
>> Describe the full picture.
>
> Ok. The filter coefficients look like this:
>
> Numerator Coefficients
>
> Section 1 0.0284 -0.0381 0.0284
> Section 2 0.4836 -0.8218 0.4836
> Section 3 0.7560 -1.3301 0.7560
> Section 4 0.2201 0.2201 0
>
> Denominator Coefficients
>
> Section 1 1.0000 -1.7690 0.8374
> Section 2 1.0000 -1.7850 0.9305
> Section 3 1.0000 -1.8010 0.9828
> Section 4 1.0000 -0.8796 0
John, this filter doesn't look all that great:
http://galois.digitalsignallabs.com/filter.png
I'm not sure if there are any numerical precision issues here, but
judging from the relatively mild stopband of -70 dB or so, I would think
not. This is in Octave's double-precision floating point.
--Randy
>
> Coeff for the first section would look like this
>
> Coeff = [0.0284 -0.0381 0.0284 1.0000 -1.7690 0.8374]
>
> Input x is in Q1.15 format
>
> Coeff is in Q2.14 format
>
> Output y is in Q1.15 format
>
> 2nd order IIR filter pseudo code:
>
> c1=coeff(1)*x(m)
> c3=c1+z(1)
> c4=bitshift(c3,-14)
> y(m)=c4
>
> c5=coeff(2)*x(m)
> c7=c5+z(2)
> c9=coeff(5)*y(m)
> z(1)=c7-c9
>
> c12=coeff(3)*x(m)
> c14=coeff(6)*y(m)
> z(2)=c12-c14
>
>
>
> Output spectrum looks like this
>
> LINK: http://img101.imageshack.us/img101/6171/fig3.png
>
> for a 440Hz sine sampled at 16000Hz which is resampled to 96000Hz.
--
Randy Yates % "She's sweet on Wagner-I think she'd die for Beethoven.
Digital Signal Labs % She love the way Puccini lays down a tune, and
mailto://yates@ieee.org % Verdi's always creepin' from her room."
http://www.digitalsignallabs.com % "Rockaria", *A New World Record*, ELO
Reply by John McDermick●November 23, 20102010-11-23
>Try plotting the fixed
>point output of the impulse input vs. the average of the fixed point
>output. That will show the noise floor in a relative way, but still
>not in an absolute way.
Do you mean plotting X - mean(X) ??? ...where X contains the
magnitudes expressed in dB
If so, here is the plot:
http://img593.imageshack.us/img593/6756/fig4.png
The plot shows the magnitude spectrum of the resampler output (in dB)
- the mean of that spectrum.
Reply by rickman●November 23, 20102010-11-23
On Nov 23, 1:01�pm, John McDermick <johnthedsp...@gmail.com> wrote:
> > How do you know these graphs show a problem? �Rather than showing how
> > "bad" the fixed point resampler is, maybe you are showing how "good"
> > the floating point resampler is. �
>
> I would just like to see how far away I am from an "ideal" solution
> (something
> that is as close as possible to a floating point solution)....
> right???
>
> > I don't even see the 440 Hz tone in your data.
> > So clearly using the floating point design as a reference doesn't give
> > you any sense of absolute noise levels... which is what you really
> > care about, right?
>
> The 440 Hz sine is "notched" out when you subtract the output
> spectrums
> from each other...You can see the two spectra here:
>
> http://img101.imageshack.us/img101/6171/fig3.png
Yes, I understand. That is my point. The two approaches match well
in some areas an not others... so? Where you see 100 dB peaks, you
can't say if they are peaks in the fixed point design or nulls in the
floating point design. Right?
Do you care if your fixed point approach is 100 dB worse than the
floating point approach if the floating point has 500 dB of head
room? Until you show me the response relative the carrier or full
scale or something else that is actually relevant, I am not convinced
you have a problem.
Rick