Commit 3824f8ad authored by Sarah Parker's avatar Sarah Parker

Allow the creation of different masks for inter and intra

This allows inter and intra modes to use different mask functions.
The mask functions checked in are still place holders to allow for
easy experimentation.

Change-Id: Ic20d88200676df81dffee8c43555d0ff0c7bfc28
parent 9d068c12
......@@ -266,8 +266,24 @@ static INLINE int av1_rotate_tx_type(int tx_type) {
#endif // CONFIG_TXMG
#if CONFIG_MRC_TX
static INLINE int get_mrc_mask(const uint8_t *pred, int pred_stride, int *mask,
int mask_stride, int width, int height) {
static INLINE int get_mrc_mask_inter(const uint8_t *pred, int pred_stride,
int *mask, int mask_stride, int width,
int height) {
// placeholder mask generation function
int n_masked_vals = 0;
for (int i = 0; i < height; ++i) {
for (int j = 0; j < width; ++j) {
mask[i * mask_stride + j] = pred[i * pred_stride + j] > 100 ? 1 : 0;
n_masked_vals += mask[i * mask_stride + j];
}
}
return n_masked_vals;
}
static INLINE int get_mrc_mask_intra(const uint8_t *pred, int pred_stride,
int *mask, int mask_stride, int width,
int height) {
// placeholder mask generation function
int n_masked_vals = 0;
for (int i = 0; i < height; ++i) {
for (int j = 0; j < width; ++j) {
......@@ -278,6 +294,20 @@ static INLINE int get_mrc_mask(const uint8_t *pred, int pred_stride, int *mask,
return n_masked_vals;
}
static INLINE int get_mrc_mask(const uint8_t *pred, int pred_stride, int *mask,
int mask_stride, int width, int height,
int is_inter) {
if (is_inter) {
assert(USE_MRC_INTER && "MRC invalid for inter blocks");
return get_mrc_mask_inter(pred, pred_stride, mask, mask_stride, width,
height);
} else {
assert(USE_MRC_INTRA && "MRC invalid for intra blocks");
return get_mrc_mask_intra(pred, pred_stride, mask, mask_stride, width,
height);
}
}
static INLINE int is_valid_mrc_mask(int n_masked_vals, int width, int height) {
return !(n_masked_vals == 0 || n_masked_vals == (width * height));
}
......
......@@ -1496,8 +1496,8 @@ static void imrc32x32_add_c(const tran_low_t *input, uint8_t *dest, int stride,
aom_idct32x32_1_add_c(input, dest, stride);
} else {
int mask[32 * 32];
int n_masked_vals =
get_mrc_mask(txfm_param->dst, txfm_param->stride, mask, 32, 32, 32);
int n_masked_vals = get_mrc_mask(txfm_param->dst, txfm_param->stride, mask,
32, 32, 32, txfm_param->is_inter);
if (!is_valid_mrc_mask(n_masked_vals, 32, 32))
assert(0 && "Invalid MRC mask");
......
......@@ -1092,9 +1092,11 @@ static void fhalfright32(const tran_low_t *input, tran_low_t *output) {
#if CONFIG_MRC_TX
static void get_masked_residual32(const int16_t **input, int *input_stride,
const uint8_t *pred, int pred_stride,
int16_t *masked_input, int *valid_mask) {
int16_t *masked_input, int *valid_mask,
int is_inter) {
int mrc_mask[32 * 32];
int n_masked_vals = get_mrc_mask(pred, pred_stride, mrc_mask, 32, 32, 32);
int n_masked_vals =
get_mrc_mask(pred, pred_stride, mrc_mask, 32, 32, 32, is_inter);
// Do not use MRC_DCT if mask is invalid. DCT_DCT will be used instead.
if (!is_valid_mrc_mask(n_masked_vals, 32, 32)) {
*valid_mask = 0;
......@@ -2458,7 +2460,8 @@ void av1_fht32x32_c(const int16_t *input, tran_low_t *output, int stride,
if (tx_type == MRC_DCT) {
int16_t masked_input[32 * 32];
get_masked_residual32(&input, &stride, txfm_param->dst, txfm_param->stride,
masked_input, txfm_param->valid_mask);
masked_input, txfm_param->valid_mask,
txfm_param->is_inter);
}
#endif // CONFIG_MRC_TX
......
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