vp9_reconinter.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /*
  2. * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
  3. *
  4. * Use of this source code is governed by a BSD-style license
  5. * that can be found in the LICENSE file in the root of the source
  6. * tree. An additional intellectual property rights grant can be found
  7. * in the file PATENTS. All contributing project authors may
  8. * be found in the AUTHORS file in the root of the source tree.
  9. */
  10. #ifndef VP9_COMMON_VP9_RECONINTER_H_
  11. #define VP9_COMMON_VP9_RECONINTER_H_
  12. #include "vp9/common/vp9_filter.h"
  13. #include "vp9/common/vp9_onyxc_int.h"
  14. #include "vpx/vpx_integer.h"
  15. #include "vpx_dsp/vpx_filter.h"
  16. #ifdef __cplusplus
  17. extern "C" {
  18. #endif
  19. static INLINE void inter_predictor(const uint8_t *src, int src_stride,
  20. uint8_t *dst, int dst_stride,
  21. const int subpel_x,
  22. const int subpel_y,
  23. const struct scale_factors *sf,
  24. int w, int h, int ref,
  25. const InterpKernel *kernel,
  26. int xs, int ys) {
  27. sf->predict[subpel_x != 0][subpel_y != 0][ref](
  28. src, src_stride, dst, dst_stride,
  29. kernel[subpel_x], xs, kernel[subpel_y], ys, w, h);
  30. }
  31. #if CONFIG_VP9_HIGHBITDEPTH
  32. static INLINE void highbd_inter_predictor(const uint8_t *src, int src_stride,
  33. uint8_t *dst, int dst_stride,
  34. const int subpel_x,
  35. const int subpel_y,
  36. const struct scale_factors *sf,
  37. int w, int h, int ref,
  38. const InterpKernel *kernel,
  39. int xs, int ys, int bd) {
  40. sf->highbd_predict[subpel_x != 0][subpel_y != 0][ref](
  41. src, src_stride, dst, dst_stride,
  42. kernel[subpel_x], xs, kernel[subpel_y], ys, w, h, bd);
  43. }
  44. #endif // CONFIG_VP9_HIGHBITDEPTH
  45. MV average_split_mvs(const struct macroblockd_plane *pd, const MODE_INFO *mi,
  46. int ref, int block);
  47. MV clamp_mv_to_umv_border_sb(const MACROBLOCKD *xd, const MV *src_mv,
  48. int bw, int bh, int ss_x, int ss_y);
  49. void vp9_build_inter_predictors_sby(MACROBLOCKD *xd, int mi_row, int mi_col,
  50. BLOCK_SIZE bsize);
  51. void vp9_build_inter_predictors_sbp(MACROBLOCKD *xd, int mi_row, int mi_col,
  52. BLOCK_SIZE bsize, int plane);
  53. void vp9_build_inter_predictors_sbuv(MACROBLOCKD *xd, int mi_row, int mi_col,
  54. BLOCK_SIZE bsize);
  55. void vp9_build_inter_predictors_sb(MACROBLOCKD *xd, int mi_row, int mi_col,
  56. BLOCK_SIZE bsize);
  57. void vp9_build_inter_predictor(const uint8_t *src, int src_stride,
  58. uint8_t *dst, int dst_stride,
  59. const MV *mv_q3,
  60. const struct scale_factors *sf,
  61. int w, int h, int do_avg,
  62. const InterpKernel *kernel,
  63. enum mv_precision precision,
  64. int x, int y);
  65. #if CONFIG_VP9_HIGHBITDEPTH
  66. void vp9_highbd_build_inter_predictor(const uint8_t *src, int src_stride,
  67. uint8_t *dst, int dst_stride,
  68. const MV *mv_q3,
  69. const struct scale_factors *sf,
  70. int w, int h, int do_avg,
  71. const InterpKernel *kernel,
  72. enum mv_precision precision,
  73. int x, int y, int bd);
  74. #endif
  75. static INLINE int scaled_buffer_offset(int x_offset, int y_offset, int stride,
  76. const struct scale_factors *sf) {
  77. const int x = sf ? sf->scale_value_x(x_offset, sf) : x_offset;
  78. const int y = sf ? sf->scale_value_y(y_offset, sf) : y_offset;
  79. return y * stride + x;
  80. }
  81. static INLINE void setup_pred_plane(struct buf_2d *dst,
  82. uint8_t *src, int stride,
  83. int mi_row, int mi_col,
  84. const struct scale_factors *scale,
  85. int subsampling_x, int subsampling_y) {
  86. const int x = (MI_SIZE * mi_col) >> subsampling_x;
  87. const int y = (MI_SIZE * mi_row) >> subsampling_y;
  88. dst->buf = src + scaled_buffer_offset(x, y, stride, scale);
  89. dst->stride = stride;
  90. }
  91. void vp9_setup_dst_planes(struct macroblockd_plane planes[MAX_MB_PLANE],
  92. const YV12_BUFFER_CONFIG *src,
  93. int mi_row, int mi_col);
  94. void vp9_setup_pre_planes(MACROBLOCKD *xd, int idx,
  95. const YV12_BUFFER_CONFIG *src, int mi_row, int mi_col,
  96. const struct scale_factors *sf);
  97. #ifdef __cplusplus
  98. } // extern "C"
  99. #endif
  100. #endif // VP9_COMMON_VP9_RECONINTER_H_