group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
SMAAAreaTex.h File Reference

SMAA Area Texture generator. More...

#include <cmath>
#include <cstring>
Include dependency graph for SMAAAreaTex.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  smaa_detail

Functions

float smaa_detail::areaOrtho (float p, float d, float offset)
 Smoothing function used by the area calculation.
void smaa_detail::calcAreaOrtho (int d1, int d2, int e1, int e2, float offset, float &r, float &g)
 Compute the area for a specific orthogonal edge configuration.
float smaa_detail::subtexOffset (int idx)
 Map sub-pixel index [0..6] to sub-pixel offset value.
void generateAreaTex (unsigned char *out)
 Generate the SMAA area texture into a caller-provided buffer.

Variables

static constexpr int SMAA_AREATEX_WIDTH = 160
static constexpr int SMAA_AREATEX_HEIGHT = 560
static constexpr int SMAA_AREATEX_PITCH = SMAA_AREATEX_WIDTH * 2
static constexpr int SMAA_AREATEX_MAX_DISTANCE = 16
 Number of orthogonal edge patterns (5x4 = 20 actually, but the original implementation uses a 5x5 grid = 25 pattern slots, 20 meaningful).
static constexpr int SMAA_AREATEX_SUBTEX_COUNT = 7
static constexpr int SMAA_AREATEX_ORTHO_PATTERNS = 16
static constexpr int SMAA_AREATEX_SUBTEX_SIZE = (SMAA_AREATEX_MAX_DISTANCE + 1)

Detailed Description

SMAA Area Texture generator.

Generates the 160x560 RG8 UNORM area lookup texture used by the SMAA blending weight calculation pass.

Based on the SMAA reference implementation by Jorge Jimenez et al. (MIT License).

The area texture encodes the blending areas for all possible edge patterns at all distances. It is organised as a grid of sub-textures:

  • Each sub-texture is (SMAA_AREATEX_MAX_DISTANCE+1) x (SMAA_AREATEX_MAX_DISTANCE+1) = 17x17 pixels
  • There are 20 crossing-edge patterns (ortho + diag) arranged horizontally, and 7 sub-pixel offsets arranged vertically.

Total size: 160 x 560 pixels, RG8 format (2 bytes/pixel = 179200 bytes).

Function Documentation

◆ generateAreaTex()

void generateAreaTex ( unsigned char * out)
inline

Generate the SMAA area texture into a caller-provided buffer.

Parameters
outmust point to at least SMAA_AREATEX_WIDTH * SMAA_AREATEX_HEIGHT * 2 bytes.
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ SMAA_AREATEX_HEIGHT

int SMAA_AREATEX_HEIGHT = 560
staticconstexpr

◆ SMAA_AREATEX_MAX_DISTANCE

int SMAA_AREATEX_MAX_DISTANCE = 16
staticconstexpr

Number of orthogonal edge patterns (5x4 = 20 actually, but the original implementation uses a 5x5 grid = 25 pattern slots, 20 meaningful).

◆ SMAA_AREATEX_ORTHO_PATTERNS

int SMAA_AREATEX_ORTHO_PATTERNS = 16
staticconstexpr

◆ SMAA_AREATEX_PITCH

int SMAA_AREATEX_PITCH = SMAA_AREATEX_WIDTH * 2
staticconstexpr

◆ SMAA_AREATEX_SUBTEX_COUNT

int SMAA_AREATEX_SUBTEX_COUNT = 7
staticconstexpr

◆ SMAA_AREATEX_SUBTEX_SIZE

int SMAA_AREATEX_SUBTEX_SIZE = (SMAA_AREATEX_MAX_DISTANCE + 1)
staticconstexpr

◆ SMAA_AREATEX_WIDTH

int SMAA_AREATEX_WIDTH = 160
staticconstexpr