An anisotropic filtering system
Patent Information
- Application Number
- CN202610730101.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-26
- Publication Date
- 2026-08-18
AI Technical Summary
[0004]然而,在现有技术中,纹理采样步长通常根据纹理特征直接计算得到,难以适应不同纹理类型、不同应用场景对采样精度和灵活性的需求
本发明在基于纹理微分值计算得到的初始采样步长的基础上,通过用户配置的偏置值对初始采样步长进行调整,得到目标采样步长,使得能够根据目标采样步长确定各向异性滤波处理的纹理采样坐标,用户能够根据实际场景需求灵活确定不同方向的偏置值,从而实现更加灵活的纹理采样,进而提高各向异性滤波处理的灵活性。
Smart Images

Figure CN122597618A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of integrated circuit design technology, and in particular to an anisotropic filtering system. Background Technology
[0002] Currently, in fields such as computer graphics, image processing, and computer vision, texture mapping technology is one of the core methods to enhance the realism of images. It makes the rendering results closer to the real scene by pasting two-dimensional texture images onto the surface of three-dimensional models or supplementing the details of two-dimensional images. However, when texture images are stretched, compressed, or the viewpoint changes during display, traditional texture sampling methods are prone to problems such as texture blurring, jagged edges, or loss of details, especially in tilted or stretched areas of the texture, where these defects are more obvious.
[0003] To address the aforementioned issues, existing technologies have proposed anisotropic filtering techniques. The core advantage of this technique lies in its ability to employ different sampling densities in different directions based on the stretching direction and degree of the texture, thereby effectively preserving texture details and enhancing image clarity and realism.
[0004] However, in existing technologies, the texture sampling step size is usually calculated directly based on texture features, which is difficult to adapt to the sampling accuracy and flexibility requirements of different texture types and application scenarios. A fixed texture sampling step size can lead to a disconnect between the filtering effect and actual needs.
[0005] Therefore, improving the flexibility of anisotropic filtering texture sampling has become an urgent problem to be solved. Summary of the Invention
[0006] To address the aforementioned technical problems, the technical solution adopted by this invention is as follows: An anisotropic filtering system includes a processor and a memory storing a computer program, wherein when the computer program is executed by the processor, the following steps are performed: S101, based on the obtained first texture differential value, second texture differential value, third texture differential value and fourth texture differential value, determine the first initial sampling step size and the second initial sampling step size; S102, determine the first target sampling step size based on the first initial sampling step size and the obtained first step size offset value; S103, determine the second target sampling step size based on the second initial sampling step size and the obtained second step size offset value; S104, based on the obtained texture coordinates, the first target sampling step size, the second target sampling step size, and the preset sampling number 2N-1, determine 2N-1 sampling coordinates, where N is a positive integer; S105, perform anisotropic filtering processing on the texture pixel values corresponding to the 2N-1 sampled coordinates in the texture image to obtain the target pixel value.
[0007] Compared with the prior art, the present invention has significant advantages. Through the above technical solution, the anisotropic filtering system provided by the present invention achieves considerable technical progress and practicality, and has broad industrial application value. It has at least the following advantages: This invention adjusts the initial sampling step size based on the texture differential value calculation and the user-configured bias value to obtain the target sampling step size. This allows the texture sampling coordinates for anisotropic filtering to be determined based on the target sampling step size. Users can flexibly determine the bias value in different directions according to the actual scene requirements, thereby achieving more flexible texture sampling and improving the flexibility of anisotropic filtering. Attached Figure Description
[0008] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0009] Figure 1 This is a flowchart illustrating the execution of a computer program by a processor in an anisotropic filtering system, as provided in an embodiment of the present invention. Detailed Implementation
[0010] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0011] This embodiment provides an anisotropic filtering system; see [link / reference]. Figure 1 This is a flowchart illustrating the execution of a computer program by a processor in an anisotropic filtering system according to an embodiment of the present invention. The system includes a processor and a memory storing the computer program. When the computer program is executed by the processor, the following steps are implemented: S101, based on the obtained first texture differential value, second texture differential value, third texture differential value and fourth texture differential value, determine the first initial sampling step size and the second initial sampling step size; S102, determine the first target sampling step size based on the first initial sampling step size and the obtained first step size offset value; S103, determine the second target sampling step size based on the second initial sampling step size and the obtained second step size offset value; S104, based on the obtained texture coordinates, the first target sampling step size, the second target sampling step size, and the preset sampling number 2N-1, determine 2N-1 sampling coordinates, where N is a positive integer; S105, perform anisotropic filtering processing on the texture pixel values corresponding to the 2N-1 sampled coordinates in the texture image to obtain the target pixel value.
[0012] Wherein, the first texture differential value can represent the change in coordinates in the u direction of the texture image when the screen image moves a single pixel in the X direction, the second texture differential value can represent the change in coordinates in the u direction of the texture image when the screen image moves a single pixel in the Y direction, the third texture differential value can represent the change in coordinates in the v direction of the texture image when the screen image moves a single pixel in the X direction, and the fourth texture differential value can represent the change in coordinates in the v direction of the texture image when the screen image moves a single pixel in the Y direction.
[0013] The first initial sampling step size can refer to the texture sampling step size in the u direction of the texture image calculated based on the texture differential value, which is the coordinate difference between adjacent sampling points in the u direction of the texture image. The second initial sampling step size can refer to the texture sampling step size in the v direction of the texture image calculated based on the texture differential value, which is the coordinate difference between adjacent sampling points in the v direction of the texture image.
[0014] Texture coordinates can refer to the coordinates of a target pixel in a screen image relative to the corresponding texture pixel in the texture image.
[0015] The preset sampling number can refer to the number of texture pixels required for filtering a single target pixel during anisotropic filtering.
[0016] The target pixel value can refer to the anisotropic filtering result corresponding to the target pixel.
[0017] In one specific implementation, determining the first initial sampling step size and the second initial sampling step size based on the acquired first texture differential value, second texture differential value, third texture differential value, and fourth texture differential value includes: The squared value of the first basic stretch length is determined based on the first texture differential value and the third texture differential value. The second basic stretch length squared value is determined based on the second texture differential value and the fourth texture differential value; The main direction identification value is determined based on the squared value of the first foundation tensile length and the squared value of the second foundation tensile length; The length square value of the main stretching direction is determined based on the main direction identification value, the square value of the first foundation stretching length, and the square value of the first foundation stretching length. The initial major axis length is determined based on the square of the length in the main tensile direction; Determine the normalization coefficient based on the initial major axis length; The first initial sampling step size is determined based on the main direction identifier value, the first texture differential value, the second texture differential value, and the normalization coefficient. The second initial sampling step size is determined based on the main direction identifier value, the third texture differential value, the fourth texture differential value, and the normalization coefficient.
[0018] The first basic stretch length square value can represent the square value of the texture stretch length in the X direction of the screen image. The first basic stretch length square value is obtained by adding the square value of the first texture differential value and the square value of the third texture differential value.
[0019] The second basic stretch length square value can represent the square value of the texture stretch length in the Y direction of the screen image. The second basic stretch length square value is obtained by adding the square value of the second texture differential value and the square value of the fourth texture differential value.
[0020] The main direction identifier value can be represented by a Boolean value to indicate whether the X direction of the screen image is the direction with more severe texture stretching. When the square of the first basic stretch length is greater than the square of the second basic stretch length, the main direction identifier value is 1, indicating that the X direction of the screen image is the direction with more severe texture stretching. When the square of the first basic stretch length is not greater than the square of the second basic stretch length, the main direction identifier value is 0, indicating that the X direction of the screen image is not the direction with more severe texture stretching.
[0021] When the main direction indicator value is 1, the square value of the first basic tensile length is determined to be the square value of the length in the main tensile direction. When the main direction indicator value is 0, the square value of the second basic tensile length is determined to be the square value of the length in the main tensile direction.
[0022] The initial major axis length is the result of taking the square root of the square value of the length in the main stretching direction.
[0023] The normalization coefficient is the reciprocal of the initial major axis length, and the normalization coefficient is calculated using floating-point format.
[0024] In one specific implementation, determining the first initial sampling step size based on the main direction identifier value, the first texture differential value, the second texture differential value, and the normalization coefficient includes: When the main direction identifier value is a first preset value, the product of the first texture differential value and the normalization coefficient is used as the first initial sampling step size; When the main direction identifier value is the second preset value, the product of the second texture differential value and the normalization coefficient is used as the first initial sampling step size.
[0025] The first preset value is 1, and the second preset value is 0.
[0026] In one specific implementation, determining the first target sampling step size based on the first initial sampling step size and the obtained first step size offset value includes: The first initial sampling step size and the first step size bias value are added together, and the sum is used as the first target sampling step size.
[0027] The first step offset value can be used to adjust the first initial sampling step size, and the first target step size can refer to the texture sampling step size in the u direction of the texture image that is ultimately used for texture pixel sampling.
[0028] In one specific implementation, the first step length bias value is selected by the user from a set of first step length bias values, wherein the set of first step length bias values includes M different first step length bias values.
[0029] Where M is a positive integer, the set of first step length bias values is provided to the user by the GPU chip. Different first step length bias values can represent different first step length adjustment levels. The higher the first step length adjustment level, the greater the degree of adjustment of the first initial sampling step length. Correspondingly, the larger the sampling interval corresponding to the first target step length.
[0030] In one specific implementation, determining the second target sampling step size based on the second initial sampling step size and the obtained second step size bias value includes: The second initial sampling step size and the second step size bias value are added together, and the result of the addition is used as the second target sampling step size.
[0031] The second step size offset value can be used to adjust the second initial sampling step size, and the second target step size can refer to the texture sampling step size in the v direction of the texture image that is ultimately used for texture pixel sampling.
[0032] In one specific implementation, the second step size bias value is selected by the user from a set of second step size bias values, wherein the set of second step size bias values includes K different second step size bias values.
[0033] Where K is a positive integer, the set of second step size bias values is provided to the user by the GPU chip, and different second step size bias values can represent different second step size adjustment levels. The higher the second step size adjustment level, the greater the degree of adjustment of the second initial sampling step size, and correspondingly, the larger the sampling interval corresponding to the second target step size.
[0034] In one specific implementation, determining 2N-1 sampling coordinates based on the acquired texture coordinates, the first target sampling step size, the second target sampling step size, and a preset sampling number 2N-1 includes: Determine the x-coordinate a and y-coordinate b of the texture coordinates; Based on the horizontal coordinate a, the vertical coordinate b, the sampling step size of the first target c, and the sampling step size of the second target d, the sampling coordinates (a±(n×c), b±(n×c)) are determined, where n is an integer in the range [0, N].
[0035] Texture coordinates are represented by two-dimensional coordinates (a, b).
[0036] Specifically, taking N=3 as an example, the number of samples is 7. When n=0, the sampling coordinates are (a,b); when n=1, the sampling coordinates are (a+c,b+d) and (ac,bd); when n=2, the sampling coordinates are (a+2c,b+2d) and (a-2c,b-2d); and when n=3, the sampling coordinates are (a+3c,b+3d) and (a-3c,b-3d).
[0037] In this embodiment, based on the initial sampling step size calculated from the texture differential value, the initial sampling step size is adjusted by the bias value configured by the user to obtain the target sampling step size. This allows the texture sampling coordinates for anisotropic filtering to be determined according to the target sampling step size. Users can flexibly determine the bias values in different directions according to the actual scene requirements, thereby achieving more flexible texture sampling and improving the flexibility of anisotropic filtering.
[0038] While specific embodiments of the invention have been described in detail by way of example, those skilled in the art should understand that the examples are for illustrative purposes only and not intended to limit the scope of the invention. Those skilled in the art should also understand that various modifications can be made to the embodiments without departing from the scope and spirit of the invention. The scope of this invention is defined by the appended claims.
Claims
1. An anisotropic filtering system, characterized in that, The system includes a processor and a memory storing a computer program, which, when executed by the processor, performs the following steps: S101, based on the obtained first texture differential value, second texture differential value, third texture differential value and fourth texture differential value, determine the first initial sampling step size and the second initial sampling step size; S102, determine the first target sampling step size based on the first initial sampling step size and the obtained first step size offset value; S103, determine the second target sampling step size based on the second initial sampling step size and the obtained second step size offset value; S104, based on the obtained texture coordinates, the first target sampling step size, the second target sampling step size, and the preset sampling number 2N-1, determine 2N-1 sampling coordinates, where N is a positive integer; S105, perform anisotropic filtering processing on the texture pixel values corresponding to the 2N-1 sampled coordinates in the texture image to obtain the target pixel value.
2. The anisotropic filtering system according to claim 1, characterized in that, The step of determining the first initial sampling step size and the second initial sampling step size based on the obtained first texture differential value, second texture differential value, third texture differential value, and fourth texture differential value includes: The squared value of the first basic stretch length is determined based on the first texture differential value and the third texture differential value. The second basic stretch length squared value is determined based on the second texture differential value and the fourth texture differential value; The main direction identification value is determined based on the squared value of the first foundation tensile length and the squared value of the second foundation tensile length; The length square value of the main stretching direction is determined based on the main direction identification value, the square value of the first foundation stretching length, and the square value of the first foundation stretching length. The initial major axis length is determined based on the square of the length in the main tensile direction; Determine the normalization coefficient based on the initial major axis length; The first initial sampling step size is determined based on the main direction identifier value, the first texture differential value, the second texture differential value, and the normalization coefficient. The second initial sampling step size is determined based on the main direction identifier value, the third texture differential value, the fourth texture differential value, and the normalization coefficient.
3. The anisotropic filtering system according to claim 2, characterized in that, The step of determining the first initial sampling step size based on the main direction identifier value, the first texture differential value, the second texture differential value, and the normalization coefficient includes: When the main direction identifier value is a first preset value, the product of the first texture differential value and the normalization coefficient is used as the first initial sampling step size; When the main direction identifier value is the second preset value, the product of the second texture differential value and the normalization coefficient is used as the first initial sampling step size.
4. The anisotropic filtering system according to claim 1, characterized in that, The step of determining the first target sampling step size based on the first initial sampling step size and the obtained first step size offset value includes: The first initial sampling step size and the first step size bias value are added together, and the sum is used as the first target sampling step size.
5. The anisotropic filtering system according to claim 1, characterized in that, The first step long bias value is selected by the user from a set of first step long bias values, wherein the set of first step long bias values includes M different first step long bias values.
6. The anisotropic filtering system according to claim 1, characterized in that, The step of determining the second target sampling step size based on the second initial sampling step size and the obtained second step size bias value includes: The second initial sampling step size and the second step size bias value are added together, and the result of the addition is used as the second target sampling step size.
7. The anisotropic filtering system according to claim 1, characterized in that, The second step size bias value is selected by the user from a set of second step size bias values, wherein the set of second step size bias values includes K different second step size bias values.
8. The anisotropic filtering system according to claim 1, characterized in that, The step of determining 2N-1 sampling coordinates based on the obtained texture coordinates, the first target sampling step size, the second target sampling step size, and the preset sampling number 2N-1 includes: Determine the x-coordinate a and y-coordinate b of the texture coordinates; Based on the horizontal coordinate a, the vertical coordinate b, the sampling step size of the first target c, and the sampling step size of the second target d, the sampling coordinates (a±(n×c), b±(n×c)) are determined, where n is an integer in the range [0, N].