motion_estimation.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /**
  2. * Copyright (c) 2016 Davinder Singh (DSM_) <ds.mudhar<@gmail.com>
  3. *
  4. * This file is part of FFmpeg.
  5. *
  6. * FFmpeg is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2.1 of the License, or (at your option) any later version.
  10. *
  11. * FFmpeg is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with FFmpeg; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  19. */
  20. #ifndef AVFILTER_MOTION_ESTIMATION_H
  21. #define AVFILTER_MOTION_ESTIMATION_H
  22. #include "libavutil/avutil.h"
  23. #define AV_ME_METHOD_ESA 1
  24. #define AV_ME_METHOD_TSS 2
  25. #define AV_ME_METHOD_TDLS 3
  26. #define AV_ME_METHOD_NTSS 4
  27. #define AV_ME_METHOD_FSS 5
  28. #define AV_ME_METHOD_DS 6
  29. #define AV_ME_METHOD_HEXBS 7
  30. #define AV_ME_METHOD_EPZS 8
  31. #define AV_ME_METHOD_UMH 9
  32. typedef struct AVMotionEstPredictor {
  33. int mvs[10][2];
  34. int nb;
  35. } AVMotionEstPredictor;
  36. typedef struct AVMotionEstContext {
  37. uint8_t *data_cur, *data_ref;
  38. int linesize;
  39. int mb_size;
  40. int search_param;
  41. int width;
  42. int height;
  43. int x_min;
  44. int x_max;
  45. int y_min;
  46. int y_max;
  47. int pred_x; ///< median predictor x
  48. int pred_y; ///< median predictor y
  49. AVMotionEstPredictor preds[2];
  50. uint64_t (*get_cost)(struct AVMotionEstContext *me_ctx, int x_mb, int y_mb,
  51. int mv_x, int mv_y);
  52. } AVMotionEstContext;
  53. void ff_me_init_context(AVMotionEstContext *me_ctx, int mb_size, int search_param,
  54. int width, int height, int x_min, int x_max, int y_min, int y_max);
  55. uint64_t ff_me_cmp_sad(AVMotionEstContext *me_ctx, int x_mb, int y_mb, int x_mv, int y_mv);
  56. uint64_t ff_me_search_esa(AVMotionEstContext *me_ctx, int x_mb, int y_mb, int *mv);
  57. uint64_t ff_me_search_tss(AVMotionEstContext *me_ctx, int x_mb, int y_mb, int *mv);
  58. uint64_t ff_me_search_tdls(AVMotionEstContext *me_ctx, int x_mb, int y_mb, int *mv);
  59. uint64_t ff_me_search_ntss(AVMotionEstContext *me_ctx, int x_mb, int y_mb, int *mv);
  60. uint64_t ff_me_search_fss(AVMotionEstContext *me_ctx, int x_mb, int y_mb, int *mv);
  61. uint64_t ff_me_search_ds(AVMotionEstContext *me_ctx, int x_mb, int y_mb, int *mv);
  62. uint64_t ff_me_search_hexbs(AVMotionEstContext *me_ctx, int x_mb, int y_mb, int *mv);
  63. uint64_t ff_me_search_epzs(AVMotionEstContext *me_ctx, int x_mb, int y_mb, int *mv);
  64. uint64_t ff_me_search_umh(AVMotionEstContext *me_ctx, int x_mb, int y_mb, int *mv);
  65. #endif /* AVFILTER_MOTION_ESTIMATION_H */