blob: 08c438de6e5204dc32f30f69ba743af3a73b1549 [file] [log] [blame]
Steinar Midtskogena9d41e82017-03-17 12:48:15 +01001/*
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 Valin5f5c1322017-03-21 16:20:21 -040014#define CDEF_STRENGTH_BITS 7
Steinar Midtskogena9d41e82017-03-17 12:48:15 +010015
Steinar Midtskogendaab3482017-04-05 20:45:02 +020016#define DERING_STRENGTHS 32
Steinar Midtskogena9d41e82017-03-17 12:48:15 +010017#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 Midtskogen8ff52fc2017-04-04 12:29:19 +020026static INLINE int sign(int i) { return i < 0 ? -1 : 1; }
27
28static 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 Midtskogena9d41e82017-03-17 12:48:15 +010038#ifdef __cplusplus
39extern "C" {
40#endif
41
Steinar Midtskogena9d41e82017-03-17 12:48:15 +010042int sb_all_skip(const AV1_COMMON *const cm, int mi_row, int mi_col);
43int sb_compute_dering_list(const AV1_COMMON *const cm, int mi_row, int mi_col,
Jean-Marc Valin70f0e5e2017-04-12 02:33:50 -040044 dering_list *dlist, int filter_skip);
Jean-Marc Valine9f77422017-03-22 17:09:51 -040045void av1_cdef_frame(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm, MACROBLOCKD *xd);
Steinar Midtskogena9d41e82017-03-17 12:48:15 +010046
47void 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_