convolve.h 2.55 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
/*
 * Copyright (c) 2016, Alliance for Open Media. All rights reserved
 *
 * This source code is subject to the terms of the BSD 2 Clause License and
 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
 * was not distributed with this source code in the LICENSE file, you can
 * obtain it at www.aomedia.org/license/software. If the Alliance for Open
 * Media Patent License 1.0 was not distributed with this source code in the
 * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
 */

Yaowu Xu's avatar
Yaowu Xu committed
12 13 14 15 16 17 18 19
#ifndef AV1_COMMON_AV1_CONVOLVE_H_
#define AV1_COMMON_AV1_CONVOLVE_H_
#include "av1/common/filter.h"

#ifdef __cplusplus
extern "C" {
#endif

20 21 22 23 24 25
typedef enum CONVOLVE_OPT {
  // indicate the results in dst buf is rounded by FILTER_BITS or not
  CONVOLVE_OPT_ROUND,
  CONVOLVE_OPT_NO_ROUND,
} CONVOLVE_OPT;

26 27
typedef struct ConvolveParams {
  int ref;
28
  CONVOLVE_OPT round;
Angie Chiang's avatar
Angie Chiang committed
29
  int32_t *dst;
30
  int dst_stride;
31 32
} ConvolveParams;

33 34 35 36 37 38 39
static INLINE ConvolveParams get_conv_params(int ref) {
  ConvolveParams conv_params;
  conv_params.ref = ref;
  conv_params.round = CONVOLVE_OPT_ROUND;
  return conv_params;
}

Angie Chiang's avatar
Angie Chiang committed
40
#if CONFIG_CONVOLVE_ROUND
Angie Chiang's avatar
Angie Chiang committed
41 42 43 44 45 46 47 48 49 50 51 52
static INLINE ConvolveParams get_conv_params_no_round(int ref, int32_t *dst,
                                                      int dst_stride) {
  ConvolveParams conv_params;
  conv_params.ref = ref;
  conv_params.round = CONVOLVE_OPT_NO_ROUND;
  conv_params.dst = dst;
  conv_params.dst_stride = dst_stride;
  return conv_params;
}

void av1_convolve_rounding(const int32_t *src, int src_stride, uint8_t *dst,
                           int dst_stride, int w, int h);
Angie Chiang's avatar
Angie Chiang committed
53
#endif  // CONFIG_CONVOLVE_ROUND
Angie Chiang's avatar
Angie Chiang committed
54

Yaowu Xu's avatar
Yaowu Xu committed
55 56 57
void av1_convolve(const uint8_t *src, int src_stride, uint8_t *dst,
                  int dst_stride, int w, int h,
#if CONFIG_DUAL_FILTER
James Zern's avatar
James Zern committed
58
                  const InterpFilter *interp_filter,
Yaowu Xu's avatar
Yaowu Xu committed
59
#else
James Zern's avatar
James Zern committed
60
                  const InterpFilter interp_filter,
Yaowu Xu's avatar
Yaowu Xu committed
61 62
#endif
                  const int subpel_x, int xstep, const int subpel_y, int ystep,
63
                  ConvolveParams *conv_params);
Yaowu Xu's avatar
Yaowu Xu committed
64 65 66 67 68

#if CONFIG_AOM_HIGHBITDEPTH
void av1_highbd_convolve(const uint8_t *src, int src_stride, uint8_t *dst,
                         int dst_stride, int w, int h,
#if CONFIG_DUAL_FILTER
James Zern's avatar
James Zern committed
69
                         const InterpFilter *interp_filter,
Yaowu Xu's avatar
Yaowu Xu committed
70
#else
James Zern's avatar
James Zern committed
71
                         const InterpFilter interp_filter,
Yaowu Xu's avatar
Yaowu Xu committed
72 73 74 75 76 77 78 79 80 81
#endif
                         const int subpel_x, int xstep, const int subpel_y,
                         int ystep, int avg, int bd);
#endif  // CONFIG_AOM_HIGHBITDEPTH

#ifdef __cplusplus
}  // extern "C"
#endif

#endif  // AV1_COMMON_AV1_CONVOLVE_H_