Commit 3eed4175 authored by Sarah Parker's avatar Sarah Parker Committed by Sebastien Alaiwan

Add configurations for hbd identity transform

This adds the proper cfgs to av1_{inv/fwd}_txfm1d_cfg for
the identity transform so all hbd transforms can use
the same codepath. This has no impact on performance
since the new identity transforms that correspond with
the cfgs are not yet being called. Once this is checked in,
we should be able to delete all deprecated transform functions
and have a single code flow for all hbd transforms.

BUG=aomedia:524

Change-Id: I3d1bfbc8bc29b367e8ddf7dcd27525af0bd31067
parent f2b87bd3
......@@ -10,6 +10,7 @@
*/
#include <stdlib.h>
#include "aom_dsp/inv_txfm.h"
#include "av1/common/av1_fwd_txfm1d.h"
#if CONFIG_COEFFICIENT_RANGE_CHECKING
......@@ -1516,6 +1517,38 @@ void av1_fadst32_new(const int32_t *input, int32_t *output,
range_check(stage, input, bf1, size, stage_range[stage]);
}
#if CONFIG_EXT_TX
void av1_fidentity4_c(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range) {
(void)cos_bit;
for (int i = 0; i < 4; ++i)
output[i] = (int32_t)dct_const_round_shift(input[i] * Sqrt2);
range_check(0, input, output, 4, stage_range[0]);
}
void av1_fidentity8_c(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range) {
(void)cos_bit;
for (int i = 0; i < 8; ++i) output[i] = input[i] * 2;
range_check(0, input, output, 8, stage_range[0]);
}
void av1_fidentity16_c(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range) {
(void)cos_bit;
for (int i = 0; i < 16; ++i)
output[i] = (int32_t)dct_const_round_shift(input[i] * 2 * Sqrt2);
range_check(0, input, output, 16, stage_range[0]);
}
void av1_fidentity32_c(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range) {
(void)cos_bit;
for (int i = 0; i < 32; ++i) output[i] = input[i] * 4;
range_check(0, input, output, 32, stage_range[0]);
}
#endif // CONFIG_EXT_TX
#if CONFIG_TX64X64
void av1_fdct64_new(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range) {
......
......@@ -37,6 +37,16 @@ void av1_fadst16_new(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
void av1_fadst32_new(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
#if CONFIG_EXT_TX
void av1_fidentity4_c(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
void av1_fidentity8_c(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
void av1_fidentity16_c(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
void av1_fidentity32_c(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
#endif // CONFIG_EXT_TX
#ifdef __cplusplus
}
......
......@@ -13,6 +13,9 @@
#define AV1_FWD_TXFM2D_CFG_H_
#include "av1/common/enums.h"
#include "av1/common/av1_fwd_txfm1d.h"
// Identity will always use max bitdepth regardless of size
static const int8_t fwd_stage_range_identity[1] = { 12 };
// ---------------- 4x4 1D constants -----------------------
// shift
static const int8_t fwd_shift_4[3] = { 2, 0, 0 };
......@@ -311,4 +314,51 @@ static const TXFM_1D_CFG fwd_txfm_1d_col_cfg_adst_32 = {
fwd_cos_bit_col_adst_32, // .cos_bit
TXFM_TYPE_ADST32, // .txfm_type
};
#if CONFIG_EXT_TX
// identity does not need to differentiate between row and col
// ---------------- row/col config fwd_identity_4 ----------
static const TXFM_1D_CFG fwd_txfm_1d_cfg_identity_4 = {
4, // .txfm_size
1, // .stage_num
// 0, // .log_scale
fwd_shift_4, // .shift
fwd_stage_range_identity, // .stage_range
NULL, // .cos_bit
TXFM_TYPE_IDENTITY4, // .txfm_type
};
// ---------------- row/col config fwd_identity_8 ----------------
static const TXFM_1D_CFG fwd_txfm_1d_cfg_identity_8 = {
8, // .txfm_size
1, // .stage_num
// 0, // .log_scale
fwd_shift_8, // .shift
fwd_stage_range_identity, // .stage_range
NULL, // .cos_bit
TXFM_TYPE_IDENTITY8, // .txfm_type
};
// ---------------- row/col config fwd_identity_16 ----------------
static const TXFM_1D_CFG fwd_txfm_1d_cfg_identity_16 = {
16, // .txfm_size
1, // .stage_num
// 0, // .log_scale
fwd_shift_16, // .shift
fwd_stage_range_identity, // .stage_range
NULL, // .cos_bit
TXFM_TYPE_IDENTITY16, // .txfm_type
};
// ---------------- row/col config fwd_identity_32 ----------------
static const TXFM_1D_CFG fwd_txfm_1d_cfg_identity_32 = {
32, // .txfm_size
1, // .stage_num
// 1, // .log_scale
fwd_shift_32, // .shift
fwd_stage_range_identity, // .stage_range
NULL, // .cos_bit
TXFM_TYPE_IDENTITY32, // .txfm_type
};
#endif // CONFIG_EXT_TX
#endif // AV1_FWD_TXFM2D_CFG_H_
......@@ -27,6 +27,12 @@ static INLINE TxfmFunc fwd_txfm_type_to_func(TXFM_TYPE txfm_type) {
case TXFM_TYPE_ADST8: return av1_fadst8_new;
case TXFM_TYPE_ADST16: return av1_fadst16_new;
case TXFM_TYPE_ADST32: return av1_fadst32_new;
#if CONFIG_EXT_TX
case TXFM_TYPE_IDENTITY4: return av1_fidentity4_c;
case TXFM_TYPE_IDENTITY8: return av1_fidentity8_c;
case TXFM_TYPE_IDENTITY16: return av1_fidentity16_c;
case TXFM_TYPE_IDENTITY32: return av1_fidentity32_c;
#endif // CONFIG_EXT_TX
default: assert(0); return NULL;
}
}
......@@ -141,13 +147,13 @@ static const TXFM_1D_CFG *fwd_txfm_col_cfg_ls[TX_TYPES_1D][TX_SIZES] = {
#endif
&fwd_txfm_1d_col_cfg_adst_4, &fwd_txfm_1d_col_cfg_adst_8,
&fwd_txfm_1d_col_cfg_adst_16, &fwd_txfm_1d_col_cfg_adst_32 },
// IDENTITY PLACEHOLDER
// IDENTITY
{
#if CONFIG_CB4X4
NULL,
#endif
&fwd_txfm_1d_col_cfg_adst_4, &fwd_txfm_1d_col_cfg_adst_8,
&fwd_txfm_1d_col_cfg_adst_16, &fwd_txfm_1d_col_cfg_adst_32 },
&fwd_txfm_1d_cfg_identity_4, &fwd_txfm_1d_cfg_identity_8,
&fwd_txfm_1d_cfg_identity_16, &fwd_txfm_1d_cfg_identity_32 },
#endif // CONFIG_EXT_TX
};
......@@ -174,13 +180,13 @@ static const TXFM_1D_CFG *fwd_txfm_row_cfg_ls[TX_TYPES_1D][TX_SIZES] = {
#endif
&fwd_txfm_1d_row_cfg_adst_4, &fwd_txfm_1d_row_cfg_adst_8,
&fwd_txfm_1d_row_cfg_adst_16, &fwd_txfm_1d_row_cfg_adst_32 },
// IDENTITY PLACEHOLDER
// IDENTITY
{
#if CONFIG_CB4X4
NULL,
#endif
&fwd_txfm_1d_row_cfg_adst_4, &fwd_txfm_1d_row_cfg_adst_8,
&fwd_txfm_1d_row_cfg_adst_16, &fwd_txfm_1d_row_cfg_adst_32 },
&fwd_txfm_1d_cfg_identity_4, &fwd_txfm_1d_cfg_identity_8,
&fwd_txfm_1d_cfg_identity_16, &fwd_txfm_1d_cfg_identity_32 },
#endif // CONFIG_EXT_TX
};
......
......@@ -10,6 +10,7 @@
*/
#include <stdlib.h>
#include "aom_dsp/inv_txfm.h"
#include "av1/common/av1_inv_txfm1d.h"
#if CONFIG_COEFFICIENT_RANGE_CHECKING
......@@ -1538,6 +1539,38 @@ void av1_iadst32_new(const int32_t *input, int32_t *output,
range_check(stage, input, bf1, size, stage_range[stage]);
}
#if CONFIG_EXT_TX
void av1_iidentity4_c(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range) {
(void)cos_bit;
for (int i = 0; i < 4; ++i)
output[i] = (int32_t)dct_const_round_shift(input[i] * Sqrt2);
range_check(0, input, output, 4, stage_range[0]);
}
void av1_iidentity8_c(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range) {
(void)cos_bit;
for (int i = 0; i < 8; ++i) output[i] = input[i] * 2;
range_check(0, input, output, 8, stage_range[0]);
}
void av1_iidentity16_c(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range) {
(void)cos_bit;
for (int i = 0; i < 16; ++i)
output[i] = (int32_t)dct_const_round_shift(input[i] * 2 * Sqrt2);
range_check(0, input, output, 16, stage_range[0]);
}
void av1_iidentity32_c(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range) {
(void)cos_bit;
for (int i = 0; i < 32; ++i) output[i] = input[i] * 4;
range_check(0, input, output, 32, stage_range[0]);
}
#endif // CONFIG_EXT_TX
#if CONFIG_TX64X64
void av1_idct64_new(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range) {
......
......@@ -37,6 +37,16 @@ void av1_iadst16_new(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
void av1_iadst32_new(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
#if CONFIG_EXT_TX
void av1_iidentity4_c(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
void av1_iidentity8_c(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
void av1_iidentity16_c(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
void av1_iidentity32_c(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
#endif // CONFIG_EXT_TX
#ifdef __cplusplus
}
......
......@@ -12,6 +12,9 @@
#ifndef AV1_INV_TXFM2D_CFG_H_
#define AV1_INV_TXFM2D_CFG_H_
#include "av1/common/av1_inv_txfm1d.h"
// Identity will always use max bitdepth regardless of size
static const int8_t inv_stage_range_identity[1] = { 12 };
// ---------------- 4x4 1D config -----------------------
// shift
static const int8_t inv_shift_4[2] = { 0, -4 };
......@@ -309,4 +312,51 @@ static const TXFM_1D_CFG inv_txfm_1d_col_cfg_adst_32 = {
inv_cos_bit_col_adst_32, // .cos_bit
TXFM_TYPE_ADST32, // .txfm_type
};
#if CONFIG_EXT_TX
// identity does not need to differentiate between row and col
// ---------------- row/col config inv_identity_4 ----------
static const TXFM_1D_CFG inv_txfm_1d_cfg_identity_4 = {
4, // .txfm_size
1, // .stage_num
// 0, // .log_scale
inv_shift_4, // .shift
inv_stage_range_identity, // .stage_range
NULL, // .cos_bit
TXFM_TYPE_IDENTITY4, // .txfm_type
};
// ---------------- row/col config inv_identity_8 ----------------
static const TXFM_1D_CFG inv_txfm_1d_cfg_identity_8 = {
8, // .txfm_size
1, // .stage_num
// 0, // .log_scale
inv_shift_8, // .shift
inv_stage_range_identity, // .stage_range
NULL, // .cos_bit
TXFM_TYPE_IDENTITY8, // .txfm_type
};
// ---------------- row/col config inv_identity_16 ----------------
static const TXFM_1D_CFG inv_txfm_1d_cfg_identity_16 = {
16, // .txfm_size
1, // .stage_num
// 0, // .log_scale
inv_shift_16, // .shift
inv_stage_range_identity, // .stage_range
NULL, // .cos_bit
TXFM_TYPE_IDENTITY16, // .txfm_type
};
// ---------------- row/col config inv_identity_32 ----------------
static const TXFM_1D_CFG inv_txfm_1d_cfg_identity_32 = {
32, // .txfm_size
1, // .stage_num
// 1, // .log_scale
inv_shift_32, // .shift
inv_stage_range_identity, // .stage_range
NULL, // .cos_bit
TXFM_TYPE_IDENTITY32, // .txfm_type
};
#endif // CONFIG_EXT_TX
#endif // AV1_INV_TXFM2D_CFG_H_
......@@ -25,6 +25,12 @@ static INLINE TxfmFunc inv_txfm_type_to_func(TXFM_TYPE txfm_type) {
case TXFM_TYPE_ADST8: return av1_iadst8_new;
case TXFM_TYPE_ADST16: return av1_iadst16_new;
case TXFM_TYPE_ADST32: return av1_iadst32_new;
#if CONFIG_EXT_TX
case TXFM_TYPE_IDENTITY4: return av1_iidentity4_c;
case TXFM_TYPE_IDENTITY8: return av1_iidentity8_c;
case TXFM_TYPE_IDENTITY16: return av1_iidentity16_c;
case TXFM_TYPE_IDENTITY32: return av1_iidentity32_c;
#endif // CONFIG_EXT_TX
default: assert(0); return NULL;
}
}
......@@ -52,13 +58,13 @@ static const TXFM_1D_CFG *inv_txfm_col_cfg_ls[TX_TYPES_1D][TX_SIZES] = {
#endif
&inv_txfm_1d_col_cfg_adst_4, &inv_txfm_1d_col_cfg_adst_8,
&inv_txfm_1d_col_cfg_adst_16, &inv_txfm_1d_col_cfg_adst_32 },
// IDENTITY PLACEHOLDER
// IDENTITY
{
#if CONFIG_CB4X4
NULL,
#endif
&inv_txfm_1d_col_cfg_adst_4, &inv_txfm_1d_col_cfg_adst_8,
&inv_txfm_1d_col_cfg_adst_16, &inv_txfm_1d_col_cfg_adst_32 },
&inv_txfm_1d_cfg_identity_4, &inv_txfm_1d_cfg_identity_8,
&inv_txfm_1d_cfg_identity_16, &inv_txfm_1d_cfg_identity_32 },
#endif // CONFIG_EXT_TX
};
......@@ -85,13 +91,13 @@ static const TXFM_1D_CFG *inv_txfm_row_cfg_ls[TX_TYPES_1D][TX_SIZES] = {
#endif
&inv_txfm_1d_row_cfg_adst_4, &inv_txfm_1d_row_cfg_adst_8,
&inv_txfm_1d_row_cfg_adst_16, &inv_txfm_1d_row_cfg_adst_32 },
// IDENTITY PLACEHOLDER
// IDENTITY
{
#if CONFIG_CB4X4
NULL,
#endif
&inv_txfm_1d_row_cfg_adst_4, &inv_txfm_1d_row_cfg_adst_8,
&inv_txfm_1d_row_cfg_adst_16, &inv_txfm_1d_row_cfg_adst_32 },
&inv_txfm_1d_cfg_identity_4, &inv_txfm_1d_cfg_identity_8,
&inv_txfm_1d_cfg_identity_16, &inv_txfm_1d_cfg_identity_32 },
#endif // CONFIG_EXT_TX
};
......
......@@ -143,6 +143,10 @@ typedef enum TXFM_TYPE {
TXFM_TYPE_ADST8,
TXFM_TYPE_ADST16,
TXFM_TYPE_ADST32,
TXFM_TYPE_IDENTITY4,
TXFM_TYPE_IDENTITY8,
TXFM_TYPE_IDENTITY16,
TXFM_TYPE_IDENTITY32,
} TXFM_TYPE;
typedef struct TXFM_1D_CFG {
......@@ -172,13 +176,23 @@ static INLINE void set_flip_cfg(int tx_type, TXFM_2D_FLIP_CFG *cfg) {
cfg->lr_flip = 0;
break;
#if CONFIG_EXT_TX
case IDTX:
case V_DCT:
case H_DCT:
case V_ADST:
case H_ADST:
cfg->ud_flip = 0;
cfg->lr_flip = 0;
break;
case FLIPADST_DCT:
case FLIPADST_ADST:
case V_FLIPADST:
cfg->ud_flip = 1;
cfg->lr_flip = 0;
break;
case DCT_FLIPADST:
case ADST_FLIPADST:
case H_FLIPADST:
cfg->ud_flip = 0;
cfg->lr_flip = 1;
break;
......
......@@ -115,6 +115,10 @@ static void ihalfright64_c(const tran_low_t *input, tran_low_t *output) {
#if CONFIG_HIGHBITDEPTH
#if CONFIG_EXT_TX
// TODO(sarahparker) these functions will be removed once the highbitdepth
// codepath works properly for rectangular transforms. They have almost
// identical versions in av1_inv_txfm1d.c, but those are currently only
// being used for square transforms.
static void highbd_iidtx4_c(const tran_low_t *input, tran_low_t *output,
int bd) {
int i;
......
......@@ -1022,6 +1022,10 @@ static void fhalfright32(const tran_low_t *input, tran_low_t *output) {
}
#if CONFIG_EXT_TX
// TODO(sarahparker) these functions will be removed once the highbitdepth
// codepath works properly for rectangular transforms. They have almost
// identical versions in av1_fwd_txfm1d.c, but those are currently only
// being used for square transforms.
static void fidtx4(const tran_low_t *input, tran_low_t *output) {
int i;
for (i = 0; i < 4; ++i)
......
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