• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_AV1_COMMON_CDEF_H_
12 #define AOM_AV1_COMMON_CDEF_H_
13 
14 #define CDEF_STRENGTH_BITS 6
15 
16 #define CDEF_PRI_STRENGTHS 16
17 #define CDEF_SEC_STRENGTHS 4
18 
19 #include "config/aom_config.h"
20 
21 #include "aom/aom_integer.h"
22 #include "aom_ports/mem.h"
23 #include "av1/common/cdef_block.h"
24 #include "av1/common/onyxc_int.h"
25 
sign(int i)26 static INLINE int sign(int i) { return i < 0 ? -1 : 1; }
27 
constrain(int diff,int threshold,int damping)28 static INLINE int constrain(int diff, int threshold, int damping) {
29   if (!threshold) return 0;
30 
31   const int shift = AOMMAX(0, damping - get_msb(threshold));
32   return sign(diff) *
33          AOMMIN(abs(diff), AOMMAX(0, threshold - (abs(diff) >> shift)));
34 }
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 int sb_all_skip(const AV1_COMMON *const cm, int mi_row, int mi_col);
41 int sb_compute_cdef_list(const AV1_COMMON *const cm, int mi_row, int mi_col,
42                          cdef_list *dlist, BLOCK_SIZE bsize);
43 void av1_cdef_frame(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm, MACROBLOCKD *xd);
44 
45 void av1_cdef_search(YV12_BUFFER_CONFIG *frame, const YV12_BUFFER_CONFIG *ref,
46                      AV1_COMMON *cm, MACROBLOCKD *xd, int fast);
47 
48 #ifdef __cplusplus
49 }  // extern "C"
50 #endif
51 #endif  // AOM_AV1_COMMON_CDEF_H_
52