cdef.h
/*
* 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.
*/
#ifndef AOM_AV1_COMMON_CDEF_H_
#define AOM_AV1_COMMON_CDEF_H_
#define CDEF_STRENGTH_BITS 6
#define CDEF_PRI_STRENGTHS 16
#define CDEF_SEC_STRENGTHS 4
#include "config/aom_config.h"
#include "aom/aom_integer.h"
#include "aom_ports/mem.h"
#include "av1/common/av1_common_int.h"
#include "av1/common/cdef_block.h"
enum { TOP, LEFT, BOTTOM, RIGHT, BOUNDARIES } UENUM1BYTE(BOUNDARY);
struct AV1CdefSyncData;
typedef struct {
uint16_t *src;
uint16_t *top_linebuf[MAX_MB_PLANE];
uint16_t *bot_linebuf[MAX_MB_PLANE];
uint8_t *dst;
cdef_list
dlist[MI_SIZE_64X64 * MI_SIZE_64X64];
int xdec;
int ydec;
int mi_wide_l2;
int mi_high_l2;
int frame_boundary[BOUNDARIES];
int damping;
int coeff_shift;
int level;
int sec_strength;
int cdef_count;
int dir[CDEF_NBLOCKS]
[CDEF_NBLOCKS];
int var[CDEF_NBLOCKS][CDEF_NBLOCKS];
int dst_stride;
int coffset;
int roffset;
} CdefBlockInfo;
static inline int sign(int i) { return i < 0 ? -1 : 1; }
static inline int constrain(int diff, int threshold, int damping) {
if (!threshold) return 0;
int shift = damping - get_msb(threshold);
shift = AOMMAX(0, shift);
return sign(diff) * clamp(threshold - (abs(diff) >> shift), 0, abs(diff));
}
#ifdef __cplusplus
extern "C" {
#endif
int av1_cdef_compute_sb_list(const CommonModeInfoParams *const mi_params,
int mi_row, int mi_col, cdef_list *dlist,
BLOCK_SIZE bsize);
typedef void (*cdef_init_fb_row_t)(
const AV1_COMMON *const cm, const MACROBLOCKD *const xd,
CdefBlockInfo *const fb_info, uint16_t **const linebuf, uint16_t *const src,
struct AV1CdefSyncData *const cdef_sync, int fbr);
void av1_cdef_frame(YV12_BUFFER_CONFIG *frame, AV1_COMMON *const cm,
MACROBLOCKD *xd, cdef_init_fb_row_t cdef_init_fb_row_fn);
void av1_cdef_fb_row(const AV1_COMMON *const cm, MACROBLOCKD *xd,
uint16_t **const linebuf, uint16_t **const colbuf,
uint16_t *const src, int fbr,
cdef_init_fb_row_t cdef_init_fb_row_fn,
struct AV1CdefSyncData *const cdef_sync,
struct aom_internal_error_info *error_info);
void av1_cdef_init_fb_row(const AV1_COMMON *const cm,
const MACROBLOCKD *const xd,
CdefBlockInfo *const fb_info,
uint16_t **const linebuf, uint16_t *const src,
struct AV1CdefSyncData *const cdef_sync, int fbr);
#ifdef __cplusplus
} // extern "C"
#endif
#endif // AOM_AV1_COMMON_CDEF_H_
av1_cdef_frame
void av1_cdef_frame(YV12_BUFFER_CONFIG *frame, AV1_COMMON *const cm, MACROBLOCKD *xd, cdef_init_fb_row_t cdef_init_fb_row_fn)
Function for applying CDEF to a frame.
CdefBlockInfo
Parameters related to CDEF Block.
Definition cdef.h:31
CdefBlockInfo::frame_boundary
int frame_boundary[BOUNDARIES]
Definition cdef.h:43
CdefBlockInfo::cdef_count
int cdef_count
Definition cdef.h:49
CdefBlockInfo::sec_strength
int sec_strength
Definition cdef.h:48
CdefBlockInfo::roffset
int roffset
Definition cdef.h:56
CdefBlockInfo::ydec
int ydec
Definition cdef.h:40
CdefBlockInfo::damping
int damping
Definition cdef.h:45
CdefBlockInfo::dlist
cdef_list dlist[MI_SIZE_64X64 *MI_SIZE_64X64]
Definition cdef.h:37
CdefBlockInfo::coeff_shift
int coeff_shift
Definition cdef.h:46
CdefBlockInfo::dir
int dir[((1<< MAX_SB_SIZE_LOG2)/8)][((1<< MAX_SB_SIZE_LOG2)/8)]
Definition cdef.h:51
CdefBlockInfo::src
uint16_t * src
Definition cdef.h:32
CdefBlockInfo::xdec
int xdec
Definition cdef.h:39
CdefBlockInfo::dst_stride
int dst_stride
Definition cdef.h:54
CdefBlockInfo::mi_wide_l2
int mi_wide_l2
Definition cdef.h:41
CdefBlockInfo::bot_linebuf
uint16_t * bot_linebuf[3]
Definition cdef.h:34
CdefBlockInfo::mi_high_l2
int mi_high_l2
Definition cdef.h:42
CdefBlockInfo::coffset
int coffset
Definition cdef.h:55
CdefBlockInfo::level
int level
Definition cdef.h:47
CdefBlockInfo::var
int var[((1<< MAX_SB_SIZE_LOG2)/8)][((1<< MAX_SB_SIZE_LOG2)/8)]
Definition cdef.h:52
CdefBlockInfo::top_linebuf
uint16_t * top_linebuf[3]
Definition cdef.h:33
CdefBlockInfo::dst
uint8_t * dst
Definition cdef.h:35
CommonModeInfoParams
Params related to MB_MODE_INFO arrays and related info.
Definition av1_common_int.h:511