mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-22 15:17:29 +09:00
Update aom to v1.0.0
Update aom to commit id d14c5bb4f336ef1842046089849dee4a301fbbf0.
This commit is contained in:
parent
bb61121b44
commit
48f6d2e034
1087 changed files with 154333 additions and 265310 deletions
386
third_party/aom/av1/common/alloccommon.c
vendored
386
third_party/aom/av1/common/alloccommon.c
vendored
|
|
@ -10,7 +10,8 @@
|
|||
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
|
||||
*/
|
||||
|
||||
#include "./aom_config.h"
|
||||
#include "config/aom_config.h"
|
||||
|
||||
#include "aom_mem/aom_mem.h"
|
||||
|
||||
#include "av1/common/alloccommon.h"
|
||||
|
|
@ -25,16 +26,43 @@ int av1_get_MBs(int width, int height) {
|
|||
const int mi_cols = aligned_width >> MI_SIZE_LOG2;
|
||||
const int mi_rows = aligned_height >> MI_SIZE_LOG2;
|
||||
|
||||
#if CONFIG_CB4X4
|
||||
const int mb_cols = (mi_cols + 2) >> 2;
|
||||
const int mb_rows = (mi_rows + 2) >> 2;
|
||||
#else
|
||||
const int mb_cols = (mi_cols + 1) >> 1;
|
||||
const int mb_rows = (mi_rows + 1) >> 1;
|
||||
#endif
|
||||
return mb_rows * mb_cols;
|
||||
}
|
||||
|
||||
#if LOOP_FILTER_BITMASK
|
||||
static int alloc_loop_filter_mask(AV1_COMMON *cm) {
|
||||
aom_free(cm->lf.lfm);
|
||||
cm->lf.lfm = NULL;
|
||||
|
||||
// Each lfm holds bit masks for all the 4x4 blocks in a max
|
||||
// 64x64 (128x128 for ext_partitions) region. The stride
|
||||
// and rows are rounded up / truncated to a multiple of 16
|
||||
// (32 for ext_partition).
|
||||
cm->lf.lfm_stride = (cm->mi_cols + (MI_SIZE_64X64 - 1)) >> MIN_MIB_SIZE_LOG2;
|
||||
cm->lf.lfm_num = ((cm->mi_rows + (MI_SIZE_64X64 - 1)) >> MIN_MIB_SIZE_LOG2) *
|
||||
cm->lf.lfm_stride;
|
||||
cm->lf.lfm =
|
||||
(LoopFilterMask *)aom_calloc(cm->lf.lfm_num, sizeof(*cm->lf.lfm));
|
||||
if (!cm->lf.lfm) return 1;
|
||||
|
||||
unsigned int i;
|
||||
for (i = 0; i < cm->lf.lfm_num; ++i) av1_zero(cm->lf.lfm[i]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void free_loop_filter_mask(AV1_COMMON *cm) {
|
||||
if (cm->lf.lfm == NULL) return;
|
||||
|
||||
aom_free(cm->lf.lfm);
|
||||
cm->lf.lfm = NULL;
|
||||
cm->lf.lfm_num = 0;
|
||||
cm->lf.lfm_stride = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
void av1_set_mb_mi(AV1_COMMON *cm, int width, int height) {
|
||||
// Ensure that the decoded width and height are both multiples of
|
||||
// 8 luma pixels (note: this may only be a multiple of 4 chroma pixels if
|
||||
|
|
@ -48,79 +76,13 @@ void av1_set_mb_mi(AV1_COMMON *cm, int width, int height) {
|
|||
cm->mi_rows = aligned_height >> MI_SIZE_LOG2;
|
||||
cm->mi_stride = calc_mi_size(cm->mi_cols);
|
||||
|
||||
#if CONFIG_CB4X4
|
||||
cm->mb_cols = (cm->mi_cols + 2) >> 2;
|
||||
cm->mb_rows = (cm->mi_rows + 2) >> 2;
|
||||
#else
|
||||
cm->mb_cols = (cm->mi_cols + 1) >> 1;
|
||||
cm->mb_rows = (cm->mi_rows + 1) >> 1;
|
||||
#endif
|
||||
cm->MBs = cm->mb_rows * cm->mb_cols;
|
||||
}
|
||||
|
||||
static int alloc_seg_map(AV1_COMMON *cm, int seg_map_size) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < NUM_PING_PONG_BUFFERS; ++i) {
|
||||
cm->seg_map_array[i] = (uint8_t *)aom_calloc(seg_map_size, 1);
|
||||
if (cm->seg_map_array[i] == NULL) return 1;
|
||||
}
|
||||
cm->seg_map_alloc_size = seg_map_size;
|
||||
|
||||
// Init the index.
|
||||
cm->seg_map_idx = 0;
|
||||
cm->prev_seg_map_idx = 1;
|
||||
|
||||
cm->current_frame_seg_map = cm->seg_map_array[cm->seg_map_idx];
|
||||
if (!cm->frame_parallel_decode)
|
||||
cm->last_frame_seg_map = cm->seg_map_array[cm->prev_seg_map_idx];
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void free_seg_map(AV1_COMMON *cm) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < NUM_PING_PONG_BUFFERS; ++i) {
|
||||
aom_free(cm->seg_map_array[i]);
|
||||
cm->seg_map_array[i] = NULL;
|
||||
}
|
||||
|
||||
cm->current_frame_seg_map = NULL;
|
||||
|
||||
if (!cm->frame_parallel_decode) {
|
||||
cm->last_frame_seg_map = NULL;
|
||||
}
|
||||
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;
|
||||
#if LOOP_FILTER_BITMASK
|
||||
alloc_loop_filter_mask(cm);
|
||||
#endif
|
||||
}
|
||||
|
||||
void av1_free_ref_frame_buffers(BufferPool *pool) {
|
||||
|
|
@ -134,97 +96,179 @@ void av1_free_ref_frame_buffers(BufferPool *pool) {
|
|||
}
|
||||
aom_free(pool->frame_bufs[i].mvs);
|
||||
pool->frame_bufs[i].mvs = NULL;
|
||||
#if CONFIG_MFMV
|
||||
aom_free(pool->frame_bufs[i].tpl_mvs);
|
||||
pool->frame_bufs[i].tpl_mvs = NULL;
|
||||
#endif
|
||||
aom_free(pool->frame_bufs[i].seg_map);
|
||||
pool->frame_bufs[i].seg_map = NULL;
|
||||
aom_free_frame_buffer(&pool->frame_bufs[i].buf);
|
||||
#if CONFIG_HASH_ME
|
||||
av1_hash_table_destroy(&pool->frame_bufs[i].hash_table);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#if CONFIG_LOOP_RESTORATION
|
||||
// Assumes cm->rst_info[p].restoration_tilesize is already initialized
|
||||
// Assumes cm->rst_info[p].restoration_unit_size is already initialized
|
||||
void av1_alloc_restoration_buffers(AV1_COMMON *cm) {
|
||||
int p;
|
||||
#if CONFIG_FRAME_SUPERRES
|
||||
int width = cm->superres_upscaled_width;
|
||||
int height = cm->superres_upscaled_height;
|
||||
#else
|
||||
int width = cm->width;
|
||||
int height = cm->height;
|
||||
#endif // CONFIG_FRAME_SUPERRES
|
||||
av1_alloc_restoration_struct(cm, &cm->rst_info[0], width, height);
|
||||
for (p = 1; p < MAX_MB_PLANE; ++p)
|
||||
av1_alloc_restoration_struct(cm, &cm->rst_info[p],
|
||||
ROUND_POWER_OF_TWO(width, cm->subsampling_x),
|
||||
ROUND_POWER_OF_TWO(height, cm->subsampling_y));
|
||||
aom_free(cm->rst_internal.tmpbuf);
|
||||
CHECK_MEM_ERROR(cm, cm->rst_internal.tmpbuf,
|
||||
(int32_t *)aom_memalign(16, RESTORATION_TMPBUF_SIZE));
|
||||
const int num_planes = av1_num_planes(cm);
|
||||
for (int p = 0; p < num_planes; ++p)
|
||||
av1_alloc_restoration_struct(cm, &cm->rst_info[p], p > 0);
|
||||
|
||||
#if CONFIG_STRIPED_LOOP_RESTORATION
|
||||
// Allocate internal storage for the loop restoration stripe boundary lines
|
||||
for (p = 0; p < MAX_MB_PLANE; ++p) {
|
||||
int w = p == 0 ? width : ROUND_POWER_OF_TWO(width, cm->subsampling_x);
|
||||
int align_bits = 5; // align for efficiency
|
||||
int stride = ALIGN_POWER_OF_TWO(w, align_bits);
|
||||
int num_stripes = (height + 63) / 64;
|
||||
// for each processing stripe: 2 lines above, 2 below
|
||||
int buf_size = num_stripes * 2 * stride;
|
||||
uint8_t *above_buf, *below_buf;
|
||||
|
||||
aom_free(cm->rst_internal.stripe_boundary_above[p]);
|
||||
aom_free(cm->rst_internal.stripe_boundary_below[p]);
|
||||
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
if (cm->use_highbitdepth) buf_size = buf_size * 2;
|
||||
#endif
|
||||
CHECK_MEM_ERROR(cm, above_buf,
|
||||
(uint8_t *)aom_memalign(1 << align_bits, buf_size));
|
||||
CHECK_MEM_ERROR(cm, below_buf,
|
||||
(uint8_t *)aom_memalign(1 << align_bits, buf_size));
|
||||
cm->rst_internal.stripe_boundary_above[p] = above_buf;
|
||||
cm->rst_internal.stripe_boundary_below[p] = below_buf;
|
||||
cm->rst_internal.stripe_boundary_stride[p] = stride;
|
||||
if (cm->rst_tmpbuf == NULL) {
|
||||
CHECK_MEM_ERROR(cm, cm->rst_tmpbuf,
|
||||
(int32_t *)aom_memalign(16, RESTORATION_TMPBUF_SIZE));
|
||||
}
|
||||
|
||||
if (cm->rlbs == NULL) {
|
||||
CHECK_MEM_ERROR(cm, cm->rlbs, aom_malloc(sizeof(RestorationLineBuffers)));
|
||||
}
|
||||
|
||||
// For striped loop restoration, we divide each row of tiles into "stripes",
|
||||
// of height 64 luma pixels but with an offset by RESTORATION_UNIT_OFFSET
|
||||
// luma pixels to match the output from CDEF. We will need to store 2 *
|
||||
// RESTORATION_CTX_VERT lines of data for each stripe, and also need to be
|
||||
// able to quickly answer the question "Where is the <n>'th stripe for tile
|
||||
// row <m>?" To make that efficient, we generate the rst_last_stripe array.
|
||||
int num_stripes = 0;
|
||||
for (int i = 0; i < cm->tile_rows; ++i) {
|
||||
TileInfo tile_info;
|
||||
av1_tile_set_row(&tile_info, cm, i);
|
||||
const int mi_h = tile_info.mi_row_end - tile_info.mi_row_start;
|
||||
const int ext_h = RESTORATION_UNIT_OFFSET + (mi_h << MI_SIZE_LOG2);
|
||||
const int tile_stripes = (ext_h + 63) / 64;
|
||||
num_stripes += tile_stripes;
|
||||
cm->rst_end_stripe[i] = num_stripes;
|
||||
}
|
||||
|
||||
// Now we need to allocate enough space to store the line buffers for the
|
||||
// stripes
|
||||
const int frame_w = cm->superres_upscaled_width;
|
||||
const int use_highbd = cm->use_highbitdepth ? 1 : 0;
|
||||
|
||||
for (int p = 0; p < num_planes; ++p) {
|
||||
const int is_uv = p > 0;
|
||||
const int ss_x = is_uv && cm->subsampling_x;
|
||||
const int plane_w = ((frame_w + ss_x) >> ss_x) + 2 * RESTORATION_EXTRA_HORZ;
|
||||
const int stride = ALIGN_POWER_OF_TWO(plane_w, 5);
|
||||
const int buf_size = num_stripes * stride * RESTORATION_CTX_VERT
|
||||
<< use_highbd;
|
||||
RestorationStripeBoundaries *boundaries = &cm->rst_info[p].boundaries;
|
||||
|
||||
if (buf_size != boundaries->stripe_boundary_size ||
|
||||
boundaries->stripe_boundary_above == NULL ||
|
||||
boundaries->stripe_boundary_below == NULL) {
|
||||
aom_free(boundaries->stripe_boundary_above);
|
||||
aom_free(boundaries->stripe_boundary_below);
|
||||
|
||||
CHECK_MEM_ERROR(cm, boundaries->stripe_boundary_above,
|
||||
(uint8_t *)aom_memalign(32, buf_size));
|
||||
CHECK_MEM_ERROR(cm, boundaries->stripe_boundary_below,
|
||||
(uint8_t *)aom_memalign(32, buf_size));
|
||||
|
||||
boundaries->stripe_boundary_size = buf_size;
|
||||
}
|
||||
boundaries->stripe_boundary_stride = stride;
|
||||
}
|
||||
#endif // CONFIG_STRIPED_LOOP_RESTORATION
|
||||
}
|
||||
|
||||
void av1_free_restoration_buffers(AV1_COMMON *cm) {
|
||||
int p;
|
||||
for (p = 0; p < MAX_MB_PLANE; ++p)
|
||||
av1_free_restoration_struct(&cm->rst_info[p]);
|
||||
aom_free(cm->rst_internal.tmpbuf);
|
||||
cm->rst_internal.tmpbuf = NULL;
|
||||
}
|
||||
#endif // CONFIG_LOOP_RESTORATION
|
||||
aom_free(cm->rst_tmpbuf);
|
||||
cm->rst_tmpbuf = NULL;
|
||||
aom_free(cm->rlbs);
|
||||
cm->rlbs = NULL;
|
||||
for (p = 0; p < MAX_MB_PLANE; ++p) {
|
||||
RestorationStripeBoundaries *boundaries = &cm->rst_info[p].boundaries;
|
||||
aom_free(boundaries->stripe_boundary_above);
|
||||
aom_free(boundaries->stripe_boundary_below);
|
||||
boundaries->stripe_boundary_above = NULL;
|
||||
boundaries->stripe_boundary_below = NULL;
|
||||
}
|
||||
|
||||
void av1_free_context_buffers(AV1_COMMON *cm) {
|
||||
aom_free_frame_buffer(&cm->rst_frame);
|
||||
}
|
||||
|
||||
void av1_free_above_context_buffers(AV1_COMMON *cm,
|
||||
int num_free_above_contexts) {
|
||||
int i;
|
||||
cm->free_mi(cm);
|
||||
free_seg_map(cm);
|
||||
free_scratch_buffers(cm);
|
||||
for (i = 0; i < MAX_MB_PLANE; i++) {
|
||||
const int num_planes = cm->num_allocated_above_context_planes;
|
||||
|
||||
for (int tile_row = 0; tile_row < num_free_above_contexts; tile_row++) {
|
||||
for (i = 0; i < num_planes; i++) {
|
||||
aom_free(cm->above_context[i][tile_row]);
|
||||
cm->above_context[i][tile_row] = NULL;
|
||||
}
|
||||
aom_free(cm->above_seg_context[tile_row]);
|
||||
cm->above_seg_context[tile_row] = NULL;
|
||||
|
||||
aom_free(cm->above_txfm_context[tile_row]);
|
||||
cm->above_txfm_context[tile_row] = NULL;
|
||||
}
|
||||
for (i = 0; i < num_planes; i++) {
|
||||
aom_free(cm->above_context[i]);
|
||||
cm->above_context[i] = NULL;
|
||||
}
|
||||
aom_free(cm->above_seg_context);
|
||||
cm->above_seg_context = NULL;
|
||||
cm->above_context_alloc_cols = 0;
|
||||
#if CONFIG_VAR_TX
|
||||
|
||||
aom_free(cm->above_txfm_context);
|
||||
cm->above_txfm_context = NULL;
|
||||
|
||||
for (i = 0; i < MAX_MB_PLANE; ++i) {
|
||||
aom_free(cm->top_txfm_context[i]);
|
||||
cm->top_txfm_context[i] = NULL;
|
||||
}
|
||||
cm->num_allocated_above_contexts = 0;
|
||||
cm->num_allocated_above_context_mi_col = 0;
|
||||
cm->num_allocated_above_context_planes = 0;
|
||||
}
|
||||
|
||||
void av1_free_context_buffers(AV1_COMMON *cm) {
|
||||
cm->free_mi(cm);
|
||||
|
||||
av1_free_above_context_buffers(cm, cm->num_allocated_above_contexts);
|
||||
|
||||
#if LOOP_FILTER_BITMASK
|
||||
free_loop_filter_mask(cm);
|
||||
#endif
|
||||
}
|
||||
|
||||
int av1_alloc_above_context_buffers(AV1_COMMON *cm,
|
||||
int num_alloc_above_contexts) {
|
||||
const int num_planes = av1_num_planes(cm);
|
||||
int plane_idx;
|
||||
const int aligned_mi_cols =
|
||||
ALIGN_POWER_OF_TWO(cm->mi_cols, MAX_MIB_SIZE_LOG2);
|
||||
|
||||
// Allocate above context buffers
|
||||
cm->num_allocated_above_contexts = num_alloc_above_contexts;
|
||||
cm->num_allocated_above_context_mi_col = aligned_mi_cols;
|
||||
cm->num_allocated_above_context_planes = num_planes;
|
||||
for (plane_idx = 0; plane_idx < num_planes; plane_idx++) {
|
||||
cm->above_context[plane_idx] = (ENTROPY_CONTEXT **)aom_calloc(
|
||||
num_alloc_above_contexts, sizeof(cm->above_context[0]));
|
||||
if (!cm->above_context[plane_idx]) return 1;
|
||||
}
|
||||
|
||||
cm->above_seg_context = (PARTITION_CONTEXT **)aom_calloc(
|
||||
num_alloc_above_contexts, sizeof(cm->above_seg_context));
|
||||
if (!cm->above_seg_context) return 1;
|
||||
|
||||
cm->above_txfm_context = (TXFM_CONTEXT **)aom_calloc(
|
||||
num_alloc_above_contexts, sizeof(cm->above_txfm_context));
|
||||
if (!cm->above_txfm_context) return 1;
|
||||
|
||||
for (int tile_row = 0; tile_row < num_alloc_above_contexts; tile_row++) {
|
||||
for (plane_idx = 0; plane_idx < num_planes; plane_idx++) {
|
||||
cm->above_context[plane_idx][tile_row] = (ENTROPY_CONTEXT *)aom_calloc(
|
||||
aligned_mi_cols, sizeof(*cm->above_context[0][tile_row]));
|
||||
if (!cm->above_context[plane_idx][tile_row]) return 1;
|
||||
}
|
||||
|
||||
cm->above_seg_context[tile_row] = (PARTITION_CONTEXT *)aom_calloc(
|
||||
aligned_mi_cols, sizeof(*cm->above_seg_context[tile_row]));
|
||||
if (!cm->above_seg_context[tile_row]) return 1;
|
||||
|
||||
cm->above_txfm_context[tile_row] = (TXFM_CONTEXT *)aom_calloc(
|
||||
aligned_mi_cols, sizeof(*cm->above_txfm_context[tile_row]));
|
||||
if (!cm->above_txfm_context[tile_row]) return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int av1_alloc_context_buffers(AV1_COMMON *cm, int width, int height) {
|
||||
int new_mi_size;
|
||||
|
||||
|
|
@ -235,52 +279,6 @@ int av1_alloc_context_buffers(AV1_COMMON *cm, int width, int height) {
|
|||
if (cm->alloc_mi(cm, new_mi_size)) goto fail;
|
||||
}
|
||||
|
||||
if (cm->seg_map_alloc_size < cm->mi_rows * cm->mi_cols) {
|
||||
// Create the segmentation map structure and set to 0.
|
||||
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.
|
||||
// cm->tile_width would be enough but it complicates indexing a
|
||||
// little elsewhere.
|
||||
const int aligned_mi_cols =
|
||||
ALIGN_POWER_OF_TWO(cm->mi_cols, MAX_MIB_SIZE_LOG2);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAX_MB_PLANE; i++) {
|
||||
aom_free(cm->above_context[i]);
|
||||
cm->above_context[i] = (ENTROPY_CONTEXT *)aom_calloc(
|
||||
aligned_mi_cols << (MI_SIZE_LOG2 - tx_size_wide_log2[0]),
|
||||
sizeof(*cm->above_context[0]));
|
||||
if (!cm->above_context[i]) goto fail;
|
||||
}
|
||||
|
||||
aom_free(cm->above_seg_context);
|
||||
cm->above_seg_context = (PARTITION_CONTEXT *)aom_calloc(
|
||||
aligned_mi_cols, sizeof(*cm->above_seg_context));
|
||||
if (!cm->above_seg_context) goto fail;
|
||||
|
||||
#if CONFIG_VAR_TX
|
||||
aom_free(cm->above_txfm_context);
|
||||
cm->above_txfm_context = (TXFM_CONTEXT *)aom_calloc(
|
||||
aligned_mi_cols << TX_UNIT_WIDE_LOG2, sizeof(*cm->above_txfm_context));
|
||||
if (!cm->above_txfm_context) goto fail;
|
||||
|
||||
for (i = 0; i < MAX_MB_PLANE; ++i) {
|
||||
aom_free(cm->top_txfm_context[i]);
|
||||
cm->top_txfm_context[i] =
|
||||
(TXFM_CONTEXT *)aom_calloc(aligned_mi_cols << TX_UNIT_WIDE_LOG2,
|
||||
sizeof(*cm->top_txfm_context[0]));
|
||||
if (!cm->top_txfm_context[i]) goto fail;
|
||||
}
|
||||
#endif
|
||||
|
||||
cm->above_context_alloc_cols = aligned_mi_cols;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
|
|
@ -299,18 +297,4 @@ void av1_remove_common(AV1_COMMON *cm) {
|
|||
cm->frame_contexts = NULL;
|
||||
}
|
||||
|
||||
void av1_init_context_buffers(AV1_COMMON *cm) {
|
||||
cm->setup_mi(cm);
|
||||
if (cm->last_frame_seg_map && !cm->frame_parallel_decode)
|
||||
memset(cm->last_frame_seg_map, 0, cm->mi_rows * cm->mi_cols);
|
||||
}
|
||||
|
||||
void av1_swap_current_and_last_seg_map(AV1_COMMON *cm) {
|
||||
// Swap indices.
|
||||
const int tmp = cm->seg_map_idx;
|
||||
cm->seg_map_idx = cm->prev_seg_map_idx;
|
||||
cm->prev_seg_map_idx = tmp;
|
||||
|
||||
cm->current_frame_seg_map = cm->seg_map_array[cm->seg_map_idx];
|
||||
cm->last_frame_seg_map = cm->seg_map_array[cm->prev_seg_map_idx];
|
||||
}
|
||||
void av1_init_context_buffers(AV1_COMMON *cm) { cm->setup_mi(cm); }
|
||||
|
|
|
|||
8
third_party/aom/av1/common/alloccommon.h
vendored
8
third_party/aom/av1/common/alloccommon.h
vendored
|
|
@ -23,15 +23,17 @@ struct BufferPool;
|
|||
|
||||
void av1_remove_common(struct AV1Common *cm);
|
||||
|
||||
int av1_alloc_above_context_buffers(struct AV1Common *cm,
|
||||
int num_alloc_above_contexts);
|
||||
void av1_free_above_context_buffers(struct AV1Common *cm,
|
||||
int num_free_above_contexts);
|
||||
int av1_alloc_context_buffers(struct AV1Common *cm, int width, int height);
|
||||
void av1_init_context_buffers(struct AV1Common *cm);
|
||||
void av1_free_context_buffers(struct AV1Common *cm);
|
||||
|
||||
void av1_free_ref_frame_buffers(struct BufferPool *pool);
|
||||
#if CONFIG_LOOP_RESTORATION
|
||||
void av1_alloc_restoration_buffers(struct AV1Common *cm);
|
||||
void av1_free_restoration_buffers(struct AV1Common *cm);
|
||||
#endif // CONFIG_LOOP_RESTORATION
|
||||
|
||||
int av1_alloc_state_buffers(struct AV1Common *cm, int width, int height);
|
||||
void av1_free_state_buffers(struct AV1Common *cm);
|
||||
|
|
@ -39,8 +41,6 @@ void av1_free_state_buffers(struct AV1Common *cm);
|
|||
void av1_set_mb_mi(struct AV1Common *cm, int width, int height);
|
||||
int av1_get_MBs(int width, int height);
|
||||
|
||||
void av1_swap_current_and_last_seg_map(struct AV1Common *cm);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
|
|
|||
28
third_party/aom/av1/common/arm/av1_txfm_neon.c
vendored
Normal file
28
third_party/aom/av1/common/arm/av1_txfm_neon.c
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
*
|
||||
* Copyright (c) 2018, 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 <arm_neon.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "aom_ports/mem.h"
|
||||
#include "av1/common/arm/mem_neon.h"
|
||||
|
||||
void av1_round_shift_array_neon(int32_t *arr, int size, int bit) {
|
||||
assert(!(size % 4));
|
||||
if (!bit) return;
|
||||
const int32x4_t dup_bits_n_32x4 = vdupq_n_s32((int32_t)(-bit));
|
||||
for (int i = 0; i < size; i += 4) {
|
||||
int32x4_t tmp_q_s32 = vld1q_s32(arr);
|
||||
tmp_q_s32 = vrshlq_s32(tmp_q_s32, dup_bits_n_32x4);
|
||||
vst1q_s32(arr, tmp_q_s32);
|
||||
arr += 4;
|
||||
}
|
||||
}
|
||||
134
third_party/aom/av1/common/arm/blend_a64_hmask_neon.c
vendored
Normal file
134
third_party/aom/av1/common/arm/blend_a64_hmask_neon.c
vendored
Normal file
|
|
@ -0,0 +1,134 @@
|
|||
/*
|
||||
*
|
||||
* Copyright (c) 2018, 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 <arm_neon.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "aom/aom_integer.h"
|
||||
#include "aom_dsp/blend.h"
|
||||
#include "aom_ports/mem.h"
|
||||
#include "av1/common/arm/mem_neon.h"
|
||||
#include "aom_dsp/aom_dsp_common.h"
|
||||
#include "config/aom_dsp_rtcd.h"
|
||||
|
||||
void aom_blend_a64_hmask_neon(uint8_t *dst, uint32_t dst_stride,
|
||||
const uint8_t *src0, uint32_t src0_stride,
|
||||
const uint8_t *src1, uint32_t src1_stride,
|
||||
const uint8_t *mask, int w, int h) {
|
||||
assert(IMPLIES(src0 == dst, src0_stride == dst_stride));
|
||||
assert(IMPLIES(src1 == dst, src1_stride == dst_stride));
|
||||
|
||||
assert(h >= 2);
|
||||
assert(w >= 2);
|
||||
assert(IS_POWER_OF_TWO(h));
|
||||
assert(IS_POWER_OF_TWO(w));
|
||||
uint8x8_t tmp0, tmp1;
|
||||
uint8x16_t res_q;
|
||||
uint16x8_t res, res_low, res_high;
|
||||
uint32x2_t tmp0_32, tmp1_32;
|
||||
uint16x4_t tmp0_16, tmp1_16;
|
||||
const uint8x8_t vdup_64 = vdup_n_u8((uint8_t)64);
|
||||
|
||||
if (w >= 16) {
|
||||
const uint8x16_t vdup_64_q = vdupq_n_u8((uint8_t)64);
|
||||
for (int i = 0; i < h; ++i) {
|
||||
for (int j = 0; j < w; j += 16) {
|
||||
__builtin_prefetch(src0);
|
||||
__builtin_prefetch(src1);
|
||||
const uint8x16_t tmp0_q = vld1q_u8(src0);
|
||||
const uint8x16_t tmp1_q = vld1q_u8(src1);
|
||||
const uint8x16_t m_q = vld1q_u8(mask);
|
||||
const uint8x16_t max_minus_m_q = vsubq_u8(vdup_64_q, m_q);
|
||||
res_low = vmull_u8(vget_low_u8(m_q), vget_low_u8(tmp0_q));
|
||||
res_low =
|
||||
vmlal_u8(res_low, vget_low_u8(max_minus_m_q), vget_low_u8(tmp1_q));
|
||||
res_high = vmull_u8(vget_high_u8(m_q), vget_high_u8(tmp0_q));
|
||||
res_high = vmlal_u8(res_high, vget_high_u8(max_minus_m_q),
|
||||
vget_high_u8(tmp1_q));
|
||||
res_q = vcombine_u8(vrshrn_n_u16(res_low, AOM_BLEND_A64_ROUND_BITS),
|
||||
vrshrn_n_u16(res_high, AOM_BLEND_A64_ROUND_BITS));
|
||||
vst1q_u8(dst, res_q);
|
||||
src0 += 16;
|
||||
src1 += 16;
|
||||
dst += 16;
|
||||
mask += 16;
|
||||
}
|
||||
src0 += src0_stride - w;
|
||||
src1 += src1_stride - w;
|
||||
dst += dst_stride - w;
|
||||
mask -= w;
|
||||
}
|
||||
} else if (w == 8) {
|
||||
const uint8x8_t m = vld1_u8(mask);
|
||||
const uint8x8_t max_minus_m = vsub_u8(vdup_64, m);
|
||||
for (int i = 0; i < h; ++i) {
|
||||
__builtin_prefetch(src0);
|
||||
__builtin_prefetch(src1);
|
||||
tmp0 = vld1_u8(src0);
|
||||
tmp1 = vld1_u8(src1);
|
||||
res = vmull_u8(m, tmp0);
|
||||
res = vmlal_u8(res, max_minus_m, tmp1);
|
||||
vst1_u8(dst, vrshrn_n_u16(res, AOM_BLEND_A64_ROUND_BITS));
|
||||
src0 += src0_stride;
|
||||
src1 += src1_stride;
|
||||
dst += dst_stride;
|
||||
}
|
||||
} else if (w == 4) {
|
||||
const uint8x8_t m = vreinterpret_u8_u32(vld1_dup_u32((uint32_t *)mask));
|
||||
const uint8x8_t max_minus_m = vsub_u8(vdup_64, m);
|
||||
for (int i = 0; i < h; i += 2) {
|
||||
__builtin_prefetch(src0 + 0 * src0_stride);
|
||||
__builtin_prefetch(src0 + 1 * src0_stride);
|
||||
__builtin_prefetch(src1 + 0 * src1_stride);
|
||||
__builtin_prefetch(src1 + 1 * src1_stride);
|
||||
load_unaligned_u8_4x2(src0, src0_stride, &tmp0_32);
|
||||
tmp0 = vreinterpret_u8_u32(tmp0_32);
|
||||
load_unaligned_u8_4x2(src1, src1_stride, &tmp1_32);
|
||||
tmp1 = vreinterpret_u8_u32(tmp1_32);
|
||||
res = vmull_u8(m, tmp0);
|
||||
res = vmlal_u8(res, max_minus_m, tmp1);
|
||||
vst1_lane_u32(
|
||||
(uint32_t *)(dst + (0 * dst_stride)),
|
||||
vreinterpret_u32_u8(vrshrn_n_u16(res, AOM_BLEND_A64_ROUND_BITS)), 0);
|
||||
vst1_lane_u32(
|
||||
(uint32_t *)(dst + (1 * dst_stride)),
|
||||
vreinterpret_u32_u8(vrshrn_n_u16(res, AOM_BLEND_A64_ROUND_BITS)), 1);
|
||||
src0 += (2 * src0_stride);
|
||||
src1 += (2 * src1_stride);
|
||||
dst += (2 * dst_stride);
|
||||
}
|
||||
} else if (w == 2) {
|
||||
const uint8x8_t m = vreinterpret_u8_u16(vld1_dup_u16((uint16_t *)mask));
|
||||
const uint8x8_t max_minus_m = vsub_u8(vdup_64, m);
|
||||
for (int i = 0; i < h; i += 2) {
|
||||
__builtin_prefetch(src0 + 0 * src0_stride);
|
||||
__builtin_prefetch(src0 + 1 * src0_stride);
|
||||
__builtin_prefetch(src1 + 0 * src1_stride);
|
||||
__builtin_prefetch(src1 + 1 * src1_stride);
|
||||
load_unaligned_u8_2x2(src0, src0_stride, &tmp0_16);
|
||||
tmp0 = vreinterpret_u8_u16(tmp0_16);
|
||||
load_unaligned_u8_2x2(src1, src1_stride, &tmp1_16);
|
||||
tmp1 = vreinterpret_u8_u16(tmp1_16);
|
||||
res = vmull_u8(m, tmp0);
|
||||
res = vmlal_u8(res, max_minus_m, tmp1);
|
||||
vst1_lane_u16(
|
||||
(uint16_t *)(dst + (0 * dst_stride)),
|
||||
vreinterpret_u16_u8(vrshrn_n_u16(res, AOM_BLEND_A64_ROUND_BITS)), 0);
|
||||
vst1_lane_u16(
|
||||
(uint16_t *)(dst + (1 * dst_stride)),
|
||||
vreinterpret_u16_u8(vrshrn_n_u16(res, AOM_BLEND_A64_ROUND_BITS)), 1);
|
||||
src0 += (2 * src0_stride);
|
||||
src1 += (2 * src1_stride);
|
||||
dst += (2 * dst_stride);
|
||||
}
|
||||
}
|
||||
}
|
||||
141
third_party/aom/av1/common/arm/blend_a64_vmask_neon.c
vendored
Normal file
141
third_party/aom/av1/common/arm/blend_a64_vmask_neon.c
vendored
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
/*
|
||||
*
|
||||
* Copyright (c) 2018, 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 <arm_neon.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "aom/aom_integer.h"
|
||||
#include "aom_dsp/blend.h"
|
||||
#include "aom_ports/mem.h"
|
||||
#include "av1/common/arm/mem_neon.h"
|
||||
#include "aom_dsp/aom_dsp_common.h"
|
||||
#include "config/aom_dsp_rtcd.h"
|
||||
|
||||
void aom_blend_a64_vmask_neon(uint8_t *dst, uint32_t dst_stride,
|
||||
const uint8_t *src0, uint32_t src0_stride,
|
||||
const uint8_t *src1, uint32_t src1_stride,
|
||||
const uint8_t *mask, int w, int h) {
|
||||
uint8x8_t tmp0, tmp1;
|
||||
uint8x16_t tmp0_q, tmp1_q, res_q;
|
||||
uint16x8_t res, res_low, res_high;
|
||||
uint32x2_t tmp0_32, tmp1_32;
|
||||
uint16x4_t tmp0_16, tmp1_16;
|
||||
assert(IMPLIES(src0 == dst, src0_stride == dst_stride));
|
||||
assert(IMPLIES(src1 == dst, src1_stride == dst_stride));
|
||||
|
||||
assert(h >= 2);
|
||||
assert(w >= 2);
|
||||
assert(IS_POWER_OF_TWO(h));
|
||||
assert(IS_POWER_OF_TWO(w));
|
||||
|
||||
if (w >= 16) {
|
||||
for (int i = 0; i < h; ++i) {
|
||||
const uint8x8_t m = vdup_n_u8((uint8_t)mask[i]);
|
||||
const uint8x8_t max_minus_m = vdup_n_u8(64 - (uint8_t)mask[i]);
|
||||
for (int j = 0; j < w; j += 16) {
|
||||
__builtin_prefetch(src0);
|
||||
__builtin_prefetch(src1);
|
||||
tmp0_q = vld1q_u8(src0);
|
||||
tmp1_q = vld1q_u8(src1);
|
||||
res_low = vmull_u8(m, vget_low_u8(tmp0_q));
|
||||
res_low = vmlal_u8(res_low, max_minus_m, vget_low_u8(tmp1_q));
|
||||
res_high = vmull_u8(m, vget_high_u8(tmp0_q));
|
||||
res_high = vmlal_u8(res_high, max_minus_m, vget_high_u8(tmp1_q));
|
||||
res_q = vcombine_u8(vrshrn_n_u16(res_low, AOM_BLEND_A64_ROUND_BITS),
|
||||
vrshrn_n_u16(res_high, AOM_BLEND_A64_ROUND_BITS));
|
||||
vst1q_u8(dst, res_q);
|
||||
src0 += 16;
|
||||
src1 += 16;
|
||||
dst += 16;
|
||||
}
|
||||
src0 += src0_stride - w;
|
||||
src1 += src1_stride - w;
|
||||
dst += dst_stride - w;
|
||||
}
|
||||
} else if (w == 8) {
|
||||
for (int i = 0; i < h; ++i) {
|
||||
__builtin_prefetch(src0);
|
||||
__builtin_prefetch(src1);
|
||||
const uint8x8_t m = vdup_n_u8((uint8_t)mask[i]);
|
||||
const uint8x8_t max_minus_m = vdup_n_u8(64 - (uint8_t)mask[i]);
|
||||
tmp0 = vld1_u8(src0);
|
||||
tmp1 = vld1_u8(src1);
|
||||
res = vmull_u8(m, tmp0);
|
||||
res = vmlal_u8(res, max_minus_m, tmp1);
|
||||
vst1_u8(dst, vrshrn_n_u16(res, AOM_BLEND_A64_ROUND_BITS));
|
||||
src0 += src0_stride;
|
||||
src1 += src1_stride;
|
||||
dst += dst_stride;
|
||||
}
|
||||
} else if (w == 4) {
|
||||
for (int i = 0; i < h; i += 2) {
|
||||
__builtin_prefetch(src0 + 0 * src0_stride);
|
||||
__builtin_prefetch(src0 + 1 * src0_stride);
|
||||
__builtin_prefetch(src1 + 0 * src1_stride);
|
||||
__builtin_prefetch(src1 + 1 * src1_stride);
|
||||
const uint16x4_t m1 = vdup_n_u16((uint16_t)mask[i]);
|
||||
const uint16x4_t m2 = vdup_n_u16((uint16_t)mask[i + 1]);
|
||||
const uint8x8_t m = vmovn_u16(vcombine_u16(m1, m2));
|
||||
const uint16x4_t max_minus_m1 = vdup_n_u16(64 - (uint16_t)mask[i]);
|
||||
const uint16x4_t max_minus_m2 = vdup_n_u16(64 - (uint16_t)mask[i + 1]);
|
||||
const uint8x8_t max_minus_m =
|
||||
vmovn_u16(vcombine_u16(max_minus_m1, max_minus_m2));
|
||||
load_unaligned_u8_4x2(src0, src0_stride, &tmp0_32);
|
||||
tmp0 = vreinterpret_u8_u32(tmp0_32);
|
||||
load_unaligned_u8_4x2(src1, src1_stride, &tmp1_32);
|
||||
tmp1 = vreinterpret_u8_u32(tmp1_32);
|
||||
res = vmull_u8(m, tmp0);
|
||||
res = vmlal_u8(res, max_minus_m, tmp1);
|
||||
vst1_lane_u32(
|
||||
(uint32_t *)(dst + (0 * dst_stride)),
|
||||
vreinterpret_u32_u8(vrshrn_n_u16(res, AOM_BLEND_A64_ROUND_BITS)), 0);
|
||||
vst1_lane_u32(
|
||||
(uint32_t *)(dst + (1 * dst_stride)),
|
||||
vreinterpret_u32_u8(vrshrn_n_u16(res, AOM_BLEND_A64_ROUND_BITS)), 1);
|
||||
src0 += (2 * src0_stride);
|
||||
src1 += (2 * src1_stride);
|
||||
dst += (2 * dst_stride);
|
||||
}
|
||||
} else if (w == 2) {
|
||||
for (int i = 0; i < h; i += 2) {
|
||||
__builtin_prefetch(src0 + 0 * src0_stride);
|
||||
__builtin_prefetch(src0 + 1 * src0_stride);
|
||||
__builtin_prefetch(src1 + 0 * src1_stride);
|
||||
__builtin_prefetch(src1 + 1 * src1_stride);
|
||||
const uint8x8_t m1 = vdup_n_u8(mask[i]);
|
||||
const uint8x8_t m2 = vdup_n_u8(mask[i + 1]);
|
||||
const uint16x4x2_t m_trn =
|
||||
vtrn_u16(vreinterpret_u16_u8(m1), vreinterpret_u16_u8(m2));
|
||||
const uint8x8_t m = vreinterpret_u8_u16(m_trn.val[0]);
|
||||
const uint8x8_t max_minus_m1 = vdup_n_u8(64 - mask[i]);
|
||||
const uint8x8_t max_minus_m2 = vdup_n_u8(64 - mask[i + 1]);
|
||||
const uint16x4x2_t max_minus_m_trn = vtrn_u16(
|
||||
vreinterpret_u16_u8(max_minus_m1), vreinterpret_u16_u8(max_minus_m2));
|
||||
const uint8x8_t max_minus_m = vreinterpret_u8_u16(max_minus_m_trn.val[0]);
|
||||
load_unaligned_u8_2x2(src0, src0_stride, &tmp0_16);
|
||||
tmp0 = vreinterpret_u8_u16(tmp0_16);
|
||||
load_unaligned_u8_2x2(src1, src1_stride, &tmp1_16);
|
||||
tmp1 = vreinterpret_u8_u16(tmp1_16);
|
||||
res = vmull_u8(m, tmp0);
|
||||
res = vmlal_u8(res, max_minus_m, tmp1);
|
||||
vst1_lane_u16(
|
||||
(uint16_t *)(dst + (0 * dst_stride)),
|
||||
vreinterpret_u16_u8(vrshrn_n_u16(res, AOM_BLEND_A64_ROUND_BITS)), 0);
|
||||
vst1_lane_u16(
|
||||
(uint16_t *)(dst + (1 * dst_stride)),
|
||||
vreinterpret_u16_u8(vrshrn_n_u16(res, AOM_BLEND_A64_ROUND_BITS)), 1);
|
||||
src0 += (2 * src0_stride);
|
||||
src1 += (2 * src1_stride);
|
||||
dst += (2 * dst_stride);
|
||||
}
|
||||
}
|
||||
}
|
||||
584
third_party/aom/av1/common/arm/cfl_neon.c
vendored
Normal file
584
third_party/aom/av1/common/arm/cfl_neon.c
vendored
Normal file
|
|
@ -0,0 +1,584 @@
|
|||
/*
|
||||
* Copyright (c) 2017, 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 <arm_neon.h>
|
||||
|
||||
#include "config/av1_rtcd.h"
|
||||
|
||||
#include "av1/common/cfl.h"
|
||||
|
||||
static INLINE void vldsubstq_s16(int16_t *dst, const uint16_t *src, int offset,
|
||||
int16x8_t sub) {
|
||||
vst1q_s16(dst + offset,
|
||||
vsubq_s16(vreinterpretq_s16_u16(vld1q_u16(src + offset)), sub));
|
||||
}
|
||||
|
||||
static INLINE uint16x8_t vldaddq_u16(const uint16_t *buf, size_t offset) {
|
||||
return vaddq_u16(vld1q_u16(buf), vld1q_u16(buf + offset));
|
||||
}
|
||||
|
||||
// Load half of a vector and duplicated in other half
|
||||
static INLINE uint8x8_t vldh_dup_u8(const uint8_t *ptr) {
|
||||
return vreinterpret_u8_u32(vld1_dup_u32((const uint32_t *)ptr));
|
||||
}
|
||||
|
||||
// Store half of a vector.
|
||||
static INLINE void vsth_u16(uint16_t *ptr, uint16x4_t val) {
|
||||
*((uint32_t *)ptr) = vreinterpret_u32_u16(val)[0];
|
||||
}
|
||||
|
||||
// Store half of a vector.
|
||||
static INLINE void vsth_u8(uint8_t *ptr, uint8x8_t val) {
|
||||
*((uint32_t *)ptr) = vreinterpret_u32_u8(val)[0];
|
||||
}
|
||||
|
||||
static void cfl_luma_subsampling_420_lbd_neon(const uint8_t *input,
|
||||
int input_stride,
|
||||
uint16_t *pred_buf_q3, int width,
|
||||
int height) {
|
||||
const uint16_t *end = pred_buf_q3 + (height >> 1) * CFL_BUF_LINE;
|
||||
const int luma_stride = input_stride << 1;
|
||||
do {
|
||||
if (width == 4) {
|
||||
const uint16x4_t top = vpaddl_u8(vldh_dup_u8(input));
|
||||
const uint16x4_t sum = vpadal_u8(top, vldh_dup_u8(input + input_stride));
|
||||
vsth_u16(pred_buf_q3, vshl_n_u16(sum, 1));
|
||||
} else if (width == 8) {
|
||||
const uint16x4_t top = vpaddl_u8(vld1_u8(input));
|
||||
const uint16x4_t sum = vpadal_u8(top, vld1_u8(input + input_stride));
|
||||
vst1_u16(pred_buf_q3, vshl_n_u16(sum, 1));
|
||||
} else if (width == 16) {
|
||||
const uint16x8_t top = vpaddlq_u8(vld1q_u8(input));
|
||||
const uint16x8_t sum = vpadalq_u8(top, vld1q_u8(input + input_stride));
|
||||
vst1q_u16(pred_buf_q3, vshlq_n_u16(sum, 1));
|
||||
} else {
|
||||
const uint8x8x4_t top = vld4_u8(input);
|
||||
const uint8x8x4_t bot = vld4_u8(input + input_stride);
|
||||
// equivalent to a vpaddlq_u8 (because vld4q interleaves)
|
||||
const uint16x8_t top_0 = vaddl_u8(top.val[0], top.val[1]);
|
||||
// equivalent to a vpaddlq_u8 (because vld4q interleaves)
|
||||
const uint16x8_t bot_0 = vaddl_u8(bot.val[0], bot.val[1]);
|
||||
// equivalent to a vpaddlq_u8 (because vld4q interleaves)
|
||||
const uint16x8_t top_1 = vaddl_u8(top.val[2], top.val[3]);
|
||||
// equivalent to a vpaddlq_u8 (because vld4q interleaves)
|
||||
const uint16x8_t bot_1 = vaddl_u8(bot.val[2], bot.val[3]);
|
||||
uint16x8x2_t sum;
|
||||
sum.val[0] = vshlq_n_u16(vaddq_u16(top_0, bot_0), 1);
|
||||
sum.val[1] = vshlq_n_u16(vaddq_u16(top_1, bot_1), 1);
|
||||
vst2q_u16(pred_buf_q3, sum);
|
||||
}
|
||||
input += luma_stride;
|
||||
} while ((pred_buf_q3 += CFL_BUF_LINE) < end);
|
||||
}
|
||||
|
||||
static void cfl_luma_subsampling_422_lbd_neon(const uint8_t *input,
|
||||
int input_stride,
|
||||
uint16_t *pred_buf_q3, int width,
|
||||
int height) {
|
||||
const uint16_t *end = pred_buf_q3 + height * CFL_BUF_LINE;
|
||||
do {
|
||||
if (width == 4) {
|
||||
const uint16x4_t top = vpaddl_u8(vldh_dup_u8(input));
|
||||
vsth_u16(pred_buf_q3, vshl_n_u16(top, 2));
|
||||
} else if (width == 8) {
|
||||
const uint16x4_t top = vpaddl_u8(vld1_u8(input));
|
||||
vst1_u16(pred_buf_q3, vshl_n_u16(top, 2));
|
||||
} else if (width == 16) {
|
||||
const uint16x8_t top = vpaddlq_u8(vld1q_u8(input));
|
||||
vst1q_u16(pred_buf_q3, vshlq_n_u16(top, 2));
|
||||
} else {
|
||||
const uint8x8x4_t top = vld4_u8(input);
|
||||
uint16x8x2_t sum;
|
||||
// vaddl_u8 is equivalent to a vpaddlq_u8 (because vld4q interleaves)
|
||||
sum.val[0] = vshlq_n_u16(vaddl_u8(top.val[0], top.val[1]), 2);
|
||||
sum.val[1] = vshlq_n_u16(vaddl_u8(top.val[2], top.val[3]), 2);
|
||||
vst2q_u16(pred_buf_q3, sum);
|
||||
}
|
||||
input += input_stride;
|
||||
} while ((pred_buf_q3 += CFL_BUF_LINE) < end);
|
||||
}
|
||||
|
||||
static void cfl_luma_subsampling_444_lbd_neon(const uint8_t *input,
|
||||
int input_stride,
|
||||
uint16_t *pred_buf_q3, int width,
|
||||
int height) {
|
||||
const uint16_t *end = pred_buf_q3 + height * CFL_BUF_LINE;
|
||||
do {
|
||||
if (width == 4) {
|
||||
const uint16x8_t top = vshll_n_u8(vldh_dup_u8(input), 3);
|
||||
vst1_u16(pred_buf_q3, vget_low_u16(top));
|
||||
} else if (width == 8) {
|
||||
const uint16x8_t top = vshll_n_u8(vld1_u8(input), 3);
|
||||
vst1q_u16(pred_buf_q3, top);
|
||||
} else {
|
||||
const uint8x16_t top = vld1q_u8(input);
|
||||
vst1q_u16(pred_buf_q3, vshll_n_u8(vget_low_u8(top), 3));
|
||||
vst1q_u16(pred_buf_q3 + 8, vshll_n_u8(vget_high_u8(top), 3));
|
||||
if (width == 32) {
|
||||
const uint8x16_t next_top = vld1q_u8(input + 16);
|
||||
vst1q_u16(pred_buf_q3 + 16, vshll_n_u8(vget_low_u8(next_top), 3));
|
||||
vst1q_u16(pred_buf_q3 + 24, vshll_n_u8(vget_high_u8(next_top), 3));
|
||||
}
|
||||
}
|
||||
input += input_stride;
|
||||
} while ((pred_buf_q3 += CFL_BUF_LINE) < end);
|
||||
}
|
||||
|
||||
#if __ARM_ARCH <= 7
|
||||
uint16x8_t vpaddq_u16(uint16x8_t a, uint16x8_t b) {
|
||||
return vcombine_u16(vpadd_u16(vget_low_u16(a), vget_high_u16(a)),
|
||||
vpadd_u16(vget_low_u16(b), vget_high_u16(b)));
|
||||
}
|
||||
#endif
|
||||
|
||||
static void cfl_luma_subsampling_420_hbd_neon(const uint16_t *input,
|
||||
int input_stride,
|
||||
uint16_t *pred_buf_q3, int width,
|
||||
int height) {
|
||||
const uint16_t *end = pred_buf_q3 + (height >> 1) * CFL_BUF_LINE;
|
||||
const int luma_stride = input_stride << 1;
|
||||
do {
|
||||
if (width == 4) {
|
||||
const uint16x4_t top = vld1_u16(input);
|
||||
const uint16x4_t bot = vld1_u16(input + input_stride);
|
||||
const uint16x4_t sum = vadd_u16(top, bot);
|
||||
const uint16x4_t hsum = vpadd_u16(sum, sum);
|
||||
vsth_u16(pred_buf_q3, vshl_n_u16(hsum, 1));
|
||||
} else if (width < 32) {
|
||||
const uint16x8_t top = vld1q_u16(input);
|
||||
const uint16x8_t bot = vld1q_u16(input + input_stride);
|
||||
const uint16x8_t sum = vaddq_u16(top, bot);
|
||||
if (width == 8) {
|
||||
const uint16x4_t hsum = vget_low_u16(vpaddq_u16(sum, sum));
|
||||
vst1_u16(pred_buf_q3, vshl_n_u16(hsum, 1));
|
||||
} else {
|
||||
const uint16x8_t top_1 = vld1q_u16(input + 8);
|
||||
const uint16x8_t bot_1 = vld1q_u16(input + 8 + input_stride);
|
||||
const uint16x8_t sum_1 = vaddq_u16(top_1, bot_1);
|
||||
const uint16x8_t hsum = vpaddq_u16(sum, sum_1);
|
||||
vst1q_u16(pred_buf_q3, vshlq_n_u16(hsum, 1));
|
||||
}
|
||||
} else {
|
||||
const uint16x8x4_t top = vld4q_u16(input);
|
||||
const uint16x8x4_t bot = vld4q_u16(input + input_stride);
|
||||
// equivalent to a vpaddq_u16 (because vld4q interleaves)
|
||||
const uint16x8_t top_0 = vaddq_u16(top.val[0], top.val[1]);
|
||||
// equivalent to a vpaddq_u16 (because vld4q interleaves)
|
||||
const uint16x8_t bot_0 = vaddq_u16(bot.val[0], bot.val[1]);
|
||||
// equivalent to a vpaddq_u16 (because vld4q interleaves)
|
||||
const uint16x8_t top_1 = vaddq_u16(top.val[2], top.val[3]);
|
||||
// equivalent to a vpaddq_u16 (because vld4q interleaves)
|
||||
const uint16x8_t bot_1 = vaddq_u16(bot.val[2], bot.val[3]);
|
||||
uint16x8x2_t sum;
|
||||
sum.val[0] = vshlq_n_u16(vaddq_u16(top_0, bot_0), 1);
|
||||
sum.val[1] = vshlq_n_u16(vaddq_u16(top_1, bot_1), 1);
|
||||
vst2q_u16(pred_buf_q3, sum);
|
||||
}
|
||||
input += luma_stride;
|
||||
} while ((pred_buf_q3 += CFL_BUF_LINE) < end);
|
||||
}
|
||||
|
||||
static void cfl_luma_subsampling_422_hbd_neon(const uint16_t *input,
|
||||
int input_stride,
|
||||
uint16_t *pred_buf_q3, int width,
|
||||
int height) {
|
||||
const uint16_t *end = pred_buf_q3 + height * CFL_BUF_LINE;
|
||||
do {
|
||||
if (width == 4) {
|
||||
const uint16x4_t top = vld1_u16(input);
|
||||
const uint16x4_t hsum = vpadd_u16(top, top);
|
||||
vsth_u16(pred_buf_q3, vshl_n_u16(hsum, 2));
|
||||
} else if (width == 8) {
|
||||
const uint16x4x2_t top = vld2_u16(input);
|
||||
// equivalent to a vpadd_u16 (because vld2 interleaves)
|
||||
const uint16x4_t hsum = vadd_u16(top.val[0], top.val[1]);
|
||||
vst1_u16(pred_buf_q3, vshl_n_u16(hsum, 2));
|
||||
} else if (width == 16) {
|
||||
const uint16x8x2_t top = vld2q_u16(input);
|
||||
// equivalent to a vpaddq_u16 (because vld2q interleaves)
|
||||
const uint16x8_t hsum = vaddq_u16(top.val[0], top.val[1]);
|
||||
vst1q_u16(pred_buf_q3, vshlq_n_u16(hsum, 2));
|
||||
} else {
|
||||
const uint16x8x4_t top = vld4q_u16(input);
|
||||
// equivalent to a vpaddq_u16 (because vld4q interleaves)
|
||||
const uint16x8_t hsum_0 = vaddq_u16(top.val[0], top.val[1]);
|
||||
// equivalent to a vpaddq_u16 (because vld4q interleaves)
|
||||
const uint16x8_t hsum_1 = vaddq_u16(top.val[2], top.val[3]);
|
||||
uint16x8x2_t result = { { vshlq_n_u16(hsum_0, 2),
|
||||
vshlq_n_u16(hsum_1, 2) } };
|
||||
vst2q_u16(pred_buf_q3, result);
|
||||
}
|
||||
input += input_stride;
|
||||
} while ((pred_buf_q3 += CFL_BUF_LINE) < end);
|
||||
}
|
||||
|
||||
static void cfl_luma_subsampling_444_hbd_neon(const uint16_t *input,
|
||||
int input_stride,
|
||||
uint16_t *pred_buf_q3, int width,
|
||||
int height) {
|
||||
const uint16_t *end = pred_buf_q3 + height * CFL_BUF_LINE;
|
||||
do {
|
||||
if (width == 4) {
|
||||
const uint16x4_t top = vld1_u16(input);
|
||||
vst1_u16(pred_buf_q3, vshl_n_u16(top, 3));
|
||||
} else if (width == 8) {
|
||||
const uint16x8_t top = vld1q_u16(input);
|
||||
vst1q_u16(pred_buf_q3, vshlq_n_u16(top, 3));
|
||||
} else if (width == 16) {
|
||||
uint16x8x2_t top = vld2q_u16(input);
|
||||
top.val[0] = vshlq_n_u16(top.val[0], 3);
|
||||
top.val[1] = vshlq_n_u16(top.val[1], 3);
|
||||
vst2q_u16(pred_buf_q3, top);
|
||||
} else {
|
||||
uint16x8x4_t top = vld4q_u16(input);
|
||||
top.val[0] = vshlq_n_u16(top.val[0], 3);
|
||||
top.val[1] = vshlq_n_u16(top.val[1], 3);
|
||||
top.val[2] = vshlq_n_u16(top.val[2], 3);
|
||||
top.val[3] = vshlq_n_u16(top.val[3], 3);
|
||||
vst4q_u16(pred_buf_q3, top);
|
||||
}
|
||||
input += input_stride;
|
||||
} while ((pred_buf_q3 += CFL_BUF_LINE) < end);
|
||||
}
|
||||
|
||||
CFL_GET_SUBSAMPLE_FUNCTION(neon)
|
||||
|
||||
static INLINE void subtract_average_neon(const uint16_t *src, int16_t *dst,
|
||||
int width, int height,
|
||||
int round_offset,
|
||||
const int num_pel_log2) {
|
||||
const uint16_t *const end = src + height * CFL_BUF_LINE;
|
||||
|
||||
// Round offset is not needed, because NEON will handle the rounding.
|
||||
(void)round_offset;
|
||||
|
||||
// To optimize the use of the CPU pipeline, we process 4 rows per iteration
|
||||
const int step = 4 * CFL_BUF_LINE;
|
||||
|
||||
// At this stage, the prediction buffer contains scaled reconstructed luma
|
||||
// pixels, which are positive integer and only require 15 bits. By using
|
||||
// unsigned integer for the sum, we can do one addition operation inside 16
|
||||
// bits (8 lanes) before having to convert to 32 bits (4 lanes).
|
||||
const uint16_t *sum_buf = src;
|
||||
uint32x4_t sum_32x4 = { 0, 0, 0, 0 };
|
||||
do {
|
||||
// For all widths, we load, add and combine the data so it fits in 4 lanes.
|
||||
if (width == 4) {
|
||||
const uint16x4_t a0 =
|
||||
vadd_u16(vld1_u16(sum_buf), vld1_u16(sum_buf + CFL_BUF_LINE));
|
||||
const uint16x4_t a1 = vadd_u16(vld1_u16(sum_buf + 2 * CFL_BUF_LINE),
|
||||
vld1_u16(sum_buf + 3 * CFL_BUF_LINE));
|
||||
sum_32x4 = vaddq_u32(sum_32x4, vaddl_u16(a0, a1));
|
||||
} else if (width == 8) {
|
||||
const uint16x8_t a0 = vldaddq_u16(sum_buf, CFL_BUF_LINE);
|
||||
const uint16x8_t a1 =
|
||||
vldaddq_u16(sum_buf + 2 * CFL_BUF_LINE, CFL_BUF_LINE);
|
||||
sum_32x4 = vpadalq_u16(sum_32x4, a0);
|
||||
sum_32x4 = vpadalq_u16(sum_32x4, a1);
|
||||
} else {
|
||||
const uint16x8_t row0 = vldaddq_u16(sum_buf, 8);
|
||||
const uint16x8_t row1 = vldaddq_u16(sum_buf + CFL_BUF_LINE, 8);
|
||||
const uint16x8_t row2 = vldaddq_u16(sum_buf + 2 * CFL_BUF_LINE, 8);
|
||||
const uint16x8_t row3 = vldaddq_u16(sum_buf + 3 * CFL_BUF_LINE, 8);
|
||||
sum_32x4 = vpadalq_u16(sum_32x4, row0);
|
||||
sum_32x4 = vpadalq_u16(sum_32x4, row1);
|
||||
sum_32x4 = vpadalq_u16(sum_32x4, row2);
|
||||
sum_32x4 = vpadalq_u16(sum_32x4, row3);
|
||||
|
||||
if (width == 32) {
|
||||
const uint16x8_t row0_1 = vldaddq_u16(sum_buf + 16, 8);
|
||||
const uint16x8_t row1_1 = vldaddq_u16(sum_buf + CFL_BUF_LINE + 16, 8);
|
||||
const uint16x8_t row2_1 =
|
||||
vldaddq_u16(sum_buf + 2 * CFL_BUF_LINE + 16, 8);
|
||||
const uint16x8_t row3_1 =
|
||||
vldaddq_u16(sum_buf + 3 * CFL_BUF_LINE + 16, 8);
|
||||
|
||||
sum_32x4 = vpadalq_u16(sum_32x4, row0_1);
|
||||
sum_32x4 = vpadalq_u16(sum_32x4, row1_1);
|
||||
sum_32x4 = vpadalq_u16(sum_32x4, row2_1);
|
||||
sum_32x4 = vpadalq_u16(sum_32x4, row3_1);
|
||||
}
|
||||
}
|
||||
sum_buf += step;
|
||||
} while (sum_buf < end);
|
||||
|
||||
// Permute and add in such a way that each lane contains the block sum.
|
||||
// [A+C+B+D, B+D+A+C, C+A+D+B, D+B+C+A]
|
||||
#if __ARM_ARCH >= 8
|
||||
sum_32x4 = vpaddq_u32(sum_32x4, sum_32x4);
|
||||
sum_32x4 = vpaddq_u32(sum_32x4, sum_32x4);
|
||||
#else
|
||||
uint32x4_t flip =
|
||||
vcombine_u32(vget_high_u32(sum_32x4), vget_low_u32(sum_32x4));
|
||||
sum_32x4 = vaddq_u32(sum_32x4, flip);
|
||||
sum_32x4 = vaddq_u32(sum_32x4, vrev64q_u32(sum_32x4));
|
||||
#endif
|
||||
|
||||
// Computing the average could be done using scalars, but getting off the NEON
|
||||
// engine introduces latency, so we use vqrshrn.
|
||||
int16x4_t avg_16x4;
|
||||
// Constant propagation makes for some ugly code.
|
||||
switch (num_pel_log2) {
|
||||
case 4: avg_16x4 = vreinterpret_s16_u16(vqrshrn_n_u32(sum_32x4, 4)); break;
|
||||
case 5: avg_16x4 = vreinterpret_s16_u16(vqrshrn_n_u32(sum_32x4, 5)); break;
|
||||
case 6: avg_16x4 = vreinterpret_s16_u16(vqrshrn_n_u32(sum_32x4, 6)); break;
|
||||
case 7: avg_16x4 = vreinterpret_s16_u16(vqrshrn_n_u32(sum_32x4, 7)); break;
|
||||
case 8: avg_16x4 = vreinterpret_s16_u16(vqrshrn_n_u32(sum_32x4, 8)); break;
|
||||
case 9: avg_16x4 = vreinterpret_s16_u16(vqrshrn_n_u32(sum_32x4, 9)); break;
|
||||
case 10:
|
||||
avg_16x4 = vreinterpret_s16_u16(vqrshrn_n_u32(sum_32x4, 10));
|
||||
break;
|
||||
default: assert(0);
|
||||
}
|
||||
|
||||
if (width == 4) {
|
||||
do {
|
||||
vst1_s16(dst, vsub_s16(vreinterpret_s16_u16(vld1_u16(src)), avg_16x4));
|
||||
src += CFL_BUF_LINE;
|
||||
dst += CFL_BUF_LINE;
|
||||
} while (src < end);
|
||||
} else {
|
||||
const int16x8_t avg_16x8 = vcombine_s16(avg_16x4, avg_16x4);
|
||||
do {
|
||||
vldsubstq_s16(dst, src, 0, avg_16x8);
|
||||
vldsubstq_s16(dst, src, CFL_BUF_LINE, avg_16x8);
|
||||
vldsubstq_s16(dst, src, 2 * CFL_BUF_LINE, avg_16x8);
|
||||
vldsubstq_s16(dst, src, 3 * CFL_BUF_LINE, avg_16x8);
|
||||
|
||||
if (width > 8) {
|
||||
vldsubstq_s16(dst, src, 8, avg_16x8);
|
||||
vldsubstq_s16(dst, src, 8 + CFL_BUF_LINE, avg_16x8);
|
||||
vldsubstq_s16(dst, src, 8 + 2 * CFL_BUF_LINE, avg_16x8);
|
||||
vldsubstq_s16(dst, src, 8 + 3 * CFL_BUF_LINE, avg_16x8);
|
||||
}
|
||||
if (width == 32) {
|
||||
vldsubstq_s16(dst, src, 16, avg_16x8);
|
||||
vldsubstq_s16(dst, src, 16 + CFL_BUF_LINE, avg_16x8);
|
||||
vldsubstq_s16(dst, src, 16 + 2 * CFL_BUF_LINE, avg_16x8);
|
||||
vldsubstq_s16(dst, src, 16 + 3 * CFL_BUF_LINE, avg_16x8);
|
||||
vldsubstq_s16(dst, src, 24, avg_16x8);
|
||||
vldsubstq_s16(dst, src, 24 + CFL_BUF_LINE, avg_16x8);
|
||||
vldsubstq_s16(dst, src, 24 + 2 * CFL_BUF_LINE, avg_16x8);
|
||||
vldsubstq_s16(dst, src, 24 + 3 * CFL_BUF_LINE, avg_16x8);
|
||||
}
|
||||
src += step;
|
||||
dst += step;
|
||||
} while (src < end);
|
||||
}
|
||||
}
|
||||
|
||||
CFL_SUB_AVG_FN(neon)
|
||||
|
||||
// Saturating negate 16-bit integers in a when the corresponding signed 16-bit
|
||||
// integer in b is negative.
|
||||
// Notes:
|
||||
// * Negating INT16_MIN results in INT16_MIN. However, this cannot occur in
|
||||
// practice, as scaled_luma is the multiplication of two absolute values.
|
||||
// * In the Intel equivalent, elements in a are zeroed out when the
|
||||
// corresponding elements in b are zero. Because vsign is used twice in a
|
||||
// row, with b in the first call becoming a in the second call, there's no
|
||||
// impact from not zeroing out.
|
||||
static int16x4_t vsign_s16(int16x4_t a, int16x4_t b) {
|
||||
const int16x4_t mask = vshr_n_s16(b, 15);
|
||||
return veor_s16(vadd_s16(a, mask), mask);
|
||||
}
|
||||
|
||||
// Saturating negate 16-bit integers in a when the corresponding signed 16-bit
|
||||
// integer in b is negative.
|
||||
// Notes:
|
||||
// * Negating INT16_MIN results in INT16_MIN. However, this cannot occur in
|
||||
// practice, as scaled_luma is the multiplication of two absolute values.
|
||||
// * In the Intel equivalent, elements in a are zeroed out when the
|
||||
// corresponding elements in b are zero. Because vsignq is used twice in a
|
||||
// row, with b in the first call becoming a in the second call, there's no
|
||||
// impact from not zeroing out.
|
||||
static int16x8_t vsignq_s16(int16x8_t a, int16x8_t b) {
|
||||
const int16x8_t mask = vshrq_n_s16(b, 15);
|
||||
return veorq_s16(vaddq_s16(a, mask), mask);
|
||||
}
|
||||
|
||||
static INLINE int16x4_t predict_w4(const int16_t *pred_buf_q3,
|
||||
int16x4_t alpha_sign, int abs_alpha_q12,
|
||||
int16x4_t dc) {
|
||||
const int16x4_t ac_q3 = vld1_s16(pred_buf_q3);
|
||||
const int16x4_t ac_sign = veor_s16(alpha_sign, ac_q3);
|
||||
int16x4_t scaled_luma = vqrdmulh_n_s16(vabs_s16(ac_q3), abs_alpha_q12);
|
||||
return vadd_s16(vsign_s16(scaled_luma, ac_sign), dc);
|
||||
}
|
||||
|
||||
static INLINE int16x8_t predict_w8(const int16_t *pred_buf_q3,
|
||||
int16x8_t alpha_sign, int abs_alpha_q12,
|
||||
int16x8_t dc) {
|
||||
const int16x8_t ac_q3 = vld1q_s16(pred_buf_q3);
|
||||
const int16x8_t ac_sign = veorq_s16(alpha_sign, ac_q3);
|
||||
int16x8_t scaled_luma = vqrdmulhq_n_s16(vabsq_s16(ac_q3), abs_alpha_q12);
|
||||
return vaddq_s16(vsignq_s16(scaled_luma, ac_sign), dc);
|
||||
}
|
||||
|
||||
static INLINE int16x8x2_t predict_w16(const int16_t *pred_buf_q3,
|
||||
int16x8_t alpha_sign, int abs_alpha_q12,
|
||||
int16x8_t dc) {
|
||||
// vld2q_s16 interleaves, which is not useful for prediction. vst1q_s16_x2
|
||||
// does not interleave, but is not currently available in the compilier used
|
||||
// by the AOM build system.
|
||||
const int16x8x2_t ac_q3 = vld2q_s16(pred_buf_q3);
|
||||
const int16x8_t ac_sign_0 = veorq_s16(alpha_sign, ac_q3.val[0]);
|
||||
const int16x8_t ac_sign_1 = veorq_s16(alpha_sign, ac_q3.val[1]);
|
||||
const int16x8_t scaled_luma_0 =
|
||||
vqrdmulhq_n_s16(vabsq_s16(ac_q3.val[0]), abs_alpha_q12);
|
||||
const int16x8_t scaled_luma_1 =
|
||||
vqrdmulhq_n_s16(vabsq_s16(ac_q3.val[1]), abs_alpha_q12);
|
||||
int16x8x2_t result;
|
||||
result.val[0] = vaddq_s16(vsignq_s16(scaled_luma_0, ac_sign_0), dc);
|
||||
result.val[1] = vaddq_s16(vsignq_s16(scaled_luma_1, ac_sign_1), dc);
|
||||
return result;
|
||||
}
|
||||
|
||||
static INLINE int16x8x4_t predict_w32(const int16_t *pred_buf_q3,
|
||||
int16x8_t alpha_sign, int abs_alpha_q12,
|
||||
int16x8_t dc) {
|
||||
// vld4q_s16 interleaves, which is not useful for prediction. vst1q_s16_x4
|
||||
// does not interleave, but is not currently available in the compilier used
|
||||
// by the AOM build system.
|
||||
const int16x8x4_t ac_q3 = vld4q_s16(pred_buf_q3);
|
||||
const int16x8_t ac_sign_0 = veorq_s16(alpha_sign, ac_q3.val[0]);
|
||||
const int16x8_t ac_sign_1 = veorq_s16(alpha_sign, ac_q3.val[1]);
|
||||
const int16x8_t ac_sign_2 = veorq_s16(alpha_sign, ac_q3.val[2]);
|
||||
const int16x8_t ac_sign_3 = veorq_s16(alpha_sign, ac_q3.val[3]);
|
||||
const int16x8_t scaled_luma_0 =
|
||||
vqrdmulhq_n_s16(vabsq_s16(ac_q3.val[0]), abs_alpha_q12);
|
||||
const int16x8_t scaled_luma_1 =
|
||||
vqrdmulhq_n_s16(vabsq_s16(ac_q3.val[1]), abs_alpha_q12);
|
||||
const int16x8_t scaled_luma_2 =
|
||||
vqrdmulhq_n_s16(vabsq_s16(ac_q3.val[2]), abs_alpha_q12);
|
||||
const int16x8_t scaled_luma_3 =
|
||||
vqrdmulhq_n_s16(vabsq_s16(ac_q3.val[3]), abs_alpha_q12);
|
||||
int16x8x4_t result;
|
||||
result.val[0] = vaddq_s16(vsignq_s16(scaled_luma_0, ac_sign_0), dc);
|
||||
result.val[1] = vaddq_s16(vsignq_s16(scaled_luma_1, ac_sign_1), dc);
|
||||
result.val[2] = vaddq_s16(vsignq_s16(scaled_luma_2, ac_sign_2), dc);
|
||||
result.val[3] = vaddq_s16(vsignq_s16(scaled_luma_3, ac_sign_3), dc);
|
||||
return result;
|
||||
}
|
||||
|
||||
static INLINE void cfl_predict_lbd_neon(const int16_t *pred_buf_q3,
|
||||
uint8_t *dst, int dst_stride,
|
||||
int alpha_q3, int width, int height) {
|
||||
const int16_t abs_alpha_q12 = abs(alpha_q3) << 9;
|
||||
const int16_t *const end = pred_buf_q3 + height * CFL_BUF_LINE;
|
||||
if (width == 4) {
|
||||
const int16x4_t alpha_sign = vdup_n_s16(alpha_q3);
|
||||
const int16x4_t dc = vdup_n_s16(*dst);
|
||||
do {
|
||||
const int16x4_t pred =
|
||||
predict_w4(pred_buf_q3, alpha_sign, abs_alpha_q12, dc);
|
||||
vsth_u8(dst, vqmovun_s16(vcombine_s16(pred, pred)));
|
||||
dst += dst_stride;
|
||||
} while ((pred_buf_q3 += CFL_BUF_LINE) < end);
|
||||
} else {
|
||||
const int16x8_t alpha_sign = vdupq_n_s16(alpha_q3);
|
||||
const int16x8_t dc = vdupq_n_s16(*dst);
|
||||
do {
|
||||
if (width == 8) {
|
||||
vst1_u8(dst, vqmovun_s16(predict_w8(pred_buf_q3, alpha_sign,
|
||||
abs_alpha_q12, dc)));
|
||||
} else if (width == 16) {
|
||||
const int16x8x2_t pred =
|
||||
predict_w16(pred_buf_q3, alpha_sign, abs_alpha_q12, dc);
|
||||
const uint8x8x2_t predun = { { vqmovun_s16(pred.val[0]),
|
||||
vqmovun_s16(pred.val[1]) } };
|
||||
vst2_u8(dst, predun);
|
||||
} else {
|
||||
const int16x8x4_t pred =
|
||||
predict_w32(pred_buf_q3, alpha_sign, abs_alpha_q12, dc);
|
||||
const uint8x8x4_t predun = {
|
||||
{ vqmovun_s16(pred.val[0]), vqmovun_s16(pred.val[1]),
|
||||
vqmovun_s16(pred.val[2]), vqmovun_s16(pred.val[3]) }
|
||||
};
|
||||
vst4_u8(dst, predun);
|
||||
}
|
||||
dst += dst_stride;
|
||||
} while ((pred_buf_q3 += CFL_BUF_LINE) < end);
|
||||
}
|
||||
}
|
||||
|
||||
CFL_PREDICT_FN(neon, lbd)
|
||||
|
||||
static INLINE uint16x4_t clamp_s16(int16x4_t a, int16x4_t max) {
|
||||
return vreinterpret_u16_s16(vmax_s16(vmin_s16(a, max), vdup_n_s16(0)));
|
||||
}
|
||||
|
||||
static INLINE uint16x8_t clampq_s16(int16x8_t a, int16x8_t max) {
|
||||
return vreinterpretq_u16_s16(vmaxq_s16(vminq_s16(a, max), vdupq_n_s16(0)));
|
||||
}
|
||||
|
||||
static INLINE uint16x8x2_t clamp2q_s16(int16x8x2_t a, int16x8_t max) {
|
||||
uint16x8x2_t result;
|
||||
result.val[0] = vreinterpretq_u16_s16(
|
||||
vmaxq_s16(vminq_s16(a.val[0], max), vdupq_n_s16(0)));
|
||||
result.val[1] = vreinterpretq_u16_s16(
|
||||
vmaxq_s16(vminq_s16(a.val[1], max), vdupq_n_s16(0)));
|
||||
return result;
|
||||
}
|
||||
|
||||
static INLINE uint16x8x4_t clamp4q_s16(int16x8x4_t a, int16x8_t max) {
|
||||
uint16x8x4_t result;
|
||||
result.val[0] = vreinterpretq_u16_s16(
|
||||
vmaxq_s16(vminq_s16(a.val[0], max), vdupq_n_s16(0)));
|
||||
result.val[1] = vreinterpretq_u16_s16(
|
||||
vmaxq_s16(vminq_s16(a.val[1], max), vdupq_n_s16(0)));
|
||||
result.val[2] = vreinterpretq_u16_s16(
|
||||
vmaxq_s16(vminq_s16(a.val[2], max), vdupq_n_s16(0)));
|
||||
result.val[3] = vreinterpretq_u16_s16(
|
||||
vmaxq_s16(vminq_s16(a.val[3], max), vdupq_n_s16(0)));
|
||||
return result;
|
||||
}
|
||||
|
||||
static INLINE void cfl_predict_hbd_neon(const int16_t *pred_buf_q3,
|
||||
uint16_t *dst, int dst_stride,
|
||||
int alpha_q3, int bd, int width,
|
||||
int height) {
|
||||
const int max = (1 << bd) - 1;
|
||||
const int16_t abs_alpha_q12 = abs(alpha_q3) << 9;
|
||||
const int16_t *const end = pred_buf_q3 + height * CFL_BUF_LINE;
|
||||
if (width == 4) {
|
||||
const int16x4_t alpha_sign = vdup_n_s16(alpha_q3);
|
||||
const int16x4_t dc = vdup_n_s16(*dst);
|
||||
const int16x4_t max_16x4 = vdup_n_s16(max);
|
||||
do {
|
||||
const int16x4_t scaled_luma =
|
||||
predict_w4(pred_buf_q3, alpha_sign, abs_alpha_q12, dc);
|
||||
vst1_u16(dst, clamp_s16(scaled_luma, max_16x4));
|
||||
dst += dst_stride;
|
||||
} while ((pred_buf_q3 += CFL_BUF_LINE) < end);
|
||||
} else {
|
||||
const int16x8_t alpha_sign = vdupq_n_s16(alpha_q3);
|
||||
const int16x8_t dc = vdupq_n_s16(*dst);
|
||||
const int16x8_t max_16x8 = vdupq_n_s16(max);
|
||||
do {
|
||||
if (width == 8) {
|
||||
const int16x8_t pred =
|
||||
predict_w8(pred_buf_q3, alpha_sign, abs_alpha_q12, dc);
|
||||
vst1q_u16(dst, clampq_s16(pred, max_16x8));
|
||||
} else if (width == 16) {
|
||||
const int16x8x2_t pred =
|
||||
predict_w16(pred_buf_q3, alpha_sign, abs_alpha_q12, dc);
|
||||
vst2q_u16(dst, clamp2q_s16(pred, max_16x8));
|
||||
} else {
|
||||
const int16x8x4_t pred =
|
||||
predict_w32(pred_buf_q3, alpha_sign, abs_alpha_q12, dc);
|
||||
vst4q_u16(dst, clamp4q_s16(pred, max_16x8));
|
||||
}
|
||||
dst += dst_stride;
|
||||
} while ((pred_buf_q3 += CFL_BUF_LINE) < end);
|
||||
}
|
||||
}
|
||||
|
||||
CFL_PREDICT_FN(neon, hbd)
|
||||
1134
third_party/aom/av1/common/arm/convolve_neon.c
vendored
Normal file
1134
third_party/aom/av1/common/arm/convolve_neon.c
vendored
Normal file
File diff suppressed because it is too large
Load diff
228
third_party/aom/av1/common/arm/convolve_neon.h
vendored
Normal file
228
third_party/aom/av1/common/arm/convolve_neon.h
vendored
Normal file
|
|
@ -0,0 +1,228 @@
|
|||
/*
|
||||
* Copyright (c) 2018, Alliance for Open Media. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#ifndef AV1_COMMON_ARM_CONVOLVE_NEON_H_
|
||||
#define AV1_COMMON_ARM_CONVOLVE_NEON_H_
|
||||
|
||||
#include <arm_neon.h>
|
||||
|
||||
#define HORIZ_EXTRA_ROWS ((SUBPEL_TAPS + 7) & ~0x07)
|
||||
|
||||
static INLINE uint8x8_t wiener_convolve8_vert_4x8(
|
||||
const int16x8_t s0, const int16x8_t s1, const int16x8_t s2,
|
||||
const int16x8_t s3, const int16x8_t s4, const int16x8_t s5,
|
||||
const int16x8_t s6, int16_t *filter_y, const int bd,
|
||||
const int round1_bits) {
|
||||
int16x8_t ss0, ss1, ss2;
|
||||
int32x4_t sum0, sum1;
|
||||
uint16x4_t tmp0, tmp1;
|
||||
uint16x8_t tmp;
|
||||
uint8x8_t res;
|
||||
|
||||
const int32_t round_const = (1 << (bd + round1_bits - 1));
|
||||
const int32x4_t round_bits = vdupq_n_s32(-round1_bits);
|
||||
const int32x4_t zero = vdupq_n_s32(0);
|
||||
const int32x4_t round_vec = vdupq_n_s32(round_const);
|
||||
|
||||
ss0 = vaddq_s16(s0, s6);
|
||||
ss1 = vaddq_s16(s1, s5);
|
||||
ss2 = vaddq_s16(s2, s4);
|
||||
|
||||
sum0 = vmull_n_s16(vget_low_s16(ss0), filter_y[0]);
|
||||
sum0 = vmlal_n_s16(sum0, vget_low_s16(ss1), filter_y[1]);
|
||||
sum0 = vmlal_n_s16(sum0, vget_low_s16(ss2), filter_y[2]);
|
||||
sum0 = vmlal_n_s16(sum0, vget_low_s16(s3), filter_y[3]);
|
||||
|
||||
sum1 = vmull_n_s16(vget_high_s16(ss0), filter_y[0]);
|
||||
sum1 = vmlal_n_s16(sum1, vget_high_s16(ss1), filter_y[1]);
|
||||
sum1 = vmlal_n_s16(sum1, vget_high_s16(ss2), filter_y[2]);
|
||||
sum1 = vmlal_n_s16(sum1, vget_high_s16(s3), filter_y[3]);
|
||||
|
||||
sum0 = vsubq_s32(sum0, round_vec);
|
||||
sum1 = vsubq_s32(sum1, round_vec);
|
||||
|
||||
/* right shift & rounding */
|
||||
sum0 = vrshlq_s32(sum0, round_bits);
|
||||
sum1 = vrshlq_s32(sum1, round_bits);
|
||||
|
||||
sum0 = vmaxq_s32(sum0, zero);
|
||||
sum1 = vmaxq_s32(sum1, zero);
|
||||
|
||||
/* from int32x4_t to uint8x8_t */
|
||||
tmp0 = vqmovn_u32(vreinterpretq_u32_s32(sum0));
|
||||
tmp1 = vqmovn_u32(vreinterpretq_u32_s32(sum1));
|
||||
tmp = vcombine_u16(tmp0, tmp1);
|
||||
res = vqmovn_u16(tmp);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static INLINE uint16x8_t wiener_convolve8_horiz_8x8(
|
||||
const int16x8_t s0, const int16x8_t s1, const int16x8_t s2,
|
||||
const int16x8_t s3, int16_t *filter_x, const int bd,
|
||||
const int round0_bits) {
|
||||
int16x8_t sum;
|
||||
uint16x8_t res;
|
||||
int32x4_t sum_0, sum_1;
|
||||
int32x4_t s3_0, s3_1;
|
||||
const int32_t round_const_0 = (1 << (bd + FILTER_BITS - 1));
|
||||
const int32_t round_const_1 = (1 << ((bd) + 1 + FILTER_BITS - round0_bits));
|
||||
|
||||
/* for the purpose of right shift by { conv_params->round_0 } */
|
||||
const int32x4_t round_bits = vdupq_n_s32(-round0_bits);
|
||||
|
||||
const int32x4_t round_vec_0 = vdupq_n_s32(round_const_0);
|
||||
const int32x4_t round_vec_1 = vdupq_n_s32(round_const_1);
|
||||
|
||||
sum = vmulq_n_s16(s0, filter_x[0]);
|
||||
sum = vmlaq_n_s16(sum, s1, filter_x[1]);
|
||||
sum = vmlaq_n_s16(sum, s2, filter_x[2]);
|
||||
|
||||
/* sum from 16x8 to 2 32x4 registers */
|
||||
sum_0 = vmovl_s16(vget_low_s16(sum));
|
||||
sum_1 = vmovl_s16(vget_high_s16(sum));
|
||||
|
||||
/* s[3]*128 -- and filter coef max can be 128
|
||||
* then max value possible = 128*128*255 exceeding 16 bit
|
||||
*/
|
||||
|
||||
s3_0 = vmull_n_s16(vget_low_s16(s3), filter_x[3]);
|
||||
s3_1 = vmull_n_s16(vget_high_s16(s3), filter_x[3]);
|
||||
sum_0 = vaddq_s32(sum_0, s3_0);
|
||||
sum_1 = vaddq_s32(sum_1, s3_1);
|
||||
|
||||
/* Add the constant value */
|
||||
sum_0 = vaddq_s32(sum_0, round_vec_0);
|
||||
sum_1 = vaddq_s32(sum_1, round_vec_0);
|
||||
|
||||
/* right shift & rounding & saturating */
|
||||
sum_0 = vqrshlq_s32(sum_0, round_bits);
|
||||
sum_1 = vqrshlq_s32(sum_1, round_bits);
|
||||
|
||||
/* Clipping to max value */
|
||||
sum_0 = vminq_s32(sum_0, round_vec_1);
|
||||
sum_1 = vminq_s32(sum_1, round_vec_1);
|
||||
|
||||
res = vcombine_u16(vqmovun_s32(sum_0), vqmovun_s32(sum_1));
|
||||
return res;
|
||||
}
|
||||
|
||||
static INLINE uint16x4_t wiener_convolve8_horiz_4x8(
|
||||
const int16x4_t s0, const int16x4_t s1, const int16x4_t s2,
|
||||
const int16x4_t s3, const int16x4_t s4, const int16x4_t s5,
|
||||
const int16x4_t s6, int16_t *filter_x, const int bd,
|
||||
const int round0_bits) {
|
||||
uint16x4_t res;
|
||||
int32x4_t sum_0, s3_0;
|
||||
int16x4_t sum, temp0, temp1, temp2;
|
||||
|
||||
const int32_t round_const_0 = (1 << (bd + FILTER_BITS - 1));
|
||||
const int32_t round_const_1 = (1 << ((bd) + 1 + FILTER_BITS - round0_bits));
|
||||
const int32x4_t round_bits = vdupq_n_s32(-round0_bits);
|
||||
const int32x4_t zero = vdupq_n_s32(0);
|
||||
const int32x4_t round_vec_0 = vdupq_n_s32(round_const_0);
|
||||
const int32x4_t round_vec_1 = vdupq_n_s32(round_const_1);
|
||||
|
||||
temp0 = vadd_s16(s0, s6);
|
||||
temp1 = vadd_s16(s1, s5);
|
||||
temp2 = vadd_s16(s2, s4);
|
||||
|
||||
sum = vmul_n_s16(temp0, filter_x[0]);
|
||||
sum = vmla_n_s16(sum, temp1, filter_x[1]);
|
||||
sum = vmla_n_s16(sum, temp2, filter_x[2]);
|
||||
sum_0 = vmovl_s16(sum);
|
||||
|
||||
/* s[3]*128 -- and filter coff max can be 128.
|
||||
* then max value possible = 128*128*255 Therefore, 32 bits are required to
|
||||
* hold the result.
|
||||
*/
|
||||
s3_0 = vmull_n_s16(s3, filter_x[3]);
|
||||
sum_0 = vaddq_s32(sum_0, s3_0);
|
||||
|
||||
sum_0 = vaddq_s32(sum_0, round_vec_0);
|
||||
sum_0 = vrshlq_s32(sum_0, round_bits);
|
||||
|
||||
sum_0 = vmaxq_s32(sum_0, zero);
|
||||
sum_0 = vminq_s32(sum_0, round_vec_1);
|
||||
res = vqmovun_s32(sum_0);
|
||||
return res;
|
||||
}
|
||||
|
||||
static INLINE int16x8_t
|
||||
convolve8_8x8_s16(const int16x8_t s0, const int16x8_t s1, const int16x8_t s2,
|
||||
const int16x8_t s3, const int16x8_t s4, const int16x8_t s5,
|
||||
const int16x8_t s6, const int16x8_t s7, const int16_t *filter,
|
||||
const int16x8_t horiz_const, const int16x8_t shift_round_0) {
|
||||
int16x8_t sum;
|
||||
int16x8_t res;
|
||||
|
||||
sum = horiz_const;
|
||||
sum = vmlaq_n_s16(sum, s0, filter[0]);
|
||||
sum = vmlaq_n_s16(sum, s1, filter[1]);
|
||||
sum = vmlaq_n_s16(sum, s2, filter[2]);
|
||||
sum = vmlaq_n_s16(sum, s3, filter[3]);
|
||||
sum = vmlaq_n_s16(sum, s4, filter[4]);
|
||||
sum = vmlaq_n_s16(sum, s5, filter[5]);
|
||||
sum = vmlaq_n_s16(sum, s6, filter[6]);
|
||||
sum = vmlaq_n_s16(sum, s7, filter[7]);
|
||||
|
||||
res = vqrshlq_s16(sum, shift_round_0);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static INLINE int16x4_t
|
||||
convolve8_4x4_s16(const int16x4_t s0, const int16x4_t s1, const int16x4_t s2,
|
||||
const int16x4_t s3, const int16x4_t s4, const int16x4_t s5,
|
||||
const int16x4_t s6, const int16x4_t s7, const int16_t *filter,
|
||||
const int16x4_t horiz_const, const int16x4_t shift_round_0) {
|
||||
int16x4_t sum;
|
||||
sum = horiz_const;
|
||||
sum = vmla_n_s16(sum, s0, filter[0]);
|
||||
sum = vmla_n_s16(sum, s1, filter[1]);
|
||||
sum = vmla_n_s16(sum, s2, filter[2]);
|
||||
sum = vmla_n_s16(sum, s3, filter[3]);
|
||||
sum = vmla_n_s16(sum, s4, filter[4]);
|
||||
sum = vmla_n_s16(sum, s5, filter[5]);
|
||||
sum = vmla_n_s16(sum, s6, filter[6]);
|
||||
sum = vmla_n_s16(sum, s7, filter[7]);
|
||||
|
||||
sum = vqrshl_s16(sum, shift_round_0);
|
||||
|
||||
return sum;
|
||||
}
|
||||
|
||||
static INLINE uint16x4_t convolve8_4x4_s32(
|
||||
const int16x4_t s0, const int16x4_t s1, const int16x4_t s2,
|
||||
const int16x4_t s3, const int16x4_t s4, const int16x4_t s5,
|
||||
const int16x4_t s6, const int16x4_t s7, const int16_t *y_filter,
|
||||
const int32x4_t round_shift_vec, const int32x4_t offset_const) {
|
||||
int32x4_t sum0;
|
||||
uint16x4_t res;
|
||||
const int32x4_t zero = vdupq_n_s32(0);
|
||||
|
||||
sum0 = vmull_n_s16(s0, y_filter[0]);
|
||||
sum0 = vmlal_n_s16(sum0, s1, y_filter[1]);
|
||||
sum0 = vmlal_n_s16(sum0, s2, y_filter[2]);
|
||||
sum0 = vmlal_n_s16(sum0, s3, y_filter[3]);
|
||||
sum0 = vmlal_n_s16(sum0, s4, y_filter[4]);
|
||||
sum0 = vmlal_n_s16(sum0, s5, y_filter[5]);
|
||||
sum0 = vmlal_n_s16(sum0, s6, y_filter[6]);
|
||||
sum0 = vmlal_n_s16(sum0, s7, y_filter[7]);
|
||||
|
||||
sum0 = vaddq_s32(sum0, offset_const);
|
||||
sum0 = vqrshlq_s32(sum0, round_shift_vec);
|
||||
sum0 = vmaxq_s32(sum0, zero);
|
||||
res = vmovn_u32(vreinterpretq_u32_s32(sum0));
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
#endif // AV1_COMMON_ARM_CONVOLVE_NEON_H_
|
||||
79
third_party/aom/av1/common/arm/intrapred_neon.c
vendored
Normal file
79
third_party/aom/av1/common/arm/intrapred_neon.c
vendored
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
*
|
||||
* Copyright (c) 2018, 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 <arm_neon.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "aom_mem/aom_mem.h"
|
||||
#include "aom_ports/mem.h"
|
||||
#include "av1/common/arm/mem_neon.h"
|
||||
#include "config/aom_dsp_rtcd.h"
|
||||
|
||||
static INLINE void highbd_dc_predictor_neon(uint16_t *dst, ptrdiff_t stride,
|
||||
int bw, const uint16_t *above,
|
||||
const uint16_t *left) {
|
||||
assert(bw >= 4);
|
||||
assert(IS_POWER_OF_TWO(bw));
|
||||
int expected_dc, sum = 0;
|
||||
const int count = bw * 2;
|
||||
uint32x4_t sum_q = vdupq_n_u32(0);
|
||||
uint32x2_t sum_d;
|
||||
uint16_t *dst_1;
|
||||
if (bw >= 8) {
|
||||
for (int i = 0; i < bw; i += 8) {
|
||||
sum_q = vpadalq_u16(sum_q, vld1q_u16(above));
|
||||
sum_q = vpadalq_u16(sum_q, vld1q_u16(left));
|
||||
above += 8;
|
||||
left += 8;
|
||||
}
|
||||
sum_d = vadd_u32(vget_low_u32(sum_q), vget_high_u32(sum_q));
|
||||
sum = vget_lane_s32(vreinterpret_s32_u64(vpaddl_u32(sum_d)), 0);
|
||||
expected_dc = (sum + (count >> 1)) / count;
|
||||
const uint16x8_t dc = vdupq_n_u16((uint16_t)expected_dc);
|
||||
for (int r = 0; r < bw; r++) {
|
||||
dst_1 = dst;
|
||||
for (int i = 0; i < bw; i += 8) {
|
||||
vst1q_u16(dst_1, dc);
|
||||
dst_1 += 8;
|
||||
}
|
||||
dst += stride;
|
||||
}
|
||||
} else { // 4x4
|
||||
sum_q = vaddl_u16(vld1_u16(above), vld1_u16(left));
|
||||
sum_d = vadd_u32(vget_low_u32(sum_q), vget_high_u32(sum_q));
|
||||
sum = vget_lane_s32(vreinterpret_s32_u64(vpaddl_u32(sum_d)), 0);
|
||||
expected_dc = (sum + (count >> 1)) / count;
|
||||
const uint16x4_t dc = vdup_n_u16((uint16_t)expected_dc);
|
||||
for (int r = 0; r < bw; r++) {
|
||||
vst1_u16(dst, dc);
|
||||
dst += stride;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define intra_pred_highbd_sized(type, width) \
|
||||
void aom_highbd_##type##_predictor_##width##x##width##_neon( \
|
||||
uint16_t *dst, ptrdiff_t stride, const uint16_t *above, \
|
||||
const uint16_t *left, int bd) { \
|
||||
(void)bd; \
|
||||
highbd_##type##_predictor_neon(dst, stride, width, above, left); \
|
||||
}
|
||||
|
||||
#define intra_pred_square(type) \
|
||||
intra_pred_highbd_sized(type, 4); \
|
||||
intra_pred_highbd_sized(type, 8); \
|
||||
intra_pred_highbd_sized(type, 16); \
|
||||
intra_pred_highbd_sized(type, 32); \
|
||||
intra_pred_highbd_sized(type, 64);
|
||||
|
||||
intra_pred_square(dc);
|
||||
|
||||
#undef intra_pred_square
|
||||
1326
third_party/aom/av1/common/arm/jnt_convolve_neon.c
vendored
Normal file
1326
third_party/aom/av1/common/arm/jnt_convolve_neon.c
vendored
Normal file
File diff suppressed because it is too large
Load diff
401
third_party/aom/av1/common/arm/mem_neon.h
vendored
Normal file
401
third_party/aom/av1/common/arm/mem_neon.h
vendored
Normal file
|
|
@ -0,0 +1,401 @@
|
|||
/*
|
||||
* Copyright (c) 2018, Alliance for Open Media. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#ifndef AV1_COMMON_ARM_MEM_NEON_H_
|
||||
#define AV1_COMMON_ARM_MEM_NEON_H_
|
||||
|
||||
#include <arm_neon.h>
|
||||
#include <string.h>
|
||||
|
||||
static INLINE void store_row2_u8_8x8(uint8_t *s, int p, const uint8x8_t s0,
|
||||
const uint8x8_t s1) {
|
||||
vst1_u8(s, s0);
|
||||
s += p;
|
||||
vst1_u8(s, s1);
|
||||
s += p;
|
||||
}
|
||||
|
||||
static INLINE void load_u8_8x8(const uint8_t *s, ptrdiff_t p,
|
||||
uint8x8_t *const s0, uint8x8_t *const s1,
|
||||
uint8x8_t *const s2, uint8x8_t *const s3,
|
||||
uint8x8_t *const s4, uint8x8_t *const s5,
|
||||
uint8x8_t *const s6, uint8x8_t *const s7) {
|
||||
*s0 = vld1_u8(s);
|
||||
s += p;
|
||||
*s1 = vld1_u8(s);
|
||||
s += p;
|
||||
*s2 = vld1_u8(s);
|
||||
s += p;
|
||||
*s3 = vld1_u8(s);
|
||||
s += p;
|
||||
*s4 = vld1_u8(s);
|
||||
s += p;
|
||||
*s5 = vld1_u8(s);
|
||||
s += p;
|
||||
*s6 = vld1_u8(s);
|
||||
s += p;
|
||||
*s7 = vld1_u8(s);
|
||||
}
|
||||
|
||||
static INLINE void load_u8_8x16(const uint8_t *s, ptrdiff_t p,
|
||||
uint8x16_t *const s0, uint8x16_t *const s1,
|
||||
uint8x16_t *const s2, uint8x16_t *const s3) {
|
||||
*s0 = vld1q_u8(s);
|
||||
s += p;
|
||||
*s1 = vld1q_u8(s);
|
||||
s += p;
|
||||
*s2 = vld1q_u8(s);
|
||||
s += p;
|
||||
*s3 = vld1q_u8(s);
|
||||
}
|
||||
|
||||
static INLINE void load_u8_8x4(const uint8_t *s, const ptrdiff_t p,
|
||||
uint8x8_t *const s0, uint8x8_t *const s1,
|
||||
uint8x8_t *const s2, uint8x8_t *const s3) {
|
||||
*s0 = vld1_u8(s);
|
||||
s += p;
|
||||
*s1 = vld1_u8(s);
|
||||
s += p;
|
||||
*s2 = vld1_u8(s);
|
||||
s += p;
|
||||
*s3 = vld1_u8(s);
|
||||
}
|
||||
|
||||
static INLINE void load_u16_4x4(const uint16_t *s, const ptrdiff_t p,
|
||||
uint16x4_t *const s0, uint16x4_t *const s1,
|
||||
uint16x4_t *const s2, uint16x4_t *const s3) {
|
||||
*s0 = vld1_u16(s);
|
||||
s += p;
|
||||
*s1 = vld1_u16(s);
|
||||
s += p;
|
||||
*s2 = vld1_u16(s);
|
||||
s += p;
|
||||
*s3 = vld1_u16(s);
|
||||
s += p;
|
||||
}
|
||||
|
||||
static INLINE void load_u16_8x4(const uint16_t *s, const ptrdiff_t p,
|
||||
uint16x8_t *const s0, uint16x8_t *const s1,
|
||||
uint16x8_t *const s2, uint16x8_t *const s3) {
|
||||
*s0 = vld1q_u16(s);
|
||||
s += p;
|
||||
*s1 = vld1q_u16(s);
|
||||
s += p;
|
||||
*s2 = vld1q_u16(s);
|
||||
s += p;
|
||||
*s3 = vld1q_u16(s);
|
||||
s += p;
|
||||
}
|
||||
|
||||
static INLINE void load_s16_4x8(const int16_t *s, ptrdiff_t p,
|
||||
int16x4_t *const s0, int16x4_t *const s1,
|
||||
int16x4_t *const s2, int16x4_t *const s3,
|
||||
int16x4_t *const s4, int16x4_t *const s5,
|
||||
int16x4_t *const s6, int16x4_t *const s7) {
|
||||
*s0 = vld1_s16(s);
|
||||
s += p;
|
||||
*s1 = vld1_s16(s);
|
||||
s += p;
|
||||
*s2 = vld1_s16(s);
|
||||
s += p;
|
||||
*s3 = vld1_s16(s);
|
||||
s += p;
|
||||
*s4 = vld1_s16(s);
|
||||
s += p;
|
||||
*s5 = vld1_s16(s);
|
||||
s += p;
|
||||
*s6 = vld1_s16(s);
|
||||
s += p;
|
||||
*s7 = vld1_s16(s);
|
||||
}
|
||||
|
||||
static INLINE void load_s16_4x4(const int16_t *s, ptrdiff_t p,
|
||||
int16x4_t *const s0, int16x4_t *const s1,
|
||||
int16x4_t *const s2, int16x4_t *const s3) {
|
||||
*s0 = vld1_s16(s);
|
||||
s += p;
|
||||
*s1 = vld1_s16(s);
|
||||
s += p;
|
||||
*s2 = vld1_s16(s);
|
||||
s += p;
|
||||
*s3 = vld1_s16(s);
|
||||
}
|
||||
|
||||
static INLINE void store_u8_8x8(uint8_t *s, ptrdiff_t p, const uint8x8_t s0,
|
||||
const uint8x8_t s1, const uint8x8_t s2,
|
||||
const uint8x8_t s3, const uint8x8_t s4,
|
||||
const uint8x8_t s5, const uint8x8_t s6,
|
||||
const uint8x8_t s7) {
|
||||
vst1_u8(s, s0);
|
||||
s += p;
|
||||
vst1_u8(s, s1);
|
||||
s += p;
|
||||
vst1_u8(s, s2);
|
||||
s += p;
|
||||
vst1_u8(s, s3);
|
||||
s += p;
|
||||
vst1_u8(s, s4);
|
||||
s += p;
|
||||
vst1_u8(s, s5);
|
||||
s += p;
|
||||
vst1_u8(s, s6);
|
||||
s += p;
|
||||
vst1_u8(s, s7);
|
||||
}
|
||||
|
||||
static INLINE void store_u8_8x4(uint8_t *s, ptrdiff_t p, const uint8x8_t s0,
|
||||
const uint8x8_t s1, const uint8x8_t s2,
|
||||
const uint8x8_t s3) {
|
||||
vst1_u8(s, s0);
|
||||
s += p;
|
||||
vst1_u8(s, s1);
|
||||
s += p;
|
||||
vst1_u8(s, s2);
|
||||
s += p;
|
||||
vst1_u8(s, s3);
|
||||
}
|
||||
|
||||
static INLINE void store_u8_8x16(uint8_t *s, ptrdiff_t p, const uint8x16_t s0,
|
||||
const uint8x16_t s1, const uint8x16_t s2,
|
||||
const uint8x16_t s3) {
|
||||
vst1q_u8(s, s0);
|
||||
s += p;
|
||||
vst1q_u8(s, s1);
|
||||
s += p;
|
||||
vst1q_u8(s, s2);
|
||||
s += p;
|
||||
vst1q_u8(s, s3);
|
||||
}
|
||||
|
||||
static INLINE void store_u16_8x8(uint16_t *s, ptrdiff_t dst_stride,
|
||||
const uint16x8_t s0, const uint16x8_t s1,
|
||||
const uint16x8_t s2, const uint16x8_t s3,
|
||||
const uint16x8_t s4, const uint16x8_t s5,
|
||||
const uint16x8_t s6, const uint16x8_t s7) {
|
||||
vst1q_u16(s, s0);
|
||||
s += dst_stride;
|
||||
vst1q_u16(s, s1);
|
||||
s += dst_stride;
|
||||
vst1q_u16(s, s2);
|
||||
s += dst_stride;
|
||||
vst1q_u16(s, s3);
|
||||
s += dst_stride;
|
||||
vst1q_u16(s, s4);
|
||||
s += dst_stride;
|
||||
vst1q_u16(s, s5);
|
||||
s += dst_stride;
|
||||
vst1q_u16(s, s6);
|
||||
s += dst_stride;
|
||||
vst1q_u16(s, s7);
|
||||
}
|
||||
|
||||
static INLINE void store_u16_4x4(uint16_t *s, ptrdiff_t dst_stride,
|
||||
const uint16x4_t s0, const uint16x4_t s1,
|
||||
const uint16x4_t s2, const uint16x4_t s3) {
|
||||
vst1_u16(s, s0);
|
||||
s += dst_stride;
|
||||
vst1_u16(s, s1);
|
||||
s += dst_stride;
|
||||
vst1_u16(s, s2);
|
||||
s += dst_stride;
|
||||
vst1_u16(s, s3);
|
||||
}
|
||||
|
||||
static INLINE void store_u16_8x4(uint16_t *s, ptrdiff_t dst_stride,
|
||||
const uint16x8_t s0, const uint16x8_t s1,
|
||||
const uint16x8_t s2, const uint16x8_t s3) {
|
||||
vst1q_u16(s, s0);
|
||||
s += dst_stride;
|
||||
vst1q_u16(s, s1);
|
||||
s += dst_stride;
|
||||
vst1q_u16(s, s2);
|
||||
s += dst_stride;
|
||||
vst1q_u16(s, s3);
|
||||
}
|
||||
|
||||
static INLINE void store_s16_8x8(int16_t *s, ptrdiff_t dst_stride,
|
||||
const int16x8_t s0, const int16x8_t s1,
|
||||
const int16x8_t s2, const int16x8_t s3,
|
||||
const int16x8_t s4, const int16x8_t s5,
|
||||
const int16x8_t s6, const int16x8_t s7) {
|
||||
vst1q_s16(s, s0);
|
||||
s += dst_stride;
|
||||
vst1q_s16(s, s1);
|
||||
s += dst_stride;
|
||||
vst1q_s16(s, s2);
|
||||
s += dst_stride;
|
||||
vst1q_s16(s, s3);
|
||||
s += dst_stride;
|
||||
vst1q_s16(s, s4);
|
||||
s += dst_stride;
|
||||
vst1q_s16(s, s5);
|
||||
s += dst_stride;
|
||||
vst1q_s16(s, s6);
|
||||
s += dst_stride;
|
||||
vst1q_s16(s, s7);
|
||||
}
|
||||
|
||||
static INLINE void load_s16_8x8(const int16_t *s, ptrdiff_t p,
|
||||
int16x8_t *const s0, int16x8_t *const s1,
|
||||
int16x8_t *const s2, int16x8_t *const s3,
|
||||
int16x8_t *const s4, int16x8_t *const s5,
|
||||
int16x8_t *const s6, int16x8_t *const s7) {
|
||||
*s0 = vld1q_s16(s);
|
||||
s += p;
|
||||
*s1 = vld1q_s16(s);
|
||||
s += p;
|
||||
*s2 = vld1q_s16(s);
|
||||
s += p;
|
||||
*s3 = vld1q_s16(s);
|
||||
s += p;
|
||||
*s4 = vld1q_s16(s);
|
||||
s += p;
|
||||
*s5 = vld1q_s16(s);
|
||||
s += p;
|
||||
*s6 = vld1q_s16(s);
|
||||
s += p;
|
||||
*s7 = vld1q_s16(s);
|
||||
}
|
||||
|
||||
static INLINE void load_s16_8x4(const int16_t *s, ptrdiff_t p,
|
||||
int16x8_t *const s0, int16x8_t *const s1,
|
||||
int16x8_t *const s2, int16x8_t *const s3) {
|
||||
*s0 = vld1q_s16(s);
|
||||
s += p;
|
||||
*s1 = vld1q_s16(s);
|
||||
s += p;
|
||||
*s2 = vld1q_s16(s);
|
||||
s += p;
|
||||
*s3 = vld1q_s16(s);
|
||||
}
|
||||
|
||||
static INLINE void load_unaligned_u8_4x8(const uint8_t *buf, int stride,
|
||||
uint32x2_t *tu0, uint32x2_t *tu1,
|
||||
uint32x2_t *tu2, uint32x2_t *tu3) {
|
||||
uint32_t a;
|
||||
|
||||
memcpy(&a, buf, 4);
|
||||
buf += stride;
|
||||
*tu0 = vset_lane_u32(a, *tu0, 0);
|
||||
memcpy(&a, buf, 4);
|
||||
buf += stride;
|
||||
*tu0 = vset_lane_u32(a, *tu0, 1);
|
||||
memcpy(&a, buf, 4);
|
||||
buf += stride;
|
||||
*tu1 = vset_lane_u32(a, *tu1, 0);
|
||||
memcpy(&a, buf, 4);
|
||||
buf += stride;
|
||||
*tu1 = vset_lane_u32(a, *tu1, 1);
|
||||
memcpy(&a, buf, 4);
|
||||
buf += stride;
|
||||
*tu2 = vset_lane_u32(a, *tu2, 0);
|
||||
memcpy(&a, buf, 4);
|
||||
buf += stride;
|
||||
*tu2 = vset_lane_u32(a, *tu2, 1);
|
||||
memcpy(&a, buf, 4);
|
||||
buf += stride;
|
||||
*tu3 = vset_lane_u32(a, *tu3, 0);
|
||||
memcpy(&a, buf, 4);
|
||||
*tu3 = vset_lane_u32(a, *tu3, 1);
|
||||
}
|
||||
|
||||
static INLINE void load_unaligned_u8_4x4(const uint8_t *buf, int stride,
|
||||
uint32x2_t *tu0, uint32x2_t *tu1) {
|
||||
uint32_t a;
|
||||
|
||||
memcpy(&a, buf, 4);
|
||||
buf += stride;
|
||||
*tu0 = vset_lane_u32(a, *tu0, 0);
|
||||
memcpy(&a, buf, 4);
|
||||
buf += stride;
|
||||
*tu0 = vset_lane_u32(a, *tu0, 1);
|
||||
memcpy(&a, buf, 4);
|
||||
buf += stride;
|
||||
*tu1 = vset_lane_u32(a, *tu1, 0);
|
||||
memcpy(&a, buf, 4);
|
||||
*tu1 = vset_lane_u32(a, *tu1, 1);
|
||||
}
|
||||
|
||||
static INLINE void load_unaligned_u8_4x2(const uint8_t *buf, int stride,
|
||||
uint32x2_t *tu0) {
|
||||
uint32_t a;
|
||||
|
||||
memcpy(&a, buf, 4);
|
||||
buf += stride;
|
||||
*tu0 = vset_lane_u32(a, *tu0, 0);
|
||||
memcpy(&a, buf, 4);
|
||||
buf += stride;
|
||||
*tu0 = vset_lane_u32(a, *tu0, 1);
|
||||
}
|
||||
|
||||
static INLINE void load_unaligned_u8_2x2(const uint8_t *buf, int stride,
|
||||
uint16x4_t *tu0) {
|
||||
uint16_t a;
|
||||
|
||||
memcpy(&a, buf, 2);
|
||||
buf += stride;
|
||||
*tu0 = vset_lane_u16(a, *tu0, 0);
|
||||
memcpy(&a, buf, 2);
|
||||
buf += stride;
|
||||
*tu0 = vset_lane_u16(a, *tu0, 1);
|
||||
}
|
||||
|
||||
static INLINE void load_u8_16x8(const uint8_t *s, ptrdiff_t p,
|
||||
uint8x16_t *const s0, uint8x16_t *const s1,
|
||||
uint8x16_t *const s2, uint8x16_t *const s3,
|
||||
uint8x16_t *const s4, uint8x16_t *const s5,
|
||||
uint8x16_t *const s6, uint8x16_t *const s7) {
|
||||
*s0 = vld1q_u8(s);
|
||||
s += p;
|
||||
*s1 = vld1q_u8(s);
|
||||
s += p;
|
||||
*s2 = vld1q_u8(s);
|
||||
s += p;
|
||||
*s3 = vld1q_u8(s);
|
||||
s += p;
|
||||
*s4 = vld1q_u8(s);
|
||||
s += p;
|
||||
*s5 = vld1q_u8(s);
|
||||
s += p;
|
||||
*s6 = vld1q_u8(s);
|
||||
s += p;
|
||||
*s7 = vld1q_u8(s);
|
||||
}
|
||||
|
||||
static INLINE void load_u8_16x4(const uint8_t *s, ptrdiff_t p,
|
||||
uint8x16_t *const s0, uint8x16_t *const s1,
|
||||
uint8x16_t *const s2, uint8x16_t *const s3) {
|
||||
*s0 = vld1q_u8(s);
|
||||
s += p;
|
||||
*s1 = vld1q_u8(s);
|
||||
s += p;
|
||||
*s2 = vld1q_u8(s);
|
||||
s += p;
|
||||
*s3 = vld1q_u8(s);
|
||||
}
|
||||
|
||||
static INLINE void load_unaligned_u16_4x4(const uint16_t *buf, uint32_t stride,
|
||||
uint64x2_t *tu0, uint64x2_t *tu1) {
|
||||
uint64_t a;
|
||||
|
||||
memcpy(&a, buf, 8);
|
||||
buf += stride;
|
||||
*tu0 = vsetq_lane_u64(a, *tu0, 0);
|
||||
memcpy(&a, buf, 8);
|
||||
buf += stride;
|
||||
*tu0 = vsetq_lane_u64(a, *tu0, 1);
|
||||
memcpy(&a, buf, 8);
|
||||
buf += stride;
|
||||
*tu1 = vsetq_lane_u64(a, *tu1, 0);
|
||||
memcpy(&a, buf, 8);
|
||||
*tu1 = vsetq_lane_u64(a, *tu1, 1);
|
||||
}
|
||||
|
||||
#endif // AV1_COMMON_ARM_MEM_NEON_H_
|
||||
|
|
@ -1,228 +0,0 @@
|
|||
/*
|
||||
* 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 <arm_neon.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "./aom_config.h"
|
||||
#include "./av1_rtcd.h"
|
||||
#include "aom_dsp/txfm_common.h"
|
||||
#include "av1/common/common.h"
|
||||
|
||||
static INLINE void TRANSPOSE4X4(int16x8_t *q8s16, int16x8_t *q9s16) {
|
||||
int32x4_t q8s32, q9s32;
|
||||
int16x4x2_t d0x2s16, d1x2s16;
|
||||
int32x4x2_t q0x2s32;
|
||||
|
||||
d0x2s16 = vtrn_s16(vget_low_s16(*q8s16), vget_high_s16(*q8s16));
|
||||
d1x2s16 = vtrn_s16(vget_low_s16(*q9s16), vget_high_s16(*q9s16));
|
||||
|
||||
q8s32 = vreinterpretq_s32_s16(vcombine_s16(d0x2s16.val[0], d0x2s16.val[1]));
|
||||
q9s32 = vreinterpretq_s32_s16(vcombine_s16(d1x2s16.val[0], d1x2s16.val[1]));
|
||||
q0x2s32 = vtrnq_s32(q8s32, q9s32);
|
||||
|
||||
*q8s16 = vreinterpretq_s16_s32(q0x2s32.val[0]);
|
||||
*q9s16 = vreinterpretq_s16_s32(q0x2s32.val[1]);
|
||||
return;
|
||||
}
|
||||
|
||||
static INLINE void GENERATE_COSINE_CONSTANTS(int16x4_t *d0s16, int16x4_t *d1s16,
|
||||
int16x4_t *d2s16) {
|
||||
*d0s16 = vdup_n_s16((int16_t)cospi_8_64);
|
||||
*d1s16 = vdup_n_s16((int16_t)cospi_16_64);
|
||||
*d2s16 = vdup_n_s16((int16_t)cospi_24_64);
|
||||
return;
|
||||
}
|
||||
|
||||
static INLINE void GENERATE_SINE_CONSTANTS(int16x4_t *d3s16, int16x4_t *d4s16,
|
||||
int16x4_t *d5s16, int16x8_t *q3s16) {
|
||||
*d3s16 = vdup_n_s16((int16_t)sinpi_1_9);
|
||||
*d4s16 = vdup_n_s16((int16_t)sinpi_2_9);
|
||||
*q3s16 = vdupq_n_s16((int16_t)sinpi_3_9);
|
||||
*d5s16 = vdup_n_s16((int16_t)sinpi_4_9);
|
||||
return;
|
||||
}
|
||||
|
||||
static INLINE void IDCT4x4_1D(int16x4_t *d0s16, int16x4_t *d1s16,
|
||||
int16x4_t *d2s16, int16x8_t *q8s16,
|
||||
int16x8_t *q9s16) {
|
||||
int16x4_t d16s16, d17s16, d18s16, d19s16, d23s16, d24s16;
|
||||
int16x4_t d26s16, d27s16, d28s16, d29s16;
|
||||
int32x4_t q10s32, q13s32, q14s32, q15s32;
|
||||
int16x8_t q13s16, q14s16;
|
||||
|
||||
d16s16 = vget_low_s16(*q8s16);
|
||||
d17s16 = vget_high_s16(*q8s16);
|
||||
d18s16 = vget_low_s16(*q9s16);
|
||||
d19s16 = vget_high_s16(*q9s16);
|
||||
|
||||
d23s16 = vadd_s16(d16s16, d18s16);
|
||||
d24s16 = vsub_s16(d16s16, d18s16);
|
||||
|
||||
q15s32 = vmull_s16(d17s16, *d2s16);
|
||||
q10s32 = vmull_s16(d17s16, *d0s16);
|
||||
q13s32 = vmull_s16(d23s16, *d1s16);
|
||||
q14s32 = vmull_s16(d24s16, *d1s16);
|
||||
q15s32 = vmlsl_s16(q15s32, d19s16, *d0s16);
|
||||
q10s32 = vmlal_s16(q10s32, d19s16, *d2s16);
|
||||
|
||||
d26s16 = vqrshrn_n_s32(q13s32, 14);
|
||||
d27s16 = vqrshrn_n_s32(q14s32, 14);
|
||||
d29s16 = vqrshrn_n_s32(q15s32, 14);
|
||||
d28s16 = vqrshrn_n_s32(q10s32, 14);
|
||||
|
||||
q13s16 = vcombine_s16(d26s16, d27s16);
|
||||
q14s16 = vcombine_s16(d28s16, d29s16);
|
||||
*q8s16 = vaddq_s16(q13s16, q14s16);
|
||||
*q9s16 = vsubq_s16(q13s16, q14s16);
|
||||
*q9s16 = vcombine_s16(vget_high_s16(*q9s16), vget_low_s16(*q9s16)); // vswp
|
||||
return;
|
||||
}
|
||||
|
||||
static INLINE void IADST4x4_1D(int16x4_t *d3s16, int16x4_t *d4s16,
|
||||
int16x4_t *d5s16, int16x8_t *q3s16,
|
||||
int16x8_t *q8s16, int16x8_t *q9s16) {
|
||||
int16x4_t d6s16, d16s16, d17s16, d18s16, d19s16;
|
||||
int32x4_t q8s32, q9s32, q10s32, q11s32, q12s32, q13s32, q14s32, q15s32;
|
||||
|
||||
d6s16 = vget_low_s16(*q3s16);
|
||||
|
||||
d16s16 = vget_low_s16(*q8s16);
|
||||
d17s16 = vget_high_s16(*q8s16);
|
||||
d18s16 = vget_low_s16(*q9s16);
|
||||
d19s16 = vget_high_s16(*q9s16);
|
||||
|
||||
q10s32 = vmull_s16(*d3s16, d16s16);
|
||||
q11s32 = vmull_s16(*d4s16, d16s16);
|
||||
q12s32 = vmull_s16(d6s16, d17s16);
|
||||
q13s32 = vmull_s16(*d5s16, d18s16);
|
||||
q14s32 = vmull_s16(*d3s16, d18s16);
|
||||
q15s32 = vmovl_s16(d16s16);
|
||||
q15s32 = vaddw_s16(q15s32, d19s16);
|
||||
q8s32 = vmull_s16(*d4s16, d19s16);
|
||||
q15s32 = vsubw_s16(q15s32, d18s16);
|
||||
q9s32 = vmull_s16(*d5s16, d19s16);
|
||||
|
||||
q10s32 = vaddq_s32(q10s32, q13s32);
|
||||
q10s32 = vaddq_s32(q10s32, q8s32);
|
||||
q11s32 = vsubq_s32(q11s32, q14s32);
|
||||
q8s32 = vdupq_n_s32((int32_t)sinpi_3_9);
|
||||
q11s32 = vsubq_s32(q11s32, q9s32);
|
||||
q15s32 = vmulq_s32(q15s32, q8s32);
|
||||
|
||||
q13s32 = vaddq_s32(q10s32, q12s32);
|
||||
q10s32 = vaddq_s32(q10s32, q11s32);
|
||||
q14s32 = vaddq_s32(q11s32, q12s32);
|
||||
q10s32 = vsubq_s32(q10s32, q12s32);
|
||||
|
||||
d16s16 = vqrshrn_n_s32(q13s32, 14);
|
||||
d17s16 = vqrshrn_n_s32(q14s32, 14);
|
||||
d18s16 = vqrshrn_n_s32(q15s32, 14);
|
||||
d19s16 = vqrshrn_n_s32(q10s32, 14);
|
||||
|
||||
*q8s16 = vcombine_s16(d16s16, d17s16);
|
||||
*q9s16 = vcombine_s16(d18s16, d19s16);
|
||||
return;
|
||||
}
|
||||
|
||||
void av1_iht4x4_16_add_neon(const tran_low_t *input, uint8_t *dest,
|
||||
int dest_stride, const TxfmParam *txfm_param) {
|
||||
uint8x8_t d26u8, d27u8;
|
||||
int16x4_t d0s16, d1s16, d2s16, d3s16, d4s16, d5s16;
|
||||
uint32x2_t d26u32, d27u32;
|
||||
int16x8_t q3s16, q8s16, q9s16;
|
||||
uint16x8_t q8u16, q9u16;
|
||||
|
||||
d26u32 = d27u32 = vdup_n_u32(0);
|
||||
|
||||
q8s16 = vld1q_s16(input);
|
||||
q9s16 = vld1q_s16(input + 8);
|
||||
|
||||
TRANSPOSE4X4(&q8s16, &q9s16);
|
||||
|
||||
const TX_TYPE tx_type = txfm_param->tx_type;
|
||||
switch (tx_type) {
|
||||
case DCT_DCT: // idct_idct is not supported. Fall back to C
|
||||
av1_iht4x4_16_add_c(input, dest, dest_stride, txfm_param);
|
||||
return;
|
||||
break;
|
||||
case ADST_DCT: // iadst_idct
|
||||
// generate constants
|
||||
GENERATE_COSINE_CONSTANTS(&d0s16, &d1s16, &d2s16);
|
||||
GENERATE_SINE_CONSTANTS(&d3s16, &d4s16, &d5s16, &q3s16);
|
||||
|
||||
// first transform rows
|
||||
IDCT4x4_1D(&d0s16, &d1s16, &d2s16, &q8s16, &q9s16);
|
||||
|
||||
// transpose the matrix
|
||||
TRANSPOSE4X4(&q8s16, &q9s16);
|
||||
|
||||
// then transform columns
|
||||
IADST4x4_1D(&d3s16, &d4s16, &d5s16, &q3s16, &q8s16, &q9s16);
|
||||
break;
|
||||
case DCT_ADST: // idct_iadst
|
||||
// generate constantsyy
|
||||
GENERATE_COSINE_CONSTANTS(&d0s16, &d1s16, &d2s16);
|
||||
GENERATE_SINE_CONSTANTS(&d3s16, &d4s16, &d5s16, &q3s16);
|
||||
|
||||
// first transform rows
|
||||
IADST4x4_1D(&d3s16, &d4s16, &d5s16, &q3s16, &q8s16, &q9s16);
|
||||
|
||||
// transpose the matrix
|
||||
TRANSPOSE4X4(&q8s16, &q9s16);
|
||||
|
||||
// then transform columns
|
||||
IDCT4x4_1D(&d0s16, &d1s16, &d2s16, &q8s16, &q9s16);
|
||||
break;
|
||||
case ADST_ADST: // iadst_iadst
|
||||
// generate constants
|
||||
GENERATE_SINE_CONSTANTS(&d3s16, &d4s16, &d5s16, &q3s16);
|
||||
|
||||
// first transform rows
|
||||
IADST4x4_1D(&d3s16, &d4s16, &d5s16, &q3s16, &q8s16, &q9s16);
|
||||
|
||||
// transpose the matrix
|
||||
TRANSPOSE4X4(&q8s16, &q9s16);
|
||||
|
||||
// then transform columns
|
||||
IADST4x4_1D(&d3s16, &d4s16, &d5s16, &q3s16, &q8s16, &q9s16);
|
||||
break;
|
||||
default: // iadst_idct
|
||||
assert(0);
|
||||
break;
|
||||
}
|
||||
|
||||
q8s16 = vrshrq_n_s16(q8s16, 4);
|
||||
q9s16 = vrshrq_n_s16(q9s16, 4);
|
||||
|
||||
d26u32 = vld1_lane_u32((const uint32_t *)dest, d26u32, 0);
|
||||
dest += dest_stride;
|
||||
d26u32 = vld1_lane_u32((const uint32_t *)dest, d26u32, 1);
|
||||
dest += dest_stride;
|
||||
d27u32 = vld1_lane_u32((const uint32_t *)dest, d27u32, 0);
|
||||
dest += dest_stride;
|
||||
d27u32 = vld1_lane_u32((const uint32_t *)dest, d27u32, 1);
|
||||
|
||||
q8u16 = vaddw_u8(vreinterpretq_u16_s16(q8s16), vreinterpret_u8_u32(d26u32));
|
||||
q9u16 = vaddw_u8(vreinterpretq_u16_s16(q9s16), vreinterpret_u8_u32(d27u32));
|
||||
|
||||
d26u8 = vqmovun_s16(vreinterpretq_s16_u16(q8u16));
|
||||
d27u8 = vqmovun_s16(vreinterpretq_s16_u16(q9u16));
|
||||
|
||||
vst1_lane_u32((uint32_t *)dest, vreinterpret_u32_u8(d27u8), 1);
|
||||
dest -= dest_stride;
|
||||
vst1_lane_u32((uint32_t *)dest, vreinterpret_u32_u8(d27u8), 0);
|
||||
dest -= dest_stride;
|
||||
vst1_lane_u32((uint32_t *)dest, vreinterpret_u32_u8(d26u8), 1);
|
||||
dest -= dest_stride;
|
||||
vst1_lane_u32((uint32_t *)dest, vreinterpret_u32_u8(d26u8), 0);
|
||||
return;
|
||||
}
|
||||
|
|
@ -1,594 +0,0 @@
|
|||
/*
|
||||
* 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 <arm_neon.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "./aom_config.h"
|
||||
#include "./av1_rtcd.h"
|
||||
#include "aom_dsp/txfm_common.h"
|
||||
#include "av1/common/common.h"
|
||||
|
||||
static INLINE void TRANSPOSE8X8(int16x8_t *q8s16, int16x8_t *q9s16,
|
||||
int16x8_t *q10s16, int16x8_t *q11s16,
|
||||
int16x8_t *q12s16, int16x8_t *q13s16,
|
||||
int16x8_t *q14s16, int16x8_t *q15s16) {
|
||||
int16x4_t d16s16, d17s16, d18s16, d19s16, d20s16, d21s16, d22s16, d23s16;
|
||||
int16x4_t d24s16, d25s16, d26s16, d27s16, d28s16, d29s16, d30s16, d31s16;
|
||||
int32x4x2_t q0x2s32, q1x2s32, q2x2s32, q3x2s32;
|
||||
int16x8x2_t q0x2s16, q1x2s16, q2x2s16, q3x2s16;
|
||||
|
||||
d16s16 = vget_low_s16(*q8s16);
|
||||
d17s16 = vget_high_s16(*q8s16);
|
||||
d18s16 = vget_low_s16(*q9s16);
|
||||
d19s16 = vget_high_s16(*q9s16);
|
||||
d20s16 = vget_low_s16(*q10s16);
|
||||
d21s16 = vget_high_s16(*q10s16);
|
||||
d22s16 = vget_low_s16(*q11s16);
|
||||
d23s16 = vget_high_s16(*q11s16);
|
||||
d24s16 = vget_low_s16(*q12s16);
|
||||
d25s16 = vget_high_s16(*q12s16);
|
||||
d26s16 = vget_low_s16(*q13s16);
|
||||
d27s16 = vget_high_s16(*q13s16);
|
||||
d28s16 = vget_low_s16(*q14s16);
|
||||
d29s16 = vget_high_s16(*q14s16);
|
||||
d30s16 = vget_low_s16(*q15s16);
|
||||
d31s16 = vget_high_s16(*q15s16);
|
||||
|
||||
*q8s16 = vcombine_s16(d16s16, d24s16); // vswp d17, d24
|
||||
*q9s16 = vcombine_s16(d18s16, d26s16); // vswp d19, d26
|
||||
*q10s16 = vcombine_s16(d20s16, d28s16); // vswp d21, d28
|
||||
*q11s16 = vcombine_s16(d22s16, d30s16); // vswp d23, d30
|
||||
*q12s16 = vcombine_s16(d17s16, d25s16);
|
||||
*q13s16 = vcombine_s16(d19s16, d27s16);
|
||||
*q14s16 = vcombine_s16(d21s16, d29s16);
|
||||
*q15s16 = vcombine_s16(d23s16, d31s16);
|
||||
|
||||
q0x2s32 =
|
||||
vtrnq_s32(vreinterpretq_s32_s16(*q8s16), vreinterpretq_s32_s16(*q10s16));
|
||||
q1x2s32 =
|
||||
vtrnq_s32(vreinterpretq_s32_s16(*q9s16), vreinterpretq_s32_s16(*q11s16));
|
||||
q2x2s32 =
|
||||
vtrnq_s32(vreinterpretq_s32_s16(*q12s16), vreinterpretq_s32_s16(*q14s16));
|
||||
q3x2s32 =
|
||||
vtrnq_s32(vreinterpretq_s32_s16(*q13s16), vreinterpretq_s32_s16(*q15s16));
|
||||
|
||||
q0x2s16 = vtrnq_s16(vreinterpretq_s16_s32(q0x2s32.val[0]), // q8
|
||||
vreinterpretq_s16_s32(q1x2s32.val[0])); // q9
|
||||
q1x2s16 = vtrnq_s16(vreinterpretq_s16_s32(q0x2s32.val[1]), // q10
|
||||
vreinterpretq_s16_s32(q1x2s32.val[1])); // q11
|
||||
q2x2s16 = vtrnq_s16(vreinterpretq_s16_s32(q2x2s32.val[0]), // q12
|
||||
vreinterpretq_s16_s32(q3x2s32.val[0])); // q13
|
||||
q3x2s16 = vtrnq_s16(vreinterpretq_s16_s32(q2x2s32.val[1]), // q14
|
||||
vreinterpretq_s16_s32(q3x2s32.val[1])); // q15
|
||||
|
||||
*q8s16 = q0x2s16.val[0];
|
||||
*q9s16 = q0x2s16.val[1];
|
||||
*q10s16 = q1x2s16.val[0];
|
||||
*q11s16 = q1x2s16.val[1];
|
||||
*q12s16 = q2x2s16.val[0];
|
||||
*q13s16 = q2x2s16.val[1];
|
||||
*q14s16 = q3x2s16.val[0];
|
||||
*q15s16 = q3x2s16.val[1];
|
||||
return;
|
||||
}
|
||||
|
||||
static INLINE void IDCT8x8_1D(int16x8_t *q8s16, int16x8_t *q9s16,
|
||||
int16x8_t *q10s16, int16x8_t *q11s16,
|
||||
int16x8_t *q12s16, int16x8_t *q13s16,
|
||||
int16x8_t *q14s16, int16x8_t *q15s16) {
|
||||
int16x4_t d0s16, d1s16, d2s16, d3s16;
|
||||
int16x4_t d8s16, d9s16, d10s16, d11s16, d12s16, d13s16, d14s16, d15s16;
|
||||
int16x4_t d16s16, d17s16, d18s16, d19s16, d20s16, d21s16, d22s16, d23s16;
|
||||
int16x4_t d24s16, d25s16, d26s16, d27s16, d28s16, d29s16, d30s16, d31s16;
|
||||
int16x8_t q0s16, q1s16, q2s16, q3s16, q4s16, q5s16, q6s16, q7s16;
|
||||
int32x4_t q2s32, q3s32, q5s32, q6s32, q8s32, q9s32;
|
||||
int32x4_t q10s32, q11s32, q12s32, q13s32, q15s32;
|
||||
|
||||
d0s16 = vdup_n_s16((int16_t)cospi_28_64);
|
||||
d1s16 = vdup_n_s16((int16_t)cospi_4_64);
|
||||
d2s16 = vdup_n_s16((int16_t)cospi_12_64);
|
||||
d3s16 = vdup_n_s16((int16_t)cospi_20_64);
|
||||
|
||||
d16s16 = vget_low_s16(*q8s16);
|
||||
d17s16 = vget_high_s16(*q8s16);
|
||||
d18s16 = vget_low_s16(*q9s16);
|
||||
d19s16 = vget_high_s16(*q9s16);
|
||||
d20s16 = vget_low_s16(*q10s16);
|
||||
d21s16 = vget_high_s16(*q10s16);
|
||||
d22s16 = vget_low_s16(*q11s16);
|
||||
d23s16 = vget_high_s16(*q11s16);
|
||||
d24s16 = vget_low_s16(*q12s16);
|
||||
d25s16 = vget_high_s16(*q12s16);
|
||||
d26s16 = vget_low_s16(*q13s16);
|
||||
d27s16 = vget_high_s16(*q13s16);
|
||||
d28s16 = vget_low_s16(*q14s16);
|
||||
d29s16 = vget_high_s16(*q14s16);
|
||||
d30s16 = vget_low_s16(*q15s16);
|
||||
d31s16 = vget_high_s16(*q15s16);
|
||||
|
||||
q2s32 = vmull_s16(d18s16, d0s16);
|
||||
q3s32 = vmull_s16(d19s16, d0s16);
|
||||
q5s32 = vmull_s16(d26s16, d2s16);
|
||||
q6s32 = vmull_s16(d27s16, d2s16);
|
||||
|
||||
q2s32 = vmlsl_s16(q2s32, d30s16, d1s16);
|
||||
q3s32 = vmlsl_s16(q3s32, d31s16, d1s16);
|
||||
q5s32 = vmlsl_s16(q5s32, d22s16, d3s16);
|
||||
q6s32 = vmlsl_s16(q6s32, d23s16, d3s16);
|
||||
|
||||
d8s16 = vqrshrn_n_s32(q2s32, 14);
|
||||
d9s16 = vqrshrn_n_s32(q3s32, 14);
|
||||
d10s16 = vqrshrn_n_s32(q5s32, 14);
|
||||
d11s16 = vqrshrn_n_s32(q6s32, 14);
|
||||
q4s16 = vcombine_s16(d8s16, d9s16);
|
||||
q5s16 = vcombine_s16(d10s16, d11s16);
|
||||
|
||||
q2s32 = vmull_s16(d18s16, d1s16);
|
||||
q3s32 = vmull_s16(d19s16, d1s16);
|
||||
q9s32 = vmull_s16(d26s16, d3s16);
|
||||
q13s32 = vmull_s16(d27s16, d3s16);
|
||||
|
||||
q2s32 = vmlal_s16(q2s32, d30s16, d0s16);
|
||||
q3s32 = vmlal_s16(q3s32, d31s16, d0s16);
|
||||
q9s32 = vmlal_s16(q9s32, d22s16, d2s16);
|
||||
q13s32 = vmlal_s16(q13s32, d23s16, d2s16);
|
||||
|
||||
d14s16 = vqrshrn_n_s32(q2s32, 14);
|
||||
d15s16 = vqrshrn_n_s32(q3s32, 14);
|
||||
d12s16 = vqrshrn_n_s32(q9s32, 14);
|
||||
d13s16 = vqrshrn_n_s32(q13s32, 14);
|
||||
q6s16 = vcombine_s16(d12s16, d13s16);
|
||||
q7s16 = vcombine_s16(d14s16, d15s16);
|
||||
|
||||
d0s16 = vdup_n_s16((int16_t)cospi_16_64);
|
||||
|
||||
q2s32 = vmull_s16(d16s16, d0s16);
|
||||
q3s32 = vmull_s16(d17s16, d0s16);
|
||||
q13s32 = vmull_s16(d16s16, d0s16);
|
||||
q15s32 = vmull_s16(d17s16, d0s16);
|
||||
|
||||
q2s32 = vmlal_s16(q2s32, d24s16, d0s16);
|
||||
q3s32 = vmlal_s16(q3s32, d25s16, d0s16);
|
||||
q13s32 = vmlsl_s16(q13s32, d24s16, d0s16);
|
||||
q15s32 = vmlsl_s16(q15s32, d25s16, d0s16);
|
||||
|
||||
d0s16 = vdup_n_s16((int16_t)cospi_24_64);
|
||||
d1s16 = vdup_n_s16((int16_t)cospi_8_64);
|
||||
|
||||
d18s16 = vqrshrn_n_s32(q2s32, 14);
|
||||
d19s16 = vqrshrn_n_s32(q3s32, 14);
|
||||
d22s16 = vqrshrn_n_s32(q13s32, 14);
|
||||
d23s16 = vqrshrn_n_s32(q15s32, 14);
|
||||
*q9s16 = vcombine_s16(d18s16, d19s16);
|
||||
*q11s16 = vcombine_s16(d22s16, d23s16);
|
||||
|
||||
q2s32 = vmull_s16(d20s16, d0s16);
|
||||
q3s32 = vmull_s16(d21s16, d0s16);
|
||||
q8s32 = vmull_s16(d20s16, d1s16);
|
||||
q12s32 = vmull_s16(d21s16, d1s16);
|
||||
|
||||
q2s32 = vmlsl_s16(q2s32, d28s16, d1s16);
|
||||
q3s32 = vmlsl_s16(q3s32, d29s16, d1s16);
|
||||
q8s32 = vmlal_s16(q8s32, d28s16, d0s16);
|
||||
q12s32 = vmlal_s16(q12s32, d29s16, d0s16);
|
||||
|
||||
d26s16 = vqrshrn_n_s32(q2s32, 14);
|
||||
d27s16 = vqrshrn_n_s32(q3s32, 14);
|
||||
d30s16 = vqrshrn_n_s32(q8s32, 14);
|
||||
d31s16 = vqrshrn_n_s32(q12s32, 14);
|
||||
*q13s16 = vcombine_s16(d26s16, d27s16);
|
||||
*q15s16 = vcombine_s16(d30s16, d31s16);
|
||||
|
||||
q0s16 = vaddq_s16(*q9s16, *q15s16);
|
||||
q1s16 = vaddq_s16(*q11s16, *q13s16);
|
||||
q2s16 = vsubq_s16(*q11s16, *q13s16);
|
||||
q3s16 = vsubq_s16(*q9s16, *q15s16);
|
||||
|
||||
*q13s16 = vsubq_s16(q4s16, q5s16);
|
||||
q4s16 = vaddq_s16(q4s16, q5s16);
|
||||
*q14s16 = vsubq_s16(q7s16, q6s16);
|
||||
q7s16 = vaddq_s16(q7s16, q6s16);
|
||||
d26s16 = vget_low_s16(*q13s16);
|
||||
d27s16 = vget_high_s16(*q13s16);
|
||||
d28s16 = vget_low_s16(*q14s16);
|
||||
d29s16 = vget_high_s16(*q14s16);
|
||||
|
||||
d16s16 = vdup_n_s16((int16_t)cospi_16_64);
|
||||
|
||||
q9s32 = vmull_s16(d28s16, d16s16);
|
||||
q10s32 = vmull_s16(d29s16, d16s16);
|
||||
q11s32 = vmull_s16(d28s16, d16s16);
|
||||
q12s32 = vmull_s16(d29s16, d16s16);
|
||||
|
||||
q9s32 = vmlsl_s16(q9s32, d26s16, d16s16);
|
||||
q10s32 = vmlsl_s16(q10s32, d27s16, d16s16);
|
||||
q11s32 = vmlal_s16(q11s32, d26s16, d16s16);
|
||||
q12s32 = vmlal_s16(q12s32, d27s16, d16s16);
|
||||
|
||||
d10s16 = vqrshrn_n_s32(q9s32, 14);
|
||||
d11s16 = vqrshrn_n_s32(q10s32, 14);
|
||||
d12s16 = vqrshrn_n_s32(q11s32, 14);
|
||||
d13s16 = vqrshrn_n_s32(q12s32, 14);
|
||||
q5s16 = vcombine_s16(d10s16, d11s16);
|
||||
q6s16 = vcombine_s16(d12s16, d13s16);
|
||||
|
||||
*q8s16 = vaddq_s16(q0s16, q7s16);
|
||||
*q9s16 = vaddq_s16(q1s16, q6s16);
|
||||
*q10s16 = vaddq_s16(q2s16, q5s16);
|
||||
*q11s16 = vaddq_s16(q3s16, q4s16);
|
||||
*q12s16 = vsubq_s16(q3s16, q4s16);
|
||||
*q13s16 = vsubq_s16(q2s16, q5s16);
|
||||
*q14s16 = vsubq_s16(q1s16, q6s16);
|
||||
*q15s16 = vsubq_s16(q0s16, q7s16);
|
||||
return;
|
||||
}
|
||||
|
||||
static INLINE void IADST8X8_1D(int16x8_t *q8s16, int16x8_t *q9s16,
|
||||
int16x8_t *q10s16, int16x8_t *q11s16,
|
||||
int16x8_t *q12s16, int16x8_t *q13s16,
|
||||
int16x8_t *q14s16, int16x8_t *q15s16) {
|
||||
int16x4_t d0s16, d1s16, d2s16, d3s16, d4s16, d5s16, d6s16, d7s16;
|
||||
int16x4_t d8s16, d9s16, d10s16, d11s16, d12s16, d13s16, d14s16, d15s16;
|
||||
int16x4_t d16s16, d17s16, d18s16, d19s16, d20s16, d21s16, d22s16, d23s16;
|
||||
int16x4_t d24s16, d25s16, d26s16, d27s16, d28s16, d29s16, d30s16, d31s16;
|
||||
int16x8_t q2s16, q4s16, q5s16, q6s16;
|
||||
int32x4_t q0s32, q1s32, q2s32, q3s32, q4s32, q5s32, q6s32, q7s32, q8s32;
|
||||
int32x4_t q9s32, q10s32, q11s32, q12s32, q13s32, q14s32, q15s32;
|
||||
|
||||
d16s16 = vget_low_s16(*q8s16);
|
||||
d17s16 = vget_high_s16(*q8s16);
|
||||
d18s16 = vget_low_s16(*q9s16);
|
||||
d19s16 = vget_high_s16(*q9s16);
|
||||
d20s16 = vget_low_s16(*q10s16);
|
||||
d21s16 = vget_high_s16(*q10s16);
|
||||
d22s16 = vget_low_s16(*q11s16);
|
||||
d23s16 = vget_high_s16(*q11s16);
|
||||
d24s16 = vget_low_s16(*q12s16);
|
||||
d25s16 = vget_high_s16(*q12s16);
|
||||
d26s16 = vget_low_s16(*q13s16);
|
||||
d27s16 = vget_high_s16(*q13s16);
|
||||
d28s16 = vget_low_s16(*q14s16);
|
||||
d29s16 = vget_high_s16(*q14s16);
|
||||
d30s16 = vget_low_s16(*q15s16);
|
||||
d31s16 = vget_high_s16(*q15s16);
|
||||
|
||||
d14s16 = vdup_n_s16((int16_t)cospi_2_64);
|
||||
d15s16 = vdup_n_s16((int16_t)cospi_30_64);
|
||||
|
||||
q1s32 = vmull_s16(d30s16, d14s16);
|
||||
q2s32 = vmull_s16(d31s16, d14s16);
|
||||
q3s32 = vmull_s16(d30s16, d15s16);
|
||||
q4s32 = vmull_s16(d31s16, d15s16);
|
||||
|
||||
d30s16 = vdup_n_s16((int16_t)cospi_18_64);
|
||||
d31s16 = vdup_n_s16((int16_t)cospi_14_64);
|
||||
|
||||
q1s32 = vmlal_s16(q1s32, d16s16, d15s16);
|
||||
q2s32 = vmlal_s16(q2s32, d17s16, d15s16);
|
||||
q3s32 = vmlsl_s16(q3s32, d16s16, d14s16);
|
||||
q4s32 = vmlsl_s16(q4s32, d17s16, d14s16);
|
||||
|
||||
q5s32 = vmull_s16(d22s16, d30s16);
|
||||
q6s32 = vmull_s16(d23s16, d30s16);
|
||||
q7s32 = vmull_s16(d22s16, d31s16);
|
||||
q8s32 = vmull_s16(d23s16, d31s16);
|
||||
|
||||
q5s32 = vmlal_s16(q5s32, d24s16, d31s16);
|
||||
q6s32 = vmlal_s16(q6s32, d25s16, d31s16);
|
||||
q7s32 = vmlsl_s16(q7s32, d24s16, d30s16);
|
||||
q8s32 = vmlsl_s16(q8s32, d25s16, d30s16);
|
||||
|
||||
q11s32 = vaddq_s32(q1s32, q5s32);
|
||||
q12s32 = vaddq_s32(q2s32, q6s32);
|
||||
q1s32 = vsubq_s32(q1s32, q5s32);
|
||||
q2s32 = vsubq_s32(q2s32, q6s32);
|
||||
|
||||
d22s16 = vqrshrn_n_s32(q11s32, 14);
|
||||
d23s16 = vqrshrn_n_s32(q12s32, 14);
|
||||
*q11s16 = vcombine_s16(d22s16, d23s16);
|
||||
|
||||
q12s32 = vaddq_s32(q3s32, q7s32);
|
||||
q15s32 = vaddq_s32(q4s32, q8s32);
|
||||
q3s32 = vsubq_s32(q3s32, q7s32);
|
||||
q4s32 = vsubq_s32(q4s32, q8s32);
|
||||
|
||||
d2s16 = vqrshrn_n_s32(q1s32, 14);
|
||||
d3s16 = vqrshrn_n_s32(q2s32, 14);
|
||||
d24s16 = vqrshrn_n_s32(q12s32, 14);
|
||||
d25s16 = vqrshrn_n_s32(q15s32, 14);
|
||||
d6s16 = vqrshrn_n_s32(q3s32, 14);
|
||||
d7s16 = vqrshrn_n_s32(q4s32, 14);
|
||||
*q12s16 = vcombine_s16(d24s16, d25s16);
|
||||
|
||||
d0s16 = vdup_n_s16((int16_t)cospi_10_64);
|
||||
d1s16 = vdup_n_s16((int16_t)cospi_22_64);
|
||||
q4s32 = vmull_s16(d26s16, d0s16);
|
||||
q5s32 = vmull_s16(d27s16, d0s16);
|
||||
q2s32 = vmull_s16(d26s16, d1s16);
|
||||
q6s32 = vmull_s16(d27s16, d1s16);
|
||||
|
||||
d30s16 = vdup_n_s16((int16_t)cospi_26_64);
|
||||
d31s16 = vdup_n_s16((int16_t)cospi_6_64);
|
||||
|
||||
q4s32 = vmlal_s16(q4s32, d20s16, d1s16);
|
||||
q5s32 = vmlal_s16(q5s32, d21s16, d1s16);
|
||||
q2s32 = vmlsl_s16(q2s32, d20s16, d0s16);
|
||||
q6s32 = vmlsl_s16(q6s32, d21s16, d0s16);
|
||||
|
||||
q0s32 = vmull_s16(d18s16, d30s16);
|
||||
q13s32 = vmull_s16(d19s16, d30s16);
|
||||
|
||||
q0s32 = vmlal_s16(q0s32, d28s16, d31s16);
|
||||
q13s32 = vmlal_s16(q13s32, d29s16, d31s16);
|
||||
|
||||
q10s32 = vmull_s16(d18s16, d31s16);
|
||||
q9s32 = vmull_s16(d19s16, d31s16);
|
||||
|
||||
q10s32 = vmlsl_s16(q10s32, d28s16, d30s16);
|
||||
q9s32 = vmlsl_s16(q9s32, d29s16, d30s16);
|
||||
|
||||
q14s32 = vaddq_s32(q2s32, q10s32);
|
||||
q15s32 = vaddq_s32(q6s32, q9s32);
|
||||
q2s32 = vsubq_s32(q2s32, q10s32);
|
||||
q6s32 = vsubq_s32(q6s32, q9s32);
|
||||
|
||||
d28s16 = vqrshrn_n_s32(q14s32, 14);
|
||||
d29s16 = vqrshrn_n_s32(q15s32, 14);
|
||||
d4s16 = vqrshrn_n_s32(q2s32, 14);
|
||||
d5s16 = vqrshrn_n_s32(q6s32, 14);
|
||||
*q14s16 = vcombine_s16(d28s16, d29s16);
|
||||
|
||||
q9s32 = vaddq_s32(q4s32, q0s32);
|
||||
q10s32 = vaddq_s32(q5s32, q13s32);
|
||||
q4s32 = vsubq_s32(q4s32, q0s32);
|
||||
q5s32 = vsubq_s32(q5s32, q13s32);
|
||||
|
||||
d30s16 = vdup_n_s16((int16_t)cospi_8_64);
|
||||
d31s16 = vdup_n_s16((int16_t)cospi_24_64);
|
||||
|
||||
d18s16 = vqrshrn_n_s32(q9s32, 14);
|
||||
d19s16 = vqrshrn_n_s32(q10s32, 14);
|
||||
d8s16 = vqrshrn_n_s32(q4s32, 14);
|
||||
d9s16 = vqrshrn_n_s32(q5s32, 14);
|
||||
*q9s16 = vcombine_s16(d18s16, d19s16);
|
||||
|
||||
q5s32 = vmull_s16(d2s16, d30s16);
|
||||
q6s32 = vmull_s16(d3s16, d30s16);
|
||||
q7s32 = vmull_s16(d2s16, d31s16);
|
||||
q0s32 = vmull_s16(d3s16, d31s16);
|
||||
|
||||
q5s32 = vmlal_s16(q5s32, d6s16, d31s16);
|
||||
q6s32 = vmlal_s16(q6s32, d7s16, d31s16);
|
||||
q7s32 = vmlsl_s16(q7s32, d6s16, d30s16);
|
||||
q0s32 = vmlsl_s16(q0s32, d7s16, d30s16);
|
||||
|
||||
q1s32 = vmull_s16(d4s16, d30s16);
|
||||
q3s32 = vmull_s16(d5s16, d30s16);
|
||||
q10s32 = vmull_s16(d4s16, d31s16);
|
||||
q2s32 = vmull_s16(d5s16, d31s16);
|
||||
|
||||
q1s32 = vmlsl_s16(q1s32, d8s16, d31s16);
|
||||
q3s32 = vmlsl_s16(q3s32, d9s16, d31s16);
|
||||
q10s32 = vmlal_s16(q10s32, d8s16, d30s16);
|
||||
q2s32 = vmlal_s16(q2s32, d9s16, d30s16);
|
||||
|
||||
*q8s16 = vaddq_s16(*q11s16, *q9s16);
|
||||
*q11s16 = vsubq_s16(*q11s16, *q9s16);
|
||||
q4s16 = vaddq_s16(*q12s16, *q14s16);
|
||||
*q12s16 = vsubq_s16(*q12s16, *q14s16);
|
||||
|
||||
q14s32 = vaddq_s32(q5s32, q1s32);
|
||||
q15s32 = vaddq_s32(q6s32, q3s32);
|
||||
q5s32 = vsubq_s32(q5s32, q1s32);
|
||||
q6s32 = vsubq_s32(q6s32, q3s32);
|
||||
|
||||
d18s16 = vqrshrn_n_s32(q14s32, 14);
|
||||
d19s16 = vqrshrn_n_s32(q15s32, 14);
|
||||
d10s16 = vqrshrn_n_s32(q5s32, 14);
|
||||
d11s16 = vqrshrn_n_s32(q6s32, 14);
|
||||
*q9s16 = vcombine_s16(d18s16, d19s16);
|
||||
|
||||
q1s32 = vaddq_s32(q7s32, q10s32);
|
||||
q3s32 = vaddq_s32(q0s32, q2s32);
|
||||
q7s32 = vsubq_s32(q7s32, q10s32);
|
||||
q0s32 = vsubq_s32(q0s32, q2s32);
|
||||
|
||||
d28s16 = vqrshrn_n_s32(q1s32, 14);
|
||||
d29s16 = vqrshrn_n_s32(q3s32, 14);
|
||||
d14s16 = vqrshrn_n_s32(q7s32, 14);
|
||||
d15s16 = vqrshrn_n_s32(q0s32, 14);
|
||||
*q14s16 = vcombine_s16(d28s16, d29s16);
|
||||
|
||||
d30s16 = vdup_n_s16((int16_t)cospi_16_64);
|
||||
|
||||
d22s16 = vget_low_s16(*q11s16);
|
||||
d23s16 = vget_high_s16(*q11s16);
|
||||
q2s32 = vmull_s16(d22s16, d30s16);
|
||||
q3s32 = vmull_s16(d23s16, d30s16);
|
||||
q13s32 = vmull_s16(d22s16, d30s16);
|
||||
q1s32 = vmull_s16(d23s16, d30s16);
|
||||
|
||||
d24s16 = vget_low_s16(*q12s16);
|
||||
d25s16 = vget_high_s16(*q12s16);
|
||||
q2s32 = vmlal_s16(q2s32, d24s16, d30s16);
|
||||
q3s32 = vmlal_s16(q3s32, d25s16, d30s16);
|
||||
q13s32 = vmlsl_s16(q13s32, d24s16, d30s16);
|
||||
q1s32 = vmlsl_s16(q1s32, d25s16, d30s16);
|
||||
|
||||
d4s16 = vqrshrn_n_s32(q2s32, 14);
|
||||
d5s16 = vqrshrn_n_s32(q3s32, 14);
|
||||
d24s16 = vqrshrn_n_s32(q13s32, 14);
|
||||
d25s16 = vqrshrn_n_s32(q1s32, 14);
|
||||
q2s16 = vcombine_s16(d4s16, d5s16);
|
||||
*q12s16 = vcombine_s16(d24s16, d25s16);
|
||||
|
||||
q13s32 = vmull_s16(d10s16, d30s16);
|
||||
q1s32 = vmull_s16(d11s16, d30s16);
|
||||
q11s32 = vmull_s16(d10s16, d30s16);
|
||||
q0s32 = vmull_s16(d11s16, d30s16);
|
||||
|
||||
q13s32 = vmlal_s16(q13s32, d14s16, d30s16);
|
||||
q1s32 = vmlal_s16(q1s32, d15s16, d30s16);
|
||||
q11s32 = vmlsl_s16(q11s32, d14s16, d30s16);
|
||||
q0s32 = vmlsl_s16(q0s32, d15s16, d30s16);
|
||||
|
||||
d20s16 = vqrshrn_n_s32(q13s32, 14);
|
||||
d21s16 = vqrshrn_n_s32(q1s32, 14);
|
||||
d12s16 = vqrshrn_n_s32(q11s32, 14);
|
||||
d13s16 = vqrshrn_n_s32(q0s32, 14);
|
||||
*q10s16 = vcombine_s16(d20s16, d21s16);
|
||||
q6s16 = vcombine_s16(d12s16, d13s16);
|
||||
|
||||
q5s16 = vdupq_n_s16(0);
|
||||
|
||||
*q9s16 = vsubq_s16(q5s16, *q9s16);
|
||||
*q11s16 = vsubq_s16(q5s16, q2s16);
|
||||
*q13s16 = vsubq_s16(q5s16, q6s16);
|
||||
*q15s16 = vsubq_s16(q5s16, q4s16);
|
||||
return;
|
||||
}
|
||||
|
||||
void av1_iht8x8_64_add_neon(const tran_low_t *input, uint8_t *dest,
|
||||
int dest_stride, const TxfmParam *txfm_param) {
|
||||
int i;
|
||||
uint8_t *d1, *d2;
|
||||
uint8x8_t d0u8, d1u8, d2u8, d3u8;
|
||||
uint64x1_t d0u64, d1u64, d2u64, d3u64;
|
||||
int16x8_t q8s16, q9s16, q10s16, q11s16, q12s16, q13s16, q14s16, q15s16;
|
||||
uint16x8_t q8u16, q9u16, q10u16, q11u16;
|
||||
|
||||
q8s16 = vld1q_s16(input);
|
||||
q9s16 = vld1q_s16(input + 8);
|
||||
q10s16 = vld1q_s16(input + 8 * 2);
|
||||
q11s16 = vld1q_s16(input + 8 * 3);
|
||||
q12s16 = vld1q_s16(input + 8 * 4);
|
||||
q13s16 = vld1q_s16(input + 8 * 5);
|
||||
q14s16 = vld1q_s16(input + 8 * 6);
|
||||
q15s16 = vld1q_s16(input + 8 * 7);
|
||||
|
||||
TRANSPOSE8X8(&q8s16, &q9s16, &q10s16, &q11s16, &q12s16, &q13s16, &q14s16,
|
||||
&q15s16);
|
||||
|
||||
const TX_TYPE tx_type = txfm_param->tx_type;
|
||||
switch (tx_type) {
|
||||
case DCT_DCT: // idct_idct is not supported. Fall back to C
|
||||
av1_iht8x8_64_add_c(input, dest, dest_stride, txfm_param);
|
||||
return;
|
||||
break;
|
||||
case ADST_DCT: // iadst_idct
|
||||
// generate IDCT constants
|
||||
// GENERATE_IDCT_CONSTANTS
|
||||
|
||||
// first transform rows
|
||||
IDCT8x8_1D(&q8s16, &q9s16, &q10s16, &q11s16, &q12s16, &q13s16, &q14s16,
|
||||
&q15s16);
|
||||
|
||||
// transpose the matrix
|
||||
TRANSPOSE8X8(&q8s16, &q9s16, &q10s16, &q11s16, &q12s16, &q13s16, &q14s16,
|
||||
&q15s16);
|
||||
|
||||
// generate IADST constants
|
||||
// GENERATE_IADST_CONSTANTS
|
||||
|
||||
// then transform columns
|
||||
IADST8X8_1D(&q8s16, &q9s16, &q10s16, &q11s16, &q12s16, &q13s16, &q14s16,
|
||||
&q15s16);
|
||||
break;
|
||||
case DCT_ADST: // idct_iadst
|
||||
// generate IADST constants
|
||||
// GENERATE_IADST_CONSTANTS
|
||||
|
||||
// first transform rows
|
||||
IADST8X8_1D(&q8s16, &q9s16, &q10s16, &q11s16, &q12s16, &q13s16, &q14s16,
|
||||
&q15s16);
|
||||
|
||||
// transpose the matrix
|
||||
TRANSPOSE8X8(&q8s16, &q9s16, &q10s16, &q11s16, &q12s16, &q13s16, &q14s16,
|
||||
&q15s16);
|
||||
|
||||
// generate IDCT constants
|
||||
// GENERATE_IDCT_CONSTANTS
|
||||
|
||||
// then transform columns
|
||||
IDCT8x8_1D(&q8s16, &q9s16, &q10s16, &q11s16, &q12s16, &q13s16, &q14s16,
|
||||
&q15s16);
|
||||
break;
|
||||
case ADST_ADST: // iadst_iadst
|
||||
// generate IADST constants
|
||||
// GENERATE_IADST_CONSTANTS
|
||||
|
||||
// first transform rows
|
||||
IADST8X8_1D(&q8s16, &q9s16, &q10s16, &q11s16, &q12s16, &q13s16, &q14s16,
|
||||
&q15s16);
|
||||
|
||||
// transpose the matrix
|
||||
TRANSPOSE8X8(&q8s16, &q9s16, &q10s16, &q11s16, &q12s16, &q13s16, &q14s16,
|
||||
&q15s16);
|
||||
|
||||
// then transform columns
|
||||
IADST8X8_1D(&q8s16, &q9s16, &q10s16, &q11s16, &q12s16, &q13s16, &q14s16,
|
||||
&q15s16);
|
||||
break;
|
||||
default: // iadst_idct
|
||||
assert(0);
|
||||
break;
|
||||
}
|
||||
|
||||
q8s16 = vrshrq_n_s16(q8s16, 5);
|
||||
q9s16 = vrshrq_n_s16(q9s16, 5);
|
||||
q10s16 = vrshrq_n_s16(q10s16, 5);
|
||||
q11s16 = vrshrq_n_s16(q11s16, 5);
|
||||
q12s16 = vrshrq_n_s16(q12s16, 5);
|
||||
q13s16 = vrshrq_n_s16(q13s16, 5);
|
||||
q14s16 = vrshrq_n_s16(q14s16, 5);
|
||||
q15s16 = vrshrq_n_s16(q15s16, 5);
|
||||
|
||||
for (d1 = d2 = dest, i = 0; i < 2; i++) {
|
||||
if (i != 0) {
|
||||
q8s16 = q12s16;
|
||||
q9s16 = q13s16;
|
||||
q10s16 = q14s16;
|
||||
q11s16 = q15s16;
|
||||
}
|
||||
|
||||
d0u64 = vld1_u64((uint64_t *)d1);
|
||||
d1 += dest_stride;
|
||||
d1u64 = vld1_u64((uint64_t *)d1);
|
||||
d1 += dest_stride;
|
||||
d2u64 = vld1_u64((uint64_t *)d1);
|
||||
d1 += dest_stride;
|
||||
d3u64 = vld1_u64((uint64_t *)d1);
|
||||
d1 += dest_stride;
|
||||
|
||||
q8u16 = vaddw_u8(vreinterpretq_u16_s16(q8s16), vreinterpret_u8_u64(d0u64));
|
||||
q9u16 = vaddw_u8(vreinterpretq_u16_s16(q9s16), vreinterpret_u8_u64(d1u64));
|
||||
q10u16 =
|
||||
vaddw_u8(vreinterpretq_u16_s16(q10s16), vreinterpret_u8_u64(d2u64));
|
||||
q11u16 =
|
||||
vaddw_u8(vreinterpretq_u16_s16(q11s16), vreinterpret_u8_u64(d3u64));
|
||||
|
||||
d0u8 = vqmovun_s16(vreinterpretq_s16_u16(q8u16));
|
||||
d1u8 = vqmovun_s16(vreinterpretq_s16_u16(q9u16));
|
||||
d2u8 = vqmovun_s16(vreinterpretq_s16_u16(q10u16));
|
||||
d3u8 = vqmovun_s16(vreinterpretq_s16_u16(q11u16));
|
||||
|
||||
vst1_u64((uint64_t *)d2, vreinterpret_u64_u8(d0u8));
|
||||
d2 += dest_stride;
|
||||
vst1_u64((uint64_t *)d2, vreinterpret_u64_u8(d1u8));
|
||||
d2 += dest_stride;
|
||||
vst1_u64((uint64_t *)d2, vreinterpret_u64_u8(d2u8));
|
||||
d2 += dest_stride;
|
||||
vst1_u64((uint64_t *)d2, vreinterpret_u64_u8(d3u8));
|
||||
d2 += dest_stride;
|
||||
}
|
||||
return;
|
||||
}
|
||||
86
third_party/aom/av1/common/arm/reconinter_neon.c
vendored
Normal file
86
third_party/aom/av1/common/arm/reconinter_neon.c
vendored
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
*
|
||||
* Copyright (c) 2018, 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 <arm_neon.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "aom/aom_integer.h"
|
||||
#include "aom_dsp/blend.h"
|
||||
#include "aom_ports/mem.h"
|
||||
#include "av1/common/arm/mem_neon.h"
|
||||
#include "av1/common/blockd.h"
|
||||
#include "config/av1_rtcd.h"
|
||||
|
||||
void av1_build_compound_diffwtd_mask_d16_neon(
|
||||
uint8_t *mask, DIFFWTD_MASK_TYPE mask_type, const CONV_BUF_TYPE *src0,
|
||||
int src0_stride, const CONV_BUF_TYPE *src1, int src1_stride, int h, int w,
|
||||
ConvolveParams *conv_params, int bd) {
|
||||
assert(h >= 4);
|
||||
assert(w >= 4);
|
||||
assert((mask_type == DIFFWTD_38_INV) || (mask_type == DIFFWTD_38));
|
||||
const int round =
|
||||
2 * FILTER_BITS - conv_params->round_0 - conv_params->round_1 + (bd - 8);
|
||||
uint16x8_t diff_q, tmp0, tmp1;
|
||||
uint8x8_t diff_d, diff_select;
|
||||
const CONV_BUF_TYPE *src0_1, *src1_1;
|
||||
const int16x8_t dup_round = vdupq_n_s16((int16_t)(-round));
|
||||
const uint8x8_t dup_38 = vdup_n_u8(38);
|
||||
const uint8x8_t dup_64 = vdup_n_u8(AOM_BLEND_A64_MAX_ALPHA);
|
||||
if (mask_type == DIFFWTD_38) {
|
||||
diff_select = vdup_n_u8(255);
|
||||
} else {
|
||||
diff_select = vdup_n_u8(0);
|
||||
}
|
||||
if (w >= 8) {
|
||||
for (int i = 0; i < h; ++i) {
|
||||
src0_1 = src0;
|
||||
src1_1 = src1;
|
||||
for (int j = 0; j < w; j += 8) {
|
||||
__builtin_prefetch(src0_1);
|
||||
__builtin_prefetch(src1_1);
|
||||
diff_q = vabdq_u16(vld1q_u16(src0_1), vld1q_u16(src1_1));
|
||||
diff_q = vrshlq_u16(diff_q, dup_round);
|
||||
diff_d = vshrn_n_u16(diff_q, DIFF_FACTOR_LOG2);
|
||||
diff_d = vmin_u8(vadd_u8(diff_d, dup_38), dup_64);
|
||||
diff_d = vbsl_u8(diff_select, diff_d, vsub_u8(dup_64, diff_d));
|
||||
vst1_u8(mask, diff_d);
|
||||
src0_1 += 8;
|
||||
src1_1 += 8;
|
||||
mask += 8;
|
||||
}
|
||||
src0 += src0_stride;
|
||||
src1 += src1_stride;
|
||||
}
|
||||
} else if (w == 4) {
|
||||
for (int i = 0; i < h; i += 2) {
|
||||
src0_1 = src0;
|
||||
src1_1 = src1;
|
||||
__builtin_prefetch(src0_1 + 0 * src0_stride);
|
||||
__builtin_prefetch(src0_1 + 1 * src0_stride);
|
||||
__builtin_prefetch(src1_1 + 0 * src1_stride);
|
||||
__builtin_prefetch(src1_1 + 1 * src1_stride);
|
||||
tmp0 = vcombine_u16(vld1_u16(src0_1 + (0 * src0_stride)),
|
||||
vld1_u16(src0_1 + (1 * src0_stride)));
|
||||
tmp1 = vcombine_u16(vld1_u16(src1_1 + (0 * src1_stride)),
|
||||
vld1_u16(src1_1 + (1 * src1_stride)));
|
||||
diff_q = vabdq_u16(tmp0, tmp1);
|
||||
diff_q = vrshlq_u16(diff_q, dup_round);
|
||||
diff_d = vshrn_n_u16(diff_q, DIFF_FACTOR_LOG2);
|
||||
diff_d = vmin_u8(vadd_u8(diff_d, dup_38), dup_64);
|
||||
diff_d = vbsl_u8(diff_select, diff_d, vsub_u8(dup_64, diff_d));
|
||||
vst1_u8(mask, diff_d);
|
||||
src0 += src0_stride * 2;
|
||||
src1 += src1_stride * 2;
|
||||
mask += w * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
422
third_party/aom/av1/common/arm/transpose_neon.h
vendored
Normal file
422
third_party/aom/av1/common/arm/transpose_neon.h
vendored
Normal file
|
|
@ -0,0 +1,422 @@
|
|||
/*
|
||||
* Copyright (c) 2018, Alliance for Open Media. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#ifndef AV1_COMMON_ARM_TRANSPOSE_NEON_H_
|
||||
#define AV1_COMMON_ARM_TRANSPOSE_NEON_H_
|
||||
|
||||
#include <arm_neon.h>
|
||||
|
||||
static INLINE void transpose_u8_8x8(uint8x8_t *a0, uint8x8_t *a1, uint8x8_t *a2,
|
||||
uint8x8_t *a3, uint8x8_t *a4, uint8x8_t *a5,
|
||||
uint8x8_t *a6, uint8x8_t *a7) {
|
||||
// Swap 8 bit elements. Goes from:
|
||||
// a0: 00 01 02 03 04 05 06 07
|
||||
// a1: 10 11 12 13 14 15 16 17
|
||||
// a2: 20 21 22 23 24 25 26 27
|
||||
// a3: 30 31 32 33 34 35 36 37
|
||||
// a4: 40 41 42 43 44 45 46 47
|
||||
// a5: 50 51 52 53 54 55 56 57
|
||||
// a6: 60 61 62 63 64 65 66 67
|
||||
// a7: 70 71 72 73 74 75 76 77
|
||||
// to:
|
||||
// b0.val[0]: 00 10 02 12 04 14 06 16 40 50 42 52 44 54 46 56
|
||||
// b0.val[1]: 01 11 03 13 05 15 07 17 41 51 43 53 45 55 47 57
|
||||
// b1.val[0]: 20 30 22 32 24 34 26 36 60 70 62 72 64 74 66 76
|
||||
// b1.val[1]: 21 31 23 33 25 35 27 37 61 71 63 73 65 75 67 77
|
||||
|
||||
const uint8x16x2_t b0 =
|
||||
vtrnq_u8(vcombine_u8(*a0, *a4), vcombine_u8(*a1, *a5));
|
||||
const uint8x16x2_t b1 =
|
||||
vtrnq_u8(vcombine_u8(*a2, *a6), vcombine_u8(*a3, *a7));
|
||||
|
||||
// Swap 16 bit elements resulting in:
|
||||
// c0.val[0]: 00 10 20 30 04 14 24 34 40 50 60 70 44 54 64 74
|
||||
// c0.val[1]: 02 12 22 32 06 16 26 36 42 52 62 72 46 56 66 76
|
||||
// c1.val[0]: 01 11 21 31 05 15 25 35 41 51 61 71 45 55 65 75
|
||||
// c1.val[1]: 03 13 23 33 07 17 27 37 43 53 63 73 47 57 67 77
|
||||
|
||||
const uint16x8x2_t c0 = vtrnq_u16(vreinterpretq_u16_u8(b0.val[0]),
|
||||
vreinterpretq_u16_u8(b1.val[0]));
|
||||
const uint16x8x2_t c1 = vtrnq_u16(vreinterpretq_u16_u8(b0.val[1]),
|
||||
vreinterpretq_u16_u8(b1.val[1]));
|
||||
|
||||
// Unzip 32 bit elements resulting in:
|
||||
// d0.val[0]: 00 10 20 30 40 50 60 70 01 11 21 31 41 51 61 71
|
||||
// d0.val[1]: 04 14 24 34 44 54 64 74 05 15 25 35 45 55 65 75
|
||||
// d1.val[0]: 02 12 22 32 42 52 62 72 03 13 23 33 43 53 63 73
|
||||
// d1.val[1]: 06 16 26 36 46 56 66 76 07 17 27 37 47 57 67 77
|
||||
const uint32x4x2_t d0 = vuzpq_u32(vreinterpretq_u32_u16(c0.val[0]),
|
||||
vreinterpretq_u32_u16(c1.val[0]));
|
||||
const uint32x4x2_t d1 = vuzpq_u32(vreinterpretq_u32_u16(c0.val[1]),
|
||||
vreinterpretq_u32_u16(c1.val[1]));
|
||||
|
||||
*a0 = vreinterpret_u8_u32(vget_low_u32(d0.val[0]));
|
||||
*a1 = vreinterpret_u8_u32(vget_high_u32(d0.val[0]));
|
||||
*a2 = vreinterpret_u8_u32(vget_low_u32(d1.val[0]));
|
||||
*a3 = vreinterpret_u8_u32(vget_high_u32(d1.val[0]));
|
||||
*a4 = vreinterpret_u8_u32(vget_low_u32(d0.val[1]));
|
||||
*a5 = vreinterpret_u8_u32(vget_high_u32(d0.val[1]));
|
||||
*a6 = vreinterpret_u8_u32(vget_low_u32(d1.val[1]));
|
||||
*a7 = vreinterpret_u8_u32(vget_high_u32(d1.val[1]));
|
||||
}
|
||||
|
||||
static INLINE void transpose_u8_8x4(uint8x8_t *a0, uint8x8_t *a1, uint8x8_t *a2,
|
||||
uint8x8_t *a3) {
|
||||
// Swap 8 bit elements. Goes from:
|
||||
// a0: 00 01 02 03 04 05 06 07
|
||||
// a1: 10 11 12 13 14 15 16 17
|
||||
// a2: 20 21 22 23 24 25 26 27
|
||||
// a3: 30 31 32 33 34 35 36 37
|
||||
// to:
|
||||
// b0.val[0]: 00 10 02 12 04 14 06 16
|
||||
// b0.val[1]: 01 11 03 13 05 15 07 17
|
||||
// b1.val[0]: 20 30 22 32 24 34 26 36
|
||||
// b1.val[1]: 21 31 23 33 25 35 27 37
|
||||
|
||||
const uint8x8x2_t b0 = vtrn_u8(*a0, *a1);
|
||||
const uint8x8x2_t b1 = vtrn_u8(*a2, *a3);
|
||||
|
||||
// Swap 16 bit elements resulting in:
|
||||
// c0.val[0]: 00 10 20 30 04 14 24 34
|
||||
// c0.val[1]: 02 12 22 32 06 16 26 36
|
||||
// c1.val[0]: 01 11 21 31 05 15 25 35
|
||||
// c1.val[1]: 03 13 23 33 07 17 27 37
|
||||
|
||||
const uint16x4x2_t c0 =
|
||||
vtrn_u16(vreinterpret_u16_u8(b0.val[0]), vreinterpret_u16_u8(b1.val[0]));
|
||||
const uint16x4x2_t c1 =
|
||||
vtrn_u16(vreinterpret_u16_u8(b0.val[1]), vreinterpret_u16_u8(b1.val[1]));
|
||||
|
||||
*a0 = vreinterpret_u8_u16(c0.val[0]);
|
||||
*a1 = vreinterpret_u8_u16(c1.val[0]);
|
||||
*a2 = vreinterpret_u8_u16(c0.val[1]);
|
||||
*a3 = vreinterpret_u8_u16(c1.val[1]);
|
||||
}
|
||||
|
||||
static INLINE void transpose_u8_4x4(uint8x8_t *a0, uint8x8_t *a1) {
|
||||
// Swap 16 bit elements. Goes from:
|
||||
// a0: 00 01 02 03 10 11 12 13
|
||||
// a1: 20 21 22 23 30 31 32 33
|
||||
// to:
|
||||
// b0.val[0]: 00 01 20 21 10 11 30 31
|
||||
// b0.val[1]: 02 03 22 23 12 13 32 33
|
||||
|
||||
const uint16x4x2_t b0 =
|
||||
vtrn_u16(vreinterpret_u16_u8(*a0), vreinterpret_u16_u8(*a1));
|
||||
|
||||
// Swap 32 bit elements resulting in:
|
||||
// c0.val[0]: 00 01 20 21 02 03 22 23
|
||||
// c0.val[1]: 10 11 30 31 12 13 32 33
|
||||
|
||||
const uint32x2x2_t c0 = vtrn_u32(vreinterpret_u32_u16(b0.val[0]),
|
||||
vreinterpret_u32_u16(b0.val[1]));
|
||||
|
||||
// Swap 8 bit elements resulting in:
|
||||
// d0.val[0]: 00 10 20 30 02 12 22 32
|
||||
// d0.val[1]: 01 11 21 31 03 13 23 33
|
||||
|
||||
const uint8x8x2_t d0 =
|
||||
vtrn_u8(vreinterpret_u8_u32(c0.val[0]), vreinterpret_u8_u32(c0.val[1]));
|
||||
|
||||
*a0 = d0.val[0];
|
||||
*a1 = d0.val[1];
|
||||
}
|
||||
|
||||
static INLINE void transpose_u8_4x8(uint8x8_t *a0, uint8x8_t *a1, uint8x8_t *a2,
|
||||
uint8x8_t *a3, const uint8x8_t a4,
|
||||
const uint8x8_t a5, const uint8x8_t a6,
|
||||
const uint8x8_t a7) {
|
||||
// Swap 32 bit elements. Goes from:
|
||||
// a0: 00 01 02 03 XX XX XX XX
|
||||
// a1: 10 11 12 13 XX XX XX XX
|
||||
// a2: 20 21 22 23 XX XX XX XX
|
||||
// a3; 30 31 32 33 XX XX XX XX
|
||||
// a4: 40 41 42 43 XX XX XX XX
|
||||
// a5: 50 51 52 53 XX XX XX XX
|
||||
// a6: 60 61 62 63 XX XX XX XX
|
||||
// a7: 70 71 72 73 XX XX XX XX
|
||||
// to:
|
||||
// b0.val[0]: 00 01 02 03 40 41 42 43
|
||||
// b1.val[0]: 10 11 12 13 50 51 52 53
|
||||
// b2.val[0]: 20 21 22 23 60 61 62 63
|
||||
// b3.val[0]: 30 31 32 33 70 71 72 73
|
||||
|
||||
const uint32x2x2_t b0 =
|
||||
vtrn_u32(vreinterpret_u32_u8(*a0), vreinterpret_u32_u8(a4));
|
||||
const uint32x2x2_t b1 =
|
||||
vtrn_u32(vreinterpret_u32_u8(*a1), vreinterpret_u32_u8(a5));
|
||||
const uint32x2x2_t b2 =
|
||||
vtrn_u32(vreinterpret_u32_u8(*a2), vreinterpret_u32_u8(a6));
|
||||
const uint32x2x2_t b3 =
|
||||
vtrn_u32(vreinterpret_u32_u8(*a3), vreinterpret_u32_u8(a7));
|
||||
|
||||
// Swap 16 bit elements resulting in:
|
||||
// c0.val[0]: 00 01 20 21 40 41 60 61
|
||||
// c0.val[1]: 02 03 22 23 42 43 62 63
|
||||
// c1.val[0]: 10 11 30 31 50 51 70 71
|
||||
// c1.val[1]: 12 13 32 33 52 53 72 73
|
||||
|
||||
const uint16x4x2_t c0 = vtrn_u16(vreinterpret_u16_u32(b0.val[0]),
|
||||
vreinterpret_u16_u32(b2.val[0]));
|
||||
const uint16x4x2_t c1 = vtrn_u16(vreinterpret_u16_u32(b1.val[0]),
|
||||
vreinterpret_u16_u32(b3.val[0]));
|
||||
|
||||
// Swap 8 bit elements resulting in:
|
||||
// d0.val[0]: 00 10 20 30 40 50 60 70
|
||||
// d0.val[1]: 01 11 21 31 41 51 61 71
|
||||
// d1.val[0]: 02 12 22 32 42 52 62 72
|
||||
// d1.val[1]: 03 13 23 33 43 53 63 73
|
||||
|
||||
const uint8x8x2_t d0 =
|
||||
vtrn_u8(vreinterpret_u8_u16(c0.val[0]), vreinterpret_u8_u16(c1.val[0]));
|
||||
const uint8x8x2_t d1 =
|
||||
vtrn_u8(vreinterpret_u8_u16(c0.val[1]), vreinterpret_u8_u16(c1.val[1]));
|
||||
|
||||
*a0 = d0.val[0];
|
||||
*a1 = d0.val[1];
|
||||
*a2 = d1.val[0];
|
||||
*a3 = d1.val[1];
|
||||
}
|
||||
|
||||
static INLINE void transpose_u16_4x8(uint16x4_t *a0, uint16x4_t *a1,
|
||||
uint16x4_t *a2, uint16x4_t *a3,
|
||||
uint16x4_t *a4, uint16x4_t *a5,
|
||||
uint16x4_t *a6, uint16x4_t *a7,
|
||||
uint16x8_t *o0, uint16x8_t *o1,
|
||||
uint16x8_t *o2, uint16x8_t *o3) {
|
||||
// Swap 16 bit elements. Goes from:
|
||||
// a0: 00 01 02 03
|
||||
// a1: 10 11 12 13
|
||||
// a2: 20 21 22 23
|
||||
// a3: 30 31 32 33
|
||||
// a4: 40 41 42 43
|
||||
// a5: 50 51 52 53
|
||||
// a6: 60 61 62 63
|
||||
// a7: 70 71 72 73
|
||||
// to:
|
||||
// b0.val[0]: 00 10 02 12
|
||||
// b0.val[1]: 01 11 03 13
|
||||
// b1.val[0]: 20 30 22 32
|
||||
// b1.val[1]: 21 31 23 33
|
||||
// b2.val[0]: 40 50 42 52
|
||||
// b2.val[1]: 41 51 43 53
|
||||
// b3.val[0]: 60 70 62 72
|
||||
// b3.val[1]: 61 71 63 73
|
||||
|
||||
uint16x4x2_t b0 = vtrn_u16(*a0, *a1);
|
||||
uint16x4x2_t b1 = vtrn_u16(*a2, *a3);
|
||||
uint16x4x2_t b2 = vtrn_u16(*a4, *a5);
|
||||
uint16x4x2_t b3 = vtrn_u16(*a6, *a7);
|
||||
|
||||
// Swap 32 bit elements resulting in:
|
||||
// c0.val[0]: 00 10 20 30
|
||||
// c0.val[1]: 02 12 22 32
|
||||
// c1.val[0]: 01 11 21 31
|
||||
// c1.val[1]: 03 13 23 33
|
||||
// c2.val[0]: 40 50 60 70
|
||||
// c2.val[1]: 42 52 62 72
|
||||
// c3.val[0]: 41 51 61 71
|
||||
// c3.val[1]: 43 53 63 73
|
||||
|
||||
uint32x2x2_t c0 = vtrn_u32(vreinterpret_u32_u16(b0.val[0]),
|
||||
vreinterpret_u32_u16(b1.val[0]));
|
||||
uint32x2x2_t c1 = vtrn_u32(vreinterpret_u32_u16(b0.val[1]),
|
||||
vreinterpret_u32_u16(b1.val[1]));
|
||||
uint32x2x2_t c2 = vtrn_u32(vreinterpret_u32_u16(b2.val[0]),
|
||||
vreinterpret_u32_u16(b3.val[0]));
|
||||
uint32x2x2_t c3 = vtrn_u32(vreinterpret_u32_u16(b2.val[1]),
|
||||
vreinterpret_u32_u16(b3.val[1]));
|
||||
|
||||
// Swap 64 bit elements resulting in:
|
||||
// o0: 00 10 20 30 40 50 60 70
|
||||
// o1: 01 11 21 31 41 51 61 71
|
||||
// o2: 02 12 22 32 42 52 62 72
|
||||
// o3: 03 13 23 33 43 53 63 73
|
||||
|
||||
*o0 = vcombine_u16(vreinterpret_u16_u32(c0.val[0]),
|
||||
vreinterpret_u16_u32(c2.val[0]));
|
||||
*o1 = vcombine_u16(vreinterpret_u16_u32(c1.val[0]),
|
||||
vreinterpret_u16_u32(c3.val[0]));
|
||||
*o2 = vcombine_u16(vreinterpret_u16_u32(c0.val[1]),
|
||||
vreinterpret_u16_u32(c2.val[1]));
|
||||
*o3 = vcombine_u16(vreinterpret_u16_u32(c1.val[1]),
|
||||
vreinterpret_u16_u32(c3.val[1]));
|
||||
}
|
||||
|
||||
static INLINE void transpose_u16_8x8(uint16x8_t *a0, uint16x8_t *a1,
|
||||
uint16x8_t *a2, uint16x8_t *a3,
|
||||
uint16x8_t *a4, uint16x8_t *a5,
|
||||
uint16x8_t *a6, uint16x8_t *a7) {
|
||||
// Swap 16 bit elements. Goes from:
|
||||
// a0: 00 01 02 03 04 05 06 07
|
||||
// a1: 10 11 12 13 14 15 16 17
|
||||
// a2: 20 21 22 23 24 25 26 27
|
||||
// a3: 30 31 32 33 34 35 36 37
|
||||
// a4: 40 41 42 43 44 45 46 47
|
||||
// a5: 50 51 52 53 54 55 56 57
|
||||
// a6: 60 61 62 63 64 65 66 67
|
||||
// a7: 70 71 72 73 74 75 76 77
|
||||
// to:
|
||||
// b0.val[0]: 00 10 02 12 04 14 06 16
|
||||
// b0.val[1]: 01 11 03 13 05 15 07 17
|
||||
// b1.val[0]: 20 30 22 32 24 34 26 36
|
||||
// b1.val[1]: 21 31 23 33 25 35 27 37
|
||||
// b2.val[0]: 40 50 42 52 44 54 46 56
|
||||
// b2.val[1]: 41 51 43 53 45 55 47 57
|
||||
// b3.val[0]: 60 70 62 72 64 74 66 76
|
||||
// b3.val[1]: 61 71 63 73 65 75 67 77
|
||||
|
||||
const uint16x8x2_t b0 = vtrnq_u16(*a0, *a1);
|
||||
const uint16x8x2_t b1 = vtrnq_u16(*a2, *a3);
|
||||
const uint16x8x2_t b2 = vtrnq_u16(*a4, *a5);
|
||||
const uint16x8x2_t b3 = vtrnq_u16(*a6, *a7);
|
||||
|
||||
// Swap 32 bit elements resulting in:
|
||||
// c0.val[0]: 00 10 20 30 04 14 24 34
|
||||
// c0.val[1]: 02 12 22 32 06 16 26 36
|
||||
// c1.val[0]: 01 11 21 31 05 15 25 35
|
||||
// c1.val[1]: 03 13 23 33 07 17 27 37
|
||||
// c2.val[0]: 40 50 60 70 44 54 64 74
|
||||
// c2.val[1]: 42 52 62 72 46 56 66 76
|
||||
// c3.val[0]: 41 51 61 71 45 55 65 75
|
||||
// c3.val[1]: 43 53 63 73 47 57 67 77
|
||||
|
||||
const uint32x4x2_t c0 = vtrnq_u32(vreinterpretq_u32_u16(b0.val[0]),
|
||||
vreinterpretq_u32_u16(b1.val[0]));
|
||||
const uint32x4x2_t c1 = vtrnq_u32(vreinterpretq_u32_u16(b0.val[1]),
|
||||
vreinterpretq_u32_u16(b1.val[1]));
|
||||
const uint32x4x2_t c2 = vtrnq_u32(vreinterpretq_u32_u16(b2.val[0]),
|
||||
vreinterpretq_u32_u16(b3.val[0]));
|
||||
const uint32x4x2_t c3 = vtrnq_u32(vreinterpretq_u32_u16(b2.val[1]),
|
||||
vreinterpretq_u32_u16(b3.val[1]));
|
||||
|
||||
*a0 = vcombine_u16(vget_low_u16(vreinterpretq_u16_u32(c0.val[0])),
|
||||
vget_low_u16(vreinterpretq_u16_u32(c2.val[0])));
|
||||
*a4 = vcombine_u16(vget_high_u16(vreinterpretq_u16_u32(c0.val[0])),
|
||||
vget_high_u16(vreinterpretq_u16_u32(c2.val[0])));
|
||||
|
||||
*a2 = vcombine_u16(vget_low_u16(vreinterpretq_u16_u32(c0.val[1])),
|
||||
vget_low_u16(vreinterpretq_u16_u32(c2.val[1])));
|
||||
*a6 = vcombine_u16(vget_high_u16(vreinterpretq_u16_u32(c0.val[1])),
|
||||
vget_high_u16(vreinterpretq_u16_u32(c2.val[1])));
|
||||
|
||||
*a1 = vcombine_u16(vget_low_u16(vreinterpretq_u16_u32(c1.val[0])),
|
||||
vget_low_u16(vreinterpretq_u16_u32(c3.val[0])));
|
||||
*a5 = vcombine_u16(vget_high_u16(vreinterpretq_u16_u32(c1.val[0])),
|
||||
vget_high_u16(vreinterpretq_u16_u32(c3.val[0])));
|
||||
|
||||
*a3 = vcombine_u16(vget_low_u16(vreinterpretq_u16_u32(c1.val[1])),
|
||||
vget_low_u16(vreinterpretq_u16_u32(c3.val[1])));
|
||||
*a7 = vcombine_u16(vget_high_u16(vreinterpretq_u16_u32(c1.val[1])),
|
||||
vget_high_u16(vreinterpretq_u16_u32(c3.val[1])));
|
||||
}
|
||||
|
||||
static INLINE void transpose_s16_8x8(int16x8_t *a0, int16x8_t *a1,
|
||||
int16x8_t *a2, int16x8_t *a3,
|
||||
int16x8_t *a4, int16x8_t *a5,
|
||||
int16x8_t *a6, int16x8_t *a7) {
|
||||
// Swap 16 bit elements. Goes from:
|
||||
// a0: 00 01 02 03 04 05 06 07
|
||||
// a1: 10 11 12 13 14 15 16 17
|
||||
// a2: 20 21 22 23 24 25 26 27
|
||||
// a3: 30 31 32 33 34 35 36 37
|
||||
// a4: 40 41 42 43 44 45 46 47
|
||||
// a5: 50 51 52 53 54 55 56 57
|
||||
// a6: 60 61 62 63 64 65 66 67
|
||||
// a7: 70 71 72 73 74 75 76 77
|
||||
// to:
|
||||
// b0.val[0]: 00 10 02 12 04 14 06 16
|
||||
// b0.val[1]: 01 11 03 13 05 15 07 17
|
||||
// b1.val[0]: 20 30 22 32 24 34 26 36
|
||||
// b1.val[1]: 21 31 23 33 25 35 27 37
|
||||
// b2.val[0]: 40 50 42 52 44 54 46 56
|
||||
// b2.val[1]: 41 51 43 53 45 55 47 57
|
||||
// b3.val[0]: 60 70 62 72 64 74 66 76
|
||||
// b3.val[1]: 61 71 63 73 65 75 67 77
|
||||
|
||||
const int16x8x2_t b0 = vtrnq_s16(*a0, *a1);
|
||||
const int16x8x2_t b1 = vtrnq_s16(*a2, *a3);
|
||||
const int16x8x2_t b2 = vtrnq_s16(*a4, *a5);
|
||||
const int16x8x2_t b3 = vtrnq_s16(*a6, *a7);
|
||||
|
||||
// Swap 32 bit elements resulting in:
|
||||
// c0.val[0]: 00 10 20 30 04 14 24 34
|
||||
// c0.val[1]: 02 12 22 32 06 16 26 36
|
||||
// c1.val[0]: 01 11 21 31 05 15 25 35
|
||||
// c1.val[1]: 03 13 23 33 07 17 27 37
|
||||
// c2.val[0]: 40 50 60 70 44 54 64 74
|
||||
// c2.val[1]: 42 52 62 72 46 56 66 76
|
||||
// c3.val[0]: 41 51 61 71 45 55 65 75
|
||||
// c3.val[1]: 43 53 63 73 47 57 67 77
|
||||
|
||||
const int32x4x2_t c0 = vtrnq_s32(vreinterpretq_s32_s16(b0.val[0]),
|
||||
vreinterpretq_s32_s16(b1.val[0]));
|
||||
const int32x4x2_t c1 = vtrnq_s32(vreinterpretq_s32_s16(b0.val[1]),
|
||||
vreinterpretq_s32_s16(b1.val[1]));
|
||||
const int32x4x2_t c2 = vtrnq_s32(vreinterpretq_s32_s16(b2.val[0]),
|
||||
vreinterpretq_s32_s16(b3.val[0]));
|
||||
const int32x4x2_t c3 = vtrnq_s32(vreinterpretq_s32_s16(b2.val[1]),
|
||||
vreinterpretq_s32_s16(b3.val[1]));
|
||||
|
||||
*a0 = vcombine_s16(vget_low_s16(vreinterpretq_s16_s32(c0.val[0])),
|
||||
vget_low_s16(vreinterpretq_s16_s32(c2.val[0])));
|
||||
*a4 = vcombine_s16(vget_high_s16(vreinterpretq_s16_s32(c0.val[0])),
|
||||
vget_high_s16(vreinterpretq_s16_s32(c2.val[0])));
|
||||
|
||||
*a2 = vcombine_s16(vget_low_s16(vreinterpretq_s16_s32(c0.val[1])),
|
||||
vget_low_s16(vreinterpretq_s16_s32(c2.val[1])));
|
||||
*a6 = vcombine_s16(vget_high_s16(vreinterpretq_s16_s32(c0.val[1])),
|
||||
vget_high_s16(vreinterpretq_s16_s32(c2.val[1])));
|
||||
|
||||
*a1 = vcombine_s16(vget_low_s16(vreinterpretq_s16_s32(c1.val[0])),
|
||||
vget_low_s16(vreinterpretq_s16_s32(c3.val[0])));
|
||||
*a5 = vcombine_s16(vget_high_s16(vreinterpretq_s16_s32(c1.val[0])),
|
||||
vget_high_s16(vreinterpretq_s16_s32(c3.val[0])));
|
||||
|
||||
*a3 = vcombine_s16(vget_low_s16(vreinterpretq_s16_s32(c1.val[1])),
|
||||
vget_low_s16(vreinterpretq_s16_s32(c3.val[1])));
|
||||
*a7 = vcombine_s16(vget_high_s16(vreinterpretq_s16_s32(c1.val[1])),
|
||||
vget_high_s16(vreinterpretq_s16_s32(c3.val[1])));
|
||||
}
|
||||
|
||||
static INLINE void transpose_s16_4x4d(int16x4_t *a0, int16x4_t *a1,
|
||||
int16x4_t *a2, int16x4_t *a3) {
|
||||
// Swap 16 bit elements. Goes from:
|
||||
// a0: 00 01 02 03
|
||||
// a1: 10 11 12 13
|
||||
// a2: 20 21 22 23
|
||||
// a3: 30 31 32 33
|
||||
// to:
|
||||
// b0.val[0]: 00 10 02 12
|
||||
// b0.val[1]: 01 11 03 13
|
||||
// b1.val[0]: 20 30 22 32
|
||||
// b1.val[1]: 21 31 23 33
|
||||
|
||||
const int16x4x2_t b0 = vtrn_s16(*a0, *a1);
|
||||
const int16x4x2_t b1 = vtrn_s16(*a2, *a3);
|
||||
|
||||
// Swap 32 bit elements resulting in:
|
||||
// c0.val[0]: 00 10 20 30
|
||||
// c0.val[1]: 02 12 22 32
|
||||
// c1.val[0]: 01 11 21 31
|
||||
// c1.val[1]: 03 13 23 33
|
||||
|
||||
const int32x2x2_t c0 = vtrn_s32(vreinterpret_s32_s16(b0.val[0]),
|
||||
vreinterpret_s32_s16(b1.val[0]));
|
||||
const int32x2x2_t c1 = vtrn_s32(vreinterpret_s32_s16(b0.val[1]),
|
||||
vreinterpret_s32_s16(b1.val[1]));
|
||||
|
||||
*a0 = vreinterpret_s16_s32(c0.val[0]);
|
||||
*a1 = vreinterpret_s16_s32(c1.val[0]);
|
||||
*a2 = vreinterpret_s16_s32(c0.val[1]);
|
||||
*a3 = vreinterpret_s16_s32(c1.val[1]);
|
||||
}
|
||||
|
||||
#endif // AV1_COMMON_ARM_TRANSPOSE_NEON_H_
|
||||
401
third_party/aom/av1/common/arm/wiener_convolve_neon.c
vendored
Normal file
401
third_party/aom/av1/common/arm/wiener_convolve_neon.c
vendored
Normal file
|
|
@ -0,0 +1,401 @@
|
|||
/*
|
||||
* Copyright (c) 2018, 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 <arm_neon.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "config/aom_config.h"
|
||||
#include "config/av1_rtcd.h"
|
||||
|
||||
#include "aom_dsp/txfm_common.h"
|
||||
#include "aom_ports/mem.h"
|
||||
#include "av1/common/common.h"
|
||||
#include "av1/common/arm/convolve_neon.h"
|
||||
#include "av1/common/arm/mem_neon.h"
|
||||
#include "av1/common/arm/transpose_neon.h"
|
||||
|
||||
/* Wiener filter 2D
|
||||
Apply horizontal filter and store in a temporary buffer. When applying
|
||||
vertical filter, overwrite the original pixel values.
|
||||
*/
|
||||
|
||||
void av1_wiener_convolve_add_src_neon(const uint8_t *src, ptrdiff_t src_stride,
|
||||
uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const int16_t *filter_x, int x_step_q4,
|
||||
const int16_t *filter_y, int y_step_q4,
|
||||
int w, int h,
|
||||
const ConvolveParams *conv_params) {
|
||||
uint16_t *d_tmp;
|
||||
uint8_t *d;
|
||||
const uint8_t *src_ptr, *s_tmp;
|
||||
uint16_t *dst_ptr;
|
||||
(void)x_step_q4;
|
||||
(void)y_step_q4;
|
||||
|
||||
int width, height;
|
||||
const int bd = 8;
|
||||
const int intermediate_height = h + SUBPEL_TAPS - 1;
|
||||
const int center_tap = ((SUBPEL_TAPS - 1) / 2);
|
||||
int16_t filter_x_tmp[7], filter_y_tmp[7];
|
||||
|
||||
DECLARE_ALIGNED(16, uint16_t,
|
||||
temp[(MAX_SB_SIZE + HORIZ_EXTRA_ROWS) * MAX_SB_SIZE]);
|
||||
|
||||
assert(x_step_q4 == 16 && y_step_q4 == 16);
|
||||
assert(!(w % 8));
|
||||
|
||||
assert(w <= MAX_SB_SIZE);
|
||||
assert(h <= MAX_SB_SIZE);
|
||||
|
||||
assert(filter_x[7] == 0);
|
||||
assert(filter_y[7] == 0);
|
||||
|
||||
/* assumption of horizontal filtering output will not exceed 15 bit.
|
||||
((bd) + 1 + FILTER_BITS - conv_params->round_0) <= 15
|
||||
16 - conv_params->round_0 <= 15 -- (conv_params->round_0) >= 1
|
||||
*/
|
||||
assert((conv_params->round_0) >= 1);
|
||||
|
||||
memcpy(&filter_x_tmp[0], filter_x, sizeof(*filter_x) * FILTER_BITS);
|
||||
memcpy(&filter_y_tmp[0], filter_y, sizeof(*filter_y) * FILTER_BITS);
|
||||
|
||||
filter_x_tmp[3] += (1 << FILTER_BITS);
|
||||
filter_y_tmp[3] += (1 << FILTER_BITS);
|
||||
|
||||
s_tmp = src - center_tap * src_stride - center_tap;
|
||||
dst_ptr = temp;
|
||||
src_ptr = s_tmp;
|
||||
height = intermediate_height;
|
||||
|
||||
/* if height is a multiple of 8 */
|
||||
if (!(h & 7)) {
|
||||
int16x8_t res0, res1, res2, res3;
|
||||
uint16x8_t res4, res5, res6, res7, res8, res9, res10, res11;
|
||||
uint8x8_t t0, t1, t2, t3, t4, t5, t6, t7;
|
||||
uint8x8_t t8, t9, t10, t11, t12, t13, t14;
|
||||
|
||||
do {
|
||||
const uint8_t *s;
|
||||
|
||||
__builtin_prefetch(src_ptr + 0 * src_stride);
|
||||
__builtin_prefetch(src_ptr + 1 * src_stride);
|
||||
__builtin_prefetch(src_ptr + 2 * src_stride);
|
||||
__builtin_prefetch(src_ptr + 3 * src_stride);
|
||||
__builtin_prefetch(src_ptr + 4 * src_stride);
|
||||
__builtin_prefetch(src_ptr + 5 * src_stride);
|
||||
__builtin_prefetch(src_ptr + 6 * src_stride);
|
||||
__builtin_prefetch(src_ptr + 7 * src_stride);
|
||||
|
||||
load_u8_8x8(src_ptr, src_stride, &t0, &t1, &t2, &t3, &t4, &t5, &t6, &t7);
|
||||
transpose_u8_8x8(&t0, &t1, &t2, &t3, &t4, &t5, &t6, &t7);
|
||||
|
||||
s = src_ptr + 7;
|
||||
d_tmp = dst_ptr;
|
||||
width = w;
|
||||
|
||||
__builtin_prefetch(dst_ptr + 0 * dst_stride);
|
||||
__builtin_prefetch(dst_ptr + 1 * dst_stride);
|
||||
__builtin_prefetch(dst_ptr + 2 * dst_stride);
|
||||
__builtin_prefetch(dst_ptr + 3 * dst_stride);
|
||||
__builtin_prefetch(dst_ptr + 4 * dst_stride);
|
||||
__builtin_prefetch(dst_ptr + 5 * dst_stride);
|
||||
__builtin_prefetch(dst_ptr + 6 * dst_stride);
|
||||
__builtin_prefetch(dst_ptr + 7 * dst_stride);
|
||||
|
||||
do {
|
||||
load_u8_8x8(s, src_stride, &t7, &t8, &t9, &t10, &t11, &t12, &t13, &t14);
|
||||
transpose_u8_8x8(&t7, &t8, &t9, &t10, &t11, &t12, &t13, &t14);
|
||||
|
||||
res0 = vreinterpretq_s16_u16(vaddl_u8(t0, t6));
|
||||
res1 = vreinterpretq_s16_u16(vaddl_u8(t1, t5));
|
||||
res2 = vreinterpretq_s16_u16(vaddl_u8(t2, t4));
|
||||
res3 = vreinterpretq_s16_u16(vmovl_u8(t3));
|
||||
res4 = wiener_convolve8_horiz_8x8(res0, res1, res2, res3, filter_x_tmp,
|
||||
bd, conv_params->round_0);
|
||||
|
||||
res0 = vreinterpretq_s16_u16(vaddl_u8(t1, t7));
|
||||
res1 = vreinterpretq_s16_u16(vaddl_u8(t2, t6));
|
||||
res2 = vreinterpretq_s16_u16(vaddl_u8(t3, t5));
|
||||
res3 = vreinterpretq_s16_u16(vmovl_u8(t4));
|
||||
res5 = wiener_convolve8_horiz_8x8(res0, res1, res2, res3, filter_x_tmp,
|
||||
bd, conv_params->round_0);
|
||||
|
||||
res0 = vreinterpretq_s16_u16(vaddl_u8(t2, t8));
|
||||
res1 = vreinterpretq_s16_u16(vaddl_u8(t3, t7));
|
||||
res2 = vreinterpretq_s16_u16(vaddl_u8(t4, t6));
|
||||
res3 = vreinterpretq_s16_u16(vmovl_u8(t5));
|
||||
res6 = wiener_convolve8_horiz_8x8(res0, res1, res2, res3, filter_x_tmp,
|
||||
bd, conv_params->round_0);
|
||||
|
||||
res0 = vreinterpretq_s16_u16(vaddl_u8(t3, t9));
|
||||
res1 = vreinterpretq_s16_u16(vaddl_u8(t4, t8));
|
||||
res2 = vreinterpretq_s16_u16(vaddl_u8(t5, t7));
|
||||
res3 = vreinterpretq_s16_u16(vmovl_u8(t6));
|
||||
res7 = wiener_convolve8_horiz_8x8(res0, res1, res2, res3, filter_x_tmp,
|
||||
bd, conv_params->round_0);
|
||||
|
||||
res0 = vreinterpretq_s16_u16(vaddl_u8(t4, t10));
|
||||
res1 = vreinterpretq_s16_u16(vaddl_u8(t5, t9));
|
||||
res2 = vreinterpretq_s16_u16(vaddl_u8(t6, t8));
|
||||
res3 = vreinterpretq_s16_u16(vmovl_u8(t7));
|
||||
res8 = wiener_convolve8_horiz_8x8(res0, res1, res2, res3, filter_x_tmp,
|
||||
bd, conv_params->round_0);
|
||||
|
||||
res0 = vreinterpretq_s16_u16(vaddl_u8(t5, t11));
|
||||
res1 = vreinterpretq_s16_u16(vaddl_u8(t6, t10));
|
||||
res2 = vreinterpretq_s16_u16(vaddl_u8(t7, t9));
|
||||
res3 = vreinterpretq_s16_u16(vmovl_u8(t8));
|
||||
res9 = wiener_convolve8_horiz_8x8(res0, res1, res2, res3, filter_x_tmp,
|
||||
bd, conv_params->round_0);
|
||||
|
||||
res0 = vreinterpretq_s16_u16(vaddl_u8(t6, t12));
|
||||
res1 = vreinterpretq_s16_u16(vaddl_u8(t7, t11));
|
||||
res2 = vreinterpretq_s16_u16(vaddl_u8(t8, t10));
|
||||
res3 = vreinterpretq_s16_u16(vmovl_u8(t9));
|
||||
res10 = wiener_convolve8_horiz_8x8(res0, res1, res2, res3, filter_x_tmp,
|
||||
bd, conv_params->round_0);
|
||||
|
||||
res0 = vreinterpretq_s16_u16(vaddl_u8(t7, t13));
|
||||
res1 = vreinterpretq_s16_u16(vaddl_u8(t8, t12));
|
||||
res2 = vreinterpretq_s16_u16(vaddl_u8(t9, t11));
|
||||
res3 = vreinterpretq_s16_u16(vmovl_u8(t10));
|
||||
res11 = wiener_convolve8_horiz_8x8(res0, res1, res2, res3, filter_x_tmp,
|
||||
bd, conv_params->round_0);
|
||||
|
||||
transpose_u16_8x8(&res4, &res5, &res6, &res7, &res8, &res9, &res10,
|
||||
&res11);
|
||||
store_u16_8x8(d_tmp, MAX_SB_SIZE, res4, res5, res6, res7, res8, res9,
|
||||
res10, res11);
|
||||
|
||||
t0 = t8;
|
||||
t1 = t9;
|
||||
t2 = t10;
|
||||
t3 = t11;
|
||||
t4 = t12;
|
||||
t5 = t13;
|
||||
t6 = t14;
|
||||
s += 8;
|
||||
d_tmp += 8;
|
||||
width -= 8;
|
||||
} while (width > 0);
|
||||
src_ptr += 8 * src_stride;
|
||||
dst_ptr += 8 * MAX_SB_SIZE;
|
||||
height -= 8;
|
||||
} while (height > 0);
|
||||
} else {
|
||||
/*if height is a multiple of 4*/
|
||||
int16x8_t tt0, tt1, tt2, tt3;
|
||||
const uint8_t *s;
|
||||
uint16x4_t res0, res1, res2, res3, res4, res5, res6, res7;
|
||||
uint16x8_t d0, d1, d2, d3;
|
||||
int16x4_t s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10;
|
||||
int16x4_t s11, s12, s13, s14;
|
||||
uint8x8_t t0, t1, t2, t3;
|
||||
|
||||
do {
|
||||
__builtin_prefetch(src_ptr + 0 * src_stride);
|
||||
__builtin_prefetch(src_ptr + 1 * src_stride);
|
||||
__builtin_prefetch(src_ptr + 2 * src_stride);
|
||||
__builtin_prefetch(src_ptr + 3 * src_stride);
|
||||
|
||||
load_u8_8x4(src_ptr, src_stride, &t0, &t1, &t2, &t3); /*8x4*/
|
||||
transpose_u8_8x4(&t0, &t1, &t2,
|
||||
&t3); /*first 8 pixels of 4 rows transposed-- 4x8*/
|
||||
|
||||
tt0 = vreinterpretq_s16_u16(vmovl_u8(t0));
|
||||
tt1 = vreinterpretq_s16_u16(vmovl_u8(t1));
|
||||
tt2 = vreinterpretq_s16_u16(vmovl_u8(t2));
|
||||
tt3 = vreinterpretq_s16_u16(vmovl_u8(t3));
|
||||
|
||||
s0 = vget_low_s16(tt0); /*pa0 pb0 pc0 pd0 -- pixel_a0*/
|
||||
s1 = vget_low_s16(tt1); /*pa1 pb1 pc1 pd1 */
|
||||
s2 = vget_low_s16(tt2); /*pa2 pb2 pc2 pd2 */
|
||||
s3 = vget_low_s16(tt3); /*pa3 pb3 pc3 pd3 */
|
||||
s4 = vget_high_s16(tt0); /*pa4 pb4 pc4 pd4 */
|
||||
s5 = vget_high_s16(tt1); /*pa5 pb5 pc5 pd5 */
|
||||
s6 = vget_high_s16(tt2); /*pa6 pb6 pc6 pd6 */
|
||||
|
||||
__builtin_prefetch(dst_ptr + 0 * dst_stride);
|
||||
__builtin_prefetch(dst_ptr + 1 * dst_stride);
|
||||
__builtin_prefetch(dst_ptr + 2 * dst_stride);
|
||||
__builtin_prefetch(dst_ptr + 3 * dst_stride);
|
||||
|
||||
s = src_ptr + 7;
|
||||
d_tmp = dst_ptr;
|
||||
width = w;
|
||||
|
||||
do {
|
||||
load_u8_8x4(s, src_stride, &t0, &t1, &t2, &t3); /*8x4*/
|
||||
transpose_u8_8x4(&t0, &t1, &t2, &t3);
|
||||
|
||||
tt0 = vreinterpretq_s16_u16(vmovl_u8(t0));
|
||||
tt1 = vreinterpretq_s16_u16(vmovl_u8(t1));
|
||||
tt2 = vreinterpretq_s16_u16(vmovl_u8(t2));
|
||||
tt3 = vreinterpretq_s16_u16(vmovl_u8(t3));
|
||||
|
||||
s7 = vget_low_s16(tt0); /*pa7 pb7 pc7 pd7 */ /*4x8*/
|
||||
s8 = vget_low_s16(tt1); /*pa8 pb8 pc8 pd8 */
|
||||
s9 = vget_low_s16(tt2); /*pa9 pb9 pc9 pd9 */
|
||||
s10 = vget_low_s16(tt3); /*pa10 pb10 pc10 pd10 */
|
||||
s11 = vget_high_s16(tt0); /*pa11 pb11 pc11 pd11 */
|
||||
s12 = vget_high_s16(tt1); /*pa12 pb12 pc12 pd12 */
|
||||
s13 = vget_high_s16(tt2); /*pa13 pb13 pc13 pd13 */
|
||||
s14 = vget_high_s16(tt3); /*pa14 pb14 pc14 pd14 */
|
||||
|
||||
res0 = wiener_convolve8_horiz_4x8(
|
||||
s0, s1, s2, s3, s4, s5, s6, filter_x_tmp, bd, conv_params->round_0);
|
||||
res1 = wiener_convolve8_horiz_4x8(
|
||||
s1, s2, s3, s4, s5, s6, s7, filter_x_tmp, bd, conv_params->round_0);
|
||||
res2 = wiener_convolve8_horiz_4x8(
|
||||
s2, s3, s4, s5, s6, s7, s8, filter_x_tmp, bd, conv_params->round_0);
|
||||
res3 = wiener_convolve8_horiz_4x8(
|
||||
s3, s4, s5, s6, s7, s8, s9, filter_x_tmp, bd, conv_params->round_0);
|
||||
res4 =
|
||||
wiener_convolve8_horiz_4x8(s4, s5, s6, s7, s8, s9, s10,
|
||||
filter_x_tmp, bd, conv_params->round_0);
|
||||
res5 =
|
||||
wiener_convolve8_horiz_4x8(s5, s6, s7, s8, s9, s10, s11,
|
||||
filter_x_tmp, bd, conv_params->round_0);
|
||||
res6 =
|
||||
wiener_convolve8_horiz_4x8(s6, s7, s8, s9, s10, s11, s12,
|
||||
filter_x_tmp, bd, conv_params->round_0);
|
||||
res7 =
|
||||
wiener_convolve8_horiz_4x8(s7, s8, s9, s10, s11, s12, s13,
|
||||
filter_x_tmp, bd, conv_params->round_0);
|
||||
|
||||
transpose_u16_4x8(&res0, &res1, &res2, &res3, &res4, &res5, &res6,
|
||||
&res7, &d0, &d1, &d2, &d3);
|
||||
|
||||
store_u16_8x4(d_tmp, MAX_SB_SIZE, d0, d1, d2, d3);
|
||||
|
||||
s0 = s8;
|
||||
s1 = s9;
|
||||
s2 = s10;
|
||||
s3 = s11;
|
||||
s4 = s12;
|
||||
s5 = s13;
|
||||
s6 = s14;
|
||||
s += 8;
|
||||
d_tmp += 8;
|
||||
width -= 8;
|
||||
} while (width > 0);
|
||||
|
||||
src_ptr += 4 * src_stride;
|
||||
dst_ptr += 4 * MAX_SB_SIZE;
|
||||
height -= 4;
|
||||
} while (height > 0);
|
||||
}
|
||||
|
||||
{
|
||||
int16x8_t s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10;
|
||||
uint8x8_t t0, t1, t2, t3;
|
||||
int16_t *src_tmp_ptr, *s;
|
||||
uint8_t *dst_tmp_ptr;
|
||||
height = h;
|
||||
width = w;
|
||||
src_tmp_ptr = (int16_t *)temp;
|
||||
dst_tmp_ptr = dst;
|
||||
src_stride = MAX_SB_SIZE;
|
||||
|
||||
do {
|
||||
s = src_tmp_ptr;
|
||||
s0 = vld1q_s16(s);
|
||||
s += src_stride;
|
||||
s1 = vld1q_s16(s);
|
||||
s += src_stride;
|
||||
s2 = vld1q_s16(s);
|
||||
s += src_stride;
|
||||
s3 = vld1q_s16(s);
|
||||
s += src_stride;
|
||||
s4 = vld1q_s16(s);
|
||||
s += src_stride;
|
||||
s5 = vld1q_s16(s);
|
||||
s += src_stride;
|
||||
s6 = vld1q_s16(s);
|
||||
s += src_stride;
|
||||
d = dst_tmp_ptr;
|
||||
height = h;
|
||||
|
||||
do {
|
||||
__builtin_prefetch(dst_tmp_ptr + 0 * dst_stride);
|
||||
__builtin_prefetch(dst_tmp_ptr + 1 * dst_stride);
|
||||
__builtin_prefetch(dst_tmp_ptr + 2 * dst_stride);
|
||||
__builtin_prefetch(dst_tmp_ptr + 3 * dst_stride);
|
||||
|
||||
s7 = vld1q_s16(s);
|
||||
s += src_stride;
|
||||
s8 = vld1q_s16(s);
|
||||
s += src_stride;
|
||||
s9 = vld1q_s16(s);
|
||||
s += src_stride;
|
||||
s10 = vld1q_s16(s);
|
||||
s += src_stride;
|
||||
|
||||
t0 = wiener_convolve8_vert_4x8(s0, s1, s2, s3, s4, s5, s6, filter_y_tmp,
|
||||
bd, conv_params->round_1);
|
||||
t1 = wiener_convolve8_vert_4x8(s1, s2, s3, s4, s5, s6, s7, filter_y_tmp,
|
||||
bd, conv_params->round_1);
|
||||
t2 = wiener_convolve8_vert_4x8(s2, s3, s4, s5, s6, s7, s8, filter_y_tmp,
|
||||
bd, conv_params->round_1);
|
||||
t3 = wiener_convolve8_vert_4x8(s3, s4, s5, s6, s7, s8, s9, filter_y_tmp,
|
||||
bd, conv_params->round_1);
|
||||
|
||||
vst1_u8(d, t0);
|
||||
d += dst_stride;
|
||||
vst1_u8(d, t1);
|
||||
d += dst_stride;
|
||||
vst1_u8(d, t2);
|
||||
d += dst_stride;
|
||||
vst1_u8(d, t3);
|
||||
d += dst_stride;
|
||||
|
||||
s0 = s4;
|
||||
s1 = s5;
|
||||
s2 = s6;
|
||||
s3 = s7;
|
||||
s4 = s8;
|
||||
s5 = s9;
|
||||
s6 = s10;
|
||||
height -= 4;
|
||||
} while (height > 3);
|
||||
|
||||
if (height != 0) {
|
||||
__builtin_prefetch(dst_tmp_ptr + 0 * dst_stride);
|
||||
__builtin_prefetch(dst_tmp_ptr + 1 * dst_stride);
|
||||
|
||||
do {
|
||||
s7 = vld1q_s16(s);
|
||||
s += src_stride;
|
||||
|
||||
t0 =
|
||||
wiener_convolve8_vert_4x8(s0, s1, s2, s3, s4, s5, s6,
|
||||
filter_y_tmp, bd, conv_params->round_1);
|
||||
vst1_u8(d, t0);
|
||||
d += dst_stride;
|
||||
|
||||
s0 = s1;
|
||||
s1 = s2;
|
||||
s2 = s3;
|
||||
s3 = s4;
|
||||
s4 = s5;
|
||||
s5 = s6;
|
||||
s6 = s7;
|
||||
height -= 1;
|
||||
} while (height > 0);
|
||||
}
|
||||
|
||||
src_tmp_ptr += 8;
|
||||
dst_tmp_ptr += 8;
|
||||
|
||||
w -= 8;
|
||||
} while (w > 0);
|
||||
}
|
||||
}
|
||||
2355
third_party/aom/av1/common/av1_fwd_txfm1d.c
vendored
2355
third_party/aom/av1/common/av1_fwd_txfm1d.c
vendored
File diff suppressed because it is too large
Load diff
61
third_party/aom/av1/common/av1_fwd_txfm1d.h
vendored
61
third_party/aom/av1/common/av1_fwd_txfm1d.h
vendored
|
|
@ -1,61 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef AV1_FWD_TXFM1D_H_
|
||||
#define AV1_FWD_TXFM1D_H_
|
||||
|
||||
#include "av1/common/av1_txfm.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void av1_fdct4_new(const int32_t *input, int32_t *output, const int8_t *cos_bit,
|
||||
const int8_t *stage_range);
|
||||
void av1_fdct8_new(const int32_t *input, int32_t *output, const int8_t *cos_bit,
|
||||
const int8_t *stage_range);
|
||||
void av1_fdct16_new(const int32_t *input, int32_t *output,
|
||||
const int8_t *cos_bit, const int8_t *stage_range);
|
||||
void av1_fdct32_new(const int32_t *input, int32_t *output,
|
||||
const int8_t *cos_bit, const int8_t *stage_range);
|
||||
#if CONFIG_TX64X64
|
||||
void av1_fdct64_new(const int32_t *input, int32_t *output,
|
||||
const int8_t *cos_bit, const int8_t *stage_range);
|
||||
#endif // CONFIG_TX64X64
|
||||
|
||||
void av1_fadst4_new(const int32_t *input, int32_t *output,
|
||||
const int8_t *cos_bit, const int8_t *stage_range);
|
||||
void av1_fadst8_new(const int32_t *input, int32_t *output,
|
||||
const int8_t *cos_bit, const int8_t *stage_range);
|
||||
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);
|
||||
#if CONFIG_TX64X64
|
||||
void av1_fidentity64_c(const int32_t *input, int32_t *output,
|
||||
const int8_t *cos_bit, const int8_t *stage_range);
|
||||
#endif // CONFIG_TX64X64
|
||||
#endif // CONFIG_EXT_TX
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // AV1_FWD_TXFM1D_H_
|
||||
363
third_party/aom/av1/common/av1_fwd_txfm1d_cfg.h
vendored
363
third_party/aom/av1/common/av1_fwd_txfm1d_cfg.h
vendored
|
|
@ -1,363 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef AV1_FWD_TXFM2D_CFG_H_
|
||||
#define AV1_FWD_TXFM2D_CFG_H_
|
||||
#include "av1/common/enums.h"
|
||||
#include "av1/common/av1_fwd_txfm1d.h"
|
||||
|
||||
// ---------------- 4x4 1D constants -----------------------
|
||||
// shift
|
||||
static const int8_t fwd_shift_4[3] = { 2, 0, 0 };
|
||||
|
||||
// stage range
|
||||
static const int8_t fwd_stage_range_col_dct_4[4] = { 0, 1, 2, 2 };
|
||||
static const int8_t fwd_stage_range_row_dct_4[4] = { 2, 3, 3, 3 };
|
||||
static const int8_t fwd_stage_range_col_adst_4[6] = { 0, 0, 1, 2, 2, 2 };
|
||||
static const int8_t fwd_stage_range_row_adst_4[6] = { 2, 2, 2, 3, 3, 3 };
|
||||
static const int8_t fwd_stage_range_idx_4[1] = { 0 };
|
||||
|
||||
// cos bit
|
||||
static const int8_t fwd_cos_bit_col_dct_4[4] = { 13, 13, 13, 13 };
|
||||
static const int8_t fwd_cos_bit_row_dct_4[4] = { 13, 13, 13, 13 };
|
||||
static const int8_t fwd_cos_bit_col_adst_4[6] = { 13, 13, 13, 13, 13, 13 };
|
||||
static const int8_t fwd_cos_bit_row_adst_4[6] = { 13, 13, 13, 13, 13, 13 };
|
||||
|
||||
// ---------------- 8x8 1D constants -----------------------
|
||||
// shift
|
||||
static const int8_t fwd_shift_8[3] = { 2, -1, 0 };
|
||||
|
||||
// stage range
|
||||
static const int8_t fwd_stage_range_col_dct_8[6] = { 0, 1, 2, 3, 3, 3 };
|
||||
static const int8_t fwd_stage_range_row_dct_8[6] = { 3, 4, 5, 5, 5, 5 };
|
||||
static const int8_t fwd_stage_range_col_adst_8[8] = { 0, 0, 1, 2, 2, 3, 3, 3 };
|
||||
static const int8_t fwd_stage_range_row_adst_8[8] = { 3, 3, 3, 4, 4, 5, 5, 5 };
|
||||
static const int8_t fwd_stage_range_idx_8[1] = { 0 };
|
||||
|
||||
// cos bit
|
||||
static const int8_t fwd_cos_bit_col_dct_8[6] = { 13, 13, 13, 13, 13, 13 };
|
||||
static const int8_t fwd_cos_bit_row_dct_8[6] = { 13, 13, 13, 13, 13, 13 };
|
||||
static const int8_t fwd_cos_bit_col_adst_8[8] = {
|
||||
13, 13, 13, 13, 13, 13, 13, 13
|
||||
};
|
||||
static const int8_t fwd_cos_bit_row_adst_8[8] = {
|
||||
13, 13, 13, 13, 13, 13, 13, 13
|
||||
};
|
||||
|
||||
// ---------------- 16x16 1D constants -----------------------
|
||||
// shift
|
||||
static const int8_t fwd_shift_16[3] = { 2, -2, 0 };
|
||||
|
||||
// stage range
|
||||
static const int8_t fwd_stage_range_col_dct_16[8] = { 0, 1, 2, 3, 4, 4, 4, 4 };
|
||||
static const int8_t fwd_stage_range_row_dct_16[8] = { 4, 5, 6, 7, 7, 7, 7, 7 };
|
||||
static const int8_t fwd_stage_range_col_adst_16[10] = { 0, 0, 1, 2, 2,
|
||||
3, 3, 4, 4, 4 };
|
||||
static const int8_t fwd_stage_range_row_adst_16[10] = {
|
||||
4, 4, 4, 5, 5, 6, 6, 7, 7, 7,
|
||||
};
|
||||
static const int8_t fwd_stage_range_idx_16[1] = { 0 };
|
||||
|
||||
// cos bit
|
||||
static const int8_t fwd_cos_bit_col_dct_16[8] = {
|
||||
13, 13, 13, 13, 13, 13, 13, 13
|
||||
};
|
||||
static const int8_t fwd_cos_bit_row_dct_16[8] = {
|
||||
12, 12, 12, 12, 12, 12, 12, 12
|
||||
};
|
||||
static const int8_t fwd_cos_bit_col_adst_16[10] = { 13, 13, 13, 13, 13,
|
||||
13, 13, 13, 13, 13 };
|
||||
static const int8_t fwd_cos_bit_row_adst_16[10] = { 12, 12, 12, 12, 12,
|
||||
12, 12, 12, 12, 12 };
|
||||
|
||||
// ---------------- 32x32 1D constants -----------------------
|
||||
// shift
|
||||
static const int8_t fwd_shift_32[3] = { 2, -4, 0 };
|
||||
|
||||
// stage range
|
||||
static const int8_t fwd_stage_range_col_dct_32[10] = { 0, 1, 2, 3, 4,
|
||||
5, 5, 5, 5, 5 };
|
||||
static const int8_t fwd_stage_range_row_dct_32[10] = { 5, 6, 7, 8, 9,
|
||||
9, 9, 9, 9, 9 };
|
||||
static const int8_t fwd_stage_range_col_adst_32[12] = { 0, 0, 1, 2, 2, 3,
|
||||
3, 4, 4, 5, 5, 5 };
|
||||
static const int8_t fwd_stage_range_row_adst_32[12] = { 5, 5, 5, 6, 6, 7,
|
||||
7, 8, 8, 9, 9, 9 };
|
||||
static const int8_t fwd_stage_range_idx_32[1] = { 0 };
|
||||
|
||||
// cos bit
|
||||
static const int8_t fwd_cos_bit_col_dct_32[10] = { 12, 12, 12, 12, 12,
|
||||
12, 12, 12, 12, 12 };
|
||||
static const int8_t fwd_cos_bit_row_dct_32[10] = { 12, 12, 12, 12, 12,
|
||||
12, 12, 12, 12, 12 };
|
||||
static const int8_t fwd_cos_bit_col_adst_32[12] = { 12, 12, 12, 12, 12, 12,
|
||||
12, 12, 12, 12, 12, 12 };
|
||||
static const int8_t fwd_cos_bit_row_adst_32[12] = { 12, 12, 12, 12, 12, 12,
|
||||
12, 12, 12, 12, 12, 12 };
|
||||
|
||||
// ---------------- 64x64 1D constants -----------------------
|
||||
// shift
|
||||
static const int8_t fwd_shift_64[3] = { 0, -2, -2 };
|
||||
|
||||
// stage range
|
||||
static const int8_t fwd_stage_range_col_dct_64[12] = { 0, 1, 2, 3, 4, 5,
|
||||
6, 6, 6, 6, 6, 6 };
|
||||
static const int8_t fwd_stage_range_row_dct_64[12] = { 6, 7, 8, 9, 10, 11,
|
||||
11, 11, 11, 11, 11, 11 };
|
||||
static const int8_t fwd_stage_range_idx_64[1] = { 0 };
|
||||
|
||||
// cos bit
|
||||
static const int8_t fwd_cos_bit_col_dct_64[12] = { 15, 15, 15, 15, 15, 14,
|
||||
13, 13, 13, 13, 13, 13 };
|
||||
static const int8_t fwd_cos_bit_row_dct_64[12] = { 15, 14, 13, 12, 11, 10,
|
||||
10, 10, 10, 10, 10, 10 };
|
||||
|
||||
// ---------------- row config fwd_dct_4 ----------------
|
||||
static const TXFM_1D_CFG fwd_txfm_1d_row_cfg_dct_4 = {
|
||||
4, // .txfm_size
|
||||
4, // .stage_num
|
||||
// 0, // .log_scale
|
||||
fwd_shift_4, // .shift
|
||||
fwd_stage_range_row_dct_4, // .stage_range
|
||||
fwd_cos_bit_row_dct_4, // .cos_bit
|
||||
TXFM_TYPE_DCT4 // .txfm_type
|
||||
};
|
||||
|
||||
// ---------------- row config fwd_dct_8 ----------------
|
||||
static const TXFM_1D_CFG fwd_txfm_1d_row_cfg_dct_8 = {
|
||||
8, // .txfm_size
|
||||
6, // .stage_num
|
||||
// 0, // .log_scale
|
||||
fwd_shift_8, // .shift
|
||||
fwd_stage_range_row_dct_8, // .stage_range
|
||||
fwd_cos_bit_row_dct_8, // .cos_bit_
|
||||
TXFM_TYPE_DCT8 // .txfm_type
|
||||
};
|
||||
// ---------------- row config fwd_dct_16 ----------------
|
||||
static const TXFM_1D_CFG fwd_txfm_1d_row_cfg_dct_16 = {
|
||||
16, // .txfm_size
|
||||
8, // .stage_num
|
||||
// 0, // .log_scale
|
||||
fwd_shift_16, // .shift
|
||||
fwd_stage_range_row_dct_16, // .stage_range
|
||||
fwd_cos_bit_row_dct_16, // .cos_bit
|
||||
TXFM_TYPE_DCT16 // .txfm_type
|
||||
};
|
||||
|
||||
// ---------------- row config fwd_dct_32 ----------------
|
||||
static const TXFM_1D_CFG fwd_txfm_1d_row_cfg_dct_32 = {
|
||||
32, // .txfm_size
|
||||
10, // .stage_num
|
||||
// 1, // .log_scale
|
||||
fwd_shift_32, // .shift
|
||||
fwd_stage_range_row_dct_32, // .stage_range
|
||||
fwd_cos_bit_row_dct_32, // .cos_bit_row
|
||||
TXFM_TYPE_DCT32 // .txfm_type
|
||||
};
|
||||
|
||||
// ---------------- row config fwd_dct_64 ----------------
|
||||
static const TXFM_1D_CFG fwd_txfm_1d_row_cfg_dct_64 = {
|
||||
64, // .txfm_size
|
||||
12, // .stage_num
|
||||
fwd_shift_64, // .shift
|
||||
fwd_stage_range_row_dct_64, // .stage_range
|
||||
fwd_cos_bit_row_dct_64, // .cos_bit
|
||||
TXFM_TYPE_DCT64, // .txfm_type_col
|
||||
};
|
||||
|
||||
// ---------------- row config fwd_adst_4 ----------------
|
||||
static const TXFM_1D_CFG fwd_txfm_1d_row_cfg_adst_4 = {
|
||||
4, // .txfm_size
|
||||
6, // .stage_num
|
||||
// 0, // .log_scale
|
||||
fwd_shift_4, // .shift
|
||||
fwd_stage_range_row_adst_4, // .stage_range
|
||||
fwd_cos_bit_row_adst_4, // .cos_bit
|
||||
TXFM_TYPE_ADST4, // .txfm_type
|
||||
};
|
||||
|
||||
// ---------------- row config fwd_adst_8 ----------------
|
||||
static const TXFM_1D_CFG fwd_txfm_1d_row_cfg_adst_8 = {
|
||||
8, // .txfm_size
|
||||
8, // .stage_num
|
||||
// 0, // .log_scale
|
||||
fwd_shift_8, // .shift
|
||||
fwd_stage_range_row_adst_8, // .stage_range
|
||||
fwd_cos_bit_row_adst_8, // .cos_bit
|
||||
TXFM_TYPE_ADST8, // .txfm_type_col
|
||||
};
|
||||
|
||||
// ---------------- row config fwd_adst_16 ----------------
|
||||
static const TXFM_1D_CFG fwd_txfm_1d_row_cfg_adst_16 = {
|
||||
16, // .txfm_size
|
||||
10, // .stage_num
|
||||
// 0, // .log_scale
|
||||
fwd_shift_16, // .shift
|
||||
fwd_stage_range_row_adst_16, // .stage_range
|
||||
fwd_cos_bit_row_adst_16, // .cos_bit
|
||||
TXFM_TYPE_ADST16, // .txfm_type
|
||||
};
|
||||
|
||||
// ---------------- row config fwd_adst_32 ----------------
|
||||
static const TXFM_1D_CFG fwd_txfm_1d_row_cfg_adst_32 = {
|
||||
32, // .txfm_size
|
||||
12, // .stage_num
|
||||
// 1, // .log_scale
|
||||
fwd_shift_32, // .shift
|
||||
fwd_stage_range_row_adst_32, // .stage_range
|
||||
fwd_cos_bit_row_adst_32, // .cos_bit
|
||||
TXFM_TYPE_ADST32, // .txfm_type
|
||||
};
|
||||
|
||||
// ---------------- col config fwd_dct_4 ----------------
|
||||
static const TXFM_1D_CFG fwd_txfm_1d_col_cfg_dct_4 = {
|
||||
4, // .txfm_size
|
||||
4, // .stage_num
|
||||
// 0, // .log_scale
|
||||
fwd_shift_4, // .shift
|
||||
fwd_stage_range_col_dct_4, // .stage_range
|
||||
fwd_cos_bit_col_dct_4, // .cos_bit
|
||||
TXFM_TYPE_DCT4 // .txfm_type
|
||||
};
|
||||
|
||||
// ---------------- col config fwd_dct_8 ----------------
|
||||
static const TXFM_1D_CFG fwd_txfm_1d_col_cfg_dct_8 = {
|
||||
8, // .txfm_size
|
||||
6, // .stage_num
|
||||
// 0, // .log_scale
|
||||
fwd_shift_8, // .shift
|
||||
fwd_stage_range_col_dct_8, // .stage_range
|
||||
fwd_cos_bit_col_dct_8, // .cos_bit_
|
||||
TXFM_TYPE_DCT8 // .txfm_type
|
||||
};
|
||||
// ---------------- col config fwd_dct_16 ----------------
|
||||
static const TXFM_1D_CFG fwd_txfm_1d_col_cfg_dct_16 = {
|
||||
16, // .txfm_size
|
||||
8, // .stage_num
|
||||
// 0, // .log_scale
|
||||
fwd_shift_16, // .shift
|
||||
fwd_stage_range_col_dct_16, // .stage_range
|
||||
fwd_cos_bit_col_dct_16, // .cos_bit
|
||||
TXFM_TYPE_DCT16 // .txfm_type
|
||||
};
|
||||
|
||||
// ---------------- col config fwd_dct_32 ----------------
|
||||
static const TXFM_1D_CFG fwd_txfm_1d_col_cfg_dct_32 = {
|
||||
32, // .txfm_size
|
||||
10, // .stage_num
|
||||
// 1, // .log_scale
|
||||
fwd_shift_32, // .shift
|
||||
fwd_stage_range_col_dct_32, // .stage_range
|
||||
fwd_cos_bit_col_dct_32, // .cos_bit_col
|
||||
TXFM_TYPE_DCT32 // .txfm_type
|
||||
};
|
||||
|
||||
// ---------------- col config fwd_dct_64 ----------------
|
||||
static const TXFM_1D_CFG fwd_txfm_1d_col_cfg_dct_64 = {
|
||||
64, // .txfm_size
|
||||
12, // .stage_num
|
||||
fwd_shift_64, // .shift
|
||||
fwd_stage_range_col_dct_64, // .stage_range
|
||||
fwd_cos_bit_col_dct_64, // .cos_bit
|
||||
TXFM_TYPE_DCT64, // .txfm_type_col
|
||||
};
|
||||
|
||||
// ---------------- col config fwd_adst_4 ----------------
|
||||
static const TXFM_1D_CFG fwd_txfm_1d_col_cfg_adst_4 = {
|
||||
4, // .txfm_size
|
||||
6, // .stage_num
|
||||
// 0, // .log_scale
|
||||
fwd_shift_4, // .shift
|
||||
fwd_stage_range_col_adst_4, // .stage_range
|
||||
fwd_cos_bit_col_adst_4, // .cos_bit
|
||||
TXFM_TYPE_ADST4, // .txfm_type
|
||||
};
|
||||
|
||||
// ---------------- col config fwd_adst_8 ----------------
|
||||
static const TXFM_1D_CFG fwd_txfm_1d_col_cfg_adst_8 = {
|
||||
8, // .txfm_size
|
||||
8, // .stage_num
|
||||
// 0, // .log_scale
|
||||
fwd_shift_8, // .shift
|
||||
fwd_stage_range_col_adst_8, // .stage_range
|
||||
fwd_cos_bit_col_adst_8, // .cos_bit
|
||||
TXFM_TYPE_ADST8, // .txfm_type_col
|
||||
};
|
||||
|
||||
// ---------------- col config fwd_adst_16 ----------------
|
||||
static const TXFM_1D_CFG fwd_txfm_1d_col_cfg_adst_16 = {
|
||||
16, // .txfm_size
|
||||
10, // .stage_num
|
||||
// 0, // .log_scale
|
||||
fwd_shift_16, // .shift
|
||||
fwd_stage_range_col_adst_16, // .stage_range
|
||||
fwd_cos_bit_col_adst_16, // .cos_bit
|
||||
TXFM_TYPE_ADST16, // .txfm_type
|
||||
};
|
||||
|
||||
// ---------------- col config fwd_adst_32 ----------------
|
||||
static const TXFM_1D_CFG fwd_txfm_1d_col_cfg_adst_32 = {
|
||||
32, // .txfm_size
|
||||
12, // .stage_num
|
||||
// 1, // .log_scale
|
||||
fwd_shift_32, // .shift
|
||||
fwd_stage_range_col_adst_32, // .stage_range
|
||||
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_idx_4, // .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_idx_8, // .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_idx_16, // .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_idx_32, // .stage_range
|
||||
NULL, // .cos_bit
|
||||
TXFM_TYPE_IDENTITY32, // .txfm_type
|
||||
};
|
||||
#endif // CONFIG_EXT_TX
|
||||
#endif // AV1_FWD_TXFM2D_CFG_H_
|
||||
413
third_party/aom/av1/common/av1_fwd_txfm2d.c
vendored
413
third_party/aom/av1/common/av1_fwd_txfm2d.c
vendored
|
|
@ -1,413 +0,0 @@
|
|||
/*
|
||||
* 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 <assert.h>
|
||||
|
||||
#include "./av1_rtcd.h"
|
||||
#include "aom_dsp/txfm_common.h"
|
||||
#include "av1/common/enums.h"
|
||||
#include "av1/common/av1_fwd_txfm1d.h"
|
||||
#include "av1/common/av1_fwd_txfm1d_cfg.h"
|
||||
#include "av1/common/av1_txfm.h"
|
||||
|
||||
static INLINE TxfmFunc fwd_txfm_type_to_func(TXFM_TYPE txfm_type) {
|
||||
switch (txfm_type) {
|
||||
case TXFM_TYPE_DCT4: return av1_fdct4_new;
|
||||
case TXFM_TYPE_DCT8: return av1_fdct8_new;
|
||||
case TXFM_TYPE_DCT16: return av1_fdct16_new;
|
||||
case TXFM_TYPE_DCT32: return av1_fdct32_new;
|
||||
#if CONFIG_TX64X64
|
||||
case TXFM_TYPE_DCT64: return av1_fdct64_new;
|
||||
#endif // CONFIG_TX64X64
|
||||
case TXFM_TYPE_ADST4: return av1_fadst4_new;
|
||||
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;
|
||||
#if CONFIG_TX64X64
|
||||
case TXFM_TYPE_IDENTITY64: return av1_fidentity64_c;
|
||||
#endif // CONFIG_TX64X64
|
||||
#endif // CONFIG_EXT_TX
|
||||
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) {
|
||||
// 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.
|
||||
const int txfm_size_col = cfg->row_cfg->txfm_size;
|
||||
const int txfm_size_row = cfg->col_cfg->txfm_size;
|
||||
// Take the shift from the larger dimension in the rectangular case.
|
||||
const int8_t *shift = (txfm_size_col > txfm_size_row) ? cfg->row_cfg->shift
|
||||
: cfg->col_cfg->shift;
|
||||
// i < MAX_TXFM_STAGE_NUM will mute above array bounds warning
|
||||
for (int i = 0; i < cfg->col_cfg->stage_num && i < MAX_TXFM_STAGE_NUM; ++i) {
|
||||
stage_range_col[i] = cfg->col_cfg->stage_range[i] + shift[0] + bd + 1;
|
||||
}
|
||||
|
||||
// i < MAX_TXFM_STAGE_NUM will mute above array bounds warning
|
||||
for (int i = 0; i < cfg->row_cfg->stage_num && i < MAX_TXFM_STAGE_NUM; ++i) {
|
||||
stage_range_row[i] =
|
||||
cfg->row_cfg->stage_range[i] + shift[0] + shift[1] + bd + 1;
|
||||
}
|
||||
}
|
||||
|
||||
static INLINE void fwd_txfm2d_c(const int16_t *input, int32_t *output,
|
||||
const int 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.
|
||||
const int txfm_size_col = cfg->row_cfg->txfm_size;
|
||||
const int txfm_size_row = cfg->col_cfg->txfm_size;
|
||||
// Take the shift from the larger dimension in the rectangular case.
|
||||
const int8_t *shift = (txfm_size_col > txfm_size_row) ? cfg->row_cfg->shift
|
||||
: cfg->col_cfg->shift;
|
||||
int8_t stage_range_col[MAX_TXFM_STAGE_NUM];
|
||||
int8_t stage_range_row[MAX_TXFM_STAGE_NUM];
|
||||
assert(cfg->col_cfg->stage_num <= MAX_TXFM_STAGE_NUM);
|
||||
assert(cfg->row_cfg->stage_num <= MAX_TXFM_STAGE_NUM);
|
||||
av1_gen_fwd_stage_range(stage_range_col, stage_range_row, cfg, bd);
|
||||
|
||||
const int8_t *cos_bit_col = cfg->col_cfg->cos_bit;
|
||||
const int8_t *cos_bit_row = cfg->row_cfg->cos_bit;
|
||||
const TxfmFunc txfm_func_col = fwd_txfm_type_to_func(cfg->col_cfg->txfm_type);
|
||||
const TxfmFunc txfm_func_row = fwd_txfm_type_to_func(cfg->row_cfg->txfm_type);
|
||||
|
||||
// use output buffer as temp buffer
|
||||
int32_t *temp_in = output;
|
||||
int32_t *temp_out = output + txfm_size_row;
|
||||
|
||||
// Columns
|
||||
for (c = 0; c < txfm_size_col; ++c) {
|
||||
if (cfg->ud_flip == 0) {
|
||||
for (r = 0; r < txfm_size_row; ++r) temp_in[r] = input[r * stride + c];
|
||||
} else {
|
||||
for (r = 0; r < txfm_size_row; ++r)
|
||||
// flip upside down
|
||||
temp_in[r] = input[(txfm_size_row - r - 1) * stride + c];
|
||||
}
|
||||
round_shift_array(temp_in, txfm_size_row, -shift[0]);
|
||||
// Multiply everything by Sqrt2 on the larger dimension if the
|
||||
// transform is rectangular
|
||||
if (txfm_size_col > txfm_size_row) {
|
||||
for (r = 0; r < txfm_size_row; ++r)
|
||||
temp_in[r] = (int32_t)fdct_round_shift(temp_in[r] * Sqrt2);
|
||||
}
|
||||
txfm_func_col(temp_in, temp_out, cos_bit_col, stage_range_col);
|
||||
round_shift_array(temp_out, txfm_size_row, -shift[1]);
|
||||
if (cfg->lr_flip == 0) {
|
||||
for (r = 0; r < txfm_size_row; ++r)
|
||||
buf[r * txfm_size_col + c] = temp_out[r];
|
||||
} else {
|
||||
for (r = 0; r < txfm_size_row; ++r)
|
||||
// flip from left to right
|
||||
buf[r * txfm_size_col + (txfm_size_col - c - 1)] = temp_out[r];
|
||||
}
|
||||
}
|
||||
|
||||
// Rows
|
||||
for (r = 0; r < txfm_size_row; ++r) {
|
||||
// Multiply everything by Sqrt2 on the larger dimension if the
|
||||
// transform is rectangular
|
||||
if (txfm_size_row > txfm_size_col) {
|
||||
for (c = 0; c < txfm_size_col; ++c)
|
||||
buf[r * txfm_size_col + c] =
|
||||
(int32_t)fdct_round_shift(buf[r * txfm_size_col + c] * Sqrt2);
|
||||
}
|
||||
txfm_func_row(buf + r * txfm_size_col, output + r * txfm_size_col,
|
||||
cos_bit_row, stage_range_row);
|
||||
round_shift_array(output + r * txfm_size_col, txfm_size_col, -shift[2]);
|
||||
}
|
||||
}
|
||||
|
||||
void av1_fwd_txfm2d_4x8_c(const int16_t *input, int32_t *output, int stride,
|
||||
TX_TYPE tx_type, int bd) {
|
||||
#if CONFIG_TXMG
|
||||
int32_t txfm_buf[4 * 8];
|
||||
int16_t rinput[4 * 8];
|
||||
TX_SIZE tx_size = TX_4X8;
|
||||
TX_SIZE rtx_size = av1_rotate_tx_size(tx_size);
|
||||
TX_TYPE rtx_type = av1_rotate_tx_type(tx_type);
|
||||
int w = tx_size_wide[tx_size];
|
||||
int h = tx_size_high[tx_size];
|
||||
int rw = h;
|
||||
int rh = w;
|
||||
transpose_int16(rinput, rw, input, stride, w, h);
|
||||
TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(rtx_type, rtx_size);
|
||||
fwd_txfm2d_c(rinput, txfm_buf, rw, &cfg, output, bd);
|
||||
transpose_int32(output, w, txfm_buf, rw, rw, rh);
|
||||
#else
|
||||
int32_t txfm_buf[4 * 8];
|
||||
TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(tx_type, TX_4X8);
|
||||
fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd);
|
||||
#endif
|
||||
}
|
||||
|
||||
void av1_fwd_txfm2d_8x4_c(const int16_t *input, int32_t *output, int stride,
|
||||
TX_TYPE tx_type, int bd) {
|
||||
int32_t txfm_buf[8 * 4];
|
||||
TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(tx_type, TX_8X4);
|
||||
fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd);
|
||||
}
|
||||
|
||||
void av1_fwd_txfm2d_8x16_c(const int16_t *input, int32_t *output, int stride,
|
||||
TX_TYPE tx_type, int bd) {
|
||||
#if CONFIG_TXMG
|
||||
int32_t txfm_buf[8 * 16];
|
||||
int16_t rinput[8 * 16];
|
||||
TX_SIZE tx_size = TX_8X16;
|
||||
TX_SIZE rtx_size = av1_rotate_tx_size(tx_size);
|
||||
TX_TYPE rtx_type = av1_rotate_tx_type(tx_type);
|
||||
int w = tx_size_wide[tx_size];
|
||||
int h = tx_size_high[tx_size];
|
||||
int rw = h;
|
||||
int rh = w;
|
||||
transpose_int16(rinput, rw, input, stride, w, h);
|
||||
TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(rtx_type, rtx_size);
|
||||
fwd_txfm2d_c(rinput, txfm_buf, rw, &cfg, output, bd);
|
||||
transpose_int32(output, w, txfm_buf, rw, rw, rh);
|
||||
#else
|
||||
int32_t txfm_buf[8 * 16];
|
||||
TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(tx_type, TX_8X16);
|
||||
fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd);
|
||||
#endif
|
||||
}
|
||||
|
||||
void av1_fwd_txfm2d_16x8_c(const int16_t *input, int32_t *output, int stride,
|
||||
TX_TYPE tx_type, int bd) {
|
||||
int32_t txfm_buf[16 * 8];
|
||||
TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(tx_type, TX_16X8);
|
||||
fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd);
|
||||
}
|
||||
|
||||
void av1_fwd_txfm2d_16x32_c(const int16_t *input, int32_t *output, int stride,
|
||||
TX_TYPE tx_type, int bd) {
|
||||
#if CONFIG_TXMG
|
||||
int32_t txfm_buf[16 * 32];
|
||||
int16_t rinput[16 * 32];
|
||||
TX_SIZE tx_size = TX_16X32;
|
||||
TX_SIZE rtx_size = av1_rotate_tx_size(tx_size);
|
||||
TX_TYPE rtx_type = av1_rotate_tx_type(tx_type);
|
||||
int w = tx_size_wide[tx_size];
|
||||
int h = tx_size_high[tx_size];
|
||||
int rw = h;
|
||||
int rh = w;
|
||||
transpose_int16(rinput, rw, input, stride, w, h);
|
||||
TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(rtx_type, rtx_size);
|
||||
fwd_txfm2d_c(rinput, txfm_buf, rw, &cfg, output, bd);
|
||||
transpose_int32(output, w, txfm_buf, rw, rw, rh);
|
||||
#else
|
||||
int32_t txfm_buf[16 * 32];
|
||||
TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(tx_type, TX_16X32);
|
||||
fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd);
|
||||
#endif
|
||||
}
|
||||
|
||||
void av1_fwd_txfm2d_32x16_c(const int16_t *input, int32_t *output, int stride,
|
||||
TX_TYPE tx_type, int bd) {
|
||||
int32_t txfm_buf[32 * 16];
|
||||
TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(tx_type, TX_32X16);
|
||||
fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd);
|
||||
}
|
||||
|
||||
void av1_fwd_txfm2d_4x4_c(const int16_t *input, int32_t *output, int stride,
|
||||
TX_TYPE tx_type, int bd) {
|
||||
int32_t txfm_buf[4 * 4];
|
||||
TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(tx_type, TX_4X4);
|
||||
fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd);
|
||||
}
|
||||
|
||||
void av1_fwd_txfm2d_8x8_c(const int16_t *input, int32_t *output, int stride,
|
||||
TX_TYPE tx_type, int bd) {
|
||||
int32_t txfm_buf[8 * 8];
|
||||
TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(tx_type, TX_8X8);
|
||||
fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd);
|
||||
}
|
||||
|
||||
void av1_fwd_txfm2d_16x16_c(const int16_t *input, int32_t *output, int stride,
|
||||
TX_TYPE tx_type, int bd) {
|
||||
int32_t txfm_buf[16 * 16];
|
||||
TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(tx_type, TX_16X16);
|
||||
fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd);
|
||||
}
|
||||
|
||||
void av1_fwd_txfm2d_32x32_c(const int16_t *input, int32_t *output, int stride,
|
||||
TX_TYPE tx_type, int bd) {
|
||||
int32_t txfm_buf[32 * 32];
|
||||
TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(tx_type, TX_32X32);
|
||||
fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd);
|
||||
}
|
||||
|
||||
#if CONFIG_TX64X64
|
||||
void av1_fwd_txfm2d_64x64_c(const int16_t *input, int32_t *output, int stride,
|
||||
TX_TYPE tx_type, int bd) {
|
||||
int32_t txfm_buf[64 * 64];
|
||||
TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_64x64_cfg(tx_type);
|
||||
fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd);
|
||||
}
|
||||
|
||||
void av1_fwd_txfm2d_32x64_c(const int16_t *input, int32_t *output, int stride,
|
||||
TX_TYPE tx_type, int bd) {
|
||||
int32_t txfm_buf[32 * 64];
|
||||
TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_32x64_cfg(tx_type);
|
||||
fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd);
|
||||
}
|
||||
|
||||
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_64x32_cfg(tx_type);
|
||||
fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd);
|
||||
}
|
||||
#endif // CONFIG_TX64X64
|
||||
|
||||
static const TXFM_1D_CFG *fwd_txfm_col_cfg_ls[TX_TYPES_1D][TX_SIZES] = {
|
||||
// DCT
|
||||
{
|
||||
#if CONFIG_CHROMA_2X2
|
||||
NULL,
|
||||
#endif
|
||||
&fwd_txfm_1d_col_cfg_dct_4, &fwd_txfm_1d_col_cfg_dct_8,
|
||||
&fwd_txfm_1d_col_cfg_dct_16, &fwd_txfm_1d_col_cfg_dct_32 },
|
||||
// ADST
|
||||
{
|
||||
#if CONFIG_CHROMA_2X2
|
||||
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 },
|
||||
#if CONFIG_EXT_TX
|
||||
// FLIPADST
|
||||
{
|
||||
#if CONFIG_CHROMA_2X2
|
||||
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 },
|
||||
// IDENTITY
|
||||
{
|
||||
#if CONFIG_CHROMA_2X2
|
||||
NULL,
|
||||
#endif
|
||||
&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
|
||||
};
|
||||
|
||||
static const TXFM_1D_CFG *fwd_txfm_row_cfg_ls[TX_TYPES_1D][TX_SIZES] = {
|
||||
// DCT
|
||||
{
|
||||
#if CONFIG_CHROMA_2X2
|
||||
NULL,
|
||||
#endif
|
||||
&fwd_txfm_1d_row_cfg_dct_4, &fwd_txfm_1d_row_cfg_dct_8,
|
||||
&fwd_txfm_1d_row_cfg_dct_16, &fwd_txfm_1d_row_cfg_dct_32 },
|
||||
// ADST
|
||||
{
|
||||
#if CONFIG_CHROMA_2X2
|
||||
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 },
|
||||
#if CONFIG_EXT_TX
|
||||
// FLIPADST
|
||||
{
|
||||
#if CONFIG_CHROMA_2X2
|
||||
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 },
|
||||
// IDENTITY
|
||||
{
|
||||
#if CONFIG_CHROMA_2X2
|
||||
NULL,
|
||||
#endif
|
||||
&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
|
||||
};
|
||||
|
||||
TXFM_2D_FLIP_CFG av1_get_fwd_txfm_cfg(TX_TYPE tx_type, TX_SIZE tx_size) {
|
||||
TXFM_2D_FLIP_CFG cfg;
|
||||
set_flip_cfg(tx_type, &cfg);
|
||||
const TX_TYPE_1D tx_type_col = vtx_tab[tx_type];
|
||||
const TX_TYPE_1D tx_type_row = htx_tab[tx_type];
|
||||
const TX_SIZE tx_size_col = txsize_vert_map[tx_size];
|
||||
const TX_SIZE tx_size_row = txsize_horz_map[tx_size];
|
||||
cfg.col_cfg = fwd_txfm_col_cfg_ls[tx_type_col][tx_size_col];
|
||||
cfg.row_cfg = fwd_txfm_row_cfg_ls[tx_type_row][tx_size_row];
|
||||
return cfg;
|
||||
}
|
||||
|
||||
#if CONFIG_TX64X64
|
||||
TXFM_2D_FLIP_CFG av1_get_fwd_txfm_32x64_cfg(TX_TYPE tx_type) {
|
||||
TXFM_2D_FLIP_CFG cfg;
|
||||
const TX_TYPE_1D tx_type_row = htx_tab[tx_type];
|
||||
const TX_SIZE tx_size_row = txsize_horz_map[TX_32X64];
|
||||
switch (tx_type) {
|
||||
case DCT_DCT:
|
||||
cfg.col_cfg = &fwd_txfm_1d_col_cfg_dct_64;
|
||||
cfg.row_cfg = fwd_txfm_row_cfg_ls[tx_type_row][tx_size_row];
|
||||
cfg.ud_flip = 0;
|
||||
cfg.lr_flip = 0;
|
||||
break;
|
||||
default: assert(0);
|
||||
}
|
||||
return cfg;
|
||||
}
|
||||
|
||||
TXFM_2D_FLIP_CFG av1_get_fwd_txfm_64x32_cfg(TX_TYPE tx_type) {
|
||||
TXFM_2D_FLIP_CFG cfg;
|
||||
const TX_TYPE_1D tx_type_col = vtx_tab[tx_type];
|
||||
const TX_SIZE tx_size_col = txsize_vert_map[TX_64X32];
|
||||
switch (tx_type) {
|
||||
case DCT_DCT:
|
||||
cfg.col_cfg = fwd_txfm_col_cfg_ls[tx_type_col][tx_size_col];
|
||||
cfg.row_cfg = &fwd_txfm_1d_row_cfg_dct_64;
|
||||
cfg.ud_flip = 0;
|
||||
cfg.lr_flip = 0;
|
||||
break;
|
||||
default: assert(0);
|
||||
}
|
||||
return cfg;
|
||||
}
|
||||
|
||||
TXFM_2D_FLIP_CFG av1_get_fwd_txfm_64x64_cfg(TX_TYPE tx_type) {
|
||||
TXFM_2D_FLIP_CFG cfg;
|
||||
switch (tx_type) {
|
||||
case DCT_DCT:
|
||||
cfg.col_cfg = &fwd_txfm_1d_col_cfg_dct_64;
|
||||
cfg.row_cfg = &fwd_txfm_1d_row_cfg_dct_64;
|
||||
cfg.ud_flip = 0;
|
||||
cfg.lr_flip = 0;
|
||||
break;
|
||||
default:
|
||||
cfg.ud_flip = 0;
|
||||
cfg.lr_flip = 0;
|
||||
assert(0);
|
||||
}
|
||||
return cfg;
|
||||
}
|
||||
#endif // CONFIG_TX64X64
|
||||
2756
third_party/aom/av1/common/av1_inv_txfm1d.c
vendored
2756
third_party/aom/av1/common/av1_inv_txfm1d.c
vendored
File diff suppressed because it is too large
Load diff
68
third_party/aom/av1/common/av1_inv_txfm1d.h
vendored
68
third_party/aom/av1/common/av1_inv_txfm1d.h
vendored
|
|
@ -18,41 +18,41 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
void av1_idct4_new(const int32_t *input, int32_t *output, const int8_t *cos_bit,
|
||||
const int8_t *stage_range);
|
||||
void av1_idct8_new(const int32_t *input, int32_t *output, const int8_t *cos_bit,
|
||||
const int8_t *stage_range);
|
||||
void av1_idct16_new(const int32_t *input, int32_t *output,
|
||||
const int8_t *cos_bit, const int8_t *stage_range);
|
||||
void av1_idct32_new(const int32_t *input, int32_t *output,
|
||||
const int8_t *cos_bit, const int8_t *stage_range);
|
||||
#if CONFIG_TX64X64
|
||||
void av1_idct64_new(const int32_t *input, int32_t *output,
|
||||
const int8_t *cos_bit, const int8_t *stage_range);
|
||||
#endif // CONFIG_TX64X64
|
||||
static INLINE int32_t clamp_value(int32_t value, int8_t bit) {
|
||||
if (bit <= 0) return value; // Do nothing for invalid clamp bit.
|
||||
const int64_t max_value = (1LL << (bit - 1)) - 1;
|
||||
const int64_t min_value = -(1LL << (bit - 1));
|
||||
return (int32_t)clamp64(value, min_value, max_value);
|
||||
}
|
||||
|
||||
void av1_iadst4_new(const int32_t *input, int32_t *output,
|
||||
const int8_t *cos_bit, const int8_t *stage_range);
|
||||
void av1_iadst8_new(const int32_t *input, int32_t *output,
|
||||
const int8_t *cos_bit, const int8_t *stage_range);
|
||||
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);
|
||||
#if CONFIG_TX64X64
|
||||
void av1_iidentity64_c(const int32_t *input, int32_t *output,
|
||||
const int8_t *cos_bit, const int8_t *stage_range);
|
||||
#endif // CONFIG_TX64X64
|
||||
#endif // CONFIG_EXT_TX
|
||||
static INLINE void clamp_buf(int32_t *buf, int32_t size, int8_t bit) {
|
||||
for (int i = 0; i < size; ++i) buf[i] = clamp_value(buf[i], bit);
|
||||
}
|
||||
|
||||
void av1_idct4_new(const int32_t *input, int32_t *output, int8_t cos_bit,
|
||||
const int8_t *stage_range);
|
||||
void av1_idct8_new(const int32_t *input, int32_t *output, int8_t cos_bit,
|
||||
const int8_t *stage_range);
|
||||
void av1_idct16_new(const int32_t *input, int32_t *output, int8_t cos_bit,
|
||||
const int8_t *stage_range);
|
||||
void av1_idct32_new(const int32_t *input, int32_t *output, int8_t cos_bit,
|
||||
const int8_t *stage_range);
|
||||
void av1_idct64_new(const int32_t *input, int32_t *output, int8_t cos_bit,
|
||||
const int8_t *stage_range);
|
||||
void av1_iadst4_new(const int32_t *input, int32_t *output, int8_t cos_bit,
|
||||
const int8_t *stage_range);
|
||||
void av1_iadst8_new(const int32_t *input, int32_t *output, int8_t cos_bit,
|
||||
const int8_t *stage_range);
|
||||
void av1_iadst16_new(const int32_t *input, int32_t *output, int8_t cos_bit,
|
||||
const int8_t *stage_range);
|
||||
void av1_iidentity4_c(const int32_t *input, int32_t *output, int8_t cos_bit,
|
||||
const int8_t *stage_range);
|
||||
void av1_iidentity8_c(const int32_t *input, int32_t *output, int8_t cos_bit,
|
||||
const int8_t *stage_range);
|
||||
void av1_iidentity16_c(const int32_t *input, int32_t *output, int8_t cos_bit,
|
||||
const int8_t *stage_range);
|
||||
void av1_iidentity32_c(const int32_t *input, int32_t *output, int8_t cos_bit,
|
||||
const int8_t *stage_range);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
376
third_party/aom/av1/common/av1_inv_txfm1d_cfg.h
vendored
376
third_party/aom/av1/common/av1_inv_txfm1d_cfg.h
vendored
|
|
@ -14,358 +14,34 @@
|
|||
#include "av1/common/av1_inv_txfm1d.h"
|
||||
|
||||
// sum of fwd_shift_##
|
||||
#if CONFIG_CHROMA_2X2
|
||||
#if CONFIG_TX64X64
|
||||
static const int8_t fwd_shift_sum[TX_SIZES] = { 3, 2, 1, 0, -2, -4 };
|
||||
#else // CONFIG_TX64X64
|
||||
static const int8_t fwd_shift_sum[TX_SIZES] = { 3, 2, 1, 0, -2 };
|
||||
#endif // CONFIG_TX64X64
|
||||
#else // CONFIG_CHROMA_2X2
|
||||
#if CONFIG_TX64X64
|
||||
static const int8_t fwd_shift_sum[TX_SIZES] = { 2, 1, 0, -2, -4 };
|
||||
#else // CONFIG_TX64X64
|
||||
static const int8_t fwd_shift_sum[TX_SIZES] = { 2, 1, 0, -2 };
|
||||
#endif // CONFIG_TX64X64
|
||||
#endif // CONFIG_CHROMA_2X2
|
||||
|
||||
// ---------------- 4x4 1D config -----------------------
|
||||
// shift
|
||||
static const int8_t inv_shift_4[2] = { 0, -4 };
|
||||
|
||||
// stage range
|
||||
static const int8_t inv_stage_range_col_dct_4[4] = { 3, 3, 2, 2 };
|
||||
static const int8_t inv_stage_range_row_dct_4[4] = { 3, 3, 3, 3 };
|
||||
static const int8_t inv_stage_range_col_adst_4[6] = { 3, 3, 3, 3, 2, 2 };
|
||||
static const int8_t inv_stage_range_row_adst_4[6] = { 3, 3, 3, 3, 3, 3 };
|
||||
static const int8_t inv_stage_range_idx_4[1] = { 0 };
|
||||
|
||||
// cos bit
|
||||
static const int8_t inv_cos_bit_col_dct_4[4] = { 13, 13, 13, 13 };
|
||||
static const int8_t inv_cos_bit_row_dct_4[4] = { 13, 13, 13, 13 };
|
||||
static const int8_t inv_cos_bit_col_adst_4[6] = { 13, 13, 13, 13, 13, 13 };
|
||||
static const int8_t inv_cos_bit_row_adst_4[6] = { 13, 13, 13, 13, 13, 13 };
|
||||
|
||||
// ---------------- 8x8 1D constants -----------------------
|
||||
// shift
|
||||
static const int8_t inv_shift_8[2] = { 0, -5 };
|
||||
|
||||
// stage range
|
||||
static const int8_t inv_stage_range_col_dct_8[6] = { 5, 5, 5, 5, 4, 4 };
|
||||
static const int8_t inv_stage_range_row_dct_8[6] = { 5, 5, 5, 5, 5, 5 };
|
||||
static const int8_t inv_stage_range_col_adst_8[8] = { 5, 5, 5, 5, 5, 5, 4, 4 };
|
||||
static const int8_t inv_stage_range_row_adst_8[8] = { 5, 5, 5, 5, 5, 5, 5, 5 };
|
||||
static const int8_t inv_stage_range_idx_8[1] = { 0 };
|
||||
|
||||
// cos bit
|
||||
static const int8_t inv_cos_bit_col_dct_8[6] = { 13, 13, 13, 13, 13, 13 };
|
||||
static const int8_t inv_cos_bit_row_dct_8[6] = { 13, 13, 13, 13, 13, 13 };
|
||||
static const int8_t inv_cos_bit_col_adst_8[8] = {
|
||||
13, 13, 13, 13, 13, 13, 13, 13
|
||||
};
|
||||
static const int8_t inv_cos_bit_row_adst_8[8] = {
|
||||
13, 13, 13, 13, 13, 13, 13, 13
|
||||
static const int8_t inv_start_range[TX_SIZES_ALL] = {
|
||||
5, // 4x4 transform
|
||||
6, // 8x8 transform
|
||||
7, // 16x16 transform
|
||||
7, // 32x32 transform
|
||||
7, // 64x64 transform
|
||||
5, // 4x8 transform
|
||||
5, // 8x4 transform
|
||||
6, // 8x16 transform
|
||||
6, // 16x8 transform
|
||||
6, // 16x32 transform
|
||||
6, // 32x16 transform
|
||||
6, // 32x64 transform
|
||||
6, // 64x32 transform
|
||||
6, // 4x16 transform
|
||||
6, // 16x4 transform
|
||||
7, // 8x32 transform
|
||||
7, // 32x8 transform
|
||||
7, // 16x64 transform
|
||||
7, // 64x16 transform
|
||||
};
|
||||
|
||||
// ---------------- 16x16 1D constants -----------------------
|
||||
// shift
|
||||
static const int8_t inv_shift_16[2] = { -1, -5 };
|
||||
extern const int8_t *inv_txfm_shift_ls[TX_SIZES_ALL];
|
||||
|
||||
// stage range
|
||||
static const int8_t inv_stage_range_col_dct_16[8] = { 7, 7, 7, 7, 7, 7, 6, 6 };
|
||||
static const int8_t inv_stage_range_row_dct_16[8] = { 7, 7, 7, 7, 7, 7, 7, 7 };
|
||||
static const int8_t inv_stage_range_col_adst_16[10] = { 7, 7, 7, 7, 7,
|
||||
7, 7, 7, 6, 6 };
|
||||
static const int8_t inv_stage_range_row_adst_16[10] = { 7, 7, 7, 7, 7,
|
||||
7, 7, 7, 7, 7 };
|
||||
static const int8_t inv_stage_range_idx_16[1] = { 0 };
|
||||
// Values in both inv_cos_bit_col and inv_cos_bit_row are always 12
|
||||
// for each valid row and col combination
|
||||
#define INV_COS_BIT 12
|
||||
extern const int8_t inv_cos_bit_col[5 /*row*/][5 /*col*/];
|
||||
extern const int8_t inv_cos_bit_row[5 /*row*/][5 /*col*/];
|
||||
|
||||
// cos bit
|
||||
static const int8_t inv_cos_bit_col_dct_16[8] = {
|
||||
13, 13, 13, 13, 13, 13, 13, 13
|
||||
};
|
||||
static const int8_t inv_cos_bit_row_dct_16[8] = {
|
||||
12, 12, 12, 12, 12, 12, 12, 12
|
||||
};
|
||||
static const int8_t inv_cos_bit_col_adst_16[10] = { 13, 13, 13, 13, 13,
|
||||
13, 13, 13, 13, 13 };
|
||||
static const int8_t inv_cos_bit_row_adst_16[10] = { 12, 12, 12, 12, 12,
|
||||
12, 12, 12, 12, 12 };
|
||||
|
||||
// ---------------- 32x32 1D constants -----------------------
|
||||
// shift
|
||||
static const int8_t inv_shift_32[2] = { -1, -5 };
|
||||
|
||||
// stage range
|
||||
static const int8_t inv_stage_range_col_dct_32[10] = { 9, 9, 9, 9, 9,
|
||||
9, 9, 9, 8, 8 };
|
||||
static const int8_t inv_stage_range_row_dct_32[10] = { 9, 9, 9, 9, 9,
|
||||
9, 9, 9, 9, 9 };
|
||||
static const int8_t inv_stage_range_col_adst_32[12] = { 9, 9, 9, 9, 9, 9,
|
||||
9, 9, 9, 9, 8, 8 };
|
||||
static const int8_t inv_stage_range_row_adst_32[12] = { 9, 9, 9, 9, 9, 9,
|
||||
9, 9, 9, 9, 9, 9 };
|
||||
static const int8_t inv_stage_range_idx_32[1] = { 0 };
|
||||
|
||||
// cos bit
|
||||
static const int8_t inv_cos_bit_col_dct_32[10] = { 13, 13, 13, 13, 13,
|
||||
13, 13, 13, 13, 13 };
|
||||
static const int8_t inv_cos_bit_row_dct_32[10] = { 12, 12, 12, 12, 12,
|
||||
12, 12, 12, 12, 12 };
|
||||
static const int8_t inv_cos_bit_col_adst_32[12] = { 13, 13, 13, 13, 13, 13,
|
||||
13, 13, 13, 13, 13, 13 };
|
||||
static const int8_t inv_cos_bit_row_adst_32[12] = { 12, 12, 12, 12, 12, 12,
|
||||
12, 12, 12, 12, 12, 12 };
|
||||
|
||||
// ---------------- 64x64 1D constants -----------------------
|
||||
// shift
|
||||
static const int8_t inv_shift_64[2] = { -1, -5 };
|
||||
|
||||
// stage range
|
||||
static const int8_t inv_stage_range_col_dct_64[12] = { 11, 11, 11, 11, 11, 11,
|
||||
11, 11, 11, 11, 10, 10 };
|
||||
static const int8_t inv_stage_range_row_dct_64[12] = { 11, 11, 11, 11, 11, 11,
|
||||
11, 11, 11, 11, 11, 11 };
|
||||
|
||||
static const int8_t inv_stage_range_idx_64[1] = { 0 };
|
||||
|
||||
// cos bit
|
||||
static const int8_t inv_cos_bit_col_dct_64[12] = { 13, 13, 13, 13, 13, 13,
|
||||
13, 13, 13, 13, 13, 13 };
|
||||
static const int8_t inv_cos_bit_row_dct_64[12] = { 12, 12, 12, 12, 12, 12,
|
||||
12, 12, 12, 12, 12, 12 };
|
||||
|
||||
// ---------------- row config inv_dct_4 ----------------
|
||||
static const TXFM_1D_CFG inv_txfm_1d_row_cfg_dct_4 = {
|
||||
4, // .txfm_size
|
||||
4, // .stage_num
|
||||
inv_shift_4, // .shift
|
||||
inv_stage_range_row_dct_4, // .stage_range
|
||||
inv_cos_bit_row_dct_4, // .cos_bit
|
||||
TXFM_TYPE_DCT4 // .txfm_type
|
||||
};
|
||||
|
||||
// ---------------- row config inv_dct_8 ----------------
|
||||
static const TXFM_1D_CFG inv_txfm_1d_row_cfg_dct_8 = {
|
||||
8, // .txfm_size
|
||||
6, // .stage_num
|
||||
inv_shift_8, // .shift
|
||||
inv_stage_range_row_dct_8, // .stage_range
|
||||
inv_cos_bit_row_dct_8, // .cos_bit_
|
||||
TXFM_TYPE_DCT8 // .txfm_type
|
||||
};
|
||||
// ---------------- row config inv_dct_16 ----------------
|
||||
static const TXFM_1D_CFG inv_txfm_1d_row_cfg_dct_16 = {
|
||||
16, // .txfm_size
|
||||
8, // .stage_num
|
||||
inv_shift_16, // .shift
|
||||
inv_stage_range_row_dct_16, // .stage_range
|
||||
inv_cos_bit_row_dct_16, // .cos_bit
|
||||
TXFM_TYPE_DCT16 // .txfm_type
|
||||
};
|
||||
|
||||
// ---------------- row config inv_dct_32 ----------------
|
||||
static const TXFM_1D_CFG inv_txfm_1d_row_cfg_dct_32 = {
|
||||
32, // .txfm_size
|
||||
10, // .stage_num
|
||||
inv_shift_32, // .shift
|
||||
inv_stage_range_row_dct_32, // .stage_range
|
||||
inv_cos_bit_row_dct_32, // .cos_bit_row
|
||||
TXFM_TYPE_DCT32 // .txfm_type
|
||||
};
|
||||
|
||||
#if CONFIG_TX64X64
|
||||
// ---------------- row config inv_dct_64 ----------------
|
||||
static const TXFM_1D_CFG inv_txfm_1d_row_cfg_dct_64 = {
|
||||
64, // .txfm_size
|
||||
12, // .stage_num
|
||||
inv_shift_64, // .shift
|
||||
inv_stage_range_row_dct_64, // .stage_range
|
||||
inv_cos_bit_row_dct_64, // .cos_bit
|
||||
TXFM_TYPE_DCT64, // .txfm_type_col
|
||||
};
|
||||
#endif // CONFIG_TX64X64
|
||||
|
||||
// ---------------- row config inv_adst_4 ----------------
|
||||
static const TXFM_1D_CFG inv_txfm_1d_row_cfg_adst_4 = {
|
||||
4, // .txfm_size
|
||||
6, // .stage_num
|
||||
inv_shift_4, // .shift
|
||||
inv_stage_range_row_adst_4, // .stage_range
|
||||
inv_cos_bit_row_adst_4, // .cos_bit
|
||||
TXFM_TYPE_ADST4, // .txfm_type
|
||||
};
|
||||
|
||||
// ---------------- row config inv_adst_8 ----------------
|
||||
static const TXFM_1D_CFG inv_txfm_1d_row_cfg_adst_8 = {
|
||||
8, // .txfm_size
|
||||
8, // .stage_num
|
||||
inv_shift_8, // .shift
|
||||
inv_stage_range_row_adst_8, // .stage_range
|
||||
inv_cos_bit_row_adst_8, // .cos_bit
|
||||
TXFM_TYPE_ADST8, // .txfm_type_col
|
||||
};
|
||||
|
||||
// ---------------- row config inv_adst_16 ----------------
|
||||
static const TXFM_1D_CFG inv_txfm_1d_row_cfg_adst_16 = {
|
||||
16, // .txfm_size
|
||||
10, // .stage_num
|
||||
inv_shift_16, // .shift
|
||||
inv_stage_range_row_adst_16, // .stage_range
|
||||
inv_cos_bit_row_adst_16, // .cos_bit
|
||||
TXFM_TYPE_ADST16, // .txfm_type
|
||||
};
|
||||
|
||||
// ---------------- row config inv_adst_32 ----------------
|
||||
static const TXFM_1D_CFG inv_txfm_1d_row_cfg_adst_32 = {
|
||||
32, // .txfm_size
|
||||
12, // .stage_num
|
||||
inv_shift_32, // .shift
|
||||
inv_stage_range_row_adst_32, // .stage_range
|
||||
inv_cos_bit_row_adst_32, // .cos_bit
|
||||
TXFM_TYPE_ADST32, // .txfm_type
|
||||
};
|
||||
|
||||
// ---------------- col config inv_dct_4 ----------------
|
||||
static const TXFM_1D_CFG inv_txfm_1d_col_cfg_dct_4 = {
|
||||
4, // .txfm_size
|
||||
4, // .stage_num
|
||||
inv_shift_4, // .shift
|
||||
inv_stage_range_col_dct_4, // .stage_range
|
||||
inv_cos_bit_col_dct_4, // .cos_bit
|
||||
TXFM_TYPE_DCT4 // .txfm_type
|
||||
};
|
||||
|
||||
// ---------------- col config inv_dct_8 ----------------
|
||||
static const TXFM_1D_CFG inv_txfm_1d_col_cfg_dct_8 = {
|
||||
8, // .txfm_size
|
||||
6, // .stage_num
|
||||
inv_shift_8, // .shift
|
||||
inv_stage_range_col_dct_8, // .stage_range
|
||||
inv_cos_bit_col_dct_8, // .cos_bit_
|
||||
TXFM_TYPE_DCT8 // .txfm_type
|
||||
};
|
||||
// ---------------- col config inv_dct_16 ----------------
|
||||
static const TXFM_1D_CFG inv_txfm_1d_col_cfg_dct_16 = {
|
||||
16, // .txfm_size
|
||||
8, // .stage_num
|
||||
inv_shift_16, // .shift
|
||||
inv_stage_range_col_dct_16, // .stage_range
|
||||
inv_cos_bit_col_dct_16, // .cos_bit
|
||||
TXFM_TYPE_DCT16 // .txfm_type
|
||||
};
|
||||
|
||||
// ---------------- col config inv_dct_32 ----------------
|
||||
static const TXFM_1D_CFG inv_txfm_1d_col_cfg_dct_32 = {
|
||||
32, // .txfm_size
|
||||
10, // .stage_num
|
||||
inv_shift_32, // .shift
|
||||
inv_stage_range_col_dct_32, // .stage_range
|
||||
inv_cos_bit_col_dct_32, // .cos_bit_col
|
||||
TXFM_TYPE_DCT32 // .txfm_type
|
||||
};
|
||||
|
||||
// ---------------- col config inv_dct_64 ----------------
|
||||
static const TXFM_1D_CFG inv_txfm_1d_col_cfg_dct_64 = {
|
||||
64, // .txfm_size
|
||||
12, // .stage_num
|
||||
inv_shift_64, // .shift
|
||||
inv_stage_range_col_dct_64, // .stage_range
|
||||
inv_cos_bit_col_dct_64, // .cos_bit
|
||||
TXFM_TYPE_DCT64, // .txfm_type_col
|
||||
};
|
||||
|
||||
// ---------------- col config inv_adst_4 ----------------
|
||||
static const TXFM_1D_CFG inv_txfm_1d_col_cfg_adst_4 = {
|
||||
4, // .txfm_size
|
||||
6, // .stage_num
|
||||
inv_shift_4, // .shift
|
||||
inv_stage_range_col_adst_4, // .stage_range
|
||||
inv_cos_bit_col_adst_4, // .cos_bit
|
||||
TXFM_TYPE_ADST4, // .txfm_type
|
||||
};
|
||||
|
||||
// ---------------- col config inv_adst_8 ----------------
|
||||
static const TXFM_1D_CFG inv_txfm_1d_col_cfg_adst_8 = {
|
||||
8, // .txfm_size
|
||||
8, // .stage_num
|
||||
inv_shift_8, // .shift
|
||||
inv_stage_range_col_adst_8, // .stage_range
|
||||
inv_cos_bit_col_adst_8, // .cos_bit
|
||||
TXFM_TYPE_ADST8, // .txfm_type_col
|
||||
};
|
||||
|
||||
// ---------------- col config inv_adst_16 ----------------
|
||||
static const TXFM_1D_CFG inv_txfm_1d_col_cfg_adst_16 = {
|
||||
16, // .txfm_size
|
||||
10, // .stage_num
|
||||
inv_shift_16, // .shift
|
||||
inv_stage_range_col_adst_16, // .stage_range
|
||||
inv_cos_bit_col_adst_16, // .cos_bit
|
||||
TXFM_TYPE_ADST16, // .txfm_type
|
||||
};
|
||||
|
||||
// ---------------- col config inv_adst_32 ----------------
|
||||
static const TXFM_1D_CFG inv_txfm_1d_col_cfg_adst_32 = {
|
||||
32, // .txfm_size
|
||||
12, // .stage_num
|
||||
inv_shift_32, // .shift
|
||||
inv_stage_range_col_adst_32, // .stage_range
|
||||
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
|
||||
inv_shift_4, // .shift
|
||||
inv_stage_range_idx_4, // .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
|
||||
inv_shift_8, // .shift
|
||||
inv_stage_range_idx_8, // .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
|
||||
inv_shift_16, // .shift
|
||||
inv_stage_range_idx_16, // .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
|
||||
inv_shift_32, // .shift
|
||||
inv_stage_range_idx_32, // .stage_range
|
||||
NULL, // .cos_bit
|
||||
TXFM_TYPE_IDENTITY32, // .txfm_type
|
||||
};
|
||||
|
||||
#if CONFIG_TX64X64
|
||||
// ---------------- row/col config inv_identity_32 ----------------
|
||||
static const TXFM_1D_CFG inv_txfm_1d_cfg_identity_64 = {
|
||||
64, // .txfm_size
|
||||
1, // .stage_num
|
||||
inv_shift_64, // .shift
|
||||
inv_stage_range_idx_64, // .stage_range
|
||||
NULL, // .cos_bit
|
||||
TXFM_TYPE_IDENTITY64, // .txfm_type
|
||||
};
|
||||
#endif // CONFIG_TX64X64
|
||||
#endif // CONFIG_EXT_TX
|
||||
#endif // AV1_INV_TXFM2D_CFG_H_
|
||||
|
|
|
|||
620
third_party/aom/av1/common/av1_inv_txfm2d.c
vendored
620
third_party/aom/av1/common/av1_inv_txfm2d.c
vendored
|
|
@ -9,218 +9,252 @@
|
|||
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
|
||||
*/
|
||||
|
||||
#include "./av1_rtcd.h"
|
||||
#include "aom_dsp/inv_txfm.h"
|
||||
#include "config/aom_dsp_rtcd.h"
|
||||
#include "config/av1_rtcd.h"
|
||||
|
||||
#include "av1/common/enums.h"
|
||||
#include "av1/common/av1_txfm.h"
|
||||
#include "av1/common/av1_inv_txfm1d.h"
|
||||
#include "av1/common/av1_inv_txfm1d_cfg.h"
|
||||
|
||||
void av1_highbd_iwht4x4_16_add_c(const tran_low_t *input, uint8_t *dest8,
|
||||
int stride, int bd) {
|
||||
/* 4-point reversible, orthonormal inverse Walsh-Hadamard in 3.5 adds,
|
||||
0.5 shifts per pixel. */
|
||||
int i;
|
||||
tran_low_t output[16];
|
||||
tran_low_t a1, b1, c1, d1, e1;
|
||||
const tran_low_t *ip = input;
|
||||
tran_low_t *op = output;
|
||||
uint16_t *dest = CONVERT_TO_SHORTPTR(dest8);
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
a1 = ip[0] >> UNIT_QUANT_SHIFT;
|
||||
c1 = ip[1] >> UNIT_QUANT_SHIFT;
|
||||
d1 = ip[2] >> UNIT_QUANT_SHIFT;
|
||||
b1 = ip[3] >> UNIT_QUANT_SHIFT;
|
||||
a1 += c1;
|
||||
d1 -= b1;
|
||||
e1 = (a1 - d1) >> 1;
|
||||
b1 = e1 - b1;
|
||||
c1 = e1 - c1;
|
||||
a1 -= b1;
|
||||
d1 += c1;
|
||||
|
||||
op[0] = a1;
|
||||
op[1] = b1;
|
||||
op[2] = c1;
|
||||
op[3] = d1;
|
||||
ip += 4;
|
||||
op += 4;
|
||||
}
|
||||
|
||||
ip = output;
|
||||
for (i = 0; i < 4; i++) {
|
||||
a1 = ip[4 * 0];
|
||||
c1 = ip[4 * 1];
|
||||
d1 = ip[4 * 2];
|
||||
b1 = ip[4 * 3];
|
||||
a1 += c1;
|
||||
d1 -= b1;
|
||||
e1 = (a1 - d1) >> 1;
|
||||
b1 = e1 - b1;
|
||||
c1 = e1 - c1;
|
||||
a1 -= b1;
|
||||
d1 += c1;
|
||||
|
||||
range_check_value(a1, bd + 1);
|
||||
range_check_value(b1, bd + 1);
|
||||
range_check_value(c1, bd + 1);
|
||||
range_check_value(d1, bd + 1);
|
||||
|
||||
dest[stride * 0] = highbd_clip_pixel_add(dest[stride * 0], a1, bd);
|
||||
dest[stride * 1] = highbd_clip_pixel_add(dest[stride * 1], b1, bd);
|
||||
dest[stride * 2] = highbd_clip_pixel_add(dest[stride * 2], c1, bd);
|
||||
dest[stride * 3] = highbd_clip_pixel_add(dest[stride * 3], d1, bd);
|
||||
|
||||
ip++;
|
||||
dest++;
|
||||
}
|
||||
}
|
||||
|
||||
void av1_highbd_iwht4x4_1_add_c(const tran_low_t *in, uint8_t *dest8,
|
||||
int dest_stride, int bd) {
|
||||
int i;
|
||||
tran_low_t a1, e1;
|
||||
tran_low_t tmp[4];
|
||||
const tran_low_t *ip = in;
|
||||
tran_low_t *op = tmp;
|
||||
uint16_t *dest = CONVERT_TO_SHORTPTR(dest8);
|
||||
(void)bd;
|
||||
|
||||
a1 = ip[0] >> UNIT_QUANT_SHIFT;
|
||||
e1 = a1 >> 1;
|
||||
a1 -= e1;
|
||||
op[0] = a1;
|
||||
op[1] = op[2] = op[3] = e1;
|
||||
|
||||
ip = tmp;
|
||||
for (i = 0; i < 4; i++) {
|
||||
e1 = ip[0] >> 1;
|
||||
a1 = ip[0] - e1;
|
||||
dest[dest_stride * 0] =
|
||||
highbd_clip_pixel_add(dest[dest_stride * 0], a1, bd);
|
||||
dest[dest_stride * 1] =
|
||||
highbd_clip_pixel_add(dest[dest_stride * 1], e1, bd);
|
||||
dest[dest_stride * 2] =
|
||||
highbd_clip_pixel_add(dest[dest_stride * 2], e1, bd);
|
||||
dest[dest_stride * 3] =
|
||||
highbd_clip_pixel_add(dest[dest_stride * 3], e1, bd);
|
||||
ip++;
|
||||
dest++;
|
||||
}
|
||||
}
|
||||
|
||||
static INLINE TxfmFunc inv_txfm_type_to_func(TXFM_TYPE txfm_type) {
|
||||
switch (txfm_type) {
|
||||
case TXFM_TYPE_DCT4: return av1_idct4_new;
|
||||
case TXFM_TYPE_DCT8: return av1_idct8_new;
|
||||
case TXFM_TYPE_DCT16: return av1_idct16_new;
|
||||
case TXFM_TYPE_DCT32: return av1_idct32_new;
|
||||
#if CONFIG_TX64X64
|
||||
case TXFM_TYPE_DCT64: return av1_idct64_new;
|
||||
#endif // CONFIG_TX64X64
|
||||
case TXFM_TYPE_ADST4: return av1_iadst4_new;
|
||||
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;
|
||||
#if CONFIG_TX64X64
|
||||
case TXFM_TYPE_IDENTITY64: return av1_iidentity64_c;
|
||||
#endif // CONFIG_TX64X64
|
||||
#endif // CONFIG_EXT_TX
|
||||
default: assert(0); return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static const TXFM_1D_CFG *inv_txfm_col_cfg_ls[TX_TYPES_1D][TX_SIZES] = {
|
||||
// DCT
|
||||
{
|
||||
#if CONFIG_CHROMA_2X2
|
||||
NULL,
|
||||
#endif
|
||||
&inv_txfm_1d_col_cfg_dct_4, &inv_txfm_1d_col_cfg_dct_8,
|
||||
&inv_txfm_1d_col_cfg_dct_16, &inv_txfm_1d_col_cfg_dct_32,
|
||||
#if CONFIG_TX64X64
|
||||
&inv_txfm_1d_col_cfg_dct_64
|
||||
#endif // CONFIG_TX64X64
|
||||
},
|
||||
// ADST
|
||||
{
|
||||
#if CONFIG_CHROMA_2X2
|
||||
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,
|
||||
#if CONFIG_TX64X64
|
||||
NULL
|
||||
#endif // CONFIG_TX64X64
|
||||
},
|
||||
#if CONFIG_EXT_TX
|
||||
// FLIPADST
|
||||
{
|
||||
#if CONFIG_CHROMA_2X2
|
||||
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,
|
||||
#if CONFIG_TX64X64
|
||||
NULL
|
||||
#endif // CONFIG_TX64X64
|
||||
},
|
||||
// IDENTITY
|
||||
{
|
||||
#if CONFIG_CHROMA_2X2
|
||||
NULL,
|
||||
#endif
|
||||
&inv_txfm_1d_cfg_identity_4, &inv_txfm_1d_cfg_identity_8,
|
||||
&inv_txfm_1d_cfg_identity_16, &inv_txfm_1d_cfg_identity_32,
|
||||
#if CONFIG_TX64X64
|
||||
&inv_txfm_1d_cfg_identity_64
|
||||
#endif // CONFIG_TX64X64
|
||||
},
|
||||
#endif // CONFIG_EXT_TX
|
||||
static const int8_t inv_shift_4x4[2] = { 0, -4 };
|
||||
static const int8_t inv_shift_8x8[2] = { -1, -4 };
|
||||
static const int8_t inv_shift_16x16[2] = { -2, -4 };
|
||||
static const int8_t inv_shift_32x32[2] = { -2, -4 };
|
||||
static const int8_t inv_shift_64x64[2] = { -2, -4 };
|
||||
static const int8_t inv_shift_4x8[2] = { 0, -4 };
|
||||
static const int8_t inv_shift_8x4[2] = { 0, -4 };
|
||||
static const int8_t inv_shift_8x16[2] = { -1, -4 };
|
||||
static const int8_t inv_shift_16x8[2] = { -1, -4 };
|
||||
static const int8_t inv_shift_16x32[2] = { -1, -4 };
|
||||
static const int8_t inv_shift_32x16[2] = { -1, -4 };
|
||||
static const int8_t inv_shift_32x64[2] = { -1, -4 };
|
||||
static const int8_t inv_shift_64x32[2] = { -1, -4 };
|
||||
static const int8_t inv_shift_4x16[2] = { -1, -4 };
|
||||
static const int8_t inv_shift_16x4[2] = { -1, -4 };
|
||||
static const int8_t inv_shift_8x32[2] = { -2, -4 };
|
||||
static const int8_t inv_shift_32x8[2] = { -2, -4 };
|
||||
static const int8_t inv_shift_16x64[2] = { -2, -4 };
|
||||
static const int8_t inv_shift_64x16[2] = { -2, -4 };
|
||||
|
||||
const int8_t *inv_txfm_shift_ls[TX_SIZES_ALL] = {
|
||||
inv_shift_4x4, inv_shift_8x8, inv_shift_16x16, inv_shift_32x32,
|
||||
inv_shift_64x64, inv_shift_4x8, inv_shift_8x4, inv_shift_8x16,
|
||||
inv_shift_16x8, inv_shift_16x32, inv_shift_32x16, inv_shift_32x64,
|
||||
inv_shift_64x32, inv_shift_4x16, inv_shift_16x4, inv_shift_8x32,
|
||||
inv_shift_32x8, inv_shift_16x64, inv_shift_64x16,
|
||||
};
|
||||
|
||||
static const TXFM_1D_CFG *inv_txfm_row_cfg_ls[TX_TYPES_1D][TX_SIZES] = {
|
||||
// DCT
|
||||
{
|
||||
#if CONFIG_CHROMA_2X2
|
||||
NULL,
|
||||
#endif
|
||||
&inv_txfm_1d_row_cfg_dct_4, &inv_txfm_1d_row_cfg_dct_8,
|
||||
&inv_txfm_1d_row_cfg_dct_16, &inv_txfm_1d_row_cfg_dct_32,
|
||||
#if CONFIG_TX64X64
|
||||
&inv_txfm_1d_row_cfg_dct_64,
|
||||
#endif // CONFIG_TX64X64
|
||||
},
|
||||
// ADST
|
||||
{
|
||||
#if CONFIG_CHROMA_2X2
|
||||
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,
|
||||
#if CONFIG_TX64X64
|
||||
NULL
|
||||
#endif // CONFIG_TX64X64
|
||||
},
|
||||
#if CONFIG_EXT_TX
|
||||
// FLIPADST
|
||||
{
|
||||
#if CONFIG_CHROMA_2X2
|
||||
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,
|
||||
#if CONFIG_TX64X64
|
||||
NULL
|
||||
#endif // CONFIG_TX64X64
|
||||
},
|
||||
// IDENTITY
|
||||
{
|
||||
#if CONFIG_CHROMA_2X2
|
||||
NULL,
|
||||
#endif
|
||||
&inv_txfm_1d_cfg_identity_4, &inv_txfm_1d_cfg_identity_8,
|
||||
&inv_txfm_1d_cfg_identity_16, &inv_txfm_1d_cfg_identity_32,
|
||||
#if CONFIG_TX64X64
|
||||
&inv_txfm_1d_cfg_identity_64
|
||||
#endif // CONFIG_TX64X64
|
||||
},
|
||||
#endif // CONFIG_EXT_TX
|
||||
};
|
||||
/* clang-format off */
|
||||
const int8_t inv_cos_bit_col[MAX_TXWH_IDX] // txw_idx
|
||||
[MAX_TXWH_IDX] = { // txh_idx
|
||||
{ INV_COS_BIT, INV_COS_BIT, INV_COS_BIT, 0, 0 },
|
||||
{ INV_COS_BIT, INV_COS_BIT, INV_COS_BIT, INV_COS_BIT, 0 },
|
||||
{ INV_COS_BIT, INV_COS_BIT, INV_COS_BIT, INV_COS_BIT, INV_COS_BIT },
|
||||
{ 0, INV_COS_BIT, INV_COS_BIT, INV_COS_BIT, INV_COS_BIT },
|
||||
{ 0, 0, INV_COS_BIT, INV_COS_BIT, INV_COS_BIT }
|
||||
};
|
||||
|
||||
TXFM_2D_FLIP_CFG av1_get_inv_txfm_cfg(TX_TYPE tx_type, TX_SIZE tx_size) {
|
||||
TXFM_2D_FLIP_CFG cfg;
|
||||
set_flip_cfg(tx_type, &cfg);
|
||||
const TX_TYPE_1D tx_type_col = vtx_tab[tx_type];
|
||||
const TX_TYPE_1D tx_type_row = htx_tab[tx_type];
|
||||
const TX_SIZE tx_size_col = txsize_vert_map[tx_size];
|
||||
const TX_SIZE tx_size_row = txsize_horz_map[tx_size];
|
||||
cfg.col_cfg = inv_txfm_col_cfg_ls[tx_type_col][tx_size_col];
|
||||
cfg.row_cfg = inv_txfm_row_cfg_ls[tx_type_row][tx_size_row];
|
||||
return cfg;
|
||||
}
|
||||
const int8_t inv_cos_bit_row[MAX_TXWH_IDX] // txw_idx
|
||||
[MAX_TXWH_IDX] = { // txh_idx
|
||||
{ INV_COS_BIT, INV_COS_BIT, INV_COS_BIT, 0, 0 },
|
||||
{ INV_COS_BIT, INV_COS_BIT, INV_COS_BIT, INV_COS_BIT, 0 },
|
||||
{ INV_COS_BIT, INV_COS_BIT, INV_COS_BIT, INV_COS_BIT, INV_COS_BIT },
|
||||
{ 0, INV_COS_BIT, INV_COS_BIT, INV_COS_BIT, INV_COS_BIT },
|
||||
{ 0, 0, INV_COS_BIT, INV_COS_BIT, INV_COS_BIT }
|
||||
};
|
||||
/* clang-format on */
|
||||
|
||||
#if CONFIG_TX64X64
|
||||
TXFM_2D_FLIP_CFG av1_get_inv_txfm_64x64_cfg(TX_TYPE tx_type) {
|
||||
TXFM_2D_FLIP_CFG cfg = { 0, 0, NULL, NULL };
|
||||
switch (tx_type) {
|
||||
case DCT_DCT:
|
||||
cfg.col_cfg = &inv_txfm_1d_col_cfg_dct_64;
|
||||
cfg.row_cfg = &inv_txfm_1d_row_cfg_dct_64;
|
||||
set_flip_cfg(tx_type, &cfg);
|
||||
break;
|
||||
default: assert(0);
|
||||
const int8_t iadst4_range[7] = { 0, 1, 0, 0, 0, 0, 0 };
|
||||
|
||||
void av1_get_inv_txfm_cfg(TX_TYPE tx_type, TX_SIZE tx_size,
|
||||
TXFM_2D_FLIP_CFG *cfg) {
|
||||
assert(cfg != NULL);
|
||||
cfg->tx_size = tx_size;
|
||||
set_flip_cfg(tx_type, cfg);
|
||||
av1_zero(cfg->stage_range_col);
|
||||
av1_zero(cfg->stage_range_row);
|
||||
set_flip_cfg(tx_type, cfg);
|
||||
const TX_TYPE_1D tx_type_1d_col = vtx_tab[tx_type];
|
||||
const TX_TYPE_1D tx_type_1d_row = htx_tab[tx_type];
|
||||
cfg->shift = inv_txfm_shift_ls[tx_size];
|
||||
const int txw_idx = get_txw_idx(tx_size);
|
||||
const int txh_idx = get_txh_idx(tx_size);
|
||||
cfg->cos_bit_col = inv_cos_bit_col[txw_idx][txh_idx];
|
||||
cfg->cos_bit_row = inv_cos_bit_row[txw_idx][txh_idx];
|
||||
cfg->txfm_type_col = av1_txfm_type_ls[txh_idx][tx_type_1d_col];
|
||||
if (cfg->txfm_type_col == TXFM_TYPE_ADST4) {
|
||||
memcpy(cfg->stage_range_col, iadst4_range, sizeof(iadst4_range));
|
||||
}
|
||||
return cfg;
|
||||
}
|
||||
|
||||
TXFM_2D_FLIP_CFG av1_get_inv_txfm_32x64_cfg(int tx_type) {
|
||||
TXFM_2D_FLIP_CFG cfg = { 0, 0, NULL, NULL };
|
||||
switch (tx_type) {
|
||||
case DCT_DCT:
|
||||
cfg.col_cfg = &inv_txfm_1d_col_cfg_dct_64;
|
||||
cfg.row_cfg = &inv_txfm_1d_row_cfg_dct_32;
|
||||
set_flip_cfg(tx_type, &cfg);
|
||||
break;
|
||||
default: assert(0);
|
||||
cfg->txfm_type_row = av1_txfm_type_ls[txw_idx][tx_type_1d_row];
|
||||
if (cfg->txfm_type_row == TXFM_TYPE_ADST4) {
|
||||
memcpy(cfg->stage_range_row, iadst4_range, sizeof(iadst4_range));
|
||||
}
|
||||
return cfg;
|
||||
cfg->stage_num_col = av1_txfm_stage_num_list[cfg->txfm_type_col];
|
||||
cfg->stage_num_row = av1_txfm_stage_num_list[cfg->txfm_type_row];
|
||||
}
|
||||
|
||||
TXFM_2D_FLIP_CFG av1_get_inv_txfm_64x32_cfg(int tx_type) {
|
||||
TXFM_2D_FLIP_CFG cfg = { 0, 0, NULL, NULL };
|
||||
switch (tx_type) {
|
||||
case DCT_DCT:
|
||||
cfg.col_cfg = &inv_txfm_1d_col_cfg_dct_32;
|
||||
cfg.row_cfg = &inv_txfm_1d_row_cfg_dct_64;
|
||||
set_flip_cfg(tx_type, &cfg);
|
||||
break;
|
||||
default: assert(0);
|
||||
}
|
||||
return cfg;
|
||||
}
|
||||
#endif // CONFIG_TX64X64
|
||||
|
||||
void av1_gen_inv_stage_range(int8_t *stage_range_col, int8_t *stage_range_row,
|
||||
const TXFM_2D_FLIP_CFG *cfg, int8_t fwd_shift,
|
||||
const TXFM_2D_FLIP_CFG *cfg, TX_SIZE tx_size,
|
||||
int bd) {
|
||||
// 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.
|
||||
const int txfm_size_col = cfg->row_cfg->txfm_size;
|
||||
const int txfm_size_row = cfg->col_cfg->txfm_size;
|
||||
// Take the shift from the larger dimension in the rectangular case.
|
||||
const int8_t *shift = (txfm_size_col > txfm_size_row) ? cfg->row_cfg->shift
|
||||
: cfg->col_cfg->shift;
|
||||
// i < MAX_TXFM_STAGE_NUM will mute above array bounds warning
|
||||
for (int i = 0; i < cfg->row_cfg->stage_num && i < MAX_TXFM_STAGE_NUM; ++i) {
|
||||
stage_range_row[i] = cfg->row_cfg->stage_range[i] + fwd_shift + bd + 1;
|
||||
const int fwd_shift = inv_start_range[tx_size];
|
||||
const int8_t *shift = cfg->shift;
|
||||
int8_t opt_range_row, opt_range_col;
|
||||
if (bd == 8) {
|
||||
opt_range_row = 16;
|
||||
opt_range_col = 16;
|
||||
} else if (bd == 10) {
|
||||
opt_range_row = 18;
|
||||
opt_range_col = 16;
|
||||
} else {
|
||||
assert(bd == 12);
|
||||
opt_range_row = 20;
|
||||
opt_range_col = 18;
|
||||
}
|
||||
// i < MAX_TXFM_STAGE_NUM will mute above array bounds warning
|
||||
for (int i = 0; i < cfg->col_cfg->stage_num && i < MAX_TXFM_STAGE_NUM; ++i) {
|
||||
stage_range_col[i] =
|
||||
cfg->col_cfg->stage_range[i] + fwd_shift + shift[0] + bd + 1;
|
||||
for (int i = 0; i < cfg->stage_num_row && i < MAX_TXFM_STAGE_NUM; ++i) {
|
||||
int real_range_row = cfg->stage_range_row[i] + fwd_shift + bd + 1;
|
||||
(void)real_range_row;
|
||||
if (cfg->txfm_type_row == TXFM_TYPE_ADST4 && i == 1) {
|
||||
// the adst4 may use 1 extra bit on top of opt_range_row at stage 1
|
||||
// so opt_range_col >= real_range_col will not hold
|
||||
stage_range_row[i] = opt_range_row;
|
||||
} else {
|
||||
assert(opt_range_row >= real_range_row);
|
||||
stage_range_row[i] = opt_range_row;
|
||||
}
|
||||
}
|
||||
// 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) {
|
||||
int real_range_col =
|
||||
cfg->stage_range_col[i] + fwd_shift + shift[0] + bd + 1;
|
||||
(void)real_range_col;
|
||||
if (cfg->txfm_type_col == TXFM_TYPE_ADST4 && i == 1) {
|
||||
// the adst4 may use 1 extra bit on top of opt_range_row at stage 1
|
||||
// so opt_range_col >= real_range_col will not hold
|
||||
stage_range_col[i] = opt_range_col;
|
||||
} else {
|
||||
assert(opt_range_col >= real_range_col);
|
||||
stage_range_col[i] = opt_range_col;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static INLINE void inv_txfm2d_add_c(const int32_t *input, uint16_t *output,
|
||||
int stride, TXFM_2D_FLIP_CFG *cfg,
|
||||
int32_t *txfm_buf, int8_t fwd_shift,
|
||||
int32_t *txfm_buf, TX_SIZE tx_size,
|
||||
int bd) {
|
||||
// Note when assigning txfm_size_col, we use the txfm_size from the
|
||||
// row configuration and vice versa. This is intentionally done to
|
||||
|
|
@ -228,39 +262,48 @@ static INLINE void inv_txfm2d_add_c(const int32_t *input, uint16_t *output,
|
|||
// 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.
|
||||
const int txfm_size_col = cfg->row_cfg->txfm_size;
|
||||
const int txfm_size_row = cfg->col_cfg->txfm_size;
|
||||
const int txfm_size_col = tx_size_wide[cfg->tx_size];
|
||||
const int txfm_size_row = tx_size_high[cfg->tx_size];
|
||||
// Take the shift from the larger dimension in the rectangular case.
|
||||
const int8_t *shift = (txfm_size_col > txfm_size_row) ? cfg->row_cfg->shift
|
||||
: cfg->col_cfg->shift;
|
||||
const int8_t *shift = cfg->shift;
|
||||
const int rect_type = get_rect_tx_log_ratio(txfm_size_col, txfm_size_row);
|
||||
int8_t stage_range_row[MAX_TXFM_STAGE_NUM];
|
||||
int8_t stage_range_col[MAX_TXFM_STAGE_NUM];
|
||||
assert(cfg->row_cfg->stage_num <= MAX_TXFM_STAGE_NUM);
|
||||
assert(cfg->col_cfg->stage_num <= MAX_TXFM_STAGE_NUM);
|
||||
av1_gen_inv_stage_range(stage_range_col, stage_range_row, cfg, fwd_shift, bd);
|
||||
assert(cfg->stage_num_row <= MAX_TXFM_STAGE_NUM);
|
||||
assert(cfg->stage_num_col <= MAX_TXFM_STAGE_NUM);
|
||||
av1_gen_inv_stage_range(stage_range_col, stage_range_row, cfg, tx_size, bd);
|
||||
|
||||
const int8_t *cos_bit_col = cfg->col_cfg->cos_bit;
|
||||
const int8_t *cos_bit_row = cfg->row_cfg->cos_bit;
|
||||
const TxfmFunc txfm_func_col = inv_txfm_type_to_func(cfg->col_cfg->txfm_type);
|
||||
const TxfmFunc txfm_func_row = inv_txfm_type_to_func(cfg->row_cfg->txfm_type);
|
||||
const int8_t cos_bit_col = cfg->cos_bit_col;
|
||||
const int8_t cos_bit_row = cfg->cos_bit_row;
|
||||
const TxfmFunc txfm_func_col = inv_txfm_type_to_func(cfg->txfm_type_col);
|
||||
const TxfmFunc txfm_func_row = inv_txfm_type_to_func(cfg->txfm_type_row);
|
||||
|
||||
// txfm_buf's length is txfm_size_row * txfm_size_col + 2 * txfm_size_row
|
||||
// txfm_buf's length is txfm_size_row * txfm_size_col + 2 *
|
||||
// AOMMAX(txfm_size_row, txfm_size_col)
|
||||
// it is used for intermediate data buffering
|
||||
const int buf_offset = AOMMAX(txfm_size_row, txfm_size_col);
|
||||
int32_t *temp_in = txfm_buf;
|
||||
int32_t *temp_out = temp_in + txfm_size_row;
|
||||
int32_t *buf = temp_out + txfm_size_row;
|
||||
int32_t *temp_out = temp_in + buf_offset;
|
||||
int32_t *buf = temp_out + buf_offset;
|
||||
int32_t *buf_ptr = buf;
|
||||
int c, r;
|
||||
|
||||
// Rows
|
||||
for (r = 0; r < txfm_size_row; ++r) {
|
||||
txfm_func_row(input, buf_ptr, cos_bit_row, stage_range_row);
|
||||
round_shift_array(buf_ptr, txfm_size_col, -shift[0]);
|
||||
// Multiply everything by Sqrt2 if the transform is rectangular
|
||||
if (txfm_size_row != txfm_size_col) {
|
||||
for (c = 0; c < txfm_size_col; ++c)
|
||||
buf_ptr[c] = (int32_t)dct_const_round_shift(buf_ptr[c] * Sqrt2);
|
||||
if (abs(rect_type) == 1) {
|
||||
for (c = 0; c < txfm_size_col; ++c) {
|
||||
temp_in[c] = round_shift((int64_t)input[c] * NewInvSqrt2, NewSqrt2Bits);
|
||||
}
|
||||
clamp_buf(temp_in, txfm_size_col, bd + 8);
|
||||
txfm_func_row(temp_in, buf_ptr, cos_bit_row, stage_range_row);
|
||||
} else {
|
||||
for (c = 0; c < txfm_size_col; ++c) {
|
||||
temp_in[c] = input[c];
|
||||
}
|
||||
clamp_buf(temp_in, txfm_size_col, bd + 8);
|
||||
txfm_func_row(temp_in, buf_ptr, cos_bit_row, stage_range_row);
|
||||
}
|
||||
av1_round_shift_array(buf_ptr, txfm_size_col, -shift[0]);
|
||||
input += txfm_size_col;
|
||||
buf_ptr += txfm_size_col;
|
||||
}
|
||||
|
|
@ -275,8 +318,9 @@ static INLINE void inv_txfm2d_add_c(const int32_t *input, uint16_t *output,
|
|||
for (r = 0; r < txfm_size_row; ++r)
|
||||
temp_in[r] = buf[r * txfm_size_col + (txfm_size_col - c - 1)];
|
||||
}
|
||||
clamp_buf(temp_in, txfm_size_row, AOMMAX(bd + 6, 16));
|
||||
txfm_func_col(temp_in, temp_out, cos_bit_col, stage_range_col);
|
||||
round_shift_array(temp_out, txfm_size_row, -shift[1]);
|
||||
av1_round_shift_array(temp_out, txfm_size_row, -shift[1]);
|
||||
if (cfg->ud_flip == 0) {
|
||||
for (r = 0; r < txfm_size_row; ++r) {
|
||||
output[r * stride + c] =
|
||||
|
|
@ -296,156 +340,166 @@ static INLINE void inv_txfm2d_add_facade(const int32_t *input, uint16_t *output,
|
|||
int stride, int32_t *txfm_buf,
|
||||
TX_TYPE tx_type, TX_SIZE tx_size,
|
||||
int bd) {
|
||||
TXFM_2D_FLIP_CFG cfg = av1_get_inv_txfm_cfg(tx_type, tx_size);
|
||||
TX_SIZE tx_size_sqr = txsize_sqr_map[tx_size];
|
||||
inv_txfm2d_add_c(input, output, stride, &cfg, txfm_buf,
|
||||
fwd_shift_sum[tx_size_sqr], bd);
|
||||
TXFM_2D_FLIP_CFG cfg;
|
||||
av1_get_inv_txfm_cfg(tx_type, tx_size, &cfg);
|
||||
// Forward shift sum uses larger square size, to be consistent with what
|
||||
// av1_gen_inv_stage_range() does for inverse shifts.
|
||||
inv_txfm2d_add_c(input, output, stride, &cfg, txfm_buf, tx_size, bd);
|
||||
}
|
||||
|
||||
void av1_inv_txfm2d_add_4x8_c(const int32_t *input, uint16_t *output,
|
||||
int stride, TX_TYPE tx_type, int bd) {
|
||||
int txfm_buf[4 * 8 + 8 + 8];
|
||||
DECLARE_ALIGNED(32, int, txfm_buf[4 * 8 + 8 + 8]);
|
||||
inv_txfm2d_add_facade(input, output, stride, txfm_buf, tx_type, TX_4X8, bd);
|
||||
}
|
||||
|
||||
void av1_inv_txfm2d_add_8x4_c(const int32_t *input, uint16_t *output,
|
||||
int stride, TX_TYPE tx_type, int bd) {
|
||||
#if CONFIG_TXMG
|
||||
int txfm_buf[8 * 4 + 8 + 8];
|
||||
int32_t rinput[8 * 4];
|
||||
uint16_t routput[8 * 4];
|
||||
TX_SIZE tx_size = TX_8X4;
|
||||
TX_SIZE rtx_size = av1_rotate_tx_size(tx_size);
|
||||
TX_TYPE rtx_type = av1_rotate_tx_type(tx_type);
|
||||
int w = tx_size_wide[tx_size];
|
||||
int h = tx_size_high[tx_size];
|
||||
int rw = h;
|
||||
int rh = w;
|
||||
transpose_int32(rinput, rw, input, w, w, h);
|
||||
transpose_uint16(routput, rw, output, stride, w, h);
|
||||
inv_txfm2d_add_facade(rinput, routput, rw, txfm_buf, rtx_type, rtx_size, bd);
|
||||
transpose_uint16(output, stride, routput, rw, rw, rh);
|
||||
#else
|
||||
int txfm_buf[8 * 4 + 4 + 4];
|
||||
DECLARE_ALIGNED(32, int, txfm_buf[8 * 4 + 8 + 8]);
|
||||
inv_txfm2d_add_facade(input, output, stride, txfm_buf, tx_type, TX_8X4, bd);
|
||||
#endif
|
||||
}
|
||||
|
||||
void av1_inv_txfm2d_add_8x16_c(const int32_t *input, uint16_t *output,
|
||||
int stride, TX_TYPE tx_type, int bd) {
|
||||
int txfm_buf[8 * 16 + 16 + 16];
|
||||
DECLARE_ALIGNED(32, int, txfm_buf[8 * 16 + 16 + 16]);
|
||||
inv_txfm2d_add_facade(input, output, stride, txfm_buf, tx_type, TX_8X16, bd);
|
||||
}
|
||||
|
||||
void av1_inv_txfm2d_add_16x8_c(const int32_t *input, uint16_t *output,
|
||||
int stride, TX_TYPE tx_type, int bd) {
|
||||
#if CONFIG_TXMG
|
||||
int txfm_buf[16 * 8 + 16 + 16];
|
||||
int32_t rinput[16 * 8];
|
||||
uint16_t routput[16 * 8];
|
||||
TX_SIZE tx_size = TX_16X8;
|
||||
TX_SIZE rtx_size = av1_rotate_tx_size(tx_size);
|
||||
TX_TYPE rtx_type = av1_rotate_tx_type(tx_type);
|
||||
int w = tx_size_wide[tx_size];
|
||||
int h = tx_size_high[tx_size];
|
||||
int rw = h;
|
||||
int rh = w;
|
||||
transpose_int32(rinput, rw, input, w, w, h);
|
||||
transpose_uint16(routput, rw, output, stride, w, h);
|
||||
inv_txfm2d_add_facade(rinput, routput, rw, txfm_buf, rtx_type, rtx_size, bd);
|
||||
transpose_uint16(output, stride, routput, rw, rw, rh);
|
||||
#else
|
||||
int txfm_buf[16 * 8 + 8 + 8];
|
||||
DECLARE_ALIGNED(32, int, txfm_buf[16 * 8 + 16 + 16]);
|
||||
inv_txfm2d_add_facade(input, output, stride, txfm_buf, tx_type, TX_16X8, bd);
|
||||
#endif
|
||||
}
|
||||
|
||||
void av1_inv_txfm2d_add_16x32_c(const int32_t *input, uint16_t *output,
|
||||
int stride, TX_TYPE tx_type, int bd) {
|
||||
int txfm_buf[16 * 32 + 32 + 32];
|
||||
DECLARE_ALIGNED(32, int, txfm_buf[16 * 32 + 32 + 32]);
|
||||
inv_txfm2d_add_facade(input, output, stride, txfm_buf, tx_type, TX_16X32, bd);
|
||||
}
|
||||
|
||||
void av1_inv_txfm2d_add_32x16_c(const int32_t *input, uint16_t *output,
|
||||
int stride, TX_TYPE tx_type, int bd) {
|
||||
#if CONFIG_TXMG
|
||||
int txfm_buf[32 * 16 + 32 + 32];
|
||||
int32_t rinput[32 * 16];
|
||||
uint16_t routput[32 * 16];
|
||||
TX_SIZE tx_size = TX_32X16;
|
||||
TX_SIZE rtx_size = av1_rotate_tx_size(tx_size);
|
||||
TX_TYPE rtx_type = av1_rotate_tx_type(tx_type);
|
||||
int w = tx_size_wide[tx_size];
|
||||
int h = tx_size_high[tx_size];
|
||||
int rw = h;
|
||||
int rh = w;
|
||||
transpose_int32(rinput, rw, input, w, w, h);
|
||||
transpose_uint16(routput, rw, output, stride, w, h);
|
||||
inv_txfm2d_add_facade(rinput, routput, rw, txfm_buf, rtx_type, rtx_size, bd);
|
||||
transpose_uint16(output, stride, routput, rw, rw, rh);
|
||||
#else
|
||||
int txfm_buf[32 * 16 + 16 + 16];
|
||||
DECLARE_ALIGNED(32, int, txfm_buf[32 * 16 + 32 + 32]);
|
||||
inv_txfm2d_add_facade(input, output, stride, txfm_buf, tx_type, TX_32X16, bd);
|
||||
#endif
|
||||
}
|
||||
|
||||
void av1_inv_txfm2d_add_4x4_c(const int32_t *input, uint16_t *output,
|
||||
int stride, TX_TYPE tx_type, int bd) {
|
||||
int txfm_buf[4 * 4 + 4 + 4];
|
||||
DECLARE_ALIGNED(32, int, txfm_buf[4 * 4 + 4 + 4]);
|
||||
inv_txfm2d_add_facade(input, output, stride, txfm_buf, tx_type, TX_4X4, bd);
|
||||
}
|
||||
|
||||
void av1_inv_txfm2d_add_8x8_c(const int32_t *input, uint16_t *output,
|
||||
int stride, TX_TYPE tx_type, int bd) {
|
||||
int txfm_buf[8 * 8 + 8 + 8];
|
||||
DECLARE_ALIGNED(32, int, txfm_buf[8 * 8 + 8 + 8]);
|
||||
inv_txfm2d_add_facade(input, output, stride, txfm_buf, tx_type, TX_8X8, bd);
|
||||
}
|
||||
|
||||
void av1_inv_txfm2d_add_16x16_c(const int32_t *input, uint16_t *output,
|
||||
int stride, TX_TYPE tx_type, int bd) {
|
||||
int txfm_buf[16 * 16 + 16 + 16];
|
||||
DECLARE_ALIGNED(32, int, txfm_buf[16 * 16 + 16 + 16]);
|
||||
inv_txfm2d_add_facade(input, output, stride, txfm_buf, tx_type, TX_16X16, bd);
|
||||
}
|
||||
|
||||
void av1_inv_txfm2d_add_32x32_c(const int32_t *input, uint16_t *output,
|
||||
int stride, TX_TYPE tx_type, int bd) {
|
||||
int txfm_buf[32 * 32 + 32 + 32];
|
||||
DECLARE_ALIGNED(32, int, txfm_buf[32 * 32 + 32 + 32]);
|
||||
inv_txfm2d_add_facade(input, output, stride, txfm_buf, tx_type, TX_32X32, bd);
|
||||
}
|
||||
|
||||
#if CONFIG_TX64X64
|
||||
void av1_inv_txfm2d_add_64x64_c(const int32_t *input, uint16_t *output,
|
||||
int stride, TX_TYPE tx_type, int bd) {
|
||||
int txfm_buf[64 * 64 + 64 + 64];
|
||||
inv_txfm2d_add_facade(input, output, stride, txfm_buf, tx_type, TX_64X64, bd);
|
||||
// TODO(urvang): Can the same array be reused, instead of using a new array?
|
||||
// Remap 32x32 input into a modified 64x64 by:
|
||||
// - Copying over these values in top-left 32x32 locations.
|
||||
// - Setting the rest of the locations to 0.
|
||||
int32_t mod_input[64 * 64];
|
||||
for (int row = 0; row < 32; ++row) {
|
||||
memcpy(mod_input + row * 64, input + row * 32, 32 * sizeof(*mod_input));
|
||||
memset(mod_input + row * 64 + 32, 0, 32 * sizeof(*mod_input));
|
||||
}
|
||||
memset(mod_input + 32 * 64, 0, 32 * 64 * sizeof(*mod_input));
|
||||
DECLARE_ALIGNED(32, int, txfm_buf[64 * 64 + 64 + 64]);
|
||||
inv_txfm2d_add_facade(mod_input, output, stride, txfm_buf, tx_type, TX_64X64,
|
||||
bd);
|
||||
}
|
||||
|
||||
void av1_inv_txfm2d_add_64x32_c(const int32_t *input, uint16_t *output,
|
||||
int stride, TX_TYPE tx_type, int bd) {
|
||||
#if CONFIG_TXMG
|
||||
int txfm_buf[64 * 32 + 64 + 64];
|
||||
int32_t rinput[64 * 32];
|
||||
uint16_t routput[64 * 32];
|
||||
TX_SIZE tx_size = TX_64X32;
|
||||
TX_SIZE rtx_size = av1_rotate_tx_size(tx_size);
|
||||
TX_TYPE rtx_type = av1_rotate_tx_type(tx_type);
|
||||
int w = tx_size_wide[tx_size];
|
||||
int h = tx_size_high[tx_size];
|
||||
int rw = h;
|
||||
int rh = w;
|
||||
transpose_int32(rinput, rw, input, w, w, h);
|
||||
transpose_uint16(routput, rw, output, stride, w, h);
|
||||
inv_txfm2d_add_facade(rinput, routput, rw, txfm_buf, rtx_type, rtx_size, bd);
|
||||
transpose_uint16(output, stride, routput, rw, rw, rh);
|
||||
#else
|
||||
int txfm_buf[64 * 32 + 64 + 64];
|
||||
inv_txfm2d_add_facade(input, output, stride, txfm_buf, tx_type, TX_64X32, bd);
|
||||
#endif
|
||||
// Remap 32x32 input into a modified 64x32 by:
|
||||
// - Copying over these values in top-left 32x32 locations.
|
||||
// - Setting the rest of the locations to 0.
|
||||
int32_t mod_input[64 * 32];
|
||||
for (int row = 0; row < 32; ++row) {
|
||||
memcpy(mod_input + row * 64, input + row * 32, 32 * sizeof(*mod_input));
|
||||
memset(mod_input + row * 64 + 32, 0, 32 * sizeof(*mod_input));
|
||||
}
|
||||
DECLARE_ALIGNED(32, int, txfm_buf[64 * 32 + 64 + 64]);
|
||||
inv_txfm2d_add_facade(mod_input, output, stride, txfm_buf, tx_type, TX_64X32,
|
||||
bd);
|
||||
}
|
||||
|
||||
void av1_inv_txfm2d_add_32x64_c(const int32_t *input, uint16_t *output,
|
||||
int stride, TX_TYPE tx_type, int bd) {
|
||||
int txfm_buf[64 * 32 + 64 + 64];
|
||||
inv_txfm2d_add_facade(input, output, stride, txfm_buf, tx_type, TX_32X64, bd);
|
||||
// Remap 32x32 input into a modified 32x64 input by:
|
||||
// - Copying over these values in top-left 32x32 locations.
|
||||
// - Setting the rest of the locations to 0.
|
||||
int32_t mod_input[32 * 64];
|
||||
memcpy(mod_input, input, 32 * 32 * sizeof(*mod_input));
|
||||
memset(mod_input + 32 * 32, 0, 32 * 32 * sizeof(*mod_input));
|
||||
DECLARE_ALIGNED(32, int, txfm_buf[64 * 32 + 64 + 64]);
|
||||
inv_txfm2d_add_facade(mod_input, output, stride, txfm_buf, tx_type, TX_32X64,
|
||||
bd);
|
||||
}
|
||||
|
||||
void av1_inv_txfm2d_add_16x64_c(const int32_t *input, uint16_t *output,
|
||||
int stride, TX_TYPE tx_type, int bd) {
|
||||
// Remap 16x32 input into a modified 16x64 input by:
|
||||
// - Copying over these values in top-left 16x32 locations.
|
||||
// - Setting the rest of the locations to 0.
|
||||
int32_t mod_input[16 * 64];
|
||||
memcpy(mod_input, input, 16 * 32 * sizeof(*mod_input));
|
||||
memset(mod_input + 16 * 32, 0, 16 * 32 * sizeof(*mod_input));
|
||||
DECLARE_ALIGNED(32, int, txfm_buf[16 * 64 + 64 + 64]);
|
||||
inv_txfm2d_add_facade(mod_input, output, stride, txfm_buf, tx_type, TX_16X64,
|
||||
bd);
|
||||
}
|
||||
|
||||
void av1_inv_txfm2d_add_64x16_c(const int32_t *input, uint16_t *output,
|
||||
int stride, TX_TYPE tx_type, int bd) {
|
||||
// Remap 32x16 input into a modified 64x16 by:
|
||||
// - Copying over these values in top-left 32x16 locations.
|
||||
// - Setting the rest of the locations to 0.
|
||||
int32_t mod_input[64 * 16];
|
||||
for (int row = 0; row < 16; ++row) {
|
||||
memcpy(mod_input + row * 64, input + row * 32, 32 * sizeof(*mod_input));
|
||||
memset(mod_input + row * 64 + 32, 0, 32 * sizeof(*mod_input));
|
||||
}
|
||||
DECLARE_ALIGNED(32, int, txfm_buf[16 * 64 + 64 + 64]);
|
||||
inv_txfm2d_add_facade(mod_input, output, stride, txfm_buf, tx_type, TX_64X16,
|
||||
bd);
|
||||
}
|
||||
|
||||
void av1_inv_txfm2d_add_4x16_c(const int32_t *input, uint16_t *output,
|
||||
int stride, TX_TYPE tx_type, int bd) {
|
||||
DECLARE_ALIGNED(32, int, txfm_buf[4 * 16 + 16 + 16]);
|
||||
inv_txfm2d_add_facade(input, output, stride, txfm_buf, tx_type, TX_4X16, bd);
|
||||
}
|
||||
|
||||
void av1_inv_txfm2d_add_16x4_c(const int32_t *input, uint16_t *output,
|
||||
int stride, TX_TYPE tx_type, int bd) {
|
||||
DECLARE_ALIGNED(32, int, txfm_buf[4 * 16 + 16 + 16]);
|
||||
inv_txfm2d_add_facade(input, output, stride, txfm_buf, tx_type, TX_16X4, bd);
|
||||
}
|
||||
|
||||
void av1_inv_txfm2d_add_8x32_c(const int32_t *input, uint16_t *output,
|
||||
int stride, TX_TYPE tx_type, int bd) {
|
||||
DECLARE_ALIGNED(32, int, txfm_buf[8 * 32 + 32 + 32]);
|
||||
inv_txfm2d_add_facade(input, output, stride, txfm_buf, tx_type, TX_8X32, bd);
|
||||
}
|
||||
|
||||
void av1_inv_txfm2d_add_32x8_c(const int32_t *input, uint16_t *output,
|
||||
int stride, TX_TYPE tx_type, int bd) {
|
||||
DECLARE_ALIGNED(32, int, txfm_buf[8 * 32 + 32 + 32]);
|
||||
inv_txfm2d_add_facade(input, output, stride, txfm_buf, tx_type, TX_32X8, bd);
|
||||
}
|
||||
#endif // CONFIG_TX64X64
|
||||
|
|
|
|||
4720
third_party/aom/av1/common/av1_loopfilter.c
vendored
4720
third_party/aom/av1/common/av1_loopfilter.c
vendored
File diff suppressed because it is too large
Load diff
231
third_party/aom/av1/common/av1_loopfilter.h
vendored
231
third_party/aom/av1/common/av1_loopfilter.h
vendored
|
|
@ -12,9 +12,9 @@
|
|||
#ifndef AV1_COMMON_LOOPFILTER_H_
|
||||
#define AV1_COMMON_LOOPFILTER_H_
|
||||
|
||||
#include "aom_ports/mem.h"
|
||||
#include "./aom_config.h"
|
||||
#include "config/aom_config.h"
|
||||
|
||||
#include "aom_ports/mem.h"
|
||||
#include "av1/common/blockd.h"
|
||||
#include "av1/common/seg_common.h"
|
||||
|
||||
|
|
@ -27,37 +27,111 @@ extern "C" {
|
|||
|
||||
#define SIMD_WIDTH 16
|
||||
|
||||
#define MAX_MODE_LF_DELTAS 2
|
||||
|
||||
enum lf_path {
|
||||
LF_PATH_420,
|
||||
LF_PATH_444,
|
||||
LF_PATH_SLOW,
|
||||
};
|
||||
|
||||
#if LOOP_FILTER_BITMASK
|
||||
typedef struct {
|
||||
uint64_t bits[4];
|
||||
} FilterMask;
|
||||
|
||||
// This structure holds bit masks for all 4x4 blocks in a 64x64 region.
|
||||
// Each 1 bit represents a position in which we want to apply the loop filter.
|
||||
// For Y plane, 4x4 in 64x64 requires 16x16 = 256 bit, therefore we use 4
|
||||
// uint64_t; For U, V plane, for 420 format, plane size is 32x32, thus we use
|
||||
// a uint64_t to represent bitmask.
|
||||
// Left_ entries refer to whether we apply a filter on the border to the
|
||||
// left of the block. Above_ entries refer to whether or not to apply a
|
||||
// filter on the above border.
|
||||
// Since each transform is accompanied by a potentially different type of
|
||||
// loop filter there is a different entry in the array for each transform size.
|
||||
typedef struct {
|
||||
FilterMask left_y[TX_SIZES];
|
||||
FilterMask above_y[TX_SIZES];
|
||||
FilterMask left_u[TX_SIZES];
|
||||
FilterMask above_u[TX_SIZES];
|
||||
FilterMask left_v[TX_SIZES];
|
||||
FilterMask above_v[TX_SIZES];
|
||||
|
||||
// Y plane vertical edge and horizontal edge filter level
|
||||
uint8_t lfl_y_hor[MI_SIZE_64X64][MI_SIZE_64X64];
|
||||
uint8_t lfl_y_ver[MI_SIZE_64X64][MI_SIZE_64X64];
|
||||
|
||||
// U plane vertical edge and horizontal edge filter level
|
||||
uint8_t lfl_u_hor[MI_SIZE_64X64][MI_SIZE_64X64];
|
||||
uint8_t lfl_u_ver[MI_SIZE_64X64][MI_SIZE_64X64];
|
||||
|
||||
// V plane vertical edge and horizontal edge filter level
|
||||
uint8_t lfl_v_hor[MI_SIZE_64X64][MI_SIZE_64X64];
|
||||
uint8_t lfl_v_ver[MI_SIZE_64X64][MI_SIZE_64X64];
|
||||
} LoopFilterMask;
|
||||
|
||||
// To determine whether to apply loop filtering at one transform block edge,
|
||||
// we need information of the neighboring transform block. Specifically,
|
||||
// in determining a vertical edge, we need the information of the tx block
|
||||
// to its left. For a horizontal edge, we need info of the tx block above it.
|
||||
// Thus, we need to record info of right column and bottom row of tx blocks.
|
||||
// We record the information of the neighboring superblock, when bitmask
|
||||
// building for a superblock is finished. And it will be used for next
|
||||
// superblock bitmask building.
|
||||
// Information includes:
|
||||
// ------------------------------------------------------------
|
||||
// MI_SIZE_64X64
|
||||
// Y tx_size above |--------------|
|
||||
// Y tx_size left |--------------|
|
||||
// UV tx_size above |--------------|
|
||||
// UV tx_size left |--------------|
|
||||
// Y level above |--------------|
|
||||
// Y level left |--------------|
|
||||
// U level above |--------------|
|
||||
// U level left |--------------|
|
||||
// V level above |--------------|
|
||||
// V level left |--------------|
|
||||
// skip |--------------|
|
||||
// ------------------------------------------------------------
|
||||
typedef struct {
|
||||
TX_SIZE tx_size_y_above[MI_SIZE_64X64];
|
||||
TX_SIZE tx_size_y_left[MI_SIZE_64X64];
|
||||
TX_SIZE tx_size_uv_above[MI_SIZE_64X64];
|
||||
TX_SIZE tx_size_uv_left[MI_SIZE_64X64];
|
||||
uint8_t y_level_above[MI_SIZE_64X64];
|
||||
uint8_t y_level_left[MI_SIZE_64X64];
|
||||
uint8_t u_level_above[MI_SIZE_64X64];
|
||||
uint8_t u_level_left[MI_SIZE_64X64];
|
||||
uint8_t v_level_above[MI_SIZE_64X64];
|
||||
uint8_t v_level_left[MI_SIZE_64X64];
|
||||
uint8_t skip[MI_SIZE_64X64];
|
||||
} LpfSuperblockInfo;
|
||||
#endif // LOOP_FILTER_BITMASK
|
||||
|
||||
struct loopfilter {
|
||||
#if CONFIG_LOOPFILTER_LEVEL
|
||||
int filter_level[2];
|
||||
int filter_level_u;
|
||||
int filter_level_v;
|
||||
#else
|
||||
int filter_level;
|
||||
#endif
|
||||
|
||||
int sharpness_level;
|
||||
int last_sharpness_level;
|
||||
|
||||
uint8_t mode_ref_delta_enabled;
|
||||
uint8_t mode_ref_delta_update;
|
||||
|
||||
// 0 = Intra, Last, Last2+Last3(CONFIG_EXT_REFS),
|
||||
// GF, BRF(CONFIG_EXT_REFS), ARF2(CONFIG_EXT_REFS), ARF
|
||||
int8_t ref_deltas[TOTAL_REFS_PER_FRAME];
|
||||
int8_t last_ref_deltas[TOTAL_REFS_PER_FRAME];
|
||||
// 0 = Intra, Last, Last2+Last3,
|
||||
// GF, BRF, ARF2, ARF
|
||||
int8_t ref_deltas[REF_FRAMES];
|
||||
|
||||
// 0 = ZERO_MV, MV
|
||||
int8_t mode_deltas[MAX_MODE_LF_DELTAS];
|
||||
int8_t last_mode_deltas[MAX_MODE_LF_DELTAS];
|
||||
|
||||
int combine_vert_horz_lf;
|
||||
|
||||
#if LOOP_FILTER_BITMASK
|
||||
LoopFilterMask *lfm;
|
||||
size_t lfm_num;
|
||||
int lfm_stride;
|
||||
LpfSuperblockInfo neighbor_sb_lpf_info;
|
||||
#endif // LOOP_FILTER_BITMASK
|
||||
};
|
||||
|
||||
// Need to align this structure so when it is declared and
|
||||
|
|
@ -70,127 +144,56 @@ typedef struct {
|
|||
|
||||
typedef struct {
|
||||
loop_filter_thresh lfthr[MAX_LOOP_FILTER + 1];
|
||||
#if CONFIG_LOOPFILTER_LEVEL
|
||||
uint8_t lvl[MAX_SEGMENTS][2][TOTAL_REFS_PER_FRAME][MAX_MODE_LF_DELTAS];
|
||||
#else
|
||||
uint8_t lvl[MAX_SEGMENTS][TOTAL_REFS_PER_FRAME][MAX_MODE_LF_DELTAS];
|
||||
#endif
|
||||
uint8_t lvl[MAX_MB_PLANE][MAX_SEGMENTS][2][REF_FRAMES][MAX_MODE_LF_DELTAS];
|
||||
} loop_filter_info_n;
|
||||
|
||||
// This structure holds bit masks for all 8x8 blocks in a 64x64 region.
|
||||
// Each 1 bit represents a position in which we want to apply the loop filter.
|
||||
// Left_ entries refer to whether we apply a filter on the border to the
|
||||
// left of the block. Above_ entries refer to whether or not to apply a
|
||||
// filter on the above border. Int_ entries refer to whether or not to
|
||||
// apply borders on the 4x4 edges within the 8x8 block that each bit
|
||||
// represents.
|
||||
// Since each transform is accompanied by a potentially different type of
|
||||
// loop filter there is a different entry in the array for each transform size.
|
||||
typedef struct {
|
||||
uint64_t left_y[TX_SIZES];
|
||||
uint64_t above_y[TX_SIZES];
|
||||
uint64_t int_4x4_y;
|
||||
uint16_t left_uv[TX_SIZES];
|
||||
uint16_t above_uv[TX_SIZES];
|
||||
uint16_t left_int_4x4_uv;
|
||||
uint16_t above_int_4x4_uv;
|
||||
uint8_t lfl_y[MAX_MIB_SIZE][MAX_MIB_SIZE];
|
||||
uint8_t lfl_uv[MAX_MIB_SIZE / 2][MAX_MIB_SIZE / 2];
|
||||
} LOOP_FILTER_MASK;
|
||||
|
||||
/* assorted loopfilter functions which get used elsewhere */
|
||||
struct AV1Common;
|
||||
struct macroblockd;
|
||||
struct AV1LfSyncData;
|
||||
|
||||
// This function sets up the bit masks for the entire 64x64 region represented
|
||||
// by mi_row, mi_col.
|
||||
void av1_setup_mask(struct AV1Common *const cm, const int mi_row,
|
||||
const int mi_col, MODE_INFO **mi_8x8,
|
||||
const int mode_info_stride, LOOP_FILTER_MASK *lfm);
|
||||
|
||||
void av1_filter_block_plane_ss00_ver(struct AV1Common *const cm,
|
||||
struct macroblockd_plane *const plane,
|
||||
int mi_row, LOOP_FILTER_MASK *lfm);
|
||||
void av1_filter_block_plane_ss00_hor(struct AV1Common *const cm,
|
||||
struct macroblockd_plane *const plane,
|
||||
int mi_row, LOOP_FILTER_MASK *lfm);
|
||||
void av1_filter_block_plane_ss11_ver(struct AV1Common *const cm,
|
||||
struct macroblockd_plane *const plane,
|
||||
int mi_row, LOOP_FILTER_MASK *lfm);
|
||||
void av1_filter_block_plane_ss11_hor(struct AV1Common *const cm,
|
||||
struct macroblockd_plane *const plane,
|
||||
int mi_row, LOOP_FILTER_MASK *lfm);
|
||||
|
||||
void av1_filter_block_plane_non420_ver(struct AV1Common *const cm,
|
||||
struct macroblockd_plane *plane,
|
||||
MODE_INFO **mi_8x8, int mi_row,
|
||||
int mi_col, int pl);
|
||||
void av1_filter_block_plane_non420_hor(struct AV1Common *const cm,
|
||||
struct macroblockd_plane *plane,
|
||||
MODE_INFO **mi_8x8, int mi_row,
|
||||
int mi_col, int pl);
|
||||
|
||||
void av1_loop_filter_init(struct AV1Common *cm);
|
||||
|
||||
// Update the loop filter for the current frame.
|
||||
// This should be called before av1_loop_filter_rows(),
|
||||
// av1_loop_filter_frame()
|
||||
// calls this function directly.
|
||||
void av1_loop_filter_frame_init(struct AV1Common *cm, int default_filt_lvl,
|
||||
int default_filt_lvl_r
|
||||
#if CONFIG_LOOPFILTER_LEVEL
|
||||
,
|
||||
int plane
|
||||
#endif
|
||||
);
|
||||
void av1_loop_filter_frame_init(struct AV1Common *cm, int plane_start,
|
||||
int plane_end);
|
||||
|
||||
#if CONFIG_LPF_SB
|
||||
void av1_loop_filter_frame(YV12_BUFFER_CONFIG *frame, struct AV1Common *cm,
|
||||
struct macroblockd *mbd, int filter_level,
|
||||
int y_only, int partial_frame, int mi_row,
|
||||
int mi_col);
|
||||
struct macroblockd *mbd, int plane_start,
|
||||
int plane_end, int partial_frame);
|
||||
|
||||
// Apply the loop filter to [start, stop) macro block rows in frame_buffer.
|
||||
void av1_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer,
|
||||
struct AV1Common *cm,
|
||||
struct macroblockd_plane *planes, int start, int stop,
|
||||
int col_start, int col_end, int y_only);
|
||||
void av1_filter_block_plane_vert(const struct AV1Common *const cm,
|
||||
const MACROBLOCKD *const xd, const int plane,
|
||||
const MACROBLOCKD_PLANE *const plane_ptr,
|
||||
const uint32_t mi_row, const uint32_t mi_col);
|
||||
|
||||
void av1_loop_filter_sb_level_init(struct AV1Common *cm, int mi_row, int mi_col,
|
||||
int lvl);
|
||||
#else
|
||||
void av1_loop_filter_frame(YV12_BUFFER_CONFIG *frame, struct AV1Common *cm,
|
||||
struct macroblockd *mbd, int filter_level,
|
||||
#if CONFIG_LOOPFILTER_LEVEL
|
||||
int filter_level_r,
|
||||
#endif
|
||||
int y_only, int partial_frame);
|
||||
|
||||
// Apply the loop filter to [start, stop) macro block rows in frame_buffer.
|
||||
void av1_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer,
|
||||
struct AV1Common *cm,
|
||||
struct macroblockd_plane *planes, int start, int stop,
|
||||
int y_only);
|
||||
#endif // CONFIG_LPF_SB
|
||||
void av1_filter_block_plane_horz(const struct AV1Common *const cm,
|
||||
const MACROBLOCKD *const xd, const int plane,
|
||||
const MACROBLOCKD_PLANE *const plane_ptr,
|
||||
const uint32_t mi_row, const uint32_t mi_col);
|
||||
|
||||
typedef struct LoopFilterWorkerData {
|
||||
YV12_BUFFER_CONFIG *frame_buffer;
|
||||
struct AV1Common *cm;
|
||||
struct macroblockd_plane planes[MAX_MB_PLANE];
|
||||
|
||||
int start;
|
||||
int stop;
|
||||
int y_only;
|
||||
// TODO(Ranjit): When the filter functions are modified to use xd->lossless
|
||||
// add lossless as a member here.
|
||||
MACROBLOCKD *xd;
|
||||
} LFWorkerData;
|
||||
|
||||
void av1_loop_filter_data_reset(LFWorkerData *lf_data,
|
||||
YV12_BUFFER_CONFIG *frame_buffer,
|
||||
struct AV1Common *cm,
|
||||
const struct macroblockd_plane *planes);
|
||||
#if LOOP_FILTER_BITMASK
|
||||
void av1_setup_bitmask(struct AV1Common *const cm, int mi_row, int mi_col,
|
||||
int plane, int subsampling_x, int subsampling_y,
|
||||
int row_end, int col_end);
|
||||
|
||||
void av1_filter_block_plane_ver(struct AV1Common *const cm,
|
||||
struct macroblockd_plane *const plane_ptr,
|
||||
int pl, int mi_row, int mi_col);
|
||||
|
||||
void av1_filter_block_plane_hor(struct AV1Common *const cm,
|
||||
struct macroblockd_plane *const plane, int pl,
|
||||
int mi_row, int mi_col);
|
||||
#endif
|
||||
|
||||
// Operates on the rows described by 'lf_data'.
|
||||
int av1_loop_filter_worker(LFWorkerData *const lf_data, void *unused);
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
|
|
|||
6
third_party/aom/av1/common/av1_rtcd.c
vendored
6
third_party/aom/av1/common/av1_rtcd.c
vendored
|
|
@ -8,9 +8,11 @@
|
|||
* 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 "./aom_config.h"
|
||||
#include "config/aom_config.h"
|
||||
|
||||
#define RTCD_C
|
||||
#include "./av1_rtcd.h"
|
||||
#include "config/av1_rtcd.h"
|
||||
|
||||
#include "aom_ports/aom_once.h"
|
||||
|
||||
void av1_rtcd() {
|
||||
|
|
|
|||
764
third_party/aom/av1/common/av1_rtcd_defs.pl
vendored
764
third_party/aom/av1/common/av1_rtcd_defs.pl
vendored
|
|
@ -1,3 +1,13 @@
|
|||
##
|
||||
## Copyright (c) 2017, 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.
|
||||
##
|
||||
sub av1_common_forward_decls() {
|
||||
print <<EOF
|
||||
/*
|
||||
|
|
@ -13,6 +23,7 @@ print <<EOF
|
|||
#include "av1/common/convolve.h"
|
||||
#include "av1/common/av1_txfm.h"
|
||||
#include "av1/common/odintrin.h"
|
||||
#include "av1/common/restoration.h"
|
||||
|
||||
struct macroblockd;
|
||||
|
||||
|
|
@ -21,9 +32,22 @@ struct macroblock;
|
|||
struct txfm_param;
|
||||
struct aom_variance_vtable;
|
||||
struct search_site_config;
|
||||
struct mv;
|
||||
union int_mv;
|
||||
struct yv12_buffer_config;
|
||||
|
||||
/* Function pointers return by CfL functions */
|
||||
typedef void (*cfl_subsample_lbd_fn)(const uint8_t *input, int input_stride,
|
||||
uint16_t *output_q3);
|
||||
|
||||
typedef void (*cfl_subsample_hbd_fn)(const uint16_t *input, int input_stride,
|
||||
uint16_t *output_q3);
|
||||
|
||||
typedef void (*cfl_subtract_average_fn)(const uint16_t *src, int16_t *dst);
|
||||
|
||||
typedef void (*cfl_predict_lbd_fn)(const int16_t *src, uint8_t *dst,
|
||||
int dst_stride, int alpha_q3);
|
||||
|
||||
typedef void (*cfl_predict_hbd_fn)(const int16_t *src, uint16_t *dst,
|
||||
int dst_stride, int alpha_q3, int bd);
|
||||
EOF
|
||||
}
|
||||
forward_decls qw/av1_common_forward_decls/;
|
||||
|
|
@ -38,233 +62,55 @@ if ($opts{arch} eq "x86_64") {
|
|||
$avx2_x86_64 = 'avx2';
|
||||
}
|
||||
|
||||
#
|
||||
# 10/12-tap convolution filters
|
||||
#
|
||||
add_proto qw/void av1_lowbd_convolve_init/, "void";
|
||||
specialize qw/av1_lowbd_convolve_init ssse3/;
|
||||
add_proto qw/void av1_convolve_horiz_rs/, "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, const int16_t *x_filters, int x0_qn, int x_step_qn";
|
||||
specialize qw/av1_convolve_horiz_rs sse4_1/;
|
||||
|
||||
add_proto qw/void av1_convolve_horiz/, "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, const InterpFilterParams fp, const int subpel_x_q4, int x_step_q4, ConvolveParams *conv_params";
|
||||
specialize qw/av1_convolve_horiz ssse3/;
|
||||
add_proto qw/void av1_highbd_convolve_horiz_rs/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, const int16_t *x_filters, int x0_qn, int x_step_qn, int bd";
|
||||
specialize qw/av1_highbd_convolve_horiz_rs sse4_1/;
|
||||
|
||||
add_proto qw/void av1_convolve_vert/, "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, const InterpFilterParams fp, const int subpel_x_q4, int x_step_q4, ConvolveParams *conv_params";
|
||||
specialize qw/av1_convolve_vert ssse3/;
|
||||
add_proto qw/void av1_wiener_convolve_add_src/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h, const ConvolveParams *conv_params";
|
||||
|
||||
if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
|
||||
add_proto qw/void av1_highbd_convolve_init/, "void";
|
||||
specialize qw/av1_highbd_convolve_init sse4_1/;
|
||||
add_proto qw/void av1_highbd_convolve_horiz/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, const InterpFilterParams fp, const int subpel_x_q4, int x_step_q4, int avg, int bd";
|
||||
specialize qw/av1_highbd_convolve_horiz sse4_1/;
|
||||
add_proto qw/void av1_highbd_convolve_vert/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, const InterpFilterParams fp, const int subpel_x_q4, int x_step_q4, int avg, int bd";
|
||||
specialize qw/av1_highbd_convolve_vert sse4_1/;
|
||||
}
|
||||
add_proto qw/void av1_highbd_wiener_convolve_add_src/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h, const ConvolveParams *conv_params, int bps";
|
||||
|
||||
#
|
||||
# Inverse dct
|
||||
#
|
||||
if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
|
||||
add_proto qw/void av1_iht4x4_16_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param";
|
||||
specialize qw/av1_iht4x4_16_add sse2/;
|
||||
specialize qw/av1_wiener_convolve_add_src sse2 avx2 neon/;
|
||||
specialize qw/av1_highbd_wiener_convolve_add_src ssse3/;
|
||||
specialize qw/av1_highbd_wiener_convolve_add_src avx2/;
|
||||
|
||||
add_proto qw/void av1_iht4x8_32_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param";
|
||||
specialize qw/av1_iht4x8_32_add sse2/;
|
||||
# directional intra predictor functions
|
||||
add_proto qw/void av1_dr_prediction_z1/, "uint8_t *dst, ptrdiff_t stride, int bw, int bh, const uint8_t *above, const uint8_t *left, int upsample_above, int dx, int dy";
|
||||
add_proto qw/void av1_dr_prediction_z2/, "uint8_t *dst, ptrdiff_t stride, int bw, int bh, const uint8_t *above, const uint8_t *left, int upsample_above, int upsample_left, int dx, int dy";
|
||||
add_proto qw/void av1_dr_prediction_z3/, "uint8_t *dst, ptrdiff_t stride, int bw, int bh, const uint8_t *above, const uint8_t *left, int upsample_left, int dx, int dy";
|
||||
|
||||
add_proto qw/void av1_iht8x4_32_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param";
|
||||
specialize qw/av1_iht8x4_32_add sse2/;
|
||||
|
||||
add_proto qw/void av1_iht8x16_128_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param";
|
||||
specialize qw/av1_iht8x16_128_add sse2/;
|
||||
|
||||
add_proto qw/void av1_iht16x8_128_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param";
|
||||
specialize qw/av1_iht16x8_128_add sse2/;
|
||||
|
||||
add_proto qw/void av1_iht16x32_512_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param";
|
||||
specialize qw/av1_iht16x32_512_add sse2/;
|
||||
|
||||
add_proto qw/void av1_iht32x16_512_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param";
|
||||
specialize qw/av1_iht32x16_512_add sse2/;
|
||||
|
||||
add_proto qw/void av1_iht4x16_64_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param";
|
||||
|
||||
add_proto qw/void av1_iht16x4_64_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param";
|
||||
|
||||
add_proto qw/void av1_iht8x32_256_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param";
|
||||
|
||||
add_proto qw/void av1_iht32x8_256_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param";
|
||||
|
||||
add_proto qw/void av1_iht8x8_64_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param";
|
||||
specialize qw/av1_iht8x8_64_add sse2/;
|
||||
|
||||
add_proto qw/void av1_iht16x16_256_add/, "const tran_low_t *input, uint8_t *output, int pitch, const struct txfm_param *param";
|
||||
specialize qw/av1_iht16x16_256_add sse2 avx2/;
|
||||
|
||||
add_proto qw/void av1_iht32x32_1024_add/, "const tran_low_t *input, uint8_t *output, int pitch, const struct txfm_param *param";
|
||||
} else {
|
||||
add_proto qw/void av1_iht4x4_16_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param";
|
||||
if (aom_config("CONFIG_DAALA_DCT4") ne "yes") {
|
||||
specialize qw/av1_iht4x4_16_add sse2 neon/;
|
||||
}
|
||||
|
||||
add_proto qw/void av1_iht4x8_32_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param";
|
||||
specialize qw/av1_iht4x8_32_add sse2/;
|
||||
|
||||
add_proto qw/void av1_iht8x4_32_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param";
|
||||
specialize qw/av1_iht8x4_32_add sse2/;
|
||||
|
||||
add_proto qw/void av1_iht8x16_128_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param";
|
||||
specialize qw/av1_iht8x16_128_add sse2/;
|
||||
|
||||
add_proto qw/void av1_iht16x8_128_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param";
|
||||
specialize qw/av1_iht16x8_128_add sse2/;
|
||||
|
||||
add_proto qw/void av1_iht16x32_512_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param";
|
||||
specialize qw/av1_iht16x32_512_add sse2/;
|
||||
|
||||
add_proto qw/void av1_iht32x16_512_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param";
|
||||
specialize qw/av1_iht32x16_512_add sse2/;
|
||||
|
||||
add_proto qw/void av1_iht4x16_64_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param";
|
||||
|
||||
add_proto qw/void av1_iht16x4_64_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param";
|
||||
|
||||
add_proto qw/void av1_iht8x32_256_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param";
|
||||
|
||||
add_proto qw/void av1_iht32x8_256_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param";
|
||||
|
||||
add_proto qw/void av1_iht8x8_64_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param";
|
||||
if (aom_config("CONFIG_DAALA_DCT8") ne "yes") {
|
||||
specialize qw/av1_iht8x8_64_add sse2 neon/;
|
||||
}
|
||||
|
||||
add_proto qw/void av1_iht16x16_256_add/, "const tran_low_t *input, uint8_t *output, int pitch, const struct txfm_param *param";
|
||||
if (aom_config("CONFIG_DAALA_DCT16") ne "yes") {
|
||||
specialize qw/av1_iht16x16_256_add sse2 avx2/;
|
||||
}
|
||||
|
||||
add_proto qw/void av1_iht32x32_1024_add/, "const tran_low_t *input, uint8_t *output, int pitch, const struct txfm_param *param";
|
||||
|
||||
if (aom_config("CONFIG_EXT_TX") ne "yes") {
|
||||
if (aom_config("CONFIG_DAALA_DCT4") ne "yes") {
|
||||
specialize qw/av1_iht4x4_16_add msa/;
|
||||
}
|
||||
if (aom_config("CONFIG_DAALA_DCT8") ne "yes") {
|
||||
specialize qw/av1_iht8x8_64_add msa/;
|
||||
}
|
||||
if (aom_config("CONFIG_DAALA_DCT16") ne "yes") {
|
||||
specialize qw/av1_iht16x16_256_add msa/;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
add_proto qw/void av1_iht32x32_1024_add/, "const tran_low_t *input, uint8_t *output, int pitch, const struct txfm_param *param";
|
||||
|
||||
if (aom_config("CONFIG_TX64X64") eq "yes") {
|
||||
add_proto qw/void av1_iht64x64_4096_add/, "const tran_low_t *input, uint8_t *output, int pitch, const struct txfm_param *param";
|
||||
add_proto qw/void av1_iht32x64_2048_add/, "const tran_low_t *input, uint8_t *output, int pitch, const struct txfm_param *param";
|
||||
add_proto qw/void av1_iht64x32_2048_add/, "const tran_low_t *input, uint8_t *output, int pitch, const struct txfm_param *param";
|
||||
}
|
||||
|
||||
if (aom_config("CONFIG_NEW_QUANT") eq "yes") {
|
||||
add_proto qw/void quantize_nuq/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, const int16_t *dequant_ptr, const cuml_bins_type_nuq *cuml_bins_ptr, const dequant_val_type_nuq *dequant_val, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const int16_t *scan, const uint8_t *band";
|
||||
|
||||
add_proto qw/void quantize_fp_nuq/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *quant_ptr, const int16_t *dequant_ptr, const cuml_bins_type_nuq *cuml_bins_ptr, const dequant_val_type_nuq *dequant_val, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const int16_t *scan, const uint8_t *band";
|
||||
|
||||
add_proto qw/void quantize_32x32_nuq/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, const int16_t *dequant_ptr, const cuml_bins_type_nuq *cuml_bins_ptr, const dequant_val_type_nuq *dequant_val, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const int16_t *scan, const uint8_t *band";
|
||||
|
||||
add_proto qw/void quantize_32x32_fp_nuq/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *quant_ptr, const int16_t *dequant_ptr, const cuml_bins_type_nuq *cuml_bins_ptr, const dequant_val_type_nuq *dequant_val, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const int16_t *scan, const uint8_t *band";
|
||||
|
||||
if (aom_config("CONFIG_TX64X64") eq "yes") {
|
||||
add_proto qw/void quantize_64x64_nuq/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, const int16_t *dequant_ptr, const cuml_bins_type_nuq *cuml_bins_ptr, const dequant_val_type_nuq *dequant_val, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const int16_t *scan, const uint8_t *band";
|
||||
|
||||
add_proto qw/void quantize_64x64_fp_nuq/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *quant_ptr, const int16_t *dequant_ptr, const cuml_bins_type_nuq *cuml_bins_ptr, const dequant_val_type_nuq *dequant_val, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const int16_t *scan, const uint8_t *band";
|
||||
}
|
||||
}
|
||||
|
||||
# FILTER_INTRA predictor functions
|
||||
if (aom_config("CONFIG_FILTER_INTRA") eq "yes") {
|
||||
add_proto qw/void av1_dc_filter_predictor/, "uint8_t *dst, ptrdiff_t stride, TX_SIZE tx_size, const uint8_t *above, const uint8_t *left";
|
||||
add_proto qw/void av1_v_filter_predictor/, "uint8_t *dst, ptrdiff_t stride, TX_SIZE tx_size, const uint8_t *above, const uint8_t *left";
|
||||
add_proto qw/void av1_h_filter_predictor/, "uint8_t *dst, ptrdiff_t stride, TX_SIZE tx_size, const uint8_t *above, const uint8_t *left";
|
||||
add_proto qw/void av1_d45_filter_predictor/, "uint8_t *dst, ptrdiff_t stride, TX_SIZE tx_size, const uint8_t *above, const uint8_t *left";
|
||||
add_proto qw/void av1_d135_filter_predictor/, "uint8_t *dst, ptrdiff_t stride, TX_SIZE tx_size, const uint8_t *above, const uint8_t *left";
|
||||
add_proto qw/void av1_d117_filter_predictor/, "uint8_t *dst, ptrdiff_t stride, TX_SIZE tx_size, const uint8_t *above, const uint8_t *left";
|
||||
add_proto qw/void av1_d153_filter_predictor/, "uint8_t *dst, ptrdiff_t stride, TX_SIZE tx_size, const uint8_t *above, const uint8_t *left";
|
||||
add_proto qw/void av1_d207_filter_predictor/, "uint8_t *dst, ptrdiff_t stride, TX_SIZE tx_size, const uint8_t *above, const uint8_t *left";
|
||||
add_proto qw/void av1_d63_filter_predictor/, "uint8_t *dst, ptrdiff_t stride, TX_SIZE tx_size, const uint8_t *above, const uint8_t *left";
|
||||
add_proto qw/void av1_tm_filter_predictor/, "uint8_t *dst, ptrdiff_t stride, TX_SIZE tx_size, const uint8_t *above, const uint8_t *left";
|
||||
# High bitdepth functions
|
||||
if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
|
||||
add_proto qw/void av1_highbd_dc_filter_predictor/, "uint16_t *dst, ptrdiff_t stride, TX_SIZE tx_size, const uint16_t *above, const uint16_t *left, int bd";
|
||||
add_proto qw/void av1_highbd_v_filter_predictor/, "uint16_t *dst, ptrdiff_t stride, TX_SIZE tx_size, const uint16_t *above, const uint16_t *left, int bd";
|
||||
add_proto qw/void av1_highbd_h_filter_predictor/, "uint16_t *dst, ptrdiff_t stride, TX_SIZE tx_size, const uint16_t *above, const uint16_t *left, int bd";
|
||||
add_proto qw/void av1_highbd_d45_filter_predictor/, "uint16_t *dst, ptrdiff_t stride, TX_SIZE tx_size, const uint16_t *above, const uint16_t *left, int bd";
|
||||
add_proto qw/void av1_highbd_d135_filter_predictor/, "uint16_t *dst, ptrdiff_t stride, TX_SIZE tx_size, const uint16_t *above, const uint16_t *left, int bd";
|
||||
add_proto qw/void av1_highbd_d117_filter_predictor/, "uint16_t *dst, ptrdiff_t stride, TX_SIZE tx_size, const uint16_t *above, const uint16_t *left, int bd";
|
||||
add_proto qw/void av1_highbd_d153_filter_predictor/, "uint16_t *dst, ptrdiff_t stride, TX_SIZE tx_size, const uint16_t *above, const uint16_t *left, int bd";
|
||||
add_proto qw/void av1_highbd_d207_filter_predictor/, "uint16_t *dst, ptrdiff_t stride, TX_SIZE tx_size, const uint16_t *above, const uint16_t *left, int bd";
|
||||
add_proto qw/void av1_highbd_d63_filter_predictor/, "uint16_t *dst, ptrdiff_t stride, TX_SIZE tx_size, const uint16_t *above, const uint16_t *left, int bd";
|
||||
add_proto qw/void av1_highbd_tm_filter_predictor/, "uint16_t *dst, ptrdiff_t stride, TX_SIZE tx_size, const uint16_t *above, const uint16_t *left, int bd";
|
||||
}
|
||||
}
|
||||
add_proto qw/void av1_filter_intra_predictor/, "uint8_t *dst, ptrdiff_t stride, TX_SIZE tx_size, const uint8_t *above, const uint8_t *left, int mode";
|
||||
specialize qw/av1_filter_intra_predictor sse4_1/;
|
||||
|
||||
# High bitdepth functions
|
||||
if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
|
||||
#
|
||||
# Sub Pixel Filters
|
||||
#
|
||||
add_proto qw/void av1_highbd_convolve_copy/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h, int bps";
|
||||
|
||||
add_proto qw/void av1_highbd_convolve_avg/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h, int bps";
|
||||
#
|
||||
# Sub Pixel Filters
|
||||
#
|
||||
add_proto qw/void av1_highbd_convolve_copy/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h, int bps";
|
||||
|
||||
add_proto qw/void av1_highbd_convolve8/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h, int bps";
|
||||
specialize qw/av1_highbd_convolve8/, "$sse2_x86_64";
|
||||
add_proto qw/void av1_highbd_convolve_avg/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h, int bps";
|
||||
|
||||
add_proto qw/void av1_highbd_convolve8_horiz/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h, int bps";
|
||||
specialize qw/av1_highbd_convolve8_horiz/, "$sse2_x86_64";
|
||||
add_proto qw/void av1_highbd_convolve8/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h, int bps";
|
||||
specialize qw/av1_highbd_convolve8/, "$sse2_x86_64";
|
||||
|
||||
add_proto qw/void av1_highbd_convolve8_vert/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h, int bps";
|
||||
specialize qw/av1_highbd_convolve8_vert/, "$sse2_x86_64";
|
||||
add_proto qw/void av1_highbd_convolve8_horiz/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h, int bps";
|
||||
specialize qw/av1_highbd_convolve8_horiz/, "$sse2_x86_64";
|
||||
|
||||
add_proto qw/void av1_highbd_convolve8_avg/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h, int bps";
|
||||
specialize qw/av1_highbd_convolve8_avg/, "$sse2_x86_64";
|
||||
|
||||
add_proto qw/void av1_highbd_convolve8_avg_horiz/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h, int bps";
|
||||
specialize qw/av1_highbd_convolve8_avg_horiz/, "$sse2_x86_64";
|
||||
|
||||
add_proto qw/void av1_highbd_convolve8_avg_vert/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h, int bps";
|
||||
specialize qw/av1_highbd_convolve8_avg_vert/, "$sse2_x86_64";
|
||||
|
||||
#
|
||||
# dct
|
||||
#
|
||||
add_proto qw/void av1_highbd_iht4x4_16_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param";
|
||||
|
||||
add_proto qw/void av1_highbd_iht4x8_32_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param";
|
||||
|
||||
add_proto qw/void av1_highbd_iht8x4_32_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param";
|
||||
|
||||
add_proto qw/void av1_highbd_iht8x16_128_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param";
|
||||
|
||||
add_proto qw/void av1_highbd_iht16x8_128_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param";
|
||||
|
||||
add_proto qw/void av1_highbd_iht16x32_512_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param";
|
||||
|
||||
add_proto qw/void av1_highbd_iht32x16_512_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param";
|
||||
|
||||
add_proto qw/void av1_highbd_iht4x16_64_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param";
|
||||
|
||||
add_proto qw/void av1_highbd_iht16x4_64_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param";
|
||||
|
||||
add_proto qw/void av1_highbd_iht8x32_256_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param";
|
||||
|
||||
add_proto qw/void av1_highbd_iht32x8_256_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param";
|
||||
|
||||
add_proto qw/void av1_highbd_iht8x8_64_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, const struct txfm_param *param";
|
||||
|
||||
add_proto qw/void av1_highbd_iht16x16_256_add/, "const tran_low_t *input, uint8_t *output, int pitch, const struct txfm_param *param";
|
||||
}
|
||||
add_proto qw/void av1_highbd_convolve8_vert/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h, int bps";
|
||||
specialize qw/av1_highbd_convolve8_vert/, "$sse2_x86_64";
|
||||
|
||||
#inv txfm
|
||||
add_proto qw/void av1_inv_txfm_add/, "const tran_low_t *dqcoeff, uint8_t *dst, int stride, const TxfmParam *txfm_param";
|
||||
specialize qw/av1_inv_txfm_add ssse3 avx2/;
|
||||
|
||||
add_proto qw/void av1_highbd_iwht4x4_1_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int bd";
|
||||
add_proto qw/void av1_highbd_iwht4x4_16_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int bd";
|
||||
|
||||
add_proto qw/void av1_inv_txfm2d_add_4x8/, "const int32_t *input, uint16_t *output, int stride, TX_TYPE tx_type, int bd";
|
||||
add_proto qw/void av1_inv_txfm2d_add_8x4/, "const int32_t *input, uint16_t *output, int stride, TX_TYPE tx_type, int bd";
|
||||
add_proto qw/void av1_inv_txfm2d_add_8x16/, "const int32_t *input, uint16_t *output, int stride, TX_TYPE tx_type, int bd";
|
||||
|
|
@ -272,26 +118,41 @@ add_proto qw/void av1_inv_txfm2d_add_16x8/, "const int32_t *input, uint16_t *out
|
|||
add_proto qw/void av1_inv_txfm2d_add_16x32/, "const int32_t *input, uint16_t *output, int stride, TX_TYPE tx_type, int bd";
|
||||
add_proto qw/void av1_inv_txfm2d_add_32x16/, "const int32_t *input, uint16_t *output, int stride, TX_TYPE tx_type, int bd";
|
||||
add_proto qw/void av1_inv_txfm2d_add_4x4/, "const int32_t *input, uint16_t *output, int stride, TX_TYPE tx_type, int bd";
|
||||
if (aom_config("CONFIG_DAALA_DCT4") ne "yes") {
|
||||
specialize qw/av1_inv_txfm2d_add_4x4 sse4_1/;
|
||||
}
|
||||
specialize qw/av1_inv_txfm2d_add_4x4 sse4_1/;
|
||||
add_proto qw/void av1_inv_txfm2d_add_8x8/, "const int32_t *input, uint16_t *output, int stride, TX_TYPE tx_type, int bd";
|
||||
if (aom_config("CONFIG_DAALA_DCT8") ne "yes") {
|
||||
specialize qw/av1_inv_txfm2d_add_8x8 sse4_1/;
|
||||
}
|
||||
specialize qw/av1_inv_txfm2d_add_8x8 sse4_1/;
|
||||
add_proto qw/void av1_inv_txfm2d_add_16x16/, "const int32_t *input, uint16_t *output, int stride, TX_TYPE tx_type, int bd";
|
||||
if (aom_config("CONFIG_DAALA_DCT16") ne "yes") {
|
||||
specialize qw/av1_inv_txfm2d_add_16x16 sse4_1/;
|
||||
}
|
||||
specialize qw/av1_inv_txfm2d_add_16x16 sse4_1/;
|
||||
add_proto qw/void av1_inv_txfm2d_add_32x32/, "const int32_t *input, uint16_t *output, int stride, TX_TYPE tx_type, int bd";
|
||||
if (aom_config("CONFIG_DAALA_DCT32") ne "yes") {
|
||||
specialize qw/av1_inv_txfm2d_add_32x32 avx2/;
|
||||
}
|
||||
if (aom_config("CONFIG_TX64X64") eq "yes") {
|
||||
add_proto qw/void av1_inv_txfm2d_add_64x64/, "const int32_t *input, uint16_t *output, int stride, TX_TYPE tx_type, int bd";
|
||||
add_proto qw/void av1_inv_txfm2d_add_64x32/, "const int32_t *input, uint16_t *output, int stride, TX_TYPE tx_type, int bd";
|
||||
add_proto qw/void av1_inv_txfm2d_add_32x64/, "const int32_t *input, uint16_t *output, int stride, TX_TYPE tx_type, int bd";
|
||||
}
|
||||
specialize qw/av1_inv_txfm2d_add_32x32 avx2/;
|
||||
|
||||
add_proto qw/void av1_inv_txfm2d_add_64x64/, "const int32_t *input, uint16_t *output, int stride, TX_TYPE tx_type, int bd";
|
||||
add_proto qw/void av1_inv_txfm2d_add_32x64/, "const int32_t *input, uint16_t *output, int stride, TX_TYPE tx_type, int bd";
|
||||
add_proto qw/void av1_inv_txfm2d_add_64x32/, "const int32_t *input, uint16_t *output, int stride, TX_TYPE tx_type, int bd";
|
||||
add_proto qw/void av1_inv_txfm2d_add_16x64/, "const int32_t *input, uint16_t *output, int stride, TX_TYPE tx_type, int bd";
|
||||
add_proto qw/void av1_inv_txfm2d_add_64x16/, "const int32_t *input, uint16_t *output, int stride, TX_TYPE tx_type, int bd";
|
||||
|
||||
specialize qw/av1_inv_txfm2d_add_64x64 sse4_1/;
|
||||
|
||||
add_proto qw/void av1_inv_txfm2d_add_4x16/, "const int32_t *input, uint16_t *output, int stride, TX_TYPE tx_type, int bd";
|
||||
add_proto qw/void av1_inv_txfm2d_add_16x4/, "const int32_t *input, uint16_t *output, int stride, TX_TYPE tx_type, int bd";
|
||||
add_proto qw/void av1_inv_txfm2d_add_8x32/, "const int32_t *input, uint16_t *output, int stride, TX_TYPE tx_type, int bd";
|
||||
add_proto qw/void av1_inv_txfm2d_add_32x8/, "const int32_t *input, uint16_t *output, int stride, TX_TYPE tx_type, int bd";
|
||||
|
||||
# directional intra predictor functions
|
||||
add_proto qw/void av1_highbd_dr_prediction_z1/, "uint16_t *dst, ptrdiff_t stride, int bw, int bh, const uint16_t *above, const uint16_t *left, int upsample_above, int dx, int dy, int bd";
|
||||
add_proto qw/void av1_highbd_dr_prediction_z2/, "uint16_t *dst, ptrdiff_t stride, int bw, int bh, const uint16_t *above, const uint16_t *left, int upsample_above, int upsample_left, int dx, int dy, int bd";
|
||||
add_proto qw/void av1_highbd_dr_prediction_z3/, "uint16_t *dst, ptrdiff_t stride, int bw, int bh, const uint16_t *above, const uint16_t *left, int upsample_left, int dx, int dy, int bd";
|
||||
|
||||
# build compound seg mask functions
|
||||
add_proto qw/void av1_build_compound_diffwtd_mask/, "uint8_t *mask, DIFFWTD_MASK_TYPE mask_type, const uint8_t *src0, int src0_stride, const uint8_t *src1, int src1_stride, int h, int w";
|
||||
specialize qw/av1_build_compound_diffwtd_mask sse4_1/;
|
||||
|
||||
add_proto qw/void av1_build_compound_diffwtd_mask_highbd/, "uint8_t *mask, DIFFWTD_MASK_TYPE mask_type, const uint8_t *src0, int src0_stride, const uint8_t *src1, int src1_stride, int h, int w, int bd";
|
||||
specialize qw/av1_build_compound_diffwtd_mask_highbd ssse3 avx2/;
|
||||
|
||||
add_proto qw/void av1_build_compound_diffwtd_mask_d16/, "uint8_t *mask, DIFFWTD_MASK_TYPE mask_type, const CONV_BUF_TYPE *src0, int src0_stride, const CONV_BUF_TYPE *src1, int src1_stride, int h, int w, ConvolveParams *conv_params, int bd";
|
||||
specialize qw/av1_build_compound_diffwtd_mask_d16 sse4_1 neon/;
|
||||
|
||||
#
|
||||
# Encoder functions below this point.
|
||||
|
|
@ -300,199 +161,85 @@ if (aom_config("CONFIG_AV1_ENCODER") eq "yes") {
|
|||
|
||||
# ENCODEMB INVOKE
|
||||
|
||||
if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
|
||||
# the transform coefficients are held in 32-bit
|
||||
# values, so the assembler code for av1_block_error can no longer be used.
|
||||
add_proto qw/int64_t av1_block_error/, "const tran_low_t *coeff, const tran_low_t *dqcoeff, intptr_t block_size, int64_t *ssz";
|
||||
specialize qw/av1_block_error avx2/;
|
||||
# the transform coefficients are held in 32-bit
|
||||
# values, so the assembler code for av1_block_error can no longer be used.
|
||||
add_proto qw/int64_t av1_block_error/, "const tran_low_t *coeff, const tran_low_t *dqcoeff, intptr_t block_size, int64_t *ssz";
|
||||
specialize qw/av1_block_error avx2/;
|
||||
|
||||
add_proto qw/void av1_quantize_fp/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan";
|
||||
specialize qw/av1_quantize_fp sse2 avx2/;
|
||||
add_proto qw/void av1_quantize_fp/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan";
|
||||
specialize qw/av1_quantize_fp sse2 avx2/;
|
||||
|
||||
add_proto qw/void av1_quantize_fp_32x32/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan";
|
||||
specialize qw/av1_quantize_fp_32x32 avx2/;
|
||||
add_proto qw/void av1_quantize_fp_32x32/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan";
|
||||
specialize qw/av1_quantize_fp_32x32 avx2/;
|
||||
|
||||
if (aom_config("CONFIG_TX64X64") eq "yes") {
|
||||
add_proto qw/void av1_quantize_fp_64x64/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan";
|
||||
}
|
||||
} else {
|
||||
add_proto qw/int64_t av1_block_error/, "const tran_low_t *coeff, const tran_low_t *dqcoeff, intptr_t block_size, int64_t *ssz";
|
||||
specialize qw/av1_block_error sse2 avx2 msa/;
|
||||
|
||||
add_proto qw/int64_t av1_block_error_fp/, "const int16_t *coeff, const int16_t *dqcoeff, int block_size";
|
||||
specialize qw/av1_block_error_fp neon sse2/;
|
||||
|
||||
add_proto qw/void av1_quantize_fp/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan";
|
||||
specialize qw/av1_quantize_fp neon sse2 avx2/, "$ssse3_x86_64";
|
||||
|
||||
add_proto qw/void av1_quantize_fp_32x32/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan";
|
||||
specialize qw/av1_quantize_fp_32x32 avx2/, "$ssse3_x86_64";
|
||||
|
||||
if (aom_config("CONFIG_TX64X64") eq "yes") {
|
||||
add_proto qw/void av1_quantize_fp_64x64/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan";
|
||||
}
|
||||
|
||||
}
|
||||
add_proto qw/void av1_quantize_fp_64x64/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan";
|
||||
specialize qw/av1_quantize_fp_64x64 avx2/;
|
||||
|
||||
# fdct functions
|
||||
|
||||
add_proto qw/void av1_fht4x4/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param";
|
||||
if (aom_config("CONFIG_DAALA_DCT4") ne "yes") {
|
||||
specialize qw/av1_fht4x4 sse2/;
|
||||
}
|
||||
|
||||
add_proto qw/void av1_fwht4x4/, "const int16_t *input, tran_low_t *output, int stride";
|
||||
|
||||
add_proto qw/void av1_fht8x8/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param";
|
||||
if (aom_config("CONFIG_DAALA_DCT8") ne "yes") {
|
||||
specialize qw/av1_fht8x8 sse2/;
|
||||
}
|
||||
|
||||
add_proto qw/void av1_fht16x16/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param";
|
||||
if (aom_config("CONFIG_DAALA_DCT16") ne "yes") {
|
||||
specialize qw/av1_fht16x16 sse2 avx2/;
|
||||
}
|
||||
|
||||
add_proto qw/void av1_fht32x32/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param";
|
||||
if (aom_config("CONFIG_DAALA_DCT32") ne "yes") {
|
||||
specialize qw/av1_fht32x32 sse2 avx2/;
|
||||
}
|
||||
|
||||
if (aom_config("CONFIG_TX64X64") eq "yes") {
|
||||
add_proto qw/void av1_fht64x64/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param";
|
||||
add_proto qw/void av1_fht64x32/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param";
|
||||
add_proto qw/void av1_fht32x64/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param";
|
||||
}
|
||||
|
||||
add_proto qw/void av1_fht4x8/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param";
|
||||
specialize qw/av1_fht4x8 sse2/;
|
||||
|
||||
add_proto qw/void av1_fht8x4/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param";
|
||||
specialize qw/av1_fht8x4 sse2/;
|
||||
|
||||
add_proto qw/void av1_fht8x16/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param";
|
||||
specialize qw/av1_fht8x16 sse2/;
|
||||
|
||||
add_proto qw/void av1_fht16x8/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param";
|
||||
specialize qw/av1_fht16x8 sse2/;
|
||||
|
||||
add_proto qw/void av1_fht16x32/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param";
|
||||
specialize qw/av1_fht16x32 sse2/;
|
||||
|
||||
add_proto qw/void av1_fht32x16/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param";
|
||||
specialize qw/av1_fht32x16 sse2/;
|
||||
|
||||
add_proto qw/void av1_fht4x16/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param";
|
||||
|
||||
add_proto qw/void av1_fht16x4/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param";
|
||||
|
||||
add_proto qw/void av1_fht8x32/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param";
|
||||
|
||||
add_proto qw/void av1_fht32x8/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param";
|
||||
|
||||
if (aom_config("CONFIG_HIGHBITDEPTH") ne "yes") {
|
||||
if (aom_config("CONFIG_EXT_TX") ne "yes") {
|
||||
if (aom_config("CONFIG_DAALA_DCT4") ne "yes") {
|
||||
specialize qw/av1_fht4x4 msa/;
|
||||
}
|
||||
if (aom_config("CONFIG_DAALA_DCT8") ne "yes") {
|
||||
specialize qw/av1_fht8x8 msa/;
|
||||
}
|
||||
if (aom_config("CONFIG_DAALA_DCT16") ne "yes") {
|
||||
specialize qw/av1_fht16x16 msa/;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
add_proto qw/void av1_fwd_idtx/, "const int16_t *src_diff, tran_low_t *coeff, int stride, int bsx, int bsy, TX_TYPE tx_type";
|
||||
|
||||
#fwd txfm
|
||||
add_proto qw/void av1_lowbd_fwd_txfm/, "const int16_t *src_diff, tran_low_t *coeff, int diff_stride, TxfmParam *txfm_param";
|
||||
specialize qw/av1_lowbd_fwd_txfm sse2 sse4_1/;
|
||||
|
||||
add_proto qw/void av1_fwd_txfm2d_4x8/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd";
|
||||
add_proto qw/void av1_fwd_txfm2d_8x4/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd";
|
||||
add_proto qw/void av1_fwd_txfm2d_8x16/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd";
|
||||
add_proto qw/void av1_fwd_txfm2d_16x8/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd";
|
||||
add_proto qw/void av1_fwd_txfm2d_16x32/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd";
|
||||
add_proto qw/void av1_fwd_txfm2d_32x16/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd";
|
||||
add_proto qw/void av1_fwd_txfm2d_4x16/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd";
|
||||
add_proto qw/void av1_fwd_txfm2d_16x4/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd";
|
||||
add_proto qw/void av1_fwd_txfm2d_8x32/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd";
|
||||
add_proto qw/void av1_fwd_txfm2d_32x8/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd";
|
||||
add_proto qw/void av1_fwd_txfm2d_4x4/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd";
|
||||
if (aom_config("CONFIG_DAALA_DCT4") ne "yes") {
|
||||
specialize qw/av1_fwd_txfm2d_4x4 sse4_1/;
|
||||
}
|
||||
specialize qw/av1_fwd_txfm2d_4x4 sse4_1/;
|
||||
add_proto qw/void av1_fwd_txfm2d_8x8/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd";
|
||||
if (aom_config("CONFIG_DAALA_DCT8") ne "yes") {
|
||||
specialize qw/av1_fwd_txfm2d_8x8 sse4_1/;
|
||||
}
|
||||
specialize qw/av1_fwd_txfm2d_8x8 sse4_1/;
|
||||
add_proto qw/void av1_fwd_txfm2d_16x16/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd";
|
||||
if (aom_config("CONFIG_DAALA_DCT16") ne "yes") {
|
||||
specialize qw/av1_fwd_txfm2d_16x16 sse4_1/;
|
||||
}
|
||||
specialize qw/av1_fwd_txfm2d_16x16 sse4_1/;
|
||||
add_proto qw/void av1_fwd_txfm2d_32x32/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd";
|
||||
if (aom_config("CONFIG_DAALA_DCT32") ne "yes") {
|
||||
specialize qw/av1_fwd_txfm2d_32x32 sse4_1/;
|
||||
}
|
||||
specialize qw/av1_fwd_txfm2d_32x32 sse4_1/;
|
||||
|
||||
add_proto qw/void av1_fwd_txfm2d_64x64/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd";
|
||||
add_proto qw/void av1_fwd_txfm2d_32x64/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd";
|
||||
add_proto qw/void av1_fwd_txfm2d_64x32/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd";
|
||||
add_proto qw/void av1_fwd_txfm2d_16x64/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd";
|
||||
add_proto qw/void av1_fwd_txfm2d_64x16/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd";
|
||||
|
||||
if (aom_config("CONFIG_TX64X64") eq "yes") {
|
||||
add_proto qw/void av1_fwd_txfm2d_32x64/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd";
|
||||
add_proto qw/void av1_fwd_txfm2d_64x32/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd";
|
||||
add_proto qw/void av1_fwd_txfm2d_64x64/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd";
|
||||
}
|
||||
#
|
||||
# Motion search
|
||||
#
|
||||
add_proto qw/int av1_full_search_sad/, "const struct macroblock *x, const struct mv *ref_mv, int sad_per_bit, int distance, const struct aom_variance_vtable *fn_ptr, const struct mv *center_mv, struct mv *best_mv";
|
||||
specialize qw/av1_full_search_sad sse3 sse4_1/;
|
||||
$av1_full_search_sad_sse3=av1_full_search_sadx3;
|
||||
$av1_full_search_sad_sse4_1=av1_full_search_sadx8;
|
||||
add_proto qw/int av1_diamond_search_sad/, "struct macroblock *x, const struct search_site_config *cfg, MV *ref_mv, MV *best_mv, int search_param, int sad_per_bit, int *num00, const struct aom_variance_vtable *fn_ptr, const MV *center_mv";
|
||||
|
||||
add_proto qw/int av1_diamond_search_sad/, "struct macroblock *x, const struct search_site_config *cfg, struct mv *ref_mv, struct mv *best_mv, int search_param, int sad_per_bit, int *num00, const struct aom_variance_vtable *fn_ptr, const struct mv *center_mv";
|
||||
|
||||
add_proto qw/int av1_full_range_search/, "const struct macroblock *x, const struct search_site_config *cfg, struct mv *ref_mv, struct mv *best_mv, int search_param, int sad_per_bit, int *num00, const struct aom_variance_vtable *fn_ptr, const struct mv *center_mv";
|
||||
add_proto qw/int av1_full_range_search/, "const struct macroblock *x, const struct search_site_config *cfg, MV *ref_mv, MV *best_mv, int search_param, int sad_per_bit, int *num00, const struct aom_variance_vtable *fn_ptr, const MV *center_mv";
|
||||
|
||||
add_proto qw/void av1_temporal_filter_apply/, "uint8_t *frame1, unsigned int stride, uint8_t *frame2, unsigned int block_width, unsigned int block_height, int strength, int filter_weight, unsigned int *accumulator, uint16_t *count";
|
||||
specialize qw/av1_temporal_filter_apply sse2 msa/;
|
||||
|
||||
if (aom_config("CONFIG_AOM_QM") eq "yes") {
|
||||
add_proto qw/void av1_quantize_b/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan, const qm_val_t * qm_ptr, const qm_val_t * iqm_ptr, int log_scale";
|
||||
} else {
|
||||
add_proto qw/void av1_quantize_b/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan, int log_scale";
|
||||
}
|
||||
add_proto qw/void av1_quantize_b/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan, const qm_val_t * qm_ptr, const qm_val_t * iqm_ptr, int log_scale";
|
||||
|
||||
if (aom_config("CONFIG_LGT_FROM_PRED") eq "yes") {
|
||||
add_proto qw/void flgt2d_from_pred/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param";
|
||||
}
|
||||
# ENCODEMB INVOKE
|
||||
|
||||
if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
|
||||
add_proto qw/int64_t av1_highbd_block_error/, "const tran_low_t *coeff, const tran_low_t *dqcoeff, intptr_t block_size, int64_t *ssz, int bd";
|
||||
specialize qw/av1_highbd_block_error sse2/;
|
||||
|
||||
# ENCODEMB INVOKE
|
||||
if (aom_config("CONFIG_NEW_QUANT") eq "yes") {
|
||||
add_proto qw/void highbd_quantize_nuq/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, const int16_t *dequant_ptr, const cuml_bins_type_nuq *cuml_bins_ptr, const dequant_val_type_nuq *dequant_val, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const int16_t *scan, const uint8_t *band";
|
||||
add_proto qw/void av1_highbd_temporal_filter_apply/, "uint8_t *frame1, unsigned int stride, uint8_t *frame2, unsigned int block_width, unsigned int block_height, int strength, int filter_weight, unsigned int *accumulator, uint16_t *count";
|
||||
|
||||
add_proto qw/void highbd_quantize_fp_nuq/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *quant_ptr, const int16_t *dequant_ptr, const cuml_bins_type_nuq *cuml_bins_ptr, const dequant_val_type_nuq *dequant_val, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const int16_t *scan, const uint8_t *band";
|
||||
|
||||
add_proto qw/void highbd_quantize_32x32_nuq/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, const int16_t *dequant_ptr, const cuml_bins_type_nuq *cuml_bins_ptr, const dequant_val_type_nuq *dequant_val, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const int16_t *scan, const uint8_t *band";
|
||||
|
||||
add_proto qw/void highbd_quantize_32x32_fp_nuq/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *quant_ptr, const int16_t *dequant_ptr, const cuml_bins_type_nuq *cuml_bins_ptr, const dequant_val_type_nuq *dequant_val, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const int16_t *scan, const uint8_t *band";
|
||||
|
||||
if (aom_config("CONFIG_TX64X64") eq "yes") {
|
||||
add_proto qw/void highbd_quantize_64x64_nuq/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, const int16_t *dequant_ptr, const cuml_bins_type_nuq *cuml_bins_ptr, const dequant_val_type_nuq *dequant_val, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const int16_t *scan, const uint8_t *band";
|
||||
|
||||
add_proto qw/void highbd_quantize_64x64_fp_nuq/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *quant_ptr, const int16_t *dequant_ptr, const cuml_bins_type_nuq *cuml_bins_ptr, const dequant_val_type_nuq *dequant_val, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const int16_t *scan, const uint8_t *band";
|
||||
}
|
||||
}
|
||||
|
||||
add_proto qw/int64_t av1_highbd_block_error/, "const tran_low_t *coeff, const tran_low_t *dqcoeff, intptr_t block_size, int64_t *ssz, int bd";
|
||||
specialize qw/av1_highbd_block_error sse2/;
|
||||
|
||||
add_proto qw/void av1_highbd_temporal_filter_apply/, "uint8_t *frame1, unsigned int stride, uint8_t *frame2, unsigned int block_width, unsigned int block_height, int strength, int filter_weight, unsigned int *accumulator, uint16_t *count";
|
||||
|
||||
}
|
||||
|
||||
add_proto qw/void av1_highbd_quantize_fp/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan, int log_scale";
|
||||
add_proto qw/void av1_highbd_quantize_fp/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan, int log_scale";
|
||||
specialize qw/av1_highbd_quantize_fp sse4_1 avx2/;
|
||||
|
||||
add_proto qw/void av1_highbd_fwht4x4/, "const int16_t *input, tran_low_t *output, int stride";
|
||||
|
||||
# End av1_high encoder functions
|
||||
|
||||
# txb
|
||||
add_proto qw/void av1_get_nz_map_contexts/, "const uint8_t *const levels, const int16_t *const scan, const uint16_t eob, const TX_SIZE tx_size, const TX_CLASS tx_class, int8_t *const coeff_contexts";
|
||||
specialize qw/av1_get_nz_map_contexts sse2/;
|
||||
add_proto qw/void av1_txb_init_levels/, "const tran_low_t *const coeff, const int width, const int height, uint8_t *const levels";
|
||||
specialize qw/av1_txb_init_levels sse4_1/;
|
||||
|
||||
add_proto qw/uint64_t av1_wedge_sse_from_residuals/, "const int16_t *r1, const int16_t *d, const uint8_t *m, int N";
|
||||
specialize qw/av1_wedge_sse_from_residuals sse2/;
|
||||
add_proto qw/int av1_wedge_sign_from_residuals/, "const int16_t *ds, const uint8_t *m, int N, int64_t limit";
|
||||
|
|
@ -500,179 +247,132 @@ if (aom_config("CONFIG_AV1_ENCODER") eq "yes") {
|
|||
add_proto qw/void av1_wedge_compute_delta_squares/, "int16_t *d, const int16_t *a, const int16_t *b, int N";
|
||||
specialize qw/av1_wedge_compute_delta_squares sse2/;
|
||||
|
||||
# hash
|
||||
add_proto qw/uint32_t av1_get_crc32c_value/, "void *crc_calculator, uint8_t *p, int length";
|
||||
specialize qw/av1_get_crc32c_value sse4_2/;
|
||||
|
||||
}
|
||||
# end encoder functions
|
||||
|
||||
# If PVQ is enabled, fwd transforms are required by decoder
|
||||
if (aom_config("CONFIG_PVQ") eq "yes") {
|
||||
# fdct functions
|
||||
|
||||
if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
|
||||
add_proto qw/void av1_fht4x4/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param";
|
||||
specialize qw/av1_fht4x4 sse2/;
|
||||
|
||||
add_proto qw/void av1_fht8x8/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param";
|
||||
specialize qw/av1_fht8x8 sse2/;
|
||||
|
||||
add_proto qw/void av1_fht16x16/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param";
|
||||
specialize qw/av1_fht16x16 sse2/;
|
||||
|
||||
add_proto qw/void av1_fwht4x4/, "const int16_t *input, tran_low_t *output, int stride";
|
||||
specialize qw/av1_fwht4x4 sse2/;
|
||||
} else {
|
||||
add_proto qw/void av1_fht4x4/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param";
|
||||
specialize qw/av1_fht4x4 sse2 msa/;
|
||||
|
||||
add_proto qw/void av1_fht8x8/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param";
|
||||
specialize qw/av1_fht8x8 sse2 msa/;
|
||||
|
||||
add_proto qw/void av1_fht16x16/, "const int16_t *input, tran_low_t *output, int stride, struct txfm_param *param";
|
||||
specialize qw/av1_fht16x16 sse2 msa/;
|
||||
|
||||
add_proto qw/void av1_fwht4x4/, "const int16_t *input, tran_low_t *output, int stride";
|
||||
specialize qw/av1_fwht4x4 msa sse2/;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
# Deringing Functions
|
||||
|
||||
if (aom_config("CONFIG_CDEF") eq "yes") {
|
||||
add_proto qw/int cdef_find_dir/, "const uint16_t *img, int stride, int32_t *var, int coeff_shift";
|
||||
if (aom_config("CONFIG_CDEF_SINGLEPASS") ne "yes") {
|
||||
add_proto qw/void aom_clpf_block_hbd/, "uint16_t *dst, const uint16_t *src, int dstride, int sstride, int sizex, int sizey, unsigned int strength, unsigned int bd";
|
||||
add_proto qw/void aom_clpf_hblock_hbd/, "uint16_t *dst, const uint16_t *src, int dstride, int sstride, int sizex, int sizey, unsigned int strength, unsigned int bd";
|
||||
add_proto qw/void aom_clpf_block/, "uint8_t *dst, const uint16_t *src, int dstride, int sstride, int sizex, int sizey, unsigned int strength, unsigned int bd";
|
||||
add_proto qw/void aom_clpf_hblock/, "uint8_t *dst, const uint16_t *src, int dstride, int sstride, int sizex, int sizey, unsigned int strength, unsigned int bd";
|
||||
add_proto qw/void cdef_direction_4x4/, "uint16_t *y, int ystride, const uint16_t *in, int threshold, int dir, int damping";
|
||||
add_proto qw/void cdef_direction_8x8/, "uint16_t *y, int ystride, const uint16_t *in, int threshold, int dir, int damping";
|
||||
add_proto qw/void copy_8x8_16bit_to_8bit/, "uint8_t *dst, int dstride, const uint16_t *src, int sstride";
|
||||
add_proto qw/void copy_4x4_16bit_to_8bit/, "uint8_t *dst, int dstride, const uint16_t *src, int sstride";
|
||||
add_proto qw/void copy_8x8_16bit_to_16bit/, "uint16_t *dst, int dstride, const uint16_t *src, int sstride";
|
||||
add_proto qw/void copy_4x4_16bit_to_16bit/, "uint16_t *dst, int dstride, const uint16_t *src, int sstride";
|
||||
} else {
|
||||
add_proto qw/void cdef_filter_block/, "uint8_t *dst8, uint16_t *dst16, int dstride, const uint16_t *in, int pri_strength, int sec_strength, int dir, int pri_damping, int sec_damping, int bsize, int max";
|
||||
}
|
||||
add_proto qw/int cdef_find_dir/, "const uint16_t *img, int stride, int32_t *var, int coeff_shift";
|
||||
add_proto qw/void cdef_filter_block/, "uint8_t *dst8, uint16_t *dst16, int dstride, const uint16_t *in, int pri_strength, int sec_strength, int dir, int pri_damping, int sec_damping, int bsize, int max, int coeff_shift";
|
||||
|
||||
add_proto qw/void copy_rect8_8bit_to_16bit/, "uint16_t *dst, int dstride, const uint8_t *src, int sstride, int v, int h";
|
||||
add_proto qw/void copy_rect8_16bit_to_16bit/, "uint16_t *dst, int dstride, const uint16_t *src, int sstride, int v, int h";
|
||||
add_proto qw/void copy_rect8_8bit_to_16bit/, "uint16_t *dst, int dstride, const uint8_t *src, int sstride, int v, int h";
|
||||
add_proto qw/void copy_rect8_16bit_to_16bit/, "uint16_t *dst, int dstride, const uint16_t *src, int sstride, int v, int h";
|
||||
|
||||
# VS compiling for 32 bit targets does not support vector types in
|
||||
# structs as arguments, which makes the v256 type of the intrinsics
|
||||
# hard to support, so optimizations for this target are disabled.
|
||||
if ($opts{config} !~ /libs-x86-win32-vs.*/) {
|
||||
if (aom_config("CONFIG_CDEF_SINGLEPASS") eq "yes") {
|
||||
specialize qw/cdef_find_dir sse2 ssse3 sse4_1 avx2 neon/;
|
||||
specialize qw/cdef_filter_block sse2 ssse3 sse4_1 avx2 neon/;
|
||||
specialize qw/copy_rect8_8bit_to_16bit sse2 ssse3 sse4_1 avx2 neon/;
|
||||
specialize qw/copy_rect8_16bit_to_16bit sse2 ssse3 sse4_1 avx2 neon/;
|
||||
} else {
|
||||
specialize qw/cdef_find_dir sse2 ssse3 sse4_1 neon/;
|
||||
specialize qw/aom_clpf_block_hbd sse2 ssse3 sse4_1 neon/;
|
||||
specialize qw/aom_clpf_hblock_hbd sse2 ssse3 sse4_1 neon/;
|
||||
specialize qw/aom_clpf_block sse2 ssse3 sse4_1 neon/;
|
||||
specialize qw/aom_clpf_hblock sse2 ssse3 sse4_1 neon/;
|
||||
specialize qw/cdef_find_dir sse2 ssse3 sse4_1 neon/;
|
||||
specialize qw/cdef_direction_4x4 sse2 ssse3 sse4_1 neon/;
|
||||
specialize qw/cdef_direction_8x8 sse2 ssse3 sse4_1 neon/;
|
||||
|
||||
specialize qw/copy_8x8_16bit_to_8bit sse2 ssse3 sse4_1 neon/;
|
||||
specialize qw/copy_4x4_16bit_to_8bit sse2 ssse3 sse4_1 neon/;
|
||||
specialize qw/copy_8x8_16bit_to_16bit sse2 ssse3 sse4_1 neon/;
|
||||
specialize qw/copy_4x4_16bit_to_16bit sse2 ssse3 sse4_1 neon/;
|
||||
specialize qw/copy_rect8_8bit_to_16bit sse2 ssse3 sse4_1 neon/;
|
||||
specialize qw/copy_rect8_16bit_to_16bit sse2 ssse3 sse4_1 neon/;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# PVQ Functions
|
||||
|
||||
if (aom_config("CONFIG_PVQ") eq "yes") {
|
||||
add_proto qw/double pvq_search_rdo_double/, "const od_val16 *xcoeff, int n, int k, int *ypulse, double g2, double pvq_norm_lambda, int prev_k";
|
||||
specialize qw/pvq_search_rdo_double sse4_1/;
|
||||
# VS compiling for 32 bit targets does not support vector types in
|
||||
# structs as arguments, which makes the v256 type of the intrinsics
|
||||
# hard to support, so optimizations for this target are disabled.
|
||||
if ($opts{config} !~ /libs-x86-win32-vs.*/) {
|
||||
specialize qw/cdef_find_dir sse2 ssse3 sse4_1 avx2 neon/;
|
||||
specialize qw/cdef_filter_block sse2 ssse3 sse4_1 avx2 neon/;
|
||||
specialize qw/copy_rect8_8bit_to_16bit sse2 ssse3 sse4_1 avx2 neon/;
|
||||
specialize qw/copy_rect8_16bit_to_16bit sse2 ssse3 sse4_1 avx2 neon/;
|
||||
}
|
||||
|
||||
# WARPED_MOTION / GLOBAL_MOTION functions
|
||||
|
||||
if ((aom_config("CONFIG_WARPED_MOTION") eq "yes") ||
|
||||
(aom_config("CONFIG_GLOBAL_MOTION") eq "yes")) {
|
||||
add_proto qw/void av1_warp_affine/, "const int32_t *mat, const uint8_t *ref, int width, int height, int stride, uint8_t *pred, int p_col, int p_row, int p_width, int p_height, int p_stride, int subsampling_x, int subsampling_y, ConvolveParams *conv_params, int16_t alpha, int16_t beta, int16_t gamma, int16_t delta";
|
||||
specialize qw/av1_warp_affine sse2 ssse3/;
|
||||
add_proto qw/void av1_warp_affine/, "const int32_t *mat, const uint8_t *ref, int width, int height, int stride, uint8_t *pred, int p_col, int p_row, int p_width, int p_height, int p_stride, int subsampling_x, int subsampling_y, ConvolveParams *conv_params, int16_t alpha, int16_t beta, int16_t gamma, int16_t delta";
|
||||
specialize qw/av1_warp_affine sse4_1/;
|
||||
|
||||
if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
|
||||
add_proto qw/void av1_highbd_warp_affine/, "const int32_t *mat, const uint16_t *ref, int width, int height, int stride, uint16_t *pred, int p_col, int p_row, int p_width, int p_height, int p_stride, int subsampling_x, int subsampling_y, int bd, ConvolveParams *conv_params, int16_t alpha, int16_t beta, int16_t gamma, int16_t delta";
|
||||
specialize qw/av1_highbd_warp_affine ssse3/;
|
||||
}
|
||||
}
|
||||
add_proto qw/void av1_highbd_warp_affine/, "const int32_t *mat, const uint16_t *ref, int width, int height, int stride, uint16_t *pred, int p_col, int p_row, int p_width, int p_height, int p_stride, int subsampling_x, int subsampling_y, int bd, ConvolveParams *conv_params, int16_t alpha, int16_t beta, int16_t gamma, int16_t delta";
|
||||
specialize qw/av1_highbd_warp_affine sse4_1/;
|
||||
|
||||
if (aom_config("CONFIG_GLOBAL_MOTION") eq "yes" &&
|
||||
aom_config("CONFIG_AV1_ENCODER") eq "yes") {
|
||||
if (aom_config("CONFIG_AV1_ENCODER") eq "yes") {
|
||||
add_proto qw/double compute_cross_correlation/, "unsigned char *im1, int stride1, int x1, int y1, unsigned char *im2, int stride2, int x2, int y2";
|
||||
specialize qw/compute_cross_correlation sse4_1/;
|
||||
}
|
||||
|
||||
# LOOP_RESTORATION functions
|
||||
|
||||
if (aom_config("CONFIG_LOOP_RESTORATION") eq "yes") {
|
||||
add_proto qw/void apply_selfguided_restoration/, "uint8_t *dat, int width, int height, int stride, int eps, int *xqd, uint8_t *dst, int dst_stride, int32_t *tmpbuf";
|
||||
specialize qw/apply_selfguided_restoration sse4_1/;
|
||||
add_proto qw/void apply_selfguided_restoration/, "const uint8_t *dat, int width, int height, int stride, int eps, const int *xqd, uint8_t *dst, int dst_stride, int32_t *tmpbuf, int bit_depth, int highbd";
|
||||
specialize qw/apply_selfguided_restoration sse4_1 avx2/;
|
||||
|
||||
add_proto qw/void av1_selfguided_restoration/, "uint8_t *dgd, int width, int height, int stride, int32_t *dst, int dst_stride, int r, int eps";
|
||||
specialize qw/av1_selfguided_restoration sse4_1/;
|
||||
|
||||
add_proto qw/void av1_highpass_filter/, "uint8_t *dgd, int width, int height, int stride, int32_t *dst, int dst_stride, int r, int eps";
|
||||
specialize qw/av1_highpass_filter sse4_1/;
|
||||
|
||||
if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
|
||||
add_proto qw/void apply_selfguided_restoration_highbd/, "uint16_t *dat, int width, int height, int stride, int bit_depth, int eps, int *xqd, uint16_t *dst, int dst_stride, int32_t *tmpbuf";
|
||||
specialize qw/apply_selfguided_restoration_highbd sse4_1/;
|
||||
|
||||
add_proto qw/void av1_selfguided_restoration_highbd/, "uint16_t *dgd, int width, int height, int stride, int32_t *dst, int dst_stride, int bit_depth, int r, int eps";
|
||||
specialize qw/av1_selfguided_restoration_highbd sse4_1/;
|
||||
|
||||
add_proto qw/void av1_highpass_filter_highbd/, "uint16_t *dgd, int width, int height, int stride, int32_t *dst, int dst_stride, int r, int eps";
|
||||
specialize qw/av1_highpass_filter_highbd sse4_1/;
|
||||
}
|
||||
}
|
||||
add_proto qw/void av1_selfguided_restoration/, "const uint8_t *dgd8, int width, int height,
|
||||
int dgd_stride, int32_t *flt0, int32_t *flt1, int flt_stride,
|
||||
int sgr_params_idx, int bit_depth, int highbd";
|
||||
specialize qw/av1_selfguided_restoration sse4_1 avx2/;
|
||||
|
||||
# CONVOLVE_ROUND/COMPOUND_ROUND functions
|
||||
|
||||
if (aom_config("CONFIG_CONVOLVE_ROUND") eq "yes") {
|
||||
add_proto qw/void av1_convolve_2d/, "const uint8_t *src, int src_stride, CONV_BUF_TYPE *dst, int dst_stride, int w, int h, InterpFilterParams *filter_params_x, InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params";
|
||||
specialize qw/av1_convolve_2d sse2/;
|
||||
add_proto qw/void av1_convolve_rounding/, "const int32_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, int bits";
|
||||
specialize qw/av1_convolve_rounding avx2/;
|
||||
add_proto qw/void av1_convolve_2d_sr/, "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, InterpFilterParams *filter_params_x, InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params";
|
||||
add_proto qw/void av1_convolve_2d_copy_sr/, "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, InterpFilterParams *filter_params_x, InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params";
|
||||
add_proto qw/void av1_convolve_x_sr/, "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, InterpFilterParams *filter_params_x, InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params";
|
||||
add_proto qw/void av1_convolve_y_sr/, "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, InterpFilterParams *filter_params_x, InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params";
|
||||
add_proto qw/void av1_jnt_convolve_2d/, "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, InterpFilterParams *filter_params_x, InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params";
|
||||
add_proto qw/void av1_jnt_convolve_2d_copy/, "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, InterpFilterParams *filter_params_x, InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params";
|
||||
add_proto qw/void av1_jnt_convolve_x/, "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, InterpFilterParams *filter_params_x, InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params";
|
||||
add_proto qw/void av1_jnt_convolve_y/, "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, InterpFilterParams *filter_params_x, InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params";
|
||||
add_proto qw/void av1_highbd_convolve_2d_copy_sr/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, InterpFilterParams *filter_params_x, InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params, int bd";
|
||||
add_proto qw/void av1_highbd_convolve_2d_sr/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, InterpFilterParams *filter_params_x, InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params, int bd";
|
||||
add_proto qw/void av1_highbd_convolve_x_sr/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, InterpFilterParams *filter_params_x, InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params, int bd";
|
||||
add_proto qw/void av1_highbd_convolve_y_sr/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, InterpFilterParams *filter_params_x, InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params, int bd";
|
||||
add_proto qw/void av1_highbd_jnt_convolve_2d/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, InterpFilterParams *filter_params_x, InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params, int bd";
|
||||
add_proto qw/void av1_highbd_jnt_convolve_x/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, InterpFilterParams *filter_params_x, InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params, int bd";
|
||||
add_proto qw/void av1_highbd_jnt_convolve_y/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, InterpFilterParams *filter_params_x, InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params, int bd";
|
||||
add_proto qw/void av1_highbd_jnt_convolve_2d_copy/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, InterpFilterParams *filter_params_x, InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params, int bd";
|
||||
|
||||
add_proto qw/void av1_convolve_2d_scale/, "const uint8_t *src, int src_stride, CONV_BUF_TYPE *dst, int dst_stride, int w, int h, InterpFilterParams *filter_params_x, InterpFilterParams *filter_params_y, const int subpel_x_qn, const int x_step_qn, const int subpel_y_q4, const int y_step_qn, ConvolveParams *conv_params";
|
||||
if (aom_config("CONFIG_COMPOUND_ROUND") ne "yes") {
|
||||
specialize qw/av1_convolve_2d_scale sse4_1/;
|
||||
}
|
||||
add_proto qw/void av1_convolve_2d_scale/, "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, InterpFilterParams *filter_params_x, InterpFilterParams *filter_params_y, const int subpel_x_qn, const int x_step_qn, const int subpel_y_q4, const int y_step_qn, ConvolveParams *conv_params";
|
||||
add_proto qw/void av1_highbd_convolve_2d_scale/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, InterpFilterParams *filter_params_x, InterpFilterParams *filter_params_y, const int subpel_x_q4, const int x_step_qn, const int subpel_y_q4, const int y_step_qn, ConvolveParams *conv_params, int bd";
|
||||
|
||||
if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
|
||||
add_proto qw/void av1_highbd_convolve_2d/, "const uint16_t *src, int src_stride, CONV_BUF_TYPE *dst, int dst_stride, int w, int h, InterpFilterParams *filter_params_x, InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params, int bd";
|
||||
specialize qw/av1_highbd_convolve_2d ssse3/;
|
||||
add_proto qw/void av1_highbd_convolve_rounding/, "const int32_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, int bits, int bd";
|
||||
specialize qw/av1_highbd_convolve_rounding avx2/;
|
||||
|
||||
add_proto qw/void av1_highbd_convolve_2d_scale/, "const uint16_t *src, int src_stride, CONV_BUF_TYPE *dst, int dst_stride, int w, int h, InterpFilterParams *filter_params_x, InterpFilterParams *filter_params_y, const int subpel_x_q4, const int x_step_qn, const int subpel_y_q4, const int y_step_qn, ConvolveParams *conv_params, int bd";
|
||||
if (aom_config("CONFIG_COMPOUND_ROUND") ne "yes") {
|
||||
specialize qw/av1_highbd_convolve_2d_scale sse4_1/;
|
||||
}
|
||||
}
|
||||
}
|
||||
specialize qw/av1_convolve_2d_sr sse2 avx2 neon/;
|
||||
specialize qw/av1_convolve_2d_copy_sr sse2 avx2 neon/;
|
||||
specialize qw/av1_convolve_x_sr sse2 avx2 neon/;
|
||||
specialize qw/av1_convolve_y_sr sse2 avx2 neon/;
|
||||
specialize qw/av1_convolve_2d_scale sse4_1/;
|
||||
specialize qw/av1_jnt_convolve_2d ssse3 avx2 neon/;
|
||||
specialize qw/av1_jnt_convolve_2d_copy sse2 avx2 neon/;
|
||||
specialize qw/av1_jnt_convolve_x sse2 avx2 neon/;
|
||||
specialize qw/av1_jnt_convolve_y sse2 avx2 neon/;
|
||||
specialize qw/av1_highbd_convolve_2d_copy_sr sse2 avx2/;
|
||||
specialize qw/av1_highbd_convolve_2d_sr ssse3 avx2/;
|
||||
specialize qw/av1_highbd_convolve_x_sr ssse3 avx2/;
|
||||
specialize qw/av1_highbd_convolve_y_sr ssse3 avx2/;
|
||||
specialize qw/av1_highbd_convolve_2d_scale sse4_1/;
|
||||
specialize qw/av1_highbd_jnt_convolve_2d sse4_1 avx2/;
|
||||
specialize qw/av1_highbd_jnt_convolve_x sse4_1 avx2/;
|
||||
specialize qw/av1_highbd_jnt_convolve_y sse4_1 avx2/;
|
||||
specialize qw/av1_highbd_jnt_convolve_2d_copy sse4_1 avx2/;
|
||||
|
||||
# INTRA_EDGE functions
|
||||
if (aom_config("CONFIG_INTRA_EDGE") eq "yes") {
|
||||
add_proto qw/void av1_filter_intra_edge/, "uint8_t *p, int sz, int strength";
|
||||
specialize qw/av1_filter_intra_edge sse4_1/;
|
||||
add_proto qw/void av1_upsample_intra_edge/, "uint8_t *p, int sz";
|
||||
specialize qw/av1_upsample_intra_edge sse4_1/;
|
||||
if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
|
||||
add_proto qw/void av1_filter_intra_edge_high/, "uint16_t *p, int sz, int strength";
|
||||
specialize qw/av1_filter_intra_edge_high sse4_1/;
|
||||
add_proto qw/void av1_upsample_intra_edge_high/, "uint16_t *p, int sz, int bd";
|
||||
specialize qw/av1_upsample_intra_edge_high sse4_1/;
|
||||
}
|
||||
}
|
||||
add_proto qw/void av1_filter_intra_edge/, "uint8_t *p, int sz, int strength";
|
||||
specialize qw/av1_filter_intra_edge sse4_1/;
|
||||
add_proto qw/void av1_upsample_intra_edge/, "uint8_t *p, int sz";
|
||||
specialize qw/av1_upsample_intra_edge sse4_1/;
|
||||
|
||||
add_proto qw/void av1_filter_intra_edge_high/, "uint16_t *p, int sz, int strength";
|
||||
specialize qw/av1_filter_intra_edge_high sse4_1/;
|
||||
add_proto qw/void av1_upsample_intra_edge_high/, "uint16_t *p, int sz, int bd";
|
||||
specialize qw/av1_upsample_intra_edge_high sse4_1/;
|
||||
|
||||
# CFL
|
||||
add_proto qw/cfl_subtract_average_fn get_subtract_average_fn/, "TX_SIZE tx_size";
|
||||
specialize qw/get_subtract_average_fn sse2 avx2 neon vsx/;
|
||||
|
||||
add_proto qw/cfl_subsample_lbd_fn cfl_get_luma_subsampling_420_lbd/, "TX_SIZE tx_size";
|
||||
specialize qw/cfl_get_luma_subsampling_420_lbd ssse3 avx2 neon/;
|
||||
|
||||
add_proto qw/cfl_subsample_lbd_fn cfl_get_luma_subsampling_422_lbd/, "TX_SIZE tx_size";
|
||||
specialize qw/cfl_get_luma_subsampling_422_lbd ssse3 avx2 neon/;
|
||||
|
||||
add_proto qw/cfl_subsample_lbd_fn cfl_get_luma_subsampling_444_lbd/, "TX_SIZE tx_size";
|
||||
specialize qw/cfl_get_luma_subsampling_444_lbd ssse3 avx2 neon/;
|
||||
|
||||
add_proto qw/cfl_subsample_hbd_fn cfl_get_luma_subsampling_420_hbd/, "TX_SIZE tx_size";
|
||||
specialize qw/cfl_get_luma_subsampling_420_hbd ssse3 avx2 neon/;
|
||||
|
||||
add_proto qw/cfl_subsample_hbd_fn cfl_get_luma_subsampling_422_hbd/, "TX_SIZE tx_size";
|
||||
specialize qw/cfl_get_luma_subsampling_422_hbd ssse3 avx2 neon/;
|
||||
|
||||
add_proto qw/cfl_subsample_hbd_fn cfl_get_luma_subsampling_444_hbd/, "TX_SIZE tx_size";
|
||||
specialize qw/cfl_get_luma_subsampling_444_hbd ssse3 avx2 neon/;
|
||||
|
||||
add_proto qw/cfl_predict_lbd_fn get_predict_lbd_fn/, "TX_SIZE tx_size";
|
||||
specialize qw/get_predict_lbd_fn ssse3 avx2 neon/;
|
||||
|
||||
add_proto qw/cfl_predict_hbd_fn get_predict_hbd_fn/, "TX_SIZE tx_size";
|
||||
specialize qw/get_predict_hbd_fn ssse3 avx2 neon/;
|
||||
|
||||
1;
|
||||
|
|
|
|||
110
third_party/aom/av1/common/av1_txfm.c
vendored
Normal file
110
third_party/aom/av1/common/av1_txfm.c
vendored
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
/*
|
||||
* Copyright (c) 2017, 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 "config/aom_dsp_rtcd.h"
|
||||
|
||||
#include "av1/common/av1_txfm.h"
|
||||
|
||||
// av1_cospi_arr[i][j] = (int)round(cos(M_PI*j/128) * (1<<(cos_bit_min+i)));
|
||||
const int32_t av1_cospi_arr_data[7][64] = {
|
||||
{ 1024, 1024, 1023, 1021, 1019, 1016, 1013, 1009, 1004, 999, 993, 987, 980,
|
||||
972, 964, 955, 946, 936, 926, 915, 903, 891, 878, 865, 851, 837,
|
||||
822, 807, 792, 775, 759, 742, 724, 706, 688, 669, 650, 630, 610,
|
||||
590, 569, 548, 526, 505, 483, 460, 438, 415, 392, 369, 345, 321,
|
||||
297, 273, 249, 224, 200, 175, 150, 125, 100, 75, 50, 25 },
|
||||
{ 2048, 2047, 2046, 2042, 2038, 2033, 2026, 2018, 2009, 1998, 1987,
|
||||
1974, 1960, 1945, 1928, 1911, 1892, 1872, 1851, 1829, 1806, 1782,
|
||||
1757, 1730, 1703, 1674, 1645, 1615, 1583, 1551, 1517, 1483, 1448,
|
||||
1412, 1375, 1338, 1299, 1260, 1220, 1179, 1138, 1096, 1053, 1009,
|
||||
965, 921, 876, 830, 784, 737, 690, 642, 595, 546, 498,
|
||||
449, 400, 350, 301, 251, 201, 151, 100, 50 },
|
||||
{ 4096, 4095, 4091, 4085, 4076, 4065, 4052, 4036, 4017, 3996, 3973,
|
||||
3948, 3920, 3889, 3857, 3822, 3784, 3745, 3703, 3659, 3612, 3564,
|
||||
3513, 3461, 3406, 3349, 3290, 3229, 3166, 3102, 3035, 2967, 2896,
|
||||
2824, 2751, 2675, 2598, 2520, 2440, 2359, 2276, 2191, 2106, 2019,
|
||||
1931, 1842, 1751, 1660, 1567, 1474, 1380, 1285, 1189, 1092, 995,
|
||||
897, 799, 700, 601, 501, 401, 301, 201, 101 },
|
||||
{ 8192, 8190, 8182, 8170, 8153, 8130, 8103, 8071, 8035, 7993, 7946,
|
||||
7895, 7839, 7779, 7713, 7643, 7568, 7489, 7405, 7317, 7225, 7128,
|
||||
7027, 6921, 6811, 6698, 6580, 6458, 6333, 6203, 6070, 5933, 5793,
|
||||
5649, 5501, 5351, 5197, 5040, 4880, 4717, 4551, 4383, 4212, 4038,
|
||||
3862, 3683, 3503, 3320, 3135, 2948, 2760, 2570, 2378, 2185, 1990,
|
||||
1795, 1598, 1401, 1202, 1003, 803, 603, 402, 201 },
|
||||
{ 16384, 16379, 16364, 16340, 16305, 16261, 16207, 16143, 16069, 15986, 15893,
|
||||
15791, 15679, 15557, 15426, 15286, 15137, 14978, 14811, 14635, 14449, 14256,
|
||||
14053, 13842, 13623, 13395, 13160, 12916, 12665, 12406, 12140, 11866, 11585,
|
||||
11297, 11003, 10702, 10394, 10080, 9760, 9434, 9102, 8765, 8423, 8076,
|
||||
7723, 7366, 7005, 6639, 6270, 5897, 5520, 5139, 4756, 4370, 3981,
|
||||
3590, 3196, 2801, 2404, 2006, 1606, 1205, 804, 402 },
|
||||
{ 32768, 32758, 32729, 32679, 32610, 32522, 32413, 32286, 32138, 31972, 31786,
|
||||
31581, 31357, 31114, 30853, 30572, 30274, 29957, 29622, 29269, 28899, 28511,
|
||||
28106, 27684, 27246, 26791, 26320, 25833, 25330, 24812, 24279, 23732, 23170,
|
||||
22595, 22006, 21403, 20788, 20160, 19520, 18868, 18205, 17531, 16846, 16151,
|
||||
15447, 14733, 14010, 13279, 12540, 11793, 11039, 10279, 9512, 8740, 7962,
|
||||
7180, 6393, 5602, 4808, 4011, 3212, 2411, 1608, 804 },
|
||||
{ 65536, 65516, 65457, 65358, 65220, 65043, 64827, 64571, 64277, 63944, 63572,
|
||||
63162, 62714, 62228, 61705, 61145, 60547, 59914, 59244, 58538, 57798, 57022,
|
||||
56212, 55368, 54491, 53581, 52639, 51665, 50660, 49624, 48559, 47464, 46341,
|
||||
45190, 44011, 42806, 41576, 40320, 39040, 37736, 36410, 35062, 33692, 32303,
|
||||
30893, 29466, 28020, 26558, 25080, 23586, 22078, 20557, 19024, 17479, 15924,
|
||||
14359, 12785, 11204, 9616, 8022, 6424, 4821, 3216, 1608 }
|
||||
};
|
||||
|
||||
// av1_sinpi_arr_data[i][j] = (int)round((sqrt(2) * sin(j*Pi/9) * 2 / 3) * (1
|
||||
// << (cos_bit_min + i))) modified so that elements j=1,2 sum to element j=4.
|
||||
const int32_t av1_sinpi_arr_data[7][5] = {
|
||||
{ 0, 330, 621, 836, 951 }, { 0, 660, 1241, 1672, 1901 },
|
||||
{ 0, 1321, 2482, 3344, 3803 }, { 0, 2642, 4964, 6689, 7606 },
|
||||
{ 0, 5283, 9929, 13377, 15212 }, { 0, 10566, 19858, 26755, 30424 },
|
||||
{ 0, 21133, 39716, 53510, 60849 }
|
||||
};
|
||||
|
||||
void av1_round_shift_array_c(int32_t *arr, int size, int bit) {
|
||||
int i;
|
||||
if (bit == 0) {
|
||||
return;
|
||||
} else {
|
||||
if (bit > 0) {
|
||||
for (i = 0; i < size; i++) {
|
||||
arr[i] = round_shift(arr[i], bit);
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < size; i++) {
|
||||
arr[i] = (int32_t)clamp64(((int64_t)1 << (-bit)) * arr[i], INT32_MIN,
|
||||
INT32_MAX);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const TXFM_TYPE av1_txfm_type_ls[5][TX_TYPES_1D] = {
|
||||
{ TXFM_TYPE_DCT4, TXFM_TYPE_ADST4, TXFM_TYPE_ADST4, TXFM_TYPE_IDENTITY4 },
|
||||
{ TXFM_TYPE_DCT8, TXFM_TYPE_ADST8, TXFM_TYPE_ADST8, TXFM_TYPE_IDENTITY8 },
|
||||
{ TXFM_TYPE_DCT16, TXFM_TYPE_ADST16, TXFM_TYPE_ADST16, TXFM_TYPE_IDENTITY16 },
|
||||
{ TXFM_TYPE_DCT32, TXFM_TYPE_INVALID, TXFM_TYPE_INVALID,
|
||||
TXFM_TYPE_IDENTITY32 },
|
||||
{ TXFM_TYPE_DCT64, TXFM_TYPE_INVALID, TXFM_TYPE_INVALID, TXFM_TYPE_INVALID }
|
||||
};
|
||||
|
||||
const int8_t av1_txfm_stage_num_list[TXFM_TYPES] = {
|
||||
4, // TXFM_TYPE_DCT4
|
||||
6, // TXFM_TYPE_DCT8
|
||||
8, // TXFM_TYPE_DCT16
|
||||
10, // TXFM_TYPE_DCT32
|
||||
12, // TXFM_TYPE_DCT64
|
||||
7, // TXFM_TYPE_ADST4
|
||||
8, // TXFM_TYPE_ADST8
|
||||
10, // TXFM_TYPE_ADST16
|
||||
1, // TXFM_TYPE_IDENTITY4
|
||||
1, // TXFM_TYPE_IDENTITY8
|
||||
1, // TXFM_TYPE_IDENTITY16
|
||||
1, // TXFM_TYPE_IDENTITY32
|
||||
};
|
||||
319
third_party/aom/av1/common/av1_txfm.h
vendored
319
third_party/aom/av1/common/av1_txfm.h
vendored
|
|
@ -16,6 +16,8 @@
|
|||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "config/aom_config.h"
|
||||
|
||||
#include "av1/common/enums.h"
|
||||
#include "av1/common/blockd.h"
|
||||
#include "aom/aom_integer.h"
|
||||
|
|
@ -25,100 +27,73 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if !defined(DO_RANGE_CHECK_CLAMP)
|
||||
#define DO_RANGE_CHECK_CLAMP 0
|
||||
#endif
|
||||
|
||||
extern const int32_t av1_cospi_arr_data[7][64];
|
||||
extern const int32_t av1_sinpi_arr_data[7][5];
|
||||
|
||||
#define MAX_TXFM_STAGE_NUM 12
|
||||
|
||||
static const int cos_bit_min = 10;
|
||||
static const int cos_bit_max = 16;
|
||||
|
||||
// cospi_arr[i][j] = (int)round(cos(M_PI*j/128) * (1<<(cos_bit_min+i)));
|
||||
static const int32_t cospi_arr_data[7][64] = {
|
||||
{ 1024, 1024, 1023, 1021, 1019, 1016, 1013, 1009, 1004, 999, 993, 987, 980,
|
||||
972, 964, 955, 946, 936, 926, 915, 903, 891, 878, 865, 851, 837,
|
||||
822, 807, 792, 775, 759, 742, 724, 706, 688, 669, 650, 630, 610,
|
||||
590, 569, 548, 526, 505, 483, 460, 438, 415, 392, 369, 345, 321,
|
||||
297, 273, 249, 224, 200, 175, 150, 125, 100, 75, 50, 25 },
|
||||
{ 2048, 2047, 2046, 2042, 2038, 2033, 2026, 2018, 2009, 1998, 1987,
|
||||
1974, 1960, 1945, 1928, 1911, 1892, 1872, 1851, 1829, 1806, 1782,
|
||||
1757, 1730, 1703, 1674, 1645, 1615, 1583, 1551, 1517, 1483, 1448,
|
||||
1412, 1375, 1338, 1299, 1260, 1220, 1179, 1138, 1096, 1053, 1009,
|
||||
965, 921, 876, 830, 784, 737, 690, 642, 595, 546, 498,
|
||||
449, 400, 350, 301, 251, 201, 151, 100, 50 },
|
||||
{ 4096, 4095, 4091, 4085, 4076, 4065, 4052, 4036, 4017, 3996, 3973,
|
||||
3948, 3920, 3889, 3857, 3822, 3784, 3745, 3703, 3659, 3612, 3564,
|
||||
3513, 3461, 3406, 3349, 3290, 3229, 3166, 3102, 3035, 2967, 2896,
|
||||
2824, 2751, 2675, 2598, 2520, 2440, 2359, 2276, 2191, 2106, 2019,
|
||||
1931, 1842, 1751, 1660, 1567, 1474, 1380, 1285, 1189, 1092, 995,
|
||||
897, 799, 700, 601, 501, 401, 301, 201, 101 },
|
||||
{ 8192, 8190, 8182, 8170, 8153, 8130, 8103, 8071, 8035, 7993, 7946,
|
||||
7895, 7839, 7779, 7713, 7643, 7568, 7489, 7405, 7317, 7225, 7128,
|
||||
7027, 6921, 6811, 6698, 6580, 6458, 6333, 6203, 6070, 5933, 5793,
|
||||
5649, 5501, 5351, 5197, 5040, 4880, 4717, 4551, 4383, 4212, 4038,
|
||||
3862, 3683, 3503, 3320, 3135, 2948, 2760, 2570, 2378, 2185, 1990,
|
||||
1795, 1598, 1401, 1202, 1003, 803, 603, 402, 201 },
|
||||
{ 16384, 16379, 16364, 16340, 16305, 16261, 16207, 16143, 16069, 15986, 15893,
|
||||
15791, 15679, 15557, 15426, 15286, 15137, 14978, 14811, 14635, 14449, 14256,
|
||||
14053, 13842, 13623, 13395, 13160, 12916, 12665, 12406, 12140, 11866, 11585,
|
||||
11297, 11003, 10702, 10394, 10080, 9760, 9434, 9102, 8765, 8423, 8076,
|
||||
7723, 7366, 7005, 6639, 6270, 5897, 5520, 5139, 4756, 4370, 3981,
|
||||
3590, 3196, 2801, 2404, 2006, 1606, 1205, 804, 402 },
|
||||
{ 32768, 32758, 32729, 32679, 32610, 32522, 32413, 32286, 32138, 31972, 31786,
|
||||
31581, 31357, 31114, 30853, 30572, 30274, 29957, 29622, 29269, 28899, 28511,
|
||||
28106, 27684, 27246, 26791, 26320, 25833, 25330, 24812, 24279, 23732, 23170,
|
||||
22595, 22006, 21403, 20788, 20160, 19520, 18868, 18205, 17531, 16846, 16151,
|
||||
15447, 14733, 14010, 13279, 12540, 11793, 11039, 10279, 9512, 8740, 7962,
|
||||
7180, 6393, 5602, 4808, 4011, 3212, 2411, 1608, 804 },
|
||||
{ 65536, 65516, 65457, 65358, 65220, 65043, 64827, 64571, 64277, 63944, 63572,
|
||||
63162, 62714, 62228, 61705, 61145, 60547, 59914, 59244, 58538, 57798, 57022,
|
||||
56212, 55368, 54491, 53581, 52639, 51665, 50660, 49624, 48559, 47464, 46341,
|
||||
45190, 44011, 42806, 41576, 40320, 39040, 37736, 36410, 35062, 33692, 32303,
|
||||
30893, 29466, 28020, 26558, 25080, 23586, 22078, 20557, 19024, 17479, 15924,
|
||||
14359, 12785, 11204, 9616, 8022, 6424, 4821, 3216, 1608 }
|
||||
};
|
||||
static const int NewSqrt2Bits = 12;
|
||||
// 2^12 * sqrt(2)
|
||||
static const int32_t NewSqrt2 = 5793;
|
||||
// 2^12 / sqrt(2)
|
||||
static const int32_t NewInvSqrt2 = 2896;
|
||||
|
||||
static INLINE const int32_t *cospi_arr(int n) {
|
||||
return cospi_arr_data[n - cos_bit_min];
|
||||
return av1_cospi_arr_data[n - cos_bit_min];
|
||||
}
|
||||
|
||||
static INLINE int32_t round_shift(int32_t value, int bit) {
|
||||
assert(bit >= 1);
|
||||
return (value + (1 << (bit - 1))) >> bit;
|
||||
static INLINE const int32_t *sinpi_arr(int n) {
|
||||
return av1_sinpi_arr_data[n - cos_bit_min];
|
||||
}
|
||||
|
||||
static INLINE void round_shift_array(int32_t *arr, int size, int bit) {
|
||||
int i;
|
||||
if (bit == 0) {
|
||||
return;
|
||||
} else {
|
||||
if (bit > 0) {
|
||||
for (i = 0; i < size; i++) {
|
||||
arr[i] = round_shift(arr[i], bit);
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < size; i++) {
|
||||
arr[i] = arr[i] * (1 << (-bit));
|
||||
}
|
||||
}
|
||||
static INLINE int32_t range_check_value(int32_t value, int8_t bit) {
|
||||
#if CONFIG_COEFFICIENT_RANGE_CHECKING
|
||||
const int64_t max_value = (1LL << (bit - 1)) - 1;
|
||||
const int64_t min_value = -(1LL << (bit - 1));
|
||||
if (value < min_value || value > max_value) {
|
||||
fprintf(stderr, "coeff out of bit range, value: %d bit %d\n", value, bit);
|
||||
assert(0);
|
||||
}
|
||||
#endif // CONFIG_COEFFICIENT_RANGE_CHECKING
|
||||
#if DO_RANGE_CHECK_CLAMP
|
||||
bit = AOMMIN(bit, 31);
|
||||
return clamp(value, (1 << (bit - 1)) - 1, -(1 << (bit - 1)));
|
||||
#endif // DO_RANGE_CHECK_CLAMP
|
||||
(void)bit;
|
||||
return value;
|
||||
}
|
||||
|
||||
static INLINE int32_t round_shift(int64_t value, int bit) {
|
||||
assert(bit >= 1);
|
||||
return (int32_t)((value + (1ll << (bit - 1))) >> bit);
|
||||
}
|
||||
|
||||
static INLINE int32_t half_btf(int32_t w0, int32_t in0, int32_t w1, int32_t in1,
|
||||
int bit) {
|
||||
int32_t result_32 = w0 * in0 + w1 * in1;
|
||||
int64_t result_64 = (int64_t)(w0 * in0) + (int64_t)(w1 * in1);
|
||||
#if CONFIG_COEFFICIENT_RANGE_CHECKING
|
||||
int64_t result_64 = (int64_t)w0 * (int64_t)in0 + (int64_t)w1 * (int64_t)in1;
|
||||
if (result_64 < INT32_MIN || result_64 > INT32_MAX) {
|
||||
printf("%s %d overflow result_32: %d result_64: %" PRId64
|
||||
" w0: %d in0: %d w1: %d in1: "
|
||||
"%d\n",
|
||||
__FILE__, __LINE__, result_32, result_64, w0, in0, w1, in1);
|
||||
assert(0 && "half_btf overflow");
|
||||
}
|
||||
assert(result_64 >= INT32_MIN && result_64 <= INT32_MAX);
|
||||
#endif
|
||||
return round_shift(result_32, bit);
|
||||
return round_shift(result_64, bit);
|
||||
}
|
||||
|
||||
typedef void (*TxfmFunc)(const int32_t *input, int32_t *output,
|
||||
const int8_t *cos_bit, const int8_t *stage_range);
|
||||
static INLINE uint16_t highbd_clip_pixel_add(uint16_t dest, tran_high_t trans,
|
||||
int bd) {
|
||||
return clip_pixel_highbd(dest + (int)trans, bd);
|
||||
}
|
||||
|
||||
typedef void (*TxfmFunc)(const int32_t *input, int32_t *output, int8_t cos_bit,
|
||||
const int8_t *stage_range);
|
||||
|
||||
typedef void (*FwdTxfm2dFunc)(const int16_t *input, int32_t *output, int stride,
|
||||
TX_TYPE tx_type, int bd);
|
||||
|
||||
typedef enum TXFM_TYPE {
|
||||
TXFM_TYPE_DCT4,
|
||||
|
|
@ -129,88 +104,82 @@ typedef enum TXFM_TYPE {
|
|||
TXFM_TYPE_ADST4,
|
||||
TXFM_TYPE_ADST8,
|
||||
TXFM_TYPE_ADST16,
|
||||
TXFM_TYPE_ADST32,
|
||||
TXFM_TYPE_IDENTITY4,
|
||||
TXFM_TYPE_IDENTITY8,
|
||||
TXFM_TYPE_IDENTITY16,
|
||||
TXFM_TYPE_IDENTITY32,
|
||||
TXFM_TYPE_IDENTITY64,
|
||||
TXFM_TYPES,
|
||||
TXFM_TYPE_INVALID,
|
||||
} TXFM_TYPE;
|
||||
|
||||
typedef struct TXFM_1D_CFG {
|
||||
const int txfm_size;
|
||||
const int stage_num;
|
||||
|
||||
const int8_t *shift;
|
||||
const int8_t *stage_range;
|
||||
const int8_t *cos_bit;
|
||||
const TXFM_TYPE txfm_type;
|
||||
} TXFM_1D_CFG;
|
||||
|
||||
typedef struct TXFM_2D_FLIP_CFG {
|
||||
TX_SIZE tx_size;
|
||||
int ud_flip; // flip upside down
|
||||
int lr_flip; // flip left to right
|
||||
const TXFM_1D_CFG *col_cfg;
|
||||
const TXFM_1D_CFG *row_cfg;
|
||||
const int8_t *shift;
|
||||
int8_t cos_bit_col;
|
||||
int8_t cos_bit_row;
|
||||
int8_t stage_range_col[MAX_TXFM_STAGE_NUM];
|
||||
int8_t stage_range_row[MAX_TXFM_STAGE_NUM];
|
||||
TXFM_TYPE txfm_type_col;
|
||||
TXFM_TYPE txfm_type_row;
|
||||
int stage_num_col;
|
||||
int stage_num_row;
|
||||
} TXFM_2D_FLIP_CFG;
|
||||
|
||||
static INLINE void set_flip_cfg(TX_TYPE tx_type, TXFM_2D_FLIP_CFG *cfg) {
|
||||
static INLINE void get_flip_cfg(TX_TYPE tx_type, int *ud_flip, int *lr_flip) {
|
||||
switch (tx_type) {
|
||||
case DCT_DCT:
|
||||
case ADST_DCT:
|
||||
case DCT_ADST:
|
||||
case ADST_ADST:
|
||||
cfg->ud_flip = 0;
|
||||
cfg->lr_flip = 0;
|
||||
*ud_flip = 0;
|
||||
*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;
|
||||
*ud_flip = 0;
|
||||
*lr_flip = 0;
|
||||
break;
|
||||
case FLIPADST_DCT:
|
||||
case FLIPADST_ADST:
|
||||
case V_FLIPADST:
|
||||
cfg->ud_flip = 1;
|
||||
cfg->lr_flip = 0;
|
||||
*ud_flip = 1;
|
||||
*lr_flip = 0;
|
||||
break;
|
||||
case DCT_FLIPADST:
|
||||
case ADST_FLIPADST:
|
||||
case H_FLIPADST:
|
||||
cfg->ud_flip = 0;
|
||||
cfg->lr_flip = 1;
|
||||
*ud_flip = 0;
|
||||
*lr_flip = 1;
|
||||
break;
|
||||
case FLIPADST_FLIPADST:
|
||||
cfg->ud_flip = 1;
|
||||
cfg->lr_flip = 1;
|
||||
*ud_flip = 1;
|
||||
*lr_flip = 1;
|
||||
break;
|
||||
#endif // CONFIG_EXT_TX
|
||||
default:
|
||||
cfg->ud_flip = 0;
|
||||
cfg->lr_flip = 0;
|
||||
*ud_flip = 0;
|
||||
*lr_flip = 0;
|
||||
assert(0);
|
||||
}
|
||||
}
|
||||
|
||||
#if CONFIG_TXMG
|
||||
static INLINE void set_flip_cfg(TX_TYPE tx_type, TXFM_2D_FLIP_CFG *cfg) {
|
||||
get_flip_cfg(tx_type, &cfg->ud_flip, &cfg->lr_flip);
|
||||
}
|
||||
|
||||
static INLINE TX_SIZE av1_rotate_tx_size(TX_SIZE tx_size) {
|
||||
switch (tx_size) {
|
||||
#if CONFIG_CHROMA_2X2
|
||||
case TX_2X2: return TX_2X2;
|
||||
#endif
|
||||
case TX_4X4: return TX_4X4;
|
||||
case TX_8X8: return TX_8X8;
|
||||
case TX_16X16: return TX_16X16;
|
||||
case TX_32X32: return TX_32X32;
|
||||
#if CONFIG_TX64X64
|
||||
case TX_64X64: return TX_64X64;
|
||||
case TX_32X64: return TX_64X32;
|
||||
case TX_64X32: return TX_32X64;
|
||||
#endif
|
||||
case TX_4X8: return TX_8X4;
|
||||
case TX_8X4: return TX_4X8;
|
||||
case TX_8X16: return TX_16X8;
|
||||
|
|
@ -221,6 +190,8 @@ static INLINE TX_SIZE av1_rotate_tx_size(TX_SIZE tx_size) {
|
|||
case TX_16X4: return TX_4X16;
|
||||
case TX_8X32: return TX_32X8;
|
||||
case TX_32X8: return TX_8X32;
|
||||
case TX_16X64: return TX_64X16;
|
||||
case TX_64X16: return TX_16X64;
|
||||
default: assert(0); return TX_INVALID;
|
||||
}
|
||||
}
|
||||
|
|
@ -231,7 +202,6 @@ static INLINE TX_TYPE av1_rotate_tx_type(TX_TYPE tx_type) {
|
|||
case ADST_DCT: return DCT_ADST;
|
||||
case DCT_ADST: return ADST_DCT;
|
||||
case ADST_ADST: return ADST_ADST;
|
||||
#if CONFIG_EXT_TX
|
||||
case FLIPADST_DCT: return DCT_FLIPADST;
|
||||
case DCT_FLIPADST: return FLIPADST_DCT;
|
||||
case FLIPADST_FLIPADST: return FLIPADST_FLIPADST;
|
||||
|
|
@ -244,123 +214,46 @@ static INLINE TX_TYPE av1_rotate_tx_type(TX_TYPE tx_type) {
|
|||
case H_ADST: return V_ADST;
|
||||
case V_FLIPADST: return H_FLIPADST;
|
||||
case H_FLIPADST: return V_FLIPADST;
|
||||
#endif // CONFIG_EXT_TX
|
||||
#if CONFIG_MRC_TX
|
||||
case MRC_DCT: return MRC_DCT;
|
||||
#endif // CONFIG_MRC_TX
|
||||
default: assert(0); return TX_TYPES;
|
||||
}
|
||||
}
|
||||
#endif // CONFIG_TXMG
|
||||
|
||||
#if CONFIG_MRC_TX
|
||||
static INLINE int get_mrc_diff_mask_inter(const int16_t *diff, int diff_stride,
|
||||
uint8_t *mask, int mask_stride,
|
||||
int width, int height) {
|
||||
// placeholder mask generation function
|
||||
assert(SIGNAL_MRC_MASK_INTER);
|
||||
int n_masked_vals = 0;
|
||||
for (int i = 0; i < height; ++i) {
|
||||
for (int j = 0; j < width; ++j) {
|
||||
mask[i * mask_stride + j] = diff[i * diff_stride + j] > 100 ? 1 : 0;
|
||||
n_masked_vals += mask[i * mask_stride + j];
|
||||
}
|
||||
}
|
||||
return n_masked_vals;
|
||||
}
|
||||
|
||||
static INLINE int get_mrc_pred_mask_inter(const uint8_t *pred, int pred_stride,
|
||||
uint8_t *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_diff_mask_intra(const int16_t *diff, int diff_stride,
|
||||
uint8_t *mask, int mask_stride,
|
||||
int width, int height) {
|
||||
// placeholder mask generation function
|
||||
assert(SIGNAL_MRC_MASK_INTRA);
|
||||
int n_masked_vals = 0;
|
||||
for (int i = 0; i < height; ++i) {
|
||||
for (int j = 0; j < width; ++j) {
|
||||
mask[i * mask_stride + j] = diff[i * diff_stride + j] > 100 ? 1 : 0;
|
||||
n_masked_vals += mask[i * mask_stride + j];
|
||||
}
|
||||
}
|
||||
return n_masked_vals;
|
||||
}
|
||||
|
||||
static INLINE int get_mrc_pred_mask_intra(const uint8_t *pred, int pred_stride,
|
||||
uint8_t *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_diff_mask(const int16_t *diff, int diff_stride,
|
||||
uint8_t *mask, int mask_stride, int width,
|
||||
int height, int is_inter) {
|
||||
if (is_inter) {
|
||||
assert(USE_MRC_INTER && "MRC invalid for inter blocks");
|
||||
assert(SIGNAL_MRC_MASK_INTER);
|
||||
return get_mrc_diff_mask_inter(diff, diff_stride, mask, mask_stride, width,
|
||||
height);
|
||||
// Utility function that returns the log of the ratio of the col and row
|
||||
// sizes.
|
||||
static INLINE int get_rect_tx_log_ratio(int col, int row) {
|
||||
if (col == row) return 0;
|
||||
if (col > row) {
|
||||
if (col == row * 2) return 1;
|
||||
if (col == row * 4) return 2;
|
||||
assert(0 && "Unsupported transform size");
|
||||
} else {
|
||||
assert(USE_MRC_INTRA && "MRC invalid for intra blocks");
|
||||
assert(SIGNAL_MRC_MASK_INTRA);
|
||||
return get_mrc_diff_mask_intra(diff, diff_stride, mask, mask_stride, width,
|
||||
height);
|
||||
if (row == col * 2) return -1;
|
||||
if (row == col * 4) return -2;
|
||||
assert(0 && "Unsupported transform size");
|
||||
}
|
||||
return 0; // Invalid
|
||||
}
|
||||
|
||||
static INLINE int get_mrc_pred_mask(const uint8_t *pred, int pred_stride,
|
||||
uint8_t *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_pred_mask_inter(pred, pred_stride, mask, mask_stride, width,
|
||||
height);
|
||||
} else {
|
||||
assert(USE_MRC_INTRA && "MRC invalid for intra blocks");
|
||||
return get_mrc_pred_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));
|
||||
}
|
||||
#endif // CONFIG_MRC_TX
|
||||
|
||||
void av1_gen_fwd_stage_range(int8_t *stage_range_col, int8_t *stage_range_row,
|
||||
const TXFM_2D_FLIP_CFG *cfg, int bd);
|
||||
|
||||
void av1_gen_inv_stage_range(int8_t *stage_range_col, int8_t *stage_range_row,
|
||||
const TXFM_2D_FLIP_CFG *cfg, int8_t fwd_shift,
|
||||
const TXFM_2D_FLIP_CFG *cfg, TX_SIZE tx_size,
|
||||
int bd);
|
||||
|
||||
TXFM_2D_FLIP_CFG av1_get_fwd_txfm_cfg(TX_TYPE tx_type, TX_SIZE tx_size);
|
||||
#if CONFIG_TX64X64
|
||||
TXFM_2D_FLIP_CFG av1_get_fwd_txfm_64x64_cfg(TX_TYPE tx_type);
|
||||
TXFM_2D_FLIP_CFG av1_get_fwd_txfm_64x32_cfg(TX_TYPE tx_type);
|
||||
TXFM_2D_FLIP_CFG av1_get_fwd_txfm_32x64_cfg(TX_TYPE tx_type);
|
||||
#endif // CONFIG_TX64X64
|
||||
TXFM_2D_FLIP_CFG av1_get_inv_txfm_cfg(TX_TYPE tx_type, TX_SIZE tx_size);
|
||||
void av1_get_fwd_txfm_cfg(TX_TYPE tx_type, TX_SIZE tx_size,
|
||||
TXFM_2D_FLIP_CFG *cfg);
|
||||
void av1_get_inv_txfm_cfg(TX_TYPE tx_type, TX_SIZE tx_size,
|
||||
TXFM_2D_FLIP_CFG *cfg);
|
||||
extern const TXFM_TYPE av1_txfm_type_ls[5][TX_TYPES_1D];
|
||||
extern const int8_t av1_txfm_stage_num_list[TXFM_TYPES];
|
||||
static INLINE int get_txw_idx(TX_SIZE tx_size) {
|
||||
return tx_size_wide_log2[tx_size] - tx_size_wide_log2[0];
|
||||
}
|
||||
static INLINE int get_txh_idx(TX_SIZE tx_size) {
|
||||
return tx_size_high_log2[tx_size] - tx_size_high_log2[0];
|
||||
}
|
||||
#define MAX_TXWH_IDX 5
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
|
|
|
|||
255
third_party/aom/av1/common/blockd.c
vendored
255
third_party/aom/av1/common/blockd.c
vendored
|
|
@ -16,110 +16,18 @@
|
|||
#include "av1/common/blockd.h"
|
||||
#include "av1/common/onyxc_int.h"
|
||||
|
||||
PREDICTION_MODE av1_left_block_mode(const MODE_INFO *cur_mi,
|
||||
const MODE_INFO *left_mi, int b) {
|
||||
if (b == 0 || b == 2) {
|
||||
if (!left_mi || is_inter_block(&left_mi->mbmi)) return DC_PRED;
|
||||
|
||||
return get_y_mode(left_mi, b + 1);
|
||||
} else {
|
||||
assert(b == 1 || b == 3);
|
||||
return cur_mi->bmi[b - 1].as_mode;
|
||||
}
|
||||
PREDICTION_MODE av1_left_block_mode(const MB_MODE_INFO *left_mi) {
|
||||
if (!left_mi) return DC_PRED;
|
||||
assert(!is_inter_block(left_mi) || is_intrabc_block(left_mi));
|
||||
return left_mi->mode;
|
||||
}
|
||||
|
||||
PREDICTION_MODE av1_above_block_mode(const MODE_INFO *cur_mi,
|
||||
const MODE_INFO *above_mi, int b) {
|
||||
if (b == 0 || b == 1) {
|
||||
if (!above_mi || is_inter_block(&above_mi->mbmi)) return DC_PRED;
|
||||
|
||||
return get_y_mode(above_mi, b + 2);
|
||||
} else {
|
||||
assert(b == 2 || b == 3);
|
||||
return cur_mi->bmi[b - 2].as_mode;
|
||||
}
|
||||
PREDICTION_MODE av1_above_block_mode(const MB_MODE_INFO *above_mi) {
|
||||
if (!above_mi) return DC_PRED;
|
||||
assert(!is_inter_block(above_mi) || is_intrabc_block(above_mi));
|
||||
return above_mi->mode;
|
||||
}
|
||||
|
||||
#if CONFIG_COEF_INTERLEAVE
|
||||
void av1_foreach_transformed_block_interleave(
|
||||
const MACROBLOCKD *const xd, BLOCK_SIZE bsize,
|
||||
foreach_transformed_block_visitor visit, void *arg) {
|
||||
const struct macroblockd_plane *const pd_y = &xd->plane[0];
|
||||
const struct macroblockd_plane *const pd_c = &xd->plane[1];
|
||||
const MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
|
||||
|
||||
const TX_SIZE tx_log2_y = mbmi->tx_size;
|
||||
const TX_SIZE tx_log2_c = av1_get_uv_tx_size(mbmi, pd_c);
|
||||
const int tx_sz_y = (1 << tx_log2_y);
|
||||
const int tx_sz_c = (1 << tx_log2_c);
|
||||
|
||||
const BLOCK_SIZE plane_bsize_y = get_plane_block_size(bsize, pd_y);
|
||||
const BLOCK_SIZE plane_bsize_c = get_plane_block_size(bsize, pd_c);
|
||||
|
||||
const int num_4x4_w_y = num_4x4_blocks_wide_lookup[plane_bsize_y];
|
||||
const int num_4x4_w_c = num_4x4_blocks_wide_lookup[plane_bsize_c];
|
||||
const int num_4x4_h_y = num_4x4_blocks_high_lookup[plane_bsize_y];
|
||||
const int num_4x4_h_c = num_4x4_blocks_high_lookup[plane_bsize_c];
|
||||
|
||||
const int step_y = 1 << (tx_log2_y << 1);
|
||||
const int step_c = 1 << (tx_log2_c << 1);
|
||||
|
||||
const int max_4x4_w_y =
|
||||
get_max_4x4_size(num_4x4_w_y, xd->mb_to_right_edge, pd_y->subsampling_x);
|
||||
const int max_4x4_h_y =
|
||||
get_max_4x4_size(num_4x4_h_y, xd->mb_to_bottom_edge, pd_y->subsampling_y);
|
||||
|
||||
const int extra_step_y = ((num_4x4_w_y - max_4x4_w_y) >> tx_log2_y) * step_y;
|
||||
|
||||
const int max_4x4_w_c =
|
||||
get_max_4x4_size(num_4x4_w_c, xd->mb_to_right_edge, pd_c->subsampling_x);
|
||||
const int max_4x4_h_c =
|
||||
get_max_4x4_size(num_4x4_h_c, xd->mb_to_bottom_edge, pd_c->subsampling_y);
|
||||
|
||||
const int extra_step_c = ((num_4x4_w_c - max_4x4_w_c) >> tx_log2_c) * step_c;
|
||||
|
||||
// The max_4x4_w/h may be smaller than tx_sz under some corner cases,
|
||||
// i.e. when the SB is splitted by tile boundaries.
|
||||
const int tu_num_w_y = (max_4x4_w_y + tx_sz_y - 1) / tx_sz_y;
|
||||
const int tu_num_h_y = (max_4x4_h_y + tx_sz_y - 1) / tx_sz_y;
|
||||
const int tu_num_w_c = (max_4x4_w_c + tx_sz_c - 1) / tx_sz_c;
|
||||
const int tu_num_h_c = (max_4x4_h_c + tx_sz_c - 1) / tx_sz_c;
|
||||
const int tu_num_c = tu_num_w_c * tu_num_h_c;
|
||||
|
||||
int tu_idx_c = 0;
|
||||
int offset_y, row_y, col_y;
|
||||
int offset_c, row_c, col_c;
|
||||
|
||||
for (row_y = 0; row_y < tu_num_h_y; row_y++) {
|
||||
for (col_y = 0; col_y < tu_num_w_y; col_y++) {
|
||||
// luma
|
||||
offset_y = (row_y * tu_num_w_y + col_y) * step_y + row_y * extra_step_y;
|
||||
visit(0, offset_y, row_y * tx_sz_y, col_y * tx_sz_y, plane_bsize_y,
|
||||
tx_log2_y, arg);
|
||||
// chroma
|
||||
if (tu_idx_c < tu_num_c) {
|
||||
row_c = (tu_idx_c / tu_num_w_c) * tx_sz_c;
|
||||
col_c = (tu_idx_c % tu_num_w_c) * tx_sz_c;
|
||||
offset_c = tu_idx_c * step_c + (tu_idx_c / tu_num_w_c) * extra_step_c;
|
||||
visit(1, offset_c, row_c, col_c, plane_bsize_c, tx_log2_c, arg);
|
||||
visit(2, offset_c, row_c, col_c, plane_bsize_c, tx_log2_c, arg);
|
||||
tu_idx_c++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// In 422 case, it's possible that Chroma has more TUs than Luma
|
||||
while (tu_idx_c < tu_num_c) {
|
||||
row_c = (tu_idx_c / tu_num_w_c) * tx_sz_c;
|
||||
col_c = (tu_idx_c % tu_num_w_c) * tx_sz_c;
|
||||
offset_c = tu_idx_c * step_c + row_c * extra_step_c;
|
||||
visit(1, offset_c, row_c, col_c, plane_bsize_c, tx_log2_c, arg);
|
||||
visit(2, offset_c, row_c, col_c, plane_bsize_c, tx_log2_c, arg);
|
||||
tu_idx_c++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void av1_foreach_transformed_block_in_plane(
|
||||
const MACROBLOCKD *const xd, BLOCK_SIZE bsize, int plane,
|
||||
foreach_transformed_block_visitor visit, void *arg) {
|
||||
|
|
@ -128,12 +36,8 @@ void av1_foreach_transformed_block_in_plane(
|
|||
// 4x4=0, 8x8=2, 16x16=4, 32x32=6, 64x64=8
|
||||
// transform size varies per plane, look it up in a common way.
|
||||
const TX_SIZE tx_size = av1_get_tx_size(plane, xd);
|
||||
#if CONFIG_CHROMA_SUB8X8
|
||||
const BLOCK_SIZE plane_bsize =
|
||||
AOMMAX(BLOCK_4X4, get_plane_block_size(bsize, pd));
|
||||
#else
|
||||
const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd);
|
||||
#endif
|
||||
get_plane_block_size(bsize, pd->subsampling_x, pd->subsampling_y);
|
||||
const uint8_t txw_unit = tx_size_wide_unit[tx_size];
|
||||
const uint8_t txh_unit = tx_size_high_unit[tx_size];
|
||||
const int step = txw_unit * txh_unit;
|
||||
|
|
@ -147,7 +51,8 @@ void av1_foreach_transformed_block_in_plane(
|
|||
|
||||
int blk_row, blk_col;
|
||||
|
||||
const BLOCK_SIZE max_unit_bsize = get_plane_block_size(BLOCK_64X64, pd);
|
||||
const BLOCK_SIZE max_unit_bsize =
|
||||
get_plane_block_size(BLOCK_64X64, pd->subsampling_x, pd->subsampling_y);
|
||||
int mu_blocks_wide = block_size_wide[max_unit_bsize] >> tx_size_wide_log2[0];
|
||||
int mu_blocks_high = block_size_high[max_unit_bsize] >> tx_size_high_log2[0];
|
||||
mu_blocks_wide = AOMMIN(max_blocks_wide, mu_blocks_wide);
|
||||
|
|
@ -170,95 +75,60 @@ void av1_foreach_transformed_block_in_plane(
|
|||
}
|
||||
}
|
||||
|
||||
#if CONFIG_LV_MAP
|
||||
void av1_foreach_transformed_block(const MACROBLOCKD *const xd,
|
||||
BLOCK_SIZE bsize, int mi_row, int mi_col,
|
||||
foreach_transformed_block_visitor visit,
|
||||
void *arg) {
|
||||
int plane;
|
||||
|
||||
for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
|
||||
#if CONFIG_CB4X4
|
||||
void *arg, const int num_planes) {
|
||||
for (int plane = 0; plane < num_planes; ++plane) {
|
||||
if (!is_chroma_reference(mi_row, mi_col, bsize,
|
||||
xd->plane[plane].subsampling_x,
|
||||
xd->plane[plane].subsampling_y))
|
||||
continue;
|
||||
#else
|
||||
(void)mi_row;
|
||||
(void)mi_col;
|
||||
#endif
|
||||
av1_foreach_transformed_block_in_plane(xd, bsize, plane, visit, arg);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !CONFIG_PVQ || CONFIG_VAR_TX
|
||||
void av1_set_contexts(const MACROBLOCKD *xd, struct macroblockd_plane *pd,
|
||||
int plane, TX_SIZE tx_size, int has_eob, int aoff,
|
||||
int loff) {
|
||||
int plane, BLOCK_SIZE plane_bsize, TX_SIZE tx_size,
|
||||
int has_eob, int aoff, int loff) {
|
||||
ENTROPY_CONTEXT *const a = pd->above_context + aoff;
|
||||
ENTROPY_CONTEXT *const l = pd->left_context + loff;
|
||||
const int txs_wide = tx_size_wide_unit[tx_size];
|
||||
const int txs_high = tx_size_high_unit[tx_size];
|
||||
#if CONFIG_CB4X4
|
||||
const BLOCK_SIZE bsize = xd->mi[0]->mbmi.sb_type;
|
||||
#else
|
||||
const BLOCK_SIZE bsize = AOMMAX(xd->mi[0]->mbmi.sb_type, BLOCK_8X8);
|
||||
#endif
|
||||
const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd);
|
||||
|
||||
// above
|
||||
if (has_eob && xd->mb_to_right_edge < 0) {
|
||||
int i;
|
||||
const int blocks_wide = max_block_wide(xd, plane_bsize, plane);
|
||||
int above_contexts = txs_wide;
|
||||
if (above_contexts + aoff > blocks_wide)
|
||||
above_contexts = blocks_wide - aoff;
|
||||
|
||||
for (i = 0; i < above_contexts; ++i) a[i] = has_eob;
|
||||
for (i = above_contexts; i < txs_wide; ++i) a[i] = 0;
|
||||
const int above_contexts = AOMMIN(txs_wide, blocks_wide - aoff);
|
||||
memset(a, has_eob, sizeof(*a) * above_contexts);
|
||||
memset(a + above_contexts, 0, sizeof(*a) * (txs_wide - above_contexts));
|
||||
} else {
|
||||
memset(a, has_eob, sizeof(ENTROPY_CONTEXT) * txs_wide);
|
||||
memset(a, has_eob, sizeof(*a) * txs_wide);
|
||||
}
|
||||
|
||||
// left
|
||||
if (has_eob && xd->mb_to_bottom_edge < 0) {
|
||||
int i;
|
||||
const int blocks_high = max_block_high(xd, plane_bsize, plane);
|
||||
int left_contexts = txs_high;
|
||||
if (left_contexts + loff > blocks_high) left_contexts = blocks_high - loff;
|
||||
|
||||
for (i = 0; i < left_contexts; ++i) l[i] = has_eob;
|
||||
for (i = left_contexts; i < txs_high; ++i) l[i] = 0;
|
||||
const int left_contexts = AOMMIN(txs_high, blocks_high - loff);
|
||||
memset(l, has_eob, sizeof(*l) * left_contexts);
|
||||
memset(l + left_contexts, 0, sizeof(*l) * (txs_high - left_contexts));
|
||||
} else {
|
||||
memset(l, has_eob, sizeof(ENTROPY_CONTEXT) * txs_high);
|
||||
memset(l, has_eob, sizeof(*l) * txs_high);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void av1_reset_skip_context(MACROBLOCKD *xd, int mi_row, int mi_col,
|
||||
BLOCK_SIZE bsize) {
|
||||
BLOCK_SIZE bsize, const int num_planes) {
|
||||
int i;
|
||||
int nplanes;
|
||||
#if CONFIG_CB4X4
|
||||
int chroma_ref;
|
||||
chroma_ref =
|
||||
is_chroma_reference(mi_row, mi_col, bsize, xd->plane[1].subsampling_x,
|
||||
xd->plane[1].subsampling_y);
|
||||
nplanes = 1 + (MAX_MB_PLANE - 1) * chroma_ref;
|
||||
#else
|
||||
(void)mi_row;
|
||||
(void)mi_col;
|
||||
nplanes = MAX_MB_PLANE;
|
||||
#endif
|
||||
nplanes = 1 + (num_planes - 1) * chroma_ref;
|
||||
for (i = 0; i < nplanes; i++) {
|
||||
struct macroblockd_plane *const pd = &xd->plane[i];
|
||||
#if CONFIG_CHROMA_SUB8X8
|
||||
const BLOCK_SIZE plane_bsize =
|
||||
AOMMAX(BLOCK_4X4, get_plane_block_size(bsize, pd));
|
||||
#else
|
||||
const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd);
|
||||
#endif
|
||||
get_plane_block_size(bsize, pd->subsampling_x, pd->subsampling_y);
|
||||
const int txs_wide = block_size_wide[plane_bsize] >> tx_size_wide_log2[0];
|
||||
const int txs_high = block_size_high[plane_bsize] >> tx_size_high_log2[0];
|
||||
memset(pd->above_context, 0, sizeof(ENTROPY_CONTEXT) * txs_wide);
|
||||
|
|
@ -266,38 +136,61 @@ void av1_reset_skip_context(MACROBLOCKD *xd, int mi_row, int mi_col,
|
|||
}
|
||||
}
|
||||
|
||||
void av1_setup_block_planes(MACROBLOCKD *xd, int ss_x, int ss_y) {
|
||||
void av1_reset_loop_filter_delta(MACROBLOCKD *xd, int num_planes) {
|
||||
xd->delta_lf_from_base = 0;
|
||||
const int frame_lf_count =
|
||||
num_planes > 1 ? FRAME_LF_COUNT : FRAME_LF_COUNT - 2;
|
||||
for (int lf_id = 0; lf_id < frame_lf_count; ++lf_id) xd->delta_lf[lf_id] = 0;
|
||||
}
|
||||
|
||||
void av1_reset_loop_restoration(MACROBLOCKD *xd, const int num_planes) {
|
||||
for (int p = 0; p < num_planes; ++p) {
|
||||
set_default_wiener(xd->wiener_info + p);
|
||||
set_default_sgrproj(xd->sgrproj_info + p);
|
||||
}
|
||||
}
|
||||
|
||||
void av1_setup_block_planes(MACROBLOCKD *xd, int ss_x, int ss_y,
|
||||
const int num_planes) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAX_MB_PLANE; i++) {
|
||||
for (i = 0; i < num_planes; i++) {
|
||||
xd->plane[i].plane_type = get_plane_type(i);
|
||||
xd->plane[i].subsampling_x = i ? ss_x : 0;
|
||||
xd->plane[i].subsampling_y = i ? ss_y : 0;
|
||||
}
|
||||
}
|
||||
|
||||
#if CONFIG_EXT_INTRA
|
||||
const int16_t dr_intra_derivative[90] = {
|
||||
1, 14666, 7330, 4884, 3660, 2926, 2435, 2084, 1821, 1616, 1451, 1317, 1204,
|
||||
1108, 1026, 955, 892, 837, 787, 743, 703, 666, 633, 603, 574, 548,
|
||||
524, 502, 481, 461, 443, 426, 409, 394, 379, 365, 352, 339, 327,
|
||||
316, 305, 294, 284, 274, 265, 256, 247, 238, 230, 222, 214, 207,
|
||||
200, 192, 185, 179, 172, 166, 159, 153, 147, 141, 136, 130, 124,
|
||||
119, 113, 108, 103, 98, 93, 88, 83, 78, 73, 68, 63, 59,
|
||||
54, 49, 45, 40, 35, 31, 26, 22, 17, 13, 8, 4,
|
||||
// More evenly spread out angles and limited to 10-bit
|
||||
// Values that are 0 will never be used
|
||||
// Approx angle
|
||||
0, 0, 0, //
|
||||
1023, 0, 0, // 3, ...
|
||||
547, 0, 0, // 6, ...
|
||||
372, 0, 0, 0, 0, // 9, ...
|
||||
273, 0, 0, // 14, ...
|
||||
215, 0, 0, // 17, ...
|
||||
178, 0, 0, // 20, ...
|
||||
151, 0, 0, // 23, ... (113 & 203 are base angles)
|
||||
132, 0, 0, // 26, ...
|
||||
116, 0, 0, // 29, ...
|
||||
102, 0, 0, 0, // 32, ...
|
||||
90, 0, 0, // 36, ...
|
||||
80, 0, 0, // 39, ...
|
||||
71, 0, 0, // 42, ...
|
||||
64, 0, 0, // 45, ... (45 & 135 are base angles)
|
||||
57, 0, 0, // 48, ...
|
||||
51, 0, 0, // 51, ...
|
||||
45, 0, 0, 0, // 54, ...
|
||||
40, 0, 0, // 58, ...
|
||||
35, 0, 0, // 61, ...
|
||||
31, 0, 0, // 64, ...
|
||||
27, 0, 0, // 67, ... (67 & 157 are base angles)
|
||||
23, 0, 0, // 70, ...
|
||||
19, 0, 0, // 73, ...
|
||||
15, 0, 0, 0, 0, // 76, ...
|
||||
11, 0, 0, // 81, ...
|
||||
7, 0, 0, // 84, ...
|
||||
3, 0, 0, // 87, ...
|
||||
};
|
||||
|
||||
#if CONFIG_INTRA_INTERP
|
||||
int av1_is_intra_filter_switchable(int angle) {
|
||||
assert(angle > 0 && angle < 270);
|
||||
if (angle % 45 == 0) return 0;
|
||||
if (angle > 90 && angle < 180) {
|
||||
return 1;
|
||||
} else {
|
||||
return ((angle < 90 ? dr_intra_derivative[angle]
|
||||
: dr_intra_derivative[270 - angle]) &
|
||||
0xFF) > 0;
|
||||
}
|
||||
}
|
||||
#endif // CONFIG_INTRA_INTERP
|
||||
#endif // CONFIG_EXT_INTRA
|
||||
|
|
|
|||
1534
third_party/aom/av1/common/blockd.h
vendored
1534
third_party/aom/av1/common/blockd.h
vendored
File diff suppressed because it is too large
Load diff
233
third_party/aom/av1/common/cdef.c
vendored
233
third_party/aom/av1/common/cdef.c
vendored
|
|
@ -13,7 +13,8 @@
|
|||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "./aom_scale_rtcd.h"
|
||||
#include "config/aom_scale_rtcd.h"
|
||||
|
||||
#include "aom/aom_integer.h"
|
||||
#include "av1/common/cdef.h"
|
||||
#include "av1/common/cdef_block.h"
|
||||
|
|
@ -21,7 +22,6 @@
|
|||
#include "av1/common/reconinter.h"
|
||||
|
||||
int sb_all_skip(const AV1_COMMON *const cm, int mi_row, int mi_col) {
|
||||
int r, c;
|
||||
int maxc, maxr;
|
||||
int skip = 1;
|
||||
maxc = cm->mi_cols - mi_col;
|
||||
|
|
@ -30,38 +30,40 @@ int sb_all_skip(const AV1_COMMON *const cm, int mi_row, int mi_col) {
|
|||
maxr = AOMMIN(maxr, MI_SIZE_64X64);
|
||||
maxc = AOMMIN(maxc, MI_SIZE_64X64);
|
||||
|
||||
for (r = 0; r < maxr; r++) {
|
||||
for (c = 0; c < maxc; c++) {
|
||||
skip = skip &&
|
||||
cm->mi_grid_visible[(mi_row + r) * cm->mi_stride + mi_col + c]
|
||||
->mbmi.skip;
|
||||
for (int r = 0; r < maxr; r++) {
|
||||
for (int c = 0; c < maxc; c++) {
|
||||
skip =
|
||||
skip &&
|
||||
cm->mi_grid_visible[(mi_row + r) * cm->mi_stride + mi_col + c]->skip;
|
||||
}
|
||||
}
|
||||
return skip;
|
||||
}
|
||||
|
||||
static int is_8x8_block_skip(MODE_INFO **grid, int mi_row, int mi_col,
|
||||
static int is_8x8_block_skip(MB_MODE_INFO **grid, int mi_row, int mi_col,
|
||||
int mi_stride) {
|
||||
int is_skip = 1;
|
||||
for (int r = 0; r < mi_size_high[BLOCK_8X8]; ++r)
|
||||
for (int c = 0; c < mi_size_wide[BLOCK_8X8]; ++c)
|
||||
is_skip &= grid[(mi_row + r) * mi_stride + (mi_col + c)]->mbmi.skip;
|
||||
is_skip &= grid[(mi_row + r) * mi_stride + (mi_col + c)]->skip;
|
||||
|
||||
return is_skip;
|
||||
}
|
||||
|
||||
int sb_compute_cdef_list(const AV1_COMMON *const cm, int mi_row, int mi_col,
|
||||
cdef_list *dlist, int filter_skip) {
|
||||
int r, c;
|
||||
int maxc, maxr;
|
||||
MODE_INFO **grid;
|
||||
int count = 0;
|
||||
grid = cm->mi_grid_visible;
|
||||
maxc = cm->mi_cols - mi_col;
|
||||
maxr = cm->mi_rows - mi_row;
|
||||
cdef_list *dlist, BLOCK_SIZE bs) {
|
||||
MB_MODE_INFO **grid = cm->mi_grid_visible;
|
||||
int maxc = cm->mi_cols - mi_col;
|
||||
int maxr = cm->mi_rows - mi_row;
|
||||
|
||||
maxr = AOMMIN(maxr, MI_SIZE_64X64);
|
||||
maxc = AOMMIN(maxc, MI_SIZE_64X64);
|
||||
if (bs == BLOCK_128X128 || bs == BLOCK_128X64)
|
||||
maxc = AOMMIN(maxc, MI_SIZE_128X128);
|
||||
else
|
||||
maxc = AOMMIN(maxc, MI_SIZE_64X64);
|
||||
if (bs == BLOCK_128X128 || bs == BLOCK_64X128)
|
||||
maxr = AOMMIN(maxr, MI_SIZE_128X128);
|
||||
else
|
||||
maxr = AOMMIN(maxr, MI_SIZE_64X64);
|
||||
|
||||
const int r_step = mi_size_high[BLOCK_8X8];
|
||||
const int c_step = mi_size_wide[BLOCK_8X8];
|
||||
|
|
@ -71,36 +73,25 @@ int sb_compute_cdef_list(const AV1_COMMON *const cm, int mi_row, int mi_col,
|
|||
assert(r_step == 1 || r_step == 2);
|
||||
assert(c_step == 1 || c_step == 2);
|
||||
|
||||
if (filter_skip) {
|
||||
for (r = 0; r < maxr; r += r_step) {
|
||||
for (c = 0; c < maxc; c += c_step) {
|
||||
int count = 0;
|
||||
|
||||
for (int r = 0; r < maxr; r += r_step) {
|
||||
for (int c = 0; c < maxc; c += c_step) {
|
||||
if (!is_8x8_block_skip(grid, mi_row + r, mi_col + c, cm->mi_stride)) {
|
||||
dlist[count].by = r >> r_shift;
|
||||
dlist[count].bx = c >> c_shift;
|
||||
dlist[count].skip =
|
||||
is_8x8_block_skip(grid, mi_row + r, mi_col + c, cm->mi_stride);
|
||||
dlist[count].skip = 0;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (r = 0; r < maxr; r += r_step) {
|
||||
for (c = 0; c < maxc; c += c_step) {
|
||||
if (!is_8x8_block_skip(grid, mi_row + r, mi_col + c, cm->mi_stride)) {
|
||||
dlist[count].by = r >> r_shift;
|
||||
dlist[count].bx = c >> c_shift;
|
||||
dlist[count].skip = 0;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
void copy_rect8_8bit_to_16bit_c(uint16_t *dst, int dstride, const uint8_t *src,
|
||||
int sstride, int v, int h) {
|
||||
int i, j;
|
||||
for (i = 0; i < v; i++) {
|
||||
for (j = 0; j < h; j++) {
|
||||
for (int i = 0; i < v; i++) {
|
||||
for (int j = 0; j < h; j++) {
|
||||
dst[i * dstride + j] = src[i * sstride + j];
|
||||
}
|
||||
}
|
||||
|
|
@ -109,36 +100,30 @@ void copy_rect8_8bit_to_16bit_c(uint16_t *dst, int dstride, const uint8_t *src,
|
|||
void copy_rect8_16bit_to_16bit_c(uint16_t *dst, int dstride,
|
||||
const uint16_t *src, int sstride, int v,
|
||||
int h) {
|
||||
int i, j;
|
||||
for (i = 0; i < v; i++) {
|
||||
for (j = 0; j < h; j++) {
|
||||
for (int i = 0; i < v; i++) {
|
||||
for (int j = 0; j < h; j++) {
|
||||
dst[i * dstride + j] = src[i * sstride + j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void copy_sb8_16(UNUSED AV1_COMMON *cm, uint16_t *dst, int dstride,
|
||||
static void copy_sb8_16(AOM_UNUSED AV1_COMMON *cm, uint16_t *dst, int dstride,
|
||||
const uint8_t *src, int src_voffset, int src_hoffset,
|
||||
int sstride, int vsize, int hsize) {
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
if (cm->use_highbitdepth) {
|
||||
const uint16_t *base =
|
||||
&CONVERT_TO_SHORTPTR(src)[src_voffset * sstride + src_hoffset];
|
||||
copy_rect8_16bit_to_16bit(dst, dstride, base, sstride, vsize, hsize);
|
||||
} else {
|
||||
#endif
|
||||
const uint8_t *base = &src[src_voffset * sstride + src_hoffset];
|
||||
copy_rect8_8bit_to_16bit(dst, dstride, base, sstride, vsize, hsize);
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static INLINE void fill_rect(uint16_t *dst, int dstride, int v, int h,
|
||||
uint16_t x) {
|
||||
int i, j;
|
||||
for (i = 0; i < v; i++) {
|
||||
for (j = 0; j < h; j++) {
|
||||
for (int i = 0; i < v; i++) {
|
||||
for (int j = 0; j < h; j++) {
|
||||
dst[i * dstride + j] = x;
|
||||
}
|
||||
}
|
||||
|
|
@ -146,9 +131,8 @@ static INLINE void fill_rect(uint16_t *dst, int dstride, int v, int h,
|
|||
|
||||
static INLINE void copy_rect(uint16_t *dst, int dstride, const uint16_t *src,
|
||||
int sstride, int v, int h) {
|
||||
int i, j;
|
||||
for (i = 0; i < v; i++) {
|
||||
for (j = 0; j < h; j++) {
|
||||
for (int i = 0; i < v; i++) {
|
||||
for (int j = 0; j < h; j++) {
|
||||
dst[i * dstride + j] = src[i * sstride + j];
|
||||
}
|
||||
}
|
||||
|
|
@ -156,9 +140,8 @@ static INLINE void copy_rect(uint16_t *dst, int dstride, const uint16_t *src,
|
|||
|
||||
void av1_cdef_frame(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm,
|
||||
MACROBLOCKD *xd) {
|
||||
int fbr, fbc;
|
||||
int nhfb, nvfb;
|
||||
uint16_t src[CDEF_INBUF_SIZE];
|
||||
const int num_planes = av1_num_planes(cm);
|
||||
DECLARE_ALIGNED(16, uint16_t, src[CDEF_INBUF_SIZE]);
|
||||
uint16_t *linebuf[3];
|
||||
uint16_t *colbuf[3];
|
||||
cdef_list dlist[MI_SIZE_64X64 * MI_SIZE_64X64];
|
||||
|
|
@ -166,48 +149,42 @@ void av1_cdef_frame(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm,
|
|||
int cdef_count;
|
||||
int dir[CDEF_NBLOCKS][CDEF_NBLOCKS] = { { 0 } };
|
||||
int var[CDEF_NBLOCKS][CDEF_NBLOCKS] = { { 0 } };
|
||||
int stride;
|
||||
int mi_wide_l2[3];
|
||||
int mi_high_l2[3];
|
||||
int xdec[3];
|
||||
int ydec[3];
|
||||
int pli;
|
||||
int cdef_left;
|
||||
int coeff_shift = AOMMAX(cm->bit_depth - 8, 0);
|
||||
int nplanes = MAX_MB_PLANE;
|
||||
int chroma_cdef = xd->plane[1].subsampling_x == xd->plane[1].subsampling_y &&
|
||||
xd->plane[2].subsampling_x == xd->plane[2].subsampling_y;
|
||||
nvfb = (cm->mi_rows + MI_SIZE_64X64 - 1) / MI_SIZE_64X64;
|
||||
nhfb = (cm->mi_cols + MI_SIZE_64X64 - 1) / MI_SIZE_64X64;
|
||||
av1_setup_dst_planes(xd->plane, cm->sb_size, frame, 0, 0);
|
||||
const int nvfb = (cm->mi_rows + MI_SIZE_64X64 - 1) / MI_SIZE_64X64;
|
||||
const int nhfb = (cm->mi_cols + MI_SIZE_64X64 - 1) / MI_SIZE_64X64;
|
||||
av1_setup_dst_planes(xd->plane, cm->seq_params.sb_size, frame, 0, 0, 0,
|
||||
num_planes);
|
||||
row_cdef = aom_malloc(sizeof(*row_cdef) * (nhfb + 2) * 2);
|
||||
memset(row_cdef, 1, sizeof(*row_cdef) * (nhfb + 2) * 2);
|
||||
prev_row_cdef = row_cdef + 1;
|
||||
curr_row_cdef = prev_row_cdef + nhfb + 2;
|
||||
for (pli = 0; pli < nplanes; pli++) {
|
||||
for (int pli = 0; pli < num_planes; pli++) {
|
||||
xdec[pli] = xd->plane[pli].subsampling_x;
|
||||
ydec[pli] = xd->plane[pli].subsampling_y;
|
||||
mi_wide_l2[pli] = MI_SIZE_LOG2 - xd->plane[pli].subsampling_x;
|
||||
mi_high_l2[pli] = MI_SIZE_LOG2 - xd->plane[pli].subsampling_y;
|
||||
if (xdec[pli] != ydec[pli]) nplanes = 1;
|
||||
}
|
||||
stride = (cm->mi_cols << MI_SIZE_LOG2) + 2 * CDEF_HBORDER;
|
||||
for (pli = 0; pli < nplanes; pli++) {
|
||||
const int stride = (cm->mi_cols << MI_SIZE_LOG2) + 2 * CDEF_HBORDER;
|
||||
for (int pli = 0; pli < num_planes; pli++) {
|
||||
linebuf[pli] = aom_malloc(sizeof(*linebuf) * CDEF_VBORDER * stride);
|
||||
colbuf[pli] =
|
||||
aom_malloc(sizeof(*colbuf) *
|
||||
((CDEF_BLOCKSIZE << mi_high_l2[pli]) + 2 * CDEF_VBORDER) *
|
||||
CDEF_HBORDER);
|
||||
}
|
||||
for (fbr = 0; fbr < nvfb; fbr++) {
|
||||
for (pli = 0; pli < nplanes; pli++) {
|
||||
for (int fbr = 0; fbr < nvfb; fbr++) {
|
||||
for (int pli = 0; pli < num_planes; pli++) {
|
||||
const int block_height =
|
||||
(MI_SIZE_64X64 << mi_high_l2[pli]) + 2 * CDEF_VBORDER;
|
||||
fill_rect(colbuf[pli], CDEF_HBORDER, block_height, CDEF_HBORDER,
|
||||
CDEF_VERY_LARGE);
|
||||
}
|
||||
cdef_left = 1;
|
||||
for (fbc = 0; fbc < nhfb; fbc++) {
|
||||
int cdef_left = 1;
|
||||
for (int fbc = 0; fbc < nhfb; fbc++) {
|
||||
int level, sec_strength;
|
||||
int uv_level, uv_sec_strength;
|
||||
int nhb, nvb;
|
||||
|
|
@ -217,38 +194,43 @@ void av1_cdef_frame(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm,
|
|||
MI_SIZE_64X64 * fbc] == NULL ||
|
||||
cm->mi_grid_visible[MI_SIZE_64X64 * fbr * cm->mi_stride +
|
||||
MI_SIZE_64X64 * fbc]
|
||||
->mbmi.cdef_strength == -1) {
|
||||
->cdef_strength == -1) {
|
||||
cdef_left = 0;
|
||||
continue;
|
||||
}
|
||||
if (!cdef_left) cstart = -CDEF_HBORDER;
|
||||
nhb = AOMMIN(MI_SIZE_64X64, cm->mi_cols - MI_SIZE_64X64 * fbc);
|
||||
nvb = AOMMIN(MI_SIZE_64X64, cm->mi_rows - MI_SIZE_64X64 * fbr);
|
||||
int tile_top, tile_left, tile_bottom, tile_right;
|
||||
int mi_idx = MI_SIZE_64X64 * fbr * cm->mi_stride + MI_SIZE_64X64 * fbc;
|
||||
MODE_INFO *const mi_tl = cm->mi + mi_idx;
|
||||
BOUNDARY_TYPE boundary_tl = mi_tl->mbmi.boundary_info;
|
||||
tile_top = boundary_tl & TILE_ABOVE_BOUNDARY;
|
||||
tile_left = boundary_tl & TILE_LEFT_BOUNDARY;
|
||||
int frame_top, frame_left, frame_bottom, frame_right;
|
||||
|
||||
if (fbr != nvfb - 1 &&
|
||||
(&cm->mi[mi_idx + (MI_SIZE_64X64 - 1) * cm->mi_stride]))
|
||||
tile_bottom = cm->mi[mi_idx + (MI_SIZE_64X64 - 1) * cm->mi_stride]
|
||||
.mbmi.boundary_info &
|
||||
TILE_BOTTOM_BOUNDARY;
|
||||
else
|
||||
tile_bottom = 1;
|
||||
int mi_row = MI_SIZE_64X64 * fbr;
|
||||
int mi_col = MI_SIZE_64X64 * fbc;
|
||||
// for the current filter block, it's top left corner mi structure (mi_tl)
|
||||
// is first accessed to check whether the top and left boundaries are
|
||||
// frame boundaries. Then bottom-left and top-right mi structures are
|
||||
// accessed to check whether the bottom and right boundaries
|
||||
// (respectively) are frame boundaries.
|
||||
//
|
||||
// Note that we can't just check the bottom-right mi structure - eg. if
|
||||
// we're at the right-hand edge of the frame but not the bottom, then
|
||||
// the bottom-right mi is NULL but the bottom-left is not.
|
||||
frame_top = (mi_row == 0) ? 1 : 0;
|
||||
frame_left = (mi_col == 0) ? 1 : 0;
|
||||
|
||||
if (fbc != nhfb - 1 && (&cm->mi[mi_idx + MI_SIZE_64X64 - 1]))
|
||||
tile_right = cm->mi[mi_idx + MI_SIZE_64X64 - 1].mbmi.boundary_info &
|
||||
TILE_RIGHT_BOUNDARY;
|
||||
if (fbr != nvfb - 1)
|
||||
frame_bottom = (mi_row + MI_SIZE_64X64 == cm->mi_rows) ? 1 : 0;
|
||||
else
|
||||
tile_right = 1;
|
||||
frame_bottom = 1;
|
||||
|
||||
if (fbc != nhfb - 1)
|
||||
frame_right = (mi_col + MI_SIZE_64X64 == cm->mi_cols) ? 1 : 0;
|
||||
else
|
||||
frame_right = 1;
|
||||
|
||||
const int mbmi_cdef_strength =
|
||||
cm->mi_grid_visible[MI_SIZE_64X64 * fbr * cm->mi_stride +
|
||||
MI_SIZE_64X64 * fbc]
|
||||
->mbmi.cdef_strength;
|
||||
->cdef_strength;
|
||||
level = cm->cdef_strengths[mbmi_cdef_strength] / CDEF_SEC_STRENGTHS;
|
||||
sec_strength =
|
||||
cm->cdef_strengths[mbmi_cdef_strength] % CDEF_SEC_STRENGTHS;
|
||||
|
|
@ -259,23 +241,15 @@ void av1_cdef_frame(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm,
|
|||
uv_sec_strength += uv_sec_strength == 3;
|
||||
if ((level == 0 && sec_strength == 0 && uv_level == 0 &&
|
||||
uv_sec_strength == 0) ||
|
||||
(cdef_count = sb_compute_cdef_list(
|
||||
cm, fbr * MI_SIZE_64X64, fbc * MI_SIZE_64X64, dlist,
|
||||
#if CONFIG_CDEF_SINGLEPASS
|
||||
(level & 1) || (uv_level & 1))) == 0)
|
||||
#else
|
||||
get_filter_skip(level) || get_filter_skip(uv_level))) == 0)
|
||||
#endif
|
||||
{
|
||||
(cdef_count = sb_compute_cdef_list(cm, fbr * MI_SIZE_64X64,
|
||||
fbc * MI_SIZE_64X64, dlist,
|
||||
BLOCK_64X64)) == 0) {
|
||||
cdef_left = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
curr_row_cdef[fbc] = 1;
|
||||
for (pli = 0; pli < nplanes; pli++) {
|
||||
#if !CONFIG_CDEF_SINGLEPASS
|
||||
uint16_t dst[CDEF_BLOCKSIZE * CDEF_BLOCKSIZE];
|
||||
#endif
|
||||
for (int pli = 0; pli < num_planes; pli++) {
|
||||
int coffset;
|
||||
int rend, cend;
|
||||
int pri_damping = cm->cdef_pri_damping;
|
||||
|
|
@ -284,10 +258,7 @@ void av1_cdef_frame(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm,
|
|||
int vsize = nvb << mi_high_l2[pli];
|
||||
|
||||
if (pli) {
|
||||
if (chroma_cdef)
|
||||
level = uv_level;
|
||||
else
|
||||
level = 0;
|
||||
level = uv_level;
|
||||
sec_strength = uv_sec_strength;
|
||||
}
|
||||
|
||||
|
|
@ -375,81 +346,57 @@ void av1_cdef_frame(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm,
|
|||
(MI_SIZE_64X64 << mi_high_l2[pli]) * (fbr + 1) - CDEF_VBORDER,
|
||||
coffset, xd->plane[pli].dst.stride, CDEF_VBORDER, hsize);
|
||||
|
||||
if (tile_top) {
|
||||
if (frame_top) {
|
||||
fill_rect(src, CDEF_BSTRIDE, CDEF_VBORDER, hsize + 2 * CDEF_HBORDER,
|
||||
CDEF_VERY_LARGE);
|
||||
}
|
||||
if (tile_left) {
|
||||
if (frame_left) {
|
||||
fill_rect(src, CDEF_BSTRIDE, vsize + 2 * CDEF_VBORDER, CDEF_HBORDER,
|
||||
CDEF_VERY_LARGE);
|
||||
}
|
||||
if (tile_bottom) {
|
||||
if (frame_bottom) {
|
||||
fill_rect(&src[(vsize + CDEF_VBORDER) * CDEF_BSTRIDE], CDEF_BSTRIDE,
|
||||
CDEF_VBORDER, hsize + 2 * CDEF_HBORDER, CDEF_VERY_LARGE);
|
||||
}
|
||||
if (tile_right) {
|
||||
if (frame_right) {
|
||||
fill_rect(&src[hsize + CDEF_HBORDER], CDEF_BSTRIDE,
|
||||
vsize + 2 * CDEF_VBORDER, CDEF_HBORDER, CDEF_VERY_LARGE);
|
||||
}
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
|
||||
if (cm->use_highbitdepth) {
|
||||
cdef_filter_fb(
|
||||
#if CONFIG_CDEF_SINGLEPASS
|
||||
NULL,
|
||||
&CONVERT_TO_SHORTPTR(xd->plane[pli].dst.buf)
|
||||
#else
|
||||
(uint8_t *)&CONVERT_TO_SHORTPTR(xd->plane[pli].dst.buf)
|
||||
#endif
|
||||
[xd->plane[pli].dst.stride *
|
||||
(MI_SIZE_64X64 * fbr << mi_high_l2[pli]) +
|
||||
(fbc * MI_SIZE_64X64 << mi_wide_l2[pli])],
|
||||
#if CONFIG_CDEF_SINGLEPASS
|
||||
&CONVERT_TO_SHORTPTR(
|
||||
xd->plane[pli]
|
||||
.dst.buf)[xd->plane[pli].dst.stride *
|
||||
(MI_SIZE_64X64 * fbr << mi_high_l2[pli]) +
|
||||
(fbc * MI_SIZE_64X64 << mi_wide_l2[pli])],
|
||||
xd->plane[pli].dst.stride,
|
||||
#else
|
||||
xd->plane[pli].dst.stride, dst,
|
||||
#endif
|
||||
&src[CDEF_VBORDER * CDEF_BSTRIDE + CDEF_HBORDER], xdec[pli],
|
||||
ydec[pli], dir, NULL, var, pli, dlist, cdef_count, level,
|
||||
#if CONFIG_CDEF_SINGLEPASS
|
||||
sec_strength, pri_damping, sec_damping, coeff_shift);
|
||||
#else
|
||||
sec_strength, sec_damping, pri_damping, coeff_shift, 0, 1);
|
||||
#endif
|
||||
} else {
|
||||
#endif
|
||||
cdef_filter_fb(
|
||||
&xd->plane[pli]
|
||||
.dst.buf[xd->plane[pli].dst.stride *
|
||||
(MI_SIZE_64X64 * fbr << mi_high_l2[pli]) +
|
||||
(fbc * MI_SIZE_64X64 << mi_wide_l2[pli])],
|
||||
#if CONFIG_CDEF_SINGLEPASS
|
||||
NULL, xd->plane[pli].dst.stride,
|
||||
#else
|
||||
xd->plane[pli].dst.stride, dst,
|
||||
#endif
|
||||
&src[CDEF_VBORDER * CDEF_BSTRIDE + CDEF_HBORDER], xdec[pli],
|
||||
ydec[pli], dir, NULL, var, pli, dlist, cdef_count, level,
|
||||
#if CONFIG_CDEF_SINGLEPASS
|
||||
sec_strength, pri_damping, sec_damping, coeff_shift);
|
||||
#else
|
||||
sec_strength, sec_damping, pri_damping, coeff_shift, 0, 0);
|
||||
#endif
|
||||
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
}
|
||||
#endif
|
||||
}
|
||||
cdef_left = 1;
|
||||
}
|
||||
{
|
||||
unsigned char *tmp;
|
||||
tmp = prev_row_cdef;
|
||||
unsigned char *tmp = prev_row_cdef;
|
||||
prev_row_cdef = curr_row_cdef;
|
||||
curr_row_cdef = tmp;
|
||||
}
|
||||
}
|
||||
aom_free(row_cdef);
|
||||
for (pli = 0; pli < nplanes; pli++) {
|
||||
for (int pli = 0; pli < num_planes; pli++) {
|
||||
aom_free(linebuf[pli]);
|
||||
aom_free(colbuf[pli]);
|
||||
}
|
||||
|
|
|
|||
9
third_party/aom/av1/common/cdef.h
vendored
9
third_party/aom/av1/common/cdef.h
vendored
|
|
@ -11,12 +11,13 @@
|
|||
#ifndef AV1_COMMON_CDEF_H_
|
||||
#define AV1_COMMON_CDEF_H_
|
||||
|
||||
#define CDEF_STRENGTH_BITS 7
|
||||
#define CDEF_STRENGTH_BITS 6
|
||||
|
||||
#define CDEF_PRI_STRENGTHS 32
|
||||
#define CDEF_PRI_STRENGTHS 16
|
||||
#define CDEF_SEC_STRENGTHS 4
|
||||
|
||||
#include "./aom_config.h"
|
||||
#include "config/aom_config.h"
|
||||
|
||||
#include "aom/aom_integer.h"
|
||||
#include "aom_ports/mem.h"
|
||||
#include "av1/common/cdef_block.h"
|
||||
|
|
@ -38,7 +39,7 @@ extern "C" {
|
|||
|
||||
int sb_all_skip(const AV1_COMMON *const cm, int mi_row, int mi_col);
|
||||
int sb_compute_cdef_list(const AV1_COMMON *const cm, int mi_row, int mi_col,
|
||||
cdef_list *dlist, int filter_skip);
|
||||
cdef_list *dlist, BLOCK_SIZE bsize);
|
||||
void av1_cdef_frame(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm, MACROBLOCKD *xd);
|
||||
|
||||
void av1_cdef_search(YV12_BUFFER_CONFIG *frame, const YV12_BUFFER_CONFIG *ref,
|
||||
|
|
|
|||
391
third_party/aom/av1/common/cdef_block.c
vendored
391
third_party/aom/av1/common/cdef_block.c
vendored
|
|
@ -12,28 +12,13 @@
|
|||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "./config.h"
|
||||
#endif
|
||||
#include "config/aom_dsp_rtcd.h"
|
||||
#include "config/av1_rtcd.h"
|
||||
|
||||
#include "./aom_dsp_rtcd.h"
|
||||
#include "./av1_rtcd.h"
|
||||
#include "./cdef.h"
|
||||
#include "av1/common/cdef.h"
|
||||
|
||||
/* Generated from gen_filter_tables.c. */
|
||||
#if !CONFIG_CDEF_SINGLEPASS || CDEF_FULL
|
||||
const int cdef_directions[8][3] = {
|
||||
{ -1 * CDEF_BSTRIDE + 1, -2 * CDEF_BSTRIDE + 2, -3 * CDEF_BSTRIDE + 3 },
|
||||
{ 0 * CDEF_BSTRIDE + 1, -1 * CDEF_BSTRIDE + 2, -1 * CDEF_BSTRIDE + 3 },
|
||||
{ 0 * CDEF_BSTRIDE + 1, 0 * CDEF_BSTRIDE + 2, 0 * CDEF_BSTRIDE + 3 },
|
||||
{ 0 * CDEF_BSTRIDE + 1, 1 * CDEF_BSTRIDE + 2, 1 * CDEF_BSTRIDE + 3 },
|
||||
{ 1 * CDEF_BSTRIDE + 1, 2 * CDEF_BSTRIDE + 2, 3 * CDEF_BSTRIDE + 3 },
|
||||
{ 1 * CDEF_BSTRIDE + 0, 2 * CDEF_BSTRIDE + 1, 3 * CDEF_BSTRIDE + 1 },
|
||||
{ 1 * CDEF_BSTRIDE + 0, 2 * CDEF_BSTRIDE + 0, 3 * CDEF_BSTRIDE + 0 },
|
||||
{ 1 * CDEF_BSTRIDE + 0, 2 * CDEF_BSTRIDE - 1, 3 * CDEF_BSTRIDE - 1 }
|
||||
};
|
||||
#else
|
||||
const int cdef_directions[8][2] = {
|
||||
DECLARE_ALIGNED(16, const int, cdef_directions[8][2]) = {
|
||||
{ -1 * CDEF_BSTRIDE + 1, -2 * CDEF_BSTRIDE + 2 },
|
||||
{ 0 * CDEF_BSTRIDE + 1, -1 * CDEF_BSTRIDE + 2 },
|
||||
{ 0 * CDEF_BSTRIDE + 1, 0 * CDEF_BSTRIDE + 2 },
|
||||
|
|
@ -43,7 +28,6 @@ const int cdef_directions[8][2] = {
|
|||
{ 1 * CDEF_BSTRIDE + 0, 2 * CDEF_BSTRIDE + 0 },
|
||||
{ 1 * CDEF_BSTRIDE + 0, 2 * CDEF_BSTRIDE - 1 }
|
||||
};
|
||||
#endif
|
||||
|
||||
/* Detect direction. 0 means 45-degree up-right, 2 is horizontal, and so on.
|
||||
The search minimizes the weighted variance along all the lines in a
|
||||
|
|
@ -123,65 +107,38 @@ int cdef_find_dir_c(const uint16_t *img, int stride, int32_t *var,
|
|||
return best_dir;
|
||||
}
|
||||
|
||||
#if CONFIG_CDEF_SINGLEPASS
|
||||
#if CDEF_FULL
|
||||
const int cdef_pri_taps[2][3] = { { 3, 2, 1 }, { 2, 2, 2 } };
|
||||
const int cdef_sec_taps[2][2] = { { 3, 1 }, { 3, 1 } };
|
||||
#else
|
||||
const int cdef_pri_taps[2][2] = { { 4, 2 }, { 3, 3 } };
|
||||
const int cdef_sec_taps[2][2] = { { 2, 1 }, { 2, 1 } };
|
||||
#endif
|
||||
|
||||
/* Smooth in the direction detected. */
|
||||
#if CDEF_CAP
|
||||
void cdef_filter_block_c(uint8_t *dst8, uint16_t *dst16, int dstride,
|
||||
const uint16_t *in, int pri_strength, int sec_strength,
|
||||
int dir, int pri_damping, int sec_damping, int bsize,
|
||||
UNUSED int max_unused)
|
||||
#else
|
||||
void cdef_filter_block_c(uint8_t *dst8, uint16_t *dst16, int dstride,
|
||||
const uint16_t *in, int pri_strength, int sec_strength,
|
||||
int dir, int pri_damping, int sec_damping, int bsize,
|
||||
int max)
|
||||
#endif
|
||||
{
|
||||
AOM_UNUSED int max_unused, int coeff_shift) {
|
||||
int i, j, k;
|
||||
const int s = CDEF_BSTRIDE;
|
||||
const int *pri_taps = cdef_pri_taps[pri_strength & 1];
|
||||
const int *sec_taps = cdef_sec_taps[pri_strength & 1];
|
||||
for (i = 0; i < 4 << (bsize == BLOCK_8X8); i++) {
|
||||
for (j = 0; j < 4 << (bsize == BLOCK_8X8); j++) {
|
||||
const int *pri_taps = cdef_pri_taps[(pri_strength >> coeff_shift) & 1];
|
||||
const int *sec_taps = cdef_sec_taps[(pri_strength >> coeff_shift) & 1];
|
||||
for (i = 0; i < 4 << (bsize == BLOCK_8X8 || bsize == BLOCK_4X8); i++) {
|
||||
for (j = 0; j < 4 << (bsize == BLOCK_8X8 || bsize == BLOCK_8X4); j++) {
|
||||
int16_t sum = 0;
|
||||
int16_t y;
|
||||
int16_t x = in[i * s + j];
|
||||
#if CDEF_CAP
|
||||
int max = x;
|
||||
int min = x;
|
||||
#endif
|
||||
#if CDEF_FULL
|
||||
for (k = 0; k < 3; k++)
|
||||
#else
|
||||
for (k = 0; k < 2; k++)
|
||||
#endif
|
||||
{
|
||||
for (k = 0; k < 2; k++) {
|
||||
int16_t p0 = in[i * s + j + cdef_directions[dir][k]];
|
||||
int16_t p1 = in[i * s + j - cdef_directions[dir][k]];
|
||||
sum += pri_taps[k] * constrain(p0 - x, pri_strength, pri_damping);
|
||||
sum += pri_taps[k] * constrain(p1 - x, pri_strength, pri_damping);
|
||||
#if CDEF_CAP
|
||||
if (p0 != CDEF_VERY_LARGE) max = AOMMAX(p0, max);
|
||||
if (p1 != CDEF_VERY_LARGE) max = AOMMAX(p1, max);
|
||||
min = AOMMIN(p0, min);
|
||||
min = AOMMIN(p1, min);
|
||||
#endif
|
||||
#if CDEF_FULL
|
||||
if (k == 2) continue;
|
||||
#endif
|
||||
int16_t s0 = in[i * s + j + cdef_directions[(dir + 2) & 7][k]];
|
||||
int16_t s1 = in[i * s + j - cdef_directions[(dir + 2) & 7][k]];
|
||||
int16_t s2 = in[i * s + j + cdef_directions[(dir + 6) & 7][k]];
|
||||
int16_t s3 = in[i * s + j - cdef_directions[(dir + 6) & 7][k]];
|
||||
#if CDEF_CAP
|
||||
if (s0 != CDEF_VERY_LARGE) max = AOMMAX(s0, max);
|
||||
if (s1 != CDEF_VERY_LARGE) max = AOMMAX(s1, max);
|
||||
if (s2 != CDEF_VERY_LARGE) max = AOMMAX(s2, max);
|
||||
|
|
@ -190,17 +147,12 @@ void cdef_filter_block_c(uint8_t *dst8, uint16_t *dst16, int dstride,
|
|||
min = AOMMIN(s1, min);
|
||||
min = AOMMIN(s2, min);
|
||||
min = AOMMIN(s3, min);
|
||||
#endif
|
||||
sum += sec_taps[k] * constrain(s0 - x, sec_strength, sec_damping);
|
||||
sum += sec_taps[k] * constrain(s1 - x, sec_strength, sec_damping);
|
||||
sum += sec_taps[k] * constrain(s2 - x, sec_strength, sec_damping);
|
||||
sum += sec_taps[k] * constrain(s3 - x, sec_strength, sec_damping);
|
||||
}
|
||||
#if CDEF_CAP
|
||||
y = clamp((int16_t)x + ((8 + sum - (sum < 0)) >> 4), min, max);
|
||||
#else
|
||||
y = clamp((int16_t)x + ((8 + sum - (sum < 0)) >> 4), 0, max);
|
||||
#endif
|
||||
if (dst8)
|
||||
dst8[i * dstride + j] = (uint8_t)y;
|
||||
else
|
||||
|
|
@ -209,67 +161,6 @@ void cdef_filter_block_c(uint8_t *dst8, uint16_t *dst16, int dstride,
|
|||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/* Smooth in the direction detected. */
|
||||
void cdef_direction_8x8_c(uint16_t *y, int ystride, const uint16_t *in,
|
||||
int threshold, int dir, int damping) {
|
||||
int i;
|
||||
int j;
|
||||
int k;
|
||||
static const int taps[3] = { 3, 2, 1 };
|
||||
for (i = 0; i < 8; i++) {
|
||||
for (j = 0; j < 8; j++) {
|
||||
int16_t sum;
|
||||
int16_t xx;
|
||||
int16_t yy;
|
||||
xx = in[i * CDEF_BSTRIDE + j];
|
||||
sum = 0;
|
||||
for (k = 0; k < 3; k++) {
|
||||
int16_t p0;
|
||||
int16_t p1;
|
||||
p0 = in[i * CDEF_BSTRIDE + j + cdef_directions[dir][k]] - xx;
|
||||
p1 = in[i * CDEF_BSTRIDE + j - cdef_directions[dir][k]] - xx;
|
||||
sum += taps[k] * constrain(p0, threshold, damping);
|
||||
sum += taps[k] * constrain(p1, threshold, damping);
|
||||
}
|
||||
sum = (sum + 8) >> 4;
|
||||
yy = xx + sum;
|
||||
y[i * ystride + j] = yy;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Smooth in the direction detected. */
|
||||
void cdef_direction_4x4_c(uint16_t *y, int ystride, const uint16_t *in,
|
||||
int threshold, int dir, int damping) {
|
||||
int i;
|
||||
int j;
|
||||
int k;
|
||||
static const int taps[2] = { 4, 1 };
|
||||
for (i = 0; i < 4; i++) {
|
||||
for (j = 0; j < 4; j++) {
|
||||
int16_t sum;
|
||||
int16_t xx;
|
||||
int16_t yy;
|
||||
xx = in[i * CDEF_BSTRIDE + j];
|
||||
sum = 0;
|
||||
for (k = 0; k < 2; k++) {
|
||||
int16_t p0;
|
||||
int16_t p1;
|
||||
p0 = in[i * CDEF_BSTRIDE + j + cdef_directions[dir][k]] - xx;
|
||||
p1 = in[i * CDEF_BSTRIDE + j - cdef_directions[dir][k]] - xx;
|
||||
sum += taps[k] * constrain(p0, threshold, damping);
|
||||
sum += taps[k] * constrain(p1, threshold, damping);
|
||||
}
|
||||
sum = (sum + 8) >> 4;
|
||||
yy = xx + sum;
|
||||
y[i * ystride + j] = yy;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Compute the primary filter strength for an 8x8 block based on the
|
||||
directional variance difference. A high variance difference means
|
||||
that we have a highly directional pattern (e.g. a high contrast
|
||||
|
|
@ -282,172 +173,26 @@ static INLINE int adjust_strength(int strength, int32_t var) {
|
|||
return var ? (strength * (4 + i) + 8) >> 4 : 0;
|
||||
}
|
||||
|
||||
#if !CONFIG_CDEF_SINGLEPASS
|
||||
void copy_8x8_16bit_to_16bit_c(uint16_t *dst, int dstride, const uint16_t *src,
|
||||
int sstride) {
|
||||
int i, j;
|
||||
for (i = 0; i < 8; i++)
|
||||
for (j = 0; j < 8; j++) dst[i * dstride + j] = src[i * sstride + j];
|
||||
}
|
||||
|
||||
void copy_4x4_16bit_to_16bit_c(uint16_t *dst, int dstride, const uint16_t *src,
|
||||
int sstride) {
|
||||
int i, j;
|
||||
for (i = 0; i < 4; i++)
|
||||
for (j = 0; j < 4; j++) dst[i * dstride + j] = src[i * sstride + j];
|
||||
}
|
||||
|
||||
static void copy_block_16bit_to_16bit(uint16_t *dst, int dstride, uint16_t *src,
|
||||
cdef_list *dlist, int cdef_count,
|
||||
int bsize) {
|
||||
int bi, bx, by;
|
||||
|
||||
if (bsize == BLOCK_8X8) {
|
||||
for (bi = 0; bi < cdef_count; bi++) {
|
||||
by = dlist[bi].by;
|
||||
bx = dlist[bi].bx;
|
||||
copy_8x8_16bit_to_16bit(&dst[(by << 3) * dstride + (bx << 3)], dstride,
|
||||
&src[bi << (3 + 3)], 8);
|
||||
}
|
||||
} else if (bsize == BLOCK_4X8) {
|
||||
for (bi = 0; bi < cdef_count; bi++) {
|
||||
by = dlist[bi].by;
|
||||
bx = dlist[bi].bx;
|
||||
copy_4x4_16bit_to_16bit(&dst[(by << 3) * dstride + (bx << 2)], dstride,
|
||||
&src[bi << (3 + 2)], 4);
|
||||
copy_4x4_16bit_to_16bit(&dst[((by << 3) + 4) * dstride + (bx << 2)],
|
||||
dstride, &src[(bi << (3 + 2)) + 4 * 4], 4);
|
||||
}
|
||||
} else if (bsize == BLOCK_8X4) {
|
||||
for (bi = 0; bi < cdef_count; bi++) {
|
||||
by = dlist[bi].by;
|
||||
bx = dlist[bi].bx;
|
||||
copy_4x4_16bit_to_16bit(&dst[(by << 2) * dstride + (bx << 3)], dstride,
|
||||
&src[bi << (2 + 3)], 8);
|
||||
copy_4x4_16bit_to_16bit(&dst[(by << 2) * dstride + (bx << 3) + 4],
|
||||
dstride, &src[(bi << (2 + 3)) + 4], 8);
|
||||
}
|
||||
} else {
|
||||
assert(bsize == BLOCK_4X4);
|
||||
for (bi = 0; bi < cdef_count; bi++) {
|
||||
by = dlist[bi].by;
|
||||
bx = dlist[bi].bx;
|
||||
copy_4x4_16bit_to_16bit(&dst[(by << 2) * dstride + (bx << 2)], dstride,
|
||||
&src[bi << (2 + 2)], 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void copy_8x8_16bit_to_8bit_c(uint8_t *dst, int dstride, const uint16_t *src,
|
||||
int sstride) {
|
||||
int i, j;
|
||||
for (i = 0; i < 8; i++)
|
||||
for (j = 0; j < 8; j++)
|
||||
dst[i * dstride + j] = (uint8_t)src[i * sstride + j];
|
||||
}
|
||||
|
||||
void copy_4x4_16bit_to_8bit_c(uint8_t *dst, int dstride, const uint16_t *src,
|
||||
int sstride) {
|
||||
int i, j;
|
||||
for (i = 0; i < 4; i++)
|
||||
for (j = 0; j < 4; j++)
|
||||
dst[i * dstride + j] = (uint8_t)src[i * sstride + j];
|
||||
}
|
||||
|
||||
static void copy_block_16bit_to_8bit(uint8_t *dst, int dstride,
|
||||
const uint16_t *src, cdef_list *dlist,
|
||||
int cdef_count, int bsize) {
|
||||
int bi, bx, by;
|
||||
if (bsize == BLOCK_8X8) {
|
||||
for (bi = 0; bi < cdef_count; bi++) {
|
||||
by = dlist[bi].by;
|
||||
bx = dlist[bi].bx;
|
||||
copy_8x8_16bit_to_8bit(&dst[(by << 3) * dstride + (bx << 3)], dstride,
|
||||
&src[bi << (3 + 3)], 8);
|
||||
}
|
||||
} else if (bsize == BLOCK_4X8) {
|
||||
for (bi = 0; bi < cdef_count; bi++) {
|
||||
by = dlist[bi].by;
|
||||
bx = dlist[bi].bx;
|
||||
copy_4x4_16bit_to_8bit(&dst[(by << 3) * dstride + (bx << 2)], dstride,
|
||||
&src[bi << (3 + 2)], 4);
|
||||
copy_4x4_16bit_to_8bit(&dst[((by << 3) + 4) * dstride + (bx << 2)],
|
||||
dstride, &src[(bi << (3 + 2)) + 4 * 4], 4);
|
||||
}
|
||||
} else if (bsize == BLOCK_8X4) {
|
||||
for (bi = 0; bi < cdef_count; bi++) {
|
||||
by = dlist[bi].by;
|
||||
bx = dlist[bi].bx;
|
||||
copy_4x4_16bit_to_8bit(&dst[(by << 2) * dstride + (bx << 3)], dstride,
|
||||
&src[bi << (2 + 3)], 8);
|
||||
copy_4x4_16bit_to_8bit(&dst[(by << 2) * dstride + (bx << 3) + 4], dstride,
|
||||
&src[(bi << (2 + 3)) + 4], 8);
|
||||
}
|
||||
} else {
|
||||
assert(bsize == BLOCK_4X4);
|
||||
for (bi = 0; bi < cdef_count; bi++) {
|
||||
by = dlist[bi].by;
|
||||
bx = dlist[bi].bx;
|
||||
copy_4x4_16bit_to_8bit(&dst[(by << 2) * dstride + (bx << 2)], dstride,
|
||||
&src[bi << (2 * 2)], 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int get_filter_skip(int level) {
|
||||
int filter_skip = level & 1;
|
||||
if (level == 1) filter_skip = 0;
|
||||
return filter_skip;
|
||||
}
|
||||
|
||||
void cdef_filter_fb(uint8_t *dst, int dstride, uint16_t *y, uint16_t *in,
|
||||
int xdec, int ydec, int dir[CDEF_NBLOCKS][CDEF_NBLOCKS],
|
||||
int *dirinit, int var[CDEF_NBLOCKS][CDEF_NBLOCKS], int pli,
|
||||
cdef_list *dlist, int cdef_count, int level,
|
||||
int sec_strength, int sec_damping, int pri_damping,
|
||||
int coeff_shift, int skip_dering, int hbd) {
|
||||
#else
|
||||
|
||||
void cdef_filter_fb(uint8_t *dst8, uint16_t *dst16, int dstride, uint16_t *in,
|
||||
int xdec, int ydec, int dir[CDEF_NBLOCKS][CDEF_NBLOCKS],
|
||||
int *dirinit, int var[CDEF_NBLOCKS][CDEF_NBLOCKS], int pli,
|
||||
cdef_list *dlist, int cdef_count, int level,
|
||||
int sec_strength, int pri_damping, int sec_damping,
|
||||
int coeff_shift) {
|
||||
#endif
|
||||
int bi;
|
||||
int bx;
|
||||
int by;
|
||||
int bsize, bsizex, bsizey;
|
||||
|
||||
#if CONFIG_CDEF_SINGLEPASS
|
||||
int pri_strength = (level >> 1) << coeff_shift;
|
||||
int filter_skip = level & 1;
|
||||
if (!pri_strength && !sec_strength && filter_skip) {
|
||||
pri_strength = 19 << coeff_shift;
|
||||
sec_strength = 7 << coeff_shift;
|
||||
}
|
||||
#else
|
||||
int threshold = (level >> 1) << coeff_shift;
|
||||
int filter_skip = get_filter_skip(level);
|
||||
if (level == 1) threshold = 31 << coeff_shift;
|
||||
|
||||
cdef_direction_func cdef_direction[] = { cdef_direction_4x4,
|
||||
cdef_direction_8x8 };
|
||||
#endif
|
||||
int pri_strength = level << coeff_shift;
|
||||
sec_strength <<= coeff_shift;
|
||||
sec_damping += coeff_shift - (pli != AOM_PLANE_Y);
|
||||
pri_damping += coeff_shift - (pli != AOM_PLANE_Y);
|
||||
bsize =
|
||||
ydec ? (xdec ? BLOCK_4X4 : BLOCK_8X4) : (xdec ? BLOCK_4X8 : BLOCK_8X8);
|
||||
bsizex = 3 - xdec;
|
||||
bsizey = 3 - ydec;
|
||||
#if CONFIG_CDEF_SINGLEPASS
|
||||
if (dirinit && pri_strength == 0 && sec_strength == 0)
|
||||
#else
|
||||
if (!skip_dering)
|
||||
#endif
|
||||
{
|
||||
#if CONFIG_CDEF_SINGLEPASS
|
||||
if (dirinit && pri_strength == 0 && sec_strength == 0) {
|
||||
// If we're here, both primary and secondary strengths are 0, and
|
||||
// we still haven't written anything to y[] yet, so we just copy
|
||||
// the input to y[]. This is necessary only for av1_cdef_search()
|
||||
|
|
@ -455,97 +200,16 @@ void cdef_filter_fb(uint8_t *dst8, uint16_t *dst16, int dstride, uint16_t *in,
|
|||
for (bi = 0; bi < cdef_count; bi++) {
|
||||
by = dlist[bi].by;
|
||||
bx = dlist[bi].bx;
|
||||
#else
|
||||
if (pli == 0) {
|
||||
if (!dirinit || !*dirinit) {
|
||||
for (bi = 0; bi < cdef_count; bi++) {
|
||||
by = dlist[bi].by;
|
||||
bx = dlist[bi].bx;
|
||||
dir[by][bx] = cdef_find_dir(&in[8 * by * CDEF_BSTRIDE + 8 * bx],
|
||||
CDEF_BSTRIDE, &var[by][bx], coeff_shift);
|
||||
}
|
||||
if (dirinit) *dirinit = 1;
|
||||
}
|
||||
}
|
||||
// Only run dering for non-zero threshold (which is always the case for
|
||||
// 4:2:2 or 4:4:0). If we don't dering, we still need to eventually write
|
||||
// something out in y[] later.
|
||||
if (threshold != 0) {
|
||||
assert(bsize == BLOCK_8X8 || bsize == BLOCK_4X4);
|
||||
for (bi = 0; bi < cdef_count; bi++) {
|
||||
int t = !filter_skip && dlist[bi].skip ? 0 : threshold;
|
||||
by = dlist[bi].by;
|
||||
bx = dlist[bi].bx;
|
||||
(cdef_direction[bsize == BLOCK_8X8])(
|
||||
&y[bi << (bsizex + bsizey)], 1 << bsizex,
|
||||
&in[(by * CDEF_BSTRIDE << bsizey) + (bx << bsizex)],
|
||||
pli ? t : adjust_strength(t, var[by][bx]), dir[by][bx],
|
||||
pri_damping);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (sec_strength) {
|
||||
if (threshold && !skip_dering)
|
||||
copy_block_16bit_to_16bit(in, CDEF_BSTRIDE, y, dlist, cdef_count, bsize);
|
||||
for (bi = 0; bi < cdef_count; bi++) {
|
||||
by = dlist[bi].by;
|
||||
bx = dlist[bi].bx;
|
||||
int py = by << bsizey;
|
||||
int px = bx << bsizex;
|
||||
|
||||
if (!filter_skip && dlist[bi].skip) continue;
|
||||
if (!dst || hbd) {
|
||||
// 16 bit destination if high bitdepth or 8 bit destination not given
|
||||
(!threshold || (dir[by][bx] < 4 && dir[by][bx]) ? aom_clpf_block_hbd
|
||||
: aom_clpf_hblock_hbd)(
|
||||
dst ? (uint16_t *)dst + py * dstride + px
|
||||
: &y[bi << (bsizex + bsizey)],
|
||||
in + py * CDEF_BSTRIDE + px, dst && hbd ? dstride : 1 << bsizex,
|
||||
CDEF_BSTRIDE, 1 << bsizex, 1 << bsizey, sec_strength << coeff_shift,
|
||||
sec_damping);
|
||||
} else {
|
||||
// Do clpf and write the result to an 8 bit destination
|
||||
(!threshold || (dir[by][bx] < 4 && dir[by][bx]) ? aom_clpf_block
|
||||
: aom_clpf_hblock)(
|
||||
dst + py * dstride + px, in + py * CDEF_BSTRIDE + px, dstride,
|
||||
CDEF_BSTRIDE, 1 << bsizex, 1 << bsizey, sec_strength << coeff_shift,
|
||||
sec_damping);
|
||||
}
|
||||
}
|
||||
} else if (threshold != 0) {
|
||||
// No clpf, so copy instead
|
||||
if (hbd) {
|
||||
copy_block_16bit_to_16bit((uint16_t *)dst, dstride, y, dlist, cdef_count,
|
||||
bsize);
|
||||
} else {
|
||||
copy_block_16bit_to_8bit(dst, dstride, y, dlist, cdef_count, bsize);
|
||||
}
|
||||
} else if (dirinit) {
|
||||
// If we're here, both dering and clpf are off, and we still haven't written
|
||||
// anything to y[] yet, so we just copy the input to y[]. This is necessary
|
||||
// only for av1_cdef_search() and only av1_cdef_search() sets dirinit.
|
||||
for (bi = 0; bi < cdef_count; bi++) {
|
||||
by = dlist[bi].by;
|
||||
bx = dlist[bi].bx;
|
||||
#endif
|
||||
int iy, ix;
|
||||
// TODO(stemidts/jmvalin): SIMD optimisations
|
||||
for (iy = 0; iy < 1 << bsizey; iy++)
|
||||
for (ix = 0; ix < 1 << bsizex; ix++)
|
||||
#if CONFIG_CDEF_SINGLEPASS
|
||||
dst16[(bi << (bsizex + bsizey)) + (iy << bsizex) + ix] =
|
||||
#else
|
||||
y[(bi << (bsizex + bsizey)) + (iy << bsizex) + ix] =
|
||||
#endif
|
||||
in[((by << bsizey) + iy) * CDEF_BSTRIDE + (bx << bsizex) + ix];
|
||||
}
|
||||
#if CONFIG_CDEF_SINGLEPASS
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if CONFIG_CDEF_SINGLEPASS
|
||||
if (pli == 0) {
|
||||
if (!dirinit || !*dirinit) {
|
||||
for (bi = 0; bi < cdef_count; bi++) {
|
||||
|
|
@ -557,19 +221,28 @@ void cdef_filter_fb(uint8_t *dst8, uint16_t *dst16, int dstride, uint16_t *in,
|
|||
if (dirinit) *dirinit = 1;
|
||||
}
|
||||
}
|
||||
if (pli == 1 && xdec != ydec) {
|
||||
for (bi = 0; bi < cdef_count; bi++) {
|
||||
static const int conv422[8] = { 7, 0, 2, 4, 5, 6, 6, 6 };
|
||||
static const int conv440[8] = { 1, 2, 2, 2, 3, 4, 6, 0 };
|
||||
by = dlist[bi].by;
|
||||
bx = dlist[bi].bx;
|
||||
dir[by][bx] = (xdec ? conv422 : conv440)[dir[by][bx]];
|
||||
}
|
||||
}
|
||||
|
||||
assert(bsize == BLOCK_8X8 || bsize == BLOCK_4X4);
|
||||
for (bi = 0; bi < cdef_count; bi++) {
|
||||
int t = !filter_skip && dlist[bi].skip ? 0 : pri_strength;
|
||||
int s = !filter_skip && dlist[bi].skip ? 0 : sec_strength;
|
||||
int t = dlist[bi].skip ? 0 : pri_strength;
|
||||
int s = dlist[bi].skip ? 0 : sec_strength;
|
||||
by = dlist[bi].by;
|
||||
bx = dlist[bi].bx;
|
||||
if (dst8)
|
||||
cdef_filter_block(
|
||||
&dst8[(by << bsizey) * dstride + (bx << bsizex)], NULL, dstride,
|
||||
&in[(by * CDEF_BSTRIDE << bsizey) + (bx << bsizex)],
|
||||
(pli ? t : adjust_strength(t, var[by][bx])), s, t ? dir[by][bx] : 0,
|
||||
pri_damping, sec_damping, bsize, (256 << coeff_shift) - 1);
|
||||
cdef_filter_block(&dst8[(by << bsizey) * dstride + (bx << bsizex)], NULL,
|
||||
dstride,
|
||||
&in[(by * CDEF_BSTRIDE << bsizey) + (bx << bsizex)],
|
||||
(pli ? t : adjust_strength(t, var[by][bx])), s,
|
||||
t ? dir[by][bx] : 0, pri_damping, sec_damping, bsize,
|
||||
(256 << coeff_shift) - 1, coeff_shift);
|
||||
else
|
||||
cdef_filter_block(
|
||||
NULL,
|
||||
|
|
@ -578,7 +251,7 @@ void cdef_filter_fb(uint8_t *dst8, uint16_t *dst16, int dstride, uint16_t *in,
|
|||
dirinit ? 1 << bsizex : dstride,
|
||||
&in[(by * CDEF_BSTRIDE << bsizey) + (bx << bsizex)],
|
||||
(pli ? t : adjust_strength(t, var[by][bx])), s, t ? dir[by][bx] : 0,
|
||||
pri_damping, sec_damping, bsize, (256 << coeff_shift) - 1);
|
||||
pri_damping, sec_damping, bsize, (256 << coeff_shift) - 1,
|
||||
coeff_shift);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
49
third_party/aom/av1/common/cdef_block.h
vendored
49
third_party/aom/av1/common/cdef_block.h
vendored
|
|
@ -12,43 +12,28 @@
|
|||
#if !defined(_CDEF_BLOCK_H)
|
||||
#define _CDEF_BLOCK_H (1)
|
||||
|
||||
#include "./odintrin.h"
|
||||
#include "av1/common/odintrin.h"
|
||||
|
||||
#define CDEF_BLOCKSIZE 64
|
||||
#define CDEF_BLOCKSIZE_LOG2 6
|
||||
#define CDEF_NBLOCKS (CDEF_BLOCKSIZE / 8)
|
||||
#if CONFIG_CDEF_SINGLEPASS
|
||||
#define CDEF_NBLOCKS ((1 << MAX_SB_SIZE_LOG2) / 8)
|
||||
#define CDEF_SB_SHIFT (MAX_SB_SIZE_LOG2 - CDEF_BLOCKSIZE_LOG2)
|
||||
#endif
|
||||
|
||||
/* We need to buffer three vertical lines. */
|
||||
#define CDEF_VBORDER (3)
|
||||
/* We only need to buffer three horizontal pixels too, but let's align to
|
||||
16 bytes (8 x 16 bits) to make vectorization easier. */
|
||||
#define CDEF_HBORDER (8)
|
||||
#define CDEF_BSTRIDE ALIGN_POWER_OF_TWO(CDEF_BLOCKSIZE + 2 * CDEF_HBORDER, 3)
|
||||
#define CDEF_BSTRIDE \
|
||||
ALIGN_POWER_OF_TWO((1 << MAX_SB_SIZE_LOG2) + 2 * CDEF_HBORDER, 3)
|
||||
|
||||
#define CDEF_VERY_LARGE (30000)
|
||||
#define CDEF_INBUF_SIZE (CDEF_BSTRIDE * (CDEF_BLOCKSIZE + 2 * CDEF_VBORDER))
|
||||
#define CDEF_INBUF_SIZE \
|
||||
(CDEF_BSTRIDE * ((1 << MAX_SB_SIZE_LOG2) + 2 * CDEF_VBORDER))
|
||||
|
||||
#if CONFIG_CDEF_SINGLEPASS
|
||||
// Filter configuration
|
||||
#define CDEF_CAP 1 // 1 = Cap change to largest diff
|
||||
#define CDEF_FULL 0 // 1 = 7x7 filter, 0 = 5x5 filter
|
||||
|
||||
#if CDEF_FULL
|
||||
extern const int cdef_pri_taps[2][3];
|
||||
extern const int cdef_sec_taps[2][2];
|
||||
extern const int cdef_directions[8][3];
|
||||
#else
|
||||
extern const int cdef_pri_taps[2][2];
|
||||
extern const int cdef_sec_taps[2][2];
|
||||
extern const int cdef_directions[8][2];
|
||||
#endif
|
||||
|
||||
#else // CONFIG_CDEF_SINGLEPASS
|
||||
extern const int cdef_directions[8][3];
|
||||
#endif
|
||||
DECLARE_ALIGNED(16, extern const int, cdef_directions[8][2]);
|
||||
|
||||
typedef struct {
|
||||
uint8_t by;
|
||||
|
|
@ -56,35 +41,19 @@ typedef struct {
|
|||
uint8_t skip;
|
||||
} cdef_list;
|
||||
|
||||
#if CONFIG_CDEF_SINGLEPASS
|
||||
typedef void (*cdef_filter_block_func)(uint8_t *dst8, uint16_t *dst16,
|
||||
int dstride, const uint16_t *in,
|
||||
int pri_strength, int sec_strength,
|
||||
int dir, int pri_damping,
|
||||
int sec_damping, int bsize, int max);
|
||||
int sec_damping, int bsize, int max,
|
||||
int coeff_shift);
|
||||
void copy_cdef_16bit_to_16bit(uint16_t *dst, int dstride, uint16_t *src,
|
||||
cdef_list *dlist, int cdef_count, int bsize);
|
||||
#else
|
||||
typedef void (*cdef_direction_func)(uint16_t *y, int ystride,
|
||||
const uint16_t *in, int threshold, int dir,
|
||||
int damping);
|
||||
|
||||
int get_filter_skip(int level);
|
||||
#endif
|
||||
|
||||
#if CONFIG_CDEF_SINGLEPASS
|
||||
void cdef_filter_fb(uint8_t *dst8, uint16_t *dst16, int dstride, uint16_t *in,
|
||||
int xdec, int ydec, int dir[CDEF_NBLOCKS][CDEF_NBLOCKS],
|
||||
int *dirinit, int var[CDEF_NBLOCKS][CDEF_NBLOCKS], int pli,
|
||||
cdef_list *dlist, int cdef_count, int level,
|
||||
int sec_strength, int pri_damping, int sec_damping,
|
||||
int coeff_shift);
|
||||
#else
|
||||
void cdef_filter_fb(uint8_t *dst, int dstride, uint16_t *y, uint16_t *in,
|
||||
int xdec, int ydec, int dir[CDEF_NBLOCKS][CDEF_NBLOCKS],
|
||||
int *dirinit, int var[CDEF_NBLOCKS][CDEF_NBLOCKS], int pli,
|
||||
cdef_list *dlist, int cdef_count, int level,
|
||||
int sec_strength, int sec_damping, int pri_damping,
|
||||
int coeff_shift, int skip_dering, int hbd);
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
2
third_party/aom/av1/common/cdef_block_avx2.c
vendored
2
third_party/aom/av1/common/cdef_block_avx2.c
vendored
|
|
@ -11,4 +11,4 @@
|
|||
|
||||
#include "aom_dsp/aom_simd.h"
|
||||
#define SIMD_FUNC(name) name##_avx2
|
||||
#include "./cdef_block_simd.h"
|
||||
#include "av1/common/cdef_block_simd.h"
|
||||
|
|
|
|||
2
third_party/aom/av1/common/cdef_block_neon.c
vendored
2
third_party/aom/av1/common/cdef_block_neon.c
vendored
|
|
@ -11,4 +11,4 @@
|
|||
|
||||
#include "aom_dsp/aom_simd.h"
|
||||
#define SIMD_FUNC(name) name##_neon
|
||||
#include "./cdef_block_simd.h"
|
||||
#include "av1/common/cdef_block_simd.h"
|
||||
|
|
|
|||
811
third_party/aom/av1/common/cdef_block_simd.h
vendored
811
third_party/aom/av1/common/cdef_block_simd.h
vendored
File diff suppressed because it is too large
Load diff
2
third_party/aom/av1/common/cdef_block_sse2.c
vendored
2
third_party/aom/av1/common/cdef_block_sse2.c
vendored
|
|
@ -11,4 +11,4 @@
|
|||
|
||||
#include "aom_dsp/aom_simd.h"
|
||||
#define SIMD_FUNC(name) name##_sse2
|
||||
#include "./cdef_block_simd.h"
|
||||
#include "av1/common/cdef_block_simd.h"
|
||||
|
|
|
|||
2
third_party/aom/av1/common/cdef_block_sse4.c
vendored
2
third_party/aom/av1/common/cdef_block_sse4.c
vendored
|
|
@ -11,4 +11,4 @@
|
|||
|
||||
#include "aom_dsp/aom_simd.h"
|
||||
#define SIMD_FUNC(name) name##_sse4_1
|
||||
#include "./cdef_block_simd.h"
|
||||
#include "av1/common/cdef_block_simd.h"
|
||||
|
|
|
|||
|
|
@ -11,4 +11,4 @@
|
|||
|
||||
#include "aom_dsp/aom_simd.h"
|
||||
#define SIMD_FUNC(name) name##_ssse3
|
||||
#include "./cdef_block_simd.h"
|
||||
#include "av1/common/cdef_block_simd.h"
|
||||
|
|
|
|||
658
third_party/aom/av1/common/cfl.c
vendored
658
third_party/aom/av1/common/cfl.c
vendored
|
|
@ -13,20 +13,77 @@
|
|||
#include "av1/common/common_data.h"
|
||||
#include "av1/common/onyxc_int.h"
|
||||
|
||||
#include "config/av1_rtcd.h"
|
||||
|
||||
void cfl_init(CFL_CTX *cfl, AV1_COMMON *cm) {
|
||||
if (!((cm->subsampling_x == 0 && cm->subsampling_y == 0) ||
|
||||
(cm->subsampling_x == 1 && cm->subsampling_y == 1))) {
|
||||
assert(block_size_wide[CFL_MAX_BLOCK_SIZE] == CFL_BUF_LINE);
|
||||
assert(block_size_high[CFL_MAX_BLOCK_SIZE] == CFL_BUF_LINE);
|
||||
if (!(cm->subsampling_x == 0 && cm->subsampling_y == 0) &&
|
||||
!(cm->subsampling_x == 1 && cm->subsampling_y == 1) &&
|
||||
!(cm->subsampling_x == 1 && cm->subsampling_y == 0)) {
|
||||
aom_internal_error(&cm->error, AOM_CODEC_UNSUP_BITSTREAM,
|
||||
"Only 4:4:4 and 4:2:0 are currently supported by CfL");
|
||||
"Only 4:4:4, 4:2:2 and 4:2:0 are currently supported by "
|
||||
"CfL, %d %d subsampling is not supported.\n",
|
||||
cm->subsampling_x, cm->subsampling_y);
|
||||
}
|
||||
memset(&cfl->pred_buf_q3, 0, sizeof(cfl->pred_buf_q3));
|
||||
memset(&cfl->recon_buf_q3, 0, sizeof(cfl->recon_buf_q3));
|
||||
memset(&cfl->ac_buf_q3, 0, sizeof(cfl->ac_buf_q3));
|
||||
cfl->subsampling_x = cm->subsampling_x;
|
||||
cfl->subsampling_y = cm->subsampling_y;
|
||||
cfl->are_parameters_computed = 0;
|
||||
cfl->store_y = 0;
|
||||
#if CONFIG_CHROMA_SUB8X8 && CONFIG_DEBUG
|
||||
cfl_clear_sub8x8_val(cfl);
|
||||
#endif // CONFIG_CHROMA_SUB8X8 && CONFIG_DEBUG
|
||||
// The DC_PRED cache is disabled by default and is only enabled in
|
||||
// cfl_rd_pick_alpha
|
||||
cfl->use_dc_pred_cache = 0;
|
||||
cfl->dc_pred_is_cached[CFL_PRED_U] = 0;
|
||||
cfl->dc_pred_is_cached[CFL_PRED_V] = 0;
|
||||
}
|
||||
|
||||
void cfl_store_dc_pred(MACROBLOCKD *const xd, const uint8_t *input,
|
||||
CFL_PRED_TYPE pred_plane, int width) {
|
||||
assert(pred_plane < CFL_PRED_PLANES);
|
||||
assert(width <= CFL_BUF_LINE);
|
||||
|
||||
if (get_bitdepth_data_path_index(xd)) {
|
||||
uint16_t *const input_16 = CONVERT_TO_SHORTPTR(input);
|
||||
memcpy(xd->cfl.dc_pred_cache[pred_plane], input_16, width << 1);
|
||||
return;
|
||||
}
|
||||
|
||||
memcpy(xd->cfl.dc_pred_cache[pred_plane], input, width);
|
||||
}
|
||||
|
||||
static void cfl_load_dc_pred_lbd(const int16_t *dc_pred_cache, uint8_t *dst,
|
||||
int dst_stride, int width, int height) {
|
||||
for (int j = 0; j < height; j++) {
|
||||
memcpy(dst, dc_pred_cache, width);
|
||||
dst += dst_stride;
|
||||
}
|
||||
}
|
||||
|
||||
static void cfl_load_dc_pred_hbd(const int16_t *dc_pred_cache, uint16_t *dst,
|
||||
int dst_stride, int width, int height) {
|
||||
const size_t num_bytes = width << 1;
|
||||
for (int j = 0; j < height; j++) {
|
||||
memcpy(dst, dc_pred_cache, num_bytes);
|
||||
dst += dst_stride;
|
||||
}
|
||||
}
|
||||
void cfl_load_dc_pred(MACROBLOCKD *const xd, uint8_t *dst, int dst_stride,
|
||||
TX_SIZE tx_size, CFL_PRED_TYPE pred_plane) {
|
||||
const int width = tx_size_wide[tx_size];
|
||||
const int height = tx_size_high[tx_size];
|
||||
assert(pred_plane < CFL_PRED_PLANES);
|
||||
assert(width <= CFL_BUF_LINE);
|
||||
assert(height <= CFL_BUF_LINE);
|
||||
if (get_bitdepth_data_path_index(xd)) {
|
||||
uint16_t *dst_16 = CONVERT_TO_SHORTPTR(dst);
|
||||
cfl_load_dc_pred_hbd(xd->cfl.dc_pred_cache[pred_plane], dst_16, dst_stride,
|
||||
width, height);
|
||||
return;
|
||||
}
|
||||
cfl_load_dc_pred_lbd(xd->cfl.dc_pred_cache[pred_plane], dst, dst_stride,
|
||||
width, height);
|
||||
}
|
||||
|
||||
// Due to frame boundary issues, it is possible that the total area covered by
|
||||
|
|
@ -38,217 +95,54 @@ static INLINE void cfl_pad(CFL_CTX *cfl, int width, int height) {
|
|||
|
||||
if (diff_width > 0) {
|
||||
const int min_height = height - diff_height;
|
||||
int16_t *pred_buf_q3 = cfl->pred_buf_q3 + (width - diff_width);
|
||||
uint16_t *recon_buf_q3 = cfl->recon_buf_q3 + (width - diff_width);
|
||||
for (int j = 0; j < min_height; j++) {
|
||||
const int last_pixel = pred_buf_q3[-1];
|
||||
const uint16_t last_pixel = recon_buf_q3[-1];
|
||||
assert(recon_buf_q3 + diff_width <= cfl->recon_buf_q3 + CFL_BUF_SQUARE);
|
||||
for (int i = 0; i < diff_width; i++) {
|
||||
pred_buf_q3[i] = last_pixel;
|
||||
recon_buf_q3[i] = last_pixel;
|
||||
}
|
||||
pred_buf_q3 += MAX_SB_SIZE;
|
||||
recon_buf_q3 += CFL_BUF_LINE;
|
||||
}
|
||||
cfl->buf_width = width;
|
||||
}
|
||||
if (diff_height > 0) {
|
||||
int16_t *pred_buf_q3 =
|
||||
cfl->pred_buf_q3 + ((height - diff_height) * MAX_SB_SIZE);
|
||||
uint16_t *recon_buf_q3 =
|
||||
cfl->recon_buf_q3 + ((height - diff_height) * CFL_BUF_LINE);
|
||||
for (int j = 0; j < diff_height; j++) {
|
||||
const int16_t *last_row_q3 = pred_buf_q3 - MAX_SB_SIZE;
|
||||
const uint16_t *last_row_q3 = recon_buf_q3 - CFL_BUF_LINE;
|
||||
assert(recon_buf_q3 + width <= cfl->recon_buf_q3 + CFL_BUF_SQUARE);
|
||||
for (int i = 0; i < width; i++) {
|
||||
pred_buf_q3[i] = last_row_q3[i];
|
||||
recon_buf_q3[i] = last_row_q3[i];
|
||||
}
|
||||
pred_buf_q3 += MAX_SB_SIZE;
|
||||
recon_buf_q3 += CFL_BUF_LINE;
|
||||
}
|
||||
cfl->buf_height = height;
|
||||
}
|
||||
}
|
||||
|
||||
static void sum_above_row_lbd(const uint8_t *above_u, const uint8_t *above_v,
|
||||
int width, int *out_sum_u, int *out_sum_v) {
|
||||
int sum_u = 0;
|
||||
int sum_v = 0;
|
||||
for (int i = 0; i < width; i++) {
|
||||
sum_u += above_u[i];
|
||||
sum_v += above_v[i];
|
||||
}
|
||||
*out_sum_u += sum_u;
|
||||
*out_sum_v += sum_v;
|
||||
}
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
static void sum_above_row_hbd(const uint16_t *above_u, const uint16_t *above_v,
|
||||
int width, int *out_sum_u, int *out_sum_v) {
|
||||
int sum_u = 0;
|
||||
int sum_v = 0;
|
||||
for (int i = 0; i < width; i++) {
|
||||
sum_u += above_u[i];
|
||||
sum_v += above_v[i];
|
||||
}
|
||||
*out_sum_u += sum_u;
|
||||
*out_sum_v += sum_v;
|
||||
}
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
|
||||
static void sum_above_row(const MACROBLOCKD *xd, int width, int *out_sum_u,
|
||||
int *out_sum_v) {
|
||||
const struct macroblockd_plane *const pd_u = &xd->plane[AOM_PLANE_U];
|
||||
const struct macroblockd_plane *const pd_v = &xd->plane[AOM_PLANE_V];
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
if (get_bitdepth_data_path_index(xd)) {
|
||||
const uint16_t *above_u_16 =
|
||||
CONVERT_TO_SHORTPTR(pd_u->dst.buf) - pd_u->dst.stride;
|
||||
const uint16_t *above_v_16 =
|
||||
CONVERT_TO_SHORTPTR(pd_v->dst.buf) - pd_v->dst.stride;
|
||||
sum_above_row_hbd(above_u_16, above_v_16, width, out_sum_u, out_sum_v);
|
||||
return;
|
||||
}
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
const uint8_t *above_u = pd_u->dst.buf - pd_u->dst.stride;
|
||||
const uint8_t *above_v = pd_v->dst.buf - pd_v->dst.stride;
|
||||
sum_above_row_lbd(above_u, above_v, width, out_sum_u, out_sum_v);
|
||||
}
|
||||
|
||||
static void sum_left_col_lbd(const uint8_t *left_u, int u_stride,
|
||||
const uint8_t *left_v, int v_stride, int height,
|
||||
int *out_sum_u, int *out_sum_v) {
|
||||
int sum_u = 0;
|
||||
int sum_v = 0;
|
||||
for (int i = 0; i < height; i++) {
|
||||
sum_u += left_u[i * u_stride];
|
||||
sum_v += left_v[i * v_stride];
|
||||
}
|
||||
*out_sum_u += sum_u;
|
||||
*out_sum_v += sum_v;
|
||||
}
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
static void sum_left_col_hbd(const uint16_t *left_u, int u_stride,
|
||||
const uint16_t *left_v, int v_stride, int height,
|
||||
int *out_sum_u, int *out_sum_v) {
|
||||
int sum_u = 0;
|
||||
int sum_v = 0;
|
||||
for (int i = 0; i < height; i++) {
|
||||
sum_u += left_u[i * u_stride];
|
||||
sum_v += left_v[i * v_stride];
|
||||
}
|
||||
*out_sum_u += sum_u;
|
||||
*out_sum_v += sum_v;
|
||||
}
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
static void sum_left_col(const MACROBLOCKD *xd, int height, int *out_sum_u,
|
||||
int *out_sum_v) {
|
||||
const struct macroblockd_plane *const pd_u = &xd->plane[AOM_PLANE_U];
|
||||
const struct macroblockd_plane *const pd_v = &xd->plane[AOM_PLANE_V];
|
||||
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
if (get_bitdepth_data_path_index(xd)) {
|
||||
const uint16_t *left_u_16 = CONVERT_TO_SHORTPTR(pd_u->dst.buf) - 1;
|
||||
const uint16_t *left_v_16 = CONVERT_TO_SHORTPTR(pd_v->dst.buf) - 1;
|
||||
sum_left_col_hbd(left_u_16, pd_u->dst.stride, left_v_16, pd_v->dst.stride,
|
||||
height, out_sum_u, out_sum_v);
|
||||
return;
|
||||
}
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
const uint8_t *left_u = pd_u->dst.buf - 1;
|
||||
const uint8_t *left_v = pd_v->dst.buf - 1;
|
||||
sum_left_col_lbd(left_u, pd_u->dst.stride, left_v, pd_v->dst.stride, height,
|
||||
out_sum_u, out_sum_v);
|
||||
}
|
||||
|
||||
// CfL computes its own block-level DC_PRED. This is required to compute both
|
||||
// alpha_cb and alpha_cr before the prediction are computed.
|
||||
static void cfl_dc_pred(MACROBLOCKD *xd, BLOCK_SIZE plane_bsize) {
|
||||
CFL_CTX *const cfl = xd->cfl;
|
||||
|
||||
// Compute DC_PRED until block boundary. We can't assume the neighbor will use
|
||||
// the same transform size.
|
||||
const int width = max_block_wide(xd, plane_bsize, AOM_PLANE_U)
|
||||
<< tx_size_wide_log2[0];
|
||||
const int height = max_block_high(xd, plane_bsize, AOM_PLANE_U)
|
||||
<< tx_size_high_log2[0];
|
||||
// Number of pixel on the top and left borders.
|
||||
const int num_pel = width + height;
|
||||
|
||||
int sum_u = 0;
|
||||
int sum_v = 0;
|
||||
|
||||
// Match behavior of build_intra_predictors_high (reconintra.c) at superblock
|
||||
// boundaries:
|
||||
// base-1 base-1 base-1 .. base-1 base-1 base-1 base-1 base-1 base-1
|
||||
// base+1 A B .. Y Z
|
||||
// base+1 C D .. W X
|
||||
// base+1 E F .. U V
|
||||
// base+1 G H .. S T T T T T
|
||||
// ..
|
||||
|
||||
#if CONFIG_CHROMA_SUB8X8
|
||||
if (xd->chroma_up_available && xd->mb_to_right_edge >= 0) {
|
||||
#else
|
||||
if (xd->up_available && xd->mb_to_right_edge >= 0) {
|
||||
#endif
|
||||
sum_above_row(xd, width, &sum_u, &sum_v);
|
||||
} else {
|
||||
const int base = 128 << (xd->bd - 8);
|
||||
sum_u = width * (base - 1);
|
||||
sum_v = width * (base - 1);
|
||||
}
|
||||
|
||||
#if CONFIG_CHROMA_SUB8X8
|
||||
if (xd->chroma_left_available && xd->mb_to_bottom_edge >= 0) {
|
||||
#else
|
||||
if (xd->left_available && xd->mb_to_bottom_edge >= 0) {
|
||||
#endif
|
||||
sum_left_col(xd, height, &sum_u, &sum_v);
|
||||
} else {
|
||||
const int base = 128 << (xd->bd - 8);
|
||||
sum_u += height * (base + 1);
|
||||
sum_v += height * (base + 1);
|
||||
}
|
||||
|
||||
// TODO(ltrudeau) Because of max_block_wide and max_block_high, num_pel will
|
||||
// not be a power of two. So these divisions will have to use a lookup table.
|
||||
cfl->dc_pred[CFL_PRED_U] = (sum_u + (num_pel >> 1)) / num_pel;
|
||||
cfl->dc_pred[CFL_PRED_V] = (sum_v + (num_pel >> 1)) / num_pel;
|
||||
}
|
||||
|
||||
static void cfl_subtract_averages(CFL_CTX *cfl, TX_SIZE tx_size) {
|
||||
const int width = cfl->uv_width;
|
||||
const int height = cfl->uv_height;
|
||||
const int tx_height = tx_size_high[tx_size];
|
||||
const int tx_width = tx_size_wide[tx_size];
|
||||
const int block_row_stride = MAX_SB_SIZE << tx_size_high_log2[tx_size];
|
||||
const int num_pel_log2 =
|
||||
(tx_size_high_log2[tx_size] + tx_size_wide_log2[tx_size]);
|
||||
|
||||
int16_t *pred_buf_q3 = cfl->pred_buf_q3;
|
||||
|
||||
cfl_pad(cfl, width, height);
|
||||
|
||||
for (int b_j = 0; b_j < height; b_j += tx_height) {
|
||||
for (int b_i = 0; b_i < width; b_i += tx_width) {
|
||||
int sum_q3 = 0;
|
||||
int16_t *tx_pred_buf_q3 = pred_buf_q3;
|
||||
for (int t_j = 0; t_j < tx_height; t_j++) {
|
||||
for (int t_i = b_i; t_i < b_i + tx_width; t_i++) {
|
||||
sum_q3 += tx_pred_buf_q3[t_i];
|
||||
}
|
||||
tx_pred_buf_q3 += MAX_SB_SIZE;
|
||||
}
|
||||
int avg_q3 = (sum_q3 + (1 << (num_pel_log2 - 1))) >> num_pel_log2;
|
||||
// Loss is never more than 1/2 (in Q3)
|
||||
assert(fabs((double)avg_q3 - (sum_q3 / ((double)(1 << num_pel_log2)))) <=
|
||||
0.5);
|
||||
|
||||
tx_pred_buf_q3 = pred_buf_q3;
|
||||
for (int t_j = 0; t_j < tx_height; t_j++) {
|
||||
for (int t_i = b_i; t_i < b_i + tx_width; t_i++) {
|
||||
tx_pred_buf_q3[t_i] -= avg_q3;
|
||||
}
|
||||
|
||||
tx_pred_buf_q3 += MAX_SB_SIZE;
|
||||
}
|
||||
static void subtract_average_c(const uint16_t *src, int16_t *dst, int width,
|
||||
int height, int round_offset, int num_pel_log2) {
|
||||
int sum = round_offset;
|
||||
const uint16_t *recon = src;
|
||||
for (int j = 0; j < height; j++) {
|
||||
for (int i = 0; i < width; i++) {
|
||||
sum += recon[i];
|
||||
}
|
||||
pred_buf_q3 += block_row_stride;
|
||||
recon += CFL_BUF_LINE;
|
||||
}
|
||||
const int avg = sum >> num_pel_log2;
|
||||
for (int j = 0; j < height; j++) {
|
||||
for (int i = 0; i < width; i++) {
|
||||
dst[i] = src[i] - avg;
|
||||
}
|
||||
src += CFL_BUF_LINE;
|
||||
dst += CFL_BUF_LINE;
|
||||
}
|
||||
}
|
||||
|
||||
CFL_SUB_AVG_FN(c)
|
||||
|
||||
static INLINE int cfl_idx_to_alpha(int alpha_idx, int joint_sign,
|
||||
CFL_PRED_TYPE pred_type) {
|
||||
const int alpha_sign = (pred_type == CFL_PRED_U) ? CFL_SIGN_U(joint_sign)
|
||||
|
|
@ -259,159 +153,218 @@ static INLINE int cfl_idx_to_alpha(int alpha_idx, int joint_sign,
|
|||
return (alpha_sign == CFL_SIGN_POS) ? abs_alpha_q3 + 1 : -abs_alpha_q3 - 1;
|
||||
}
|
||||
|
||||
static void cfl_build_prediction_lbd(const int16_t *pred_buf_q3, uint8_t *dst,
|
||||
int dst_stride, int width, int height,
|
||||
int alpha_q3, int dc_pred) {
|
||||
static INLINE void cfl_predict_lbd_c(const int16_t *ac_buf_q3, uint8_t *dst,
|
||||
int dst_stride, int alpha_q3, int width,
|
||||
int height) {
|
||||
for (int j = 0; j < height; j++) {
|
||||
for (int i = 0; i < width; i++) {
|
||||
dst[i] =
|
||||
clip_pixel(get_scaled_luma_q0(alpha_q3, pred_buf_q3[i]) + dc_pred);
|
||||
dst[i] = clip_pixel(get_scaled_luma_q0(alpha_q3, ac_buf_q3[i]) + dst[i]);
|
||||
}
|
||||
dst += dst_stride;
|
||||
pred_buf_q3 += MAX_SB_SIZE;
|
||||
ac_buf_q3 += CFL_BUF_LINE;
|
||||
}
|
||||
}
|
||||
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
static void cfl_build_prediction_hbd(const int16_t *pred_buf_q3, uint16_t *dst,
|
||||
int dst_stride, int width, int height,
|
||||
int alpha_q3, int dc_pred, int bit_depth) {
|
||||
// Null function used for invalid tx_sizes
|
||||
void cfl_predict_lbd_null(const int16_t *ac_buf_q3, uint8_t *dst,
|
||||
int dst_stride, int alpha_q3) {
|
||||
(void)ac_buf_q3;
|
||||
(void)dst;
|
||||
(void)dst_stride;
|
||||
(void)alpha_q3;
|
||||
assert(0);
|
||||
}
|
||||
|
||||
CFL_PREDICT_FN(c, lbd)
|
||||
|
||||
void cfl_predict_hbd_c(const int16_t *ac_buf_q3, uint16_t *dst, int dst_stride,
|
||||
int alpha_q3, int bit_depth, int width, int height) {
|
||||
for (int j = 0; j < height; j++) {
|
||||
for (int i = 0; i < width; i++) {
|
||||
dst[i] = clip_pixel_highbd(
|
||||
get_scaled_luma_q0(alpha_q3, pred_buf_q3[i]) + dc_pred, bit_depth);
|
||||
get_scaled_luma_q0(alpha_q3, ac_buf_q3[i]) + dst[i], bit_depth);
|
||||
}
|
||||
dst += dst_stride;
|
||||
pred_buf_q3 += MAX_SB_SIZE;
|
||||
ac_buf_q3 += CFL_BUF_LINE;
|
||||
}
|
||||
}
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
|
||||
static void cfl_build_prediction(const int16_t *pred_buf_q3, uint8_t *dst,
|
||||
int dst_stride, int width, int height,
|
||||
int alpha_q3, int dc_pred, int use_hbd,
|
||||
int bit_depth) {
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
if (use_hbd) {
|
||||
uint16_t *dst_16 = CONVERT_TO_SHORTPTR(dst);
|
||||
cfl_build_prediction_hbd(pred_buf_q3, dst_16, dst_stride, width, height,
|
||||
alpha_q3, dc_pred, bit_depth);
|
||||
return;
|
||||
}
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
(void)use_hbd;
|
||||
(void)bit_depth;
|
||||
cfl_build_prediction_lbd(pred_buf_q3, dst, dst_stride, width, height,
|
||||
alpha_q3, dc_pred);
|
||||
// Null function used for invalid tx_sizes
|
||||
void cfl_predict_hbd_null(const int16_t *ac_buf_q3, uint16_t *dst,
|
||||
int dst_stride, int alpha_q3, int bd) {
|
||||
(void)ac_buf_q3;
|
||||
(void)dst;
|
||||
(void)dst_stride;
|
||||
(void)alpha_q3;
|
||||
(void)bd;
|
||||
assert(0);
|
||||
}
|
||||
|
||||
CFL_PREDICT_FN(c, hbd)
|
||||
|
||||
static void cfl_compute_parameters(MACROBLOCKD *const xd, TX_SIZE tx_size) {
|
||||
CFL_CTX *const cfl = &xd->cfl;
|
||||
// Do not call cfl_compute_parameters multiple time on the same values.
|
||||
assert(cfl->are_parameters_computed == 0);
|
||||
|
||||
cfl_pad(cfl, tx_size_wide[tx_size], tx_size_high[tx_size]);
|
||||
get_subtract_average_fn(tx_size)(cfl->recon_buf_q3, cfl->ac_buf_q3);
|
||||
cfl->are_parameters_computed = 1;
|
||||
}
|
||||
|
||||
void cfl_predict_block(MACROBLOCKD *const xd, uint8_t *dst, int dst_stride,
|
||||
int row, int col, TX_SIZE tx_size, int plane) {
|
||||
CFL_CTX *const cfl = xd->cfl;
|
||||
MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
|
||||
TX_SIZE tx_size, int plane) {
|
||||
CFL_CTX *const cfl = &xd->cfl;
|
||||
MB_MODE_INFO *mbmi = xd->mi[0];
|
||||
assert(is_cfl_allowed(xd));
|
||||
|
||||
// CfL parameters must be computed before prediction can be done.
|
||||
assert(cfl->are_parameters_computed == 1);
|
||||
if (!cfl->are_parameters_computed) cfl_compute_parameters(xd, tx_size);
|
||||
|
||||
const int16_t *pred_buf_q3 =
|
||||
cfl->pred_buf_q3 + ((row * MAX_SB_SIZE + col) << tx_size_wide_log2[0]);
|
||||
const int alpha_q3 =
|
||||
cfl_idx_to_alpha(mbmi->cfl_alpha_idx, mbmi->cfl_alpha_signs, plane - 1);
|
||||
|
||||
cfl_build_prediction(pred_buf_q3, dst, dst_stride, tx_size_wide[tx_size],
|
||||
tx_size_high[tx_size], alpha_q3, cfl->dc_pred[plane - 1],
|
||||
get_bitdepth_data_path_index(xd), xd->bd);
|
||||
assert((tx_size_high[tx_size] - 1) * CFL_BUF_LINE + tx_size_wide[tx_size] <=
|
||||
CFL_BUF_SQUARE);
|
||||
if (get_bitdepth_data_path_index(xd)) {
|
||||
uint16_t *dst_16 = CONVERT_TO_SHORTPTR(dst);
|
||||
get_predict_hbd_fn(tx_size)(cfl->ac_buf_q3, dst_16, dst_stride, alpha_q3,
|
||||
xd->bd);
|
||||
return;
|
||||
}
|
||||
get_predict_lbd_fn(tx_size)(cfl->ac_buf_q3, dst, dst_stride, alpha_q3);
|
||||
}
|
||||
|
||||
static void cfl_luma_subsampling_420_lbd(const uint8_t *input, int input_stride,
|
||||
int16_t *output_q3, int width,
|
||||
int height) {
|
||||
for (int j = 0; j < height; j++) {
|
||||
for (int i = 0; i < width; i++) {
|
||||
int top = i << 1;
|
||||
int bot = top + input_stride;
|
||||
output_q3[i] = (input[top] + input[top + 1] + input[bot] + input[bot + 1])
|
||||
<< 1;
|
||||
// Null function used for invalid tx_sizes
|
||||
void cfl_subsample_lbd_null(const uint8_t *input, int input_stride,
|
||||
uint16_t *output_q3) {
|
||||
(void)input;
|
||||
(void)input_stride;
|
||||
(void)output_q3;
|
||||
assert(0);
|
||||
}
|
||||
|
||||
// Null function used for invalid tx_sizes
|
||||
void cfl_subsample_hbd_null(const uint16_t *input, int input_stride,
|
||||
uint16_t *output_q3) {
|
||||
(void)input;
|
||||
(void)input_stride;
|
||||
(void)output_q3;
|
||||
assert(0);
|
||||
}
|
||||
|
||||
static void cfl_luma_subsampling_420_lbd_c(const uint8_t *input,
|
||||
int input_stride,
|
||||
uint16_t *output_q3, int width,
|
||||
int height) {
|
||||
for (int j = 0; j < height; j += 2) {
|
||||
for (int i = 0; i < width; i += 2) {
|
||||
const int bot = i + input_stride;
|
||||
output_q3[i >> 1] =
|
||||
(input[i] + input[i + 1] + input[bot] + input[bot + 1]) << 1;
|
||||
}
|
||||
input += input_stride << 1;
|
||||
output_q3 += MAX_SB_SIZE;
|
||||
output_q3 += CFL_BUF_LINE;
|
||||
}
|
||||
}
|
||||
|
||||
static void cfl_luma_subsampling_444_lbd(const uint8_t *input, int input_stride,
|
||||
int16_t *output_q3, int width,
|
||||
int height) {
|
||||
static void cfl_luma_subsampling_422_lbd_c(const uint8_t *input,
|
||||
int input_stride,
|
||||
uint16_t *output_q3, int width,
|
||||
int height) {
|
||||
assert((height - 1) * CFL_BUF_LINE + width <= CFL_BUF_SQUARE);
|
||||
for (int j = 0; j < height; j++) {
|
||||
for (int i = 0; i < width; i += 2) {
|
||||
output_q3[i >> 1] = (input[i] + input[i + 1]) << 2;
|
||||
}
|
||||
input += input_stride;
|
||||
output_q3 += CFL_BUF_LINE;
|
||||
}
|
||||
}
|
||||
|
||||
static void cfl_luma_subsampling_444_lbd_c(const uint8_t *input,
|
||||
int input_stride,
|
||||
uint16_t *output_q3, int width,
|
||||
int height) {
|
||||
assert((height - 1) * CFL_BUF_LINE + width <= CFL_BUF_SQUARE);
|
||||
for (int j = 0; j < height; j++) {
|
||||
for (int i = 0; i < width; i++) {
|
||||
output_q3[i] = input[i] << 3;
|
||||
}
|
||||
input += input_stride;
|
||||
output_q3 += MAX_SB_SIZE;
|
||||
output_q3 += CFL_BUF_LINE;
|
||||
}
|
||||
}
|
||||
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
static void cfl_luma_subsampling_420_hbd(const uint16_t *input,
|
||||
int input_stride, int16_t *output_q3,
|
||||
int width, int height) {
|
||||
for (int j = 0; j < height; j++) {
|
||||
for (int i = 0; i < width; i++) {
|
||||
int top = i << 1;
|
||||
int bot = top + input_stride;
|
||||
output_q3[i] = (input[top] + input[top + 1] + input[bot] + input[bot + 1])
|
||||
<< 1;
|
||||
static void cfl_luma_subsampling_420_hbd_c(const uint16_t *input,
|
||||
int input_stride,
|
||||
uint16_t *output_q3, int width,
|
||||
int height) {
|
||||
for (int j = 0; j < height; j += 2) {
|
||||
for (int i = 0; i < width; i += 2) {
|
||||
const int bot = i + input_stride;
|
||||
output_q3[i >> 1] =
|
||||
(input[i] + input[i + 1] + input[bot] + input[bot + 1]) << 1;
|
||||
}
|
||||
input += input_stride << 1;
|
||||
output_q3 += MAX_SB_SIZE;
|
||||
output_q3 += CFL_BUF_LINE;
|
||||
}
|
||||
}
|
||||
|
||||
static void cfl_luma_subsampling_444_hbd(const uint16_t *input,
|
||||
int input_stride, int16_t *output_q3,
|
||||
int width, int height) {
|
||||
static void cfl_luma_subsampling_422_hbd_c(const uint16_t *input,
|
||||
int input_stride,
|
||||
uint16_t *output_q3, int width,
|
||||
int height) {
|
||||
assert((height - 1) * CFL_BUF_LINE + width <= CFL_BUF_SQUARE);
|
||||
for (int j = 0; j < height; j++) {
|
||||
for (int i = 0; i < width; i += 2) {
|
||||
output_q3[i >> 1] = (input[i] + input[i + 1]) << 2;
|
||||
}
|
||||
input += input_stride;
|
||||
output_q3 += CFL_BUF_LINE;
|
||||
}
|
||||
}
|
||||
|
||||
static void cfl_luma_subsampling_444_hbd_c(const uint16_t *input,
|
||||
int input_stride,
|
||||
uint16_t *output_q3, int width,
|
||||
int height) {
|
||||
assert((height - 1) * CFL_BUF_LINE + width <= CFL_BUF_SQUARE);
|
||||
for (int j = 0; j < height; j++) {
|
||||
for (int i = 0; i < width; i++) {
|
||||
output_q3[i] = input[i] << 3;
|
||||
}
|
||||
input += input_stride;
|
||||
output_q3 += MAX_SB_SIZE;
|
||||
output_q3 += CFL_BUF_LINE;
|
||||
}
|
||||
}
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
|
||||
static void cfl_luma_subsampling_420(const uint8_t *input, int input_stride,
|
||||
int16_t *output_q3, int width, int height,
|
||||
int use_hbd) {
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
if (use_hbd) {
|
||||
const uint16_t *input_16 = CONVERT_TO_SHORTPTR(input);
|
||||
cfl_luma_subsampling_420_hbd(input_16, input_stride, output_q3, width,
|
||||
height);
|
||||
return;
|
||||
CFL_GET_SUBSAMPLE_FUNCTION(c)
|
||||
|
||||
static INLINE cfl_subsample_hbd_fn cfl_subsampling_hbd(TX_SIZE tx_size,
|
||||
int sub_x, int sub_y) {
|
||||
if (sub_x == 1) {
|
||||
if (sub_y == 1) {
|
||||
return cfl_get_luma_subsampling_420_hbd(tx_size);
|
||||
}
|
||||
return cfl_get_luma_subsampling_422_hbd(tx_size);
|
||||
}
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
(void)use_hbd;
|
||||
cfl_luma_subsampling_420_lbd(input, input_stride, output_q3, width, height);
|
||||
return cfl_get_luma_subsampling_444_hbd(tx_size);
|
||||
}
|
||||
|
||||
static void cfl_luma_subsampling_444(const uint8_t *input, int input_stride,
|
||||
int16_t *output_q3, int width, int height,
|
||||
int use_hbd) {
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
if (use_hbd) {
|
||||
uint16_t *input_16 = CONVERT_TO_SHORTPTR(input);
|
||||
cfl_luma_subsampling_444_hbd(input_16, input_stride, output_q3, width,
|
||||
height);
|
||||
return;
|
||||
static INLINE cfl_subsample_lbd_fn cfl_subsampling_lbd(TX_SIZE tx_size,
|
||||
int sub_x, int sub_y) {
|
||||
if (sub_x == 1) {
|
||||
if (sub_y == 1) {
|
||||
return cfl_get_luma_subsampling_420_lbd(tx_size);
|
||||
}
|
||||
return cfl_get_luma_subsampling_422_lbd(tx_size);
|
||||
}
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
(void)use_hbd;
|
||||
cfl_luma_subsampling_444_lbd(input, input_stride, output_q3, width, height);
|
||||
return cfl_get_luma_subsampling_444_lbd(tx_size);
|
||||
}
|
||||
|
||||
static INLINE void cfl_store(CFL_CTX *cfl, const uint8_t *input,
|
||||
int input_stride, int row, int col, int width,
|
||||
int height, int use_hbd) {
|
||||
static void cfl_store(CFL_CTX *cfl, const uint8_t *input, int input_stride,
|
||||
int row, int col, TX_SIZE tx_size, int use_hbd) {
|
||||
const int width = tx_size_wide[tx_size];
|
||||
const int height = tx_size_high[tx_size];
|
||||
const int tx_off_log2 = tx_size_wide_log2[0];
|
||||
const int sub_x = cfl->subsampling_x;
|
||||
const int sub_y = cfl->subsampling_y;
|
||||
|
|
@ -435,26 +388,22 @@ static INLINE void cfl_store(CFL_CTX *cfl, const uint8_t *input,
|
|||
}
|
||||
|
||||
// Check that we will remain inside the pixel buffer.
|
||||
assert(store_row + store_height <= MAX_SB_SIZE);
|
||||
assert(store_col + store_width <= MAX_SB_SIZE);
|
||||
assert(store_row + store_height <= CFL_BUF_LINE);
|
||||
assert(store_col + store_width <= CFL_BUF_LINE);
|
||||
|
||||
// Store the input into the CfL pixel buffer
|
||||
int16_t *pred_buf_q3 =
|
||||
cfl->pred_buf_q3 + (store_row * MAX_SB_SIZE + store_col);
|
||||
uint16_t *recon_buf_q3 =
|
||||
cfl->recon_buf_q3 + (store_row * CFL_BUF_LINE + store_col);
|
||||
|
||||
if (sub_y == 0 && sub_x == 0) {
|
||||
cfl_luma_subsampling_444(input, input_stride, pred_buf_q3, store_width,
|
||||
store_height, use_hbd);
|
||||
} else if (sub_y == 1 && sub_x == 1) {
|
||||
cfl_luma_subsampling_420(input, input_stride, pred_buf_q3, store_width,
|
||||
store_height, use_hbd);
|
||||
if (use_hbd) {
|
||||
cfl_subsampling_hbd(tx_size, sub_x, sub_y)(CONVERT_TO_SHORTPTR(input),
|
||||
input_stride, recon_buf_q3);
|
||||
} else {
|
||||
// TODO(ltrudeau) add support for 4:2:2
|
||||
assert(0); // Unsupported chroma subsampling
|
||||
cfl_subsampling_lbd(tx_size, sub_x, sub_y)(input, input_stride,
|
||||
recon_buf_q3);
|
||||
}
|
||||
}
|
||||
|
||||
#if CONFIG_CHROMA_SUB8X8
|
||||
// Adjust the row and column of blocks smaller than 8X8, as chroma-referenced
|
||||
// and non-chroma-referenced blocks are stored together in the CfL buffer.
|
||||
static INLINE void sub8x8_adjust_offset(const CFL_CTX *cfl, int *row_out,
|
||||
|
|
@ -471,99 +420,36 @@ static INLINE void sub8x8_adjust_offset(const CFL_CTX *cfl, int *row_out,
|
|||
(*col_out)++;
|
||||
}
|
||||
}
|
||||
#if CONFIG_DEBUG
|
||||
static INLINE void sub8x8_set_val(CFL_CTX *cfl, int row, int col, int val_high,
|
||||
int val_wide) {
|
||||
for (int val_r = 0; val_r < val_high; val_r++) {
|
||||
assert(row + val_r < CFL_SUB8X8_VAL_MI_SIZE);
|
||||
int row_off = (row + val_r) * CFL_SUB8X8_VAL_MI_SIZE;
|
||||
for (int val_c = 0; val_c < val_wide; val_c++) {
|
||||
assert(col + val_c < CFL_SUB8X8_VAL_MI_SIZE);
|
||||
assert(cfl->sub8x8_val[row_off + col + val_c] == 0);
|
||||
cfl->sub8x8_val[row_off + col + val_c]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // CONFIG_DEBUG
|
||||
#endif // CONFIG_CHROMA_SUB8X8
|
||||
|
||||
void cfl_store_tx(MACROBLOCKD *const xd, int row, int col, TX_SIZE tx_size,
|
||||
BLOCK_SIZE bsize) {
|
||||
CFL_CTX *const cfl = xd->cfl;
|
||||
CFL_CTX *const cfl = &xd->cfl;
|
||||
struct macroblockd_plane *const pd = &xd->plane[AOM_PLANE_Y];
|
||||
uint8_t *dst =
|
||||
&pd->dst.buf[(row * pd->dst.stride + col) << tx_size_wide_log2[0]];
|
||||
(void)bsize;
|
||||
#if CONFIG_CHROMA_SUB8X8
|
||||
|
||||
if (block_size_high[bsize] == 4 || block_size_wide[bsize] == 4) {
|
||||
// Only dimensions of size 4 can have an odd offset.
|
||||
assert(!((col & 1) && tx_size_wide[tx_size] != 4));
|
||||
assert(!((row & 1) && tx_size_high[tx_size] != 4));
|
||||
sub8x8_adjust_offset(cfl, &row, &col);
|
||||
#if CONFIG_DEBUG
|
||||
sub8x8_set_val(cfl, row, col, tx_size_high_unit[tx_size],
|
||||
tx_size_wide_unit[tx_size]);
|
||||
#endif // CONFIG_DEBUG
|
||||
}
|
||||
#endif
|
||||
cfl_store(cfl, dst, pd->dst.stride, row, col, tx_size_wide[tx_size],
|
||||
tx_size_high[tx_size], get_bitdepth_data_path_index(xd));
|
||||
}
|
||||
|
||||
void cfl_store_block(MACROBLOCKD *const xd, BLOCK_SIZE bsize, TX_SIZE tx_size) {
|
||||
CFL_CTX *const cfl = xd->cfl;
|
||||
struct macroblockd_plane *const pd = &xd->plane[AOM_PLANE_Y];
|
||||
int row = 0;
|
||||
int col = 0;
|
||||
#if CONFIG_CHROMA_SUB8X8
|
||||
bsize = AOMMAX(BLOCK_4X4, bsize);
|
||||
if (block_size_high[bsize] == 4 || block_size_wide[bsize] == 4) {
|
||||
sub8x8_adjust_offset(cfl, &row, &col);
|
||||
#if CONFIG_DEBUG
|
||||
sub8x8_set_val(cfl, row, col, mi_size_high[bsize], mi_size_wide[bsize]);
|
||||
#endif // CONFIG_DEBUG
|
||||
}
|
||||
#endif // CONFIG_CHROMA_SUB8X8
|
||||
const int width = max_intra_block_width(xd, bsize, AOM_PLANE_Y, tx_size);
|
||||
const int height = max_intra_block_height(xd, bsize, AOM_PLANE_Y, tx_size);
|
||||
cfl_store(cfl, pd->dst.buf, pd->dst.stride, row, col, width, height,
|
||||
cfl_store(cfl, dst, pd->dst.stride, row, col, tx_size,
|
||||
get_bitdepth_data_path_index(xd));
|
||||
}
|
||||
|
||||
void cfl_compute_parameters(MACROBLOCKD *const xd, TX_SIZE tx_size) {
|
||||
CFL_CTX *const cfl = xd->cfl;
|
||||
MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
|
||||
void cfl_store_block(MACROBLOCKD *const xd, BLOCK_SIZE bsize, TX_SIZE tx_size) {
|
||||
CFL_CTX *const cfl = &xd->cfl;
|
||||
struct macroblockd_plane *const pd = &xd->plane[AOM_PLANE_Y];
|
||||
int row = 0;
|
||||
int col = 0;
|
||||
|
||||
// Do not call cfl_compute_parameters multiple time on the same values.
|
||||
assert(cfl->are_parameters_computed == 0);
|
||||
|
||||
#if CONFIG_CHROMA_SUB8X8
|
||||
const BLOCK_SIZE plane_bsize = AOMMAX(
|
||||
BLOCK_4X4, get_plane_block_size(mbmi->sb_type, &xd->plane[AOM_PLANE_U]));
|
||||
#if CONFIG_DEBUG
|
||||
if (mbmi->sb_type < BLOCK_8X8) {
|
||||
for (int val_r = 0; val_r < mi_size_high[mbmi->sb_type]; val_r++) {
|
||||
for (int val_c = 0; val_c < mi_size_wide[mbmi->sb_type]; val_c++) {
|
||||
assert(cfl->sub8x8_val[val_r * CFL_SUB8X8_VAL_MI_SIZE + val_c] == 1);
|
||||
}
|
||||
}
|
||||
cfl_clear_sub8x8_val(cfl);
|
||||
if (block_size_high[bsize] == 4 || block_size_wide[bsize] == 4) {
|
||||
sub8x8_adjust_offset(cfl, &row, &col);
|
||||
}
|
||||
#endif // CONFIG_DEBUG
|
||||
#else
|
||||
const BLOCK_SIZE plane_bsize =
|
||||
get_plane_block_size(mbmi->sb_type, &xd->plane[AOM_PLANE_U]);
|
||||
#endif
|
||||
// AOM_PLANE_U is used, but both planes will have the same sizes.
|
||||
cfl->uv_width = max_intra_block_width(xd, plane_bsize, AOM_PLANE_U, tx_size);
|
||||
cfl->uv_height =
|
||||
max_intra_block_height(xd, plane_bsize, AOM_PLANE_U, tx_size);
|
||||
|
||||
assert(cfl->buf_width <= cfl->uv_width);
|
||||
assert(cfl->buf_height <= cfl->uv_height);
|
||||
|
||||
cfl_dc_pred(xd, plane_bsize);
|
||||
cfl_subtract_averages(cfl, tx_size);
|
||||
cfl->are_parameters_computed = 1;
|
||||
const int width = max_intra_block_width(xd, bsize, AOM_PLANE_Y, tx_size);
|
||||
const int height = max_intra_block_height(xd, bsize, AOM_PLANE_Y, tx_size);
|
||||
tx_size = get_tx_size(width, height);
|
||||
cfl_store(cfl, pd->dst.buf, pd->dst.stride, row, col, tx_size,
|
||||
get_bitdepth_data_path_index(xd));
|
||||
}
|
||||
|
|
|
|||
274
third_party/aom/av1/common/cfl.h
vendored
274
third_party/aom/av1/common/cfl.h
vendored
|
|
@ -13,20 +13,290 @@
|
|||
#define AV1_COMMON_CFL_H_
|
||||
|
||||
#include "av1/common/blockd.h"
|
||||
#include "av1/common/onyxc_int.h"
|
||||
|
||||
// Can we use CfL for the current block?
|
||||
static INLINE CFL_ALLOWED_TYPE is_cfl_allowed(const MACROBLOCKD *xd) {
|
||||
const MB_MODE_INFO *mbmi = xd->mi[0];
|
||||
const BLOCK_SIZE bsize = mbmi->sb_type;
|
||||
assert(bsize < BLOCK_SIZES_ALL);
|
||||
if (xd->lossless[mbmi->segment_id]) {
|
||||
// In lossless, CfL is available when the partition size is equal to the
|
||||
// transform size.
|
||||
const int ssx = xd->plane[AOM_PLANE_U].subsampling_x;
|
||||
const int ssy = xd->plane[AOM_PLANE_U].subsampling_y;
|
||||
const int plane_bsize = get_plane_block_size(bsize, ssx, ssy);
|
||||
return (CFL_ALLOWED_TYPE)(plane_bsize == BLOCK_4X4);
|
||||
}
|
||||
// Spec: CfL is available to luma partitions lesser than or equal to 32x32
|
||||
return (CFL_ALLOWED_TYPE)(block_size_wide[bsize] <= 32 &&
|
||||
block_size_high[bsize] <= 32);
|
||||
}
|
||||
|
||||
// Do we need to save the luma pixels from the current block,
|
||||
// for a possible future CfL prediction?
|
||||
static INLINE CFL_ALLOWED_TYPE store_cfl_required(const AV1_COMMON *cm,
|
||||
const MACROBLOCKD *xd) {
|
||||
const MB_MODE_INFO *mbmi = xd->mi[0];
|
||||
|
||||
if (cm->seq_params.monochrome) return CFL_DISALLOWED;
|
||||
|
||||
if (!xd->cfl.is_chroma_reference) {
|
||||
// For non-chroma-reference blocks, we should always store the luma pixels,
|
||||
// in case the corresponding chroma-reference block uses CfL.
|
||||
// Note that this can only happen for block sizes which are <8 on
|
||||
// their shortest side, as otherwise they would be chroma reference
|
||||
// blocks.
|
||||
return CFL_ALLOWED;
|
||||
}
|
||||
|
||||
// If this block has chroma information, we know whether we're
|
||||
// actually going to perform a CfL prediction
|
||||
return (CFL_ALLOWED_TYPE)(!is_inter_block(mbmi) &&
|
||||
mbmi->uv_mode == UV_CFL_PRED);
|
||||
}
|
||||
|
||||
static INLINE int get_scaled_luma_q0(int alpha_q3, int16_t pred_buf_q3) {
|
||||
int scaled_luma_q6 = alpha_q3 * pred_buf_q3;
|
||||
return ROUND_POWER_OF_TWO_SIGNED(scaled_luma_q6, 6);
|
||||
}
|
||||
|
||||
static INLINE CFL_PRED_TYPE get_cfl_pred_type(PLANE_TYPE plane) {
|
||||
assert(plane > 0);
|
||||
return (CFL_PRED_TYPE)(plane - 1);
|
||||
}
|
||||
|
||||
void cfl_predict_block(MACROBLOCKD *const xd, uint8_t *dst, int dst_stride,
|
||||
int row, int col, TX_SIZE tx_size, int plane);
|
||||
TX_SIZE tx_size, int plane);
|
||||
|
||||
void cfl_store_block(MACROBLOCKD *const xd, BLOCK_SIZE bsize, TX_SIZE tx_size);
|
||||
|
||||
void cfl_store_tx(MACROBLOCKD *const xd, int row, int col, TX_SIZE tx_size,
|
||||
BLOCK_SIZE bsize);
|
||||
|
||||
void cfl_compute_parameters(MACROBLOCKD *const xd, TX_SIZE tx_size);
|
||||
void cfl_store_dc_pred(MACROBLOCKD *const xd, const uint8_t *input,
|
||||
CFL_PRED_TYPE pred_plane, int width);
|
||||
|
||||
void cfl_load_dc_pred(MACROBLOCKD *const xd, uint8_t *dst, int dst_stride,
|
||||
TX_SIZE tx_size, CFL_PRED_TYPE pred_plane);
|
||||
|
||||
// Null function used for invalid tx_sizes
|
||||
void cfl_subsample_lbd_null(const uint8_t *input, int input_stride,
|
||||
uint16_t *output_q3);
|
||||
|
||||
// Null function used for invalid tx_sizes
|
||||
void cfl_subsample_hbd_null(const uint16_t *input, int input_stride,
|
||||
uint16_t *output_q3);
|
||||
|
||||
// Allows the CFL_SUBSAMPLE function to switch types depending on the bitdepth.
|
||||
#define CFL_lbd_TYPE uint8_t *cfl_type
|
||||
#define CFL_hbd_TYPE uint16_t *cfl_type
|
||||
|
||||
// Declare a size-specific wrapper for the size-generic function. The compiler
|
||||
// will inline the size generic function in here, the advantage is that the size
|
||||
// will be constant allowing for loop unrolling and other constant propagated
|
||||
// goodness.
|
||||
#define CFL_SUBSAMPLE(arch, sub, bd, width, height) \
|
||||
void subsample_##bd##_##sub##_##width##x##height##_##arch( \
|
||||
const CFL_##bd##_TYPE, int input_stride, uint16_t *output_q3) { \
|
||||
cfl_luma_subsampling_##sub##_##bd##_##arch(cfl_type, input_stride, \
|
||||
output_q3, width, height); \
|
||||
}
|
||||
|
||||
// Declare size-specific wrappers for all valid CfL sizes.
|
||||
#define CFL_SUBSAMPLE_FUNCTIONS(arch, sub, bd) \
|
||||
CFL_SUBSAMPLE(arch, sub, bd, 4, 4) \
|
||||
CFL_SUBSAMPLE(arch, sub, bd, 8, 8) \
|
||||
CFL_SUBSAMPLE(arch, sub, bd, 16, 16) \
|
||||
CFL_SUBSAMPLE(arch, sub, bd, 32, 32) \
|
||||
CFL_SUBSAMPLE(arch, sub, bd, 4, 8) \
|
||||
CFL_SUBSAMPLE(arch, sub, bd, 8, 4) \
|
||||
CFL_SUBSAMPLE(arch, sub, bd, 8, 16) \
|
||||
CFL_SUBSAMPLE(arch, sub, bd, 16, 8) \
|
||||
CFL_SUBSAMPLE(arch, sub, bd, 16, 32) \
|
||||
CFL_SUBSAMPLE(arch, sub, bd, 32, 16) \
|
||||
CFL_SUBSAMPLE(arch, sub, bd, 4, 16) \
|
||||
CFL_SUBSAMPLE(arch, sub, bd, 16, 4) \
|
||||
CFL_SUBSAMPLE(arch, sub, bd, 8, 32) \
|
||||
CFL_SUBSAMPLE(arch, sub, bd, 32, 8) \
|
||||
cfl_subsample_##bd##_fn cfl_get_luma_subsampling_##sub##_##bd##_##arch( \
|
||||
TX_SIZE tx_size) { \
|
||||
CFL_SUBSAMPLE_FUNCTION_ARRAY(arch, sub, bd) \
|
||||
return subfn_##sub[tx_size]; \
|
||||
}
|
||||
|
||||
// Declare an architecture-specific array of function pointers for size-specific
|
||||
// wrappers.
|
||||
#define CFL_SUBSAMPLE_FUNCTION_ARRAY(arch, sub, bd) \
|
||||
static const cfl_subsample_##bd##_fn subfn_##sub[TX_SIZES_ALL] = { \
|
||||
subsample_##bd##_##sub##_4x4_##arch, /* 4x4 */ \
|
||||
subsample_##bd##_##sub##_8x8_##arch, /* 8x8 */ \
|
||||
subsample_##bd##_##sub##_16x16_##arch, /* 16x16 */ \
|
||||
subsample_##bd##_##sub##_32x32_##arch, /* 32x32 */ \
|
||||
cfl_subsample_##bd##_null, /* 64x64 (invalid CFL size) */ \
|
||||
subsample_##bd##_##sub##_4x8_##arch, /* 4x8 */ \
|
||||
subsample_##bd##_##sub##_8x4_##arch, /* 8x4 */ \
|
||||
subsample_##bd##_##sub##_8x16_##arch, /* 8x16 */ \
|
||||
subsample_##bd##_##sub##_16x8_##arch, /* 16x8 */ \
|
||||
subsample_##bd##_##sub##_16x32_##arch, /* 16x32 */ \
|
||||
subsample_##bd##_##sub##_32x16_##arch, /* 32x16 */ \
|
||||
cfl_subsample_##bd##_null, /* 32x64 (invalid CFL size) */ \
|
||||
cfl_subsample_##bd##_null, /* 64x32 (invalid CFL size) */ \
|
||||
subsample_##bd##_##sub##_4x16_##arch, /* 4x16 */ \
|
||||
subsample_##bd##_##sub##_16x4_##arch, /* 16x4 */ \
|
||||
subsample_##bd##_##sub##_8x32_##arch, /* 8x32 */ \
|
||||
subsample_##bd##_##sub##_32x8_##arch, /* 32x8 */ \
|
||||
cfl_subsample_##bd##_null, /* 16x64 (invalid CFL size) */ \
|
||||
cfl_subsample_##bd##_null, /* 64x16 (invalid CFL size) */ \
|
||||
};
|
||||
|
||||
// The RTCD script does not support passing in an array, so we wrap it in this
|
||||
// function.
|
||||
#define CFL_GET_SUBSAMPLE_FUNCTION(arch) \
|
||||
CFL_SUBSAMPLE_FUNCTIONS(arch, 420, lbd) \
|
||||
CFL_SUBSAMPLE_FUNCTIONS(arch, 422, lbd) \
|
||||
CFL_SUBSAMPLE_FUNCTIONS(arch, 444, lbd) \
|
||||
CFL_SUBSAMPLE_FUNCTIONS(arch, 420, hbd) \
|
||||
CFL_SUBSAMPLE_FUNCTIONS(arch, 422, hbd) \
|
||||
CFL_SUBSAMPLE_FUNCTIONS(arch, 444, hbd)
|
||||
|
||||
// Null function used for invalid tx_sizes
|
||||
static INLINE void cfl_subtract_average_null(const uint16_t *src,
|
||||
int16_t *dst) {
|
||||
(void)dst;
|
||||
(void)src;
|
||||
assert(0);
|
||||
}
|
||||
|
||||
// Declare a size-specific wrapper for the size-generic function. The compiler
|
||||
// will inline the size generic function in here, the advantage is that the size
|
||||
// will be constant allowing for loop unrolling and other constant propagated
|
||||
// goodness.
|
||||
#define CFL_SUB_AVG_X(arch, width, height, round_offset, num_pel_log2) \
|
||||
void subtract_average_##width##x##height##_##arch(const uint16_t *src, \
|
||||
int16_t *dst) { \
|
||||
subtract_average_##arch(src, dst, width, height, round_offset, \
|
||||
num_pel_log2); \
|
||||
}
|
||||
|
||||
// Declare size-specific wrappers for all valid CfL sizes.
|
||||
#define CFL_SUB_AVG_FN(arch) \
|
||||
CFL_SUB_AVG_X(arch, 4, 4, 8, 4) \
|
||||
CFL_SUB_AVG_X(arch, 4, 8, 16, 5) \
|
||||
CFL_SUB_AVG_X(arch, 4, 16, 32, 6) \
|
||||
CFL_SUB_AVG_X(arch, 8, 4, 16, 5) \
|
||||
CFL_SUB_AVG_X(arch, 8, 8, 32, 6) \
|
||||
CFL_SUB_AVG_X(arch, 8, 16, 64, 7) \
|
||||
CFL_SUB_AVG_X(arch, 8, 32, 128, 8) \
|
||||
CFL_SUB_AVG_X(arch, 16, 4, 32, 6) \
|
||||
CFL_SUB_AVG_X(arch, 16, 8, 64, 7) \
|
||||
CFL_SUB_AVG_X(arch, 16, 16, 128, 8) \
|
||||
CFL_SUB_AVG_X(arch, 16, 32, 256, 9) \
|
||||
CFL_SUB_AVG_X(arch, 32, 8, 128, 8) \
|
||||
CFL_SUB_AVG_X(arch, 32, 16, 256, 9) \
|
||||
CFL_SUB_AVG_X(arch, 32, 32, 512, 10) \
|
||||
cfl_subtract_average_fn get_subtract_average_fn_##arch(TX_SIZE tx_size) { \
|
||||
static const cfl_subtract_average_fn sub_avg[TX_SIZES_ALL] = { \
|
||||
subtract_average_4x4_##arch, /* 4x4 */ \
|
||||
subtract_average_8x8_##arch, /* 8x8 */ \
|
||||
subtract_average_16x16_##arch, /* 16x16 */ \
|
||||
subtract_average_32x32_##arch, /* 32x32 */ \
|
||||
cfl_subtract_average_null, /* 64x64 (invalid CFL size) */ \
|
||||
subtract_average_4x8_##arch, /* 4x8 */ \
|
||||
subtract_average_8x4_##arch, /* 8x4 */ \
|
||||
subtract_average_8x16_##arch, /* 8x16 */ \
|
||||
subtract_average_16x8_##arch, /* 16x8 */ \
|
||||
subtract_average_16x32_##arch, /* 16x32 */ \
|
||||
subtract_average_32x16_##arch, /* 32x16 */ \
|
||||
cfl_subtract_average_null, /* 32x64 (invalid CFL size) */ \
|
||||
cfl_subtract_average_null, /* 64x32 (invalid CFL size) */ \
|
||||
subtract_average_4x16_##arch, /* 4x16 (invalid CFL size) */ \
|
||||
subtract_average_16x4_##arch, /* 16x4 (invalid CFL size) */ \
|
||||
subtract_average_8x32_##arch, /* 8x32 (invalid CFL size) */ \
|
||||
subtract_average_32x8_##arch, /* 32x8 (invalid CFL size) */ \
|
||||
cfl_subtract_average_null, /* 16x64 (invalid CFL size) */ \
|
||||
cfl_subtract_average_null, /* 64x16 (invalid CFL size) */ \
|
||||
}; \
|
||||
/* Modulo TX_SIZES_ALL to ensure that an attacker won't be able to */ \
|
||||
/* index the function pointer array out of bounds. */ \
|
||||
return sub_avg[tx_size % TX_SIZES_ALL]; \
|
||||
}
|
||||
|
||||
// For VSX SIMD optimization, the C versions of width == 4 subtract are
|
||||
// faster than the VSX. As such, the VSX code calls the C versions.
|
||||
void subtract_average_4x4_c(const uint16_t *src, int16_t *dst);
|
||||
void subtract_average_4x8_c(const uint16_t *src, int16_t *dst);
|
||||
void subtract_average_4x16_c(const uint16_t *src, int16_t *dst);
|
||||
|
||||
#define CFL_PREDICT_lbd(arch, width, height) \
|
||||
void predict_lbd_##width##x##height##_##arch(const int16_t *pred_buf_q3, \
|
||||
uint8_t *dst, int dst_stride, \
|
||||
int alpha_q3) { \
|
||||
cfl_predict_lbd_##arch(pred_buf_q3, dst, dst_stride, alpha_q3, width, \
|
||||
height); \
|
||||
}
|
||||
|
||||
#define CFL_PREDICT_hbd(arch, width, height) \
|
||||
void predict_hbd_##width##x##height##_##arch(const int16_t *pred_buf_q3, \
|
||||
uint16_t *dst, int dst_stride, \
|
||||
int alpha_q3, int bd) { \
|
||||
cfl_predict_hbd_##arch(pred_buf_q3, dst, dst_stride, alpha_q3, bd, width, \
|
||||
height); \
|
||||
}
|
||||
|
||||
// This wrapper exists because clang format does not like calling macros with
|
||||
// lowercase letters.
|
||||
#define CFL_PREDICT_X(arch, width, height, bd) \
|
||||
CFL_PREDICT_##bd(arch, width, height)
|
||||
|
||||
// Null function used for invalid tx_sizes
|
||||
void cfl_predict_lbd_null(const int16_t *pred_buf_q3, uint8_t *dst,
|
||||
int dst_stride, int alpha_q3);
|
||||
|
||||
// Null function used for invalid tx_sizes
|
||||
void cfl_predict_hbd_null(const int16_t *pred_buf_q3, uint16_t *dst,
|
||||
int dst_stride, int alpha_q3, int bd);
|
||||
|
||||
#define CFL_PREDICT_FN(arch, bd) \
|
||||
CFL_PREDICT_X(arch, 4, 4, bd) \
|
||||
CFL_PREDICT_X(arch, 4, 8, bd) \
|
||||
CFL_PREDICT_X(arch, 4, 16, bd) \
|
||||
CFL_PREDICT_X(arch, 8, 4, bd) \
|
||||
CFL_PREDICT_X(arch, 8, 8, bd) \
|
||||
CFL_PREDICT_X(arch, 8, 16, bd) \
|
||||
CFL_PREDICT_X(arch, 8, 32, bd) \
|
||||
CFL_PREDICT_X(arch, 16, 4, bd) \
|
||||
CFL_PREDICT_X(arch, 16, 8, bd) \
|
||||
CFL_PREDICT_X(arch, 16, 16, bd) \
|
||||
CFL_PREDICT_X(arch, 16, 32, bd) \
|
||||
CFL_PREDICT_X(arch, 32, 8, bd) \
|
||||
CFL_PREDICT_X(arch, 32, 16, bd) \
|
||||
CFL_PREDICT_X(arch, 32, 32, bd) \
|
||||
cfl_predict_##bd##_fn get_predict_##bd##_fn_##arch(TX_SIZE tx_size) { \
|
||||
static const cfl_predict_##bd##_fn pred[TX_SIZES_ALL] = { \
|
||||
predict_##bd##_4x4_##arch, /* 4x4 */ \
|
||||
predict_##bd##_8x8_##arch, /* 8x8 */ \
|
||||
predict_##bd##_16x16_##arch, /* 16x16 */ \
|
||||
predict_##bd##_32x32_##arch, /* 32x32 */ \
|
||||
cfl_predict_##bd##_null, /* 64x64 (invalid CFL size) */ \
|
||||
predict_##bd##_4x8_##arch, /* 4x8 */ \
|
||||
predict_##bd##_8x4_##arch, /* 8x4 */ \
|
||||
predict_##bd##_8x16_##arch, /* 8x16 */ \
|
||||
predict_##bd##_16x8_##arch, /* 16x8 */ \
|
||||
predict_##bd##_16x32_##arch, /* 16x32 */ \
|
||||
predict_##bd##_32x16_##arch, /* 32x16 */ \
|
||||
cfl_predict_##bd##_null, /* 32x64 (invalid CFL size) */ \
|
||||
cfl_predict_##bd##_null, /* 64x32 (invalid CFL size) */ \
|
||||
predict_##bd##_4x16_##arch, /* 4x16 */ \
|
||||
predict_##bd##_16x4_##arch, /* 16x4 */ \
|
||||
predict_##bd##_8x32_##arch, /* 8x32 */ \
|
||||
predict_##bd##_32x8_##arch, /* 32x8 */ \
|
||||
cfl_predict_##bd##_null, /* 16x64 (invalid CFL size) */ \
|
||||
cfl_predict_##bd##_null, /* 64x16 (invalid CFL size) */ \
|
||||
}; \
|
||||
/* Modulo TX_SIZES_ALL to ensure that an attacker won't be able to */ \
|
||||
/* index the function pointer array out of bounds. */ \
|
||||
return pred[tx_size % TX_SIZES_ALL]; \
|
||||
}
|
||||
|
||||
#endif // AV1_COMMON_CFL_H_
|
||||
|
|
|
|||
115
third_party/aom/av1/common/clpf.c
vendored
115
third_party/aom/av1/common/clpf.c
vendored
|
|
@ -1,115 +0,0 @@
|
|||
/*
|
||||
* 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 "./av1_rtcd.h"
|
||||
#include "./cdef.h"
|
||||
#include "aom/aom_image.h"
|
||||
#include "aom_dsp/aom_dsp_common.h"
|
||||
|
||||
static int clpf_sample(int X, int A, int B, int C, int D, int E, int F, int G,
|
||||
int H, int s, unsigned int dmp) {
|
||||
int delta = 1 * constrain(A - X, s, dmp) + 3 * constrain(B - X, s, dmp) +
|
||||
1 * constrain(C - X, s, dmp) + 3 * constrain(D - X, s, dmp) +
|
||||
3 * constrain(E - X, s, dmp) + 1 * constrain(F - X, s, dmp) +
|
||||
3 * constrain(G - X, s, dmp) + 1 * constrain(H - X, s, dmp);
|
||||
return (8 + delta - (delta < 0)) >> 4;
|
||||
}
|
||||
|
||||
static int clpf_hsample(int X, int A, int B, int C, int D, int s,
|
||||
unsigned int dmp) {
|
||||
int delta = 1 * constrain(A - X, s, dmp) + 3 * constrain(B - X, s, dmp) +
|
||||
3 * constrain(C - X, s, dmp) + 1 * constrain(D - X, s, dmp);
|
||||
return (4 + delta - (delta < 0)) >> 3;
|
||||
}
|
||||
|
||||
void aom_clpf_block_c(uint8_t *dst, const uint16_t *src, int dstride,
|
||||
int sstride, int sizex, int sizey, unsigned int strength,
|
||||
unsigned int damping) {
|
||||
int x, y;
|
||||
|
||||
for (y = 0; y < sizey; y++) {
|
||||
for (x = 0; x < sizex; x++) {
|
||||
const int X = src[y * sstride + x];
|
||||
const int A = src[(y - 2) * sstride + x];
|
||||
const int B = src[(y - 1) * sstride + x];
|
||||
const int C = src[y * sstride + x - 2];
|
||||
const int D = src[y * sstride + x - 1];
|
||||
const int E = src[y * sstride + x + 1];
|
||||
const int F = src[y * sstride + x + 2];
|
||||
const int G = src[(y + 1) * sstride + x];
|
||||
const int H = src[(y + 2) * sstride + x];
|
||||
const int delta =
|
||||
clpf_sample(X, A, B, C, D, E, F, G, H, strength, damping);
|
||||
dst[y * dstride + x] = X + delta;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Identical to aom_clpf_block_c() apart from "dst".
|
||||
void aom_clpf_block_hbd_c(uint16_t *dst, const uint16_t *src, int dstride,
|
||||
int sstride, int sizex, int sizey,
|
||||
unsigned int strength, unsigned int damping) {
|
||||
int x, y;
|
||||
|
||||
for (y = 0; y < sizey; y++) {
|
||||
for (x = 0; x < sizex; x++) {
|
||||
const int X = src[y * sstride + x];
|
||||
const int A = src[(y - 2) * sstride + x];
|
||||
const int B = src[(y - 1) * sstride + x];
|
||||
const int C = src[y * sstride + x - 2];
|
||||
const int D = src[y * sstride + x - 1];
|
||||
const int E = src[y * sstride + x + 1];
|
||||
const int F = src[y * sstride + x + 2];
|
||||
const int G = src[(y + 1) * sstride + x];
|
||||
const int H = src[(y + 2) * sstride + x];
|
||||
const int delta =
|
||||
clpf_sample(X, A, B, C, D, E, F, G, H, strength, damping);
|
||||
dst[y * dstride + x] = X + delta;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Vertically restricted filter
|
||||
void aom_clpf_hblock_c(uint8_t *dst, const uint16_t *src, int dstride,
|
||||
int sstride, int sizex, int sizey, unsigned int strength,
|
||||
unsigned int damping) {
|
||||
int x, y;
|
||||
|
||||
for (y = 0; y < sizey; y++) {
|
||||
for (x = 0; x < sizex; x++) {
|
||||
const int X = src[y * sstride + x];
|
||||
const int A = src[y * sstride + x - 2];
|
||||
const int B = src[y * sstride + x - 1];
|
||||
const int C = src[y * sstride + x + 1];
|
||||
const int D = src[y * sstride + x + 2];
|
||||
const int delta = clpf_hsample(X, A, B, C, D, strength, damping);
|
||||
dst[y * dstride + x] = X + delta;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void aom_clpf_hblock_hbd_c(uint16_t *dst, const uint16_t *src, int dstride,
|
||||
int sstride, int sizex, int sizey,
|
||||
unsigned int strength, unsigned int damping) {
|
||||
int x, y;
|
||||
|
||||
for (y = 0; y < sizey; y++) {
|
||||
for (x = 0; x < sizex; x++) {
|
||||
const int X = src[y * sstride + x];
|
||||
const int A = src[y * sstride + x - 2];
|
||||
const int B = src[y * sstride + x - 1];
|
||||
const int C = src[y * sstride + x + 1];
|
||||
const int D = src[y * sstride + x + 2];
|
||||
const int delta = clpf_hsample(X, A, B, C, D, strength, damping);
|
||||
dst[y * dstride + x] = X + delta;
|
||||
}
|
||||
}
|
||||
}
|
||||
14
third_party/aom/av1/common/clpf_neon.c
vendored
14
third_party/aom/av1/common/clpf_neon.c
vendored
|
|
@ -1,14 +0,0 @@
|
|||
/*
|
||||
* 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 "aom_dsp/aom_simd.h"
|
||||
#define SIMD_FUNC(name) name##_neon
|
||||
#include "./clpf_simd.h"
|
||||
456
third_party/aom/av1/common/clpf_simd.h
vendored
456
third_party/aom/av1/common/clpf_simd.h
vendored
|
|
@ -1,456 +0,0 @@
|
|||
/*
|
||||
* 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 "./av1_rtcd.h"
|
||||
#include "aom_ports/bitops.h"
|
||||
#include "aom_ports/mem.h"
|
||||
|
||||
// sign(a-b) * min(abs(a-b), max(0, threshold - (abs(a-b) >> adjdamp)))
|
||||
SIMD_INLINE v128 constrain16(v128 a, v128 b, unsigned int threshold,
|
||||
unsigned int adjdamp) {
|
||||
v128 diff = v128_sub_16(a, b);
|
||||
const v128 sign = v128_shr_n_s16(diff, 15);
|
||||
diff = v128_abs_s16(diff);
|
||||
const v128 s =
|
||||
v128_ssub_u16(v128_dup_16(threshold), v128_shr_u16(diff, adjdamp));
|
||||
return v128_xor(v128_add_16(sign, v128_min_s16(diff, s)), sign);
|
||||
}
|
||||
|
||||
// sign(a - b) * min(abs(a - b), max(0, strength - (abs(a - b) >> adjdamp)))
|
||||
SIMD_INLINE v128 constrain(v256 a, v256 b, unsigned int strength,
|
||||
unsigned int adjdamp) {
|
||||
const v256 diff16 = v256_sub_16(a, b);
|
||||
v128 diff = v128_pack_s16_s8(v256_high_v128(diff16), v256_low_v128(diff16));
|
||||
const v128 sign = v128_cmplt_s8(diff, v128_zero());
|
||||
diff = v128_abs_s8(diff);
|
||||
return v128_xor(
|
||||
v128_add_8(sign,
|
||||
v128_min_u8(diff, v128_ssub_u8(v128_dup_8(strength),
|
||||
v128_shr_u8(diff, adjdamp)))),
|
||||
sign);
|
||||
}
|
||||
|
||||
// delta = 1/16 * constrain(a, x, s, d) + 3/16 * constrain(b, x, s, d) +
|
||||
// 1/16 * constrain(c, x, s, d) + 3/16 * constrain(d, x, s, d) +
|
||||
// 3/16 * constrain(e, x, s, d) + 1/16 * constrain(f, x, s, d) +
|
||||
// 3/16 * constrain(g, x, s, d) + 1/16 * constrain(h, x, s, d)
|
||||
SIMD_INLINE v128 calc_delta(v256 x, v256 a, v256 b, v256 c, v256 d, v256 e,
|
||||
v256 f, v256 g, v256 h, unsigned int s,
|
||||
unsigned int dmp) {
|
||||
const v128 bdeg =
|
||||
v128_add_8(v128_add_8(constrain(b, x, s, dmp), constrain(d, x, s, dmp)),
|
||||
v128_add_8(constrain(e, x, s, dmp), constrain(g, x, s, dmp)));
|
||||
const v128 delta = v128_add_8(
|
||||
v128_add_8(v128_add_8(constrain(a, x, s, dmp), constrain(c, x, s, dmp)),
|
||||
v128_add_8(constrain(f, x, s, dmp), constrain(h, x, s, dmp))),
|
||||
v128_add_8(v128_add_8(bdeg, bdeg), bdeg));
|
||||
return v128_add_8(
|
||||
v128_pack_s16_u8(v256_high_v128(x), v256_low_v128(x)),
|
||||
v128_shr_s8(
|
||||
v128_add_8(v128_dup_8(8),
|
||||
v128_add_8(delta, v128_cmplt_s8(delta, v128_zero()))),
|
||||
4));
|
||||
}
|
||||
|
||||
// delta = 1/8 * constrain(a, x, s, d) + 3/8 * constrain(b, x, s, d) +
|
||||
// 3/8 * constrain(c, x, s, d) + 1/8 * constrain(d, x, s, d) +
|
||||
SIMD_INLINE v128 calc_hdelta(v256 x, v256 a, v256 b, v256 c, v256 d,
|
||||
unsigned int s, unsigned int dmp) {
|
||||
const v128 bc = v128_add_8(constrain(b, x, s, dmp), constrain(c, x, s, dmp));
|
||||
const v128 delta =
|
||||
v128_add_8(v128_add_8(constrain(a, x, s, dmp), constrain(d, x, s, dmp)),
|
||||
v128_add_8(v128_add_8(bc, bc), bc));
|
||||
return v128_add_8(
|
||||
v128_pack_s16_u8(v256_high_v128(x), v256_low_v128(x)),
|
||||
v128_shr_s8(
|
||||
v128_add_8(v128_dup_8(4),
|
||||
v128_add_8(delta, v128_cmplt_s8(delta, v128_zero()))),
|
||||
3));
|
||||
}
|
||||
|
||||
// Process blocks of width 8, two lines at a time, 8 bit.
|
||||
static void SIMD_FUNC(clpf_block8)(uint8_t *dst, const uint16_t *src,
|
||||
int dstride, int sstride, int sizey,
|
||||
unsigned int strength,
|
||||
unsigned int adjdamp) {
|
||||
int y;
|
||||
|
||||
for (y = 0; y < sizey; y += 2) {
|
||||
const v128 l1 = v128_load_aligned(src);
|
||||
const v128 l2 = v128_load_aligned(src + sstride);
|
||||
const v128 l3 = v128_load_aligned(src - sstride);
|
||||
const v128 l4 = v128_load_aligned(src + 2 * sstride);
|
||||
const v256 a = v256_from_v128(v128_load_aligned(src - 2 * sstride), l3);
|
||||
const v256 b = v256_from_v128(l3, l1);
|
||||
const v256 g = v256_from_v128(l2, l4);
|
||||
const v256 h = v256_from_v128(l4, v128_load_aligned(src + 3 * sstride));
|
||||
const v256 c = v256_from_v128(v128_load_unaligned(src - 2),
|
||||
v128_load_unaligned(src - 2 + sstride));
|
||||
const v256 d = v256_from_v128(v128_load_unaligned(src - 1),
|
||||
v128_load_unaligned(src - 1 + sstride));
|
||||
const v256 e = v256_from_v128(v128_load_unaligned(src + 1),
|
||||
v128_load_unaligned(src + 1 + sstride));
|
||||
const v256 f = v256_from_v128(v128_load_unaligned(src + 2),
|
||||
v128_load_unaligned(src + 2 + sstride));
|
||||
const v128 o = calc_delta(v256_from_v128(l1, l2), a, b, c, d, e, f, g, h,
|
||||
strength, adjdamp);
|
||||
|
||||
v64_store_aligned(dst, v128_high_v64(o));
|
||||
v64_store_aligned(dst + dstride, v128_low_v64(o));
|
||||
src += sstride * 2;
|
||||
dst += dstride * 2;
|
||||
}
|
||||
}
|
||||
|
||||
// Process blocks of width 4, four lines at a time, 8 bit.
|
||||
static void SIMD_FUNC(clpf_block4)(uint8_t *dst, const uint16_t *src,
|
||||
int dstride, int sstride, int sizey,
|
||||
unsigned int strength,
|
||||
unsigned int adjdamp) {
|
||||
int y;
|
||||
|
||||
for (y = 0; y < sizey; y += 4) {
|
||||
const v64 l0 = v64_load_aligned(src - 2 * sstride);
|
||||
const v64 l1 = v64_load_aligned(src - sstride);
|
||||
const v64 l2 = v64_load_aligned(src);
|
||||
const v64 l3 = v64_load_aligned(src + sstride);
|
||||
const v64 l4 = v64_load_aligned(src + 2 * sstride);
|
||||
const v64 l5 = v64_load_aligned(src + 3 * sstride);
|
||||
const v64 l6 = v64_load_aligned(src + 4 * sstride);
|
||||
const v64 l7 = v64_load_aligned(src + 5 * sstride);
|
||||
const v128 o =
|
||||
calc_delta(v256_from_v64(l2, l3, l4, l5), v256_from_v64(l0, l1, l2, l3),
|
||||
v256_from_v64(l1, l2, l3, l4),
|
||||
v256_from_v64(v64_load_unaligned(src - 2),
|
||||
v64_load_unaligned(src + sstride - 2),
|
||||
v64_load_unaligned(src + 2 * sstride - 2),
|
||||
v64_load_unaligned(src + 3 * sstride - 2)),
|
||||
v256_from_v64(v64_load_unaligned(src - 1),
|
||||
v64_load_unaligned(src + sstride - 1),
|
||||
v64_load_unaligned(src + 2 * sstride - 1),
|
||||
v64_load_unaligned(src + 3 * sstride - 1)),
|
||||
v256_from_v64(v64_load_unaligned(src + 1),
|
||||
v64_load_unaligned(src + sstride + 1),
|
||||
v64_load_unaligned(src + 2 * sstride + 1),
|
||||
v64_load_unaligned(src + 3 * sstride + 1)),
|
||||
v256_from_v64(v64_load_unaligned(src + 2),
|
||||
v64_load_unaligned(src + sstride + 2),
|
||||
v64_load_unaligned(src + 2 * sstride + 2),
|
||||
v64_load_unaligned(src + 3 * sstride + 2)),
|
||||
v256_from_v64(l3, l4, l5, l6), v256_from_v64(l4, l5, l6, l7),
|
||||
strength, adjdamp);
|
||||
|
||||
u32_store_aligned(dst, v128_low_u32(v128_shr_n_byte(o, 12)));
|
||||
u32_store_aligned(dst + dstride, v128_low_u32(v128_shr_n_byte(o, 8)));
|
||||
u32_store_aligned(dst + 2 * dstride, v128_low_u32(v128_shr_n_byte(o, 4)));
|
||||
u32_store_aligned(dst + 3 * dstride, v128_low_u32(o));
|
||||
|
||||
dst += 4 * dstride;
|
||||
src += 4 * sstride;
|
||||
}
|
||||
}
|
||||
|
||||
static void SIMD_FUNC(clpf_hblock8)(uint8_t *dst, const uint16_t *src,
|
||||
int dstride, int sstride, int sizey,
|
||||
unsigned int strength,
|
||||
unsigned int adjdamp) {
|
||||
int y;
|
||||
|
||||
for (y = 0; y < sizey; y += 2) {
|
||||
const v256 x = v256_from_v128(v128_load_aligned(src),
|
||||
v128_load_aligned(src + sstride));
|
||||
const v256 a = v256_from_v128(v128_load_unaligned(src - 2),
|
||||
v128_load_unaligned(src - 2 + sstride));
|
||||
const v256 b = v256_from_v128(v128_load_unaligned(src - 1),
|
||||
v128_load_unaligned(src - 1 + sstride));
|
||||
const v256 c = v256_from_v128(v128_load_unaligned(src + 1),
|
||||
v128_load_unaligned(src + 1 + sstride));
|
||||
const v256 d = v256_from_v128(v128_load_unaligned(src + 2),
|
||||
v128_load_unaligned(src + 2 + sstride));
|
||||
const v128 o = calc_hdelta(x, a, b, c, d, strength, adjdamp);
|
||||
|
||||
v64_store_aligned(dst, v128_high_v64(o));
|
||||
v64_store_aligned(dst + dstride, v128_low_v64(o));
|
||||
src += sstride * 2;
|
||||
dst += dstride * 2;
|
||||
}
|
||||
}
|
||||
|
||||
// Process blocks of width 4, four lines at a time, 8 bit.
|
||||
static void SIMD_FUNC(clpf_hblock4)(uint8_t *dst, const uint16_t *src,
|
||||
int dstride, int sstride, int sizey,
|
||||
unsigned int strength,
|
||||
unsigned int adjdamp) {
|
||||
int y;
|
||||
|
||||
for (y = 0; y < sizey; y += 4) {
|
||||
const v256 a = v256_from_v64(v64_load_unaligned(src - 2),
|
||||
v64_load_unaligned(src + sstride - 2),
|
||||
v64_load_unaligned(src + 2 * sstride - 2),
|
||||
v64_load_unaligned(src + 3 * sstride - 2));
|
||||
const v256 b = v256_from_v64(v64_load_unaligned(src - 1),
|
||||
v64_load_unaligned(src + sstride - 1),
|
||||
v64_load_unaligned(src + 2 * sstride - 1),
|
||||
v64_load_unaligned(src + 3 * sstride - 1));
|
||||
const v256 c = v256_from_v64(v64_load_unaligned(src + 1),
|
||||
v64_load_unaligned(src + sstride + 1),
|
||||
v64_load_unaligned(src + 2 * sstride + 1),
|
||||
v64_load_unaligned(src + 3 * sstride + 1));
|
||||
const v256 d = v256_from_v64(v64_load_unaligned(src + 2),
|
||||
v64_load_unaligned(src + sstride + 2),
|
||||
v64_load_unaligned(src + 2 * sstride + 2),
|
||||
v64_load_unaligned(src + 3 * sstride + 2));
|
||||
|
||||
const v128 o = calc_hdelta(
|
||||
v256_from_v64(v64_load_aligned(src), v64_load_aligned(src + sstride),
|
||||
v64_load_aligned(src + 2 * sstride),
|
||||
v64_load_aligned(src + 3 * sstride)),
|
||||
a, b, c, d, strength, adjdamp);
|
||||
|
||||
u32_store_aligned(dst, v128_low_u32(v128_shr_n_byte(o, 12)));
|
||||
u32_store_aligned(dst + dstride, v128_low_u32(v128_shr_n_byte(o, 8)));
|
||||
u32_store_aligned(dst + 2 * dstride, v128_low_u32(v128_shr_n_byte(o, 4)));
|
||||
u32_store_aligned(dst + 3 * dstride, v128_low_u32(o));
|
||||
|
||||
dst += 4 * dstride;
|
||||
src += 4 * sstride;
|
||||
}
|
||||
}
|
||||
|
||||
void SIMD_FUNC(aom_clpf_block)(uint8_t *dst, const uint16_t *src, int dstride,
|
||||
int sstride, int sizex, int sizey,
|
||||
unsigned int strength, unsigned int dmp) {
|
||||
if ((sizex != 4 && sizex != 8) || ((sizey & 3) && sizex == 4)) {
|
||||
// Fallback to C for odd sizes:
|
||||
// * block widths not 4 or 8
|
||||
// * block heights not a multiple of 4 if the block width is 4
|
||||
aom_clpf_block_c(dst, src, dstride, sstride, sizex, sizey, strength, dmp);
|
||||
} else {
|
||||
(sizex == 4 ? SIMD_FUNC(clpf_block4) : SIMD_FUNC(clpf_block8))(
|
||||
dst, src, dstride, sstride, sizey, strength, dmp - get_msb(strength));
|
||||
}
|
||||
}
|
||||
|
||||
void SIMD_FUNC(aom_clpf_hblock)(uint8_t *dst, const uint16_t *src, int dstride,
|
||||
int sstride, int sizex, int sizey,
|
||||
unsigned int strength, unsigned int dmp) {
|
||||
if ((sizex != 4 && sizex != 8) || ((sizey & 3) && sizex == 4)) {
|
||||
// Fallback to C for odd sizes:
|
||||
// * block widths not 4 or 8
|
||||
// * block heights not a multiple of 4 if the block width is 4
|
||||
aom_clpf_hblock_c(dst, src, dstride, sstride, sizex, sizey, strength, dmp);
|
||||
} else {
|
||||
(sizex == 4 ? SIMD_FUNC(clpf_hblock4) : SIMD_FUNC(clpf_hblock8))(
|
||||
dst, src, dstride, sstride, sizey, strength, dmp - get_msb(strength));
|
||||
}
|
||||
}
|
||||
|
||||
// delta = 1/16 * constrain(a, x, s, d) + 3/16 * constrain(b, x, s, d) +
|
||||
// 1/16 * constrain(c, x, s, d) + 3/16 * constrain(d, x, s, d) +
|
||||
// 3/16 * constrain(e, x, s, d) + 1/16 * constrain(f, x, s, d) +
|
||||
// 3/16 * constrain(g, x, s, d) + 1/16 * constrain(h, x, s, d)
|
||||
SIMD_INLINE v128 calc_delta_hbd(v128 x, v128 a, v128 b, v128 c, v128 d, v128 e,
|
||||
v128 f, v128 g, v128 h, unsigned int s,
|
||||
unsigned int dmp) {
|
||||
const v128 bdeg = v128_add_16(
|
||||
v128_add_16(constrain16(b, x, s, dmp), constrain16(d, x, s, dmp)),
|
||||
v128_add_16(constrain16(e, x, s, dmp), constrain16(g, x, s, dmp)));
|
||||
const v128 delta = v128_add_16(
|
||||
v128_add_16(
|
||||
v128_add_16(constrain16(a, x, s, dmp), constrain16(c, x, s, dmp)),
|
||||
v128_add_16(constrain16(f, x, s, dmp), constrain16(h, x, s, dmp))),
|
||||
v128_add_16(v128_add_16(bdeg, bdeg), bdeg));
|
||||
return v128_add_16(
|
||||
x,
|
||||
v128_shr_s16(
|
||||
v128_add_16(v128_dup_16(8),
|
||||
v128_add_16(delta, v128_cmplt_s16(delta, v128_zero()))),
|
||||
4));
|
||||
}
|
||||
|
||||
static void calc_delta_hbd4(v128 o, v128 a, v128 b, v128 c, v128 d, v128 e,
|
||||
v128 f, v128 g, v128 h, uint16_t *dst,
|
||||
unsigned int s, unsigned int dmp, int dstride) {
|
||||
o = calc_delta_hbd(o, a, b, c, d, e, f, g, h, s, dmp);
|
||||
v64_store_aligned(dst, v128_high_v64(o));
|
||||
v64_store_aligned(dst + dstride, v128_low_v64(o));
|
||||
}
|
||||
|
||||
static void calc_delta_hbd8(v128 o, v128 a, v128 b, v128 c, v128 d, v128 e,
|
||||
v128 f, v128 g, v128 h, uint16_t *dst,
|
||||
unsigned int s, unsigned int adjdamp) {
|
||||
v128_store_aligned(dst,
|
||||
calc_delta_hbd(o, a, b, c, d, e, f, g, h, s, adjdamp));
|
||||
}
|
||||
|
||||
// delta = 1/16 * constrain(a, x, s, dmp) + 3/16 * constrain(b, x, s, dmp) +
|
||||
// 3/16 * constrain(c, x, s, dmp) + 1/16 * constrain(d, x, s, dmp)
|
||||
SIMD_INLINE v128 calc_hdelta_hbd(v128 x, v128 a, v128 b, v128 c, v128 d,
|
||||
unsigned int s, unsigned int dmp) {
|
||||
const v128 bc =
|
||||
v128_add_16(constrain16(b, x, s, dmp), constrain16(c, x, s, dmp));
|
||||
const v128 delta = v128_add_16(
|
||||
v128_add_16(constrain16(a, x, s, dmp), constrain16(d, x, s, dmp)),
|
||||
v128_add_16(v128_add_16(bc, bc), bc));
|
||||
return v128_add_16(
|
||||
x,
|
||||
v128_shr_s16(
|
||||
v128_add_16(v128_dup_16(4),
|
||||
v128_add_16(delta, v128_cmplt_s16(delta, v128_zero()))),
|
||||
3));
|
||||
}
|
||||
|
||||
static void calc_hdelta_hbd4(v128 o, v128 a, v128 b, v128 c, v128 d,
|
||||
uint16_t *dst, unsigned int s,
|
||||
unsigned int adjdamp, int dstride) {
|
||||
o = calc_hdelta_hbd(o, a, b, c, d, s, adjdamp);
|
||||
v64_store_aligned(dst, v128_high_v64(o));
|
||||
v64_store_aligned(dst + dstride, v128_low_v64(o));
|
||||
}
|
||||
|
||||
static void calc_hdelta_hbd8(v128 o, v128 a, v128 b, v128 c, v128 d,
|
||||
uint16_t *dst, unsigned int s,
|
||||
unsigned int adjdamp) {
|
||||
v128_store_aligned(dst, calc_hdelta_hbd(o, a, b, c, d, s, adjdamp));
|
||||
}
|
||||
|
||||
// Process blocks of width 4, two lines at time.
|
||||
static void SIMD_FUNC(clpf_block_hbd4)(uint16_t *dst, const uint16_t *src,
|
||||
int dstride, int sstride, int sizey,
|
||||
unsigned int strength,
|
||||
unsigned int adjdamp) {
|
||||
int y;
|
||||
|
||||
for (y = 0; y < sizey; y += 2) {
|
||||
const v64 l1 = v64_load_aligned(src);
|
||||
const v64 l2 = v64_load_aligned(src + sstride);
|
||||
const v64 l3 = v64_load_aligned(src - sstride);
|
||||
const v64 l4 = v64_load_aligned(src + 2 * sstride);
|
||||
const v128 a = v128_from_v64(v64_load_aligned(src - 2 * sstride), l3);
|
||||
const v128 b = v128_from_v64(l3, l1);
|
||||
const v128 g = v128_from_v64(l2, l4);
|
||||
const v128 h = v128_from_v64(l4, v64_load_aligned(src + 3 * sstride));
|
||||
const v128 c = v128_from_v64(v64_load_unaligned(src - 2),
|
||||
v64_load_unaligned(src - 2 + sstride));
|
||||
const v128 d = v128_from_v64(v64_load_unaligned(src - 1),
|
||||
v64_load_unaligned(src - 1 + sstride));
|
||||
const v128 e = v128_from_v64(v64_load_unaligned(src + 1),
|
||||
v64_load_unaligned(src + 1 + sstride));
|
||||
const v128 f = v128_from_v64(v64_load_unaligned(src + 2),
|
||||
v64_load_unaligned(src + 2 + sstride));
|
||||
|
||||
calc_delta_hbd4(v128_from_v64(l1, l2), a, b, c, d, e, f, g, h, dst,
|
||||
strength, adjdamp, dstride);
|
||||
src += sstride * 2;
|
||||
dst += dstride * 2;
|
||||
}
|
||||
}
|
||||
|
||||
// The most simple case. Start here if you need to understand the functions.
|
||||
static void SIMD_FUNC(clpf_block_hbd)(uint16_t *dst, const uint16_t *src,
|
||||
int dstride, int sstride, int sizey,
|
||||
unsigned int strength,
|
||||
unsigned int adjdamp) {
|
||||
int y;
|
||||
|
||||
for (y = 0; y < sizey; y++) {
|
||||
const v128 o = v128_load_aligned(src);
|
||||
const v128 a = v128_load_aligned(src - 2 * sstride);
|
||||
const v128 b = v128_load_aligned(src - 1 * sstride);
|
||||
const v128 g = v128_load_aligned(src + sstride);
|
||||
const v128 h = v128_load_aligned(src + 2 * sstride);
|
||||
const v128 c = v128_load_unaligned(src - 2);
|
||||
const v128 d = v128_load_unaligned(src - 1);
|
||||
const v128 e = v128_load_unaligned(src + 1);
|
||||
const v128 f = v128_load_unaligned(src + 2);
|
||||
|
||||
calc_delta_hbd8(o, a, b, c, d, e, f, g, h, dst, strength, adjdamp);
|
||||
src += sstride;
|
||||
dst += dstride;
|
||||
}
|
||||
}
|
||||
|
||||
// Process blocks of width 4, horizontal filter, two lines at time.
|
||||
static void SIMD_FUNC(clpf_hblock_hbd4)(uint16_t *dst, const uint16_t *src,
|
||||
int dstride, int sstride, int sizey,
|
||||
unsigned int strength,
|
||||
unsigned int adjdamp) {
|
||||
int y;
|
||||
|
||||
for (y = 0; y < sizey; y += 2) {
|
||||
const v128 a = v128_from_v64(v64_load_unaligned(src - 2),
|
||||
v64_load_unaligned(src - 2 + sstride));
|
||||
const v128 b = v128_from_v64(v64_load_unaligned(src - 1),
|
||||
v64_load_unaligned(src - 1 + sstride));
|
||||
const v128 c = v128_from_v64(v64_load_unaligned(src + 1),
|
||||
v64_load_unaligned(src + 1 + sstride));
|
||||
const v128 d = v128_from_v64(v64_load_unaligned(src + 2),
|
||||
v64_load_unaligned(src + 2 + sstride));
|
||||
|
||||
calc_hdelta_hbd4(v128_from_v64(v64_load_unaligned(src),
|
||||
v64_load_unaligned(src + sstride)),
|
||||
a, b, c, d, dst, strength, adjdamp, dstride);
|
||||
src += sstride * 2;
|
||||
dst += dstride * 2;
|
||||
}
|
||||
}
|
||||
|
||||
// Process blocks of width 8, horizontal filter, two lines at time.
|
||||
static void SIMD_FUNC(clpf_hblock_hbd)(uint16_t *dst, const uint16_t *src,
|
||||
int dstride, int sstride, int sizey,
|
||||
unsigned int strength,
|
||||
unsigned int adjdamp) {
|
||||
int y;
|
||||
|
||||
for (y = 0; y < sizey; y++) {
|
||||
const v128 o = v128_load_aligned(src);
|
||||
const v128 a = v128_load_unaligned(src - 2);
|
||||
const v128 b = v128_load_unaligned(src - 1);
|
||||
const v128 c = v128_load_unaligned(src + 1);
|
||||
const v128 d = v128_load_unaligned(src + 2);
|
||||
|
||||
calc_hdelta_hbd8(o, a, b, c, d, dst, strength, adjdamp);
|
||||
src += sstride;
|
||||
dst += dstride;
|
||||
}
|
||||
}
|
||||
|
||||
void SIMD_FUNC(aom_clpf_block_hbd)(uint16_t *dst, const uint16_t *src,
|
||||
int dstride, int sstride, int sizex,
|
||||
int sizey, unsigned int strength,
|
||||
unsigned int dmp) {
|
||||
if ((sizex != 4 && sizex != 8) || ((sizey & 1) && sizex == 4)) {
|
||||
// Fallback to C for odd sizes:
|
||||
// * block width not 4 or 8
|
||||
// * block heights not a multiple of 2 if the block width is 4
|
||||
aom_clpf_block_hbd_c(dst, src, dstride, sstride, sizex, sizey, strength,
|
||||
dmp);
|
||||
} else {
|
||||
(sizex == 4 ? SIMD_FUNC(clpf_block_hbd4) : SIMD_FUNC(clpf_block_hbd))(
|
||||
dst, src, dstride, sstride, sizey, strength, dmp - get_msb(strength));
|
||||
}
|
||||
}
|
||||
|
||||
void SIMD_FUNC(aom_clpf_hblock_hbd)(uint16_t *dst, const uint16_t *src,
|
||||
int dstride, int sstride, int sizex,
|
||||
int sizey, unsigned int strength,
|
||||
unsigned int dmp) {
|
||||
if ((sizex != 4 && sizex != 8) || ((sizey & 1) && sizex == 4)) {
|
||||
// Fallback to C for odd sizes:
|
||||
// * block width not 4 or 8
|
||||
// * block heights not a multiple of 2 if the block width is 4
|
||||
aom_clpf_hblock_hbd_c(dst, src, dstride, sstride, sizex, sizey, strength,
|
||||
dmp);
|
||||
} else {
|
||||
(sizex == 4 ? SIMD_FUNC(clpf_hblock_hbd4) : SIMD_FUNC(clpf_hblock_hbd))(
|
||||
dst, src, dstride, sstride, sizey, strength, dmp - get_msb(strength));
|
||||
}
|
||||
}
|
||||
14
third_party/aom/av1/common/clpf_sse2.c
vendored
14
third_party/aom/av1/common/clpf_sse2.c
vendored
|
|
@ -1,14 +0,0 @@
|
|||
/*
|
||||
* 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 "aom_dsp/aom_simd.h"
|
||||
#define SIMD_FUNC(name) name##_sse2
|
||||
#include "./clpf_simd.h"
|
||||
14
third_party/aom/av1/common/clpf_sse4.c
vendored
14
third_party/aom/av1/common/clpf_sse4.c
vendored
|
|
@ -1,14 +0,0 @@
|
|||
/*
|
||||
* 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 "aom_dsp/aom_simd.h"
|
||||
#define SIMD_FUNC(name) name##_sse4_1
|
||||
#include "./clpf_simd.h"
|
||||
14
third_party/aom/av1/common/clpf_ssse3.c
vendored
14
third_party/aom/av1/common/clpf_ssse3.c
vendored
|
|
@ -1,14 +0,0 @@
|
|||
/*
|
||||
* 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 "aom_dsp/aom_simd.h"
|
||||
#define SIMD_FUNC(name) name##_ssse3
|
||||
#include "./clpf_simd.h"
|
||||
3
third_party/aom/av1/common/common.h
vendored
3
third_party/aom/av1/common/common.h
vendored
|
|
@ -20,6 +20,7 @@
|
|||
#include "aom_mem/aom_mem.h"
|
||||
#include "aom/aom_integer.h"
|
||||
#include "aom_ports/bitops.h"
|
||||
#include "config/aom_config.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
@ -53,6 +54,8 @@ static INLINE int get_unsigned_bits(unsigned int num_values) {
|
|||
|
||||
#define AOM_FRAME_MARKER 0x2
|
||||
|
||||
#define AV1_MIN_TILE_SIZE_BYTES 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
|
|
|||
2023
third_party/aom/av1/common/common_data.h
vendored
2023
third_party/aom/av1/common/common_data.h
vendored
File diff suppressed because it is too large
Load diff
2232
third_party/aom/av1/common/convolve.c
vendored
2232
third_party/aom/av1/common/convolve.c
vendored
File diff suppressed because it is too large
Load diff
169
third_party/aom/av1/common/convolve.h
vendored
169
third_party/aom/av1/common/convolve.h
vendored
|
|
@ -17,140 +17,119 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum CONVOLVE_OPT {
|
||||
// indicate the results in dst buf is rounded by FILTER_BITS or not
|
||||
CONVOLVE_OPT_ROUND,
|
||||
CONVOLVE_OPT_NO_ROUND,
|
||||
} CONVOLVE_OPT;
|
||||
|
||||
typedef int32_t CONV_BUF_TYPE;
|
||||
|
||||
typedef uint16_t CONV_BUF_TYPE;
|
||||
typedef struct ConvolveParams {
|
||||
int ref;
|
||||
int do_average;
|
||||
CONVOLVE_OPT round;
|
||||
CONV_BUF_TYPE *dst;
|
||||
int dst_stride;
|
||||
int round_0;
|
||||
int round_1;
|
||||
int plane;
|
||||
int do_post_rounding;
|
||||
int is_compound;
|
||||
int use_jnt_comp_avg;
|
||||
int fwd_offset;
|
||||
int bck_offset;
|
||||
} ConvolveParams;
|
||||
|
||||
static INLINE ConvolveParams get_conv_params(int ref, int do_average,
|
||||
int plane) {
|
||||
ConvolveParams conv_params;
|
||||
conv_params.ref = ref;
|
||||
conv_params.do_average = do_average;
|
||||
conv_params.round = CONVOLVE_OPT_ROUND;
|
||||
conv_params.plane = plane;
|
||||
conv_params.do_post_rounding = 0;
|
||||
return conv_params;
|
||||
}
|
||||
#define ROUND0_BITS 3
|
||||
#define COMPOUND_ROUND1_BITS 7
|
||||
#define WIENER_ROUND0_BITS 3
|
||||
|
||||
#if CONFIG_DUAL_FILTER && USE_EXTRA_FILTER
|
||||
static INLINE void av1_convolve_filter_params_fixup_1212(
|
||||
const InterpFilterParams *params_x, InterpFilterParams *params_y) {
|
||||
if (params_x->interp_filter == MULTITAP_SHARP &&
|
||||
params_y->interp_filter == MULTITAP_SHARP) {
|
||||
// Avoid two directions both using 12-tap filter.
|
||||
// This will reduce hardware implementation cost.
|
||||
*params_y = av1_get_interp_filter_params(EIGHTTAP_SHARP);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#define WIENER_CLAMP_LIMIT(r0, bd) (1 << ((bd) + 1 + FILTER_BITS - r0))
|
||||
|
||||
static INLINE void av1_get_convolve_filter_params(
|
||||
InterpFilters interp_filters, int avoid_1212, InterpFilterParams *params_x,
|
||||
InterpFilterParams *params_y) {
|
||||
#if CONFIG_DUAL_FILTER
|
||||
typedef void (*aom_convolve_fn_t)(const uint8_t *src, int src_stride,
|
||||
uint8_t *dst, int dst_stride, int w, int h,
|
||||
InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y,
|
||||
const int subpel_x_q4, const int subpel_y_q4,
|
||||
ConvolveParams *conv_params);
|
||||
|
||||
typedef void (*aom_highbd_convolve_fn_t)(
|
||||
const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w,
|
||||
int h, InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y, const int subpel_x_q4,
|
||||
const int subpel_y_q4, ConvolveParams *conv_params, int bd);
|
||||
|
||||
static INLINE void av1_get_convolve_filter_params(InterpFilters interp_filters,
|
||||
InterpFilterParams *params_x,
|
||||
InterpFilterParams *params_y,
|
||||
int w, int h) {
|
||||
InterpFilter filter_x = av1_extract_interp_filter(interp_filters, 1);
|
||||
InterpFilter filter_y = av1_extract_interp_filter(interp_filters, 0);
|
||||
#else
|
||||
InterpFilter filter_x = av1_extract_interp_filter(interp_filters, 0);
|
||||
InterpFilter filter_y = av1_extract_interp_filter(interp_filters, 0);
|
||||
#endif
|
||||
|
||||
*params_x = av1_get_interp_filter_params(filter_x);
|
||||
*params_y = av1_get_interp_filter_params(filter_y);
|
||||
|
||||
if (avoid_1212) {
|
||||
#if CONFIG_DUAL_FILTER && USE_EXTRA_FILTER
|
||||
convolve_filter_params_fixup_1212(params_x, params_y);
|
||||
#endif
|
||||
}
|
||||
*params_x = av1_get_interp_filter_params_with_block_size(filter_x, w);
|
||||
*params_y = av1_get_interp_filter_params_with_block_size(filter_y, h);
|
||||
}
|
||||
|
||||
struct AV1Common;
|
||||
void av1_convolve_init(struct AV1Common *cm);
|
||||
struct scale_factors;
|
||||
|
||||
#if CONFIG_CONVOLVE_ROUND
|
||||
void av1_convolve_2d_facade(const uint8_t *src, int src_stride, uint8_t *dst,
|
||||
int dst_stride, int w, int h,
|
||||
InterpFilters interp_filters, const int subpel_x_q4,
|
||||
int x_step_q4, const int subpel_y_q4, int y_step_q4,
|
||||
int scaled, ConvolveParams *conv_params);
|
||||
int scaled, ConvolveParams *conv_params,
|
||||
const struct scale_factors *sf);
|
||||
|
||||
static INLINE ConvolveParams get_conv_params_no_round(int ref, int do_average,
|
||||
int plane, int32_t *dst,
|
||||
int dst_stride) {
|
||||
int plane,
|
||||
CONV_BUF_TYPE *dst,
|
||||
int dst_stride,
|
||||
int is_compound, int bd) {
|
||||
ConvolveParams conv_params;
|
||||
conv_params.ref = ref;
|
||||
conv_params.do_average = do_average;
|
||||
conv_params.round = CONVOLVE_OPT_NO_ROUND;
|
||||
#if CONFIG_COMPOUND_ROUND
|
||||
conv_params.round_0 = FILTER_BITS;
|
||||
#else
|
||||
conv_params.round_0 = 5;
|
||||
#endif
|
||||
conv_params.round_1 = 0;
|
||||
assert(IMPLIES(do_average, is_compound));
|
||||
conv_params.is_compound = is_compound;
|
||||
conv_params.round_0 = ROUND0_BITS;
|
||||
conv_params.round_1 = is_compound ? COMPOUND_ROUND1_BITS
|
||||
: 2 * FILTER_BITS - conv_params.round_0;
|
||||
const int intbufrange = bd + FILTER_BITS - conv_params.round_0 + 2;
|
||||
assert(IMPLIES(bd < 12, intbufrange <= 16));
|
||||
if (intbufrange > 16) {
|
||||
conv_params.round_0 += intbufrange - 16;
|
||||
if (!is_compound) conv_params.round_1 -= intbufrange - 16;
|
||||
}
|
||||
// TODO(yunqing): The following dst should only be valid while
|
||||
// is_compound = 1;
|
||||
conv_params.dst = dst;
|
||||
conv_params.dst_stride = dst_stride;
|
||||
conv_params.plane = plane;
|
||||
conv_params.do_post_rounding = 0;
|
||||
return conv_params;
|
||||
}
|
||||
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
static INLINE ConvolveParams get_conv_params(int ref, int do_average, int plane,
|
||||
int bd) {
|
||||
return get_conv_params_no_round(ref, do_average, plane, NULL, 0, 0, bd);
|
||||
}
|
||||
|
||||
static INLINE ConvolveParams get_conv_params_wiener(int bd) {
|
||||
ConvolveParams conv_params;
|
||||
(void)bd;
|
||||
conv_params.ref = 0;
|
||||
conv_params.do_average = 0;
|
||||
conv_params.is_compound = 0;
|
||||
conv_params.round_0 = WIENER_ROUND0_BITS;
|
||||
conv_params.round_1 = 2 * FILTER_BITS - conv_params.round_0;
|
||||
const int intbufrange = bd + FILTER_BITS - conv_params.round_0 + 2;
|
||||
assert(IMPLIES(bd < 12, intbufrange <= 16));
|
||||
if (intbufrange > 16) {
|
||||
conv_params.round_0 += intbufrange - 16;
|
||||
conv_params.round_1 -= intbufrange - 16;
|
||||
}
|
||||
conv_params.dst = NULL;
|
||||
conv_params.dst_stride = 0;
|
||||
conv_params.plane = 0;
|
||||
return conv_params;
|
||||
}
|
||||
|
||||
void av1_highbd_convolve_2d_facade(const uint8_t *src8, int src_stride,
|
||||
uint8_t *dst, int dst_stride, int w, int h,
|
||||
InterpFilters interp_filters,
|
||||
const int subpel_x_q4, int x_step_q4,
|
||||
const int subpel_y_q4, int y_step_q4,
|
||||
int scaled, ConvolveParams *conv_params,
|
||||
int bd);
|
||||
#endif
|
||||
#endif // CONFIG_CONVOLVE_ROUND
|
||||
|
||||
void av1_convolve(const uint8_t *src, int src_stride, uint8_t *dst,
|
||||
int dst_stride, int w, int h, InterpFilters interp_filters,
|
||||
const int subpel_x, int xstep, const int subpel_y, int ystep,
|
||||
ConvolveParams *conv_params);
|
||||
|
||||
void av1_convolve_c(const uint8_t *src, int src_stride, uint8_t *dst,
|
||||
int dst_stride, int w, int h, InterpFilters interp_filters,
|
||||
const int subpel_x, int xstep, const int subpel_y,
|
||||
int ystep, ConvolveParams *conv_params);
|
||||
|
||||
void av1_convolve_scale(const uint8_t *src, int src_stride, uint8_t *dst,
|
||||
int dst_stride, int w, int h,
|
||||
InterpFilters interp_filters, const int subpel_x,
|
||||
int xstep, const int subpel_y, int ystep,
|
||||
ConvolveParams *conv_params);
|
||||
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
void av1_highbd_convolve(const uint8_t *src, int src_stride, uint8_t *dst,
|
||||
int dst_stride, int w, int h,
|
||||
InterpFilters interp_filters, const int subpel_x,
|
||||
int xstep, const int subpel_y, int ystep, int avg,
|
||||
int bd);
|
||||
|
||||
void av1_highbd_convolve_scale(const uint8_t *src, int src_stride, uint8_t *dst,
|
||||
int dst_stride, int w, int h,
|
||||
InterpFilters interp_filters, const int subpel_x,
|
||||
int xstep, const int subpel_y, int ystep,
|
||||
int avg, int bd);
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
const struct scale_factors *sf, int bd);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
|
|
|
|||
4331
third_party/aom/av1/common/daala_tx.c
vendored
4331
third_party/aom/av1/common/daala_tx.c
vendored
File diff suppressed because it is too large
Load diff
53
third_party/aom/av1/common/daala_tx.h
vendored
53
third_party/aom/av1/common/daala_tx.h
vendored
|
|
@ -1,53 +0,0 @@
|
|||
#ifndef AOM_DSP_DAALA_TX_H_
|
||||
#define AOM_DSP_DAALA_TX_H_
|
||||
|
||||
#include "aom_dsp/aom_dsp_common.h"
|
||||
#include "av1/common/odintrin.h"
|
||||
|
||||
void daala_fdct4(const tran_low_t *input, tran_low_t *output);
|
||||
void daala_idct4(const tran_low_t *input, tran_low_t *output);
|
||||
void daala_fdst4(const tran_low_t *input, tran_low_t *output);
|
||||
void daala_idst4(const tran_low_t *input, tran_low_t *output);
|
||||
void daala_idtx4(const tran_low_t *input, tran_low_t *output);
|
||||
void daala_fdct8(const tran_low_t *input, tran_low_t *output);
|
||||
void daala_idct8(const tran_low_t *input, tran_low_t *output);
|
||||
void daala_fdst8(const tran_low_t *input, tran_low_t *output);
|
||||
void daala_idst8(const tran_low_t *input, tran_low_t *output);
|
||||
void daala_idtx8(const tran_low_t *input, tran_low_t *output);
|
||||
void daala_fdct16(const tran_low_t *input, tran_low_t *output);
|
||||
void daala_idct16(const tran_low_t *input, tran_low_t *output);
|
||||
void daala_fdst16(const tran_low_t *input, tran_low_t *output);
|
||||
void daala_idst16(const tran_low_t *input, tran_low_t *output);
|
||||
void daala_idtx16(const tran_low_t *input, tran_low_t *output);
|
||||
void daala_fdct32(const tran_low_t *input, tran_low_t *output);
|
||||
void daala_idct32(const tran_low_t *input, tran_low_t *output);
|
||||
void daala_fdst32(const tran_low_t *input, tran_low_t *output);
|
||||
void daala_idst32(const tran_low_t *input, tran_low_t *output);
|
||||
void daala_idtx32(const tran_low_t *input, tran_low_t *output);
|
||||
#if CONFIG_TX64X64
|
||||
void daala_fdct64(const tran_low_t *input, tran_low_t *output);
|
||||
void daala_idct64(const tran_low_t *input, tran_low_t *output);
|
||||
void daala_fdst64(const tran_low_t *input, tran_low_t *output);
|
||||
void daala_idst64(const tran_low_t *input, tran_low_t *output);
|
||||
void daala_idtx64(const tran_low_t *input, tran_low_t *output);
|
||||
#endif
|
||||
|
||||
void od_bin_fdct4(od_coeff y[4], const od_coeff *x, int xstride);
|
||||
void od_bin_idct4(od_coeff *x, int xstride, const od_coeff y[4]);
|
||||
void od_bin_fdst4(od_coeff y[4], const od_coeff *x, int xstride);
|
||||
void od_bin_idst4(od_coeff *x, int xstride, const od_coeff y[4]);
|
||||
void od_bin_fdct8(od_coeff y[8], const od_coeff *x, int xstride);
|
||||
void od_bin_idct8(od_coeff *x, int xstride, const od_coeff y[8]);
|
||||
void od_bin_fdst8(od_coeff y[8], const od_coeff *x, int xstride);
|
||||
void od_bin_idst8(od_coeff *x, int xstride, const od_coeff y[8]);
|
||||
void od_bin_fdct16(od_coeff y[16], const od_coeff *x, int xstride);
|
||||
void od_bin_idct16(od_coeff *x, int xstride, const od_coeff y[16]);
|
||||
void od_bin_fdst16(od_coeff y[16], const od_coeff *x, int xstride);
|
||||
void od_bin_idst16(od_coeff *x, int xstride, const od_coeff y[16]);
|
||||
void od_bin_fdct32(od_coeff y[32], const od_coeff *x, int xstride);
|
||||
void od_bin_idct32(od_coeff *x, int xstride, const od_coeff y[32]);
|
||||
#if CONFIG_TX64X64
|
||||
void od_bin_fdct64(od_coeff y[64], const od_coeff *x, int xstride);
|
||||
void od_bin_idct64(od_coeff *x, int xstride, const od_coeff y[64]);
|
||||
#endif
|
||||
#endif
|
||||
29
third_party/aom/av1/common/debugmodes.c
vendored
29
third_party/aom/av1/common/debugmodes.c
vendored
|
|
@ -27,7 +27,7 @@ static void log_frame_info(AV1_COMMON *cm, const char *str, FILE *f) {
|
|||
static void print_mi_data(AV1_COMMON *cm, FILE *file, const char *descriptor,
|
||||
size_t member_offset) {
|
||||
int mi_row, mi_col;
|
||||
MODE_INFO **mi = cm->mi_grid_visible;
|
||||
MB_MODE_INFO **mi = cm->mi_grid_visible;
|
||||
int rows = cm->mi_rows;
|
||||
int cols = cm->mi_cols;
|
||||
char prefix = descriptor[0];
|
||||
|
|
@ -36,8 +36,7 @@ static void print_mi_data(AV1_COMMON *cm, FILE *file, const char *descriptor,
|
|||
for (mi_row = 0; mi_row < rows; mi_row++) {
|
||||
fprintf(file, "%c ", prefix);
|
||||
for (mi_col = 0; mi_col < cols; mi_col++) {
|
||||
fprintf(file, "%2d ",
|
||||
*((char *)((char *)(&mi[0]->mbmi) + member_offset)));
|
||||
fprintf(file, "%2d ", *((char *)((char *)(mi[0]) + member_offset)));
|
||||
mi++;
|
||||
}
|
||||
fprintf(file, "\n");
|
||||
|
|
@ -50,7 +49,7 @@ void av1_print_modes_and_motion_vectors(AV1_COMMON *cm, const char *file) {
|
|||
int mi_row;
|
||||
int mi_col;
|
||||
FILE *mvs = fopen(file, "a");
|
||||
MODE_INFO **mi = cm->mi_grid_visible;
|
||||
MB_MODE_INFO **mi = cm->mi_grid_visible;
|
||||
int rows = cm->mi_rows;
|
||||
int cols = cm->mi_cols;
|
||||
|
||||
|
|
@ -65,7 +64,7 @@ void av1_print_modes_and_motion_vectors(AV1_COMMON *cm, const char *file) {
|
|||
for (mi_row = 0; mi_row < rows; mi_row++) {
|
||||
fprintf(mvs, "S ");
|
||||
for (mi_col = 0; mi_col < cols; mi_col++) {
|
||||
fprintf(mvs, "%2d ", mi[0]->mbmi.skip);
|
||||
fprintf(mvs, "%2d ", mi[0]->skip);
|
||||
mi++;
|
||||
}
|
||||
fprintf(mvs, "\n");
|
||||
|
|
@ -79,8 +78,7 @@ void av1_print_modes_and_motion_vectors(AV1_COMMON *cm, const char *file) {
|
|||
for (mi_row = 0; mi_row < rows; mi_row++) {
|
||||
fprintf(mvs, "V ");
|
||||
for (mi_col = 0; mi_col < cols; mi_col++) {
|
||||
fprintf(mvs, "%4d:%4d ", mi[0]->mbmi.mv[0].as_mv.row,
|
||||
mi[0]->mbmi.mv[0].as_mv.col);
|
||||
fprintf(mvs, "%4d:%4d ", mi[0]->mv[0].as_mv.row, mi[0]->mv[0].as_mv.col);
|
||||
mi++;
|
||||
}
|
||||
fprintf(mvs, "\n");
|
||||
|
|
@ -90,3 +88,20 @@ void av1_print_modes_and_motion_vectors(AV1_COMMON *cm, const char *file) {
|
|||
|
||||
fclose(mvs);
|
||||
}
|
||||
|
||||
void av1_print_uncompressed_frame_header(const uint8_t *data, int size,
|
||||
const char *filename) {
|
||||
FILE *hdrFile = fopen(filename, "w");
|
||||
fwrite(data, size, sizeof(uint8_t), hdrFile);
|
||||
fclose(hdrFile);
|
||||
}
|
||||
|
||||
void av1_print_frame_contexts(const FRAME_CONTEXT *fc, const char *filename) {
|
||||
FILE *fcFile = fopen(filename, "w");
|
||||
const uint16_t *fcp = (uint16_t *)fc;
|
||||
const unsigned int n_contexts = sizeof(FRAME_CONTEXT) / sizeof(uint16_t);
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < n_contexts; ++i) fprintf(fcFile, "%d ", *fcp++);
|
||||
fclose(fcFile);
|
||||
}
|
||||
|
|
|
|||
2570
third_party/aom/av1/common/entropy.c
vendored
2570
third_party/aom/av1/common/entropy.c
vendored
File diff suppressed because it is too large
Load diff
361
third_party/aom/av1/common/entropy.h
vendored
361
third_party/aom/av1/common/entropy.h
vendored
|
|
@ -12,7 +12,8 @@
|
|||
#ifndef AV1_COMMON_ENTROPY_H_
|
||||
#define AV1_COMMON_ENTROPY_H_
|
||||
|
||||
#include "./aom_config.h"
|
||||
#include "config/aom_config.h"
|
||||
|
||||
#include "aom/aom_integer.h"
|
||||
#include "aom_dsp/prob.h"
|
||||
|
||||
|
|
@ -24,82 +25,35 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define DIFF_UPDATE_PROB 252
|
||||
#define GROUP_DIFF_UPDATE_PROB 252
|
||||
|
||||
#if CONFIG_Q_ADAPT_PROBS
|
||||
#define TOKEN_CDF_Q_CTXS 4
|
||||
#endif // CONFIG_Q_ADAPT_PROBS
|
||||
|
||||
// Coefficient token alphabet
|
||||
#define ZERO_TOKEN 0 // 0 Extra Bits 0+0
|
||||
#define ONE_TOKEN 1 // 1 Extra Bits 0+1
|
||||
#define TWO_TOKEN 2 // 2 Extra Bits 0+1
|
||||
#define THREE_TOKEN 3 // 3 Extra Bits 0+1
|
||||
#define FOUR_TOKEN 4 // 4 Extra Bits 0+1
|
||||
#define CATEGORY1_TOKEN 5 // 5-6 Extra Bits 1+1
|
||||
#define CATEGORY2_TOKEN 6 // 7-10 Extra Bits 2+1
|
||||
#define CATEGORY3_TOKEN 7 // 11-18 Extra Bits 3+1
|
||||
#define CATEGORY4_TOKEN 8 // 19-34 Extra Bits 4+1
|
||||
#define CATEGORY5_TOKEN 9 // 35-66 Extra Bits 5+1
|
||||
#define CATEGORY6_TOKEN 10 // 67+ Extra Bits 14+1
|
||||
#define EOB_TOKEN 11 // EOB Extra Bits 0+0
|
||||
#define NO_EOB 0 // Not an end-of-block
|
||||
#define EARLY_EOB 1 // End of block before the last position
|
||||
#define LAST_EOB 2 // End of block in the last position (implicit)
|
||||
#define BLOCK_Z_TOKEN 255 // block zero
|
||||
#define HEAD_TOKENS 5
|
||||
#define TAIL_TOKENS 9
|
||||
#define ONE_TOKEN_EOB 1
|
||||
#define ONE_TOKEN_NEOB 2
|
||||
#define TWO_TOKEN_PLUS_EOB 3
|
||||
#define TWO_TOKEN_PLUS_NEOB 4
|
||||
#define ENTROPY_TOKENS 12
|
||||
|
||||
#define ENTROPY_NODES 11
|
||||
|
||||
#if CONFIG_LV_MAP
|
||||
#define TXB_SKIP_CONTEXTS 13
|
||||
|
||||
#if CONFIG_CTX1D
|
||||
#define EOB_COEF_CONTEXTS_2D 25
|
||||
#define EOB_COEF_CONTEXTS_1D 25
|
||||
#define EOB_COEF_CONTEXTS \
|
||||
(EOB_COEF_CONTEXTS_2D + EOB_COEF_CONTEXTS_1D + EOB_COEF_CONTEXTS_1D)
|
||||
#else // CONFIG_CTX1D
|
||||
#define EOB_COEF_CONTEXTS 25
|
||||
#endif // CONFIG_CTX1D
|
||||
#define EOB_COEF_CONTEXTS 9
|
||||
|
||||
#if CONFIG_EXT_TX
|
||||
#define SIG_COEF_CONTEXTS_2D 16
|
||||
#define SIG_COEF_CONTEXTS_2D 26
|
||||
#define SIG_COEF_CONTEXTS_1D 16
|
||||
#define SIG_COEF_CONTEXTS \
|
||||
(SIG_COEF_CONTEXTS_2D + SIG_COEF_CONTEXTS_1D + SIG_COEF_CONTEXTS_1D)
|
||||
#else // CONFIG_EXT_TX
|
||||
#define SIG_COEF_CONTEXTS_2D 16
|
||||
#define SIG_COEF_CONTEXTS 16
|
||||
#endif // CONFIG_EXT_TX
|
||||
#define COEFF_BASE_CONTEXTS 42
|
||||
#define SIG_COEF_CONTEXTS_EOB 4
|
||||
#define SIG_COEF_CONTEXTS (SIG_COEF_CONTEXTS_2D + SIG_COEF_CONTEXTS_1D)
|
||||
|
||||
#define COEFF_BASE_CONTEXTS (SIG_COEF_CONTEXTS)
|
||||
#define DC_SIGN_CONTEXTS 3
|
||||
|
||||
#define BR_TMP_OFFSET 12
|
||||
#define BR_REF_CAT 4
|
||||
#define LEVEL_CONTEXTS (BR_TMP_OFFSET * BR_REF_CAT)
|
||||
#define LEVEL_CONTEXTS 21
|
||||
|
||||
#define NUM_BASE_LEVELS 2
|
||||
#define COEFF_BASE_RANGE (16 - NUM_BASE_LEVELS)
|
||||
#define BASE_RANGE_SETS 3
|
||||
|
||||
#define BR_CDF_SIZE (4)
|
||||
#define COEFF_BASE_RANGE (4 * (BR_CDF_SIZE - 1))
|
||||
|
||||
#define COEFF_CONTEXT_BITS 6
|
||||
#define COEFF_CONTEXT_MASK ((1 << COEFF_CONTEXT_BITS) - 1)
|
||||
#define MAX_BASE_BR_RANGE (COEFF_BASE_RANGE + NUM_BASE_LEVELS + 1)
|
||||
|
||||
#define BASE_CONTEXT_POSITION_NUM 12
|
||||
|
||||
#if CONFIG_CTX1D
|
||||
#define EMPTY_LINE_CONTEXTS 5
|
||||
#define HV_EOB_CONTEXTS 24
|
||||
#endif // CONFIG_CTX1D
|
||||
|
||||
typedef enum TX_CLASS {
|
||||
TX_CLASS_2D = 0,
|
||||
TX_CLASS_HORIZ = 1,
|
||||
|
|
@ -107,161 +61,21 @@ typedef enum TX_CLASS {
|
|||
TX_CLASSES = 3,
|
||||
} TX_CLASS;
|
||||
|
||||
#endif
|
||||
|
||||
DECLARE_ALIGNED(16, extern const uint8_t, av1_pt_energy_class[ENTROPY_TOKENS]);
|
||||
|
||||
#define CAT1_MIN_VAL 5
|
||||
#define CAT2_MIN_VAL 7
|
||||
#define CAT3_MIN_VAL 11
|
||||
#define CAT4_MIN_VAL 19
|
||||
#define CAT5_MIN_VAL 35
|
||||
#define CAT6_MIN_VAL 67
|
||||
|
||||
// Extra bit probabilities.
|
||||
DECLARE_ALIGNED(16, extern const uint8_t, av1_cat1_prob[1]);
|
||||
DECLARE_ALIGNED(16, extern const uint8_t, av1_cat2_prob[2]);
|
||||
DECLARE_ALIGNED(16, extern const uint8_t, av1_cat3_prob[3]);
|
||||
DECLARE_ALIGNED(16, extern const uint8_t, av1_cat4_prob[4]);
|
||||
DECLARE_ALIGNED(16, extern const uint8_t, av1_cat5_prob[5]);
|
||||
DECLARE_ALIGNED(16, extern const uint8_t, av1_cat6_prob[18]);
|
||||
#if CONFIG_NEW_MULTISYMBOL
|
||||
extern const aom_cdf_prob *av1_cat1_cdf[];
|
||||
extern const aom_cdf_prob *av1_cat2_cdf[];
|
||||
extern const aom_cdf_prob *av1_cat3_cdf[];
|
||||
extern const aom_cdf_prob *av1_cat4_cdf[];
|
||||
extern const aom_cdf_prob *av1_cat5_cdf[];
|
||||
extern const aom_cdf_prob *av1_cat6_cdf[];
|
||||
#endif
|
||||
|
||||
#define EOB_MODEL_TOKEN 3
|
||||
|
||||
typedef struct {
|
||||
#if CONFIG_NEW_MULTISYMBOL
|
||||
const aom_cdf_prob **cdf;
|
||||
#else
|
||||
const aom_prob *prob;
|
||||
#endif
|
||||
int len;
|
||||
int base_val;
|
||||
const int16_t *cost;
|
||||
} av1_extra_bit;
|
||||
|
||||
// indexed by token value
|
||||
extern const av1_extra_bit av1_extra_bits[ENTROPY_TOKENS];
|
||||
|
||||
static INLINE int av1_get_cat6_extrabits_size(TX_SIZE tx_size,
|
||||
aom_bit_depth_t bit_depth) {
|
||||
tx_size = txsize_sqr_up_map[tx_size];
|
||||
#if CONFIG_TX64X64
|
||||
// TODO(debargha): Does TX_64X64 require an additional extrabit?
|
||||
if (tx_size > TX_32X32) tx_size = TX_32X32;
|
||||
#endif
|
||||
#if CONFIG_CHROMA_2X2
|
||||
int tx_offset = (tx_size < TX_4X4) ? 0 : (int)(tx_size - TX_4X4);
|
||||
#else
|
||||
int tx_offset = (int)(tx_size - TX_4X4);
|
||||
#endif
|
||||
int bits = (int)bit_depth + 3 + tx_offset;
|
||||
#if CONFIG_NEW_MULTISYMBOL
|
||||
// Round up
|
||||
bits = AOMMIN((int)sizeof(av1_cat6_prob), ((bits + 3) & ~3));
|
||||
#endif
|
||||
assert(bits <= (int)sizeof(av1_cat6_prob));
|
||||
return bits;
|
||||
}
|
||||
|
||||
#define DCT_MAX_VALUE 16384
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
#define DCT_MAX_VALUE_HIGH10 65536
|
||||
#define DCT_MAX_VALUE_HIGH12 262144
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
|
||||
/* Coefficients are predicted via a 3-dimensional probability table. */
|
||||
|
||||
/* Coefficients are predicted via a 3-dimensional probability table indexed on
|
||||
* REF_TYPES, COEF_BANDS and COEF_CONTEXTS. */
|
||||
#define REF_TYPES 2 // intra=0, inter=1
|
||||
|
||||
/* Middle dimension reflects the coefficient position within the transform. */
|
||||
#define COEF_BANDS 6
|
||||
|
||||
/* Inside dimension is measure of nearby complexity, that reflects the energy
|
||||
of nearby coefficients are nonzero. For the first coefficient (DC, unless
|
||||
block type is 0), we look at the (already encoded) blocks above and to the
|
||||
left of the current block. The context index is then the number (0,1,or 2)
|
||||
of these blocks having nonzero coefficients.
|
||||
After decoding a coefficient, the measure is determined by the size of the
|
||||
most recently decoded coefficient.
|
||||
Note that the intuitive meaning of this measure changes as coefficients
|
||||
are decoded, e.g., prior to the first token, a zero means that my neighbors
|
||||
are empty while, after the first token, because of the use of end-of-block,
|
||||
a zero means we just decoded a zero and hence guarantees that a non-zero
|
||||
coefficient will appear later in this block. However, this shift
|
||||
in meaning is perfectly OK because our context depends also on the
|
||||
coefficient band (and since zigzag positions 0, 1, and 2 are in
|
||||
distinct bands). */
|
||||
|
||||
#define COEFF_CONTEXTS 6
|
||||
#define COEFF_CONTEXTS0 3 // for band 0
|
||||
#define BAND_COEFF_CONTEXTS(band) \
|
||||
((band) == 0 ? COEFF_CONTEXTS0 : COEFF_CONTEXTS)
|
||||
|
||||
#define SUBEXP_PARAM 4 /* Subexponential code parameter */
|
||||
#define MODULUS_PARAM 13 /* Modulus parameter */
|
||||
|
||||
struct AV1Common;
|
||||
struct frame_contexts;
|
||||
void av1_reset_cdf_symbol_counters(struct frame_contexts *fc);
|
||||
void av1_default_coef_probs(struct AV1Common *cm);
|
||||
#if CONFIG_LV_MAP
|
||||
void av1_adapt_coef_probs(struct AV1Common *cm);
|
||||
#endif // CONFIG_LV_MAP
|
||||
|
||||
// This is the index in the scan order beyond which all coefficients for
|
||||
// 8x8 transform and above are in the top band.
|
||||
// This macro is currently unused but may be used by certain implementations
|
||||
#define MAXBAND_INDEX 21
|
||||
|
||||
DECLARE_ALIGNED(16, extern const uint8_t,
|
||||
av1_coefband_trans_8x8plus[MAX_TX_SQUARE]);
|
||||
DECLARE_ALIGNED(16, extern const uint8_t, av1_coefband_trans_4x8_8x4[32]);
|
||||
DECLARE_ALIGNED(16, extern const uint8_t, av1_coefband_trans_4x4[16]);
|
||||
|
||||
DECLARE_ALIGNED(16, extern const uint16_t, band_count_table[TX_SIZES_ALL][8]);
|
||||
DECLARE_ALIGNED(16, extern const uint16_t,
|
||||
band_cum_count_table[TX_SIZES_ALL][8]);
|
||||
|
||||
static INLINE const uint8_t *get_band_translate(TX_SIZE tx_size) {
|
||||
switch (tx_size) {
|
||||
case TX_4X4: return av1_coefband_trans_4x4;
|
||||
case TX_8X4:
|
||||
case TX_4X8: return av1_coefband_trans_4x8_8x4;
|
||||
default: return av1_coefband_trans_8x8plus;
|
||||
}
|
||||
}
|
||||
|
||||
// 128 lists of probabilities are stored for the following ONE node probs:
|
||||
// 1, 3, 5, 7, ..., 253, 255
|
||||
// In between probabilities are interpolated linearly
|
||||
|
||||
#define COEFF_PROB_MODELS 255
|
||||
|
||||
#define UNCONSTRAINED_NODES 3
|
||||
|
||||
#define MODEL_NODES (ENTROPY_NODES - UNCONSTRAINED_NODES)
|
||||
#define TAIL_NODES (MODEL_NODES + 1)
|
||||
extern const aom_tree_index av1_coef_con_tree[TREE_SIZE(ENTROPY_TOKENS)];
|
||||
extern const aom_prob av1_pareto8_full[COEFF_PROB_MODELS][MODEL_NODES];
|
||||
|
||||
typedef aom_cdf_prob coeff_cdf_model[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS]
|
||||
[CDF_SIZE(ENTROPY_TOKENS)];
|
||||
extern const aom_cdf_prob av1_pareto8_token_probs[COEFF_PROB_MODELS]
|
||||
[ENTROPY_TOKENS - 2];
|
||||
extern const aom_cdf_prob av1_pareto8_tail_probs[COEFF_PROB_MODELS]
|
||||
[ENTROPY_TOKENS - 3];
|
||||
struct frame_contexts;
|
||||
|
||||
void av1_coef_head_cdfs(struct frame_contexts *fc);
|
||||
void av1_coef_pareto_cdfs(struct frame_contexts *fc);
|
||||
|
||||
typedef char ENTROPY_CONTEXT;
|
||||
|
||||
static INLINE int combine_entropy_contexts(ENTROPY_CONTEXT a,
|
||||
|
|
@ -273,93 +87,6 @@ static INLINE int get_entropy_context(TX_SIZE tx_size, const ENTROPY_CONTEXT *a,
|
|||
const ENTROPY_CONTEXT *l) {
|
||||
ENTROPY_CONTEXT above_ec = 0, left_ec = 0;
|
||||
|
||||
#if CONFIG_CHROMA_2X2
|
||||
switch (tx_size) {
|
||||
case TX_2X2:
|
||||
above_ec = a[0] != 0;
|
||||
left_ec = l[0] != 0;
|
||||
break;
|
||||
case TX_4X4:
|
||||
above_ec = !!*(const uint16_t *)a;
|
||||
left_ec = !!*(const uint16_t *)l;
|
||||
break;
|
||||
case TX_4X8:
|
||||
above_ec = !!*(const uint16_t *)a;
|
||||
left_ec = !!*(const uint32_t *)l;
|
||||
break;
|
||||
case TX_8X4:
|
||||
above_ec = !!*(const uint32_t *)a;
|
||||
left_ec = !!*(const uint16_t *)l;
|
||||
break;
|
||||
case TX_8X8:
|
||||
above_ec = !!*(const uint32_t *)a;
|
||||
left_ec = !!*(const uint32_t *)l;
|
||||
break;
|
||||
case TX_8X16:
|
||||
above_ec = !!*(const uint32_t *)a;
|
||||
left_ec = !!*(const uint64_t *)l;
|
||||
break;
|
||||
case TX_16X8:
|
||||
above_ec = !!*(const uint64_t *)a;
|
||||
left_ec = !!*(const uint32_t *)l;
|
||||
break;
|
||||
case TX_16X16:
|
||||
above_ec = !!*(const uint64_t *)a;
|
||||
left_ec = !!*(const uint64_t *)l;
|
||||
break;
|
||||
case TX_16X32:
|
||||
above_ec = !!*(const uint64_t *)a;
|
||||
left_ec = !!(*(const uint64_t *)l | *(const uint64_t *)(l + 8));
|
||||
break;
|
||||
case TX_32X16:
|
||||
above_ec = !!(*(const uint64_t *)a | *(const uint64_t *)(a + 8));
|
||||
left_ec = !!*(const uint64_t *)l;
|
||||
break;
|
||||
case TX_32X32:
|
||||
above_ec = !!(*(const uint64_t *)a | *(const uint64_t *)(a + 8));
|
||||
left_ec = !!(*(const uint64_t *)l | *(const uint64_t *)(l + 8));
|
||||
break;
|
||||
#if CONFIG_TX64X64
|
||||
case TX_64X64:
|
||||
above_ec = !!(*(const uint64_t *)a | *(const uint64_t *)(a + 8) |
|
||||
*(const uint64_t *)(a + 16) | *(const uint64_t *)(a + 24));
|
||||
left_ec = !!(*(const uint64_t *)l | *(const uint64_t *)(l + 8) |
|
||||
*(const uint64_t *)(l + 16) | *(const uint64_t *)(l + 24));
|
||||
break;
|
||||
case TX_32X64:
|
||||
above_ec = !!(*(const uint64_t *)a | *(const uint64_t *)(a + 8));
|
||||
left_ec = !!(*(const uint64_t *)l | *(const uint64_t *)(l + 8) |
|
||||
*(const uint64_t *)(l + 16) | *(const uint64_t *)(l + 24));
|
||||
break;
|
||||
case TX_64X32:
|
||||
above_ec = !!(*(const uint64_t *)a | *(const uint64_t *)(a + 8) |
|
||||
*(const uint64_t *)(a + 16) | *(const uint64_t *)(a + 24));
|
||||
left_ec = !!(*(const uint64_t *)l | *(const uint64_t *)(l + 8));
|
||||
break;
|
||||
#endif // CONFIG_TX64X64
|
||||
#if CONFIG_RECT_TX_EXT && (CONFIG_EXT_TX || CONFIG_VAR_TX)
|
||||
case TX_4X16:
|
||||
above_ec = !!*(const uint16_t *)a;
|
||||
left_ec = !!*(const uint64_t *)l;
|
||||
break;
|
||||
case TX_16X4:
|
||||
above_ec = !!*(const uint64_t *)a;
|
||||
left_ec = !!*(const uint16_t *)l;
|
||||
break;
|
||||
case TX_8X32:
|
||||
above_ec = !!*(const uint32_t *)a;
|
||||
left_ec = !!(*(const uint64_t *)l | *(const uint64_t *)(l + 8));
|
||||
break;
|
||||
case TX_32X8:
|
||||
above_ec = !!(*(const uint64_t *)a | *(const uint64_t *)(a + 8));
|
||||
left_ec = !!*(const uint32_t *)l;
|
||||
break;
|
||||
#endif
|
||||
default: assert(0 && "Invalid transform size."); break;
|
||||
}
|
||||
return combine_entropy_contexts(above_ec, left_ec);
|
||||
#endif // CONFIG_CHROMA_2X2
|
||||
|
||||
switch (tx_size) {
|
||||
case TX_4X4:
|
||||
above_ec = a[0] != 0;
|
||||
|
|
@ -401,7 +128,6 @@ static INLINE int get_entropy_context(TX_SIZE tx_size, const ENTROPY_CONTEXT *a,
|
|||
above_ec = !!*(const uint64_t *)a;
|
||||
left_ec = !!*(const uint64_t *)l;
|
||||
break;
|
||||
#if CONFIG_TX64X64
|
||||
case TX_64X64:
|
||||
above_ec = !!(*(const uint64_t *)a | *(const uint64_t *)(a + 8));
|
||||
left_ec = !!(*(const uint64_t *)l | *(const uint64_t *)(l + 8));
|
||||
|
|
@ -414,8 +140,6 @@ static INLINE int get_entropy_context(TX_SIZE tx_size, const ENTROPY_CONTEXT *a,
|
|||
above_ec = !!(*(const uint64_t *)a | *(const uint64_t *)(a + 8));
|
||||
left_ec = !!*(const uint64_t *)l;
|
||||
break;
|
||||
#endif // CONFIG_TX64X64
|
||||
#if CONFIG_RECT_TX_EXT && (CONFIG_EXT_TX || CONFIG_VAR_TX)
|
||||
case TX_4X16:
|
||||
above_ec = a[0] != 0;
|
||||
left_ec = !!*(const uint32_t *)l;
|
||||
|
|
@ -432,55 +156,24 @@ static INLINE int get_entropy_context(TX_SIZE tx_size, const ENTROPY_CONTEXT *a,
|
|||
above_ec = !!*(const uint64_t *)a;
|
||||
left_ec = !!*(const uint16_t *)l;
|
||||
break;
|
||||
#endif
|
||||
case TX_16X64:
|
||||
above_ec = !!*(const uint32_t *)a;
|
||||
left_ec = !!(*(const uint64_t *)l | *(const uint64_t *)(l + 8));
|
||||
break;
|
||||
case TX_64X16:
|
||||
above_ec = !!(*(const uint64_t *)a | *(const uint64_t *)(a + 8));
|
||||
left_ec = !!*(const uint32_t *)l;
|
||||
break;
|
||||
default: assert(0 && "Invalid transform size."); break;
|
||||
}
|
||||
return combine_entropy_contexts(above_ec, left_ec);
|
||||
}
|
||||
|
||||
#define COEF_COUNT_SAT 24
|
||||
#define COEF_MAX_UPDATE_FACTOR 112
|
||||
#define COEF_COUNT_SAT_AFTER_KEY 24
|
||||
#define COEF_MAX_UPDATE_FACTOR_AFTER_KEY 128
|
||||
|
||||
#if CONFIG_ADAPT_SCAN
|
||||
#define ADAPT_SCAN_PROB_PRECISION 10
|
||||
// 1/8 update rate
|
||||
#define ADAPT_SCAN_UPDATE_LOG_RATE 3
|
||||
#define ADAPT_SCAN_UPDATE_RATE \
|
||||
(1 << (ADAPT_SCAN_PROB_PRECISION - ADAPT_SCAN_UPDATE_LOG_RATE))
|
||||
#endif
|
||||
|
||||
static INLINE aom_prob av1_merge_probs(aom_prob pre_prob,
|
||||
const unsigned int ct[2],
|
||||
unsigned int count_sat,
|
||||
unsigned int max_update_factor) {
|
||||
return merge_probs(pre_prob, ct, count_sat, max_update_factor);
|
||||
static INLINE TX_SIZE get_txsize_entropy_ctx(TX_SIZE txsize) {
|
||||
return (TX_SIZE)((txsize_sqr_map[txsize] + txsize_sqr_up_map[txsize] + 1) >>
|
||||
1);
|
||||
}
|
||||
|
||||
static INLINE aom_prob av1_mode_mv_merge_probs(aom_prob pre_prob,
|
||||
const unsigned int ct[2]) {
|
||||
return mode_mv_merge_probs(pre_prob, ct);
|
||||
}
|
||||
|
||||
void av1_average_tile_coef_cdfs(struct frame_contexts *fc,
|
||||
struct frame_contexts *ec_ctxs[],
|
||||
aom_cdf_prob *cdf_ptrs[], int num_tiles);
|
||||
void av1_average_tile_mv_cdfs(struct frame_contexts *fc,
|
||||
struct frame_contexts *ec_ctxs[],
|
||||
aom_cdf_prob *cdf_ptrs[], int num_tiles);
|
||||
void av1_average_tile_intra_cdfs(struct frame_contexts *fc,
|
||||
struct frame_contexts *ec_ctxs[],
|
||||
aom_cdf_prob *cdf_ptrs[], int num_tiles);
|
||||
void av1_average_tile_inter_cdfs(struct AV1Common *cm,
|
||||
struct frame_contexts *fc,
|
||||
struct frame_contexts *ec_ctxs[],
|
||||
aom_cdf_prob *cdf_ptrs[], int num_tiles);
|
||||
#if CONFIG_PVQ
|
||||
void av1_default_pvq_probs(struct AV1Common *cm);
|
||||
void av1_average_tile_pvq_cdfs(struct frame_contexts *fc,
|
||||
struct frame_contexts *ec_ctxs[], int num_tiles);
|
||||
#endif // CONFIG_PVQ
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
|
|
|||
6750
third_party/aom/av1/common/entropymode.c
vendored
6750
third_party/aom/av1/common/entropymode.c
vendored
File diff suppressed because it is too large
Load diff
661
third_party/aom/av1/common/entropymode.h
vendored
661
third_party/aom/av1/common/entropymode.h
vendored
|
|
@ -18,25 +18,16 @@
|
|||
#include "av1/common/seg_common.h"
|
||||
#include "aom_dsp/aom_filter.h"
|
||||
|
||||
#if CONFIG_PVQ
|
||||
#include "av1/common/pvq.h"
|
||||
#include "av1/common/pvq_state.h"
|
||||
#include "av1/common/generic_code.h"
|
||||
#endif // CONFIG_PVQ
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define BLOCK_SIZE_GROUPS 4
|
||||
|
||||
#define TX_SIZE_CONTEXTS 2
|
||||
#define TX_SIZE_CONTEXTS 3
|
||||
|
||||
#define INTER_OFFSET(mode) ((mode)-NEARESTMV)
|
||||
#if CONFIG_COMPOUND_SINGLEREF
|
||||
#define INTER_SINGLEREF_COMP_OFFSET(mode) ((mode)-SR_NEAREST_NEARMV)
|
||||
#endif // CONFIG_COMPOUND_SINGLEREF
|
||||
#define INTER_COMPOUND_OFFSET(mode) ((mode)-NEAREST_NEARESTMV)
|
||||
#define INTER_COMPOUND_OFFSET(mode) (uint8_t)((mode)-NEAREST_NEARESTMV)
|
||||
|
||||
// Number of possible contexts for a color index.
|
||||
// As can be seen from av1_get_palette_color_index_context(), the possible
|
||||
|
|
@ -44,14 +35,6 @@ extern "C" {
|
|||
// a value from 0 to 4 using 'palette_color_index_context_lookup' table.
|
||||
#define PALETTE_COLOR_INDEX_CONTEXTS 5
|
||||
|
||||
// Maximum number of colors in a palette.
|
||||
#define PALETTE_MAX_SIZE 8
|
||||
// Minimum number of colors in a palette.
|
||||
#define PALETTE_MIN_SIZE 2
|
||||
|
||||
// Palette mode is available for block sizes >= 8x8.
|
||||
#define PALETTE_BLOCK_SIZES (BLOCK_LARGEST - BLOCK_8X8 + 1)
|
||||
|
||||
// Palette Y mode context for a block is determined by number of neighboring
|
||||
// blocks (top and/or left) using a palette for Y plane. So, possible Y mode'
|
||||
// context values are:
|
||||
|
|
@ -66,11 +49,14 @@ extern "C" {
|
|||
// 1 if this block uses palette for Y plane (i.e. Y palette size > 0).
|
||||
#define PALETTE_UV_MODE_CONTEXTS 2
|
||||
|
||||
#define PALETTE_MAX_BLOCK_SIZE (64 * 64)
|
||||
// Map the number of pixels in a block size to a context
|
||||
// 64(BLOCK_8X8, BLOCK_4x16, BLOCK_16X4) -> 0
|
||||
// 128(BLOCK_8X16, BLOCK_16x8) -> 1
|
||||
// ...
|
||||
// 4096(BLOCK_64X64) -> 6
|
||||
#define PALATTE_BSIZE_CTXS 7
|
||||
|
||||
#if CONFIG_KF_CTX
|
||||
#define KF_MODE_CONTEXTS 5
|
||||
#endif
|
||||
|
||||
struct AV1Common;
|
||||
|
||||
|
|
@ -80,643 +66,128 @@ typedef struct {
|
|||
const int16_t *neighbors;
|
||||
} SCAN_ORDER;
|
||||
|
||||
struct seg_counts {
|
||||
unsigned int tree_total[MAX_SEGMENTS];
|
||||
unsigned int tree_mispred[MAX_SEGMENTS];
|
||||
unsigned int pred[PREDICTION_PROBS][2];
|
||||
};
|
||||
|
||||
typedef struct frame_contexts {
|
||||
aom_prob y_mode_prob[BLOCK_SIZE_GROUPS][INTRA_MODES - 1];
|
||||
aom_prob uv_mode_prob[INTRA_MODES][UV_INTRA_MODES - 1];
|
||||
#if CONFIG_EXT_PARTITION_TYPES
|
||||
aom_prob partition_prob[PARTITION_CONTEXTS][EXT_PARTITION_TYPES - 1];
|
||||
#else
|
||||
aom_prob partition_prob[PARTITION_CONTEXTS][PARTITION_TYPES - 1];
|
||||
#endif
|
||||
coeff_cdf_model coef_tail_cdfs[TX_SIZES][PLANE_TYPES];
|
||||
coeff_cdf_model coef_head_cdfs[TX_SIZES][PLANE_TYPES];
|
||||
#if CONFIG_ADAPT_SCAN
|
||||
// TODO(angiebird): try aom_prob
|
||||
#if CONFIG_CHROMA_2X2
|
||||
uint32_t non_zero_prob_2x2[TX_TYPES][4];
|
||||
#endif
|
||||
uint32_t non_zero_prob_4X4[TX_TYPES][16];
|
||||
uint32_t non_zero_prob_8X8[TX_TYPES][64];
|
||||
uint32_t non_zero_prob_16X16[TX_TYPES][256];
|
||||
uint32_t non_zero_prob_32X32[TX_TYPES][1024];
|
||||
|
||||
uint32_t non_zero_prob_4X8[TX_TYPES][32];
|
||||
uint32_t non_zero_prob_8X4[TX_TYPES][32];
|
||||
uint32_t non_zero_prob_16X8[TX_TYPES][128];
|
||||
uint32_t non_zero_prob_8X16[TX_TYPES][128];
|
||||
uint32_t non_zero_prob_32X16[TX_TYPES][512];
|
||||
uint32_t non_zero_prob_16X32[TX_TYPES][512];
|
||||
|
||||
#if CONFIG_CHROMA_2X2
|
||||
DECLARE_ALIGNED(16, int16_t, scan_2x2[TX_TYPES][4]);
|
||||
#endif
|
||||
DECLARE_ALIGNED(16, int16_t, scan_4X4[TX_TYPES][16]);
|
||||
DECLARE_ALIGNED(16, int16_t, scan_8X8[TX_TYPES][64]);
|
||||
DECLARE_ALIGNED(16, int16_t, scan_16X16[TX_TYPES][256]);
|
||||
DECLARE_ALIGNED(16, int16_t, scan_32X32[TX_TYPES][1024]);
|
||||
|
||||
DECLARE_ALIGNED(16, int16_t, scan_4X8[TX_TYPES][32]);
|
||||
DECLARE_ALIGNED(16, int16_t, scan_8X4[TX_TYPES][32]);
|
||||
DECLARE_ALIGNED(16, int16_t, scan_8X16[TX_TYPES][128]);
|
||||
DECLARE_ALIGNED(16, int16_t, scan_16X8[TX_TYPES][128]);
|
||||
DECLARE_ALIGNED(16, int16_t, scan_16X32[TX_TYPES][512]);
|
||||
DECLARE_ALIGNED(16, int16_t, scan_32X16[TX_TYPES][512]);
|
||||
|
||||
#if CONFIG_CHROMA_2X2
|
||||
DECLARE_ALIGNED(16, int16_t, iscan_2x2[TX_TYPES][4]);
|
||||
#endif
|
||||
DECLARE_ALIGNED(16, int16_t, iscan_4X4[TX_TYPES][16]);
|
||||
DECLARE_ALIGNED(16, int16_t, iscan_8X8[TX_TYPES][64]);
|
||||
DECLARE_ALIGNED(16, int16_t, iscan_16X16[TX_TYPES][256]);
|
||||
DECLARE_ALIGNED(16, int16_t, iscan_32X32[TX_TYPES][1024]);
|
||||
|
||||
DECLARE_ALIGNED(16, int16_t, iscan_4X8[TX_TYPES][32]);
|
||||
DECLARE_ALIGNED(16, int16_t, iscan_8X4[TX_TYPES][32]);
|
||||
DECLARE_ALIGNED(16, int16_t, iscan_8X16[TX_TYPES][128]);
|
||||
DECLARE_ALIGNED(16, int16_t, iscan_16X8[TX_TYPES][128]);
|
||||
DECLARE_ALIGNED(16, int16_t, iscan_16X32[TX_TYPES][512]);
|
||||
DECLARE_ALIGNED(16, int16_t, iscan_32X16[TX_TYPES][512]);
|
||||
|
||||
#if CONFIG_CHROMA_2X2
|
||||
int16_t nb_2x2[TX_TYPES][(4 + 1) * 2];
|
||||
#endif
|
||||
int16_t nb_4X4[TX_TYPES][(16 + 1) * 2];
|
||||
int16_t nb_8X8[TX_TYPES][(64 + 1) * 2];
|
||||
int16_t nb_16X16[TX_TYPES][(256 + 1) * 2];
|
||||
int16_t nb_32X32[TX_TYPES][(1024 + 1) * 2];
|
||||
|
||||
int16_t nb_4X8[TX_TYPES][(32 + 1) * 2];
|
||||
int16_t nb_8X4[TX_TYPES][(32 + 1) * 2];
|
||||
int16_t nb_8X16[TX_TYPES][(128 + 1) * 2];
|
||||
int16_t nb_16X8[TX_TYPES][(128 + 1) * 2];
|
||||
int16_t nb_16X32[TX_TYPES][(512 + 1) * 2];
|
||||
int16_t nb_32X16[TX_TYPES][(512 + 1) * 2];
|
||||
|
||||
SCAN_ORDER sc[TX_SIZES_ALL][TX_TYPES];
|
||||
|
||||
int16_t eob_threshold[TX_SIZES_ALL][TX_TYPES][EOB_THRESHOLD_NUM];
|
||||
#endif // CONFIG_ADAPT_SCAN
|
||||
|
||||
#if CONFIG_LV_MAP
|
||||
aom_prob txb_skip[TX_SIZES][TXB_SKIP_CONTEXTS];
|
||||
aom_prob nz_map[TX_SIZES][PLANE_TYPES][SIG_COEF_CONTEXTS];
|
||||
aom_prob eob_flag[TX_SIZES][PLANE_TYPES][EOB_COEF_CONTEXTS];
|
||||
aom_prob dc_sign[PLANE_TYPES][DC_SIGN_CONTEXTS];
|
||||
aom_prob coeff_base[TX_SIZES][PLANE_TYPES][NUM_BASE_LEVELS]
|
||||
[COEFF_BASE_CONTEXTS];
|
||||
aom_prob coeff_lps[TX_SIZES][PLANE_TYPES][LEVEL_CONTEXTS];
|
||||
#if BR_NODE
|
||||
aom_prob coeff_br[TX_SIZES][PLANE_TYPES][BASE_RANGE_SETS][LEVEL_CONTEXTS];
|
||||
#endif
|
||||
#if CONFIG_CTX1D
|
||||
aom_prob eob_mode[TX_SIZES][PLANE_TYPES][TX_CLASSES];
|
||||
aom_prob empty_line[TX_SIZES][PLANE_TYPES][TX_CLASSES][EMPTY_LINE_CONTEXTS];
|
||||
aom_prob hv_eob[TX_SIZES][PLANE_TYPES][TX_CLASSES][HV_EOB_CONTEXTS];
|
||||
#endif // CONFIG_CTX1D
|
||||
|
||||
#if LV_MAP_PROB
|
||||
aom_cdf_prob txb_skip_cdf[TX_SIZES][TXB_SKIP_CONTEXTS][CDF_SIZE(2)];
|
||||
aom_cdf_prob nz_map_cdf[TX_SIZES][PLANE_TYPES][SIG_COEF_CONTEXTS]
|
||||
[CDF_SIZE(2)];
|
||||
aom_cdf_prob eob_flag_cdf[TX_SIZES][PLANE_TYPES][EOB_COEF_CONTEXTS]
|
||||
[CDF_SIZE(2)];
|
||||
aom_cdf_prob dc_sign_cdf[PLANE_TYPES][DC_SIGN_CONTEXTS][CDF_SIZE(2)];
|
||||
aom_cdf_prob coeff_base_cdf[TX_SIZES][PLANE_TYPES][NUM_BASE_LEVELS]
|
||||
[COEFF_BASE_CONTEXTS][CDF_SIZE(2)];
|
||||
aom_cdf_prob coeff_lps_cdf[TX_SIZES][PLANE_TYPES][LEVEL_CONTEXTS]
|
||||
aom_cdf_prob eob_extra_cdf[TX_SIZES][PLANE_TYPES][EOB_COEF_CONTEXTS]
|
||||
[CDF_SIZE(2)];
|
||||
#if BR_NODE
|
||||
aom_cdf_prob coeff_br_cdf[TX_SIZES][PLANE_TYPES][BASE_RANGE_SETS]
|
||||
[LEVEL_CONTEXTS][CDF_SIZE(2)];
|
||||
#endif
|
||||
#if CONFIG_CTX1D
|
||||
aom_cdf_prob eob_mode_cdf[TX_SIZES][PLANE_TYPES][TX_CLASSES][CDF_SIZE(2)];
|
||||
aom_cdf_prob empty_line_cdf[TX_SIZES][PLANE_TYPES][TX_CLASSES]
|
||||
[EMPTY_LINE_CONTEXTS][CDF_SIZE(2)];
|
||||
aom_cdf_prob hv_eob_cdf[TX_SIZES][PLANE_TYPES][TX_CLASSES][HV_EOB_CONTEXTS]
|
||||
[CDF_SIZE(2)];
|
||||
#endif // CONFIG_CTX1D
|
||||
#endif // LV_MAP_PROB
|
||||
#endif
|
||||
aom_cdf_prob dc_sign_cdf[PLANE_TYPES][DC_SIGN_CONTEXTS][CDF_SIZE(2)];
|
||||
aom_cdf_prob eob_flag_cdf16[PLANE_TYPES][2][CDF_SIZE(5)];
|
||||
aom_cdf_prob eob_flag_cdf32[PLANE_TYPES][2][CDF_SIZE(6)];
|
||||
aom_cdf_prob eob_flag_cdf64[PLANE_TYPES][2][CDF_SIZE(7)];
|
||||
aom_cdf_prob eob_flag_cdf128[PLANE_TYPES][2][CDF_SIZE(8)];
|
||||
aom_cdf_prob eob_flag_cdf256[PLANE_TYPES][2][CDF_SIZE(9)];
|
||||
aom_cdf_prob eob_flag_cdf512[PLANE_TYPES][2][CDF_SIZE(10)];
|
||||
aom_cdf_prob eob_flag_cdf1024[PLANE_TYPES][2][CDF_SIZE(11)];
|
||||
aom_cdf_prob coeff_base_eob_cdf[TX_SIZES][PLANE_TYPES][SIG_COEF_CONTEXTS_EOB]
|
||||
[CDF_SIZE(3)];
|
||||
aom_cdf_prob coeff_base_cdf[TX_SIZES][PLANE_TYPES][SIG_COEF_CONTEXTS]
|
||||
[CDF_SIZE(4)];
|
||||
aom_cdf_prob coeff_br_cdf[TX_SIZES][PLANE_TYPES][LEVEL_CONTEXTS]
|
||||
[CDF_SIZE(BR_CDF_SIZE)];
|
||||
|
||||
aom_prob newmv_prob[NEWMV_MODE_CONTEXTS];
|
||||
aom_prob zeromv_prob[ZEROMV_MODE_CONTEXTS];
|
||||
aom_prob refmv_prob[REFMV_MODE_CONTEXTS];
|
||||
aom_prob drl_prob[DRL_MODE_CONTEXTS];
|
||||
#if CONFIG_NEW_MULTISYMBOL
|
||||
aom_cdf_prob newmv_cdf[NEWMV_MODE_CONTEXTS][CDF_SIZE(2)];
|
||||
aom_cdf_prob zeromv_cdf[ZEROMV_MODE_CONTEXTS][CDF_SIZE(2)];
|
||||
aom_cdf_prob zeromv_cdf[GLOBALMV_MODE_CONTEXTS][CDF_SIZE(2)];
|
||||
aom_cdf_prob refmv_cdf[REFMV_MODE_CONTEXTS][CDF_SIZE(2)];
|
||||
aom_cdf_prob drl_cdf[DRL_MODE_CONTEXTS][CDF_SIZE(2)];
|
||||
#endif
|
||||
|
||||
aom_prob inter_compound_mode_probs[INTER_MODE_CONTEXTS]
|
||||
[INTER_COMPOUND_MODES - 1];
|
||||
aom_cdf_prob inter_compound_mode_cdf[INTER_MODE_CONTEXTS]
|
||||
[CDF_SIZE(INTER_COMPOUND_MODES)];
|
||||
#if CONFIG_COMPOUND_SINGLEREF
|
||||
aom_prob inter_singleref_comp_mode_probs[INTER_MODE_CONTEXTS]
|
||||
[INTER_SINGLEREF_COMP_MODES - 1];
|
||||
aom_cdf_prob inter_singleref_comp_mode_cdf[INTER_MODE_CONTEXTS][CDF_SIZE(
|
||||
INTER_SINGLEREF_COMP_MODES)];
|
||||
#endif // CONFIG_COMPOUND_SINGLEREF
|
||||
aom_prob compound_type_prob[BLOCK_SIZES_ALL][COMPOUND_TYPES - 1];
|
||||
#if CONFIG_WEDGE || CONFIG_COMPOUND_SEGMENT
|
||||
aom_cdf_prob compound_type_cdf[BLOCK_SIZES_ALL][CDF_SIZE(COMPOUND_TYPES)];
|
||||
#endif // CONFIG_WEDGE || CONFIG_COMPOUND_SEGMENT
|
||||
#if CONFIG_INTERINTRA
|
||||
aom_prob interintra_prob[BLOCK_SIZE_GROUPS];
|
||||
aom_prob wedge_interintra_prob[BLOCK_SIZES_ALL];
|
||||
aom_prob interintra_mode_prob[BLOCK_SIZE_GROUPS][INTERINTRA_MODES - 1];
|
||||
#if CONFIG_NEW_MULTISYMBOL
|
||||
aom_cdf_prob compound_type_cdf[BLOCK_SIZES_ALL][CDF_SIZE(COMPOUND_TYPES - 1)];
|
||||
aom_cdf_prob wedge_idx_cdf[BLOCK_SIZES_ALL][CDF_SIZE(16)];
|
||||
aom_cdf_prob interintra_cdf[BLOCK_SIZE_GROUPS][CDF_SIZE(2)];
|
||||
aom_cdf_prob wedge_interintra_cdf[BLOCK_SIZES_ALL][CDF_SIZE(2)];
|
||||
#endif
|
||||
aom_cdf_prob interintra_mode_cdf[BLOCK_SIZE_GROUPS]
|
||||
[CDF_SIZE(INTERINTRA_MODES)];
|
||||
#endif // CONFIG_INTERINTRA
|
||||
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
|
||||
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 && CONFIG_MOTION_VAR
|
||||
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_MOTION_VAR && CONFIG_WARPED_MOTION
|
||||
#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
|
||||
aom_cdf_prob obmc_cdf[BLOCK_SIZES_ALL][CDF_SIZE(2)];
|
||||
#endif // CONFIG_NEW_MULTISYMBOL
|
||||
#endif // CONFIG_MOTION_VAR && CONFIG_WARPED_MOTION
|
||||
#endif // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
|
||||
aom_prob intra_inter_prob[INTRA_INTER_CONTEXTS];
|
||||
aom_prob comp_inter_prob[COMP_INTER_CONTEXTS];
|
||||
aom_cdf_prob palette_y_size_cdf[PALETTE_BLOCK_SIZES][CDF_SIZE(PALETTE_SIZES)];
|
||||
aom_cdf_prob palette_uv_size_cdf[PALETTE_BLOCK_SIZES]
|
||||
[CDF_SIZE(PALETTE_SIZES)];
|
||||
aom_cdf_prob palette_y_size_cdf[PALATTE_BSIZE_CTXS][CDF_SIZE(PALETTE_SIZES)];
|
||||
aom_cdf_prob palette_uv_size_cdf[PALATTE_BSIZE_CTXS][CDF_SIZE(PALETTE_SIZES)];
|
||||
aom_cdf_prob palette_y_color_index_cdf[PALETTE_SIZES]
|
||||
[PALETTE_COLOR_INDEX_CONTEXTS]
|
||||
[CDF_SIZE(PALETTE_COLORS)];
|
||||
aom_cdf_prob palette_uv_color_index_cdf[PALETTE_SIZES]
|
||||
[PALETTE_COLOR_INDEX_CONTEXTS]
|
||||
[CDF_SIZE(PALETTE_COLORS)];
|
||||
#if CONFIG_MRC_TX
|
||||
aom_cdf_prob mrc_mask_inter_cdf[PALETTE_SIZES][PALETTE_COLOR_INDEX_CONTEXTS]
|
||||
[CDF_SIZE(PALETTE_COLORS)];
|
||||
aom_cdf_prob mrc_mask_intra_cdf[PALETTE_SIZES][PALETTE_COLOR_INDEX_CONTEXTS]
|
||||
[CDF_SIZE(PALETTE_COLORS)];
|
||||
#endif // CONFIG_MRC_TX
|
||||
#if CONFIG_NEW_MULTISYMBOL
|
||||
aom_cdf_prob palette_y_mode_cdf[PALETTE_BLOCK_SIZES][PALETTE_Y_MODE_CONTEXTS]
|
||||
aom_cdf_prob palette_y_mode_cdf[PALATTE_BSIZE_CTXS][PALETTE_Y_MODE_CONTEXTS]
|
||||
[CDF_SIZE(2)];
|
||||
aom_cdf_prob palette_uv_mode_cdf[PALETTE_UV_MODE_CONTEXTS][CDF_SIZE(2)];
|
||||
aom_cdf_prob comp_inter_cdf[COMP_INTER_CONTEXTS][CDF_SIZE(2)];
|
||||
aom_cdf_prob single_ref_cdf[REF_CONTEXTS][SINGLE_REFS - 1][CDF_SIZE(2)];
|
||||
#endif
|
||||
#if CONFIG_EXT_COMP_REFS
|
||||
aom_prob comp_ref_type_prob[COMP_REF_TYPE_CONTEXTS];
|
||||
aom_prob uni_comp_ref_prob[UNI_COMP_REF_CONTEXTS][UNIDIR_COMP_REFS - 1];
|
||||
#if CONFIG_NEW_MULTISYMBOL
|
||||
aom_cdf_prob comp_ref_type_cdf[COMP_REF_TYPE_CONTEXTS][CDF_SIZE(2)];
|
||||
aom_cdf_prob uni_comp_ref_cdf[UNI_COMP_REF_CONTEXTS][UNIDIR_COMP_REFS - 1]
|
||||
[CDF_SIZE(2)];
|
||||
#endif // CONFIG_NEW_MULTISYMBOL
|
||||
#endif // CONFIG_EXT_COMP_REFS
|
||||
aom_prob single_ref_prob[REF_CONTEXTS][SINGLE_REFS - 1];
|
||||
#if CONFIG_EXT_REFS
|
||||
aom_prob comp_ref_prob[REF_CONTEXTS][FWD_REFS - 1];
|
||||
aom_prob comp_bwdref_prob[REF_CONTEXTS][BWD_REFS - 1];
|
||||
#else
|
||||
aom_prob comp_ref_prob[REF_CONTEXTS][COMP_REFS - 1];
|
||||
#endif // CONFIG_EXT_REFS
|
||||
#if CONFIG_NEW_MULTISYMBOL
|
||||
#if CONFIG_EXT_REFS
|
||||
aom_cdf_prob comp_ref_cdf[REF_CONTEXTS][FWD_REFS - 1][CDF_SIZE(2)];
|
||||
aom_cdf_prob comp_bwdref_cdf[REF_CONTEXTS][BWD_REFS - 1][CDF_SIZE(2)];
|
||||
#else
|
||||
aom_cdf_prob comp_ref_cdf[REF_CONTEXTS][COMP_REFS - 1][CDF_SIZE(2)];
|
||||
#endif // CONFIG_EXT_REFS
|
||||
#endif
|
||||
#if CONFIG_COMPOUND_SINGLEREF
|
||||
aom_prob comp_inter_mode_prob[COMP_INTER_MODE_CONTEXTS];
|
||||
#endif // CONFIG_COMPOUND_SINGLEREF
|
||||
#if CONFIG_RECT_TX_EXT && (CONFIG_EXT_TX || CONFIG_VAR_TX)
|
||||
aom_prob quarter_tx_size_prob;
|
||||
#if CONFIG_NEW_MULTISYMBOL
|
||||
aom_cdf_prob quarter_tx_size_cdf[CDF_SIZE(2)];
|
||||
#endif
|
||||
#endif
|
||||
#if CONFIG_VAR_TX
|
||||
aom_prob txfm_partition_prob[TXFM_PARTITION_CONTEXTS];
|
||||
#if CONFIG_NEW_MULTISYMBOL
|
||||
aom_cdf_prob txfm_partition_cdf[TXFM_PARTITION_CONTEXTS][CDF_SIZE(2)];
|
||||
#endif
|
||||
#endif // CONFIG_VAR_TX
|
||||
aom_prob skip_probs[SKIP_CONTEXTS];
|
||||
#if CONFIG_NEW_MULTISYMBOL
|
||||
aom_cdf_prob compound_index_cdf[COMP_INDEX_CONTEXTS][CDF_SIZE(2)];
|
||||
aom_cdf_prob comp_group_idx_cdf[COMP_GROUP_IDX_CONTEXTS][CDF_SIZE(2)];
|
||||
aom_cdf_prob skip_mode_cdfs[SKIP_CONTEXTS][CDF_SIZE(2)];
|
||||
aom_cdf_prob skip_cdfs[SKIP_CONTEXTS][CDF_SIZE(2)];
|
||||
aom_cdf_prob intra_inter_cdf[INTRA_INTER_CONTEXTS][CDF_SIZE(2)];
|
||||
#endif
|
||||
nmv_context nmvc[NMV_CONTEXTS];
|
||||
#if CONFIG_INTRABC
|
||||
nmv_context nmvc;
|
||||
nmv_context ndvc;
|
||||
aom_cdf_prob intrabc_cdf[CDF_SIZE(2)];
|
||||
#endif
|
||||
int initialized;
|
||||
#if CONFIG_SUPERTX
|
||||
aom_prob supertx_prob[PARTITION_SUPERTX_CONTEXTS][TX_SIZES];
|
||||
#endif // CONFIG_SUPERTX
|
||||
struct segmentation_probs seg;
|
||||
#if CONFIG_EXT_INTRA
|
||||
#if CONFIG_INTRA_INTERP
|
||||
aom_prob intra_filter_probs[INTRA_FILTERS + 1][INTRA_FILTERS - 1];
|
||||
#endif // CONFIG_INTRA_INTERP
|
||||
#endif // CONFIG_EXT_INTRA
|
||||
#if CONFIG_FILTER_INTRA
|
||||
aom_prob filter_intra_probs[PLANE_TYPES];
|
||||
#endif // CONFIG_FILTER_INTRA
|
||||
#if CONFIG_LOOP_RESTORATION
|
||||
aom_prob switchable_restore_prob[RESTORE_SWITCHABLE_TYPES - 1];
|
||||
#endif // CONFIG_LOOP_RESTORATION
|
||||
aom_cdf_prob filter_intra_cdfs[BLOCK_SIZES_ALL][CDF_SIZE(2)];
|
||||
aom_cdf_prob filter_intra_mode_cdf[CDF_SIZE(FILTER_INTRA_MODES)];
|
||||
aom_cdf_prob switchable_restore_cdf[CDF_SIZE(RESTORE_SWITCHABLE_TYPES)];
|
||||
aom_cdf_prob wiener_restore_cdf[CDF_SIZE(2)];
|
||||
aom_cdf_prob sgrproj_restore_cdf[CDF_SIZE(2)];
|
||||
aom_cdf_prob y_mode_cdf[BLOCK_SIZE_GROUPS][CDF_SIZE(INTRA_MODES)];
|
||||
aom_cdf_prob uv_mode_cdf[INTRA_MODES][CDF_SIZE(UV_INTRA_MODES)];
|
||||
#if CONFIG_EXT_PARTITION_TYPES
|
||||
aom_cdf_prob uv_mode_cdf[CFL_ALLOWED_TYPES][INTRA_MODES]
|
||||
[CDF_SIZE(UV_INTRA_MODES)];
|
||||
aom_cdf_prob partition_cdf[PARTITION_CONTEXTS][CDF_SIZE(EXT_PARTITION_TYPES)];
|
||||
#else
|
||||
aom_cdf_prob partition_cdf[PARTITION_CONTEXTS][CDF_SIZE(PARTITION_TYPES)];
|
||||
#endif
|
||||
aom_cdf_prob switchable_interp_cdf[SWITCHABLE_FILTER_CONTEXTS]
|
||||
[CDF_SIZE(SWITCHABLE_FILTERS)];
|
||||
/* kf_y_cdf is discarded after use, so does not require persistent storage.
|
||||
However, we keep it with the other CDFs in this struct since it needs to
|
||||
be copied to each tile to support parallelism just like the others.
|
||||
*/
|
||||
#if CONFIG_KF_CTX
|
||||
/* kf_y_cdf is discarded after use, so does not require persistent storage.
|
||||
However, we keep it with the other CDFs in this struct since it needs to
|
||||
be copied to each tile to support parallelism just like the others.
|
||||
*/
|
||||
aom_cdf_prob kf_y_cdf[KF_MODE_CONTEXTS][KF_MODE_CONTEXTS]
|
||||
[CDF_SIZE(INTRA_MODES)];
|
||||
#else
|
||||
aom_cdf_prob kf_y_cdf[INTRA_MODES][INTRA_MODES][CDF_SIZE(INTRA_MODES)];
|
||||
#endif
|
||||
aom_cdf_prob tx_size_cdf[MAX_TX_DEPTH][TX_SIZE_CONTEXTS]
|
||||
|
||||
aom_cdf_prob angle_delta_cdf[DIRECTIONAL_MODES]
|
||||
[CDF_SIZE(2 * MAX_ANGLE_DELTA + 1)];
|
||||
|
||||
aom_cdf_prob tx_size_cdf[MAX_TX_CATS][TX_SIZE_CONTEXTS]
|
||||
[CDF_SIZE(MAX_TX_DEPTH + 1)];
|
||||
aom_cdf_prob delta_q_cdf[CDF_SIZE(DELTA_Q_PROBS + 1)];
|
||||
#if CONFIG_EXT_DELTA_Q
|
||||
#if CONFIG_LOOPFILTER_LEVEL
|
||||
aom_cdf_prob delta_lf_multi_cdf[FRAME_LF_COUNT][CDF_SIZE(DELTA_LF_PROBS + 1)];
|
||||
#endif // CONFIG_LOOPFILTER_LEVEL
|
||||
aom_cdf_prob delta_lf_cdf[CDF_SIZE(DELTA_LF_PROBS + 1)];
|
||||
#endif
|
||||
#if CONFIG_EXT_TX
|
||||
aom_cdf_prob intra_ext_tx_cdf[EXT_TX_SETS_INTRA][EXT_TX_SIZES][INTRA_MODES]
|
||||
[CDF_SIZE(TX_TYPES)];
|
||||
aom_cdf_prob inter_ext_tx_cdf[EXT_TX_SETS_INTER][EXT_TX_SIZES]
|
||||
[CDF_SIZE(TX_TYPES)];
|
||||
#else
|
||||
aom_cdf_prob intra_ext_tx_cdf[EXT_TX_SIZES][TX_TYPES][CDF_SIZE(TX_TYPES)];
|
||||
aom_cdf_prob inter_ext_tx_cdf[EXT_TX_SIZES][CDF_SIZE(TX_TYPES)];
|
||||
#endif // CONFIG_EXT_TX
|
||||
#if CONFIG_LGT_FROM_PRED
|
||||
aom_prob intra_lgt_prob[LGT_SIZES][INTRA_MODES];
|
||||
aom_prob inter_lgt_prob[LGT_SIZES];
|
||||
#endif // CONFIG_LGT_FROM_PRED
|
||||
#if CONFIG_EXT_INTRA && CONFIG_INTRA_INTERP
|
||||
aom_cdf_prob intra_filter_cdf[INTRA_FILTERS + 1][CDF_SIZE(INTRA_FILTERS)];
|
||||
#endif // CONFIG_EXT_INTRA && CONFIG_INTRA_INTERP
|
||||
aom_prob delta_q_prob[DELTA_Q_PROBS];
|
||||
#if CONFIG_EXT_DELTA_Q
|
||||
#if CONFIG_LOOPFILTER_LEVEL
|
||||
aom_prob delta_lf_multi_prob[FRAME_LF_COUNT][DELTA_LF_PROBS];
|
||||
#endif // CONFIG_LOOPFILTER_LEVEL
|
||||
aom_prob delta_lf_prob[DELTA_LF_PROBS];
|
||||
#endif
|
||||
#if CONFIG_PVQ
|
||||
// TODO(any): If PVQ is enabled, most of coefficient related cdf,
|
||||
// such as coef_cdfs[], coef_tail_cdfs[], and coef_heaf_cdfs[] can be removed.
|
||||
od_adapt_ctx pvq_context;
|
||||
#endif // CONFIG_PVQ
|
||||
#if CONFIG_CFL
|
||||
aom_cdf_prob cfl_sign_cdf[CDF_SIZE(CFL_JOINT_SIGNS)];
|
||||
aom_cdf_prob cfl_alpha_cdf[CFL_ALPHA_CONTEXTS][CDF_SIZE(CFL_ALPHABET_SIZE)];
|
||||
#endif
|
||||
#if CONFIG_LPF_SB
|
||||
aom_cdf_prob lpf_reuse_cdf[LPF_REUSE_CONTEXT][CDF_SIZE(2)];
|
||||
aom_cdf_prob lpf_delta_cdf[LPF_DELTA_CONTEXT][CDF_SIZE(DELTA_RANGE)];
|
||||
aom_cdf_prob lpf_sign_cdf[LPF_REUSE_CONTEXT][LPF_SIGN_CONTEXT][CDF_SIZE(2)];
|
||||
#endif // CONFIG_LPF_SB
|
||||
int initialized;
|
||||
} FRAME_CONTEXT;
|
||||
|
||||
typedef struct FRAME_COUNTS {
|
||||
// Note: This structure should only contain 'unsigned int' fields, or
|
||||
// aggregates built solely from 'unsigned int' fields/elements
|
||||
#if CONFIG_ENTROPY_STATS
|
||||
unsigned int kf_y_mode[INTRA_MODES][INTRA_MODES][INTRA_MODES];
|
||||
unsigned int y_mode[BLOCK_SIZE_GROUPS][INTRA_MODES];
|
||||
unsigned int uv_mode[INTRA_MODES][UV_INTRA_MODES];
|
||||
#endif // CONFIG_ENTROPY_STATS
|
||||
#if CONFIG_EXT_PARTITION_TYPES
|
||||
unsigned int partition[PARTITION_CONTEXTS][EXT_PARTITION_TYPES];
|
||||
#else
|
||||
unsigned int partition[PARTITION_CONTEXTS][PARTITION_TYPES];
|
||||
#endif
|
||||
unsigned int switchable_interp[SWITCHABLE_FILTER_CONTEXTS]
|
||||
[SWITCHABLE_FILTERS];
|
||||
#if CONFIG_ADAPT_SCAN
|
||||
#if CONFIG_CHROMA_2X2
|
||||
unsigned int non_zero_count_2x2[TX_TYPES][4];
|
||||
#endif // CONFIG_CHROMA_2X2
|
||||
unsigned int non_zero_count_4X4[TX_TYPES][16];
|
||||
unsigned int non_zero_count_8X8[TX_TYPES][64];
|
||||
unsigned int non_zero_count_16X16[TX_TYPES][256];
|
||||
unsigned int non_zero_count_32X32[TX_TYPES][1024];
|
||||
|
||||
unsigned int non_zero_count_4x8[TX_TYPES][32];
|
||||
unsigned int non_zero_count_8x4[TX_TYPES][32];
|
||||
unsigned int non_zero_count_8x16[TX_TYPES][128];
|
||||
unsigned int non_zero_count_16x8[TX_TYPES][128];
|
||||
unsigned int non_zero_count_16x32[TX_TYPES][512];
|
||||
unsigned int non_zero_count_32x16[TX_TYPES][512];
|
||||
|
||||
unsigned int txb_count[TX_SIZES_ALL][TX_TYPES];
|
||||
#endif // CONFIG_ADAPT_SCAN
|
||||
|
||||
#if CONFIG_LV_MAP
|
||||
unsigned int txb_skip[TX_SIZES][TXB_SKIP_CONTEXTS][2];
|
||||
unsigned int nz_map[TX_SIZES][PLANE_TYPES][SIG_COEF_CONTEXTS][2];
|
||||
unsigned int eob_flag[TX_SIZES][PLANE_TYPES][EOB_COEF_CONTEXTS][2];
|
||||
unsigned int dc_sign[PLANE_TYPES][DC_SIGN_CONTEXTS][2];
|
||||
unsigned int coeff_base[TX_SIZES][PLANE_TYPES][NUM_BASE_LEVELS]
|
||||
[COEFF_BASE_CONTEXTS][2];
|
||||
unsigned int coeff_lps[TX_SIZES][PLANE_TYPES][LEVEL_CONTEXTS][2];
|
||||
unsigned int coeff_br[TX_SIZES][PLANE_TYPES][BASE_RANGE_SETS][LEVEL_CONTEXTS]
|
||||
[2];
|
||||
#if CONFIG_CTX1D
|
||||
unsigned int eob_mode[TX_SIZES][PLANE_TYPES][TX_CLASSES][2];
|
||||
unsigned int empty_line[TX_SIZES][PLANE_TYPES][TX_CLASSES]
|
||||
[EMPTY_LINE_CONTEXTS][2];
|
||||
unsigned int hv_eob[TX_SIZES][PLANE_TYPES][TX_CLASSES][HV_EOB_CONTEXTS][2];
|
||||
#endif // CONFIG_CTX1D
|
||||
#endif // CONFIG_LV_MAP
|
||||
|
||||
#if CONFIG_SYMBOLRATE
|
||||
unsigned int coeff_num[2]; // 0: zero coeff 1: non-zero coeff
|
||||
unsigned int symbol_num[2]; // 0: entropy symbol 1: non-entropy symbol
|
||||
#endif
|
||||
|
||||
unsigned int newmv_mode[NEWMV_MODE_CONTEXTS][2];
|
||||
unsigned int zeromv_mode[ZEROMV_MODE_CONTEXTS][2];
|
||||
unsigned int refmv_mode[REFMV_MODE_CONTEXTS][2];
|
||||
unsigned int drl_mode[DRL_MODE_CONTEXTS][2];
|
||||
|
||||
unsigned int inter_compound_mode[INTER_MODE_CONTEXTS][INTER_COMPOUND_MODES];
|
||||
#if CONFIG_COMPOUND_SINGLEREF
|
||||
unsigned int inter_singleref_comp_mode[INTER_MODE_CONTEXTS]
|
||||
[INTER_SINGLEREF_COMP_MODES];
|
||||
#endif // CONFIG_COMPOUND_SINGLEREF
|
||||
#if CONFIG_INTERINTRA
|
||||
unsigned int interintra[BLOCK_SIZE_GROUPS][2];
|
||||
unsigned int interintra_mode[BLOCK_SIZE_GROUPS][INTERINTRA_MODES];
|
||||
unsigned int wedge_interintra[BLOCK_SIZES_ALL][2];
|
||||
#endif // CONFIG_INTERINTRA
|
||||
unsigned int compound_interinter[BLOCK_SIZES_ALL][COMPOUND_TYPES];
|
||||
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
|
||||
unsigned int motion_mode[BLOCK_SIZES_ALL][MOTION_MODES];
|
||||
#if CONFIG_NCOBMC_ADAPT_WEIGHT && CONFIG_MOTION_VAR
|
||||
unsigned int ncobmc_mode[ADAPT_OVERLAP_BLOCKS][MAX_NCOBMC_MODES];
|
||||
#endif
|
||||
#if CONFIG_MOTION_VAR && CONFIG_WARPED_MOTION
|
||||
#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];
|
||||
#endif // CONFIG_MOTION_VAR && CONFIG_WARPED_MOTION
|
||||
#endif // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
|
||||
unsigned int intra_inter[INTRA_INTER_CONTEXTS][2];
|
||||
unsigned int comp_inter[COMP_INTER_CONTEXTS][2];
|
||||
#if CONFIG_EXT_COMP_REFS
|
||||
unsigned int comp_ref_type[COMP_REF_TYPE_CONTEXTS][2];
|
||||
unsigned int uni_comp_ref[UNI_COMP_REF_CONTEXTS][UNIDIR_COMP_REFS - 1][2];
|
||||
#endif // CONFIG_EXT_COMP_REFS
|
||||
unsigned int single_ref[REF_CONTEXTS][SINGLE_REFS - 1][2];
|
||||
#if CONFIG_EXT_REFS
|
||||
unsigned int comp_ref[REF_CONTEXTS][FWD_REFS - 1][2];
|
||||
unsigned int comp_bwdref[REF_CONTEXTS][BWD_REFS - 1][2];
|
||||
#else
|
||||
unsigned int comp_ref[REF_CONTEXTS][COMP_REFS - 1][2];
|
||||
#endif // CONFIG_EXT_REFS
|
||||
#if CONFIG_COMPOUND_SINGLEREF
|
||||
unsigned int comp_inter_mode[COMP_INTER_MODE_CONTEXTS][2];
|
||||
#endif // CONFIG_COMPOUND_SINGLEREF
|
||||
// TODO(urvang): Only needed for !CONFIG_VAR_TX case. So can be removed when
|
||||
// CONFIG_VAR_TX flag is removed.
|
||||
unsigned int tx_size[MAX_TX_DEPTH][TX_SIZE_CONTEXTS][MAX_TX_DEPTH + 1];
|
||||
#if CONFIG_RECT_TX_EXT && (CONFIG_EXT_TX || CONFIG_VAR_TX)
|
||||
unsigned int quarter_tx_size[2];
|
||||
#endif
|
||||
#if CONFIG_VAR_TX
|
||||
unsigned int txfm_partition[TXFM_PARTITION_CONTEXTS][2];
|
||||
#endif
|
||||
unsigned int skip[SKIP_CONTEXTS][2];
|
||||
nmv_context_counts mv[NMV_CONTEXTS];
|
||||
#if CONFIG_INTRABC
|
||||
unsigned int intrabc[2];
|
||||
nmv_context_counts dv;
|
||||
#endif
|
||||
#if CONFIG_LGT_FROM_PRED
|
||||
unsigned int intra_lgt[LGT_SIZES][INTRA_MODES][2];
|
||||
unsigned int inter_lgt[LGT_SIZES][2];
|
||||
#endif // CONFIG_LGT_FROM_PRED
|
||||
unsigned int delta_q[DELTA_Q_PROBS][2];
|
||||
#if CONFIG_EXT_DELTA_Q
|
||||
#if CONFIG_LOOPFILTER_LEVEL
|
||||
unsigned int delta_lf_multi[FRAME_LF_COUNT][DELTA_LF_PROBS][2];
|
||||
#endif // CONFIG_LOOPFILTER_LEVEL
|
||||
unsigned int delta_lf[DELTA_LF_PROBS][2];
|
||||
#endif
|
||||
#if CONFIG_EXT_TX && CONFIG_RECT_TX
|
||||
unsigned int tx_size_implied[TX_SIZES][TX_SIZES];
|
||||
#endif // CONFIG_EXT_TX && CONFIG_RECT_TX
|
||||
#if CONFIG_ENTROPY_STATS
|
||||
#if CONFIG_EXT_TX
|
||||
unsigned int inter_ext_tx[EXT_TX_SETS_INTER][EXT_TX_SIZES][TX_TYPES];
|
||||
unsigned int intra_ext_tx[EXT_TX_SETS_INTRA][EXT_TX_SIZES][INTRA_MODES]
|
||||
[TX_TYPES];
|
||||
#else
|
||||
unsigned int intra_ext_tx[EXT_TX_SIZES][TX_TYPES][TX_TYPES];
|
||||
unsigned int inter_ext_tx[EXT_TX_SIZES][TX_TYPES];
|
||||
#endif // CONFIG_EXT_TX
|
||||
#endif // CONFIG_ENTROPY_STATS
|
||||
#if CONFIG_SUPERTX
|
||||
unsigned int supertx[PARTITION_SUPERTX_CONTEXTS][TX_SIZES][2];
|
||||
unsigned int supertx_size[TX_SIZES];
|
||||
#endif // CONFIG_SUPERTX
|
||||
struct seg_counts seg;
|
||||
#if CONFIG_EXT_INTRA
|
||||
#if CONFIG_INTRA_INTERP
|
||||
unsigned int intra_filter[INTRA_FILTERS + 1][INTRA_FILTERS];
|
||||
#endif // CONFIG_INTRA_INTERP
|
||||
#endif // CONFIG_EXT_INTRA
|
||||
#if CONFIG_FILTER_INTRA
|
||||
unsigned int filter_intra[PLANE_TYPES][2];
|
||||
#endif // CONFIG_FILTER_INTRA
|
||||
#if CONFIG_LPF_SB
|
||||
unsigned int lpf_reuse[LPF_REUSE_CONTEXT][2];
|
||||
unsigned int lpf_delta[LPF_DELTA_CONTEXT][DELTA_RANGE];
|
||||
unsigned int lpf_sign[LPF_SIGN_CONTEXT][2];
|
||||
#endif // CONFIG_LPF_SB
|
||||
} FRAME_COUNTS;
|
||||
|
||||
#if CONFIG_KF_CTX
|
||||
extern const aom_cdf_prob default_kf_y_mode_cdf[KF_MODE_CONTEXTS]
|
||||
[KF_MODE_CONTEXTS]
|
||||
[CDF_SIZE(INTRA_MODES)];
|
||||
#else
|
||||
extern const aom_cdf_prob default_kf_y_mode_cdf[INTRA_MODES][INTRA_MODES]
|
||||
[CDF_SIZE(INTRA_MODES)];
|
||||
#endif
|
||||
|
||||
extern const aom_prob av1_default_palette_y_mode_prob[PALETTE_BLOCK_SIZES]
|
||||
[PALETTE_Y_MODE_CONTEXTS];
|
||||
extern const aom_prob
|
||||
av1_default_palette_uv_mode_prob[PALETTE_UV_MODE_CONTEXTS];
|
||||
|
||||
#if CONFIG_EXT_TX
|
||||
static const int av1_ext_tx_ind[EXT_TX_SET_TYPES][TX_TYPES] = {
|
||||
{
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
},
|
||||
{
|
||||
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
},
|
||||
#if CONFIG_MRC_TX
|
||||
{
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
|
||||
},
|
||||
{
|
||||
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
|
||||
},
|
||||
#endif // CONFIG_MRC_TX
|
||||
{
|
||||
1, 3, 4, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
},
|
||||
{
|
||||
1, 5, 6, 4, 0, 0, 0, 0, 0, 0, 2, 3, 0, 0, 0, 0,
|
||||
},
|
||||
{
|
||||
3, 4, 5, 8, 6, 7, 9, 10, 11, 0, 1, 2, 0, 0, 0, 0,
|
||||
},
|
||||
{
|
||||
7, 8, 9, 12, 10, 11, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6,
|
||||
},
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 1, 3, 4, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 1, 5, 6, 4, 0, 0, 0, 0, 0, 0, 2, 3, 0, 0, 0, 0 },
|
||||
{ 3, 4, 5, 8, 6, 7, 9, 10, 11, 0, 1, 2, 0, 0, 0, 0 },
|
||||
{ 7, 8, 9, 12, 10, 11, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6 },
|
||||
};
|
||||
|
||||
static const int av1_ext_tx_inv[EXT_TX_SET_TYPES][TX_TYPES] = {
|
||||
{
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
},
|
||||
{
|
||||
9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
},
|
||||
#if CONFIG_MRC_TX
|
||||
{
|
||||
0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
},
|
||||
{
|
||||
9, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
},
|
||||
#endif // CONFIG_MRC_TX
|
||||
{
|
||||
9, 0, 3, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
},
|
||||
{
|
||||
9, 0, 10, 11, 3, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
},
|
||||
{
|
||||
9, 10, 11, 0, 1, 2, 4, 5, 3, 6, 7, 8, 0, 0, 0, 0,
|
||||
},
|
||||
{
|
||||
9, 10, 11, 12, 13, 14, 15, 0, 1, 2, 4, 5, 3, 6, 7, 8,
|
||||
},
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 9, 0, 3, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 9, 0, 10, 11, 3, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 9, 10, 11, 0, 1, 2, 4, 5, 3, 6, 7, 8, 0, 0, 0, 0 },
|
||||
{ 9, 10, 11, 12, 13, 14, 15, 0, 1, 2, 4, 5, 3, 6, 7, 8 },
|
||||
};
|
||||
#else
|
||||
#if CONFIG_MRC_TX
|
||||
static const int av1_ext_tx_ind[TX_TYPES] = {
|
||||
0, 3, 4, 2, 1,
|
||||
};
|
||||
static const int av1_ext_tx_inv[TX_TYPES] = {
|
||||
0, 4, 3, 1, 2,
|
||||
};
|
||||
#else
|
||||
static const int av1_ext_tx_ind[TX_TYPES] = {
|
||||
0, 2, 3, 1,
|
||||
};
|
||||
static const int av1_ext_tx_inv[TX_TYPES] = {
|
||||
0, 3, 1, 2,
|
||||
};
|
||||
#endif // CONFIG_MRC_TX
|
||||
#endif // CONFIG_EXT_TX
|
||||
|
||||
#if CONFIG_INTERINTRA
|
||||
extern const aom_tree_index
|
||||
av1_interintra_mode_tree[TREE_SIZE(INTERINTRA_MODES)];
|
||||
#endif
|
||||
extern const aom_tree_index
|
||||
av1_inter_compound_mode_tree[TREE_SIZE(INTER_COMPOUND_MODES)];
|
||||
#if CONFIG_COMPOUND_SINGLEREF
|
||||
extern const aom_tree_index
|
||||
av1_inter_singleref_comp_mode_tree[TREE_SIZE(INTER_SINGLEREF_COMP_MODES)];
|
||||
#endif // CONFIG_COMPOUND_SINGLEREF
|
||||
extern const aom_tree_index av1_compound_type_tree[TREE_SIZE(COMPOUND_TYPES)];
|
||||
extern const aom_tree_index av1_partition_tree[TREE_SIZE(PARTITION_TYPES)];
|
||||
#if CONFIG_EXT_PARTITION_TYPES
|
||||
extern const aom_tree_index
|
||||
av1_ext_partition_tree[TREE_SIZE(EXT_PARTITION_TYPES)];
|
||||
#endif
|
||||
extern const aom_tree_index
|
||||
av1_palette_color_index_tree[PALETTE_SIZES][TREE_SIZE(PALETTE_COLORS)];
|
||||
#if CONFIG_EXT_INTRA && CONFIG_INTRA_INTERP
|
||||
extern const aom_tree_index av1_intra_filter_tree[TREE_SIZE(INTRA_FILTERS)];
|
||||
#endif // CONFIG_EXT_INTRA && CONFIG_INTRA_INTERP
|
||||
#if CONFIG_EXT_TX
|
||||
extern const aom_tree_index av1_ext_tx_tree[EXT_TX_SET_TYPES]
|
||||
[TREE_SIZE(TX_TYPES)];
|
||||
#else
|
||||
extern const aom_tree_index av1_ext_tx_tree[TREE_SIZE(TX_TYPES)];
|
||||
#endif // CONFIG_EXT_TX
|
||||
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
|
||||
extern const aom_tree_index av1_motion_mode_tree[TREE_SIZE(MOTION_MODES)];
|
||||
#endif // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
|
||||
#if CONFIG_NCOBMC_ADAPT_WEIGHT
|
||||
extern const aom_tree_index av1_ncobmc_mode_tree[TREE_SIZE(MAX_NCOBMC_MODES)];
|
||||
#if CONFIG_WARPED_MOTION
|
||||
extern const aom_tree_index av1_ncobmc_tree[TREE_SIZE(OBMC_FAMILY_MODES)];
|
||||
#endif // CONFIG_WARPED_MOTION
|
||||
#endif // CONFIG_NCOBMC_ADAPT_WEIGHT
|
||||
#if CONFIG_LOOP_RESTORATION
|
||||
#define RESTORE_NONE_SGRPROJ_PROB 64
|
||||
#define RESTORE_NONE_BILATERAL_PROB 16
|
||||
#define RESTORE_NONE_WIENER_PROB 64
|
||||
#define RESTORE_NONE_DOMAINTXFMRF_PROB 64
|
||||
extern const aom_tree_index
|
||||
av1_switchable_restore_tree[TREE_SIZE(RESTORE_SWITCHABLE_TYPES)];
|
||||
#endif // CONFIG_LOOP_RESTORATION
|
||||
|
||||
void av1_set_default_ref_deltas(int8_t *ref_deltas);
|
||||
void av1_set_default_mode_deltas(int8_t *mode_deltas);
|
||||
void av1_setup_frame_contexts(struct AV1Common *cm);
|
||||
void av1_setup_past_independence(struct AV1Common *cm);
|
||||
|
||||
void av1_adapt_intra_frame_probs(struct AV1Common *cm);
|
||||
void av1_adapt_inter_frame_probs(struct AV1Common *cm);
|
||||
|
||||
static INLINE int av1_ceil_log2(int n) {
|
||||
if (n < 2) return 0;
|
||||
int i = 1, p = 2;
|
||||
while (p < n) {
|
||||
i++;
|
||||
|
|
|
|||
227
third_party/aom/av1/common/entropymv.c
vendored
227
third_party/aom/av1/common/entropymv.c
vendored
|
|
@ -12,100 +12,51 @@
|
|||
#include "av1/common/onyxc_int.h"
|
||||
#include "av1/common/entropymv.h"
|
||||
|
||||
// Integer pel reference mv threshold for use of high-precision 1/8 mv
|
||||
#define COMPANDED_MVREF_THRESH 8
|
||||
|
||||
const aom_tree_index av1_mv_joint_tree[TREE_SIZE(MV_JOINTS)] = {
|
||||
-MV_JOINT_ZERO, 2, -MV_JOINT_HNZVZ, 4, -MV_JOINT_HZVNZ, -MV_JOINT_HNZVNZ
|
||||
};
|
||||
|
||||
/* clang-format off */
|
||||
const aom_tree_index av1_mv_class_tree[TREE_SIZE(MV_CLASSES)] = {
|
||||
-MV_CLASS_0, 2,
|
||||
-MV_CLASS_1, 4,
|
||||
6, 8,
|
||||
-MV_CLASS_2, -MV_CLASS_3,
|
||||
10, 12,
|
||||
-MV_CLASS_4, -MV_CLASS_5,
|
||||
-MV_CLASS_6, 14,
|
||||
16, 18,
|
||||
-MV_CLASS_7, -MV_CLASS_8,
|
||||
-MV_CLASS_9, -MV_CLASS_10,
|
||||
};
|
||||
/* clang-format on */
|
||||
|
||||
const aom_tree_index av1_mv_class0_tree[TREE_SIZE(CLASS0_SIZE)] = {
|
||||
-0, -1,
|
||||
};
|
||||
|
||||
const aom_tree_index av1_mv_fp_tree[TREE_SIZE(MV_FP_SIZE)] = { -0, 2, -1,
|
||||
4, -2, -3 };
|
||||
|
||||
static const nmv_context default_nmv_context = {
|
||||
{ 32, 64, 96 }, // joints
|
||||
{ AOM_ICDF(4096), AOM_ICDF(11264), AOM_ICDF(19328), AOM_ICDF(32768),
|
||||
0 }, // joint_cdf
|
||||
{ AOM_CDF4(4096, 11264, 19328) }, // joints_cdf
|
||||
{ {
|
||||
// Vertical component
|
||||
128, // sign
|
||||
{ 224, 144, 192, 168, 192, 176, 192, 198, 198, 245 }, // class
|
||||
{ AOM_ICDF(28672), AOM_ICDF(30976), AOM_ICDF(31858), AOM_ICDF(32320),
|
||||
AOM_ICDF(32551), AOM_ICDF(32656), AOM_ICDF(32740), AOM_ICDF(32757),
|
||||
AOM_ICDF(32762), AOM_ICDF(32767), AOM_ICDF(32768), 0 }, // class_cdf
|
||||
{ 216 }, // class0
|
||||
{ 136, 140, 148, 160, 176, 192, 224, 234, 234, 240 }, // bits
|
||||
{ { 128, 128, 64 }, { 96, 112, 64 } }, // class0_fp
|
||||
{ 64, 96, 64 }, // fp
|
||||
{ { AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(26624), AOM_ICDF(32768),
|
||||
0 },
|
||||
{ AOM_ICDF(12288), AOM_ICDF(21248), AOM_ICDF(24128), AOM_ICDF(32768),
|
||||
0 } }, // class0_fp_cdf
|
||||
{ AOM_ICDF(8192), AOM_ICDF(17408), AOM_ICDF(21248), AOM_ICDF(32768),
|
||||
0 }, // fp_cdf
|
||||
160, // class0_hp bit
|
||||
128, // hp
|
||||
#if CONFIG_NEW_MULTISYMBOL
|
||||
{ AOM_ICDF(160 * 128), AOM_ICDF(32768), 0 },
|
||||
{ AOM_ICDF(128 * 128), AOM_ICDF(32768), 0 },
|
||||
{ AOM_ICDF(216 * 128), AOM_ICDF(32768), 0 },
|
||||
{ { AOM_ICDF(128 * 196), AOM_ICDF(32768), 0 },
|
||||
{ AOM_ICDF(128 * 198), AOM_ICDF(32768), 0 },
|
||||
{ AOM_ICDF(128 * 208), AOM_ICDF(32768), 0 },
|
||||
{ AOM_ICDF(128 * 224), AOM_ICDF(32768), 0 },
|
||||
{ AOM_ICDF(128 * 245), AOM_ICDF(32768), 0 },
|
||||
{ AOM_ICDF(128 * 240), AOM_ICDF(32768), 0 } }, // bits_cdf
|
||||
#endif
|
||||
{ AOM_CDF11(28672, 30976, 31858, 32320, 32551, 32656, 32740, 32757,
|
||||
32762, 32767) }, // class_cdf // fp
|
||||
{ { AOM_CDF4(16384, 24576, 26624) },
|
||||
{ AOM_CDF4(12288, 21248, 24128) } }, // class0_fp_cdf
|
||||
{ AOM_CDF4(8192, 17408, 21248) }, // fp_cdf
|
||||
{ AOM_CDF2(128 * 128) }, // sign_cdf
|
||||
{ AOM_CDF2(160 * 128) }, // class0_hp_cdf
|
||||
{ AOM_CDF2(128 * 128) }, // hp_cdf
|
||||
{ AOM_CDF2(216 * 128) }, // class0_cdf
|
||||
{ { AOM_CDF2(128 * 136) },
|
||||
{ AOM_CDF2(128 * 140) },
|
||||
{ AOM_CDF2(128 * 148) },
|
||||
{ AOM_CDF2(128 * 160) },
|
||||
{ AOM_CDF2(128 * 176) },
|
||||
{ AOM_CDF2(128 * 192) },
|
||||
{ AOM_CDF2(128 * 224) },
|
||||
{ AOM_CDF2(128 * 234) },
|
||||
{ AOM_CDF2(128 * 234) },
|
||||
{ AOM_CDF2(128 * 240) } }, // bits_cdf
|
||||
},
|
||||
{
|
||||
// Horizontal component
|
||||
128, // sign
|
||||
{ 216, 128, 176, 160, 176, 176, 192, 198, 198, 208 }, // class
|
||||
{ AOM_ICDF(28672), AOM_ICDF(30976), AOM_ICDF(31858), AOM_ICDF(32320),
|
||||
AOM_ICDF(32551), AOM_ICDF(32656), AOM_ICDF(32740), AOM_ICDF(32757),
|
||||
AOM_ICDF(32762), AOM_ICDF(32767), AOM_ICDF(32768), 0 }, // class_cdf
|
||||
{ 208 }, // class0
|
||||
{ 136, 140, 148, 160, 176, 192, 224, 234, 234, 240 }, // bits
|
||||
{ { 128, 128, 64 }, { 96, 112, 64 } }, // class0_fp
|
||||
{ 64, 96, 64 }, // fp
|
||||
{ { AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(26624), AOM_ICDF(32768),
|
||||
0 },
|
||||
{ AOM_ICDF(12288), AOM_ICDF(21248), AOM_ICDF(24128), AOM_ICDF(32768),
|
||||
0 } }, // class0_fp_cdf
|
||||
{ AOM_ICDF(8192), AOM_ICDF(17408), AOM_ICDF(21248), AOM_ICDF(32768),
|
||||
0 }, // fp_cdf
|
||||
160, // class0_hp bit
|
||||
128, // hp
|
||||
#if CONFIG_NEW_MULTISYMBOL
|
||||
{ AOM_ICDF(160 * 128), AOM_ICDF(32768), 0 },
|
||||
{ AOM_ICDF(128 * 128), AOM_ICDF(32768), 0 },
|
||||
{ AOM_ICDF(216 * 128), AOM_ICDF(32768), 0 },
|
||||
{ { AOM_ICDF(128 * 196), AOM_ICDF(32768), 0 },
|
||||
{ AOM_ICDF(128 * 198), AOM_ICDF(32768), 0 },
|
||||
{ AOM_ICDF(128 * 208), AOM_ICDF(32768), 0 },
|
||||
{ AOM_ICDF(128 * 224), AOM_ICDF(32768), 0 },
|
||||
{ AOM_ICDF(128 * 245), AOM_ICDF(32768), 0 },
|
||||
{ AOM_ICDF(128 * 240), AOM_ICDF(32768), 0 } }, // bits_cdf
|
||||
#endif
|
||||
{ AOM_CDF11(28672, 30976, 31858, 32320, 32551, 32656, 32740, 32757,
|
||||
32762, 32767) }, // class_cdf // fp
|
||||
{ { AOM_CDF4(16384, 24576, 26624) },
|
||||
{ AOM_CDF4(12288, 21248, 24128) } }, // class0_fp_cdf
|
||||
{ AOM_CDF4(8192, 17408, 21248) }, // fp_cdf
|
||||
{ AOM_CDF2(128 * 128) }, // sign_cdf
|
||||
{ AOM_CDF2(160 * 128) }, // class0_hp_cdf
|
||||
{ AOM_CDF2(128 * 128) }, // hp_cdf
|
||||
{ AOM_CDF2(216 * 128) }, // class0_cdf
|
||||
{ { AOM_CDF2(128 * 136) },
|
||||
{ AOM_CDF2(128 * 140) },
|
||||
{ AOM_CDF2(128 * 148) },
|
||||
{ AOM_CDF2(128 * 160) },
|
||||
{ AOM_CDF2(128 * 176) },
|
||||
{ AOM_CDF2(128 * 192) },
|
||||
{ AOM_CDF2(128 * 224) },
|
||||
{ AOM_CDF2(128 * 234) },
|
||||
{ AOM_CDF2(128 * 234) },
|
||||
{ AOM_CDF2(128 * 240) } }, // bits_cdf
|
||||
} },
|
||||
};
|
||||
|
||||
|
|
@ -164,104 +115,8 @@ MV_CLASS_TYPE av1_get_mv_class(int z, int *offset) {
|
|||
return c;
|
||||
}
|
||||
|
||||
static void inc_mv_component(int v, nmv_component_counts *comp_counts, int incr,
|
||||
MvSubpelPrecision precision) {
|
||||
int s, z, c, o, d, e, f;
|
||||
assert(v != 0); /* should not be zero */
|
||||
s = v < 0;
|
||||
comp_counts->sign[s] += incr;
|
||||
z = (s ? -v : v) - 1; /* magnitude - 1 */
|
||||
|
||||
c = av1_get_mv_class(z, &o);
|
||||
comp_counts->classes[c] += incr;
|
||||
|
||||
d = (o >> 3); /* int mv data */
|
||||
f = (o >> 1) & 3; /* fractional pel mv data */
|
||||
e = (o & 1); /* high precision mv data */
|
||||
|
||||
if (c == MV_CLASS_0) {
|
||||
comp_counts->class0[d] += incr;
|
||||
#if CONFIG_INTRABC || CONFIG_AMVR
|
||||
if (precision > MV_SUBPEL_NONE)
|
||||
#endif
|
||||
comp_counts->class0_fp[d][f] += incr;
|
||||
if (precision > MV_SUBPEL_LOW_PRECISION) comp_counts->class0_hp[e] += incr;
|
||||
} else {
|
||||
int i;
|
||||
int b = c + CLASS0_BITS - 1; // number of bits
|
||||
for (i = 0; i < b; ++i) comp_counts->bits[i][((d >> i) & 1)] += incr;
|
||||
#if CONFIG_INTRABC || CONFIG_AMVR
|
||||
if (precision > MV_SUBPEL_NONE)
|
||||
#endif
|
||||
comp_counts->fp[f] += incr;
|
||||
if (precision > MV_SUBPEL_LOW_PRECISION) comp_counts->hp[e] += incr;
|
||||
}
|
||||
}
|
||||
|
||||
void av1_inc_mv(const MV *mv, nmv_context_counts *counts,
|
||||
MvSubpelPrecision precision) {
|
||||
if (counts != NULL) {
|
||||
const MV_JOINT_TYPE j = av1_get_mv_joint(mv);
|
||||
++counts->joints[j];
|
||||
|
||||
if (mv_joint_vertical(j))
|
||||
inc_mv_component(mv->row, &counts->comps[0], 1, precision);
|
||||
|
||||
if (mv_joint_horizontal(j))
|
||||
inc_mv_component(mv->col, &counts->comps[1], 1, precision);
|
||||
}
|
||||
}
|
||||
|
||||
void av1_adapt_mv_probs(AV1_COMMON *cm, int allow_hp) {
|
||||
int i, j;
|
||||
int idx;
|
||||
for (idx = 0; idx < NMV_CONTEXTS; ++idx) {
|
||||
nmv_context *nmvc = &cm->fc->nmvc[idx];
|
||||
const nmv_context *pre_nmvc = &cm->pre_fc->nmvc[idx];
|
||||
const nmv_context_counts *counts = &cm->counts.mv[idx];
|
||||
aom_tree_merge_probs(av1_mv_joint_tree, pre_nmvc->joints, counts->joints,
|
||||
nmvc->joints);
|
||||
for (i = 0; i < 2; ++i) {
|
||||
nmv_component *comp = &nmvc->comps[i];
|
||||
const nmv_component *pre_comp = &pre_nmvc->comps[i];
|
||||
const nmv_component_counts *c = &counts->comps[i];
|
||||
|
||||
comp->sign = av1_mode_mv_merge_probs(pre_comp->sign, c->sign);
|
||||
aom_tree_merge_probs(av1_mv_class_tree, pre_comp->classes, c->classes,
|
||||
comp->classes);
|
||||
aom_tree_merge_probs(av1_mv_class0_tree, pre_comp->class0, c->class0,
|
||||
comp->class0);
|
||||
|
||||
for (j = 0; j < MV_OFFSET_BITS; ++j)
|
||||
comp->bits[j] = av1_mode_mv_merge_probs(pre_comp->bits[j], c->bits[j]);
|
||||
#if CONFIG_AMVR
|
||||
if (cm->cur_frame_mv_precision_level == 0) {
|
||||
#endif
|
||||
for (j = 0; j < CLASS0_SIZE; ++j)
|
||||
aom_tree_merge_probs(av1_mv_fp_tree, pre_comp->class0_fp[j],
|
||||
c->class0_fp[j], comp->class0_fp[j]);
|
||||
|
||||
aom_tree_merge_probs(av1_mv_fp_tree, pre_comp->fp, c->fp, comp->fp);
|
||||
|
||||
if (allow_hp) {
|
||||
comp->class0_hp =
|
||||
av1_mode_mv_merge_probs(pre_comp->class0_hp, c->class0_hp);
|
||||
comp->hp = av1_mode_mv_merge_probs(pre_comp->hp, c->hp);
|
||||
}
|
||||
#if CONFIG_AMVR
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void av1_init_mv_probs(AV1_COMMON *cm) {
|
||||
int i;
|
||||
for (i = 0; i < NMV_CONTEXTS; ++i) {
|
||||
// NB: this sets CDFs too
|
||||
cm->fc->nmvc[i] = default_nmv_context;
|
||||
}
|
||||
#if CONFIG_INTRABC
|
||||
// NB: this sets CDFs too
|
||||
cm->fc->nmvc = default_nmv_context;
|
||||
cm->fc->ndvc = default_nmv_context;
|
||||
#endif // CONFIG_INTRABC
|
||||
}
|
||||
|
|
|
|||
52
third_party/aom/av1/common/entropymv.h
vendored
52
third_party/aom/av1/common/entropymv.h
vendored
|
|
@ -12,7 +12,7 @@
|
|||
#ifndef AV1_COMMON_ENTROPYMV_H_
|
||||
#define AV1_COMMON_ENTROPYMV_H_
|
||||
|
||||
#include "./aom_config.h"
|
||||
#include "config/aom_config.h"
|
||||
|
||||
#include "aom_dsp/prob.h"
|
||||
|
||||
|
|
@ -26,8 +26,6 @@ struct AV1Common;
|
|||
|
||||
void av1_init_mv_probs(struct AV1Common *cm);
|
||||
|
||||
void av1_adapt_mv_probs(struct AV1Common *cm, int usehp);
|
||||
|
||||
#define MV_UPDATE_PROB 252
|
||||
|
||||
/* Symbols for coding which components are zero jointly */
|
||||
|
|
@ -66,9 +64,7 @@ typedef enum {
|
|||
#define CLASS0_BITS 1 /* bits at integer precision for class 0 */
|
||||
#define CLASS0_SIZE (1 << CLASS0_BITS)
|
||||
#define MV_OFFSET_BITS (MV_CLASSES + CLASS0_BITS - 2)
|
||||
#if CONFIG_NEW_MULTISYMBOL
|
||||
#define MV_BITS_CONTEXTS 6
|
||||
#endif
|
||||
#define MV_FP_SIZE 4
|
||||
|
||||
#define MV_MAX_BITS (MV_CLASSES + CLASS0_BITS + 2)
|
||||
|
|
@ -76,37 +72,22 @@ typedef enum {
|
|||
#define MV_VALS ((MV_MAX << 1) + 1)
|
||||
|
||||
#define MV_IN_USE_BITS 14
|
||||
#define MV_UPP ((1 << MV_IN_USE_BITS) - 1)
|
||||
#define MV_UPP (1 << MV_IN_USE_BITS)
|
||||
#define MV_LOW (-(1 << MV_IN_USE_BITS))
|
||||
|
||||
extern const aom_tree_index av1_mv_joint_tree[];
|
||||
extern const aom_tree_index av1_mv_class_tree[];
|
||||
extern const aom_tree_index av1_mv_class0_tree[];
|
||||
extern const aom_tree_index av1_mv_fp_tree[];
|
||||
|
||||
typedef struct {
|
||||
aom_prob sign;
|
||||
aom_prob classes[MV_CLASSES - 1];
|
||||
aom_cdf_prob class_cdf[CDF_SIZE(MV_CLASSES)];
|
||||
aom_prob class0[CLASS0_SIZE - 1];
|
||||
aom_prob bits[MV_OFFSET_BITS];
|
||||
aom_prob class0_fp[CLASS0_SIZE][MV_FP_SIZE - 1];
|
||||
aom_prob fp[MV_FP_SIZE - 1];
|
||||
aom_cdf_prob classes_cdf[CDF_SIZE(MV_CLASSES)];
|
||||
aom_cdf_prob class0_fp_cdf[CLASS0_SIZE][CDF_SIZE(MV_FP_SIZE)];
|
||||
aom_cdf_prob fp_cdf[CDF_SIZE(MV_FP_SIZE)];
|
||||
aom_prob class0_hp;
|
||||
aom_prob hp;
|
||||
#if CONFIG_NEW_MULTISYMBOL
|
||||
aom_cdf_prob sign_cdf[CDF_SIZE(2)];
|
||||
aom_cdf_prob class0_hp_cdf[CDF_SIZE(2)];
|
||||
aom_cdf_prob hp_cdf[CDF_SIZE(2)];
|
||||
aom_cdf_prob class0_cdf[CDF_SIZE(CLASS0_SIZE)];
|
||||
aom_cdf_prob bits_cdf[MV_BITS_CONTEXTS][CDF_SIZE(2)];
|
||||
#endif
|
||||
aom_cdf_prob bits_cdf[MV_OFFSET_BITS][CDF_SIZE(2)];
|
||||
} nmv_component;
|
||||
|
||||
typedef struct {
|
||||
aom_prob joints[MV_JOINTS - 1];
|
||||
aom_cdf_prob joint_cdf[CDF_SIZE(MV_JOINTS)];
|
||||
aom_cdf_prob joints_cdf[CDF_SIZE(MV_JOINTS)];
|
||||
nmv_component comps[2];
|
||||
} nmv_context;
|
||||
|
||||
|
|
@ -120,33 +101,12 @@ static INLINE MV_JOINT_TYPE av1_get_mv_joint(const MV *mv) {
|
|||
|
||||
MV_CLASS_TYPE av1_get_mv_class(int z, int *offset);
|
||||
|
||||
typedef struct {
|
||||
unsigned int sign[2];
|
||||
unsigned int classes[MV_CLASSES];
|
||||
unsigned int class0[CLASS0_SIZE];
|
||||
unsigned int bits[MV_OFFSET_BITS][2];
|
||||
unsigned int class0_fp[CLASS0_SIZE][MV_FP_SIZE];
|
||||
unsigned int fp[MV_FP_SIZE];
|
||||
unsigned int class0_hp[2];
|
||||
unsigned int hp[2];
|
||||
} nmv_component_counts;
|
||||
|
||||
typedef struct {
|
||||
unsigned int joints[MV_JOINTS];
|
||||
nmv_component_counts comps[2];
|
||||
} nmv_context_counts;
|
||||
|
||||
typedef enum {
|
||||
#if CONFIG_INTRABC || CONFIG_AMVR
|
||||
MV_SUBPEL_NONE = -1,
|
||||
#endif
|
||||
MV_SUBPEL_LOW_PRECISION = 0,
|
||||
MV_SUBPEL_HIGH_PRECISION,
|
||||
} MvSubpelPrecision;
|
||||
|
||||
void av1_inc_mv(const MV *mv, nmv_context_counts *mvctx,
|
||||
MvSubpelPrecision precision);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
|
|
|||
618
third_party/aom/av1/common/enums.h
vendored
618
third_party/aom/av1/common/enums.h
vendored
|
|
@ -12,7 +12,8 @@
|
|||
#ifndef AV1_COMMON_ENUMS_H_
|
||||
#define AV1_COMMON_ENUMS_H_
|
||||
|
||||
#include "./aom_config.h"
|
||||
#include "config/aom_config.h"
|
||||
|
||||
#include "aom/aom_codec.h"
|
||||
#include "aom/aom_integer.h"
|
||||
|
||||
|
|
@ -22,22 +23,8 @@ extern "C" {
|
|||
|
||||
#undef MAX_SB_SIZE
|
||||
|
||||
#if CONFIG_NCOBMC_ADAPT_WEIGHT
|
||||
#define TWO_MODE
|
||||
#endif
|
||||
|
||||
#if CONFIG_NCOBMC || CONFIG_NCOBMC_ADAPT_WEIGHT
|
||||
#define NC_MODE_INFO 1
|
||||
#else
|
||||
#define NC_MODE_INFO 0
|
||||
#endif
|
||||
|
||||
// Max superblock size
|
||||
#if CONFIG_EXT_PARTITION
|
||||
#define MAX_SB_SIZE_LOG2 7
|
||||
#else
|
||||
#define MAX_SB_SIZE_LOG2 6
|
||||
#endif // CONFIG_EXT_PARTITION
|
||||
#define MAX_SB_SIZE (1 << MAX_SB_SIZE_LOG2)
|
||||
#define MAX_SB_SQUARE (MAX_SB_SIZE * MAX_SB_SIZE)
|
||||
|
||||
|
|
@ -45,11 +32,7 @@ extern "C" {
|
|||
#define MIN_SB_SIZE_LOG2 6
|
||||
|
||||
// Pixels per Mode Info (MI) unit
|
||||
#if CONFIG_CB4X4
|
||||
#define MI_SIZE_LOG2 2
|
||||
#else
|
||||
#define MI_SIZE_LOG2 3
|
||||
#endif
|
||||
#define MI_SIZE (1 << MI_SIZE_LOG2)
|
||||
|
||||
// MI-units per max superblock (MI Block - MIB)
|
||||
|
|
@ -63,73 +46,78 @@ extern "C" {
|
|||
#define MAX_MIB_MASK (MAX_MIB_SIZE - 1)
|
||||
|
||||
// Maximum number of tile rows and tile columns
|
||||
#if CONFIG_EXT_TILE
|
||||
#define MAX_TILE_ROWS 1024
|
||||
#define MAX_TILE_COLS 1024
|
||||
#else
|
||||
#if CONFIG_MAX_TILE
|
||||
#define MAX_TILE_ROWS 64
|
||||
#define MAX_TILE_COLS 64
|
||||
#else
|
||||
#define MAX_TILE_ROWS 4
|
||||
#define MAX_TILE_COLS 64
|
||||
#endif
|
||||
#endif // CONFIG_EXT_TILE
|
||||
|
||||
#if CONFIG_VAR_TX
|
||||
#define MAX_VARTX_DEPTH 2
|
||||
#define SQR_VARTX_DEPTH_INIT 0
|
||||
#define RECT_VARTX_DEPTH_INIT 0
|
||||
#endif
|
||||
|
||||
#define MI_SIZE_64X64 (64 >> MI_SIZE_LOG2)
|
||||
#define MI_SIZE_128X128 (128 >> MI_SIZE_LOG2)
|
||||
|
||||
#define MAX_PALETTE_SQUARE (64 * 64)
|
||||
// Maximum number of colors in a palette.
|
||||
#define PALETTE_MAX_SIZE 8
|
||||
// Minimum number of colors in a palette.
|
||||
#define PALETTE_MIN_SIZE 2
|
||||
|
||||
#define FRAME_OFFSET_BITS 5
|
||||
#define MAX_FRAME_DISTANCE ((1 << FRAME_OFFSET_BITS) - 1)
|
||||
|
||||
#define REF_FRAMES_LOG2 3
|
||||
#define REF_FRAMES (1 << REF_FRAMES_LOG2)
|
||||
|
||||
// 4 scratch frames for the new frames to support a maximum of 4 cores decoding
|
||||
// in parallel, 3 for scaled references on the encoder.
|
||||
// TODO(hkuang): Add ondemand frame buffers instead of hardcoding the number
|
||||
// of framebuffers.
|
||||
// TODO(jkoleszar): These 3 extra references could probably come from the
|
||||
// normal reference pool.
|
||||
#define FRAME_BUFFERS (REF_FRAMES + 7)
|
||||
|
||||
#if CONFIG_LOOPFILTER_LEVEL
|
||||
// 4 frame filter levels: y plane vertical, y plane horizontal,
|
||||
// u plane, and v plane
|
||||
#define FRAME_LF_COUNT 4
|
||||
#define DEFAULT_DELTA_LF_MULTI 0
|
||||
#endif // CONFIG_LOOPFILTER_LEVEL
|
||||
#define MAX_MODE_LF_DELTAS 2
|
||||
|
||||
#if CONFIG_LPF_SB
|
||||
#define LPF_DELTA_BITS 3
|
||||
#define LPF_STEP 2
|
||||
#define DELTA_RANGE (1 << LPF_DELTA_BITS)
|
||||
#define MAX_LPF_OFFSET (LPF_STEP * ((1 << LPF_DELTA_BITS) - 1))
|
||||
#define DIST_PRECISION_BITS 4
|
||||
#define DIST_PRECISION (1 << DIST_PRECISION_BITS) // 16
|
||||
|
||||
#define LPF_REUSE_CONTEXT 2
|
||||
#define LPF_DELTA_CONTEXT DELTA_RANGE
|
||||
#define LPF_SIGN_CONTEXT 2
|
||||
// TODO(chengchen): Temporal flag serve as experimental flag for WIP
|
||||
// bitmask construction.
|
||||
// Shall be removed when bitmask code is completely checkedin
|
||||
#define LOOP_FILTER_BITMASK 0
|
||||
|
||||
// Half of maximum loop filter length (15-tap)
|
||||
#define FILT_BOUNDARY_OFFSET 8
|
||||
#define FILT_BOUNDARY_MI_OFFSET (FILT_BOUNDARY_OFFSET >> MI_SIZE_LOG2)
|
||||
#endif // CONFIG_LPF_SB
|
||||
|
||||
// Bitstream profiles indicated by 2-3 bits in the uncompressed header.
|
||||
// 00: Profile 0. 8-bit 4:2:0 only.
|
||||
// 10: Profile 1. 8-bit 4:4:4, 4:2:2, and 4:4:0.
|
||||
// 01: Profile 2. 10-bit and 12-bit color only, with 4:2:0 sampling.
|
||||
// 110: Profile 3. 10-bit and 12-bit color only, with 4:2:2/4:4:4/4:4:0
|
||||
// sampling.
|
||||
// 111: Undefined profile.
|
||||
#define PROFILE_BITS 3
|
||||
// The following three profiles are currently defined.
|
||||
// Profile 0. 8-bit and 10-bit 4:2:0 and 4:0:0 only.
|
||||
// Profile 1. 8-bit and 10-bit 4:4:4
|
||||
// Profile 2. 8-bit and 10-bit 4:2:2
|
||||
// 12-bit 4:0:0, 4:2:2 and 4:4:4
|
||||
// Since we have three bits for the profiles, it can be extended later.
|
||||
typedef enum BITSTREAM_PROFILE {
|
||||
PROFILE_0,
|
||||
PROFILE_1,
|
||||
PROFILE_2,
|
||||
PROFILE_3,
|
||||
MAX_PROFILES
|
||||
MAX_PROFILES,
|
||||
} BITSTREAM_PROFILE;
|
||||
|
||||
#define LEVEL_MAJOR_BITS 3
|
||||
#define LEVEL_MINOR_BITS 2
|
||||
#define LEVEL_BITS (LEVEL_MAJOR_BITS + LEVEL_MINOR_BITS)
|
||||
|
||||
#define LEVEL_MAJOR_MIN 2
|
||||
#define LEVEL_MAJOR_MAX ((1 << LEVEL_MAJOR_BITS) - 1 + LEVEL_MAJOR_MIN)
|
||||
#define LEVEL_MINOR_MIN 0
|
||||
#define LEVEL_MINOR_MAX ((1 << LEVEL_MINOR_BITS) - 1)
|
||||
|
||||
#define OP_POINTS_CNT_MINUS_1_BITS 5
|
||||
#define OP_POINTS_IDC_BITS 12
|
||||
|
||||
// Note: Some enums use the attribute 'packed' to use smallest possible integer
|
||||
// type, so that we can save memory when they are used in structs/arrays.
|
||||
|
||||
typedef enum ATTRIBUTE_PACKED {
|
||||
#if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8
|
||||
BLOCK_2X2,
|
||||
BLOCK_2X4,
|
||||
BLOCK_4X2,
|
||||
#endif
|
||||
BLOCK_4X4,
|
||||
BLOCK_4X8,
|
||||
BLOCK_8X4,
|
||||
|
|
@ -143,33 +131,29 @@ typedef enum ATTRIBUTE_PACKED {
|
|||
BLOCK_32X64,
|
||||
BLOCK_64X32,
|
||||
BLOCK_64X64,
|
||||
#if CONFIG_EXT_PARTITION
|
||||
BLOCK_64X128,
|
||||
BLOCK_128X64,
|
||||
BLOCK_128X128,
|
||||
#endif // CONFIG_EXT_PARTITION
|
||||
BLOCK_4X16,
|
||||
BLOCK_16X4,
|
||||
BLOCK_8X32,
|
||||
BLOCK_32X8,
|
||||
BLOCK_16X64,
|
||||
BLOCK_64X16,
|
||||
#if CONFIG_EXT_PARTITION
|
||||
BLOCK_32X128,
|
||||
BLOCK_128X32,
|
||||
#endif // CONFIG_EXT_PARTITION
|
||||
BLOCK_SIZES_ALL,
|
||||
BLOCK_SIZES = BLOCK_4X16,
|
||||
BLOCK_INVALID = 255,
|
||||
BLOCK_LARGEST = (BLOCK_SIZES - 1)
|
||||
} BLOCK_SIZE;
|
||||
|
||||
typedef enum {
|
||||
// 4X4, 8X8, 16X16, 32X32, 64X64, 128X128
|
||||
#define SQR_BLOCK_SIZES 6
|
||||
|
||||
typedef enum ATTRIBUTE_PACKED {
|
||||
PARTITION_NONE,
|
||||
PARTITION_HORZ,
|
||||
PARTITION_VERT,
|
||||
PARTITION_SPLIT,
|
||||
#if CONFIG_EXT_PARTITION_TYPES
|
||||
PARTITION_HORZ_A, // HORZ split and the top partition is split again
|
||||
PARTITION_HORZ_B, // HORZ split and the bottom partition is split again
|
||||
PARTITION_VERT_A, // VERT split and the left partition is split again
|
||||
|
|
@ -177,134 +161,104 @@ typedef enum {
|
|||
PARTITION_HORZ_4, // 4:1 horizontal partition
|
||||
PARTITION_VERT_4, // 4:1 vertical partition
|
||||
EXT_PARTITION_TYPES,
|
||||
#endif // CONFIG_EXT_PARTITION_TYPES
|
||||
PARTITION_TYPES = PARTITION_SPLIT + 1,
|
||||
PARTITION_INVALID = 255
|
||||
} PARTITION_TYPE;
|
||||
|
||||
typedef char PARTITION_CONTEXT;
|
||||
#define PARTITION_PLOFFSET 4 // number of probability models per block size
|
||||
#define PARTITION_BLOCK_SIZES (4 + CONFIG_EXT_PARTITION)
|
||||
#define PARTITION_CONTEXTS_PRIMARY (PARTITION_BLOCK_SIZES * PARTITION_PLOFFSET)
|
||||
#if CONFIG_UNPOISON_PARTITION_CTX
|
||||
#define INVALID_PARTITION_CTX (-1)
|
||||
#define PARTITION_CONTEXTS \
|
||||
(PARTITION_CONTEXTS_PRIMARY + 2 * PARTITION_BLOCK_SIZES)
|
||||
#else
|
||||
#define PARTITION_CONTEXTS PARTITION_CONTEXTS_PRIMARY
|
||||
#endif
|
||||
#define PARTITION_BLOCK_SIZES 5
|
||||
#define PARTITION_CONTEXTS (PARTITION_BLOCK_SIZES * PARTITION_PLOFFSET)
|
||||
|
||||
// block transform size
|
||||
#if defined(_MSC_VER)
|
||||
typedef uint8_t TX_SIZE;
|
||||
enum ATTRIBUTE_PACKED {
|
||||
#else
|
||||
typedef enum ATTRIBUTE_PACKED {
|
||||
#if CONFIG_CHROMA_2X2
|
||||
TX_2X2, // 2x2 transform
|
||||
#endif
|
||||
TX_4X4, // 4x4 transform
|
||||
TX_8X8, // 8x8 transform
|
||||
TX_16X16, // 16x16 transform
|
||||
TX_32X32, // 32x32 transform
|
||||
#if CONFIG_TX64X64
|
||||
TX_64X64, // 64x64 transform
|
||||
#endif // CONFIG_TX64X64
|
||||
TX_4X8, // 4x8 transform
|
||||
TX_8X4, // 8x4 transform
|
||||
TX_8X16, // 8x16 transform
|
||||
TX_16X8, // 16x8 transform
|
||||
TX_16X32, // 16x32 transform
|
||||
TX_32X16, // 32x16 transform
|
||||
#if CONFIG_TX64X64
|
||||
TX_4X4, // 4x4 transform
|
||||
TX_8X8, // 8x8 transform
|
||||
TX_16X16, // 16x16 transform
|
||||
TX_32X32, // 32x32 transform
|
||||
TX_64X64, // 64x64 transform
|
||||
TX_4X8, // 4x8 transform
|
||||
TX_8X4, // 8x4 transform
|
||||
TX_8X16, // 8x16 transform
|
||||
TX_16X8, // 16x8 transform
|
||||
TX_16X32, // 16x32 transform
|
||||
TX_32X16, // 32x16 transform
|
||||
TX_32X64, // 32x64 transform
|
||||
TX_64X32, // 64x32 transform
|
||||
#endif // CONFIG_TX64X64
|
||||
TX_4X16, // 4x16 transform
|
||||
TX_16X4, // 16x4 transform
|
||||
TX_8X32, // 8x32 transform
|
||||
TX_32X8, // 32x8 transform
|
||||
TX_16X64, // 16x64 transform
|
||||
TX_64X16, // 64x16 transform
|
||||
TX_SIZES_ALL, // Includes rectangular transforms
|
||||
TX_SIZES = TX_4X8, // Does NOT include rectangular transforms
|
||||
TX_INVALID = 255 // Invalid transform size
|
||||
TX_SIZES_LARGEST = TX_64X64,
|
||||
TX_INVALID = 255 // Invalid transform size
|
||||
#if defined(_MSC_VER)
|
||||
};
|
||||
#else
|
||||
} TX_SIZE;
|
||||
#endif
|
||||
|
||||
#define TX_SIZE_LUMA_MIN (TX_4X4)
|
||||
/* We don't need to code a transform size unless the allowed size is at least
|
||||
one more than the minimum. */
|
||||
#define TX_SIZE_CTX_MIN (TX_SIZE_LUMA_MIN + 1)
|
||||
|
||||
#define MAX_TX_DEPTH (TX_SIZES - TX_SIZE_CTX_MIN)
|
||||
// Maximum tx_size categories
|
||||
#define MAX_TX_CATS (TX_SIZES - TX_SIZE_CTX_MIN)
|
||||
#define MAX_TX_DEPTH 2
|
||||
|
||||
#if CONFIG_CTX1D
|
||||
#define MAX_HVTX_SIZE (1 << 5)
|
||||
#endif // CONFIG_CTX1D
|
||||
|
||||
#define MAX_TX_SIZE_LOG2 (5 + CONFIG_TX64X64)
|
||||
#define MAX_TX_SIZE_LOG2 (6)
|
||||
#define MAX_TX_SIZE (1 << MAX_TX_SIZE_LOG2)
|
||||
#define MIN_TX_SIZE_LOG2 2
|
||||
#define MIN_TX_SIZE (1 << MIN_TX_SIZE_LOG2)
|
||||
#define MAX_TX_SQUARE (MAX_TX_SIZE * MAX_TX_SIZE)
|
||||
|
||||
// Pad 4 extra columns to remove horizontal availability check.
|
||||
#define TX_PAD_HOR_LOG2 2
|
||||
#define TX_PAD_HOR 4
|
||||
// Pad 6 extra rows (2 on top and 4 on bottom) to remove vertical availability
|
||||
// check.
|
||||
#define TX_PAD_TOP 2
|
||||
#define TX_PAD_BOTTOM 4
|
||||
#define TX_PAD_VER (TX_PAD_TOP + TX_PAD_BOTTOM)
|
||||
// Pad 16 extra bytes to avoid reading overflow in SIMD optimization.
|
||||
#define TX_PAD_END 16
|
||||
#define TX_PAD_2D ((32 + TX_PAD_HOR) * (32 + TX_PAD_VER) + TX_PAD_END)
|
||||
|
||||
// Number of maxium size transform blocks in the maximum size superblock
|
||||
#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 {
|
||||
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
|
||||
typedef enum {
|
||||
ONLY_4X4, // only 4x4 transform used
|
||||
ALLOW_8X8, // allow block transform size up to 8x8
|
||||
ALLOW_16X16, // allow block transform size up to 16x16
|
||||
ALLOW_32X32, // allow block transform size up to 32x32
|
||||
#if CONFIG_TX64X64
|
||||
ALLOW_64X64, // allow block transform size up to 64x64
|
||||
#endif
|
||||
TX_MODE_SELECT, // transform specified for each block
|
||||
typedef enum ATTRIBUTE_PACKED {
|
||||
ONLY_4X4, // use only 4x4 transform
|
||||
TX_MODE_LARGEST, // transform size is the largest possible for pu size
|
||||
TX_MODE_SELECT, // transform specified for each block
|
||||
TX_MODES,
|
||||
} TX_MODE;
|
||||
|
||||
// 1D tx types
|
||||
typedef enum {
|
||||
typedef enum ATTRIBUTE_PACKED {
|
||||
DCT_1D,
|
||||
ADST_1D,
|
||||
FLIPADST_1D,
|
||||
IDTX_1D,
|
||||
// TODO(sarahparker) need to eventually put something here for the
|
||||
// mrc experiment to make this work with the ext-tx pruning functions
|
||||
TX_TYPES_1D,
|
||||
} TX_TYPE_1D;
|
||||
|
||||
typedef enum {
|
||||
typedef enum ATTRIBUTE_PACKED {
|
||||
DCT_DCT, // DCT in both horizontal and vertical
|
||||
ADST_DCT, // ADST in vertical, DCT in horizontal
|
||||
DCT_ADST, // DCT in vertical, ADST in horizontal
|
||||
ADST_ADST, // ADST in both directions
|
||||
#if CONFIG_EXT_TX
|
||||
FLIPADST_DCT,
|
||||
DCT_FLIPADST,
|
||||
FLIPADST_FLIPADST,
|
||||
|
|
@ -317,25 +271,26 @@ typedef enum {
|
|||
H_ADST,
|
||||
V_FLIPADST,
|
||||
H_FLIPADST,
|
||||
#endif // CONFIG_EXT_TX
|
||||
#if CONFIG_MRC_TX
|
||||
MRC_DCT, // DCT in both directions with mrc based bitmask
|
||||
#endif // CONFIG_MRC_TX
|
||||
TX_TYPES,
|
||||
} TX_TYPE;
|
||||
|
||||
#if CONFIG_EXT_TX
|
||||
typedef enum {
|
||||
REG_REG,
|
||||
REG_SMOOTH,
|
||||
REG_SHARP,
|
||||
SMOOTH_REG,
|
||||
SMOOTH_SMOOTH,
|
||||
SMOOTH_SHARP,
|
||||
SHARP_REG,
|
||||
SHARP_SMOOTH,
|
||||
SHARP_SHARP,
|
||||
} DUAL_FILTER_TYPE;
|
||||
|
||||
typedef enum ATTRIBUTE_PACKED {
|
||||
// DCT only
|
||||
EXT_TX_SET_DCTONLY,
|
||||
// DCT + Identity only
|
||||
EXT_TX_SET_DCT_IDTX,
|
||||
#if CONFIG_MRC_TX
|
||||
// DCT + MRC_DCT
|
||||
EXT_TX_SET_MRC_DCT,
|
||||
// DCT + MRC_DCT + IDTX
|
||||
EXT_TX_SET_MRC_DCT_IDTX,
|
||||
#endif // CONFIG_MRC_TX
|
||||
// Discrete Trig transforms w/o flip (4) + Identity (1)
|
||||
EXT_TX_SET_DTT4_IDTX,
|
||||
// Discrete Trig transforms w/o flip (4) + Identity (1) + 1D Hor/vert DCT (2)
|
||||
|
|
@ -348,45 +303,13 @@ typedef enum {
|
|||
} TxSetType;
|
||||
|
||||
#define IS_2D_TRANSFORM(tx_type) (tx_type < IDTX)
|
||||
#else
|
||||
#define IS_2D_TRANSFORM(tx_type) 1
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
TILE_LEFT_BOUNDARY = 1,
|
||||
TILE_RIGHT_BOUNDARY = 2,
|
||||
TILE_ABOVE_BOUNDARY = 4,
|
||||
TILE_BOTTOM_BOUNDARY = 8,
|
||||
FRAME_LEFT_BOUNDARY = 16,
|
||||
FRAME_RIGHT_BOUNDARY = 32,
|
||||
FRAME_ABOVE_BOUNDARY = 64,
|
||||
FRAME_BOTTOM_BOUNDARY = 128,
|
||||
} BOUNDARY_TYPE;
|
||||
|
||||
#if CONFIG_EXT_TX
|
||||
#if CONFIG_CHROMA_2X2
|
||||
#define EXT_TX_SIZES 5 // number of sizes that use extended transforms
|
||||
#else
|
||||
#define EXT_TX_SIZES 4 // number of sizes that use extended transforms
|
||||
#endif // CONFIG_CHROMA_2X2
|
||||
#if CONFIG_MRC_TX
|
||||
#define EXT_TX_SETS_INTER 5 // Sets of transform selections for INTER
|
||||
#define EXT_TX_SETS_INTRA 4 // Sets of transform selections for INTRA
|
||||
#else // CONFIG_MRC_TX
|
||||
#define EXT_TX_SIZES 4 // number of sizes that use extended transforms
|
||||
#define EXT_TX_SETS_INTER 4 // Sets of transform selections for INTER
|
||||
#define EXT_TX_SETS_INTRA 3 // Sets of transform selections for INTRA
|
||||
#endif // CONFIG_MRC_TX
|
||||
#else
|
||||
#if CONFIG_CHROMA_2X2
|
||||
#define EXT_TX_SIZES 4 // number of sizes that use extended transforms
|
||||
#else
|
||||
#define EXT_TX_SIZES 3 // number of sizes that use extended transforms
|
||||
#endif
|
||||
#endif // CONFIG_EXT_TX
|
||||
|
||||
typedef enum {
|
||||
typedef enum ATTRIBUTE_PACKED {
|
||||
AOM_LAST_FLAG = 1 << 0,
|
||||
#if CONFIG_EXT_REFS
|
||||
AOM_LAST2_FLAG = 1 << 1,
|
||||
AOM_LAST3_FLAG = 1 << 2,
|
||||
AOM_GOLD_FLAG = 1 << 3,
|
||||
|
|
@ -394,43 +317,45 @@ typedef enum {
|
|||
AOM_ALT2_FLAG = 1 << 5,
|
||||
AOM_ALT_FLAG = 1 << 6,
|
||||
AOM_REFFRAME_ALL = (1 << 7) - 1
|
||||
#else // !CONFIG_EXT_REFS
|
||||
AOM_GOLD_FLAG = 1 << 1,
|
||||
AOM_ALT_FLAG = 1 << 2,
|
||||
AOM_REFFRAME_ALL = (1 << 3) - 1
|
||||
#endif // CONFIG_EXT_REFS
|
||||
} AOM_REFFRAME;
|
||||
|
||||
#if CONFIG_EXT_COMP_REFS
|
||||
#define USE_UNI_COMP_REFS 1
|
||||
|
||||
typedef enum {
|
||||
typedef enum ATTRIBUTE_PACKED {
|
||||
UNIDIR_COMP_REFERENCE,
|
||||
BIDIR_COMP_REFERENCE,
|
||||
COMP_REFERENCE_TYPES,
|
||||
} COMP_REFERENCE_TYPE;
|
||||
#else // !CONFIG_EXT_COMP_REFS
|
||||
#define USE_UNI_COMP_REFS 0
|
||||
#endif // CONFIG_EXT_COMP_REFS
|
||||
|
||||
typedef enum { PLANE_TYPE_Y, PLANE_TYPE_UV, PLANE_TYPES } PLANE_TYPE;
|
||||
typedef enum ATTRIBUTE_PACKED {
|
||||
PLANE_TYPE_Y,
|
||||
PLANE_TYPE_UV,
|
||||
PLANE_TYPES
|
||||
} PLANE_TYPE;
|
||||
|
||||
#if CONFIG_CFL
|
||||
#define CFL_ALPHABET_SIZE_LOG2 4
|
||||
#define CFL_ALPHABET_SIZE (1 << CFL_ALPHABET_SIZE_LOG2)
|
||||
#define CFL_MAGS_SIZE ((2 << CFL_ALPHABET_SIZE_LOG2) + 1)
|
||||
#define CFL_IDX_U(idx) (idx >> CFL_ALPHABET_SIZE_LOG2)
|
||||
#define CFL_IDX_V(idx) (idx & (CFL_ALPHABET_SIZE - 1))
|
||||
|
||||
typedef enum { CFL_PRED_U, CFL_PRED_V, CFL_PRED_PLANES } CFL_PRED_TYPE;
|
||||
typedef enum ATTRIBUTE_PACKED {
|
||||
CFL_PRED_U,
|
||||
CFL_PRED_V,
|
||||
CFL_PRED_PLANES
|
||||
} CFL_PRED_TYPE;
|
||||
|
||||
typedef enum {
|
||||
typedef enum ATTRIBUTE_PACKED {
|
||||
CFL_SIGN_ZERO,
|
||||
CFL_SIGN_NEG,
|
||||
CFL_SIGN_POS,
|
||||
CFL_SIGNS
|
||||
} CFL_SIGN_TYPE;
|
||||
|
||||
typedef enum ATTRIBUTE_PACKED {
|
||||
CFL_DISALLOWED,
|
||||
CFL_ALLOWED,
|
||||
CFL_ALLOWED_TYPES
|
||||
} CFL_ALLOWED_TYPE;
|
||||
|
||||
// CFL_SIGN_ZERO,CFL_SIGN_ZERO is invalid
|
||||
#define CFL_JOINT_SIGNS (CFL_SIGNS * CFL_SIGNS - 1)
|
||||
// CFL_SIGN_U is equivalent to (js + 1) / 3 for js in 0 to 8
|
||||
|
|
@ -445,17 +370,13 @@ typedef enum {
|
|||
// Also, the contexts are symmetric under swapping the planes.
|
||||
#define CFL_CONTEXT_V(js) \
|
||||
(CFL_SIGN_V(js) * CFL_SIGNS + CFL_SIGN_U(js) - CFL_SIGNS)
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
typedef enum ATTRIBUTE_PACKED {
|
||||
PALETTE_MAP,
|
||||
#if CONFIG_MRC_TX
|
||||
MRC_MAP,
|
||||
#endif // CONFIG_MRC_TX
|
||||
COLOR_MAP_TYPES,
|
||||
} COLOR_MAP_TYPE;
|
||||
|
||||
typedef enum {
|
||||
typedef enum ATTRIBUTE_PACKED {
|
||||
TWO_COLORS,
|
||||
THREE_COLORS,
|
||||
FOUR_COLORS,
|
||||
|
|
@ -466,7 +387,7 @@ typedef enum {
|
|||
PALETTE_SIZES
|
||||
} PALETTE_SIZE;
|
||||
|
||||
typedef enum {
|
||||
typedef enum ATTRIBUTE_PACKED {
|
||||
PALETTE_COLOR_ONE,
|
||||
PALETTE_COLOR_TWO,
|
||||
PALETTE_COLOR_THREE,
|
||||
|
|
@ -478,36 +399,26 @@ typedef enum {
|
|||
PALETTE_COLORS
|
||||
} PALETTE_COLOR;
|
||||
|
||||
// Note: All directional predictors must be between V_PRED and D63_PRED (both
|
||||
// Note: All directional predictors must be between V_PRED and D67_PRED (both
|
||||
// inclusive).
|
||||
typedef enum ATTRIBUTE_PACKED {
|
||||
DC_PRED, // Average of above and left pixels
|
||||
V_PRED, // Vertical
|
||||
H_PRED, // Horizontal
|
||||
D45_PRED, // Directional 45 deg = round(arctan(1/1) * 180/pi)
|
||||
D135_PRED, // Directional 135 deg = 180 - 45
|
||||
D117_PRED, // Directional 117 deg = 180 - 63
|
||||
D153_PRED, // Directional 153 deg = 180 - 27
|
||||
D207_PRED, // Directional 207 deg = 180 + 27
|
||||
D63_PRED, // Directional 63 deg = round(arctan(2/1) * 180/pi)
|
||||
SMOOTH_PRED, // Combination of horizontal and vertical interpolation
|
||||
#if CONFIG_SMOOTH_HV
|
||||
DC_PRED, // Average of above and left pixels
|
||||
V_PRED, // Vertical
|
||||
H_PRED, // Horizontal
|
||||
D45_PRED, // Directional 45 degree
|
||||
D135_PRED, // Directional 135 degree
|
||||
D113_PRED, // Directional 113 degree
|
||||
D157_PRED, // Directional 157 degree
|
||||
D203_PRED, // Directional 203 degree
|
||||
D67_PRED, // Directional 67 degree
|
||||
SMOOTH_PRED, // Combination of horizontal and vertical interpolation
|
||||
SMOOTH_V_PRED, // Vertical interpolation
|
||||
SMOOTH_H_PRED, // Horizontal interpolation
|
||||
#endif // CONFIG_SMOOTH_HV
|
||||
TM_PRED, // True-motion
|
||||
PAETH_PRED, // Predict from the direction of smallest gradient
|
||||
NEARESTMV,
|
||||
NEARMV,
|
||||
ZEROMV,
|
||||
GLOBALMV,
|
||||
NEWMV,
|
||||
#if CONFIG_COMPOUND_SINGLEREF
|
||||
// Single ref compound modes
|
||||
SR_NEAREST_NEARMV,
|
||||
// SR_NEAREST_NEWMV,
|
||||
SR_NEAR_NEWMV,
|
||||
SR_ZERO_NEWMV,
|
||||
SR_NEW_NEWMV,
|
||||
#endif // CONFIG_COMPOUND_SINGLEREF
|
||||
// Compound ref compound modes
|
||||
NEAREST_NEARESTMV,
|
||||
NEAR_NEARMV,
|
||||
|
|
@ -515,175 +426,131 @@ typedef enum ATTRIBUTE_PACKED {
|
|||
NEW_NEARESTMV,
|
||||
NEAR_NEWMV,
|
||||
NEW_NEARMV,
|
||||
ZERO_ZEROMV,
|
||||
GLOBAL_GLOBALMV,
|
||||
NEW_NEWMV,
|
||||
MB_MODE_COUNT,
|
||||
INTRA_MODES = TM_PRED + 1, // TM_PRED has to be the last intra mode.
|
||||
INTRA_MODE_START = DC_PRED,
|
||||
INTRA_MODE_END = NEARESTMV,
|
||||
INTRA_MODE_NUM = INTRA_MODE_END - INTRA_MODE_START,
|
||||
SINGLE_INTER_MODE_START = NEARESTMV,
|
||||
SINGLE_INTER_MODE_END = NEAREST_NEARESTMV,
|
||||
SINGLE_INTER_MODE_NUM = SINGLE_INTER_MODE_END - SINGLE_INTER_MODE_START,
|
||||
COMP_INTER_MODE_START = NEAREST_NEARESTMV,
|
||||
COMP_INTER_MODE_END = MB_MODE_COUNT,
|
||||
COMP_INTER_MODE_NUM = COMP_INTER_MODE_END - COMP_INTER_MODE_START,
|
||||
INTRA_MODES = PAETH_PRED + 1, // PAETH_PRED has to be the last intra mode.
|
||||
INTRA_INVALID = MB_MODE_COUNT // For uv_mode in inter blocks
|
||||
} PREDICTION_MODE;
|
||||
|
||||
#if CONFIG_CFL
|
||||
// TODO(ltrudeau) Do we really want to pack this?
|
||||
// TODO(ltrudeau) Do we match with PREDICTION_MODE?
|
||||
typedef enum ATTRIBUTE_PACKED {
|
||||
UV_DC_PRED, // Average of above and left pixels
|
||||
UV_V_PRED, // Vertical
|
||||
UV_H_PRED, // Horizontal
|
||||
UV_D45_PRED, // Directional 45 deg = round(arctan(1/1) * 180/pi)
|
||||
UV_D135_PRED, // Directional 135 deg = 180 - 45
|
||||
UV_D117_PRED, // Directional 117 deg = 180 - 63
|
||||
UV_D153_PRED, // Directional 153 deg = 180 - 27
|
||||
UV_D207_PRED, // Directional 207 deg = 180 + 27
|
||||
UV_D63_PRED, // Directional 63 deg = round(arctan(2/1) * 180/pi)
|
||||
UV_SMOOTH_PRED, // Combination of horizontal and vertical interpolation
|
||||
#if CONFIG_SMOOTH_HV
|
||||
UV_DC_PRED, // Average of above and left pixels
|
||||
UV_V_PRED, // Vertical
|
||||
UV_H_PRED, // Horizontal
|
||||
UV_D45_PRED, // Directional 45 degree
|
||||
UV_D135_PRED, // Directional 135 degree
|
||||
UV_D113_PRED, // Directional 113 degree
|
||||
UV_D157_PRED, // Directional 157 degree
|
||||
UV_D203_PRED, // Directional 203 degree
|
||||
UV_D67_PRED, // Directional 67 degree
|
||||
UV_SMOOTH_PRED, // Combination of horizontal and vertical interpolation
|
||||
UV_SMOOTH_V_PRED, // Vertical interpolation
|
||||
UV_SMOOTH_H_PRED, // Horizontal interpolation
|
||||
#endif // CONFIG_SMOOTH_HV
|
||||
UV_TM_PRED, // True-motion
|
||||
UV_PAETH_PRED, // Predict from the direction of smallest gradient
|
||||
UV_CFL_PRED, // Chroma-from-Luma
|
||||
UV_INTRA_MODES,
|
||||
UV_MODE_INVALID, // For uv_mode in inter blocks
|
||||
} UV_PREDICTION_MODE;
|
||||
#else
|
||||
#define UV_INTRA_MODES (INTRA_MODES)
|
||||
#define UV_PREDICTION_MODE PREDICTION_MODE
|
||||
#define UV_DC_PRED (DC_PRED)
|
||||
#define UV_MODE_INVALID (INTRA_INVALID)
|
||||
#endif // CONFIG_CFL
|
||||
|
||||
typedef enum {
|
||||
typedef enum ATTRIBUTE_PACKED {
|
||||
SIMPLE_TRANSLATION,
|
||||
#if CONFIG_MOTION_VAR
|
||||
OBMC_CAUSAL, // 2-sided OBMC
|
||||
#if CONFIG_NCOBMC_ADAPT_WEIGHT
|
||||
NCOBMC_ADAPT_WEIGHT,
|
||||
#endif // CONFIG_NCOBMC_ADAPT_WEIGHT
|
||||
#endif // CONFIG_MOTION_VAR
|
||||
#if CONFIG_WARPED_MOTION
|
||||
OBMC_CAUSAL, // 2-sided OBMC
|
||||
WARPED_CAUSAL, // 2-sided WARPED
|
||||
#endif // CONFIG_WARPED_MOTION
|
||||
MOTION_MODES
|
||||
#if CONFIG_NCOBMC_ADAPT_WEIGHT && CONFIG_WARPED_MOTION
|
||||
,
|
||||
OBMC_FAMILY_MODES = NCOBMC_ADAPT_WEIGHT + 1
|
||||
#endif
|
||||
} MOTION_MODE;
|
||||
|
||||
#if CONFIG_INTERINTRA
|
||||
typedef enum {
|
||||
typedef enum ATTRIBUTE_PACKED {
|
||||
II_DC_PRED,
|
||||
II_V_PRED,
|
||||
II_H_PRED,
|
||||
II_SMOOTH_PRED,
|
||||
INTERINTRA_MODES
|
||||
} INTERINTRA_MODE;
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
COMPOUND_AVERAGE,
|
||||
#if CONFIG_WEDGE
|
||||
COMPOUND_WEDGE,
|
||||
#endif // CONFIG_WEDGE
|
||||
#if CONFIG_COMPOUND_SEGMENT
|
||||
COMPOUND_SEG,
|
||||
#endif // CONFIG_COMPOUND_SEGMENT
|
||||
COMPOUND_DIFFWTD,
|
||||
COMPOUND_TYPES,
|
||||
} COMPOUND_TYPE;
|
||||
|
||||
// TODO(huisu): Consider adding FILTER_SMOOTH_PRED to "FILTER_INTRA_MODE".
|
||||
#if CONFIG_FILTER_INTRA
|
||||
typedef enum {
|
||||
typedef enum ATTRIBUTE_PACKED {
|
||||
FILTER_DC_PRED,
|
||||
FILTER_V_PRED,
|
||||
FILTER_H_PRED,
|
||||
FILTER_D45_PRED,
|
||||
FILTER_D135_PRED,
|
||||
FILTER_D117_PRED,
|
||||
FILTER_D153_PRED,
|
||||
FILTER_D207_PRED,
|
||||
FILTER_D63_PRED,
|
||||
FILTER_TM_PRED,
|
||||
FILTER_D157_PRED,
|
||||
FILTER_PAETH_PRED,
|
||||
FILTER_INTRA_MODES,
|
||||
} FILTER_INTRA_MODE;
|
||||
#endif // CONFIG_FILTER_INTRA
|
||||
|
||||
#if CONFIG_EXT_INTRA
|
||||
#define DIRECTIONAL_MODES 8
|
||||
#endif // CONFIG_EXT_INTRA
|
||||
#define MAX_ANGLE_DELTA 3
|
||||
#define ANGLE_STEP 3
|
||||
|
||||
#define INTER_MODES (1 + NEWMV - NEARESTMV)
|
||||
|
||||
#if CONFIG_COMPOUND_SINGLEREF
|
||||
#define INTER_SINGLEREF_COMP_MODES (1 + SR_NEW_NEWMV - SR_NEAREST_NEARMV)
|
||||
#endif // CONFIG_COMPOUND_SINGLEREF
|
||||
|
||||
#define INTER_COMPOUND_MODES (1 + NEW_NEWMV - NEAREST_NEARESTMV)
|
||||
|
||||
#define SKIP_CONTEXTS 3
|
||||
#define SKIP_MODE_CONTEXTS 3
|
||||
|
||||
#define COMP_INDEX_CONTEXTS 6
|
||||
#define COMP_GROUP_IDX_CONTEXTS 6
|
||||
|
||||
#define NMV_CONTEXTS 3
|
||||
|
||||
#define NEWMV_MODE_CONTEXTS 7
|
||||
#define ZEROMV_MODE_CONTEXTS 2
|
||||
#define REFMV_MODE_CONTEXTS 9
|
||||
#define DRL_MODE_CONTEXTS 5
|
||||
#define NEWMV_MODE_CONTEXTS 6
|
||||
#define GLOBALMV_MODE_CONTEXTS 2
|
||||
#define REFMV_MODE_CONTEXTS 6
|
||||
#define DRL_MODE_CONTEXTS 3
|
||||
|
||||
#define ZEROMV_OFFSET 3
|
||||
#define GLOBALMV_OFFSET 3
|
||||
#define REFMV_OFFSET 4
|
||||
|
||||
#define NEWMV_CTX_MASK ((1 << ZEROMV_OFFSET) - 1)
|
||||
#define ZEROMV_CTX_MASK ((1 << (REFMV_OFFSET - ZEROMV_OFFSET)) - 1)
|
||||
#define NEWMV_CTX_MASK ((1 << GLOBALMV_OFFSET) - 1)
|
||||
#define GLOBALMV_CTX_MASK ((1 << (REFMV_OFFSET - GLOBALMV_OFFSET)) - 1)
|
||||
#define REFMV_CTX_MASK ((1 << (8 - REFMV_OFFSET)) - 1)
|
||||
|
||||
#define ALL_ZERO_FLAG_OFFSET 8
|
||||
#define SKIP_NEARESTMV_OFFSET 9
|
||||
#define SKIP_NEARMV_OFFSET 10
|
||||
#define SKIP_NEARESTMV_SUB8X8_OFFSET 11
|
||||
#define COMP_NEWMV_CTXS 5
|
||||
#define INTER_MODE_CONTEXTS 8
|
||||
|
||||
#define INTER_MODE_CONTEXTS 7
|
||||
#define DELTA_Q_SMALL 3
|
||||
#define DELTA_Q_PROBS (DELTA_Q_SMALL)
|
||||
#define DEFAULT_DELTA_Q_RES 4
|
||||
#if CONFIG_EXT_DELTA_Q
|
||||
#define DELTA_LF_SMALL 3
|
||||
#define DELTA_LF_PROBS (DELTA_LF_SMALL)
|
||||
#define DEFAULT_DELTA_LF_RES 2
|
||||
#endif
|
||||
|
||||
/* Segment Feature Masks */
|
||||
#define MAX_MV_REF_CANDIDATES 2
|
||||
|
||||
#define MAX_REF_MV_STACK_SIZE 16
|
||||
#if CONFIG_EXT_PARTITION
|
||||
#define MAX_REF_MV_STACK_SIZE 8
|
||||
#define REF_CAT_LEVEL 640
|
||||
#else
|
||||
#define REF_CAT_LEVEL 255
|
||||
#endif // CONFIG_EXT_PARTITION
|
||||
|
||||
#define INTRA_INTER_CONTEXTS 4
|
||||
#define COMP_INTER_CONTEXTS 5
|
||||
#define REF_CONTEXTS 5
|
||||
#define REF_CONTEXTS 3
|
||||
|
||||
#if CONFIG_EXT_COMP_REFS
|
||||
#define COMP_REF_TYPE_CONTEXTS 5
|
||||
#define UNI_COMP_REF_CONTEXTS 3
|
||||
#endif // CONFIG_EXT_COMP_REFS
|
||||
|
||||
#if CONFIG_COMPOUND_SINGLEREF
|
||||
#define COMP_INTER_MODE_CONTEXTS 4
|
||||
#endif // CONFIG_COMPOUND_SINGLEREF
|
||||
|
||||
#if CONFIG_VAR_TX
|
||||
#define TXFM_PARTITION_CONTEXTS ((TX_SIZES - TX_8X8) * 6 - 2)
|
||||
#define TXFM_PARTITION_CONTEXTS ((TX_SIZES - TX_8X8) * 6 - 3)
|
||||
typedef uint8_t TXFM_CONTEXT;
|
||||
#endif
|
||||
|
||||
#define NONE_FRAME -1
|
||||
#define INTRA_FRAME 0
|
||||
#define LAST_FRAME 1
|
||||
|
||||
#if CONFIG_EXT_REFS
|
||||
#define LAST2_FRAME 2
|
||||
#define LAST3_FRAME 3
|
||||
#define GOLDEN_FRAME 4
|
||||
|
|
@ -691,94 +558,55 @@ typedef uint8_t TXFM_CONTEXT;
|
|||
#define ALTREF2_FRAME 6
|
||||
#define ALTREF_FRAME 7
|
||||
#define LAST_REF_FRAMES (LAST3_FRAME - LAST_FRAME + 1)
|
||||
#else // !CONFIG_EXT_REFS
|
||||
#define GOLDEN_FRAME 2
|
||||
#define ALTREF_FRAME 3
|
||||
#endif // CONFIG_EXT_REFS
|
||||
|
||||
#define INTER_REFS_PER_FRAME (ALTREF_FRAME - LAST_FRAME + 1)
|
||||
#define TOTAL_REFS_PER_FRAME (ALTREF_FRAME - INTRA_FRAME + 1)
|
||||
|
||||
#define FWD_REFS (GOLDEN_FRAME - LAST_FRAME + 1)
|
||||
#define FWD_RF_OFFSET(ref) (ref - LAST_FRAME)
|
||||
#if CONFIG_EXT_REFS
|
||||
#define BWD_REFS (ALTREF_FRAME - BWDREF_FRAME + 1)
|
||||
#define BWD_RF_OFFSET(ref) (ref - BWDREF_FRAME)
|
||||
#else
|
||||
#define BWD_REFS 1
|
||||
#define BWD_RF_OFFSET(ref) (ref - ALTREF_FRAME)
|
||||
#endif // CONFIG_EXT_REFS
|
||||
|
||||
#define SINGLE_REFS (FWD_REFS + BWD_REFS)
|
||||
#if CONFIG_EXT_COMP_REFS
|
||||
typedef enum {
|
||||
LAST_LAST2_FRAMES, // { LAST_FRAME, LAST2_FRAME }
|
||||
LAST_LAST3_FRAMES, // { LAST_FRAME, LAST3_FRAME }
|
||||
LAST_GOLDEN_FRAMES, // { LAST_FRAME, GOLDEN_FRAME }
|
||||
BWDREF_ALTREF_FRAMES, // { BWDREF_FRAME, ALTREF_FRAME }
|
||||
UNIDIR_COMP_REFS
|
||||
|
||||
typedef enum ATTRIBUTE_PACKED {
|
||||
LAST_LAST2_FRAMES, // { LAST_FRAME, LAST2_FRAME }
|
||||
LAST_LAST3_FRAMES, // { LAST_FRAME, LAST3_FRAME }
|
||||
LAST_GOLDEN_FRAMES, // { LAST_FRAME, GOLDEN_FRAME }
|
||||
BWDREF_ALTREF_FRAMES, // { BWDREF_FRAME, ALTREF_FRAME }
|
||||
LAST2_LAST3_FRAMES, // { LAST2_FRAME, LAST3_FRAME }
|
||||
LAST2_GOLDEN_FRAMES, // { LAST2_FRAME, GOLDEN_FRAME }
|
||||
LAST3_GOLDEN_FRAMES, // { LAST3_FRAME, GOLDEN_FRAME }
|
||||
BWDREF_ALTREF2_FRAMES, // { BWDREF_FRAME, ALTREF2_FRAME }
|
||||
ALTREF2_ALTREF_FRAMES, // { ALTREF2_FRAME, ALTREF_FRAME }
|
||||
TOTAL_UNIDIR_COMP_REFS,
|
||||
// NOTE: UNIDIR_COMP_REFS is the number of uni-directional reference pairs
|
||||
// that are explicitly signaled.
|
||||
UNIDIR_COMP_REFS = BWDREF_ALTREF_FRAMES + 1,
|
||||
} UNIDIR_COMP_REF;
|
||||
|
||||
#define TOTAL_COMP_REFS (FWD_REFS * BWD_REFS + TOTAL_UNIDIR_COMP_REFS)
|
||||
|
||||
#define COMP_REFS (FWD_REFS * BWD_REFS + UNIDIR_COMP_REFS)
|
||||
#else // !CONFIG_EXT_COMP_REFS
|
||||
#define COMP_REFS (FWD_REFS * BWD_REFS)
|
||||
#endif // CONFIG_EXT_COMP_REFS
|
||||
|
||||
#define MODE_CTX_REF_FRAMES (TOTAL_REFS_PER_FRAME + COMP_REFS)
|
||||
// NOTE: A limited number of unidirectional reference pairs can be signalled for
|
||||
// compound prediction. The use of skip mode, on the other hand, makes it
|
||||
// possible to have a reference pair not listed for explicit signaling.
|
||||
#define MODE_CTX_REF_FRAMES (REF_FRAMES + TOTAL_COMP_REFS)
|
||||
|
||||
#if CONFIG_SUPERTX
|
||||
#define PARTITION_SUPERTX_CONTEXTS 2
|
||||
#define MAX_SUPERTX_BLOCK_SIZE BLOCK_32X32
|
||||
#endif // CONFIG_SUPERTX
|
||||
|
||||
#if CONFIG_LOOP_RESTORATION
|
||||
typedef enum {
|
||||
typedef enum ATTRIBUTE_PACKED {
|
||||
RESTORE_NONE,
|
||||
RESTORE_WIENER,
|
||||
RESTORE_SGRPROJ,
|
||||
RESTORE_SWITCHABLE,
|
||||
RESTORE_SWITCHABLE_TYPES = RESTORE_SWITCHABLE,
|
||||
RESTORE_TYPES,
|
||||
RESTORE_TYPES = 4,
|
||||
} RestorationType;
|
||||
#endif // CONFIG_LOOP_RESTORATION
|
||||
|
||||
#if CONFIG_FRAME_SUPERRES
|
||||
#define SUPERRES_SCALE_BITS 3
|
||||
#define SUPERRES_SCALE_DENOMINATOR_MIN 8
|
||||
#endif // CONFIG_FRAME_SUPERRES
|
||||
#define SUPERRES_SCALE_DENOMINATOR_MIN (SCALE_NUMERATOR + 1)
|
||||
|
||||
#if CONFIG_LPF_DIRECT
|
||||
typedef enum {
|
||||
VERT_HORZ,
|
||||
DEGREE_30,
|
||||
DEGREE_45,
|
||||
DEGREE_60,
|
||||
DEGREE_120,
|
||||
DEGREE_135,
|
||||
DEGREE_150,
|
||||
FILTER_DEGREES,
|
||||
} FILTER_DEGREE;
|
||||
#endif // CONFIG_LPF_DIRECT
|
||||
|
||||
#if CONFIG_OBU
|
||||
// R19
|
||||
typedef enum {
|
||||
OBU_SEQUENCE_HEADER = 1,
|
||||
OBU_TD = 2,
|
||||
OBU_FRAME_HEADER = 3,
|
||||
OBU_TILE_GROUP = 4,
|
||||
OBU_METADATA = 5,
|
||||
OBU_PADDING = 15,
|
||||
} OBU_TYPE;
|
||||
#endif
|
||||
|
||||
#if CONFIG_LGT_FROM_PRED
|
||||
#define LGT_SIZES 2
|
||||
// Note: at least one of LGT_FROM_PRED_INTRA and LGT_FROM_PRED_INTER must be 1
|
||||
#define LGT_FROM_PRED_INTRA 1
|
||||
#define LGT_FROM_PRED_INTER 1
|
||||
// LGT_SL_INTRA: LGTs with a mode-dependent first self-loop and a break point
|
||||
#define LGT_SL_INTRA 0
|
||||
#endif // CONFIG_LGT_FROM_PRED
|
||||
// In large_scale_tile coding, external references are used.
|
||||
#define MAX_EXTERNAL_REFERENCES 128
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
|
|
|
|||
274
third_party/aom/av1/common/filter.c
vendored
274
third_party/aom/av1/common/filter.c
vendored
|
|
@ -25,153 +25,6 @@ DECLARE_ALIGNED(256, static const InterpKernel,
|
|||
{ 0, 0, 0, 16, 112, 0, 0, 0 }, { 0, 0, 0, 8, 120, 0, 0, 0 }
|
||||
};
|
||||
|
||||
#if USE_TEMPORALFILTER_12TAP
|
||||
DECLARE_ALIGNED(16, static const int16_t,
|
||||
sub_pel_filters_temporalfilter_12[SUBPEL_SHIFTS][12]) = {
|
||||
// intfilt 0.8
|
||||
{ 0, 0, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0, 1, -1, 3, -7, 127, 8, -4, 2, -1, 0, 0 },
|
||||
{ 0, 1, -3, 5, -12, 124, 18, -8, 4, -2, 1, 0 },
|
||||
{ -1, 2, -4, 8, -17, 120, 28, -11, 6, -3, 1, -1 },
|
||||
{ -1, 2, -4, 10, -21, 114, 38, -15, 8, -4, 2, -1 },
|
||||
{ -1, 3, -5, 11, -23, 107, 49, -18, 9, -5, 2, -1 },
|
||||
{ -1, 3, -6, 12, -25, 99, 60, -21, 11, -6, 3, -1 },
|
||||
{ -1, 3, -6, 12, -25, 90, 70, -23, 12, -6, 3, -1 },
|
||||
{ -1, 3, -6, 12, -24, 80, 80, -24, 12, -6, 3, -1 },
|
||||
{ -1, 3, -6, 12, -23, 70, 90, -25, 12, -6, 3, -1 },
|
||||
{ -1, 3, -6, 11, -21, 60, 99, -25, 12, -6, 3, -1 },
|
||||
{ -1, 2, -5, 9, -18, 49, 107, -23, 11, -5, 3, -1 },
|
||||
{ -1, 2, -4, 8, -15, 38, 114, -21, 10, -4, 2, -1 },
|
||||
{ -1, 1, -3, 6, -11, 28, 120, -17, 8, -4, 2, -1 },
|
||||
{ 0, 1, -2, 4, -8, 18, 124, -12, 5, -3, 1, 0 },
|
||||
{ 0, 0, -1, 2, -4, 8, 127, -7, 3, -1, 1, 0 },
|
||||
};
|
||||
#endif // USE_TEMPORALFILTER_12TAP
|
||||
|
||||
#if USE_EXTRA_FILTER
|
||||
DECLARE_ALIGNED(256, static const InterpKernel,
|
||||
sub_pel_filters_8[SUBPEL_SHIFTS]) = {
|
||||
{ 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 2, -6, 126, 8, -2, 0, 0 },
|
||||
{ 0, 2, -10, 122, 18, -4, 0, 0 }, { 0, 2, -12, 116, 28, -8, 2, 0 },
|
||||
{ 0, 2, -14, 110, 38, -10, 2, 0 }, { 0, 2, -14, 102, 48, -12, 2, 0 },
|
||||
{ 0, 2, -16, 94, 58, -12, 2, 0 }, { 0, 2, -14, 84, 66, -12, 2, 0 },
|
||||
{ 0, 2, -14, 76, 76, -14, 2, 0 }, { 0, 2, -12, 66, 84, -14, 2, 0 },
|
||||
{ 0, 2, -12, 58, 94, -16, 2, 0 }, { 0, 2, -12, 48, 102, -14, 2, 0 },
|
||||
{ 0, 2, -10, 38, 110, -14, 2, 0 }, { 0, 2, -8, 28, 116, -12, 2, 0 },
|
||||
{ 0, 0, -4, 18, 122, -10, 2, 0 }, { 0, 0, -2, 8, 126, -6, 2, 0 }
|
||||
};
|
||||
|
||||
DECLARE_ALIGNED(256, static const InterpKernel,
|
||||
sub_pel_filters_regular_uv[SUBPEL_SHIFTS]) = {
|
||||
{ 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 2, -6, 126, 8, -2, 0, 0 },
|
||||
{ 0, 2, -10, 122, 18, -4, 0, 0 }, { 0, 2, -12, 116, 28, -8, 2, 0 },
|
||||
{ 0, 2, -14, 110, 38, -10, 2, 0 }, { 0, 2, -14, 102, 48, -12, 2, 0 },
|
||||
{ 0, 2, -16, 94, 58, -12, 2, 0 }, { 0, 2, -14, 84, 66, -12, 2, 0 },
|
||||
{ 0, 2, -14, 76, 76, -14, 2, 0 }, { 0, 2, -12, 66, 84, -14, 2, 0 },
|
||||
{ 0, 2, -12, 58, 94, -16, 2, 0 }, { 0, 2, -12, 48, 102, -14, 2, 0 },
|
||||
{ 0, 2, -10, 38, 110, -14, 2, 0 }, { 0, 2, -8, 28, 116, -12, 2, 0 },
|
||||
{ 0, 0, -4, 18, 122, -10, 2, 0 }, { 0, 0, -2, 8, 126, -6, 2, 0 }
|
||||
};
|
||||
|
||||
#if USE_12TAP_FILTER
|
||||
DECLARE_ALIGNED(256, static const InterpKernel,
|
||||
sub_pel_filters_8sharp[SUBPEL_SHIFTS]) = {
|
||||
// intfilt 0.8
|
||||
{ 0, 0, 0, 128, 0, 0, 0, 0 }, { -1, 2, -6, 127, 9, -4, 2, -1 },
|
||||
{ -2, 5, -12, 124, 18, -7, 4, -2 }, { -2, 7, -16, 119, 28, -11, 5, -2 },
|
||||
{ -3, 8, -19, 114, 38, -14, 7, -3 }, { -3, 9, -22, 107, 49, -17, 8, -3 },
|
||||
{ -4, 10, -23, 99, 60, -20, 10, -4 }, { -4, 11, -23, 90, 70, -22, 10, -4 },
|
||||
{ -4, 11, -23, 80, 80, -23, 11, -4 }, { -4, 10, -22, 70, 90, -23, 11, -4 },
|
||||
{ -4, 10, -20, 60, 99, -23, 10, -4 }, { -3, 8, -17, 49, 107, -22, 9, -3 },
|
||||
{ -3, 7, -14, 38, 114, -19, 8, -3 }, { -2, 5, -11, 28, 119, -16, 7, -2 },
|
||||
{ -2, 4, -7, 18, 124, -12, 5, -2 }, { -1, 2, -4, 9, 127, -6, 2, -1 },
|
||||
};
|
||||
|
||||
DECLARE_ALIGNED(256, static const int16_t,
|
||||
sub_pel_filters_10sharp[SUBPEL_SHIFTS][12]) = {
|
||||
// intfilt 0.85
|
||||
{ 0, 0, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0, 1, -2, 3, -7, 127, 8, -4, 2, -1, 1, 0 },
|
||||
{ 0, 1, -3, 6, -13, 124, 18, -8, 4, -2, 1, 0 },
|
||||
{ 0, 2, -4, 8, -18, 120, 28, -12, 6, -4, 2, 0 },
|
||||
{ 0, 2, -5, 10, -21, 114, 38, -15, 8, -5, 2, 0 },
|
||||
{ 0, 3, -6, 11, -24, 107, 49, -19, 10, -6, 3, 0 },
|
||||
{ 0, 3, -7, 12, -25, 99, 59, -21, 11, -6, 3, 0 },
|
||||
{ 0, 3, -7, 12, -25, 90, 70, -23, 12, -7, 3, 0 },
|
||||
{ 0, 3, -7, 12, -25, 81, 81, -25, 12, -7, 3, 0 },
|
||||
{ 0, 3, -7, 12, -23, 70, 90, -25, 12, -7, 3, 0 },
|
||||
{ 0, 3, -6, 11, -21, 59, 99, -25, 12, -7, 3, 0 },
|
||||
{ 0, 3, -6, 10, -19, 49, 107, -24, 11, -6, 3, 0 },
|
||||
{ 0, 2, -5, 8, -15, 38, 114, -21, 10, -5, 2, 0 },
|
||||
{ 0, 2, -4, 6, -12, 28, 120, -18, 8, -4, 2, 0 },
|
||||
{ 0, 1, -2, 4, -8, 18, 124, -13, 6, -3, 1, 0 },
|
||||
{ 0, 1, -1, 2, -4, 8, 127, -7, 3, -2, 1, 0 },
|
||||
};
|
||||
#else
|
||||
DECLARE_ALIGNED(256, static const InterpKernel,
|
||||
sub_pel_filters_8sharp[SUBPEL_SHIFTS]) = {
|
||||
{ 0, 0, 0, 128, 0, 0, 0, 0 }, { -2, 2, -6, 126, 8, -2, 2, 0 },
|
||||
{ -2, 6, -12, 124, 16, -6, 4, -2 }, { -2, 8, -18, 120, 26, -10, 6, -2 },
|
||||
{ -4, 10, -22, 116, 38, -14, 6, -2 }, { -4, 10, -22, 108, 48, -18, 8, -2 },
|
||||
{ -4, 10, -24, 100, 60, -20, 8, -2 }, { -4, 10, -24, 90, 70, -22, 10, -2 },
|
||||
{ -4, 12, -24, 80, 80, -24, 12, -4 }, { -2, 10, -22, 70, 90, -24, 10, -4 },
|
||||
{ -2, 8, -20, 60, 100, -24, 10, -4 }, { -2, 8, -18, 48, 108, -22, 10, -4 },
|
||||
{ -2, 6, -14, 38, 116, -22, 10, -4 }, { -2, 6, -10, 26, 120, -18, 8, -2 },
|
||||
{ -2, 4, -6, 16, 124, -12, 6, -2 }, { 0, 2, -2, 8, 126, -6, 2, -2 }
|
||||
};
|
||||
#endif
|
||||
|
||||
DECLARE_ALIGNED(256, static const InterpKernel,
|
||||
sub_pel_filters_8smooth2[SUBPEL_SHIFTS]) = {
|
||||
// freqmultiplier = 0.2
|
||||
{ 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 9, 30, 44, 32, 11, 2, 0 },
|
||||
{ 0, 8, 28, 44, 34, 12, 2, 0 }, { 0, 7, 27, 44, 35, 13, 2, 0 },
|
||||
{ 0, 6, 26, 43, 37, 14, 2, 0 }, { 0, 5, 24, 43, 38, 16, 2, 0 },
|
||||
{ 0, 5, 23, 42, 38, 17, 3, 0 }, { 0, 4, 21, 41, 40, 19, 3, 0 },
|
||||
{ 0, 4, 20, 40, 40, 20, 4, 0 }, { 0, 3, 19, 40, 41, 21, 4, 0 },
|
||||
{ 0, 3, 17, 38, 42, 23, 5, 0 }, { 0, 2, 16, 38, 43, 24, 5, 0 },
|
||||
{ 0, 2, 14, 37, 43, 26, 6, 0 }, { 0, 2, 13, 35, 44, 27, 7, 0 },
|
||||
{ 0, 2, 12, 34, 44, 28, 8, 0 }, { 0, 2, 11, 32, 44, 30, 9, 0 },
|
||||
};
|
||||
|
||||
DECLARE_ALIGNED(256, static const InterpKernel,
|
||||
sub_pel_filters_smooth2_uv[SUBPEL_SHIFTS]) = {
|
||||
// freqmultiplier = 0.2
|
||||
{ 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 9, 30, 44, 32, 11, 2, 0 },
|
||||
{ 0, 8, 28, 44, 34, 12, 2, 0 }, { 0, 7, 27, 44, 35, 13, 2, 0 },
|
||||
{ 0, 6, 26, 43, 37, 14, 2, 0 }, { 0, 5, 24, 43, 38, 16, 2, 0 },
|
||||
{ 0, 5, 23, 42, 38, 17, 3, 0 }, { 0, 4, 21, 41, 40, 19, 3, 0 },
|
||||
{ 0, 4, 20, 40, 40, 20, 4, 0 }, { 0, 3, 19, 40, 41, 21, 4, 0 },
|
||||
{ 0, 3, 17, 38, 42, 23, 5, 0 }, { 0, 2, 16, 38, 43, 24, 5, 0 },
|
||||
{ 0, 2, 14, 37, 43, 26, 6, 0 }, { 0, 2, 13, 35, 44, 27, 7, 0 },
|
||||
{ 0, 2, 12, 34, 44, 28, 8, 0 }, { 0, 2, 11, 32, 44, 30, 9, 0 },
|
||||
};
|
||||
|
||||
DECLARE_ALIGNED(256, static const InterpKernel,
|
||||
sub_pel_filters_8smooth[SUBPEL_SHIFTS]) = {
|
||||
{ 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 2, 28, 62, 34, 2, 0, 0 },
|
||||
{ 0, 0, 26, 62, 36, 4, 0, 0 }, { 0, 0, 22, 62, 40, 4, 0, 0 },
|
||||
{ 0, 0, 20, 60, 42, 6, 0, 0 }, { 0, 0, 18, 58, 44, 8, 0, 0 },
|
||||
{ 0, 0, 16, 56, 46, 10, 0, 0 }, { 0, -2, 16, 54, 48, 12, 0, 0 },
|
||||
{ 0, -2, 14, 52, 52, 14, -2, 0 }, { 0, 0, 12, 48, 54, 16, -2, 0 },
|
||||
{ 0, 0, 10, 46, 56, 16, 0, 0 }, { 0, 0, 8, 44, 58, 18, 0, 0 },
|
||||
{ 0, 0, 6, 42, 60, 20, 0, 0 }, { 0, 0, 4, 40, 62, 22, 0, 0 },
|
||||
{ 0, 0, 4, 36, 62, 26, 0, 0 }, { 0, 0, 2, 34, 62, 28, 2, 0 }
|
||||
};
|
||||
|
||||
DECLARE_ALIGNED(256, static const InterpKernel,
|
||||
sub_pel_filters_smooth_uv[SUBPEL_SHIFTS]) = {
|
||||
{ 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 2, 28, 62, 34, 2, 0, 0 },
|
||||
{ 0, 0, 26, 62, 36, 4, 0, 0 }, { 0, 0, 22, 62, 40, 4, 0, 0 },
|
||||
{ 0, 0, 20, 60, 42, 6, 0, 0 }, { 0, 0, 18, 58, 44, 8, 0, 0 },
|
||||
{ 0, 0, 16, 56, 46, 10, 0, 0 }, { 0, -2, 16, 54, 48, 12, 0, 0 },
|
||||
{ 0, -2, 14, 52, 52, 14, -2, 0 }, { 0, 0, 12, 48, 54, 16, -2, 0 },
|
||||
{ 0, 0, 10, 46, 56, 16, 0, 0 }, { 0, 0, 8, 44, 58, 18, 0, 0 },
|
||||
{ 0, 0, 6, 42, 60, 20, 0, 0 }, { 0, 0, 4, 40, 62, 22, 0, 0 },
|
||||
{ 0, 0, 4, 36, 62, 26, 0, 0 }, { 0, 0, 2, 34, 62, 28, 2, 0 }
|
||||
};
|
||||
#else // USE_EXTRA_FILTER
|
||||
|
||||
DECLARE_ALIGNED(256, static const InterpKernel,
|
||||
sub_pel_filters_8[SUBPEL_SHIFTS]) = {
|
||||
{ 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 2, -6, 126, 8, -2, 0, 0 },
|
||||
|
|
@ -207,49 +60,7 @@ DECLARE_ALIGNED(256, static const InterpKernel,
|
|||
{ 0, 0, 6, 42, 60, 20, 0, 0 }, { 0, 0, 4, 40, 62, 22, 0, 0 },
|
||||
{ 0, 0, 4, 36, 62, 26, 0, 0 }, { 0, 0, 2, 34, 62, 28, 2, 0 }
|
||||
};
|
||||
#endif // USE_EXTRA_FILTER
|
||||
|
||||
#if CONFIG_EXT_INTRA
|
||||
#if CONFIG_INTRA_INTERP
|
||||
const InterpKernel *av1_intra_filter_kernels[INTRA_FILTERS] = {
|
||||
bilinear_filters, // INTRA_FILTER_LINEAR
|
||||
sub_pel_filters_8, // INTRA_FILTER_8TAP
|
||||
sub_pel_filters_8sharp, // INTRA_FILTER_8TAP_SHARP
|
||||
sub_pel_filters_8smooth, // INTRA_FILTER_8TAP_SMOOTH
|
||||
};
|
||||
#endif // CONFIG_INTRA_INTERP
|
||||
#endif // CONFIG_EXT_INTRA
|
||||
|
||||
#if USE_EXTRA_FILTER
|
||||
static const InterpFilterParams
|
||||
av1_interp_filter_params_list[SWITCHABLE_FILTERS + EXTRA_FILTERS] = {
|
||||
{ (const int16_t *)sub_pel_filters_8, SUBPEL_TAPS, SUBPEL_SHIFTS,
|
||||
EIGHTTAP_REGULAR },
|
||||
{ (const int16_t *)sub_pel_filters_8smooth, SUBPEL_TAPS, SUBPEL_SHIFTS,
|
||||
EIGHTTAP_SMOOTH },
|
||||
#if USE_12TAP_FILTER
|
||||
{ (const int16_t *)sub_pel_filters_10sharp, 12, SUBPEL_SHIFTS,
|
||||
MULTITAP_SHARP },
|
||||
#else
|
||||
{ (const int16_t *)sub_pel_filters_8sharp, SUBPEL_TAPS, SUBPEL_SHIFTS,
|
||||
EIGHTTAP_SHARP },
|
||||
#endif
|
||||
{ (const int16_t *)sub_pel_filters_8smooth2, SUBPEL_TAPS, SUBPEL_SHIFTS,
|
||||
EIGHTTAP_SMOOTH2 },
|
||||
{ (const int16_t *)bilinear_filters, SUBPEL_TAPS, SUBPEL_SHIFTS,
|
||||
BILINEAR },
|
||||
{ (const int16_t *)sub_pel_filters_8sharp, SUBPEL_TAPS, SUBPEL_SHIFTS,
|
||||
EIGHTTAP_SHARP },
|
||||
{ (const int16_t *)sub_pel_filters_regular_uv, SUBPEL_TAPS, SUBPEL_SHIFTS,
|
||||
FILTER_REGULAR_UV },
|
||||
{ (const int16_t *)sub_pel_filters_smooth_uv, SUBPEL_TAPS, SUBPEL_SHIFTS,
|
||||
FILTER_SMOOTH_UV },
|
||||
{ (const int16_t *)sub_pel_filters_8sharp, SUBPEL_TAPS, SUBPEL_SHIFTS,
|
||||
FILTER_SHARP_UV },
|
||||
{ (const int16_t *)sub_pel_filters_smooth2_uv, SUBPEL_TAPS, SUBPEL_SHIFTS,
|
||||
FILTER_SMOOTH2_UV },
|
||||
};
|
||||
#else
|
||||
static const InterpFilterParams
|
||||
av1_interp_filter_params_list[SWITCHABLE_FILTERS + 1] = {
|
||||
{ (const int16_t *)sub_pel_filters_8, SUBPEL_TAPS, SUBPEL_SHIFTS,
|
||||
|
|
@ -261,62 +72,49 @@ static const InterpFilterParams
|
|||
{ (const int16_t *)bilinear_filters, SUBPEL_TAPS, SUBPEL_SHIFTS,
|
||||
BILINEAR }
|
||||
};
|
||||
#endif // USE_EXTRA_FILTER
|
||||
|
||||
#if USE_TEMPORALFILTER_12TAP
|
||||
static const InterpFilterParams av1_interp_temporalfilter_12tap = {
|
||||
(const int16_t *)sub_pel_filters_temporalfilter_12, 12, SUBPEL_SHIFTS,
|
||||
TEMPORALFILTER_12TAP
|
||||
DECLARE_ALIGNED(256, static const InterpKernel,
|
||||
sub_pel_filters_4[SUBPEL_SHIFTS]) = {
|
||||
{ 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 0, -4, 126, 8, -2, 0, 0 },
|
||||
{ 0, 0, -8, 122, 18, -4, 0, 0 }, { 0, 0, -10, 116, 28, -6, 0, 0 },
|
||||
{ 0, 0, -12, 110, 38, -8, 0, 0 }, { 0, 0, -12, 102, 48, -10, 0, 0 },
|
||||
{ 0, 0, -14, 94, 58, -10, 0, 0 }, { 0, 0, -12, 84, 66, -10, 0, 0 },
|
||||
{ 0, 0, -12, 76, 76, -12, 0, 0 }, { 0, 0, -10, 66, 84, -12, 0, 0 },
|
||||
{ 0, 0, -10, 58, 94, -14, 0, 0 }, { 0, 0, -10, 48, 102, -12, 0, 0 },
|
||||
{ 0, 0, -8, 38, 110, -12, 0, 0 }, { 0, 0, -6, 28, 116, -10, 0, 0 },
|
||||
{ 0, 0, -4, 18, 122, -8, 0, 0 }, { 0, 0, -2, 8, 126, -4, 0, 0 }
|
||||
};
|
||||
DECLARE_ALIGNED(256, static const InterpKernel,
|
||||
sub_pel_filters_4smooth[SUBPEL_SHIFTS]) = {
|
||||
{ 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 0, 30, 62, 34, 2, 0, 0 },
|
||||
{ 0, 0, 26, 62, 36, 4, 0, 0 }, { 0, 0, 22, 62, 40, 4, 0, 0 },
|
||||
{ 0, 0, 20, 60, 42, 6, 0, 0 }, { 0, 0, 18, 58, 44, 8, 0, 0 },
|
||||
{ 0, 0, 16, 56, 46, 10, 0, 0 }, { 0, 0, 14, 54, 48, 12, 0, 0 },
|
||||
{ 0, 0, 12, 52, 52, 12, 0, 0 }, { 0, 0, 12, 48, 54, 14, 0, 0 },
|
||||
{ 0, 0, 10, 46, 56, 16, 0, 0 }, { 0, 0, 8, 44, 58, 18, 0, 0 },
|
||||
{ 0, 0, 6, 42, 60, 20, 0, 0 }, { 0, 0, 4, 40, 62, 22, 0, 0 },
|
||||
{ 0, 0, 4, 36, 62, 26, 0, 0 }, { 0, 0, 2, 34, 62, 30, 0, 0 }
|
||||
};
|
||||
#endif // USE_TEMPORALFILTER_12TAP
|
||||
|
||||
InterpFilterParams av1_get_interp_filter_params(
|
||||
const InterpFilter interp_filter) {
|
||||
#if USE_TEMPORALFILTER_12TAP
|
||||
if (interp_filter == TEMPORALFILTER_12TAP)
|
||||
return av1_interp_temporalfilter_12tap;
|
||||
#endif // USE_TEMPORALFILTER_12TAP
|
||||
static const InterpFilterParams av1_interp_4tap[2] = {
|
||||
{ (const int16_t *)sub_pel_filters_4, SUBPEL_TAPS, SUBPEL_SHIFTS,
|
||||
EIGHTTAP_REGULAR },
|
||||
{ (const int16_t *)sub_pel_filters_4smooth, SUBPEL_TAPS, SUBPEL_SHIFTS,
|
||||
EIGHTTAP_SMOOTH },
|
||||
};
|
||||
|
||||
InterpFilterParams av1_get_interp_filter_params_with_block_size(
|
||||
const InterpFilter interp_filter, const int w) {
|
||||
if (w <= 4 &&
|
||||
(interp_filter == MULTITAP_SHARP || interp_filter == EIGHTTAP_REGULAR))
|
||||
return av1_interp_4tap[0];
|
||||
else if (w <= 4 && interp_filter == EIGHTTAP_SMOOTH)
|
||||
return av1_interp_4tap[1];
|
||||
|
||||
return av1_interp_filter_params_list[interp_filter];
|
||||
}
|
||||
|
||||
const int16_t *av1_get_interp_filter_kernel(const InterpFilter interp_filter) {
|
||||
#if USE_TEMPORALFILTER_12TAP
|
||||
if (interp_filter == TEMPORALFILTER_12TAP)
|
||||
return av1_interp_temporalfilter_12tap.filter_ptr;
|
||||
#endif // USE_TEMPORALFILTER_12TAP
|
||||
return (const int16_t *)av1_interp_filter_params_list[interp_filter]
|
||||
.filter_ptr;
|
||||
}
|
||||
|
||||
#if CONFIG_DUAL_FILTER
|
||||
InterpFilter av1_get_plane_interp_filter(InterpFilter interp_filter,
|
||||
int plane) {
|
||||
#if USE_TEMPORALFILTER_12TAP
|
||||
#if USE_EXTRA_FILTER
|
||||
assert(interp_filter <= EIGHTTAP_SHARP ||
|
||||
interp_filter == TEMPORALFILTER_12TAP);
|
||||
#else // USE_EXTRA_FILTER
|
||||
assert(interp_filter <= SWITCHABLE_FILTERS ||
|
||||
interp_filter == TEMPORALFILTER_12TAP);
|
||||
#endif // USE_EXTRA_FILTER
|
||||
#else
|
||||
assert(interp_filter <= EIGHTTAP_SHARP);
|
||||
#endif
|
||||
#if USE_EXTRA_FILTER
|
||||
if (plane == 0) {
|
||||
return interp_filter;
|
||||
} else {
|
||||
switch (interp_filter) {
|
||||
case EIGHTTAP_REGULAR: return FILTER_REGULAR_UV;
|
||||
case EIGHTTAP_SMOOTH: return FILTER_SMOOTH_UV;
|
||||
case MULTITAP_SHARP: return FILTER_SHARP_UV;
|
||||
case EIGHTTAP_SMOOTH2: return FILTER_SMOOTH2_UV;
|
||||
default: return interp_filter;
|
||||
}
|
||||
}
|
||||
#else // USE_EXTRA_FILTER
|
||||
(void)plane;
|
||||
return interp_filter;
|
||||
#endif // USE_EXTRA_FILTER
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
85
third_party/aom/av1/common/filter.h
vendored
85
third_party/aom/av1/common/filter.h
vendored
|
|
@ -14,7 +14,8 @@
|
|||
|
||||
#include <assert.h>
|
||||
|
||||
#include "./aom_config.h"
|
||||
#include "config/aom_config.h"
|
||||
|
||||
#include "aom/aom_integer.h"
|
||||
#include "aom_dsp/aom_filter.h"
|
||||
#include "aom_ports/mem.h"
|
||||
|
|
@ -23,34 +24,17 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define USE_TEMPORALFILTER_12TAP 1
|
||||
#define MAX_FILTER_TAP 12
|
||||
#define MAX_FILTER_TAP 8
|
||||
|
||||
#define USE_12TAP_FILTER 0
|
||||
#define USE_EXTRA_FILTER 0
|
||||
|
||||
typedef enum {
|
||||
typedef enum ATTRIBUTE_PACKED {
|
||||
EIGHTTAP_REGULAR,
|
||||
EIGHTTAP_SMOOTH,
|
||||
#if USE_EXTRA_FILTER
|
||||
EIGHTTAP_SMOOTH2,
|
||||
#endif // USE_EXTRA_FILTER
|
||||
MULTITAP_SHARP,
|
||||
BILINEAR,
|
||||
#if USE_EXTRA_FILTER
|
||||
EIGHTTAP_SHARP,
|
||||
FILTER_REGULAR_UV,
|
||||
FILTER_SMOOTH_UV,
|
||||
FILTER_SHARP_UV,
|
||||
FILTER_SMOOTH2_UV,
|
||||
#endif // USE_EXTRA_FILTER
|
||||
INTERP_FILTERS_ALL,
|
||||
SWITCHABLE_FILTERS = BILINEAR,
|
||||
SWITCHABLE = SWITCHABLE_FILTERS + 1, /* the last switchable one */
|
||||
EXTRA_FILTERS = INTERP_FILTERS_ALL - SWITCHABLE_FILTERS,
|
||||
#if USE_TEMPORALFILTER_12TAP
|
||||
TEMPORALFILTER_12TAP = SWITCHABLE_FILTERS + EXTRA_FILTERS,
|
||||
#endif
|
||||
} InterpFilter;
|
||||
|
||||
// With CONFIG_DUAL_FILTER, pack two InterpFilter's into a uint32_t: since
|
||||
|
|
@ -59,73 +43,34 @@ typedef enum {
|
|||
// setting a (pair of) filters.
|
||||
//
|
||||
// Without CONFIG_DUAL_FILTER,
|
||||
#if CONFIG_DUAL_FILTER
|
||||
typedef uint32_t InterpFilters;
|
||||
static INLINE InterpFilter av1_extract_interp_filter(InterpFilters filters,
|
||||
int x_filter) {
|
||||
return (InterpFilter)((filters >> (x_filter ? 16 : 0)) & 0xffff);
|
||||
return (InterpFilter)((filters >> (x_filter ? 16 : 0)) & 0xf);
|
||||
}
|
||||
|
||||
static INLINE InterpFilters av1_make_interp_filters(InterpFilter y_filter,
|
||||
InterpFilter x_filter) {
|
||||
uint16_t y16 = y_filter & 0xffff;
|
||||
uint16_t x16 = x_filter & 0xffff;
|
||||
uint16_t y16 = y_filter & 0xf;
|
||||
uint16_t x16 = x_filter & 0xf;
|
||||
return y16 | ((uint32_t)x16 << 16);
|
||||
}
|
||||
|
||||
static INLINE InterpFilters av1_broadcast_interp_filter(InterpFilter filter) {
|
||||
return av1_make_interp_filters(filter, filter);
|
||||
}
|
||||
#else
|
||||
typedef InterpFilter InterpFilters;
|
||||
static INLINE InterpFilter av1_extract_interp_filter(InterpFilters filters,
|
||||
int x_filter) {
|
||||
#ifdef NDEBUG
|
||||
(void)x_filter;
|
||||
#endif
|
||||
assert(!x_filter);
|
||||
return filters;
|
||||
}
|
||||
|
||||
static INLINE InterpFilters av1_broadcast_interp_filter(InterpFilter filter) {
|
||||
return filter;
|
||||
}
|
||||
#endif
|
||||
|
||||
static INLINE InterpFilter av1_unswitchable_filter(InterpFilter filter) {
|
||||
return filter == SWITCHABLE ? EIGHTTAP_REGULAR : filter;
|
||||
}
|
||||
|
||||
#if USE_EXTRA_FILTER
|
||||
#define LOG_SWITCHABLE_FILTERS \
|
||||
3 /* (1 << LOG_SWITCHABLE_FILTERS) > SWITCHABLE_FILTERS */
|
||||
#else
|
||||
#define LOG_SWITCHABLE_FILTERS \
|
||||
2 /* (1 << LOG_SWITCHABLE_FILTERS) > SWITCHABLE_FILTERS */
|
||||
#endif
|
||||
|
||||
#if CONFIG_DUAL_FILTER
|
||||
#define MAX_SUBPEL_TAPS 12
|
||||
#define SWITCHABLE_FILTER_CONTEXTS ((SWITCHABLE_FILTERS + 1) * 4)
|
||||
#define INTER_FILTER_COMP_OFFSET (SWITCHABLE_FILTERS + 1)
|
||||
#define INTER_FILTER_DIR_OFFSET ((SWITCHABLE_FILTERS + 1) * 2)
|
||||
#else // CONFIG_DUAL_FILTER
|
||||
#define SWITCHABLE_FILTER_CONTEXTS (SWITCHABLE_FILTERS + 1)
|
||||
#endif // CONFIG_DUAL_FILTER
|
||||
|
||||
#if CONFIG_EXT_INTRA
|
||||
#if CONFIG_INTRA_INTERP
|
||||
typedef enum {
|
||||
INTRA_FILTER_LINEAR,
|
||||
INTRA_FILTER_8TAP,
|
||||
INTRA_FILTER_8TAP_SHARP,
|
||||
INTRA_FILTER_8TAP_SMOOTH,
|
||||
INTRA_FILTERS,
|
||||
} INTRA_FILTER;
|
||||
|
||||
extern const InterpKernel *av1_intra_filter_kernels[INTRA_FILTERS];
|
||||
#endif // CONFIG_INTRA_INTERP
|
||||
#endif // CONFIG_EXT_INTRA
|
||||
|
||||
typedef struct InterpFilterParams {
|
||||
const int16_t *filter_ptr;
|
||||
|
|
@ -134,26 +79,16 @@ typedef struct InterpFilterParams {
|
|||
InterpFilter interp_filter;
|
||||
} InterpFilterParams;
|
||||
|
||||
InterpFilterParams av1_get_interp_filter_params(
|
||||
const InterpFilter interp_filter);
|
||||
|
||||
const int16_t *av1_get_interp_filter_kernel(const InterpFilter interp_filter);
|
||||
|
||||
InterpFilterParams av1_get_interp_filter_params_with_block_size(
|
||||
const InterpFilter interp_filter, const int w);
|
||||
|
||||
static INLINE const int16_t *av1_get_interp_filter_subpel_kernel(
|
||||
const InterpFilterParams filter_params, const int subpel) {
|
||||
return filter_params.filter_ptr + filter_params.taps * subpel;
|
||||
}
|
||||
|
||||
static INLINE int av1_is_interpolating_filter(
|
||||
const InterpFilter interp_filter) {
|
||||
const InterpFilterParams ip = av1_get_interp_filter_params(interp_filter);
|
||||
return (ip.filter_ptr[ip.taps / 2 - 1] == 128);
|
||||
}
|
||||
|
||||
#if CONFIG_DUAL_FILTER
|
||||
InterpFilter av1_get_plane_interp_filter(InterpFilter interp_filter, int plane);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
|
|
|||
1
third_party/aom/av1/common/frame_buffers.c
vendored
1
third_party/aom/av1/common/frame_buffers.c
vendored
|
|
@ -75,5 +75,6 @@ int av1_release_frame_buffer(void *cb_priv, aom_codec_frame_buffer_t *fb) {
|
|||
InternalFrameBuffer *const int_fb = (InternalFrameBuffer *)fb->priv;
|
||||
(void)cb_priv;
|
||||
if (int_fb) int_fb->in_use = 0;
|
||||
fb->priv = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
112
third_party/aom/av1/common/generic_code.c
vendored
112
third_party/aom/av1/common/generic_code.c
vendored
|
|
@ -1,112 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2001-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.
|
||||
*/
|
||||
|
||||
/* clang-format off */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include "generic_code.h"
|
||||
|
||||
void aom_cdf_init_q15_1D(uint16_t *cdf, int nsyms, int cdf_size) {
|
||||
int i;
|
||||
for (i = 0; i < nsyms; i++)
|
||||
cdf[i] = AOM_ICDF((i + 1)*CDF_PROB_TOP/nsyms);
|
||||
|
||||
cdf[cdf_size - 1] = 0;
|
||||
}
|
||||
|
||||
/** Adapts a Q15 cdf after encoding/decoding a symbol. */
|
||||
void aom_cdf_adapt_q15(int val, uint16_t *cdf, int n, int *count, int rate) {
|
||||
int i;
|
||||
*count = OD_MINI(*count + 1, 1 << rate);
|
||||
OD_ASSERT(AOM_ICDF(cdf[n - 1]) == 32768);
|
||||
if (*count >= 1 << rate) {
|
||||
/* Steady-state adaptation based on a simple IIR with dyadic rate. */
|
||||
for (i = 0; i < n; i++) {
|
||||
int tmp;
|
||||
/* When (i < val), we want the adjustment ((cdf[i] - tmp) >> rate) to be
|
||||
positive so long as (cdf[i] > i + 1), and 0 when (cdf[i] == i + 1),
|
||||
to ensure we don't drive any probabilities to 0. Replacing cdf[i] with
|
||||
(i + 2) and solving ((i + 2 - tmp) >> rate == 1) for tmp produces
|
||||
tmp == i + 2 - (1 << rate). Using this value of tmp with
|
||||
cdf[i] == i + 1 instead gives an adjustment of 0 as desired.
|
||||
|
||||
When (i >= val), we want ((cdf[i] - tmp) >> rate) to be negative so
|
||||
long as cdf[i] < 32768 - (n - 1 - i), and 0 when
|
||||
cdf[i] == 32768 - (n - 1 - i), again to ensure we don't drive any
|
||||
probabilities to 0. Since right-shifting any negative value is still
|
||||
negative, we can solve (32768 - (n - 1 - i) - tmp == 0) for tmp,
|
||||
producing tmp = 32769 - n + i. Using this value of tmp with smaller
|
||||
values of cdf[i] instead gives negative adjustments, as desired.
|
||||
|
||||
Combining the two cases gives the expression below. These could be
|
||||
stored in a lookup table indexed by n and rate to avoid the
|
||||
arithmetic. */
|
||||
tmp = 2 - (1<<rate) + i + (32767 + (1<<rate) - n)*(i >= val);
|
||||
cdf[i] = AOM_ICDF(AOM_ICDF(cdf[i]) - ((AOM_ICDF(cdf[i]) - tmp) >> rate));
|
||||
}
|
||||
}
|
||||
else {
|
||||
int alpha;
|
||||
/* Initial adaptation for the first symbols. The adaptation rate is
|
||||
computed to be equivalent to what od_{en,de}code_cdf_adapt() does
|
||||
when the initial cdf is set to increment/4. */
|
||||
alpha = 4*32768/(n + 4**count);
|
||||
for (i = 0; i < n; i++) {
|
||||
int tmp;
|
||||
tmp = (32768 - n)*(i >= val) + i + 1;
|
||||
cdf[i] = AOM_ICDF(AOM_ICDF(cdf[i])
|
||||
- (((AOM_ICDF(cdf[i]) - tmp)*alpha) >> 15));
|
||||
}
|
||||
}
|
||||
OD_ASSERT(AOM_ICDF(cdf[n - 1]) == 32768);
|
||||
}
|
||||
|
||||
/** Takes the base-2 log of E(x) in Q1.
|
||||
*
|
||||
* @param [in] ExQ16 expectation of x in Q16
|
||||
*
|
||||
* @retval 2*log2(ExQ16/2^16)
|
||||
*/
|
||||
int log_ex(int ex_q16) {
|
||||
int lg;
|
||||
int lg_q1;
|
||||
int odd;
|
||||
lg = OD_ILOG(ex_q16);
|
||||
if (lg < 15) {
|
||||
odd = ex_q16*ex_q16 > 2 << 2*lg;
|
||||
}
|
||||
else {
|
||||
int tmp;
|
||||
tmp = ex_q16 >> (lg - 8);
|
||||
odd = tmp*tmp > (1 << 15);
|
||||
}
|
||||
lg_q1 = OD_MAXI(0, 2*lg - 33 + odd);
|
||||
return lg_q1;
|
||||
}
|
||||
|
||||
/** Updates the probability model based on the encoded/decoded value
|
||||
*
|
||||
* @param [in,out] model generic prob model
|
||||
* @param [in,out] ExQ16 expectation of x
|
||||
* @param [in] x variable encoded/decoded (used for ExQ16)
|
||||
* @param [in] xs variable x after shift (used for the model)
|
||||
* @param [in] id id of the icdf to adapt
|
||||
* @param [in] integration integration period of ExQ16 (leaky average over
|
||||
* 1<<integration samples)
|
||||
*/
|
||||
void generic_model_update(int *ex_q16, int x, int integration) {
|
||||
/* We could have saturated ExQ16 directly, but this is safe and simpler */
|
||||
x = OD_MINI(x, 32767);
|
||||
OD_IIR_DIADIC(*ex_q16, x << 16, integration);
|
||||
}
|
||||
81
third_party/aom/av1/common/generic_code.h
vendored
81
third_party/aom/av1/common/generic_code.h
vendored
|
|
@ -1,81 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2001-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.
|
||||
*/
|
||||
|
||||
/* clang-format off */
|
||||
|
||||
#if !defined(_generic_code_H)
|
||||
# define _generic_code_H
|
||||
|
||||
# include "aom_dsp/bitreader.h"
|
||||
# include "aom_dsp/bitwriter.h"
|
||||
|
||||
# define GENERIC_TABLES 12
|
||||
|
||||
#define generic_decode(r, model, ex_q16, integration, ACCT_STR_NAME) \
|
||||
generic_decode_(r, model, ex_q16, integration ACCT_STR_ARG(ACCT_STR_NAME))
|
||||
#define aom_decode_cdf_adapt_q15(r, cdf, n, count, rate, ACCT_STR_NAME) \
|
||||
aom_decode_cdf_adapt_q15_(r, cdf, n, count, rate ACCT_STR_ARG(ACCT_STR_NAME))
|
||||
#define aom_decode_cdf_adapt(r, cdf, n, increment, ACCT_STR_NAME) \
|
||||
aom_decode_cdf_adapt_(r, cdf, n, increment ACCT_STR_ARG(ACCT_STR_NAME))
|
||||
|
||||
typedef struct {
|
||||
/** cdf for multiple expectations of x */
|
||||
uint16_t cdf[GENERIC_TABLES][CDF_SIZE(16)];
|
||||
} generic_encoder;
|
||||
|
||||
#define OD_IIR_DIADIC(y, x, shift) ((y) += ((x) - (y)) >> (shift))
|
||||
|
||||
void generic_model_init(generic_encoder *model);
|
||||
|
||||
/* Initialize a CDF for use by aom_write_symbol_pvq()/aom_read_symbol_pvq().
|
||||
This is used for CDFs whose size might not match the declared array size.
|
||||
The only real requirement is that the first value of every CDF be zero.
|
||||
Then aom_cdf_init_q15_1D() will be called with the real size the first time
|
||||
the CDF is used. */
|
||||
#define OD_CDFS_INIT_DYNAMIC(cdf) (memset(cdf, 0, sizeof(cdf)))
|
||||
|
||||
// WARNING: DO NOT USE this init function,
|
||||
// if the size of cdf is different from what is declared by code.
|
||||
#define OD_CDFS_INIT_Q15(cdfs) \
|
||||
{ int n_cdfs = sizeof(cdfs)/sizeof(cdfs[0]); \
|
||||
int cdf_size = sizeof(cdfs[0])/sizeof(cdfs[0][0]); \
|
||||
int nsyms = cdf_size - 1; \
|
||||
int i_; \
|
||||
for (i_ = 0; i_ < n_cdfs; i_++) \
|
||||
aom_cdf_init_q15_1D(cdfs[i_], nsyms, cdf_size); \
|
||||
}
|
||||
|
||||
void aom_cdf_init(uint16_t *cdf, int ncdfs, int nsyms, int val, int first);
|
||||
|
||||
void aom_cdf_init_q15_1D(uint16_t *cdf, int nsyms, int cdf_size);
|
||||
|
||||
void aom_cdf_adapt_q15(int val, uint16_t *cdf, int n, int *count, int rate);
|
||||
|
||||
void aom_encode_cdf_adapt_q15(aom_writer *w, int val, uint16_t *cdf, int n,
|
||||
int *count, int rate);
|
||||
|
||||
void generic_encode(aom_writer *w, generic_encoder *model, int x,
|
||||
int *ex_q16, int integration);
|
||||
double generic_encode_cost(generic_encoder *model, int x, int *ex_q16);
|
||||
|
||||
double od_encode_cdf_cost(int val, uint16_t *cdf, int n);
|
||||
|
||||
int aom_decode_cdf_adapt_q15_(aom_reader *r, uint16_t *cdf, int n,
|
||||
int *count, int rate ACCT_STR_PARAM);
|
||||
|
||||
int generic_decode_(aom_reader *r, generic_encoder *model,
|
||||
int *ex_q16, int integration ACCT_STR_PARAM);
|
||||
|
||||
int log_ex(int ex_q16);
|
||||
|
||||
void generic_model_update(int *ex_q16, int x, int integration);
|
||||
|
||||
#endif
|
||||
3091
third_party/aom/av1/common/idct.c
vendored
3091
third_party/aom/av1/common/idct.c
vendored
File diff suppressed because it is too large
Load diff
57
third_party/aom/av1/common/idct.h
vendored
57
third_party/aom/av1/common/idct.h
vendored
|
|
@ -12,15 +12,12 @@
|
|||
#ifndef AV1_COMMON_IDCT_H_
|
||||
#define AV1_COMMON_IDCT_H_
|
||||
|
||||
#include <assert.h>
|
||||
#include "config/aom_config.h"
|
||||
|
||||
#include "./aom_config.h"
|
||||
#include "av1/common/blockd.h"
|
||||
#include "av1/common/common.h"
|
||||
#include "av1/common/enums.h"
|
||||
#include "aom_dsp/inv_txfm.h"
|
||||
#include "aom_dsp/txfm_common.h"
|
||||
#include "aom_ports/mem.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
@ -32,64 +29,16 @@ 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_LGT_FROM_PRED
|
||||
void get_lgt4_from_pred(const TxfmParam *txfm_param, int is_col,
|
||||
const tran_high_t **lgtmtx, int ntx);
|
||||
void get_lgt8_from_pred(const TxfmParam *txfm_param, int is_col,
|
||||
const tran_high_t **lgtmtx, int ntx);
|
||||
void get_lgt16up_from_pred(const TxfmParam *txfm_param, int is_col,
|
||||
const tran_high_t **lgtmtx, int ntx);
|
||||
#endif // CONFIG_LGT_FROM_PRED
|
||||
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
typedef void (*highbd_transform_1d)(const tran_low_t *, tran_low_t *, int bd);
|
||||
|
||||
typedef struct {
|
||||
highbd_transform_1d cols, rows; // vertical and horizontal
|
||||
} highbd_transform_2d;
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
|
||||
#define MAX_TX_SCALE 1
|
||||
int av1_get_tx_scale(const TX_SIZE tx_size);
|
||||
|
||||
void av1_iwht4x4_add(const tran_low_t *input, uint8_t *dest, int stride,
|
||||
const TxfmParam *txfm_param);
|
||||
void av1_idct4x4_add(const tran_low_t *input, uint8_t *dest, int stride,
|
||||
const TxfmParam *txfm_param);
|
||||
|
||||
void av1_inv_txfm_add(const tran_low_t *input, uint8_t *dest, int stride,
|
||||
TxfmParam *txfm_param);
|
||||
void av1_inverse_transform_block(const MACROBLOCKD *xd,
|
||||
const tran_low_t *dqcoeff,
|
||||
#if CONFIG_LGT_FROM_PRED
|
||||
PREDICTION_MODE mode,
|
||||
#endif
|
||||
#if CONFIG_MRC_TX && SIGNAL_ANY_MRC_MASK
|
||||
uint8_t *mrc_mask,
|
||||
#endif // CONFIG_MRC_TX && SIGNAL_ANY_MRC_MASK
|
||||
const tran_low_t *dqcoeff, int plane,
|
||||
TX_TYPE tx_type, TX_SIZE tx_size, uint8_t *dst,
|
||||
int stride, int eob);
|
||||
void av1_inverse_transform_block_facade(MACROBLOCKD *xd, int plane, int block,
|
||||
int blk_row, int blk_col, int eob);
|
||||
int stride, int eob, int reduced_tx_set);
|
||||
|
||||
void av1_highbd_iwht4x4_add(const tran_low_t *input, uint8_t *dest, int stride,
|
||||
int eob, int bd);
|
||||
void av1_highbd_inv_txfm_add_4x4(const tran_low_t *input, uint8_t *dest,
|
||||
int stride, const TxfmParam *param);
|
||||
void av1_highbd_inv_txfm_add_4x8(const tran_low_t *input, uint8_t *dest,
|
||||
int stride, const TxfmParam *param);
|
||||
void av1_highbd_inv_txfm_add_8x4(const tran_low_t *input, uint8_t *dest,
|
||||
int stride, const TxfmParam *param);
|
||||
void av1_highbd_inv_txfm_add(const tran_low_t *input, uint8_t *dest, int stride,
|
||||
TxfmParam *txfm_param);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
|
|
|||
657
third_party/aom/av1/common/laplace_tables.c
vendored
657
third_party/aom/av1/common/laplace_tables.c
vendored
|
|
@ -1,657 +0,0 @@
|
|||
/* This file is auto-generated using "gen_laplace_tables 128 7" */
|
||||
|
||||
/* clang-format off */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include "aom_dsp/prob.h"
|
||||
#include "pvq.h"
|
||||
|
||||
const uint16_t EXP_CDF_TABLE[128][16] = {
|
||||
{AOM_ICDF(32753), AOM_ICDF(32754), AOM_ICDF(32755), AOM_ICDF(32756),
|
||||
AOM_ICDF(32757), AOM_ICDF(32758), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(32499), AOM_ICDF(32753), AOM_ICDF(32755), AOM_ICDF(32756),
|
||||
AOM_ICDF(32757), AOM_ICDF(32758), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(32243), AOM_ICDF(32747), AOM_ICDF(32755), AOM_ICDF(32756),
|
||||
AOM_ICDF(32757), AOM_ICDF(32758), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(31987), AOM_ICDF(32737), AOM_ICDF(32755), AOM_ICDF(32756),
|
||||
AOM_ICDF(32757), AOM_ICDF(32758), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(31732), AOM_ICDF(32724), AOM_ICDF(32755), AOM_ICDF(32756),
|
||||
AOM_ICDF(32757), AOM_ICDF(32758), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(31476), AOM_ICDF(32706), AOM_ICDF(32754), AOM_ICDF(32756),
|
||||
AOM_ICDF(32757), AOM_ICDF(32758), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(31220), AOM_ICDF(32684), AOM_ICDF(32753), AOM_ICDF(32756),
|
||||
AOM_ICDF(32757), AOM_ICDF(32758), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(30964), AOM_ICDF(32658), AOM_ICDF(32751), AOM_ICDF(32756),
|
||||
AOM_ICDF(32757), AOM_ICDF(32758), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(30708), AOM_ICDF(32628), AOM_ICDF(32748), AOM_ICDF(32756),
|
||||
AOM_ICDF(32757), AOM_ICDF(32758), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(30452), AOM_ICDF(32594), AOM_ICDF(32745), AOM_ICDF(32756),
|
||||
AOM_ICDF(32757), AOM_ICDF(32758), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(30198), AOM_ICDF(32558), AOM_ICDF(32742), AOM_ICDF(32756),
|
||||
AOM_ICDF(32757), AOM_ICDF(32758), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(29941), AOM_ICDF(32515), AOM_ICDF(32736), AOM_ICDF(32755),
|
||||
AOM_ICDF(32757), AOM_ICDF(32758), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(29686), AOM_ICDF(32470), AOM_ICDF(32731), AOM_ICDF(32755),
|
||||
AOM_ICDF(32757), AOM_ICDF(32758), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(29429), AOM_ICDF(32419), AOM_ICDF(32723), AOM_ICDF(32754),
|
||||
AOM_ICDF(32757), AOM_ICDF(32758), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(29174), AOM_ICDF(32366), AOM_ICDF(32715), AOM_ICDF(32753),
|
||||
AOM_ICDF(32757), AOM_ICDF(32758), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(28918), AOM_ICDF(32308), AOM_ICDF(32705), AOM_ICDF(32752),
|
||||
AOM_ICDF(32757), AOM_ICDF(32758), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(28662), AOM_ICDF(32246), AOM_ICDF(32694), AOM_ICDF(32750),
|
||||
AOM_ICDF(32757), AOM_ICDF(32758), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(28406), AOM_ICDF(32180), AOM_ICDF(32681), AOM_ICDF(32748),
|
||||
AOM_ICDF(32757), AOM_ICDF(32758), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(28150), AOM_ICDF(32110), AOM_ICDF(32667), AOM_ICDF(32745),
|
||||
AOM_ICDF(32756), AOM_ICDF(32758), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(27894), AOM_ICDF(32036), AOM_ICDF(32651), AOM_ICDF(32742),
|
||||
AOM_ICDF(32756), AOM_ICDF(32758), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(27639), AOM_ICDF(31959), AOM_ICDF(32634), AOM_ICDF(32739),
|
||||
AOM_ICDF(32755), AOM_ICDF(32758), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(27383), AOM_ICDF(31877), AOM_ICDF(32614), AOM_ICDF(32735),
|
||||
AOM_ICDF(32755), AOM_ICDF(32758), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(27126), AOM_ICDF(31790), AOM_ICDF(32592), AOM_ICDF(32730),
|
||||
AOM_ICDF(32754), AOM_ICDF(32758), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(26871), AOM_ICDF(31701), AOM_ICDF(32569), AOM_ICDF(32725),
|
||||
AOM_ICDF(32753), AOM_ICDF(32758), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(26615), AOM_ICDF(31607), AOM_ICDF(32543), AOM_ICDF(32719),
|
||||
AOM_ICDF(32752), AOM_ICDF(32758), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(26361), AOM_ICDF(31511), AOM_ICDF(32517), AOM_ICDF(32713),
|
||||
AOM_ICDF(32751), AOM_ICDF(32758), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(26104), AOM_ICDF(31408), AOM_ICDF(32485), AOM_ICDF(32704),
|
||||
AOM_ICDF(32748), AOM_ICDF(32757), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(25848), AOM_ICDF(31302), AOM_ICDF(32452), AOM_ICDF(32695),
|
||||
AOM_ICDF(32746), AOM_ICDF(32757), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(25591), AOM_ICDF(31191), AOM_ICDF(32416), AOM_ICDF(32684),
|
||||
AOM_ICDF(32743), AOM_ICDF(32756), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(25336), AOM_ICDF(31078), AOM_ICDF(32379), AOM_ICDF(32674),
|
||||
AOM_ICDF(32741), AOM_ICDF(32756), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(25080), AOM_ICDF(30960), AOM_ICDF(32338), AOM_ICDF(32661),
|
||||
AOM_ICDF(32737), AOM_ICDF(32755), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(24824), AOM_ICDF(30838), AOM_ICDF(32295), AOM_ICDF(32648),
|
||||
AOM_ICDF(32733), AOM_ICDF(32754), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(24568), AOM_ICDF(30712), AOM_ICDF(32248), AOM_ICDF(32632),
|
||||
AOM_ICDF(32728), AOM_ICDF(32752), AOM_ICDF(32758), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(24313), AOM_ICDF(30583), AOM_ICDF(32199), AOM_ICDF(32616),
|
||||
AOM_ICDF(32723), AOM_ICDF(32751), AOM_ICDF(32758), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(24057), AOM_ICDF(30449), AOM_ICDF(32147), AOM_ICDF(32598),
|
||||
AOM_ICDF(32718), AOM_ICDF(32750), AOM_ICDF(32758), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(23801), AOM_ICDF(30311), AOM_ICDF(32091), AOM_ICDF(32578),
|
||||
AOM_ICDF(32711), AOM_ICDF(32747), AOM_ICDF(32757), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(23546), AOM_ICDF(30170), AOM_ICDF(32033), AOM_ICDF(32557),
|
||||
AOM_ICDF(32704), AOM_ICDF(32745), AOM_ICDF(32757), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(23288), AOM_ICDF(30022), AOM_ICDF(31969), AOM_ICDF(32532),
|
||||
AOM_ICDF(32695), AOM_ICDF(32742), AOM_ICDF(32756), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(23033), AOM_ICDF(29873), AOM_ICDF(31904), AOM_ICDF(32507),
|
||||
AOM_ICDF(32686), AOM_ICDF(32739), AOM_ICDF(32755), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(22778), AOM_ICDF(29720), AOM_ICDF(31835), AOM_ICDF(32479),
|
||||
AOM_ICDF(32675), AOM_ICDF(32735), AOM_ICDF(32753), AOM_ICDF(32759),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(22521), AOM_ICDF(29561), AOM_ICDF(31761), AOM_ICDF(32449),
|
||||
AOM_ICDF(32664), AOM_ICDF(32731), AOM_ICDF(32752), AOM_ICDF(32759),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(22267), AOM_ICDF(29401), AOM_ICDF(31686), AOM_ICDF(32418),
|
||||
AOM_ICDF(32652), AOM_ICDF(32727), AOM_ICDF(32751), AOM_ICDF(32759),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(22011), AOM_ICDF(29235), AOM_ICDF(31605), AOM_ICDF(32383),
|
||||
AOM_ICDF(32638), AOM_ICDF(32722), AOM_ICDF(32749), AOM_ICDF(32758),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(21754), AOM_ICDF(29064), AOM_ICDF(31520), AOM_ICDF(32345),
|
||||
AOM_ICDF(32622), AOM_ICDF(32715), AOM_ICDF(32746), AOM_ICDF(32757),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(21501), AOM_ICDF(28893), AOM_ICDF(31434), AOM_ICDF(32307),
|
||||
AOM_ICDF(32607), AOM_ICDF(32710), AOM_ICDF(32745), AOM_ICDF(32757),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(21243), AOM_ICDF(28713), AOM_ICDF(31339), AOM_ICDF(32262),
|
||||
AOM_ICDF(32587), AOM_ICDF(32701), AOM_ICDF(32741), AOM_ICDF(32755),
|
||||
AOM_ICDF(32760), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(20988), AOM_ICDF(28532), AOM_ICDF(31243), AOM_ICDF(32217),
|
||||
AOM_ICDF(32567), AOM_ICDF(32693), AOM_ICDF(32738), AOM_ICDF(32754),
|
||||
AOM_ICDF(32760), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(20730), AOM_ICDF(28344), AOM_ICDF(31140), AOM_ICDF(32167),
|
||||
AOM_ICDF(32544), AOM_ICDF(32682), AOM_ICDF(32733), AOM_ICDF(32752),
|
||||
AOM_ICDF(32759), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(20476), AOM_ICDF(28156), AOM_ICDF(31036), AOM_ICDF(32116),
|
||||
AOM_ICDF(32521), AOM_ICDF(32673), AOM_ICDF(32730), AOM_ICDF(32751),
|
||||
AOM_ICDF(32759), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(20220), AOM_ICDF(27962), AOM_ICDF(30926), AOM_ICDF(32061),
|
||||
AOM_ICDF(32495), AOM_ICDF(32661), AOM_ICDF(32725), AOM_ICDF(32749),
|
||||
AOM_ICDF(32758), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(19963), AOM_ICDF(27763), AOM_ICDF(30810), AOM_ICDF(32000),
|
||||
AOM_ICDF(32465), AOM_ICDF(32647), AOM_ICDF(32718), AOM_ICDF(32746),
|
||||
AOM_ICDF(32757), AOM_ICDF(32761), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(19708), AOM_ICDF(27562), AOM_ICDF(30691), AOM_ICDF(31938),
|
||||
AOM_ICDF(32435), AOM_ICDF(32633), AOM_ICDF(32712), AOM_ICDF(32743),
|
||||
AOM_ICDF(32756), AOM_ICDF(32761), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(19454), AOM_ICDF(27358), AOM_ICDF(30569), AOM_ICDF(31873),
|
||||
AOM_ICDF(32403), AOM_ICDF(32618), AOM_ICDF(32705), AOM_ICDF(32741),
|
||||
AOM_ICDF(32755), AOM_ICDF(32761), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(19196), AOM_ICDF(27146), AOM_ICDF(30438), AOM_ICDF(31801),
|
||||
AOM_ICDF(32365), AOM_ICDF(32599), AOM_ICDF(32696), AOM_ICDF(32736),
|
||||
AOM_ICDF(32753), AOM_ICDF(32760), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(18942), AOM_ICDF(26934), AOM_ICDF(30306), AOM_ICDF(31728),
|
||||
AOM_ICDF(32328), AOM_ICDF(32581), AOM_ICDF(32688), AOM_ICDF(32733),
|
||||
AOM_ICDF(32752), AOM_ICDF(32760), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(18684), AOM_ICDF(26714), AOM_ICDF(30164), AOM_ICDF(31647),
|
||||
AOM_ICDF(32284), AOM_ICDF(32558), AOM_ICDF(32676), AOM_ICDF(32727),
|
||||
AOM_ICDF(32749), AOM_ICDF(32758), AOM_ICDF(32762), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(18429), AOM_ICDF(26493), AOM_ICDF(30021), AOM_ICDF(31565),
|
||||
AOM_ICDF(32240), AOM_ICDF(32535), AOM_ICDF(32664), AOM_ICDF(32721),
|
||||
AOM_ICDF(32746), AOM_ICDF(32757), AOM_ICDF(32762), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(18174), AOM_ICDF(26268), AOM_ICDF(29872), AOM_ICDF(31477),
|
||||
AOM_ICDF(32192), AOM_ICDF(32510), AOM_ICDF(32652), AOM_ICDF(32715),
|
||||
AOM_ICDF(32743), AOM_ICDF(32756), AOM_ICDF(32762), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(17920), AOM_ICDF(26040), AOM_ICDF(29719), AOM_ICDF(31386),
|
||||
AOM_ICDF(32141), AOM_ICDF(32483), AOM_ICDF(32638), AOM_ICDF(32708),
|
||||
AOM_ICDF(32740), AOM_ICDF(32754), AOM_ICDF(32761), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(17661), AOM_ICDF(25803), AOM_ICDF(29556), AOM_ICDF(31286),
|
||||
AOM_ICDF(32083), AOM_ICDF(32451), AOM_ICDF(32620), AOM_ICDF(32698),
|
||||
AOM_ICDF(32734), AOM_ICDF(32751), AOM_ICDF(32759), AOM_ICDF(32763),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(17406), AOM_ICDF(25566), AOM_ICDF(29391), AOM_ICDF(31184),
|
||||
AOM_ICDF(32024), AOM_ICDF(32418), AOM_ICDF(32603), AOM_ICDF(32690),
|
||||
AOM_ICDF(32731), AOM_ICDF(32750), AOM_ICDF(32759), AOM_ICDF(32763),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(17151), AOM_ICDF(25325), AOM_ICDF(29220), AOM_ICDF(31076),
|
||||
AOM_ICDF(31961), AOM_ICDF(32383), AOM_ICDF(32584), AOM_ICDF(32680),
|
||||
AOM_ICDF(32726), AOM_ICDF(32748), AOM_ICDF(32758), AOM_ICDF(32763),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(16896), AOM_ICDF(25080), AOM_ICDF(29044), AOM_ICDF(30964),
|
||||
AOM_ICDF(31894), AOM_ICDF(32344), AOM_ICDF(32562), AOM_ICDF(32668),
|
||||
AOM_ICDF(32719), AOM_ICDF(32744), AOM_ICDF(32756), AOM_ICDF(32762),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(16639), AOM_ICDF(24829), AOM_ICDF(28860), AOM_ICDF(30844),
|
||||
AOM_ICDF(31821), AOM_ICDF(32302), AOM_ICDF(32539), AOM_ICDF(32655),
|
||||
AOM_ICDF(32712), AOM_ICDF(32740), AOM_ICDF(32754), AOM_ICDF(32761),
|
||||
AOM_ICDF(32764), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(28672), AOM_ICDF(30720),
|
||||
AOM_ICDF(31744), AOM_ICDF(32256), AOM_ICDF(32512), AOM_ICDF(32640),
|
||||
AOM_ICDF(32704), AOM_ICDF(32736), AOM_ICDF(32752), AOM_ICDF(32760),
|
||||
AOM_ICDF(32764), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(16130), AOM_ICDF(24320), AOM_ICDF(28479), AOM_ICDF(30591),
|
||||
AOM_ICDF(31663), AOM_ICDF(32208), AOM_ICDF(32485), AOM_ICDF(32625),
|
||||
AOM_ICDF(32696), AOM_ICDF(32732), AOM_ICDF(32750), AOM_ICDF(32759),
|
||||
AOM_ICDF(32764), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(15872), AOM_ICDF(24056), AOM_ICDF(28276), AOM_ICDF(30452),
|
||||
AOM_ICDF(31574), AOM_ICDF(32152), AOM_ICDF(32450), AOM_ICDF(32604),
|
||||
AOM_ICDF(32683), AOM_ICDF(32724), AOM_ICDF(32745), AOM_ICDF(32756),
|
||||
AOM_ICDF(32762), AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(15615), AOM_ICDF(23789), AOM_ICDF(28068), AOM_ICDF(30308),
|
||||
AOM_ICDF(31480), AOM_ICDF(32094), AOM_ICDF(32415), AOM_ICDF(32583),
|
||||
AOM_ICDF(32671), AOM_ICDF(32717), AOM_ICDF(32741), AOM_ICDF(32754),
|
||||
AOM_ICDF(32761), AOM_ICDF(32764), AOM_ICDF(32766), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(15361), AOM_ICDF(23521), AOM_ICDF(27856), AOM_ICDF(30159),
|
||||
AOM_ICDF(31382), AOM_ICDF(32032), AOM_ICDF(32377), AOM_ICDF(32560),
|
||||
AOM_ICDF(32657), AOM_ICDF(32709), AOM_ICDF(32737), AOM_ICDF(32752),
|
||||
AOM_ICDF(32760), AOM_ICDF(32764), AOM_ICDF(32766), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(15103), AOM_ICDF(23245), AOM_ICDF(27634), AOM_ICDF(30000),
|
||||
AOM_ICDF(31275), AOM_ICDF(31963), AOM_ICDF(32334), AOM_ICDF(32534),
|
||||
AOM_ICDF(32642), AOM_ICDF(32700), AOM_ICDF(32731), AOM_ICDF(32748),
|
||||
AOM_ICDF(32757), AOM_ICDF(32762), AOM_ICDF(32765), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(14848), AOM_ICDF(22968), AOM_ICDF(27409), AOM_ICDF(29837),
|
||||
AOM_ICDF(31165), AOM_ICDF(31891), AOM_ICDF(32288), AOM_ICDF(32505),
|
||||
AOM_ICDF(32624), AOM_ICDF(32689), AOM_ICDF(32725), AOM_ICDF(32744),
|
||||
AOM_ICDF(32755), AOM_ICDF(32761), AOM_ICDF(32764), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(14592), AOM_ICDF(22686), AOM_ICDF(27176), AOM_ICDF(29666),
|
||||
AOM_ICDF(31047), AOM_ICDF(31813), AOM_ICDF(32238), AOM_ICDF(32474),
|
||||
AOM_ICDF(32605), AOM_ICDF(32678), AOM_ICDF(32718), AOM_ICDF(32740),
|
||||
AOM_ICDF(32752), AOM_ICDF(32759), AOM_ICDF(32763), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(14336), AOM_ICDF(22400), AOM_ICDF(26936), AOM_ICDF(29488),
|
||||
AOM_ICDF(30923), AOM_ICDF(31730), AOM_ICDF(32184), AOM_ICDF(32439),
|
||||
AOM_ICDF(32583), AOM_ICDF(32664), AOM_ICDF(32709), AOM_ICDF(32735),
|
||||
AOM_ICDF(32749), AOM_ICDF(32757), AOM_ICDF(32762), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(14079), AOM_ICDF(22109), AOM_ICDF(26689), AOM_ICDF(29301),
|
||||
AOM_ICDF(30791), AOM_ICDF(31641), AOM_ICDF(32125), AOM_ICDF(32401),
|
||||
AOM_ICDF(32559), AOM_ICDF(32649), AOM_ICDF(32700), AOM_ICDF(32729),
|
||||
AOM_ICDF(32746), AOM_ICDF(32756), AOM_ICDF(32761), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(13825), AOM_ICDF(21817), AOM_ICDF(26437), AOM_ICDF(29108),
|
||||
AOM_ICDF(30652), AOM_ICDF(31545), AOM_ICDF(32061), AOM_ICDF(32359),
|
||||
AOM_ICDF(32532), AOM_ICDF(32632), AOM_ICDF(32690), AOM_ICDF(32723),
|
||||
AOM_ICDF(32742), AOM_ICDF(32753), AOM_ICDF(32759), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(13568), AOM_ICDF(21518), AOM_ICDF(26176), AOM_ICDF(28905),
|
||||
AOM_ICDF(30504), AOM_ICDF(31441), AOM_ICDF(31990), AOM_ICDF(32312),
|
||||
AOM_ICDF(32501), AOM_ICDF(32611), AOM_ICDF(32676), AOM_ICDF(32714),
|
||||
AOM_ICDF(32736), AOM_ICDF(32749), AOM_ICDF(32757), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(13314), AOM_ICDF(21218), AOM_ICDF(25911), AOM_ICDF(28697),
|
||||
AOM_ICDF(30351), AOM_ICDF(31333), AOM_ICDF(31916), AOM_ICDF(32262),
|
||||
AOM_ICDF(32468), AOM_ICDF(32590), AOM_ICDF(32662), AOM_ICDF(32705),
|
||||
AOM_ICDF(32731), AOM_ICDF(32746), AOM_ICDF(32755), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(13054), AOM_ICDF(20908), AOM_ICDF(25633), AOM_ICDF(28475),
|
||||
AOM_ICDF(30185), AOM_ICDF(31214), AOM_ICDF(31833), AOM_ICDF(32205),
|
||||
AOM_ICDF(32429), AOM_ICDF(32564), AOM_ICDF(32645), AOM_ICDF(32694),
|
||||
AOM_ICDF(32723), AOM_ICDF(32741), AOM_ICDF(32752), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(12803), AOM_ICDF(20603), AOM_ICDF(25356), AOM_ICDF(28252),
|
||||
AOM_ICDF(30017), AOM_ICDF(31093), AOM_ICDF(31748), AOM_ICDF(32147),
|
||||
AOM_ICDF(32390), AOM_ICDF(32538), AOM_ICDF(32628), AOM_ICDF(32683),
|
||||
AOM_ICDF(32717), AOM_ICDF(32737), AOM_ICDF(32749), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(12544), AOM_ICDF(20286), AOM_ICDF(25064), AOM_ICDF(28013),
|
||||
AOM_ICDF(29833), AOM_ICDF(30956), AOM_ICDF(31649), AOM_ICDF(32077),
|
||||
AOM_ICDF(32341), AOM_ICDF(32504), AOM_ICDF(32605), AOM_ICDF(32667),
|
||||
AOM_ICDF(32705), AOM_ICDF(32729), AOM_ICDF(32744), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(12288), AOM_ICDF(19968), AOM_ICDF(24768), AOM_ICDF(27768),
|
||||
AOM_ICDF(29643), AOM_ICDF(30815), AOM_ICDF(31547), AOM_ICDF(32005),
|
||||
AOM_ICDF(32291), AOM_ICDF(32470), AOM_ICDF(32582), AOM_ICDF(32652),
|
||||
AOM_ICDF(32696), AOM_ICDF(32723), AOM_ICDF(32740), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(12033), AOM_ICDF(19647), AOM_ICDF(24465), AOM_ICDF(27514),
|
||||
AOM_ICDF(29443), AOM_ICDF(30664), AOM_ICDF(31437), AOM_ICDF(31926),
|
||||
AOM_ICDF(32235), AOM_ICDF(32431), AOM_ICDF(32555), AOM_ICDF(32633),
|
||||
AOM_ICDF(32683), AOM_ICDF(32714), AOM_ICDF(32734), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(11777), AOM_ICDF(19321), AOM_ICDF(24154), AOM_ICDF(27250),
|
||||
AOM_ICDF(29233), AOM_ICDF(30504), AOM_ICDF(31318), AOM_ICDF(31839),
|
||||
AOM_ICDF(32173), AOM_ICDF(32387), AOM_ICDF(32524), AOM_ICDF(32612),
|
||||
AOM_ICDF(32668), AOM_ICDF(32704), AOM_ICDF(32727), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(11521), AOM_ICDF(18991), AOM_ICDF(23835), AOM_ICDF(26976),
|
||||
AOM_ICDF(29013), AOM_ICDF(30334), AOM_ICDF(31190), AOM_ICDF(31745),
|
||||
AOM_ICDF(32105), AOM_ICDF(32338), AOM_ICDF(32489), AOM_ICDF(32587),
|
||||
AOM_ICDF(32651), AOM_ICDF(32692), AOM_ICDF(32719), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(11265), AOM_ICDF(18657), AOM_ICDF(23508), AOM_ICDF(26691),
|
||||
AOM_ICDF(28780), AOM_ICDF(30151), AOM_ICDF(31051), AOM_ICDF(31641),
|
||||
AOM_ICDF(32028), AOM_ICDF(32282), AOM_ICDF(32449), AOM_ICDF(32559),
|
||||
AOM_ICDF(32631), AOM_ICDF(32678), AOM_ICDF(32709), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(11006), AOM_ICDF(18316), AOM_ICDF(23170), AOM_ICDF(26394),
|
||||
AOM_ICDF(28535), AOM_ICDF(29957), AOM_ICDF(30901), AOM_ICDF(31528),
|
||||
AOM_ICDF(31944), AOM_ICDF(32220), AOM_ICDF(32404), AOM_ICDF(32526),
|
||||
AOM_ICDF(32607), AOM_ICDF(32661), AOM_ICDF(32697), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(10752), AOM_ICDF(17976), AOM_ICDF(22830), AOM_ICDF(26091),
|
||||
AOM_ICDF(28282), AOM_ICDF(29754), AOM_ICDF(30743), AOM_ICDF(31408),
|
||||
AOM_ICDF(31854), AOM_ICDF(32154), AOM_ICDF(32356), AOM_ICDF(32491),
|
||||
AOM_ICDF(32582), AOM_ICDF(32643), AOM_ICDF(32684), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(10496), AOM_ICDF(17630), AOM_ICDF(22479), AOM_ICDF(25775),
|
||||
AOM_ICDF(28015), AOM_ICDF(29538), AOM_ICDF(30573), AOM_ICDF(31276),
|
||||
AOM_ICDF(31754), AOM_ICDF(32079), AOM_ICDF(32300), AOM_ICDF(32450),
|
||||
AOM_ICDF(32552), AOM_ICDF(32621), AOM_ICDF(32668), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(10240), AOM_ICDF(17280), AOM_ICDF(22120), AOM_ICDF(25448),
|
||||
AOM_ICDF(27736), AOM_ICDF(29309), AOM_ICDF(30390), AOM_ICDF(31133),
|
||||
AOM_ICDF(31644), AOM_ICDF(31995), AOM_ICDF(32237), AOM_ICDF(32403),
|
||||
AOM_ICDF(32517), AOM_ICDF(32595), AOM_ICDF(32649), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(9984), AOM_ICDF(16926), AOM_ICDF(21753), AOM_ICDF(25109),
|
||||
AOM_ICDF(27443), AOM_ICDF(29066), AOM_ICDF(30194), AOM_ICDF(30978),
|
||||
AOM_ICDF(31523), AOM_ICDF(31902), AOM_ICDF(32166), AOM_ICDF(32349),
|
||||
AOM_ICDF(32476), AOM_ICDF(32565), AOM_ICDF(32627), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(9728), AOM_ICDF(16568), AOM_ICDF(21377), AOM_ICDF(24759),
|
||||
AOM_ICDF(27137), AOM_ICDF(28809), AOM_ICDF(29984), AOM_ICDF(30811),
|
||||
AOM_ICDF(31392), AOM_ICDF(31801), AOM_ICDF(32088), AOM_ICDF(32290),
|
||||
AOM_ICDF(32432), AOM_ICDF(32532), AOM_ICDF(32602), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(9474), AOM_ICDF(16208), AOM_ICDF(20995), AOM_ICDF(24399),
|
||||
AOM_ICDF(26819), AOM_ICDF(28539), AOM_ICDF(29762), AOM_ICDF(30631),
|
||||
AOM_ICDF(31249), AOM_ICDF(31688), AOM_ICDF(32000), AOM_ICDF(32222),
|
||||
AOM_ICDF(32380), AOM_ICDF(32492), AOM_ICDF(32572), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(9216), AOM_ICDF(15840), AOM_ICDF(20601), AOM_ICDF(24023),
|
||||
AOM_ICDF(26483), AOM_ICDF(28251), AOM_ICDF(29522), AOM_ICDF(30435),
|
||||
AOM_ICDF(31091), AOM_ICDF(31563), AOM_ICDF(31902), AOM_ICDF(32146),
|
||||
AOM_ICDF(32321), AOM_ICDF(32447), AOM_ICDF(32537), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(8959), AOM_ICDF(15469), AOM_ICDF(20199), AOM_ICDF(23636),
|
||||
AOM_ICDF(26133), AOM_ICDF(27947), AOM_ICDF(29265), AOM_ICDF(30223),
|
||||
AOM_ICDF(30919), AOM_ICDF(31425), AOM_ICDF(31792), AOM_ICDF(32059),
|
||||
AOM_ICDF(32253), AOM_ICDF(32394), AOM_ICDF(32496), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(8705), AOM_ICDF(15097), AOM_ICDF(19791), AOM_ICDF(23238),
|
||||
AOM_ICDF(25770), AOM_ICDF(27629), AOM_ICDF(28994), AOM_ICDF(29997),
|
||||
AOM_ICDF(30733), AOM_ICDF(31274), AOM_ICDF(31671), AOM_ICDF(31963),
|
||||
AOM_ICDF(32177), AOM_ICDF(32334), AOM_ICDF(32449), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(8449), AOM_ICDF(14719), AOM_ICDF(19373), AOM_ICDF(22827),
|
||||
AOM_ICDF(25390), AOM_ICDF(27292), AOM_ICDF(28704), AOM_ICDF(29752),
|
||||
AOM_ICDF(30530), AOM_ICDF(31107), AOM_ICDF(31535), AOM_ICDF(31853),
|
||||
AOM_ICDF(32089), AOM_ICDF(32264), AOM_ICDF(32394), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(8192), AOM_ICDF(14336), AOM_ICDF(18944), AOM_ICDF(22400),
|
||||
AOM_ICDF(24992), AOM_ICDF(26936), AOM_ICDF(28394), AOM_ICDF(29488),
|
||||
AOM_ICDF(30308), AOM_ICDF(30923), AOM_ICDF(31384), AOM_ICDF(31730),
|
||||
AOM_ICDF(31989), AOM_ICDF(32184), AOM_ICDF(32330), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(7936), AOM_ICDF(13950), AOM_ICDF(18507), AOM_ICDF(21961),
|
||||
AOM_ICDF(24578), AOM_ICDF(26561), AOM_ICDF(28064), AOM_ICDF(29203),
|
||||
AOM_ICDF(30066), AOM_ICDF(30720), AOM_ICDF(31216), AOM_ICDF(31592),
|
||||
AOM_ICDF(31877), AOM_ICDF(32093), AOM_ICDF(32256), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(7678), AOM_ICDF(13558), AOM_ICDF(18060), AOM_ICDF(21507),
|
||||
AOM_ICDF(24146), AOM_ICDF(26166), AOM_ICDF(27713), AOM_ICDF(28897),
|
||||
AOM_ICDF(29804), AOM_ICDF(30498), AOM_ICDF(31030), AOM_ICDF(31437),
|
||||
AOM_ICDF(31749), AOM_ICDF(31988), AOM_ICDF(32171), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(7423), AOM_ICDF(13165), AOM_ICDF(17606), AOM_ICDF(21041),
|
||||
AOM_ICDF(23698), AOM_ICDF(25753), AOM_ICDF(27342), AOM_ICDF(28571),
|
||||
AOM_ICDF(29522), AOM_ICDF(30257), AOM_ICDF(30826), AOM_ICDF(31266),
|
||||
AOM_ICDF(31606), AOM_ICDF(31869), AOM_ICDF(32073), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(7168), AOM_ICDF(12768), AOM_ICDF(17143), AOM_ICDF(20561),
|
||||
AOM_ICDF(23231), AOM_ICDF(25317), AOM_ICDF(26947), AOM_ICDF(28220),
|
||||
AOM_ICDF(29215), AOM_ICDF(29992), AOM_ICDF(30599), AOM_ICDF(31073),
|
||||
AOM_ICDF(31444), AOM_ICDF(31734), AOM_ICDF(31960), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(6911), AOM_ICDF(12365), AOM_ICDF(16669), AOM_ICDF(20065),
|
||||
AOM_ICDF(22744), AOM_ICDF(24858), AOM_ICDF(26526), AOM_ICDF(27842),
|
||||
AOM_ICDF(28881), AOM_ICDF(29701), AOM_ICDF(30348), AOM_ICDF(30858),
|
||||
AOM_ICDF(31261), AOM_ICDF(31579), AOM_ICDF(31830), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(6657), AOM_ICDF(11961), AOM_ICDF(16188), AOM_ICDF(19556),
|
||||
AOM_ICDF(22240), AOM_ICDF(24379), AOM_ICDF(26083), AOM_ICDF(27441),
|
||||
AOM_ICDF(28523), AOM_ICDF(29385), AOM_ICDF(30072), AOM_ICDF(30620),
|
||||
AOM_ICDF(31056), AOM_ICDF(31404), AOM_ICDF(31681), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(6400), AOM_ICDF(11550), AOM_ICDF(15694), AOM_ICDF(19029),
|
||||
AOM_ICDF(21712), AOM_ICDF(23871), AOM_ICDF(25609), AOM_ICDF(27007),
|
||||
AOM_ICDF(28132), AOM_ICDF(29037), AOM_ICDF(29766), AOM_ICDF(30352),
|
||||
AOM_ICDF(30824), AOM_ICDF(31204), AOM_ICDF(31509), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(6142), AOM_ICDF(11134), AOM_ICDF(15190), AOM_ICDF(18486),
|
||||
AOM_ICDF(21164), AOM_ICDF(23340), AOM_ICDF(25108), AOM_ICDF(26544),
|
||||
AOM_ICDF(27711), AOM_ICDF(28659), AOM_ICDF(29429), AOM_ICDF(30055),
|
||||
AOM_ICDF(30564), AOM_ICDF(30977), AOM_ICDF(31313), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(5890), AOM_ICDF(10720), AOM_ICDF(14682), AOM_ICDF(17932),
|
||||
AOM_ICDF(20598), AOM_ICDF(22785), AOM_ICDF(24579), AOM_ICDF(26051),
|
||||
AOM_ICDF(27258), AOM_ICDF(28248), AOM_ICDF(29060), AOM_ICDF(29726),
|
||||
AOM_ICDF(30273), AOM_ICDF(30721), AOM_ICDF(31089), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(5631), AOM_ICDF(10295), AOM_ICDF(14157), AOM_ICDF(17356),
|
||||
AOM_ICDF(20005), AOM_ICDF(22199), AOM_ICDF(24016), AOM_ICDF(25520),
|
||||
AOM_ICDF(26766), AOM_ICDF(27798), AOM_ICDF(28652), AOM_ICDF(29359),
|
||||
AOM_ICDF(29945), AOM_ICDF(30430), AOM_ICDF(30832), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(5377), AOM_ICDF(9871), AOM_ICDF(13628), AOM_ICDF(16768),
|
||||
AOM_ICDF(19393), AOM_ICDF(21587), AOM_ICDF(23421), AOM_ICDF(24954),
|
||||
AOM_ICDF(26236), AOM_ICDF(27308), AOM_ICDF(28204), AOM_ICDF(28953),
|
||||
AOM_ICDF(29579), AOM_ICDF(30102), AOM_ICDF(30539), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(5121), AOM_ICDF(9441), AOM_ICDF(13086), AOM_ICDF(16161),
|
||||
AOM_ICDF(18756), AOM_ICDF(20945), AOM_ICDF(22792), AOM_ICDF(24351),
|
||||
AOM_ICDF(25666), AOM_ICDF(26776), AOM_ICDF(27712), AOM_ICDF(28502),
|
||||
AOM_ICDF(29169), AOM_ICDF(29731), AOM_ICDF(30206), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(4865), AOM_ICDF(9007), AOM_ICDF(12534), AOM_ICDF(15538),
|
||||
AOM_ICDF(18096), AOM_ICDF(20274), AOM_ICDF(22129), AOM_ICDF(23708),
|
||||
AOM_ICDF(25053), AOM_ICDF(26198), AOM_ICDF(27173), AOM_ICDF(28004),
|
||||
AOM_ICDF(28711), AOM_ICDF(29313), AOM_ICDF(29826), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(4608), AOM_ICDF(8568), AOM_ICDF(11971), AOM_ICDF(14896),
|
||||
AOM_ICDF(17409), AOM_ICDF(19569), AOM_ICDF(21425), AOM_ICDF(23020),
|
||||
AOM_ICDF(24391), AOM_ICDF(25569), AOM_ICDF(26581), AOM_ICDF(27451),
|
||||
AOM_ICDF(28199), AOM_ICDF(28842), AOM_ICDF(29394), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(4351), AOM_ICDF(8125), AOM_ICDF(11398), AOM_ICDF(14236),
|
||||
AOM_ICDF(16697), AOM_ICDF(18831), AOM_ICDF(20682), AOM_ICDF(22287),
|
||||
AOM_ICDF(23679), AOM_ICDF(24886), AOM_ICDF(25933), AOM_ICDF(26841),
|
||||
AOM_ICDF(27628), AOM_ICDF(28311), AOM_ICDF(28903), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(4096), AOM_ICDF(7680), AOM_ICDF(10816), AOM_ICDF(13560),
|
||||
AOM_ICDF(15961), AOM_ICDF(18062), AOM_ICDF(19900), AOM_ICDF(21508),
|
||||
AOM_ICDF(22915), AOM_ICDF(24146), AOM_ICDF(25224), AOM_ICDF(26167),
|
||||
AOM_ICDF(26992), AOM_ICDF(27714), AOM_ICDF(28346), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(3840), AOM_ICDF(7230), AOM_ICDF(10223), AOM_ICDF(12865),
|
||||
AOM_ICDF(15197), AOM_ICDF(17256), AOM_ICDF(19074), AOM_ICDF(20679),
|
||||
AOM_ICDF(22096), AOM_ICDF(23347), AOM_ICDF(24451), AOM_ICDF(25426),
|
||||
AOM_ICDF(26287), AOM_ICDF(27047), AOM_ICDF(27718), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(3584), AOM_ICDF(6776), AOM_ICDF(9619), AOM_ICDF(12151),
|
||||
AOM_ICDF(14406), AOM_ICDF(16414), AOM_ICDF(18203), AOM_ICDF(19796),
|
||||
AOM_ICDF(21215), AOM_ICDF(22479), AOM_ICDF(23604), AOM_ICDF(24606),
|
||||
AOM_ICDF(25499), AOM_ICDF(26294), AOM_ICDF(27002), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(3328), AOM_ICDF(6318), AOM_ICDF(9004), AOM_ICDF(11417),
|
||||
AOM_ICDF(13585), AOM_ICDF(15533), AOM_ICDF(17283), AOM_ICDF(18856),
|
||||
AOM_ICDF(20269), AOM_ICDF(21538), AOM_ICDF(22678), AOM_ICDF(23703),
|
||||
AOM_ICDF(24624), AOM_ICDF(25451), AOM_ICDF(26194), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(3072), AOM_ICDF(5856), AOM_ICDF(8379), AOM_ICDF(10665),
|
||||
AOM_ICDF(12737), AOM_ICDF(14615), AOM_ICDF(16317), AOM_ICDF(17859),
|
||||
AOM_ICDF(19257), AOM_ICDF(20524), AOM_ICDF(21672), AOM_ICDF(22712),
|
||||
AOM_ICDF(23655), AOM_ICDF(24509), AOM_ICDF(25283), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(2816), AOM_ICDF(5390), AOM_ICDF(7743), AOM_ICDF(9894),
|
||||
AOM_ICDF(11860), AOM_ICDF(13657), AOM_ICDF(15299), AOM_ICDF(16800),
|
||||
AOM_ICDF(18172), AOM_ICDF(19426), AOM_ICDF(20573), AOM_ICDF(21621),
|
||||
AOM_ICDF(22579), AOM_ICDF(23455), AOM_ICDF(24255), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(2560), AOM_ICDF(4920), AOM_ICDF(7096), AOM_ICDF(9102),
|
||||
AOM_ICDF(10951), AOM_ICDF(12656), AOM_ICDF(14227), AOM_ICDF(15676),
|
||||
AOM_ICDF(17011), AOM_ICDF(18242), AOM_ICDF(19377), AOM_ICDF(20423),
|
||||
AOM_ICDF(21388), AOM_ICDF(22277), AOM_ICDF(23097), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(2304), AOM_ICDF(4446), AOM_ICDF(6437), AOM_ICDF(8288),
|
||||
AOM_ICDF(10009), AOM_ICDF(11609), AOM_ICDF(13097), AOM_ICDF(14480),
|
||||
AOM_ICDF(15766), AOM_ICDF(16961), AOM_ICDF(18072), AOM_ICDF(19105),
|
||||
AOM_ICDF(20066), AOM_ICDF(20959), AOM_ICDF(21789), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(2048), AOM_ICDF(3968), AOM_ICDF(5768), AOM_ICDF(7456),
|
||||
AOM_ICDF(9038), AOM_ICDF(10521), AOM_ICDF(11911), AOM_ICDF(13215),
|
||||
AOM_ICDF(14437), AOM_ICDF(15583), AOM_ICDF(16657), AOM_ICDF(17664),
|
||||
AOM_ICDF(18608), AOM_ICDF(19493), AOM_ICDF(20323), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(1792), AOM_ICDF(3486), AOM_ICDF(5087), AOM_ICDF(6601),
|
||||
AOM_ICDF(8032), AOM_ICDF(9385), AOM_ICDF(10664), AOM_ICDF(11873),
|
||||
AOM_ICDF(13016), AOM_ICDF(14096), AOM_ICDF(15117), AOM_ICDF(16082),
|
||||
AOM_ICDF(16995), AOM_ICDF(17858), AOM_ICDF(18673), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(1536), AOM_ICDF(3000), AOM_ICDF(4395), AOM_ICDF(5725),
|
||||
AOM_ICDF(6993), AOM_ICDF(8201), AOM_ICDF(9353), AOM_ICDF(10451),
|
||||
AOM_ICDF(11497), AOM_ICDF(12494), AOM_ICDF(13444), AOM_ICDF(14350),
|
||||
AOM_ICDF(15213), AOM_ICDF(16036), AOM_ICDF(16820), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(1280), AOM_ICDF(2510), AOM_ICDF(3692), AOM_ICDF(4828),
|
||||
AOM_ICDF(5919), AOM_ICDF(6968), AOM_ICDF(7976), AOM_ICDF(8944),
|
||||
AOM_ICDF(9875), AOM_ICDF(10769), AOM_ICDF(11628), AOM_ICDF(12454),
|
||||
AOM_ICDF(13248), AOM_ICDF(14011), AOM_ICDF(14744), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(1024), AOM_ICDF(2016), AOM_ICDF(2977), AOM_ICDF(3908),
|
||||
AOM_ICDF(4810), AOM_ICDF(5684), AOM_ICDF(6530), AOM_ICDF(7350),
|
||||
AOM_ICDF(8144), AOM_ICDF(8913), AOM_ICDF(9658), AOM_ICDF(10380),
|
||||
AOM_ICDF(11080), AOM_ICDF(11758), AOM_ICDF(12415), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(768), AOM_ICDF(1518), AOM_ICDF(2250), AOM_ICDF(2965),
|
||||
AOM_ICDF(3663), AOM_ICDF(4345), AOM_ICDF(5011), AOM_ICDF(5662),
|
||||
AOM_ICDF(6297), AOM_ICDF(6917), AOM_ICDF(7523), AOM_ICDF(8115),
|
||||
AOM_ICDF(8693), AOM_ICDF(9257), AOM_ICDF(9808), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(512), AOM_ICDF(1016), AOM_ICDF(1512), AOM_ICDF(2000),
|
||||
AOM_ICDF(2481), AOM_ICDF(2954), AOM_ICDF(3420), AOM_ICDF(3879),
|
||||
AOM_ICDF(4330), AOM_ICDF(4774), AOM_ICDF(5211), AOM_ICDF(5642),
|
||||
AOM_ICDF(6066), AOM_ICDF(6483), AOM_ICDF(6894), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(256), AOM_ICDF(510), AOM_ICDF(762), AOM_ICDF(1012),
|
||||
AOM_ICDF(1260), AOM_ICDF(1506), AOM_ICDF(1750), AOM_ICDF(1992),
|
||||
AOM_ICDF(2232), AOM_ICDF(2471), AOM_ICDF(2708), AOM_ICDF(2943),
|
||||
AOM_ICDF(3176), AOM_ICDF(3407), AOM_ICDF(3636), AOM_ICDF(32768)},
|
||||
};
|
||||
|
||||
|
||||
const uint16_t LAPLACE_OFFSET[128] = {
|
||||
0,
|
||||
29871,
|
||||
28672,
|
||||
27751,
|
||||
26975,
|
||||
26291,
|
||||
25673,
|
||||
25105,
|
||||
24576,
|
||||
24079,
|
||||
23609,
|
||||
23162,
|
||||
22734,
|
||||
22325,
|
||||
21931,
|
||||
21550,
|
||||
21182,
|
||||
20826,
|
||||
20480,
|
||||
20143,
|
||||
19815,
|
||||
19495,
|
||||
19183,
|
||||
18877,
|
||||
18579,
|
||||
18286,
|
||||
17999,
|
||||
17718,
|
||||
17442,
|
||||
17170,
|
||||
16904,
|
||||
16642,
|
||||
16384,
|
||||
16129,
|
||||
15879,
|
||||
15633,
|
||||
15390,
|
||||
15150,
|
||||
14913,
|
||||
14680,
|
||||
14450,
|
||||
14222,
|
||||
13997,
|
||||
13775,
|
||||
13556,
|
||||
13338,
|
||||
13124,
|
||||
12911,
|
||||
12701,
|
||||
12493,
|
||||
12288,
|
||||
12084,
|
||||
11882,
|
||||
11682,
|
||||
11484,
|
||||
11288,
|
||||
11094,
|
||||
10901,
|
||||
10710,
|
||||
10521,
|
||||
10333,
|
||||
10147,
|
||||
9962,
|
||||
9779,
|
||||
9597,
|
||||
9417,
|
||||
9238,
|
||||
9060,
|
||||
8884,
|
||||
8709,
|
||||
8535,
|
||||
8363,
|
||||
8192,
|
||||
8021,
|
||||
7853,
|
||||
7685,
|
||||
7518,
|
||||
7352,
|
||||
7188,
|
||||
7025,
|
||||
6862,
|
||||
6701,
|
||||
6540,
|
||||
6381,
|
||||
6222,
|
||||
6065,
|
||||
5908,
|
||||
5753,
|
||||
5598,
|
||||
5444,
|
||||
5291,
|
||||
5138,
|
||||
4987,
|
||||
4837,
|
||||
4687,
|
||||
4538,
|
||||
4390,
|
||||
4242,
|
||||
4096,
|
||||
3950,
|
||||
3804,
|
||||
3660,
|
||||
3516,
|
||||
3373,
|
||||
3231,
|
||||
3089,
|
||||
2948,
|
||||
2808,
|
||||
2668,
|
||||
2529,
|
||||
2391,
|
||||
2253,
|
||||
2116,
|
||||
1979,
|
||||
1843,
|
||||
1708,
|
||||
1573,
|
||||
1439,
|
||||
1306,
|
||||
1172,
|
||||
1040,
|
||||
908,
|
||||
777,
|
||||
646,
|
||||
516,
|
||||
386,
|
||||
257,
|
||||
128,
|
||||
};
|
||||
|
|
@ -1,81 +0,0 @@
|
|||
/*
|
||||
* 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 <assert.h>
|
||||
|
||||
#include "av1/common/enums.h"
|
||||
#include "aom_dsp/mips/inv_txfm_msa.h"
|
||||
|
||||
void av1_iht16x16_256_add_msa(const int16_t *input, uint8_t *dst,
|
||||
int32_t dst_stride, TxfmParam *txfm_param) {
|
||||
int32_t i;
|
||||
DECLARE_ALIGNED(32, int16_t, out[16 * 16]);
|
||||
int16_t *out_ptr = &out[0];
|
||||
const TX_TYPE tx_type = txfm_param->tx_type;
|
||||
|
||||
switch (tx_type) {
|
||||
case DCT_DCT:
|
||||
/* transform rows */
|
||||
for (i = 0; i < 2; ++i) {
|
||||
/* process 16 * 8 block */
|
||||
aom_idct16_1d_rows_msa((input + (i << 7)), (out_ptr + (i << 7)));
|
||||
}
|
||||
|
||||
/* transform columns */
|
||||
for (i = 0; i < 2; ++i) {
|
||||
/* process 8 * 16 block */
|
||||
aom_idct16_1d_columns_addblk_msa((out_ptr + (i << 3)), (dst + (i << 3)),
|
||||
dst_stride);
|
||||
}
|
||||
break;
|
||||
case ADST_DCT:
|
||||
/* transform rows */
|
||||
for (i = 0; i < 2; ++i) {
|
||||
/* process 16 * 8 block */
|
||||
aom_idct16_1d_rows_msa((input + (i << 7)), (out_ptr + (i << 7)));
|
||||
}
|
||||
|
||||
/* transform columns */
|
||||
for (i = 0; i < 2; ++i) {
|
||||
aom_iadst16_1d_columns_addblk_msa((out_ptr + (i << 3)),
|
||||
(dst + (i << 3)), dst_stride);
|
||||
}
|
||||
break;
|
||||
case DCT_ADST:
|
||||
/* transform rows */
|
||||
for (i = 0; i < 2; ++i) {
|
||||
/* process 16 * 8 block */
|
||||
aom_iadst16_1d_rows_msa((input + (i << 7)), (out_ptr + (i << 7)));
|
||||
}
|
||||
|
||||
/* transform columns */
|
||||
for (i = 0; i < 2; ++i) {
|
||||
/* process 8 * 16 block */
|
||||
aom_idct16_1d_columns_addblk_msa((out_ptr + (i << 3)), (dst + (i << 3)),
|
||||
dst_stride);
|
||||
}
|
||||
break;
|
||||
case ADST_ADST:
|
||||
/* transform rows */
|
||||
for (i = 0; i < 2; ++i) {
|
||||
/* process 16 * 8 block */
|
||||
aom_iadst16_1d_rows_msa((input + (i << 7)), (out_ptr + (i << 7)));
|
||||
}
|
||||
|
||||
/* transform columns */
|
||||
for (i = 0; i < 2; ++i) {
|
||||
aom_iadst16_1d_columns_addblk_msa((out_ptr + (i << 3)),
|
||||
(dst + (i << 3)), dst_stride);
|
||||
}
|
||||
break;
|
||||
default: assert(0); break;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
/*
|
||||
* 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 <assert.h>
|
||||
|
||||
#include "av1/common/enums.h"
|
||||
#include "aom_dsp/mips/inv_txfm_msa.h"
|
||||
|
||||
void av1_iht4x4_16_add_msa(const int16_t *input, uint8_t *dst,
|
||||
int32_t dst_stride, TxfmParam *txfm_param) {
|
||||
v8i16 in0, in1, in2, in3;
|
||||
const TX_TYPE tx_type = txfm_param->tx_type;
|
||||
|
||||
/* load vector elements of 4x4 block */
|
||||
LD4x4_SH(input, in0, in1, in2, in3);
|
||||
TRANSPOSE4x4_SH_SH(in0, in1, in2, in3, in0, in1, in2, in3);
|
||||
|
||||
switch (tx_type) {
|
||||
case DCT_DCT:
|
||||
/* DCT in horizontal */
|
||||
AOM_IDCT4x4(in0, in1, in2, in3, in0, in1, in2, in3);
|
||||
/* DCT in vertical */
|
||||
TRANSPOSE4x4_SH_SH(in0, in1, in2, in3, in0, in1, in2, in3);
|
||||
AOM_IDCT4x4(in0, in1, in2, in3, in0, in1, in2, in3);
|
||||
break;
|
||||
case ADST_DCT:
|
||||
/* DCT in horizontal */
|
||||
AOM_IDCT4x4(in0, in1, in2, in3, in0, in1, in2, in3);
|
||||
/* ADST in vertical */
|
||||
TRANSPOSE4x4_SH_SH(in0, in1, in2, in3, in0, in1, in2, in3);
|
||||
AOM_IADST4x4(in0, in1, in2, in3, in0, in1, in2, in3);
|
||||
break;
|
||||
case DCT_ADST:
|
||||
/* ADST in horizontal */
|
||||
AOM_IADST4x4(in0, in1, in2, in3, in0, in1, in2, in3);
|
||||
/* DCT in vertical */
|
||||
TRANSPOSE4x4_SH_SH(in0, in1, in2, in3, in0, in1, in2, in3);
|
||||
AOM_IDCT4x4(in0, in1, in2, in3, in0, in1, in2, in3);
|
||||
break;
|
||||
case ADST_ADST:
|
||||
/* ADST in horizontal */
|
||||
AOM_IADST4x4(in0, in1, in2, in3, in0, in1, in2, in3);
|
||||
/* ADST in vertical */
|
||||
TRANSPOSE4x4_SH_SH(in0, in1, in2, in3, in0, in1, in2, in3);
|
||||
AOM_IADST4x4(in0, in1, in2, in3, in0, in1, in2, in3);
|
||||
break;
|
||||
default: assert(0); break;
|
||||
}
|
||||
|
||||
/* final rounding (add 2^3, divide by 2^4) and shift */
|
||||
SRARI_H4_SH(in0, in1, in2, in3, 4);
|
||||
/* add block and store 4x4 */
|
||||
ADDBLK_ST4x4_UB(in0, in1, in2, in3, dst, dst_stride);
|
||||
}
|
||||
|
|
@ -1,80 +0,0 @@
|
|||
/*
|
||||
* 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 <assert.h>
|
||||
|
||||
#include "av1/common/enums.h"
|
||||
#include "aom_dsp/mips/inv_txfm_msa.h"
|
||||
|
||||
void av1_iht8x8_64_add_msa(const int16_t *input, uint8_t *dst,
|
||||
int32_t dst_stride, TxfmParam *txfm_param) {
|
||||
v8i16 in0, in1, in2, in3, in4, in5, in6, in7;
|
||||
const TX_TYPE tx_type = txfm_param->tx_type;
|
||||
|
||||
/* load vector elements of 8x8 block */
|
||||
LD_SH8(input, 8, in0, in1, in2, in3, in4, in5, in6, in7);
|
||||
|
||||
TRANSPOSE8x8_SH_SH(in0, in1, in2, in3, in4, in5, in6, in7, in0, in1, in2, in3,
|
||||
in4, in5, in6, in7);
|
||||
|
||||
switch (tx_type) {
|
||||
case DCT_DCT:
|
||||
/* DCT in horizontal */
|
||||
AOM_IDCT8x8_1D(in0, in1, in2, in3, in4, in5, in6, in7, in0, in1, in2, in3,
|
||||
in4, in5, in6, in7);
|
||||
/* DCT in vertical */
|
||||
TRANSPOSE8x8_SH_SH(in0, in1, in2, in3, in4, in5, in6, in7, in0, in1, in2,
|
||||
in3, in4, in5, in6, in7);
|
||||
AOM_IDCT8x8_1D(in0, in1, in2, in3, in4, in5, in6, in7, in0, in1, in2, in3,
|
||||
in4, in5, in6, in7);
|
||||
break;
|
||||
case ADST_DCT:
|
||||
/* DCT in horizontal */
|
||||
AOM_IDCT8x8_1D(in0, in1, in2, in3, in4, in5, in6, in7, in0, in1, in2, in3,
|
||||
in4, in5, in6, in7);
|
||||
/* ADST in vertical */
|
||||
TRANSPOSE8x8_SH_SH(in0, in1, in2, in3, in4, in5, in6, in7, in0, in1, in2,
|
||||
in3, in4, in5, in6, in7);
|
||||
AOM_ADST8(in0, in1, in2, in3, in4, in5, in6, in7, in0, in1, in2, in3, in4,
|
||||
in5, in6, in7);
|
||||
break;
|
||||
case DCT_ADST:
|
||||
/* ADST in horizontal */
|
||||
AOM_ADST8(in0, in1, in2, in3, in4, in5, in6, in7, in0, in1, in2, in3, in4,
|
||||
in5, in6, in7);
|
||||
/* DCT in vertical */
|
||||
TRANSPOSE8x8_SH_SH(in0, in1, in2, in3, in4, in5, in6, in7, in0, in1, in2,
|
||||
in3, in4, in5, in6, in7);
|
||||
AOM_IDCT8x8_1D(in0, in1, in2, in3, in4, in5, in6, in7, in0, in1, in2, in3,
|
||||
in4, in5, in6, in7);
|
||||
break;
|
||||
case ADST_ADST:
|
||||
/* ADST in horizontal */
|
||||
AOM_ADST8(in0, in1, in2, in3, in4, in5, in6, in7, in0, in1, in2, in3, in4,
|
||||
in5, in6, in7);
|
||||
/* ADST in vertical */
|
||||
TRANSPOSE8x8_SH_SH(in0, in1, in2, in3, in4, in5, in6, in7, in0, in1, in2,
|
||||
in3, in4, in5, in6, in7);
|
||||
AOM_ADST8(in0, in1, in2, in3, in4, in5, in6, in7, in0, in1, in2, in3, in4,
|
||||
in5, in6, in7);
|
||||
break;
|
||||
default: assert(0); break;
|
||||
}
|
||||
|
||||
/* final rounding (add 2^4, divide by 2^5) and shift */
|
||||
SRARI_H4_SH(in0, in1, in2, in3, 5);
|
||||
SRARI_H4_SH(in4, in5, in6, in7, 5);
|
||||
|
||||
/* add block and store 8x8 */
|
||||
AOM_ADDBLK_ST8x4_UB(dst, dst_stride, in0, in1, in2, in3);
|
||||
dst += (4 * dst_stride);
|
||||
AOM_ADDBLK_ST8x4_UB(dst, dst_stride, in4, in5, in6, in7);
|
||||
}
|
||||
110
third_party/aom/av1/common/mv.h
vendored
110
third_party/aom/av1/common/mv.h
vendored
|
|
@ -27,6 +27,8 @@ typedef struct mv {
|
|||
int16_t col;
|
||||
} MV;
|
||||
|
||||
static const MV kZeroMv = { 0, 0 };
|
||||
|
||||
typedef union int_mv {
|
||||
uint32_t as_int;
|
||||
MV as_mv;
|
||||
|
|
@ -37,11 +39,6 @@ typedef struct mv32 {
|
|||
int32_t col;
|
||||
} MV32;
|
||||
|
||||
#if CONFIG_WARPED_MOTION
|
||||
#define WARPED_MOTION_SORT_SAMPLES 1
|
||||
#endif // CONFIG_WARPED_MOTION
|
||||
|
||||
#if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
|
||||
// Bits of precision used for the model
|
||||
#define WARPEDMODEL_PREC_BITS 16
|
||||
#define WARPEDMODEL_ROW3HOMO_PREC_BITS 16
|
||||
|
|
@ -54,19 +51,8 @@ typedef struct mv32 {
|
|||
#define WARPEDPIXEL_PREC_BITS 6
|
||||
#define WARPEDPIXEL_PREC_SHIFTS (1 << WARPEDPIXEL_PREC_BITS)
|
||||
|
||||
// Taps for ntap filter
|
||||
#define WARPEDPIXEL_FILTER_TAPS 6
|
||||
|
||||
// Precision of filter taps
|
||||
#define WARPEDPIXEL_FILTER_BITS 7
|
||||
|
||||
#define WARP_PARAM_REDUCE_BITS 6
|
||||
|
||||
// Precision bits reduction after horizontal shear
|
||||
#define HORSHEAR_REDUCE_PREC_BITS 5
|
||||
#define VERSHEAR_REDUCE_PREC_BITS \
|
||||
(2 * WARPEDPIXEL_FILTER_BITS - HORSHEAR_REDUCE_PREC_BITS)
|
||||
|
||||
#define WARPEDDIFF_PREC_BITS (WARPEDMODEL_PREC_BITS - WARPEDPIXEL_PREC_BITS)
|
||||
|
||||
/* clang-format off */
|
||||
|
|
@ -75,10 +61,7 @@ typedef enum {
|
|||
TRANSLATION = 1, // translational motion 2-parameter
|
||||
ROTZOOM = 2, // simplified affine with rotation + zoom only, 4-parameter
|
||||
AFFINE = 3, // affine, 6-parameter
|
||||
HORTRAPEZOID = 4, // constrained homography, hor trapezoid, 6-parameter
|
||||
VERTRAPEZOID = 5, // constrained homography, ver trapezoid, 6-parameter
|
||||
HOMOGRAPHY = 6, // homography, 8-parameter
|
||||
TRANS_TYPES = 7,
|
||||
TRANS_TYPES,
|
||||
} TransformationType;
|
||||
/* clang-format on */
|
||||
|
||||
|
|
@ -90,24 +73,13 @@ typedef enum {
|
|||
// GLOBAL_TRANS_TYPES 7 - up to full homography
|
||||
#define GLOBAL_TRANS_TYPES 4
|
||||
|
||||
#if GLOBAL_TRANS_TYPES > 4
|
||||
// First bit indicates whether using identity or not
|
||||
// GLOBAL_TYPE_BITS=ceiling(log2(GLOBAL_TRANS_TYPES-1)) is the
|
||||
// number of bits needed to cover the remaining possibilities
|
||||
#define GLOBAL_TYPE_BITS (get_msb(2 * GLOBAL_TRANS_TYPES - 3))
|
||||
#endif // GLOBAL_TRANS_TYPES > 4
|
||||
|
||||
typedef struct {
|
||||
#if CONFIG_GLOBAL_MOTION
|
||||
int global_warp_allowed;
|
||||
#endif // CONFIG_GLOBAL_MOTION
|
||||
#if CONFIG_WARPED_MOTION
|
||||
int local_warp_allowed;
|
||||
#endif // CONFIG_WARPED_MOTION
|
||||
} WarpTypesAllowed;
|
||||
|
||||
// number of parameters used by each transformation in TransformationTypes
|
||||
static const int trans_model_params[TRANS_TYPES] = { 0, 2, 4, 6, 6, 6, 8 };
|
||||
static const int trans_model_params[TRANS_TYPES] = { 0, 2, 4, 6 };
|
||||
|
||||
// The order of values in the wmmat matrix below is best described
|
||||
// by the homography:
|
||||
|
|
@ -118,6 +90,7 @@ typedef struct {
|
|||
TransformationType wmtype;
|
||||
int32_t wmmat[8];
|
||||
int16_t alpha, beta, gamma, delta;
|
||||
int8_t invalid;
|
||||
} WarpedMotionParams;
|
||||
|
||||
/* clang-format off */
|
||||
|
|
@ -125,12 +98,11 @@ static const WarpedMotionParams default_warp_params = {
|
|||
IDENTITY,
|
||||
{ 0, 0, (1 << WARPEDMODEL_PREC_BITS), 0, 0, (1 << WARPEDMODEL_PREC_BITS), 0,
|
||||
0 },
|
||||
0, 0, 0, 0
|
||||
0, 0, 0, 0,
|
||||
0,
|
||||
};
|
||||
/* clang-format on */
|
||||
#endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
|
||||
|
||||
#if CONFIG_GLOBAL_MOTION
|
||||
// The following constants describe the various precisions
|
||||
// of different parameters in the global motion experiment.
|
||||
//
|
||||
|
|
@ -187,9 +159,6 @@ static const WarpedMotionParams default_warp_params = {
|
|||
#define GM_ALPHA_MIN -GM_ALPHA_MAX
|
||||
#define GM_ROW3HOMO_MIN -GM_ROW3HOMO_MAX
|
||||
|
||||
// Use global motion parameters for sub8x8 blocks
|
||||
#define GLOBAL_SUB8X8_USED 0
|
||||
|
||||
static INLINE int block_center_x(int mi_col, BLOCK_SIZE bs) {
|
||||
const int bw = block_size_wide[bs];
|
||||
return mi_col * MI_SIZE + bw / 2 - 1;
|
||||
|
|
@ -206,7 +175,6 @@ static INLINE int convert_to_trans_prec(int allow_hp, int coor) {
|
|||
else
|
||||
return ROUND_POWER_OF_TWO_SIGNED(coor, WARPEDMODEL_PREC_BITS - 2) * 2;
|
||||
}
|
||||
#if CONFIG_AMVR
|
||||
static INLINE void integer_mv_precision(MV *mv) {
|
||||
int mod = (mv->row % 8);
|
||||
if (mod != 0) {
|
||||
|
|
@ -232,7 +200,6 @@ static INLINE void integer_mv_precision(MV *mv) {
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
// Convert a global motion vector into a motion vector at the centre of the
|
||||
// given block.
|
||||
//
|
||||
|
|
@ -242,14 +209,15 @@ static INLINE void integer_mv_precision(MV *mv) {
|
|||
// represents an integer)
|
||||
static INLINE int_mv gm_get_motion_vector(const WarpedMotionParams *gm,
|
||||
int allow_hp, BLOCK_SIZE bsize,
|
||||
int mi_col, int mi_row, int block_idx
|
||||
#if CONFIG_AMVR
|
||||
,
|
||||
int is_integer
|
||||
#endif
|
||||
) {
|
||||
const int unify_bsize = CONFIG_CB4X4;
|
||||
int mi_col, int mi_row,
|
||||
int is_integer) {
|
||||
int_mv res;
|
||||
|
||||
if (gm->wmtype == IDENTITY) {
|
||||
res.as_int = 0;
|
||||
return res;
|
||||
}
|
||||
|
||||
const int32_t *mat = gm->wmmat;
|
||||
int x, y, tx, ty;
|
||||
|
||||
|
|
@ -265,65 +233,37 @@ static INLINE int_mv gm_get_motion_vector(const WarpedMotionParams *gm,
|
|||
res.as_mv.row = gm->wmmat[0] >> GM_TRANS_ONLY_PREC_DIFF;
|
||||
res.as_mv.col = gm->wmmat[1] >> GM_TRANS_ONLY_PREC_DIFF;
|
||||
assert(IMPLIES(1 & (res.as_mv.row | res.as_mv.col), allow_hp));
|
||||
#if CONFIG_AMVR
|
||||
if (is_integer) {
|
||||
integer_mv_precision(&res.as_mv);
|
||||
}
|
||||
#endif
|
||||
return res;
|
||||
}
|
||||
|
||||
if (bsize >= BLOCK_8X8 || unify_bsize) {
|
||||
x = block_center_x(mi_col, bsize);
|
||||
y = block_center_y(mi_row, bsize);
|
||||
} else {
|
||||
x = block_center_x(mi_col, bsize);
|
||||
y = block_center_y(mi_row, bsize);
|
||||
x += (block_idx & 1) * MI_SIZE / 2;
|
||||
y += (block_idx & 2) * MI_SIZE / 4;
|
||||
}
|
||||
x = block_center_x(mi_col, bsize);
|
||||
y = block_center_y(mi_row, bsize);
|
||||
|
||||
if (gm->wmtype == ROTZOOM) {
|
||||
assert(gm->wmmat[5] == gm->wmmat[2]);
|
||||
assert(gm->wmmat[4] == -gm->wmmat[3]);
|
||||
}
|
||||
if (gm->wmtype > AFFINE) {
|
||||
int xc = (int)((int64_t)mat[2] * x + (int64_t)mat[3] * y + mat[0]);
|
||||
int yc = (int)((int64_t)mat[4] * x + (int64_t)mat[5] * y + mat[1]);
|
||||
const int Z = (int)((int64_t)mat[6] * x + (int64_t)mat[7] * y +
|
||||
(1 << WARPEDMODEL_ROW3HOMO_PREC_BITS));
|
||||
xc *= 1 << (WARPEDMODEL_ROW3HOMO_PREC_BITS - WARPEDMODEL_PREC_BITS);
|
||||
yc *= 1 << (WARPEDMODEL_ROW3HOMO_PREC_BITS - WARPEDMODEL_PREC_BITS);
|
||||
xc = (int)(xc > 0 ? ((int64_t)xc + Z / 2) / Z : ((int64_t)xc - Z / 2) / Z);
|
||||
yc = (int)(yc > 0 ? ((int64_t)yc + Z / 2) / Z : ((int64_t)yc - Z / 2) / Z);
|
||||
tx = convert_to_trans_prec(allow_hp, xc) - (x << 3);
|
||||
ty = convert_to_trans_prec(allow_hp, yc) - (y << 3);
|
||||
} else {
|
||||
const int xc =
|
||||
(mat[2] - (1 << WARPEDMODEL_PREC_BITS)) * x + mat[3] * y + mat[0];
|
||||
const int yc =
|
||||
mat[4] * x + (mat[5] - (1 << WARPEDMODEL_PREC_BITS)) * y + mat[1];
|
||||
tx = convert_to_trans_prec(allow_hp, xc);
|
||||
ty = convert_to_trans_prec(allow_hp, yc);
|
||||
}
|
||||
|
||||
const int xc =
|
||||
(mat[2] - (1 << WARPEDMODEL_PREC_BITS)) * x + mat[3] * y + mat[0];
|
||||
const int yc =
|
||||
mat[4] * x + (mat[5] - (1 << WARPEDMODEL_PREC_BITS)) * y + mat[1];
|
||||
tx = convert_to_trans_prec(allow_hp, xc);
|
||||
ty = convert_to_trans_prec(allow_hp, yc);
|
||||
|
||||
res.as_mv.row = ty;
|
||||
res.as_mv.col = tx;
|
||||
|
||||
#if CONFIG_AMVR
|
||||
if (is_integer) {
|
||||
integer_mv_precision(&res.as_mv);
|
||||
}
|
||||
#endif
|
||||
return res;
|
||||
}
|
||||
|
||||
static INLINE TransformationType get_gmtype(const WarpedMotionParams *gm) {
|
||||
if (gm->wmmat[6] != 0 || gm->wmmat[7] != 0) {
|
||||
if (!gm->wmmat[6] && !gm->wmmat[4]) return HORTRAPEZOID;
|
||||
if (!gm->wmmat[7] && !gm->wmmat[3]) return VERTRAPEZOID;
|
||||
return HOMOGRAPHY;
|
||||
}
|
||||
if (gm->wmmat[5] == (1 << WARPEDMODEL_PREC_BITS) && !gm->wmmat[4] &&
|
||||
gm->wmmat[2] == (1 << WARPEDMODEL_PREC_BITS) && !gm->wmmat[3]) {
|
||||
return ((!gm->wmmat[1] && !gm->wmmat[0]) ? IDENTITY : TRANSLATION);
|
||||
|
|
@ -333,12 +273,10 @@ static INLINE TransformationType get_gmtype(const WarpedMotionParams *gm) {
|
|||
else
|
||||
return AFFINE;
|
||||
}
|
||||
#endif // CONFIG_GLOBAL_MOTION
|
||||
|
||||
typedef struct candidate_mv {
|
||||
int_mv this_mv;
|
||||
int_mv comp_mv;
|
||||
uint8_t pred_diff[2];
|
||||
int weight;
|
||||
} CANDIDATE_MV;
|
||||
|
||||
|
|
|
|||
2760
third_party/aom/av1/common/mvref_common.c
vendored
2760
third_party/aom/av1/common/mvref_common.c
vendored
File diff suppressed because it is too large
Load diff
443
third_party/aom/av1/common/mvref_common.h
vendored
443
third_party/aom/av1/common/mvref_common.h
vendored
|
|
@ -18,103 +18,36 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define MVREF_NEIGHBOURS 9
|
||||
#define MVREF_ROWS 3
|
||||
#define MVREF_COLS 4
|
||||
#define MVREF_ROW_COLS 3
|
||||
|
||||
// Set the upper limit of the motion vector component magnitude.
|
||||
// This would make a motion vector fit in 26 bits. Plus 3 bits for the
|
||||
// reference frame index. A tuple of motion vector can hence be stored within
|
||||
// 32 bit range for efficient load/store operations.
|
||||
#define REFMVS_LIMIT ((1 << 12) - 1)
|
||||
|
||||
typedef struct position {
|
||||
int row;
|
||||
int col;
|
||||
} POSITION;
|
||||
|
||||
typedef enum {
|
||||
BOTH_ZERO = 0,
|
||||
ZERO_PLUS_PREDICTED = 1,
|
||||
BOTH_PREDICTED = 2,
|
||||
NEW_PLUS_NON_INTRA = 3,
|
||||
BOTH_NEW = 4,
|
||||
INTRA_PLUS_NON_INTRA = 5,
|
||||
BOTH_INTRA = 6,
|
||||
INVALID_CASE = 9
|
||||
} motion_vector_context;
|
||||
|
||||
// This is used to figure out a context for the ref blocks. The code flattens
|
||||
// an array that would have 3 possible counts (0, 1 & 2) for 3 choices by
|
||||
// adding 9 for each intra block, 3 for each zero mv and 1 for each new
|
||||
// motion vector. This single number is then converted into a context
|
||||
// with a single lookup ( counter_to_context ).
|
||||
static const int mode_2_counter[] = {
|
||||
9, // DC_PRED
|
||||
9, // V_PRED
|
||||
9, // H_PRED
|
||||
9, // D45_PRED
|
||||
9, // D135_PRED
|
||||
9, // D117_PRED
|
||||
9, // D153_PRED
|
||||
9, // D207_PRED
|
||||
9, // D63_PRED
|
||||
9, // SMOOTH_PRED
|
||||
#if CONFIG_SMOOTH_HV
|
||||
9, // SMOOTH_V_PRED
|
||||
9, // SMOOTH_H_PRED
|
||||
#endif // CONFIG_SMOOTH_HV
|
||||
9, // TM_PRED
|
||||
0, // NEARESTMV
|
||||
0, // NEARMV
|
||||
3, // ZEROMV
|
||||
1, // NEWMV
|
||||
#if CONFIG_COMPOUND_SINGLEREF
|
||||
0, // SR_NEAREST_NEARMV
|
||||
// 1, // SR_NEAREST_NEWMV
|
||||
1, // SR_NEAR_NEWMV
|
||||
3, // SR_ZERO_NEWMV
|
||||
1, // SR_NEW_NEWMV
|
||||
#endif // CONFIG_COMPOUND_SINGLEREF
|
||||
0, // NEAREST_NEARESTMV
|
||||
0, // NEAR_NEARMV
|
||||
1, // NEAREST_NEWMV
|
||||
1, // NEW_NEARESTMV
|
||||
1, // NEAR_NEWMV
|
||||
1, // NEW_NEARMV
|
||||
3, // ZERO_ZEROMV
|
||||
1, // NEW_NEWMV
|
||||
};
|
||||
|
||||
// There are 3^3 different combinations of 3 counts that can be either 0,1 or
|
||||
// 2. However the actual count can never be greater than 2 so the highest
|
||||
// counter we need is 18. 9 is an invalid counter that's never used.
|
||||
static const int counter_to_context[19] = {
|
||||
BOTH_PREDICTED, // 0
|
||||
NEW_PLUS_NON_INTRA, // 1
|
||||
BOTH_NEW, // 2
|
||||
ZERO_PLUS_PREDICTED, // 3
|
||||
NEW_PLUS_NON_INTRA, // 4
|
||||
INVALID_CASE, // 5
|
||||
BOTH_ZERO, // 6
|
||||
INVALID_CASE, // 7
|
||||
INVALID_CASE, // 8
|
||||
INTRA_PLUS_NON_INTRA, // 9
|
||||
INTRA_PLUS_NON_INTRA, // 10
|
||||
INVALID_CASE, // 11
|
||||
INTRA_PLUS_NON_INTRA, // 12
|
||||
INVALID_CASE, // 13
|
||||
INVALID_CASE, // 14
|
||||
INVALID_CASE, // 15
|
||||
INVALID_CASE, // 16
|
||||
INVALID_CASE, // 17
|
||||
BOTH_INTRA // 18
|
||||
};
|
||||
|
||||
static const int idx_n_column_to_subblock[4][2] = {
|
||||
{ 1, 2 }, { 1, 3 }, { 3, 2 }, { 3, 3 }
|
||||
};
|
||||
|
||||
// clamp_mv_ref
|
||||
#if CONFIG_EXT_PARTITION
|
||||
#define MV_BORDER (16 << 3) // Allow 16 pels in 1/8th pel units
|
||||
#else
|
||||
#define MV_BORDER (8 << 3) // Allow 8 pels in 1/8th pel units
|
||||
#endif // CONFIG_EXT_PARTITION
|
||||
|
||||
static INLINE int get_relative_dist(const AV1_COMMON *cm, int a, int b) {
|
||||
if (!cm->seq_params.enable_order_hint) return 0;
|
||||
|
||||
const int bits = cm->seq_params.order_hint_bits_minus_1 + 1;
|
||||
|
||||
assert(bits >= 1);
|
||||
assert(a >= 0 && a < (1 << bits));
|
||||
assert(b >= 0 && b < (1 << bits));
|
||||
|
||||
int diff = a - b;
|
||||
int m = 1 << (bits - 1);
|
||||
diff = (diff & (m - 1)) - (diff & m);
|
||||
return diff;
|
||||
}
|
||||
|
||||
static INLINE void clamp_mv_ref(MV *mv, int bw, int bh, const MACROBLOCKD *xd) {
|
||||
clamp_mv(mv, xd->mb_to_left_edge - bw * 8 - MV_BORDER,
|
||||
|
|
@ -125,19 +58,16 @@ static INLINE void clamp_mv_ref(MV *mv, int bw, int bh, const MACROBLOCKD *xd) {
|
|||
|
||||
// This function returns either the appropriate sub block or block's mv
|
||||
// on whether the block_size < 8x8 and we have check_sub_blocks set.
|
||||
static INLINE int_mv get_sub_block_mv(const MODE_INFO *candidate, int which_mv,
|
||||
int search_col, int block_idx) {
|
||||
static INLINE int_mv get_sub_block_mv(const MB_MODE_INFO *candidate,
|
||||
int which_mv, int search_col) {
|
||||
(void)search_col;
|
||||
(void)block_idx;
|
||||
return candidate->mbmi.mv[which_mv];
|
||||
return candidate->mv[which_mv];
|
||||
}
|
||||
|
||||
static INLINE int_mv get_sub_block_pred_mv(const MODE_INFO *candidate,
|
||||
int which_mv, int search_col,
|
||||
int block_idx) {
|
||||
static INLINE int_mv get_sub_block_pred_mv(const MB_MODE_INFO *candidate,
|
||||
int which_mv, int search_col) {
|
||||
(void)search_col;
|
||||
(void)block_idx;
|
||||
return candidate->mbmi.mv[which_mv];
|
||||
return candidate->mv[which_mv];
|
||||
}
|
||||
|
||||
// Performs mv sign inversion if indicated by the reference frame combination.
|
||||
|
|
@ -152,48 +82,11 @@ static INLINE int_mv scale_mv(const MB_MODE_INFO *mbmi, int ref,
|
|||
return mv;
|
||||
}
|
||||
|
||||
#define CLIP_IN_ADD(mv, bw, bh, xd) clamp_mv_ref(mv, bw, bh, xd)
|
||||
|
||||
// This macro is used to add a motion vector mv_ref list if it isn't
|
||||
// already in the list. If it's the second motion vector it will also
|
||||
// skip all additional processing and jump to done!
|
||||
#define ADD_MV_REF_LIST(mv, refmv_count, mv_ref_list, bw, bh, xd, Done) \
|
||||
do { \
|
||||
(mv_ref_list)[(refmv_count)] = (mv); \
|
||||
CLIP_IN_ADD(&(mv_ref_list)[(refmv_count)].as_mv, (bw), (bh), (xd)); \
|
||||
if (refmv_count && (mv_ref_list)[1].as_int != (mv_ref_list)[0].as_int) { \
|
||||
(refmv_count) = 2; \
|
||||
goto Done; \
|
||||
} \
|
||||
(refmv_count) = 1; \
|
||||
} while (0)
|
||||
|
||||
// If either reference frame is different, not INTRA, and they
|
||||
// are different from each other scale and add the mv to our list.
|
||||
#define IF_DIFF_REF_FRAME_ADD_MV(mbmi, ref_frame, ref_sign_bias, refmv_count, \
|
||||
mv_ref_list, bw, bh, xd, Done) \
|
||||
do { \
|
||||
if (is_inter_block(mbmi)) { \
|
||||
if ((mbmi)->ref_frame[0] != ref_frame) \
|
||||
ADD_MV_REF_LIST(scale_mv((mbmi), 0, ref_frame, ref_sign_bias), \
|
||||
refmv_count, mv_ref_list, bw, bh, xd, Done); \
|
||||
if (has_second_ref(mbmi) && (mbmi)->ref_frame[1] != ref_frame) \
|
||||
ADD_MV_REF_LIST(scale_mv((mbmi), 1, ref_frame, ref_sign_bias), \
|
||||
refmv_count, mv_ref_list, bw, bh, xd, Done); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
// Checks that the given mi_row, mi_col and search point
|
||||
// are inside the borders of the tile.
|
||||
static INLINE int is_inside(const TileInfo *const tile, int mi_col, int mi_row,
|
||||
int mi_rows, const AV1_COMMON *cm,
|
||||
const POSITION *mi_pos) {
|
||||
#if CONFIG_DEPENDENT_HORZTILES
|
||||
const int dependent_horz_tile_flag = cm->dependent_horz_tiles;
|
||||
#else
|
||||
int mi_rows, const POSITION *mi_pos) {
|
||||
const int dependent_horz_tile_flag = 0;
|
||||
(void)cm;
|
||||
#endif
|
||||
if (dependent_horz_tile_flag && !tile->tg_horz_boundary) {
|
||||
return !(mi_row + mi_pos->row < 0 ||
|
||||
mi_col + mi_pos->col < tile->mi_col_start ||
|
||||
|
|
@ -208,14 +101,8 @@ static INLINE int is_inside(const TileInfo *const tile, int mi_col, int mi_row,
|
|||
}
|
||||
|
||||
static INLINE int find_valid_row_offset(const TileInfo *const tile, int mi_row,
|
||||
int mi_rows, const AV1_COMMON *cm,
|
||||
int row_offset) {
|
||||
#if CONFIG_DEPENDENT_HORZTILES
|
||||
const int dependent_horz_tile_flag = cm->dependent_horz_tiles;
|
||||
#else
|
||||
int mi_rows, int row_offset) {
|
||||
const int dependent_horz_tile_flag = 0;
|
||||
(void)cm;
|
||||
#endif
|
||||
if (dependent_horz_tile_flag && !tile->tg_horz_boundary)
|
||||
return clamp(row_offset, -mi_row, mi_rows - mi_row - 1);
|
||||
else
|
||||
|
|
@ -229,87 +116,49 @@ static INLINE int find_valid_col_offset(const TileInfo *const tile, int mi_col,
|
|||
tile->mi_col_end - mi_col - 1);
|
||||
}
|
||||
|
||||
static INLINE void lower_mv_precision(MV *mv, int allow_hp
|
||||
#if CONFIG_AMVR
|
||||
,
|
||||
int is_integer
|
||||
#endif
|
||||
) {
|
||||
#if CONFIG_AMVR
|
||||
static INLINE void lower_mv_precision(MV *mv, int allow_hp, int is_integer) {
|
||||
if (is_integer) {
|
||||
integer_mv_precision(mv);
|
||||
} else {
|
||||
#endif
|
||||
if (!allow_hp) {
|
||||
if (mv->row & 1) mv->row += (mv->row > 0 ? -1 : 1);
|
||||
if (mv->col & 1) mv->col += (mv->col > 0 ? -1 : 1);
|
||||
}
|
||||
#if CONFIG_AMVR
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static INLINE uint8_t av1_get_pred_diff_ctx(const int_mv pred_mv,
|
||||
const int_mv this_mv) {
|
||||
if (abs(this_mv.as_mv.row - pred_mv.as_mv.row) <= 4 &&
|
||||
abs(this_mv.as_mv.col - pred_mv.as_mv.col) <= 4)
|
||||
return 2;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
static INLINE int av1_nmv_ctx(const uint8_t ref_mv_count,
|
||||
const CANDIDATE_MV *ref_mv_stack, int ref,
|
||||
int ref_mv_idx) {
|
||||
if (ref_mv_stack[ref_mv_idx].weight >= REF_CAT_LEVEL && ref_mv_count > 0)
|
||||
return ref_mv_stack[ref_mv_idx].pred_diff[ref];
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if CONFIG_EXT_COMP_REFS
|
||||
static INLINE int8_t av1_uni_comp_ref_idx(const MV_REFERENCE_FRAME *const rf) {
|
||||
static INLINE int8_t get_uni_comp_ref_idx(const MV_REFERENCE_FRAME *const rf) {
|
||||
// Single ref pred
|
||||
if (rf[1] <= INTRA_FRAME) return -1;
|
||||
|
||||
// Bi-directional comp ref pred
|
||||
if ((rf[0] < BWDREF_FRAME) && (rf[1] >= BWDREF_FRAME)) return -1;
|
||||
|
||||
for (int8_t ref_idx = 0; ref_idx < UNIDIR_COMP_REFS; ++ref_idx) {
|
||||
for (int8_t ref_idx = 0; ref_idx < TOTAL_UNIDIR_COMP_REFS; ++ref_idx) {
|
||||
if (rf[0] == comp_ref0(ref_idx) && rf[1] == comp_ref1(ref_idx))
|
||||
return ref_idx;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
#endif // CONFIG_EXT_COMP_REFS
|
||||
|
||||
static INLINE int8_t av1_ref_frame_type(const MV_REFERENCE_FRAME *const rf) {
|
||||
if (rf[1] > INTRA_FRAME) {
|
||||
#if CONFIG_EXT_COMP_REFS
|
||||
int8_t uni_comp_ref_idx = av1_uni_comp_ref_idx(rf);
|
||||
#if !USE_UNI_COMP_REFS
|
||||
// NOTE: uni-directional comp refs disabled
|
||||
assert(uni_comp_ref_idx < 0);
|
||||
#endif // !USE_UNI_COMP_REFS
|
||||
const int8_t uni_comp_ref_idx = get_uni_comp_ref_idx(rf);
|
||||
if (uni_comp_ref_idx >= 0) {
|
||||
assert((TOTAL_REFS_PER_FRAME + FWD_REFS * BWD_REFS + uni_comp_ref_idx) <
|
||||
assert((REF_FRAMES + FWD_REFS * BWD_REFS + uni_comp_ref_idx) <
|
||||
MODE_CTX_REF_FRAMES);
|
||||
return TOTAL_REFS_PER_FRAME + FWD_REFS * BWD_REFS + uni_comp_ref_idx;
|
||||
return REF_FRAMES + FWD_REFS * BWD_REFS + uni_comp_ref_idx;
|
||||
} else {
|
||||
#endif // CONFIG_EXT_COMP_REFS
|
||||
return TOTAL_REFS_PER_FRAME + FWD_RF_OFFSET(rf[0]) +
|
||||
return REF_FRAMES + FWD_RF_OFFSET(rf[0]) +
|
||||
BWD_RF_OFFSET(rf[1]) * FWD_REFS;
|
||||
#if CONFIG_EXT_COMP_REFS
|
||||
}
|
||||
#endif // CONFIG_EXT_COMP_REFS
|
||||
}
|
||||
|
||||
return rf[0];
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
static MV_REFERENCE_FRAME ref_frame_map[COMP_REFS][2] = {
|
||||
#if CONFIG_EXT_REFS
|
||||
static MV_REFERENCE_FRAME ref_frame_map[TOTAL_COMP_REFS][2] = {
|
||||
{ LAST_FRAME, BWDREF_FRAME }, { LAST2_FRAME, BWDREF_FRAME },
|
||||
{ LAST3_FRAME, BWDREF_FRAME }, { GOLDEN_FRAME, BWDREF_FRAME },
|
||||
|
||||
|
|
@ -317,58 +166,51 @@ static MV_REFERENCE_FRAME ref_frame_map[COMP_REFS][2] = {
|
|||
{ LAST3_FRAME, ALTREF2_FRAME }, { GOLDEN_FRAME, ALTREF2_FRAME },
|
||||
|
||||
{ LAST_FRAME, ALTREF_FRAME }, { LAST2_FRAME, ALTREF_FRAME },
|
||||
{ LAST3_FRAME, ALTREF_FRAME }, { GOLDEN_FRAME, ALTREF_FRAME }
|
||||
{ LAST3_FRAME, ALTREF_FRAME }, { GOLDEN_FRAME, ALTREF_FRAME },
|
||||
|
||||
// TODO(zoeliu): Temporarily disable uni-directional comp refs
|
||||
#if CONFIG_EXT_COMP_REFS
|
||||
, { LAST_FRAME, LAST2_FRAME }, { LAST_FRAME, LAST3_FRAME },
|
||||
{ LAST_FRAME, GOLDEN_FRAME }, { BWDREF_FRAME, ALTREF_FRAME }
|
||||
// TODO(zoeliu): When ALTREF2 is enabled, we may add:
|
||||
// {BWDREF_FRAME, ALTREF2_FRAME}
|
||||
#endif // CONFIG_EXT_COMP_REFS
|
||||
#else // !CONFIG_EXT_REFS
|
||||
{ LAST_FRAME, ALTREF_FRAME }, { GOLDEN_FRAME, ALTREF_FRAME }
|
||||
#endif // CONFIG_EXT_REFS
|
||||
{ LAST_FRAME, LAST2_FRAME }, { LAST_FRAME, LAST3_FRAME },
|
||||
{ LAST_FRAME, GOLDEN_FRAME }, { BWDREF_FRAME, ALTREF_FRAME },
|
||||
|
||||
// NOTE: Following reference frame pairs are not supported to be explicitly
|
||||
// signalled, but they are possibly chosen by the use of skip_mode,
|
||||
// which may use the most recent one-sided reference frame pair.
|
||||
{ LAST2_FRAME, LAST3_FRAME }, { LAST2_FRAME, GOLDEN_FRAME },
|
||||
{ LAST3_FRAME, GOLDEN_FRAME }, {BWDREF_FRAME, ALTREF2_FRAME},
|
||||
{ ALTREF2_FRAME, ALTREF_FRAME }
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
static INLINE void av1_set_ref_frame(MV_REFERENCE_FRAME *rf,
|
||||
int8_t ref_frame_type) {
|
||||
if (ref_frame_type >= TOTAL_REFS_PER_FRAME) {
|
||||
rf[0] = ref_frame_map[ref_frame_type - TOTAL_REFS_PER_FRAME][0];
|
||||
rf[1] = ref_frame_map[ref_frame_type - TOTAL_REFS_PER_FRAME][1];
|
||||
if (ref_frame_type >= REF_FRAMES) {
|
||||
rf[0] = ref_frame_map[ref_frame_type - REF_FRAMES][0];
|
||||
rf[1] = ref_frame_map[ref_frame_type - REF_FRAMES][1];
|
||||
} else {
|
||||
rf[0] = ref_frame_type;
|
||||
rf[1] = NONE_FRAME;
|
||||
#if CONFIG_INTRABC
|
||||
assert(ref_frame_type > NONE_FRAME);
|
||||
#else
|
||||
assert(ref_frame_type > INTRA_FRAME);
|
||||
#endif
|
||||
assert(ref_frame_type < TOTAL_REFS_PER_FRAME);
|
||||
}
|
||||
}
|
||||
|
||||
static uint16_t compound_mode_ctx_map[3][COMP_NEWMV_CTXS] = {
|
||||
{ 0, 1, 1, 1, 1 },
|
||||
{ 1, 2, 3, 4, 4 },
|
||||
{ 4, 4, 5, 6, 7 },
|
||||
};
|
||||
|
||||
static INLINE int16_t av1_mode_context_analyzer(
|
||||
const int16_t *const mode_context, const MV_REFERENCE_FRAME *const rf,
|
||||
BLOCK_SIZE bsize, int block) {
|
||||
int16_t mode_ctx = 0;
|
||||
int8_t ref_frame_type = av1_ref_frame_type(rf);
|
||||
const int16_t *const mode_context, const MV_REFERENCE_FRAME *const rf) {
|
||||
const int8_t ref_frame = av1_ref_frame_type(rf);
|
||||
|
||||
if (block >= 0) {
|
||||
mode_ctx = mode_context[rf[0]] & 0x00ff;
|
||||
#if !CONFIG_CB4X4
|
||||
if (block > 0 && bsize < BLOCK_8X8 && bsize > BLOCK_4X4)
|
||||
mode_ctx |= (1 << SKIP_NEARESTMV_SUB8X8_OFFSET);
|
||||
#else
|
||||
(void)block;
|
||||
(void)bsize;
|
||||
#endif
|
||||
if (rf[1] <= INTRA_FRAME) return mode_context[ref_frame];
|
||||
|
||||
return mode_ctx;
|
||||
}
|
||||
const int16_t newmv_ctx = mode_context[ref_frame] & NEWMV_CTX_MASK;
|
||||
const int16_t refmv_ctx =
|
||||
(mode_context[ref_frame] >> REFMV_OFFSET) & REFMV_CTX_MASK;
|
||||
|
||||
return mode_context[ref_frame_type];
|
||||
const int16_t comp_ctx = compound_mode_ctx_map[refmv_ctx >> 1][AOMMIN(
|
||||
newmv_ctx, COMP_NEWMV_CTXS - 1)];
|
||||
return comp_ctx;
|
||||
}
|
||||
|
||||
static INLINE uint8_t av1_drl_ctx(const CANDIDATE_MV *ref_mv_stack,
|
||||
|
|
@ -379,92 +221,99 @@ static INLINE uint8_t av1_drl_ctx(const CANDIDATE_MV *ref_mv_stack,
|
|||
|
||||
if (ref_mv_stack[ref_idx].weight >= REF_CAT_LEVEL &&
|
||||
ref_mv_stack[ref_idx + 1].weight < REF_CAT_LEVEL)
|
||||
return 2;
|
||||
return 1;
|
||||
|
||||
if (ref_mv_stack[ref_idx].weight < REF_CAT_LEVEL &&
|
||||
ref_mv_stack[ref_idx + 1].weight < REF_CAT_LEVEL)
|
||||
return 3;
|
||||
return 2;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if CONFIG_FRAME_MARKER
|
||||
void av1_setup_frame_buf_refs(AV1_COMMON *cm);
|
||||
#if CONFIG_FRAME_SIGN_BIAS
|
||||
void av1_setup_frame_sign_bias(AV1_COMMON *cm);
|
||||
#endif // CONFIG_FRAME_SIGN_BIAS
|
||||
#if CONFIG_MFMV
|
||||
void av1_setup_skip_mode_allowed(AV1_COMMON *cm);
|
||||
void av1_setup_motion_field(AV1_COMMON *cm);
|
||||
#endif // CONFIG_MFMV
|
||||
#endif // CONFIG_FRAME_MARKER
|
||||
void av1_set_frame_refs(AV1_COMMON *const cm, int lst_map_idx, int gld_map_idx);
|
||||
|
||||
void av1_copy_frame_mvs(const AV1_COMMON *const cm, MODE_INFO *mi, int mi_row,
|
||||
int mi_col, int x_mis, int y_mis);
|
||||
static INLINE void av1_collect_neighbors_ref_counts(MACROBLOCKD *const xd) {
|
||||
av1_zero(xd->neighbors_ref_counts);
|
||||
|
||||
uint8_t *const ref_counts = xd->neighbors_ref_counts;
|
||||
|
||||
const MB_MODE_INFO *const above_mbmi = xd->above_mbmi;
|
||||
const MB_MODE_INFO *const left_mbmi = xd->left_mbmi;
|
||||
const int above_in_image = xd->up_available;
|
||||
const int left_in_image = xd->left_available;
|
||||
|
||||
// Above neighbor
|
||||
if (above_in_image && is_inter_block(above_mbmi)) {
|
||||
ref_counts[above_mbmi->ref_frame[0]]++;
|
||||
if (has_second_ref(above_mbmi)) {
|
||||
ref_counts[above_mbmi->ref_frame[1]]++;
|
||||
}
|
||||
}
|
||||
|
||||
// Left neighbor
|
||||
if (left_in_image && is_inter_block(left_mbmi)) {
|
||||
ref_counts[left_mbmi->ref_frame[0]]++;
|
||||
if (has_second_ref(left_mbmi)) {
|
||||
ref_counts[left_mbmi->ref_frame[1]]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void av1_copy_frame_mvs(const AV1_COMMON *const cm, MB_MODE_INFO *mi,
|
||||
int mi_row, int mi_col, int x_mis, int y_mis);
|
||||
|
||||
typedef void (*find_mv_refs_sync)(void *const data, int mi_row);
|
||||
void av1_find_mv_refs(const AV1_COMMON *cm, const MACROBLOCKD *xd,
|
||||
MODE_INFO *mi, MV_REFERENCE_FRAME ref_frame,
|
||||
uint8_t *ref_mv_count, CANDIDATE_MV *ref_mv_stack,
|
||||
int16_t *compound_mode_context, int_mv *mv_ref_list,
|
||||
int mi_row, int mi_col, find_mv_refs_sync sync,
|
||||
void *const data, int16_t *mode_context);
|
||||
MB_MODE_INFO *mi, MV_REFERENCE_FRAME ref_frame,
|
||||
uint8_t ref_mv_count[MODE_CTX_REF_FRAMES],
|
||||
CANDIDATE_MV ref_mv_stack[][MAX_REF_MV_STACK_SIZE],
|
||||
int_mv mv_ref_list[][MAX_MV_REF_CANDIDATES],
|
||||
int_mv *global_mvs, int mi_row, int mi_col,
|
||||
int16_t *mode_context);
|
||||
|
||||
// check a list of motion vectors by sad score using a number rows of pixels
|
||||
// above and a number cols of pixels in the left to select the one with best
|
||||
// score to use as ref motion vector
|
||||
#if CONFIG_AMVR
|
||||
void av1_find_best_ref_mvs(int allow_hp, int_mv *mvlist, int_mv *nearest_mv,
|
||||
int_mv *near_mv, int is_integer);
|
||||
#else
|
||||
void av1_find_best_ref_mvs(int allow_hp, int_mv *mvlist, int_mv *nearest_mv,
|
||||
int_mv *near_mv);
|
||||
#endif
|
||||
|
||||
void av1_append_sub8x8_mvs_for_idx(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
||||
int block, int ref, int mi_row, int mi_col,
|
||||
CANDIDATE_MV *ref_mv_stack,
|
||||
uint8_t *ref_mv_count, int_mv *mv_list,
|
||||
int_mv *nearest_mv, int_mv *near_mv);
|
||||
|
||||
// This function keeps a mode count for a given MB/SB
|
||||
void av1_update_mv_context(const AV1_COMMON *cm, const MACROBLOCKD *xd,
|
||||
MODE_INFO *mi, MV_REFERENCE_FRAME ref_frame,
|
||||
int_mv *mv_ref_list, int block, int mi_row,
|
||||
int mi_col, int16_t *mode_context);
|
||||
|
||||
#if CONFIG_WARPED_MOTION
|
||||
#if WARPED_MOTION_SORT_SAMPLES
|
||||
int sortSamples(int *pts_mv, MV *mv, int *pts, int *pts_inref, int len);
|
||||
int findSamples(const AV1_COMMON *cm, MACROBLOCKD *xd, int mi_row, int mi_col,
|
||||
int *pts, int *pts_inref, int *pts_mv);
|
||||
#else
|
||||
int selectSamples(MV *mv, int *pts, int *pts_inref, int len, BLOCK_SIZE bsize);
|
||||
int findSamples(const AV1_COMMON *cm, MACROBLOCKD *xd, int mi_row, int mi_col,
|
||||
int *pts, int *pts_inref);
|
||||
#endif // WARPED_MOTION_SORT_SAMPLES
|
||||
#endif // CONFIG_WARPED_MOTION
|
||||
|
||||
#if CONFIG_INTRABC
|
||||
static INLINE void av1_find_ref_dv(int_mv *ref_dv, int mi_row, int mi_col) {
|
||||
// TODO(aconverse@google.com): Handle tiles and such
|
||||
#define INTRABC_DELAY_PIXELS 256 // Delay of 256 pixels
|
||||
#define INTRABC_DELAY_SB64 (INTRABC_DELAY_PIXELS / 64)
|
||||
#define USE_WAVE_FRONT 1 // Use only top left area of frame for reference.
|
||||
|
||||
static INLINE void av1_find_ref_dv(int_mv *ref_dv, const TileInfo *const tile,
|
||||
int mib_size, int mi_row, int mi_col) {
|
||||
(void)mi_col;
|
||||
if (mi_row < MAX_MIB_SIZE) {
|
||||
if (mi_row - mib_size < tile->mi_row_start) {
|
||||
ref_dv->as_mv.row = 0;
|
||||
ref_dv->as_mv.col = -MI_SIZE * MAX_MIB_SIZE;
|
||||
ref_dv->as_mv.col = -MI_SIZE * mib_size - INTRABC_DELAY_PIXELS;
|
||||
} else {
|
||||
ref_dv->as_mv.row = -MI_SIZE * MAX_MIB_SIZE;
|
||||
ref_dv->as_mv.row = -MI_SIZE * mib_size;
|
||||
ref_dv->as_mv.col = 0;
|
||||
}
|
||||
ref_dv->as_mv.row *= 8;
|
||||
ref_dv->as_mv.col *= 8;
|
||||
}
|
||||
|
||||
static INLINE int is_dv_valid(const MV dv, const TileInfo *const tile,
|
||||
int mi_row, int mi_col, BLOCK_SIZE bsize) {
|
||||
static INLINE int av1_is_dv_valid(const MV dv, const AV1_COMMON *cm,
|
||||
const MACROBLOCKD *xd, int mi_row, int mi_col,
|
||||
BLOCK_SIZE bsize, int mib_size_log2) {
|
||||
const int bw = block_size_wide[bsize];
|
||||
const int bh = block_size_high[bsize];
|
||||
const int SCALE_PX_TO_MV = 8;
|
||||
// Disallow subpixel for now
|
||||
// SUBPEL_MASK is not the correct scale
|
||||
if ((dv.row & (SCALE_PX_TO_MV - 1) || dv.col & (SCALE_PX_TO_MV - 1)))
|
||||
if (((dv.row & (SCALE_PX_TO_MV - 1)) || (dv.col & (SCALE_PX_TO_MV - 1))))
|
||||
return 0;
|
||||
|
||||
const TileInfo *const tile = &xd->tile;
|
||||
// Is the source top-left inside the current tile?
|
||||
const int src_top_edge = mi_row * MI_SIZE * SCALE_PX_TO_MV + dv.row;
|
||||
const int tile_top_edge = tile->mi_row_start * MI_SIZE * SCALE_PX_TO_MV;
|
||||
|
|
@ -479,20 +328,44 @@ static INLINE int is_dv_valid(const MV dv, const TileInfo *const tile,
|
|||
const int src_right_edge = (mi_col * MI_SIZE + bw) * SCALE_PX_TO_MV + dv.col;
|
||||
const int tile_right_edge = tile->mi_col_end * MI_SIZE * SCALE_PX_TO_MV;
|
||||
if (src_right_edge > tile_right_edge) return 0;
|
||||
// Is the bottom right within an already coded SB?
|
||||
const int active_sb_top_edge =
|
||||
(mi_row & ~MAX_MIB_MASK) * MI_SIZE * SCALE_PX_TO_MV;
|
||||
const int active_sb_bottom_edge =
|
||||
((mi_row & ~MAX_MIB_MASK) + MAX_MIB_SIZE) * MI_SIZE * SCALE_PX_TO_MV;
|
||||
const int active_sb_left_edge =
|
||||
(mi_col & ~MAX_MIB_MASK) * MI_SIZE * SCALE_PX_TO_MV;
|
||||
if (src_bottom_edge > active_sb_bottom_edge) return 0;
|
||||
if (src_bottom_edge > active_sb_top_edge &&
|
||||
src_right_edge > active_sb_left_edge)
|
||||
|
||||
// Special case for sub 8x8 chroma cases, to prevent referring to chroma
|
||||
// pixels outside current tile.
|
||||
for (int plane = 1; plane < av1_num_planes(cm); ++plane) {
|
||||
const struct macroblockd_plane *const pd = &xd->plane[plane];
|
||||
if (is_chroma_reference(mi_row, mi_col, bsize, pd->subsampling_x,
|
||||
pd->subsampling_y)) {
|
||||
if (bw < 8 && pd->subsampling_x)
|
||||
if (src_left_edge < tile_left_edge + 4 * SCALE_PX_TO_MV) return 0;
|
||||
if (bh < 8 && pd->subsampling_y)
|
||||
if (src_top_edge < tile_top_edge + 4 * SCALE_PX_TO_MV) return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Is the bottom right within an already coded SB? Also consider additional
|
||||
// constraints to facilitate HW decoder.
|
||||
const int max_mib_size = 1 << mib_size_log2;
|
||||
const int active_sb_row = mi_row >> mib_size_log2;
|
||||
const int active_sb64_col = (mi_col * MI_SIZE) >> 6;
|
||||
const int sb_size = max_mib_size * MI_SIZE;
|
||||
const int src_sb_row = ((src_bottom_edge >> 3) - 1) / sb_size;
|
||||
const int src_sb64_col = ((src_right_edge >> 3) - 1) >> 6;
|
||||
const int total_sb64_per_row =
|
||||
((tile->mi_col_end - tile->mi_col_start - 1) >> 4) + 1;
|
||||
const int active_sb64 = active_sb_row * total_sb64_per_row + active_sb64_col;
|
||||
const int src_sb64 = src_sb_row * total_sb64_per_row + src_sb64_col;
|
||||
if (src_sb64 >= active_sb64 - INTRABC_DELAY_SB64) return 0;
|
||||
|
||||
#if USE_WAVE_FRONT
|
||||
const int gradient = 1 + INTRABC_DELAY_SB64 + (sb_size > 64);
|
||||
const int wf_offset = gradient * (active_sb_row - src_sb_row);
|
||||
if (src_sb_row > active_sb_row ||
|
||||
src_sb64_col >= active_sb64_col - INTRABC_DELAY_SB64 + wf_offset)
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
#endif // CONFIG_INTRABC
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
|
|
|
|||
1181
third_party/aom/av1/common/ncobmc_kernels.c
vendored
1181
third_party/aom/av1/common/ncobmc_kernels.c
vendored
File diff suppressed because it is too large
Load diff
22
third_party/aom/av1/common/ncobmc_kernels.h
vendored
22
third_party/aom/av1/common/ncobmc_kernels.h
vendored
|
|
@ -1,22 +0,0 @@
|
|||
/*
|
||||
* 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_
|
||||
39
third_party/aom/av1/common/obmc.h
vendored
39
third_party/aom/av1/common/obmc.h
vendored
|
|
@ -12,31 +12,31 @@
|
|||
#ifndef AV1_COMMON_OBMC_H_
|
||||
#define AV1_COMMON_OBMC_H_
|
||||
|
||||
#if CONFIG_MOTION_VAR
|
||||
typedef void (*overlappable_nb_visitor_t)(MACROBLOCKD *xd, int rel_mi_pos,
|
||||
uint8_t nb_mi_size, MODE_INFO *nb_mi,
|
||||
void *fun_ctxt);
|
||||
uint8_t nb_mi_size,
|
||||
MB_MODE_INFO *nb_mi, void *fun_ctxt,
|
||||
const int num_planes);
|
||||
|
||||
static INLINE void foreach_overlappable_nb_above(const AV1_COMMON *cm,
|
||||
MACROBLOCKD *xd, int mi_col,
|
||||
int nb_max,
|
||||
overlappable_nb_visitor_t fun,
|
||||
void *fun_ctxt) {
|
||||
const int num_planes = av1_num_planes(cm);
|
||||
if (!xd->up_available) return;
|
||||
|
||||
int nb_count = 0;
|
||||
|
||||
// prev_row_mi points into the mi array, starting at the beginning of the
|
||||
// previous row.
|
||||
MODE_INFO **prev_row_mi = xd->mi - mi_col - 1 * xd->mi_stride;
|
||||
MB_MODE_INFO **prev_row_mi = xd->mi - mi_col - 1 * xd->mi_stride;
|
||||
const int end_col = AOMMIN(mi_col + xd->n8_w, cm->mi_cols);
|
||||
uint8_t mi_step;
|
||||
for (int above_mi_col = mi_col; above_mi_col < end_col && nb_count < nb_max;
|
||||
above_mi_col += mi_step) {
|
||||
MODE_INFO **above_mi = prev_row_mi + above_mi_col;
|
||||
mi_step = AOMMIN(mi_size_wide[above_mi[0]->mbmi.sb_type],
|
||||
mi_size_wide[BLOCK_64X64]);
|
||||
#if CONFIG_CHROMA_SUB8X8
|
||||
MB_MODE_INFO **above_mi = prev_row_mi + above_mi_col;
|
||||
mi_step =
|
||||
AOMMIN(mi_size_wide[above_mi[0]->sb_type], mi_size_wide[BLOCK_64X64]);
|
||||
// If we're considering a block with width 4, it should be treated as
|
||||
// half of a pair of blocks with chroma information in the second. Move
|
||||
// above_mi_col back to the start of the pair if needed, set above_mbmi
|
||||
|
|
@ -47,12 +47,10 @@ static INLINE void foreach_overlappable_nb_above(const AV1_COMMON *cm,
|
|||
above_mi = prev_row_mi + above_mi_col + 1;
|
||||
mi_step = 2;
|
||||
}
|
||||
#endif // CONFIG_CHROMA_SUB8X8
|
||||
MB_MODE_INFO *above_mbmi = &above_mi[0]->mbmi;
|
||||
if (is_neighbor_overlappable(above_mbmi)) {
|
||||
if (is_neighbor_overlappable(*above_mi)) {
|
||||
++nb_count;
|
||||
fun(xd, above_mi_col - mi_col, AOMMIN(xd->n8_w, mi_step), *above_mi,
|
||||
fun_ctxt);
|
||||
fun_ctxt, num_planes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -62,35 +60,32 @@ static INLINE void foreach_overlappable_nb_left(const AV1_COMMON *cm,
|
|||
int nb_max,
|
||||
overlappable_nb_visitor_t fun,
|
||||
void *fun_ctxt) {
|
||||
const int num_planes = av1_num_planes(cm);
|
||||
if (!xd->left_available) return;
|
||||
|
||||
int nb_count = 0;
|
||||
|
||||
// prev_col_mi points into the mi array, starting at the top of the
|
||||
// previous column
|
||||
MODE_INFO **prev_col_mi = xd->mi - 1 - mi_row * xd->mi_stride;
|
||||
MB_MODE_INFO **prev_col_mi = xd->mi - 1 - mi_row * xd->mi_stride;
|
||||
const int end_row = AOMMIN(mi_row + xd->n8_h, cm->mi_rows);
|
||||
uint8_t mi_step;
|
||||
for (int left_mi_row = mi_row; left_mi_row < end_row && nb_count < nb_max;
|
||||
left_mi_row += mi_step) {
|
||||
MODE_INFO **left_mi = prev_col_mi + left_mi_row * xd->mi_stride;
|
||||
mi_step = AOMMIN(mi_size_high[left_mi[0]->mbmi.sb_type],
|
||||
mi_size_high[BLOCK_64X64]);
|
||||
#if CONFIG_CHROMA_SUB8X8
|
||||
MB_MODE_INFO **left_mi = prev_col_mi + left_mi_row * xd->mi_stride;
|
||||
mi_step =
|
||||
AOMMIN(mi_size_high[left_mi[0]->sb_type], mi_size_high[BLOCK_64X64]);
|
||||
if (mi_step == 1) {
|
||||
left_mi_row &= ~1;
|
||||
left_mi = prev_col_mi + (left_mi_row + 1) * xd->mi_stride;
|
||||
mi_step = 2;
|
||||
}
|
||||
#endif // CONFIG_CHROMA_SUB8X8
|
||||
MB_MODE_INFO *left_mbmi = &left_mi[0]->mbmi;
|
||||
if (is_neighbor_overlappable(left_mbmi)) {
|
||||
if (is_neighbor_overlappable(*left_mi)) {
|
||||
++nb_count;
|
||||
fun(xd, left_mi_row - mi_row, AOMMIN(xd->n8_h, mi_step), *left_mi,
|
||||
fun_ctxt);
|
||||
fun_ctxt, num_planes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // CONFIG_MOTION_VAR
|
||||
#endif // AV1_COMMON_OBMC_H_
|
||||
|
|
|
|||
10
third_party/aom/av1/common/odintrin.c
vendored
10
third_party/aom/av1/common/odintrin.c
vendored
|
|
@ -13,16 +13,6 @@
|
|||
|
||||
#include "av1/common/odintrin.h"
|
||||
|
||||
#if defined(OD_ENABLE_ASSERTIONS)
|
||||
# include <stdio.h>
|
||||
|
||||
void od_fatal_impl(const char *_str, const char *_file, int _line) {
|
||||
fprintf(stderr, "Fatal (internal) error in %s, line %d: %s\n",
|
||||
_file, _line, _str);
|
||||
abort();
|
||||
}
|
||||
#endif
|
||||
|
||||
/*Constants for use with OD_DIVU_SMALL().
|
||||
See \cite{Rob05} for details on computing these constants.
|
||||
@INPROCEEDINGS{Rob05,
|
||||
|
|
|
|||
180
third_party/aom/av1/common/odintrin.h
vendored
180
third_party/aom/av1/common/odintrin.h
vendored
|
|
@ -14,10 +14,6 @@
|
|||
#ifndef AV1_COMMON_ODINTRIN_H_
|
||||
#define AV1_COMMON_ODINTRIN_H_
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# define _USE_MATH_DEFINES
|
||||
#endif
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
|
@ -30,71 +26,8 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
# if !defined(M_PI)
|
||||
# define M_PI (3.1415926535897932384626433832795)
|
||||
# endif
|
||||
|
||||
# if !defined(M_SQRT2)
|
||||
# define M_SQRT2 (1.41421356237309504880168872420970)
|
||||
# endif
|
||||
|
||||
# if !defined(M_SQRT1_2)
|
||||
# define M_SQRT1_2 (0.70710678118654752440084436210485)
|
||||
# endif
|
||||
|
||||
# if !defined(M_LOG2E)
|
||||
# define M_LOG2E (1.4426950408889634073599246810019)
|
||||
# endif
|
||||
|
||||
# if !defined(M_LN2)
|
||||
# define M_LN2 (0.69314718055994530941723212145818)
|
||||
# endif
|
||||
|
||||
/*Smallest blocks are 4x4*/
|
||||
#define OD_LOG_BSIZE0 (2)
|
||||
/*There are 5 block sizes total (4x4, 8x8, 16x16, 32x32 and 64x64).*/
|
||||
#define OD_NBSIZES (5)
|
||||
|
||||
/*There are 4 transform sizes total in AV1 (4x4, 8x8, 16x16 and 32x32).*/
|
||||
#define OD_TXSIZES TX_SIZES
|
||||
/*The log of the maximum length of the side of a transform.*/
|
||||
#define OD_LOG_TXSIZE_MAX (OD_LOG_BSIZE0 + OD_TXSIZES - 1)
|
||||
/*The maximum length of the side of a transform.*/
|
||||
#define OD_TXSIZE_MAX (1 << OD_LOG_TXSIZE_MAX)
|
||||
|
||||
/**The maximum number of color planes allowed in a single frame.*/
|
||||
# define OD_NPLANES_MAX (3)
|
||||
|
||||
# define OD_COEFF_SHIFT (4)
|
||||
|
||||
# define OD_DISABLE_CFL (1)
|
||||
# define OD_DISABLE_FILTER (1)
|
||||
|
||||
#if !defined(NDEBUG)
|
||||
# define OD_ENABLE_ASSERTIONS (1)
|
||||
#endif
|
||||
|
||||
# define OD_LOG(a)
|
||||
# define OD_LOG_PARTIAL(a)
|
||||
|
||||
/*Possible block sizes, note that OD_BLOCK_NXN = log2(N) - 2.*/
|
||||
#define OD_BLOCK_4X4 (0)
|
||||
#define OD_BLOCK_8X8 (1)
|
||||
#define OD_BLOCK_16X16 (2)
|
||||
#define OD_BLOCK_32X32 (3)
|
||||
#define OD_BLOCK_SIZES (OD_BLOCK_32X32 + 1)
|
||||
|
||||
# define OD_LIMIT_BSIZE_MIN (OD_BLOCK_4X4)
|
||||
# define OD_LIMIT_BSIZE_MAX (OD_BLOCK_32X32)
|
||||
|
||||
typedef int od_coeff;
|
||||
|
||||
/*This is the strength reduced version of ((_a)/(1 << (_b))).
|
||||
This will not work for _b == 0, however currently this is only used for
|
||||
b == 1 anyway.*/
|
||||
# define OD_UNBIASED_RSHIFT32(_a, _b) \
|
||||
(((int32_t)(((uint32_t)(_a) >> (32 - (_b))) + (_a))) >> (_b))
|
||||
|
||||
#define OD_DIVU_DMAX (1024)
|
||||
|
||||
extern uint32_t OD_DIVU_SMALL_CONSTS[OD_DIVU_DMAX][2];
|
||||
|
|
@ -116,14 +49,6 @@ extern uint32_t OD_DIVU_SMALL_CONSTS[OD_DIVU_DMAX][2];
|
|||
#define OD_CLZ0 (1)
|
||||
#define OD_CLZ(x) (-get_msb(x))
|
||||
#define OD_ILOG_NZ(x) (OD_CLZ0 - OD_CLZ(x))
|
||||
/*Note that __builtin_clz is not defined when x == 0, according to the gcc
|
||||
documentation (and that of the x86 BSR instruction that implements it), so
|
||||
we have to special-case it.
|
||||
We define a special version of the macro to use when x can be zero.*/
|
||||
#define OD_ILOG(x) ((x) ? OD_ILOG_NZ(x) : 0)
|
||||
|
||||
#define OD_LOG2(x) (M_LOG2E*log(x))
|
||||
#define OD_EXP2(x) (exp(M_LN2*(x)))
|
||||
|
||||
/*Enable special features for gcc and compatible compilers.*/
|
||||
#if defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__)
|
||||
|
|
@ -146,36 +71,6 @@ extern uint32_t OD_DIVU_SMALL_CONSTS[OD_DIVU_DMAX][2];
|
|||
#define OD_ARG_NONNULL(x)
|
||||
#endif
|
||||
|
||||
#if defined(OD_ENABLE_ASSERTIONS)
|
||||
#if OD_GNUC_PREREQ(2, 5, 0)
|
||||
__attribute__((noreturn))
|
||||
#endif
|
||||
void od_fatal_impl(const char *_str, const char *_file, int _line);
|
||||
|
||||
#define OD_FATAL(_str) (od_fatal_impl(_str, __FILE__, __LINE__))
|
||||
|
||||
#define OD_ASSERT(_cond) \
|
||||
do { \
|
||||
if (!(_cond)) { \
|
||||
OD_FATAL("assertion failed: " #_cond); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define OD_ASSERT2(_cond, _message) \
|
||||
do { \
|
||||
if (!(_cond)) { \
|
||||
OD_FATAL("assertion failed: " #_cond "\n" _message); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define OD_ALWAYS_TRUE(_cond) OD_ASSERT(_cond)
|
||||
|
||||
#else
|
||||
#define OD_ASSERT(_cond)
|
||||
#define OD_ASSERT2(_cond, _message)
|
||||
#define OD_ALWAYS_TRUE(_cond) ((void)(_cond))
|
||||
#endif
|
||||
|
||||
/** Copy n elements of memory from src to dst. The 0* term provides
|
||||
compile-time type checking */
|
||||
#if !defined(OVERRIDE_OD_COPY)
|
||||
|
|
@ -190,85 +85,10 @@ void od_fatal_impl(const char *_str, const char *_file, int _line);
|
|||
(memmove((dst), (src), sizeof(*(dst))*(n) + 0*((dst) - (src)) ))
|
||||
#endif
|
||||
|
||||
/** Linkage will break without this if using a C++ compiler, and will issue
|
||||
* warnings without this for a C compiler*/
|
||||
#if defined(__cplusplus)
|
||||
# define OD_EXTERN extern
|
||||
#else
|
||||
# define OD_EXTERN
|
||||
#endif
|
||||
|
||||
/** Set n elements of dst to zero */
|
||||
#if !defined(OVERRIDE_OD_CLEAR)
|
||||
# define OD_CLEAR(dst, n) (memset((dst), 0, sizeof(*(dst))*(n)))
|
||||
#endif
|
||||
|
||||
/** Silence unused parameter/variable warnings */
|
||||
# define OD_UNUSED(expr) (void)(expr)
|
||||
|
||||
#if defined(OD_FLOAT_PVQ)
|
||||
typedef double od_val16;
|
||||
typedef double od_val32;
|
||||
# define OD_QCONST32(x, bits) (x)
|
||||
# define OD_ROUND16(x) (x)
|
||||
# define OD_ROUND32(x) (x)
|
||||
# define OD_SHL(x, shift) (x)
|
||||
# define OD_SHR(x, shift) (x)
|
||||
# define OD_SHR_ROUND(x, shift) (x)
|
||||
# define OD_ABS(x) (fabs(x))
|
||||
# define OD_MULT16_16(a, b) ((a)*(b))
|
||||
# define OD_MULT16_32_Q16(a, b) ((a)*(b))
|
||||
#else
|
||||
typedef int16_t od_val16;
|
||||
typedef int32_t od_val32;
|
||||
/** Compile-time conversion of float constant to 32-bit value */
|
||||
# define OD_QCONST32(x, bits) ((od_val32)(.5 + (x)*(((od_val32)1) << (bits))))
|
||||
# define OD_ROUND16(x) (int16_t)(floor(.5 + (x)))
|
||||
# define OD_ROUND32(x) (int32_t)(floor(.5 + (x)))
|
||||
/*Shift x left by shift*/
|
||||
# define OD_SHL(a, shift) ((int32_t)((uint32_t)(a) << (shift)))
|
||||
/*Shift x right by shift (without rounding)*/
|
||||
# define OD_SHR(x, shift) \
|
||||
((int32_t)((x) >> (shift)))
|
||||
/*Shift x right by shift (with rounding)*/
|
||||
# define OD_SHR_ROUND(x, shift) \
|
||||
((int32_t)(((x) + (1 << (shift) >> 1)) >> (shift)))
|
||||
/*Shift x right by shift (without rounding) or left by -shift if shift
|
||||
is negative.*/
|
||||
# define OD_VSHR(x, shift) \
|
||||
(((shift) > 0) ? OD_SHR(x, shift) : OD_SHL(x, -(shift)))
|
||||
/*Shift x right by shift (with rounding) or left by -shift if shift
|
||||
is negative.*/
|
||||
# define OD_VSHR_ROUND(x, shift) \
|
||||
(((shift) > 0) ? OD_SHR_ROUND(x, shift) : OD_SHL(x, -(shift)))
|
||||
# define OD_ABS(x) (abs(x))
|
||||
/* (od_val32)(od_val16) gives TI compiler a hint that it's 16x16->32 multiply */
|
||||
/** 16x16 multiplication where the result fits in 32 bits */
|
||||
# define OD_MULT16_16(a, b) \
|
||||
(((od_val32)(od_val16)(a))*((od_val32)(od_val16)(b)))
|
||||
/* Multiplies 16-bit a by 32-bit b and keeps bits [16:47]. */
|
||||
# define OD_MULT16_32_Q16(a, b) ((int16_t)(a)*(int64_t)(int32_t)(b) >> 16)
|
||||
/*16x16 multiplication where the result fits in 16 bits, without rounding.*/
|
||||
# define OD_MULT16_16_Q15(a, b) \
|
||||
(((int16_t)(a)*((int32_t)(int16_t)(b))) >> 15)
|
||||
/*16x16 multiplication where the result fits in 16 bits, without rounding.*/
|
||||
# define OD_MULT16_16_Q16(a, b) \
|
||||
((((int16_t)(a))*((int32_t)(int16_t)(b))) >> 16)
|
||||
#endif
|
||||
|
||||
/*All of these macros should expect floats as arguments.*/
|
||||
/*These two should compile as a single SSE instruction.*/
|
||||
# define OD_MINF(a, b) ((a) < (b) ? (a) : (b))
|
||||
# define OD_MAXF(a, b) ((a) > (b) ? (a) : (b))
|
||||
|
||||
# define OD_DIV_R0(x, y) (((x) + OD_FLIPSIGNI((((y) + 1) >> 1) - 1, (x)))/(y))
|
||||
|
||||
# define OD_SIGNMASK(a) (-((a) < 0))
|
||||
# define OD_FLIPSIGNI(a, b) (((a) + OD_SIGNMASK(b)) ^ OD_SIGNMASK(b))
|
||||
|
||||
# define OD_MULT16_16_Q15(a, b) \
|
||||
(((int16_t)(a)*((int32_t)(int16_t)(b))) >> 15)
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
|
|
|||
1205
third_party/aom/av1/common/onyxc_int.h
vendored
1205
third_party/aom/av1/common/onyxc_int.h
vendored
File diff suppressed because it is too large
Load diff
256
third_party/aom/av1/common/partition.c
vendored
256
third_party/aom/av1/common/partition.c
vendored
|
|
@ -1,256 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2001-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.
|
||||
*/
|
||||
|
||||
/* clang-format off */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include "enums.h"
|
||||
#include "odintrin.h"
|
||||
#include "partition.h"
|
||||
#include "zigzag.h"
|
||||
|
||||
OD_EXTERN const index_pair *OD_ZIGZAG4[4] = {
|
||||
OD_ZIGZAG4_DCT_DCT,
|
||||
OD_ZIGZAG4_ADST_DCT,
|
||||
OD_ZIGZAG4_DCT_ADST,
|
||||
OD_ZIGZAG4_ADST_ADST
|
||||
};
|
||||
|
||||
OD_EXTERN const index_pair *OD_ZIGZAG8[4] = {
|
||||
OD_ZIGZAG8_DCT_DCT,
|
||||
OD_ZIGZAG8_ADST_DCT,
|
||||
OD_ZIGZAG8_DCT_ADST,
|
||||
OD_ZIGZAG8_ADST_ADST
|
||||
};
|
||||
|
||||
OD_EXTERN const index_pair *OD_ZIGZAG16[4] = {
|
||||
OD_ZIGZAG16_DCT_DCT,
|
||||
OD_ZIGZAG16_ADST_DCT,
|
||||
OD_ZIGZAG16_DCT_ADST,
|
||||
OD_ZIGZAG16_ADST_ADST
|
||||
};
|
||||
|
||||
OD_EXTERN const index_pair *OD_ZIGZAG32[4] = {
|
||||
OD_ZIGZAG32_DCT_DCT,
|
||||
OD_ZIGZAG32_DCT_DCT,
|
||||
OD_ZIGZAG32_DCT_DCT,
|
||||
OD_ZIGZAG32_DCT_DCT
|
||||
};
|
||||
|
||||
/* The tables below specify how coefficient blocks are translated to
|
||||
and from PVQ partition coding scan order for 4x4, 8x8 and 16x16 */
|
||||
|
||||
static const int OD_LAYOUT32_OFFSETS[4] = { 0, 128, 256, 768 };
|
||||
const band_layout OD_LAYOUT32 = {
|
||||
OD_ZIGZAG32,
|
||||
32,
|
||||
3,
|
||||
OD_LAYOUT32_OFFSETS
|
||||
};
|
||||
|
||||
static const int OD_LAYOUT16_OFFSETS[4] = { 0, 32, 64, 192 };
|
||||
const band_layout OD_LAYOUT16 = {
|
||||
OD_ZIGZAG16,
|
||||
16,
|
||||
3,
|
||||
OD_LAYOUT16_OFFSETS
|
||||
};
|
||||
|
||||
const int OD_LAYOUT8_OFFSETS[4] = { 0, 8, 16, 48 };
|
||||
const band_layout OD_LAYOUT8 = {
|
||||
OD_ZIGZAG8,
|
||||
8,
|
||||
3,
|
||||
OD_LAYOUT8_OFFSETS
|
||||
};
|
||||
|
||||
static const int OD_LAYOUT4_OFFSETS[2] = { 0, 15 };
|
||||
const band_layout OD_LAYOUT4 = {
|
||||
OD_ZIGZAG4,
|
||||
4,
|
||||
1,
|
||||
OD_LAYOUT4_OFFSETS
|
||||
};
|
||||
|
||||
/* First element is the number of bands, followed by the list all the band
|
||||
boundaries. */
|
||||
static const int OD_BAND_OFFSETS4[] = {1, 1, 16};
|
||||
static const int OD_BAND_OFFSETS8[] = {4, 1, 16, 24, 32, 64};
|
||||
static const int OD_BAND_OFFSETS16[] = {7, 1, 16, 24, 32, 64, 96, 128, 256};
|
||||
static const int OD_BAND_OFFSETS32[] = {10, 1, 16, 24, 32, 64, 96, 128, 256,
|
||||
384, 512, 1024};
|
||||
static const int OD_BAND_OFFSETS64[] = {13, 1, 16, 24, 32, 64, 96, 128, 256,
|
||||
384, 512, 1024, 1536, 2048, 4096};
|
||||
|
||||
const int *const OD_BAND_OFFSETS[OD_TXSIZES + 1] = {
|
||||
OD_BAND_OFFSETS4,
|
||||
OD_BAND_OFFSETS8,
|
||||
OD_BAND_OFFSETS16,
|
||||
OD_BAND_OFFSETS32,
|
||||
OD_BAND_OFFSETS64
|
||||
};
|
||||
|
||||
/** Perform a single stage of conversion from a coefficient block in
|
||||
* raster order into coding scan order
|
||||
*
|
||||
* @param [in] layout scan order specification
|
||||
* @param [out] dst destination vector
|
||||
* @param [in] src source coefficient block
|
||||
* @param [int] int source vector row stride
|
||||
*/
|
||||
static void od_band_from_raster(const band_layout *layout, tran_low_t *dst,
|
||||
const tran_low_t *src, int stride, TX_TYPE tx_type) {
|
||||
int i;
|
||||
int len;
|
||||
len = layout->band_offsets[layout->nb_bands];
|
||||
for (i = 0; i < len; i++) {
|
||||
dst[i] = src[layout->dst_table[tx_type][i][1]*stride + layout->dst_table[tx_type][i][0]];
|
||||
}
|
||||
}
|
||||
|
||||
/** Perform a single stage of conversion from a vector in coding scan
|
||||
order back into a coefficient block in raster order
|
||||
*
|
||||
* @param [in] layout scan order specification
|
||||
* @param [out] dst destination coefficient block
|
||||
* @param [in] src source vector
|
||||
* @param [int] stride destination vector row stride
|
||||
*/
|
||||
static void od_raster_from_band(const band_layout *layout, tran_low_t *dst,
|
||||
int stride, TX_TYPE tx_type, const tran_low_t *src) {
|
||||
int i;
|
||||
int len;
|
||||
len = layout->band_offsets[layout->nb_bands];
|
||||
for (i = 0; i < len; i++) {
|
||||
dst[layout->dst_table[tx_type][i][1]*stride + layout->dst_table[tx_type][i][0]] = src[i];
|
||||
}
|
||||
}
|
||||
|
||||
static const band_layout *const OD_LAYOUTS[] = {&OD_LAYOUT4, &OD_LAYOUT8,
|
||||
&OD_LAYOUT16, &OD_LAYOUT32};
|
||||
|
||||
/** Converts a coefficient block in raster order into a vector in
|
||||
* coding scan order with the PVQ partitions laid out one after
|
||||
* another. This works in stages; the 4x4 conversion is applied to
|
||||
* the coefficients nearest DC, then the 8x8 applied to the 8x8 block
|
||||
* nearest DC that was not already coded by 4x4, then 16x16 following
|
||||
* the same pattern.
|
||||
*
|
||||
* @param [out] dst destination vector
|
||||
* @param [in] n block size (along one side)
|
||||
* @param [in] ty_type transfrom type
|
||||
* @param [in] src source coefficient block
|
||||
* @param [in] stride source vector row stride
|
||||
*/
|
||||
void od_raster_to_coding_order(tran_low_t *dst, int n, TX_TYPE ty_type,
|
||||
const tran_low_t *src, int stride) {
|
||||
int bs;
|
||||
/* dst + 1 because DC is not included for 4x4 blocks. */
|
||||
od_band_from_raster(OD_LAYOUTS[0], dst + 1, src, stride, ty_type);
|
||||
for (bs = 1; bs < OD_TXSIZES; bs++) {
|
||||
int size;
|
||||
int offset;
|
||||
/* Length of block size > 4. */
|
||||
size = 1 << (OD_LOG_BSIZE0 + bs);
|
||||
/* Offset is the size of the previous block squared. */
|
||||
offset = 1 << 2*(OD_LOG_BSIZE0 - 1 + bs);
|
||||
if (n >= size) {
|
||||
/* 3 16x16 bands come after 3 8x8 bands, which come after 2 4x4 bands. */
|
||||
od_band_from_raster(OD_LAYOUTS[bs], dst + offset, src, stride, ty_type);
|
||||
}
|
||||
}
|
||||
dst[0] = src[0];
|
||||
}
|
||||
|
||||
/** Converts a vector in coding scan order witht he PVQ partitions
|
||||
* laid out one after another into a coefficient block in raster
|
||||
* order. This works in stages in the reverse order of raster->scan
|
||||
* order; the 16x16 conversion is applied to the coefficients that
|
||||
* don't appear in an 8x8 block, then the 8x8 applied to the 8x8 block
|
||||
* sans the 4x4 block it contains, then 4x4 is converted sans DC.
|
||||
*
|
||||
* @param [out] dst destination coefficient block
|
||||
* @param [in] stride destination vector row stride
|
||||
* @param [in] src source vector
|
||||
* @param [in] n block size (along one side)
|
||||
*/
|
||||
void od_coding_order_to_raster(tran_low_t *dst, int stride, TX_TYPE ty_type,
|
||||
const tran_low_t *src, int n) {
|
||||
int bs;
|
||||
/* src + 1 because DC is not included for 4x4 blocks. */
|
||||
od_raster_from_band(OD_LAYOUTS[0], dst, stride, ty_type, src + 1);
|
||||
for (bs = 1; bs < OD_TXSIZES; bs++) {
|
||||
int size;
|
||||
int offset;
|
||||
/* Length of block size > 4 */
|
||||
size = 1 << (OD_LOG_BSIZE0 + bs);
|
||||
/* Offset is the size of the previous block squared. */
|
||||
offset = 1 << 2*(OD_LOG_BSIZE0 - 1 + bs);
|
||||
if (n >= size) {
|
||||
/* 3 16x16 bands come after 3 8x8 bands, which come after 2 4x4 bands. */
|
||||
od_raster_from_band(OD_LAYOUTS[bs], dst, stride, ty_type, src + offset);
|
||||
}
|
||||
}
|
||||
dst[0] = src[0];
|
||||
}
|
||||
|
||||
/** Perform a single stage of conversion from a coefficient block in
|
||||
* raster order into coding scan order
|
||||
*
|
||||
* @param [in] layout scan order specification
|
||||
* @param [out] dst destination vector
|
||||
* @param [in] src source coefficient block
|
||||
* @param [int] int source vector row stride
|
||||
*/
|
||||
static void od_band_from_raster_16(const band_layout *layout, int16_t *dst,
|
||||
const int16_t *src, int stride) {
|
||||
int i;
|
||||
int len;
|
||||
len = layout->band_offsets[layout->nb_bands];
|
||||
for (i = 0; i < len; i++) {
|
||||
dst[i] = src[layout->dst_table[DCT_DCT][i][1]*stride + layout->dst_table[DCT_DCT][i][0]];
|
||||
}
|
||||
}
|
||||
|
||||
/** Converts a coefficient block in raster order into a vector in
|
||||
* coding scan order with the PVQ partitions laid out one after
|
||||
* another. This works in stages; the 4x4 conversion is applied to
|
||||
* the coefficients nearest DC, then the 8x8 applied to the 8x8 block
|
||||
* nearest DC that was not already coded by 4x4, then 16x16 following
|
||||
* the same pattern.
|
||||
*
|
||||
* @param [out] dst destination vector
|
||||
* @param [in] n block size (along one side)
|
||||
* @param [in] src source coefficient block
|
||||
* @param [in] stride source vector row stride
|
||||
*/
|
||||
void od_raster_to_coding_order_16(int16_t *dst, int n, const int16_t *src,
|
||||
int stride) {
|
||||
int bs;
|
||||
/* dst + 1 because DC is not included for 4x4 blocks. */
|
||||
od_band_from_raster_16(OD_LAYOUTS[0], dst + 1, src, stride);
|
||||
for (bs = 1; bs < OD_TXSIZES; bs++) {
|
||||
int size;
|
||||
int offset;
|
||||
/* Length of block size > 4. */
|
||||
size = 1 << (OD_LOG_BSIZE0 + bs);
|
||||
/* Offset is the size of the previous block squared. */
|
||||
offset = 1 << 2*(OD_LOG_BSIZE0 - 1 + bs);
|
||||
if (n >= size) {
|
||||
/* 3 16x16 bands come after 3 8x8 bands, which come after 2 4x4 bands. */
|
||||
od_band_from_raster_16(OD_LAYOUTS[bs], dst + offset, src, stride);
|
||||
}
|
||||
}
|
||||
dst[0] = src[0];
|
||||
}
|
||||
40
third_party/aom/av1/common/partition.h
vendored
40
third_party/aom/av1/common/partition.h
vendored
|
|
@ -1,40 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2001-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.
|
||||
*/
|
||||
|
||||
/* clang-format off */
|
||||
|
||||
#if !defined(_partition_H)
|
||||
# define _partition_H
|
||||
|
||||
#include "av1/common/enums.h"
|
||||
#include "odintrin.h"
|
||||
|
||||
typedef unsigned char index_pair[2];
|
||||
|
||||
typedef struct {
|
||||
const index_pair **const dst_table;
|
||||
int size;
|
||||
int nb_bands;
|
||||
const int *const band_offsets;
|
||||
} band_layout;
|
||||
|
||||
extern const int *const OD_BAND_OFFSETS[OD_TXSIZES + 1];
|
||||
|
||||
void od_raster_to_coding_order(tran_low_t *dst, int n, TX_TYPE ty_type,
|
||||
const tran_low_t *src, int stride);
|
||||
|
||||
void od_coding_order_to_raster(tran_low_t *dst, int stride, TX_TYPE ty_type,
|
||||
const tran_low_t *src, int n);
|
||||
|
||||
void od_raster_to_coding_order_16(int16_t *dst, int n, const int16_t *src,
|
||||
int stride);
|
||||
|
||||
#endif
|
||||
153
third_party/aom/av1/common/ppc/cfl_ppc.c
vendored
Normal file
153
third_party/aom/av1/common/ppc/cfl_ppc.c
vendored
Normal file
|
|
@ -0,0 +1,153 @@
|
|||
/*
|
||||
* Copyright (c) 2017, 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 <altivec.h>
|
||||
|
||||
#include "config/av1_rtcd.h"
|
||||
|
||||
#include "av1/common/cfl.h"
|
||||
|
||||
#define OFF_0 0
|
||||
#define OFF_1 16
|
||||
#define OFF_2 32
|
||||
#define OFF_3 48
|
||||
#define CFL_BUF_LINE_BYTES 64
|
||||
#define CFL_LINE_1 64
|
||||
#define CFL_LINE_2 128
|
||||
#define CFL_LINE_3 192
|
||||
|
||||
typedef vector int8_t int8x16_t;
|
||||
typedef vector uint8_t uint8x16_t;
|
||||
typedef vector int16_t int16x8_t;
|
||||
typedef vector uint16_t uint16x8_t;
|
||||
typedef vector int32_t int32x4_t;
|
||||
typedef vector uint32_t uint32x4_t;
|
||||
typedef vector uint64_t uint64x2_t;
|
||||
|
||||
static INLINE void subtract_average_vsx(int16_t *pred_buf, int width,
|
||||
int height, int round_offset,
|
||||
int num_pel_log2) {
|
||||
const int16_t *end = pred_buf + height * CFL_BUF_LINE;
|
||||
const int16_t *sum_buf = pred_buf;
|
||||
const uint32x4_t div_shift = vec_splats((uint32_t)num_pel_log2);
|
||||
const uint8x16_t mask_64 = { 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 };
|
||||
const uint8x16_t mask_32 = { 0x14, 0x15, 0x16, 0x17, 0x00, 0x01, 0x02, 0x03,
|
||||
0x1C, 0x1D, 0x1E, 0x1F, 0x08, 0x09, 0x0A, 0x0B };
|
||||
|
||||
int32x4_t sum_32x4_0 = { 0, 0, 0, round_offset };
|
||||
int32x4_t sum_32x4_1 = { 0, 0, 0, 0 };
|
||||
do {
|
||||
sum_32x4_0 = vec_sum4s(vec_vsx_ld(OFF_0, sum_buf), sum_32x4_0);
|
||||
sum_32x4_1 = vec_sum4s(vec_vsx_ld(OFF_0 + CFL_LINE_1, sum_buf), sum_32x4_1);
|
||||
if (width >= 16) {
|
||||
sum_32x4_0 = vec_sum4s(vec_vsx_ld(OFF_1, sum_buf), sum_32x4_0);
|
||||
sum_32x4_1 =
|
||||
vec_sum4s(vec_vsx_ld(OFF_1 + CFL_LINE_1, sum_buf), sum_32x4_1);
|
||||
}
|
||||
if (width == 32) {
|
||||
sum_32x4_0 = vec_sum4s(vec_vsx_ld(OFF_2, sum_buf), sum_32x4_0);
|
||||
sum_32x4_1 =
|
||||
vec_sum4s(vec_vsx_ld(OFF_2 + CFL_LINE_1, sum_buf), sum_32x4_1);
|
||||
sum_32x4_0 = vec_sum4s(vec_vsx_ld(OFF_3, sum_buf), sum_32x4_0);
|
||||
sum_32x4_1 =
|
||||
vec_sum4s(vec_vsx_ld(OFF_3 + CFL_LINE_1, sum_buf), sum_32x4_1);
|
||||
}
|
||||
} while ((sum_buf += (CFL_BUF_LINE * 2)) < end);
|
||||
int32x4_t sum_32x4 = vec_add(sum_32x4_0, sum_32x4_1);
|
||||
|
||||
const int32x4_t perm_64 = vec_perm(sum_32x4, sum_32x4, mask_64);
|
||||
sum_32x4 = vec_add(sum_32x4, perm_64);
|
||||
const int32x4_t perm_32 = vec_perm(sum_32x4, sum_32x4, mask_32);
|
||||
sum_32x4 = vec_add(sum_32x4, perm_32);
|
||||
const int32x4_t avg = vec_sr(sum_32x4, div_shift);
|
||||
const int16x8_t vec_avg = vec_pack(avg, avg);
|
||||
do {
|
||||
vec_vsx_st(vec_sub(vec_vsx_ld(OFF_0, pred_buf), vec_avg), OFF_0, pred_buf);
|
||||
vec_vsx_st(vec_sub(vec_vsx_ld(OFF_0 + CFL_LINE_1, pred_buf), vec_avg),
|
||||
OFF_0 + CFL_BUF_LINE_BYTES, pred_buf);
|
||||
vec_vsx_st(vec_sub(vec_vsx_ld(OFF_0 + CFL_LINE_2, pred_buf), vec_avg),
|
||||
OFF_0 + CFL_LINE_2, pred_buf);
|
||||
vec_vsx_st(vec_sub(vec_vsx_ld(OFF_0 + CFL_LINE_3, pred_buf), vec_avg),
|
||||
OFF_0 + CFL_LINE_3, pred_buf);
|
||||
if (width >= 16) {
|
||||
vec_vsx_st(vec_sub(vec_vsx_ld(OFF_1, pred_buf), vec_avg), OFF_1,
|
||||
pred_buf);
|
||||
vec_vsx_st(vec_sub(vec_vsx_ld(OFF_1 + CFL_LINE_1, pred_buf), vec_avg),
|
||||
OFF_1 + CFL_LINE_1, pred_buf);
|
||||
vec_vsx_st(vec_sub(vec_vsx_ld(OFF_1 + CFL_LINE_2, pred_buf), vec_avg),
|
||||
OFF_1 + CFL_LINE_2, pred_buf);
|
||||
vec_vsx_st(vec_sub(vec_vsx_ld(OFF_1 + CFL_LINE_3, pred_buf), vec_avg),
|
||||
OFF_1 + CFL_LINE_3, pred_buf);
|
||||
}
|
||||
if (width == 32) {
|
||||
vec_vsx_st(vec_sub(vec_vsx_ld(OFF_2, pred_buf), vec_avg), OFF_2,
|
||||
pred_buf);
|
||||
vec_vsx_st(vec_sub(vec_vsx_ld(OFF_2 + CFL_LINE_1, pred_buf), vec_avg),
|
||||
OFF_2 + CFL_LINE_1, pred_buf);
|
||||
vec_vsx_st(vec_sub(vec_vsx_ld(OFF_2 + CFL_LINE_2, pred_buf), vec_avg),
|
||||
OFF_2 + CFL_LINE_2, pred_buf);
|
||||
vec_vsx_st(vec_sub(vec_vsx_ld(OFF_2 + CFL_LINE_3, pred_buf), vec_avg),
|
||||
OFF_2 + CFL_LINE_3, pred_buf);
|
||||
|
||||
vec_vsx_st(vec_sub(vec_vsx_ld(OFF_3, pred_buf), vec_avg), OFF_3,
|
||||
pred_buf);
|
||||
vec_vsx_st(vec_sub(vec_vsx_ld(OFF_3 + CFL_LINE_1, pred_buf), vec_avg),
|
||||
OFF_3 + CFL_LINE_1, pred_buf);
|
||||
vec_vsx_st(vec_sub(vec_vsx_ld(OFF_3 + CFL_LINE_2, pred_buf), vec_avg),
|
||||
OFF_3 + CFL_LINE_2, pred_buf);
|
||||
vec_vsx_st(vec_sub(vec_vsx_ld(OFF_3 + CFL_LINE_3, pred_buf), vec_avg),
|
||||
OFF_3 + CFL_LINE_3, pred_buf);
|
||||
}
|
||||
} while ((pred_buf += CFL_BUF_LINE * 4) < end);
|
||||
}
|
||||
|
||||
// Declare wrappers for VSX sizes
|
||||
CFL_SUB_AVG_X(vsx, 8, 4, 16, 5)
|
||||
CFL_SUB_AVG_X(vsx, 8, 8, 32, 6)
|
||||
CFL_SUB_AVG_X(vsx, 8, 16, 64, 7)
|
||||
CFL_SUB_AVG_X(vsx, 8, 32, 128, 8)
|
||||
CFL_SUB_AVG_X(vsx, 16, 4, 32, 6)
|
||||
CFL_SUB_AVG_X(vsx, 16, 8, 64, 7)
|
||||
CFL_SUB_AVG_X(vsx, 16, 16, 128, 8)
|
||||
CFL_SUB_AVG_X(vsx, 16, 32, 256, 9)
|
||||
CFL_SUB_AVG_X(vsx, 32, 8, 128, 8)
|
||||
CFL_SUB_AVG_X(vsx, 32, 16, 256, 9)
|
||||
CFL_SUB_AVG_X(vsx, 32, 32, 512, 10)
|
||||
|
||||
// Based on observation, for small blocks VSX does not outperform C (no 64bit
|
||||
// load and store intrinsics). So we call the C code for block widths 4.
|
||||
cfl_subtract_average_fn get_subtract_average_fn_vsx(TX_SIZE tx_size) {
|
||||
static const cfl_subtract_average_fn sub_avg[TX_SIZES_ALL] = {
|
||||
subtract_average_4x4_c, /* 4x4 */
|
||||
subtract_average_8x8_vsx, /* 8x8 */
|
||||
subtract_average_16x16_vsx, /* 16x16 */
|
||||
subtract_average_32x32_vsx, /* 32x32 */
|
||||
cfl_subtract_average_null, /* 64x64 (invalid CFL size) */
|
||||
subtract_average_4x8_c, /* 4x8 */
|
||||
subtract_average_8x4_vsx, /* 8x4 */
|
||||
subtract_average_8x16_vsx, /* 8x16 */
|
||||
subtract_average_16x8_vsx, /* 16x8 */
|
||||
subtract_average_16x32_vsx, /* 16x32 */
|
||||
subtract_average_32x16_vsx, /* 32x16 */
|
||||
cfl_subtract_average_null, /* 32x64 (invalid CFL size) */
|
||||
cfl_subtract_average_null, /* 64x32 (invalid CFL size) */
|
||||
subtract_average_4x16_c, /* 4x16 */
|
||||
subtract_average_16x4_vsx, /* 16x4 */
|
||||
subtract_average_8x32_vsx, /* 8x32 */
|
||||
subtract_average_32x8_vsx, /* 32x8 */
|
||||
cfl_subtract_average_null, /* 16x64 (invalid CFL size) */
|
||||
cfl_subtract_average_null, /* 64x16 (invalid CFL size) */
|
||||
};
|
||||
// Modulo TX_SIZES_ALL to ensure that an attacker won't be able to
|
||||
// index the function pointer array out of bounds.
|
||||
return sub_avg[tx_size % TX_SIZES_ALL];
|
||||
}
|
||||
1329
third_party/aom/av1/common/pred_common.c
vendored
1329
third_party/aom/av1/common/pred_common.c
vendored
File diff suppressed because it is too large
Load diff
387
third_party/aom/av1/common/pred_common.h
vendored
387
third_party/aom/av1/common/pred_common.h
vendored
|
|
@ -13,6 +13,7 @@
|
|||
#define AV1_COMMON_PRED_COMMON_H_
|
||||
|
||||
#include "av1/common/blockd.h"
|
||||
#include "av1/common/mvref_common.h"
|
||||
#include "av1/common/onyxc_int.h"
|
||||
#include "aom_dsp/aom_dsp_common.h"
|
||||
|
||||
|
|
@ -39,115 +40,174 @@ static INLINE int get_segment_id(const AV1_COMMON *const cm,
|
|||
return segment_id;
|
||||
}
|
||||
|
||||
static INLINE int av1_get_spatial_seg_pred(const AV1_COMMON *const cm,
|
||||
const MACROBLOCKD *const xd,
|
||||
int mi_row, int mi_col,
|
||||
int *cdf_index) {
|
||||
int prev_ul = -1; // top left segment_id
|
||||
int prev_l = -1; // left segment_id
|
||||
int prev_u = -1; // top segment_id
|
||||
if ((xd->up_available) && (xd->left_available)) {
|
||||
prev_ul = get_segment_id(cm, cm->current_frame_seg_map, BLOCK_4X4,
|
||||
mi_row - 1, mi_col - 1);
|
||||
}
|
||||
if (xd->up_available) {
|
||||
prev_u = get_segment_id(cm, cm->current_frame_seg_map, BLOCK_4X4,
|
||||
mi_row - 1, mi_col - 0);
|
||||
}
|
||||
if (xd->left_available) {
|
||||
prev_l = get_segment_id(cm, cm->current_frame_seg_map, BLOCK_4X4,
|
||||
mi_row - 0, mi_col - 1);
|
||||
}
|
||||
|
||||
// Pick CDF index based on number of matching/out-of-bounds segment IDs.
|
||||
if (prev_ul < 0 || prev_u < 0 || prev_l < 0) /* Edge case */
|
||||
*cdf_index = 0;
|
||||
else if ((prev_ul == prev_u) && (prev_ul == prev_l))
|
||||
*cdf_index = 2;
|
||||
else if ((prev_ul == prev_u) || (prev_ul == prev_l) || (prev_u == prev_l))
|
||||
*cdf_index = 1;
|
||||
else
|
||||
*cdf_index = 0;
|
||||
|
||||
// If 2 or more are identical returns that as predictor, otherwise prev_l.
|
||||
if (prev_u == -1) // edge case
|
||||
return prev_l == -1 ? 0 : prev_l;
|
||||
if (prev_l == -1) // edge case
|
||||
return prev_u;
|
||||
return (prev_ul == prev_u) ? prev_u : prev_l;
|
||||
}
|
||||
|
||||
static INLINE int av1_get_pred_context_seg_id(const MACROBLOCKD *xd) {
|
||||
const MODE_INFO *const above_mi = xd->above_mi;
|
||||
const MODE_INFO *const left_mi = xd->left_mi;
|
||||
const int above_sip =
|
||||
(above_mi != NULL) ? above_mi->mbmi.seg_id_predicted : 0;
|
||||
const int left_sip = (left_mi != NULL) ? left_mi->mbmi.seg_id_predicted : 0;
|
||||
const MB_MODE_INFO *const above_mi = xd->above_mbmi;
|
||||
const MB_MODE_INFO *const left_mi = xd->left_mbmi;
|
||||
const int above_sip = (above_mi != NULL) ? above_mi->seg_id_predicted : 0;
|
||||
const int left_sip = (left_mi != NULL) ? left_mi->seg_id_predicted : 0;
|
||||
|
||||
return above_sip + left_sip;
|
||||
}
|
||||
|
||||
static INLINE aom_prob av1_get_pred_prob_seg_id(
|
||||
const struct segmentation_probs *segp, const MACROBLOCKD *xd) {
|
||||
return segp->pred_probs[av1_get_pred_context_seg_id(xd)];
|
||||
static INLINE int get_comp_index_context(const AV1_COMMON *cm,
|
||||
const MACROBLOCKD *xd) {
|
||||
MB_MODE_INFO *mbmi = xd->mi[0];
|
||||
int bck_idx = cm->frame_refs[mbmi->ref_frame[0] - LAST_FRAME].idx;
|
||||
int fwd_idx = cm->frame_refs[mbmi->ref_frame[1] - LAST_FRAME].idx;
|
||||
int bck_frame_index = 0, fwd_frame_index = 0;
|
||||
int cur_frame_index = cm->cur_frame->cur_frame_offset;
|
||||
|
||||
if (bck_idx >= 0)
|
||||
bck_frame_index = cm->buffer_pool->frame_bufs[bck_idx].cur_frame_offset;
|
||||
|
||||
if (fwd_idx >= 0)
|
||||
fwd_frame_index = cm->buffer_pool->frame_bufs[fwd_idx].cur_frame_offset;
|
||||
int fwd = abs(get_relative_dist(cm, fwd_frame_index, cur_frame_index));
|
||||
int bck = abs(get_relative_dist(cm, cur_frame_index, bck_frame_index));
|
||||
|
||||
const MB_MODE_INFO *const above_mi = xd->above_mbmi;
|
||||
const MB_MODE_INFO *const left_mi = xd->left_mbmi;
|
||||
|
||||
int above_ctx = 0, left_ctx = 0;
|
||||
const int offset = (fwd == bck);
|
||||
|
||||
if (above_mi) {
|
||||
if (has_second_ref(above_mi))
|
||||
above_ctx = above_mi->compound_idx;
|
||||
else if (above_mi->ref_frame[0] == ALTREF_FRAME)
|
||||
above_ctx = 1;
|
||||
}
|
||||
|
||||
if (left_mi) {
|
||||
if (has_second_ref(left_mi))
|
||||
left_ctx = left_mi->compound_idx;
|
||||
else if (left_mi->ref_frame[0] == ALTREF_FRAME)
|
||||
left_ctx = 1;
|
||||
}
|
||||
|
||||
return above_ctx + left_ctx + 3 * offset;
|
||||
}
|
||||
|
||||
static INLINE int get_comp_group_idx_context(const MACROBLOCKD *xd) {
|
||||
const MB_MODE_INFO *const above_mi = xd->above_mbmi;
|
||||
const MB_MODE_INFO *const left_mi = xd->left_mbmi;
|
||||
int above_ctx = 0, left_ctx = 0;
|
||||
|
||||
if (above_mi) {
|
||||
if (has_second_ref(above_mi))
|
||||
above_ctx = above_mi->comp_group_idx;
|
||||
else if (above_mi->ref_frame[0] == ALTREF_FRAME)
|
||||
above_ctx = 3;
|
||||
}
|
||||
if (left_mi) {
|
||||
if (has_second_ref(left_mi))
|
||||
left_ctx = left_mi->comp_group_idx;
|
||||
else if (left_mi->ref_frame[0] == ALTREF_FRAME)
|
||||
left_ctx = 3;
|
||||
}
|
||||
|
||||
return AOMMIN(5, above_ctx + left_ctx);
|
||||
}
|
||||
|
||||
#if CONFIG_NEW_MULTISYMBOL
|
||||
static INLINE aom_cdf_prob *av1_get_pred_cdf_seg_id(
|
||||
struct segmentation_probs *segp, const MACROBLOCKD *xd) {
|
||||
return segp->pred_cdf[av1_get_pred_context_seg_id(xd)];
|
||||
}
|
||||
#endif
|
||||
|
||||
static INLINE int av1_get_skip_mode_context(const MACROBLOCKD *xd) {
|
||||
const MB_MODE_INFO *const above_mi = xd->above_mbmi;
|
||||
const MB_MODE_INFO *const left_mi = xd->left_mbmi;
|
||||
const int above_skip_mode = above_mi ? above_mi->skip_mode : 0;
|
||||
const int left_skip_mode = left_mi ? left_mi->skip_mode : 0;
|
||||
return above_skip_mode + left_skip_mode;
|
||||
}
|
||||
|
||||
static INLINE int av1_get_skip_context(const MACROBLOCKD *xd) {
|
||||
const MODE_INFO *const above_mi = xd->above_mi;
|
||||
const MODE_INFO *const left_mi = xd->left_mi;
|
||||
const int above_skip = (above_mi != NULL) ? above_mi->mbmi.skip : 0;
|
||||
const int left_skip = (left_mi != NULL) ? left_mi->mbmi.skip : 0;
|
||||
const MB_MODE_INFO *const above_mi = xd->above_mbmi;
|
||||
const MB_MODE_INFO *const left_mi = xd->left_mbmi;
|
||||
const int above_skip = above_mi ? above_mi->skip : 0;
|
||||
const int left_skip = left_mi ? left_mi->skip : 0;
|
||||
return above_skip + left_skip;
|
||||
}
|
||||
|
||||
static INLINE aom_prob av1_get_skip_prob(const AV1_COMMON *cm,
|
||||
const MACROBLOCKD *xd) {
|
||||
return cm->fc->skip_probs[av1_get_skip_context(xd)];
|
||||
}
|
||||
|
||||
#if CONFIG_DUAL_FILTER
|
||||
int av1_get_pred_context_switchable_interp(const MACROBLOCKD *xd, int dir);
|
||||
#else
|
||||
int av1_get_pred_context_switchable_interp(const MACROBLOCKD *xd);
|
||||
#endif
|
||||
|
||||
#if CONFIG_EXT_INTRA
|
||||
#if CONFIG_INTRA_INTERP
|
||||
int av1_get_pred_context_intra_interp(const MACROBLOCKD *xd);
|
||||
#endif // CONFIG_INTRA_INTERP
|
||||
#endif // CONFIG_EXT_INTRA
|
||||
|
||||
#if CONFIG_PALETTE_DELTA_ENCODING
|
||||
// Get a list of palette base colors that are used in the above and left blocks,
|
||||
// referred to as "color cache". The return value is the number of colors in the
|
||||
// cache (<= 2 * PALETTE_MAX_SIZE). The color values are stored in "cache"
|
||||
// in ascending order.
|
||||
int av1_get_palette_cache(const MACROBLOCKD *const xd, int plane,
|
||||
uint16_t *cache);
|
||||
#endif // CONFIG_PALETTE_DELTA_ENCODING
|
||||
|
||||
static INLINE int av1_get_palette_bsize_ctx(BLOCK_SIZE bsize) {
|
||||
return num_pels_log2_lookup[bsize] - num_pels_log2_lookup[BLOCK_8X8];
|
||||
}
|
||||
|
||||
static INLINE int av1_get_palette_mode_ctx(const MACROBLOCKD *xd) {
|
||||
const MB_MODE_INFO *const above_mi = xd->above_mbmi;
|
||||
const MB_MODE_INFO *const left_mi = xd->left_mbmi;
|
||||
int ctx = 0;
|
||||
if (above_mi) ctx += (above_mi->palette_mode_info.palette_size[0] > 0);
|
||||
if (left_mi) ctx += (left_mi->palette_mode_info.palette_size[0] > 0);
|
||||
return ctx;
|
||||
}
|
||||
|
||||
int av1_get_intra_inter_context(const MACROBLOCKD *xd);
|
||||
|
||||
static INLINE aom_prob av1_get_intra_inter_prob(const AV1_COMMON *cm,
|
||||
const MACROBLOCKD *xd) {
|
||||
return cm->fc->intra_inter_prob[av1_get_intra_inter_context(xd)];
|
||||
int av1_get_reference_mode_context(const MACROBLOCKD *xd);
|
||||
|
||||
static INLINE aom_cdf_prob *av1_get_reference_mode_cdf(const MACROBLOCKD *xd) {
|
||||
return xd->tile_ctx->comp_inter_cdf[av1_get_reference_mode_context(xd)];
|
||||
}
|
||||
|
||||
int av1_get_reference_mode_context(const AV1_COMMON *cm, const MACROBLOCKD *xd);
|
||||
|
||||
static INLINE aom_prob av1_get_reference_mode_prob(const AV1_COMMON *cm,
|
||||
const MACROBLOCKD *xd) {
|
||||
return cm->fc->comp_inter_prob[av1_get_reference_mode_context(cm, xd)];
|
||||
}
|
||||
#if CONFIG_NEW_MULTISYMBOL
|
||||
static INLINE aom_cdf_prob *av1_get_reference_mode_cdf(const AV1_COMMON *cm,
|
||||
const MACROBLOCKD *xd) {
|
||||
return xd->tile_ctx->comp_inter_cdf[av1_get_reference_mode_context(cm, xd)];
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CONFIG_EXT_COMP_REFS
|
||||
int av1_get_comp_reference_type_context(const MACROBLOCKD *xd);
|
||||
|
||||
static INLINE aom_prob av1_get_comp_reference_type_prob(const AV1_COMMON *cm,
|
||||
const MACROBLOCKD *xd) {
|
||||
return cm->fc->comp_ref_type_prob[av1_get_comp_reference_type_context(xd)];
|
||||
}
|
||||
// == Uni-directional contexts ==
|
||||
|
||||
int av1_get_pred_context_uni_comp_ref_p(const MACROBLOCKD *xd);
|
||||
|
||||
static INLINE aom_prob av1_get_pred_prob_uni_comp_ref_p(const AV1_COMMON *cm,
|
||||
const MACROBLOCKD *xd) {
|
||||
const int pred_context = av1_get_pred_context_uni_comp_ref_p(xd);
|
||||
return cm->fc->uni_comp_ref_prob[pred_context][0];
|
||||
}
|
||||
|
||||
int av1_get_pred_context_uni_comp_ref_p1(const MACROBLOCKD *xd);
|
||||
|
||||
static INLINE aom_prob
|
||||
av1_get_pred_prob_uni_comp_ref_p1(const AV1_COMMON *cm, const MACROBLOCKD *xd) {
|
||||
const int pred_context = av1_get_pred_context_uni_comp_ref_p1(xd);
|
||||
return cm->fc->uni_comp_ref_prob[pred_context][1];
|
||||
}
|
||||
|
||||
int av1_get_pred_context_uni_comp_ref_p2(const MACROBLOCKD *xd);
|
||||
|
||||
static INLINE aom_prob
|
||||
av1_get_pred_prob_uni_comp_ref_p2(const AV1_COMMON *cm, const MACROBLOCKD *xd) {
|
||||
const int pred_context = av1_get_pred_context_uni_comp_ref_p2(xd);
|
||||
return cm->fc->uni_comp_ref_prob[pred_context][2];
|
||||
}
|
||||
|
||||
#if CONFIG_NEW_MULTISYMBOL
|
||||
static INLINE aom_cdf_prob *av1_get_comp_reference_type_cdf(
|
||||
const MACROBLOCKD *xd) {
|
||||
const int pred_context = av1_get_comp_reference_type_context(xd);
|
||||
|
|
@ -171,211 +231,126 @@ static INLINE aom_cdf_prob *av1_get_pred_cdf_uni_comp_ref_p2(
|
|||
const int pred_context = av1_get_pred_context_uni_comp_ref_p2(xd);
|
||||
return xd->tile_ctx->uni_comp_ref_cdf[pred_context][2];
|
||||
}
|
||||
#endif // CONFIG_NEW_MULTISYMBOL
|
||||
#endif // CONFIG_EXT_COMP_REFS
|
||||
|
||||
int av1_get_pred_context_comp_ref_p(const AV1_COMMON *cm,
|
||||
const MACROBLOCKD *xd);
|
||||
// == Bi-directional contexts ==
|
||||
|
||||
#if CONFIG_NEW_MULTISYMBOL
|
||||
static INLINE aom_cdf_prob *av1_get_pred_cdf_comp_ref_p(const AV1_COMMON *cm,
|
||||
const MACROBLOCKD *xd) {
|
||||
const int pred_context = av1_get_pred_context_comp_ref_p(cm, xd);
|
||||
int av1_get_pred_context_comp_ref_p(const MACROBLOCKD *xd);
|
||||
|
||||
int av1_get_pred_context_comp_ref_p1(const MACROBLOCKD *xd);
|
||||
|
||||
int av1_get_pred_context_comp_ref_p2(const MACROBLOCKD *xd);
|
||||
|
||||
int av1_get_pred_context_comp_bwdref_p(const MACROBLOCKD *xd);
|
||||
|
||||
int av1_get_pred_context_comp_bwdref_p1(const MACROBLOCKD *xd);
|
||||
|
||||
static INLINE aom_cdf_prob *av1_get_pred_cdf_comp_ref_p(const MACROBLOCKD *xd) {
|
||||
const int pred_context = av1_get_pred_context_comp_ref_p(xd);
|
||||
return xd->tile_ctx->comp_ref_cdf[pred_context][0];
|
||||
}
|
||||
#endif
|
||||
|
||||
static INLINE aom_prob av1_get_pred_prob_comp_ref_p(const AV1_COMMON *cm,
|
||||
const MACROBLOCKD *xd) {
|
||||
const int pred_context = av1_get_pred_context_comp_ref_p(cm, xd);
|
||||
return cm->fc->comp_ref_prob[pred_context][0];
|
||||
}
|
||||
|
||||
#if CONFIG_EXT_REFS
|
||||
int av1_get_pred_context_comp_ref_p1(const AV1_COMMON *cm,
|
||||
const MACROBLOCKD *xd);
|
||||
|
||||
#if CONFIG_NEW_MULTISYMBOL
|
||||
static INLINE aom_cdf_prob *av1_get_pred_cdf_comp_ref_p1(
|
||||
const AV1_COMMON *cm, const MACROBLOCKD *xd) {
|
||||
const int pred_context = av1_get_pred_context_comp_ref_p1(cm, xd);
|
||||
const MACROBLOCKD *xd) {
|
||||
const int pred_context = av1_get_pred_context_comp_ref_p1(xd);
|
||||
return xd->tile_ctx->comp_ref_cdf[pred_context][1];
|
||||
}
|
||||
#endif // CONFIG_NEW_MULTISYMBOL
|
||||
|
||||
static INLINE aom_prob av1_get_pred_prob_comp_ref_p1(const AV1_COMMON *cm,
|
||||
const MACROBLOCKD *xd) {
|
||||
const int pred_context = av1_get_pred_context_comp_ref_p1(cm, xd);
|
||||
return cm->fc->comp_ref_prob[pred_context][1];
|
||||
}
|
||||
|
||||
int av1_get_pred_context_comp_ref_p2(const AV1_COMMON *cm,
|
||||
const MACROBLOCKD *xd);
|
||||
|
||||
#if CONFIG_NEW_MULTISYMBOL
|
||||
static INLINE aom_cdf_prob *av1_get_pred_cdf_comp_ref_p2(
|
||||
const AV1_COMMON *cm, const MACROBLOCKD *xd) {
|
||||
const int pred_context = av1_get_pred_context_comp_ref_p2(cm, xd);
|
||||
const MACROBLOCKD *xd) {
|
||||
const int pred_context = av1_get_pred_context_comp_ref_p2(xd);
|
||||
return xd->tile_ctx->comp_ref_cdf[pred_context][2];
|
||||
}
|
||||
#endif // CONFIG_NEW_MULTISYMBOL
|
||||
|
||||
static INLINE aom_prob av1_get_pred_prob_comp_ref_p2(const AV1_COMMON *cm,
|
||||
const MACROBLOCKD *xd) {
|
||||
const int pred_context = av1_get_pred_context_comp_ref_p2(cm, xd);
|
||||
return cm->fc->comp_ref_prob[pred_context][2];
|
||||
}
|
||||
|
||||
int av1_get_pred_context_comp_bwdref_p(const AV1_COMMON *cm,
|
||||
const MACROBLOCKD *xd);
|
||||
|
||||
#if CONFIG_NEW_MULTISYMBOL
|
||||
static INLINE aom_cdf_prob *av1_get_pred_cdf_comp_bwdref_p(
|
||||
const AV1_COMMON *cm, const MACROBLOCKD *xd) {
|
||||
const int pred_context = av1_get_pred_context_comp_bwdref_p(cm, xd);
|
||||
const MACROBLOCKD *xd) {
|
||||
const int pred_context = av1_get_pred_context_comp_bwdref_p(xd);
|
||||
return xd->tile_ctx->comp_bwdref_cdf[pred_context][0];
|
||||
}
|
||||
#endif // CONFIG_NEW_MULTISYMBOL
|
||||
|
||||
static INLINE aom_prob av1_get_pred_prob_comp_bwdref_p(const AV1_COMMON *cm,
|
||||
const MACROBLOCKD *xd) {
|
||||
const int pred_context = av1_get_pred_context_comp_bwdref_p(cm, xd);
|
||||
return cm->fc->comp_bwdref_prob[pred_context][0];
|
||||
}
|
||||
|
||||
int av1_get_pred_context_comp_bwdref_p1(const AV1_COMMON *cm,
|
||||
const MACROBLOCKD *xd);
|
||||
|
||||
#if CONFIG_NEW_MULTISYMBOL
|
||||
static INLINE aom_cdf_prob *av1_get_pred_cdf_comp_bwdref_p1(
|
||||
const AV1_COMMON *cm, const MACROBLOCKD *xd) {
|
||||
const int pred_context = av1_get_pred_context_comp_bwdref_p1(cm, xd);
|
||||
const MACROBLOCKD *xd) {
|
||||
const int pred_context = av1_get_pred_context_comp_bwdref_p1(xd);
|
||||
return xd->tile_ctx->comp_bwdref_cdf[pred_context][1];
|
||||
}
|
||||
#endif // CONFIG_NEW_MULTISYMBOL
|
||||
|
||||
static INLINE aom_prob av1_get_pred_prob_comp_bwdref_p1(const AV1_COMMON *cm,
|
||||
const MACROBLOCKD *xd) {
|
||||
const int pred_context = av1_get_pred_context_comp_bwdref_p1(cm, xd);
|
||||
return cm->fc->comp_bwdref_prob[pred_context][1];
|
||||
}
|
||||
#endif // CONFIG_EXT_REFS
|
||||
// == Single contexts ==
|
||||
|
||||
int av1_get_pred_context_single_ref_p1(const MACROBLOCKD *xd);
|
||||
|
||||
static INLINE aom_prob av1_get_pred_prob_single_ref_p1(const AV1_COMMON *cm,
|
||||
const MACROBLOCKD *xd) {
|
||||
return cm->fc->single_ref_prob[av1_get_pred_context_single_ref_p1(xd)][0];
|
||||
}
|
||||
|
||||
int av1_get_pred_context_single_ref_p2(const MACROBLOCKD *xd);
|
||||
|
||||
static INLINE aom_prob av1_get_pred_prob_single_ref_p2(const AV1_COMMON *cm,
|
||||
const MACROBLOCKD *xd) {
|
||||
return cm->fc->single_ref_prob[av1_get_pred_context_single_ref_p2(xd)][1];
|
||||
}
|
||||
|
||||
#if CONFIG_EXT_REFS
|
||||
int av1_get_pred_context_single_ref_p3(const MACROBLOCKD *xd);
|
||||
|
||||
static INLINE aom_prob av1_get_pred_prob_single_ref_p3(const AV1_COMMON *cm,
|
||||
const MACROBLOCKD *xd) {
|
||||
return cm->fc->single_ref_prob[av1_get_pred_context_single_ref_p3(xd)][2];
|
||||
}
|
||||
|
||||
int av1_get_pred_context_single_ref_p4(const MACROBLOCKD *xd);
|
||||
|
||||
static INLINE aom_prob av1_get_pred_prob_single_ref_p4(const AV1_COMMON *cm,
|
||||
const MACROBLOCKD *xd) {
|
||||
return cm->fc->single_ref_prob[av1_get_pred_context_single_ref_p4(xd)][3];
|
||||
}
|
||||
|
||||
int av1_get_pred_context_single_ref_p5(const MACROBLOCKD *xd);
|
||||
|
||||
static INLINE aom_prob av1_get_pred_prob_single_ref_p5(const AV1_COMMON *cm,
|
||||
const MACROBLOCKD *xd) {
|
||||
return cm->fc->single_ref_prob[av1_get_pred_context_single_ref_p5(xd)][4];
|
||||
}
|
||||
|
||||
int av1_get_pred_context_single_ref_p6(const MACROBLOCKD *xd);
|
||||
|
||||
static INLINE aom_prob av1_get_pred_prob_single_ref_p6(const AV1_COMMON *cm,
|
||||
const MACROBLOCKD *xd) {
|
||||
return cm->fc->single_ref_prob[av1_get_pred_context_single_ref_p6(xd)][5];
|
||||
}
|
||||
#endif // CONFIG_EXT_REFS
|
||||
|
||||
#if CONFIG_NEW_MULTISYMBOL
|
||||
static INLINE aom_cdf_prob *av1_get_pred_cdf_single_ref_p1(
|
||||
const AV1_COMMON *cm, const MACROBLOCKD *xd) {
|
||||
(void)cm;
|
||||
const MACROBLOCKD *xd) {
|
||||
return xd->tile_ctx
|
||||
->single_ref_cdf[av1_get_pred_context_single_ref_p1(xd)][0];
|
||||
}
|
||||
static INLINE aom_cdf_prob *av1_get_pred_cdf_single_ref_p2(
|
||||
const AV1_COMMON *cm, const MACROBLOCKD *xd) {
|
||||
(void)cm;
|
||||
const MACROBLOCKD *xd) {
|
||||
return xd->tile_ctx
|
||||
->single_ref_cdf[av1_get_pred_context_single_ref_p2(xd)][1];
|
||||
}
|
||||
#if CONFIG_EXT_REFS
|
||||
static INLINE aom_cdf_prob *av1_get_pred_cdf_single_ref_p3(
|
||||
const AV1_COMMON *cm, const MACROBLOCKD *xd) {
|
||||
(void)cm;
|
||||
const MACROBLOCKD *xd) {
|
||||
return xd->tile_ctx
|
||||
->single_ref_cdf[av1_get_pred_context_single_ref_p3(xd)][2];
|
||||
}
|
||||
static INLINE aom_cdf_prob *av1_get_pred_cdf_single_ref_p4(
|
||||
const AV1_COMMON *cm, const MACROBLOCKD *xd) {
|
||||
(void)cm;
|
||||
const MACROBLOCKD *xd) {
|
||||
return xd->tile_ctx
|
||||
->single_ref_cdf[av1_get_pred_context_single_ref_p4(xd)][3];
|
||||
}
|
||||
static INLINE aom_cdf_prob *av1_get_pred_cdf_single_ref_p5(
|
||||
const AV1_COMMON *cm, const MACROBLOCKD *xd) {
|
||||
(void)cm;
|
||||
const MACROBLOCKD *xd) {
|
||||
return xd->tile_ctx
|
||||
->single_ref_cdf[av1_get_pred_context_single_ref_p5(xd)][4];
|
||||
}
|
||||
static INLINE aom_cdf_prob *av1_get_pred_cdf_single_ref_p6(
|
||||
const AV1_COMMON *cm, const MACROBLOCKD *xd) {
|
||||
(void)cm;
|
||||
const MACROBLOCKD *xd) {
|
||||
return xd->tile_ctx
|
||||
->single_ref_cdf[av1_get_pred_context_single_ref_p6(xd)][5];
|
||||
}
|
||||
#endif // CONFIG_EXT_REFS
|
||||
#endif // CONFIG_NEW_MULTISYMBOL
|
||||
|
||||
#if CONFIG_COMPOUND_SINGLEREF
|
||||
int av1_get_inter_mode_context(const MACROBLOCKD *xd);
|
||||
|
||||
static INLINE aom_prob av1_get_inter_mode_prob(const AV1_COMMON *cm,
|
||||
const MACROBLOCKD *xd) {
|
||||
return cm->fc->comp_inter_mode_prob[av1_get_inter_mode_context(xd)];
|
||||
}
|
||||
#endif // CONFIG_COMPOUND_SINGLEREF
|
||||
|
||||
// Returns a context number for the given MB prediction signal
|
||||
// The mode info data structure has a one element border above and to the
|
||||
// left of the entries corresponding to real blocks.
|
||||
// The prediction flags in these dummy entries are initialized to 0.
|
||||
static INLINE int get_tx_size_context(const MACROBLOCKD *xd) {
|
||||
const int max_tx_size = max_txsize_lookup[xd->mi[0]->mbmi.sb_type];
|
||||
const MB_MODE_INFO *mbmi = xd->mi[0];
|
||||
const MB_MODE_INFO *const above_mbmi = xd->above_mbmi;
|
||||
const MB_MODE_INFO *const left_mbmi = xd->left_mbmi;
|
||||
const TX_SIZE max_tx_size = max_txsize_rect_lookup[mbmi->sb_type];
|
||||
const int max_tx_wide = tx_size_wide[max_tx_size];
|
||||
const int max_tx_high = tx_size_high[max_tx_size];
|
||||
const int has_above = xd->up_available;
|
||||
const int has_left = xd->left_available;
|
||||
int above_ctx = (has_above && !above_mbmi->skip)
|
||||
? (int)txsize_sqr_map[above_mbmi->tx_size]
|
||||
: max_tx_size;
|
||||
int left_ctx = (has_left && !left_mbmi->skip)
|
||||
? (int)txsize_sqr_map[left_mbmi->tx_size]
|
||||
: max_tx_size;
|
||||
|
||||
if (!has_left) left_ctx = above_ctx;
|
||||
int above = xd->above_txfm_context[0] >= max_tx_wide;
|
||||
int left = xd->left_txfm_context[0] >= max_tx_high;
|
||||
|
||||
if (!has_above) above_ctx = left_ctx;
|
||||
return (above_ctx + left_ctx) > max_tx_size + TX_SIZE_LUMA_MIN;
|
||||
if (has_above)
|
||||
if (is_inter_block(above_mbmi))
|
||||
above = block_size_wide[above_mbmi->sb_type] >= max_tx_wide;
|
||||
|
||||
if (has_left)
|
||||
if (is_inter_block(left_mbmi))
|
||||
left = block_size_high[left_mbmi->sb_type] >= max_tx_high;
|
||||
|
||||
if (has_above && has_left)
|
||||
return (above + left);
|
||||
else if (has_above)
|
||||
return above;
|
||||
else if (has_left)
|
||||
return left;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
1007
third_party/aom/av1/common/pvq.c
vendored
1007
third_party/aom/av1/common/pvq.c
vendored
File diff suppressed because it is too large
Load diff
179
third_party/aom/av1/common/pvq.h
vendored
179
third_party/aom/av1/common/pvq.h
vendored
|
|
@ -1,179 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2001-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.
|
||||
*/
|
||||
|
||||
/* clang-format off */
|
||||
|
||||
#if !defined(_pvq_H)
|
||||
# define _pvq_H (1)
|
||||
# include "generic_code.h"
|
||||
# include "odintrin.h"
|
||||
|
||||
extern const uint16_t EXP_CDF_TABLE[][16];
|
||||
extern const uint16_t LAPLACE_OFFSET[];
|
||||
|
||||
#define AV1_PVQ_ENABLE_ACTIVITY_MASKING (0)
|
||||
|
||||
# define PVQ_MAX_PARTITIONS (1 + 3*(OD_TXSIZES-1))
|
||||
|
||||
# define OD_NOREF_ADAPT_SPEED (4)
|
||||
/* Normalized lambda for PVQ quantizer. Since we normalize the gain by q, the
|
||||
distortion is normalized by q^2 and lambda does not need the q^2 factor.
|
||||
At high rate, this would be log(2)/6, but we're using a slightly more
|
||||
aggressive value, closer to:
|
||||
Li, Xiang, et al. "Laplace distribution based Lagrangian rate distortion
|
||||
optimization for hybrid video coding." Circuits and Systems for Video
|
||||
Technology, IEEE Transactions on 19.2 (2009): 193-205.
|
||||
*/
|
||||
# define OD_PVQ_LAMBDA (.1146)
|
||||
|
||||
#define OD_PVQ_SKIP_ZERO 1
|
||||
#define OD_PVQ_SKIP_COPY 2
|
||||
|
||||
/* Maximum size for coding a PVQ band. */
|
||||
#define OD_MAX_PVQ_SIZE (1024)
|
||||
|
||||
#if defined(OD_FLOAT_PVQ)
|
||||
#define OD_QM_SHIFT (15)
|
||||
#else
|
||||
#define OD_QM_SHIFT (11)
|
||||
#endif
|
||||
#define OD_QM_SCALE (1 << OD_QM_SHIFT)
|
||||
#if defined(OD_FLOAT_PVQ)
|
||||
#define OD_QM_SCALE_1 (1./OD_QM_SCALE)
|
||||
#endif
|
||||
#define OD_QM_SCALE_MAX 32767
|
||||
#define OD_QM_INV_SHIFT (12)
|
||||
#define OD_QM_INV_SCALE (1 << OD_QM_INV_SHIFT)
|
||||
#if defined(OD_FLOAT_PVQ)
|
||||
#define OD_QM_INV_SCALE_1 (1./OD_QM_INV_SCALE)
|
||||
#endif
|
||||
#define OD_QM_OFFSET(bs) ((((1 << 2*bs) - 1) << 2*OD_LOG_BSIZE0)/3)
|
||||
#define OD_QM_STRIDE (OD_QM_OFFSET(OD_TXSIZES))
|
||||
#define OD_QM_BUFFER_SIZE (2*OD_QM_STRIDE)
|
||||
|
||||
#if !defined(OD_FLOAT_PVQ)
|
||||
#define OD_THETA_SHIFT (15)
|
||||
#define OD_THETA_SCALE ((1 << OD_THETA_SHIFT)*2./M_PI)
|
||||
#define OD_MAX_THETA_SCALE (1 << OD_THETA_SHIFT)
|
||||
#define OD_TRIG_SCALE (32768)
|
||||
#define OD_BETA_SHIFT (12)
|
||||
#define OD_BETA_SCALE_1 (1./(1 << OD_BETA_SHIFT))
|
||||
/*Multiplies 16-bit a by 32-bit b and keeps bits [16:64-OD_BETA_SHIFT-1].*/
|
||||
#define OD_MULT16_32_QBETA(a, b) \
|
||||
((int16_t)(a)*(int64_t)(int32_t)(b) >> OD_BETA_SHIFT)
|
||||
# define OD_MULT16_16_QBETA(a, b) \
|
||||
((((int16_t)(a))*((int32_t)(int16_t)(b))) >> OD_BETA_SHIFT)
|
||||
#define OD_CGAIN_SHIFT (8)
|
||||
#define OD_CGAIN_SCALE (1 << OD_CGAIN_SHIFT)
|
||||
#else
|
||||
#define OD_BETA_SCALE_1 (1.)
|
||||
#define OD_THETA_SCALE (1)
|
||||
#define OD_TRIG_SCALE (1)
|
||||
#define OD_CGAIN_SCALE (1)
|
||||
#endif
|
||||
#define OD_THETA_SCALE_1 (1./OD_THETA_SCALE)
|
||||
#define OD_TRIG_SCALE_1 (1./OD_TRIG_SCALE)
|
||||
#define OD_CGAIN_SCALE_1 (1./OD_CGAIN_SCALE)
|
||||
#define OD_CGAIN_SCALE_2 (OD_CGAIN_SCALE_1*OD_CGAIN_SCALE_1)
|
||||
|
||||
/* Largest PVQ partition is half the coefficients of largest block size. */
|
||||
#define MAXN (OD_TXSIZE_MAX*OD_TXSIZE_MAX/2)
|
||||
|
||||
#define OD_COMPAND_SHIFT (8 + OD_COEFF_SHIFT)
|
||||
#define OD_COMPAND_SCALE (1 << OD_COMPAND_SHIFT)
|
||||
#define OD_COMPAND_SCALE_1 (1./OD_COMPAND_SCALE)
|
||||
|
||||
#define OD_QM_SIZE (OD_TXSIZES*(OD_TXSIZES + 1))
|
||||
|
||||
#define OD_FLAT_QM 0
|
||||
#define OD_HVS_QM 1
|
||||
|
||||
# define OD_NSB_ADAPT_CTXS (4)
|
||||
|
||||
# define OD_ADAPT_K_Q8 0
|
||||
# define OD_ADAPT_SUM_EX_Q8 1
|
||||
# define OD_ADAPT_COUNT_Q8 2
|
||||
# define OD_ADAPT_COUNT_EX_Q8 3
|
||||
|
||||
# define OD_ADAPT_NO_VALUE (-2147483647-1)
|
||||
|
||||
typedef enum {
|
||||
PVQ_SKIP = 0x0,
|
||||
DC_CODED = 0x1,
|
||||
AC_CODED = 0x2,
|
||||
AC_DC_CODED = 0x3,
|
||||
} PVQ_SKIP_TYPE;
|
||||
|
||||
typedef struct od_pvq_adapt_ctx od_pvq_adapt_ctx;
|
||||
typedef struct od_pvq_codeword_ctx od_pvq_codeword_ctx;
|
||||
|
||||
struct od_pvq_codeword_ctx {
|
||||
int pvq_adapt[2*OD_TXSIZES*OD_NSB_ADAPT_CTXS];
|
||||
/* CDFs are size 16 despite the fact that we're using less than that. */
|
||||
uint16_t pvq_k1_cdf[12][CDF_SIZE(16)];
|
||||
uint16_t pvq_split_cdf[22*7][CDF_SIZE(8)];
|
||||
};
|
||||
|
||||
struct od_pvq_adapt_ctx {
|
||||
od_pvq_codeword_ctx pvq_codeword_ctx;
|
||||
generic_encoder pvq_param_model[3];
|
||||
int pvq_ext[OD_TXSIZES*PVQ_MAX_PARTITIONS];
|
||||
int pvq_exg[OD_NPLANES_MAX][OD_TXSIZES][PVQ_MAX_PARTITIONS];
|
||||
uint16_t pvq_gaintheta_cdf[2*OD_TXSIZES*PVQ_MAX_PARTITIONS][CDF_SIZE(16)];
|
||||
uint16_t pvq_skip_dir_cdf[2*(OD_TXSIZES-1)][CDF_SIZE(7)];
|
||||
};
|
||||
|
||||
typedef struct od_qm_entry {
|
||||
int interp_q;
|
||||
int scale_q8;
|
||||
const unsigned char *qm_q4;
|
||||
} od_qm_entry;
|
||||
|
||||
extern const od_qm_entry OD_DEFAULT_QMS[2][2][OD_NPLANES_MAX];
|
||||
|
||||
void od_adapt_pvq_ctx_reset(od_pvq_adapt_ctx *state, int is_keyframe);
|
||||
int od_pvq_size_ctx(int n);
|
||||
int od_pvq_k1_ctx(int n, int orig_size);
|
||||
|
||||
od_val16 od_pvq_sin(od_val32 x);
|
||||
od_val16 od_pvq_cos(od_val32 x);
|
||||
#if !defined(OD_FLOAT_PVQ)
|
||||
int od_vector_log_mag(const od_coeff *x, int n);
|
||||
#endif
|
||||
|
||||
void od_interp_qm(unsigned char *out, int q, const od_qm_entry *entry1,
|
||||
const od_qm_entry *entry2);
|
||||
|
||||
int od_qm_get_index(int bs, int band);
|
||||
|
||||
extern const od_val16 *const OD_PVQ_BETA[2][OD_NPLANES_MAX][OD_TXSIZES + 1];
|
||||
|
||||
void od_init_qm(int16_t *x, int16_t *x_inv, const int *qm);
|
||||
int od_compute_householder(od_val16 *r, int n, od_val32 gr, int *sign,
|
||||
int shift);
|
||||
void od_apply_householder(od_val16 *out, const od_val16 *x, const od_val16 *r,
|
||||
int n);
|
||||
void od_pvq_synthesis_partial(od_coeff *xcoeff, const od_coeff *ypulse,
|
||||
const od_val16 *r, int n,
|
||||
int noref, od_val32 g,
|
||||
od_val32 theta, int m, int s,
|
||||
const int16_t *qm_inv);
|
||||
od_val32 od_gain_expand(od_val32 cg, int q0, od_val16 beta);
|
||||
od_val32 od_pvq_compute_gain(const od_val16 *x, int n, int q0, od_val32 *g,
|
||||
od_val16 beta, int bshift);
|
||||
int od_pvq_compute_max_theta(od_val32 qcg, od_val16 beta);
|
||||
od_val32 od_pvq_compute_theta(int t, int max_theta);
|
||||
int od_pvq_compute_k(od_val32 qcg, int itheta, int noref, int n, od_val16 beta);
|
||||
|
||||
int od_vector_is_null(const od_coeff *x, int len);
|
||||
int od_qm_offset(int bs, int xydec);
|
||||
|
||||
#endif
|
||||
50
third_party/aom/av1/common/pvq_state.c
vendored
50
third_party/aom/av1/common/pvq_state.c
vendored
|
|
@ -1,50 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2001-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 "av1/common/pvq_state.h"
|
||||
#include "av1/common/odintrin.h"
|
||||
|
||||
void od_adapt_ctx_reset(od_adapt_ctx *adapt, int is_keyframe) {
|
||||
int pli;
|
||||
od_adapt_pvq_ctx_reset(&adapt->pvq, is_keyframe);
|
||||
OD_CDFS_INIT_Q15(adapt->skip_cdf);
|
||||
for (pli = 0; pli < OD_NPLANES_MAX; pli++) {
|
||||
int i;
|
||||
OD_CDFS_INIT_DYNAMIC(adapt->model_dc[pli].cdf);
|
||||
for (i = 0; i < OD_TXSIZES; i++) {
|
||||
int j;
|
||||
adapt->ex_g[pli][i] = 8;
|
||||
for (j = 0; j < 3; j++) {
|
||||
adapt->ex_dc[pli][i][j] = pli > 0 ? 8 : 32768;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void od_init_skipped_coeffs(int16_t *d, int16_t *pred, int is_keyframe, int bo,
|
||||
int n, int w) {
|
||||
int i;
|
||||
int j;
|
||||
if (is_keyframe) {
|
||||
for (i = 0; i < n; i++) {
|
||||
for (j = 0; j < n; j++) {
|
||||
/* skip DC */
|
||||
if (i || j) d[bo + i * w + j] = 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < n; i++) {
|
||||
for (j = 0; j < n; j++) {
|
||||
d[bo + i * w + j] = pred[i * n + j];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
52
third_party/aom/av1/common/pvq_state.h
vendored
52
third_party/aom/av1/common/pvq_state.h
vendored
|
|
@ -1,52 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2001-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.
|
||||
*/
|
||||
|
||||
/* clang-format off */
|
||||
|
||||
#if !defined(_state_H)
|
||||
# define _state_H (1)
|
||||
|
||||
typedef struct od_state od_state;
|
||||
typedef struct od_adapt_ctx od_adapt_ctx;
|
||||
|
||||
# include "generic_code.h"
|
||||
# include "odintrin.h"
|
||||
# include "pvq.h"
|
||||
|
||||
/*Adaptation speed of scalar Laplace encoding.*/
|
||||
# define OD_SCALAR_ADAPT_SPEED (4)
|
||||
|
||||
struct od_adapt_ctx {
|
||||
/* Support for PVQ encode/decode */
|
||||
od_pvq_adapt_ctx pvq;
|
||||
|
||||
generic_encoder model_dc[OD_NPLANES_MAX];
|
||||
|
||||
int ex_dc[OD_NPLANES_MAX][OD_TXSIZES][3];
|
||||
int ex_g[OD_NPLANES_MAX][OD_TXSIZES];
|
||||
|
||||
/* Joint skip flag for DC and AC */
|
||||
uint16_t skip_cdf[OD_TXSIZES*2][CDF_SIZE(4)];
|
||||
};
|
||||
|
||||
struct od_state {
|
||||
od_adapt_ctx *adapt;
|
||||
unsigned char pvq_qm_q4[OD_NPLANES_MAX][OD_QM_SIZE];
|
||||
/* Quantization matrices and their inverses. */
|
||||
int16_t qm[OD_QM_BUFFER_SIZE];
|
||||
int16_t qm_inv[OD_QM_BUFFER_SIZE];
|
||||
};
|
||||
|
||||
void od_adapt_ctx_reset(od_adapt_ctx *state, int is_keyframe);
|
||||
void od_init_skipped_coeffs(int16_t *d, int16_t *pred, int is_keyframe,
|
||||
int bo, int n, int w);
|
||||
|
||||
#endif
|
||||
585
third_party/aom/av1/common/quant_common.c
vendored
585
third_party/aom/av1/common/quant_common.c
vendored
File diff suppressed because it is too large
Load diff
71
third_party/aom/av1/common/quant_common.h
vendored
71
third_party/aom/av1/common/quant_common.h
vendored
|
|
@ -25,82 +25,37 @@ extern "C" {
|
|||
#define MAXQ 255
|
||||
#define QINDEX_RANGE (MAXQ - MINQ + 1)
|
||||
#define QINDEX_BITS 8
|
||||
#if CONFIG_AOM_QM
|
||||
// Total number of QM sets stored
|
||||
#define QM_LEVEL_BITS 4
|
||||
#define NUM_QM_LEVELS (1 << QM_LEVEL_BITS)
|
||||
/* Range of QMS is between first and last value, with offset applied to inter
|
||||
* blocks*/
|
||||
#define DEFAULT_QM_Y 10
|
||||
#define DEFAULT_QM_U 11
|
||||
#define DEFAULT_QM_V 12
|
||||
#define DEFAULT_QM_FIRST 5
|
||||
#define DEFAULT_QM_LAST 9
|
||||
#define DEFAULT_QM_INTER_OFFSET 0
|
||||
#endif
|
||||
|
||||
struct AV1Common;
|
||||
|
||||
int16_t av1_dc_quant(int qindex, int delta, aom_bit_depth_t bit_depth);
|
||||
int16_t av1_ac_quant(int qindex, int delta, aom_bit_depth_t bit_depth);
|
||||
int16_t av1_qindex_from_ac(int ac, aom_bit_depth_t bit_depth);
|
||||
int16_t av1_dc_quant_Q3(int qindex, int delta, aom_bit_depth_t bit_depth);
|
||||
int16_t av1_ac_quant_Q3(int qindex, int delta, aom_bit_depth_t bit_depth);
|
||||
int16_t av1_dc_quant_QTX(int qindex, int delta, aom_bit_depth_t bit_depth);
|
||||
int16_t av1_ac_quant_QTX(int qindex, int delta, aom_bit_depth_t bit_depth);
|
||||
int16_t av1_qindex_from_ac_Q3(int ac_Q3, aom_bit_depth_t bit_depth);
|
||||
|
||||
int av1_get_qindex(const struct segmentation *seg, int segment_id,
|
||||
int base_qindex);
|
||||
#if CONFIG_AOM_QM
|
||||
// Reduce the large number of quantizers to a smaller number of levels for which
|
||||
// different matrices may be defined
|
||||
static INLINE int aom_get_qmlevel(int qindex, int first, int last) {
|
||||
return first + (qindex * (last + 1 - first)) / QINDEX_RANGE;
|
||||
}
|
||||
void aom_qm_init(struct AV1Common *cm);
|
||||
qm_val_t *aom_iqmatrix(struct AV1Common *cm, int qindex, int comp,
|
||||
TX_SIZE tx_size, int is_intra);
|
||||
qm_val_t *aom_qmatrix(struct AV1Common *cm, int qindex, int comp,
|
||||
TX_SIZE tx_size, int is_intra);
|
||||
#endif
|
||||
|
||||
#if CONFIG_NEW_QUANT
|
||||
|
||||
#define QUANT_PROFILES 4
|
||||
#define QUANT_RANGES 2
|
||||
#define NUQ_KNOTS 3
|
||||
|
||||
typedef tran_low_t dequant_val_type_nuq[NUQ_KNOTS + 1];
|
||||
typedef tran_low_t cuml_bins_type_nuq[NUQ_KNOTS];
|
||||
void av1_get_dequant_val_nuq(int q, int band, tran_low_t *dq,
|
||||
tran_low_t *cuml_bins, int dq_off_index);
|
||||
tran_low_t av1_dequant_abscoeff_nuq(int v, int q, const tran_low_t *dq);
|
||||
tran_low_t av1_dequant_coeff_nuq(int v, int q, const tran_low_t *dq);
|
||||
|
||||
static INLINE int qindex_to_qrange(int qindex) {
|
||||
return (qindex < 140 ? 1 : 0);
|
||||
}
|
||||
|
||||
static INLINE int get_dq_profile_from_ctx(int qindex, int q_ctx, int is_inter,
|
||||
PLANE_TYPE plane_type) {
|
||||
// intra/inter, Y/UV, ctx, qrange
|
||||
static const int
|
||||
def_dq_profile_lookup[REF_TYPES][PLANE_TYPES][COEFF_CONTEXTS0]
|
||||
[QUANT_RANGES] = {
|
||||
{
|
||||
// intra
|
||||
{ { 2, 1 }, { 2, 1 }, { 2, 1 } }, // Y
|
||||
{ { 3, 1 }, { 3, 1 }, { 3, 1 } }, // UV
|
||||
},
|
||||
{
|
||||
// inter
|
||||
{ { 3, 1 }, { 2, 1 }, { 2, 1 } }, // Y
|
||||
{ { 3, 1 }, { 3, 1 }, { 3, 1 } }, // UV
|
||||
},
|
||||
};
|
||||
if (!qindex) return 0; // lossless
|
||||
return def_dq_profile_lookup[is_inter][plane_type][q_ctx]
|
||||
[qindex_to_qrange(qindex)];
|
||||
}
|
||||
#endif // CONFIG_NEW_QUANT
|
||||
|
||||
#if CONFIG_PVQ
|
||||
extern const int OD_QM8_Q4_FLAT[];
|
||||
extern const int OD_QM8_Q4_HVS[];
|
||||
#endif
|
||||
void av1_qm_init(struct AV1Common *cm);
|
||||
const qm_val_t *av1_iqmatrix(struct AV1Common *cm, int qindex, int comp,
|
||||
TX_SIZE tx_size);
|
||||
const qm_val_t *av1_qmatrix(struct AV1Common *cm, int qindex, int comp,
|
||||
TX_SIZE tx_size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
|
|
|
|||
3959
third_party/aom/av1/common/reconinter.c
vendored
3959
third_party/aom/av1/common/reconinter.c
vendored
File diff suppressed because it is too large
Load diff
561
third_party/aom/av1/common/reconinter.h
vendored
561
third_party/aom/av1/common/reconinter.h
vendored
|
|
@ -15,164 +15,26 @@
|
|||
#include "av1/common/filter.h"
|
||||
#include "av1/common/onyxc_int.h"
|
||||
#include "av1/common/convolve.h"
|
||||
#if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
|
||||
#include "av1/common/warped_motion.h"
|
||||
#endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
|
||||
#include "aom/aom_integer.h"
|
||||
|
||||
#if CONFIG_MOTION_VAR && CONFIG_WARPED_MOTION
|
||||
#define WARP_WM_NEIGHBORS_WITH_OBMC 0
|
||||
#endif // CONFIG_MOTION_VAR && CONFIG_WARPED_MOTION
|
||||
|
||||
#if CONFIG_MOTION_VAR && CONFIG_GLOBAL_MOTION
|
||||
#define WARP_GM_NEIGHBORS_WITH_OBMC 0
|
||||
#endif // CONFIG_MOTION_VAR && CONFIG_WARPED_MOTION
|
||||
// Work out how many pixels off the edge of a reference frame we're allowed
|
||||
// to go when forming an inter prediction.
|
||||
// The outermost row/col of each referernce frame is extended by
|
||||
// (AOM_BORDER_IN_PIXELS >> subsampling) pixels, but we need to keep
|
||||
// at least AOM_INTERP_EXTEND pixels within that to account for filtering.
|
||||
//
|
||||
// We have to break this up into two macros to keep both clang-format and
|
||||
// tools/lint-hunks.py happy.
|
||||
#define AOM_LEFT_TOP_MARGIN_PX(subsampling) \
|
||||
((AOM_BORDER_IN_PIXELS >> subsampling) - AOM_INTERP_EXTEND)
|
||||
#define AOM_LEFT_TOP_MARGIN_SCALED(subsampling) \
|
||||
(AOM_LEFT_TOP_MARGIN_PX(subsampling) << SCALE_SUBPEL_BITS)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
static INLINE int has_scale(int xs, int ys) {
|
||||
return xs != SCALE_SUBPEL_SHIFTS || ys != SCALE_SUBPEL_SHIFTS;
|
||||
}
|
||||
|
||||
static INLINE void inter_predictor(const uint8_t *src, int src_stride,
|
||||
uint8_t *dst, int dst_stride, int subpel_x,
|
||||
int subpel_y, const struct scale_factors *sf,
|
||||
int w, int h, ConvolveParams *conv_params,
|
||||
InterpFilters interp_filters, int xs,
|
||||
int ys) {
|
||||
assert(conv_params->do_average == 0 || conv_params->do_average == 1);
|
||||
assert(sf);
|
||||
if (has_scale(xs, ys)) {
|
||||
// TODO(afergs, debargha): Use a different scale convolve function
|
||||
// that uses higher precision for subpel_x, subpel_y, xs, ys
|
||||
if (conv_params->round == CONVOLVE_OPT_NO_ROUND) {
|
||||
#if CONFIG_CONVOLVE_ROUND
|
||||
av1_convolve_2d_facade(src, src_stride, dst, dst_stride, w, h,
|
||||
interp_filters, subpel_x, xs, subpel_y, ys, 1,
|
||||
conv_params);
|
||||
conv_params->do_post_rounding = 1;
|
||||
#else
|
||||
assert(0);
|
||||
#endif // CONFIG_CONVOLVE_ROUND
|
||||
} else {
|
||||
assert(conv_params->round == CONVOLVE_OPT_ROUND);
|
||||
av1_convolve_scale(src, src_stride, dst, dst_stride, w, h, interp_filters,
|
||||
subpel_x, xs, subpel_y, ys, conv_params);
|
||||
}
|
||||
} else {
|
||||
subpel_x >>= SCALE_EXTRA_BITS;
|
||||
subpel_y >>= SCALE_EXTRA_BITS;
|
||||
xs >>= SCALE_EXTRA_BITS;
|
||||
ys >>= SCALE_EXTRA_BITS;
|
||||
assert(subpel_x < SUBPEL_SHIFTS);
|
||||
assert(subpel_y < SUBPEL_SHIFTS);
|
||||
assert(xs <= SUBPEL_SHIFTS);
|
||||
assert(ys <= SUBPEL_SHIFTS);
|
||||
if (conv_params->round == CONVOLVE_OPT_NO_ROUND) {
|
||||
#if CONFIG_CONVOLVE_ROUND
|
||||
av1_convolve_2d_facade(src, src_stride, dst, dst_stride, w, h,
|
||||
interp_filters, subpel_x, xs, subpel_y, ys, 0,
|
||||
conv_params);
|
||||
conv_params->do_post_rounding = 1;
|
||||
#else
|
||||
assert(0);
|
||||
#endif // CONFIG_CONVOLVE_ROUND
|
||||
} else {
|
||||
assert(conv_params->round == CONVOLVE_OPT_ROUND);
|
||||
|
||||
InterpFilterParams filter_params_x, filter_params_y;
|
||||
av1_get_convolve_filter_params(interp_filters, 0, &filter_params_x,
|
||||
&filter_params_y);
|
||||
|
||||
if (w <= 2 || h <= 2) {
|
||||
av1_convolve_c(src, src_stride, dst, dst_stride, w, h, interp_filters,
|
||||
subpel_x, xs, subpel_y, ys, conv_params);
|
||||
} else if (filter_params_x.taps == SUBPEL_TAPS &&
|
||||
filter_params_y.taps == SUBPEL_TAPS) {
|
||||
const int16_t *kernel_x =
|
||||
av1_get_interp_filter_subpel_kernel(filter_params_x, subpel_x);
|
||||
const int16_t *kernel_y =
|
||||
av1_get_interp_filter_subpel_kernel(filter_params_y, subpel_y);
|
||||
sf->predict[subpel_x != 0][subpel_y != 0][conv_params->do_average](
|
||||
src, src_stride, dst, dst_stride, kernel_x, xs, kernel_y, ys, w, h);
|
||||
} else {
|
||||
av1_convolve(src, src_stride, dst, dst_stride, w, h, interp_filters,
|
||||
subpel_x, xs, subpel_y, ys, conv_params);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
static INLINE void highbd_inter_predictor(const uint8_t *src, int src_stride,
|
||||
uint8_t *dst, int dst_stride,
|
||||
int subpel_x, int subpel_y,
|
||||
const struct scale_factors *sf, int w,
|
||||
int h, ConvolveParams *conv_params,
|
||||
InterpFilters interp_filters, int xs,
|
||||
int ys, int bd) {
|
||||
const int avg = conv_params->do_average;
|
||||
assert(avg == 0 || avg == 1);
|
||||
|
||||
if (has_scale(xs, ys)) {
|
||||
if (conv_params->round == CONVOLVE_OPT_NO_ROUND) {
|
||||
#if CONFIG_CONVOLVE_ROUND
|
||||
av1_highbd_convolve_2d_facade(src, src_stride, dst, dst_stride, w, h,
|
||||
interp_filters, subpel_x, xs, subpel_y, ys,
|
||||
1, conv_params, bd);
|
||||
conv_params->do_post_rounding = 1;
|
||||
#else
|
||||
assert(0);
|
||||
#endif // CONFIG_CONVOLVE_ROUND
|
||||
} else {
|
||||
av1_highbd_convolve_scale(src, src_stride, dst, dst_stride, w, h,
|
||||
interp_filters, subpel_x, xs, subpel_y, ys, avg,
|
||||
bd);
|
||||
}
|
||||
} else {
|
||||
subpel_x >>= SCALE_EXTRA_BITS;
|
||||
subpel_y >>= SCALE_EXTRA_BITS;
|
||||
xs >>= SCALE_EXTRA_BITS;
|
||||
ys >>= SCALE_EXTRA_BITS;
|
||||
assert(subpel_x < SUBPEL_SHIFTS);
|
||||
assert(subpel_y < SUBPEL_SHIFTS);
|
||||
assert(xs <= SUBPEL_SHIFTS);
|
||||
assert(ys <= SUBPEL_SHIFTS);
|
||||
if (conv_params->round == CONVOLVE_OPT_NO_ROUND) {
|
||||
#if CONFIG_CONVOLVE_ROUND
|
||||
av1_highbd_convolve_2d_facade(src, src_stride, dst, dst_stride, w, h,
|
||||
interp_filters, subpel_x, xs, subpel_y, ys,
|
||||
0, conv_params, bd);
|
||||
conv_params->do_post_rounding = 1;
|
||||
#else
|
||||
assert(0);
|
||||
#endif // CONFIG_CONVOLVE_ROUND
|
||||
} else {
|
||||
InterpFilterParams filter_params_x, filter_params_y;
|
||||
av1_get_convolve_filter_params(interp_filters, 0, &filter_params_x,
|
||||
&filter_params_y);
|
||||
|
||||
if (filter_params_x.taps == SUBPEL_TAPS &&
|
||||
filter_params_y.taps == SUBPEL_TAPS && w > 2 && h > 2) {
|
||||
const int16_t *kernel_x =
|
||||
av1_get_interp_filter_subpel_kernel(filter_params_x, subpel_x);
|
||||
const int16_t *kernel_y =
|
||||
av1_get_interp_filter_subpel_kernel(filter_params_y, subpel_y);
|
||||
sf->highbd_predict[subpel_x != 0][subpel_y != 0][avg](
|
||||
src, src_stride, dst, dst_stride, kernel_x, xs, kernel_y, ys, w, h,
|
||||
bd);
|
||||
} else {
|
||||
av1_highbd_convolve(src, src_stride, dst, dst_stride, w, h,
|
||||
interp_filters, subpel_x, xs, subpel_y, ys, avg,
|
||||
bd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
|
||||
// Set to (1 << 5) if the 32-ary codebooks are used for any bock size
|
||||
#define MAX_WEDGE_TYPES (1 << 4)
|
||||
|
||||
|
|
@ -208,38 +70,108 @@ typedef struct {
|
|||
int bits;
|
||||
const wedge_code_type *codebook;
|
||||
uint8_t *signflip;
|
||||
int smoother;
|
||||
wedge_masks_type *masks;
|
||||
} wedge_params_type;
|
||||
|
||||
extern const wedge_params_type wedge_params_lookup[BLOCK_SIZES_ALL];
|
||||
|
||||
typedef struct SubpelParams {
|
||||
int xs;
|
||||
int ys;
|
||||
int subpel_x;
|
||||
int subpel_y;
|
||||
} SubpelParams;
|
||||
|
||||
struct build_prediction_ctxt {
|
||||
const AV1_COMMON *cm;
|
||||
int mi_row;
|
||||
int mi_col;
|
||||
uint8_t **tmp_buf;
|
||||
int *tmp_width;
|
||||
int *tmp_height;
|
||||
int *tmp_stride;
|
||||
int mb_to_far_edge;
|
||||
};
|
||||
|
||||
static INLINE int has_scale(int xs, int ys) {
|
||||
return xs != SCALE_SUBPEL_SHIFTS || ys != SCALE_SUBPEL_SHIFTS;
|
||||
}
|
||||
|
||||
static INLINE void revert_scale_extra_bits(SubpelParams *sp) {
|
||||
sp->subpel_x >>= SCALE_EXTRA_BITS;
|
||||
sp->subpel_y >>= SCALE_EXTRA_BITS;
|
||||
sp->xs >>= SCALE_EXTRA_BITS;
|
||||
sp->ys >>= SCALE_EXTRA_BITS;
|
||||
assert(sp->subpel_x < SUBPEL_SHIFTS);
|
||||
assert(sp->subpel_y < SUBPEL_SHIFTS);
|
||||
assert(sp->xs <= SUBPEL_SHIFTS);
|
||||
assert(sp->ys <= SUBPEL_SHIFTS);
|
||||
}
|
||||
|
||||
static INLINE void inter_predictor(const uint8_t *src, int src_stride,
|
||||
uint8_t *dst, int dst_stride,
|
||||
const SubpelParams *subpel_params,
|
||||
const struct scale_factors *sf, int w, int h,
|
||||
ConvolveParams *conv_params,
|
||||
InterpFilters interp_filters) {
|
||||
assert(conv_params->do_average == 0 || conv_params->do_average == 1);
|
||||
assert(sf);
|
||||
if (has_scale(subpel_params->xs, subpel_params->ys)) {
|
||||
av1_convolve_2d_facade(src, src_stride, dst, dst_stride, w, h,
|
||||
interp_filters, subpel_params->subpel_x,
|
||||
subpel_params->xs, subpel_params->subpel_y,
|
||||
subpel_params->ys, 1, conv_params, sf);
|
||||
} else {
|
||||
SubpelParams sp = *subpel_params;
|
||||
revert_scale_extra_bits(&sp);
|
||||
av1_convolve_2d_facade(src, src_stride, dst, dst_stride, w, h,
|
||||
interp_filters, sp.subpel_x, sp.xs, sp.subpel_y,
|
||||
sp.ys, 0, conv_params, sf);
|
||||
}
|
||||
}
|
||||
|
||||
static INLINE void highbd_inter_predictor(
|
||||
const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride,
|
||||
const SubpelParams *subpel_params, const struct scale_factors *sf, int w,
|
||||
int h, ConvolveParams *conv_params, InterpFilters interp_filters, int bd) {
|
||||
assert(conv_params->do_average == 0 || conv_params->do_average == 1);
|
||||
assert(sf);
|
||||
if (has_scale(subpel_params->xs, subpel_params->ys)) {
|
||||
av1_highbd_convolve_2d_facade(src, src_stride, dst, dst_stride, w, h,
|
||||
interp_filters, subpel_params->subpel_x,
|
||||
subpel_params->xs, subpel_params->subpel_y,
|
||||
subpel_params->ys, 1, conv_params, sf, bd);
|
||||
} else {
|
||||
SubpelParams sp = *subpel_params;
|
||||
revert_scale_extra_bits(&sp);
|
||||
av1_highbd_convolve_2d_facade(src, src_stride, dst, dst_stride, w, h,
|
||||
interp_filters, sp.subpel_x, sp.xs,
|
||||
sp.subpel_y, sp.ys, 0, conv_params, sf, bd);
|
||||
}
|
||||
}
|
||||
|
||||
void av1_modify_neighbor_predictor_for_obmc(MB_MODE_INFO *mbmi);
|
||||
int av1_skip_u4x4_pred_in_obmc(BLOCK_SIZE bsize,
|
||||
const struct macroblockd_plane *pd, int dir);
|
||||
|
||||
static INLINE int is_interinter_compound_used(COMPOUND_TYPE type,
|
||||
BLOCK_SIZE sb_type) {
|
||||
(void)sb_type;
|
||||
const int comp_allowed = is_comp_ref_allowed(sb_type);
|
||||
switch (type) {
|
||||
#if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8
|
||||
case COMPOUND_AVERAGE: return sb_type >= BLOCK_4X4;
|
||||
#else // CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8
|
||||
case COMPOUND_AVERAGE: return 1;
|
||||
#endif // CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8
|
||||
#if CONFIG_WEDGE
|
||||
case COMPOUND_WEDGE: return wedge_params_lookup[sb_type].bits > 0;
|
||||
#endif // CONFIG_WEDGE
|
||||
#if CONFIG_COMPOUND_SEGMENT
|
||||
case COMPOUND_SEG:
|
||||
return AOMMIN(block_size_wide[sb_type], block_size_high[sb_type]) >= 8;
|
||||
#endif // CONFIG_COMPOUND_SEGMENT
|
||||
case COMPOUND_AVERAGE:
|
||||
case COMPOUND_DIFFWTD: return comp_allowed;
|
||||
case COMPOUND_WEDGE:
|
||||
return comp_allowed && wedge_params_lookup[sb_type].bits > 0;
|
||||
default: assert(0); return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static INLINE int is_any_masked_compound_used(BLOCK_SIZE sb_type) {
|
||||
COMPOUND_TYPE comp_type;
|
||||
#if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8
|
||||
if (sb_type < BLOCK_4X4) return 0;
|
||||
#endif // CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8
|
||||
for (comp_type = 0; comp_type < COMPOUND_TYPES; comp_type++) {
|
||||
int i;
|
||||
if (!is_comp_ref_allowed(sb_type)) return 0;
|
||||
for (i = 0; i < COMPOUND_TYPES; i++) {
|
||||
comp_type = (COMPOUND_TYPE)i;
|
||||
if (is_masked_compound_type(comp_type) &&
|
||||
is_interinter_compound_used(comp_type, sb_type))
|
||||
return 1;
|
||||
|
|
@ -257,7 +189,6 @@ static INLINE int get_interinter_wedge_bits(BLOCK_SIZE sb_type) {
|
|||
}
|
||||
|
||||
static INLINE int is_interintra_wedge_used(BLOCK_SIZE sb_type) {
|
||||
(void)sb_type;
|
||||
return wedge_params_lookup[sb_type].bits > 0;
|
||||
}
|
||||
|
||||
|
|
@ -265,60 +196,22 @@ static INLINE int get_interintra_wedge_bits(BLOCK_SIZE sb_type) {
|
|||
return wedge_params_lookup[sb_type].bits;
|
||||
}
|
||||
|
||||
#if CONFIG_COMPOUND_SEGMENT
|
||||
void build_compound_seg_mask(uint8_t *mask, SEG_MASK_TYPE mask_type,
|
||||
const uint8_t *src0, int src0_stride,
|
||||
const uint8_t *src1, int src1_stride,
|
||||
BLOCK_SIZE sb_type, int h, int w);
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
void build_compound_seg_mask_highbd(uint8_t *mask, SEG_MASK_TYPE mask_type,
|
||||
const uint8_t *src0, int src0_stride,
|
||||
const uint8_t *src1, int src1_stride,
|
||||
BLOCK_SIZE sb_type, int h, int w, int bd);
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
#endif // CONFIG_COMPOUND_SEGMENT
|
||||
void av1_make_inter_predictor(const uint8_t *src, int src_stride, uint8_t *dst,
|
||||
int dst_stride, const SubpelParams *subpel_params,
|
||||
const struct scale_factors *sf, int w, int h,
|
||||
ConvolveParams *conv_params,
|
||||
InterpFilters interp_filters,
|
||||
const WarpTypesAllowed *warp_types, int p_col,
|
||||
int p_row, int plane, int ref,
|
||||
const MB_MODE_INFO *mi, int build_for_obmc,
|
||||
const MACROBLOCKD *xd, int can_use_previous);
|
||||
|
||||
void av1_make_masked_inter_predictor(
|
||||
const uint8_t *pre, int pre_stride, uint8_t *dst, int dst_stride,
|
||||
const int subpel_x, const int subpel_y, const struct scale_factors *sf,
|
||||
int w, int h, ConvolveParams *conv_params, InterpFilters interp_filters,
|
||||
int xs, int ys,
|
||||
#if CONFIG_SUPERTX
|
||||
int wedge_offset_x, int wedge_offset_y,
|
||||
#endif // CONFIG_SUPERTX
|
||||
int plane,
|
||||
#if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
|
||||
const SubpelParams *subpel_params, const struct scale_factors *sf, int w,
|
||||
int h, ConvolveParams *conv_params, InterpFilters interp_filters, int plane,
|
||||
const WarpTypesAllowed *warp_types, int p_col, int p_row, int ref,
|
||||
#endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
|
||||
MACROBLOCKD *xd);
|
||||
|
||||
static INLINE int round_mv_comp_q4(int value) {
|
||||
return (value < 0 ? value - 2 : value + 2) / 4;
|
||||
}
|
||||
|
||||
static MV mi_mv_pred_q4(const MODE_INFO *mi, int idx) {
|
||||
MV res = {
|
||||
round_mv_comp_q4(
|
||||
mi->bmi[0].as_mv[idx].as_mv.row + mi->bmi[1].as_mv[idx].as_mv.row +
|
||||
mi->bmi[2].as_mv[idx].as_mv.row + mi->bmi[3].as_mv[idx].as_mv.row),
|
||||
round_mv_comp_q4(
|
||||
mi->bmi[0].as_mv[idx].as_mv.col + mi->bmi[1].as_mv[idx].as_mv.col +
|
||||
mi->bmi[2].as_mv[idx].as_mv.col + mi->bmi[3].as_mv[idx].as_mv.col)
|
||||
};
|
||||
return res;
|
||||
}
|
||||
|
||||
static INLINE int round_mv_comp_q2(int value) {
|
||||
return (value < 0 ? value - 1 : value + 1) / 2;
|
||||
}
|
||||
|
||||
static MV mi_mv_pred_q2(const MODE_INFO *mi, int idx, int block0, int block1) {
|
||||
MV res = { round_mv_comp_q2(mi->bmi[block0].as_mv[idx].as_mv.row +
|
||||
mi->bmi[block1].as_mv[idx].as_mv.row),
|
||||
round_mv_comp_q2(mi->bmi[block0].as_mv[idx].as_mv.col +
|
||||
mi->bmi[block1].as_mv[idx].as_mv.col) };
|
||||
return res;
|
||||
}
|
||||
MACROBLOCKD *xd, int can_use_previous);
|
||||
|
||||
// TODO(jkoleszar): yet another mv clamping function :-(
|
||||
static INLINE MV clamp_mv_to_umv_border_sb(const MACROBLOCKD *xd,
|
||||
|
|
@ -331,8 +224,8 @@ static INLINE MV clamp_mv_to_umv_border_sb(const MACROBLOCKD *xd,
|
|||
const int spel_right = spel_left - SUBPEL_SHIFTS;
|
||||
const int spel_top = (AOM_INTERP_EXTEND + bh) << SUBPEL_BITS;
|
||||
const int spel_bottom = spel_top - SUBPEL_SHIFTS;
|
||||
MV clamped_mv = { src_mv->row * (1 << (1 - ss_y)),
|
||||
src_mv->col * (1 << (1 - ss_x)) };
|
||||
MV clamped_mv = { (int16_t)(src_mv->row * (1 << (1 - ss_y))),
|
||||
(int16_t)(src_mv->col * (1 << (1 - ss_x))) };
|
||||
assert(ss_x <= 1);
|
||||
assert(ss_y <= 1);
|
||||
|
||||
|
|
@ -344,20 +237,6 @@ static INLINE MV clamp_mv_to_umv_border_sb(const MACROBLOCKD *xd,
|
|||
return clamped_mv;
|
||||
}
|
||||
|
||||
static INLINE MV average_split_mvs(const struct macroblockd_plane *pd,
|
||||
const MODE_INFO *mi, int ref, int block) {
|
||||
const int ss_idx = ((pd->subsampling_x > 0) << 1) | (pd->subsampling_y > 0);
|
||||
MV res = { 0, 0 };
|
||||
switch (ss_idx) {
|
||||
case 0: res = mi->bmi[block].as_mv[ref].as_mv; break;
|
||||
case 1: res = mi_mv_pred_q2(mi, ref, block, block + 2); break;
|
||||
case 2: res = mi_mv_pred_q2(mi, ref, block, block + 1); break;
|
||||
case 3: res = mi_mv_pred_q4(mi, ref); break;
|
||||
default: assert(ss_idx <= 3 && ss_idx >= 0);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
void av1_build_inter_predictors_sby(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
||||
int mi_row, int mi_col, BUFFER_SET *ctx,
|
||||
BLOCK_SIZE bsize);
|
||||
|
|
@ -370,48 +249,22 @@ void av1_build_inter_predictors_sb(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
|||
int mi_row, int mi_col, BUFFER_SET *ctx,
|
||||
BLOCK_SIZE bsize);
|
||||
|
||||
#if CONFIG_SUPERTX
|
||||
void av1_build_inter_predictor_sb_sub8x8_extend(const AV1_COMMON *cm,
|
||||
MACROBLOCKD *xd, int mi_row_ori,
|
||||
int mi_col_ori, int mi_row,
|
||||
int mi_col, int plane,
|
||||
BLOCK_SIZE bsize, int block);
|
||||
|
||||
void av1_build_inter_predictor_sb_extend(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
||||
int mi_row_ori, int mi_col_ori,
|
||||
int mi_row, int mi_col, int plane,
|
||||
BLOCK_SIZE bsize);
|
||||
struct macroblockd_plane;
|
||||
void av1_build_masked_inter_predictor_complex(
|
||||
MACROBLOCKD *xd, uint8_t *dst, int dst_stride, const uint8_t *pre,
|
||||
int pre_stride, int mi_row, int mi_col, int mi_row_ori, int mi_col_ori,
|
||||
BLOCK_SIZE bsize, BLOCK_SIZE top_bsize, PARTITION_TYPE partition,
|
||||
int plane);
|
||||
#endif // CONFIG_SUPERTX
|
||||
|
||||
void av1_build_inter_predictor(const uint8_t *src, int src_stride, uint8_t *dst,
|
||||
int dst_stride, const MV *src_mv,
|
||||
const struct scale_factors *sf, int w, int h,
|
||||
ConvolveParams *conv_params,
|
||||
InterpFilters interp_filters,
|
||||
#if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
|
||||
const WarpTypesAllowed *warp_types, int p_col,
|
||||
int p_row, int plane, int ref,
|
||||
#endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
|
||||
enum mv_precision precision, int x, int y,
|
||||
const MACROBLOCKD *xd);
|
||||
const MACROBLOCKD *xd, int can_use_previous);
|
||||
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
void av1_highbd_build_inter_predictor(
|
||||
const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride,
|
||||
const MV *mv_q3, const struct scale_factors *sf, int w, int h, int do_avg,
|
||||
InterpFilters interp_filters,
|
||||
#if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
|
||||
const WarpTypesAllowed *warp_types, int p_col, int p_row,
|
||||
#endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
|
||||
int plane, enum mv_precision precision, int x, int y,
|
||||
const MACROBLOCKD *xd);
|
||||
#endif
|
||||
InterpFilters interp_filters, const WarpTypesAllowed *warp_types, int p_col,
|
||||
int p_row, int plane, enum mv_precision precision, int x, int y,
|
||||
const MACROBLOCKD *xd, int can_use_previous);
|
||||
|
||||
static INLINE int scaled_buffer_offset(int x_offset, int y_offset, int stride,
|
||||
const struct scale_factors *sf) {
|
||||
|
|
@ -427,15 +280,11 @@ static INLINE void setup_pred_plane(struct buf_2d *dst, BLOCK_SIZE bsize,
|
|||
int stride, int mi_row, int mi_col,
|
||||
const struct scale_factors *scale,
|
||||
int subsampling_x, int subsampling_y) {
|
||||
#if CONFIG_CHROMA_SUB8X8
|
||||
// Offset the buffer pointer
|
||||
if (subsampling_y && (mi_row & 0x01) && (mi_size_high[bsize] == 1))
|
||||
mi_row -= 1;
|
||||
if (subsampling_x && (mi_col & 0x01) && (mi_size_wide[bsize] == 1))
|
||||
mi_col -= 1;
|
||||
#else
|
||||
(void)bsize;
|
||||
#endif
|
||||
|
||||
const int x = (MI_SIZE * mi_col) >> subsampling_x;
|
||||
const int y = (MI_SIZE * mi_row) >> subsampling_y;
|
||||
|
|
@ -447,62 +296,33 @@ static INLINE void setup_pred_plane(struct buf_2d *dst, BLOCK_SIZE bsize,
|
|||
}
|
||||
|
||||
void av1_setup_dst_planes(struct macroblockd_plane *planes, BLOCK_SIZE bsize,
|
||||
const YV12_BUFFER_CONFIG *src, int mi_row,
|
||||
int mi_col);
|
||||
const YV12_BUFFER_CONFIG *src, int mi_row, int mi_col,
|
||||
const int plane_start, const int plane_end);
|
||||
|
||||
void av1_setup_pre_planes(MACROBLOCKD *xd, int idx,
|
||||
const YV12_BUFFER_CONFIG *src, int mi_row, int mi_col,
|
||||
const struct scale_factors *sf);
|
||||
const struct scale_factors *sf, const int num_planes);
|
||||
|
||||
// Detect if the block have sub-pixel level motion vectors
|
||||
// per component.
|
||||
#define CHECK_SUBPEL 0
|
||||
static INLINE int has_subpel_mv_component(const MODE_INFO *const mi,
|
||||
static INLINE int has_subpel_mv_component(const MB_MODE_INFO *const mbmi,
|
||||
const MACROBLOCKD *const xd,
|
||||
int dir) {
|
||||
#if CHECK_SUBPEL
|
||||
const MB_MODE_INFO *const mbmi = &mi->mbmi;
|
||||
const BLOCK_SIZE bsize = mbmi->sb_type;
|
||||
int plane;
|
||||
int ref = (dir >> 1);
|
||||
#if CONFIG_CB4X4
|
||||
const int unify_bsize = 1;
|
||||
#else
|
||||
const int unify_bsize = 0;
|
||||
#endif
|
||||
|
||||
if (bsize >= BLOCK_8X8 || unify_bsize) {
|
||||
if (dir & 0x01) {
|
||||
if (mbmi->mv[ref].as_mv.col & SUBPEL_MASK) return 1;
|
||||
} else {
|
||||
if (mbmi->mv[ref].as_mv.row & SUBPEL_MASK) return 1;
|
||||
}
|
||||
if (dir & 0x01) {
|
||||
if (mbmi->mv[ref].as_mv.col & SUBPEL_MASK) return 1;
|
||||
} else {
|
||||
for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
|
||||
const PARTITION_TYPE bp = BLOCK_8X8 - bsize;
|
||||
const struct macroblockd_plane *const pd = &xd->plane[plane];
|
||||
const int have_vsplit = bp != PARTITION_HORZ;
|
||||
const int have_hsplit = bp != PARTITION_VERT;
|
||||
const int num_4x4_w = 2 >> ((!have_vsplit) | pd->subsampling_x);
|
||||
const int num_4x4_h = 2 >> ((!have_hsplit) | pd->subsampling_y);
|
||||
|
||||
int x, y;
|
||||
for (y = 0; y < num_4x4_h; ++y) {
|
||||
for (x = 0; x < num_4x4_w; ++x) {
|
||||
const MV mv = average_split_mvs(pd, mi, ref, y * 2 + x);
|
||||
if (dir & 0x01) {
|
||||
if (mv.col & SUBPEL_MASK) return 1;
|
||||
} else {
|
||||
if (mv.row & SUBPEL_MASK) return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (mbmi->mv[ref].as_mv.row & SUBPEL_MASK) return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
#else
|
||||
(void)mi;
|
||||
(void)mbmi;
|
||||
(void)xd;
|
||||
(void)dir;
|
||||
return 1;
|
||||
|
|
@ -516,20 +336,16 @@ static INLINE void set_default_interp_filters(
|
|||
}
|
||||
|
||||
static INLINE int av1_is_interp_needed(const MACROBLOCKD *const xd) {
|
||||
(void)xd;
|
||||
#if CONFIG_WARPED_MOTION
|
||||
const MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
|
||||
const MB_MODE_INFO *const mbmi = xd->mi[0];
|
||||
if (mbmi->skip_mode) return 0;
|
||||
if (mbmi->motion_mode == WARPED_CAUSAL) return 0;
|
||||
#endif // CONFIG_WARPED_MOTION
|
||||
#if CONFIG_GLOBAL_MOTION
|
||||
if (is_nontrans_global_motion(xd)) return 0;
|
||||
#endif // CONFIG_GLOBAL_MOTION
|
||||
if (is_nontrans_global_motion(xd, xd->mi[0])) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static INLINE int av1_is_interp_search_needed(const MACROBLOCKD *const xd) {
|
||||
MODE_INFO *const mi = xd->mi[0];
|
||||
const int is_compound = has_second_ref(&mi->mbmi);
|
||||
MB_MODE_INFO *const mi = xd->mi[0];
|
||||
const int is_compound = has_second_ref(mi);
|
||||
int ref;
|
||||
for (ref = 0; ref < 1 + is_compound; ++ref) {
|
||||
int row_col;
|
||||
|
|
@ -542,17 +358,15 @@ static INLINE int av1_is_interp_search_needed(const MACROBLOCKD *const xd) {
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if CONFIG_MOTION_VAR
|
||||
const uint8_t *av1_get_obmc_mask(int length);
|
||||
void av1_count_overlappable_neighbors(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
||||
int mi_row, int mi_col);
|
||||
void av1_build_obmc_inter_prediction(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
||||
int mi_row, int mi_col,
|
||||
uint8_t *above[MAX_MB_PLANE],
|
||||
int above_stride[MAX_MB_PLANE],
|
||||
uint8_t *left[MAX_MB_PLANE],
|
||||
int left_stride[MAX_MB_PLANE]);
|
||||
void av1_setup_build_prediction_by_above_pred(
|
||||
MACROBLOCKD *xd, int rel_mi_col, uint8_t above_mi_width,
|
||||
MB_MODE_INFO *above_mbmi, struct build_prediction_ctxt *ctxt,
|
||||
const int num_planes);
|
||||
void av1_setup_build_prediction_by_left_pred(MACROBLOCKD *xd, int rel_mi_row,
|
||||
uint8_t left_mi_height,
|
||||
MB_MODE_INFO *left_mbmi,
|
||||
struct build_prediction_ctxt *ctxt,
|
||||
const int num_planes);
|
||||
void av1_build_prediction_by_above_preds(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
||||
int mi_row, int mi_col,
|
||||
uint8_t *tmp_buf[MAX_MB_PLANE],
|
||||
|
|
@ -565,13 +379,18 @@ void av1_build_prediction_by_left_preds(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
|||
int tmp_width[MAX_MB_PLANE],
|
||||
int tmp_height[MAX_MB_PLANE],
|
||||
int tmp_stride[MAX_MB_PLANE]);
|
||||
void av1_build_obmc_inter_prediction(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
||||
int mi_row, int mi_col,
|
||||
uint8_t *above[MAX_MB_PLANE],
|
||||
int above_stride[MAX_MB_PLANE],
|
||||
uint8_t *left[MAX_MB_PLANE],
|
||||
int left_stride[MAX_MB_PLANE]);
|
||||
|
||||
const uint8_t *av1_get_obmc_mask(int length);
|
||||
void av1_count_overlappable_neighbors(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
||||
int mi_row, int mi_col);
|
||||
void av1_build_obmc_inter_predictors_sb(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
||||
int mi_row, int mi_col);
|
||||
#if CONFIG_NCOBMC
|
||||
void av1_build_ncobmc_inter_predictors_sb(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
||||
int mi_row, int mi_col);
|
||||
#endif
|
||||
#endif // CONFIG_MOTION_VAR
|
||||
|
||||
#define MASK_MASTER_SIZE ((MAX_WEDGE_SIZE) << 1)
|
||||
#define MASK_MASTER_STRIDE (MASK_MASTER_SIZE)
|
||||
|
|
@ -584,32 +403,24 @@ static INLINE const uint8_t *av1_get_contiguous_soft_mask(int wedge_index,
|
|||
return wedge_params_lookup[sb_type].masks[wedge_sign][wedge_index];
|
||||
}
|
||||
|
||||
const uint8_t *av1_get_soft_mask(int wedge_index, int wedge_sign,
|
||||
BLOCK_SIZE sb_type, int wedge_offset_x,
|
||||
int wedge_offset_y);
|
||||
|
||||
const uint8_t *av1_get_compound_type_mask_inverse(
|
||||
const INTERINTER_COMPOUND_DATA *const comp_data,
|
||||
#if CONFIG_COMPOUND_SEGMENT
|
||||
uint8_t *mask_buffer, int h, int w, int stride,
|
||||
#endif
|
||||
BLOCK_SIZE sb_type);
|
||||
|
||||
const uint8_t *av1_get_compound_type_mask(
|
||||
const INTERINTER_COMPOUND_DATA *const comp_data, BLOCK_SIZE sb_type);
|
||||
#if CONFIG_INTERINTRA
|
||||
|
||||
void av1_build_interintra_predictors(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
||||
uint8_t *ypred, uint8_t *upred,
|
||||
uint8_t *vpred, int ystride, int ustride,
|
||||
int vstride, BUFFER_SET *ctx,
|
||||
BLOCK_SIZE bsize);
|
||||
|
||||
void av1_build_interintra_predictors_sby(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
||||
uint8_t *ypred, int ystride,
|
||||
BUFFER_SET *ctx, BLOCK_SIZE bsize);
|
||||
|
||||
void av1_build_interintra_predictors_sbc(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
||||
uint8_t *upred, int ustride,
|
||||
BUFFER_SET *ctx, int plane,
|
||||
BLOCK_SIZE bsize);
|
||||
|
||||
void av1_build_interintra_predictors_sbuv(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
||||
uint8_t *upred, uint8_t *vpred,
|
||||
int ustride, int vstride,
|
||||
|
|
@ -621,57 +432,27 @@ void av1_build_intra_predictors_for_interintra(
|
|||
void av1_combine_interintra(MACROBLOCKD *xd, BLOCK_SIZE bsize, int plane,
|
||||
const uint8_t *inter_pred, int inter_stride,
|
||||
const uint8_t *intra_pred, int intra_stride);
|
||||
#endif // CONFIG_INTERINTRA
|
||||
|
||||
// Encoder only
|
||||
void av1_build_inter_predictors_for_planes_single_buf(
|
||||
MACROBLOCKD *xd, BLOCK_SIZE bsize, int plane_from, int plane_to, int mi_row,
|
||||
int mi_col, int ref, uint8_t *ext_dst[3], int ext_dst_stride[3]);
|
||||
void av1_build_wedge_inter_predictor_from_buf(
|
||||
MACROBLOCKD *xd, BLOCK_SIZE bsize, int plane_from, int plane_to,
|
||||
#if CONFIG_SUPERTX
|
||||
int wedge_offset_x, int wedge_offset_y,
|
||||
#endif // CONFIG_SUPERTX
|
||||
uint8_t *ext_dst0[3], int ext_dst_stride0[3], uint8_t *ext_dst1[3],
|
||||
int ext_dst_stride1[3]);
|
||||
int mi_col, int ref, uint8_t *ext_dst[3], int ext_dst_stride[3],
|
||||
int can_use_previous);
|
||||
void av1_build_wedge_inter_predictor_from_buf(MACROBLOCKD *xd, BLOCK_SIZE bsize,
|
||||
int plane_from, int plane_to,
|
||||
uint8_t *ext_dst0[3],
|
||||
int ext_dst_stride0[3],
|
||||
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
|
||||
void av1_jnt_comp_weight_assign(const AV1_COMMON *cm, const MB_MODE_INFO *mbmi,
|
||||
int order_idx, int *fwd_offset, int *bck_offset,
|
||||
int *use_jnt_comp_avg, int is_compound);
|
||||
int av1_allow_warp(const MB_MODE_INFO *const mbmi,
|
||||
const WarpTypesAllowed *const warp_types,
|
||||
const WarpedMotionParams *const gm_params,
|
||||
int build_for_obmc, int x_scale, int y_scale,
|
||||
WarpedMotionParams *final_warp_params);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
|
|
|
|||
3188
third_party/aom/av1/common/reconintra.c
vendored
3188
third_party/aom/av1/common/reconintra.c
vendored
File diff suppressed because it is too large
Load diff
94
third_party/aom/av1/common/reconintra.h
vendored
94
third_party/aom/av1/common/reconintra.h
vendored
|
|
@ -22,15 +22,16 @@ extern "C" {
|
|||
|
||||
void av1_init_intra_predictors(void);
|
||||
void av1_predict_intra_block_facade(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
||||
int plane, int block_idx, int blk_col,
|
||||
int blk_row, TX_SIZE tx_size);
|
||||
int plane, int blk_col, int blk_row,
|
||||
TX_SIZE tx_size);
|
||||
void av1_predict_intra_block(const AV1_COMMON *cm, const MACROBLOCKD *xd,
|
||||
int bw, int bh, BLOCK_SIZE bsize,
|
||||
PREDICTION_MODE mode, const uint8_t *ref,
|
||||
int ref_stride, uint8_t *dst, int dst_stride,
|
||||
int aoff, int loff, int plane);
|
||||
int bw, int bh, TX_SIZE tx_size,
|
||||
PREDICTION_MODE mode, int angle_delta,
|
||||
int use_palette,
|
||||
FILTER_INTRA_MODE filter_intra_mode,
|
||||
const uint8_t *ref, int ref_stride, uint8_t *dst,
|
||||
int dst_stride, int aoff, int loff, int plane);
|
||||
|
||||
#if CONFIG_INTERINTRA
|
||||
// Mapping of interintra to intra mode for use in the intra component
|
||||
static const PREDICTION_MODE interintra_to_intra_mode[INTERINTRA_MODES] = {
|
||||
DC_PRED, V_PRED, H_PRED, SMOOTH_PRED
|
||||
|
|
@ -41,44 +42,67 @@ static const INTERINTRA_MODE intra_to_interintra_mode[INTRA_MODES] = {
|
|||
II_DC_PRED, II_V_PRED, II_H_PRED, II_V_PRED, II_SMOOTH_PRED, II_V_PRED,
|
||||
II_H_PRED, II_H_PRED, II_V_PRED, II_SMOOTH_PRED, II_SMOOTH_PRED
|
||||
};
|
||||
#endif // CONFIG_INTERINTRA
|
||||
|
||||
#if CONFIG_FILTER_INTRA
|
||||
#define FILTER_INTRA_PREC_BITS 10
|
||||
#endif // CONFIG_FILTER_INTRA
|
||||
#define FILTER_INTRA_SCALE_BITS 4
|
||||
|
||||
#define CONFIG_INTRA_EDGE_UPSAMPLE CONFIG_INTRA_EDGE
|
||||
#define CONFIG_USE_ANGLE_DELTA_SUB8X8 0
|
||||
|
||||
#if CONFIG_EXT_INTRA
|
||||
static INLINE int av1_is_directional_mode(PREDICTION_MODE mode,
|
||||
BLOCK_SIZE bsize) {
|
||||
#if CONFIG_INTRA_EDGE_UPSAMPLE
|
||||
(void)bsize;
|
||||
return mode >= V_PRED && mode <= D63_PRED;
|
||||
#else
|
||||
return mode >= V_PRED && mode <= D63_PRED && bsize >= BLOCK_8X8;
|
||||
#endif
|
||||
static INLINE int av1_is_directional_mode(PREDICTION_MODE mode) {
|
||||
return mode >= V_PRED && mode <= D67_PRED;
|
||||
}
|
||||
|
||||
static INLINE int av1_use_angle_delta(BLOCK_SIZE bsize) {
|
||||
(void)bsize;
|
||||
#if CONFIG_USE_ANGLE_DELTA_SUB8X8
|
||||
return 1;
|
||||
#else
|
||||
return bsize >= BLOCK_8X8;
|
||||
#endif
|
||||
}
|
||||
#endif // CONFIG_EXT_INTRA
|
||||
|
||||
#if CONFIG_INTRABC
|
||||
static INLINE int av1_allow_intrabc(BLOCK_SIZE bsize,
|
||||
const AV1_COMMON *const cm) {
|
||||
return (bsize >= BLOCK_8X8 || bsize == BLOCK_4X4) &&
|
||||
cm->allow_screen_content_tools;
|
||||
static INLINE int av1_allow_intrabc(const AV1_COMMON *const cm) {
|
||||
return frame_is_intra_only(cm) && cm->allow_screen_content_tools &&
|
||||
cm->allow_intrabc;
|
||||
}
|
||||
#endif // CONFIG_INTRABC
|
||||
|
||||
static INLINE int av1_filter_intra_allowed_bsize(const AV1_COMMON *const cm,
|
||||
BLOCK_SIZE bs) {
|
||||
if (!cm->seq_params.enable_filter_intra || bs == BLOCK_INVALID) return 0;
|
||||
|
||||
return block_size_wide[bs] <= 32 && block_size_high[bs] <= 32;
|
||||
}
|
||||
|
||||
static INLINE int av1_filter_intra_allowed(const AV1_COMMON *const cm,
|
||||
const MB_MODE_INFO *mbmi) {
|
||||
return mbmi->mode == DC_PRED &&
|
||||
mbmi->palette_mode_info.palette_size[0] == 0 &&
|
||||
av1_filter_intra_allowed_bsize(cm, mbmi->sb_type);
|
||||
}
|
||||
|
||||
extern const int8_t av1_filter_intra_taps[FILTER_INTRA_MODES][8][8];
|
||||
|
||||
// Get the shift (up-scaled by 256) in X w.r.t a unit change in Y.
|
||||
// If angle > 0 && angle < 90, dx = -((int)(256 / t));
|
||||
// If angle > 90 && angle < 180, dx = (int)(256 / t);
|
||||
// If angle > 180 && angle < 270, dx = 1;
|
||||
static INLINE int av1_get_dx(int angle) {
|
||||
if (angle > 0 && angle < 90) {
|
||||
return dr_intra_derivative[angle];
|
||||
} else if (angle > 90 && angle < 180) {
|
||||
return dr_intra_derivative[180 - angle];
|
||||
} else {
|
||||
// In this case, we are not really going to use dx. We may return any value.
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Get the shift (up-scaled by 256) in Y w.r.t a unit change in X.
|
||||
// If angle > 0 && angle < 90, dy = 1;
|
||||
// If angle > 90 && angle < 180, dy = (int)(256 * t);
|
||||
// If angle > 180 && angle < 270, dy = -((int)(256 * t));
|
||||
static INLINE int av1_get_dy(int angle) {
|
||||
if (angle > 90 && angle < 180) {
|
||||
return dr_intra_derivative[angle - 90];
|
||||
} else if (angle > 180 && angle < 270) {
|
||||
return dr_intra_derivative[270 - angle];
|
||||
} else {
|
||||
// In this case, we are not really going to use dy. We may return any value.
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
|
|
|||
767
third_party/aom/av1/common/resize.c
vendored
767
third_party/aom/av1/common/resize.c
vendored
File diff suppressed because it is too large
Load diff
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue