Steinar Midtskogen | a9d41e8 | 2017-03-17 12:48:15 +0100 | [diff] [blame] | 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 AV1_COMMON_DERING_H_ |
| 12 | #define AV1_COMMON_DERING_H_ |
| 13 | |
Jean-Marc Valin | 5f5c132 | 2017-03-21 16:20:21 -0400 | [diff] [blame] | 14 | #define CDEF_STRENGTH_BITS 7 |
Steinar Midtskogen | a9d41e8 | 2017-03-17 12:48:15 +0100 | [diff] [blame] | 15 | |
Steinar Midtskogen | daab348 | 2017-04-05 20:45:02 +0200 | [diff] [blame] | 16 | #define DERING_STRENGTHS 32 |
Steinar Midtskogen | a9d41e8 | 2017-03-17 12:48:15 +0100 | [diff] [blame] | 17 | #define CLPF_STRENGTHS 4 |
| 18 | |
| 19 | #include "./aom_config.h" |
| 20 | #include "aom/aom_integer.h" |
| 21 | #include "aom_ports/mem.h" |
| 22 | #include "av1/common/od_dering.h" |
| 23 | #include "av1/common/onyxc_int.h" |
| 24 | #include "./od_dering.h" |
| 25 | |
Steinar Midtskogen | 8ff52fc | 2017-04-04 12:29:19 +0200 | [diff] [blame] | 26 | static INLINE int sign(int i) { return i < 0 ? -1 : 1; } |
| 27 | |
| 28 | static INLINE int constrain(int diff, int threshold, unsigned int damping) { |
| 29 | return threshold |
| 30 | ? sign(diff) * |
| 31 | AOMMIN( |
| 32 | abs(diff), |
| 33 | AOMMAX(0, threshold - (abs(diff) >> |
| 34 | (damping - get_msb(threshold))))) |
| 35 | : 0; |
| 36 | } |
| 37 | |
Steinar Midtskogen | a9d41e8 | 2017-03-17 12:48:15 +0100 | [diff] [blame] | 38 | #ifdef __cplusplus |
| 39 | extern "C" { |
| 40 | #endif |
| 41 | |
Steinar Midtskogen | a9d41e8 | 2017-03-17 12:48:15 +0100 | [diff] [blame] | 42 | int sb_all_skip(const AV1_COMMON *const cm, int mi_row, int mi_col); |
| 43 | int sb_compute_dering_list(const AV1_COMMON *const cm, int mi_row, int mi_col, |
Jean-Marc Valin | 70f0e5e | 2017-04-12 02:33:50 -0400 | [diff] [blame] | 44 | dering_list *dlist, int filter_skip); |
Jean-Marc Valin | e9f7742 | 2017-03-22 17:09:51 -0400 | [diff] [blame] | 45 | void av1_cdef_frame(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm, MACROBLOCKD *xd); |
Steinar Midtskogen | a9d41e8 | 2017-03-17 12:48:15 +0100 | [diff] [blame] | 46 | |
| 47 | void av1_cdef_search(YV12_BUFFER_CONFIG *frame, const YV12_BUFFER_CONFIG *ref, |
| 48 | AV1_COMMON *cm, MACROBLOCKD *xd); |
| 49 | |
| 50 | #ifdef __cplusplus |
| 51 | } // extern "C" |
| 52 | #endif |
| 53 | #endif // AV1_COMMON_DERING_H_ |