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 | */ |
Steinar Midtskogen | 94de0aa | 2017-08-02 10:30:12 +0200 | [diff] [blame] | 11 | #ifndef AV1_COMMON_CDEF_H_ |
| 12 | #define AV1_COMMON_CDEF_H_ |
Steinar Midtskogen | a9d41e8 | 2017-03-17 12:48:15 +0100 | [diff] [blame] | 13 | |
Steinar Midtskogen | 6c24b02 | 2017-09-15 09:46:39 +0200 | [diff] [blame] | 14 | #define CDEF_STRENGTH_BITS 6 |
Steinar Midtskogen | a9d41e8 | 2017-03-17 12:48:15 +0100 | [diff] [blame] | 15 | |
Steinar Midtskogen | 6c24b02 | 2017-09-15 09:46:39 +0200 | [diff] [blame] | 16 | #define CDEF_PRI_STRENGTHS 16 |
Steinar Midtskogen | 94de0aa | 2017-08-02 10:30:12 +0200 | [diff] [blame] | 17 | #define CDEF_SEC_STRENGTHS 4 |
Steinar Midtskogen | a9d41e8 | 2017-03-17 12:48:15 +0100 | [diff] [blame] | 18 | |
| 19 | #include "./aom_config.h" |
| 20 | #include "aom/aom_integer.h" |
| 21 | #include "aom_ports/mem.h" |
Steinar Midtskogen | 94de0aa | 2017-08-02 10:30:12 +0200 | [diff] [blame] | 22 | #include "av1/common/cdef_block.h" |
Steinar Midtskogen | a9d41e8 | 2017-03-17 12:48:15 +0100 | [diff] [blame] | 23 | #include "av1/common/onyxc_int.h" |
Steinar Midtskogen | a9d41e8 | 2017-03-17 12:48:15 +0100 | [diff] [blame] | 24 | |
Steinar Midtskogen | 8ff52fc | 2017-04-04 12:29:19 +0200 | [diff] [blame] | 25 | static INLINE int sign(int i) { return i < 0 ? -1 : 1; } |
| 26 | |
David Barker | 0123bc7 | 2017-09-06 15:22:59 +0100 | [diff] [blame] | 27 | static INLINE int constrain(int diff, int threshold, int damping) { |
| 28 | if (!threshold) return 0; |
| 29 | |
| 30 | const int shift = AOMMAX(0, damping - get_msb(threshold)); |
| 31 | return sign(diff) * |
| 32 | AOMMIN(abs(diff), AOMMAX(0, threshold - (abs(diff) >> shift))); |
Steinar Midtskogen | 8ff52fc | 2017-04-04 12:29:19 +0200 | [diff] [blame] | 33 | } |
| 34 | |
Steinar Midtskogen | a9d41e8 | 2017-03-17 12:48:15 +0100 | [diff] [blame] | 35 | #ifdef __cplusplus |
| 36 | extern "C" { |
| 37 | #endif |
| 38 | |
Steinar Midtskogen | a9d41e8 | 2017-03-17 12:48:15 +0100 | [diff] [blame] | 39 | int sb_all_skip(const AV1_COMMON *const cm, int mi_row, int mi_col); |
Steinar Midtskogen | 6c24b02 | 2017-09-15 09:46:39 +0200 | [diff] [blame] | 40 | #if CONFIG_EXT_PARTITION |
Steinar Midtskogen | 94de0aa | 2017-08-02 10:30:12 +0200 | [diff] [blame] | 41 | int sb_compute_cdef_list(const AV1_COMMON *const cm, int mi_row, int mi_col, |
Steinar Midtskogen | 6c24b02 | 2017-09-15 09:46:39 +0200 | [diff] [blame] | 42 | cdef_list *dlist, BLOCK_SIZE bsize); |
| 43 | #else |
| 44 | int sb_compute_cdef_list(const AV1_COMMON *const cm, int mi_row, int mi_col, |
| 45 | cdef_list *dlist); |
| 46 | #endif |
Jean-Marc Valin | e9f7742 | 2017-03-22 17:09:51 -0400 | [diff] [blame] | 47 | 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] | 48 | |
| 49 | void av1_cdef_search(YV12_BUFFER_CONFIG *frame, const YV12_BUFFER_CONFIG *ref, |
Steinar Midtskogen | b1555c9 | 2017-06-07 13:26:31 +0200 | [diff] [blame] | 50 | AV1_COMMON *cm, MACROBLOCKD *xd, int fast); |
Steinar Midtskogen | a9d41e8 | 2017-03-17 12:48:15 +0100 | [diff] [blame] | 51 | |
| 52 | #ifdef __cplusplus |
| 53 | } // extern "C" |
| 54 | #endif |
Steinar Midtskogen | 94de0aa | 2017-08-02 10:30:12 +0200 | [diff] [blame] | 55 | #endif // AV1_COMMON_CDEF_H_ |