Commit 918fe698 authored by Lester Lu's avatar Lester Lu Committed by Debargha Mukherjee

Refactor lgt

Change get_lgt in order to integrate a later experiment
lgt_from_pred with lgt. There are two main changes.

The main purpose for this change is to unify get_fwd_lgt and
get_inv_lgt functions into a get_lgt function so the lgt basis
functions can always be selected through the same function in
both forward and inverse transform paths. The structure of those
functions will also be consistent with the get_lgt_from_pred
functions that will be added in the lgt-from-pred experiment.

These changes have no impact on the bitstream.

Change-Id: Ifd3dfc1a9e1a250495830ddbf42c201e80aa913e
parent 8f661605
......@@ -31,13 +31,13 @@ typedef struct txfm_param {
int is_inter;
int stride;
uint8_t *dst;
#if CONFIG_LGT
int mode;
#endif
#if CONFIG_MRC_TX
int *valid_mask;
#endif // CONFIG_MRC_TX
#endif // CONFIG_MRC_TX || CONFIG_LGT
#if CONFIG_LGT
int mode;
#endif
// for inverse transforms only
#if CONFIG_ADAPT_SCAN
const int16_t *eob_threshold;
......@@ -97,9 +97,10 @@ static INLINE tran_high_t fdct_round_shift(tran_high_t input) {
}
#if CONFIG_LGT
// The Line Graph Transforms (LGTs) matrices are written as follows.
// Each 2D array is 16384 times an LGT matrix, which is the matrix of
// eigenvectors of the graph Laplacian matrices for the line graph.
/* The Line Graph Transforms (LGTs) matrices are defined as follows.
* Each 2D array is sqrt(2)*16384 times an LGT matrix, which is the
* matrix of eigenvectors of the graph Laplacian matrix of the associated
* line graph. */
// LGT4 name: lgt4_140
// Self loops: 1.400, 0.000, 0.000, 0.000
......
......@@ -1235,19 +1235,6 @@ static INLINE int av1_raster_order_to_block_index(TX_SIZE tx_size,
return (tx_size == TX_4X4) ? raster_order : (raster_order > 0) ? 2 : 0;
}
#if CONFIG_LGT
static INLINE PREDICTION_MODE get_prediction_mode(const MODE_INFO *mi,
int plane, TX_SIZE tx_size,
int block_idx) {
const MB_MODE_INFO *const mbmi = &mi->mbmi;
if (is_inter_block(mbmi)) return mbmi->mode;
int block_raster_idx = av1_block_index_to_raster_order(tx_size, block_idx);
return (plane == PLANE_TYPE_Y) ? get_y_mode(mi, block_raster_idx)
: get_uv_mode(mbmi->uv_mode);
}
#endif // CONFIG_LGT
static INLINE TX_TYPE get_default_tx_type(PLANE_TYPE plane_type,
const MACROBLOCKD *xd, int block_idx,
TX_SIZE tx_size) {
......
This diff is collapsed.
......@@ -26,13 +26,19 @@
extern "C" {
#endif
// TODO(kslu) move the common stuff in idct.h to av1_txfm.h or txfm_common.h
typedef void (*transform_1d)(const tran_low_t *, tran_low_t *);
typedef struct {
transform_1d cols, rows; // vertical and horizontal
} transform_2d;
#if CONFIG_LGT
int get_lgt4(const TxfmParam *txfm_param, int is_col,
const tran_high_t **lgtmtx);
int get_lgt8(const TxfmParam *txfm_param, int is_col,
const tran_high_t **lgtmtx);
#endif // CONFIG_LGT
#if CONFIG_HIGHBITDEPTH
typedef void (*highbd_transform_1d)(const tran_low_t *, tran_low_t *, int bd);
......
......@@ -504,13 +504,9 @@ static void predict_and_reconstruct_intra_block(
if (eob) {
uint8_t *dst =
&pd->dst.buf[(row * pd->dst.stride + col) << tx_size_wide_log2[0]];
#if CONFIG_LGT
const PREDICTION_MODE mode =
get_prediction_mode(xd->mi[0], plane, tx_size, block_idx);
#endif // CONFIG_LGT
inverse_transform_block(xd, plane,
#if CONFIG_LGT
mode,
mbmi->mode,
#endif
tx_type, tx_size, dst, pd->dst.stride,
max_scan_line, eob);
......
This diff is collapsed.
......@@ -615,8 +615,8 @@ void av1_xform_quant(const AV1_COMMON *cm, MACROBLOCK *x, int plane, int block,
#endif // CONFIG_MRC_TX
#endif // CONFIG_MRC_TX || CONFIG_LGT
#if CONFIG_LGT
txfm_param.mode = get_prediction_mode(xd->mi[0], plane, tx_size, block);
#endif
txfm_param.mode = mbmi->mode;
#endif // CONFIG_LGT
#if !CONFIG_PVQ
txfm_param.bd = xd->bd;
......@@ -746,7 +746,7 @@ static void encode_block(int plane, int block, int blk_row, int blk_col,
TX_TYPE tx_type =
av1_get_tx_type(pd->plane_type, xd, blk_row, blk_col, block, tx_size);
#if CONFIG_LGT
PREDICTION_MODE mode = get_prediction_mode(xd->mi[0], plane, tx_size, block);
PREDICTION_MODE mode = xd->mi[0]->mbmi.mode;
av1_inverse_transform_block(xd, dqcoeff, mode, tx_type, tx_size, dst,
pd->dst.stride, p->eobs[block]);
#else
......@@ -1063,11 +1063,6 @@ void av1_encode_block_intra(int plane, int block, int blk_row, int blk_col,
av1_predict_intra_block_facade(xd, plane, block, blk_col, blk_row, tx_size);
#if CONFIG_LGT
const PREDICTION_MODE mode =
get_prediction_mode(xd->mi[0], plane, tx_size, block);
#endif // CONFIG_LGT
av1_subtract_txb(x, plane, plane_bsize, blk_col, blk_row, tx_size);
const ENTROPY_CONTEXT *a = &args->ta[blk_col];
......@@ -1091,7 +1086,7 @@ void av1_encode_block_intra(int plane, int block, int blk_row, int blk_col,
#endif // CONFIG_PVQ
av1_inverse_transform_block(xd, dqcoeff,
#if CONFIG_LGT
mode,
xd->mi[0]->mbmi.mode,
#endif
tx_type, tx_size, dst, dst_stride, *eob);
#if !CONFIG_PVQ
......
......@@ -4560,14 +4560,11 @@ void av1_tx_block_rd_b(const AV1_COMP *cpi, MACROBLOCK *x, TX_SIZE tx_size,
const int eob = p->eobs[block];
av1_inverse_transform_block(xd, dqcoeff,
#if CONFIG_LGT
PREDICTION_MODE mode = get_prediction_mode(xd->mi[0], plane, tx_size, block);
av1_inverse_transform_block(xd, dqcoeff, mode, tx_type, tx_size, rec_buffer,
MAX_TX_SIZE, eob);
#else
av1_inverse_transform_block(xd, dqcoeff, tx_type, tx_size, rec_buffer,
MAX_TX_SIZE, eob);
xd->mi[0]->mbmi.mode,
#endif
tx_type, tx_size, rec_buffer, MAX_TX_SIZE, eob);
if (eob > 0) {
#if CONFIG_DIST_8X8
if (x->using_dist_8x8 && plane == 0 && (bw < 8 && bh < 8)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment