framerate.h 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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_FRAMERATE_H
  19. #define AVFILTER_FRAMERATE_H
  20. #include "scene_sad.h"
  21. #include "avfilter.h"
  22. #define BLEND_FUNC_PARAMS const uint8_t *src1, ptrdiff_t src1_linesize, \
  23. const uint8_t *src2, ptrdiff_t src2_linesize, \
  24. uint8_t *dst, ptrdiff_t dst_linesize, \
  25. ptrdiff_t width, ptrdiff_t height, \
  26. int factor1, int factor2, int half
  27. #define BLEND_FACTOR_DEPTH8 7
  28. #define BLEND_FACTOR_DEPTH16 15
  29. typedef void (*blend_func)(BLEND_FUNC_PARAMS);
  30. typedef struct FrameRateContext {
  31. const AVClass *class;
  32. // parameters
  33. AVRational dest_frame_rate; ///< output frames per second
  34. int flags; ///< flags affecting frame rate conversion algorithm
  35. double scene_score; ///< score that denotes a scene change has happened
  36. int interp_start; ///< start of range to apply linear interpolation
  37. int interp_end; ///< end of range to apply linear interpolation
  38. int line_size[4]; ///< bytes of pixel data per line for each plane
  39. int vsub;
  40. AVRational srce_time_base; ///< timebase of source
  41. AVRational dest_time_base; ///< timebase of destination
  42. ff_scene_sad_fn sad; ///< Sum of the absolute difference function (scene detect only)
  43. double prev_mafd; ///< previous MAFD (scene detect only)
  44. int blend_factor_max;
  45. int bitdepth;
  46. AVFrame *work;
  47. AVFrame *f0; ///< last frame
  48. AVFrame *f1; ///< current frame
  49. int64_t pts0; ///< last frame pts in dest_time_base
  50. int64_t pts1; ///< current frame pts in dest_time_base
  51. int64_t delta; ///< pts1 to pts0 delta
  52. double score; ///< scene change score (f0 to f1)
  53. int flush; ///< 1 if the filter is being flushed
  54. int64_t start_pts; ///< pts of the first output frame
  55. int64_t n; ///< output frame counter
  56. blend_func blend;
  57. } FrameRateContext;
  58. void ff_framerate_init(FrameRateContext *s);
  59. void ff_framerate_init_x86(FrameRateContext *s);
  60. #endif /* AVFILTER_FRAMERATE_H */