36 unsigned char yuv_color[4];
43 char color_str[1024] =
"black";
44 uint8_t rgba_color[4];
46 drawbox->
x = drawbox->
y = drawbox->
w = drawbox->
h = 0;
49 sscanf(args,
"%d:%d:%d:%d:%s",
50 &drawbox->
x, &drawbox->
y, &drawbox->
w, &drawbox->
h, color_str);
84 if (drawbox->
w == 0) drawbox->
w = inlink->
w;
85 if (drawbox->
h == 0) drawbox->
h = inlink->
h;
88 drawbox->
w, drawbox->
y, drawbox->
w, drawbox->
h,
97 int plane, x, y, xb = drawbox->
x, yb = drawbox->
y;
98 unsigned char *row[4];
101 for (y =
FFMAX(yb, y0); y < (y0 + h) && y < (yb + drawbox->
h); y++) {
104 for (plane = 1; plane < 3; plane++)
105 row[plane] = picref->
data[plane] +
108 for (x =
FFMAX(xb, 0); x < (xb + drawbox->
w) && x < picref->video->w; x++) {
109 double alpha = (double)drawbox->
yuv_color[
A] / 255;
111 if ((y - yb < 3) || (yb + drawbox->
h - y < 4) ||
112 (x - xb < 3) || (xb + drawbox->
w - x < 4)) {
113 row[0][x ] = (1 - alpha) * row[0][x ] + alpha * drawbox->
yuv_color[
Y];
114 row[1][x >> drawbox->
hsub] = (1 - alpha) * row[1][x >> drawbox->
hsub] + alpha * drawbox->
yuv_color[
U];
115 row[2][x >> drawbox->
hsub] = (1 - alpha) * row[2][x >> drawbox->
hsub] + alpha * drawbox->
yuv_color[
V];
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
int linesize[8]
number of bytes per line
int h
agreed upon image height
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV422P and setting color_...
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Various defines for YUV<->RGB conversion.
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
#define AV_PERM_READ
can read from the buffer
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV444P and setting color_...
void avfilter_null_end_frame(AVFilterLink *link)
end_frame() handler for filters which simply pass video along
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
static int query_formats(AVFilterContext *ctx)
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV420P and setting color_...
int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen, void *log_ctx)
Put the RGBA values that correspond to color_string in rgba_color.
A filter pad used for either input or output.
A link between two filters.
static int config_input(AVFilterLink *inlink)
void avfilter_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats)
A helper for query_formats() which sets all links to the same list of formats.
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void * priv
private data for use by the filter
void av_log(void *avcl, int level, const char *fmt,...)
AVFilterFormats * avfilter_make_format_list(const int *fmts)
Create a list of supported formats.
const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB]
The array of all the pixel format descriptors.
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
int w
agreed upon image width
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of PIX_FMT_YUV440P and setting color_range ...
void avfilter_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
Send a slice to the next filter.
int format
agreed upon media format
A reference to an AVFilterBuffer.
static void drawbox(AVFilterBufferRef *picref, unsigned int x, unsigned int y, unsigned int width, unsigned int height, uint8_t *line[4], int pixel_step[4], uint8_t color[4], int hsub, int vsub, int is_rgba_packed, uint8_t rgba_map[4])
static void draw_slice(AVFilterLink *inlink, int y0, int h, int slice_dir)
int hsub
chroma subsampling
AVFilter avfilter_vf_drawbox
void avfilter_null_start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
start_frame() handler for filters which simply pass video along
const char * name
filter name
AVFilterBufferRef * avfilter_null_get_video_buffer(AVFilterLink *link, int perms, int w, int h)
get_video_buffer() handler for filters which simply pass video along
AVFilterLink ** outputs
array of pointers to output links
#define RGB_TO_U_CCIR(r1, g1, b1, shift)
#define AV_PERM_PRESERVE
nobody else can overwrite the buffer
#define RGB_TO_V_CCIR(r1, g1, b1, shift)
#define AV_PERM_WRITE
can write to the buffer
#define RGB_TO_Y_CCIR(r, g, b)
AVFilterContext * dst
dest filter
uint8_t * data[8]
picture/audio data for each plane
AVFilterBufferRef * cur_buf
unsigned char yuv_color[4]