#ifndef AOM_AV1_COMMON_RESTORATION_H_
#define AOM_AV1_COMMON_RESTORATION_H_
#include "aom_ports/mem.h"
#include "config/aom_config.h"
#include "av1/common/blockd.h"
#include "av1/common/enums.h"
#ifdef __cplusplus
extern "C" {
#endif
#define AOM_RESTORATION_FRAME_BORDER …
#define CLIP(x, lo, hi) …
#define RINT(x) …
#define RESTORATION_PROC_UNIT_SIZE …
#define RESTORATION_UNIT_OFFSET …
#define SGRPROJ_BORDER_VERT …
#define SGRPROJ_BORDER_HORZ …
#define WIENER_BORDER_VERT …
#define WIENER_HALFWIN …
#define WIENER_BORDER_HORZ …
#if SGRPROJ_BORDER_VERT >= WIENER_BORDER_VERT
#define RESTORATION_BORDER_VERT …
#else
#define RESTORATION_BORDER_VERT …
#endif
#if SGRPROJ_BORDER_HORZ >= WIENER_BORDER_HORZ
#define RESTORATION_BORDER_HORZ …
#else
#define RESTORATION_BORDER_HORZ …
#endif
#define RESTORATION_BORDER …
#define RESTORATION_CTX_VERT …
#define RESTORATION_EXTRA_HORZ …
#define RESTORATION_PADDING …
#define RESTORATION_PROC_UNIT_PELS …
#define RESTORATION_UNITSIZE_MAX …
#define RESTORATION_UNITPELS_HORZ_MAX …
#define RESTORATION_UNITPELS_VERT_MAX …
#define RESTORATION_UNITPELS_MAX …
#define SGRPROJ_TMPBUF_SIZE …
#define SGRPROJ_EXTBUF_SIZE …
#define SGRPROJ_PARAMS_BITS …
#define SGRPROJ_PARAMS …
#define SGRPROJ_PRJ_BITS …
#define SGRPROJ_RST_BITS …
#define SGRPROJ_SGR_BITS …
#define SGRPROJ_SGR …
#define SGRPROJ_PRJ_MIN0 …
#define SGRPROJ_PRJ_MAX0 …
#define SGRPROJ_PRJ_MIN1 …
#define SGRPROJ_PRJ_MAX1 …
#define SGRPROJ_PRJ_SUBEXP_K …
#define SGRPROJ_BITS …
#define MAX_RADIUS …
#define MAX_NELEM …
#define SGRPROJ_MTABLE_BITS …
#define SGRPROJ_RECIP_BITS …
#define WIENER_HALFWIN1 …
#define WIENER_WIN …
#define WIENER_WIN2 …
#define WIENER_TMPBUF_SIZE …
#define WIENER_EXTBUF_SIZE …
#define WIENER_WIN_CHROMA …
#define WIENER_WIN_REDUCED …
#define WIENER_WIN2_CHROMA …
#define WIENER_STATS_DOWNSAMPLE_FACTOR …
#define WIENER_FILT_PREC_BITS …
#define WIENER_FILT_STEP …
#define WIENER_FILT_TAP0_MIDV …
#define WIENER_FILT_TAP1_MIDV …
#define WIENER_FILT_TAP2_MIDV …
#define WIENER_FILT_TAP3_MIDV …
#define WIENER_FILT_TAP0_BITS …
#define WIENER_FILT_TAP1_BITS …
#define WIENER_FILT_TAP2_BITS …
#define WIENER_FILT_BITS …
#define WIENER_FILT_TAP0_MINV …
#define WIENER_FILT_TAP1_MINV …
#define WIENER_FILT_TAP2_MINV …
#define WIENER_FILT_TAP0_MAXV …
#define WIENER_FILT_TAP1_MAXV …
#define WIENER_FILT_TAP2_MAXV …
#define WIENER_FILT_TAP0_SUBEXP_K …
#define WIENER_FILT_TAP1_SUBEXP_K …
#define WIENER_FILT_TAP2_SUBEXP_K …
#define RESTORATION_TMPBUF_SIZE …
#define RESTORATION_EXTBUF_SIZE …
#if SUBPEL_TAPS != WIENER_WIN + 1
#error "Wiener filter currently only works if SUBPEL_TAPS == WIENER_WIN + 1"
#endif
#if WIENER_FILT_PREC_BITS != 7
#error "Wiener filter currently only works if WIENER_FILT_PREC_BITS == 7"
#endif
sgr_params_type;
RestorationUnitInfo;
#define RESTORATION_LINEBUFFER_WIDTH …
RestorationLineBuffers;
RestorationStripeBoundaries;
RestorationInfo;
static inline void set_default_sgrproj(SgrprojInfo *sgrproj_info) { … }
static inline void set_default_wiener(WienerInfo *wiener_info) { … }
RestorationTileLimits;
rest_unit_visitor_t;
FilterFrameCtxt;
AV1LrStruct;
extern const sgr_params_type av1_sgr_params[SGRPROJ_PARAMS];
extern int sgrproj_mtable[SGRPROJ_PARAMS][2];
extern const int32_t av1_x_by_xplus1[256];
extern const int32_t av1_one_by_x[MAX_NELEM];
void av1_alloc_restoration_struct(struct AV1Common *cm, RestorationInfo *rsi,
int is_uv);
void av1_free_restoration_struct(RestorationInfo *rst_info);
void av1_extend_frame(uint8_t *data, int width, int height, int stride,
int border_horz, int border_vert, int highbd);
void av1_decode_xq(const int *xqd, int *xq, const sgr_params_type *params);
void av1_loop_restoration_filter_unit(
const RestorationTileLimits *limits, const RestorationUnitInfo *rui,
const RestorationStripeBoundaries *rsb, RestorationLineBuffers *rlbs,
int plane_w, int plane_h, int ss_x, int ss_y, int highbd, int bit_depth,
uint8_t *data8, int stride, uint8_t *dst8, int dst_stride, int32_t *tmpbuf,
int optimized_lr, struct aom_internal_error_info *error_info);
void av1_loop_restoration_filter_frame(YV12_BUFFER_CONFIG *frame,
struct AV1Common *cm, int optimized_lr,
void *lr_ctxt);
void av1_loop_restoration_precal(void);
struct AV1LrSyncData;
sync_read_fn_t;
sync_write_fn_t;
int av1_loop_restoration_corners_in_sb(const struct AV1Common *cm, int plane,
int mi_row, int mi_col, BLOCK_SIZE bsize,
int *rcol0, int *rcol1, int *rrow0,
int *rrow1);
void av1_loop_restoration_save_boundary_lines(const YV12_BUFFER_CONFIG *frame,
struct AV1Common *cm,
int after_cdef);
void av1_loop_restoration_filter_frame_init(AV1LrStruct *lr_ctxt,
YV12_BUFFER_CONFIG *frame,
struct AV1Common *cm,
int optimized_lr, int num_planes);
void av1_loop_restoration_copy_planes(AV1LrStruct *loop_rest_ctxt,
struct AV1Common *cm, int num_planes);
void av1_foreach_rest_unit_in_row(
RestorationTileLimits *limits, int plane_w,
rest_unit_visitor_t on_rest_unit, int row_number, int unit_size,
int hnum_rest_units, int vnum_rest_units, int plane, void *priv,
int32_t *tmpbuf, RestorationLineBuffers *rlbs, sync_read_fn_t on_sync_read,
sync_write_fn_t on_sync_write, struct AV1LrSyncData *const lr_sync,
struct aom_internal_error_info *error_info);
void av1_get_upsampled_plane_size(const struct AV1Common *cm, int is_uv,
int *plane_w, int *plane_h);
int av1_lr_count_units(int unit_size, int plane_size);
void av1_lr_sync_read_dummy(void *const lr_sync, int r, int c, int plane);
void av1_lr_sync_write_dummy(void *const lr_sync, int r, int c,
const int sb_cols, int plane);
#ifdef __cplusplus
}
#endif
#endif