FFmpeg
Macros | Functions
texturedsp.c File Reference
#include <stddef.h>
#include <stdint.h>
#include "libavutil/attributes.h"
#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/libm.h"
#include "texturedsp.h"
#include "texturedsp_template.c"

Go to the source code of this file.

Macros

#define RGBA(r, g, b, a)
 
#define TEXTUREDSP_FUNC_NAME   ff_texturedsp_exec_decompress_threads
 
#define TEXTUREDSP_TEX_FUNC(a, b, c)   tex_funct(a, b, c)
 

Functions

static av_always_inline void extract_color (uint32_t colors[4], uint16_t color0, uint16_t color1, int dxtn, int alpha)
 
static void dxt1_block_internal (uint8_t *dst, ptrdiff_t stride, const uint8_t *block, uint8_t alpha)
 
static int dxt1_block (uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
 Decompress one block of a DXT1 texture and store the resulting RGBA pixels in 'dst'. More...
 
static int dxt1a_block (uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
 Decompress one block of a DXT1 with 1-bit alpha texture and store the resulting RGBA pixels in 'dst'. More...
 
static void dxt3_block_internal (uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
 
static av_always_inline void premult2straight (uint8_t *src)
 Convert a premultiplied alpha pixel to a straight alpha pixel. More...
 
static int dxt2_block (uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
 Decompress one block of a DXT2 texture and store the resulting RGBA pixels in 'dst'. More...
 
static int dxt3_block (uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
 Decompress one block of a DXT3 texture and store the resulting RGBA pixels in 'dst'. More...
 
static void decompress_indices (uint8_t *dst, const uint8_t *src)
 Decompress a BC 16x3 index block stored as h g f e d c b a p o n m l k j i. More...
 
static void dxt5_block_internal (uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
 
static int dxt4_block (uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
 Decompress one block of a DXT4 texture and store the resulting RGBA pixels in 'dst'. More...
 
static int dxt5_block (uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
 Decompress one block of a DXT5 texture and store the resulting RGBA pixels in 'dst'. More...
 
static av_always_inline void ycocg2rgba (uint8_t *src, int scaled)
 Convert a YCoCg buffer to RGBA. More...
 
static int dxt5y_block (uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
 Decompress one block of a DXT5 texture with classic YCoCg and store the resulting RGBA pixels in 'dst'. More...
 
static int dxt5ys_block (uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
 Decompress one block of a DXT5 texture with scaled YCoCg and store the resulting RGBA pixels in 'dst'. More...
 
static void rgtc_block_internal (uint8_t *dst, ptrdiff_t stride, const uint8_t *block, const int *color_tab, int mono, int offset, int pix_size)
 
static void rgtc1_block_internal (uint8_t *dst, ptrdiff_t stride, const uint8_t *block, int sign, int mono, int offset, int pix_size)
 
static int rgtc1s_block (uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
 Decompress one block of a RGRC1 texture with signed components and store the resulting RGBA pixels in 'dst'. More...
 
static int rgtc1u_block (uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
 Decompress one block of a RGRC1 texture with unsigned components and store the resulting RGBA pixels in 'dst'. More...
 
static int rgtc1u_alpha_block (uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
 Decompress one block of a RGTC1 texture with unsigned components and overwrite the alpha component in 'dst' (RGBA data). More...
 
static int rgtc1u_gray_block (uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
 Decompress one block of a RGTC1 texture with unsigned components to Gray 8. More...
 
static void rgtc2_block_internal (uint8_t *dst, ptrdiff_t stride, const uint8_t *block, int sign)
 
static int rgtc2s_block (uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
 Decompress one block of a RGRC2 texture with signed components and store the resulting RGBA pixels in 'dst'. More...
 
static int rgtc2u_block (uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
 Decompress one block of a RGRC2 texture with unsigned components and store the resulting RGBA pixels in 'dst'. More...
 
static int dxn3dc_block (uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
 Decompress one block of a 3Dc texture with unsigned components and store the resulting RGBA pixels in 'dst'. More...
 
av_cold void ff_texturedsp_init (TextureDSPContext *c)
 

Macro Definition Documentation

◆ RGBA

#define RGBA (   r,
  g,
  b,
  a 
)
Value:
(((uint8_t)(r) << 0) | \
((uint8_t)(g) << 8) | \
((uint8_t)(b) << 16) | \
((unsigned)(uint8_t)(a) << 24))

Definition at line 35 of file texturedsp.c.

◆ TEXTUREDSP_FUNC_NAME

#define TEXTUREDSP_FUNC_NAME   ff_texturedsp_exec_decompress_threads

Definition at line 659 of file texturedsp.c.

◆ TEXTUREDSP_TEX_FUNC

#define TEXTUREDSP_TEX_FUNC (   a,
  b,
  c 
)    tex_funct(a, b, c)

Definition at line 660 of file texturedsp.c.

Function Documentation

◆ extract_color()

static av_always_inline void extract_color ( uint32_t  colors[4],
uint16_t  color0,
uint16_t  color1,
int  dxtn,
int  alpha 
)
static

Definition at line 40 of file texturedsp.c.

Referenced by dxt1_block_internal(), dxt3_block_internal(), and dxt5_block_internal().

◆ dxt1_block_internal()

static void dxt1_block_internal ( uint8_t *  dst,
ptrdiff_t  stride,
const uint8_t *  block,
uint8_t  alpha 
)
inlinestatic

Definition at line 85 of file texturedsp.c.

Referenced by dxt1_block(), and dxt1a_block().

◆ dxt1_block()

static int dxt1_block ( uint8_t *  dst,
ptrdiff_t  stride,
const uint8_t *  block 
)
static

Decompress one block of a DXT1 texture and store the resulting RGBA pixels in 'dst'.

Alpha component is fully opaque.

Parameters
dstoutput buffer.
stridescanline in bytes.
blockblock to decompress.
Returns
how much texture data has been consumed.

Definition at line 115 of file texturedsp.c.

Referenced by decode_rtv1(), and ff_texturedsp_init().

◆ dxt1a_block()

static int dxt1a_block ( uint8_t *  dst,
ptrdiff_t  stride,
const uint8_t *  block 
)
static

Decompress one block of a DXT1 with 1-bit alpha texture and store the resulting RGBA pixels in 'dst'.

Alpha is either fully opaque or fully transparent.

Parameters
dstoutput buffer.
stridescanline in bytes.
blockblock to decompress.
Returns
how much texture data has been consumed.

Definition at line 132 of file texturedsp.c.

Referenced by ff_texturedsp_init().

◆ dxt3_block_internal()

static void dxt3_block_internal ( uint8_t *  dst,
ptrdiff_t  stride,
const uint8_t *  block 
)
inlinestatic

Definition at line 139 of file texturedsp.c.

Referenced by dxt2_block(), and dxt3_block().

◆ premult2straight()

static av_always_inline void premult2straight ( uint8_t *  src)
static

Convert a premultiplied alpha pixel to a straight alpha pixel.

Definition at line 171 of file texturedsp.c.

Referenced by dxt2_block(), and dxt4_block().

◆ dxt2_block()

static int dxt2_block ( uint8_t *  dst,
ptrdiff_t  stride,
const uint8_t *  block 
)
static

Decompress one block of a DXT2 texture and store the resulting RGBA pixels in 'dst'.

Parameters
dstoutput buffer.
stridescanline in bytes.
blockblock to decompress.
Returns
how much texture data has been consumed.

Definition at line 195 of file texturedsp.c.

Referenced by ff_texturedsp_init().

◆ dxt3_block()

static int dxt3_block ( uint8_t *  dst,
ptrdiff_t  stride,
const uint8_t *  block 
)
static

Decompress one block of a DXT3 texture and store the resulting RGBA pixels in 'dst'.

Parameters
dstoutput buffer.
stridescanline in bytes.
blockblock to decompress.
Returns
how much texture data has been consumed.

Definition at line 219 of file texturedsp.c.

Referenced by ff_texturedsp_init().

◆ decompress_indices()

static void decompress_indices ( uint8_t *  dst,
const uint8_t *  src 
)
static

Decompress a BC 16x3 index block stored as h g f e d c b a p o n m l k j i.

Bits packed as | h | g | f | e | d | c | b | a | // Entry |765 432 107 654 321 076 543 210| // Bit |0000000000111111111112222222222| // Byte

into 16 8-bit indices.

Definition at line 240 of file texturedsp.c.

Referenced by dxt5_block_internal(), and rgtc_block_internal().

◆ dxt5_block_internal()

static void dxt5_block_internal ( uint8_t *  dst,
ptrdiff_t  stride,
const uint8_t *  block 
)
inlinestatic

Definition at line 256 of file texturedsp.c.

Referenced by dxt4_block(), dxt5_block(), dxt5y_block(), and dxt5ys_block().

◆ dxt4_block()

static int dxt4_block ( uint8_t *  dst,
ptrdiff_t  stride,
const uint8_t *  block 
)
static

Decompress one block of a DXT4 texture and store the resulting RGBA pixels in 'dst'.

Parameters
dstoutput buffer.
stridescanline in bytes.
blockblock to decompress.
Returns
how much texture data has been consumed.

Definition at line 314 of file texturedsp.c.

Referenced by ff_texturedsp_init().

◆ dxt5_block()

static int dxt5_block ( uint8_t *  dst,
ptrdiff_t  stride,
const uint8_t *  block 
)
static

Decompress one block of a DXT5 texture and store the resulting RGBA pixels in 'dst'.

Parameters
dstoutput buffer.
stridescanline in bytes.
blockblock to decompress.
Returns
how much texture data has been consumed.

Definition at line 338 of file texturedsp.c.

Referenced by ff_texturedsp_init().

◆ ycocg2rgba()

static av_always_inline void ycocg2rgba ( uint8_t *  src,
int  scaled 
)
static

Convert a YCoCg buffer to RGBA.

Parameters
srcinput buffer.
scaledvariant with scaled chroma components and opaque alpha.

Definition at line 351 of file texturedsp.c.

Referenced by dxt5y_block(), and dxt5ys_block().

◆ dxt5y_block()

static int dxt5y_block ( uint8_t *  dst,
ptrdiff_t  stride,
const uint8_t *  block 
)
static

Decompress one block of a DXT5 texture with classic YCoCg and store the resulting RGBA pixels in 'dst'.

Alpha component is fully opaque.

Parameters
dstoutput buffer.
stridescanline in bytes.
blockblock to decompress.
Returns
how much texture data has been consumed.

Definition at line 378 of file texturedsp.c.

Referenced by ff_texturedsp_init().

◆ dxt5ys_block()

static int dxt5ys_block ( uint8_t *  dst,
ptrdiff_t  stride,
const uint8_t *  block 
)
static

Decompress one block of a DXT5 texture with scaled YCoCg and store the resulting RGBA pixels in 'dst'.

Alpha component is fully opaque.

Parameters
dstoutput buffer.
stridescanline in bytes.
blockblock to decompress.
Returns
how much texture data has been consumed.

Definition at line 402 of file texturedsp.c.

Referenced by ff_texturedsp_init().

◆ rgtc_block_internal()

static void rgtc_block_internal ( uint8_t *  dst,
ptrdiff_t  stride,
const uint8_t *  block,
const int *  color_tab,
int  mono,
int  offset,
int  pix_size 
)
inlinestatic

Definition at line 417 of file texturedsp.c.

Referenced by rgtc1_block_internal().

◆ rgtc1_block_internal()

static void rgtc1_block_internal ( uint8_t *  dst,
ptrdiff_t  stride,
const uint8_t *  block,
int  sign,
int  mono,
int  offset,
int  pix_size 
)
inlinestatic

◆ rgtc1s_block()

static int rgtc1s_block ( uint8_t *  dst,
ptrdiff_t  stride,
const uint8_t *  block 
)
static

Decompress one block of a RGRC1 texture with signed components and store the resulting RGBA pixels in 'dst'.

Parameters
dstoutput buffer.
stridescanline in bytes.
blockblock to decompress.
Returns
how much texture data has been consumed.

Definition at line 496 of file texturedsp.c.

Referenced by ff_texturedsp_init().

◆ rgtc1u_block()

static int rgtc1u_block ( uint8_t *  dst,
ptrdiff_t  stride,
const uint8_t *  block 
)
static

Decompress one block of a RGRC1 texture with unsigned components and store the resulting RGBA pixels in 'dst'.

Parameters
dstoutput buffer.
stridescanline in bytes.
blockblock to decompress.
Returns
how much texture data has been consumed.

Definition at line 512 of file texturedsp.c.

Referenced by ff_texturedsp_init().

◆ rgtc1u_alpha_block()

static int rgtc1u_alpha_block ( uint8_t *  dst,
ptrdiff_t  stride,
const uint8_t *  block 
)
static

Decompress one block of a RGTC1 texture with unsigned components and overwrite the alpha component in 'dst' (RGBA data).

Parameters
dstoutput buffer.
stridescanline in bytes.
blockblock to decompress.
Returns
how much texture data has been consumed.

Definition at line 528 of file texturedsp.c.

Referenced by ff_texturedsp_init().

◆ rgtc1u_gray_block()

static int rgtc1u_gray_block ( uint8_t *  dst,
ptrdiff_t  stride,
const uint8_t *  block 
)
static

Decompress one block of a RGTC1 texture with unsigned components to Gray 8.

Parameters
dstoutput buffer.
stridescanline in bytes.
blockblock to decompress.
Returns
how much texture data has been consumed.

Definition at line 544 of file texturedsp.c.

Referenced by ff_texturedsp_init().

◆ rgtc2_block_internal()

static void rgtc2_block_internal ( uint8_t *  dst,
ptrdiff_t  stride,
const uint8_t *  block,
int  sign 
)
inlinestatic

Definition at line 551 of file texturedsp.c.

Referenced by dxn3dc_block(), rgtc2s_block(), and rgtc2u_block().

◆ rgtc2s_block()

static int rgtc2s_block ( uint8_t *  dst,
ptrdiff_t  stride,
const uint8_t *  block 
)
static

Decompress one block of a RGRC2 texture with signed components and store the resulting RGBA pixels in 'dst'.

Alpha is fully opaque.

Parameters
dstoutput buffer.
stridescanline in bytes.
blockblock to decompress.
Returns
how much texture data has been consumed.

Definition at line 592 of file texturedsp.c.

Referenced by ff_texturedsp_init().

◆ rgtc2u_block()

static int rgtc2u_block ( uint8_t *  dst,
ptrdiff_t  stride,
const uint8_t *  block 
)
static

Decompress one block of a RGRC2 texture with unsigned components and store the resulting RGBA pixels in 'dst'.

Alpha is fully opaque.

Parameters
dstoutput buffer.
stridescanline in bytes.
blockblock to decompress.
Returns
how much texture data has been consumed.

Definition at line 608 of file texturedsp.c.

Referenced by ff_texturedsp_init().

◆ dxn3dc_block()

static int dxn3dc_block ( uint8_t *  dst,
ptrdiff_t  stride,
const uint8_t *  block 
)
static

Decompress one block of a 3Dc texture with unsigned components and store the resulting RGBA pixels in 'dst'.

Alpha is fully opaque.

Parameters
dstoutput buffer.
stridescanline in bytes.
blockblock to decompress.
Returns
how much texture data has been consumed.

Definition at line 624 of file texturedsp.c.

Referenced by ff_texturedsp_init().

◆ ff_texturedsp_init()

av_cold void ff_texturedsp_init ( TextureDSPContext c)

Definition at line 640 of file texturedsp.c.

Referenced by dds_decode(), decode_init(), dxv_init(), hap_init(), txd_decode_frame(), and vbn_init().

r
const char * r
Definition: vf_curves.c:127
b
#define b
Definition: input.c:41
g
const char * g
Definition: vf_curves.c:128
a
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
Definition: undefined.txt:41