Programmable four-tap texture filter

A programmable filter is provided for filtering image or texture map data. A weighting RAM stores weighting data for filtering data in both x and y directions. Different weighting values may be programmed into weighting RAMs to provide different weighting functions and also enable or disable a number of taps within the filter. A weighting value of zero, for example, may disable a particular tap for the filter. In the preferred embodiment, a number of lines in the x direction may be simultaneously weighted and then weighted and combined in the y direction to produce a filtered value within one clock cycle.

CROSS-REFERENCE TO RELATED APPLICATIONS 
The subject matter of the present application is related to that in 
co-pending U.S. patent applications Attorney Docket No. CRUS-0083, filed 
Apr. 23, 1997, entitled "METHOD FOR CONFIGURING A COMPOSITING BUFFER INTO 
VARIABLE BAND SIZES", and Attorney Docket No. CRUS-0085 filed (date) 
entitled "**", both of which are incorporated herein by reference. 
FIELD OF THE INVENTION 
The present invention is related to the field of 2-D and 3-D texture 
mapping and video scaling and warping in display controllers for use with 
computer systems. In particular, the present invention is directed toward 
the use of multi-tap filters for texture mapping, video scaling and 
warping. 
BACKGROUND OF THE INVENTION 
Texture mapping is a technique whereby images generated by computer 
displays maybe made to seem more realistic. In graphics and animation 
applications (e.g., 2-D and 3-D graphics including games, simulations, and 
the like) objects may be rendered as two dimensional or three dimensional 
objects by representing such objects as a collection of polygon shapes. 
2-D image mapping or warping may be employed in graphics systems such as 
the proposed Talisman.TM. graphics system promoted by Microsoft.TM.. Such 
a system may utilize affine transformations to rotate BitBlts operations 
to alter the shape, size, and perspective of objects on a screen. 
In video applications, scaling or warping may be achieved using 2-pixel 
horizontal filters and 3- or 4-line horizontal filters to reduce, enlarge, 
or otherwise alter a video image. 
In three dimensional animation (i.e., "3-D"), such objects may be 
re-rendered when a user (or player's) position changes, or when the 
position of an object on the screen changes in order to preserve correct 
perspective and the like. 
However, simple polygon images do not impart the appearance of realism to a 
game, simulation, or graphic rendering. Texture mapping is a technique 
whereby stored images of surface textures or appearances may be applied to 
polygon surfaces to provide an enhanced appearance of realism. Texture 
mapping is explained in more detail in related co-pending U.S. Pat. No. 
5,630,043 issued May 13, 1997 entitled "ANIMATED TEXTURE MAP APATUS AND 
METHOD FOR 3-D IMAGE DISPLAYS" incorporated herein by reference. 
A texture map may comprise a pattern, such as a brick pattern or the like, 
that may be repeated to form a texture image to cover a polygon surface. 
Texture maps may also represent scanned in photographic images or the 
like, and may cover an entire polygon surface with or without repetition. 
In 3-D animation rendering, however, a polygon image may be continually 
re-rendered in different positions, perspectives, and sizes, depending 
upon the orientation of an object on the screen and the perceived distance 
of the object from the viewer. Thus, texture map data may need to be 
interpolated to fit to a polygon image. In other words, an individual 
datum of texture map data may not correspond to one pixel of display data. 
Thus, individual pixels of display data may need to be interpolated from 
adjacent datum of texture map data. 
Prior art texture mapping engines use various mapping algorithms such as 
linear, bi-linear, tri-linear, and anisotropic. These various filters are 
based upon a linear interpolation between a set of texture values and how 
the sample point relates spatially to the texture values. FIG. 1 is a 
diagram illustrating the operation of a prior art two-tap (bi-linear) 
texture map filter used to interpolate texture map data to generate pixel 
data. 
In FIG. 1, sample point P represents a position within a texture map from 
which pixel data is to be generated. Values Ta, Tb, Tc, and Td represent 
four adjacent values of texture map (or other) data. Values Ta, Tb, Tc, 
and Td may represent any of Y, U, or V data, R,G, or B data, or the like. 
The number of bits and value range for each of values Ta, Tb, Tc, and Td 
may vary depending upon pixel depth, compression, and the like. 
The relative position between sample point P and values Ta, Tb, Tc, and Td 
may be determined by dimension u horizontally, and dimension v vertically. 
Using simple two-tap (bi-linear) interpolation, the value for sample point 
P may be generated from equation 1: 
EQU P=v*(u*Ta+(1-u)Tb)+(1-v)*(u*Tc+(1-u)Td) (1) 
Where u and v are between 0 and 1. 
Recently, four-tap texture filters have been used for texture mapping. 
Four-tap filters may utilize four input values from both horizontal and 
vertical directions to sample up to 16 data values. A four-tap texture 
filter may produce better interpolation results and reduce the amount of 
artifacts and the like in the resultant image. 
Such four-tap filters have been based upon fixed functions which are 
symmetrical in both horizontal and vertical directions. These fixed 
functions define the weighting used along columns and rows to sample the 
final value, and may comprise, for example, a Gaussian filter. Such 
filters have been shown to be useful for filtering a previously lossy 
compressed image or texture. 
Video applications are beginning to explore an asymmetrical filtering 
system wherein the filter is a two-tap filter for horizontal 
interpolation, but vertically, a three-tap filter may be used to eliminate 
flicker or interlace effects. In the prior art, separate fixed filtering 
units are used in each of the above applications (as well as other 
applications). Thus, each filter is application specific, and separate 
filters may be required for texture map filters and for video filtering. 
Moreover, different types of data may respond better to different filter 
types. For example, a more equal weighting in a four-tap filter will blur 
or wash out any high frequency data because of its averaging effect. Such 
a filtering technique may be useful for images such a cloud textures, 
where a "soft" look is desirable. Other images may respond better to a 
two-tap filter with different interpolation techniques for horizontal and 
vertical functions in order to avoid blurring edges and the like. 
In the prior art, to provide such separate filter types for different 
applications and/or data types may be cumbersome and expensive. 
SUMMARY OF THE INVENTION 
The present invention provides a general programmable filter which may be 
optimized for data type, application, speed, or the like. The filter unit 
supports a multi-tap calculation in both the horizontal and vertical 
direction. The horizontal tap weights and the vertical tap weights may be 
programmed separately, allowing for asymmetrical filtering. The ability to 
program the tap weights allows many functions to be supported. For 
example, by zeroing out all the weights except the two nearest tap points 
which are set to one, a linear filter (in that particular direction) may 
be achieved. If such a technique is applied in both directions, the result 
is a bi-linear filter. 
The programmable filter of the present invention also allows the 
application or driver software to best optimize the filter for other 
desired effects. As discussed above, a more equal weighting on a four-tap 
filter will blur or wash out any high frequency data.

DETAILED DESCRIPTION OF THE INVENTION 
FIG. 2B is a block diagram of a programmable four-tap (or less) filter 
according to the present invention. Such a programmable filter may be used 
in a number of applications. However, in the preferred embodiment, the 
filter of the present invention may be applied as a texture map filter 
within a display controller for a computer system. 
Sample point addresses sample.sub.-- x and sample.sub.-- y may be provided 
as desired location points for a texture map to be generated on a display 
(i.e., a sample location). As noted above, when displaying texture map 
data, locations of individual display pixels may not correspond to actual 
texture map data points. Thus, a texture map filter may be required to 
generate data for a given sample point. In this instance, sample point 
addresses sample.sub.-- x and sample.sub.-- y represent relative 
horizontal and vertical locations of a desired sample point within a 
texture map. 
FIG. 2A illustrates mapping from x-y space to sample space. Sample.sub.-- x 
and sample.sub.-- y represent the location of a sample point in x-y space. 
Sample.sub.-- x and sample.sub.-- y have both integer and fraction 
components as illustrated in FIG. 2A. Integer components, int.sub.-- 
sample.sub.-- x and int.sub.-- sample.sub.-- y represent the whole integer 
value of sample.sub.-- x and sample.sub.-- y values. Int.sub.-- 
sample.sub.-- x and int.sub.-- sample.sub.-- y may represent the next 
lowest data value location. Fractional values frac.sub.-- sample.sub.-- x 
and frac.sub.-- sample.sub.-- y representing the distance between the next 
lowest pixel value and adjacent data values in the x and y directions, 
respectively. 
Referring back to FIG. 2B, integer sample values int.sub.-- sample.sub.-- x 
and int.sub.-- sample.sub.-- y are fed to nearest data address logic 201 
which calculates the addresses of the four data values nearest to the 
sample point in a particular direction (i.e., x or y). These addresses, 
addr.sub.-- T0, addr.sub.-- T1, addr.sub.-- T2, and addr.sub.-- T3 are 
output from nearest address data logic 201 and are illustrated in FIG. 2A. 
In the embodiment of FIG. 2B, the four nearest data points in the x 
direction are first chosen and their addresses output as addr.sub.-- T0, 
addr.sub.-- T1, addr.sub.-- T2, and addr.sub.-- T3 to image or texture 
memory 203. Image or texture memory 203 then outputs data for the four 
data points addressed by addresses addr.sub.-- T0, addr.sub.-- T1, 
addr.sub.-- T2, and addr.sub.-- T3. Each data output by image or texture 
memory 203 may represent a color value (e.g., monochrome, or Red, Blue or 
Green) or luminance or color difference value (e.g., Y, U, or V) for a 
particular data point of a image or texture. Alternately, the data output 
may represent, for example, an 8-bit modulation value (such as alpha) used 
for so-called "Bump Mapping" or "translucency Mapping". 
Weight RAM 202 may be fed fractional value frac.sub.-- sample.sub.-- x 
representing the position in the x direction of the sample point between 
adjacent data points in the image map, as illustrated in FIG. 2B. Weight 
RAM 202 outputs weighting values horW0, horW1, horW2, and horW3 which 
weight data values from image or texture memory 203 in multipliers 205, 
206, 207, and 208. 
The sum of the multiplied values from multipliers 205, 206, 207, and 208 
are then summed in adder 209 to produce a weighted value for the first row 
of x values which are in turn stored in a storage means (e.g., latch, 
buffer, register, or like) R0. The process is repeated for rows 1-3 to 
produce four weighted and summed values in storage means 210, 211, 212, 
and 213. 
Once four horizontal rows have been filtered, the resultant values are then 
filtered vertically. Filtered values R0, R1, R2, and R3 stored in storage 
means 210, 211, 212, and 213 are multiplied in multipliers 214, 215, 216, 
and 217 with vertical weighting values verW0, verW1, verW2, and verW3 and 
added in adder 218 to produce filtered result 220. 
Weighting RAM 202 may be programmed via bus 100 to perform different 
weighting functions or to provide a different number of taps. For example, 
if weighting values horW0 and horW3 are set to zero, then the apparatus 
may perform as a two-tap filter in the x direction. Similarly, weighting 
RAM 204 may be selectively programmed as well. Bus 100 may comprise a 
system bus within a computer system, or may comprise an internal bus 
within a device (e.g., multimedia device or the like). 
The selectability of weighting RAM programming allows the filter of the 
present invention to be utilized in a number of different applications. As 
a result, a single programmable filter may be provided within a 
semiconductor circuit as a substitute for a number of individual, discrete 
circuits. Weight RAMs 201 and 202 may be programmed with linear or 
non-linear curves, which may be addressed using fractional sample values 
frac.sub.-- sample.sub.-- x and frac.sub.-- sample.sub.-- y, respectively. 
In an alternative embodiment, a pair of values may be output from 
weighting RAMs 210 or 204 for each data value, in order to provide curve 
fitting for a continuous curve. 
Weighting RAMs 202 and 204 may be provided as standard RAMs (e.g., DRAMs or 
the like) or may be provided within a portion of system memory or other 
memory. 
The embodiment of FIG. 1 is provided for purposes of illustration to allow 
one to understand the operation of the filter of the present invention. In 
actual implementation, such an embodiment may not be efficient, as it may 
require four clock cycles to process four rows of data in the x direction 
and an additional clock cycle to process the averaged data in the y 
direction. 
FIG. 3 is a block diagram of the preferred embodiment of the present 
invention, illustrating a technique whereby filtering may occur within one 
or two clock cycles. Integer sample values int.sub.-- sample.sub.-- x and 
int.sub.-- sample.sub.-- y are fed to nearest data address logic 301 which 
calculates the addresses of the four data values nearest to the sample 
point in a particular direction (i.e., x or y). These addresses, 
addr.sub.-- T0, addr.sub.-- T1, addr.sub.-- T2, and addr.sub.-- T3 are 
output from nearest address data logic 301 to image or texture memory 
portions 303, 323, 333, and 343. 
Image or texture memory portion 303 may output data for a first row of data 
(Row R0), with memory portions 323, 333, and 343, outputting row data for 
rows R1, R2, and R3, respectively. All three of memory portions 303, 323, 
333, and 343 may output their respective row data simultaneously. Weight 
RAM 302 may be fed fractional value frac.sub.-- sample.sub.-- x 
representing the position in the x direction of the sample point between 
adjacent data points in the image map, as illustrated in FIG. 2B. Weight 
RAM 302 outputs weighting values horW0, horW1, horW2, and horW3 which 
weight data values from image or texture memory 303 in corresponding 
groups of multipliers 305-308, 325-328, 335,338, and 345-348. 
The respective multiplied values from each group of multipliers 305-308, 
325-328, 335,338, and 345-348 are then summed respectively in adders 309, 
329, 339, and 349 to produce a weighted values R0, R1, R2, and R3 in 
storage means 310, 311, 312, and 313. Again, the weighting and summing of 
all four rows of values may take place within one clock cycle, producing 
four weighed values simultaneously. 
Once four horizontal rows have been filtered, the resultant values are then 
filtered vertically. Filtered values R0, R1, R2, and R3 stored in storage 
means 310, 311, 312, and 313 are multiplied in multipliers 314, 315, 316, 
and 317 with vertical weighting values verW0, verW1, verW2, and verW3 and 
added in adder 318 to produce filtered result 320. Row map 340 may be 
provided to selectively address weight RAM 342 to insure the correct 
weighting value is provided to each weight row data R0, R1, R2, and R3. 
Weighting RAMs 302 may be programmed via bus 100 to perform different 
weighting functions or to provide a different number of taps. For example, 
if weighting values horW0 and horW3 are set to zero, then the apparatus 
may perform as a two-tap filter in the x direction. Similarly, weighting 
RAM 342 may be selectively programmed as well. Bus 100 may comprise a 
system bus within a computer system, or may comprise an internal bus 
within a device (e.g., multimedia device or the like). 
If both horizontal and vertical weighting can occur within one clock cycle, 
it is possible that the filter of FIG. 3 may operate within one clock 
cycle, outputting one filtered result per clock cycle in response to an 
input sample address. 
It should be noted that in the preferred embodiment of the present 
invention, filtering in the x direction is performed first, then filtering 
in the y direction. Changing filtering order may change the resultant 
filtering functions, and thus the process may be order dependent. However, 
it is entirely within the spirit and scope of the present invention to 
perform filtering first in the y direction and then in the x direction. 
In the preferred embodiment, the texture map of the present invention 
comprises a nominally 4-tap filter. The term "nominally" is used, as the 
filter of the present invention may be programmed to operate as a 4 by 4 
tap filter, a 4 by 2 tap filter, 2 by 2 filter, and the like, by use of 
the programmable features of the present invention. Although the texture 
map of the present invention comprises a nominally 4-tap filter, the 
apparatus of the present invention may be expanded to other sizes (e.g., 
16-tap, 32-tap, of the like) without departing from the spirit and scope 
of the present invention. 
Although the present invention has been illustrated and described in 
detail, it is clearly understood that the same is by way of illustration 
and example only and is not to be taken by way of limitation, the scope 
and spirit of the present invention being limited only the terms of the 
appended claims.