FFmpeg
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
vf_paletteuse.c File Reference
#include "libavutil/bprint.h"
#include "libavutil/internal.h"
#include "libavutil/opt.h"
#include "libavutil/qsort.h"
#include "avfilter.h"
#include "framesync.h"
#include "internal.h"

Go to the source code of this file.

Data Structures

struct  color_node
 
struct  cached_color
 
struct  cache_node
 
struct  PaletteUseContext
 
struct  nearest_color
 
struct  stack_node
 
struct  color
 
struct  color_rect
 

Macros

#define NBITS   5
 
#define CACHE_SIZE   (1<<(4*NBITS))
 
#define OFFSET(x)   offsetof(PaletteUseContext, x)
 
#define FLAGS   (AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM)
 
#define COLORMAP_NEAREST(s, search, root, target)
 
#define INDENT   4
 
#define DECLARE_CMP_FUNC(name, pos)
 
#define DEFINE_SET_FRAME(color_search, name, value)
 
#define DEFINE_SET_FRAME_COLOR_SEARCH(color_search, color_search_macro)
 
#define DITHERING_ENTRIES(color_search)
 

Typedefs

typedef int(* set_frame_func) (struct PaletteUseContext *s, AVFrame *out, AVFrame *in, int x_start, int y_start, int width, int height)
 
typedef int(* cmp_func) (const void *, const void *)
 

Enumerations

enum  dithering_mode {
  DITHERING_NONE, DITHERING_BAYER, DITHERING_HECKBERT, DITHERING_FLOYD_STEINBERG,
  DITHERING_SIERRA2, DITHERING_SIERRA2_4A, NB_DITHERING
}
 
enum  color_search_method { COLOR_SEARCH_NNS_ITERATIVE, COLOR_SEARCH_NNS_RECURSIVE, COLOR_SEARCH_BRUTEFORCE, NB_COLOR_SEARCHES }
 
enum  diff_mode { DIFF_MODE_NONE, DIFF_MODE_RECTANGLE, NB_DIFF_MODE }
 

Functions

 AVFILTER_DEFINE_CLASS (paletteuse)
 
static int load_apply_palette (FFFrameSync *fs)
 
static int query_formats (AVFilterContext *ctx)
 
static av_always_inline uint32_t dither_color (uint32_t px, int er, int eg, int eb, int scale, int shift)
 
static av_always_inline int diff (const uint8_t *c1, const uint8_t *c2, const PaletteUseContext *s)
 
static av_always_inline uint8_t colormap_nearest_bruteforce (const PaletteUseContext *s, const uint8_t *argb)
 
static void colormap_nearest_node (const PaletteUseContext *s, const struct color_node *map, const int node_pos, const uint8_t *target, struct nearest_color *nearest)
 
static av_always_inline uint8_t colormap_nearest_recursive (const PaletteUseContext *s, const struct color_node *node, const uint8_t *rgb)
 
static av_always_inline uint8_t colormap_nearest_iterative (const PaletteUseContext *s, const struct color_node *root, const uint8_t *target)
 
static av_always_inline int color_get (PaletteUseContext *s, uint32_t color, uint8_t a, uint8_t r, uint8_t g, uint8_t b, const enum color_search_method search_method)
 Check if the requested color is in the cache already. More...
 
static av_always_inline int get_dst_color_err (PaletteUseContext *s, uint32_t c, int *ea, int *er, int *eg, int *eb, const enum color_search_method search_method)
 
static av_always_inline int set_frame (PaletteUseContext *s, AVFrame *out, AVFrame *in, int x_start, int y_start, int w, int h, enum dithering_mode dither, const enum color_search_method search_method)
 
static void disp_node (AVBPrint *buf, const struct color_node *map, int parent_id, int node_id, int depth)
 
static int disp_tree (const struct color_node *node, const char *fname)
 
static int debug_accuracy (const PaletteUseContext *s)
 
static int get_next_color (const uint8_t *color_used, const PaletteUseContext *s, int *component, const struct color_rect *box)
 
static int colormap_insert (struct color_node *map, uint8_t *color_used, int *nb_used, const PaletteUseContext *s, const struct color_rect *box)
 
static int cmp_pal_entry (const void *a, const void *b)
 
static int cmp_pal_entry_alpha (const void *a, const void *b)
 
static void load_colormap (PaletteUseContext *s)
 
static void debug_mean_error (PaletteUseContext *s, const AVFrame *in1, const AVFrame *in2, int frame_count)
 
