variance.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /*
  2. * Copyright (c) 2016, Alliance for Open Media. All rights reserved
  3. *
  4. * This source code is subject to the terms of the BSD 2 Clause License and
  5. * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
  6. * was not distributed with this source code in the LICENSE file, you can
  7. * obtain it at www.aomedia.org/license/software. If the Alliance for Open
  8. * Media Patent License 1.0 was not distributed with this source code in the
  9. * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
  10. */
  11. #ifndef AOM_AOM_DSP_VARIANCE_H_
  12. #define AOM_AOM_DSP_VARIANCE_H_
  13. #include "config/aom_config.h"
  14. #include "aom/aom_integer.h"
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. #define FILTER_BITS 7
  19. #define FILTER_WEIGHT 128
  20. typedef unsigned int (*aom_sad_fn_t)(const uint8_t *a, int a_stride,
  21. const uint8_t *b, int b_stride);
  22. typedef unsigned int (*aom_sad_avg_fn_t)(const uint8_t *a, int a_stride,
  23. const uint8_t *b, int b_stride,
  24. const uint8_t *second_pred);
  25. typedef void (*aom_copy32xn_fn_t)(const uint8_t *a, int a_stride, uint8_t *b,
  26. int b_stride, int n);
  27. typedef void (*aom_sad_multi_d_fn_t)(const uint8_t *a, int a_stride,
  28. const uint8_t *const b_array[],
  29. int b_stride, unsigned int *sad_array);
  30. typedef unsigned int (*aom_variance_fn_t)(const uint8_t *a, int a_stride,
  31. const uint8_t *b, int b_stride,
  32. unsigned int *sse);
  33. typedef unsigned int (*aom_subpixvariance_fn_t)(const uint8_t *a, int a_stride,
  34. int xoffset, int yoffset,
  35. const uint8_t *b, int b_stride,
  36. unsigned int *sse);
  37. typedef unsigned int (*aom_subp_avg_variance_fn_t)(
  38. const uint8_t *a, int a_stride, int xoffset, int yoffset, const uint8_t *b,
  39. int b_stride, unsigned int *sse, const uint8_t *second_pred);
  40. typedef unsigned int (*aom_dist_wtd_sad_avg_fn_t)(
  41. const uint8_t *a, int a_stride, const uint8_t *b, int b_stride,
  42. const uint8_t *second_pred, const DIST_WTD_COMP_PARAMS *jcp_param);
  43. typedef unsigned int (*aom_dist_wtd_subp_avg_variance_fn_t)(
  44. const uint8_t *a, int a_stride, int xoffset, int yoffset, const uint8_t *b,
  45. int b_stride, unsigned int *sse, const uint8_t *second_pred,
  46. const DIST_WTD_COMP_PARAMS *jcp_param);
  47. typedef unsigned int (*aom_masked_sad_fn_t)(const uint8_t *src, int src_stride,
  48. const uint8_t *ref, int ref_stride,
  49. const uint8_t *second_pred,
  50. const uint8_t *msk, int msk_stride,
  51. int invert_mask);
  52. typedef unsigned int (*aom_masked_subpixvariance_fn_t)(
  53. const uint8_t *src, int src_stride, int xoffset, int yoffset,
  54. const uint8_t *ref, int ref_stride, const uint8_t *second_pred,
  55. const uint8_t *msk, int msk_stride, int invert_mask, unsigned int *sse);
  56. typedef unsigned int (*aom_obmc_sad_fn_t)(const uint8_t *pred, int pred_stride,
  57. const int32_t *wsrc,
  58. const int32_t *msk);
  59. typedef unsigned int (*aom_obmc_variance_fn_t)(const uint8_t *pred,
  60. int pred_stride,
  61. const int32_t *wsrc,
  62. const int32_t *msk,
  63. unsigned int *sse);
  64. typedef unsigned int (*aom_obmc_subpixvariance_fn_t)(
  65. const uint8_t *pred, int pred_stride, int xoffset, int yoffset,
  66. const int32_t *wsrc, const int32_t *msk, unsigned int *sse);
  67. typedef struct aom_variance_vtable {
  68. aom_sad_fn_t sdf;
  69. // Same as normal sad, but downsample the rows by a factor of 2.
  70. aom_sad_fn_t sdsf;
  71. aom_sad_avg_fn_t sdaf;
  72. aom_variance_fn_t vf;
  73. aom_subpixvariance_fn_t svf;
  74. aom_subp_avg_variance_fn_t svaf;
  75. aom_sad_multi_d_fn_t sdx4df;
  76. aom_sad_multi_d_fn_t sdx3df;
  77. // Same as sadx4, but downsample the rows by a factor of 2.
  78. aom_sad_multi_d_fn_t sdsx4df;
  79. aom_masked_sad_fn_t msdf;
  80. aom_masked_subpixvariance_fn_t msvf;
  81. aom_obmc_sad_fn_t osdf;
  82. aom_obmc_variance_fn_t ovf;
  83. aom_obmc_subpixvariance_fn_t osvf;
  84. aom_dist_wtd_sad_avg_fn_t jsdaf;
  85. aom_dist_wtd_subp_avg_variance_fn_t jsvaf;
  86. } aom_variance_fn_ptr_t;
  87. void aom_highbd_var_filter_block2d_bil_first_pass(
  88. const uint8_t *src_ptr8, uint16_t *output_ptr,
  89. unsigned int src_pixels_per_line, int pixel_step,
  90. unsigned int output_height, unsigned int output_width,
  91. const uint8_t *filter);
  92. void aom_highbd_var_filter_block2d_bil_second_pass(
  93. const uint16_t *src_ptr, uint16_t *output_ptr,
  94. unsigned int src_pixels_per_line, unsigned int pixel_step,
  95. unsigned int output_height, unsigned int output_width,
  96. const uint8_t *filter);
  97. uint32_t aom_sse_odd_size(const uint8_t *a, int a_stride, const uint8_t *b,
  98. int b_stride, int w, int h);
  99. uint64_t aom_highbd_sse_odd_size(const uint8_t *a, int a_stride,
  100. const uint8_t *b, int b_stride, int w, int h);
  101. #ifdef __cplusplus
  102. } // extern "C"
  103. #endif
  104. #endif // AOM_AOM_DSP_VARIANCE_H_