40 unsigned char yuv_color[4];
47 char color_str[1024] =
"black";
50 drawbox->
x = drawbox->
y = drawbox->
w = drawbox->
h = 0;
53 sscanf(args,
"%d:%d:%d:%d:%s",
54 &drawbox->
x, &drawbox->
y, &drawbox->
w, &drawbox->
h, color_str);
89 if (drawbox->
w == 0) drawbox->
w = inlink->
w;
90 if (drawbox->
h == 0) drawbox->
h = inlink->
h;
93 drawbox->
w, drawbox->
y, drawbox->
w, drawbox->
h,
102 int plane, x, y, xb = drawbox->
x, yb = drawbox->
y;
103 unsigned char *row[4];
105 for (y =
FFMAX(yb, 0); y < frame->
video->
h && y < (yb + drawbox->
h); y++) {
108 for (plane = 1; plane < 3; plane++)
109 row[plane] = frame->
data[plane] +
112 for (x =
FFMAX(xb, 0); x < (xb + drawbox->
w) && x < frame->video->w; x++) {
113 double alpha = (double)drawbox->
yuv_color[
A] / 255;
115 if ((y - yb < 3) || (yb + drawbox->
h - y < 4) ||
116 (x - xb < 3) || (xb + drawbox->
w - x < 4)) {
117 row[0][x ] = (1 - alpha) * row[0][x ] + alpha * drawbox->
yuv_color[
Y];
118 row[1][x >> drawbox->
hsub] = (1 - alpha) * row[1][x >> drawbox->
hsub] + alpha * drawbox->
yuv_color[
U];
119 row[2][x >> drawbox->
hsub] = (1 - alpha) * row[2][x >> drawbox->
hsub] + alpha * drawbox->
yuv_color[
V];
155 .
inputs = avfilter_vf_drawbox_inputs,
156 .
outputs = avfilter_vf_drawbox_outputs,
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
AVFilterBufferRefVideoProps * video
video buffer specific properties
int linesize[8]
number of bytes per line
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
static const AVFilterPad outputs[]
int h
agreed upon image height
int ff_filter_frame(AVFilterLink *link, AVFilterBufferRef *frame)
Send a frame of data to the next filter.
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
const char * name
Pad name.
static int query_formats(AVFilterContext *ctx)
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of PIX_FMT_YUV440P and setting color_range ...
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV422P and setting color_...
static const AVFilterPad avfilter_vf_drawbox_outputs[]
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)
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *frame)
#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,...)
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
int w
agreed upon image width
static const AVFilterPad avfilter_vf_drawbox_inputs[]
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV420P and setting color_...
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])
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
int hsub
chroma subsampling
AVFilter avfilter_vf_drawbox
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
static const AVFilterPad inputs[]
const char * name
filter name
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)
static av_cold int init(AVFilterContext *ctx, const char *args)
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
common internal and external API header
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV444P and setting color_...
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
#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
unsigned char yuv_color[4]
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
AVFilterBufferRef * ff_null_get_video_buffer(AVFilterLink *link, int perms, int w, int h)
AVPixelFormat
Pixel format.
if(!(ptr_align%ac->ptr_align)&&samples_align >=aligned_len)