static void set_processing_window (enum diff_mode diff_mode, const AVFrame *prv_src, const AVFrame *cur_src, const AVFrame *prv_dst, AVFrame *cur_dst, int *xp, int *yp, int *wp, int *hp)
 
static int apply_palette (AVFilterLink *inlink, AVFrame *in, AVFrame **outf)
 
static int config_output (AVFilterLink *outlink)
 
static int config_input_palette (AVFilterLink *inlink)
 
static void load_palette (PaletteUseContext *s, const AVFrame *palette_frame)
 
static int dither_value (int p)
 
static av_cold int init (AVFilterContext *ctx)
 
static int activate (AVFilterContext *ctx)
 
static av_cold void uninit (AVFilterContext *ctx)
 

Variables

static const AVOption paletteuse_options []
 
static const cmp_func cmp_funcs [] = {cmp_a, cmp_r, cmp_g, cmp_b}
 
static const set_frame_func set_frame_lut [NB_COLOR_SEARCHES][NB_DITHERING]
 
static const AVFilterPad paletteuse_inputs []
 
static const AVFilterPad paletteuse_outputs []
 
const AVFilter ff_vf_paletteuse
 

Detailed Description

Use a palette to downsample an input video stream.

Definition in file vf_paletteuse.c.

Macro Definition Documentation

◆ NBITS

#define NBITS   5

Definition at line 64 of file vf_paletteuse.c.

◆ CACHE_SIZE

#define CACHE_SIZE   (1<<(4*NBITS))

Definition at line 65 of file vf_paletteuse.c.

◆ OFFSET

#define OFFSET (   x)    offsetof(PaletteUseContext, x)

Definition at line 109 of file vf_paletteuse.c.

◆ FLAGS

Definition at line 110 of file vf_paletteuse.c.

◆ COLORMAP_NEAREST

#define COLORMAP_NEAREST (   s,
  search,
  root,
  target 
)

◆ INDENT

#define INDENT   4

Definition at line 507 of file vf_paletteuse.c.

◆ DECLARE_CMP_FUNC

#define DECLARE_CMP_FUNC (   name,
  pos 
)
Value:
static int cmp_##name(const void *pa, const void *pb) \
{ \
const struct color *a = pa; \
const struct color *b = pb; \
return (int)(a->value >> (8 * (3 - (pos))) & 0xff) \
- (int)(b->value >> (8 * (3 - (pos))) & 0xff); \
}

Definition at line 611 of file vf_paletteuse.c.

◆ DEFINE_SET_FRAME

#define DEFINE_SET_FRAME (   color_search,
  name,
  value 
)
Value:
static int set_frame_##name(PaletteUseContext *s, AVFrame *out, AVFrame *in, \
int x_start, int y_start, int w, int h) \
{ \
return set_frame(s, out, in, x_start, y_start, w, h, value, color_search); \
}

Definition at line 1065 of file vf_paletteuse.c.

◆ DEFINE_SET_FRAME_COLOR_SEARCH

