Commit 80daf0c4 authored by Yue Chen's avatar Yue Chen

Remove NCOBMC_ADAPT_WEIGHT from AV1

Development of this experiment will be deferred to AV2.

Change-Id: I3c4615a21b59508500bed8aab0a5c54413b4f284
parent 77fb5be1
......@@ -405,13 +405,6 @@ if (CONFIG_INTRA_EDGE)
"${AOM_ROOT}/av1/common/x86/intra_edge_sse4.c")
endif ()
if (CONFIG_NCOBMC_ADAPT_WEIGHT)
set(AOM_AV1_COMMON_SOURCES
${AOM_AV1_COMMON_SOURCES}
"${AOM_ROOT}/av1/common/ncobmc_kernels.c"
"${AOM_ROOT}/av1/common/ncobmc_kernels.h")
endif ()
set(AOM_AV1_COMMON_SOURCES
${AOM_AV1_COMMON_SOURCES}
"${AOM_ROOT}/av1/common/warped_motion.c"
......
......@@ -160,14 +160,8 @@ AV1_COMMON_SRCS-$(HAVE_SSSE3) += common/x86/highbd_convolve_2d_ssse3.c
endif
endif
ifeq ($(CONFIG_Q_ADAPT_PROBS),yes)
AV1_COMMON_SRCS-yes += common/token_cdfs.h
endif
ifeq ($(CONFIG_NCOBMC_ADAPT_WEIGHT),yes)
AV1_COMMON_SRCS-yes += common/ncobmc_kernels.h
AV1_COMMON_SRCS-yes += common/ncobmc_kernels.c
endif
$(eval $(call rtcd_h_template,av1_rtcd,av1/common/av1_rtcd_defs.pl))
......@@ -84,35 +84,6 @@ static void free_seg_map(AV1_COMMON *cm) {
cm->seg_map_alloc_size = 0;
}
static void free_scratch_buffers(AV1_COMMON *cm) {
(void)cm;
#if CONFIG_NCOBMC && CONFIG_NCOBMC_ADAPT_WEIGHT
for (int i = 0; i < 4; ++i) {
if (cm->ncobmcaw_buf[i]) {
aom_free(cm->ncobmcaw_buf[i]);
cm->ncobmcaw_buf[i] = NULL;
}
}
#endif // CONFIG_NCOBMC && CONFIG_NCOBMC_ADAPT_WEIGHT
}
static int alloc_scratch_buffers(AV1_COMMON *cm) {
(void)cm;
#if CONFIG_NCOBMC && CONFIG_NCOBMC_ADAPT_WEIGHT
// If not allocated already, allocate
if (!cm->ncobmcaw_buf[0] && !cm->ncobmcaw_buf[1] && !cm->ncobmcaw_buf[2] &&
!cm->ncobmcaw_buf[3]) {
for (int i = 0; i < 4; ++i) {
CHECK_MEM_ERROR(
cm, cm->ncobmcaw_buf[i],
(uint8_t *)aom_memalign(
16, (1 + CONFIG_HIGHBITDEPTH) * MAX_MB_PLANE * MAX_SB_SQUARE));
}
}
#endif // CONFIG_NCOBMC && CONFIG_NCOBMC_ADAPT_WEIGHT
return 0;
}
void av1_free_ref_frame_buffers(BufferPool *pool) {
int i;
......@@ -222,7 +193,6 @@ void av1_free_context_buffers(AV1_COMMON *cm) {
int i;
cm->free_mi(cm);
free_seg_map(cm);
free_scratch_buffers(cm);
for (i = 0; i < MAX_MB_PLANE; i++) {
aom_free(cm->above_context[i]);
cm->above_context[i] = NULL;
......@@ -254,7 +224,6 @@ int av1_alloc_context_buffers(AV1_COMMON *cm, int width, int height) {
free_seg_map(cm);
if (alloc_seg_map(cm, cm->mi_rows * cm->mi_cols)) goto fail;
}
if (alloc_scratch_buffers(cm)) goto fail;
if (cm->above_context_alloc_cols < cm->mi_cols) {
// TODO(geza.lore): These are bigger than they need to be.
......
......@@ -70,17 +70,6 @@ static INLINE int is_inter_mode(PREDICTION_MODE mode) {
return mode >= NEARESTMV && mode <= NEW_NEWMV;
}
#if CONFIG_NCOBMC_ADAPT_WEIGHT
typedef struct superblock_mi_boundaries {
int mi_row_begin;
int mi_col_begin;
int mi_row_end;
int mi_col_end;
} SB_MI_BD;
typedef struct { int16_t KERNEL[4][MAX_SB_SIZE][MAX_SB_SIZE]; } NCOBMC_KERNELS;
#endif
typedef struct {
uint8_t *plane[MAX_MB_PLANE];
int stride[MAX_MB_PLANE];
......@@ -367,13 +356,6 @@ typedef struct MB_MODE_INFO {
SEG_MASK_TYPE mask_type;
MOTION_MODE motion_mode;
int overlappable_neighbors[2];
#if CONFIG_NCOBMC_ADAPT_WEIGHT
// Applying different weighting kernels in ncobmc
// In current implementation, interpolation modes only defined for squared
// blocks. A rectangular block is divided into two squared blocks and each
// squared block has an interpolation mode.
NCOBMC_MODE ncobmc_mode[2];
#endif // CONFIG_NCOBMC_ADAPT_WEIGHT
int_mv mv[2];
int_mv pred_mv[2];
uint8_t ref_mv_idx;
......@@ -766,12 +748,6 @@ typedef struct macroblockd {
#if CONFIG_CFL
CFL_CTX *cfl;
#endif
#if CONFIG_NCOBMC_ADAPT_WEIGHT
uint8_t *ncobmc_pred_buf[MAX_MB_PLANE];
int ncobmc_pred_buf_stride[MAX_MB_PLANE];
SB_MI_BD sb_mi_bd;
#endif
} MACROBLOCKD;
static INLINE int get_bitdepth_data_path_index(const MACROBLOCKD *xd) {
......@@ -1376,14 +1352,6 @@ static INLINE int check_num_overlappable_neighbors(const MB_MODE_INFO *mbmi) {
return !(mbmi->overlappable_neighbors[0] == 0 &&
mbmi->overlappable_neighbors[1] == 0);
}
#if CONFIG_NCOBMC_ADAPT_WEIGHT
static INLINE NCOBMC_MODE ncobmc_mode_allowed_bsize(BLOCK_SIZE bsize) {
if (bsize < BLOCK_8X8 || bsize >= BLOCK_64X64)
return NO_OVERLAP;
else
return MAX_NCOBMC_MODES;
}
#endif // CONFIG_NCOBMC_ADAPT_WEIGHT
static INLINE MOTION_MODE
motion_mode_allowed(int block, const WarpedMotionParams *gm_params,
......@@ -1410,13 +1378,7 @@ motion_mode_allowed(int block, const WarpedMotionParams *gm_params,
#endif
return WARPED_CAUSAL;
}
#if CONFIG_NCOBMC_ADAPT_WEIGHT
if (ncobmc_mode_allowed_bsize(mbmi->sb_type) < NO_OVERLAP)
return NCOBMC_ADAPT_WEIGHT;
else
#endif
return OBMC_CAUSAL;
return OBMC_CAUSAL;
} else {
return SIMPLE_TRANSLATION;
}
......
......@@ -1851,46 +1851,6 @@ static const int intra_mode_context[INTRA_MODES] = {
};
#endif
#if CONFIG_NCOBMC_ADAPT_WEIGHT
// NCOBMC_ADAPT_INTRPL only supports block size >= BLOCK_8X8 and <= BLOCK_64X64
static const ADAPT_OVERLAP_BLOCK adapt_overlap_block_lookup[BLOCK_SIZES_ALL] = {
ADAPT_OVERLAP_BLOCK_INVALID, // BLOCK_2X2
ADAPT_OVERLAP_BLOCK_INVALID, // BLOCK_2X4
ADAPT_OVERLAP_BLOCK_INVALID, // BLOCK_4X2
ADAPT_OVERLAP_BLOCK_INVALID, // BLOCK_4X4
ADAPT_OVERLAP_BLOCK_INVALID, // BLOCK_4X8
ADAPT_OVERLAP_BLOCK_INVALID, // BLOCK_8X4
// the rest of the block sizes round to the largest squared block less than
// the given block size
ADAPT_OVERLAP_BLOCK_8X8, ADAPT_OVERLAP_BLOCK_8X8, ADAPT_OVERLAP_BLOCK_8X8,
ADAPT_OVERLAP_BLOCK_16X16, ADAPT_OVERLAP_BLOCK_16X16,
ADAPT_OVERLAP_BLOCK_16X16, ADAPT_OVERLAP_BLOCK_32X32,
ADAPT_OVERLAP_BLOCK_32X32, ADAPT_OVERLAP_BLOCK_32X32,
ADAPT_OVERLAP_BLOCK_64X64,
#if CONFIG_EXT_PARTITION
ADAPT_OVERLAP_BLOCK_INVALID, ADAPT_OVERLAP_BLOCK_INVALID,
ADAPT_OVERLAP_BLOCK_INVALID,
#endif // CONFIG_EXT_PARTITION
ADAPT_OVERLAP_BLOCK_INVALID, ADAPT_OVERLAP_BLOCK_INVALID,
ADAPT_OVERLAP_BLOCK_INVALID, ADAPT_OVERLAP_BLOCK_INVALID,
ADAPT_OVERLAP_BLOCK_INVALID, ADAPT_OVERLAP_BLOCK_INVALID,
#if CONFIG_EXT_PARTITION
ADAPT_OVERLAP_BLOCK_INVALID, ADAPT_OVERLAP_BLOCK_INVALID
#endif // CONFIG_EXT_PARTITION
};
static const BLOCK_SIZE bsize_2_sqr_bsize[BLOCK_SIZES] = {
BLOCK_2X2, BLOCK_2X2, BLOCK_2X2, BLOCK_4X4, BLOCK_4X4, BLOCK_4X4,
BLOCK_8X8, BLOCK_8X8, BLOCK_8X8, BLOCK_16X16, BLOCK_16X16, BLOCK_16X16,
BLOCK_32X32, BLOCK_32X32, BLOCK_32X32, BLOCK_64X64,
#if CONFIG_EXT_PARTITION
BLOCK_64X64, BLOCK_64X64,
#endif
};
#endif // CONFIG_NCOBMC_ADAPT_WEIGHT
#if CONFIG_ADAPT_SCAN
#define EOB_THRESHOLD_NUM 2
#endif
......
This diff is collapsed.
......@@ -218,17 +218,8 @@ typedef struct frame_contexts {
[CDF_SIZE(INTERINTRA_MODES)];
aom_prob motion_mode_prob[BLOCK_SIZES_ALL][MOTION_MODES - 1];
aom_cdf_prob motion_mode_cdf[BLOCK_SIZES_ALL][CDF_SIZE(MOTION_MODES)];
#if CONFIG_NCOBMC_ADAPT_WEIGHT
aom_prob ncobmc_mode_prob[ADAPT_OVERLAP_BLOCKS][MAX_NCOBMC_MODES - 1];
aom_cdf_prob ncobmc_mode_cdf[ADAPT_OVERLAP_BLOCKS]
[CDF_SIZE(MAX_NCOBMC_MODES)];
#endif
#if CONFIG_NCOBMC_ADAPT_WEIGHT
aom_prob ncobmc_prob[BLOCK_SIZES_ALL][OBMC_FAMILY_MODES - 1];
aom_cdf_prob ncobmc_cdf[BLOCK_SIZES_ALL][CDF_SIZE(OBMC_FAMILY_MODES)];
#endif // CONFIG_NCOBMC_ADAPT_WEIGHT
aom_prob obmc_prob[BLOCK_SIZES_ALL];
#if CONFIG_NEW_MULTISYMBOL || CONFIG_NCOBMC_ADAPT_WEIGHT
#if CONFIG_NEW_MULTISYMBOL
aom_cdf_prob obmc_cdf[BLOCK_SIZES_ALL][CDF_SIZE(2)];
#endif // CONFIG_NEW_MULTISYMBOL
aom_prob intra_inter_prob[INTRA_INTER_CONTEXTS];
......@@ -449,12 +440,6 @@ typedef struct FRAME_COUNTS {
unsigned int wedge_interintra[BLOCK_SIZES_ALL][2];
unsigned int compound_interinter[BLOCK_SIZES_ALL][COMPOUND_TYPES];
unsigned int motion_mode[BLOCK_SIZES_ALL][MOTION_MODES];
#if CONFIG_NCOBMC_ADAPT_WEIGHT
unsigned int ncobmc_mode[ADAPT_OVERLAP_BLOCKS][MAX_NCOBMC_MODES];
#endif
#if CONFIG_NCOBMC_ADAPT_WEIGHT
unsigned int ncobmc[BLOCK_SIZES_ALL][OBMC_FAMILY_MODES];
#endif // CONFIG_NCOBMC_ADAPT_WEIGHT
unsigned int obmc[BLOCK_SIZES_ALL][2];
unsigned int intra_inter[INTRA_INTER_CONTEXTS][2];
unsigned int comp_inter[COMP_INTER_CONTEXTS][2];
......@@ -603,10 +588,6 @@ extern const aom_tree_index
extern const aom_tree_index av1_ext_tx_tree[EXT_TX_SET_TYPES]
[TREE_SIZE(TX_TYPES)];
extern const aom_tree_index av1_motion_mode_tree[TREE_SIZE(MOTION_MODES)];
#if CONFIG_NCOBMC_ADAPT_WEIGHT
extern const aom_tree_index av1_ncobmc_mode_tree[TREE_SIZE(MAX_NCOBMC_MODES)];
extern const aom_tree_index av1_ncobmc_tree[TREE_SIZE(OBMC_FAMILY_MODES)];
#endif // CONFIG_NCOBMC_ADAPT_WEIGHT
#if CONFIG_LOOP_RESTORATION
#define RESTORE_NONE_SGRPROJ_PROB 64
#define RESTORE_NONE_WIENER_PROB 64
......
......@@ -22,11 +22,7 @@ extern "C" {
#undef MAX_SB_SIZE
#if CONFIG_NCOBMC_ADAPT_WEIGHT
#define TWO_MODE
#endif
#if CONFIG_NCOBMC || CONFIG_NCOBMC_ADAPT_WEIGHT
#if CONFIG_NCOBMC
#define NC_MODE_INFO 1
#else
#define NC_MODE_INFO 0
......@@ -251,35 +247,6 @@ typedef enum ATTRIBUTE_PACKED {
#define MAX_TX_BLOCKS_IN_MAX_SB_LOG2 ((MAX_SB_SIZE_LOG2 - MAX_TX_SIZE_LOG2) * 2)
#define MAX_TX_BLOCKS_IN_MAX_SB (1 << MAX_TX_BLOCKS_IN_MAX_SB_LOG2)
#if CONFIG_NCOBMC_ADAPT_WEIGHT
typedef enum ATTRIBUTE_PACKED {
NCOBMC_MODE_0,
NCOBMC_MODE_1,
NCOBMC_MODE_2,
NCOBMC_MODE_3,
NCOBMC_MODE_4,
NCOBMC_MODE_5,
NCOBMC_MODE_6,
NCOBMC_MODE_7,
ALL_NCOBMC_MODES,
#ifdef TWO_MODE
MAX_NCOBMC_MODES = NCOBMC_MODE_1 + 1,
#else
MAX_NCOBMC_MODES = ALL_NCOBMC_MODES,
#endif
NO_OVERLAP = MAX_NCOBMC_MODES + 1
} NCOBMC_MODE;
typedef enum ATTRIBUTE_PACKED {
ADAPT_OVERLAP_BLOCK_8X8,
ADAPT_OVERLAP_BLOCK_16X16,
ADAPT_OVERLAP_BLOCK_32X32,
ADAPT_OVERLAP_BLOCK_64X64,
ADAPT_OVERLAP_BLOCKS,
ADAPT_OVERLAP_BLOCK_INVALID = 255
} ADAPT_OVERLAP_BLOCK;
#endif // CONFIG_NCOBMC_ADAPT_WEIGHT
// frame transform mode
#if CONFIG_SIMPLIFY_TX_MODE
typedef enum ATTRIBUTE_PACKED {
......@@ -564,16 +531,9 @@ typedef enum ATTRIBUTE_PACKED {
typedef enum ATTRIBUTE_PACKED {
SIMPLE_TRANSLATION,
OBMC_CAUSAL, // 2-sided OBMC
#if CONFIG_NCOBMC_ADAPT_WEIGHT
NCOBMC_ADAPT_WEIGHT,
#endif // CONFIG_NCOBMC_ADAPT_WEIGHT
OBMC_CAUSAL, // 2-sided OBMC
WARPED_CAUSAL, // 2-sided WARPED
MOTION_MODES
#if CONFIG_NCOBMC_ADAPT_WEIGHT
,
OBMC_FAMILY_MODES = NCOBMC_ADAPT_WEIGHT + 1
#endif
} MOTION_MODE;
typedef enum ATTRIBUTE_PACKED {
......
This diff is collapsed.
/*
* 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.
*/
#include <stdio.h>
#include "av1/common/enums.h"
#include "av1/common/onyxc_int.h"
#include "av1/common/common.h"
#ifndef AV1_COMMON_NCOBMC_KERNELS_H_
#define AV1_COMMON_NCOBMC_KERNELS_H_
void get_default_ncobmc_kernels(AV1_COMMON *cm);
#endif // AV1_COMMON_NCOBMC_KERNELS_H_
......@@ -523,10 +523,6 @@ typedef struct AV1Common {
#if CONFIG_ANS && ANS_MAX_SYMBOLS
int ans_window_size_log2;
#endif
#if CONFIG_NCOBMC_ADAPT_WEIGHT
NCOBMC_KERNELS ncobmc_kernels[ADAPT_OVERLAP_BLOCKS][ALL_NCOBMC_MODES];
uint8_t *ncobmcaw_buf[4];
#endif
#if CONFIG_LV_MAP
LV_MAP_CTX_TABLE coeff_ctx_table;
#endif
......
This diff is collapsed.
......@@ -560,45 +560,6 @@ void av1_build_wedge_inter_predictor_from_buf(MACROBLOCKD *xd, BLOCK_SIZE bsize,
uint8_t *ext_dst1[3],
int ext_dst_stride1[3]);
#if CONFIG_NCOBMC_ADAPT_WEIGHT
#define ASSIGN_ALIGNED_PTRS(p, a, s) \
p[0] = a; \
p[1] = a + s; \
p[2] = a + 2 * s;
#define ASSIGN_ALIGNED_PTRS_HBD(p, a, s, l) \
p[0] = CONVERT_TO_BYTEPTR(a); \
p[1] = CONVERT_TO_BYTEPTR(a + s * l); \
p[2] = CONVERT_TO_BYTEPTR(a + 2 * s * l);
void alloc_ncobmc_pred_buffer(MACROBLOCKD *const xd);
void free_ncobmc_pred_buffer(MACROBLOCKD *const xd);
void set_sb_mi_boundaries(const AV1_COMMON *const cm, MACROBLOCKD *const xd,
const int mi_row, const int mi_col);
void reset_xd_boundary(MACROBLOCKD *xd, int mi_row, int bh, int mi_col, int bw,
int mi_rows, int mi_cols);
void get_pred_from_intrpl_buf(MACROBLOCKD *xd, int mi_row, int mi_col,
BLOCK_SIZE bsize, int plane);
void build_ncobmc_intrpl_pred(const AV1_COMMON *const cm, MACROBLOCKD *xd,
int plane, int pxl_row, int pxl_col,
BLOCK_SIZE bsize, uint8_t *preds[][MAX_MB_PLANE],
int ps[MAX_MB_PLANE], // pred buffer strides
int mode);
void av1_get_ext_blk_preds(const AV1_COMMON *cm, MACROBLOCKD *xd, int bsize,
int mi_row, int mi_col,
uint8_t *dst_buf[][MAX_MB_PLANE],
int dst_stride[MAX_MB_PLANE]);
void av1_get_ori_blk_pred(const AV1_COMMON *cm, MACROBLOCKD *xd, int bsize,
int mi_row, int mi_col,
uint8_t *dst_buf[MAX_MB_PLANE],
int dst_stride[MAX_MB_PLANE]);
#endif // CONFIG_NCOBMC_ADAPT_WEIGHT
#ifdef __cplusplus
} // extern "C"
#endif
......
......@@ -480,94 +480,6 @@ static void decode_mbmi_block(AV1Decoder *const pbi, MACROBLOCKD *const xd,
aom_merge_corrupted_flag(&xd->corrupted, reader_corrupted_flag);
}
#if CONFIG_NCOBMC_ADAPT_WEIGHT
static void set_mode_info_offsets(AV1_COMMON *const cm, MACROBLOCKD *const xd,
int mi_row, int mi_col) {
const int offset = mi_row * cm->mi_stride + mi_col;
xd->mi = cm->mi_grid_visible + offset;
xd->mi[0] = &cm->mi[offset];
}
static void get_ncobmc_recon(AV1_COMMON *const cm, MACROBLOCKD *xd, int mi_row,
int mi_col, int bsize, int mode) {
uint8_t *pred_buf[4][MAX_MB_PLANE];
int pred_stride[MAX_MB_PLANE] = { MAX_SB_SIZE, MAX_SB_SIZE, MAX_SB_SIZE };
// target block in pxl
int pxl_row = mi_row << MI_SIZE_LOG2;
int pxl_col = mi_col << MI_SIZE_LOG2;
int plane;
#if CONFIG_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
int len = sizeof(uint16_t);
ASSIGN_ALIGNED_PTRS_HBD(pred_buf[0], cm->ncobmcaw_buf[0], MAX_SB_SQUARE,
len);
ASSIGN_ALIGNED_PTRS_HBD(pred_buf[1], cm->ncobmcaw_buf[1], MAX_SB_SQUARE,
len);
ASSIGN_ALIGNED_PTRS_HBD(pred_buf[2], cm->ncobmcaw_buf[2], MAX_SB_SQUARE,
len);
ASSIGN_ALIGNED_PTRS_HBD(pred_buf[3], cm->ncobmcaw_buf[3], MAX_SB_SQUARE,
len);
} else {
#endif // CONFIG_HIGHBITDEPTH
ASSIGN_ALIGNED_PTRS(pred_buf[0], cm->ncobmcaw_buf[0], MAX_SB_SQUARE);
ASSIGN_ALIGNED_PTRS(pred_buf[1], cm->ncobmcaw_buf[1], MAX_SB_SQUARE);
ASSIGN_ALIGNED_PTRS(pred_buf[2], cm->ncobmcaw_buf[2], MAX_SB_SQUARE);
ASSIGN_ALIGNED_PTRS(pred_buf[3], cm->ncobmcaw_buf[3], MAX_SB_SQUARE);
#if CONFIG_HIGHBITDEPTH
}
#endif
av1_get_ext_blk_preds(cm, xd, bsize, mi_row, mi_col, pred_buf, pred_stride);
av1_get_ori_blk_pred(cm, xd, bsize, mi_row, mi_col, pred_buf[3], pred_stride);
for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
build_ncobmc_intrpl_pred(cm, xd, plane, pxl_row, pxl_col, bsize, pred_buf,
pred_stride, mode);
}
}
static void av1_get_ncobmc_recon(AV1_COMMON *const cm, MACROBLOCKD *const xd,
int bsize, const int mi_row, const int mi_col,
const NCOBMC_MODE modes) {
const int mi_width = mi_size_wide[bsize];
const int mi_height = mi_size_high[bsize];
assert(bsize >= BLOCK_8X8);
reset_xd_boundary(xd, mi_row, mi_height, mi_col, mi_width, cm->mi_rows,
cm->mi_cols);
get_ncobmc_recon(cm, xd, mi_row, mi_col, bsize, modes);
}
static void recon_ncobmc_intrpl_pred(AV1_COMMON *const cm,
MACROBLOCKD *const xd, int mi_row,
int mi_col, BLOCK_SIZE bsize) {
MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
const int mi_width = mi_size_wide[bsize];
const int mi_height = mi_size_high[bsize];
const int hbs = AOMMAX(mi_size_wide[bsize] / 2, mi_size_high[bsize] / 2);
const BLOCK_SIZE sqr_blk = bsize_2_sqr_bsize[bsize];
if (mi_width > mi_height) {
// horizontal partition
av1_get_ncobmc_recon(cm, xd, sqr_blk, mi_row, mi_col, mbmi->ncobmc_mode[0]);
xd->mi += hbs;
av1_get_ncobmc_recon(cm, xd, sqr_blk, mi_row, mi_col + hbs,
mbmi->ncobmc_mode[1]);
} else if (mi_height > mi_width) {
// vertical partition
av1_get_ncobmc_recon(cm, xd, sqr_blk, mi_row, mi_col, mbmi->ncobmc_mode[0]);
xd->mi += hbs * xd->mi_stride;
av1_get_ncobmc_recon(cm, xd, sqr_blk, mi_row + hbs, mi_col,
mbmi->ncobmc_mode[1]);
} else {
av1_get_ncobmc_recon(cm, xd, sqr_blk, mi_row, mi_col, mbmi->ncobmc_mode[0]);
}
set_mode_info_offsets(cm, xd, mi_row, mi_col);
// restore dst buffer and mode info
av1_setup_dst_planes(xd->plane, bsize, get_frame_new_buffer(cm), mi_row,
mi_col);
}
#endif // CONFIG_NCOBMC_ADAPT_WEIGHT
static void decode_token_and_recon_block(AV1Decoder *const pbi,
MACROBLOCKD *const xd, int mi_row,
int mi_col, aom_reader *r,
......@@ -695,15 +607,6 @@ static void decode_token_and_recon_block(AV1Decoder *const pbi,
av1_build_obmc_inter_predictors_sb(cm, xd, mi_row, mi_col);
#endif
}
#if CONFIG_NCOBMC_ADAPT_WEIGHT
if (mbmi->motion_mode == NCOBMC_ADAPT_WEIGHT) {
int plane;
recon_ncobmc_intrpl_pred(cm, xd, mi_row, mi_col, bsize);
for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
get_pred_from_intrpl_buf(xd, mi_row, mi_col, bsize, plane);
}
}
#endif
// Reconstruction
if (!mbmi->skip) {
int eobtotal = 0;
......@@ -2433,10 +2336,6 @@ static const uint8_t *decode_tiles(AV1Decoder *pbi, const uint8_t *data,
for (mi_col = tile_info.mi_col_start; mi_col < tile_info.mi_col_end;
mi_col += cm->mib_size) {
#if CONFIG_NCOBMC_ADAPT_WEIGHT
alloc_ncobmc_pred_buffer(&td->xd);
set_sb_mi_boundaries(cm, &td->xd, mi_row, mi_col);
#endif
#if CONFIG_SYMBOLRATE
av1_record_superblock(td->xd.counts);
#endif
......@@ -2446,9 +2345,6 @@ static const uint8_t *decode_tiles(AV1Decoder *pbi, const uint8_t *data,
detoken_and_recon_sb(pbi, &td->xd, mi_row, mi_col, &td->bit_reader,
cm->sb_size);
#endif
#if CONFIG_NCOBMC_ADAPT_WEIGHT
free_ncobmc_pred_buffer(&td->xd);
#endif
#if CONFIG_LPF_SB
if (USE_LOOP_FILTER_SUPERBLOCK) {
// apply deblocking filtering right after each superblock is decoded
......@@ -3493,10 +3389,6 @@ static void debug_check_frame_counts(const AV1_COMMON *const cm) {
sizeof(cm->counts.compound_interinter)));
assert(!memcmp(cm->counts.motion_mode, zero_counts.motion_mode,
sizeof(cm->counts.motion_mode)));
#if CONFIG_NCOBMC_ADAPT_WEIGHT
assert(!memcmp(cm->counts.ncobmc_mode, zero_counts.ncobmc_mode,
sizeof(cm->counts.ncobmc_mode)));
#endif
assert(!memcmp(cm->counts.intra_inter, zero_counts.intra_inter,
sizeof(cm->counts.intra_inter)));
#if CONFIG_COMPOUND_SINGLEREF
......
......@@ -278,7 +278,7 @@ static void read_drl_idx(FRAME_CONTEXT *ec_ctx, MACROBLOCKD *xd,
static MOTION_MODE read_motion_mode(AV1_COMMON *cm, MACROBLOCKD *xd,
MODE_INFO *mi, aom_reader *r) {
MB_MODE_INFO *mbmi = &mi->mbmi;
#if CONFIG_NEW_MULTISYMBOL || CONFIG_NCOBMC_ADAPT_WEIGHT
#if CONFIG_NEW_MULTISYMBOL
(void)cm;
#endif
......@@ -288,19 +288,7 @@ static MOTION_MODE read_motion_mode(AV1_COMMON *cm, MACROBLOCKD *xd,
FRAME_COUNTS *counts = xd->counts;
if (last_motion_mode_allowed == SIMPLE_TRANSLATION) return SIMPLE_TRANSLATION;
#if CONFIG_NCOBMC_ADAPT_WEIGHT
if (last_motion_mode_allowed == NCOBMC_ADAPT_WEIGHT) {
motion_mode = aom_read_symbol(r, xd->tile_ctx->ncobmc_cdf[mbmi->sb_type],
OBMC_FAMILY_MODES, ACCT_STR);
if (counts) ++counts->ncobmc[mbmi->sb_type][motion_mode];
return (MOTION_MODE)(SIMPLE_TRANSLATION + motion_mode);
} else if (last_motion_mode_allowed == OBMC_CAUSAL) {
motion_mode =
aom_read_symbol(r, xd->tile_ctx->obmc_cdf[mbmi->sb_type], 2, ACCT_STR);
if (counts) ++counts->obmc[mbmi->sb_type][motion_mode];
return (MOTION_MODE)(SIMPLE_TRANSLATION + motion_mode);
} else {
#else
if (last_motion_mode_allowed == OBMC_CAUSAL) {
#if CONFIG_NEW_MULTISYMBOL
motion_mode =
......@@ -311,7 +299,6 @@ static MOTION_MODE read_motion_mode(AV1_COMMON *cm, MACROBLOCKD *xd,
if (counts) ++counts->obmc[mbmi->sb_type][motion_mode];
return (MOTION_MODE)(SIMPLE_TRANSLATION + motion_mode);
} else {
#endif // CONFIG_NCOBMC_ADAPT_WEIGHT
motion_mode =
aom_read_symbol(r, xd->tile_ctx->motion_mode_cdf[mbmi->sb_type],
MOTION_MODES, ACCT_STR);
......@@ -320,26 +307,6 @@ static MOTION_MODE read_motion_mode(AV1_COMMON *cm, MACROBLOCKD *xd,
}
}
#if CONFIG_NCOBMC_ADAPT_WEIGHT
static void read_ncobmc_mode(MACROBLOCKD *xd, MODE_INFO *mi,
NCOBMC_MODE ncobmc_mode[2], aom_reader *r) {
MB_MODE_INFO *mbmi = &mi->mbmi;
FRAME_COUNTS *counts = xd->counts;
ADAPT_OVERLAP_BLOCK ao_block = adapt_overlap_block_lookup[mbmi->sb_type];
if (mbmi->motion_mode != NCOBMC_ADAPT_WEIGHT) return;
ncobmc_mode[0] = aom_read_symbol(r, xd->tile_ctx->ncobmc_mode_cdf[ao_block],
MAX_NCOBMC_MODES, ACCT_STR);
if (counts) ++counts->ncobmc_mode[ao_block][ncobmc_mode[0]];
if (mi_size_wide[mbmi->sb_type] != mi_size_high[mbmi->sb_type]) {
ncobmc_mode[1] = aom_read_symbol(r, xd->tile_ctx->ncobmc_mode_cdf[ao_block],
MAX_NCOBMC_MODES, ACCT_STR);
if (counts) ++counts->ncobmc_mode[ao_block][ncobmc_mode[1]];
}
}
#endif // CONFIG_NCOBMC_ADAPT_WEIGHT
static PREDICTION_MODE read_inter_compound_mode(AV1_COMMON *cm, MACROBLOCKD *xd,
aom_reader *r, int16_t ctx) {
(void)cm;
......@@ -2523,10 +2490,6 @@ static void read_inter_block_mode_info(AV1Decoder *const pbi,
if (mbmi->ref_frame[1] != INTRA_FRAME)
mbmi->motion_mode = read_motion_mode(cm, xd, mi, r);
#if CONFIG_NCOBMC_ADAPT_WEIGHT
read_ncobmc_mode(xd, mi, mbmi->ncobmc_mode, r);
#endif
#if CONFIG_COMPOUND_SINGLEREF
if (is_singleref_comp_mode) assert(mbmi->motion_mode == SIMPLE_TRANSLATION);
#endif // CONFIG_COMPOUND_SINGLEREF
......
......@@ -33,9 +33,6 @@
#include "av1/decoder/decodeframe.h"
#include "av1/decoder/decoder.h"
#if CONFIG_NCOBMC_ADAPT_WEIGHT
#include "av1/common/ncobmc_kernels.h"
#endif // CONFIG_NCOBMC_ADAPT_WEIGHT
#include "av1/decoder/detokenize.h"
static void initialize_dec(void) {
......@@ -118,10 +115,6 @@ AV1Decoder *av1_decoder_create(BufferPool *const pool) {
av1_loop_filter_init(cm);
#if CONFIG_NCOBMC_ADAPT_WEIGHT
get_default_ncobmc_kernels(cm);
#endif // CONFIG_NCOBMC_ADAPT_WEIGHT
#if CONFIG_AOM_QM
aom_qm_init(cm);
#endif
......
......@@ -405,13 +405,6 @@ static void write_motion_mode(const AV1_COMMON *cm, MACROBLOCKD *xd,
motion_mode_allowed(0, cm->global_motion, xd, mi);
switch (last_motion_mode_allowed) {
case SIMPLE_TRANSLATION: break;
#if CONFIG_NCOBMC_ADAPT_WEIGHT
case NCOBMC_ADAPT_WEIGHT:
aom_write_symbol(w, mbmi->motion_mode,
xd->tile_ctx->ncobmc_cdf[mbmi->sb_type],
OBMC_FAMILY_MODES);
break;
#endif
case OBMC_CAUSAL:
#if CONFIG_NEW_MULTISYMBOL
aom_write_symbol(w, mbmi->motion_mode == OBMC_CAUSAL,
......@@ -421,7 +414,6 @@ static void write_motion_mode(const AV1_COMMON *cm, MACROBLOCKD *xd,
cm->fc->obmc_prob[mbmi->sb_type]);
#endif
break;
default:
aom_write_symbol(w, mbmi->motion_mode,
xd->tile_ctx->motion_mode_cdf[mbmi->sb_type],
......@@ -429,22 +421,6 @@ static void write_motion_mode(const AV1_COMMON *cm, MACROBLOCKD *xd,
}
}
#if CONFIG_NCOBMC_ADAPT_WEIGHT
static void write_ncobmc_mode(MACROBLOCKD *xd, const MODE_INFO *mi,
aom_writer *w) {
const MB_MODE_INFO *mbmi = &mi->mbmi;
ADAPT_OVERLAP_BLOCK ao_block = adapt_overlap_block_lookup[mbmi->sb_type];
if (mbmi->motion_mode != NCOBMC_ADAPT_WEIGHT) return;
aom_write_symbol(w, mbmi->ncobmc_mode[0],
xd->tile_ctx->ncobmc_mode_cdf[ao_block], MAX_NCOBMC_MODES);
if (mi_size_wide[mbmi->sb_type] != mi_size_high[mbmi->sb_type]) {
aom_write_symbol(w, mbmi->ncobmc_mode[1],
xd->tile_ctx->ncobmc_mode_cdf[ao_block], MAX_NCOBMC_MODES);
}
}
#endif
static void write_delta_qindex(const AV1_COMMON *cm, const MACROBLOCKD *xd,