[MPlayer-users] Banshee quality bilinear filtering (tdfx_vid)

Georgi Petrov gogothebee at yahoo.com
Thu Sep 18 21:04:17 CEST 2003

    Hello to everyone. With the help of Alban Bedel,
the author of tdfx_vid, I'm finally able to watch
movies with bilinear hardware filtering on my Voodoo
Banshee. If you ask yourself, what is this, I'll tell
you. Banshee (and Voodoo 3/4/5 I suppose) supports two
methods of image stretching (they are used when you
are rescalling smaller image to fit fullscreen) -
point and bilinear. Point looks ugly and if you want
to see what it is like, rescale with -vop scale=x:y
(set x and y to your fullscreen dimensions) and then
add -sws 4, which turns on SwScaler with filter
"nearest neighbour", which is EXACTLY the same type of
filtering. Then try the same, but with -sws 1 (fast
bilinear). If the movie was low-res and you are
rescalling to high-res, the difference is obvious. I
personally just can't watch the ugly point stretched
movie. The good news are that XVideo for example
always uses bilinear filtering with Banshee, and the
bad ones are that tdfxfb and tdfx_vid (this one can be
fixed, read on) use point stretching. Because tdfxfb
doesn't use overlay, bilinear filtering can't be
turned on (am I wrong? The specs don't say it
directly, but I think it's so).

    The good news (again:) are that tdfx_vid can use
bilinear filtering and it's VERY easy to turn it on. I
sent email to Alban Bedel (tdfx_vid author) with my
problem and I'm very thankful, that he told me where
to change the code. The remaining was consulting with
3dfx Banshee 2D Reference and changing four lines of

    Voodoo Banshee (3/4/5) have 1x and 2x video mode.
The specs say: "2X mode refreshes two screen pixels
per video clock". Obviously 1X refreshes them once. I
personally don't know if there is visible difference
between these two modes, but what I know is that
bilinear filtering can't be enabled in 2X mode. 

    If you still think that I'm talking stupid things,
just try and see the difference for yourself. If you
have been watching movies using tdfxfb of tdfx_vid
with point stretching, that's sad. I'm not sure tdfxfb
can be fixed, but tdfx_vid can.

    See this code from drivers/tdfx_vid.c:

if (!(vidcfg | (1<<26)))
   vidcfg |= (3<<16);
  vidcfg &= ~(3<<16);

    What does this code? vidcfg points to one register
in the video card, which is responsible for many
things. Among them is the swithing on/off of both
1X/2X and bilinear filtering. Since bilinear filtering
isn't supported in 2X mode, this code first tests
which mode is turned on - 1X or 2X and based upon this
value turns off or on bilinear filtering. Exactly here
lies the problem - on my system when getting vidcfg
(it's read from video card I think, but I'm not sure)
2X mode is always enabled, which results in bilinear
filtering being TURNED OFF!

    I ask: Why don't we always set 1X mode and
bilinear filtering, since 2X give us nothing except
the only choice to use inferior stretching algorithm?
Since many movies are actually lower resolution than
our desktop one, everyone should care about this. My
suggestion is to remove this code and write the

vidcfg &= ~(1<<26); //Turns 2X mode off
vidcfg |= (3<<16);  //Turns bilinear high quality
filtering on

    But I have one more suggestion. Since when I run
tdfx_vid undex X11, the hardware cursor stays WHILE
I'm wathing the movie, turn it also off:

vidcfg &= ~(1<<27); //Turns hardware cursor off

    Because I don't want to introduce new bugs, please
if this gets into the official source, someone have
also to turn hardware cursor somewhere back on! It's

    I have changed those few lines and all (not all,
read on) my problems are almost gone. 1 and 1/2 weeks
I was trying to figure out why the picture looks so
bad with tdfx* drivers and so good with XVideo. Now I
got it and I want all of you to fix this in order to
get better quality - something we all want. I said not
all of my problems since Direct Rendering (-dr) works
very slow with tdfx_vid. I'll try to fix that later.
My primary goal is accomplished - quality bilinear
filtering with as little CPU usage as possible (well,
with Direct Rendering it will be even faster!).

    Now, i have another three dreams - to make this
possible under tdfxfb, to make overlay work from the
console, because now it must be run from X and the
final dream is to get Direct Rendering right with

    Thanks for the great player guys, keep up the good

Georgi Petrov

Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software

More information about the MPlayer-users mailing list