Welcome to Doom9's Forum, THE inplace to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. 
5th September 2018, 09:05  #1  Link 
Registered User
Join Date: Jan 2015
Posts: 616

A different approach to truncated sinc filters
AVIsynth's builtin sinc filter is designed to truncate at an integer number of taps. This leaves filter shapes that need to be "normalized" because their integrals don't equal 1. But has anyone looked into truncating the filter at xvalues that leave a filter shape with an integral of exactly 1?
So x = 0.61320733549 1.55775636508 2.53778369874 3.52784055722 and so on?
__________________
If I ask "How do I do X?" or "what happens if I do X?", and X is a very bad thing that no one would ever normally do, assume that I already know this, and that I have Katie reasons for asking anyway. 
5th September 2018, 10:50  #2  Link  
Formerly davidh*****
Join Date: Jan 2004
Posts: 1,822

Quote:
Sinc is an infinite filter. It will never add up to 1 in all finite cases. And it's not the integral you want to equal 1, it's the sum of the particular coefficients that get picked, and those depend on your sampling position. Quote:
Then again maybe I'm still blocked for daring to question your brilliance last time, so if anyone who isn't on the Naughty List wants to quote this... Last edited by wonkey_monkey; 5th September 2018 at 14:10. 

5th September 2018, 18:27  #3  Link  
Registered User
Join Date: Jan 2015
Posts: 616

Quote:
__________________
If I ask "How do I do X?" or "what happens if I do X?", and X is a very bad thing that no one would ever normally do, assume that I already know this, and that I have Katie reasons for asking anyway. 

5th September 2018, 19:11  #4  Link 
Excessively jovial fellow
Join Date: Jun 2004
Location: rude
Posts: 1,073

I'm a bit confused by your terminology and I'm not a DSP guru, but as far as I understand it, if you want a sinc filter where the coeffs sum to exactly 1, you pretty much want Lanczos, because that's pretty much what Lanczos is. Getting the coeffs to sum to exactly 1 in a real implementation (of any resizer) with all its pesky numerical precision issues requires dithering them though, and even then there might still be a small residual error. See for example zimg's take on it.
Last edited by TheFluff; 5th September 2018 at 19:15. 
5th September 2018, 20:01  #5  Link 
Formerly davidh*****
Join Date: Jan 2004
Posts: 1,822

If you must be condescending when someone does their best to answer your questions, you should really only do so when you know what you're talking about.
You don't. Furthermore, most of your "contributions" to this forum seem to consist of little more than insulting other members and spurning their advice, always given in good faith. You're dragging this forum down with your childishness and it's both pathetic and pitiful. Last edited by wonkey_monkey; 5th September 2018 at 20:08. 
5th September 2018, 21:15  #6  Link  
Registered User
Join Date: Jan 2015
Posts: 616

Quote:
Quote:
__________________
If I ask "How do I do X?" or "what happens if I do X?", and X is a very bad thing that no one would ever normally do, assume that I already know this, and that I have Katie reasons for asking anyway. 

5th September 2018, 23:42  #7  Link  
Excessively jovial fellow
Join Date: Jun 2004
Location: rude
Posts: 1,073

As davidhorman mentioned (see below for the record), if you want the coeffs for a sinc filter to sum to exactly 1 then you need an infinitely large filter kernel, so the question in the OP is nonsensical. If you want the coeffs to sum to exactly 1 then you can't just leave some of them out (which is what you do by only considering a fixed number of taps  the mathematically pure sinc filter has an infinite number of taps). So, as I said, the way you solve this is to use a window function because infinitely large filter kernels are obviously not practical, and the best way to do that windowing that anyone has come up with is Lanczos, and that's the only answer I can give you other than "you can't do that".
Quote:
Last edited by TheFluff; 5th September 2018 at 23:46. 

6th September 2018, 18:16  #8  Link 
Registered User
Join Date: Jan 2015
Posts: 616

I didn't say anything about coeffs. I said the integral.
__________________
If I ask "How do I do X?" or "what happens if I do X?", and X is a very bad thing that no one would ever normally do, assume that I already know this, and that I have Katie reasons for asking anyway. 
8th September 2018, 23:52  #11  Link 
Broadcast Encoder
Join Date: Nov 2013
Location: Germany
Posts: 672

Almost. It's C++. ^_^
There's no need to include standard input output unless you need to. It already includes a bunch of things needed for the calculations it has to do: Code:
#include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <cstddef> #include <cstdlib> #include <stdexcept> #include <vector> 
10th September 2018, 18:31  #12  Link 
Registered User
Join Date: Jan 2015
Posts: 616

Just wondering if there's anything particularly magical about filter shapes with an integral of exactly 1, and if so, what the implications are for truncated (NOT windowed) sinc filters.
__________________
If I ask "How do I do X?" or "what happens if I do X?", and X is a very bad thing that no one would ever normally do, assume that I already know this, and that I have Katie reasons for asking anyway. 
Thread Tools  Search this Thread 
Display Modes  

