OpenFFmpeg
vf_overlay.h
1 /*
2  * This file is part of FFmpeg.
3  *
4  * FFmpeg is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * FFmpeg is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with FFmpeg; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 #ifndef AVFILTER_OVERLAY_H
20 #define AVFILTER_OVERLAY_H
21 
22 #include "libavutil/eval.h"
23 #include "libavutil/pixdesc.h"
24 #include "framesync.h"
25 #include "avfilter.h"
26 
27 enum var_name {
28  VAR_MAIN_W, VAR_MW,
29  VAR_MAIN_H, VAR_MH,
30  VAR_OVERLAY_W, VAR_OW,
31  VAR_OVERLAY_H, VAR_OH,
32  VAR_HSUB,
33  VAR_VSUB,
34  VAR_X,
35  VAR_Y,
36  VAR_N,
37  VAR_POS,
38  VAR_T,
39  VAR_VARS_NB
40 };
41 
42 enum OverlayFormat {
43  OVERLAY_FORMAT_YUV420,
44  OVERLAY_FORMAT_YUV422,
45  OVERLAY_FORMAT_YUV444,
46  OVERLAY_FORMAT_RGB,
47  OVERLAY_FORMAT_GBRP,
48  OVERLAY_FORMAT_AUTO,
49  OVERLAY_FORMAT_NB
50 };
51 
52 typedef struct OverlayContext {
53  const AVClass *class;
54  int x, y;
55 
56  uint8_t main_is_packed_rgb;
57  uint8_t main_rgba_map[4];
58  uint8_t main_has_alpha;
59  uint8_t overlay_is_packed_rgb;
60  uint8_t overlay_rgba_map[4];
61  uint8_t overlay_has_alpha;
62  int format;
63  int alpha_format;
64  int eval_mode;
65 
66  FFFrameSync fs;
67 
68  int main_pix_step[4];
70  int hsub, vsub;
72 
73  double var_values[VAR_VARS_NB];
74  char *x_expr, *y_expr;
75 
76  AVExpr *x_pexpr, *y_pexpr;
77 
78  int (*blend_row[4])(uint8_t *d, uint8_t *da, uint8_t *s, uint8_t *a, int w,
79  ptrdiff_t alinesize);
80  int (*blend_slice)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs);
82 
83 void ff_overlay_init_x86(OverlayContext *s, int format, int pix_format,
84  int alpha_format, int main_has_alpha);
85 
86 #endif /* AVFILTER_OVERLAY_H */
Main libavfilter public API header.
const AVPixFmtDescriptor * main_desc
format descriptor for main input
Definition: vf_overlay.h:71
Definition: eval.c:157
Definition: vf_overlay.h:52
int eval_mode
EvalMode.
Definition: vf_overlay.h:64
int format
OverlayFormat.
Definition: vf_overlay.h:62
Frame sync structure.
Definition: framesync.h:146
int main_pix_step[4]
steps per pixel for each plane of the main output
Definition: vf_overlay.h:68
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:81
int y
position of overlaid picture
Definition: vf_overlay.h:54
Describe the class of an AVClass context structure.
Definition: log.h:67
int overlay_pix_step[4]
steps per pixel for each plane of the overlay
Definition: vf_overlay.h:69
int vsub
chroma subsampling values
Definition: vf_overlay.h:70
An instance of a filter.
Definition: avfilter.h:338
simple arithmetic expression evaluator