vf_overlay.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. #ifndef AVFILTER_OVERLAY_H
  19. #define AVFILTER_OVERLAY_H
  20. #include "libavutil/eval.h"
  21. #include "libavutil/pixdesc.h"
  22. #include "framesync.h"
  23. #include "avfilter.h"
  24. enum var_name {
  25. VAR_MAIN_W, VAR_MW,
  26. VAR_MAIN_H, VAR_MH,
  27. VAR_OVERLAY_W, VAR_OW,
  28. VAR_OVERLAY_H, VAR_OH,
  29. VAR_HSUB,
  30. VAR_VSUB,
  31. VAR_X,
  32. VAR_Y,
  33. VAR_N,
  34. VAR_POS,
  35. VAR_T,
  36. VAR_VARS_NB
  37. };
  38. enum OverlayFormat {
  39. OVERLAY_FORMAT_YUV420,
  40. OVERLAY_FORMAT_YUV422,
  41. OVERLAY_FORMAT_YUV444,
  42. OVERLAY_FORMAT_RGB,
  43. OVERLAY_FORMAT_GBRP,
  44. OVERLAY_FORMAT_AUTO,
  45. OVERLAY_FORMAT_NB
  46. };
  47. typedef struct OverlayContext {
  48. const AVClass *class;
  49. int x, y; ///< position of overlaid picture
  50. uint8_t main_is_packed_rgb;
  51. uint8_t main_rgba_map[4];
  52. uint8_t main_has_alpha;
  53. uint8_t overlay_is_packed_rgb;
  54. uint8_t overlay_rgba_map[4];
  55. uint8_t overlay_has_alpha;
  56. int format; ///< OverlayFormat
  57. int alpha_format;
  58. int eval_mode; ///< EvalMode
  59. FFFrameSync fs;
  60. int main_pix_step[4]; ///< steps per pixel for each plane of the main output
  61. int overlay_pix_step[4]; ///< steps per pixel for each plane of the overlay
  62. int hsub, vsub; ///< chroma subsampling values
  63. const AVPixFmtDescriptor *main_desc; ///< format descriptor for main input
  64. double var_values[VAR_VARS_NB];
  65. char *x_expr, *y_expr;
  66. AVExpr *x_pexpr, *y_pexpr;
  67. int (*blend_row[4])(uint8_t *d, uint8_t *da, uint8_t *s, uint8_t *a, int w,
  68. ptrdiff_t alinesize);
  69. int (*blend_slice)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs);
  70. } OverlayContext;
  71. void ff_overlay_init_x86(OverlayContext *s, int format, int pix_format,
  72. int alpha_format, int main_has_alpha);
  73. #endif /* AVFILTER_OVERLAY_H */