yadif.h 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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_YADIF_H
  19. #define AVFILTER_YADIF_H
  20. #include "libavutil/opt.h"
  21. #include "libavutil/pixdesc.h"
  22. #include "avfilter.h"
  23. enum YADIFMode {
  24. YADIF_MODE_SEND_FRAME = 0, ///< send 1 frame for each frame
  25. YADIF_MODE_SEND_FIELD = 1, ///< send 1 frame for each field
  26. YADIF_MODE_SEND_FRAME_NOSPATIAL = 2, ///< send 1 frame for each frame but skips spatial interlacing check
  27. YADIF_MODE_SEND_FIELD_NOSPATIAL = 3, ///< send 1 frame for each field but skips spatial interlacing check
  28. };
  29. enum YADIFParity {
  30. YADIF_PARITY_TFF = 0, ///< top field first
  31. YADIF_PARITY_BFF = 1, ///< bottom field first
  32. YADIF_PARITY_AUTO = -1, ///< auto detection
  33. };
  34. enum YADIFDeint {
  35. YADIF_DEINT_ALL = 0, ///< deinterlace all frames
  36. YADIF_DEINT_INTERLACED = 1, ///< only deinterlace frames marked as interlaced
  37. };
  38. enum YADIFCurrentField {
  39. YADIF_FIELD_BACK_END = -1, ///< The last frame in a sequence
  40. YADIF_FIELD_END = 0, ///< The first or last field in a sequence
  41. YADIF_FIELD_NORMAL = 1, ///< A normal field in the middle of a sequence
  42. };
  43. typedef struct YADIFContext {
  44. const AVClass *class;
  45. int mode; ///< YADIFMode
  46. int parity; ///< YADIFParity
  47. int deint; ///< YADIFDeint
  48. int frame_pending;
  49. AVFrame *cur;
  50. AVFrame *next;
  51. AVFrame *prev;
  52. AVFrame *out;
  53. void (*filter)(AVFilterContext *ctx, AVFrame *dstpic, int parity, int tff);
  54. /**
  55. * Required alignment for filter_line
  56. */
  57. void (*filter_line)(void *dst,
  58. void *prev, void *cur, void *next,
  59. int w, int prefs, int mrefs, int parity, int mode);
  60. void (*filter_edges)(void *dst, void *prev, void *cur, void *next,
  61. int w, int prefs, int mrefs, int parity, int mode);
  62. const AVPixFmtDescriptor *csp;
  63. int eof;
  64. uint8_t *temp_line;
  65. int temp_line_size;
  66. /*
  67. * An algorithm that treats first and/or last fields in a sequence
  68. * differently can use this to detect those cases. It is the algorithm's
  69. * responsibility to set the value to YADIF_FIELD_NORMAL after processing
  70. * the first field.
  71. */
  72. int current_field; ///< YADIFCurrentField
  73. } YADIFContext;
  74. void ff_yadif_init_x86(YADIFContext *yadif);
  75. int ff_yadif_filter_frame(AVFilterLink *link, AVFrame *frame);
  76. int ff_yadif_request_frame(AVFilterLink *link);
  77. extern const AVOption ff_yadif_options[];
  78. #endif /* AVFILTER_YADIF_H */