FFmpeg
Loading...
Searching...
No Matches
vf_colordetectdsp.h File Reference
#include <stddef.h>
#include <stdint.h>
#include "config.h"
#include "libavutil/attributes.h"
#include "libavutil/avassert.h"
#include "libavutil/pixfmt.h"

Go to the source code of this file.

Data Structures

struct  FFColorDetectDSPContext
 

Macros

#define DECL_DETECT_RANGE_IMPL(TYPE, NAME)
 
#define DECL_DETECT_ALPHA_FULL_IMPL(TYPE, INTER, NAME)
 
#define DECL_DETECT_ALPHA_LIMITED_IMPL(TYPE, INTER, NAME)
 

Enumerations

enum  FFAlphaDetect { FF_ALPHA_NONE = -1 , FF_ALPHA_UNDETERMINED = 0 , FF_ALPHA_TRANSPARENT = 1 << 0 , FF_ALPHA_STRAIGHT = (1 << 1) | FF_ALPHA_TRANSPARENT }
 

Functions

void ff_color_detect_dsp_init_aarch64 (FFColorDetectDSPContext *dsp, int depth, enum AVColorRange color_range)
 
void ff_color_detect_dsp_init_x86 (FFColorDetectDSPContext *dsp, int depth, int offset, enum AVColorRange color_range)
 
static av_cold void ff_color_detect_dsp_init (FFColorDetectDSPContext *dsp, int depth, int offset, enum AVColorRange color_range)
 

Macro Definition Documentation

◆ DECL_DETECT_RANGE_IMPL

#define DECL_DETECT_RANGE_IMPL ( TYPE,
NAME )
Value:
static inline int NAME(const uint8_t* data, ptrdiff_t stride, \
ptrdiff_t width, ptrdiff_t height, \
int mpeg_min, int mpeg_max) \
{ \
const TYPE min = mpeg_min; \
const TYPE max = mpeg_max; \
av_assume(min == mpeg_min); \
av_assume(max == mpeg_max); \
\
while (height--) { \
const TYPE *row = (const TYPE *) data; \
uint8_t cond = 0; \
for (int x = 0; x < width; x++) { \
const TYPE val = row[x]; \
} \
if (cond) \
return 1; \
data += stride; \
} \
\
return 0; \
}
static double val(void *priv, double ch)
Definition aeval.c:77
#define min(a, b)
#define max(a, b)
#define TYPE
Definition ffv1dec.c:90
const char data[16]
Definition mxf.c:149
int(* cond)(enum AVPixelFormat pix_fmt)
#define stride
#define height
Definition dsp.h:89
#define width
Definition dsp.h:89

Definition at line 57 of file vf_colordetectdsp.h.

◆ DECL_DETECT_ALPHA_FULL_IMPL

#define DECL_DETECT_ALPHA_FULL_IMPL ( TYPE,
INTER,
NAME )
Value:
static inline int NAME(const uint8_t* color, ptrdiff_t color_stride, \
const uint8_t* alpha, ptrdiff_t alpha_stride, \
ptrdiff_t width, ptrdiff_t height, int alpha_max, \
int mpeg_range, int offset) \
{ \
const TYPE max = alpha_max; \
const INTER off = offset; \
av_assume(max == alpha_max); \
av_assume(off == offset); \
(void) mpeg_range; \
\
uint8_t transparent = 0; \
while (height--) { \
const TYPE *col = (const TYPE *) color; \
const TYPE *alp = (const TYPE *) alpha; \
uint8_t straight = 0; \
for (int x = 0; x < width; x++) { \
straight |= col[x] > alp[x] + off; \
transparent |= alp[x] != max; \
} \
if (straight) \
color += color_stride; \
alpha += alpha_stride; \
} \
return transparent ? FF_ALPHA_TRANSPARENT : 0; \
}
static const int16_t alpha[]
Definition ilbcdata.h:55
unsigned offset
Definition libaomenc.c:763
@ FF_ALPHA_TRANSPARENT
alpha < alpha_max
@ FF_ALPHA_STRAIGHT
alpha < pixel

Definition at line 85 of file vf_colordetectdsp.h.

◆ DECL_DETECT_ALPHA_LIMITED_IMPL

#define DECL_DETECT_ALPHA_LIMITED_IMPL ( TYPE,
INTER,
NAME )
Value:
static inline int NAME(const uint8_t* color, ptrdiff_t color_stride, \
const uint8_t* alpha, ptrdiff_t alpha_stride, \
ptrdiff_t width, ptrdiff_t height, int alpha_max, \
int mpeg_range, int offset) \
{ \
const TYPE max = alpha_max; \
const INTER off = offset; \
const INTER range = mpeg_range; \
av_assume(max == alpha_max); \
av_assume(off == offset); \
av_assume(range == mpeg_range); \
\
uint8_t transparent = 0; \
while (height--) { \
const TYPE *col = (const TYPE *) color; \
const TYPE *alp = (const TYPE *) alpha; \
uint8_t straight = 0; \
for (int x = 0; x < width; x++) { \
straight |= (INTER) max * col[x] - off > range * alp[x]; \
transparent |= alp[x] != max; \
} \
if (straight) \
color += color_stride; \
alpha += alpha_stride; \
} \
return transparent ? FF_ALPHA_TRANSPARENT : 0; \
}
enum AVColorRange range

Definition at line 117 of file vf_colordetectdsp.h.

Enumeration Type Documentation

◆ FFAlphaDetect

Enumerator
FF_ALPHA_NONE 
FF_ALPHA_UNDETERMINED 
FF_ALPHA_TRANSPARENT 

alpha < alpha_max

FF_ALPHA_STRAIGHT 

alpha < pixel

Definition at line 31 of file vf_colordetectdsp.h.

Function Documentation

◆ ff_color_detect_dsp_init_aarch64()

void ff_color_detect_dsp_init_aarch64 ( FFColorDetectDSPContext * dsp,
int depth,
enum AVColorRange color_range )

Definition at line 52 of file vf_colordetect_init.c.

Referenced by ff_color_detect_dsp_init().

◆ ff_color_detect_dsp_init_x86()

void ff_color_detect_dsp_init_x86 ( FFColorDetectDSPContext * dsp,
int depth,
int offset,
enum AVColorRange color_range )

Definition at line 93 of file vf_colordetect_init.c.

Referenced by ff_color_detect_dsp_init().

◆ ff_color_detect_dsp_init()

static av_cold void ff_color_detect_dsp_init ( FFColorDetectDSPContext * dsp,
int depth,
int offset,
enum AVColorRange color_range )
inlinestatic

Definition at line 151 of file vf_colordetectdsp.h.

Referenced by check_alpha_detect(), check_range_detect(), and config_input().