#define DEFINE_SET_FRAME_COLOR_SEARCH (   color_search,
  color_search_macro 
)
Value:
DEFINE_SET_FRAME(color_search_macro, color_search##_##none, DITHERING_NONE) \
DEFINE_SET_FRAME(color_search_macro, color_search##_##bayer, DITHERING_BAYER) \
DEFINE_SET_FRAME(color_search_macro, color_search##_##heckbert, DITHERING_HECKBERT) \
DEFINE_SET_FRAME(color_search_macro, color_search##_##floyd_steinberg, DITHERING_FLOYD_STEINBERG) \
DEFINE_SET_FRAME(color_search_macro, color_search##_##sierra2, DITHERING_SIERRA2) \
DEFINE_SET_FRAME(color_search_macro, color_search##_##sierra2_4a, DITHERING_SIERRA2_4A) \

Definition at line 1072 of file vf_paletteuse.c.

◆ DITHERING_ENTRIES

#define DITHERING_ENTRIES (   color_search)
Value:
{ \
set_frame_##color_search##_none, \
set_frame_##color_search##_bayer, \
set_frame_##color_search##_heckbert, \
set_frame_##color_search##_floyd_steinberg, \
set_frame_##color_search##_sierra2, \
set_frame_##color_search##_sierra2_4a, \
}

Definition at line 1084 of file vf_paletteuse.c.

Typedef Documentation

◆ set_frame_func

typedef int(* set_frame_func) (struct PaletteUseContext *s, AVFrame *out, AVFrame *in, int x_start, int y_start, int width, int height)

Definition at line 79 of file vf_paletteuse.c.

◆ cmp_func

typedef int(* cmp_func) (const void *, const void *)

Definition at line 609 of file vf_paletteuse.c.

Enumeration Type Documentation

◆ dithering_mode

Enumerator
DITHERING_NONE 
DITHERING_BAYER 
DITHERING_HECKBERT 
DITHERING_FLOYD_STEINBERG 
DITHERING_SIERRA2 
DITHERING_SIERRA2_4A 
NB_DITHERING 

Definition at line 34 of file vf_paletteuse.c.

◆ color_search_method

Enumerator
COLOR_SEARCH_NNS_ITERATIVE 
COLOR_SEARCH_NNS_RECURSIVE 
COLOR_SEARCH_BRUTEFORCE 
NB_COLOR_SEARCHES 

Definition at line 44 of file vf_paletteuse.c.

◆ diff_mode

enum diff_mode
Enumerator
DIFF_MODE_NONE 
DIFF_MODE_RECTANGLE 
NB_DIFF_MODE 

Definition at line 51 of file vf_paletteuse.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( paletteuse  )

◆ load_apply_palette()

static int load_apply_palette ( FFFrameSync fs)
static

Definition at line 1039 of file vf_paletteuse.c.

Referenced by config_output().

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 140 of file vf_paletteuse.c.

◆ dither_color()

static av_always_inline uint32_t dither_color ( uint32_t  px,
int  er,
int  eg,
int  eb,
int  scale,
int  shift 
)
static

Definition at line 156 of file vf_paletteuse.c.

Referenced by set_frame().

◆ diff()

static av_always_inline int diff ( const uint8_t *  c1,
const uint8_t *  c2,
const PaletteUseContext s 
)
static

◆ colormap_nearest_bruteforce()

static av_always_inline uint8_t colormap_nearest_bruteforce ( const PaletteUseContext s,
const uint8_t *  argb 
)
static

Definition at line 185 of file vf_paletteuse.c.

Referenced by debug_accuracy().

◆ colormap_nearest_node()

static void colormap_nearest_node ( const PaletteUseContext s,
const struct color_node map,
const int  node_pos,
const uint8_t *  target,
struct nearest_color nearest 
)
static

Definition at line 215 of file vf_paletteuse.c.

Referenced by colormap_nearest_recursive().

◆ colormap_nearest_recursive()

static av_always_inline uint8_t colormap_nearest_recursive ( const PaletteUseContext s,
const struct color_node node,
const uint8_t *  rgb 
)
static

Definition at line 246 of file vf_paletteuse.c.

◆ colormap_nearest_iterative()

static av_always_inline uint8_t colormap_nearest_iterative ( const PaletteUseContext s,
const struct color_node root,
const uint8_t *  target 
)
static

Definition at line 258 of file vf_paletteuse.c.

◆ color_get()

static av_always_inline int color_get ( PaletteUseContext s,
uint32_t  color,
uint8_t  a,
uint8_t  r,
uint8_t  g,
uint8_t  b,
const enum color_search_method  search_method 
)
static

Check if the requested color is in the cache already.

If not, find it in the color tree and cache it. Note: a, r, g, and b are the components of color, but are passed as well to avoid recomputing them (they are generally computed by the caller for other uses).

Definition at line 341 of file vf_paletteuse.c.

Referenced by get_dst_color_err(), and set_frame().

◆ get_dst_color_err()

static av_always_inline int get_dst_color_err ( PaletteUseContext s,
uint32_t  c,
int ea,
int er,
int eg,
int eb,
const enum color_search_method  search_method 
)
static

Definition at line 375 of file vf_paletteuse.c.

Referenced by set_frame().

◆ set_frame()

static av_always_inline int set_frame ( PaletteUseContext s,
AVFrame out,
AVFrame in,
int  x_start,
int  y_start,
int  w,
int  h,
enum dithering_mode  dither,
const enum color_search_method  search_method 
)
static

Definition at line 399 of file vf_paletteuse.c.

◆ disp_node()

static void disp_node ( AVBPrint *  buf,
const struct color_node map,
int  parent_id,
int  node_id,
int  depth 
)
static

Definition at line 508 of file vf_paletteuse.c.

Referenced by disp_tree().

◆ disp_tree()

static int disp_tree ( const struct color_node node,
const char *  fname 
)
static

Definition at line 537 of file vf_paletteuse.c.

Referenced by load_colormap().

◆ debug_accuracy()

static int debug_accuracy ( const PaletteUseContext s)
static

Definition at line 562 of file vf_paletteuse.c.

Referenced by load_colormap().

◆ get_next_color()

static int get_next_color ( const uint8_t *  color_used,
const PaletteUseContext s,
int component,
const struct color_rect box 
)
static

Definition at line 627 of file vf_paletteuse.c.

Referenced by colormap_insert().

◆ colormap_insert()

static int colormap_insert ( struct color_node map,
uint8_t *  color_used,
int nb_used,
const PaletteUseContext s,
const struct color_rect box 
)
static

Definition at line 704 of file vf_paletteuse.c.

Referenced by load_colormap().

◆ cmp_pal_entry()

static int cmp_pal_entry ( const void *  a,
const void *  b 
)
static

Definition at line 749 of file vf_paletteuse.c.

Referenced by load_colormap().

◆ cmp_pal_entry_alpha()

static int cmp_pal_entry_alpha ( const void *  a,
const void *  b 
)
static

Definition at line 756 of file vf_paletteuse.c.

Referenced by load_colormap().

◆ load_colormap()

static void load_colormap ( PaletteUseContext s)
static

Definition at line 763 of file vf_paletteuse.c.

Referenced by load_palette().

◆ debug_mean_error()

static void debug_mean_error ( PaletteUseContext s,
const AVFrame in1,
const AVFrame in2,
int  frame_count 
)
static

Definition at line 805 of file vf_paletteuse.c.

Referenced by apply_palette().

◆ set_processing_window()

static void set_processing_window ( enum diff_mode  diff_mode,
const AVFrame prv_src,
const AVFrame cur_src,
const AVFrame prv_dst,
AVFrame cur_dst,
int xp,
int yp,
int wp,
int hp 
)
static

Definition at line 837 of file vf_paletteuse.c.

Referenced by apply_palette().

◆ apply_palette()

static int apply_palette ( AVFilterLink inlink,
AVFrame in,
AVFrame **  outf 
)
static

Definition at line 926 of file vf_paletteuse.c.

Referenced by load_apply_palette().

◆ config_output()

static int config_output ( AVFilterLink outlink)
static

Definition at line 968 of file vf_paletteuse.c.

◆ config_input_palette()

static int config_input_palette ( AVFilterLink inlink)
static

Definition at line 990 of file vf_paletteuse.c.

◆ load_palette()

static void load_palette ( PaletteUseContext s,
const AVFrame palette_frame 
)
static

Definition at line 1005 of file vf_paletteuse.c.

Referenced by load_apply_palette().

◆ dither_value()

static int dither_value ( int  p)
static

Definition at line 1099 of file vf_paletteuse.c.

Referenced by init().

◆ init()

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 1107 of file vf_paletteuse.c.

◆ activate()

static int activate ( AVFilterContext ctx)
static

Definition at line 1129 of file vf_paletteuse.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 1135 of file vf_paletteuse.c.

Variable Documentation

◆ paletteuse_options

const AVOption paletteuse_options[]
static
Initial value:
= {
{ "dither", "select dithering mode", OFFSET(dither), AV_OPT_TYPE_INT, {.i64=DITHERING_SIERRA2_4A}, 0, NB_DITHERING-1, FLAGS, "dithering_mode" },
{ "bayer", "ordered 8x8 bayer dithering (deterministic)", 0, AV_OPT_TYPE_CONST, {.i64=DITHERING_BAYER}, INT_MIN, INT_MAX, FLAGS, "dithering_mode" },
{ "heckbert", "dithering as defined by Paul Heckbert in 1982 (simple error diffusion)", 0, AV_OPT_TYPE_CONST, {.i64=DITHERING_HECKBERT}, INT_MIN, INT_MAX, FLAGS, "dithering_mode" },
{ "floyd_steinberg", "Floyd and Steingberg dithering (error diffusion)", 0, AV_OPT_TYPE_CONST, {.i64=DITHERING_FLOYD_STEINBERG}, INT_MIN, INT_MAX, FLAGS, "dithering_mode" },
{ "sierra2", "Frankie Sierra dithering v2 (error diffusion)", 0, AV_OPT_TYPE_CONST, {.i64=DITHERING_SIERRA2}, INT_MIN, INT_MAX, FLAGS, "dithering_mode" },
{ "sierra2_4a", "Frankie Sierra dithering v2 \"Lite\" (error diffusion)", 0, AV_OPT_TYPE_CONST, {.i64=DITHERING_SIERRA2_4A}, INT_MIN, INT_MAX, FLAGS, "dithering_mode" },
{ "bayer_scale", "set scale for bayer dithering", OFFSET(bayer_scale), AV_OPT_TYPE_INT, {.i64=2}, 0, 5, FLAGS },
{ "diff_mode", "set frame difference mode", OFFSET(diff_mode), AV_OPT_TYPE_INT, {.i64=DIFF_MODE_NONE}, 0, NB_DIFF_MODE-1, FLAGS, "diff_mode" },
{ "rectangle", "process smallest different rectangle", 0, AV_OPT_TYPE_CONST, {.i64=DIFF_MODE_RECTANGLE}, INT_MIN, INT_MAX, FLAGS, "diff_mode" },
{ "new", "take new palette for each output frame", OFFSET(new), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS },
{ "alpha_threshold", "set the alpha threshold for transparency", OFFSET(trans_thresh), AV_OPT_TYPE_INT, {.i64=128}, 0, 255, FLAGS },
{ "use_alpha", "use alpha channel for mapping", OFFSET(use_alpha), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS },
{ "debug_kdtree", "save Graphviz graph of the kdtree in specified file", OFFSET(dot_filename), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS },
{ "color_search", "set reverse colormap color search method", OFFSET(color_search_method), AV_OPT_TYPE_INT, {.i64=COLOR_SEARCH_NNS_ITERATIVE}, 0, NB_COLOR_SEARCHES-1, FLAGS, "search" },
{ "nns_iterative", "iterative search", 0, AV_OPT_TYPE_CONST, {.i64=COLOR_SEARCH_NNS_ITERATIVE}, INT_MIN, INT_MAX, FLAGS, "search" },
{ "nns_recursive", "recursive search", 0, AV_OPT_TYPE_CONST, {.i64=COLOR_SEARCH_NNS_RECURSIVE}, INT_MIN, INT_MAX, FLAGS, "search" },
{ "bruteforce", "brute-force into the palette", 0, AV_OPT_TYPE_CONST, {.i64=COLOR_SEARCH_BRUTEFORCE}, INT_MIN, INT_MAX, FLAGS, "search" },
{ "mean_err", "compute and print mean error", OFFSET(calc_mean_err), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS },
{ "debug_accuracy", "test color search accuracy", OFFSET(debug_accuracy), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS },
{ NULL }
}

Definition at line 111 of file vf_paletteuse.c.

◆ cmp_funcs

const cmp_func cmp_funcs[] = {cmp_a, cmp_r, cmp_g, cmp_b}
static

Definition at line 625 of file vf_paletteuse.c.

Referenced by get_next_color().

◆ set_frame_lut

const set_frame_func set_frame_lut[NB_COLOR_SEARCHES][NB_DITHERING]
static
Initial value:
= {
DITHERING_ENTRIES(nns_iterative),
DITHERING_ENTRIES(nns_recursive),
DITHERING_ENTRIES(bruteforce),
}

Definition at line 1093 of file vf_paletteuse.c.

Referenced by init().

◆ paletteuse_inputs

const AVFilterPad paletteuse_inputs[]
static
Initial value:
= {
{
.name = "default",
},{
.name = "palette",
.config_props = config_input_palette,
},
}

Definition at line 1147 of file vf_paletteuse.c.

◆ paletteuse_outputs

const AVFilterPad paletteuse_outputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_output,
},
}

Definition at line 1158 of file vf_paletteuse.c.

◆ ff_vf_paletteuse

const AVFilter ff_vf_paletteuse
Initial value:
= {
.name = "paletteuse",
.description = NULL_IF_CONFIG_SMALL("Use a palette to downsample an input video stream."),
.priv_size = sizeof(PaletteUseContext),
.init = init,
.priv_class = &paletteuse_class,
}

Definition at line 1166 of file vf_paletteuse.c.

config_input_palette
static int config_input_palette(AVFilterLink *inlink)
Definition: vf_paletteuse.c:990
name
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
Definition: writing_filters.txt:88
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: vf_paletteuse.c:140
out
FILE * out
Definition: movenc.c:54
color
Definition: vf_paletteuse.c:599
init
static av_cold int init(AVFilterContext *ctx)
Definition: vf_paletteuse.c:1107
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:317
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_paletteuse.c:1135
w
uint8_t w
Definition: llviddspenc.c:38
b
#define b
Definition: input.c:40
FILTER_QUERY_FUNC
#define FILTER_QUERY_FUNC(func)
Definition: internal.h:168
DIFF_MODE_NONE
@ DIFF_MODE_NONE
Definition: vf_paletteuse.c:52
NB_DITHERING
@ NB_DITHERING
Definition: vf_paletteuse.c:41
COLOR_SEARCH_BRUTEFORCE
@ COLOR_SEARCH_BRUTEFORCE
Definition: vf_paletteuse.c:47
colormap_nearest_bruteforce
static av_always_inline uint8_t colormap_nearest_bruteforce(const PaletteUseContext *s, const uint8_t *argb)
Definition: vf_paletteuse.c:185
s
#define s(width, name)
Definition: cbs_vp9.c:257
config_output
static int config_output(AVFilterLink *outlink)
Definition: vf_paletteuse.c:968
DITHERING_HECKBERT
@ DITHERING_HECKBERT
Definition: vf_paletteuse.c:37
DEFINE_SET_FRAME
#define DEFINE_SET_FRAME(color_search, name, value)
Definition: vf_paletteuse.c:1065
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:191
debug_accuracy
static int debug_accuracy(const PaletteUseContext *s)
Definition: vf_paletteuse.c:562
NULL
#define NULL
Definition: coverity.c:32
DITHERING_ENTRIES
#define DITHERING_ENTRIES(color_search)
Definition: vf_paletteuse.c:1084
PaletteUseContext
Definition: vf_paletteuse.c:82
DITHERING_NONE
@ DITHERING_NONE
Definition: vf_paletteuse.c:35
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:117
DITHERING_BAYER
@ DITHERING_BAYER
Definition: vf_paletteuse.c:36
DITHERING_FLOYD_STEINBERG
@ DITHERING_FLOYD_STEINBERG
Definition: vf_paletteuse.c:38
DITHERING_SIERRA2
@ DITHERING_SIERRA2
Definition: vf_paletteuse.c:39
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
DITHERING_SIERRA2_4A
@ DITHERING_SIERRA2_4A
Definition: vf_paletteuse.c:40
activate
static int activate(AVFilterContext *ctx)
Definition: vf_paletteuse.c:1129
OFFSET
#define OFFSET(x)
Definition: vf_paletteuse.c:109
value
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default value
Definition: writing_filters.txt:86
diff_mode
diff_mode
Definition: vf_paletteuse.c:51
FLAGS
#define FLAGS
Definition: vf_paletteuse.c:110
search
static float search(FOCContext *foc, int pass, int maxpass, int xmin, int xmax, int ymin, int ymax, int *best_x, int *best_y, float best_score)
Definition: vf_find_rect.c:146
pos
unsigned int pos
Definition: spdifenc.c:412
set_frame
static av_always_inline int set_frame(PaletteUseContext *s, AVFrame *out, AVFrame *in, int x_start, int y_start, int w, int h, enum dithering_mode dither, const enum color_search_method search_method)
Definition: vf_paletteuse.c:399
colormap_nearest_iterative
static av_always_inline uint8_t colormap_nearest_iterative(const PaletteUseContext *s, const struct color_node *root, const uint8_t *target)
Definition: vf_paletteuse.c:258
DIFF_MODE_RECTANGLE
@ DIFF_MODE_RECTANGLE
Definition: vf_paletteuse.c:53
COLOR_SEARCH_NNS_ITERATIVE
@ COLOR_SEARCH_NNS_ITERATIVE
Definition: vf_paletteuse.c:45
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:224
COLOR_SEARCH_NNS_RECURSIVE
@ COLOR_SEARCH_NNS_RECURSIVE
Definition: vf_paletteuse.c:46
colormap_nearest_recursive
static av_always_inline uint8_t colormap_nearest_recursive(const PaletteUseContext *s, const struct color_node *node, const uint8_t *rgb)
Definition: vf_paletteuse.c:246
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
_
#define _
NB_COLOR_SEARCHES
@ NB_COLOR_SEARCHES
Definition: vf_paletteuse.c:48
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:241
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:192
paletteuse_outputs
static const AVFilterPad paletteuse_outputs[]
Definition: vf_paletteuse.c:1158
h
h
Definition: vp9dsp_template.c:2038
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:228
int
int
Definition: ffmpeg_filter.c:153
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:233
paletteuse_inputs
static const AVFilterPad paletteuse_inputs[]
Definition: vf_paletteuse.c:1147
color_search_method
color_search_method
Definition: vf_paletteuse.c:44
NB_DIFF_MODE
@ NB_DIFF_MODE
Definition: vf_paletteuse.c:54
dither
static const uint8_t dither[8][8]
Definition: vf_fspp.c:58