/* * 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.
*/
staticinline TxfmFunc fwd_txfm_type_to_func(TXFM_TYPE txfm_type) { switch (txfm_type) { case TXFM_TYPE_DCT4: return av1_fdct4; case TXFM_TYPE_DCT8: return av1_fdct8; case TXFM_TYPE_DCT16: return av1_fdct16; case TXFM_TYPE_DCT32: return av1_fdct32; case TXFM_TYPE_DCT64: return av1_fdct64; case TXFM_TYPE_ADST4: return av1_fadst4; case TXFM_TYPE_ADST8: return av1_fadst8; case TXFM_TYPE_ADST16: return av1_fadst16; 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; default: assert(0); return NULL;
}
}
void av1_gen_fwd_stage_range(int8_t *stage_range_col, int8_t *stage_range_row, const TXFM_2D_FLIP_CFG *cfg, int bd) { // Take the shift from the larger dimension in the rectangular case. const int8_t *shift = cfg->shift; // i < MAX_TXFM_STAGE_NUM will mute above array bounds warning for (int i = 0; i < cfg->stage_num_col && i < MAX_TXFM_STAGE_NUM; ++i) {
stage_range_col[i] = cfg->stage_range_col[i] + shift[0] + bd + 1;
}
// i < MAX_TXFM_STAGE_NUM will mute above array bounds warning for (int i = 0; i < cfg->stage_num_row && i < MAX_TXFM_STAGE_NUM; ++i) {
stage_range_row[i] = cfg->stage_range_row[i] + shift[0] + shift[1] + bd + 1;
}
}
staticinlinevoid fwd_txfm2d_c(const int16_t *input, int32_t *output, constint stride, const TXFM_2D_FLIP_CFG *cfg,
int32_t *buf, int bd) { int c, r; // Note when assigning txfm_size_col, we use the txfm_size from the // row configuration and vice versa. This is intentionally done to // accurately perform rectangular transforms. When the transform is // rectangular, the number of columns will be the same as the // txfm_size stored in the row cfg struct. It will make no difference // for square transforms. constint txfm_size_col = tx_size_wide[cfg->tx_size]; constint txfm_size_row = tx_size_high[cfg->tx_size]; // Take the shift from the larger dimension in the rectangular case. const int8_t *shift = cfg->shift; constint rect_type = get_rect_tx_log_ratio(txfm_size_col, txfm_size_row);
int8_t stage_range_col[MAX_TXFM_STAGE_NUM];
int8_t stage_range_row[MAX_TXFM_STAGE_NUM];
assert(cfg->stage_num_col <= MAX_TXFM_STAGE_NUM);
assert(cfg->stage_num_row <= MAX_TXFM_STAGE_NUM);
av1_gen_fwd_stage_range(stage_range_col, stage_range_row, cfg, bd);
// Rows for (r = 0; r < txfm_size_row; ++r) {
txfm_func_row(buf + r * txfm_size_col, row_buffer, cos_bit_row,
stage_range_row);
av1_round_shift_array(row_buffer, txfm_size_col, -shift[2]); if (abs(rect_type) == 1) { // Multiply everything by Sqrt2 if the transform is rectangular and the // size difference is a factor of 2. for (c = 0; c < txfm_size_col; ++c) {
row_buffer[c] =
round_shift((int64_t)row_buffer[c] * NewSqrt2, NewSqrt2Bits);
}
} for (c = 0; c < txfm_size_col; ++c) {
output[c * txfm_size_row + r] = row_buffer[c];
}
}
}
// Zero out top-right 32x32 area. for (int col = 0; col < 32; ++col) {
memset(output + col * 64 + 32, 0, 32 * sizeof(*output));
} // Zero out the bottom 64x32 area.
memset(output + 32 * 64, 0, 32 * 64 * sizeof(*output)); // Re-pack non-zero coeffs in the first 32x32 indices. for (int col = 1; col < 32; ++col) {
memcpy(output + col * 32, output + col * 64, 32 * sizeof(*output));
}
}
void av1_fwd_txfm2d_32x64_c(const int16_t *input, int32_t *output, int stride,
TX_TYPE tx_type, int bd) {
DECLARE_ALIGNED(32, int32_t, txfm_buf[32 * 64]);
TXFM_2D_FLIP_CFG cfg;
av1_get_fwd_txfm_cfg(tx_type, TX_32X64, &cfg);
fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd); // Zero out right 32x32 area. for (int col = 0; col < 32; ++col) {
memset(output + col * 64 + 32, 0, 32 * sizeof(*output));
} // Re-pack non-zero coeffs in the first 32x32 indices. for (int col = 1; col < 32; ++col) {
memcpy(output + col * 32, output + col * 64, 32 * sizeof(*output));
}
}
void av1_fwd_txfm2d_64x32_c(const int16_t *input, int32_t *output, int stride,
TX_TYPE tx_type, int bd) {
int32_t txfm_buf[64 * 32];
TXFM_2D_FLIP_CFG cfg;
av1_get_fwd_txfm_cfg(tx_type, TX_64X32, &cfg);
fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd); // Zero out the bottom 32x32 area.
memset(output + 32 * 32, 0, 32 * 32 * sizeof(*output)); // Note: no repacking needed here.
}
#if !CONFIG_REALTIME_ONLY void av1_fwd_txfm2d_16x64_c(const int16_t *input, int32_t *output, int stride,
TX_TYPE tx_type, int bd) {
DECLARE_ALIGNED(32, int32_t, txfm_buf[64 * 16]);
TXFM_2D_FLIP_CFG cfg;
av1_get_fwd_txfm_cfg(tx_type, TX_16X64, &cfg);
fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd); // Zero out right 32x16 area. for (int row = 0; row < 16; ++row) {
memset(output + row * 64 + 32, 0, 32 * sizeof(*output));
} // Re-pack non-zero coeffs in the first 32x16 indices. for (int row = 1; row < 16; ++row) {
memcpy(output + row * 32, output + row * 64, 32 * sizeof(*output));
}
}
void av1_fwd_txfm2d_64x16_c(const int16_t *input, int32_t *output, int stride,
TX_TYPE tx_type, int bd) {
int32_t txfm_buf[64 * 16];
TXFM_2D_FLIP_CFG cfg;
av1_get_fwd_txfm_cfg(tx_type, TX_64X16, &cfg);
fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd); // Zero out the bottom 16x32 area.
memset(output + 16 * 32, 0, 16 * 32 * sizeof(*output)); // Note: no repacking needed here.
} #endif// !CONFIG_REALTIME_ONLY
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.