FFmpeg
|
#include <stddef.h>
#include <stdint.h>
#include "libavutil/attributes.h"
#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
#include "texturedsp.h"
Go to the source code of this file.
Macros | |
#define | mul8(a, b) (((a) * (b) + 128 + (((a) * (b) + 128) >> 8)) >> 8) |
#define | rgb2rgb565(r, g, b) ((mul8(r, 31) << 11) | (mul8(g, 63) << 5) | (mul8(b, 31) << 0)) |
#define | lerp13(a, b) ((2 * (a) + (b)) / 3) |
Functions | |
static void | lerp13rgb (uint8_t *out, uint8_t *p1, uint8_t *p2) |
static void | rgb5652rgb (uint8_t *out, uint16_t v) |
static unsigned int | match_colors (const uint8_t *block, ptrdiff_t stride, uint16_t c0, uint16_t c1) |
static void | optimize_colors (const uint8_t *block, ptrdiff_t stride, uint16_t *pmax16, uint16_t *pmin16) |
static int | refine_colors (const uint8_t *block, ptrdiff_t stride, uint16_t *pmax16, uint16_t *pmin16, uint32_t mask) |
static int | constant_color (const uint8_t *block, ptrdiff_t stride) |
static void | compress_color (uint8_t *dst, ptrdiff_t stride, const uint8_t *block) |
static void | compress_alpha (uint8_t *dst, ptrdiff_t stride, const uint8_t *block) |
static void | rgba2ycocg (uint8_t *dst, const uint8_t *pixel) |
Convert a RGBA buffer to unscaled YCoCg. More... | |
static int | dxt1_block (uint8_t *dst, ptrdiff_t stride, const uint8_t *block) |
Compress one block of RGBA pixels in a DXT1 texture and store the resulting bytes in 'dst'. More... | |
static int | dxt5_block (uint8_t *dst, ptrdiff_t stride, const uint8_t *block) |
Compress one block of RGBA pixels in a DXT5 texture and store the resulting bytes in 'dst'. More... | |
static int | dxt5ys_block (uint8_t *dst, ptrdiff_t stride, const uint8_t *block) |
Compress one block of RGBA pixels in a DXT5-YCoCg texture and store the resulting bytes in 'dst'. More... | |
static int | rgtc1u_alpha_block (uint8_t *dst, ptrdiff_t stride, const uint8_t *block) |
Compress one block of RGBA pixels in a RGTC1U texture and store the resulting bytes in 'dst'. More... | |
av_cold void | ff_texturedspenc_init (TextureDSPContext *c) |
Variables | |
static const uint8_t | expand5 [32] |
static const uint8_t | expand6 [64] |
static const uint8_t | match5 [256][2] |
static const uint8_t | match6 [256][2] |
Definition at line 143 of file texturedspenc.c.
Definition at line 146 of file texturedspenc.c.
|
inlinestatic |
Definition at line 153 of file texturedspenc.c.
Referenced by match_colors().
|
inlinestatic |
Definition at line 161 of file texturedspenc.c.
Referenced by match_colors().
|
static |
Definition at line 174 of file texturedspenc.c.
Referenced by compress_color().
|
static |
Definition at line 237 of file texturedspenc.c.
Referenced by compress_color().
|
static |
Definition at line 350 of file texturedspenc.c.
Referenced by compress_color().
|
static |
Definition at line 440 of file texturedspenc.c.
Referenced by compress_color().
|
static |
Definition at line 453 of file texturedspenc.c.
Referenced by dxt1_block(), dxt5_block(), and dxt5ys_block().
|
static |
Definition at line 499 of file texturedspenc.c.
Referenced by dxt5_block(), dxt5ys_block(), and rgtc1u_alpha_block().
|
static |
Convert a RGBA buffer to unscaled YCoCg.
Scale is usually introduced to avoid banding over a certain range of colors, but this version of the algorithm does not introduce it as much as other implementations, allowing for a simpler and faster conversion.
Definition at line 579 of file texturedspenc.c.
Referenced by dxt5ys_block().
|
static |
Compress one block of RGBA pixels in a DXT1 texture and store the resulting bytes in 'dst'.
Alpha is not preserved.
dst | output buffer. |
stride | scanline in bytes. |
block | block to compress. |
Definition at line 601 of file texturedspenc.c.
Referenced by ff_texturedspenc_init().
|
static |
Compress one block of RGBA pixels in a DXT5 texture and store the resulting bytes in 'dst'.
Alpha is preserved.
dst | output buffer. |
stride | scanline in bytes. |
block | block to compress. |
Definition at line 617 of file texturedspenc.c.
Referenced by ff_texturedspenc_init().
|
static |
Compress one block of RGBA pixels in a DXT5-YCoCg texture and store the resulting bytes in 'dst'.
Alpha is not preserved.
dst | output buffer. |
stride | scanline in bytes. |
block | block to compress. |
Definition at line 634 of file texturedspenc.c.
Referenced by ff_texturedspenc_init().
|
static |
Compress one block of RGBA pixels in a RGTC1U texture and store the resulting bytes in 'dst'.
Use the alpha channel of the input image.
dst | output buffer. |
stride | scanline in bytes. |
block | block to compress. |
Definition at line 659 of file texturedspenc.c.
Referenced by ff_texturedspenc_init().
av_cold void ff_texturedspenc_init | ( | TextureDSPContext * | c | ) |
Definition at line 666 of file texturedspenc.c.
Referenced by hap_init().
|
static |
Definition at line 35 of file texturedspenc.c.
Referenced by rgb5652rgb().
|
static |
Definition at line 41 of file texturedspenc.c.
Referenced by rgb5652rgb().
|
static |
Definition at line 50 of file texturedspenc.c.
Referenced by compress_color(), and refine_colors().
|
static |
Definition at line 96 of file texturedspenc.c.
Referenced by compress_color(), and refine_colors().