mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-06 23:37:31 +09:00
Update aom to slightly newer commit ID
This commit is contained in:
parent
1c8af26369
commit
76f1e6edca
311 changed files with 55292 additions and 33790 deletions
65
third_party/aom/av1/av1.cmake
vendored
65
third_party/aom/av1/av1.cmake
vendored
|
|
@ -8,6 +8,9 @@
|
|||
## 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.
|
||||
##
|
||||
if (NOT AOM_AV1_AV1_CMAKE_)
|
||||
set(AOM_AV1_AV1_CMAKE_ 1)
|
||||
|
||||
set(AOM_AV1_COMMON_SOURCES
|
||||
"${AOM_ROOT}/av1/av1_iface_common.h"
|
||||
"${AOM_ROOT}/av1/common/alloccommon.c"
|
||||
|
|
@ -16,11 +19,11 @@ set(AOM_AV1_COMMON_SOURCES
|
|||
"${AOM_ROOT}/av1/common/av1_fwd_txfm1d.c"
|
||||
"${AOM_ROOT}/av1/common/av1_fwd_txfm1d.h"
|
||||
"${AOM_ROOT}/av1/common/av1_fwd_txfm2d.c"
|
||||
"${AOM_ROOT}/av1/common/av1_fwd_txfm2d_cfg.h"
|
||||
"${AOM_ROOT}/av1/common/av1_fwd_txfm1d_cfg.h"
|
||||
"${AOM_ROOT}/av1/common/av1_inv_txfm1d.c"
|
||||
"${AOM_ROOT}/av1/common/av1_inv_txfm1d.h"
|
||||
"${AOM_ROOT}/av1/common/av1_inv_txfm2d.c"
|
||||
"${AOM_ROOT}/av1/common/av1_inv_txfm2d_cfg.h"
|
||||
"${AOM_ROOT}/av1/common/av1_inv_txfm1d_cfg.h"
|
||||
"${AOM_ROOT}/av1/common/av1_loopfilter.c"
|
||||
"${AOM_ROOT}/av1/common/av1_loopfilter.h"
|
||||
"${AOM_ROOT}/av1/common/av1_txfm.h"
|
||||
|
|
@ -60,7 +63,6 @@ set(AOM_AV1_COMMON_SOURCES
|
|||
"${AOM_ROOT}/av1/common/reconintra.h"
|
||||
"${AOM_ROOT}/av1/common/resize.c"
|
||||
"${AOM_ROOT}/av1/common/resize.h"
|
||||
"${AOM_ROOT}/av1/common/restoration.h"
|
||||
"${AOM_ROOT}/av1/common/scale.c"
|
||||
"${AOM_ROOT}/av1/common/scale.h"
|
||||
"${AOM_ROOT}/av1/common/scan.c"
|
||||
|
|
@ -146,13 +148,9 @@ set(AOM_AV1_ENCODER_SOURCES
|
|||
"${AOM_ROOT}/av1/encoder/tokenize.c"
|
||||
"${AOM_ROOT}/av1/encoder/tokenize.h"
|
||||
"${AOM_ROOT}/av1/encoder/treewriter.c"
|
||||
"${AOM_ROOT}/av1/encoder/treewriter.h"
|
||||
"${AOM_ROOT}/av1/encoder/variance_tree.c"
|
||||
"${AOM_ROOT}/av1/encoder/variance_tree.h")
|
||||
"${AOM_ROOT}/av1/encoder/treewriter.h")
|
||||
|
||||
set(AOM_AV1_COMMON_INTRIN_SSE2
|
||||
# Requires CONFIG_GLOBAL_MOTION or CONFIG_WARPED_MOTION
|
||||
#"${AOM_ROOT}/av1/common/x86/warp_plane_sse2.c"
|
||||
"${AOM_ROOT}/av1/common/x86/idct_intrin_sse2.c")
|
||||
|
||||
set(AOM_AV1_COMMON_INTRIN_SSSE3
|
||||
|
|
@ -293,6 +291,27 @@ if (CONFIG_ACCOUNTING)
|
|||
"${AOM_ROOT}/av1/decoder/accounting.h")
|
||||
endif ()
|
||||
|
||||
if (CONFIG_GLOBAL_MOTION)
|
||||
set(AOM_AV1_ENCODER_SOURCES
|
||||
${AOM_AV1_ENCODER_SOURCES}
|
||||
"${AOM_ROOT}/av1/encoder/corner_detect.c"
|
||||
"${AOM_ROOT}/av1/encoder/corner_detect.h"
|
||||
"${AOM_ROOT}/av1/encoder/corner_match.c"
|
||||
"${AOM_ROOT}/av1/encoder/corner_match.h"
|
||||
"${AOM_ROOT}/av1/encoder/global_motion.c"
|
||||
"${AOM_ROOT}/av1/encoder/global_motion.h"
|
||||
"${AOM_ROOT}/av1/encoder/ransac.c"
|
||||
"${AOM_ROOT}/av1/encoder/ransac.h"
|
||||
"${AOM_ROOT}/third_party/fastfeat/fast_9.c"
|
||||
"${AOM_ROOT}/third_party/fastfeat/fast.c"
|
||||
"${AOM_ROOT}/third_party/fastfeat/fast.h"
|
||||
"${AOM_ROOT}/third_party/fastfeat/nonmax.c")
|
||||
|
||||
set(AOM_AV1_ENCODER_INTRIN_SSE4_1
|
||||
${AOM_AV1_ENCODER_INTRIN_SSE4_1}
|
||||
"${AOM_ROOT}/av1/encoder/x86/corner_match_sse4.c")
|
||||
endif ()
|
||||
|
||||
if (CONFIG_INSPECTION)
|
||||
set(AOM_AV1_DECODER_SOURCES
|
||||
${AOM_AV1_DECODER_SOURCES}
|
||||
|
|
@ -320,6 +339,22 @@ if (CONFIG_CFL)
|
|||
"${AOM_ROOT}/av1/common/cfl.h")
|
||||
endif ()
|
||||
|
||||
if (CONFIG_LOOP_RESTORATION)
|
||||
set(AOM_AV1_COMMON_SOURCES
|
||||
${AOM_AV1_COMMON_SOURCES}
|
||||
"${AOM_ROOT}/av1/common/restoration.c"
|
||||
"${AOM_ROOT}/av1/common/restoration.h")
|
||||
|
||||
set(AOM_AV1_COMMON_INTRIN_SSE4_1
|
||||
${AOM_AV1_COMMON_INTRIN_SSE4_1}
|
||||
"${AOM_ROOT}/av1/common/x86/selfguided_sse4.c")
|
||||
|
||||
set(AOM_AV1_ENCODER_SOURCES
|
||||
${AOM_AV1_ENCODER_SOURCES}
|
||||
"${AOM_ROOT}/av1/encoder/pickrst.c"
|
||||
"${AOM_ROOT}/av1/encoder/pickrst.h")
|
||||
endif ()
|
||||
|
||||
if (CONFIG_PVQ)
|
||||
set(AOM_AV1_COMMON_SOURCES
|
||||
${AOM_AV1_COMMON_SOURCES}
|
||||
|
|
@ -382,7 +417,7 @@ if (CONFIG_PVQ)
|
|||
endif ()
|
||||
endif ()
|
||||
|
||||
if (CONFIG_WARPED_MOTION)
|
||||
if (CONFIG_WARPED_MOTION OR CONFIG_GLOBAL_MOTION)
|
||||
set(AOM_AV1_COMMON_SOURCES
|
||||
${AOM_AV1_COMMON_SOURCES}
|
||||
"${AOM_ROOT}/av1/common/warped_motion.c"
|
||||
|
|
@ -391,6 +426,16 @@ if (CONFIG_WARPED_MOTION)
|
|||
set(AOM_AV1_COMMON_INTRIN_SSE2
|
||||
${AOM_AV1_COMMON_INTRIN_SSE2}
|
||||
"${AOM_ROOT}/av1/common/x86/warp_plane_sse2.c")
|
||||
|
||||
set(AOM_AV1_COMMON_INTRIN_SSSE3
|
||||
${AOM_AV1_COMMON_INTRIN_SSSE3}
|
||||
"${AOM_ROOT}/av1/common/x86/warp_plane_ssse3.c")
|
||||
|
||||
if (CONFIG_HIGHBITDEPTH)
|
||||
set(AOM_AV1_COMMON_INTRIN_SSSE3
|
||||
${AOM_AV1_COMMON_INTRIN_SSSE3}
|
||||
"${AOM_ROOT}/av1/common/x86/highbd_warp_plane_ssse3.c")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# Setup AV1 common/decoder/encoder targets. The libaom target must exist before
|
||||
|
|
@ -516,3 +561,5 @@ endfunction ()
|
|||
|
||||
function (setup_av1_test_targets)
|
||||
endfunction ()
|
||||
|
||||
endif () # AOM_AV1_AV1_CMAKE_
|
||||
|
|
|
|||
6
third_party/aom/av1/av1_common.mk
vendored
6
third_party/aom/av1/av1_common.mk
vendored
|
|
@ -58,7 +58,6 @@ AV1_COMMON_SRCS-yes += common/reconinter.c
|
|||
AV1_COMMON_SRCS-yes += common/reconintra.c
|
||||
AV1_COMMON_SRCS-yes += common/resize.c
|
||||
AV1_COMMON_SRCS-yes += common/resize.h
|
||||
AV1_COMMON_SRCS-yes += common/restoration.h
|
||||
AV1_COMMON_SRCS-yes += common/common_data.h
|
||||
AV1_COMMON_SRCS-yes += common/scan.c
|
||||
AV1_COMMON_SRCS-yes += common/scan.h
|
||||
|
|
@ -69,9 +68,9 @@ AV1_COMMON_SRCS-yes += common/av1_fwd_txfm1d.c
|
|||
AV1_COMMON_SRCS-yes += common/av1_inv_txfm1d.h
|
||||
AV1_COMMON_SRCS-yes += common/av1_inv_txfm1d.c
|
||||
AV1_COMMON_SRCS-yes += common/av1_fwd_txfm2d.c
|
||||
AV1_COMMON_SRCS-yes += common/av1_fwd_txfm2d_cfg.h
|
||||
AV1_COMMON_SRCS-yes += common/av1_fwd_txfm1d_cfg.h
|
||||
AV1_COMMON_SRCS-yes += common/av1_inv_txfm2d.c
|
||||
AV1_COMMON_SRCS-yes += common/av1_inv_txfm2d_cfg.h
|
||||
AV1_COMMON_SRCS-yes += common/av1_inv_txfm1d_cfg.h
|
||||
AV1_COMMON_SRCS-$(HAVE_SSSE3) += common/x86/av1_convolve_ssse3.c
|
||||
ifeq ($(CONFIG_HIGHBITDEPTH),yes)
|
||||
AV1_COMMON_SRCS-$(HAVE_SSE4_1) += common/x86/av1_highbd_convolve_sse4.c
|
||||
|
|
@ -172,6 +171,7 @@ endif
|
|||
|
||||
ifneq ($(findstring yes,$(CONFIG_GLOBAL_MOTION) $(CONFIG_WARPED_MOTION)),)
|
||||
AV1_COMMON_SRCS-$(HAVE_SSE2) += common/x86/warp_plane_sse2.c
|
||||
AV1_COMMON_SRCS-$(HAVE_SSSE3) += common/x86/warp_plane_ssse3.c
|
||||
ifeq ($(CONFIG_HIGHBITDEPTH),yes)
|
||||
AV1_COMMON_SRCS-$(HAVE_SSSE3) += common/x86/highbd_warp_plane_ssse3.c
|
||||
endif
|
||||
|
|
|
|||
7
third_party/aom/av1/av1_cx.mk
vendored
7
third_party/aom/av1/av1_cx.mk
vendored
|
|
@ -23,8 +23,6 @@ AV1_CX_SRCS-yes += encoder/av1_quantize.h
|
|||
AV1_CX_SRCS-yes += encoder/bitstream.c
|
||||
AV1_CX_SRCS-yes += encoder/context_tree.c
|
||||
AV1_CX_SRCS-yes += encoder/context_tree.h
|
||||
AV1_CX_SRCS-yes += encoder/variance_tree.c
|
||||
AV1_CX_SRCS-yes += encoder/variance_tree.h
|
||||
AV1_CX_SRCS-yes += encoder/cost.h
|
||||
AV1_CX_SRCS-yes += encoder/cost.c
|
||||
AV1_CX_SRCS-yes += encoder/dct.c
|
||||
|
|
@ -38,6 +36,7 @@ AV1_CX_SRCS-yes += encoder/ethread.h
|
|||
AV1_CX_SRCS-yes += encoder/ethread.c
|
||||
AV1_CX_SRCS-yes += encoder/extend.c
|
||||
AV1_CX_SRCS-yes += encoder/firstpass.c
|
||||
AV1_CX_SRCS-yes += encoder/mathutils.h
|
||||
AV1_CX_SRCS-$(CONFIG_GLOBAL_MOTION) += ../third_party/fastfeat/fast.h
|
||||
AV1_CX_SRCS-$(CONFIG_GLOBAL_MOTION) += ../third_party/fastfeat/nonmax.c
|
||||
AV1_CX_SRCS-$(CONFIG_GLOBAL_MOTION) += ../third_party/fastfeat/fast_9.c
|
||||
|
|
@ -162,4 +161,8 @@ AV1_CX_SRCS-$(HAVE_MSA) += encoder/mips/msa/fdct16x16_msa.c
|
|||
AV1_CX_SRCS-$(HAVE_MSA) += encoder/mips/msa/fdct_msa.h
|
||||
AV1_CX_SRCS-$(HAVE_MSA) += encoder/mips/msa/temporal_filter_msa.c
|
||||
|
||||
ifeq ($(CONFIG_GLOBAL_MOTION),yes)
|
||||
AV1_CX_SRCS-$(HAVE_SSE4_1) += encoder/x86/corner_match_sse4.c
|
||||
endif
|
||||
|
||||
AV1_CX_SRCS-yes := $(filter-out $(AV1_CX_SRCS_REMOVE-yes),$(AV1_CX_SRCS-yes))
|
||||
|
|
|
|||
10
third_party/aom/av1/av1_cx_iface.c
vendored
10
third_party/aom/av1/av1_cx_iface.c
vendored
|
|
@ -483,6 +483,16 @@ static aom_codec_err_t set_encoder_config(
|
|||
oxcf->resize_mode = RESIZE_NONE;
|
||||
}
|
||||
|
||||
// Initialize to input resolution if not specified.
|
||||
if (oxcf->resize_mode != RESIZE_FIXED) {
|
||||
oxcf->scaled_frame_width = oxcf->width;
|
||||
oxcf->scaled_frame_height = oxcf->height;
|
||||
}
|
||||
|
||||
#if CONFIG_FRAME_SUPERRES
|
||||
oxcf->superres_enabled = 1; // TODO(afergs): Check the config
|
||||
#endif // CONFIG_FRAME_SUPERRES
|
||||
|
||||
oxcf->maximum_buffer_size_ms = is_vbr ? 240000 : cfg->rc_buf_sz;
|
||||
oxcf->starting_buffer_level_ms = is_vbr ? 60000 : cfg->rc_buf_initial_sz;
|
||||
oxcf->optimal_buffer_level_ms = is_vbr ? 60000 : cfg->rc_buf_optimal_sz;
|
||||
|
|
|
|||
11
third_party/aom/av1/av1_dx_iface.c
vendored
11
third_party/aom/av1/av1_dx_iface.c
vendored
|
|
@ -31,8 +31,6 @@
|
|||
|
||||
#include "av1/av1_iface_common.h"
|
||||
|
||||
typedef aom_codec_stream_info_t av1_stream_info_t;
|
||||
|
||||
// This limit is due to framebuffer numbers.
|
||||
// TODO(hkuang): Remove this limit after implementing ondemand framebuffers.
|
||||
#define FRAME_CACHE_SIZE 6 // Cache maximum 6 decoded frames.
|
||||
|
|
@ -45,7 +43,7 @@ typedef struct cache_frame {
|
|||
struct aom_codec_alg_priv {
|
||||
aom_codec_priv_t base;
|
||||
aom_codec_dec_cfg_t cfg;
|
||||
av1_stream_info_t si;
|
||||
aom_codec_stream_info_t si;
|
||||
int postproc_cfg_set;
|
||||
aom_postproc_cfg_t postproc_cfg;
|
||||
aom_decrypt_cb decrypt_cb;
|
||||
|
|
@ -101,7 +99,6 @@ static aom_codec_err_t decoder_init(aom_codec_ctx_t *ctx,
|
|||
|
||||
ctx->priv = (aom_codec_priv_t *)priv;
|
||||
ctx->priv->init_flags = ctx->init_flags;
|
||||
priv->si.sz = sizeof(priv->si);
|
||||
priv->flushed = 0;
|
||||
// Only do frame parallel decode when threads > 1.
|
||||
priv->frame_parallel_decode =
|
||||
|
|
@ -263,11 +260,7 @@ static aom_codec_err_t decoder_peek_si(const uint8_t *data,
|
|||
|
||||
static aom_codec_err_t decoder_get_si(aom_codec_alg_priv_t *ctx,
|
||||
aom_codec_stream_info_t *si) {
|
||||
const size_t sz = (si->sz >= sizeof(av1_stream_info_t))
|
||||
? sizeof(av1_stream_info_t)
|
||||
: sizeof(aom_codec_stream_info_t);
|
||||
memcpy(si, &ctx->si, sz);
|
||||
si->sz = (unsigned int)sz;
|
||||
memcpy(si, &ctx->si, sizeof(*si));
|
||||
|
||||
return AOM_CODEC_OK;
|
||||
}
|
||||
|
|
|
|||
18
third_party/aom/av1/common/alloccommon.c
vendored
18
third_party/aom/av1/common/alloccommon.c
vendored
|
|
@ -125,6 +125,11 @@ void av1_free_context_buffers(AV1_COMMON *cm) {
|
|||
#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;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -155,7 +160,8 @@ int av1_alloc_context_buffers(AV1_COMMON *cm, int width, int height) {
|
|||
for (i = 0; i < MAX_MB_PLANE; i++) {
|
||||
aom_free(cm->above_context[i]);
|
||||
cm->above_context[i] = (ENTROPY_CONTEXT *)aom_calloc(
|
||||
2 * aligned_mi_cols, sizeof(*cm->above_context[0]));
|
||||
aligned_mi_cols << (MI_SIZE_LOG2 - tx_size_wide_log2[0]),
|
||||
sizeof(*cm->above_context[0]));
|
||||
if (!cm->above_context[i]) goto fail;
|
||||
}
|
||||
|
||||
|
|
@ -167,8 +173,16 @@ int av1_alloc_context_buffers(AV1_COMMON *cm, int width, int height) {
|
|||
#if CONFIG_VAR_TX
|
||||
aom_free(cm->above_txfm_context);
|
||||
cm->above_txfm_context = (TXFM_CONTEXT *)aom_calloc(
|
||||
aligned_mi_cols, sizeof(*cm->above_txfm_context));
|
||||
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;
|
||||
|
|
|
|||
115
third_party/aom/av1/common/av1_fwd_txfm1d.c
vendored
115
third_party/aom/av1/common/av1_fwd_txfm1d.c
vendored
|
|
@ -10,6 +10,7 @@
|
|||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "aom_dsp/inv_txfm.h"
|
||||
#include "av1/common/av1_fwd_txfm1d.h"
|
||||
#if CONFIG_COEFFICIENT_RANGE_CHECKING
|
||||
|
||||
|
|
@ -53,7 +54,7 @@ void av1_fdct4_new(const int32_t *input, int32_t *output, const int8_t *cos_bit,
|
|||
|
||||
// stage 2
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = half_btf(cospi[32], bf0[0], cospi[32], bf0[1], cos_bit[stage]);
|
||||
|
|
@ -100,7 +101,7 @@ void av1_fdct8_new(const int32_t *input, int32_t *output, const int8_t *cos_bit,
|
|||
|
||||
// stage 2
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = bf0[0] + bf0[3];
|
||||
|
|
@ -115,7 +116,7 @@ void av1_fdct8_new(const int32_t *input, int32_t *output, const int8_t *cos_bit,
|
|||
|
||||
// stage 3
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = step;
|
||||
bf1 = output;
|
||||
bf1[0] = half_btf(cospi[32], bf0[0], cospi[32], bf0[1], cos_bit[stage]);
|
||||
|
|
@ -130,7 +131,7 @@ void av1_fdct8_new(const int32_t *input, int32_t *output, const int8_t *cos_bit,
|
|||
|
||||
// stage 4
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = bf0[0];
|
||||
|
|
@ -193,7 +194,7 @@ void av1_fdct16_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 2
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = bf0[0] + bf0[7];
|
||||
|
|
@ -216,7 +217,7 @@ void av1_fdct16_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 3
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = step;
|
||||
bf1 = output;
|
||||
bf1[0] = bf0[0] + bf0[3];
|
||||
|
|
@ -239,7 +240,7 @@ void av1_fdct16_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 4
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = half_btf(cospi[32], bf0[0], cospi[32], bf0[1], cos_bit[stage]);
|
||||
|
|
@ -262,7 +263,7 @@ void av1_fdct16_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 5
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = step;
|
||||
bf1 = output;
|
||||
bf1[0] = bf0[0];
|
||||
|
|
@ -285,7 +286,7 @@ void av1_fdct16_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 6
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = bf0[0];
|
||||
|
|
@ -380,7 +381,7 @@ void av1_fdct32_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 2
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = bf0[0] + bf0[15];
|
||||
|
|
@ -419,7 +420,7 @@ void av1_fdct32_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 3
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = step;
|
||||
bf1 = output;
|
||||
bf1[0] = bf0[0] + bf0[7];
|
||||
|
|
@ -458,7 +459,7 @@ void av1_fdct32_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 4
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = bf0[0] + bf0[3];
|
||||
|
|
@ -497,7 +498,7 @@ void av1_fdct32_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 5
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = step;
|
||||
bf1 = output;
|
||||
bf1[0] = half_btf(cospi[32], bf0[0], cospi[32], bf0[1], cos_bit[stage]);
|
||||
|
|
@ -536,7 +537,7 @@ void av1_fdct32_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 6
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = bf0[0];
|
||||
|
|
@ -575,7 +576,7 @@ void av1_fdct32_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 7
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = step;
|
||||
bf1 = output;
|
||||
bf1[0] = bf0[0];
|
||||
|
|
@ -614,7 +615,7 @@ void av1_fdct32_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 8
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = bf0[0];
|
||||
|
|
@ -713,7 +714,7 @@ void av1_fadst4_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 2
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = half_btf(cospi[8], bf0[0], cospi[56], bf0[1], cos_bit[stage]);
|
||||
|
|
@ -734,7 +735,7 @@ void av1_fadst4_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 4
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = bf0[0];
|
||||
|
|
@ -781,7 +782,7 @@ void av1_fadst8_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 2
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = half_btf(cospi[4], bf0[0], cospi[60], bf0[1], cos_bit[stage]);
|
||||
|
|
@ -810,7 +811,7 @@ void av1_fadst8_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 4
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = bf0[0];
|
||||
|
|
@ -839,7 +840,7 @@ void av1_fadst8_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 6
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = bf0[0];
|
||||
|
|
@ -902,7 +903,7 @@ void av1_fadst16_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 2
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = half_btf(cospi[2], bf0[0], cospi[62], bf0[1], cos_bit[stage]);
|
||||
|
|
@ -947,7 +948,7 @@ void av1_fadst16_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 4
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = bf0[0];
|
||||
|
|
@ -992,7 +993,7 @@ void av1_fadst16_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 6
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = bf0[0];
|
||||
|
|
@ -1037,7 +1038,7 @@ void av1_fadst16_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 8
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = bf0[0];
|
||||
|
|
@ -1132,7 +1133,7 @@ void av1_fadst32_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 2
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = half_btf(cospi[1], bf0[0], cospi[63], bf0[1], cos_bit[stage]);
|
||||
|
|
@ -1209,7 +1210,7 @@ void av1_fadst32_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 4
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = bf0[0];
|
||||
|
|
@ -1286,7 +1287,7 @@ void av1_fadst32_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 6
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = bf0[0];
|
||||
|
|
@ -1363,7 +1364,7 @@ void av1_fadst32_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 8
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = bf0[0];
|
||||
|
|
@ -1440,7 +1441,7 @@ void av1_fadst32_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 10
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = bf0[0];
|
||||
|
|
@ -1516,6 +1517,38 @@ void av1_fadst32_new(const int32_t *input, int32_t *output,
|
|||
range_check(stage, input, bf1, size, stage_range[stage]);
|
||||
}
|
||||
|
||||
#if CONFIG_EXT_TX
|
||||
void av1_fidentity4_c(const int32_t *input, int32_t *output,
|
||||
const int8_t *cos_bit, const int8_t *stage_range) {
|
||||
(void)cos_bit;
|
||||
for (int i = 0; i < 4; ++i)
|
||||
output[i] = (int32_t)dct_const_round_shift(input[i] * Sqrt2);
|
||||
range_check(0, input, output, 4, stage_range[0]);
|
||||
}
|
||||
|
||||
void av1_fidentity8_c(const int32_t *input, int32_t *output,
|
||||
const int8_t *cos_bit, const int8_t *stage_range) {
|
||||
(void)cos_bit;
|
||||
for (int i = 0; i < 8; ++i) output[i] = input[i] * 2;
|
||||
range_check(0, input, output, 8, stage_range[0]);
|
||||
}
|
||||
|
||||
void av1_fidentity16_c(const int32_t *input, int32_t *output,
|
||||
const int8_t *cos_bit, const int8_t *stage_range) {
|
||||
(void)cos_bit;
|
||||
for (int i = 0; i < 16; ++i)
|
||||
output[i] = (int32_t)dct_const_round_shift(input[i] * 2 * Sqrt2);
|
||||
range_check(0, input, output, 16, stage_range[0]);
|
||||
}
|
||||
|
||||
void av1_fidentity32_c(const int32_t *input, int32_t *output,
|
||||
const int8_t *cos_bit, const int8_t *stage_range) {
|
||||
(void)cos_bit;
|
||||
for (int i = 0; i < 32; ++i) output[i] = input[i] * 4;
|
||||
range_check(0, input, output, 32, stage_range[0]);
|
||||
}
|
||||
#endif // CONFIG_EXT_TX
|
||||
|
||||
#if CONFIG_TX64X64
|
||||
void av1_fdct64_new(const int32_t *input, int32_t *output,
|
||||
const int8_t *cos_bit, const int8_t *stage_range) {
|
||||
|
|
@ -1531,7 +1564,7 @@ void av1_fdct64_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 1;
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf1 = output;
|
||||
bf1[0] = input[0] + input[63];
|
||||
bf1[1] = input[1] + input[62];
|
||||
|
|
@ -1601,7 +1634,7 @@ void av1_fdct64_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 2
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = bf0[0] + bf0[31];
|
||||
|
|
@ -1672,7 +1705,7 @@ void av1_fdct64_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 3
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = step;
|
||||
bf1 = output;
|
||||
bf1[0] = bf0[0] + bf0[15];
|
||||
|
|
@ -1743,7 +1776,7 @@ void av1_fdct64_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 4
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = bf0[0] + bf0[7];
|
||||
|
|
@ -1814,7 +1847,7 @@ void av1_fdct64_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 5
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = step;
|
||||
bf1 = output;
|
||||
bf1[0] = bf0[0] + bf0[3];
|
||||
|
|
@ -1885,7 +1918,7 @@ void av1_fdct64_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 6
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = half_btf(cospi[32], bf0[0], cospi[32], bf0[1], cos_bit[stage]);
|
||||
|
|
@ -1956,7 +1989,7 @@ void av1_fdct64_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 7
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = step;
|
||||
bf1 = output;
|
||||
bf1[0] = bf0[0];
|
||||
|
|
@ -2027,7 +2060,7 @@ void av1_fdct64_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 8
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = bf0[0];
|
||||
|
|
@ -2098,7 +2131,7 @@ void av1_fdct64_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 9
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = step;
|
||||
bf1 = output;
|
||||
bf1[0] = bf0[0];
|
||||
|
|
@ -2169,7 +2202,7 @@ void av1_fdct64_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 10
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = bf0[0];
|
||||
|
|
@ -2240,7 +2273,7 @@ void av1_fdct64_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 11
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = step;
|
||||
bf1 = output;
|
||||
bf1[0] = bf0[0];
|
||||
|
|
|
|||
10
third_party/aom/av1/common/av1_fwd_txfm1d.h
vendored
10
third_party/aom/av1/common/av1_fwd_txfm1d.h
vendored
|
|
@ -37,6 +37,16 @@ void av1_fadst16_new(const int32_t *input, int32_t *output,
|
|||
const int8_t *cos_bit, const int8_t *stage_range);
|
||||
void av1_fadst32_new(const int32_t *input, int32_t *output,
|
||||
const int8_t *cos_bit, const int8_t *stage_range);
|
||||
#if CONFIG_EXT_TX
|
||||
void av1_fidentity4_c(const int32_t *input, int32_t *output,
|
||||
const int8_t *cos_bit, const int8_t *stage_range);
|
||||
void av1_fidentity8_c(const int32_t *input, int32_t *output,
|
||||
const int8_t *cos_bit, const int8_t *stage_range);
|
||||
void av1_fidentity16_c(const int32_t *input, int32_t *output,
|
||||
const int8_t *cos_bit, const int8_t *stage_range);
|
||||
void av1_fidentity32_c(const int32_t *input, int32_t *output,
|
||||
const int8_t *cos_bit, const int8_t *stage_range);
|
||||
#endif // CONFIG_EXT_TX
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
364
third_party/aom/av1/common/av1_fwd_txfm1d_cfg.h
vendored
Normal file
364
third_party/aom/av1/common/av1_fwd_txfm1d_cfg.h
vendored
Normal file
|
|
@ -0,0 +1,364 @@
|
|||
/*
|
||||
* 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"
|
||||
// Identity will always use max bitdepth regardless of size
|
||||
static const int8_t fwd_stage_range_identity[1] = { 12 };
|
||||
|
||||
// ---------------- 4x4 1D constants -----------------------
|
||||
// shift
|
||||
static const int8_t fwd_shift_4[3] = { 2, 0, 0 };
|
||||
|
||||
// stage range
|
||||
static const int8_t fwd_stage_range_col_dct_4[4] = { 15, 16, 17, 17 };
|
||||
static const int8_t fwd_stage_range_row_dct_4[4] = { 17, 18, 18, 18 };
|
||||
static const int8_t fwd_stage_range_col_adst_4[6] = { 15, 15, 16, 17, 17, 17 };
|
||||
static const int8_t fwd_stage_range_row_adst_4[6] = { 17, 17, 17, 18, 18, 18 };
|
||||
// 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] = { 15, 16, 17, 18, 18, 18 };
|
||||
static const int8_t fwd_stage_range_row_dct_8[6] = { 17, 18, 19, 19, 19, 19 };
|
||||
static const int8_t fwd_stage_range_col_adst_8[8] = { 15, 15, 16, 17,
|
||||
17, 18, 18, 18 };
|
||||
static const int8_t fwd_stage_range_row_adst_8[8] = { 17, 17, 17, 18,
|
||||
18, 19, 19, 19 };
|
||||
|
||||
// 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] = { 15, 16, 17, 18,
|
||||
19, 19, 19, 19 };
|
||||
static const int8_t fwd_stage_range_row_dct_16[8] = { 17, 18, 19, 20,
|
||||
20, 20, 20, 20 };
|
||||
static const int8_t fwd_stage_range_col_adst_16[10] = { 15, 15, 16, 17, 17,
|
||||
18, 18, 19, 19, 19 };
|
||||
static const int8_t fwd_stage_range_row_adst_16[10] = { 17, 17, 17, 18, 18,
|
||||
19, 19, 20, 20, 20 };
|
||||
|
||||
// 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] = { 15, 16, 17, 18, 19,
|
||||
20, 20, 20, 20, 20 };
|
||||
static const int8_t fwd_stage_range_row_dct_32[10] = { 16, 17, 18, 19, 20,
|
||||
20, 20, 20, 20, 20 };
|
||||
static const int8_t fwd_stage_range_col_adst_32[12] = {
|
||||
15, 15, 16, 17, 17, 18, 18, 19, 19, 20, 20, 20
|
||||
};
|
||||
static const int8_t fwd_stage_range_row_adst_32[12] = {
|
||||
16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 20
|
||||
};
|
||||
|
||||
// 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] = { 13, 14, 15, 16, 17, 18,
|
||||
19, 19, 19, 19, 19, 19 };
|
||||
static const int8_t fwd_stage_range_row_dct_64[12] = { 17, 18, 19, 20, 21, 22,
|
||||
22, 22, 22, 22, 22, 22 };
|
||||
|
||||
// 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_identity, // .stage_range
|
||||
NULL, // .cos_bit
|
||||
TXFM_TYPE_IDENTITY4, // .txfm_type
|
||||
};
|
||||
|
||||
// ---------------- row/col config fwd_identity_8 ----------------
|
||||
static const TXFM_1D_CFG fwd_txfm_1d_cfg_identity_8 = {
|
||||
8, // .txfm_size
|
||||
1, // .stage_num
|
||||
// 0, // .log_scale
|
||||
fwd_shift_8, // .shift
|
||||
fwd_stage_range_identity, // .stage_range
|
||||
NULL, // .cos_bit
|
||||
TXFM_TYPE_IDENTITY8, // .txfm_type
|
||||
};
|
||||
|
||||
// ---------------- row/col config fwd_identity_16 ----------------
|
||||
static const TXFM_1D_CFG fwd_txfm_1d_cfg_identity_16 = {
|
||||
16, // .txfm_size
|
||||
1, // .stage_num
|
||||
// 0, // .log_scale
|
||||
fwd_shift_16, // .shift
|
||||
fwd_stage_range_identity, // .stage_range
|
||||
NULL, // .cos_bit
|
||||
TXFM_TYPE_IDENTITY16, // .txfm_type
|
||||
};
|
||||
|
||||
// ---------------- row/col config fwd_identity_32 ----------------
|
||||
static const TXFM_1D_CFG fwd_txfm_1d_cfg_identity_32 = {
|
||||
32, // .txfm_size
|
||||
1, // .stage_num
|
||||
// 1, // .log_scale
|
||||
fwd_shift_32, // .shift
|
||||
fwd_stage_range_identity, // .stage_range
|
||||
NULL, // .cos_bit
|
||||
TXFM_TYPE_IDENTITY32, // .txfm_type
|
||||
};
|
||||
#endif // CONFIG_EXT_TX
|
||||
#endif // AV1_FWD_TXFM2D_CFG_H_
|
||||
170
third_party/aom/av1/common/av1_fwd_txfm2d.c
vendored
170
third_party/aom/av1/common/av1_fwd_txfm2d.c
vendored
|
|
@ -14,7 +14,7 @@
|
|||
#include "./av1_rtcd.h"
|
||||
#include "av1/common/enums.h"
|
||||
#include "av1/common/av1_fwd_txfm1d.h"
|
||||
#include "av1/common/av1_fwd_txfm2d_cfg.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) {
|
||||
|
|
@ -27,6 +27,12 @@ static INLINE TxfmFunc fwd_txfm_type_to_func(TXFM_TYPE txfm_type) {
|
|||
case TXFM_TYPE_ADST8: return av1_fadst8_new;
|
||||
case TXFM_TYPE_ADST16: return av1_fadst16_new;
|
||||
case TXFM_TYPE_ADST32: return av1_fadst32_new;
|
||||
#if CONFIG_EXT_TX
|
||||
case TXFM_TYPE_IDENTITY4: return av1_fidentity4_c;
|
||||
case TXFM_TYPE_IDENTITY8: return av1_fidentity8_c;
|
||||
case TXFM_TYPE_IDENTITY16: return av1_fidentity16_c;
|
||||
case TXFM_TYPE_IDENTITY32: return av1_fidentity32_c;
|
||||
#endif // CONFIG_EXT_TX
|
||||
default: assert(0); return NULL;
|
||||
}
|
||||
}
|
||||
|
|
@ -35,14 +41,15 @@ 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 c, r;
|
||||
const int txfm_size = cfg->cfg->txfm_size;
|
||||
const int8_t *shift = cfg->cfg->shift;
|
||||
const int8_t *stage_range_col = cfg->cfg->stage_range_col;
|
||||
const int8_t *stage_range_row = cfg->cfg->stage_range_row;
|
||||
const int8_t *cos_bit_col = cfg->cfg->cos_bit_col;
|
||||
const int8_t *cos_bit_row = cfg->cfg->cos_bit_row;
|
||||
const TxfmFunc txfm_func_col = fwd_txfm_type_to_func(cfg->cfg->txfm_type_col);
|
||||
const TxfmFunc txfm_func_row = fwd_txfm_type_to_func(cfg->cfg->txfm_type_row);
|
||||
// TODO(sarahparker) must correct for rectangular transforms in follow up
|
||||
const int txfm_size = cfg->row_cfg->txfm_size;
|
||||
const int8_t *shift = cfg->row_cfg->shift;
|
||||
const int8_t *stage_range_col = cfg->col_cfg->stage_range;
|
||||
const int8_t *stage_range_row = cfg->row_cfg->stage_range;
|
||||
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;
|
||||
|
|
@ -117,96 +124,79 @@ void av1_fwd_txfm2d_64x64_c(const int16_t *input, int32_t *output, int stride,
|
|||
fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf);
|
||||
}
|
||||
|
||||
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
|
||||
static const TXFM_2D_CFG *fwd_txfm_cfg_ls[FLIPADST_ADST + 1][TX_SIZES] = {
|
||||
// FLIPADST
|
||||
{
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
NULL,
|
||||
#endif
|
||||
&fwd_txfm_2d_cfg_dct_dct_4, &fwd_txfm_2d_cfg_dct_dct_8,
|
||||
&fwd_txfm_2d_cfg_dct_dct_16, &fwd_txfm_2d_cfg_dct_dct_32 },
|
||||
&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_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
NULL,
|
||||
#endif
|
||||
&fwd_txfm_2d_cfg_adst_dct_4, &fwd_txfm_2d_cfg_adst_dct_8,
|
||||
&fwd_txfm_2d_cfg_adst_dct_16, &fwd_txfm_2d_cfg_adst_dct_32 },
|
||||
{
|
||||
#if CONFIG_CB4X4
|
||||
NULL,
|
||||
#endif
|
||||
&fwd_txfm_2d_cfg_dct_adst_4, &fwd_txfm_2d_cfg_dct_adst_8,
|
||||
&fwd_txfm_2d_cfg_dct_adst_16, &fwd_txfm_2d_cfg_dct_adst_32 },
|
||||
{
|
||||
#if CONFIG_CB4X4
|
||||
NULL,
|
||||
#endif
|
||||
&fwd_txfm_2d_cfg_adst_adst_4, &fwd_txfm_2d_cfg_adst_adst_8,
|
||||
&fwd_txfm_2d_cfg_adst_adst_16, &fwd_txfm_2d_cfg_adst_adst_32 },
|
||||
{
|
||||
#if CONFIG_CB4X4
|
||||
NULL,
|
||||
#endif
|
||||
&fwd_txfm_2d_cfg_adst_dct_4, &fwd_txfm_2d_cfg_adst_dct_8,
|
||||
&fwd_txfm_2d_cfg_adst_dct_16, &fwd_txfm_2d_cfg_adst_dct_32 },
|
||||
{
|
||||
#if CONFIG_CB4X4
|
||||
NULL,
|
||||
#endif
|
||||
&fwd_txfm_2d_cfg_dct_adst_4, &fwd_txfm_2d_cfg_dct_adst_8,
|
||||
&fwd_txfm_2d_cfg_dct_adst_16, &fwd_txfm_2d_cfg_dct_adst_32 },
|
||||
{
|
||||
#if CONFIG_CB4X4
|
||||
NULL,
|
||||
#endif
|
||||
&fwd_txfm_2d_cfg_adst_adst_4, &fwd_txfm_2d_cfg_adst_adst_8,
|
||||
&fwd_txfm_2d_cfg_adst_adst_16, &fwd_txfm_2d_cfg_adst_adst_32 },
|
||||
{
|
||||
#if CONFIG_CB4X4
|
||||
NULL,
|
||||
#endif
|
||||
&fwd_txfm_2d_cfg_adst_adst_4, &fwd_txfm_2d_cfg_adst_adst_8,
|
||||
&fwd_txfm_2d_cfg_adst_adst_16, &fwd_txfm_2d_cfg_adst_adst_32 },
|
||||
{
|
||||
#if CONFIG_CB4X4
|
||||
NULL,
|
||||
#endif
|
||||
&fwd_txfm_2d_cfg_adst_adst_4, &fwd_txfm_2d_cfg_adst_adst_8,
|
||||
&fwd_txfm_2d_cfg_adst_adst_16, &fwd_txfm_2d_cfg_adst_adst_32 },
|
||||
};
|
||||
#else // CONFIG_EXT_TX
|
||||
static const TXFM_2D_CFG *fwd_txfm_cfg_ls[TX_TYPES][TX_SIZES] = {
|
||||
{
|
||||
#if CONFIG_CB4X4
|
||||
NULL,
|
||||
#endif
|
||||
&fwd_txfm_2d_cfg_dct_dct_4, &fwd_txfm_2d_cfg_dct_dct_8,
|
||||
&fwd_txfm_2d_cfg_dct_dct_16, &fwd_txfm_2d_cfg_dct_dct_32 },
|
||||
{
|
||||
#if CONFIG_CB4X4
|
||||
NULL,
|
||||
#endif
|
||||
&fwd_txfm_2d_cfg_adst_dct_4, &fwd_txfm_2d_cfg_adst_dct_8,
|
||||
&fwd_txfm_2d_cfg_adst_dct_16, &fwd_txfm_2d_cfg_adst_dct_32 },
|
||||
{
|
||||
#if CONFIG_CB4X4
|
||||
NULL,
|
||||
#endif
|
||||
&fwd_txfm_2d_cfg_dct_adst_4, &fwd_txfm_2d_cfg_dct_adst_8,
|
||||
&fwd_txfm_2d_cfg_dct_adst_16, &fwd_txfm_2d_cfg_dct_adst_32 },
|
||||
{
|
||||
#if CONFIG_CB4X4
|
||||
NULL,
|
||||
#endif
|
||||
&fwd_txfm_2d_cfg_adst_adst_4, &fwd_txfm_2d_cfg_adst_adst_8,
|
||||
&fwd_txfm_2d_cfg_adst_adst_16, &fwd_txfm_2d_cfg_adst_adst_32 },
|
||||
};
|
||||
&fwd_txfm_1d_cfg_identity_4, &fwd_txfm_1d_cfg_identity_8,
|
||||
&fwd_txfm_1d_cfg_identity_16, &fwd_txfm_1d_cfg_identity_32 },
|
||||
#endif // CONFIG_EXT_TX
|
||||
};
|
||||
|
||||
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(int tx_type, int tx_size) {
|
||||
TXFM_2D_FLIP_CFG cfg;
|
||||
set_flip_cfg(tx_type, &cfg);
|
||||
cfg.cfg = fwd_txfm_cfg_ls[tx_type][tx_size];
|
||||
int tx_type_col = vtx_tab[tx_type];
|
||||
int tx_type_row = htx_tab[tx_type];
|
||||
cfg.col_cfg = fwd_txfm_col_cfg_ls[tx_type_col][tx_size];
|
||||
cfg.row_cfg = fwd_txfm_row_cfg_ls[tx_type_row][tx_size];
|
||||
return cfg;
|
||||
}
|
||||
|
||||
|
|
@ -214,13 +204,11 @@ TXFM_2D_FLIP_CFG av1_get_fwd_txfm_64x64_cfg(int tx_type) {
|
|||
TXFM_2D_FLIP_CFG cfg;
|
||||
switch (tx_type) {
|
||||
case DCT_DCT:
|
||||
cfg.cfg = &fwd_txfm_2d_cfg_dct_dct_64;
|
||||
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;
|
||||
case ADST_DCT:
|
||||
case DCT_ADST:
|
||||
case ADST_ADST:
|
||||
default:
|
||||
cfg.ud_flip = 0;
|
||||
cfg.lr_flip = 0;
|
||||
|
|
|
|||
444
third_party/aom/av1/common/av1_fwd_txfm2d_cfg.h
vendored
444
third_party/aom/av1/common/av1_fwd_txfm2d_cfg.h
vendored
|
|
@ -1,444 +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"
|
||||
// ---------------- config fwd_dct_dct_4 ----------------
|
||||
static const int8_t fwd_shift_dct_dct_4[3] = { 2, 0, 0 };
|
||||
static const int8_t fwd_stage_range_col_dct_dct_4[4] = { 15, 16, 17, 17 };
|
||||
static const int8_t fwd_stage_range_row_dct_dct_4[4] = { 17, 18, 18, 18 };
|
||||
static const int8_t fwd_cos_bit_col_dct_dct_4[4] = { 13, 13, 13, 13 };
|
||||
static const int8_t fwd_cos_bit_row_dct_dct_4[4] = { 13, 13, 13, 13 };
|
||||
|
||||
static const TXFM_2D_CFG fwd_txfm_2d_cfg_dct_dct_4 = {
|
||||
4, // .txfm_size
|
||||
4, // .stage_num_col
|
||||
4, // .stage_num_row
|
||||
// 0, // .log_scale
|
||||
fwd_shift_dct_dct_4, // .shift
|
||||
fwd_stage_range_col_dct_dct_4, // .stage_range_col
|
||||
fwd_stage_range_row_dct_dct_4, // .stage_range_row
|
||||
fwd_cos_bit_col_dct_dct_4, // .cos_bit_col
|
||||
fwd_cos_bit_row_dct_dct_4, // .cos_bit_row
|
||||
TXFM_TYPE_DCT4, // .txfm_type_col
|
||||
TXFM_TYPE_DCT4
|
||||
}; // .txfm_type_row
|
||||
|
||||
// ---------------- config fwd_dct_dct_8 ----------------
|
||||
static const int8_t fwd_shift_dct_dct_8[3] = { 2, -1, 0 };
|
||||
static const int8_t fwd_stage_range_col_dct_dct_8[6] = {
|
||||
15, 16, 17, 18, 18, 18
|
||||
};
|
||||
static const int8_t fwd_stage_range_row_dct_dct_8[6] = {
|
||||
17, 18, 19, 19, 19, 19
|
||||
};
|
||||
static const int8_t fwd_cos_bit_col_dct_dct_8[6] = { 13, 13, 13, 13, 13, 13 };
|
||||
static const int8_t fwd_cos_bit_row_dct_dct_8[6] = { 13, 13, 13, 13, 13, 13 };
|
||||
|
||||
static const TXFM_2D_CFG fwd_txfm_2d_cfg_dct_dct_8 = {
|
||||
8, // .txfm_size
|
||||
6, // .stage_num_col
|
||||
6, // .stage_num_row
|
||||
// 0, // .log_scale
|
||||
fwd_shift_dct_dct_8, // .shift
|
||||
fwd_stage_range_col_dct_dct_8, // .stage_range_col
|
||||
fwd_stage_range_row_dct_dct_8, // .stage_range_row
|
||||
fwd_cos_bit_col_dct_dct_8, // .cos_bit_col
|
||||
fwd_cos_bit_row_dct_dct_8, // .cos_bit_row
|
||||
TXFM_TYPE_DCT8, // .txfm_type_col
|
||||
TXFM_TYPE_DCT8
|
||||
}; // .txfm_type_row
|
||||
|
||||
// ---------------- config fwd_dct_dct_16 ----------------
|
||||
static const int8_t fwd_shift_dct_dct_16[3] = { 2, -2, 0 };
|
||||
static const int8_t fwd_stage_range_col_dct_dct_16[8] = { 15, 16, 17, 18,
|
||||
19, 19, 19, 19 };
|
||||
static const int8_t fwd_stage_range_row_dct_dct_16[8] = { 17, 18, 19, 20,
|
||||
20, 20, 20, 20 };
|
||||
static const int8_t fwd_cos_bit_col_dct_dct_16[8] = { 13, 13, 13, 13,
|
||||
13, 13, 13, 13 };
|
||||
static const int8_t fwd_cos_bit_row_dct_dct_16[8] = { 12, 12, 12, 12,
|
||||
12, 12, 12, 12 };
|
||||
|
||||
static const TXFM_2D_CFG fwd_txfm_2d_cfg_dct_dct_16 = {
|
||||
16, // .txfm_size
|
||||
8, // .stage_num_col
|
||||
8, // .stage_num_row
|
||||
// 0, // .log_scale
|
||||
fwd_shift_dct_dct_16, // .shift
|
||||
fwd_stage_range_col_dct_dct_16, // .stage_range_col
|
||||
fwd_stage_range_row_dct_dct_16, // .stage_range_row
|
||||
fwd_cos_bit_col_dct_dct_16, // .cos_bit_col
|
||||
fwd_cos_bit_row_dct_dct_16, // .cos_bit_row
|
||||
TXFM_TYPE_DCT16, // .txfm_type_col
|
||||
TXFM_TYPE_DCT16
|
||||
}; // .txfm_type_row
|
||||
|
||||
// ---------------- config fwd_dct_dct_32 ----------------
|
||||
static const int8_t fwd_shift_dct_dct_32[3] = { 2, -4, 0 };
|
||||
static const int8_t fwd_stage_range_col_dct_dct_32[10] = { 15, 16, 17, 18, 19,
|
||||
20, 20, 20, 20, 20 };
|
||||
static const int8_t fwd_stage_range_row_dct_dct_32[10] = { 16, 17, 18, 19, 20,
|
||||
20, 20, 20, 20, 20 };
|
||||
static const int8_t fwd_cos_bit_col_dct_dct_32[10] = { 12, 12, 12, 12, 12,
|
||||
12, 12, 12, 12, 12 };
|
||||
static const int8_t fwd_cos_bit_row_dct_dct_32[10] = { 12, 12, 12, 12, 12,
|
||||
12, 12, 12, 12, 12 };
|
||||
|
||||
static const TXFM_2D_CFG fwd_txfm_2d_cfg_dct_dct_32 = {
|
||||
32, // .txfm_size
|
||||
10, // .stage_num_col
|
||||
10, // .stage_num_row
|
||||
// 1, // .log_scale
|
||||
fwd_shift_dct_dct_32, // .shift
|
||||
fwd_stage_range_col_dct_dct_32, // .stage_range_col
|
||||
fwd_stage_range_row_dct_dct_32, // .stage_range_row
|
||||
fwd_cos_bit_col_dct_dct_32, // .cos_bit_col
|
||||
fwd_cos_bit_row_dct_dct_32, // .cos_bit_row
|
||||
TXFM_TYPE_DCT32, // .txfm_type_col
|
||||
TXFM_TYPE_DCT32
|
||||
}; // .txfm_type_row
|
||||
|
||||
// ---------------- config fwd_dct_dct_64 ----------------
|
||||
static const int8_t fwd_shift_dct_dct_64[3] = { 0, -2, -2 };
|
||||
static const int8_t fwd_stage_range_col_dct_dct_64[12] = {
|
||||
13, 14, 15, 16, 17, 18, 19, 19, 19, 19, 19, 19
|
||||
};
|
||||
static const int8_t fwd_stage_range_row_dct_dct_64[12] = {
|
||||
17, 18, 19, 20, 21, 22, 22, 22, 22, 22, 22, 22
|
||||
};
|
||||
static const int8_t fwd_cos_bit_col_dct_dct_64[12] = { 15, 15, 15, 15, 15, 14,
|
||||
13, 13, 13, 13, 13, 13 };
|
||||
static const int8_t fwd_cos_bit_row_dct_dct_64[12] = { 15, 14, 13, 12, 11, 10,
|
||||
10, 10, 10, 10, 10, 10 };
|
||||
|
||||
static const TXFM_2D_CFG fwd_txfm_2d_cfg_dct_dct_64 = {
|
||||
64, // .txfm_size
|
||||
12, // .stage_num_col
|
||||
12, // .stage_num_row
|
||||
fwd_shift_dct_dct_64, // .shift
|
||||
fwd_stage_range_col_dct_dct_64, // .stage_range_col
|
||||
fwd_stage_range_row_dct_dct_64, // .stage_range_row
|
||||
fwd_cos_bit_col_dct_dct_64, // .cos_bit_col
|
||||
fwd_cos_bit_row_dct_dct_64, // .cos_bit_row
|
||||
TXFM_TYPE_DCT64, // .txfm_type_col
|
||||
TXFM_TYPE_DCT64
|
||||
}; // .txfm_type_row
|
||||
|
||||
// ---------------- config fwd_dct_adst_4 ----------------
|
||||
static const int8_t fwd_shift_dct_adst_4[3] = { 2, 0, 0 };
|
||||
static const int8_t fwd_stage_range_col_dct_adst_4[4] = { 15, 16, 17, 17 };
|
||||
static const int8_t fwd_stage_range_row_dct_adst_4[6] = {
|
||||
17, 17, 17, 18, 18, 18
|
||||
};
|
||||
static const int8_t fwd_cos_bit_col_dct_adst_4[4] = { 13, 13, 13, 13 };
|
||||
static const int8_t fwd_cos_bit_row_dct_adst_4[6] = { 13, 13, 13, 13, 13, 13 };
|
||||
|
||||
static const TXFM_2D_CFG fwd_txfm_2d_cfg_dct_adst_4 = {
|
||||
4, // .txfm_size
|
||||
4, // .stage_num_col
|
||||
6, // .stage_num_row
|
||||
// 0, // .log_scale
|
||||
fwd_shift_dct_adst_4, // .shift
|
||||
fwd_stage_range_col_dct_adst_4, // .stage_range_col
|
||||
fwd_stage_range_row_dct_adst_4, // .stage_range_row
|
||||
fwd_cos_bit_col_dct_adst_4, // .cos_bit_col
|
||||
fwd_cos_bit_row_dct_adst_4, // .cos_bit_row
|
||||
TXFM_TYPE_DCT4, // .txfm_type_col
|
||||
TXFM_TYPE_ADST4
|
||||
}; // .txfm_type_row
|
||||
|
||||
// ---------------- config fwd_dct_adst_8 ----------------
|
||||
static const int8_t fwd_shift_dct_adst_8[3] = { 2, -1, 0 };
|
||||
static const int8_t fwd_stage_range_col_dct_adst_8[6] = {
|
||||
15, 16, 17, 18, 18, 18
|
||||
};
|
||||
static const int8_t fwd_stage_range_row_dct_adst_8[8] = { 17, 17, 17, 18,
|
||||
18, 19, 19, 19 };
|
||||
static const int8_t fwd_cos_bit_col_dct_adst_8[6] = { 13, 13, 13, 13, 13, 13 };
|
||||
static const int8_t fwd_cos_bit_row_dct_adst_8[8] = { 13, 13, 13, 13,
|
||||
13, 13, 13, 13 };
|
||||
|
||||
static const TXFM_2D_CFG fwd_txfm_2d_cfg_dct_adst_8 = {
|
||||
8, // .txfm_size
|
||||
6, // .stage_num_col
|
||||
8, // .stage_num_row
|
||||
// 0, // .log_scale
|
||||
fwd_shift_dct_adst_8, // .shift
|
||||
fwd_stage_range_col_dct_adst_8, // .stage_range_col
|
||||
fwd_stage_range_row_dct_adst_8, // .stage_range_row
|
||||
fwd_cos_bit_col_dct_adst_8, // .cos_bit_col
|
||||
fwd_cos_bit_row_dct_adst_8, // .cos_bit_row
|
||||
TXFM_TYPE_DCT8, // .txfm_type_col
|
||||
TXFM_TYPE_ADST8
|
||||
}; // .txfm_type_row
|
||||
|
||||
// ---------------- config fwd_dct_adst_16 ----------------
|
||||
static const int8_t fwd_shift_dct_adst_16[3] = { 2, -2, 0 };
|
||||
static const int8_t fwd_stage_range_col_dct_adst_16[8] = { 15, 16, 17, 18,
|
||||
19, 19, 19, 19 };
|
||||
static const int8_t fwd_stage_range_row_dct_adst_16[10] = {
|
||||
17, 17, 17, 18, 18, 19, 19, 20, 20, 20
|
||||
};
|
||||
static const int8_t fwd_cos_bit_col_dct_adst_16[8] = { 13, 13, 13, 13,
|
||||
13, 13, 13, 13 };
|
||||
static const int8_t fwd_cos_bit_row_dct_adst_16[10] = { 12, 12, 12, 12, 12,
|
||||
12, 12, 12, 12, 12 };
|
||||
|
||||
static const TXFM_2D_CFG fwd_txfm_2d_cfg_dct_adst_16 = {
|
||||
16, // .txfm_size
|
||||
8, // .stage_num_col
|
||||
10, // .stage_num_row
|
||||
// 0, // .log_scale
|
||||
fwd_shift_dct_adst_16, // .shift
|
||||
fwd_stage_range_col_dct_adst_16, // .stage_range_col
|
||||
fwd_stage_range_row_dct_adst_16, // .stage_range_row
|
||||
fwd_cos_bit_col_dct_adst_16, // .cos_bit_col
|
||||
fwd_cos_bit_row_dct_adst_16, // .cos_bit_row
|
||||
TXFM_TYPE_DCT16, // .txfm_type_col
|
||||
TXFM_TYPE_ADST16
|
||||
}; // .txfm_type_row
|
||||
|
||||
// ---------------- config fwd_dct_adst_32 ----------------
|
||||
static const int8_t fwd_shift_dct_adst_32[3] = { 2, -4, 0 };
|
||||
static const int8_t fwd_stage_range_col_dct_adst_32[10] = {
|
||||
15, 16, 17, 18, 19, 20, 20, 20, 20, 20
|
||||
};
|
||||
static const int8_t fwd_stage_range_row_dct_adst_32[12] = {
|
||||
16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 20
|
||||
};
|
||||
static const int8_t fwd_cos_bit_col_dct_adst_32[10] = { 12, 12, 12, 12, 12,
|
||||
12, 12, 12, 12, 12 };
|
||||
static const int8_t fwd_cos_bit_row_dct_adst_32[12] = {
|
||||
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12
|
||||
};
|
||||
|
||||
static const TXFM_2D_CFG fwd_txfm_2d_cfg_dct_adst_32 = {
|
||||
32, // .txfm_size
|
||||
10, // .stage_num_col
|
||||
12, // .stage_num_row
|
||||
// 1, // .log_scale
|
||||
fwd_shift_dct_adst_32, // .shift
|
||||
fwd_stage_range_col_dct_adst_32, // .stage_range_col
|
||||
fwd_stage_range_row_dct_adst_32, // .stage_range_row
|
||||
fwd_cos_bit_col_dct_adst_32, // .cos_bit_col
|
||||
fwd_cos_bit_row_dct_adst_32, // .cos_bit_row
|
||||
TXFM_TYPE_DCT32, // .txfm_type_col
|
||||
TXFM_TYPE_ADST32
|
||||
}; // .txfm_type_row
|
||||
// ---------------- config fwd_adst_adst_4 ----------------
|
||||
static const int8_t fwd_shift_adst_adst_4[3] = { 2, 0, 0 };
|
||||
static const int8_t fwd_stage_range_col_adst_adst_4[6] = { 15, 15, 16,
|
||||
17, 17, 17 };
|
||||
static const int8_t fwd_stage_range_row_adst_adst_4[6] = { 17, 17, 17,
|
||||
18, 18, 18 };
|
||||
static const int8_t fwd_cos_bit_col_adst_adst_4[6] = { 13, 13, 13, 13, 13, 13 };
|
||||
static const int8_t fwd_cos_bit_row_adst_adst_4[6] = { 13, 13, 13, 13, 13, 13 };
|
||||
|
||||
static const TXFM_2D_CFG fwd_txfm_2d_cfg_adst_adst_4 = {
|
||||
4, // .txfm_size
|
||||
6, // .stage_num_col
|
||||
6, // .stage_num_row
|
||||
// 0, // .log_scale
|
||||
fwd_shift_adst_adst_4, // .shift
|
||||
fwd_stage_range_col_adst_adst_4, // .stage_range_col
|
||||
fwd_stage_range_row_adst_adst_4, // .stage_range_row
|
||||
fwd_cos_bit_col_adst_adst_4, // .cos_bit_col
|
||||
fwd_cos_bit_row_adst_adst_4, // .cos_bit_row
|
||||
TXFM_TYPE_ADST4, // .txfm_type_col
|
||||
TXFM_TYPE_ADST4
|
||||
}; // .txfm_type_row
|
||||
|
||||
// ---------------- config fwd_adst_adst_8 ----------------
|
||||
static const int8_t fwd_shift_adst_adst_8[3] = { 2, -1, 0 };
|
||||
static const int8_t fwd_stage_range_col_adst_adst_8[8] = { 15, 15, 16, 17,
|
||||
17, 18, 18, 18 };
|
||||
static const int8_t fwd_stage_range_row_adst_adst_8[8] = { 17, 17, 17, 18,
|
||||
18, 19, 19, 19 };
|
||||
static const int8_t fwd_cos_bit_col_adst_adst_8[8] = { 13, 13, 13, 13,
|
||||
13, 13, 13, 13 };
|
||||
static const int8_t fwd_cos_bit_row_adst_adst_8[8] = { 13, 13, 13, 13,
|
||||
13, 13, 13, 13 };
|
||||
|
||||
static const TXFM_2D_CFG fwd_txfm_2d_cfg_adst_adst_8 = {
|
||||
8, // .txfm_size
|
||||
8, // .stage_num_col
|
||||
8, // .stage_num_row
|
||||
// 0, // .log_scale
|
||||
fwd_shift_adst_adst_8, // .shift
|
||||
fwd_stage_range_col_adst_adst_8, // .stage_range_col
|
||||
fwd_stage_range_row_adst_adst_8, // .stage_range_row
|
||||
fwd_cos_bit_col_adst_adst_8, // .cos_bit_col
|
||||
fwd_cos_bit_row_adst_adst_8, // .cos_bit_row
|
||||
TXFM_TYPE_ADST8, // .txfm_type_col
|
||||
TXFM_TYPE_ADST8
|
||||
}; // .txfm_type_row
|
||||
|
||||
// ---------------- config fwd_adst_adst_16 ----------------
|
||||
static const int8_t fwd_shift_adst_adst_16[3] = { 2, -2, 0 };
|
||||
static const int8_t fwd_stage_range_col_adst_adst_16[10] = {
|
||||
15, 15, 16, 17, 17, 18, 18, 19, 19, 19
|
||||
};
|
||||
static const int8_t fwd_stage_range_row_adst_adst_16[10] = {
|
||||
17, 17, 17, 18, 18, 19, 19, 20, 20, 20
|
||||
};
|
||||
static const int8_t fwd_cos_bit_col_adst_adst_16[10] = { 13, 13, 13, 13, 13,
|
||||
13, 13, 13, 13, 13 };
|
||||
static const int8_t fwd_cos_bit_row_adst_adst_16[10] = { 12, 12, 12, 12, 12,
|
||||
12, 12, 12, 12, 12 };
|
||||
|
||||
static const TXFM_2D_CFG fwd_txfm_2d_cfg_adst_adst_16 = {
|
||||
16, // .txfm_size
|
||||
10, // .stage_num_col
|
||||
10, // .stage_num_row
|
||||
// 0, // .log_scale
|
||||
fwd_shift_adst_adst_16, // .shift
|
||||
fwd_stage_range_col_adst_adst_16, // .stage_range_col
|
||||
fwd_stage_range_row_adst_adst_16, // .stage_range_row
|
||||
fwd_cos_bit_col_adst_adst_16, // .cos_bit_col
|
||||
fwd_cos_bit_row_adst_adst_16, // .cos_bit_row
|
||||
TXFM_TYPE_ADST16, // .txfm_type_col
|
||||
TXFM_TYPE_ADST16
|
||||
}; // .txfm_type_row
|
||||
|
||||
// ---------------- config fwd_adst_adst_32 ----------------
|
||||
static const int8_t fwd_shift_adst_adst_32[3] = { 2, -4, 0 };
|
||||
static const int8_t fwd_stage_range_col_adst_adst_32[12] = {
|
||||
15, 15, 16, 17, 17, 18, 18, 19, 19, 20, 20, 20
|
||||
};
|
||||
static const int8_t fwd_stage_range_row_adst_adst_32[12] = {
|
||||
16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 20
|
||||
};
|
||||
static const int8_t fwd_cos_bit_col_adst_adst_32[12] = {
|
||||
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12
|
||||
};
|
||||
static const int8_t fwd_cos_bit_row_adst_adst_32[12] = {
|
||||
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12
|
||||
};
|
||||
|
||||
static const TXFM_2D_CFG fwd_txfm_2d_cfg_adst_adst_32 = {
|
||||
32, // .txfm_size
|
||||
12, // .stage_num_col
|
||||
12, // .stage_num_row
|
||||
// 1, // .log_scale
|
||||
fwd_shift_adst_adst_32, // .shift
|
||||
fwd_stage_range_col_adst_adst_32, // .stage_range_col
|
||||
fwd_stage_range_row_adst_adst_32, // .stage_range_row
|
||||
fwd_cos_bit_col_adst_adst_32, // .cos_bit_col
|
||||
fwd_cos_bit_row_adst_adst_32, // .cos_bit_row
|
||||
TXFM_TYPE_ADST32, // .txfm_type_col
|
||||
TXFM_TYPE_ADST32
|
||||
}; // .txfm_type_row
|
||||
|
||||
// ---------------- config fwd_adst_dct_4 ----------------
|
||||
static const int8_t fwd_shift_adst_dct_4[3] = { 2, 0, 0 };
|
||||
static const int8_t fwd_stage_range_col_adst_dct_4[6] = {
|
||||
15, 15, 16, 17, 17, 17
|
||||
};
|
||||
static const int8_t fwd_stage_range_row_adst_dct_4[4] = { 17, 18, 18, 18 };
|
||||
static const int8_t fwd_cos_bit_col_adst_dct_4[6] = { 13, 13, 13, 13, 13, 13 };
|
||||
static const int8_t fwd_cos_bit_row_adst_dct_4[4] = { 13, 13, 13, 13 };
|
||||
|
||||
static const TXFM_2D_CFG fwd_txfm_2d_cfg_adst_dct_4 = {
|
||||
4, // .txfm_size
|
||||
6, // .stage_num_col
|
||||
4, // .stage_num_row
|
||||
// 0, // .log_scale
|
||||
fwd_shift_adst_dct_4, // .shift
|
||||
fwd_stage_range_col_adst_dct_4, // .stage_range_col
|
||||
fwd_stage_range_row_adst_dct_4, // .stage_range_row
|
||||
fwd_cos_bit_col_adst_dct_4, // .cos_bit_col
|
||||
fwd_cos_bit_row_adst_dct_4, // .cos_bit_row
|
||||
TXFM_TYPE_ADST4, // .txfm_type_col
|
||||
TXFM_TYPE_DCT4
|
||||
}; // .txfm_type_row
|
||||
|
||||
// ---------------- config fwd_adst_dct_8 ----------------
|
||||
static const int8_t fwd_shift_adst_dct_8[3] = { 2, -1, 0 };
|
||||
static const int8_t fwd_stage_range_col_adst_dct_8[8] = { 15, 15, 16, 17,
|
||||
17, 18, 18, 18 };
|
||||
static const int8_t fwd_stage_range_row_adst_dct_8[6] = {
|
||||
17, 18, 19, 19, 19, 19
|
||||
};
|
||||
static const int8_t fwd_cos_bit_col_adst_dct_8[8] = { 13, 13, 13, 13,
|
||||
13, 13, 13, 13 };
|
||||
static const int8_t fwd_cos_bit_row_adst_dct_8[6] = { 13, 13, 13, 13, 13, 13 };
|
||||
|
||||
static const TXFM_2D_CFG fwd_txfm_2d_cfg_adst_dct_8 = {
|
||||
8, // .txfm_size
|
||||
8, // .stage_num_col
|
||||
6, // .stage_num_row
|
||||
// 0, // .log_scale
|
||||
fwd_shift_adst_dct_8, // .shift
|
||||
fwd_stage_range_col_adst_dct_8, // .stage_range_col
|
||||
fwd_stage_range_row_adst_dct_8, // .stage_range_row
|
||||
fwd_cos_bit_col_adst_dct_8, // .cos_bit_col
|
||||
fwd_cos_bit_row_adst_dct_8, // .cos_bit_row
|
||||
TXFM_TYPE_ADST8, // .txfm_type_col
|
||||
TXFM_TYPE_DCT8
|
||||
}; // .txfm_type_row
|
||||
|
||||
// ---------------- config fwd_adst_dct_16 ----------------
|
||||
static const int8_t fwd_shift_adst_dct_16[3] = { 2, -2, 0 };
|
||||
static const int8_t fwd_stage_range_col_adst_dct_16[10] = {
|
||||
15, 15, 16, 17, 17, 18, 18, 19, 19, 19
|
||||
};
|
||||
static const int8_t fwd_stage_range_row_adst_dct_16[8] = { 17, 18, 19, 20,
|
||||
20, 20, 20, 20 };
|
||||
static const int8_t fwd_cos_bit_col_adst_dct_16[10] = { 13, 13, 13, 13, 13,
|
||||
13, 13, 13, 13, 13 };
|
||||
static const int8_t fwd_cos_bit_row_adst_dct_16[8] = { 12, 12, 12, 12,
|
||||
12, 12, 12, 12 };
|
||||
|
||||
static const TXFM_2D_CFG fwd_txfm_2d_cfg_adst_dct_16 = {
|
||||
16, // .txfm_size
|
||||
10, // .stage_num_col
|
||||
8, // .stage_num_row
|
||||
// 0, // .log_scale
|
||||
fwd_shift_adst_dct_16, // .shift
|
||||
fwd_stage_range_col_adst_dct_16, // .stage_range_col
|
||||
fwd_stage_range_row_adst_dct_16, // .stage_range_row
|
||||
fwd_cos_bit_col_adst_dct_16, // .cos_bit_col
|
||||
fwd_cos_bit_row_adst_dct_16, // .cos_bit_row
|
||||
TXFM_TYPE_ADST16, // .txfm_type_col
|
||||
TXFM_TYPE_DCT16
|
||||
}; // .txfm_type_row
|
||||
|
||||
// ---------------- config fwd_adst_dct_32 ----------------
|
||||
static const int8_t fwd_shift_adst_dct_32[3] = { 2, -4, 0 };
|
||||
static const int8_t fwd_stage_range_col_adst_dct_32[12] = {
|
||||
15, 15, 16, 17, 17, 18, 18, 19, 19, 20, 20, 20
|
||||
};
|
||||
static const int8_t fwd_stage_range_row_adst_dct_32[10] = {
|
||||
16, 17, 18, 19, 20, 20, 20, 20, 20, 20
|
||||
};
|
||||
static const int8_t fwd_cos_bit_col_adst_dct_32[12] = {
|
||||
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12
|
||||
};
|
||||
static const int8_t fwd_cos_bit_row_adst_dct_32[10] = { 12, 12, 12, 12, 12,
|
||||
12, 12, 12, 12, 12 };
|
||||
|
||||
static const TXFM_2D_CFG fwd_txfm_2d_cfg_adst_dct_32 = {
|
||||
32, // .txfm_size
|
||||
12, // .stage_num_col
|
||||
10, // .stage_num_row
|
||||
// 1, // .log_scale
|
||||
fwd_shift_adst_dct_32, // .shift
|
||||
fwd_stage_range_col_adst_dct_32, // .stage_range_col
|
||||
fwd_stage_range_row_adst_dct_32, // .stage_range_row
|
||||
fwd_cos_bit_col_adst_dct_32, // .cos_bit_col
|
||||
fwd_cos_bit_row_adst_dct_32, // .cos_bit_row
|
||||
TXFM_TYPE_ADST32, // .txfm_type_col
|
||||
TXFM_TYPE_DCT32
|
||||
}; // .txfm_type_row
|
||||
#endif // AV1_FWD_TXFM2D_CFG_H_
|
||||
124
third_party/aom/av1/common/av1_inv_txfm1d.c
vendored
124
third_party/aom/av1/common/av1_inv_txfm1d.c
vendored
|
|
@ -10,6 +10,7 @@
|
|||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "aom_dsp/inv_txfm.h"
|
||||
#include "av1/common/av1_inv_txfm1d.h"
|
||||
#if CONFIG_COEFFICIENT_RANGE_CHECKING
|
||||
|
||||
|
|
@ -66,6 +67,7 @@ void av1_idct4_new(const int32_t *input, int32_t *output, const int8_t *cos_bit,
|
|||
|
||||
// stage 1;
|
||||
stage++;
|
||||
assert(output != input);
|
||||
bf1 = output;
|
||||
bf1[0] = input[0];
|
||||
bf1[1] = input[2];
|
||||
|
|
@ -75,7 +77,7 @@ void av1_idct4_new(const int32_t *input, int32_t *output, const int8_t *cos_bit,
|
|||
|
||||
// stage 2
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = half_btf(cospi[32], bf0[0], cospi[32], bf0[1], cos_bit[stage]);
|
||||
|
|
@ -109,6 +111,7 @@ void av1_idct8_new(const int32_t *input, int32_t *output, const int8_t *cos_bit,
|
|||
|
||||
// stage 1;
|
||||
stage++;
|
||||
assert(output != input);
|
||||
bf1 = output;
|
||||
bf1[0] = input[0];
|
||||
bf1[1] = input[4];
|
||||
|
|
@ -122,7 +125,7 @@ void av1_idct8_new(const int32_t *input, int32_t *output, const int8_t *cos_bit,
|
|||
|
||||
// stage 2
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = bf0[0];
|
||||
|
|
@ -137,7 +140,7 @@ void av1_idct8_new(const int32_t *input, int32_t *output, const int8_t *cos_bit,
|
|||
|
||||
// stage 3
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = step;
|
||||
bf1 = output;
|
||||
bf1[0] = half_btf(cospi[32], bf0[0], cospi[32], bf0[1], cos_bit[stage]);
|
||||
|
|
@ -152,7 +155,7 @@ void av1_idct8_new(const int32_t *input, int32_t *output, const int8_t *cos_bit,
|
|||
|
||||
// stage 4
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = bf0[0] + bf0[3];
|
||||
|
|
@ -194,6 +197,7 @@ void av1_idct16_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 1;
|
||||
stage++;
|
||||
assert(output != input);
|
||||
bf1 = output;
|
||||
bf1[0] = input[0];
|
||||
bf1[1] = input[8];
|
||||
|
|
@ -215,7 +219,7 @@ void av1_idct16_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 2
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = bf0[0];
|
||||
|
|
@ -238,7 +242,7 @@ void av1_idct16_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 3
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = step;
|
||||
bf1 = output;
|
||||
bf1[0] = bf0[0];
|
||||
|
|
@ -261,7 +265,7 @@ void av1_idct16_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 4
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = half_btf(cospi[32], bf0[0], cospi[32], bf0[1], cos_bit[stage]);
|
||||
|
|
@ -284,7 +288,7 @@ void av1_idct16_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 5
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = step;
|
||||
bf1 = output;
|
||||
bf1[0] = bf0[0] + bf0[3];
|
||||
|
|
@ -307,7 +311,7 @@ void av1_idct16_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 6
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = bf0[0] + bf0[7];
|
||||
|
|
@ -365,6 +369,7 @@ void av1_idct32_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 1;
|
||||
stage++;
|
||||
assert(output != input);
|
||||
bf1 = output;
|
||||
bf1[0] = input[0];
|
||||
bf1[1] = input[16];
|
||||
|
|
@ -402,7 +407,7 @@ void av1_idct32_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 2
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = bf0[0];
|
||||
|
|
@ -441,7 +446,7 @@ void av1_idct32_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 3
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = step;
|
||||
bf1 = output;
|
||||
bf1[0] = bf0[0];
|
||||
|
|
@ -480,7 +485,7 @@ void av1_idct32_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 4
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = bf0[0];
|
||||
|
|
@ -519,7 +524,7 @@ void av1_idct32_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 5
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = step;
|
||||
bf1 = output;
|
||||
bf1[0] = half_btf(cospi[32], bf0[0], cospi[32], bf0[1], cos_bit[stage]);
|
||||
|
|
@ -558,7 +563,7 @@ void av1_idct32_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 6
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = bf0[0] + bf0[3];
|
||||
|
|
@ -597,7 +602,7 @@ void av1_idct32_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 7
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = step;
|
||||
bf1 = output;
|
||||
bf1[0] = bf0[0] + bf0[7];
|
||||
|
|
@ -636,7 +641,7 @@ void av1_idct32_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 8
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = bf0[0] + bf0[15];
|
||||
|
|
@ -726,6 +731,7 @@ void av1_iadst4_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 1;
|
||||
stage++;
|
||||
assert(output != input);
|
||||
bf1 = output;
|
||||
bf1[0] = input[0];
|
||||
bf1[1] = -input[3];
|
||||
|
|
@ -735,7 +741,7 @@ void av1_iadst4_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 2
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = bf0[0];
|
||||
|
|
@ -756,7 +762,7 @@ void av1_iadst4_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 4
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = half_btf(cospi[8], bf0[0], cospi[56], bf0[1], cos_bit[stage]);
|
||||
|
|
@ -790,6 +796,7 @@ void av1_iadst8_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 1;
|
||||
stage++;
|
||||
assert(output != input);
|
||||
bf1 = output;
|
||||
bf1[0] = input[0];
|
||||
bf1[1] = -input[7];
|
||||
|
|
@ -803,7 +810,7 @@ void av1_iadst8_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 2
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = bf0[0];
|
||||
|
|
@ -832,7 +839,7 @@ void av1_iadst8_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 4
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = bf0[0];
|
||||
|
|
@ -861,7 +868,7 @@ void av1_iadst8_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 6
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = half_btf(cospi[4], bf0[0], cospi[60], bf0[1], cos_bit[stage]);
|
||||
|
|
@ -903,6 +910,7 @@ void av1_iadst16_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 1;
|
||||
stage++;
|
||||
assert(output != input);
|
||||
bf1 = output;
|
||||
bf1[0] = input[0];
|
||||
bf1[1] = -input[15];
|
||||
|
|
@ -924,7 +932,7 @@ void av1_iadst16_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 2
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = bf0[0];
|
||||
|
|
@ -969,7 +977,7 @@ void av1_iadst16_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 4
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = bf0[0];
|
||||
|
|
@ -1014,7 +1022,7 @@ void av1_iadst16_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 6
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = bf0[0];
|
||||
|
|
@ -1059,7 +1067,7 @@ void av1_iadst16_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 8
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = half_btf(cospi[2], bf0[0], cospi[62], bf0[1], cos_bit[stage]);
|
||||
|
|
@ -1117,6 +1125,7 @@ void av1_iadst32_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 1;
|
||||
stage++;
|
||||
assert(output != input);
|
||||
bf1 = output;
|
||||
bf1[0] = input[0];
|
||||
bf1[1] = -input[31];
|
||||
|
|
@ -1154,7 +1163,7 @@ void av1_iadst32_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 2
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = bf0[0];
|
||||
|
|
@ -1231,7 +1240,7 @@ void av1_iadst32_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 4
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = bf0[0];
|
||||
|
|
@ -1308,7 +1317,7 @@ void av1_iadst32_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 6
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = bf0[0];
|
||||
|
|
@ -1385,7 +1394,7 @@ void av1_iadst32_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 8
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = bf0[0];
|
||||
|
|
@ -1462,7 +1471,7 @@ void av1_iadst32_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 10
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = half_btf(cospi[1], bf0[0], cospi[63], bf0[1], cos_bit[stage]);
|
||||
|
|
@ -1538,6 +1547,38 @@ void av1_iadst32_new(const int32_t *input, int32_t *output,
|
|||
range_check(stage, input, bf1, size, stage_range[stage]);
|
||||
}
|
||||
|
||||
#if CONFIG_EXT_TX
|
||||
void av1_iidentity4_c(const int32_t *input, int32_t *output,
|
||||
const int8_t *cos_bit, const int8_t *stage_range) {
|
||||
(void)cos_bit;
|
||||
for (int i = 0; i < 4; ++i)
|
||||
output[i] = (int32_t)dct_const_round_shift(input[i] * Sqrt2);
|
||||
range_check(0, input, output, 4, stage_range[0]);
|
||||
}
|
||||
|
||||
void av1_iidentity8_c(const int32_t *input, int32_t *output,
|
||||
const int8_t *cos_bit, const int8_t *stage_range) {
|
||||
(void)cos_bit;
|
||||
for (int i = 0; i < 8; ++i) output[i] = input[i] * 2;
|
||||
range_check(0, input, output, 8, stage_range[0]);
|
||||
}
|
||||
|
||||
void av1_iidentity16_c(const int32_t *input, int32_t *output,
|
||||
const int8_t *cos_bit, const int8_t *stage_range) {
|
||||
(void)cos_bit;
|
||||
for (int i = 0; i < 16; ++i)
|
||||
output[i] = (int32_t)dct_const_round_shift(input[i] * 2 * Sqrt2);
|
||||
range_check(0, input, output, 16, stage_range[0]);
|
||||
}
|
||||
|
||||
void av1_iidentity32_c(const int32_t *input, int32_t *output,
|
||||
const int8_t *cos_bit, const int8_t *stage_range) {
|
||||
(void)cos_bit;
|
||||
for (int i = 0; i < 32; ++i) output[i] = input[i] * 4;
|
||||
range_check(0, input, output, 32, stage_range[0]);
|
||||
}
|
||||
#endif // CONFIG_EXT_TX
|
||||
|
||||
#if CONFIG_TX64X64
|
||||
void av1_idct64_new(const int32_t *input, int32_t *output,
|
||||
const int8_t *cos_bit, const int8_t *stage_range) {
|
||||
|
|
@ -1553,7 +1594,8 @@ void av1_idct64_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 1;
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
assert(output != input);
|
||||
bf1 = output;
|
||||
bf1[0] = input[0];
|
||||
bf1[1] = input[32];
|
||||
|
|
@ -1623,7 +1665,7 @@ void av1_idct64_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 2
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = bf0[0];
|
||||
|
|
@ -1694,7 +1736,7 @@ void av1_idct64_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 3
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = step;
|
||||
bf1 = output;
|
||||
bf1[0] = bf0[0];
|
||||
|
|
@ -1765,7 +1807,7 @@ void av1_idct64_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 4
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = bf0[0];
|
||||
|
|
@ -1836,7 +1878,7 @@ void av1_idct64_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 5
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = step;
|
||||
bf1 = output;
|
||||
bf1[0] = bf0[0];
|
||||
|
|
@ -1907,7 +1949,7 @@ void av1_idct64_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 6
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = half_btf(cospi[32], bf0[0], cospi[32], bf0[1], cos_bit[stage]);
|
||||
|
|
@ -1978,7 +2020,7 @@ void av1_idct64_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 7
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = step;
|
||||
bf1 = output;
|
||||
bf1[0] = bf0[0] + bf0[3];
|
||||
|
|
@ -2049,7 +2091,7 @@ void av1_idct64_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 8
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = bf0[0] + bf0[7];
|
||||
|
|
@ -2120,7 +2162,7 @@ void av1_idct64_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 9
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = step;
|
||||
bf1 = output;
|
||||
bf1[0] = bf0[0] + bf0[15];
|
||||
|
|
@ -2191,7 +2233,7 @@ void av1_idct64_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 10
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = output;
|
||||
bf1 = step;
|
||||
bf1[0] = bf0[0] + bf0[31];
|
||||
|
|
@ -2262,7 +2304,7 @@ void av1_idct64_new(const int32_t *input, int32_t *output,
|
|||
|
||||
// stage 11
|
||||
stage++;
|
||||
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
|
||||
cospi = cospi_arr(cos_bit[stage]);
|
||||
bf0 = step;
|
||||
bf1 = output;
|
||||
bf1[0] = bf0[0] + bf0[63];
|
||||
|
|
|
|||
10
third_party/aom/av1/common/av1_inv_txfm1d.h
vendored
10
third_party/aom/av1/common/av1_inv_txfm1d.h
vendored
|
|
@ -37,6 +37,16 @@ void av1_iadst16_new(const int32_t *input, int32_t *output,
|
|||
const int8_t *cos_bit, const int8_t *stage_range);
|
||||
void av1_iadst32_new(const int32_t *input, int32_t *output,
|
||||
const int8_t *cos_bit, const int8_t *stage_range);
|
||||
#if CONFIG_EXT_TX
|
||||
void av1_iidentity4_c(const int32_t *input, int32_t *output,
|
||||
const int8_t *cos_bit, const int8_t *stage_range);
|
||||
void av1_iidentity8_c(const int32_t *input, int32_t *output,
|
||||
const int8_t *cos_bit, const int8_t *stage_range);
|
||||
void av1_iidentity16_c(const int32_t *input, int32_t *output,
|
||||
const int8_t *cos_bit, const int8_t *stage_range);
|
||||
void av1_iidentity32_c(const int32_t *input, int32_t *output,
|
||||
const int8_t *cos_bit, const int8_t *stage_range);
|
||||
#endif // CONFIG_EXT_TX
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
362
third_party/aom/av1/common/av1_inv_txfm1d_cfg.h
vendored
Normal file
362
third_party/aom/av1/common/av1_inv_txfm1d_cfg.h
vendored
Normal file
|
|
@ -0,0 +1,362 @@
|
|||
/*
|
||||
* 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_INV_TXFM2D_CFG_H_
|
||||
#define AV1_INV_TXFM2D_CFG_H_
|
||||
#include "av1/common/av1_inv_txfm1d.h"
|
||||
// Identity will always use max bitdepth regardless of size
|
||||
static const int8_t inv_stage_range_identity[1] = { 12 };
|
||||
|
||||
// ---------------- 4x4 1D config -----------------------
|
||||
// shift
|
||||
static const int8_t inv_shift_4[2] = { 0, -4 };
|
||||
|
||||
// stage range
|
||||
static const int8_t inv_stage_range_col_dct_4[4] = { 18, 18, 17, 17 };
|
||||
static const int8_t inv_stage_range_row_dct_4[4] = { 18, 18, 18, 18 };
|
||||
static const int8_t inv_stage_range_col_adst_4[6] = { 18, 18, 18, 18, 17, 17 };
|
||||
static const int8_t inv_stage_range_row_adst_4[6] = { 18, 18, 18, 18, 18, 18 };
|
||||
// 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] = { 19, 19, 19, 19, 18, 18 };
|
||||
static const int8_t inv_stage_range_row_dct_8[6] = { 19, 19, 19, 19, 19, 19 };
|
||||
static const int8_t inv_stage_range_col_adst_8[8] = { 19, 19, 19, 19,
|
||||
19, 19, 18, 18 };
|
||||
static const int8_t inv_stage_range_row_adst_8[8] = { 19, 19, 19, 19,
|
||||
19, 19, 19, 19 };
|
||||
// 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
|
||||
};
|
||||
|
||||
// ---------------- 16x16 1D constants -----------------------
|
||||
// shift
|
||||
static const int8_t inv_shift_16[2] = { -1, -5 };
|
||||
|
||||
// stage range
|
||||
static const int8_t inv_stage_range_col_dct_16[8] = { 19, 19, 19, 19,
|
||||
19, 19, 18, 18 };
|
||||
static const int8_t inv_stage_range_row_dct_16[8] = { 20, 20, 20, 20,
|
||||
20, 20, 20, 20 };
|
||||
static const int8_t inv_stage_range_col_adst_16[10] = { 19, 19, 19, 19, 19,
|
||||
19, 19, 19, 18, 18 };
|
||||
static const int8_t inv_stage_range_row_adst_16[10] = { 20, 20, 20, 20, 20,
|
||||
20, 20, 20, 20, 20 };
|
||||
|
||||
// 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] = { 19, 19, 19, 19, 19,
|
||||
19, 19, 19, 18, 18 };
|
||||
static const int8_t inv_stage_range_row_dct_32[10] = { 20, 20, 20, 20, 20,
|
||||
20, 20, 20, 20, 20 };
|
||||
static const int8_t inv_stage_range_col_adst_32[12] = {
|
||||
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 18, 18
|
||||
};
|
||||
static const int8_t inv_stage_range_row_adst_32[12] = {
|
||||
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20
|
||||
};
|
||||
|
||||
// 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, -7 };
|
||||
|
||||
// stage range
|
||||
static const int8_t inv_stage_range_col_dct_64[12] = { 19, 19, 19, 19, 19, 19,
|
||||
19, 19, 19, 19, 18, 18 };
|
||||
static const int8_t inv_stage_range_row_dct_64[12] = { 20, 20, 20, 20, 20, 20,
|
||||
20, 20, 20, 20, 20, 20 };
|
||||
|
||||
// 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
|
||||
// 0, // .log_scale
|
||||
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
|
||||
// 0, // .log_scale
|
||||
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
|
||||
// 0, // .log_scale
|
||||
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
|
||||
// 1, // .log_scale
|
||||
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
|
||||
};
|
||||
|
||||
// ---------------- 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
|
||||
};
|
||||
|
||||
// ---------------- row config inv_adst_4 ----------------
|
||||
static const TXFM_1D_CFG inv_txfm_1d_row_cfg_adst_4 = {
|
||||
4, // .txfm_size
|
||||
6, // .stage_num
|
||||
// 0, // .log_scale
|
||||
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
|
||||
// 0, // .log_scale
|
||||
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
|
||||
// 0, // .log_scale
|
||||
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
|
||||
// 1, // .log_scale
|
||||
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
|
||||
// 0, // .log_scale
|
||||
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
|
||||
// 0, // .log_scale
|
||||
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
|
||||
// 0, // .log_scale
|
||||
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
|
||||
// 1, // .log_scale
|
||||
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
|
||||
// 0, // .log_scale
|
||||
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
|
||||
// 0, // .log_scale
|
||||
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
|
||||
// 0, // .log_scale
|
||||
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
|
||||
// 1, // .log_scale
|
||||
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
|
||||
// 0, // .log_scale
|
||||
inv_shift_4, // .shift
|
||||
inv_stage_range_identity, // .stage_range
|
||||
NULL, // .cos_bit
|
||||
TXFM_TYPE_IDENTITY4, // .txfm_type
|
||||
};
|
||||
|
||||
// ---------------- row/col config inv_identity_8 ----------------
|
||||
static const TXFM_1D_CFG inv_txfm_1d_cfg_identity_8 = {
|
||||
8, // .txfm_size
|
||||
1, // .stage_num
|
||||
// 0, // .log_scale
|
||||
inv_shift_8, // .shift
|
||||
inv_stage_range_identity, // .stage_range
|
||||
NULL, // .cos_bit
|
||||
TXFM_TYPE_IDENTITY8, // .txfm_type
|
||||
};
|
||||
|
||||
// ---------------- row/col config inv_identity_16 ----------------
|
||||
static const TXFM_1D_CFG inv_txfm_1d_cfg_identity_16 = {
|
||||
16, // .txfm_size
|
||||
1, // .stage_num
|
||||
// 0, // .log_scale
|
||||
inv_shift_16, // .shift
|
||||
inv_stage_range_identity, // .stage_range
|
||||
NULL, // .cos_bit
|
||||
TXFM_TYPE_IDENTITY16, // .txfm_type
|
||||
};
|
||||
|
||||
// ---------------- row/col config inv_identity_32 ----------------
|
||||
static const TXFM_1D_CFG inv_txfm_1d_cfg_identity_32 = {
|
||||
32, // .txfm_size
|
||||
1, // .stage_num
|
||||
// 1, // .log_scale
|
||||
inv_shift_32, // .shift
|
||||
inv_stage_range_identity, // .stage_range
|
||||
NULL, // .cos_bit
|
||||
TXFM_TYPE_IDENTITY32, // .txfm_type
|
||||
};
|
||||
#endif // CONFIG_EXT_TX
|
||||
#endif // AV1_INV_TXFM2D_CFG_H_
|
||||
167
third_party/aom/av1/common/av1_inv_txfm2d.c
vendored
167
third_party/aom/av1/common/av1_inv_txfm2d.c
vendored
|
|
@ -13,7 +13,7 @@
|
|||
#include "av1/common/enums.h"
|
||||
#include "av1/common/av1_txfm.h"
|
||||
#include "av1/common/av1_inv_txfm1d.h"
|
||||
#include "av1/common/av1_inv_txfm2d_cfg.h"
|
||||
#include "av1/common/av1_inv_txfm1d_cfg.h"
|
||||
|
||||
static INLINE TxfmFunc inv_txfm_type_to_func(TXFM_TYPE txfm_type) {
|
||||
switch (txfm_type) {
|
||||
|
|
@ -25,132 +25,100 @@ static INLINE TxfmFunc inv_txfm_type_to_func(TXFM_TYPE txfm_type) {
|
|||
case TXFM_TYPE_ADST8: return av1_iadst8_new;
|
||||
case TXFM_TYPE_ADST16: return av1_iadst16_new;
|
||||
case TXFM_TYPE_ADST32: return av1_iadst32_new;
|
||||
#if CONFIG_EXT_TX
|
||||
case TXFM_TYPE_IDENTITY4: return av1_iidentity4_c;
|
||||
case TXFM_TYPE_IDENTITY8: return av1_iidentity8_c;
|
||||
case TXFM_TYPE_IDENTITY16: return av1_iidentity16_c;
|
||||
case TXFM_TYPE_IDENTITY32: return av1_iidentity32_c;
|
||||
#endif // CONFIG_EXT_TX
|
||||
default: assert(0); return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
const TXFM_2D_CFG *inv_txfm_cfg_ls[TX_TYPES][TX_SIZES] = {
|
||||
// DCT_DCT
|
||||
static const TXFM_1D_CFG *inv_txfm_col_cfg_ls[TX_TYPES_1D][TX_SIZES] = {
|
||||
// DCT
|
||||
{
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
NULL,
|
||||
#endif
|
||||
&inv_txfm_2d_cfg_dct_dct_4, &inv_txfm_2d_cfg_dct_dct_8,
|
||||
&inv_txfm_2d_cfg_dct_dct_16, &inv_txfm_2d_cfg_dct_dct_32 },
|
||||
// ADST_DCT
|
||||
&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 },
|
||||
// ADST
|
||||
{
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
NULL,
|
||||
#endif
|
||||
&inv_txfm_2d_cfg_adst_dct_4, &inv_txfm_2d_cfg_adst_dct_8,
|
||||
&inv_txfm_2d_cfg_adst_dct_16, &inv_txfm_2d_cfg_adst_dct_32 },
|
||||
// DCT_ADST
|
||||
{
|
||||
#if CONFIG_CB4X4
|
||||
NULL,
|
||||
#endif
|
||||
&inv_txfm_2d_cfg_dct_adst_4, &inv_txfm_2d_cfg_dct_adst_8,
|
||||
&inv_txfm_2d_cfg_dct_adst_16, &inv_txfm_2d_cfg_dct_adst_32 },
|
||||
// ADST_ADST
|
||||
{
|
||||
#if CONFIG_CB4X4
|
||||
NULL,
|
||||
#endif
|
||||
&inv_txfm_2d_cfg_adst_adst_4, &inv_txfm_2d_cfg_adst_adst_8,
|
||||
&inv_txfm_2d_cfg_adst_adst_16, &inv_txfm_2d_cfg_adst_adst_32 },
|
||||
&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_EXT_TX
|
||||
// FLIPADST_DCT
|
||||
// FLIPADST
|
||||
{
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
NULL,
|
||||
#endif
|
||||
&inv_txfm_2d_cfg_adst_dct_4, &inv_txfm_2d_cfg_adst_dct_8,
|
||||
&inv_txfm_2d_cfg_adst_dct_16, &inv_txfm_2d_cfg_adst_dct_32 },
|
||||
// DCT_FLIPADST
|
||||
&inv_txfm_1d_col_cfg_adst_4, &inv_txfm_1d_col_cfg_adst_8,
|
||||
&inv_txfm_1d_col_cfg_adst_16, &inv_txfm_1d_col_cfg_adst_32 },
|
||||
// IDENTITY
|
||||
{
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
NULL,
|
||||
#endif
|
||||
&inv_txfm_2d_cfg_dct_adst_4, &inv_txfm_2d_cfg_dct_adst_8,
|
||||
&inv_txfm_2d_cfg_dct_adst_16, &inv_txfm_2d_cfg_dct_adst_32 },
|
||||
// FLIPADST_FLIPADST
|
||||
&inv_txfm_1d_cfg_identity_4, &inv_txfm_1d_cfg_identity_8,
|
||||
&inv_txfm_1d_cfg_identity_16, &inv_txfm_1d_cfg_identity_32 },
|
||||
#endif // CONFIG_EXT_TX
|
||||
};
|
||||
|
||||
static const TXFM_1D_CFG *inv_txfm_row_cfg_ls[TX_TYPES_1D][TX_SIZES] = {
|
||||
// DCT
|
||||
{
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
NULL,
|
||||
#endif
|
||||
&inv_txfm_2d_cfg_adst_adst_4, &inv_txfm_2d_cfg_adst_adst_8,
|
||||
&inv_txfm_2d_cfg_adst_adst_16, &inv_txfm_2d_cfg_adst_adst_32 },
|
||||
// ADST_FLIPADST
|
||||
&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 },
|
||||
// ADST
|
||||
{
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
NULL,
|
||||
#endif
|
||||
&inv_txfm_2d_cfg_adst_adst_4, &inv_txfm_2d_cfg_adst_adst_8,
|
||||
&inv_txfm_2d_cfg_adst_adst_16, &inv_txfm_2d_cfg_adst_adst_32 },
|
||||
// FLIPADST_ADST
|
||||
&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_EXT_TX
|
||||
// FLIPADST
|
||||
{
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
NULL,
|
||||
#endif
|
||||
&inv_txfm_2d_cfg_adst_adst_4, &inv_txfm_2d_cfg_adst_adst_8,
|
||||
&inv_txfm_2d_cfg_adst_adst_16, &inv_txfm_2d_cfg_adst_adst_32 },
|
||||
{ // IDTX
|
||||
#if CONFIG_CB4X4
|
||||
NULL,
|
||||
&inv_txfm_1d_row_cfg_adst_4, &inv_txfm_1d_row_cfg_adst_8,
|
||||
&inv_txfm_1d_row_cfg_adst_16, &inv_txfm_1d_row_cfg_adst_32 },
|
||||
// IDENTITY
|
||||
{
|
||||
#if CONFIG_CHROMA_2X2
|
||||
NULL,
|
||||
#endif
|
||||
&inv_txfm_2d_cfg_adst_adst_4, &inv_txfm_2d_cfg_adst_adst_8,
|
||||
&inv_txfm_2d_cfg_adst_adst_16, &inv_txfm_2d_cfg_adst_adst_32 },
|
||||
{ // V_DCT
|
||||
#if CONFIG_CB4X4
|
||||
NULL,
|
||||
#endif
|
||||
&inv_txfm_2d_cfg_dct_adst_4, &inv_txfm_2d_cfg_dct_adst_8,
|
||||
&inv_txfm_2d_cfg_dct_adst_16, &inv_txfm_2d_cfg_dct_adst_32 },
|
||||
{ // H_DCT
|
||||
#if CONFIG_CB4X4
|
||||
NULL,
|
||||
#endif
|
||||
&inv_txfm_2d_cfg_adst_dct_4, &inv_txfm_2d_cfg_adst_dct_8,
|
||||
&inv_txfm_2d_cfg_adst_dct_16, &inv_txfm_2d_cfg_adst_dct_32 },
|
||||
{ // V_ADST
|
||||
#if CONFIG_CB4X4
|
||||
NULL,
|
||||
#endif
|
||||
&inv_txfm_2d_cfg_adst_adst_4, &inv_txfm_2d_cfg_adst_adst_8,
|
||||
&inv_txfm_2d_cfg_adst_adst_16, &inv_txfm_2d_cfg_adst_adst_32 },
|
||||
{ // H_ADST
|
||||
#if CONFIG_CB4X4
|
||||
NULL,
|
||||
#endif
|
||||
&inv_txfm_2d_cfg_adst_adst_4, &inv_txfm_2d_cfg_adst_adst_8,
|
||||
&inv_txfm_2d_cfg_adst_adst_16, &inv_txfm_2d_cfg_adst_adst_32 },
|
||||
{ // V_FLIP_ADST
|
||||
#if CONFIG_CB4X4
|
||||
NULL,
|
||||
#endif
|
||||
&inv_txfm_2d_cfg_adst_adst_4, &inv_txfm_2d_cfg_adst_adst_8,
|
||||
&inv_txfm_2d_cfg_adst_adst_16, &inv_txfm_2d_cfg_adst_adst_32 },
|
||||
{ // H_FLIP_ADST
|
||||
#if CONFIG_CB4X4
|
||||
NULL,
|
||||
#endif
|
||||
&inv_txfm_2d_cfg_adst_adst_4, &inv_txfm_2d_cfg_adst_adst_8,
|
||||
&inv_txfm_2d_cfg_adst_adst_16, &inv_txfm_2d_cfg_adst_adst_32 },
|
||||
&inv_txfm_1d_cfg_identity_4, &inv_txfm_1d_cfg_identity_8,
|
||||
&inv_txfm_1d_cfg_identity_16, &inv_txfm_1d_cfg_identity_32 },
|
||||
#endif // CONFIG_EXT_TX
|
||||
};
|
||||
|
||||
TXFM_2D_FLIP_CFG av1_get_inv_txfm_cfg(int tx_type, int tx_size) {
|
||||
TXFM_2D_FLIP_CFG cfg;
|
||||
set_flip_cfg(tx_type, &cfg);
|
||||
cfg.cfg = inv_txfm_cfg_ls[tx_type][tx_size];
|
||||
int tx_type_col = vtx_tab[tx_type];
|
||||
int tx_type_row = htx_tab[tx_type];
|
||||
// TODO(sarahparker) this is currently only implemented for
|
||||
// square transforms
|
||||
cfg.col_cfg = inv_txfm_col_cfg_ls[tx_type_col][tx_size];
|
||||
cfg.row_cfg = inv_txfm_row_cfg_ls[tx_type_row][tx_size];
|
||||
return cfg;
|
||||
}
|
||||
|
||||
TXFM_2D_FLIP_CFG av1_get_inv_txfm_64x64_cfg(int tx_type) {
|
||||
TXFM_2D_FLIP_CFG cfg = { 0, 0, NULL };
|
||||
TXFM_2D_FLIP_CFG cfg = { 0, 0, NULL, NULL };
|
||||
switch (tx_type) {
|
||||
case DCT_DCT:
|
||||
cfg.cfg = &inv_txfm_2d_cfg_dct_dct_64;
|
||||
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);
|
||||
|
|
@ -161,14 +129,15 @@ TXFM_2D_FLIP_CFG av1_get_inv_txfm_64x64_cfg(int tx_type) {
|
|||
static INLINE void inv_txfm2d_add_c(const int32_t *input, int16_t *output,
|
||||
int stride, TXFM_2D_FLIP_CFG *cfg,
|
||||
int32_t *txfm_buf) {
|
||||
const int txfm_size = cfg->cfg->txfm_size;
|
||||
const int8_t *shift = cfg->cfg->shift;
|
||||
const int8_t *stage_range_col = cfg->cfg->stage_range_col;
|
||||
const int8_t *stage_range_row = cfg->cfg->stage_range_row;
|
||||
const int8_t *cos_bit_col = cfg->cfg->cos_bit_col;
|
||||
const int8_t *cos_bit_row = cfg->cfg->cos_bit_row;
|
||||
const TxfmFunc txfm_func_col = inv_txfm_type_to_func(cfg->cfg->txfm_type_col);
|
||||
const TxfmFunc txfm_func_row = inv_txfm_type_to_func(cfg->cfg->txfm_type_row);
|
||||
// TODO(sarahparker) must correct for rectangular transforms in follow up
|
||||
const int txfm_size = cfg->row_cfg->txfm_size;
|
||||
const int8_t *shift = cfg->row_cfg->shift;
|
||||
const int8_t *stage_range_col = cfg->col_cfg->stage_range;
|
||||
const int8_t *stage_range_row = cfg->row_cfg->stage_range;
|
||||
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);
|
||||
|
||||
// txfm_buf's length is txfm_size * txfm_size + 2 * txfm_size
|
||||
// it is used for intermediate data buffering
|
||||
|
|
@ -216,7 +185,11 @@ static INLINE void inv_txfm2d_add_facade(const int32_t *input, uint16_t *output,
|
|||
// int16_t*
|
||||
TXFM_2D_FLIP_CFG cfg = av1_get_inv_txfm_cfg(tx_type, tx_size);
|
||||
inv_txfm2d_add_c(input, (int16_t *)output, stride, &cfg, txfm_buf);
|
||||
clamp_block((int16_t *)output, cfg.cfg->txfm_size, stride, 0, (1 << bd) - 1);
|
||||
// TODO(sarahparker) just using the cfg_row->txfm_size for now because
|
||||
// we are assumint this is only used for square transforms. This will
|
||||
// be adjusted in a follow up
|
||||
clamp_block((int16_t *)output, cfg.row_cfg->txfm_size, stride, 0,
|
||||
(1 << bd) - 1);
|
||||
}
|
||||
|
||||
void av1_inv_txfm2d_add_4x4_c(const int32_t *input, uint16_t *output,
|
||||
|
|
|
|||
447
third_party/aom/av1/common/av1_inv_txfm2d_cfg.h
vendored
447
third_party/aom/av1/common/av1_inv_txfm2d_cfg.h
vendored
|
|
@ -1,447 +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_INV_TXFM2D_CFG_H_
|
||||
#define AV1_INV_TXFM2D_CFG_H_
|
||||
#include "av1/common/av1_inv_txfm1d.h"
|
||||
// ---------------- config inv_dct_dct_4 ----------------
|
||||
static const int8_t inv_shift_dct_dct_4[2] = { 0, -4 };
|
||||
static const int8_t inv_stage_range_col_dct_dct_4[4] = { 18, 18, 17, 17 };
|
||||
static const int8_t inv_stage_range_row_dct_dct_4[4] = { 18, 18, 18, 18 };
|
||||
static const int8_t inv_cos_bit_col_dct_dct_4[4] = { 13, 13, 13, 13 };
|
||||
static const int8_t inv_cos_bit_row_dct_dct_4[4] = { 13, 13, 13, 13 };
|
||||
|
||||
static const TXFM_2D_CFG inv_txfm_2d_cfg_dct_dct_4 = {
|
||||
4, // .txfm_size
|
||||
4, // .stage_num_col
|
||||
4, // .stage_num_row
|
||||
// 0, // .log_scale
|
||||
inv_shift_dct_dct_4, // .shift
|
||||
inv_stage_range_col_dct_dct_4, // .stage_range_col
|
||||
inv_stage_range_row_dct_dct_4, // .stage_range_row
|
||||
inv_cos_bit_col_dct_dct_4, // .cos_bit_col
|
||||
inv_cos_bit_row_dct_dct_4, // .cos_bit_row
|
||||
TXFM_TYPE_DCT4, // .txfm_type_col
|
||||
TXFM_TYPE_DCT4
|
||||
}; // .txfm_type_row
|
||||
|
||||
// ---------------- config inv_dct_dct_8 ----------------
|
||||
static const int8_t inv_shift_dct_dct_8[2] = { 0, -5 };
|
||||
static const int8_t inv_stage_range_col_dct_dct_8[6] = {
|
||||
19, 19, 19, 19, 18, 18
|
||||
};
|
||||
static const int8_t inv_stage_range_row_dct_dct_8[6] = {
|
||||
19, 19, 19, 19, 19, 19
|
||||
};
|
||||
static const int8_t inv_cos_bit_col_dct_dct_8[6] = { 13, 13, 13, 13, 13, 13 };
|
||||
static const int8_t inv_cos_bit_row_dct_dct_8[6] = { 13, 13, 13, 13, 13, 13 };
|
||||
|
||||
static const TXFM_2D_CFG inv_txfm_2d_cfg_dct_dct_8 = {
|
||||
8, // .txfm_size
|
||||
6, // .stage_num_col
|
||||
6, // .stage_num_row
|
||||
// 0, // .log_scale
|
||||
inv_shift_dct_dct_8, // .shift
|
||||
inv_stage_range_col_dct_dct_8, // .stage_range_col
|
||||
inv_stage_range_row_dct_dct_8, // .stage_range_row
|
||||
inv_cos_bit_col_dct_dct_8, // .cos_bit_col
|
||||
inv_cos_bit_row_dct_dct_8, // .cos_bit_row
|
||||
TXFM_TYPE_DCT8, // .txfm_type_col
|
||||
TXFM_TYPE_DCT8
|
||||
}; // .txfm_type_row
|
||||
|
||||
// ---------------- config inv_dct_dct_16 ----------------
|
||||
static const int8_t inv_shift_dct_dct_16[2] = { -1, -5 };
|
||||
static const int8_t inv_stage_range_col_dct_dct_16[8] = { 19, 19, 19, 19,
|
||||
19, 19, 18, 18 };
|
||||
static const int8_t inv_stage_range_row_dct_dct_16[8] = { 20, 20, 20, 20,
|
||||
20, 20, 20, 20 };
|
||||
static const int8_t inv_cos_bit_col_dct_dct_16[8] = { 13, 13, 13, 13,
|
||||
13, 13, 13, 13 };
|
||||
static const int8_t inv_cos_bit_row_dct_dct_16[8] = { 12, 12, 12, 12,
|
||||
12, 12, 12, 12 };
|
||||
|
||||
static const TXFM_2D_CFG inv_txfm_2d_cfg_dct_dct_16 = {
|
||||
16, // .txfm_size
|
||||
8, // .stage_num_col
|
||||
8, // .stage_num_row
|
||||
// 0, // .log_scale
|
||||
inv_shift_dct_dct_16, // .shift
|
||||
inv_stage_range_col_dct_dct_16, // .stage_range_col
|
||||
inv_stage_range_row_dct_dct_16, // .stage_range_row
|
||||
inv_cos_bit_col_dct_dct_16, // .cos_bit_col
|
||||
inv_cos_bit_row_dct_dct_16, // .cos_bit_row
|
||||
TXFM_TYPE_DCT16, // .txfm_type_col
|
||||
TXFM_TYPE_DCT16
|
||||
}; // .txfm_type_row
|
||||
|
||||
// ---------------- config inv_dct_dct_32 ----------------
|
||||
static const int8_t inv_shift_dct_dct_32[2] = { -1, -5 };
|
||||
static const int8_t inv_stage_range_col_dct_dct_32[10] = { 19, 19, 19, 19, 19,
|
||||
19, 19, 19, 18, 18 };
|
||||
static const int8_t inv_stage_range_row_dct_dct_32[10] = { 20, 20, 20, 20, 20,
|
||||
20, 20, 20, 20, 20 };
|
||||
static const int8_t inv_cos_bit_col_dct_dct_32[10] = { 13, 13, 13, 13, 13,
|
||||
13, 13, 13, 13, 13 };
|
||||
static const int8_t inv_cos_bit_row_dct_dct_32[10] = { 12, 12, 12, 12, 12,
|
||||
12, 12, 12, 12, 12 };
|
||||
|
||||
static const TXFM_2D_CFG inv_txfm_2d_cfg_dct_dct_32 = {
|
||||
32, // .txfm_size
|
||||
10, // .stage_num_col
|
||||
10, // .stage_num_row
|
||||
// 1, // .log_scale
|
||||
inv_shift_dct_dct_32, // .shift
|
||||
inv_stage_range_col_dct_dct_32, // .stage_range_col
|
||||
inv_stage_range_row_dct_dct_32, // .stage_range_row
|
||||
inv_cos_bit_col_dct_dct_32, // .cos_bit_col
|
||||
inv_cos_bit_row_dct_dct_32, // .cos_bit_row
|
||||
TXFM_TYPE_DCT32, // .txfm_type_col
|
||||
TXFM_TYPE_DCT32
|
||||
}; // .txfm_type_row
|
||||
|
||||
// ---------------- config inv_dct_dct_64 ----------------
|
||||
static const int8_t inv_shift_dct_dct_64[2] = { -1, -7 };
|
||||
static const int8_t inv_stage_range_col_dct_dct_64[12] = {
|
||||
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 18, 18
|
||||
};
|
||||
static const int8_t inv_stage_range_row_dct_dct_64[12] = {
|
||||
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20
|
||||
};
|
||||
static const int8_t inv_cos_bit_col_dct_dct_64[12] = { 13, 13, 13, 13, 13, 13,
|
||||
13, 13, 13, 13, 13, 13 };
|
||||
static const int8_t inv_cos_bit_row_dct_dct_64[12] = { 12, 12, 12, 12, 12, 12,
|
||||
12, 12, 12, 12, 12, 12 };
|
||||
|
||||
static const TXFM_2D_CFG inv_txfm_2d_cfg_dct_dct_64 = {
|
||||
64, // .txfm_size
|
||||
12, // .stage_num_col
|
||||
12, // .stage_num_row
|
||||
inv_shift_dct_dct_64, // .shift
|
||||
inv_stage_range_col_dct_dct_64, // .stage_range_col
|
||||
inv_stage_range_row_dct_dct_64, // .stage_range_row
|
||||
inv_cos_bit_col_dct_dct_64, // .cos_bit_col
|
||||
inv_cos_bit_row_dct_dct_64, // .cos_bit_row
|
||||
TXFM_TYPE_DCT64, // .txfm_type_col
|
||||
TXFM_TYPE_DCT64
|
||||
}; // .txfm_type_row
|
||||
|
||||
// ---------------- config inv_dct_adst_4 ----------------
|
||||
static const int8_t inv_shift_dct_adst_4[2] = { 0, -4 };
|
||||
static const int8_t inv_stage_range_col_dct_adst_4[4] = { 18, 18, 17, 17 };
|
||||
static const int8_t inv_stage_range_row_dct_adst_4[6] = {
|
||||
18, 18, 18, 18, 18, 18
|
||||
};
|
||||
static const int8_t inv_cos_bit_col_dct_adst_4[4] = { 13, 13, 13, 13 };
|
||||
static const int8_t inv_cos_bit_row_dct_adst_4[6] = { 13, 13, 13, 13, 13, 13 };
|
||||
|
||||
static const TXFM_2D_CFG inv_txfm_2d_cfg_dct_adst_4 = {
|
||||
4, // .txfm_size
|
||||
4, // .stage_num_col
|
||||
6, // .stage_num_row
|
||||
// 0, // .log_scale
|
||||
inv_shift_dct_adst_4, // .shift
|
||||
inv_stage_range_col_dct_adst_4, // .stage_range_col
|
||||
inv_stage_range_row_dct_adst_4, // .stage_range_row
|
||||
inv_cos_bit_col_dct_adst_4, // .cos_bit_col
|
||||
inv_cos_bit_row_dct_adst_4, // .cos_bit_row
|
||||
TXFM_TYPE_DCT4, // .txfm_type_col
|
||||
TXFM_TYPE_ADST4
|
||||
}; // .txfm_type_row
|
||||
|
||||
// ---------------- config inv_dct_adst_8 ----------------
|
||||
static const int8_t inv_shift_dct_adst_8[2] = { 0, -5 };
|
||||
static const int8_t inv_stage_range_col_dct_adst_8[6] = {
|
||||
19, 19, 19, 19, 18, 18
|
||||
};
|
||||
static const int8_t inv_stage_range_row_dct_adst_8[8] = { 19, 19, 19, 19,
|
||||
19, 19, 19, 19 };
|
||||
static const int8_t inv_cos_bit_col_dct_adst_8[6] = { 13, 13, 13, 13, 13, 13 };
|
||||
static const int8_t inv_cos_bit_row_dct_adst_8[8] = { 13, 13, 13, 13,
|
||||
13, 13, 13, 13 };
|
||||
|
||||
static const TXFM_2D_CFG inv_txfm_2d_cfg_dct_adst_8 = {
|
||||
8, // .txfm_size
|
||||
6, // .stage_num_col
|
||||
8, // .stage_num_row
|
||||
// 0, // .log_scale
|
||||
inv_shift_dct_adst_8, // .shift
|
||||
inv_stage_range_col_dct_adst_8, // .stage_range_col
|
||||
inv_stage_range_row_dct_adst_8, // .stage_range_row
|
||||
inv_cos_bit_col_dct_adst_8, // .cos_bit_col
|
||||
inv_cos_bit_row_dct_adst_8, // .cos_bit_row
|
||||
TXFM_TYPE_DCT8, // .txfm_type_col
|
||||
TXFM_TYPE_ADST8
|
||||
}; // .txfm_type_row
|
||||
|
||||
// ---------------- config inv_dct_adst_16 ----------------
|
||||
static const int8_t inv_shift_dct_adst_16[2] = { -1, -5 };
|
||||
static const int8_t inv_stage_range_col_dct_adst_16[8] = { 19, 19, 19, 19,
|
||||
19, 19, 18, 18 };
|
||||
static const int8_t inv_stage_range_row_dct_adst_16[10] = {
|
||||
20, 20, 20, 20, 20, 20, 20, 20, 20, 20
|
||||
};
|
||||
static const int8_t inv_cos_bit_col_dct_adst_16[8] = { 13, 13, 13, 13,
|
||||
13, 13, 13, 13 };
|
||||
static const int8_t inv_cos_bit_row_dct_adst_16[10] = { 12, 12, 12, 12, 12,
|
||||
12, 12, 12, 12, 12 };
|
||||
|
||||
static const TXFM_2D_CFG inv_txfm_2d_cfg_dct_adst_16 = {
|
||||
16, // .txfm_size
|
||||
8, // .stage_num_col
|
||||
10, // .stage_num_row
|
||||
// 0, // .log_scale
|
||||
inv_shift_dct_adst_16, // .shift
|
||||
inv_stage_range_col_dct_adst_16, // .stage_range_col
|
||||
inv_stage_range_row_dct_adst_16, // .stage_range_row
|
||||
inv_cos_bit_col_dct_adst_16, // .cos_bit_col
|
||||
inv_cos_bit_row_dct_adst_16, // .cos_bit_row
|
||||
TXFM_TYPE_DCT16, // .txfm_type_col
|
||||
TXFM_TYPE_ADST16
|
||||
}; // .txfm_type_row
|
||||
|
||||
// ---------------- config inv_dct_adst_32 ----------------
|
||||
static const int8_t inv_shift_dct_adst_32[2] = { -1, -5 };
|
||||
static const int8_t inv_stage_range_col_dct_adst_32[10] = {
|
||||
19, 19, 19, 19, 19, 19, 19, 19, 18, 18
|
||||
};
|
||||
static const int8_t inv_stage_range_row_dct_adst_32[12] = {
|
||||
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20
|
||||
};
|
||||
static const int8_t inv_cos_bit_col_dct_adst_32[10] = { 13, 13, 13, 13, 13,
|
||||
13, 13, 13, 13, 13 };
|
||||
static const int8_t inv_cos_bit_row_dct_adst_32[12] = {
|
||||
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12
|
||||
};
|
||||
|
||||
static const TXFM_2D_CFG inv_txfm_2d_cfg_dct_adst_32 = {
|
||||
32, // .txfm_size
|
||||
10, // .stage_num_col
|
||||
12, // .stage_num_row
|
||||
// 1, // .log_scale
|
||||
inv_shift_dct_adst_32, // .shift
|
||||
inv_stage_range_col_dct_adst_32, // .stage_range_col
|
||||
inv_stage_range_row_dct_adst_32, // .stage_range_row
|
||||
inv_cos_bit_col_dct_adst_32, // .cos_bit_col
|
||||
inv_cos_bit_row_dct_adst_32, // .cos_bit_row
|
||||
TXFM_TYPE_DCT32, // .txfm_type_col
|
||||
TXFM_TYPE_ADST32
|
||||
}; // .txfm_type_row
|
||||
|
||||
// ---------------- config inv_adst_adst_4 ----------------
|
||||
static const int8_t inv_shift_adst_adst_4[2] = { 0, -4 };
|
||||
static const int8_t inv_stage_range_col_adst_adst_4[6] = { 18, 18, 18,
|
||||
18, 17, 17 };
|
||||
static const int8_t inv_stage_range_row_adst_adst_4[6] = { 18, 18, 18,
|
||||
18, 18, 18 };
|
||||
static const int8_t inv_cos_bit_col_adst_adst_4[6] = { 13, 13, 13, 13, 13, 13 };
|
||||
static const int8_t inv_cos_bit_row_adst_adst_4[6] = { 13, 13, 13, 13, 13, 13 };
|
||||
|
||||
static const TXFM_2D_CFG inv_txfm_2d_cfg_adst_adst_4 = {
|
||||
4, // .txfm_size
|
||||
6, // .stage_num_col
|
||||
6, // .stage_num_row
|
||||
// 0, // .log_scale
|
||||
inv_shift_adst_adst_4, // .shift
|
||||
inv_stage_range_col_adst_adst_4, // .stage_range_col
|
||||
inv_stage_range_row_adst_adst_4, // .stage_range_row
|
||||
inv_cos_bit_col_adst_adst_4, // .cos_bit_col
|
||||
inv_cos_bit_row_adst_adst_4, // .cos_bit_row
|
||||
TXFM_TYPE_ADST4, // .txfm_type_col
|
||||
TXFM_TYPE_ADST4
|
||||
}; // .txfm_type_row
|
||||
|
||||
// ---------------- config inv_adst_adst_8 ----------------
|
||||
static const int8_t inv_shift_adst_adst_8[2] = { 0, -5 };
|
||||
static const int8_t inv_stage_range_col_adst_adst_8[8] = { 19, 19, 19, 19,
|
||||
19, 19, 18, 18 };
|
||||
static const int8_t inv_stage_range_row_adst_adst_8[8] = { 19, 19, 19, 19,
|
||||
19, 19, 19, 19 };
|
||||
static const int8_t inv_cos_bit_col_adst_adst_8[8] = { 13, 13, 13, 13,
|
||||
13, 13, 13, 13 };
|
||||
static const int8_t inv_cos_bit_row_adst_adst_8[8] = { 13, 13, 13, 13,
|
||||
13, 13, 13, 13 };
|
||||
|
||||
static const TXFM_2D_CFG inv_txfm_2d_cfg_adst_adst_8 = {
|
||||
8, // .txfm_size
|
||||
8, // .stage_num_col
|
||||
8, // .stage_num_row
|
||||
// 0, // .log_scale
|
||||
inv_shift_adst_adst_8, // .shift
|
||||
inv_stage_range_col_adst_adst_8, // .stage_range_col
|
||||
inv_stage_range_row_adst_adst_8, // .stage_range_row
|
||||
inv_cos_bit_col_adst_adst_8, // .cos_bit_col
|
||||
inv_cos_bit_row_adst_adst_8, // .cos_bit_row
|
||||
TXFM_TYPE_ADST8, // .txfm_type_col
|
||||
TXFM_TYPE_ADST8
|
||||
}; // .txfm_type_row
|
||||
|
||||
// ---------------- config inv_adst_adst_16 ----------------
|
||||
static const int8_t inv_shift_adst_adst_16[2] = { -1, -5 };
|
||||
static const int8_t inv_stage_range_col_adst_adst_16[10] = {
|
||||
19, 19, 19, 19, 19, 19, 19, 19, 18, 18
|
||||
};
|
||||
static const int8_t inv_stage_range_row_adst_adst_16[10] = {
|
||||
20, 20, 20, 20, 20, 20, 20, 20, 20, 20
|
||||
};
|
||||
static const int8_t inv_cos_bit_col_adst_adst_16[10] = { 13, 13, 13, 13, 13,
|
||||
13, 13, 13, 13, 13 };
|
||||
static const int8_t inv_cos_bit_row_adst_adst_16[10] = { 12, 12, 12, 12, 12,
|
||||
12, 12, 12, 12, 12 };
|
||||
|
||||
static const TXFM_2D_CFG inv_txfm_2d_cfg_adst_adst_16 = {
|
||||
16, // .txfm_size
|
||||
10, // .stage_num_col
|
||||
10, // .stage_num_row
|
||||
// 0, // .log_scale
|
||||
inv_shift_adst_adst_16, // .shift
|
||||
inv_stage_range_col_adst_adst_16, // .stage_range_col
|
||||
inv_stage_range_row_adst_adst_16, // .stage_range_row
|
||||
inv_cos_bit_col_adst_adst_16, // .cos_bit_col
|
||||
inv_cos_bit_row_adst_adst_16, // .cos_bit_row
|
||||
TXFM_TYPE_ADST16, // .txfm_type_col
|
||||
TXFM_TYPE_ADST16
|
||||
}; // .txfm_type_row
|
||||
|
||||
// ---------------- config inv_adst_adst_32 ----------------
|
||||
static const int8_t inv_shift_adst_adst_32[2] = { -1, -5 };
|
||||
static const int8_t inv_stage_range_col_adst_adst_32[12] = {
|
||||
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 18, 18
|
||||
};
|
||||
static const int8_t inv_stage_range_row_adst_adst_32[12] = {
|
||||
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20
|
||||
};
|
||||
static const int8_t inv_cos_bit_col_adst_adst_32[12] = {
|
||||
13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13
|
||||
};
|
||||
static const int8_t inv_cos_bit_row_adst_adst_32[12] = {
|
||||
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12
|
||||
};
|
||||
|
||||
static const TXFM_2D_CFG inv_txfm_2d_cfg_adst_adst_32 = {
|
||||
32, // .txfm_size
|
||||
12, // .stage_num_col
|
||||
12, // .stage_num_row
|
||||
// 1, // .log_scale
|
||||
inv_shift_adst_adst_32, // .shift
|
||||
inv_stage_range_col_adst_adst_32, // .stage_range_col
|
||||
inv_stage_range_row_adst_adst_32, // .stage_range_row
|
||||
inv_cos_bit_col_adst_adst_32, // .cos_bit_col
|
||||
inv_cos_bit_row_adst_adst_32, // .cos_bit_row
|
||||
TXFM_TYPE_ADST32, // .txfm_type_col
|
||||
TXFM_TYPE_ADST32
|
||||
}; // .txfm_type_row
|
||||
|
||||
// ---------------- config inv_adst_dct_4 ----------------
|
||||
static const int8_t inv_shift_adst_dct_4[2] = { 0, -4 };
|
||||
static const int8_t inv_stage_range_col_adst_dct_4[6] = {
|
||||
18, 18, 18, 18, 17, 17
|
||||
};
|
||||
static const int8_t inv_stage_range_row_adst_dct_4[4] = { 18, 18, 18, 18 };
|
||||
static const int8_t inv_cos_bit_col_adst_dct_4[6] = { 13, 13, 13, 13, 13, 13 };
|
||||
static const int8_t inv_cos_bit_row_adst_dct_4[4] = { 13, 13, 13, 13 };
|
||||
|
||||
static const TXFM_2D_CFG inv_txfm_2d_cfg_adst_dct_4 = {
|
||||
4, // .txfm_size
|
||||
6, // .stage_num_col
|
||||
4, // .stage_num_row
|
||||
// 0, // .log_scale
|
||||
inv_shift_adst_dct_4, // .shift
|
||||
inv_stage_range_col_adst_dct_4, // .stage_range_col
|
||||
inv_stage_range_row_adst_dct_4, // .stage_range_row
|
||||
inv_cos_bit_col_adst_dct_4, // .cos_bit_col
|
||||
inv_cos_bit_row_adst_dct_4, // .cos_bit_row
|
||||
TXFM_TYPE_ADST4, // .txfm_type_col
|
||||
TXFM_TYPE_DCT4
|
||||
}; // .txfm_type_row
|
||||
|
||||
// ---------------- config inv_adst_dct_8 ----------------
|
||||
static const int8_t inv_shift_adst_dct_8[2] = { 0, -5 };
|
||||
static const int8_t inv_stage_range_col_adst_dct_8[8] = { 19, 19, 19, 19,
|
||||
19, 19, 18, 18 };
|
||||
static const int8_t inv_stage_range_row_adst_dct_8[6] = {
|
||||
19, 19, 19, 19, 19, 19
|
||||
};
|
||||
static const int8_t inv_cos_bit_col_adst_dct_8[8] = { 13, 13, 13, 13,
|
||||
13, 13, 13, 13 };
|
||||
static const int8_t inv_cos_bit_row_adst_dct_8[6] = { 13, 13, 13, 13, 13, 13 };
|
||||
|
||||
static const TXFM_2D_CFG inv_txfm_2d_cfg_adst_dct_8 = {
|
||||
8, // .txfm_size
|
||||
8, // .stage_num_col
|
||||
6, // .stage_num_row
|
||||
// 0, // .log_scale
|
||||
inv_shift_adst_dct_8, // .shift
|
||||
inv_stage_range_col_adst_dct_8, // .stage_range_col
|
||||
inv_stage_range_row_adst_dct_8, // .stage_range_row
|
||||
inv_cos_bit_col_adst_dct_8, // .cos_bit_col
|
||||
inv_cos_bit_row_adst_dct_8, // .cos_bit_row
|
||||
TXFM_TYPE_ADST8, // .txfm_type_col
|
||||
TXFM_TYPE_DCT8
|
||||
}; // .txfm_type_row
|
||||
|
||||
// ---------------- config inv_adst_dct_16 ----------------
|
||||
static const int8_t inv_shift_adst_dct_16[2] = { -1, -5 };
|
||||
static const int8_t inv_stage_range_col_adst_dct_16[10] = {
|
||||
19, 19, 19, 19, 19, 19, 19, 19, 18, 18
|
||||
};
|
||||
static const int8_t inv_stage_range_row_adst_dct_16[8] = { 20, 20, 20, 20,
|
||||
20, 20, 20, 20 };
|
||||
static const int8_t inv_cos_bit_col_adst_dct_16[10] = { 13, 13, 13, 13, 13,
|
||||
13, 13, 13, 13, 13 };
|
||||
static const int8_t inv_cos_bit_row_adst_dct_16[8] = { 12, 12, 12, 12,
|
||||
12, 12, 12, 12 };
|
||||
|
||||
static const TXFM_2D_CFG inv_txfm_2d_cfg_adst_dct_16 = {
|
||||
16, // .txfm_size
|
||||
10, // .stage_num_col
|
||||
8, // .stage_num_row
|
||||
// 0, // .log_scale
|
||||
inv_shift_adst_dct_16, // .shift
|
||||
inv_stage_range_col_adst_dct_16, // .stage_range_col
|
||||
inv_stage_range_row_adst_dct_16, // .stage_range_row
|
||||
inv_cos_bit_col_adst_dct_16, // .cos_bit_col
|
||||
inv_cos_bit_row_adst_dct_16, // .cos_bit_row
|
||||
TXFM_TYPE_ADST16, // .txfm_type_col
|
||||
TXFM_TYPE_DCT16
|
||||
}; // .txfm_type_row
|
||||
|
||||
// ---------------- config inv_adst_dct_32 ----------------
|
||||
static const int8_t inv_shift_adst_dct_32[2] = { -1, -5 };
|
||||
static const int8_t inv_stage_range_col_adst_dct_32[12] = {
|
||||
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 18, 18
|
||||
};
|
||||
static const int8_t inv_stage_range_row_adst_dct_32[10] = {
|
||||
20, 20, 20, 20, 20, 20, 20, 20, 20, 20
|
||||
};
|
||||
static const int8_t inv_cos_bit_col_adst_dct_32[12] = {
|
||||
13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13
|
||||
};
|
||||
static const int8_t inv_cos_bit_row_adst_dct_32[10] = { 12, 12, 12, 12, 12,
|
||||
12, 12, 12, 12, 12 };
|
||||
|
||||
static const TXFM_2D_CFG inv_txfm_2d_cfg_adst_dct_32 = {
|
||||
32, // .txfm_size
|
||||
12, // .stage_num_col
|
||||
10, // .stage_num_row
|
||||
// 1, // .log_scale
|
||||
inv_shift_adst_dct_32, // .shift
|
||||
inv_stage_range_col_adst_dct_32, // .stage_range_col
|
||||
inv_stage_range_row_adst_dct_32, // .stage_range_row
|
||||
inv_cos_bit_col_adst_dct_32, // .cos_bit_col
|
||||
inv_cos_bit_row_adst_dct_32, // .cos_bit_row
|
||||
TXFM_TYPE_ADST32, // .txfm_type_col
|
||||
TXFM_TYPE_DCT32
|
||||
}; // .txfm_type_row
|
||||
|
||||
extern const TXFM_2D_CFG *inv_txfm_cfg_ls[TX_TYPES][TX_SIZES];
|
||||
|
||||
#endif // AV1_INV_TXFM2D_CFG_H_
|
||||
343
third_party/aom/av1/common/av1_loopfilter.c
vendored
343
third_party/aom/av1/common/av1_loopfilter.c
vendored
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include "av1/common/seg_common.h"
|
||||
|
||||
#define CONFIG_PARALLEL_DEBLOCKING_15TAPLUMAONLY 0
|
||||
#define PARALLEL_DEBLOCKING_15TAPLUMAONLY 1
|
||||
|
||||
// 64 bit masks for left transform size. Each 1 represents a position where
|
||||
// we should apply a loop filter across the left border of an 8x8 block
|
||||
|
|
@ -42,7 +42,7 @@
|
|||
//
|
||||
// A loopfilter should be applied to every other 8x8 horizontally.
|
||||
static const uint64_t left_64x64_txform_mask[TX_SIZES] = {
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
0xffffffffffffffffULL, // TX_2X2
|
||||
#endif
|
||||
0xffffffffffffffffULL, // TX_4X4
|
||||
|
|
@ -72,7 +72,7 @@ static const uint64_t left_64x64_txform_mask[TX_SIZES] = {
|
|||
//
|
||||
// A loopfilter should be applied to every other 4 the row vertically.
|
||||
static const uint64_t above_64x64_txform_mask[TX_SIZES] = {
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
0xffffffffffffffffULL, // TX_4X4
|
||||
#endif
|
||||
0xffffffffffffffffULL, // TX_4X4
|
||||
|
|
@ -171,7 +171,7 @@ static const uint64_t above_border = 0x000000ff000000ffULL;
|
|||
|
||||
// 16 bit masks for uv transform sizes.
|
||||
static const uint16_t left_64x64_txform_mask_uv[TX_SIZES] = {
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
0xffff, // TX_2X2
|
||||
#endif
|
||||
0xffff, // TX_4X4
|
||||
|
|
@ -184,7 +184,7 @@ static const uint16_t left_64x64_txform_mask_uv[TX_SIZES] = {
|
|||
};
|
||||
|
||||
static const uint16_t above_64x64_txform_mask_uv[TX_SIZES] = {
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
0xffff, // TX_2X2
|
||||
#endif
|
||||
0xffff, // TX_4X4
|
||||
|
|
@ -267,11 +267,14 @@ static const int mode_lf_lut[] = {
|
|||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // INTRA_MODES
|
||||
#if CONFIG_ALT_INTRA
|
||||
0,
|
||||
#endif
|
||||
#if CONFIG_SMOOTH_HV
|
||||
0, 0,
|
||||
#endif // CONFIG_SMOOTH_HV
|
||||
#endif // CONFIG_ALT_INTRA
|
||||
1, 1, 0, 1, // INTER_MODES (ZEROMV == 0)
|
||||
#if CONFIG_EXT_INTER
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 0, 1 // INTER_COMPOUND_MODES (ZERO_ZEROMV == 0)
|
||||
#endif // CONFIG_EXT_INTER
|
||||
1, 1, 1, 1, 1, 1, 0, 1 // INTER_COMPOUND_MODES (ZERO_ZEROMV == 0)
|
||||
#endif // CONFIG_EXT_INTER
|
||||
};
|
||||
|
||||
static void update_sharpness(loop_filter_info_n *lfi, int sharpness_lvl) {
|
||||
|
|
@ -345,8 +348,6 @@ static uint8_t get_filter_level(const loop_filter_info_n *lfi_n,
|
|||
}
|
||||
#endif
|
||||
|
||||
#define NELEMENTS(x) (sizeof((x)) / sizeof((x)[0]))
|
||||
|
||||
void av1_loop_filter_init(AV1_COMMON *cm) {
|
||||
assert(MB_MODE_COUNT == NELEMENTS(mode_lf_lut));
|
||||
loop_filter_info_n *lfi = &cm->lf_info;
|
||||
|
|
@ -1362,9 +1363,10 @@ typedef struct {
|
|||
// the non420 case).
|
||||
// Note: 'row_masks_ptr' and/or 'col_masks_ptr' can be passed NULL.
|
||||
static void get_filter_level_and_masks_non420(
|
||||
AV1_COMMON *const cm, const struct macroblockd_plane *const plane,
|
||||
AV1_COMMON *const cm, const struct macroblockd_plane *const plane, int pl,
|
||||
MODE_INFO **mib, int mi_row, int mi_col, int idx_r, uint8_t *const lfl_r,
|
||||
unsigned int *const mask_4x4_int_r, FilterMasks *const row_masks_ptr,
|
||||
unsigned int *const mask_4x4_int_r_ptr,
|
||||
unsigned int *const mask_4x4_int_c_ptr, FilterMasks *const row_masks_ptr,
|
||||
FilterMasks *const col_masks_ptr) {
|
||||
const int ss_x = plane->subsampling_x;
|
||||
const int ss_y = plane->subsampling_y;
|
||||
|
|
@ -1372,7 +1374,7 @@ static void get_filter_level_and_masks_non420(
|
|||
FilterMasks row_masks, col_masks;
|
||||
memset(&row_masks, 0, sizeof(row_masks));
|
||||
memset(&col_masks, 0, sizeof(col_masks));
|
||||
*mask_4x4_int_r = 0;
|
||||
unsigned int mask_4x4_int_r = 0, mask_4x4_int_c = 0;
|
||||
const int r = idx_r >> mi_height_log2_lookup[BLOCK_8X8];
|
||||
|
||||
// Determine the vertical edges that need filtering
|
||||
|
|
@ -1398,10 +1400,6 @@ static void get_filter_level_and_masks_non420(
|
|||
(num_4x4_blocks_high_lookup[sb_type] > 1) ? !blk_row : 1;
|
||||
const int skip_this_r = skip_this && !block_edge_above;
|
||||
|
||||
#if CONFIG_VAR_TX
|
||||
const TX_SIZE mb_tx_size = mbmi->inter_tx_size[blk_row][blk_col];
|
||||
#endif
|
||||
|
||||
TX_SIZE tx_size = (plane->plane_type == PLANE_TYPE_UV)
|
||||
? get_uv_tx_size(mbmi, plane)
|
||||
: mbmi->tx_size;
|
||||
|
|
@ -1411,9 +1409,6 @@ static void get_filter_level_and_masks_non420(
|
|||
const int skip_border_4x4_r =
|
||||
ss_y && mi_row + idx_r >= cm->mi_rows - mi_size_high[BLOCK_8X8];
|
||||
|
||||
TX_SIZE tx_size_c = txsize_horz_map[tx_size];
|
||||
TX_SIZE tx_size_r = txsize_vert_map[tx_size];
|
||||
|
||||
int tx_size_mask = 0;
|
||||
const int c_step = (c >> ss_x);
|
||||
const int r_step = (r >> ss_y);
|
||||
|
|
@ -1421,8 +1416,15 @@ static void get_filter_level_and_masks_non420(
|
|||
|
||||
#if CONFIG_VAR_TX
|
||||
if (is_inter_block(mbmi) && !mbmi->skip) {
|
||||
const int tx_row_idx =
|
||||
(blk_row * mi_size_high[BLOCK_8X8] << TX_UNIT_HIGH_LOG2) >> 1;
|
||||
const int tx_col_idx =
|
||||
(blk_col * mi_size_wide[BLOCK_8X8] << TX_UNIT_WIDE_LOG2) >> 1;
|
||||
const BLOCK_SIZE bsize =
|
||||
AOMMAX(BLOCK_4X4, get_plane_block_size(mbmi->sb_type, plane));
|
||||
const TX_SIZE mb_tx_size = mbmi->inter_tx_size[tx_row_idx][tx_col_idx];
|
||||
tx_size = (plane->plane_type == PLANE_TYPE_UV)
|
||||
? uv_txsize_lookup[sb_type][mb_tx_size][ss_x][ss_y]
|
||||
? uv_txsize_lookup[bsize][mb_tx_size][0][0]
|
||||
: mb_tx_size;
|
||||
}
|
||||
#endif
|
||||
|
|
@ -1435,12 +1437,29 @@ static void get_filter_level_and_masks_non420(
|
|||
#endif
|
||||
|
||||
#if CONFIG_VAR_TX
|
||||
tx_size_r = AOMMIN(tx_size, cm->above_txfm_context[mi_col + c]);
|
||||
tx_size_c =
|
||||
AOMMIN(tx_size, cm->left_txfm_context[(mi_row + r) & MAX_MIB_MASK]);
|
||||
TX_SIZE tx_size_r, tx_size_c;
|
||||
|
||||
cm->above_txfm_context[mi_col + c] = tx_size;
|
||||
cm->left_txfm_context[(mi_row + r) & MAX_MIB_MASK] = tx_size;
|
||||
const int tx_wide =
|
||||
AOMMIN(tx_size_wide[tx_size],
|
||||
tx_size_wide[cm->top_txfm_context[pl][(mi_col + idx_c)
|
||||
<< TX_UNIT_WIDE_LOG2]]);
|
||||
const int tx_high = AOMMIN(
|
||||
tx_size_high[tx_size],
|
||||
tx_size_high[cm->left_txfm_context[pl][((mi_row + idx_r) & MAX_MIB_MASK)
|
||||
<< TX_UNIT_HIGH_LOG2]]);
|
||||
|
||||
tx_size_c = get_sqr_tx_size(tx_wide);
|
||||
tx_size_r = get_sqr_tx_size(tx_high);
|
||||
|
||||
memset(cm->top_txfm_context[pl] + ((mi_col + idx_c) << TX_UNIT_WIDE_LOG2),
|
||||
tx_size, mi_size_wide[BLOCK_8X8] << TX_UNIT_WIDE_LOG2);
|
||||
memset(cm->left_txfm_context[pl] +
|
||||
(((mi_row + idx_r) & MAX_MIB_MASK) << TX_UNIT_HIGH_LOG2),
|
||||
tx_size, mi_size_high[BLOCK_8X8] << TX_UNIT_HIGH_LOG2);
|
||||
#else
|
||||
TX_SIZE tx_size_c = txsize_horz_map[tx_size];
|
||||
TX_SIZE tx_size_r = txsize_vert_map[tx_size];
|
||||
(void)pl;
|
||||
#endif // CONFIG_VAR_TX
|
||||
|
||||
if (tx_size_c == TX_32X32)
|
||||
|
|
@ -1477,7 +1496,7 @@ static void get_filter_level_and_masks_non420(
|
|||
|
||||
if (!skip_this && tx_size_c < TX_8X8 && !skip_border_4x4_c &&
|
||||
(c_step & tx_size_mask) == 0)
|
||||
*mask_4x4_int_r |= col_mask;
|
||||
mask_4x4_int_c |= col_mask;
|
||||
}
|
||||
|
||||
if (tx_size_r == TX_32X32)
|
||||
|
|
@ -1511,20 +1530,22 @@ static void get_filter_level_and_masks_non420(
|
|||
row_masks.m4x4 |= col_mask;
|
||||
}
|
||||
|
||||
if (!skip_this && tx_size_r < TX_8X8 && !skip_border_4x4_c &&
|
||||
if (!skip_this && tx_size_r < TX_8X8 && !skip_border_4x4_r &&
|
||||
((r >> ss_y) & tx_size_mask) == 0)
|
||||
*mask_4x4_int_r |= col_mask;
|
||||
mask_4x4_int_r |= col_mask;
|
||||
}
|
||||
}
|
||||
|
||||
if (row_masks_ptr) *row_masks_ptr = row_masks;
|
||||
if (col_masks_ptr) *col_masks_ptr = col_masks;
|
||||
if (mask_4x4_int_c_ptr) *mask_4x4_int_c_ptr = mask_4x4_int_c;
|
||||
if (mask_4x4_int_r_ptr) *mask_4x4_int_r_ptr = mask_4x4_int_r;
|
||||
}
|
||||
|
||||
void av1_filter_block_plane_non420_ver(AV1_COMMON *const cm,
|
||||
struct macroblockd_plane *plane,
|
||||
MODE_INFO **mib, int mi_row,
|
||||
int mi_col) {
|
||||
MODE_INFO **mib, int mi_row, int mi_col,
|
||||
int pl) {
|
||||
const int ss_y = plane->subsampling_y;
|
||||
const int row_step = mi_size_high[BLOCK_8X8] << ss_y;
|
||||
struct buf_2d *const dst = &plane->dst;
|
||||
|
|
@ -1537,8 +1558,8 @@ void av1_filter_block_plane_non420_ver(AV1_COMMON *const cm,
|
|||
unsigned int mask_4x4_int;
|
||||
FilterMasks col_masks;
|
||||
const int r = idx_r >> mi_height_log2_lookup[BLOCK_8X8];
|
||||
get_filter_level_and_masks_non420(cm, plane, mib, mi_row, mi_col, idx_r,
|
||||
&lfl[r][0], &mask_4x4_int, NULL,
|
||||
get_filter_level_and_masks_non420(cm, plane, pl, mib, mi_row, mi_col, idx_r,
|
||||
&lfl[r][0], NULL, &mask_4x4_int, NULL,
|
||||
&col_masks);
|
||||
|
||||
// Disable filtering on the leftmost column or tile boundary
|
||||
|
|
@ -1572,8 +1593,8 @@ void av1_filter_block_plane_non420_ver(AV1_COMMON *const cm,
|
|||
|
||||
void av1_filter_block_plane_non420_hor(AV1_COMMON *const cm,
|
||||
struct macroblockd_plane *plane,
|
||||
MODE_INFO **mib, int mi_row,
|
||||
int mi_col) {
|
||||
MODE_INFO **mib, int mi_row, int mi_col,
|
||||
int pl) {
|
||||
const int ss_y = plane->subsampling_y;
|
||||
const int row_step = mi_size_high[BLOCK_8X8] << ss_y;
|
||||
struct buf_2d *const dst = &plane->dst;
|
||||
|
|
@ -1585,16 +1606,13 @@ void av1_filter_block_plane_non420_hor(AV1_COMMON *const cm,
|
|||
for (idx_r = 0; idx_r < cm->mib_size && mi_row + idx_r < cm->mi_rows;
|
||||
idx_r += row_step) {
|
||||
const int r = idx_r >> mi_height_log2_lookup[BLOCK_8X8];
|
||||
get_filter_level_and_masks_non420(cm, plane, mib, mi_row, mi_col, idx_r,
|
||||
&lfl[r][0], mask_4x4_int + r,
|
||||
get_filter_level_and_masks_non420(cm, plane, pl, mib, mi_row, mi_col, idx_r,
|
||||
&lfl[r][0], mask_4x4_int + r, NULL,
|
||||
row_masks_array + r, NULL);
|
||||
}
|
||||
for (idx_r = 0; idx_r < cm->mib_size && mi_row + idx_r < cm->mi_rows;
|
||||
idx_r += row_step) {
|
||||
const int skip_border_4x4_r =
|
||||
ss_y && mi_row + idx_r >= cm->mi_rows - mi_size_wide[BLOCK_8X8];
|
||||
const int r = idx_r >> mi_width_log2_lookup[BLOCK_8X8];
|
||||
const unsigned int mask_4x4_int_r = skip_border_4x4_r ? 0 : mask_4x4_int[r];
|
||||
FilterMasks row_masks;
|
||||
|
||||
#if CONFIG_LOOPFILTERING_ACROSS_TILES
|
||||
|
|
@ -1615,12 +1633,12 @@ void av1_filter_block_plane_non420_hor(AV1_COMMON *const cm,
|
|||
if (cm->use_highbitdepth)
|
||||
highbd_filter_selectively_horiz(
|
||||
CONVERT_TO_SHORTPTR(dst->buf), dst->stride, row_masks.m16x16,
|
||||
row_masks.m8x8, row_masks.m4x4, mask_4x4_int_r, &cm->lf_info,
|
||||
row_masks.m8x8, row_masks.m4x4, mask_4x4_int[r], &cm->lf_info,
|
||||
&lfl[r][0], (int)cm->bit_depth);
|
||||
else
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
filter_selectively_horiz(dst->buf, dst->stride, row_masks.m16x16,
|
||||
row_masks.m8x8, row_masks.m4x4, mask_4x4_int_r,
|
||||
row_masks.m8x8, row_masks.m4x4, mask_4x4_int[r],
|
||||
&cm->lf_info, &lfl[r][0]);
|
||||
dst->buf += 8 * dst->stride;
|
||||
}
|
||||
|
|
@ -1839,8 +1857,6 @@ void av1_filter_block_plane_ss11_hor(AV1_COMMON *const cm,
|
|||
dst->buf = dst0;
|
||||
}
|
||||
|
||||
#if !(CONFIG_VAR_TX || CONFIG_EXT_PARTITION || CONFIG_EXT_PARTITION_TYPES || \
|
||||
CONFIG_CB4X4)
|
||||
#if CONFIG_PARALLEL_DEBLOCKING
|
||||
typedef enum EDGE_DIR { VERT_EDGE = 0, HORZ_EDGE = 1, NUM_EDGE_DIRS } EDGE_DIR;
|
||||
static const uint32_t av1_prediction_masks[NUM_EDGE_DIRS][BLOCK_SIZES] = {
|
||||
|
|
@ -1900,7 +1916,7 @@ static const uint32_t av1_prediction_masks[NUM_EDGE_DIRS][BLOCK_SIZES] = {
|
|||
|
||||
static const uint32_t av1_transform_masks[NUM_EDGE_DIRS][TX_SIZES_ALL] = {
|
||||
{
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
2 - 1, // TX_2X2
|
||||
#endif
|
||||
4 - 1, // TX_4X4
|
||||
|
|
@ -1922,7 +1938,7 @@ static const uint32_t av1_transform_masks[NUM_EDGE_DIRS][TX_SIZES_ALL] = {
|
|||
32 - 1 // TX_32X8
|
||||
},
|
||||
{
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
2 - 1, // TX_2X2
|
||||
#endif
|
||||
4 - 1, // TX_4X4
|
||||
|
|
@ -1992,10 +2008,17 @@ static void set_lpf_parameters(AV1_DEBLOCKING_PARAMETERS *const pParams,
|
|||
// not sure if changes are required.
|
||||
assert(0 && "Not yet updated");
|
||||
#endif // CONFIG_EXT_PARTITION
|
||||
|
||||
{
|
||||
const TX_SIZE ts =
|
||||
av1_get_transform_size(ppCurr[0], edgeDir, scaleHorz, scaleVert);
|
||||
#if CONFIG_EXT_DELTA_Q
|
||||
const uint32_t currLevel =
|
||||
get_filter_level(cm, &cm->lf_info, &ppCurr[0]->mbmi);
|
||||
#else
|
||||
const uint32_t currLevel = get_filter_level(&cm->lf_info, &ppCurr[0]->mbmi);
|
||||
#endif // CONFIG_EXT_DELTA_Q
|
||||
|
||||
const int currSkipped =
|
||||
ppCurr[0]->mbmi.skip && is_inter_block(&ppCurr[0]->mbmi);
|
||||
const uint32_t coord = (VERT_EDGE == edgeDir) ? (x) : (y);
|
||||
|
|
@ -2016,7 +2039,13 @@ static void set_lpf_parameters(AV1_DEBLOCKING_PARAMETERS *const pParams,
|
|||
const MODE_INFO *const pPrev = *(ppCurr - modeStep);
|
||||
const TX_SIZE pvTs =
|
||||
av1_get_transform_size(pPrev, edgeDir, scaleHorz, scaleVert);
|
||||
#if CONFIG_EXT_DELTA_Q
|
||||
const uint32_t pvLvl =
|
||||
get_filter_level(cm, &cm->lf_info, &pPrev->mbmi);
|
||||
#else
|
||||
const uint32_t pvLvl = get_filter_level(&cm->lf_info, &pPrev->mbmi);
|
||||
#endif // CONFIG_EXT_DELTA_Q
|
||||
|
||||
const int pvSkip = pPrev->mbmi.skip && is_inter_block(&pPrev->mbmi);
|
||||
const int32_t puEdge =
|
||||
(coord &
|
||||
|
|
@ -2028,7 +2057,7 @@ static void set_lpf_parameters(AV1_DEBLOCKING_PARAMETERS *const pParams,
|
|||
// if the current and the previous blocks are skipped,
|
||||
// deblock the edge if the edge belongs to a PU's edge only.
|
||||
if ((currLevel || pvLvl) && (!pvSkip || !currSkipped || puEdge)) {
|
||||
#if CONFIG_PARALLEL_DEBLOCKING_15TAP || CONFIG_PARALLEL_DEBLOCKING_15TAPLUMAONLY
|
||||
#if CONFIG_PARALLEL_DEBLOCKING_15TAP || PARALLEL_DEBLOCKING_15TAPLUMAONLY
|
||||
const TX_SIZE minTs = AOMMIN(ts, pvTs);
|
||||
if (TX_4X4 >= minTs) {
|
||||
pParams->filterLength = 4;
|
||||
|
|
@ -2036,7 +2065,7 @@ static void set_lpf_parameters(AV1_DEBLOCKING_PARAMETERS *const pParams,
|
|||
pParams->filterLength = 8;
|
||||
} else {
|
||||
pParams->filterLength = 16;
|
||||
#if CONFIG_PARALLEL_DEBLOCKING_15TAPLUMAONLY
|
||||
#if PARALLEL_DEBLOCKING_15TAPLUMAONLY
|
||||
// No wide filtering for chroma plane
|
||||
if (scaleHorz || scaleVert) {
|
||||
pParams->filterLength = 8;
|
||||
|
|
@ -2046,7 +2075,7 @@ static void set_lpf_parameters(AV1_DEBLOCKING_PARAMETERS *const pParams,
|
|||
#else
|
||||
pParams->filterLength = (TX_4X4 >= AOMMIN(ts, pvTs)) ? (4) : (8);
|
||||
|
||||
#endif // CONFIG_PARALLEL_DEBLOCKING_15TAP
|
||||
#endif // CONFIG_PARALLEL_DEBLOCKING_15TAP || PARALLEL_DEBLOCKING_15TAPLUMAONLY
|
||||
|
||||
// update the level if the current block is skipped,
|
||||
// but the previous one is not
|
||||
|
|
@ -2054,10 +2083,14 @@ static void set_lpf_parameters(AV1_DEBLOCKING_PARAMETERS *const pParams,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if !CONFIG_CB4X4
|
||||
// prepare internal edge parameters
|
||||
if (currLevel && !currSkipped) {
|
||||
pParams->filterLengthInternal = (TX_4X4 >= ts) ? (4) : (0);
|
||||
}
|
||||
#endif
|
||||
|
||||
// prepare common parameters
|
||||
if (pParams->filterLength || pParams->filterLengthInternal) {
|
||||
const loop_filter_thresh *const limits = cm->lf_info.lfthr + level;
|
||||
|
|
@ -2075,15 +2108,21 @@ static void av1_filter_block_plane_vert(const AV1_COMMON *const cm,
|
|||
const ptrdiff_t modeStride,
|
||||
const uint32_t cuX,
|
||||
const uint32_t cuY) {
|
||||
const int col_step = MI_SIZE >> MI_SIZE_LOG2;
|
||||
const int row_step = MI_SIZE >> MI_SIZE_LOG2;
|
||||
const uint32_t scaleHorz = pPlane->subsampling_x;
|
||||
const uint32_t scaleVert = pPlane->subsampling_y;
|
||||
const uint32_t width = pPlane->dst.width;
|
||||
const uint32_t height = pPlane->dst.height;
|
||||
uint8_t *const pDst = pPlane->dst.buf;
|
||||
const int dstStride = pPlane->dst.stride;
|
||||
for (int y = 0; y < (MAX_MIB_SIZE >> scaleVert); y += 1) {
|
||||
for (int y = 0; y < (MAX_MIB_SIZE >> scaleVert); y += row_step) {
|
||||
uint8_t *p = pDst + y * MI_SIZE * dstStride;
|
||||
for (int x = 0; x < (MAX_MIB_SIZE >> scaleHorz); x += 1) {
|
||||
for (int x = 0; x < (MAX_MIB_SIZE >> scaleHorz); x += col_step) {
|
||||
// inner loop always filter vertical edges in a MI block. If MI size
|
||||
// is 8x8, it will filter the vertical edge aligned with a 8x8 block.
|
||||
// If 4x4 trasnform is used, it will then filter the internal edge
|
||||
// aligned with a 4x4 block
|
||||
const MODE_INFO **const pCurr =
|
||||
ppModeInfo + (y << scaleVert) * modeStride + (x << scaleHorz);
|
||||
AV1_DEBLOCKING_PARAMETERS params;
|
||||
|
|
@ -2094,31 +2133,59 @@ static void av1_filter_block_plane_vert(const AV1_COMMON *const cm,
|
|||
switch (params.filterLength) {
|
||||
// apply 4-tap filtering
|
||||
case 4:
|
||||
aom_lpf_vertical_4(p, dstStride, params.mblim, params.lim,
|
||||
params.hev_thr);
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
if (cm->use_highbitdepth)
|
||||
aom_highbd_lpf_vertical_4_c(CONVERT_TO_SHORTPTR(p), dstStride,
|
||||
params.mblim, params.lim,
|
||||
params.hev_thr, cm->bit_depth);
|
||||
else
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
aom_lpf_vertical_4_c(p, dstStride, params.mblim, params.lim,
|
||||
params.hev_thr);
|
||||
break;
|
||||
// apply 8-tap filtering
|
||||
case 8:
|
||||
aom_lpf_vertical_8(p, dstStride, params.mblim, params.lim,
|
||||
params.hev_thr);
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
if (cm->use_highbitdepth)
|
||||
aom_highbd_lpf_vertical_8_c(CONVERT_TO_SHORTPTR(p), dstStride,
|
||||
params.mblim, params.lim,
|
||||
params.hev_thr, cm->bit_depth);
|
||||
else
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
aom_lpf_vertical_8_c(p, dstStride, params.mblim, params.lim,
|
||||
params.hev_thr);
|
||||
break;
|
||||
#if CONFIG_PARALLEL_DEBLOCKING_15TAP || CONFIG_PARALLEL_DEBLOCKING_15TAPLUMAONLY
|
||||
#if CONFIG_PARALLEL_DEBLOCKING_15TAP || PARALLEL_DEBLOCKING_15TAPLUMAONLY
|
||||
// apply 16-tap filtering
|
||||
case 16:
|
||||
aom_lpf_vertical_16(p, dstStride, params.mblim, params.lim,
|
||||
params.hev_thr);
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
if (cm->use_highbitdepth)
|
||||
aom_highbd_lpf_vertical_16_c(CONVERT_TO_SHORTPTR(p), dstStride,
|
||||
params.mblim, params.lim,
|
||||
params.hev_thr, cm->bit_depth);
|
||||
else
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
aom_lpf_vertical_16_c(p, dstStride, params.mblim, params.lim,
|
||||
params.hev_thr);
|
||||
break;
|
||||
#endif // CONFIG_PARALLEL_DEBLOCKING_15TAP
|
||||
#endif // CONFIG_PARALLEL_DEBLOCKING_15TAP || PARALLEL_DEBLOCKING_15TAPLUMAONLY
|
||||
// no filtering
|
||||
default: break;
|
||||
}
|
||||
// process the internal edge
|
||||
if (params.filterLengthInternal) {
|
||||
aom_lpf_vertical_4(p + 4, dstStride, params.mblim, params.lim,
|
||||
params.hev_thr);
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
if (cm->use_highbitdepth)
|
||||
aom_highbd_lpf_vertical_4_c(CONVERT_TO_SHORTPTR(p + 4), dstStride,
|
||||
params.mblim, params.lim, params.hev_thr,
|
||||
cm->bit_depth);
|
||||
else
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
aom_lpf_vertical_4_c(p + 4, dstStride, params.mblim, params.lim,
|
||||
params.hev_thr);
|
||||
}
|
||||
// advance the destination pointer
|
||||
p += 8;
|
||||
p += MI_SIZE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2129,15 +2196,21 @@ static void av1_filter_block_plane_horz(const AV1_COMMON *const cm,
|
|||
const ptrdiff_t modeStride,
|
||||
const uint32_t cuX,
|
||||
const uint32_t cuY) {
|
||||
const int col_step = MI_SIZE >> MI_SIZE_LOG2;
|
||||
const int row_step = MI_SIZE >> MI_SIZE_LOG2;
|
||||
const uint32_t scaleHorz = pPlane->subsampling_x;
|
||||
const uint32_t scaleVert = pPlane->subsampling_y;
|
||||
const uint32_t width = pPlane->dst.width;
|
||||
const uint32_t height = pPlane->dst.height;
|
||||
uint8_t *const pDst = pPlane->dst.buf;
|
||||
const int dstStride = pPlane->dst.stride;
|
||||
for (int y = 0; y < (MAX_MIB_SIZE >> scaleVert); y += 1) {
|
||||
for (int y = 0; y < (MAX_MIB_SIZE >> scaleVert); y += row_step) {
|
||||
uint8_t *p = pDst + y * MI_SIZE * dstStride;
|
||||
for (int x = 0; x < (MAX_MIB_SIZE >> scaleHorz); x += 1) {
|
||||
for (int x = 0; x < (MAX_MIB_SIZE >> scaleHorz); x += col_step) {
|
||||
// inner loop always filter vertical edges in a MI block. If MI size
|
||||
// is 8x8, it will first filter the vertical edge aligned with a 8x8
|
||||
// block. If 4x4 trasnform is used, it will then filter the internal
|
||||
// edge aligned with a 4x4 block
|
||||
const MODE_INFO **const pCurr =
|
||||
ppModeInfo + (y << scaleVert) * modeStride + (x << scaleHorz);
|
||||
AV1_DEBLOCKING_PARAMETERS params;
|
||||
|
|
@ -2148,52 +2221,84 @@ static void av1_filter_block_plane_horz(const AV1_COMMON *const cm,
|
|||
switch (params.filterLength) {
|
||||
// apply 4-tap filtering
|
||||
case 4:
|
||||
aom_lpf_horizontal_4(p, dstStride, params.mblim, params.lim,
|
||||
params.hev_thr);
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
if (cm->use_highbitdepth)
|
||||
aom_highbd_lpf_horizontal_4_c(CONVERT_TO_SHORTPTR(p), dstStride,
|
||||
params.mblim, params.lim,
|
||||
params.hev_thr, cm->bit_depth);
|
||||
else
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
aom_lpf_horizontal_4_c(p, dstStride, params.mblim, params.lim,
|
||||
params.hev_thr);
|
||||
break;
|
||||
// apply 8-tap filtering
|
||||
case 8:
|
||||
aom_lpf_horizontal_8(p, dstStride, params.mblim, params.lim,
|
||||
params.hev_thr);
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
if (cm->use_highbitdepth)
|
||||
aom_highbd_lpf_horizontal_8_c(CONVERT_TO_SHORTPTR(p), dstStride,
|
||||
params.mblim, params.lim,
|
||||
params.hev_thr, cm->bit_depth);
|
||||
else
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
aom_lpf_horizontal_8_c(p, dstStride, params.mblim, params.lim,
|
||||
params.hev_thr);
|
||||
break;
|
||||
#if CONFIG_PARALLEL_DEBLOCKING_15TAP || CONFIG_PARALLEL_DEBLOCKING_15TAPLUMAONLY
|
||||
#if CONFIG_PARALLEL_DEBLOCKING_15TAP || PARALLEL_DEBLOCKING_15TAPLUMAONLY
|
||||
// apply 16-tap filtering
|
||||
case 16:
|
||||
aom_lpf_horizontal_edge_16(p, dstStride, params.mblim, params.lim,
|
||||
params.hev_thr);
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
if (cm->use_highbitdepth)
|
||||
aom_highbd_lpf_horizontal_edge_16_c(
|
||||
CONVERT_TO_SHORTPTR(p), dstStride, params.mblim, params.lim,
|
||||
params.hev_thr, cm->bit_depth);
|
||||
else
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
aom_lpf_horizontal_edge_16_c(p, dstStride, params.mblim, params.lim,
|
||||
params.hev_thr);
|
||||
break;
|
||||
#endif // CONFIG_PARALLEL_DEBLOCKING_15TAP
|
||||
#endif // CONFIG_PARALLEL_DEBLOCKING_15TAP || PARALLEL_DEBLOCKING_15TAPLUMAONLY
|
||||
// no filtering
|
||||
default: break;
|
||||
}
|
||||
// process the internal edge
|
||||
if (params.filterLengthInternal) {
|
||||
aom_lpf_horizontal_4(p + 4 * dstStride, dstStride, params.mblim,
|
||||
params.lim, params.hev_thr);
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
if (cm->use_highbitdepth)
|
||||
aom_highbd_lpf_horizontal_4_c(CONVERT_TO_SHORTPTR(p + 4 * dstStride),
|
||||
dstStride, params.mblim, params.lim,
|
||||
params.hev_thr, cm->bit_depth);
|
||||
else
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
aom_lpf_horizontal_4_c(p + 4 * dstStride, dstStride, params.mblim,
|
||||
params.lim, params.hev_thr);
|
||||
}
|
||||
// advance the destination pointer
|
||||
p += 8;
|
||||
p += MI_SIZE;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // CONFIG_PARALLEL_DEBLOCKING
|
||||
#endif
|
||||
|
||||
void av1_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer, AV1_COMMON *cm,
|
||||
struct macroblockd_plane planes[MAX_MB_PLANE],
|
||||
int start, int stop, int y_only) {
|
||||
#if CONFIG_VAR_TX || CONFIG_EXT_PARTITION || CONFIG_EXT_PARTITION_TYPES || \
|
||||
CONFIG_CB4X4
|
||||
const int num_planes = y_only ? 1 : MAX_MB_PLANE;
|
||||
int mi_row, mi_col;
|
||||
|
||||
#if CONFIG_VAR_TX || CONFIG_EXT_PARTITION || CONFIG_EXT_PARTITION_TYPES || \
|
||||
CONFIG_CB4X4
|
||||
|
||||
#if !CONFIG_PARALLEL_DEBLOCKING
|
||||
#if CONFIG_VAR_TX
|
||||
memset(cm->above_txfm_context, TX_SIZES, cm->mi_cols);
|
||||
for (int i = 0; i < MAX_MB_PLANE; ++i)
|
||||
memset(cm->top_txfm_context[i], TX_32X32, cm->mi_cols << TX_UNIT_WIDE_LOG2);
|
||||
#endif // CONFIG_VAR_TX
|
||||
for (mi_row = start; mi_row < stop; mi_row += cm->mib_size) {
|
||||
MODE_INFO **mi = cm->mi_grid_visible + mi_row * cm->mi_stride;
|
||||
#if CONFIG_VAR_TX
|
||||
memset(cm->left_txfm_context, TX_SIZES, MAX_MIB_SIZE);
|
||||
for (int i = 0; i < MAX_MB_PLANE; ++i)
|
||||
memset(cm->left_txfm_context[i], TX_32X32, MAX_MIB_SIZE
|
||||
<< TX_UNIT_WIDE_LOG2);
|
||||
#endif // CONFIG_VAR_TX
|
||||
for (mi_col = 0; mi_col < cm->mi_cols; mi_col += cm->mib_size) {
|
||||
int plane;
|
||||
|
|
@ -2202,33 +2307,23 @@ void av1_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer, AV1_COMMON *cm,
|
|||
|
||||
for (plane = 0; plane < num_planes; ++plane) {
|
||||
av1_filter_block_plane_non420_ver(cm, &planes[plane], mi + mi_col,
|
||||
mi_row, mi_col);
|
||||
mi_row, mi_col, plane);
|
||||
av1_filter_block_plane_non420_hor(cm, &planes[plane], mi + mi_col,
|
||||
mi_row, mi_col);
|
||||
mi_row, mi_col, plane);
|
||||
}
|
||||
}
|
||||
}
|
||||
#else // CONFIG_VAR_TX || CONFIG_EXT_PARTITION || CONFIG_EXT_PARTITION_TYPES
|
||||
const int num_planes = y_only ? 1 : MAX_MB_PLANE;
|
||||
int mi_row, mi_col;
|
||||
#if !CONFIG_PARALLEL_DEBLOCKING
|
||||
enum lf_path path;
|
||||
LOOP_FILTER_MASK lfm;
|
||||
#else
|
||||
|
||||
#if CONFIG_VAR_TX || CONFIG_EXT_PARTITION || CONFIG_EXT_PARTITION_TYPES
|
||||
assert(0 && "Not yet updated. ToDo as next steps");
|
||||
#endif // CONFIG_VAR_TX || CONFIG_EXT_PARTITION || CONFIG_EXT_PARTITION_TYPES
|
||||
|
||||
if (y_only)
|
||||
path = LF_PATH_444;
|
||||
else if (planes[1].subsampling_y == 1 && planes[1].subsampling_x == 1)
|
||||
path = LF_PATH_420;
|
||||
else if (planes[1].subsampling_y == 0 && planes[1].subsampling_x == 0)
|
||||
path = LF_PATH_444;
|
||||
else
|
||||
path = LF_PATH_SLOW;
|
||||
#endif
|
||||
#if CONFIG_PARALLEL_DEBLOCKING
|
||||
for (mi_row = start; mi_row < stop; mi_row += MAX_MIB_SIZE) {
|
||||
MODE_INFO **mi = cm->mi_grid_visible + mi_row * cm->mi_stride;
|
||||
for (mi_col = 0; mi_col < cm->mi_cols; mi_col += MAX_MIB_SIZE) {
|
||||
av1_setup_dst_planes(planes, cm->sb_size, frame_buffer, mi_row, mi_col);
|
||||
// filter all vertical edges in every 64x64 super block
|
||||
for (int planeIdx = 0; planeIdx < num_planes; planeIdx += 1) {
|
||||
const int32_t scaleHorz = planes[planeIdx].subsampling_x;
|
||||
const int32_t scaleVert = planes[planeIdx].subsampling_y;
|
||||
|
|
@ -2243,6 +2338,42 @@ void av1_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer, AV1_COMMON *cm,
|
|||
MODE_INFO **mi = cm->mi_grid_visible + mi_row * cm->mi_stride;
|
||||
for (mi_col = 0; mi_col < cm->mi_cols; mi_col += MAX_MIB_SIZE) {
|
||||
av1_setup_dst_planes(planes, cm->sb_size, frame_buffer, mi_row, mi_col);
|
||||
// filter all horizontal edges in every 64x64 super block
|
||||
for (int planeIdx = 0; planeIdx < num_planes; planeIdx += 1) {
|
||||
const int32_t scaleHorz = planes[planeIdx].subsampling_x;
|
||||
const int32_t scaleVert = planes[planeIdx].subsampling_y;
|
||||
av1_filter_block_plane_horz(
|
||||
cm, planes + planeIdx, (const MODE_INFO **)(mi + mi_col),
|
||||
cm->mi_stride, (mi_col * MI_SIZE) >> scaleHorz,
|
||||
(mi_row * MI_SIZE) >> scaleVert);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // CONFIG_PARALLEL_DEBLOCKING
|
||||
|
||||
#else // CONFIG_VAR_TX || CONFIG_EXT_PARTITION || CONFIG_EXT_PARTITION_TYPES
|
||||
|
||||
#if CONFIG_PARALLEL_DEBLOCKING
|
||||
for (mi_row = start; mi_row < stop; mi_row += MAX_MIB_SIZE) {
|
||||
MODE_INFO **mi = cm->mi_grid_visible + mi_row * cm->mi_stride;
|
||||
for (mi_col = 0; mi_col < cm->mi_cols; mi_col += MAX_MIB_SIZE) {
|
||||
av1_setup_dst_planes(planes, cm->sb_size, frame_buffer, mi_row, mi_col);
|
||||
// filter all vertical edges in every 64x64 super block
|
||||
for (int planeIdx = 0; planeIdx < num_planes; planeIdx += 1) {
|
||||
const int32_t scaleHorz = planes[planeIdx].subsampling_x;
|
||||
const int32_t scaleVert = planes[planeIdx].subsampling_y;
|
||||
av1_filter_block_plane_vert(
|
||||
cm, planes + planeIdx, (const MODE_INFO **)(mi + mi_col),
|
||||
cm->mi_stride, (mi_col * MI_SIZE) >> scaleHorz,
|
||||
(mi_row * MI_SIZE) >> scaleVert);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (mi_row = start; mi_row < stop; mi_row += MAX_MIB_SIZE) {
|
||||
MODE_INFO **mi = cm->mi_grid_visible + mi_row * cm->mi_stride;
|
||||
for (mi_col = 0; mi_col < cm->mi_cols; mi_col += MAX_MIB_SIZE) {
|
||||
av1_setup_dst_planes(planes, cm->sb_size, frame_buffer, mi_row, mi_col);
|
||||
// filter all horizontal edges in every 64x64 super block
|
||||
for (int planeIdx = 0; planeIdx < num_planes; planeIdx += 1) {
|
||||
const int32_t scaleHorz = planes[planeIdx].subsampling_x;
|
||||
const int32_t scaleVert = planes[planeIdx].subsampling_y;
|
||||
|
|
@ -2254,6 +2385,18 @@ void av1_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer, AV1_COMMON *cm,
|
|||
}
|
||||
}
|
||||
#else // CONFIG_PARALLEL_DEBLOCKING
|
||||
enum lf_path path;
|
||||
LOOP_FILTER_MASK lfm;
|
||||
|
||||
if (y_only)
|
||||
path = LF_PATH_444;
|
||||
else if (planes[1].subsampling_y == 1 && planes[1].subsampling_x == 1)
|
||||
path = LF_PATH_420;
|
||||
else if (planes[1].subsampling_y == 0 && planes[1].subsampling_x == 0)
|
||||
path = LF_PATH_444;
|
||||
else
|
||||
path = LF_PATH_SLOW;
|
||||
|
||||
for (mi_row = start; mi_row < stop; mi_row += MAX_MIB_SIZE) {
|
||||
MODE_INFO **mi = cm->mi_grid_visible + mi_row * cm->mi_stride;
|
||||
for (mi_col = 0; mi_col < cm->mi_cols; mi_col += MAX_MIB_SIZE) {
|
||||
|
|
@ -2278,9 +2421,9 @@ void av1_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer, AV1_COMMON *cm,
|
|||
break;
|
||||
case LF_PATH_SLOW:
|
||||
av1_filter_block_plane_non420_ver(cm, &planes[plane], mi + mi_col,
|
||||
mi_row, mi_col);
|
||||
mi_row, mi_col, plane);
|
||||
av1_filter_block_plane_non420_hor(cm, &planes[plane], mi + mi_col,
|
||||
mi_row, mi_col);
|
||||
mi_row, mi_col, plane);
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
4
third_party/aom/av1/common/av1_loopfilter.h
vendored
4
third_party/aom/av1/common/av1_loopfilter.h
vendored
|
|
@ -115,11 +115,11 @@ void av1_filter_block_plane_ss11_hor(struct AV1Common *const cm,
|
|||
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 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 mi_col, int pl);
|
||||
|
||||
void av1_loop_filter_init(struct AV1Common *cm);
|
||||
|
||||
|
|
|
|||
20
third_party/aom/av1/common/av1_rtcd_defs.pl
vendored
20
third_party/aom/av1/common/av1_rtcd_defs.pl
vendored
|
|
@ -312,6 +312,7 @@ if (aom_config("CONFIG_AOM_QM") eq "yes") {
|
|||
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";
|
||||
|
||||
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/;
|
||||
|
||||
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";
|
||||
|
||||
|
|
@ -399,6 +400,13 @@ if (aom_config("CONFIG_HIGHBITDEPTH") ne "yes") {
|
|||
|
||||
add_proto qw/void av1_fwd_idtx/, "const int16_t *src_diff, tran_low_t *coeff, int stride, int bs, int tx_type";
|
||||
|
||||
if (aom_config("CONFIG_DPCM_INTRA") eq "yes") {
|
||||
@sizes = (4, 8, 16, 32);
|
||||
foreach $size (@sizes) {
|
||||
add_proto "void", "av1_dpcm_ft$size", "const int16_t *input, int stride, TX_TYPE_1D tx_type, tran_low_t *output";
|
||||
}
|
||||
}
|
||||
|
||||
if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
|
||||
#fwd txfm
|
||||
add_proto qw/void av1_fwd_txfm2d_4x4/, "const int16_t *input, int32_t *output, int stride, int tx_type, int bd";
|
||||
|
|
@ -608,15 +616,21 @@ if (aom_config("CONFIG_PVQ") eq "yes") {
|
|||
|
||||
if ((aom_config("CONFIG_WARPED_MOTION") eq "yes") ||
|
||||
(aom_config("CONFIG_GLOBAL_MOTION") eq "yes")) {
|
||||
add_proto qw/void av1_warp_affine/, "int32_t *mat, 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, int ref_frm, int16_t alpha, int16_t beta, int16_t gamma, int16_t delta";
|
||||
specialize qw/av1_warp_affine sse2/;
|
||||
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, int comp_avg, int16_t alpha, int16_t beta, int16_t gamma, int16_t delta";
|
||||
specialize qw/av1_warp_affine sse2 ssse3/;
|
||||
|
||||
if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
|
||||
add_proto qw/void av1_highbd_warp_affine/, "int32_t *mat, 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, int ref_frm, int16_t alpha, int16_t beta, int16_t gamma, int16_t delta";
|
||||
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, int comp_avg, int16_t alpha, int16_t beta, int16_t gamma, int16_t delta";
|
||||
specialize qw/av1_highbd_warp_affine ssse3/;
|
||||
}
|
||||
}
|
||||
|
||||
if (aom_config("CONFIG_GLOBAL_MOTION") eq "yes" &&
|
||||
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") {
|
||||
|
|
|
|||
49
third_party/aom/av1/common/av1_txfm.h
vendored
49
third_party/aom/av1/common/av1_txfm.h
vendored
|
|
@ -24,7 +24,7 @@ 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[7][64] = {
|
||||
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,
|
||||
|
|
@ -68,6 +68,10 @@ static const int32_t cospi_arr[7][64] = {
|
|||
14359, 12785, 11204, 9616, 8022, 6424, 4821, 3216, 1608 }
|
||||
};
|
||||
|
||||
static INLINE const int32_t *cospi_arr(int n) {
|
||||
return 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;
|
||||
|
|
@ -139,26 +143,27 @@ typedef enum TXFM_TYPE {
|
|||
TXFM_TYPE_ADST8,
|
||||
TXFM_TYPE_ADST16,
|
||||
TXFM_TYPE_ADST32,
|
||||
TXFM_TYPE_IDENTITY4,
|
||||
TXFM_TYPE_IDENTITY8,
|
||||
TXFM_TYPE_IDENTITY16,
|
||||
TXFM_TYPE_IDENTITY32,
|
||||
} TXFM_TYPE;
|
||||
|
||||
typedef struct TXFM_2D_CFG {
|
||||
typedef struct TXFM_1D_CFG {
|
||||
const int txfm_size;
|
||||
const int stage_num_col;
|
||||
const int stage_num_row;
|
||||
const int stage_num;
|
||||
|
||||
const int8_t *shift;
|
||||
const int8_t *stage_range_col;
|
||||
const int8_t *stage_range_row;
|
||||
const int8_t *cos_bit_col;
|
||||
const int8_t *cos_bit_row;
|
||||
const TXFM_TYPE txfm_type_col;
|
||||
const TXFM_TYPE txfm_type_row;
|
||||
} TXFM_2D_CFG;
|
||||
const int8_t *stage_range;
|
||||
const int8_t *cos_bit;
|
||||
const TXFM_TYPE txfm_type;
|
||||
} TXFM_1D_CFG;
|
||||
|
||||
typedef struct TXFM_2D_FLIP_CFG {
|
||||
int ud_flip; // flip upside down
|
||||
int lr_flip; // flip left to right
|
||||
const TXFM_2D_CFG *cfg;
|
||||
const TXFM_1D_CFG *col_cfg;
|
||||
const TXFM_1D_CFG *row_cfg;
|
||||
} TXFM_2D_FLIP_CFG;
|
||||
|
||||
static INLINE void set_flip_cfg(int tx_type, TXFM_2D_FLIP_CFG *cfg) {
|
||||
|
|
@ -171,11 +176,23 @@ static INLINE void set_flip_cfg(int tx_type, TXFM_2D_FLIP_CFG *cfg) {
|
|||
cfg->lr_flip = 0;
|
||||
break;
|
||||
#if CONFIG_EXT_TX
|
||||
case IDTX:
|
||||
case V_DCT:
|
||||
case H_DCT:
|
||||
case V_ADST:
|
||||
case H_ADST:
|
||||
cfg->ud_flip = 0;
|
||||
cfg->lr_flip = 0;
|
||||
break;
|
||||
case FLIPADST_DCT:
|
||||
case FLIPADST_ADST:
|
||||
case V_FLIPADST:
|
||||
cfg->ud_flip = 1;
|
||||
cfg->lr_flip = 0;
|
||||
break;
|
||||
case DCT_FLIPADST:
|
||||
case ADST_FLIPADST:
|
||||
case H_FLIPADST:
|
||||
cfg->ud_flip = 0;
|
||||
cfg->lr_flip = 1;
|
||||
break;
|
||||
|
|
@ -183,14 +200,6 @@ static INLINE void set_flip_cfg(int tx_type, TXFM_2D_FLIP_CFG *cfg) {
|
|||
cfg->ud_flip = 1;
|
||||
cfg->lr_flip = 1;
|
||||
break;
|
||||
case ADST_FLIPADST:
|
||||
cfg->ud_flip = 0;
|
||||
cfg->lr_flip = 1;
|
||||
break;
|
||||
case FLIPADST_ADST:
|
||||
cfg->ud_flip = 1;
|
||||
cfg->lr_flip = 0;
|
||||
break;
|
||||
#endif // CONFIG_EXT_TX
|
||||
default:
|
||||
cfg->ud_flip = 0;
|
||||
|
|
|
|||
56
third_party/aom/av1/common/blockd.c
vendored
56
third_party/aom/av1/common/blockd.c
vendored
|
|
@ -179,15 +179,15 @@ void av1_foreach_transformed_block(const MACROBLOCKD *const xd,
|
|||
#endif
|
||||
|
||||
#if CONFIG_DAALA_DIST
|
||||
void av1_foreach_8x8_transformed_block_in_plane(
|
||||
const MACROBLOCKD *const xd, BLOCK_SIZE bsize, int plane,
|
||||
void av1_foreach_8x8_transformed_block_in_yplane(
|
||||
const MACROBLOCKD *const xd, BLOCK_SIZE bsize,
|
||||
foreach_transformed_block_visitor visit,
|
||||
foreach_transformed_block_visitor mi_visit, void *arg) {
|
||||
const struct macroblockd_plane *const pd = &xd->plane[plane];
|
||||
const struct macroblockd_plane *const pd = &xd->plane[0];
|
||||
// block and transform sizes, in number of 4x4 blocks log 2 ("*_b")
|
||||
// 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 = get_tx_size(plane, xd);
|
||||
const TX_SIZE tx_size = get_tx_size(0, xd);
|
||||
const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd);
|
||||
const uint8_t txw_unit = tx_size_wide_unit[tx_size];
|
||||
const uint8_t txh_unit = tx_size_high_unit[tx_size];
|
||||
|
|
@ -197,18 +197,24 @@ void av1_foreach_8x8_transformed_block_in_plane(
|
|||
// If mb_to_right_edge is < 0 we are in a situation in which
|
||||
// the current block size extends into the UMV and we won't
|
||||
// visit the sub blocks that are wholly within the UMV.
|
||||
const int max_blocks_wide = max_block_wide(xd, plane_bsize, plane);
|
||||
const int max_blocks_high = max_block_high(xd, plane_bsize, plane);
|
||||
const int max_blocks_wide = max_block_wide(xd, plane_bsize, 0);
|
||||
const int max_blocks_high = max_block_high(xd, plane_bsize, 0);
|
||||
const int skip_check_r = tx_size_high[tx_size] == 8 ? 1 : 0;
|
||||
const int skip_check_c = tx_size_wide[tx_size] == 8 ? 1 : 0;
|
||||
|
||||
assert(plane_bsize >= BLOCK_8X8);
|
||||
assert(tx_size == TX_4X4 || tx_size == TX_4X8 || tx_size == TX_8X4);
|
||||
|
||||
// Keep track of the row and column of the blocks we use so that we know
|
||||
// if we are in the unrestricted motion border.
|
||||
for (r = 0; r < max_blocks_high; r += txh_unit) {
|
||||
// Skip visiting the sub blocks that are wholly within the UMV.
|
||||
for (c = 0; c < max_blocks_wide; c += txw_unit) {
|
||||
visit(plane, i, r, c, plane_bsize, tx_size, arg);
|
||||
// Call whenever each 8x8 block is done
|
||||
if ((r & 1) && (c & 1))
|
||||
mi_visit(plane, i, r - 1, c - 1, plane_bsize, TX_8X8, arg);
|
||||
visit(0, i, r, c, plane_bsize, tx_size, arg);
|
||||
// Call whenever each 8x8 tx block is done
|
||||
if (((r & txh_unit) || skip_check_r) && ((c & txw_unit) || skip_check_c))
|
||||
mi_visit(0, i, r - (1 - skip_check_r) * txh_unit,
|
||||
c - (1 - skip_check_c) * txw_unit, plane_bsize, tx_size, arg);
|
||||
i += step;
|
||||
}
|
||||
}
|
||||
|
|
@ -259,6 +265,36 @@ void av1_set_contexts(const MACROBLOCKD *xd, struct macroblockd_plane *pd,
|
|||
}
|
||||
#endif
|
||||
|
||||
void av1_reset_skip_context(MACROBLOCKD *xd, int mi_row, int mi_col,
|
||||
BLOCK_SIZE bsize) {
|
||||
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
|
||||
for (i = 0; i < nplanes; i++) {
|
||||
struct macroblockd_plane *const pd = &xd->plane[i];
|
||||
#if CONFIG_CHROMA_2X2 || !CONFIG_CB4X4
|
||||
const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd);
|
||||
#else
|
||||
const BLOCK_SIZE plane_bsize =
|
||||
AOMMAX(BLOCK_4X4, get_plane_block_size(bsize, pd));
|
||||
#endif
|
||||
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);
|
||||
memset(pd->left_context, 0, sizeof(ENTROPY_CONTEXT) * txs_high);
|
||||
}
|
||||
}
|
||||
|
||||
void av1_setup_block_planes(MACROBLOCKD *xd, int ss_x, int ss_y) {
|
||||
int i;
|
||||
|
||||
|
|
|
|||
206
third_party/aom/av1/common/blockd.h
vendored
206
third_party/aom/av1/common/blockd.h
vendored
|
|
@ -38,7 +38,11 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define SUB8X8_COMP_REF (!(CONFIG_CB4X4 && CONFIG_CHROMA_2X2))
|
||||
#if (CONFIG_CHROMA_SUB8X8 || CONFIG_CHROMA_2X2)
|
||||
#define SUB8X8_COMP_REF 0
|
||||
#else
|
||||
#define SUB8X8_COMP_REF 1
|
||||
#endif
|
||||
|
||||
#define MAX_MB_PLANE 3
|
||||
|
||||
|
|
@ -49,26 +53,20 @@ extern "C" {
|
|||
// 0: Uniform
|
||||
// 1: Difference weighted
|
||||
#define COMPOUND_SEGMENT_TYPE 1
|
||||
|
||||
#if COMPOUND_SEGMENT_TYPE == 0
|
||||
#define MAX_SEG_MASK_BITS 1
|
||||
|
||||
// SEG_MASK_TYPES should not surpass 1 << MAX_SEG_MASK_BITS
|
||||
typedef enum {
|
||||
#if COMPOUND_SEGMENT_TYPE == 0
|
||||
UNIFORM_45 = 0,
|
||||
UNIFORM_45_INV,
|
||||
SEG_MASK_TYPES,
|
||||
} SEG_MASK_TYPE;
|
||||
|
||||
#elif COMPOUND_SEGMENT_TYPE == 1
|
||||
#define MAX_SEG_MASK_BITS 1
|
||||
// SEG_MASK_TYPES should not surpass 1 << MAX_SEG_MASK_BITS
|
||||
typedef enum {
|
||||
DIFFWTD_42 = 0,
|
||||
DIFFWTD_42_INV,
|
||||
DIFFWTD_38 = 0,
|
||||
DIFFWTD_38_INV,
|
||||
#endif // COMPOUND_SEGMENT_TYPE
|
||||
SEG_MASK_TYPES,
|
||||
} SEG_MASK_TYPE;
|
||||
|
||||
#endif // COMPOUND_SEGMENT_TYPE
|
||||
#endif // CONFIG_COMPOUND_SEGMENT
|
||||
#endif // CONFIG_EXT_INTER
|
||||
|
||||
|
|
@ -131,7 +129,7 @@ static INLINE int is_inter_compound_mode(PREDICTION_MODE mode) {
|
|||
}
|
||||
|
||||
static INLINE PREDICTION_MODE compound_ref0_mode(PREDICTION_MODE mode) {
|
||||
static PREDICTION_MODE lut[MB_MODE_COUNT] = {
|
||||
static PREDICTION_MODE lut[] = {
|
||||
MB_MODE_COUNT, // DC_PRED
|
||||
MB_MODE_COUNT, // V_PRED
|
||||
MB_MODE_COUNT, // H_PRED
|
||||
|
|
@ -143,6 +141,10 @@ static INLINE PREDICTION_MODE compound_ref0_mode(PREDICTION_MODE mode) {
|
|||
MB_MODE_COUNT, // D63_PRED
|
||||
#if CONFIG_ALT_INTRA
|
||||
MB_MODE_COUNT, // SMOOTH_PRED
|
||||
#if CONFIG_SMOOTH_HV
|
||||
MB_MODE_COUNT, // SMOOTH_V_PRED
|
||||
MB_MODE_COUNT, // SMOOTH_H_PRED
|
||||
#endif // CONFIG_SMOOTH_HV
|
||||
#endif // CONFIG_ALT_INTRA
|
||||
MB_MODE_COUNT, // TM_PRED
|
||||
MB_MODE_COUNT, // NEARESTMV
|
||||
|
|
@ -157,8 +159,6 @@ static INLINE PREDICTION_MODE compound_ref0_mode(PREDICTION_MODE mode) {
|
|||
NEWMV, // SR_NEW_NEWMV
|
||||
#endif // CONFIG_COMPOUND_SINGLEREF
|
||||
NEARESTMV, // NEAREST_NEARESTMV
|
||||
NEARESTMV, // NEAREST_NEARMV
|
||||
NEARMV, // NEAR_NEARESTMV
|
||||
NEARMV, // NEAR_NEARMV
|
||||
NEARESTMV, // NEAREST_NEWMV
|
||||
NEWMV, // NEW_NEARESTMV
|
||||
|
|
@ -167,12 +167,13 @@ static INLINE PREDICTION_MODE compound_ref0_mode(PREDICTION_MODE mode) {
|
|||
ZEROMV, // ZERO_ZEROMV
|
||||
NEWMV, // NEW_NEWMV
|
||||
};
|
||||
assert(NELEMENTS(lut) == MB_MODE_COUNT);
|
||||
assert(is_inter_compound_mode(mode));
|
||||
return lut[mode];
|
||||
}
|
||||
|
||||
static INLINE PREDICTION_MODE compound_ref1_mode(PREDICTION_MODE mode) {
|
||||
static PREDICTION_MODE lut[MB_MODE_COUNT] = {
|
||||
static PREDICTION_MODE lut[] = {
|
||||
MB_MODE_COUNT, // DC_PRED
|
||||
MB_MODE_COUNT, // V_PRED
|
||||
MB_MODE_COUNT, // H_PRED
|
||||
|
|
@ -184,6 +185,10 @@ static INLINE PREDICTION_MODE compound_ref1_mode(PREDICTION_MODE mode) {
|
|||
MB_MODE_COUNT, // D63_PRED
|
||||
#if CONFIG_ALT_INTRA
|
||||
MB_MODE_COUNT, // SMOOTH_PRED
|
||||
#if CONFIG_SMOOTH_HV
|
||||
MB_MODE_COUNT, // SMOOTH_V_PRED
|
||||
MB_MODE_COUNT, // SMOOTH_H_PRED
|
||||
#endif // CONFIG_SMOOTH_HV
|
||||
#endif // CONFIG_ALT_INTRA
|
||||
MB_MODE_COUNT, // TM_PRED
|
||||
MB_MODE_COUNT, // NEARESTMV
|
||||
|
|
@ -198,8 +203,6 @@ static INLINE PREDICTION_MODE compound_ref1_mode(PREDICTION_MODE mode) {
|
|||
NEWMV, // SR_NEW_NEWMV
|
||||
#endif // CONFIG_COMPOUND_SINGLEREF
|
||||
NEARESTMV, // NEAREST_NEARESTMV
|
||||
NEARMV, // NEAREST_NEARMV
|
||||
NEARESTMV, // NEAR_NEARESTMV
|
||||
NEARMV, // NEAR_NEARMV
|
||||
NEWMV, // NEAREST_NEWMV
|
||||
NEARESTMV, // NEW_NEARESTMV
|
||||
|
|
@ -208,13 +211,14 @@ static INLINE PREDICTION_MODE compound_ref1_mode(PREDICTION_MODE mode) {
|
|||
ZEROMV, // ZERO_ZEROMV
|
||||
NEWMV, // NEW_NEWMV
|
||||
};
|
||||
assert(NELEMENTS(lut) == MB_MODE_COUNT);
|
||||
assert(is_inter_compound_mode(mode));
|
||||
return lut[mode];
|
||||
}
|
||||
|
||||
static INLINE int have_nearmv_in_inter_mode(PREDICTION_MODE mode) {
|
||||
return (mode == NEARMV || mode == NEAR_NEARMV || mode == NEAREST_NEARMV ||
|
||||
mode == NEAR_NEARESTMV || mode == NEAR_NEWMV || mode == NEW_NEARMV);
|
||||
return (mode == NEARMV || mode == NEAR_NEARMV || mode == NEAR_NEWMV ||
|
||||
mode == NEW_NEARMV);
|
||||
}
|
||||
|
||||
static INLINE int have_newmv_in_inter_mode(PREDICTION_MODE mode) {
|
||||
|
|
@ -260,9 +264,7 @@ static INLINE int have_newmv_in_inter_mode(PREDICTION_MODE mode) {
|
|||
typedef struct {
|
||||
PREDICTION_MODE as_mode;
|
||||
int_mv as_mv[2]; // first, second inter predictor motion vectors
|
||||
#if CONFIG_REF_MV
|
||||
int_mv pred_mv[2];
|
||||
#endif
|
||||
#if CONFIG_EXT_INTER
|
||||
int_mv ref_mv[2];
|
||||
#endif // CONFIG_EXT_INTER
|
||||
|
|
@ -274,12 +276,8 @@ typedef int8_t MV_REFERENCE_FRAME;
|
|||
typedef struct {
|
||||
// Number of base colors for Y (0) and UV (1)
|
||||
uint8_t palette_size[2];
|
||||
// Value of base colors for Y, U, and V
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
// Value of base colors for Y, U, and V
|
||||
uint16_t palette_colors[3 * PALETTE_MAX_SIZE];
|
||||
#else
|
||||
uint8_t palette_colors[3 * PALETTE_MAX_SIZE];
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
// Only used by encoder to store the color index of the top left pixel.
|
||||
// TODO(huisu): move this to encoder
|
||||
uint8_t palette_first_color_idx[2];
|
||||
|
|
@ -312,6 +310,9 @@ typedef struct RD_STATS {
|
|||
int64_t rdcost;
|
||||
int64_t sse;
|
||||
int skip; // sse should equal to dist when skip == 1
|
||||
#if CONFIG_DAALA_DIST && CONFIG_CB4X4
|
||||
int64_t dist_y;
|
||||
#endif
|
||||
#if CONFIG_RD_DEBUG
|
||||
int txb_coeff_cost[MAX_MB_PLANE];
|
||||
#if CONFIG_VAR_TX
|
||||
|
|
@ -338,7 +339,7 @@ typedef struct {
|
|||
#endif // CONFIG_EXT_INTER
|
||||
|
||||
// This structure now relates to 8x8 block regions.
|
||||
typedef struct {
|
||||
typedef struct MB_MODE_INFO {
|
||||
// Common for both INTER and INTRA blocks
|
||||
BLOCK_SIZE sb_type;
|
||||
PREDICTION_MODE mode;
|
||||
|
|
@ -391,8 +392,10 @@ typedef struct {
|
|||
#endif // CONFIG_EXT_INTRA
|
||||
|
||||
#if CONFIG_EXT_INTER
|
||||
#if CONFIG_INTERINTRA
|
||||
// interintra members
|
||||
INTERINTRA_MODE interintra_mode;
|
||||
#endif
|
||||
// TODO(debargha): Consolidate these flags
|
||||
int use_wedge_interintra;
|
||||
int interintra_wedge_index;
|
||||
|
|
@ -413,9 +416,7 @@ typedef struct {
|
|||
#endif // CONFIG_MOTION_VAR
|
||||
int_mv mv[2];
|
||||
int_mv pred_mv[2];
|
||||
#if CONFIG_REF_MV
|
||||
uint8_t ref_mv_idx;
|
||||
#endif
|
||||
#if CONFIG_EXT_PARTITION_TYPES
|
||||
PARTITION_TYPE partition;
|
||||
#endif
|
||||
|
|
@ -441,6 +442,13 @@ typedef struct {
|
|||
WarpedMotionParams wm_params[2];
|
||||
#endif // CONFIG_WARPED_MOTION
|
||||
|
||||
#if CONFIG_CFL
|
||||
// Index of the alpha Cb and alpha Cr combination
|
||||
int cfl_alpha_idx;
|
||||
// Signs of alpha Cb and alpha Cr
|
||||
CFL_SIGN_TYPE cfl_alpha_signs[CFL_PRED_PLANES];
|
||||
#endif
|
||||
|
||||
BOUNDARY_TYPE boundary_info;
|
||||
} MB_MODE_INFO;
|
||||
|
||||
|
|
@ -536,16 +544,14 @@ typedef struct macroblockd_plane {
|
|||
uint8_t width, height;
|
||||
|
||||
#if CONFIG_AOM_QM
|
||||
const qm_val_t *seg_iqmatrix[MAX_SEGMENTS][2][TX_SIZES];
|
||||
const qm_val_t *seg_iqmatrix[MAX_SEGMENTS][2][TX_SIZES_ALL];
|
||||
const qm_val_t *seg_qmatrix[MAX_SEGMENTS][2][TX_SIZES_ALL];
|
||||
#endif
|
||||
// encoder
|
||||
const int16_t *dequant;
|
||||
#if CONFIG_NEW_QUANT
|
||||
const dequant_val_type_nuq *dequant_val_nuq[QUANT_PROFILES];
|
||||
#endif // CONFIG_NEW_QUANT
|
||||
#if CONFIG_AOM_QM
|
||||
const qm_val_t *seg_qmatrix[MAX_SEGMENTS][2][TX_SIZES];
|
||||
#endif
|
||||
|
||||
#if CONFIG_PVQ || CONFIG_DAALA_DIST
|
||||
DECLARE_ALIGNED(16, int16_t, pred[MAX_SB_SQUARE]);
|
||||
|
|
@ -558,14 +564,14 @@ typedef struct macroblockd_plane {
|
|||
((x) + (i) * (1 << (tx_size_wide_log2[0] + tx_size_high_log2[0])))
|
||||
|
||||
typedef struct RefBuffer {
|
||||
// TODO(dkovalev): idx is not really required and should be removed, now it
|
||||
// is used in av1_onyxd_if.c
|
||||
int idx;
|
||||
YV12_BUFFER_CONFIG *buf;
|
||||
struct scale_factors sf;
|
||||
} RefBuffer;
|
||||
|
||||
typedef int16_t EobThresholdMD[TX_SIZES_ALL][TX_TYPES];
|
||||
#if CONFIG_ADAPT_SCAN
|
||||
typedef int16_t EobThresholdMD[TX_TYPES][EOB_THRESHOLD_NUM];
|
||||
#endif
|
||||
|
||||
typedef struct macroblockd {
|
||||
struct macroblockd_plane plane[MAX_MB_PLANE];
|
||||
|
|
@ -606,6 +612,11 @@ typedef struct macroblockd {
|
|||
/* pointer to current frame */
|
||||
const YV12_BUFFER_CONFIG *cur_buf;
|
||||
|
||||
#if CONFIG_INTRABC
|
||||
/* Scale of the current frame with respect to itself */
|
||||
struct scale_factors sf_identity;
|
||||
#endif
|
||||
|
||||
ENTROPY_CONTEXT *above_context[MAX_MB_PLANE];
|
||||
ENTROPY_CONTEXT left_context[MAX_MB_PLANE][2 * MAX_MIB_SIZE];
|
||||
|
||||
|
|
@ -615,7 +626,7 @@ typedef struct macroblockd {
|
|||
#if CONFIG_VAR_TX
|
||||
TXFM_CONTEXT *above_txfm_context;
|
||||
TXFM_CONTEXT *left_txfm_context;
|
||||
TXFM_CONTEXT left_txfm_context_buffer[MAX_MIB_SIZE];
|
||||
TXFM_CONTEXT left_txfm_context_buffer[2 * MAX_MIB_SIZE];
|
||||
|
||||
TX_SIZE max_tx_size;
|
||||
#if CONFIG_SUPERTX
|
||||
|
|
@ -626,11 +637,9 @@ typedef struct macroblockd {
|
|||
// block dimension in the unit of mode_info.
|
||||
uint8_t n8_w, n8_h;
|
||||
|
||||
#if CONFIG_REF_MV
|
||||
uint8_t ref_mv_count[MODE_CTX_REF_FRAMES];
|
||||
CANDIDATE_MV ref_mv_stack[MODE_CTX_REF_FRAMES][MAX_REF_MV_STACK_SIZE];
|
||||
uint8_t is_sec_rect;
|
||||
#endif
|
||||
|
||||
#if CONFIG_PVQ
|
||||
daala_dec_ctx daala_dec;
|
||||
|
|
@ -638,10 +647,8 @@ typedef struct macroblockd {
|
|||
#if CONFIG_EC_ADAPT
|
||||
FRAME_CONTEXT *tile_ctx;
|
||||
#endif
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
/* Bit depth: 8, 10, 12 */
|
||||
int bd;
|
||||
#endif
|
||||
|
||||
int qindex[MAX_SEGMENTS];
|
||||
int lossless[MAX_SEGMENTS];
|
||||
|
|
@ -699,6 +706,10 @@ static const TX_TYPE intra_mode_to_tx_type_context[INTRA_MODES] = {
|
|||
ADST_DCT, // D63
|
||||
#if CONFIG_ALT_INTRA
|
||||
ADST_ADST, // SMOOTH
|
||||
#if CONFIG_SMOOTH_HV
|
||||
ADST_DCT, // SMOOTH_V
|
||||
DCT_ADST, // SMOOTH_H
|
||||
#endif // CONFIG_SMOOTH_HV
|
||||
#endif // CONFIG_ALT_INTRA
|
||||
ADST_ADST, // TM
|
||||
};
|
||||
|
|
@ -761,24 +772,24 @@ static const int ext_tx_set_index_inter[EXT_TX_SET_TYPES] = {
|
|||
|
||||
static INLINE TxSetType get_ext_tx_set_type(TX_SIZE tx_size, BLOCK_SIZE bs,
|
||||
int is_inter, int use_reduced_set) {
|
||||
const TX_SIZE tx_size2 = txsize_sqr_up_map[tx_size];
|
||||
tx_size = txsize_sqr_map[tx_size];
|
||||
const TX_SIZE tx_size_sqr_up = txsize_sqr_up_map[tx_size];
|
||||
const TX_SIZE tx_size_sqr = txsize_sqr_map[tx_size];
|
||||
#if CONFIG_CB4X4 && USE_TXTYPE_SEARCH_FOR_SUB8X8_IN_CB4X4
|
||||
(void)bs;
|
||||
if (tx_size > TX_32X32) return EXT_TX_SET_DCTONLY;
|
||||
if (tx_size_sqr > TX_32X32) return EXT_TX_SET_DCTONLY;
|
||||
#else
|
||||
if (tx_size > TX_32X32 || bs < BLOCK_8X8) return EXT_TX_SET_DCTONLY;
|
||||
if (tx_size_sqr > TX_32X32 || bs < BLOCK_8X8) return EXT_TX_SET_DCTONLY;
|
||||
#endif
|
||||
if (use_reduced_set)
|
||||
return is_inter ? EXT_TX_SET_DCT_IDTX : EXT_TX_SET_DTT4_IDTX;
|
||||
if (tx_size2 == TX_32X32)
|
||||
if (tx_size_sqr_up == TX_32X32)
|
||||
return is_inter ? EXT_TX_SET_DCT_IDTX : EXT_TX_SET_DCTONLY;
|
||||
if (is_inter)
|
||||
return (tx_size == TX_16X16 ? EXT_TX_SET_DTT9_IDTX_1DDCT
|
||||
: EXT_TX_SET_ALL16);
|
||||
return (tx_size_sqr == TX_16X16 ? EXT_TX_SET_DTT9_IDTX_1DDCT
|
||||
: EXT_TX_SET_ALL16);
|
||||
else
|
||||
return (tx_size == TX_16X16 ? EXT_TX_SET_DTT4_IDTX
|
||||
: EXT_TX_SET_DTT4_IDTX_1DDCT);
|
||||
return (tx_size_sqr == TX_16X16 ? EXT_TX_SET_DTT4_IDTX
|
||||
: EXT_TX_SET_DTT4_IDTX_1DDCT);
|
||||
}
|
||||
|
||||
static INLINE int get_ext_tx_set(TX_SIZE tx_size, BLOCK_SIZE bs, int is_inter,
|
||||
|
|
@ -791,7 +802,7 @@ static INLINE int get_ext_tx_set(TX_SIZE tx_size, BLOCK_SIZE bs, int is_inter,
|
|||
|
||||
static const int use_intra_ext_tx_for_txsize[EXT_TX_SETS_INTRA][EXT_TX_SIZES] =
|
||||
{
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
{ 1, 1, 1, 1, 1 }, // unused
|
||||
{ 0, 1, 1, 0, 0 },
|
||||
{ 0, 0, 0, 1, 0 },
|
||||
|
|
@ -799,12 +810,12 @@ static const int use_intra_ext_tx_for_txsize[EXT_TX_SETS_INTRA][EXT_TX_SIZES] =
|
|||
{ 1, 1, 1, 1 }, // unused
|
||||
{ 1, 1, 0, 0 },
|
||||
{ 0, 0, 1, 0 },
|
||||
#endif // CONFIG_CB4X4
|
||||
#endif // CONFIG_CHROMA_2X2
|
||||
};
|
||||
|
||||
static const int use_inter_ext_tx_for_txsize[EXT_TX_SETS_INTER][EXT_TX_SIZES] =
|
||||
{
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
{ 1, 1, 1, 1, 1 }, // unused
|
||||
{ 0, 1, 1, 0, 0 },
|
||||
{ 0, 0, 0, 1, 0 },
|
||||
|
|
@ -814,7 +825,7 @@ static const int use_inter_ext_tx_for_txsize[EXT_TX_SETS_INTER][EXT_TX_SIZES] =
|
|||
{ 1, 1, 0, 0 },
|
||||
{ 0, 0, 1, 0 },
|
||||
{ 0, 0, 0, 1 },
|
||||
#endif // CONFIG_CB4X4
|
||||
#endif // CONFIG_CHROMA_2X2
|
||||
};
|
||||
|
||||
// Transform types used in each intra set
|
||||
|
|
@ -887,6 +898,45 @@ static INLINE int is_rect_tx_allowed(const MACROBLOCKD *xd,
|
|||
return is_rect_tx_allowed_bsize(mbmi->sb_type) &&
|
||||
!xd->lossless[mbmi->segment_id];
|
||||
}
|
||||
|
||||
#if CONFIG_RECT_TX_EXT
|
||||
static INLINE int is_quarter_tx_allowed_bsize(BLOCK_SIZE bsize) {
|
||||
static const char LUT_QTTX[BLOCK_SIZES] = {
|
||||
#if CONFIG_CB4X4
|
||||
0, // BLOCK_2X2
|
||||
0, // BLOCK_2X4
|
||||
0, // BLOCK_4X2
|
||||
#endif
|
||||
0, // BLOCK_4X4
|
||||
0, // BLOCK_4X8
|
||||
0, // BLOCK_8X4
|
||||
0, // BLOCK_8X8
|
||||
1, // BLOCK_8X16
|
||||
1, // BLOCK_16X8
|
||||
0, // BLOCK_16X16
|
||||
0, // BLOCK_16X32
|
||||
0, // BLOCK_32X16
|
||||
0, // BLOCK_32X32
|
||||
0, // BLOCK_32X64
|
||||
0, // BLOCK_64X32
|
||||
0, // BLOCK_64X64
|
||||
#if CONFIG_EXT_PARTITION
|
||||
0, // BLOCK_64X128
|
||||
0, // BLOCK_128X64
|
||||
0, // BLOCK_128X128
|
||||
#endif // CONFIG_EXT_PARTITION
|
||||
};
|
||||
|
||||
return LUT_QTTX[bsize];
|
||||
}
|
||||
|
||||
static INLINE int is_quarter_tx_allowed(const MACROBLOCKD *xd,
|
||||
const MB_MODE_INFO *mbmi,
|
||||
int is_inter) {
|
||||
return is_quarter_tx_allowed_bsize(mbmi->sb_type) && is_inter &&
|
||||
!xd->lossless[mbmi->segment_id];
|
||||
}
|
||||
#endif // CONFIG_RECT_TX_EXT
|
||||
#endif // CONFIG_RECT_TX
|
||||
#endif // CONFIG_EXT_TX
|
||||
|
||||
|
|
@ -926,8 +976,14 @@ static INLINE TX_SIZE tx_size_from_tx_mode(BLOCK_SIZE bsize, TX_MODE tx_mode,
|
|||
#define MAX_ANGLE_DELTA 3
|
||||
#define ANGLE_STEP 3
|
||||
extern const int16_t dr_intra_derivative[90];
|
||||
static const uint8_t mode_to_angle_map[INTRA_MODES] = {
|
||||
static const uint8_t mode_to_angle_map[] = {
|
||||
0, 90, 180, 45, 135, 111, 157, 203, 67, 0,
|
||||
#if CONFIG_ALT_INTRA
|
||||
0,
|
||||
#if CONFIG_SMOOTH_HV
|
||||
0, 0,
|
||||
#endif // CONFIG_SMOOTH_HV
|
||||
#endif // CONFIG_ALT_INTRA
|
||||
};
|
||||
#if CONFIG_INTRA_INTERP
|
||||
// Returns whether filter selection is needed for a given
|
||||
|
|
@ -977,10 +1033,10 @@ static INLINE TX_TYPE get_tx_type(PLANE_TYPE plane_type, const MACROBLOCKD *xd,
|
|||
int block, TX_SIZE tx_size) {
|
||||
const MODE_INFO *const mi = xd->mi[0];
|
||||
const MB_MODE_INFO *const mbmi = &mi->mbmi;
|
||||
#if CONFIG_INTRABC
|
||||
// TODO(aconverse@google.com): Revisit this decision
|
||||
#if CONFIG_INTRABC && (!CONFIG_EXT_TX || CONFIG_TXK_SEL)
|
||||
// TODO(aconverse@google.com): Handle INTRABC + EXT_TX + TXK_SEL
|
||||
if (is_intrabc_block(mbmi)) return DCT_DCT;
|
||||
#endif // CONFIG_INTRABC
|
||||
#endif // CONFIG_INTRABC && (!CONFIG_EXT_TX || CONFIG_TXK_SEL)
|
||||
#if !CONFIG_TXK_SEL
|
||||
#if FIXED_TX_TYPE
|
||||
const int block_raster_idx = av1_block_index_to_raster_order(tx_size, block);
|
||||
|
|
@ -1002,7 +1058,7 @@ static INLINE TX_TYPE get_tx_type(PLANE_TYPE plane_type, const MACROBLOCKD *xd,
|
|||
|
||||
if (is_inter_block(mbmi)) {
|
||||
// UV Inter only
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
if (tx_size < TX_4X4) return DCT_DCT;
|
||||
#endif
|
||||
return (mbmi->tx_type == IDTX && txsize_sqr_map[tx_size] >= TX_32X32)
|
||||
|
|
@ -1013,11 +1069,13 @@ static INLINE TX_TYPE get_tx_type(PLANE_TYPE plane_type, const MACROBLOCKD *xd,
|
|||
|
||||
#if CONFIG_CB4X4
|
||||
(void)block;
|
||||
#if CONFIG_CHROMA_2X2
|
||||
if (tx_size < TX_4X4)
|
||||
return DCT_DCT;
|
||||
else
|
||||
#endif
|
||||
return intra_mode_to_tx_type_context[mbmi->uv_mode];
|
||||
#else
|
||||
#else // CONFIG_CB4X4
|
||||
|
||||
// Sub8x8-Inter/Intra OR UV-Intra
|
||||
if (is_inter_block(mbmi)) // Sub8x8-Inter
|
||||
|
|
@ -1051,17 +1109,17 @@ static INLINE TX_TYPE get_tx_type(PLANE_TYPE plane_type, const MACROBLOCKD *xd,
|
|||
void av1_setup_block_planes(MACROBLOCKD *xd, int ss_x, int ss_y);
|
||||
|
||||
static INLINE int tx_size_to_depth(TX_SIZE tx_size) {
|
||||
return (int)(tx_size - TX_4X4);
|
||||
return (int)(tx_size - TX_SIZE_LUMA_MIN);
|
||||
}
|
||||
|
||||
static INLINE TX_SIZE depth_to_tx_size(int depth) {
|
||||
return (TX_SIZE)(depth + TX_4X4);
|
||||
return (TX_SIZE)(depth + TX_SIZE_LUMA_MIN);
|
||||
}
|
||||
|
||||
static INLINE TX_SIZE get_uv_tx_size(const MB_MODE_INFO *mbmi,
|
||||
const struct macroblockd_plane *pd) {
|
||||
TX_SIZE uv_txsize;
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
assert(mbmi->tx_size > TX_2X2);
|
||||
#endif
|
||||
|
||||
|
|
@ -1073,9 +1131,6 @@ static INLINE TX_SIZE get_uv_tx_size(const MB_MODE_INFO *mbmi,
|
|||
|
||||
uv_txsize = uv_txsize_lookup[mbmi->sb_type][mbmi->tx_size][pd->subsampling_x]
|
||||
[pd->subsampling_y];
|
||||
#if CONFIG_CB4X4 && !CONFIG_CHROMA_2X2
|
||||
uv_txsize = AOMMAX(uv_txsize, TX_4X4);
|
||||
#endif
|
||||
assert(uv_txsize != TX_INVALID);
|
||||
return uv_txsize;
|
||||
}
|
||||
|
|
@ -1092,17 +1147,8 @@ get_plane_block_size(BLOCK_SIZE bsize, const struct macroblockd_plane *pd) {
|
|||
return ss_size_lookup[bsize][pd->subsampling_x][pd->subsampling_y];
|
||||
}
|
||||
|
||||
static INLINE void reset_skip_context(MACROBLOCKD *xd, BLOCK_SIZE bsize) {
|
||||
int i;
|
||||
for (i = 0; i < MAX_MB_PLANE; i++) {
|
||||
struct macroblockd_plane *const pd = &xd->plane[i];
|
||||
const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd);
|
||||
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);
|
||||
memset(pd->left_context, 0, sizeof(ENTROPY_CONTEXT) * txs_high);
|
||||
}
|
||||
}
|
||||
void av1_reset_skip_context(MACROBLOCKD *xd, int mi_row, int mi_col,
|
||||
BLOCK_SIZE bsize);
|
||||
|
||||
typedef void (*foreach_transformed_block_visitor)(int plane, int block,
|
||||
int blk_row, int blk_col,
|
||||
|
|
@ -1121,8 +1167,8 @@ void av1_foreach_transformed_block(const MACROBLOCKD *const xd,
|
|||
#endif
|
||||
|
||||
#if CONFIG_DAALA_DIST
|
||||
void av1_foreach_8x8_transformed_block_in_plane(
|
||||
const MACROBLOCKD *const xd, BLOCK_SIZE bsize, int plane,
|
||||
void av1_foreach_8x8_transformed_block_in_yplane(
|
||||
const MACROBLOCKD *const xd, BLOCK_SIZE bsize,
|
||||
foreach_transformed_block_visitor visit,
|
||||
foreach_transformed_block_visitor mi_visit, void *arg);
|
||||
#endif
|
||||
|
|
|
|||
20
third_party/aom/av1/common/cdef.c
vendored
20
third_party/aom/av1/common/cdef.c
vendored
|
|
@ -26,13 +26,9 @@ int sb_all_skip(const AV1_COMMON *const cm, int mi_row, int mi_col) {
|
|||
int skip = 1;
|
||||
maxc = cm->mi_cols - mi_col;
|
||||
maxr = cm->mi_rows - mi_row;
|
||||
#if CONFIG_EXT_PARTITION
|
||||
if (maxr > cm->mib_size_log2) maxr = cm->mib_size_log2;
|
||||
if (maxc > cm->mib_size_log2) maxc = cm->mib_size_log2;
|
||||
#else
|
||||
if (maxr > MAX_MIB_SIZE) maxr = MAX_MIB_SIZE;
|
||||
if (maxc > MAX_MIB_SIZE) maxc = MAX_MIB_SIZE;
|
||||
#endif
|
||||
|
||||
maxr = AOMMIN(maxr, cm->mib_size);
|
||||
maxc = AOMMIN(maxc, cm->mib_size);
|
||||
|
||||
for (r = 0; r < maxr; r++) {
|
||||
for (c = 0; c < maxc; c++) {
|
||||
|
|
@ -63,13 +59,9 @@ int sb_compute_dering_list(const AV1_COMMON *const cm, int mi_row, int mi_col,
|
|||
grid = cm->mi_grid_visible;
|
||||
maxc = cm->mi_cols - mi_col;
|
||||
maxr = cm->mi_rows - mi_row;
|
||||
#if CONFIG_EXT_PARTITION
|
||||
if (maxr > cm->mib_size_log2) maxr = cm->mib_size_log2;
|
||||
if (maxc > cm->mib_size_log2) maxc = cm->mib_size_log2;
|
||||
#else
|
||||
if (maxr > MAX_MIB_SIZE) maxr = MAX_MIB_SIZE;
|
||||
if (maxc > MAX_MIB_SIZE) maxc = MAX_MIB_SIZE;
|
||||
#endif
|
||||
|
||||
maxr = AOMMIN(maxr, cm->mib_size);
|
||||
maxc = AOMMIN(maxc, cm->mib_size);
|
||||
|
||||
const int r_step = mi_size_high[BLOCK_8X8];
|
||||
const int c_step = mi_size_wide[BLOCK_8X8];
|
||||
|
|
|
|||
85
third_party/aom/av1/common/cfl.c
vendored
85
third_party/aom/av1/common/cfl.c
vendored
|
|
@ -47,23 +47,27 @@ void cfl_dc_pred(MACROBLOCKD *xd, BLOCK_SIZE plane_bsize, TX_SIZE tx_size) {
|
|||
: tx_size_high[tx_size];
|
||||
|
||||
// Number of pixel on the top and left borders.
|
||||
const int num_pel = block_width + block_height;
|
||||
const double num_pel = block_width + block_height;
|
||||
|
||||
int sum_u = 0;
|
||||
int sum_v = 0;
|
||||
|
||||
// Match behavior of build_intra_predictors (reconintra.c) at superblock
|
||||
// boundaries:
|
||||
//
|
||||
// 127 127 127 .. 127 127 127 127 127 127
|
||||
// 129 A B .. Y Z
|
||||
// 129 C D .. W X
|
||||
// 129 E F .. U V
|
||||
// 129 G H .. S T T T T T
|
||||
// ..
|
||||
// Match behavior of build_intra_predictors (reconintra.c) at superblock
|
||||
// boundaries:
|
||||
//
|
||||
// 127 127 127 .. 127 127 127 127 127 127
|
||||
// 129 A B .. Y Z
|
||||
// 129 C D .. W X
|
||||
// 129 E F .. U V
|
||||
// 129 G H .. S T T T T T
|
||||
// ..
|
||||
|
||||
// TODO(ltrudeau) replace this with DC_PRED assembly
|
||||
#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
|
||||
// TODO(ltrudeau) replace this with DC_PRED assembly
|
||||
for (int i = 0; i < block_width; i++) {
|
||||
sum_u += dst_u[-dst_u_stride + i];
|
||||
sum_v += dst_v[-dst_v_stride + i];
|
||||
|
|
@ -73,7 +77,11 @@ void cfl_dc_pred(MACROBLOCKD *xd, BLOCK_SIZE plane_bsize, TX_SIZE tx_size) {
|
|||
sum_v = block_width * 127;
|
||||
}
|
||||
|
||||
#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
|
||||
for (int i = 0; i < block_height; i++) {
|
||||
sum_u += dst_u[i * dst_u_stride - 1];
|
||||
sum_v += dst_v[i * dst_v_stride - 1];
|
||||
|
|
@ -83,25 +91,22 @@ void cfl_dc_pred(MACROBLOCKD *xd, BLOCK_SIZE plane_bsize, TX_SIZE tx_size) {
|
|||
sum_v += block_height * 129;
|
||||
}
|
||||
|
||||
xd->cfl->dc_pred[CFL_PRED_U] = (sum_u + (num_pel >> 1)) / num_pel;
|
||||
xd->cfl->dc_pred[CFL_PRED_V] = (sum_v + (num_pel >> 1)) / num_pel;
|
||||
xd->cfl->dc_pred[CFL_PRED_U] = sum_u / num_pel;
|
||||
xd->cfl->dc_pred[CFL_PRED_V] = sum_v / num_pel;
|
||||
}
|
||||
|
||||
// Predict the current transform block using CfL.
|
||||
// it is assumed that dst points at the start of the transform block
|
||||
void cfl_predict_block(const CFL_CTX *cfl, uint8_t *dst, int dst_stride,
|
||||
int row, int col, TX_SIZE tx_size, int dc_pred) {
|
||||
const int tx_block_width = tx_size_wide[tx_size];
|
||||
const int tx_block_height = tx_size_high[tx_size];
|
||||
int row, int col, TX_SIZE tx_size, double dc_pred,
|
||||
double alpha) {
|
||||
const int width = tx_size_wide[tx_size];
|
||||
const int height = tx_size_high[tx_size];
|
||||
|
||||
// TODO(ltrudeau) implement alpha
|
||||
// Place holder for alpha
|
||||
const double alpha = 0;
|
||||
const double y_avg = cfl_load(cfl, dst, dst_stride, row, col, tx_size);
|
||||
const double y_avg = cfl_load(cfl, dst, dst_stride, row, col, width, height);
|
||||
|
||||
for (int j = 0; j < tx_block_height; j++) {
|
||||
for (int i = 0; i < tx_block_width; i++) {
|
||||
dst[i] = (uint8_t)(alpha * y_avg + dc_pred + 0.5);
|
||||
for (int j = 0; j < height; j++) {
|
||||
for (int i = 0; i < width; i++) {
|
||||
dst[i] = (uint8_t)(alpha * (dst[i] - y_avg) + dc_pred + 0.5);
|
||||
}
|
||||
dst += dst_stride;
|
||||
}
|
||||
|
|
@ -142,9 +147,7 @@ void cfl_store(CFL_CTX *cfl, const uint8_t *input, int input_stride, int row,
|
|||
|
||||
// Load from the CfL pixel buffer into output
|
||||
double cfl_load(const CFL_CTX *cfl, uint8_t *output, int output_stride, int row,
|
||||
int col, TX_SIZE tx_size) {
|
||||
const int tx_width = tx_size_wide[tx_size];
|
||||
const int tx_height = tx_size_high[tx_size];
|
||||
int col, int width, int height) {
|
||||
const int sub_x = cfl->subsampling_x;
|
||||
const int sub_y = cfl->subsampling_y;
|
||||
const int tx_off_log2 = tx_size_wide_log2[0];
|
||||
|
|
@ -161,12 +164,12 @@ double cfl_load(const CFL_CTX *cfl, uint8_t *output, int output_stride, int row,
|
|||
// TODO(ltrudeau) add support for 4:2:2
|
||||
if (sub_y == 0 && sub_x == 0) {
|
||||
y_pix = &cfl->y_pix[(row * MAX_SB_SIZE + col) << tx_off_log2];
|
||||
int uv_width = (col << tx_off_log2) + tx_width;
|
||||
int uv_width = (col << tx_off_log2) + width;
|
||||
diff_width = uv_width - cfl->y_width;
|
||||
int uv_height = (row << tx_off_log2) + tx_width;
|
||||
int uv_height = (row << tx_off_log2) + height;
|
||||
diff_height = uv_height - cfl->y_height;
|
||||
for (int j = 0; j < tx_height; j++) {
|
||||
for (int i = 0; i < tx_width; i++) {
|
||||
for (int j = 0; j < height; j++) {
|
||||
for (int i = 0; i < width; i++) {
|
||||
// In 4:4:4, pixels match 1 to 1
|
||||
output[output_row_offset + i] = y_pix[pred_row_offset + i];
|
||||
}
|
||||
|
|
@ -175,12 +178,12 @@ double cfl_load(const CFL_CTX *cfl, uint8_t *output, int output_stride, int row,
|
|||
}
|
||||
} else if (sub_y == 1 && sub_x == 1) {
|
||||
y_pix = &cfl->y_pix[(row * MAX_SB_SIZE + col) << (tx_off_log2 + sub_y)];
|
||||
int uv_width = ((col << tx_off_log2) + tx_width) << sub_x;
|
||||
int uv_width = ((col << tx_off_log2) + width) << sub_x;
|
||||
diff_width = (uv_width - cfl->y_width) >> sub_x;
|
||||
int uv_height = ((row << tx_off_log2) + tx_width) << sub_y;
|
||||
int uv_height = ((row << tx_off_log2) + height) << sub_y;
|
||||
diff_height = (uv_height - cfl->y_height) >> sub_y;
|
||||
for (int j = 0; j < tx_height; j++) {
|
||||
for (int i = 0; i < tx_width; i++) {
|
||||
for (int j = 0; j < height; j++) {
|
||||
for (int i = 0; i < width; i++) {
|
||||
top_left = (pred_row_offset + i) << sub_y;
|
||||
bot_left = top_left + MAX_SB_SIZE;
|
||||
// In 4:2:0, average pixels in 2x2 grid
|
||||
|
|
@ -206,9 +209,9 @@ double cfl_load(const CFL_CTX *cfl, uint8_t *output, int output_stride, int row,
|
|||
// frame, the columns will be copied over them.
|
||||
if (diff_width > 0) {
|
||||
int last_pixel;
|
||||
output_row_offset = tx_width - diff_width;
|
||||
output_row_offset = width - diff_width;
|
||||
|
||||
for (int j = 0; j < tx_height; j++) {
|
||||
for (int j = 0; j < height; j++) {
|
||||
last_pixel = output_row_offset - 1;
|
||||
for (int i = 0; i < diff_width; i++) {
|
||||
output[output_row_offset + i] = output[last_pixel];
|
||||
|
|
@ -221,7 +224,7 @@ double cfl_load(const CFL_CTX *cfl, uint8_t *output, int output_stride, int row,
|
|||
output_row_offset = diff_height * output_stride;
|
||||
const int last_row_offset = output_row_offset - output_stride;
|
||||
for (int j = 0; j < diff_height; j++) {
|
||||
for (int i = 0; i < tx_width; i++) {
|
||||
for (int i = 0; i < width; i++) {
|
||||
output[output_row_offset + i] = output[last_row_offset + i];
|
||||
}
|
||||
output_row_offset += output_stride;
|
||||
|
|
@ -230,11 +233,11 @@ double cfl_load(const CFL_CTX *cfl, uint8_t *output, int output_stride, int row,
|
|||
|
||||
int avg = 0;
|
||||
output_row_offset = 0;
|
||||
for (int j = 0; j < tx_height; j++) {
|
||||
for (int i = 0; i < tx_width; i++) {
|
||||
for (int j = 0; j < height; j++) {
|
||||
for (int i = 0; i < width; i++) {
|
||||
avg += output[output_row_offset + i];
|
||||
}
|
||||
output_row_offset += output_stride;
|
||||
}
|
||||
return avg / (double)(tx_width * tx_height);
|
||||
return avg / (double)(width * height);
|
||||
}
|
||||
|
|
|
|||
41
third_party/aom/av1/common/cfl.h
vendored
41
third_party/aom/av1/common/cfl.h
vendored
|
|
@ -12,6 +12,8 @@
|
|||
#ifndef AV1_COMMON_CFL_H_
|
||||
#define AV1_COMMON_CFL_H_
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "av1/common/enums.h"
|
||||
|
||||
// Forward declaration of AV1_COMMON, in order to avoid creating a cyclic
|
||||
|
|
@ -33,20 +35,53 @@ typedef struct {
|
|||
int subsampling_x, subsampling_y;
|
||||
|
||||
// CfL Performs its own block level DC_PRED for each chromatic plane
|
||||
int dc_pred[CFL_PRED_PLANES];
|
||||
double dc_pred[CFL_PRED_PLANES];
|
||||
|
||||
// The rate associated with each alpha codeword
|
||||
int costs[CFL_ALPHABET_SIZE];
|
||||
|
||||
// Count the number of TX blocks in a predicted block to know when you are at
|
||||
// the last one, so you can check for skips.
|
||||
// TODO(any) Is there a better way to do this?
|
||||
int num_tx_blk[CFL_PRED_PLANES];
|
||||
} CFL_CTX;
|
||||
|
||||
static const double cfl_alpha_mags[CFL_MAGS_SIZE] = {
|
||||
0., 0.125, -0.125, 0.25, -0.25, 0.5, -0.5
|
||||
};
|
||||
|
||||
static const int cfl_alpha_codes[CFL_ALPHABET_SIZE][CFL_PRED_PLANES] = {
|
||||
// barrbrain's simple 1D quant ordered by subset 3 likelihood
|
||||
{ 0, 0 }, { 1, 1 }, { 3, 0 }, { 3, 1 }, { 1, 0 }, { 3, 3 },
|
||||
{ 0, 1 }, { 5, 5 }, { 5, 3 }, { 1, 3 }, { 5, 3 }, { 3, 5 },
|
||||
{ 0, 3 }, { 5, 1 }, { 1, 5 }, { 0, 5 }
|
||||
};
|
||||
|
||||
void cfl_init(CFL_CTX *cfl, AV1_COMMON *cm, int subsampling_x,
|
||||
int subsampling_y);
|
||||
|
||||
void cfl_dc_pred(MACROBLOCKD *xd, BLOCK_SIZE plane_bsize, TX_SIZE tx_size);
|
||||
|
||||
static INLINE double cfl_idx_to_alpha(int alpha_idx, CFL_SIGN_TYPE alpha_sign,
|
||||
CFL_PRED_TYPE pred_type) {
|
||||
const int mag_idx = cfl_alpha_codes[alpha_idx][pred_type];
|
||||
const double abs_alpha = cfl_alpha_mags[mag_idx];
|
||||
if (alpha_sign == CFL_SIGN_POS) {
|
||||
return abs_alpha;
|
||||
} else {
|
||||
assert(abs_alpha != 0.0);
|
||||
assert(cfl_alpha_mags[mag_idx + 1] == -abs_alpha);
|
||||
return -abs_alpha;
|
||||
}
|
||||
}
|
||||
|
||||
void cfl_predict_block(const CFL_CTX *cfl, uint8_t *dst, int dst_stride,
|
||||
int row, int col, TX_SIZE tx_size, int dc_pred);
|
||||
int row, int col, TX_SIZE tx_size, double dc_pred,
|
||||
double alpha);
|
||||
|
||||
void cfl_store(CFL_CTX *cfl, const uint8_t *input, int input_stride, int row,
|
||||
int col, TX_SIZE tx_size);
|
||||
|
||||
double cfl_load(const CFL_CTX *cfl, uint8_t *output, int output_stride, int row,
|
||||
int col, TX_SIZE tx_size);
|
||||
int col, int width, int height);
|
||||
#endif // AV1_COMMON_CFL_H_
|
||||
|
|
|
|||
312
third_party/aom/av1/common/common_data.h
vendored
312
third_party/aom/av1/common/common_data.h
vendored
|
|
@ -21,105 +21,117 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
#if CONFIG_EXT_PARTITION
|
||||
#define IF_EXT_PARTITION(...) __VA_ARGS__
|
||||
#define IF_EXT_PARTITION(...) __VA_ARGS__,
|
||||
#else
|
||||
#define IF_EXT_PARTITION(...)
|
||||
#endif
|
||||
|
||||
// Log 2 conversion lookup tables for block width and height
|
||||
static const uint8_t b_width_log2_lookup[BLOCK_SIZES] = {
|
||||
static const uint8_t b_width_log2_lookup[BLOCK_SIZES_ALL] = {
|
||||
#if CONFIG_CB4X4
|
||||
0, 0, 0,
|
||||
#endif
|
||||
0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, IF_EXT_PARTITION(4, 5, 5)
|
||||
0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, IF_EXT_PARTITION(4, 5, 5) 0, 2, 1, 3
|
||||
};
|
||||
static const uint8_t b_height_log2_lookup[BLOCK_SIZES] = {
|
||||
static const uint8_t b_height_log2_lookup[BLOCK_SIZES_ALL] = {
|
||||
#if CONFIG_CB4X4
|
||||
0, 0, 0,
|
||||
#endif
|
||||
0, 1, 0, 1, 2, 1, 2, 3, 2, 3, 4, 3, 4, IF_EXT_PARTITION(5, 4, 5)
|
||||
0, 1, 0, 1, 2, 1, 2, 3, 2, 3, 4, 3, 4, IF_EXT_PARTITION(5, 4, 5) 2, 0, 3, 1
|
||||
};
|
||||
// Log 2 conversion lookup tables for modeinfo width and height
|
||||
static const uint8_t mi_width_log2_lookup[BLOCK_SIZES] = {
|
||||
static const uint8_t mi_width_log2_lookup[BLOCK_SIZES_ALL] = {
|
||||
#if CONFIG_CB4X4
|
||||
0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, IF_EXT_PARTITION(4, 5, 5)
|
||||
0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, IF_EXT_PARTITION(4, 5, 5) 0,
|
||||
2, 1, 3
|
||||
#else
|
||||
0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, IF_EXT_PARTITION(3, 4, 4)
|
||||
0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, IF_EXT_PARTITION(3, 4, 4) 0, 1, 0, 2
|
||||
#endif
|
||||
};
|
||||
static const uint8_t mi_height_log2_lookup[BLOCK_SIZES] = {
|
||||
static const uint8_t mi_height_log2_lookup[BLOCK_SIZES_ALL] = {
|
||||
#if CONFIG_CB4X4
|
||||
0, 0, 0, 0, 1, 0, 1, 2, 1, 2, 3, 2, 3, 4, 3, 4, IF_EXT_PARTITION(5, 4, 5)
|
||||
0, 0, 0, 0, 1, 0, 1, 2, 1, 2, 3, 2, 3, 4, 3, 4, IF_EXT_PARTITION(5, 4, 5) 2,
|
||||
0, 3, 1
|
||||
#else
|
||||
0, 0, 0, 0, 1, 0, 1, 2, 1, 2, 3, 2, 3, IF_EXT_PARTITION(4, 3, 4)
|
||||
0, 0, 0, 0, 1, 0, 1, 2, 1, 2, 3, 2, 3, IF_EXT_PARTITION(4, 3, 4) 1, 0, 2, 0
|
||||
#endif
|
||||
};
|
||||
|
||||
static const uint8_t mi_size_wide[BLOCK_SIZES] = {
|
||||
/* clang-format off */
|
||||
static const uint8_t mi_size_wide[BLOCK_SIZES_ALL] = {
|
||||
#if CONFIG_CB4X4
|
||||
1, 1, 1, 1, 1, 2, 2, 2, 4, 4, 4, 8, 8, 8, 16, 16, IF_EXT_PARTITION(16, 32, 32)
|
||||
1, 1, 1, 1, 1, 2, 2, 2, 4, 4, 4, 8, 8, 8, 16, 16,
|
||||
IF_EXT_PARTITION(16, 32, 32) 1, 4, 2, 8
|
||||
#else
|
||||
1, 1, 1, 1, 1, 2, 2, 2, 4, 4, 4, 8, 8, IF_EXT_PARTITION(8, 16, 16)
|
||||
1, 1, 1, 1, 1, 2, 2, 2, 4, 4, 4, 8, 8, IF_EXT_PARTITION(8, 16, 16) 1, 2, 1, 4
|
||||
#endif
|
||||
};
|
||||
static const uint8_t mi_size_high[BLOCK_SIZES] = {
|
||||
static const uint8_t mi_size_high[BLOCK_SIZES_ALL] = {
|
||||
#if CONFIG_CB4X4
|
||||
1, 1, 1, 1, 2, 1, 2, 4, 2, 4, 8, 4, 8, 16, 8, 16, IF_EXT_PARTITION(32, 16, 32)
|
||||
1, 1, 1, 1, 2, 1, 2, 4, 2, 4, 8, 4, 8, 16, 8, 16,
|
||||
IF_EXT_PARTITION(32, 16, 32) 4, 1, 8, 2
|
||||
#else
|
||||
1, 1, 1, 1, 2, 1, 2, 4, 2, 4, 8, 4, 8, IF_EXT_PARTITION(16, 8, 16)
|
||||
1, 1, 1, 1, 2, 1, 2, 4, 2, 4, 8, 4, 8, IF_EXT_PARTITION(16, 8, 16) 2, 1, 4, 1
|
||||
#endif
|
||||
};
|
||||
/* clang-format on */
|
||||
|
||||
// Width/height lookup tables in units of various block sizes
|
||||
static const uint8_t block_size_wide[BLOCK_SIZES] = {
|
||||
static const uint8_t block_size_wide[BLOCK_SIZES_ALL] = {
|
||||
#if CONFIG_CB4X4
|
||||
2, 2, 4,
|
||||
2, 2, 4,
|
||||
#endif
|
||||
4, 4, 8, 8, 8, 16, 16, 16, 32, 32, 32, 64, 64, IF_EXT_PARTITION(64, 128, 128)
|
||||
4, 4, 8, 8, 8, 16, 16,
|
||||
16, 32, 32, 32, 64, 64, IF_EXT_PARTITION(64, 128, 128) 4,
|
||||
16, 8, 32
|
||||
};
|
||||
|
||||
static const uint8_t block_size_high[BLOCK_SIZES] = {
|
||||
static const uint8_t block_size_high[BLOCK_SIZES_ALL] = {
|
||||
#if CONFIG_CB4X4
|
||||
2, 4, 2,
|
||||
2, 4, 2,
|
||||
#endif
|
||||
4, 8, 4, 8, 16, 8, 16, 32, 16, 32, 64, 32, 64, IF_EXT_PARTITION(128, 64, 128)
|
||||
4, 8, 4, 8, 16, 8, 16,
|
||||
32, 16, 32, 64, 32, 64, IF_EXT_PARTITION(128, 64, 128) 16,
|
||||
4, 32, 8
|
||||
};
|
||||
|
||||
static const uint8_t num_4x4_blocks_wide_lookup[BLOCK_SIZES] = {
|
||||
static const uint8_t num_4x4_blocks_wide_lookup[BLOCK_SIZES_ALL] = {
|
||||
#if CONFIG_CB4X4
|
||||
1, 1, 1,
|
||||
#endif
|
||||
1, 1, 2, 2, 2, 4, 4, 4, 8, 8, 8, 16, 16, IF_EXT_PARTITION(16, 32, 32)
|
||||
1, 1, 2, 2, 2, 4, 4, 4, 8, 8, 8, 16, 16, IF_EXT_PARTITION(16, 32, 32) 1,
|
||||
4, 2, 8
|
||||
};
|
||||
static const uint8_t num_4x4_blocks_high_lookup[BLOCK_SIZES] = {
|
||||
static const uint8_t num_4x4_blocks_high_lookup[BLOCK_SIZES_ALL] = {
|
||||
#if CONFIG_CB4X4
|
||||
1, 1, 1,
|
||||
#endif
|
||||
1, 2, 1, 2, 4, 2, 4, 8, 4, 8, 16, 8, 16, IF_EXT_PARTITION(32, 16, 32)
|
||||
1, 2, 1, 2, 4, 2, 4, 8, 4, 8, 16, 8, 16, IF_EXT_PARTITION(32, 16, 32) 4,
|
||||
1, 8, 2
|
||||
};
|
||||
static const uint8_t num_8x8_blocks_wide_lookup[BLOCK_SIZES] = {
|
||||
static const uint8_t num_8x8_blocks_wide_lookup[BLOCK_SIZES_ALL] = {
|
||||
#if CONFIG_CB4X4
|
||||
1, 1, 1,
|
||||
#endif
|
||||
1, 1, 1, 1, 1, 2, 2, 2, 4, 4, 4, 8, 8, IF_EXT_PARTITION(8, 16, 16)
|
||||
1, 1, 1, 1, 1, 2, 2, 2, 4, 4, 4, 8, 8, IF_EXT_PARTITION(8, 16, 16) 1, 2, 1, 4
|
||||
};
|
||||
static const uint8_t num_8x8_blocks_high_lookup[BLOCK_SIZES] = {
|
||||
static const uint8_t num_8x8_blocks_high_lookup[BLOCK_SIZES_ALL] = {
|
||||
#if CONFIG_CB4X4
|
||||
1, 1, 1,
|
||||
#endif
|
||||
1, 1, 1, 1, 2, 1, 2, 4, 2, 4, 8, 4, 8, IF_EXT_PARTITION(16, 8, 16)
|
||||
1, 1, 1, 1, 2, 1, 2, 4, 2, 4, 8, 4, 8, IF_EXT_PARTITION(16, 8, 16) 2, 1, 4, 1
|
||||
};
|
||||
static const uint8_t num_16x16_blocks_wide_lookup[BLOCK_SIZES] = {
|
||||
static const uint8_t num_16x16_blocks_wide_lookup[BLOCK_SIZES_ALL] = {
|
||||
#if CONFIG_CB4X4
|
||||
1, 1, 1,
|
||||
#endif
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 4, 4, IF_EXT_PARTITION(4, 8, 8)
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 4, 4, IF_EXT_PARTITION(4, 8, 8) 1, 1, 1, 2
|
||||
};
|
||||
static const uint8_t num_16x16_blocks_high_lookup[BLOCK_SIZES] = {
|
||||
static const uint8_t num_16x16_blocks_high_lookup[BLOCK_SIZES_ALL] = {
|
||||
#if CONFIG_CB4X4
|
||||
1, 1, 1,
|
||||
#endif
|
||||
1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 4, 2, 4, IF_EXT_PARTITION(8, 4, 8)
|
||||
1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 4, 2, 4, IF_EXT_PARTITION(8, 4, 8) 1, 1, 2, 1
|
||||
};
|
||||
|
||||
// AOMMIN(3, AOMMIN(b_width_log2(bsize), b_height_log2(bsize)))
|
||||
|
|
@ -130,11 +142,12 @@ static const uint8_t size_group_lookup[BLOCK_SIZES] = {
|
|||
0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, IF_EXT_PARTITION(3, 3, 3)
|
||||
};
|
||||
|
||||
static const uint8_t num_pels_log2_lookup[BLOCK_SIZES] = {
|
||||
static const uint8_t num_pels_log2_lookup[BLOCK_SIZES_ALL] = {
|
||||
#if CONFIG_CB4X4
|
||||
2, 3, 3,
|
||||
#endif
|
||||
4, 5, 5, 6, 7, 7, 8, 9, 9, 10, 11, 11, 12, IF_EXT_PARTITION(13, 13, 14)
|
||||
4, 5, 5, 6, 7, 7, 8, 9, 9, 10, 11, 11, 12, IF_EXT_PARTITION(13, 13, 14) 6,
|
||||
6, 8, 8
|
||||
};
|
||||
|
||||
/* clang-format off */
|
||||
|
|
@ -424,9 +437,11 @@ static const BLOCK_SIZE subsize_lookup[PARTITION_TYPES][BLOCK_SIZES] =
|
|||
};
|
||||
|
||||
static const TX_SIZE max_txsize_lookup[BLOCK_SIZES] = {
|
||||
#if CONFIG_CB4X4
|
||||
// 2X2, 2X4, 4X2,
|
||||
#if CONFIG_CHROMA_2X2
|
||||
TX_2X2, TX_2X2, TX_2X2,
|
||||
#elif CONFIG_CB4X4
|
||||
TX_4X4, TX_4X4, TX_4X4,
|
||||
#endif
|
||||
// 4X4
|
||||
TX_4X4,
|
||||
|
|
@ -457,10 +472,12 @@ static const TX_SIZE max_txsize_lookup[BLOCK_SIZES] = {
|
|||
|
||||
#if CONFIG_RECT_TX && (CONFIG_EXT_TX || CONFIG_VAR_TX)
|
||||
static const TX_SIZE max_txsize_rect_lookup[BLOCK_SIZES] = {
|
||||
#if CONFIG_CB4X4
|
||||
// 2X2, 2X4, 4X2,
|
||||
#if CONFIG_CHROMA_2X2
|
||||
TX_2X2, TX_2X2, TX_2X2,
|
||||
#endif // CONFIG_CB4X4
|
||||
#elif CONFIG_CB4X4
|
||||
TX_4X4, TX_4X4, TX_4X4,
|
||||
#endif
|
||||
// 4X4
|
||||
TX_4X4,
|
||||
// 4X8, 8X4, 8X8
|
||||
|
|
@ -487,10 +504,49 @@ static const TX_SIZE max_txsize_rect_lookup[BLOCK_SIZES] = {
|
|||
#endif // CONFIG_EXT_PARTITION
|
||||
#endif // CONFIG_TX64X64
|
||||
};
|
||||
|
||||
#if CONFIG_EXT_TX && CONFIG_RECT_TX_EXT
|
||||
static const TX_SIZE quarter_txsize_lookup[BLOCK_SIZES] = {
|
||||
#if CONFIG_CB4X4
|
||||
// 2X2, 2X4, 4X2,
|
||||
TX_INVALID, TX_INVALID, TX_INVALID,
|
||||
#endif
|
||||
// 4x4,
|
||||
TX_INVALID,
|
||||
// 4x8, 8x4, 8x8,
|
||||
TX_INVALID, TX_INVALID, TX_INVALID,
|
||||
// 8x16, 16x8, 16x16,
|
||||
TX_4X16, TX_16X4, TX_INVALID,
|
||||
// 16x32, 32x16, 32x32,
|
||||
TX_8X32, TX_32X8, TX_INVALID,
|
||||
// 32x64, 64x32, 64x64
|
||||
TX_INVALID, TX_INVALID, TX_INVALID,
|
||||
#if CONFIG_EXT_PARTITION
|
||||
// 64x128, 128x64, 128x128
|
||||
TX_INVALID, TX_INVALID, TX_INVALID,
|
||||
#endif
|
||||
};
|
||||
#endif // CONFIG_EXT_TX && CONFIG_RECT_TX_EXT
|
||||
#else
|
||||
#define max_txsize_rect_lookup max_txsize_lookup
|
||||
#endif // CONFIG_RECT_TX && (CONFIG_EXT_TX || CONFIG_VAR_TX)
|
||||
|
||||
static const TX_TYPE_1D vtx_tab[TX_TYPES] = {
|
||||
DCT_1D, ADST_1D, DCT_1D, ADST_1D,
|
||||
#if CONFIG_EXT_TX
|
||||
FLIPADST_1D, DCT_1D, FLIPADST_1D, ADST_1D, FLIPADST_1D, IDTX_1D,
|
||||
DCT_1D, IDTX_1D, ADST_1D, IDTX_1D, FLIPADST_1D, IDTX_1D,
|
||||
#endif // CONFIG_EXT_TX
|
||||
};
|
||||
|
||||
static const TX_TYPE_1D htx_tab[TX_TYPES] = {
|
||||
DCT_1D, DCT_1D, ADST_1D, ADST_1D,
|
||||
#if CONFIG_EXT_TX
|
||||
DCT_1D, FLIPADST_1D, FLIPADST_1D, FLIPADST_1D, ADST_1D, IDTX_1D,
|
||||
IDTX_1D, DCT_1D, IDTX_1D, ADST_1D, IDTX_1D, FLIPADST_1D,
|
||||
#endif // CONFIG_EXT_TX
|
||||
};
|
||||
|
||||
#if CONFIG_RECT_TX && (CONFIG_EXT_TX || CONFIG_VAR_TX)
|
||||
// Same as "max_txsize_lookup[bsize] - TX_8X8", except for rectangular
|
||||
// block which may use a rectangular transform, in which case it is
|
||||
|
|
@ -571,7 +627,7 @@ static const int32_t intra_tx_size_cat_lookup[BLOCK_SIZES] = {
|
|||
/* clang-format on */
|
||||
|
||||
static const TX_SIZE sub_tx_size_map[TX_SIZES_ALL] = {
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
TX_2X2, // TX_2X2
|
||||
#endif
|
||||
TX_4X4, // TX_4X4
|
||||
|
|
@ -594,7 +650,7 @@ static const TX_SIZE sub_tx_size_map[TX_SIZES_ALL] = {
|
|||
};
|
||||
|
||||
static const TX_SIZE txsize_horz_map[TX_SIZES_ALL] = {
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
TX_2X2, // TX_2X2
|
||||
#endif
|
||||
TX_4X4, // TX_4X4
|
||||
|
|
@ -617,7 +673,7 @@ static const TX_SIZE txsize_horz_map[TX_SIZES_ALL] = {
|
|||
};
|
||||
|
||||
static const TX_SIZE txsize_vert_map[TX_SIZES_ALL] = {
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
TX_2X2, // TX_2X2
|
||||
#endif
|
||||
TX_4X4, // TX_4X4
|
||||
|
|
@ -639,7 +695,7 @@ static const TX_SIZE txsize_vert_map[TX_SIZES_ALL] = {
|
|||
TX_8X8, // TX_32X8
|
||||
};
|
||||
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
#define TX_SIZE_W_MIN 2
|
||||
#else
|
||||
#define TX_SIZE_W_MIN 4
|
||||
|
|
@ -647,7 +703,7 @@ static const TX_SIZE txsize_vert_map[TX_SIZES_ALL] = {
|
|||
|
||||
// Transform block width in pixels
|
||||
static const int tx_size_wide[TX_SIZES_ALL] = {
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
2,
|
||||
#endif
|
||||
4, 8, 16, 32,
|
||||
|
|
@ -657,7 +713,7 @@ static const int tx_size_wide[TX_SIZES_ALL] = {
|
|||
4, 8, 8, 16, 16, 32, 4, 16, 8, 32
|
||||
};
|
||||
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
#define TX_SIZE_H_MIN 2
|
||||
#else
|
||||
#define TX_SIZE_H_MIN 4
|
||||
|
|
@ -665,7 +721,7 @@ static const int tx_size_wide[TX_SIZES_ALL] = {
|
|||
|
||||
// Transform block height in pixels
|
||||
static const int tx_size_high[TX_SIZES_ALL] = {
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
2,
|
||||
#endif
|
||||
4, 8, 16, 32,
|
||||
|
|
@ -677,41 +733,41 @@ static const int tx_size_high[TX_SIZES_ALL] = {
|
|||
|
||||
// Transform block width in unit
|
||||
static const int tx_size_wide_unit[TX_SIZES_ALL] = {
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
1, 2, 4, 8, 16,
|
||||
#if CONFIG_TX64X64
|
||||
32,
|
||||
#endif // CONFIG_TX64X64
|
||||
2, 4, 4, 8, 8, 16, 2, 8, 4, 16
|
||||
#else // CONFIG_CB4X4
|
||||
#else // CONFIG_CHROMA_2X2
|
||||
1, 2, 4, 8,
|
||||
#if CONFIG_TX64X64
|
||||
16,
|
||||
#endif // CONFIG_TX64X64
|
||||
1, 2, 2, 4, 4, 8, 1, 4, 2, 8
|
||||
#endif // CONFIG_CB4X4
|
||||
#endif // CONFIG_CHROMA_2X2
|
||||
};
|
||||
|
||||
// Transform block height in unit
|
||||
static const int tx_size_high_unit[TX_SIZES_ALL] = {
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
1, 2, 4, 8, 16,
|
||||
#if CONFIG_TX64X64
|
||||
32,
|
||||
#endif // CONFIG_TX64X64
|
||||
4, 2, 8, 4, 16, 8, 8, 2, 16, 4
|
||||
#else // CONFIG_CB4X4
|
||||
#else // CONFIG_CHROMA_2X2
|
||||
1, 2, 4, 8,
|
||||
#if CONFIG_TX64X64
|
||||
16,
|
||||
#endif // CONFIG_TX64X64
|
||||
2, 1, 4, 2, 8, 4, 4, 1, 8, 2
|
||||
#endif // CONFIG_CB4X4
|
||||
#endif // CONFIG_CHROMA_2X2
|
||||
};
|
||||
|
||||
// Transform block width in log2
|
||||
static const int tx_size_wide_log2[TX_SIZES_ALL] = {
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
1,
|
||||
#endif
|
||||
2, 3, 4, 5,
|
||||
|
|
@ -723,7 +779,7 @@ static const int tx_size_wide_log2[TX_SIZES_ALL] = {
|
|||
|
||||
// Transform block height in log2
|
||||
static const int tx_size_high_log2[TX_SIZES_ALL] = {
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
1,
|
||||
#endif
|
||||
2, 3, 4, 5,
|
||||
|
|
@ -733,8 +789,11 @@ static const int tx_size_high_log2[TX_SIZES_ALL] = {
|
|||
3, 2, 4, 3, 5, 4, 4, 2, 5, 3
|
||||
};
|
||||
|
||||
#define TX_UNIT_WIDE_LOG2 (MI_SIZE_LOG2 - tx_size_wide_log2[0])
|
||||
#define TX_UNIT_HIGH_LOG2 (MI_SIZE_LOG2 - tx_size_high_log2[0])
|
||||
|
||||
static const int tx_size_2d[TX_SIZES_ALL] = {
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
4,
|
||||
#endif
|
||||
16, 64, 256, 1024,
|
||||
|
|
@ -745,7 +804,7 @@ static const int tx_size_2d[TX_SIZES_ALL] = {
|
|||
};
|
||||
|
||||
static const BLOCK_SIZE txsize_to_bsize[TX_SIZES_ALL] = {
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
BLOCK_2X2, // TX_2X2
|
||||
#endif
|
||||
BLOCK_4X4, // TX_4X4
|
||||
|
|
@ -753,22 +812,22 @@ static const BLOCK_SIZE txsize_to_bsize[TX_SIZES_ALL] = {
|
|||
BLOCK_16X16, // TX_16X16
|
||||
BLOCK_32X32, // TX_32X32
|
||||
#if CONFIG_TX64X64
|
||||
BLOCK_64X64, // TX_64X64
|
||||
#endif // CONFIG_TX64X64
|
||||
BLOCK_4X8, // TX_4X8
|
||||
BLOCK_8X4, // TX_8X4
|
||||
BLOCK_8X16, // TX_8X16
|
||||
BLOCK_16X8, // TX_16X8
|
||||
BLOCK_16X32, // TX_16X32
|
||||
BLOCK_32X16, // TX_32X16
|
||||
BLOCK_INVALID, // TX_4X16
|
||||
BLOCK_INVALID, // TX_16X4
|
||||
BLOCK_INVALID, // TX_8X32
|
||||
BLOCK_INVALID, // TX_32X8
|
||||
BLOCK_64X64, // TX_64X64
|
||||
#endif // CONFIG_TX64X64
|
||||
BLOCK_4X8, // TX_4X8
|
||||
BLOCK_8X4, // TX_8X4
|
||||
BLOCK_8X16, // TX_8X16
|
||||
BLOCK_16X8, // TX_16X8
|
||||
BLOCK_16X32, // TX_16X32
|
||||
BLOCK_32X16, // TX_32X16
|
||||
BLOCK_4X16, // TX_4X16
|
||||
BLOCK_16X4, // TX_16X4
|
||||
BLOCK_8X32, // TX_8X32
|
||||
BLOCK_32X8, // TX_32X8
|
||||
};
|
||||
|
||||
static const TX_SIZE txsize_sqr_map[TX_SIZES_ALL] = {
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
TX_2X2, // TX_2X2
|
||||
#endif
|
||||
TX_4X4, // TX_4X4
|
||||
|
|
@ -791,7 +850,7 @@ static const TX_SIZE txsize_sqr_map[TX_SIZES_ALL] = {
|
|||
};
|
||||
|
||||
static const TX_SIZE txsize_sqr_up_map[TX_SIZES_ALL] = {
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
TX_2X2, // TX_2X2
|
||||
#endif
|
||||
TX_4X4, // TX_4X4
|
||||
|
|
@ -864,6 +923,7 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
|
|||
// ss_x == 0 ss_x == 0 ss_x == 1 ss_x == 1
|
||||
// ss_y == 0 ss_y == 1 ss_y == 0 ss_y == 1
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
{
|
||||
// BLOCK_2X2
|
||||
{ { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
|
||||
|
|
@ -927,15 +987,77 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
|
|||
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
|
||||
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
|
||||
},
|
||||
#else // CONFIG_CHROMA_2X2
|
||||
{
|
||||
// BLOCK_2X2
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
#if CONFIG_TX64X64
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
#endif // CONFIG_TX64X64
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
|
||||
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
|
||||
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
|
||||
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
|
||||
},
|
||||
{
|
||||
// BLOCK_2X4
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
#if CONFIG_TX64X64
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
#endif // CONFIG_TX64X64
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
|
||||
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
|
||||
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
|
||||
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
|
||||
},
|
||||
{
|
||||
// BLOCK_2X4
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
#if CONFIG_TX64X64
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
#endif // CONFIG_TX64X64
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
|
||||
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
|
||||
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
|
||||
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
|
||||
},
|
||||
#endif // CONFIG_CHROMA_2X2
|
||||
#endif
|
||||
{
|
||||
// BLOCK_4X4
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
{ { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
|
||||
{ { TX_4X4, TX_2X2 }, { TX_2X2, TX_2X2 } },
|
||||
#else
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
#endif // CONFIG_CB4X4
|
||||
#endif // CONFIG_CHROMA_2X2
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
|
|
@ -955,7 +1077,7 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
|
|||
},
|
||||
{
|
||||
// BLOCK_4X8
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
{ { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
|
||||
{ { TX_4X4, TX_2X2 }, { TX_2X2, TX_2X2 } },
|
||||
#else
|
||||
|
|
@ -967,7 +1089,7 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
|
|||
#if CONFIG_TX64X64
|
||||
{ { TX_4X8, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
#endif // CONFIG_TX64X64
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
{ { TX_4X8, TX_4X4 }, { TX_2X2, TX_2X2 } }, // used
|
||||
#else
|
||||
{ { TX_4X8, TX_4X4 }, { TX_4X4, TX_4X4 } }, // used
|
||||
|
|
@ -984,7 +1106,7 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
|
|||
},
|
||||
{
|
||||
// BLOCK_8X4
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
{ { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
|
||||
{ { TX_4X4, TX_2X2 }, { TX_2X2, TX_2X2 } },
|
||||
#else
|
||||
|
|
@ -997,7 +1119,7 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
|
|||
{ { TX_8X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
#endif // CONFIG_TX64X64
|
||||
{ { TX_8X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
{ { TX_8X4, TX_2X2 }, { TX_4X4, TX_2X2 } }, // used
|
||||
#else
|
||||
{ { TX_8X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, // used
|
||||
|
|
@ -1013,7 +1135,7 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
|
|||
},
|
||||
{
|
||||
// BLOCK_8X8
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
{ { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
|
||||
#endif
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
|
|
@ -1036,7 +1158,7 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
|
|||
},
|
||||
{
|
||||
// BLOCK_8X16
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
#endif
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
|
|
@ -1052,14 +1174,14 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
|
|||
{ { TX_8X16, TX_8X8 }, { TX_4X8, TX_4X8 } },
|
||||
{ { TX_8X16, TX_8X8 }, { TX_4X8, TX_4X8 } },
|
||||
{ { TX_8X16, TX_8X8 }, { TX_4X8, TX_4X8 } },
|
||||
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
|
||||
{ { TX_4X16, TX_4X8 }, { TX_4X16, TX_4X8 } },
|
||||
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
|
||||
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
|
||||
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
|
||||
},
|
||||
{
|
||||
// BLOCK_16X8
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
#endif
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
|
|
@ -1076,13 +1198,13 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
|
|||
{ { TX_16X8, TX_8X4 }, { TX_8X8, TX_8X4 } },
|
||||
{ { TX_16X8, TX_8X4 }, { TX_8X8, TX_8X4 } },
|
||||
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
|
||||
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
|
||||
{ { TX_16X4, TX_16X4 }, { TX_8X4, TX_8X4 } },
|
||||
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
|
||||
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
|
||||
},
|
||||
{
|
||||
// BLOCK_16X16
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
#endif
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
|
|
@ -1105,7 +1227,7 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
|
|||
},
|
||||
{
|
||||
// BLOCK_16X32
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
#endif
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
|
|
@ -1123,12 +1245,12 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
|
|||
{ { TX_16X32, TX_16X16 }, { TX_8X16, TX_8X16 } },
|
||||
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
|
||||
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
|
||||
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
|
||||
{ { TX_8X32, TX_8X16 }, { TX_4X16, TX_4X16 } },
|
||||
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
|
||||
},
|
||||
{
|
||||
// BLOCK_32X16
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
#endif
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
|
|
@ -1147,11 +1269,11 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
|
|||
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
|
||||
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
|
||||
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
|
||||
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
|
||||
{ { TX_32X8, TX_32X8 }, { TX_16X8, TX_16X4 } },
|
||||
},
|
||||
{
|
||||
// BLOCK_32X32
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
#endif
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
|
|
@ -1174,7 +1296,7 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
|
|||
},
|
||||
{
|
||||
// BLOCK_32X64
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
#endif
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
|
|
@ -1197,7 +1319,7 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
|
|||
},
|
||||
{
|
||||
// BLOCK_64X32
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
#endif
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
|
|
@ -1220,7 +1342,7 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
|
|||
},
|
||||
{
|
||||
// BLOCK_64X64
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
#endif
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
|
|
@ -1244,7 +1366,7 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
|
|||
#if CONFIG_EXT_PARTITION
|
||||
{
|
||||
// BLOCK_64X128
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
#endif
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
|
|
@ -1267,7 +1389,7 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
|
|||
},
|
||||
{
|
||||
// BLOCK_128X64
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
#endif
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
|
|
@ -1290,7 +1412,7 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
|
|||
},
|
||||
{
|
||||
// BLOCK_128X128
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
#endif
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
|
|
@ -1371,7 +1493,7 @@ static const struct {
|
|||
static const TX_SIZE uvsupertx_size_lookup[TX_SIZES][2][2] = {
|
||||
// ss_x == 0 ss_x == 0 ss_x == 1 ss_x == 1
|
||||
// ss_y == 0 ss_y == 1 ss_y == 0 ss_y == 1
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
#endif
|
||||
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
|
||||
|
|
|
|||
148
third_party/aom/av1/common/convolve.c
vendored
148
third_party/aom/av1/common/convolve.c
vendored
|
|
@ -290,12 +290,14 @@ void av1_convolve_2d_facade(const uint8_t *src, int src_stride, uint8_t *dst,
|
|||
InterpFilterParams filter_params_y =
|
||||
av1_get_interp_filter_params(interp_filter[0 + 2 * conv_params->ref]);
|
||||
|
||||
#if USE_EXTRA_FILTER
|
||||
if (filter_params_x.interp_filter == MULTITAP_SHARP &&
|
||||
filter_params_y.interp_filter == MULTITAP_SHARP) {
|
||||
// Avoid two directions both using 12-tap filter.
|
||||
// This will reduce hardware implementation cost.
|
||||
filter_params_y = av1_get_interp_filter_params(EIGHTTAP_SHARP);
|
||||
}
|
||||
#endif // USE_EXTRA_FILTER
|
||||
#else
|
||||
InterpFilterParams filter_params_x =
|
||||
av1_get_interp_filter_params(*interp_filter);
|
||||
|
|
@ -331,6 +333,140 @@ void av1_convolve_2d_facade(const uint8_t *src, int src_stride, uint8_t *dst,
|
|||
}
|
||||
}
|
||||
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
static INLINE void transpose_uint16(uint16_t *dst, int dst_stride,
|
||||
const uint16_t *src, int src_stride, int w,
|
||||
int h) {
|
||||
int r, c;
|
||||
for (r = 0; r < h; ++r)
|
||||
for (c = 0; c < w; ++c) dst[c * dst_stride + r] = src[r * src_stride + c];
|
||||
}
|
||||
|
||||
void av1_highbd_convolve_rounding(const int32_t *src, int src_stride,
|
||||
uint8_t *dst8, int dst_stride, int w, int h,
|
||||
int bits, int bd) {
|
||||
uint16_t *dst = CONVERT_TO_SHORTPTR(dst8);
|
||||
int r, c;
|
||||
for (r = 0; r < h; ++r) {
|
||||
for (c = 0; c < w; ++c) {
|
||||
dst[r * dst_stride + c] = clip_pixel_highbd(
|
||||
ROUND_POWER_OF_TWO_SIGNED(src[r * src_stride + c], bits), bd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
int x, y, k;
|
||||
CONV_BUF_TYPE im_block[(MAX_SB_SIZE + MAX_FILTER_TAP - 1) * MAX_SB_SIZE];
|
||||
int im_h = h + filter_params_y->taps - 1;
|
||||
int im_stride = w;
|
||||
const int fo_vert = filter_params_y->taps / 2 - 1;
|
||||
const int fo_horiz = filter_params_x->taps / 2 - 1;
|
||||
(void)conv_params;
|
||||
// horizontal filter
|
||||
const uint16_t *src_horiz = src - fo_vert * src_stride;
|
||||
const int16_t *x_filter = av1_get_interp_filter_subpel_kernel(
|
||||
*filter_params_x, subpel_x_q4 & SUBPEL_MASK);
|
||||
for (y = 0; y < im_h; ++y) {
|
||||
for (x = 0; x < w; ++x) {
|
||||
CONV_BUF_TYPE sum = 0;
|
||||
for (k = 0; k < filter_params_x->taps; ++k) {
|
||||
sum += x_filter[k] * src_horiz[y * src_stride + x - fo_horiz + k];
|
||||
}
|
||||
#if CONFIG_COMPOUND_ROUND
|
||||
im_block[y * im_stride + x] = clip_pixel_highbd(
|
||||
ROUND_POWER_OF_TWO_SIGNED(sum, conv_params->round_0), bd);
|
||||
#else
|
||||
(void)bd;
|
||||
im_block[y * im_stride + x] =
|
||||
ROUND_POWER_OF_TWO_SIGNED(sum, conv_params->round_0);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
// vertical filter
|
||||
CONV_BUF_TYPE *src_vert = im_block + fo_vert * im_stride;
|
||||
const int16_t *y_filter = av1_get_interp_filter_subpel_kernel(
|
||||
*filter_params_y, subpel_y_q4 & SUBPEL_MASK);
|
||||
for (y = 0; y < h; ++y) {
|
||||
for (x = 0; x < w; ++x) {
|
||||
CONV_BUF_TYPE sum = 0;
|
||||
for (k = 0; k < filter_params_y->taps; ++k) {
|
||||
sum += y_filter[k] * src_vert[(y - fo_vert + k) * im_stride + x];
|
||||
}
|
||||
dst[y * dst_stride + x] +=
|
||||
ROUND_POWER_OF_TWO_SIGNED(sum, conv_params->round_1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void av1_highbd_convolve_2d_facade(const uint8_t *src8, int src_stride,
|
||||
uint8_t *dst, int dst_stride, int w, int h,
|
||||
const InterpFilter *interp_filter,
|
||||
const int subpel_x_q4, int x_step_q4,
|
||||
const int subpel_y_q4, int y_step_q4,
|
||||
ConvolveParams *conv_params, int bd) {
|
||||
(void)x_step_q4;
|
||||
(void)y_step_q4;
|
||||
(void)dst;
|
||||
(void)dst_stride;
|
||||
#if CONFIG_DUAL_FILTER
|
||||
InterpFilterParams filter_params_x =
|
||||
av1_get_interp_filter_params(interp_filter[1 + 2 * conv_params->ref]);
|
||||
InterpFilterParams filter_params_y =
|
||||
av1_get_interp_filter_params(interp_filter[0 + 2 * conv_params->ref]);
|
||||
|
||||
#if USE_EXTRA_FILTER
|
||||
if (filter_params_x.interp_filter == MULTITAP_SHARP &&
|
||||
filter_params_y.interp_filter == MULTITAP_SHARP) {
|
||||
// Avoid two directions both using 12-tap filter.
|
||||
// This will reduce hardware implementation cost.
|
||||
filter_params_y = av1_get_interp_filter_params(EIGHTTAP_SHARP);
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
InterpFilterParams filter_params_x =
|
||||
av1_get_interp_filter_params(*interp_filter);
|
||||
InterpFilterParams filter_params_y =
|
||||
av1_get_interp_filter_params(*interp_filter);
|
||||
#endif
|
||||
const uint16_t *src = CONVERT_TO_SHORTPTR(src8);
|
||||
if (filter_params_y.taps < filter_params_x.taps) {
|
||||
uint16_t tr_src[(MAX_SB_SIZE + MAX_FILTER_TAP - 1) *
|
||||
(MAX_SB_SIZE + MAX_FILTER_TAP - 1)];
|
||||
int tr_src_stride = MAX_SB_SIZE + MAX_FILTER_TAP - 1;
|
||||
CONV_BUF_TYPE tr_dst[MAX_SB_SIZE * MAX_SB_SIZE];
|
||||
int tr_dst_stride = MAX_SB_SIZE;
|
||||
int fo_vert = filter_params_y.taps / 2 - 1;
|
||||
int fo_horiz = filter_params_x.taps / 2 - 1;
|
||||
|
||||
transpose_uint16(
|
||||
tr_src, tr_src_stride, src - fo_vert * src_stride - fo_horiz,
|
||||
src_stride, w + filter_params_x.taps - 1, h + filter_params_y.taps - 1);
|
||||
transpose_int32(tr_dst, tr_dst_stride, conv_params->dst,
|
||||
conv_params->dst_stride, w, h);
|
||||
|
||||
// horizontal and vertical parameters are swapped because of the transpose
|
||||
av1_highbd_convolve_2d(tr_src + fo_horiz * tr_src_stride + fo_vert,
|
||||
tr_src_stride, tr_dst, tr_dst_stride, h, w,
|
||||
&filter_params_y, &filter_params_x, subpel_y_q4,
|
||||
subpel_x_q4, conv_params, bd);
|
||||
transpose_int32(conv_params->dst, conv_params->dst_stride, tr_dst,
|
||||
tr_dst_stride, h, w);
|
||||
} else {
|
||||
av1_highbd_convolve_2d(src, src_stride, conv_params->dst,
|
||||
conv_params->dst_stride, w, h, &filter_params_x,
|
||||
&filter_params_y, subpel_x_q4, subpel_y_q4,
|
||||
conv_params, bd);
|
||||
}
|
||||
}
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
|
||||
#endif // CONFIG_CONVOLVE_ROUND
|
||||
|
||||
typedef void (*ConvolveFunc)(const uint8_t *src, int src_stride, uint8_t *dst,
|
||||
|
|
@ -394,7 +530,7 @@ static void convolve_helper(const uint8_t *src, int src_stride, uint8_t *dst,
|
|||
temp[((MAX_SB_SIZE * 2 + 16) + 16) * MAX_SB_SIZE]);
|
||||
int max_intermediate_size = ((MAX_SB_SIZE * 2 + 16) + 16);
|
||||
int filter_size;
|
||||
#if CONFIG_DUAL_FILTER
|
||||
#if CONFIG_DUAL_FILTER && USE_EXTRA_FILTER
|
||||
if (interp_filter[0 + 2 * conv_params->ref] == MULTITAP_SHARP &&
|
||||
interp_filter[1 + 2 * conv_params->ref] == MULTITAP_SHARP) {
|
||||
// Avoid two directions both using 12-tap filter.
|
||||
|
|
@ -427,7 +563,7 @@ static void convolve_helper(const uint8_t *src, int src_stride, uint8_t *dst,
|
|||
convolve_horiz(temp + (filter_size / 2 - 1), temp_stride, dst, dst_stride,
|
||||
w, h, filter_params, subpel_x_q4, x_step_q4, conv_params);
|
||||
} else
|
||||
#endif // CONFIG_DUAL_FILTER
|
||||
#endif // CONFIG_DUAL_FILTER && USE_EXTRA_FILTER
|
||||
{
|
||||
int intermediate_height;
|
||||
int temp_stride = MAX_SB_SIZE;
|
||||
|
|
@ -708,15 +844,15 @@ void av1_highbd_convolve(const uint8_t *src8, int src_stride, uint8_t *dst8,
|
|||
av1_get_interp_filter_params(interp_filter[1 + 2 * ref_idx]);
|
||||
InterpFilterParams filter_params_y =
|
||||
av1_get_interp_filter_params(interp_filter[0 + 2 * ref_idx]);
|
||||
#endif
|
||||
|
||||
#if CONFIG_DUAL_FILTER && USE_EXTRA_FILTER
|
||||
if (interp_filter[0 + 2 * ref_idx] == MULTITAP_SHARP &&
|
||||
interp_filter[1 + 2 * ref_idx] == MULTITAP_SHARP) {
|
||||
// Avoid two directions both using 12-tap filter.
|
||||
// This will reduce hardware implementation cost.
|
||||
filter_params_y = av1_get_interp_filter_params(EIGHTTAP_SHARP);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CONFIG_DUAL_FILTER
|
||||
if (filter_params_y.taps < filter_params_x.taps) {
|
||||
int intermediate_width;
|
||||
int temp_stride = max_intermediate_size;
|
||||
|
|
@ -739,7 +875,7 @@ void av1_highbd_convolve(const uint8_t *src8, int src_stride, uint8_t *dst8,
|
|||
temp8 + (filter_size / 2 - 1), temp_stride, dst8, dst_stride, w, h,
|
||||
filter_params, subpel_x_q4, x_step_q4, ref_idx, bd);
|
||||
} else
|
||||
#endif // CONFIG_DUAL_FILTER
|
||||
#endif // CONFIG_DUAL_FILTER && USE_EXTRA_FILTER
|
||||
{
|
||||
int intermediate_height;
|
||||
int temp_stride = MAX_SB_SIZE;
|
||||
|
|
|
|||
23
third_party/aom/av1/common/convolve.h
vendored
23
third_party/aom/av1/common/convolve.h
vendored
|
|
@ -33,6 +33,7 @@ typedef struct ConvolveParams {
|
|||
int round_0;
|
||||
int round_1;
|
||||
int plane;
|
||||
int do_post_rounding;
|
||||
} ConvolveParams;
|
||||
|
||||
static INLINE ConvolveParams get_conv_params(int ref, int plane) {
|
||||
|
|
@ -40,6 +41,7 @@ static INLINE ConvolveParams get_conv_params(int ref, int plane) {
|
|||
conv_params.ref = ref;
|
||||
conv_params.round = CONVOLVE_OPT_ROUND;
|
||||
conv_params.plane = plane;
|
||||
conv_params.do_post_rounding = 0;
|
||||
return conv_params;
|
||||
}
|
||||
struct AV1Common;
|
||||
|
|
@ -73,11 +75,32 @@ static INLINE ConvolveParams get_conv_params_no_round(int ref, int plane,
|
|||
conv_params.dst = dst;
|
||||
conv_params.dst_stride = dst_stride;
|
||||
conv_params.plane = plane;
|
||||
conv_params.do_post_rounding = 0;
|
||||
return conv_params;
|
||||
}
|
||||
|
||||
void av1_convolve_rounding(const int32_t *src, int src_stride, uint8_t *dst,
|
||||
int dst_stride, int w, int h, int bits);
|
||||
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
void av1_highbd_convolve_rounding(const int32_t *src, int src_stride,
|
||||
uint8_t *dst8, int dst_stride, int w, int h,
|
||||
int bits, int bd);
|
||||
|
||||
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);
|
||||
|
||||
void av1_highbd_convolve_2d_facade(const uint8_t *src8, int src_stride,
|
||||
uint8_t *dst, int dst_stride, int w, int h,
|
||||
const InterpFilter *interp_filter,
|
||||
const int subpel_x_q4, int x_step_q4,
|
||||
const int subpel_y_q4, int y_step_q4,
|
||||
ConvolveParams *conv_params, int bd);
|
||||
#endif
|
||||
#endif // CONFIG_CONVOLVE_ROUND
|
||||
|
||||
void av1_convolve(const uint8_t *src, int src_stride, uint8_t *dst,
|
||||
|
|
|
|||
10
third_party/aom/av1/common/debugmodes.c
vendored
10
third_party/aom/av1/common/debugmodes.c
vendored
|
|
@ -12,6 +12,7 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#include "av1/common/blockd.h"
|
||||
#include "av1/common/enums.h"
|
||||
#include "av1/common/onyxc_int.h"
|
||||
|
||||
static void log_frame_info(AV1_COMMON *cm, const char *str, FILE *f) {
|
||||
|
|
@ -35,11 +36,12 @@ 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 ", *((int *)((char *)(&mi[0]->mbmi) + member_offset)));
|
||||
fprintf(file, "%2d ",
|
||||
*((char *)((char *)(&mi[0]->mbmi) + member_offset)));
|
||||
mi++;
|
||||
}
|
||||
fprintf(file, "\n");
|
||||
mi += 8;
|
||||
mi += MAX_MIB_SIZE;
|
||||
}
|
||||
fprintf(file, "\n");
|
||||
}
|
||||
|
|
@ -67,7 +69,7 @@ void av1_print_modes_and_motion_vectors(AV1_COMMON *cm, const char *file) {
|
|||
mi++;
|
||||
}
|
||||
fprintf(mvs, "\n");
|
||||
mi += 8;
|
||||
mi += MAX_MIB_SIZE;
|
||||
}
|
||||
fprintf(mvs, "\n");
|
||||
|
||||
|
|
@ -82,7 +84,7 @@ void av1_print_modes_and_motion_vectors(AV1_COMMON *cm, const char *file) {
|
|||
mi++;
|
||||
}
|
||||
fprintf(mvs, "\n");
|
||||
mi += 8;
|
||||
mi += MAX_MIB_SIZE;
|
||||
}
|
||||
fprintf(mvs, "\n");
|
||||
|
||||
|
|
|
|||
722
third_party/aom/av1/common/entropy.c
vendored
722
third_party/aom/av1/common/entropy.c
vendored
|
|
@ -135,7 +135,7 @@ const aom_prob av1_cat6_prob[] = {
|
|||
};
|
||||
|
||||
const uint16_t band_count_table[TX_SIZES_ALL][8] = {
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
{ 1, 2, 2, 3, 0, 0, 0 },
|
||||
#endif
|
||||
{ 1, 2, 3, 4, 3, 16 - 13, 0 }, { 1, 2, 3, 4, 11, 64 - 21, 0 },
|
||||
|
|
@ -151,7 +151,7 @@ const uint16_t band_count_table[TX_SIZES_ALL][8] = {
|
|||
};
|
||||
|
||||
const uint16_t band_cum_count_table[TX_SIZES_ALL][8] = {
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
{ 0, 1, 3, 6, 10, 13, 16, 0 },
|
||||
#endif
|
||||
{ 0, 1, 3, 6, 10, 13, 16, 0 }, { 0, 1, 3, 6, 10, 21, 64, 0 },
|
||||
|
|
@ -627,7 +627,6 @@ const aom_prob av1_pareto8_full[COEFF_PROB_MODELS][MODEL_NODES] = {
|
|||
// The full source code of the generating program is available in:
|
||||
// tools/gen_constrained_tokenset.py
|
||||
//
|
||||
#if CONFIG_NEW_TOKENSET
|
||||
// Values for tokens TWO_TOKEN through CATEGORY6_TOKEN included
|
||||
// in the table here : the ONE_TOKEN probability is
|
||||
// removed and the probabilities rescaled.
|
||||
|
|
@ -891,275 +890,13 @@ const aom_cdf_prob av1_pareto8_tail_probs[COEFF_PROB_MODELS][TAIL_NODES] = {
|
|||
{ 31131, 1448, 152, 31, 2, 1, 1, 1, 1 },
|
||||
{ 31486, 1150, 107, 20, 1, 1, 1, 1, 1 },
|
||||
};
|
||||
#elif CONFIG_EC_MULTISYMBOL
|
||||
// Values for tokens ONE_TOKEN through CATEGORY6_TOKEN included here.
|
||||
// ZERO_TOKEN and EOB_TOKEN are coded as flags outside this coder.
|
||||
const aom_cdf_prob
|
||||
av1_pareto8_token_probs[COEFF_PROB_MODELS][ENTROPY_TOKENS - 2] = {
|
||||
{ 128, 127, 127, 126, 251, 495, 965, 1832, 3305, 25412 },
|
||||
{ 256, 254, 252, 249, 492, 959, 1820, 3283, 5365, 19838 },
|
||||
{ 384, 379, 374, 369, 724, 1392, 2574, 4417, 6568, 15587 },
|
||||
{ 512, 503, 494, 486, 946, 1795, 3238, 5289, 7184, 12321 },
|
||||
{ 640, 626, 612, 599, 1159, 2172, 3818, 5946, 7401, 9795 },
|
||||
{ 768, 748, 728, 709, 1363, 2522, 4324, 6424, 7352, 7830 },
|
||||
{ 896, 869, 842, 816, 1559, 2847, 4762, 6755, 7131, 6291 },
|
||||
{ 1024, 988, 954, 921, 1747, 3148, 5139, 6966, 6803, 5078 },
|
||||
{ 1152, 1107, 1063, 1022, 1926, 3427, 5460, 7080, 6412, 4119 },
|
||||
{ 1280, 1224, 1171, 1120, 2098, 3685, 5730, 7113, 5991, 3356 },
|
||||
{ 1408, 1340, 1276, 1216, 2261, 3923, 5955, 7083, 5560, 2746 },
|
||||
{ 1536, 1455, 1380, 1308, 2418, 4142, 6140, 7001, 5133, 2255 },
|
||||
{ 1664, 1569, 1481, 1398, 2567, 4342, 6287, 6879, 4721, 1860 },
|
||||
{ 1792, 1683, 1580, 1485, 2709, 4525, 6401, 6725, 4329, 1539 },
|
||||
{ 1920, 1794, 1678, 1570, 2845, 4692, 6486, 6546, 3959, 1278 },
|
||||
{ 2048, 1905, 1773, 1651, 2974, 4844, 6543, 6350, 3615, 1065 },
|
||||
{ 2176, 2015, 1867, 1731, 3096, 4980, 6576, 6140, 3296, 891 },
|
||||
{ 2304, 2123, 1958, 1807, 3212, 5104, 6589, 5922, 3002, 747 },
|
||||
{ 2432, 2231, 2048, 1882, 3322, 5214, 6581, 5698, 2732, 628 },
|
||||
{ 2560, 2337, 2136, 1953, 3427, 5311, 6557, 5472, 2485, 530 },
|
||||
{ 2688, 2442, 2222, 2023, 3525, 5397, 6518, 5246, 2259, 448 },
|
||||
{ 2816, 2547, 2306, 2090, 3618, 5472, 6465, 5021, 2053, 380 },
|
||||
{ 2944, 2650, 2388, 2154, 3706, 5537, 6401, 4799, 1866, 323 },
|
||||
{ 3072, 2752, 2468, 2217, 3788, 5591, 6327, 4581, 1696, 276 },
|
||||
{ 3200, 2853, 2547, 2277, 3866, 5637, 6243, 4369, 1541, 235 },
|
||||
{ 3328, 2952, 2624, 2335, 3938, 5673, 6152, 4163, 1401, 202 },
|
||||
{ 3456, 3051, 2699, 2391, 4006, 5702, 6054, 3962, 1274, 173 },
|
||||
{ 3584, 3149, 2772, 2444, 4070, 5723, 5950, 3769, 1158, 149 },
|
||||
{ 3712, 3246, 2843, 2496, 4128, 5736, 5842, 3583, 1054, 128 },
|
||||
{ 3840, 3341, 2913, 2545, 4183, 5743, 5729, 3404, 959, 111 },
|
||||
{ 3968, 3436, 2981, 2593, 4233, 5743, 5614, 3232, 872, 96 },
|
||||
{ 4096, 3529, 3048, 2638, 4280, 5737, 5496, 3067, 794, 83 },
|
||||
{ 4224, 3621, 3113, 2682, 4322, 5726, 5375, 2909, 724, 72 },
|
||||
{ 4352, 3712, 3176, 2724, 4361, 5709, 5253, 2759, 659, 63 },
|
||||
{ 4480, 3803, 3237, 2764, 4396, 5687, 5130, 2615, 601, 55 },
|
||||
{ 4608, 3892, 3297, 2801, 4428, 5661, 5007, 2478, 548, 48 },
|
||||
{ 4736, 3980, 3355, 2838, 4456, 5631, 4883, 2347, 500, 42 },
|
||||
{ 4864, 4067, 3412, 2872, 4481, 5596, 4760, 2223, 456, 37 },
|
||||
{ 4992, 4152, 3467, 2905, 4503, 5558, 4637, 2105, 417, 32 },
|
||||
{ 5120, 4237, 3521, 2936, 4521, 5516, 4515, 1993, 381, 28 },
|
||||
{ 5248, 4321, 3573, 2966, 4537, 5471, 4393, 1886, 348, 25 },
|
||||
{ 5376, 4404, 3623, 2993, 4550, 5424, 4273, 1785, 318, 22 },
|
||||
{ 5504, 4486, 3672, 3020, 4560, 5373, 4155, 1688, 291, 19 },
|
||||
{ 5632, 4566, 3720, 3044, 4568, 5321, 4037, 1597, 266, 17 },
|
||||
{ 5760, 4646, 3766, 3067, 4572, 5265, 3922, 1511, 244, 15 },
|
||||
{ 5888, 4724, 3811, 3089, 4575, 5208, 3808, 1429, 223, 13 },
|
||||
{ 6016, 4802, 3854, 3109, 4575, 5148, 3696, 1352, 204, 12 },
|
||||
{ 6144, 4878, 3895, 3128, 4573, 5088, 3587, 1278, 187, 10 },
|
||||
{ 6272, 4953, 3936, 3145, 4568, 5025, 3479, 1209, 172, 9 },
|
||||
{ 6400, 5028, 3975, 3161, 4561, 4961, 3373, 1143, 158, 8 },
|
||||
{ 6528, 5101, 4012, 3175, 4553, 4896, 3270, 1081, 145, 7 },
|
||||
{ 6656, 5173, 4048, 3189, 4542, 4830, 3168, 1022, 133, 7 },
|
||||
{ 6784, 5244, 4083, 3201, 4530, 4763, 3069, 966, 122, 6 },
|
||||
{ 6912, 5314, 4117, 3212, 4516, 4694, 2973, 913, 112, 5 },
|
||||
{ 7040, 5383, 4149, 3221, 4500, 4626, 2878, 863, 103, 5 },
|
||||
{ 7168, 5452, 4180, 3229, 4482, 4556, 2786, 816, 95, 4 },
|
||||
{ 7296, 5519, 4210, 3236, 4463, 4486, 2696, 771, 87, 4 },
|
||||
{ 7424, 5585, 4238, 3242, 4442, 4416, 2609, 729, 80, 3 },
|
||||
{ 7552, 5650, 4265, 3247, 4420, 4345, 2523, 689, 74, 3 },
|
||||
{ 7680, 5714, 4291, 3251, 4396, 4274, 2440, 651, 68, 3 },
|
||||
{ 7808, 5777, 4315, 3254, 4371, 4203, 2359, 616, 63, 2 },
|
||||
{ 7936, 5838, 4339, 3255, 4345, 4132, 2281, 582, 58, 2 },
|
||||
{ 8064, 5899, 4361, 3256, 4318, 4061, 2204, 550, 53, 2 },
|
||||
{ 8192, 5959, 4382, 3255, 4289, 3990, 2130, 520, 49, 2 },
|
||||
{ 8320, 6018, 4402, 3254, 4259, 3919, 2057, 492, 45, 2 },
|
||||
{ 8448, 6075, 4421, 3252, 4229, 3848, 1987, 465, 42, 1 },
|
||||
{ 8576, 6133, 4438, 3248, 4197, 3778, 1919, 439, 39, 1 },
|
||||
{ 8704, 6188, 4455, 3244, 4164, 3708, 1853, 415, 36, 1 },
|
||||
{ 8832, 6243, 4470, 3239, 4131, 3638, 1789, 392, 33, 1 },
|
||||
{ 8960, 6297, 4484, 3233, 4096, 3569, 1727, 371, 30, 1 },
|
||||
{ 9088, 6349, 4497, 3226, 4061, 3500, 1667, 351, 28, 1 },
|
||||
{ 9216, 6401, 4509, 3219, 4025, 3432, 1608, 331, 26, 1 },
|
||||
{ 9344, 6452, 4520, 3210, 3989, 3364, 1551, 313, 24, 1 },
|
||||
{ 9472, 6501, 4530, 3201, 3952, 3297, 1496, 296, 22, 1 },
|
||||
{ 9600, 6550, 4539, 3191, 3914, 3230, 1443, 280, 20, 1 },
|
||||
{ 9728, 6597, 4547, 3180, 3875, 3164, 1392, 265, 19, 1 },
|
||||
{ 9856, 6644, 4554, 3169, 3836, 3098, 1342, 250, 18, 1 },
|
||||
{ 9984, 6690, 4560, 3157, 3796, 3034, 1293, 237, 16, 1 },
|
||||
{ 10112, 6734, 4565, 3144, 3756, 2970, 1247, 224, 15, 1 },
|
||||
{ 10240, 6778, 4568, 3131, 3716, 2907, 1202, 211, 14, 1 },
|
||||
{ 10368, 6821, 4571, 3117, 3675, 2844, 1158, 200, 13, 1 },
|
||||
{ 10496, 6862, 4573, 3102, 3634, 2783, 1116, 189, 12, 1 },
|
||||
{ 10624, 6903, 4574, 3087, 3592, 2722, 1075, 179, 11, 1 },
|
||||
{ 10752, 6942, 4575, 3071, 3551, 2662, 1035, 169, 10, 1 },
|
||||
{ 10880, 6981, 4574, 3054, 3508, 2603, 997, 160, 10, 1 },
|
||||
{ 11008, 7019, 4572, 3038, 3466, 2544, 960, 151, 9, 1 },
|
||||
{ 11136, 7055, 4570, 3020, 3424, 2487, 924, 143, 8, 1 },
|
||||
{ 11264, 7091, 4566, 3002, 3381, 2430, 890, 135, 8, 1 },
|
||||
{ 11392, 7126, 4563, 2984, 3338, 2374, 856, 127, 7, 1 },
|
||||
{ 11520, 7159, 4557, 2965, 3295, 2319, 824, 121, 7, 1 },
|
||||
{ 11648, 7193, 4552, 2945, 3252, 2264, 793, 114, 6, 1 },
|
||||
{ 11776, 7224, 4545, 2925, 3209, 2211, 763, 108, 6, 1 },
|
||||
{ 11904, 7255, 4538, 2905, 3165, 2159, 734, 102, 5, 1 },
|
||||
{ 12032, 7285, 4530, 2884, 3122, 2107, 706, 96, 5, 1 },
|
||||
{ 12160, 7314, 4520, 2863, 3079, 2056, 679, 91, 5, 1 },
|
||||
{ 12288, 7341, 4511, 2842, 3036, 2006, 653, 86, 4, 1 },
|
||||
{ 12416, 7368, 4500, 2820, 2993, 1957, 628, 81, 4, 1 },
|
||||
{ 12544, 7394, 4489, 2797, 2949, 1909, 604, 77, 4, 1 },
|
||||
{ 12672, 7419, 4477, 2775, 2906, 1861, 581, 73, 3, 1 },
|
||||
{ 12800, 7443, 4464, 2752, 2863, 1815, 558, 69, 3, 1 },
|
||||
{ 12928, 7466, 4451, 2729, 2820, 1769, 536, 65, 3, 1 },
|
||||
{ 13056, 7488, 4437, 2705, 2777, 1724, 516, 61, 3, 1 },
|
||||
{ 13184, 7509, 4422, 2682, 2734, 1680, 495, 58, 3, 1 },
|
||||
{ 13312, 7529, 4406, 2658, 2692, 1637, 476, 55, 2, 1 },
|
||||
{ 13440, 7548, 4390, 2633, 2650, 1595, 457, 52, 2, 1 },
|
||||
{ 13568, 7567, 4373, 2609, 2607, 1553, 439, 49, 2, 1 },
|
||||
{ 13696, 7583, 4356, 2584, 2565, 1513, 422, 46, 2, 1 },
|
||||
{ 13824, 7600, 4337, 2559, 2523, 1473, 405, 44, 2, 1 },
|
||||
{ 13952, 7615, 4319, 2533, 2482, 1434, 389, 41, 2, 1 },
|
||||
{ 14080, 7629, 4300, 2508, 2441, 1395, 373, 39, 2, 1 },
|
||||
{ 14208, 7643, 4280, 2482, 2400, 1358, 358, 37, 1, 1 },
|
||||
{ 14336, 7655, 4259, 2457, 2359, 1321, 344, 35, 1, 1 },
|
||||
{ 14464, 7667, 4238, 2431, 2318, 1285, 330, 33, 1, 1 },
|
||||
{ 14592, 7677, 4217, 2405, 2278, 1250, 316, 31, 1, 1 },
|
||||
{ 14720, 7687, 4195, 2378, 2238, 1215, 304, 29, 1, 1 },
|
||||
{ 14848, 7696, 4172, 2352, 2198, 1181, 291, 28, 1, 1 },
|
||||
{ 14976, 7703, 4149, 2326, 2159, 1148, 279, 26, 1, 1 },
|
||||
{ 15104, 7710, 4125, 2299, 2119, 1116, 268, 25, 1, 1 },
|
||||
{ 15232, 7715, 4101, 2272, 2081, 1085, 257, 23, 1, 1 },
|
||||
{ 15360, 7721, 4076, 2245, 2042, 1054, 246, 22, 1, 1 },
|
||||
{ 15488, 7724, 4051, 2219, 2004, 1023, 236, 21, 1, 1 },
|
||||
{ 15616, 7727, 4025, 2192, 1966, 994, 226, 20, 1, 1 },
|
||||
{ 15744, 7729, 3999, 2164, 1929, 965, 217, 19, 1, 1 },
|
||||
{ 15872, 7731, 3972, 2137, 1892, 937, 207, 18, 1, 1 },
|
||||
{ 16000, 7731, 3945, 2110, 1855, 909, 199, 17, 1, 1 },
|
||||
{ 16128, 7730, 3918, 2083, 1819, 882, 190, 16, 1, 1 },
|
||||
{ 16256, 7728, 3890, 2056, 1783, 856, 182, 15, 1, 1 },
|
||||
{ 16384, 7725, 3862, 2029, 1747, 831, 174, 14, 1, 1 },
|
||||
{ 16512, 7721, 3833, 2002, 1712, 806, 167, 13, 1, 1 },
|
||||
{ 16640, 7717, 3804, 1975, 1677, 781, 160, 12, 1, 1 },
|
||||
{ 16768, 7712, 3775, 1947, 1642, 757, 153, 12, 1, 1 },
|
||||
{ 16896, 7706, 3745, 1920, 1608, 734, 146, 11, 1, 1 },
|
||||
{ 17024, 7699, 3714, 1893, 1575, 711, 140, 10, 1, 1 },
|
||||
{ 17152, 7690, 3684, 1866, 1541, 689, 134, 10, 1, 1 },
|
||||
{ 17280, 7681, 3653, 1839, 1508, 668, 128, 9, 1, 1 },
|
||||
{ 17408, 7671, 3621, 1812, 1476, 647, 122, 9, 1, 1 },
|
||||
{ 17536, 7660, 3590, 1785, 1444, 626, 117, 8, 1, 1 },
|
||||
{ 17664, 7648, 3558, 1758, 1412, 606, 112, 8, 1, 1 },
|
||||
{ 17792, 7635, 3526, 1731, 1381, 587, 107, 7, 1, 1 },
|
||||
{ 17920, 7622, 3493, 1704, 1350, 568, 102, 7, 1, 1 },
|
||||
{ 18048, 7607, 3461, 1678, 1319, 549, 98, 6, 1, 1 },
|
||||
{ 18176, 7592, 3428, 1651, 1289, 531, 93, 6, 1, 1 },
|
||||
{ 18304, 7575, 3394, 1625, 1259, 514, 89, 6, 1, 1 },
|
||||
{ 18432, 7558, 3361, 1598, 1230, 497, 85, 5, 1, 1 },
|
||||
{ 18560, 7540, 3327, 1572, 1201, 480, 81, 5, 1, 1 },
|
||||
{ 18688, 7520, 3293, 1546, 1173, 464, 77, 5, 1, 1 },
|
||||
{ 18816, 7500, 3258, 1520, 1145, 448, 74, 5, 1, 1 },
|
||||
{ 18944, 7480, 3224, 1494, 1117, 433, 70, 4, 1, 1 },
|
||||
{ 19072, 7458, 3189, 1468, 1090, 418, 67, 4, 1, 1 },
|
||||
{ 19200, 7435, 3154, 1442, 1063, 404, 64, 4, 1, 1 },
|
||||
{ 19328, 7410, 3119, 1417, 1037, 390, 61, 4, 1, 1 },
|
||||
{ 19456, 7386, 3084, 1392, 1011, 376, 58, 3, 1, 1 },
|
||||
{ 19584, 7361, 3048, 1366, 986, 363, 55, 3, 1, 1 },
|
||||
{ 19712, 7335, 3012, 1341, 960, 350, 53, 3, 1, 1 },
|
||||
{ 19840, 7307, 2977, 1316, 936, 337, 50, 3, 1, 1 },
|
||||
{ 19968, 7279, 2941, 1291, 911, 325, 48, 3, 1, 1 },
|
||||
{ 20096, 7251, 2905, 1267, 887, 313, 45, 2, 1, 1 },
|
||||
{ 20224, 7220, 2868, 1243, 864, 302, 43, 2, 1, 1 },
|
||||
{ 20352, 7189, 2832, 1218, 841, 291, 41, 2, 1, 1 },
|
||||
{ 20480, 7158, 2795, 1194, 818, 280, 39, 2, 1, 1 },
|
||||
{ 20608, 7124, 2759, 1170, 796, 270, 37, 2, 1, 1 },
|
||||
{ 20736, 7091, 2722, 1147, 774, 259, 35, 2, 1, 1 },
|
||||
{ 20864, 7056, 2685, 1123, 752, 250, 34, 2, 1, 1 },
|
||||
{ 20992, 7021, 2648, 1100, 731, 240, 32, 2, 1, 1 },
|
||||
{ 21120, 6985, 2612, 1077, 710, 231, 30, 1, 1, 1 },
|
||||
{ 21248, 6948, 2574, 1054, 690, 222, 29, 1, 1, 1 },
|
||||
{ 21376, 6911, 2537, 1031, 670, 213, 27, 1, 1, 1 },
|
||||
{ 21504, 6872, 2500, 1008, 650, 205, 26, 1, 1, 1 },
|
||||
{ 21632, 6831, 2463, 986, 631, 197, 25, 1, 1, 1 },
|
||||
{ 21760, 6791, 2426, 964, 612, 189, 23, 1, 1, 1 },
|
||||
{ 21888, 6749, 2389, 942, 594, 181, 22, 1, 1, 1 },
|
||||
{ 22016, 6707, 2351, 921, 575, 174, 21, 1, 1, 1 },
|
||||
{ 22144, 6663, 2314, 899, 558, 167, 20, 1, 1, 1 },
|
||||
{ 22272, 6619, 2277, 878, 540, 160, 19, 1, 1, 1 },
|
||||
{ 22400, 6574, 2240, 857, 523, 153, 18, 1, 1, 1 },
|
||||
{ 22528, 6529, 2202, 836, 507, 146, 17, 1, 1, 1 },
|
||||
{ 22656, 6482, 2165, 816, 490, 140, 16, 1, 1, 1 },
|
||||
{ 22784, 6435, 2128, 795, 474, 134, 15, 1, 1, 1 },
|
||||
{ 22912, 6386, 2091, 775, 459, 128, 14, 1, 1, 1 },
|
||||
{ 23040, 6336, 2054, 756, 443, 123, 13, 1, 1, 1 },
|
||||
{ 23168, 6286, 2017, 736, 428, 117, 13, 1, 1, 1 },
|
||||
{ 23296, 6234, 1980, 717, 414, 112, 12, 1, 1, 1 },
|
||||
{ 23424, 6183, 1943, 698, 399, 107, 11, 1, 1, 1 },
|
||||
{ 23552, 6130, 1906, 679, 385, 102, 11, 1, 1, 1 },
|
||||
{ 23680, 6077, 1869, 660, 372, 97, 10, 1, 1, 1 },
|
||||
{ 23808, 6022, 1833, 642, 358, 93, 9, 1, 1, 1 },
|
||||
{ 23936, 5966, 1796, 624, 345, 89, 9, 1, 1, 1 },
|
||||
{ 24064, 5910, 1760, 606, 333, 84, 8, 1, 1, 1 },
|
||||
{ 24192, 5853, 1724, 588, 320, 80, 8, 1, 1, 1 },
|
||||
{ 24320, 5796, 1687, 571, 308, 76, 7, 1, 1, 1 },
|
||||
{ 24448, 5735, 1651, 554, 297, 73, 7, 1, 1, 1 },
|
||||
{ 24576, 5677, 1615, 537, 285, 69, 6, 1, 1, 1 },
|
||||
{ 24704, 5615, 1579, 521, 274, 66, 6, 1, 1, 1 },
|
||||
{ 24832, 5554, 1544, 504, 263, 62, 6, 1, 1, 1 },
|
||||
{ 24960, 5492, 1508, 488, 253, 59, 5, 1, 1, 1 },
|
||||
{ 25088, 5428, 1473, 473, 242, 56, 5, 1, 1, 1 },
|
||||
{ 25216, 5364, 1438, 457, 232, 53, 5, 1, 1, 1 },
|
||||
{ 25344, 5300, 1403, 442, 222, 50, 4, 1, 1, 1 },
|
||||
{ 25472, 5233, 1368, 427, 213, 48, 4, 1, 1, 1 },
|
||||
{ 25600, 5166, 1334, 412, 204, 45, 4, 1, 1, 1 },
|
||||
{ 25728, 5098, 1299, 398, 195, 43, 4, 1, 1, 1 },
|
||||
{ 25856, 5030, 1266, 384, 186, 40, 3, 1, 1, 1 },
|
||||
{ 25984, 4960, 1232, 370, 178, 38, 3, 1, 1, 1 },
|
||||
{ 26112, 4890, 1198, 356, 170, 36, 3, 1, 1, 1 },
|
||||
{ 26240, 4819, 1164, 343, 162, 34, 3, 1, 1, 1 },
|
||||
{ 26368, 4748, 1132, 329, 154, 32, 2, 1, 1, 1 },
|
||||
{ 26496, 4675, 1098, 317, 147, 30, 2, 1, 1, 1 },
|
||||
{ 26624, 4602, 1066, 304, 139, 28, 2, 1, 1, 1 },
|
||||
{ 26752, 4527, 1034, 292, 132, 26, 2, 1, 1, 1 },
|
||||
{ 26880, 4451, 1001, 280, 126, 25, 2, 1, 1, 1 },
|
||||
{ 27008, 4375, 970, 268, 119, 23, 2, 1, 1, 1 },
|
||||
{ 27136, 4299, 938, 256, 113, 21, 2, 1, 1, 1 },
|
||||
{ 27264, 4221, 907, 245, 107, 20, 1, 1, 1, 1 },
|
||||
{ 27392, 4142, 876, 234, 101, 19, 1, 1, 1, 1 },
|
||||
{ 27520, 4063, 846, 223, 95, 17, 1, 1, 1, 1 },
|
||||
{ 27648, 3982, 815, 213, 90, 16, 1, 1, 1, 1 },
|
||||
{ 27776, 3900, 786, 202, 85, 15, 1, 1, 1, 1 },
|
||||
{ 27904, 3818, 756, 192, 80, 14, 1, 1, 1, 1 },
|
||||
{ 28032, 3734, 727, 183, 75, 13, 1, 1, 1, 1 },
|
||||
{ 28160, 3651, 698, 173, 70, 12, 1, 1, 1, 1 },
|
||||
{ 28288, 3566, 669, 164, 66, 11, 1, 1, 1, 1 },
|
||||
{ 28416, 3481, 641, 155, 61, 10, 1, 1, 1, 1 },
|
||||
{ 28544, 3393, 614, 147, 57, 9, 1, 1, 1, 1 },
|
||||
{ 28672, 3306, 586, 138, 53, 9, 1, 1, 1, 1 },
|
||||
{ 28800, 3217, 559, 130, 50, 8, 1, 1, 1, 1 },
|
||||
{ 28928, 3128, 533, 122, 46, 7, 1, 1, 1, 1 },
|
||||
{ 29056, 3037, 507, 114, 43, 7, 1, 1, 1, 1 },
|
||||
{ 29184, 2947, 481, 107, 39, 6, 1, 1, 1, 1 },
|
||||
{ 29312, 2855, 456, 100, 36, 5, 1, 1, 1, 1 },
|
||||
{ 29440, 2762, 431, 93, 33, 5, 1, 1, 1, 1 },
|
||||
{ 29568, 2668, 407, 86, 31, 4, 1, 1, 1, 1 },
|
||||
{ 29696, 2573, 383, 80, 28, 4, 1, 1, 1, 1 },
|
||||
{ 29824, 2478, 359, 74, 25, 4, 1, 1, 1, 1 },
|
||||
{ 29952, 2381, 337, 68, 23, 3, 1, 1, 1, 1 },
|
||||
{ 30080, 2284, 314, 62, 21, 3, 1, 1, 1, 1 },
|
||||
{ 30208, 2185, 293, 57, 19, 2, 1, 1, 1, 1 },
|
||||
{ 30336, 2086, 271, 52, 17, 2, 1, 1, 1, 1 },
|
||||
{ 30464, 1986, 250, 47, 15, 2, 1, 1, 1, 1 },
|
||||
{ 30592, 1885, 230, 42, 13, 2, 1, 1, 1, 1 },
|
||||
{ 30720, 1782, 211, 38, 12, 1, 1, 1, 1, 1 },
|
||||
{ 30848, 1679, 192, 34, 10, 1, 1, 1, 1, 1 },
|
||||
{ 30976, 1575, 173, 30, 9, 1, 1, 1, 1, 1 },
|
||||
{ 31104, 1469, 156, 26, 8, 1, 1, 1, 1, 1 },
|
||||
{ 31232, 1364, 138, 23, 6, 1, 1, 1, 1, 1 },
|
||||
{ 31360, 1257, 122, 19, 5, 1, 1, 1, 1, 1 },
|
||||
{ 31488, 1149, 106, 16, 4, 1, 1, 1, 1, 1 },
|
||||
{ 31616, 1038, 91, 14, 4, 1, 1, 1, 1, 1 },
|
||||
{ 31744, 928, 77, 11, 3, 1, 1, 1, 1, 1 },
|
||||
{ 31872, 816, 64, 9, 2, 1, 1, 1, 1, 1 },
|
||||
{ 32000, 703, 51, 7, 2, 1, 1, 1, 1, 1 },
|
||||
{ 32128, 589, 40, 5, 1, 1, 1, 1, 1, 1 },
|
||||
{ 32256, 473, 29, 4, 1, 1, 1, 1, 1, 1 },
|
||||
{ 32384, 357, 19, 2, 1, 1, 1, 1, 1, 1 },
|
||||
{ 32512, 238, 11, 1, 1, 1, 1, 1, 1, 1 },
|
||||
{ 32640, 117, 4, 1, 1, 1, 1, 1, 1, 1 },
|
||||
};
|
||||
#endif // CONFIG_NEW_TOKENSET
|
||||
|
||||
/* clang-format off */
|
||||
#if CONFIG_Q_ADAPT_PROBS
|
||||
const av1_coeff_probs_model
|
||||
default_qctx_coef_probs[QCTX_BINS][TX_SIZES][PLANE_TYPES] = {
|
||||
{ // Q_Index 0
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
{ // TX_SIZE 0
|
||||
{ // Y plane
|
||||
{ // Intra
|
||||
|
|
@ -1825,7 +1562,7 @@ default_qctx_coef_probs[QCTX_BINS][TX_SIZES][PLANE_TYPES] = {
|
|||
#endif // CONFIG_TX64X64
|
||||
},
|
||||
{ // Q_Index 1
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
{ // TX_SIZE 0
|
||||
{ // Y plane
|
||||
{ // Intra
|
||||
|
|
@ -2491,7 +2228,7 @@ default_qctx_coef_probs[QCTX_BINS][TX_SIZES][PLANE_TYPES] = {
|
|||
#endif // CONFIG_TX64X64
|
||||
},
|
||||
{ // Q_Index 2
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
{ // TX_SIZE 0
|
||||
{ // Y plane
|
||||
{ // Intra
|
||||
|
|
@ -3157,7 +2894,7 @@ default_qctx_coef_probs[QCTX_BINS][TX_SIZES][PLANE_TYPES] = {
|
|||
#endif // CONFIG_TX64X64
|
||||
},
|
||||
{ // Q_Index 3
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
{ // TX_SIZE 0
|
||||
{ // Y plane
|
||||
{ // Intra
|
||||
|
|
@ -3824,7 +3561,6 @@ default_qctx_coef_probs[QCTX_BINS][TX_SIZES][PLANE_TYPES] = {
|
|||
},
|
||||
};
|
||||
#else
|
||||
#if CONFIG_NEW_TOKENSET
|
||||
static const av1_coeff_probs_model default_coef_probs_4x4[PLANE_TYPES] = {
|
||||
{ // Y plane
|
||||
{ // Intra
|
||||
|
|
@ -4249,343 +3985,6 @@ static const av1_coeff_probs_model default_coef_probs_32x32[PLANE_TYPES] = {
|
|||
}
|
||||
}
|
||||
};
|
||||
#else // CONFIG_NEW_TOKENSET
|
||||
static const av1_coeff_probs_model default_coef_probs_4x4[PLANE_TYPES] = {
|
||||
{ // Y plane
|
||||
{ // Intra
|
||||
{ // Band 0
|
||||
{ 195, 29, 183 }, { 84, 49, 136 }, { 8, 42, 71 }
|
||||
}, { // Band 1
|
||||
{ 31, 107, 169 }, { 35, 99, 159 }, { 17, 82, 140 },
|
||||
{ 8, 66, 114 }, { 2, 44, 76 }, { 1, 19, 32 }
|
||||
}, { // Band 2
|
||||
{ 40, 132, 201 }, { 29, 114, 187 }, { 13, 91, 157 },
|
||||
{ 7, 75, 127 }, { 3, 58, 95 }, { 1, 28, 47 }
|
||||
}, { // Band 3
|
||||
{ 69, 142, 221 }, { 42, 122, 201 }, { 15, 91, 159 },
|
||||
{ 6, 67, 121 }, { 1, 42, 77 }, { 1, 17, 31 }
|
||||
}, { // Band 4
|
||||
{ 102, 148, 228 }, { 67, 117, 204 }, { 17, 82, 154 },
|
||||
{ 6, 59, 114 }, { 2, 39, 75 }, { 1, 15, 29 }
|
||||
}, { // Band 5
|
||||
{ 156, 57, 233 }, { 119, 57, 212 }, { 58, 48, 163 },
|
||||
{ 29, 40, 124 }, { 12, 30, 81 }, { 3, 12, 31 }
|
||||
}
|
||||
}, { // Inter
|
||||
{ // Band 0
|
||||
{ 191, 107, 226 }, { 124, 117, 204 }, { 25, 99, 155 }
|
||||
}, { // Band 1
|
||||
{ 29, 148, 210 }, { 37, 126, 194 }, { 8, 93, 157 },
|
||||
{ 2, 68, 118 }, { 1, 39, 69 }, { 1, 17, 33 }
|
||||
}, { // Band 2
|
||||
{ 41, 151, 213 }, { 27, 123, 193 }, { 3, 82, 144 },
|
||||
{ 1, 58, 105 }, { 1, 32, 60 }, { 1, 13, 26 }
|
||||
}, { // Band 3
|
||||
{ 59, 159, 220 }, { 23, 126, 198 }, { 4, 88, 151 },
|
||||
{ 1, 66, 114 }, { 1, 38, 71 }, { 1, 18, 34 }
|
||||
}, { // Band 4
|
||||
{ 114, 136, 232 }, { 51, 114, 207 }, { 11, 83, 155 },
|
||||
{ 3, 56, 105 }, { 1, 33, 65 }, { 1, 17, 34 }
|
||||
}, { // Band 5
|
||||
{ 149, 65, 234 }, { 121, 57, 215 }, { 61, 49, 166 },
|
||||
{ 28, 36, 114 }, { 12, 25, 76 }, { 3, 16, 42 }
|
||||
}
|
||||
}
|
||||
}, { // UV plane
|
||||
{ // Intra
|
||||
{ // Band 0
|
||||
{ 214, 49, 220 }, { 132, 63, 188 }, { 42, 65, 137 }
|
||||
}, { // Band 1
|
||||
{ 85, 137, 221 }, { 104, 131, 216 }, { 49, 111, 192 },
|
||||
{ 21, 87, 155 }, { 2, 49, 87 }, { 1, 16, 28 }
|
||||
}, { // Band 2
|
||||
{ 89, 163, 230 }, { 90, 137, 220 }, { 29, 100, 183 },
|
||||
{ 10, 70, 135 }, { 2, 42, 81 }, { 1, 17, 33 }
|
||||
}, { // Band 3
|
||||
{ 108, 167, 237 }, { 55, 133, 222 }, { 15, 97, 179 },
|
||||
{ 4, 72, 135 }, { 1, 45, 85 }, { 1, 19, 38 }
|
||||
}, { // Band 4
|
||||
{ 124, 146, 240 }, { 66, 124, 224 }, { 17, 88, 175 },
|
||||
{ 4, 58, 122 }, { 1, 36, 75 }, { 1, 18, 37 }
|
||||
}, { // Band 5
|
||||
{ 141, 79, 241 }, { 126, 70, 227 }, { 66, 58, 182 },
|
||||
{ 30, 44, 136 }, { 12, 34, 96 }, { 2, 20, 47 }
|
||||
}
|
||||
}, { // Inter
|
||||
{ // Band 0
|
||||
{ 229, 99, 249 }, { 143, 111, 235 }, { 46, 109, 192 }
|
||||
}, { // Band 1
|
||||
{ 82, 158, 236 }, { 94, 146, 224 }, { 25, 117, 191 },
|
||||
{ 9, 87, 149 }, { 3, 56, 99 }, { 1, 33, 57 }
|
||||
}, { // Band 2
|
||||
{ 83, 167, 237 }, { 68, 145, 222 }, { 10, 103, 177 },
|
||||
{ 2, 72, 131 }, { 1, 41, 79 }, { 1, 20, 39 }
|
||||
}, { // Band 3
|
||||
{ 99, 167, 239 }, { 47, 141, 224 }, { 10, 104, 178 },
|
||||
{ 2, 73, 133 }, { 1, 44, 85 }, { 1, 22, 47 }
|
||||
}, { // Band 4
|
||||
{ 127, 145, 243 }, { 71, 129, 228 }, { 17, 93, 177 },
|
||||
{ 3, 61, 124 }, { 1, 41, 84 }, { 1, 21, 52 }
|
||||
}, { // Band 5
|
||||
{ 157, 78, 244 }, { 140, 72, 231 }, { 69, 58, 184 },
|
||||
{ 31, 44, 137 }, { 14, 38, 105 }, { 8, 23, 61 }
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static const av1_coeff_probs_model default_coef_probs_8x8[PLANE_TYPES] = {
|
||||
{ // Y plane
|
||||
{ // Intra
|
||||
{ // Band 0
|
||||
{ 125, 34, 187 }, { 52, 41, 133 }, { 6, 31, 56 }
|
||||
}, { // Band 1
|
||||
{ 37, 109, 153 }, { 51, 102, 147 }, { 23, 87, 128 },
|
||||
{ 8, 67, 101 }, { 1, 41, 63 }, { 1, 19, 29 }
|
||||
}, { // Band 2
|
||||
{ 31, 154, 185 }, { 17, 127, 175 }, { 6, 96, 145 },
|
||||
{ 2, 73, 114 }, { 1, 51, 82 }, { 1, 28, 45 }
|
||||
}, { // Band 3
|
||||
{ 23, 163, 200 }, { 10, 131, 185 }, { 2, 93, 148 },
|
||||
{ 1, 67, 111 }, { 1, 41, 69 }, { 1, 14, 24 }
|
||||
}, { // Band 4
|
||||
{ 29, 176, 217 }, { 12, 145, 201 }, { 3, 101, 156 },
|
||||
{ 1, 69, 111 }, { 1, 39, 63 }, { 1, 14, 23 }
|
||||
}, { // Band 5
|
||||
{ 57, 192, 233 }, { 25, 154, 215 }, { 6, 109, 167 },
|
||||
{ 3, 78, 118 }, { 1, 48, 69 }, { 1, 21, 29 }
|
||||
}
|
||||
}, { // Inter
|
||||
{ // Band 0
|
||||
{ 202, 105, 245 }, { 108, 106, 216 }, { 18, 90, 144 }
|
||||
}, { // Band 1
|
||||
{ 33, 172, 219 }, { 64, 149, 206 }, { 14, 117, 177 },
|
||||
{ 5, 90, 141 }, { 2, 61, 95 }, { 1, 37, 57 }
|
||||
}, { // Band 2
|
||||
{ 33, 179, 220 }, { 11, 140, 198 }, { 1, 89, 148 },
|
||||
{ 1, 60, 104 }, { 1, 33, 57 }, { 1, 12, 21 }
|
||||
}, { // Band 3
|
||||
{ 30, 181, 221 }, { 8, 141, 198 }, { 1, 87, 145 },
|
||||
{ 1, 58, 100 }, { 1, 31, 55 }, { 1, 12, 20 }
|
||||
}, { // Band 4
|
||||
{ 32, 186, 224 }, { 7, 142, 198 }, { 1, 86, 143 },
|
||||
{ 1, 58, 100 }, { 1, 31, 55 }, { 1, 12, 22 }
|
||||
}, { // Band 5
|
||||
{ 57, 192, 227 }, { 20, 143, 204 }, { 3, 96, 154 },
|
||||
{ 1, 68, 112 }, { 1, 42, 69 }, { 1, 19, 32 }
|
||||
}
|
||||
}
|
||||
}, { // UV plane
|
||||
{ // Intra
|
||||
{ // Band 0
|
||||
{ 212, 35, 215 }, { 113, 47, 169 }, { 29, 48, 105 }
|
||||
}, { // Band 1
|
||||
{ 74, 129, 203 }, { 106, 120, 203 }, { 49, 107, 178 },
|
||||
{ 19, 84, 144 }, { 4, 50, 84 }, { 1, 15, 25 }
|
||||
}, { // Band 2
|
||||
{ 71, 172, 217 }, { 44, 141, 209 }, { 15, 102, 173 },
|
||||
{ 6, 76, 133 }, { 2, 51, 89 }, { 1, 24, 42 }
|
||||
}, { // Band 3
|
||||
{ 64, 185, 231 }, { 31, 148, 216 }, { 8, 103, 175 },
|
||||
{ 3, 74, 131 }, { 1, 46, 81 }, { 1, 18, 30 }
|
||||
}, { // Band 4
|
||||
{ 65, 196, 235 }, { 25, 157, 221 }, { 5, 105, 174 },
|
||||
{ 1, 67, 120 }, { 1, 38, 69 }, { 1, 15, 30 }
|
||||
}, { // Band 5
|
||||
{ 65, 204, 238 }, { 30, 156, 224 }, { 7, 107, 177 },
|
||||
{ 2, 70, 124 }, { 1, 42, 73 }, { 1, 18, 34 }
|
||||
}
|
||||
}, { // Inter
|
||||
{ // Band 0
|
||||
{ 225, 86, 251 }, { 144, 104, 235 }, { 42, 99, 181 }
|
||||
}, { // Band 1
|
||||
{ 85, 175, 239 }, { 112, 165, 229 }, { 29, 136, 200 },
|
||||
{ 12, 103, 162 }, { 6, 77, 123 }, { 2, 53, 84 }
|
||||
}, { // Band 2
|
||||
{ 75, 183, 239 }, { 30, 155, 221 }, { 3, 106, 171 },
|
||||
{ 1, 74, 128 }, { 1, 44, 76 }, { 1, 17, 28 }
|
||||
}, { // Band 3
|
||||
{ 73, 185, 240 }, { 27, 159, 222 }, { 2, 107, 172 },
|
||||
{ 1, 75, 127 }, { 1, 42, 73 }, { 1, 17, 29 }
|
||||
}, { // Band 4
|
||||
{ 62, 190, 238 }, { 21, 159, 222 }, { 2, 107, 172 },
|
||||
{ 1, 72, 122 }, { 1, 40, 71 }, { 1, 18, 32 }
|
||||
}, { // Band 5
|
||||
{ 61, 199, 240 }, { 27, 161, 226 }, { 4, 113, 180 },
|
||||
{ 1, 76, 129 }, { 1, 46, 80 }, { 1, 23, 41 }
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static const av1_coeff_probs_model default_coef_probs_16x16[PLANE_TYPES] = {
|
||||
{ // Y plane
|
||||
{ // Intra
|
||||
{ // Band 0
|
||||
{ 7, 27, 153 }, { 5, 30, 95 }, { 1, 16, 30 }
|
||||
}, { // Band 1
|
||||
{ 50, 75, 127 }, { 57, 75, 124 }, { 27, 67, 108 },
|
||||
{ 10, 54, 86 }, { 1, 33, 52 }, { 1, 12, 18 }
|
||||
}, { // Band 2
|
||||
{ 43, 125, 151 }, { 26, 108, 148 }, { 7, 83, 122 },
|
||||
{ 2, 59, 89 }, { 1, 38, 60 }, { 1, 17, 27 }
|
||||
}, { // Band 3
|
||||
{ 23, 144, 163 }, { 13, 112, 154 }, { 2, 75, 117 },
|
||||
{ 1, 50, 81 }, { 1, 31, 51 }, { 1, 14, 23 }
|
||||
}, { // Band 4
|
||||
{ 18, 162, 185 }, { 6, 123, 171 }, { 1, 78, 125 },
|
||||
{ 1, 51, 86 }, { 1, 31, 54 }, { 1, 14, 23 }
|
||||
}, { // Band 5
|
||||
{ 15, 199, 227 }, { 3, 150, 204 }, { 1, 91, 146 },
|
||||
{ 1, 55, 95 }, { 1, 30, 53 }, { 1, 11, 20 }
|
||||
}
|
||||
}, { // Inter
|
||||
{ // Band 0
|
||||
{ 19, 55, 240 }, { 19, 59, 196 }, { 3, 52, 105 }
|
||||
}, { // Band 1
|
||||
{ 41, 166, 207 }, { 104, 153, 199 }, { 31, 123, 181 },
|
||||
{ 14, 101, 152 }, { 5, 72, 106 }, { 1, 36, 52 }
|
||||
}, { // Band 2
|
||||
{ 35, 176, 211 }, { 12, 131, 190 }, { 2, 88, 144 },
|
||||
{ 1, 60, 101 }, { 1, 36, 60 }, { 1, 16, 28 }
|
||||
}, { // Band 3
|
||||
{ 28, 183, 213 }, { 8, 134, 191 }, { 1, 86, 142 },
|
||||
{ 1, 56, 96 }, { 1, 30, 53 }, { 1, 12, 20 }
|
||||
}, { // Band 4
|
||||
{ 20, 190, 215 }, { 4, 135, 192 }, { 1, 84, 139 },
|
||||
{ 1, 53, 91 }, { 1, 28, 49 }, { 1, 11, 20 }
|
||||
}, { // Band 5
|
||||
{ 13, 196, 216 }, { 2, 137, 192 }, { 1, 86, 143 },
|
||||
{ 1, 57, 99 }, { 1, 32, 56 }, { 1, 13, 24 }
|
||||
}
|
||||
}
|
||||
}, { // UV plane
|
||||
{ // Intra
|
||||
{ // Band 0
|
||||
{ 211, 29, 217 }, { 96, 47, 156 }, { 22, 43, 87 }
|
||||
}, { // Band 1
|
||||
{ 78, 120, 193 }, { 111, 116, 186 }, { 46, 102, 164 },
|
||||
{ 15, 80, 128 }, { 2, 49, 76 }, { 1, 18, 28 }
|
||||
}, { // Band 2
|
||||
{ 71, 161, 203 }, { 42, 132, 192 }, { 10, 98, 150 },
|
||||
{ 3, 69, 109 }, { 1, 44, 70 }, { 1, 18, 29 }
|
||||
}, { // Band 3
|
||||
{ 57, 186, 211 }, { 30, 140, 196 }, { 4, 93, 146 },
|
||||
{ 1, 62, 102 }, { 1, 38, 65 }, { 1, 16, 27 }
|
||||
}, { // Band 4
|
||||
{ 47, 199, 217 }, { 14, 145, 196 }, { 1, 88, 142 },
|
||||
{ 1, 57, 98 }, { 1, 36, 62 }, { 1, 15, 26 }
|
||||
}, { // Band 5
|
||||
{ 26, 219, 229 }, { 5, 155, 207 }, { 1, 94, 151 },
|
||||
{ 1, 60, 104 }, { 1, 36, 62 }, { 1, 16, 28 }
|
||||
}
|
||||
}, { // Inter
|
||||
{ // Band 0
|
||||
{ 233, 29, 248 }, { 146, 47, 220 }, { 43, 52, 140 }
|
||||
}, { // Band 1
|
||||
{ 100, 163, 232 }, { 179, 161, 222 }, { 63, 142, 204 },
|
||||
{ 37, 113, 174 }, { 26, 89, 137 }, { 18, 68, 97 }
|
||||
}, { // Band 2
|
||||
{ 85, 181, 230 }, { 32, 146, 209 }, { 7, 100, 164 },
|
||||
{ 3, 71, 121 }, { 1, 45, 77 }, { 1, 18, 30 }
|
||||
}, { // Band 3
|
||||
{ 65, 187, 230 }, { 20, 148, 207 }, { 2, 97, 159 },
|
||||
{ 1, 68, 116 }, { 1, 40, 70 }, { 1, 14, 29 }
|
||||
}, { // Band 4
|
||||
{ 40, 194, 227 }, { 8, 147, 204 }, { 1, 94, 155 },
|
||||
{ 1, 65, 112 }, { 1, 39, 66 }, { 1, 14, 26 }
|
||||
}, { // Band 5
|
||||
{ 16, 208, 228 }, { 3, 151, 207 }, { 1, 98, 160 },
|
||||
{ 1, 67, 117 }, { 1, 41, 74 }, { 1, 17, 31 }
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static const av1_coeff_probs_model default_coef_probs_32x32[PLANE_TYPES] = {
|
||||
{ // Y plane
|
||||
{ // Intra
|
||||
{ // Band 0
|
||||
{ 17, 38, 140 }, { 7, 34, 80 }, { 1, 17, 29 }
|
||||
}, { // Band 1
|
||||
{ 37, 75, 128 }, { 41, 76, 128 }, { 26, 66, 116 },
|
||||
{ 12, 52, 94 }, { 2, 32, 55 }, { 1, 10, 16 }
|
||||
}, { // Band 2
|
||||
{ 50, 127, 154 }, { 37, 109, 152 }, { 16, 82, 121 },
|
||||
{ 5, 59, 85 }, { 1, 35, 54 }, { 1, 13, 20 }
|
||||
}, { // Band 3
|
||||
{ 40, 142, 167 }, { 17, 110, 157 }, { 2, 71, 112 },
|
||||
{ 1, 44, 72 }, { 1, 27, 45 }, { 1, 11, 17 }
|
||||
}, { // Band 4
|
||||
{ 30, 175, 188 }, { 9, 124, 169 }, { 1, 74, 116 },
|
||||
{ 1, 48, 78 }, { 1, 30, 49 }, { 1, 11, 18 }
|
||||
}, { // Band 5
|
||||
{ 10, 222, 223 }, { 2, 150, 194 }, { 1, 83, 128 },
|
||||
{ 1, 48, 79 }, { 1, 27, 45 }, { 1, 11, 17 }
|
||||
}
|
||||
}, { // Inter
|
||||
{ // Band 0
|
||||
{ 36, 41, 235 }, { 29, 36, 193 }, { 10, 27, 111 }
|
||||
}, { // Band 1
|
||||
{ 85, 165, 222 }, { 177, 162, 215 }, { 110, 135, 195 },
|
||||
{ 57, 113, 168 }, { 23, 83, 120 }, { 10, 49, 61 }
|
||||
}, { // Band 2
|
||||
{ 85, 190, 223 }, { 36, 139, 200 }, { 5, 90, 146 },
|
||||
{ 1, 60, 103 }, { 1, 38, 65 }, { 1, 18, 30 }
|
||||
}, { // Band 3
|
||||
{ 72, 202, 223 }, { 23, 141, 199 }, { 2, 86, 140 },
|
||||
{ 1, 56, 97 }, { 1, 36, 61 }, { 1, 16, 27 }
|
||||
}, { // Band 4
|
||||
{ 55, 218, 225 }, { 13, 145, 200 }, { 1, 86, 141 },
|
||||
{ 1, 57, 99 }, { 1, 35, 61 }, { 1, 13, 22 }
|
||||
}, { // Band 5
|
||||
{ 15, 235, 212 }, { 1, 132, 184 }, { 1, 84, 139 },
|
||||
{ 1, 57, 97 }, { 1, 34, 56 }, { 1, 14, 23 }
|
||||
}
|
||||
}
|
||||
}, { // UV plane
|
||||
{ // Intra
|
||||
{ // Band 0
|
||||
{ 181, 21, 201 }, { 61, 37, 123 }, { 10, 38, 71 }
|
||||
}, { // Band 1
|
||||
{ 47, 106, 172 }, { 95, 104, 173 }, { 42, 93, 159 },
|
||||
{ 18, 77, 131 }, { 4, 50, 81 }, { 1, 17, 23 }
|
||||
}, { // Band 2
|
||||
{ 62, 147, 199 }, { 44, 130, 189 }, { 28, 102, 154 },
|
||||
{ 18, 75, 115 }, { 2, 44, 65 }, { 1, 12, 19 }
|
||||
}, { // Band 3
|
||||
{ 55, 153, 210 }, { 24, 130, 194 }, { 3, 93, 146 },
|
||||
{ 1, 61, 97 }, { 1, 31, 50 }, { 1, 10, 16 }
|
||||
}, { // Band 4
|
||||
{ 49, 186, 223 }, { 17, 148, 204 }, { 1, 96, 142 },
|
||||
{ 1, 53, 83 }, { 1, 26, 44 }, { 1, 11, 17 }
|
||||
}, { // Band 5
|
||||
{ 13, 217, 212 }, { 2, 136, 180 }, { 1, 78, 124 },
|
||||
{ 1, 50, 83 }, { 1, 29, 49 }, { 1, 14, 23 }
|
||||
}
|
||||
}, { // Inter
|
||||
{ // Band 0
|
||||
{ 197, 13, 247 }, { 82, 17, 222 }, { 25, 17, 162 }
|
||||
}, { // Band 1
|
||||
{ 126, 186, 247 }, { 234, 191, 243 }, { 176, 177, 234 },
|
||||
{ 104, 158, 220 }, { 66, 128, 186 }, { 55, 90, 137 }
|
||||
}, { // Band 2
|
||||
{ 111, 197, 242 }, { 46, 158, 219 }, { 9, 104, 171 },
|
||||
{ 2, 65, 125 }, { 1, 44, 80 }, { 1, 17, 91 }
|
||||
}, { // Band 3
|
||||
{ 104, 208, 245 }, { 39, 168, 224 }, { 3, 109, 162 },
|
||||
{ 1, 79, 124 }, { 1, 50, 102 }, { 1, 43, 102 }
|
||||
}, { // Band 4
|
||||
{ 84, 220, 246 }, { 31, 177, 231 }, { 2, 115, 180 },
|
||||
{ 1, 79, 134 }, { 1, 55, 77 }, { 1, 60, 79 }
|
||||
}, { // Band 5
|
||||
{ 43, 243, 240 }, { 8, 180, 217 }, { 1, 115, 166 },
|
||||
{ 1, 84, 121 }, { 1, 51, 67 }, { 1, 16, 6 }
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
#endif // CONFIG_NEW_TOKENSET
|
||||
|
||||
#if CONFIG_TX64X64
|
||||
// FIXME. Optimize for EC_MULTISYMBOL
|
||||
|
|
@ -4674,9 +4073,20 @@ static const av1_coeff_probs_model default_coef_probs_64x64[PLANE_TYPES] = {
|
|||
};
|
||||
#endif // CONFIG_TX64X64
|
||||
#endif // CONFIG_Q_ADAPT_PROBS
|
||||
#if CONFIG_NEW_TOKENSET
|
||||
static const aom_prob av1_default_blockzero_probs[TX_SIZES][PLANE_TYPES]
|
||||
[REF_TYPES][BLOCKZ_CONTEXTS] = {
|
||||
#if CONFIG_CHROMA_2X2
|
||||
{ // TX_2x2
|
||||
{ // Y plane
|
||||
{ 195, 84, 8, }, // Intra
|
||||
{ 191, 124, 25, }, // Inter
|
||||
},
|
||||
{ // UV plane
|
||||
{ 214, 132, 42, }, // Intra
|
||||
{ 229, 143, 46, }, // Inter
|
||||
},
|
||||
},
|
||||
#endif
|
||||
{ // TX_4x4
|
||||
{ // Y plane
|
||||
{ 195, 84, 8, }, // Intra
|
||||
|
|
@ -5915,7 +5325,6 @@ static const coeff_cdf_model default_coef_head_cdf_32x32[PLANE_TYPES] = {
|
|||
{AOM_ICDF(3009), AOM_ICDF(3246), AOM_ICDF(10158), AOM_ICDF(10533),
|
||||
AOM_ICDF(32768) } } } }
|
||||
};
|
||||
#endif // CONFIG_NEW_TOKENSET
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
|
|
@ -5930,8 +5339,6 @@ void av1_model_to_full_probs(const aom_prob *model, aom_prob *full) {
|
|||
extend_to_full_distribution(&full[UNCONSTRAINED_NODES], model[PIVOT_NODE]);
|
||||
}
|
||||
|
||||
#if CONFIG_NEW_TOKENSET
|
||||
|
||||
static void build_tail_cdfs(aom_cdf_prob cdf_tail[CDF_SIZE(ENTROPY_TOKENS)],
|
||||
aom_cdf_prob cdf_head[CDF_SIZE(ENTROPY_TOKENS)],
|
||||
int band_zero) {
|
||||
|
|
@ -6041,7 +5448,7 @@ static void av1_default_coef_cdfs(FRAME_CONTEXT *fc) {
|
|||
for (j = 0; j < REF_TYPES; ++j)
|
||||
for (k = 0; k < COEF_BANDS; ++k)
|
||||
for (l = 0; l < BAND_COEFF_CONTEXTS(k); ++l) {
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
av1_copy(fc->coef_head_cdfs[TX_2X2][i][j][k][l],
|
||||
default_coef_head_cdf_4x4[i][j][k][l]);
|
||||
#endif
|
||||
|
|
@ -6074,19 +5481,6 @@ void av1_coef_head_cdfs(FRAME_CONTEXT *fc) {
|
|||
}
|
||||
}
|
||||
|
||||
#elif CONFIG_EC_MULTISYMBOL
|
||||
static void build_token_cdfs(const aom_prob *pdf_model,
|
||||
aom_cdf_prob cdf[ENTROPY_TOKENS + 1]) {
|
||||
int i, sum = 0;
|
||||
assert(pdf_model[2] != 0);
|
||||
for (i = 0; i < ENTROPY_TOKENS - 2; ++i) {
|
||||
sum += av1_pareto8_token_probs[pdf_model[2] - 1][i];
|
||||
cdf[i] = AOM_ICDF(sum);
|
||||
}
|
||||
}
|
||||
#endif // CONFIG_NEW_TOKENSET
|
||||
|
||||
#if CONFIG_EC_MULTISYMBOL
|
||||
void av1_coef_pareto_cdfs(FRAME_CONTEXT *fc) {
|
||||
/* Build the tail based on a Pareto distribution */
|
||||
TX_SIZE t;
|
||||
|
|
@ -6096,15 +5490,9 @@ void av1_coef_pareto_cdfs(FRAME_CONTEXT *fc) {
|
|||
for (j = 0; j < REF_TYPES; ++j)
|
||||
for (k = 0; k < COEF_BANDS; ++k)
|
||||
for (l = 0; l < BAND_COEFF_CONTEXTS(k); ++l)
|
||||
#if CONFIG_NEW_TOKENSET
|
||||
build_tail_cdfs(fc->coef_tail_cdfs[t][i][j][k][l],
|
||||
fc->coef_head_cdfs[t][i][j][k][l], k == 0);
|
||||
#else
|
||||
build_token_cdfs(fc->coef_probs[t][i][j][k][l],
|
||||
fc->coef_cdfs[t][i][j][k][l]);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void av1_default_coef_probs(AV1_COMMON *cm) {
|
||||
#if CONFIG_Q_ADAPT_PROBS
|
||||
|
|
@ -6112,7 +5500,7 @@ void av1_default_coef_probs(AV1_COMMON *cm) {
|
|||
ROUND_POWER_OF_TWO(cm->base_qindex, 8 - QCTX_BIN_BITS), QCTX_BINS - 1);
|
||||
av1_copy(cm->fc->coef_probs, default_qctx_coef_probs[index]);
|
||||
#else
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
av1_copy(cm->fc->coef_probs[TX_2X2], default_coef_probs_4x4);
|
||||
#endif
|
||||
av1_copy(cm->fc->coef_probs[TX_4X4], default_coef_probs_4x4);
|
||||
|
|
@ -6123,44 +5511,29 @@ void av1_default_coef_probs(AV1_COMMON *cm) {
|
|||
av1_copy(cm->fc->coef_probs[TX_64X64], default_coef_probs_64x64);
|
||||
#endif // CONFIG_TX64X64
|
||||
#endif // CONFIG_Q_ADAPT_PROBS
|
||||
#if CONFIG_NEW_TOKENSET
|
||||
av1_copy(cm->fc->blockzero_probs, av1_default_blockzero_probs);
|
||||
#endif
|
||||
#if CONFIG_NEW_TOKENSET
|
||||
/* Load the head tokens */
|
||||
av1_default_coef_cdfs(cm->fc);
|
||||
#endif
|
||||
#if CONFIG_EC_MULTISYMBOL
|
||||
av1_coef_pareto_cdfs(cm->fc);
|
||||
#endif // CONFIG_EC_MULTISYMBOL
|
||||
}
|
||||
|
||||
#if !CONFIG_LV_MAP
|
||||
static void adapt_coef_probs(AV1_COMMON *cm, TX_SIZE tx_size,
|
||||
unsigned int count_sat,
|
||||
unsigned int update_factor) {
|
||||
const FRAME_CONTEXT *pre_fc = &cm->frame_contexts[cm->frame_context_idx];
|
||||
const FRAME_CONTEXT *pre_fc = cm->pre_fc;
|
||||
av1_coeff_probs_model *const probs = cm->fc->coef_probs[tx_size];
|
||||
#if CONFIG_SUBFRAME_PROB_UPDATE
|
||||
const av1_coeff_probs_model *const pre_probs =
|
||||
cm->partial_prob_update
|
||||
? (const av1_coeff_probs_model *)cm->starting_coef_probs[tx_size]
|
||||
: pre_fc->coef_probs[tx_size];
|
||||
#else
|
||||
const av1_coeff_probs_model *const pre_probs = pre_fc->coef_probs[tx_size];
|
||||
#endif // CONFIG_SUBFRAME_PROB_UPDATE
|
||||
const av1_coeff_count_model *const counts =
|
||||
(const av1_coeff_count_model *)cm->counts.coef[tx_size];
|
||||
const unsigned int(*eob_counts)[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS] =
|
||||
(const unsigned int(*)[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS])
|
||||
cm->counts.eob_branch[tx_size];
|
||||
#if CONFIG_NEW_TOKENSET
|
||||
const av1_blockz_probs_model *const pre_blockz_probs =
|
||||
pre_fc->blockzero_probs[tx_size];
|
||||
av1_blockz_probs_model *const blockz_probs = cm->fc->blockzero_probs[tx_size];
|
||||
const av1_blockz_count_model *const blockz_counts =
|
||||
(const av1_blockz_count_model *)&cm->counts.blockz_count[tx_size][0];
|
||||
#endif
|
||||
int i, j, k, l, m;
|
||||
#if CONFIG_RECT_TX
|
||||
assert(!is_rect_tx(tx_size));
|
||||
|
|
@ -6183,7 +5556,6 @@ static void adapt_coef_probs(AV1_COMMON *cm, TX_SIZE tx_size,
|
|||
count_sat, update_factor);
|
||||
}
|
||||
|
||||
#if CONFIG_NEW_TOKENSET
|
||||
for (i = 0; i < PLANE_TYPES; ++i) {
|
||||
for (j = 0; j < REF_TYPES; ++j) {
|
||||
for (k = 0; k < BLOCKZ_CONTEXTS; ++k) {
|
||||
|
|
@ -6195,7 +5567,6 @@ static void adapt_coef_probs(AV1_COMMON *cm, TX_SIZE tx_size,
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif // !CONFIG_LV_MAP
|
||||
|
||||
|
|
@ -6209,9 +5580,6 @@ void av1_adapt_coef_probs(AV1_COMMON *cm) {
|
|||
update_factor = COEF_MAX_UPDATE_FACTOR;
|
||||
count_sat = COEF_COUNT_SAT;
|
||||
}
|
||||
#if CONFIG_SUBFRAME_PROB_UPDATE
|
||||
if (cm->partial_prob_update == 1) update_factor = COEF_MAX_UPDATE_FACTOR;
|
||||
#endif // CONFIG_SUBFRAME_PROB_UPDATE
|
||||
|
||||
#if CONFIG_LV_MAP
|
||||
av1_adapt_txb_probs(cm, count_sat, update_factor);
|
||||
|
|
@ -6222,18 +5590,6 @@ void av1_adapt_coef_probs(AV1_COMMON *cm) {
|
|||
#endif
|
||||
}
|
||||
|
||||
#if CONFIG_SUBFRAME_PROB_UPDATE
|
||||
void av1_partial_adapt_probs(AV1_COMMON *cm, int mi_row, int mi_col) {
|
||||
(void)mi_row;
|
||||
(void)mi_col;
|
||||
|
||||
if (cm->refresh_frame_context == REFRESH_FRAME_CONTEXT_BACKWARD) {
|
||||
cm->partial_prob_update = 1;
|
||||
av1_adapt_coef_probs(cm);
|
||||
}
|
||||
}
|
||||
#endif // CONFIG_SUBFRAME_PROB_UPDATE
|
||||
|
||||
#if CONFIG_EC_ADAPT
|
||||
static void av1_average_cdf(aom_cdf_prob *cdf_ptr[], aom_cdf_prob *fc_cdf_ptr,
|
||||
int cdf_size, const int num_tiles) {
|
||||
|
|
@ -6263,26 +5619,21 @@ static void av1_average_cdf(aom_cdf_prob *cdf_ptr[], aom_cdf_prob *fc_cdf_ptr,
|
|||
av1_average_cdf(cdf_ptr, fc_cdf_ptr, cdf_size, num_tiles);
|
||||
|
||||
void av1_average_tile_coef_cdfs(FRAME_CONTEXT *fc, FRAME_CONTEXT *ec_ctxs[],
|
||||
aom_cdf_prob *cdf_ptr[], const int num_tiles) {
|
||||
aom_cdf_prob *cdf_ptr[], int num_tiles) {
|
||||
int i, cdf_size;
|
||||
|
||||
aom_cdf_prob *fc_cdf_ptr;
|
||||
|
||||
#if CONFIG_NEW_TOKENSET
|
||||
AVERAGE_TILE_CDFS(coef_head_cdfs)
|
||||
AVERAGE_TILE_CDFS(coef_tail_cdfs)
|
||||
#else
|
||||
AVERAGE_TILE_CDFS(coef_cdfs)
|
||||
#endif
|
||||
}
|
||||
|
||||
void av1_average_tile_mv_cdfs(FRAME_CONTEXT *fc, FRAME_CONTEXT *ec_ctxs[],
|
||||
aom_cdf_prob *cdf_ptr[], const int num_tiles) {
|
||||
aom_cdf_prob *cdf_ptr[], int num_tiles) {
|
||||
int i, k, cdf_size;
|
||||
|
||||
aom_cdf_prob *fc_cdf_ptr;
|
||||
|
||||
#if CONFIG_REF_MV
|
||||
int j;
|
||||
for (j = 0; j < NMV_CONTEXTS; ++j) {
|
||||
AVERAGE_TILE_CDFS(nmvc[j].joint_cdf)
|
||||
|
|
@ -6293,19 +5644,10 @@ void av1_average_tile_mv_cdfs(FRAME_CONTEXT *fc, FRAME_CONTEXT *ec_ctxs[],
|
|||
AVERAGE_TILE_CDFS(nmvc[j].comps[k].fp_cdf);
|
||||
}
|
||||
}
|
||||
#else
|
||||
AVERAGE_TILE_CDFS(nmvc.joint_cdf)
|
||||
|
||||
for (k = 0; k < 2; ++k) {
|
||||
AVERAGE_TILE_CDFS(nmvc.comps[k].class_cdf)
|
||||
AVERAGE_TILE_CDFS(nmvc.comps[k].class0_fp_cdf)
|
||||
AVERAGE_TILE_CDFS(nmvc.comps[k].fp_cdf)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void av1_average_tile_intra_cdfs(FRAME_CONTEXT *fc, FRAME_CONTEXT *ec_ctxs[],
|
||||
aom_cdf_prob *cdf_ptr[], const int num_tiles) {
|
||||
aom_cdf_prob *cdf_ptr[], int num_tiles) {
|
||||
int i, cdf_size;
|
||||
|
||||
aom_cdf_prob *fc_cdf_ptr;
|
||||
|
|
@ -6335,28 +5677,22 @@ void av1_average_tile_intra_cdfs(FRAME_CONTEXT *fc, FRAME_CONTEXT *ec_ctxs[],
|
|||
#if CONFIG_EXT_INTRA && CONFIG_INTRA_INTERP
|
||||
AVERAGE_TILE_CDFS(intra_filter_cdf)
|
||||
#endif // CONFIG_EXT_INTRA && CONFIG_INTRA_INTERP
|
||||
#if CONFIG_FILTER_INTRA
|
||||
#endif // CONFIG_FILTER_INTRA
|
||||
}
|
||||
|
||||
void av1_average_tile_inter_cdfs(AV1_COMMON *cm, FRAME_CONTEXT *fc,
|
||||
FRAME_CONTEXT *ec_ctxs[],
|
||||
aom_cdf_prob *cdf_ptr[], const int num_tiles) {
|
||||
aom_cdf_prob *cdf_ptr[], int num_tiles) {
|
||||
int i, cdf_size;
|
||||
|
||||
aom_cdf_prob *fc_cdf_ptr;
|
||||
|
||||
// FIXME: comp_inter_cdf not defined
|
||||
// FIXME: comp_inter_cdf not defined
|
||||
|
||||
// FIXME: comp_ref_cdf and comp_bwd_ref not defined
|
||||
// FIXME: comp_ref_cdf and comp_bwd_ref not defined
|
||||
|
||||
// FIXME: single_ref_cdf not defined
|
||||
// FIXME: single_ref_cdf not defined
|
||||
|
||||
#if CONFIG_REF_MV
|
||||
// FIXME: cdfs not defined for newmv_mode, zeromv_mode, drl_mode, new2mv_mode
|
||||
#else
|
||||
AVERAGE_TILE_CDFS(inter_mode_cdf)
|
||||
#endif
|
||||
// FIXME: cdfs not defined for newmv_mode, zeromv_mode, drl_mode, new2mv_mode
|
||||
|
||||
// FIXME: cdfs not defined for motion_mode_prob, obmc_prob
|
||||
|
||||
|
|
|
|||
74
third_party/aom/av1/common/entropy.h
vendored
74
third_party/aom/av1/common/entropy.h
vendored
|
|
@ -32,10 +32,6 @@ extern "C" {
|
|||
#define QCTX_BINS (1 << QCTX_BIN_BITS)
|
||||
#endif // CONFIG_Q_ADAPT_PROBS
|
||||
|
||||
#if CONFIG_SUBFRAME_PROB_UPDATE
|
||||
#define COEF_PROBS_BUFS 16
|
||||
#endif // CONFIG_SUBFRAME_PROB_UPDATE
|
||||
|
||||
// Coefficient token alphabet
|
||||
#define ZERO_TOKEN 0 // 0 Extra Bits 0+0
|
||||
#define ONE_TOKEN 1 // 1 Extra Bits 0+1
|
||||
|
|
@ -49,18 +45,16 @@ extern "C" {
|
|||
#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
|
||||
#if CONFIG_NEW_TOKENSET
|
||||
#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 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
|
||||
#endif
|
||||
#define ENTROPY_TOKENS 12
|
||||
|
||||
#define ENTROPY_NODES 11
|
||||
|
|
@ -131,7 +125,7 @@ static INLINE int av1_get_cat6_extrabits_size(TX_SIZE tx_size,
|
|||
// TODO(debargha): Does TX_64X64 require an additional extrabit?
|
||||
if (tx_size > TX_32X32) tx_size = TX_32X32;
|
||||
#endif
|
||||
#if CONFIG_CB4X4
|
||||
#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);
|
||||
|
|
@ -175,9 +169,7 @@ static INLINE int av1_get_cat6_extrabits_size(TX_SIZE tx_size,
|
|||
distinct bands). */
|
||||
|
||||
#define COEFF_CONTEXTS 6
|
||||
#if CONFIG_EC_MULTISYMBOL
|
||||
#define BLOCKZ_CONTEXTS 3
|
||||
#endif
|
||||
#define COEFF_CONTEXTS0 3 // for band 0
|
||||
#define BAND_COEFF_CONTEXTS(band) \
|
||||
((band) == 0 ? COEFF_CONTEXTS0 : COEFF_CONTEXTS)
|
||||
|
|
@ -199,9 +191,6 @@ void av1_adapt_coef_probs(struct AV1Common *cm);
|
|||
#if CONFIG_EC_ADAPT
|
||||
void av1_adapt_coef_cdfs(struct AV1Common *cm, struct frame_contexts *pre_fc);
|
||||
#endif
|
||||
#if CONFIG_SUBFRAME_PROB_UPDATE
|
||||
void av1_partial_adapt_probs(struct AV1Common *cm, int mi_row, int mi_col);
|
||||
#endif // CONFIG_SUBFRAME_PROB_UPDATE
|
||||
|
||||
// This is the index in the scan order beyond which all coefficients for
|
||||
// 8x8 transform and above are in the top band.
|
||||
|
|
@ -250,7 +239,6 @@ typedef unsigned int av1_coeff_count_model[REF_TYPES][COEF_BANDS]
|
|||
|
||||
void av1_model_to_full_probs(const aom_prob *model, aom_prob *full);
|
||||
|
||||
#if CONFIG_EC_MULTISYMBOL
|
||||
typedef aom_cdf_prob coeff_cdf_model[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS]
|
||||
[CDF_SIZE(ENTROPY_TOKENS)];
|
||||
typedef aom_prob av1_blockz_probs_model[REF_TYPES][BLOCKZ_CONTEXTS];
|
||||
|
|
@ -260,11 +248,9 @@ extern const aom_cdf_prob av1_pareto8_token_probs[COEFF_PROB_MODELS]
|
|||
extern const aom_cdf_prob av1_pareto8_tail_probs[COEFF_PROB_MODELS]
|
||||
[ENTROPY_TOKENS - 3];
|
||||
struct frame_contexts;
|
||||
#if CONFIG_NEW_TOKENSET
|
||||
|
||||
void av1_coef_head_cdfs(struct frame_contexts *fc);
|
||||
#endif
|
||||
void av1_coef_pareto_cdfs(struct frame_contexts *fc);
|
||||
#endif // CONFIG_EC_MULTISYMBOL
|
||||
|
||||
typedef char ENTROPY_CONTEXT;
|
||||
|
||||
|
|
@ -277,7 +263,7 @@ 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_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
switch (tx_size) {
|
||||
case TX_2X2:
|
||||
above_ec = a[0] != 0;
|
||||
|
|
@ -323,10 +309,36 @@ 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 | *(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;
|
||||
#endif // CONFIG_TX64X64
|
||||
#if CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT
|
||||
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 // CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT
|
||||
default: assert(0 && "Invalid transform size."); break;
|
||||
}
|
||||
return combine_entropy_contexts(above_ec, left_ec);
|
||||
#endif
|
||||
#endif // CONFIG_CHROMA_2X2
|
||||
|
||||
switch (tx_size) {
|
||||
case TX_4X4:
|
||||
|
|
@ -375,6 +387,24 @@ static INLINE int get_entropy_context(TX_SIZE tx_size, const ENTROPY_CONTEXT *a,
|
|||
left_ec = !!(*(const uint64_t *)l | *(const uint64_t *)(l + 8));
|
||||
break;
|
||||
#endif // CONFIG_TX64X64
|
||||
#if CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT
|
||||
case TX_4X16:
|
||||
above_ec = a[0] != 0;
|
||||
left_ec = !!*(const uint32_t *)l;
|
||||
break;
|
||||
case TX_16X4:
|
||||
above_ec = !!*(const uint32_t *)a;
|
||||
left_ec = l[0] != 0;
|
||||
break;
|
||||
case TX_8X32:
|
||||
above_ec = !!*(const uint16_t *)a;
|
||||
left_ec = !!*(const uint64_t *)l;
|
||||
break;
|
||||
case TX_32X8:
|
||||
above_ec = !!*(const uint64_t *)a;
|
||||
left_ec = !!*(const uint16_t *)l;
|
||||
break;
|
||||
#endif // CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT
|
||||
default: assert(0 && "Invalid transform size."); break;
|
||||
}
|
||||
return combine_entropy_contexts(above_ec, left_ec);
|
||||
|
|
|
|||
1945
third_party/aom/av1/common/entropymode.c
vendored
1945
third_party/aom/av1/common/entropymode.c
vendored
File diff suppressed because it is too large
Load diff
61
third_party/aom/av1/common/entropymode.h
vendored
61
third_party/aom/av1/common/entropymode.h
vendored
|
|
@ -73,7 +73,7 @@ extern "C" {
|
|||
#endif // CONFIG_PALETTE
|
||||
|
||||
#if CONFIG_INTRABC
|
||||
#define INTRABC_PROB 192
|
||||
#define INTRABC_PROB_DEFAULT 192
|
||||
#endif // CONFIG_INTRABC
|
||||
|
||||
struct AV1Common;
|
||||
|
|
@ -99,18 +99,14 @@ typedef struct frame_contexts {
|
|||
aom_prob partition_prob[PARTITION_CONTEXTS][PARTITION_TYPES - 1];
|
||||
#endif
|
||||
av1_coeff_probs_model coef_probs[TX_SIZES][PLANE_TYPES];
|
||||
#if CONFIG_NEW_TOKENSET
|
||||
coeff_cdf_model coef_tail_cdfs[TX_SIZES][PLANE_TYPES];
|
||||
coeff_cdf_model coef_head_cdfs[TX_SIZES][PLANE_TYPES];
|
||||
aom_prob blockzero_probs[TX_SIZES][PLANE_TYPES][REF_TYPES][BLOCKZ_CONTEXTS];
|
||||
#elif CONFIG_EC_MULTISYMBOL
|
||||
coeff_cdf_model coef_cdfs[TX_SIZES][PLANE_TYPES];
|
||||
#endif // CONFIG_NEW_TOKENSET
|
||||
aom_prob switchable_interp_prob[SWITCHABLE_FILTER_CONTEXTS]
|
||||
[SWITCHABLE_FILTERS - 1];
|
||||
#if CONFIG_ADAPT_SCAN
|
||||
// TODO(angiebird): try aom_prob
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
uint32_t non_zero_prob_2x2[TX_TYPES][4];
|
||||
#endif
|
||||
uint32_t non_zero_prob_4X4[TX_TYPES][16];
|
||||
|
|
@ -125,7 +121,7 @@ typedef struct frame_contexts {
|
|||
uint32_t non_zero_prob_32X16[TX_TYPES][512];
|
||||
uint32_t non_zero_prob_16X32[TX_TYPES][512];
|
||||
|
||||
#if CONFIG_CB4X4
|
||||
#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]);
|
||||
|
|
@ -140,7 +136,7 @@ typedef struct frame_contexts {
|
|||
DECLARE_ALIGNED(16, int16_t, scan_16X32[TX_TYPES][512]);
|
||||
DECLARE_ALIGNED(16, int16_t, scan_32X16[TX_TYPES][512]);
|
||||
|
||||
#if CONFIG_CB4X4
|
||||
#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]);
|
||||
|
|
@ -155,7 +151,7 @@ typedef struct frame_contexts {
|
|||
DECLARE_ALIGNED(16, int16_t, iscan_16X32[TX_TYPES][512]);
|
||||
DECLARE_ALIGNED(16, int16_t, iscan_32X16[TX_TYPES][512]);
|
||||
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
int16_t nb_2x2[TX_TYPES][(4 + 1) * 2];
|
||||
#endif
|
||||
int16_t nb_4X4[TX_TYPES][(16 + 1) * 2];
|
||||
|
|
@ -185,12 +181,10 @@ typedef struct frame_contexts {
|
|||
aom_prob coeff_lps[TX_SIZES][PLANE_TYPES][LEVEL_CONTEXTS];
|
||||
#endif
|
||||
|
||||
#if CONFIG_REF_MV
|
||||
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];
|
||||
#endif // CONFIG_REF_MV
|
||||
|
||||
aom_prob inter_mode_probs[INTER_MODE_CONTEXTS][INTER_MODES - 1];
|
||||
#if CONFIG_EXT_INTER
|
||||
|
|
@ -201,9 +195,11 @@ typedef struct frame_contexts {
|
|||
[INTER_SINGLEREF_COMP_MODES - 1];
|
||||
#endif // CONFIG_COMPOUND_SINGLEREF
|
||||
aom_prob compound_type_prob[BLOCK_SIZES][COMPOUND_TYPES - 1];
|
||||
#if CONFIG_INTERINTRA
|
||||
aom_prob interintra_prob[BLOCK_SIZE_GROUPS];
|
||||
aom_prob interintra_mode_prob[BLOCK_SIZE_GROUPS][INTERINTRA_MODES - 1];
|
||||
aom_prob wedge_interintra_prob[BLOCK_SIZES];
|
||||
#endif // CONFIG_INTERINTRA
|
||||
#endif // CONFIG_EXT_INTER
|
||||
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
|
||||
aom_prob motion_mode_prob[BLOCK_SIZES][MOTION_MODES - 1];
|
||||
|
|
@ -224,17 +220,17 @@ typedef struct frame_contexts {
|
|||
aom_prob comp_inter_mode_prob[COMP_INTER_MODE_CONTEXTS];
|
||||
#endif // CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF
|
||||
aom_prob tx_size_probs[MAX_TX_DEPTH][TX_SIZE_CONTEXTS][MAX_TX_DEPTH];
|
||||
#if CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT
|
||||
aom_prob quarter_tx_size_prob;
|
||||
#endif // CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT
|
||||
#if CONFIG_VAR_TX
|
||||
aom_prob txfm_partition_prob[TXFM_PARTITION_CONTEXTS];
|
||||
#endif
|
||||
aom_prob skip_probs[SKIP_CONTEXTS];
|
||||
#if CONFIG_REF_MV
|
||||
nmv_context nmvc[NMV_CONTEXTS];
|
||||
#else
|
||||
nmv_context nmvc;
|
||||
#endif
|
||||
#if CONFIG_INTRABC
|
||||
nmv_context ndvc;
|
||||
aom_prob intrabc_prob;
|
||||
#endif
|
||||
int initialized;
|
||||
#if CONFIG_EXT_TX
|
||||
|
|
@ -263,7 +259,6 @@ typedef struct frame_contexts {
|
|||
#if CONFIG_LOOP_RESTORATION
|
||||
aom_prob switchable_restore_prob[RESTORE_SWITCHABLE_TYPES - 1];
|
||||
#endif // CONFIG_LOOP_RESTORATION
|
||||
#if CONFIG_EC_MULTISYMBOL
|
||||
aom_cdf_prob y_mode_cdf[BLOCK_SIZE_GROUPS][CDF_SIZE(INTRA_MODES)];
|
||||
aom_cdf_prob uv_mode_cdf[INTRA_MODES][CDF_SIZE(INTRA_MODES)];
|
||||
#if CONFIG_EXT_PARTITION_TYPES
|
||||
|
|
@ -297,7 +292,6 @@ typedef struct frame_contexts {
|
|||
#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
|
||||
#endif // CONFIG_EC_MULTISYMBOL
|
||||
#if CONFIG_DELTA_Q
|
||||
aom_prob delta_q_prob[DELTA_Q_PROBS];
|
||||
#if CONFIG_EXT_DELTA_Q
|
||||
|
|
@ -309,6 +303,9 @@ typedef struct frame_contexts {
|
|||
// 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_alpha_cdf[CDF_SIZE(CFL_ALPHABET_SIZE)];
|
||||
#endif
|
||||
} FRAME_CONTEXT;
|
||||
|
||||
typedef struct FRAME_COUNTS {
|
||||
|
|
@ -328,9 +325,9 @@ typedef struct FRAME_COUNTS {
|
|||
unsigned int switchable_interp[SWITCHABLE_FILTER_CONTEXTS]
|
||||
[SWITCHABLE_FILTERS];
|
||||
#if CONFIG_ADAPT_SCAN
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
unsigned int non_zero_count_2x2[TX_TYPES][4];
|
||||
#endif // CONFIG_CB4X4
|
||||
#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];
|
||||
|
|
@ -356,16 +353,12 @@ typedef struct FRAME_COUNTS {
|
|||
unsigned int coeff_lps[TX_SIZES][PLANE_TYPES][LEVEL_CONTEXTS][2];
|
||||
#endif // CONFIG_LV_MAP
|
||||
|
||||
#if CONFIG_EC_MULTISYMBOL
|
||||
av1_blockz_count_model blockz_count[TX_SIZES][PLANE_TYPES];
|
||||
#endif
|
||||
|
||||
#if CONFIG_REF_MV
|
||||
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];
|
||||
#endif
|
||||
|
||||
unsigned int inter_mode[INTER_MODE_CONTEXTS][INTER_MODES];
|
||||
#if CONFIG_EXT_INTER
|
||||
|
|
@ -374,9 +367,11 @@ typedef struct FRAME_COUNTS {
|
|||
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][2];
|
||||
#endif // CONFIG_INTERINTRA
|
||||
unsigned int compound_interinter[BLOCK_SIZES][COMPOUND_TYPES];
|
||||
#endif // CONFIG_EXT_INTER
|
||||
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
|
||||
|
|
@ -401,17 +396,17 @@ typedef struct FRAME_COUNTS {
|
|||
// to use forward updates for the coeff probs, and as such it does not really
|
||||
// belong into this structure.
|
||||
unsigned int tx_size_totals[TX_SIZES];
|
||||
unsigned int tx_size[MAX_TX_DEPTH][TX_SIZE_CONTEXTS][TX_SIZES];
|
||||
unsigned int tx_size[MAX_TX_DEPTH][TX_SIZE_CONTEXTS][MAX_TX_DEPTH + 1];
|
||||
#if CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT
|
||||
unsigned int quarter_tx_size[2];
|
||||
#endif // CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT
|
||||
#if CONFIG_VAR_TX
|
||||
unsigned int txfm_partition[TXFM_PARTITION_CONTEXTS][2];
|
||||
#endif
|
||||
unsigned int skip[SKIP_CONTEXTS][2];
|
||||
#if CONFIG_REF_MV
|
||||
nmv_context_counts mv[NMV_CONTEXTS];
|
||||
#else
|
||||
nmv_context_counts mv;
|
||||
#endif
|
||||
#if CONFIG_INTRABC
|
||||
unsigned int intrabc[2];
|
||||
nmv_context_counts dv;
|
||||
#endif
|
||||
#if CONFIG_DELTA_Q
|
||||
|
|
@ -451,11 +446,9 @@ typedef struct FRAME_COUNTS {
|
|||
// Contexts used: Intra mode (Y plane) of 'above' and 'left' blocks.
|
||||
extern const aom_prob av1_kf_y_mode_prob[INTRA_MODES][INTRA_MODES]
|
||||
[INTRA_MODES - 1];
|
||||
#if CONFIG_EC_MULTISYMBOL
|
||||
// CDF version of 'av1_kf_y_mode_prob'.
|
||||
extern const aom_cdf_prob av1_kf_y_mode_cdf[INTRA_MODES][INTRA_MODES]
|
||||
[CDF_SIZE(INTRA_MODES)];
|
||||
#endif
|
||||
|
||||
#if CONFIG_PALETTE
|
||||
extern const aom_prob av1_default_palette_y_mode_prob[PALETTE_BLOCK_SIZES]
|
||||
|
|
@ -474,7 +467,6 @@ extern const aom_prob av1_default_palette_uv_color_index_prob
|
|||
|
||||
extern const aom_tree_index av1_intra_mode_tree[TREE_SIZE(INTRA_MODES)];
|
||||
extern const aom_tree_index av1_inter_mode_tree[TREE_SIZE(INTER_MODES)];
|
||||
#if CONFIG_EC_MULTISYMBOL
|
||||
extern int av1_intra_mode_ind[INTRA_MODES];
|
||||
extern int av1_intra_mode_inv[INTRA_MODES];
|
||||
extern int av1_inter_mode_ind[INTER_MODES];
|
||||
|
|
@ -485,11 +477,12 @@ extern int av1_ext_tx_intra_inv[EXT_TX_SETS_INTRA][TX_TYPES];
|
|||
extern int av1_ext_tx_inter_ind[EXT_TX_SETS_INTER][TX_TYPES];
|
||||
extern int av1_ext_tx_inter_inv[EXT_TX_SETS_INTER][TX_TYPES];
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if CONFIG_EXT_INTER
|
||||
#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
|
||||
|
|
@ -534,10 +527,10 @@ extern const aom_tree_index av1_motion_mode_tree[TREE_SIZE(MOTION_MODES)];
|
|||
extern const aom_tree_index
|
||||
av1_switchable_restore_tree[TREE_SIZE(RESTORE_SWITCHABLE_TYPES)];
|
||||
#endif // CONFIG_LOOP_RESTORATION
|
||||
#if CONFIG_EC_MULTISYMBOL
|
||||
extern int av1_switchable_interp_ind[SWITCHABLE_FILTERS];
|
||||
extern int av1_switchable_interp_inv[SWITCHABLE_FILTERS];
|
||||
|
||||
#if !CONFIG_EC_ADAPT
|
||||
void av1_set_mode_cdfs(struct AV1Common *cm);
|
||||
#endif
|
||||
|
||||
|
|
@ -545,7 +538,7 @@ 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);
|
||||
#if CONFIG_EC_MULTISYMBOL && !CONFIG_EXT_TX
|
||||
#if !CONFIG_EXT_TX
|
||||
extern int av1_ext_tx_ind[TX_TYPES];
|
||||
extern int av1_ext_tx_inv[TX_TYPES];
|
||||
#endif
|
||||
|
|
|
|||
61
third_party/aom/av1/common/entropymv.c
vendored
61
third_party/aom/av1/common/entropymv.c
vendored
|
|
@ -43,57 +43,47 @@ const aom_tree_index av1_mv_fp_tree[TREE_SIZE(MV_FP_SIZE)] = { -0, 2, -1,
|
|||
|
||||
static const nmv_context default_nmv_context = {
|
||||
{ 32, 64, 96 }, // joints
|
||||
#if CONFIG_EC_MULTISYMBOL
|
||||
{ AOM_ICDF(4096), AOM_ICDF(11264), AOM_ICDF(19328), AOM_ICDF(32768),
|
||||
0 }, // joint_cdf
|
||||
#endif
|
||||
{ {
|
||||
// Vertical component
|
||||
128, // sign
|
||||
{ 224, 144, 192, 168, 192, 176, 192, 198, 198, 245 }, // class
|
||||
#if CONFIG_EC_MULTISYMBOL
|
||||
{ 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
|
||||
#endif
|
||||
{ 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
|
||||
#if CONFIG_EC_MULTISYMBOL
|
||||
{ 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
|
||||
#endif
|
||||
160, // class0_hp bit
|
||||
128, // hp
|
||||
160, // class0_hp bit
|
||||
128, // hp
|
||||
},
|
||||
{
|
||||
// Horizontal component
|
||||
128, // sign
|
||||
{ 216, 128, 176, 160, 176, 176, 192, 198, 198, 208 }, // class
|
||||
#if CONFIG_EC_MULTISYMBOL
|
||||
{ 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
|
||||
#endif
|
||||
{ 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
|
||||
#if CONFIG_EC_MULTISYMBOL
|
||||
{ 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
|
||||
#endif
|
||||
160, // class0_hp bit
|
||||
128, // hp
|
||||
160, // class0_hp bit
|
||||
128, // hp
|
||||
} },
|
||||
};
|
||||
|
||||
|
|
@ -232,23 +222,16 @@ void av1_inc_mv(const MV *mv, nmv_context_counts *counts, const int usehp) {
|
|||
|
||||
void av1_adapt_mv_probs(AV1_COMMON *cm, int allow_hp) {
|
||||
int i, j;
|
||||
#if CONFIG_REF_MV
|
||||
int idx;
|
||||
for (idx = 0; idx < NMV_CONTEXTS; ++idx) {
|
||||
nmv_context *fc = &cm->fc->nmvc[idx];
|
||||
const nmv_context *pre_fc =
|
||||
&cm->frame_contexts[cm->frame_context_idx].nmvc[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];
|
||||
#else
|
||||
nmv_context *fc = &cm->fc->nmvc;
|
||||
const nmv_context *pre_fc = &cm->frame_contexts[cm->frame_context_idx].nmvc;
|
||||
const nmv_context_counts *counts = &cm->counts.mv;
|
||||
#endif // CONFIG_REF_MV
|
||||
aom_tree_merge_probs(av1_mv_joint_tree, pre_fc->joints, counts->joints,
|
||||
fc->joints);
|
||||
aom_tree_merge_probs(av1_mv_joint_tree, pre_nmvc->joints, counts->joints,
|
||||
nmvc->joints);
|
||||
for (i = 0; i < 2; ++i) {
|
||||
nmv_component *comp = &fc->comps[i];
|
||||
const nmv_component *pre_comp = &pre_fc->comps[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);
|
||||
|
|
@ -272,12 +255,10 @@ void av1_adapt_mv_probs(AV1_COMMON *cm, int allow_hp) {
|
|||
comp->hp = av1_mode_mv_merge_probs(pre_comp->hp, c->hp);
|
||||
}
|
||||
}
|
||||
#if CONFIG_REF_MV
|
||||
}
|
||||
#endif // CONFIG_REF_MV
|
||||
}
|
||||
|
||||
#if CONFIG_EC_MULTISYMBOL && !CONFIG_EC_ADAPT
|
||||
#if !CONFIG_EC_ADAPT
|
||||
void av1_set_mv_cdfs(nmv_context *ctx) {
|
||||
int i;
|
||||
int j;
|
||||
|
|
@ -297,15 +278,11 @@ void av1_set_mv_cdfs(nmv_context *ctx) {
|
|||
#endif
|
||||
|
||||
void av1_init_mv_probs(AV1_COMMON *cm) {
|
||||
#if CONFIG_REF_MV
|
||||
int i;
|
||||
for (i = 0; i < NMV_CONTEXTS; ++i) {
|
||||
// NB: this sets CDFs too
|
||||
cm->fc->nmvc[i] = default_nmv_context;
|
||||
}
|
||||
#else
|
||||
cm->fc->nmvc = default_nmv_context;
|
||||
#endif // CONFIG_REF_MV
|
||||
#if CONFIG_INTRABC
|
||||
cm->fc->ndvc = default_nmv_context;
|
||||
#endif // CONFIG_INTRABC
|
||||
|
|
|
|||
8
third_party/aom/av1/common/entropymv.h
vendored
8
third_party/aom/av1/common/entropymv.h
vendored
|
|
@ -84,26 +84,20 @@ extern const aom_tree_index av1_mv_fp_tree[];
|
|||
typedef struct {
|
||||
aom_prob sign;
|
||||
aom_prob classes[MV_CLASSES - 1];
|
||||
#if CONFIG_EC_MULTISYMBOL
|
||||
aom_cdf_prob class_cdf[CDF_SIZE(MV_CLASSES)];
|
||||
#endif
|
||||
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];
|
||||
#if CONFIG_EC_MULTISYMBOL
|
||||
aom_cdf_prob class0_fp_cdf[CLASS0_SIZE][CDF_SIZE(MV_FP_SIZE)];
|
||||
aom_cdf_prob fp_cdf[CDF_SIZE(MV_FP_SIZE)];
|
||||
#endif
|
||||
aom_prob class0_hp;
|
||||
aom_prob hp;
|
||||
} nmv_component;
|
||||
|
||||
typedef struct {
|
||||
aom_prob joints[MV_JOINTS - 1];
|
||||
#if CONFIG_EC_MULTISYMBOL
|
||||
aom_cdf_prob joint_cdf[CDF_SIZE(MV_JOINTS)];
|
||||
#endif
|
||||
nmv_component comps[2];
|
||||
} nmv_context;
|
||||
|
||||
|
|
@ -138,7 +132,7 @@ void av1_inc_mv(const MV *mv, nmv_context_counts *mvctx, const int usehp);
|
|||
extern const aom_tree_index
|
||||
av1_global_motion_types_tree[TREE_SIZE(GLOBAL_TRANS_TYPES)];
|
||||
#endif // CONFIG_GLOBAL_MOTION
|
||||
#if CONFIG_EC_MULTISYMBOL
|
||||
#if !CONFIG_EC_ADAPT
|
||||
void av1_set_mv_cdfs(nmv_context *ctx);
|
||||
#endif
|
||||
|
||||
|
|
|
|||
66
third_party/aom/av1/common/enums.h
vendored
66
third_party/aom/av1/common/enums.h
vendored
|
|
@ -51,7 +51,6 @@ extern "C" {
|
|||
|
||||
// Mask to extract MI offset within max MIB
|
||||
#define MAX_MIB_MASK (MAX_MIB_SIZE - 1)
|
||||
#define MAX_MIB_MASK_2 (MAX_MIB_SIZE * 2 - 1)
|
||||
|
||||
// Maximum number of tile rows and tile columns
|
||||
#if CONFIG_EXT_TILE
|
||||
|
|
@ -111,8 +110,13 @@ typedef enum ATTRIBUTE_PACKED {
|
|||
BLOCK_128X64,
|
||||
BLOCK_128X128,
|
||||
#endif // CONFIG_EXT_PARTITION
|
||||
BLOCK_SIZES,
|
||||
BLOCK_INVALID = BLOCK_SIZES,
|
||||
BLOCK_4X16,
|
||||
BLOCK_16X4,
|
||||
BLOCK_8X32,
|
||||
BLOCK_32X8,
|
||||
BLOCK_SIZES_ALL,
|
||||
BLOCK_SIZES = BLOCK_4X16,
|
||||
BLOCK_INVALID = 255,
|
||||
BLOCK_LARGEST = (BLOCK_SIZES - 1)
|
||||
} BLOCK_SIZE;
|
||||
|
||||
|
|
@ -145,7 +149,7 @@ typedef char PARTITION_CONTEXT;
|
|||
|
||||
// block transform size
|
||||
typedef enum ATTRIBUTE_PACKED {
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
TX_2X2, // 2x2 transform
|
||||
#endif
|
||||
TX_4X4, // 4x4 transform
|
||||
|
|
@ -170,7 +174,12 @@ typedef enum ATTRIBUTE_PACKED {
|
|||
TX_INVALID = 255 // Invalid transform size
|
||||
} TX_SIZE;
|
||||
|
||||
#define MAX_TX_DEPTH (TX_SIZES - 1 - TX_4X4)
|
||||
#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)
|
||||
|
||||
#define MAX_TX_SIZE_LOG2 (5 + CONFIG_TX64X64)
|
||||
#define MAX_TX_SIZE (1 << MAX_TX_SIZE_LOG2)
|
||||
|
|
@ -240,15 +249,15 @@ typedef enum {
|
|||
} BOUNDARY_TYPE;
|
||||
|
||||
#if CONFIG_EXT_TX
|
||||
#if CONFIG_CB4X4
|
||||
#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_CB4X4
|
||||
#endif // CONFIG_CHROMA_2X2
|
||||
#define EXT_TX_SETS_INTER 4 // Sets of transform selections for INTER
|
||||
#define EXT_TX_SETS_INTRA 3 // Sets of transform selections for INTRA
|
||||
#else
|
||||
#if CONFIG_CB4X4
|
||||
#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
|
||||
|
|
@ -274,7 +283,14 @@ typedef enum {
|
|||
typedef enum { PLANE_TYPE_Y = 0, PLANE_TYPE_UV = 1, PLANE_TYPES } PLANE_TYPE;
|
||||
|
||||
#if CONFIG_CFL
|
||||
// TODO(ltrudeau) this should change based on QP size
|
||||
#define CB_ALPHABET_SIZE 4
|
||||
#define CR_ALPHABET_SIZE 4
|
||||
#define CFL_ALPHABET_SIZE (CB_ALPHABET_SIZE * CR_ALPHABET_SIZE)
|
||||
#define CFL_MAGS_SIZE 7
|
||||
|
||||
typedef enum { CFL_PRED_U = 0, CFL_PRED_V = 1, CFL_PRED_PLANES } CFL_PRED_TYPE;
|
||||
typedef enum { CFL_SIGN_NEG = 0, CFL_SIGN_POS = 1, CFL_SIGNS } CFL_SIGN_TYPE;
|
||||
#endif
|
||||
|
||||
#if CONFIG_PALETTE
|
||||
|
|
@ -314,8 +330,12 @@ typedef enum ATTRIBUTE_PACKED {
|
|||
D63_PRED, // Directional 63 deg = round(arctan(2/1) * 180/pi)
|
||||
#if CONFIG_ALT_INTRA
|
||||
SMOOTH_PRED, // Combination of horizontal and vertical interpolation
|
||||
#endif // CONFIG_ALT_INTRA
|
||||
TM_PRED, // True-motion
|
||||
#if CONFIG_SMOOTH_HV
|
||||
SMOOTH_V_PRED, // Vertical interpolation
|
||||
SMOOTH_H_PRED, // Horizontal interpolation
|
||||
#endif // CONFIG_SMOOTH_HV
|
||||
#endif // CONFIG_ALT_INTRA
|
||||
TM_PRED, // True-motion
|
||||
NEARESTMV,
|
||||
NEARMV,
|
||||
ZEROMV,
|
||||
|
|
@ -331,8 +351,6 @@ typedef enum ATTRIBUTE_PACKED {
|
|||
#endif // CONFIG_COMPOUND_SINGLEREF
|
||||
// Compound ref compound modes
|
||||
NEAREST_NEARESTMV,
|
||||
NEAREST_NEARMV,
|
||||
NEAR_NEARESTMV,
|
||||
NEAR_NEARMV,
|
||||
NEAREST_NEWMV,
|
||||
NEW_NEARESTMV,
|
||||
|
|
@ -357,22 +375,20 @@ typedef enum {
|
|||
MOTION_MODES
|
||||
} MOTION_MODE;
|
||||
|
||||
// TODO(urvang): Consider adding II_SMOOTH_PRED if it's helpful.
|
||||
|
||||
#if CONFIG_EXT_INTER
|
||||
#if CONFIG_INTERINTRA
|
||||
typedef enum {
|
||||
II_DC_PRED = 0,
|
||||
II_V_PRED,
|
||||
II_H_PRED,
|
||||
II_D45_PRED,
|
||||
II_D135_PRED,
|
||||
II_D117_PRED,
|
||||
II_D153_PRED,
|
||||
II_D207_PRED,
|
||||
II_D63_PRED,
|
||||
#if CONFIG_ALT_INTRA
|
||||
II_SMOOTH_PRED,
|
||||
#else
|
||||
II_TM_PRED,
|
||||
#endif // CONFIG_ALT_INTRA
|
||||
INTERINTRA_MODES
|
||||
} INTERINTRA_MODE;
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
COMPOUND_AVERAGE = 0,
|
||||
|
|
@ -404,7 +420,7 @@ typedef enum {
|
|||
#endif // CONFIG_FILTER_INTRA
|
||||
|
||||
#if CONFIG_EXT_INTRA
|
||||
#define DIRECTIONAL_MODES (INTRA_MODES - 2)
|
||||
#define DIRECTIONAL_MODES 8
|
||||
#endif // CONFIG_EXT_INTRA
|
||||
|
||||
#define INTER_MODES (1 + NEWMV - NEARESTMV)
|
||||
|
|
@ -419,7 +435,6 @@ typedef enum {
|
|||
|
||||
#define SKIP_CONTEXTS 3
|
||||
|
||||
#if CONFIG_REF_MV
|
||||
#define NMV_CONTEXTS 3
|
||||
|
||||
#define NEWMV_MODE_CONTEXTS 7
|
||||
|
|
@ -438,7 +453,6 @@ typedef enum {
|
|||
#define SKIP_NEARESTMV_OFFSET 9
|
||||
#define SKIP_NEARMV_OFFSET 10
|
||||
#define SKIP_NEARESTMV_SUB8X8_OFFSET 11
|
||||
#endif
|
||||
|
||||
#define INTER_MODE_CONTEXTS 7
|
||||
#if CONFIG_DELTA_Q
|
||||
|
|
@ -455,14 +469,12 @@ typedef enum {
|
|||
/* Segment Feature Masks */
|
||||
#define MAX_MV_REF_CANDIDATES 2
|
||||
|
||||
#if CONFIG_REF_MV
|
||||
#define MAX_REF_MV_STACK_SIZE 16
|
||||
#if CONFIG_EXT_PARTITION
|
||||
#define REF_CAT_LEVEL 640
|
||||
#else
|
||||
#define REF_CAT_LEVEL 255
|
||||
#endif // CONFIG_EXT_PARTITION
|
||||
#endif // CONFIG_REF_MV
|
||||
|
||||
#define INTRA_INTER_CONTEXTS 4
|
||||
#define COMP_INTER_CONTEXTS 5
|
||||
|
|
@ -508,11 +520,7 @@ typedef uint8_t TXFM_CONTEXT;
|
|||
#define SINGLE_REFS (FWD_REFS + BWD_REFS)
|
||||
#define COMP_REFS (FWD_REFS * BWD_REFS)
|
||||
|
||||
#if CONFIG_REF_MV
|
||||
#define MODE_CTX_REF_FRAMES (TOTAL_REFS_PER_FRAME + COMP_REFS)
|
||||
#else
|
||||
#define MODE_CTX_REF_FRAMES TOTAL_REFS_PER_FRAME
|
||||
#endif
|
||||
|
||||
#if CONFIG_SUPERTX
|
||||
#define PARTITION_SUPERTX_CONTEXTS 2
|
||||
|
|
|
|||
64
third_party/aom/av1/common/filter.c
vendored
64
third_party/aom/av1/common/filter.c
vendored
|
|
@ -48,9 +48,19 @@ DECLARE_ALIGNED(16, static const int16_t,
|
|||
};
|
||||
#endif // USE_TEMPORALFILTER_12TAP
|
||||
|
||||
#if CONFIG_DUAL_FILTER
|
||||
#if USE_EXTRA_FILTER
|
||||
DECLARE_ALIGNED(256, static const InterpKernel,
|
||||
sub_pel_filters_8[SUBPEL_SHIFTS]) = {
|
||||
#if CONFIG_FILTER_7BIT
|
||||
{ 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 }
|
||||
#else
|
||||
// intfilt 0.575
|
||||
{ 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 1, -5, 126, 8, -3, 1, 0 },
|
||||
{ -1, 3, -10, 123, 18, -6, 2, -1 }, { -1, 4, -14, 118, 27, -9, 3, 0 },
|
||||
|
|
@ -60,10 +70,21 @@ DECLARE_ALIGNED(256, static const InterpKernel,
|
|||
{ -1, 5, -17, 58, 97, -19, 6, -1 }, { -1, 4, -14, 48, 105, -18, 5, -1 },
|
||||
{ -1, 4, -12, 37, 112, -16, 5, -1 }, { 0, 3, -9, 27, 118, -14, 4, -1 },
|
||||
{ -1, 2, -6, 18, 123, -10, 3, -1 }, { 0, 1, -3, 8, 126, -5, 1, 0 },
|
||||
#endif
|
||||
};
|
||||
|
||||
DECLARE_ALIGNED(256, static const InterpKernel,
|
||||
sub_pel_filters_regular_uv[SUBPEL_SHIFTS]) = {
|
||||
#if CONFIG_FILTER_7BIT
|
||||
{ 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 }
|
||||
#else
|
||||
// intfilt 0.575
|
||||
{ 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 1, -5, 126, 8, -3, 1, 0 },
|
||||
{ -1, 3, -10, 123, 18, -6, 2, -1 }, { -1, 4, -14, 118, 27, -9, 3, 0 },
|
||||
|
|
@ -73,6 +94,7 @@ DECLARE_ALIGNED(256, static const InterpKernel,
|
|||
{ -1, 5, -17, 58, 97, -19, 6, -1 }, { -1, 4, -14, 48, 105, -18, 5, -1 },
|
||||
{ -1, 4, -12, 37, 112, -16, 5, -1 }, { 0, 3, -9, 27, 118, -14, 4, -1 },
|
||||
{ -1, 2, -6, 18, 123, -10, 3, -1 }, { 0, 1, -3, 8, 126, -5, 1, 0 },
|
||||
#endif
|
||||
};
|
||||
|
||||
#if USE_12TAP_FILTER
|
||||
|
|
@ -162,6 +184,16 @@ DECLARE_ALIGNED(256, static const InterpKernel,
|
|||
|
||||
DECLARE_ALIGNED(256, static const InterpKernel,
|
||||
sub_pel_filters_8smooth[SUBPEL_SHIFTS]) = {
|
||||
#if CONFIG_FILTER_7BIT
|
||||
{ 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
|
||||
// freqmultiplier = 0.8
|
||||
{ 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, -5, 13, 102, 24, -7, 1, 0 },
|
||||
{ 0, -4, 8, 100, 31, -8, 1, 0 }, { 0, -3, 4, 97, 37, -8, 1, 0 },
|
||||
|
|
@ -171,10 +203,21 @@ DECLARE_ALIGNED(256, static const InterpKernel,
|
|||
{ 0, 0, -9, 59, 84, -5, -1, 0 }, { 0, 1, -9, 51, 90, -3, -2, 0 },
|
||||
{ 0, 1, -9, 44, 94, 0, -2, 0 }, { 0, 1, -8, 37, 97, 4, -3, 0 },
|
||||
{ 0, 1, -8, 31, 100, 8, -4, 0 }, { 0, 1, -7, 24, 102, 13, -5, 0 },
|
||||
#endif
|
||||
};
|
||||
|
||||
DECLARE_ALIGNED(256, static const InterpKernel,
|
||||
sub_pel_filters_smooth_uv[SUBPEL_SHIFTS]) = {
|
||||
#if CONFIG_FILTER_7BIT
|
||||
{ 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
|
||||
// freqmultiplier = 0.8
|
||||
{ 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, -5, 13, 102, 24, -7, 1, 0 },
|
||||
{ 0, -4, 8, 100, 31, -8, 1, 0 }, { 0, -3, 4, 97, 37, -8, 1, 0 },
|
||||
|
|
@ -184,8 +227,9 @@ DECLARE_ALIGNED(256, static const InterpKernel,
|
|||
{ 0, 0, -9, 59, 84, -5, -1, 0 }, { 0, 1, -9, 51, 90, -3, -2, 0 },
|
||||
{ 0, 1, -9, 44, 94, 0, -2, 0 }, { 0, 1, -8, 37, 97, 4, -3, 0 },
|
||||
{ 0, 1, -8, 31, 100, 8, -4, 0 }, { 0, 1, -7, 24, 102, 13, -5, 0 },
|
||||
#endif
|
||||
};
|
||||
#else // CONFIG_DUAL_FILTER
|
||||
#else // USE_EXTRA_FILTER
|
||||
|
||||
DECLARE_ALIGNED(256, static const InterpKernel,
|
||||
sub_pel_filters_8[SUBPEL_SHIFTS]) = {
|
||||
|
|
@ -255,7 +299,7 @@ DECLARE_ALIGNED(256, static const InterpKernel,
|
|||
{ 0, -3, 2, 41, 63, 29, -2, -2 }, { 0, -3, 1, 38, 64, 32, -1, -3 }
|
||||
#endif
|
||||
};
|
||||
#endif // CONFIG_DUAL_FILTER
|
||||
#endif // USE_EXTRA_FILTER
|
||||
|
||||
#if CONFIG_EXT_INTRA
|
||||
#if CONFIG_INTRA_INTERP
|
||||
|
|
@ -268,7 +312,7 @@ const InterpKernel *av1_intra_filter_kernels[INTRA_FILTERS] = {
|
|||
#endif // CONFIG_INTRA_INTERP
|
||||
#endif // CONFIG_EXT_INTRA
|
||||
|
||||
#if CONFIG_DUAL_FILTER
|
||||
#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,
|
||||
|
|
@ -309,7 +353,7 @@ static const InterpFilterParams
|
|||
{ (const int16_t *)bilinear_filters, SUBPEL_TAPS, SUBPEL_SHIFTS,
|
||||
BILINEAR }
|
||||
};
|
||||
#endif // CONFIG_DUAL_FILTER
|
||||
#endif // USE_EXTRA_FILTER
|
||||
|
||||
#if USE_TEMPORALFILTER_12TAP
|
||||
static const InterpFilterParams av1_interp_temporalfilter_12tap = {
|
||||
|
|
@ -340,11 +384,17 @@ const int16_t *av1_get_interp_filter_kernel(const InterpFilter interp_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 {
|
||||
|
|
@ -356,5 +406,9 @@ InterpFilter av1_get_plane_interp_filter(InterpFilter interp_filter,
|
|||
default: return interp_filter;
|
||||
}
|
||||
}
|
||||
#else // USE_EXTRA_FILTER
|
||||
(void)plane;
|
||||
return interp_filter;
|
||||
#endif // USE_EXTRA_FILTER
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
9
third_party/aom/av1/common/filter.h
vendored
9
third_party/aom/av1/common/filter.h
vendored
|
|
@ -25,22 +25,23 @@ extern "C" {
|
|||
#define MAX_FILTER_TAP 12
|
||||
|
||||
#define USE_12TAP_FILTER 0
|
||||
#define USE_EXTRA_FILTER 0
|
||||
|
||||
typedef enum {
|
||||
EIGHTTAP_REGULAR,
|
||||
EIGHTTAP_SMOOTH,
|
||||
MULTITAP_SHARP,
|
||||
#if CONFIG_DUAL_FILTER
|
||||
#if USE_EXTRA_FILTER
|
||||
EIGHTTAP_SMOOTH2,
|
||||
#endif // CONFIG_DUAL_FILTER
|
||||
#endif // USE_EXTRA_FILTER
|
||||
BILINEAR,
|
||||
#if CONFIG_DUAL_FILTER
|
||||
#if USE_EXTRA_FILTER
|
||||
EIGHTTAP_SHARP,
|
||||
FILTER_REGULAR_UV,
|
||||
FILTER_SMOOTH_UV,
|
||||
FILTER_SHARP_UV,
|
||||
FILTER_SMOOTH2_UV,
|
||||
#endif // CONFIG_DUAL_FILTER
|
||||
#endif // USE_EXTRA_FILTER
|
||||
INTERP_FILTERS_ALL,
|
||||
SWITCHABLE_FILTERS = BILINEAR,
|
||||
SWITCHABLE = SWITCHABLE_FILTERS + 1, /* the last switchable one */
|
||||
|
|
|
|||
1222
third_party/aom/av1/common/idct.c
vendored
1222
third_party/aom/av1/common/idct.c
vendored
File diff suppressed because it is too large
Load diff
37
third_party/aom/av1/common/idct.h
vendored
37
third_party/aom/av1/common/idct.h
vendored
|
|
@ -46,9 +46,7 @@ typedef struct {
|
|||
} transform_2d;
|
||||
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
typedef void (*highbd_transform_1d)(const tran_low_t *, tran_low_t *,
|
||||
const int8_t *cos_bit,
|
||||
const int8_t *stage_range, int bd);
|
||||
typedef void (*highbd_transform_1d)(const tran_low_t *, tran_low_t *, int bd);
|
||||
|
||||
typedef struct {
|
||||
highbd_transform_1d cols, rows; // vertical and horizontal
|
||||
|
|
@ -63,12 +61,6 @@ void av1_iwht4x4_add(const tran_low_t *input, uint8_t *dest, int stride,
|
|||
void av1_idct4x4_add(const tran_low_t *input, uint8_t *dest, int stride,
|
||||
int eob);
|
||||
|
||||
void av1_inv_txfm_add_4x4(const tran_low_t *input, uint8_t *dest, int stride,
|
||||
int eob, TX_TYPE tx_type, int lossless);
|
||||
void av1_inv_txfm_add_8x4(const tran_low_t *input, uint8_t *dest, int stride,
|
||||
int eob, TX_TYPE tx_type);
|
||||
void av1_inv_txfm_add_4x8(const tran_low_t *input, uint8_t *dest, int stride,
|
||||
int eob, TX_TYPE tx_type);
|
||||
void av1_inv_txfm_add(const tran_low_t *input, uint8_t *dest, int stride,
|
||||
INV_TXFM_PARAM *inv_txfm_param);
|
||||
void av1_inverse_transform_block(const MACROBLOCKD *xd,
|
||||
|
|
@ -92,6 +84,33 @@ void av1_highbd_inv_txfm_add_8x4(const tran_low_t *input, uint8_t *dest,
|
|||
void av1_highbd_inv_txfm_add(const tran_low_t *input, uint8_t *dest, int stride,
|
||||
INV_TXFM_PARAM *inv_txfm_param);
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
#if CONFIG_DPCM_INTRA
|
||||
void av1_dpcm_inv_txfm_add_4_c(const tran_low_t *input, int stride,
|
||||
TX_TYPE_1D tx_type, uint8_t *dest);
|
||||
void av1_dpcm_inv_txfm_add_8_c(const tran_low_t *input, int stride,
|
||||
TX_TYPE_1D tx_type, uint8_t *dest);
|
||||
void av1_dpcm_inv_txfm_add_16_c(const tran_low_t *input, int stride,
|
||||
TX_TYPE_1D tx_type, uint8_t *dest);
|
||||
void av1_dpcm_inv_txfm_add_32_c(const tran_low_t *input, int stride,
|
||||
TX_TYPE_1D tx_type, uint8_t *dest);
|
||||
typedef void (*dpcm_inv_txfm_add_func)(const tran_low_t *input, int stride,
|
||||
TX_TYPE_1D tx_type, uint8_t *dest);
|
||||
dpcm_inv_txfm_add_func av1_get_dpcm_inv_txfm_add_func(int tx_length);
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
void av1_hbd_dpcm_inv_txfm_add_4_c(const tran_low_t *input, int stride,
|
||||
TX_TYPE_1D tx_type, int bd, uint16_t *dest);
|
||||
void av1_hbd_dpcm_inv_txfm_add_8_c(const tran_low_t *input, int stride,
|
||||
TX_TYPE_1D tx_type, int bd, uint16_t *dest);
|
||||
void av1_hbd_dpcm_inv_txfm_add_16_c(const tran_low_t *input, int stride,
|
||||
TX_TYPE_1D tx_type, int bd, uint16_t *dest);
|
||||
void av1_hbd_dpcm_inv_txfm_add_32_c(const tran_low_t *input, int stride,
|
||||
TX_TYPE_1D tx_type, int bd, uint16_t *dest);
|
||||
typedef void (*hbd_dpcm_inv_txfm_add_func)(const tran_low_t *input, int stride,
|
||||
TX_TYPE_1D tx_type, int bd,
|
||||
uint16_t *dest);
|
||||
hbd_dpcm_inv_txfm_add_func av1_get_hbd_dpcm_inv_txfm_add_func(int tx_length);
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
#endif // CONFIG_DPCM_INTRA
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
|
|
|||
4
third_party/aom/av1/common/mv.h
vendored
4
third_party/aom/av1/common/mv.h
vendored
|
|
@ -58,6 +58,8 @@ typedef struct mv32 {
|
|||
// 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 \
|
||||
|
|
@ -269,14 +271,12 @@ static INLINE TransformationType get_gmtype(const WarpedMotionParams *gm) {
|
|||
}
|
||||
#endif // CONFIG_GLOBAL_MOTION
|
||||
|
||||
#if CONFIG_REF_MV
|
||||
typedef struct candidate_mv {
|
||||
int_mv this_mv;
|
||||
int_mv comp_mv;
|
||||
uint8_t pred_diff[2];
|
||||
int weight;
|
||||
} CANDIDATE_MV;
|
||||
#endif
|
||||
|
||||
static INLINE int is_zero_mv(const MV *mv) {
|
||||
return *((const uint32_t *)mv) == 0;
|
||||
|
|
|
|||
78
third_party/aom/av1/common/mvref_common.c
vendored
78
third_party/aom/av1/common/mvref_common.c
vendored
|
|
@ -14,8 +14,6 @@
|
|||
#include "av1/common/warped_motion.h"
|
||||
#endif // CONFIG_WARPED_MOTION
|
||||
|
||||
#if CONFIG_REF_MV
|
||||
|
||||
static uint8_t add_ref_mv_candidate(
|
||||
const MODE_INFO *const candidate_mi, const MB_MODE_INFO *const candidate,
|
||||
const MV_REFERENCE_FRAME rf[2], uint8_t *refmv_count,
|
||||
|
|
@ -556,7 +554,6 @@ static void setup_ref_mv_list(const AV1_COMMON *cm, const MACROBLOCKD *xd,
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// This function searches the neighbourhood of a given MB/SB
|
||||
// to try and find candidate reference vectors.
|
||||
|
|
@ -568,9 +565,6 @@ static void find_mv_refs_idx(const AV1_COMMON *cm, const MACROBLOCKD *xd,
|
|||
int_mv zeromv) {
|
||||
const int *ref_sign_bias = cm->ref_frame_sign_bias;
|
||||
int i, refmv_count = 0;
|
||||
#if !CONFIG_REF_MV
|
||||
const POSITION *const mv_ref_search = mv_ref_blocks[mi->mbmi.sb_type];
|
||||
#endif
|
||||
int different_ref_found = 0;
|
||||
int context_counter = 0;
|
||||
#if CONFIG_MV_COMPRESS
|
||||
|
|
@ -591,12 +585,14 @@ static void find_mv_refs_idx(const AV1_COMMON *cm, const MACROBLOCKD *xd,
|
|||
cm->use_prev_frame_mvs
|
||||
? cm->prev_frame->mvs + mi_row * cm->mi_cols + mi_col
|
||||
: NULL;
|
||||
#endif
|
||||
#if CONFIG_INTRABC
|
||||
assert(IMPLIES(ref_frame == INTRA_FRAME, cm->use_prev_frame_mvs == 0));
|
||||
#endif
|
||||
const TileInfo *const tile = &xd->tile;
|
||||
const BLOCK_SIZE bsize = mi->mbmi.sb_type;
|
||||
const int bw = block_size_wide[AOMMAX(bsize, BLOCK_8X8)];
|
||||
const int bh = block_size_high[AOMMAX(bsize, BLOCK_8X8)];
|
||||
#if CONFIG_REF_MV
|
||||
POSITION mv_ref_search[MVREF_NEIGHBOURS];
|
||||
const int num_8x8_blocks_wide = num_8x8_blocks_wide_lookup[bsize];
|
||||
const int num_8x8_blocks_high = num_8x8_blocks_high_lookup[bsize];
|
||||
|
|
@ -639,7 +635,6 @@ static void find_mv_refs_idx(const AV1_COMMON *cm, const MACROBLOCKD *xd,
|
|||
mv_ref_search[i].col *= 2;
|
||||
}
|
||||
#endif // CONFIG_CB4X4
|
||||
#endif // CONFIG_REF_MV
|
||||
|
||||
// The nearest 2 blocks are treated differently
|
||||
// if the size < 8x8 we get the mv from the bmi substructure,
|
||||
|
|
@ -673,12 +668,10 @@ static void find_mv_refs_idx(const AV1_COMMON *cm, const MACROBLOCKD *xd,
|
|||
!xd->mi[mv_ref->col + mv_ref->row * xd->mi_stride]
|
||||
? NULL
|
||||
: &xd->mi[mv_ref->col + mv_ref->row * xd->mi_stride]->mbmi;
|
||||
#if CONFIG_REF_MV
|
||||
if (candidate == NULL) continue;
|
||||
if ((mi_row % MAX_MIB_SIZE) + mv_ref->row >= MAX_MIB_SIZE ||
|
||||
(mi_col % MAX_MIB_SIZE) + mv_ref->col >= MAX_MIB_SIZE)
|
||||
continue;
|
||||
#endif
|
||||
different_ref_found = 1;
|
||||
|
||||
if (candidate->ref_frame[0] == ref_frame)
|
||||
|
|
@ -727,12 +720,10 @@ static void find_mv_refs_idx(const AV1_COMMON *cm, const MACROBLOCKD *xd,
|
|||
!xd->mi[mv_ref->col + mv_ref->row * xd->mi_stride]
|
||||
? NULL
|
||||
: &xd->mi[mv_ref->col + mv_ref->row * xd->mi_stride]->mbmi;
|
||||
#if CONFIG_REF_MV
|
||||
if (candidate == NULL) continue;
|
||||
if ((mi_row % MAX_MIB_SIZE) + mv_ref->row >= MAX_MIB_SIZE ||
|
||||
(mi_col % MAX_MIB_SIZE) + mv_ref->col >= MAX_MIB_SIZE)
|
||||
continue;
|
||||
#endif
|
||||
|
||||
// If the candidate is INTRA we don't want to consider its mv.
|
||||
IF_DIFF_REF_FRAME_ADD_MV(candidate, ref_frame, ref_sign_bias,
|
||||
|
|
@ -780,50 +771,18 @@ void av1_update_mv_context(const AV1_COMMON *cm, const MACROBLOCKD *xd,
|
|||
int_mv *mv_ref_list, int block, int mi_row,
|
||||
int mi_col, int16_t *mode_context) {
|
||||
int i, refmv_count = 0;
|
||||
#if !CONFIG_REF_MV
|
||||
const POSITION *const mv_ref_search = mv_ref_blocks[mi->mbmi.sb_type];
|
||||
#endif
|
||||
int context_counter = 0;
|
||||
const int bw = block_size_wide[mi->mbmi.sb_type];
|
||||
const int bh = block_size_high[mi->mbmi.sb_type];
|
||||
const TileInfo *const tile = &xd->tile;
|
||||
#if CONFIG_REF_MV
|
||||
POSITION mv_ref_search[MVREF_NEIGHBOURS];
|
||||
POSITION mv_ref_search[2];
|
||||
const int num_8x8_blocks_wide = mi_size_wide[mi->mbmi.sb_type];
|
||||
const int num_8x8_blocks_high = mi_size_high[mi->mbmi.sb_type];
|
||||
|
||||
mv_ref_search[0].row = num_8x8_blocks_high - 1;
|
||||
mv_ref_search[0].col = -1;
|
||||
mv_ref_search[1].row = -1;
|
||||
mv_ref_search[1].col = num_8x8_blocks_wide - 1;
|
||||
mv_ref_search[2].row = -1;
|
||||
mv_ref_search[2].col = (num_8x8_blocks_wide - 1) >> 1;
|
||||
mv_ref_search[3].row = (num_8x8_blocks_high - 1) >> 1;
|
||||
mv_ref_search[3].col = -1;
|
||||
mv_ref_search[4].row = -1;
|
||||
mv_ref_search[4].col = -1;
|
||||
#if CONFIG_EXT_PARTITION_TYPES
|
||||
if (num_8x8_blocks_wide == num_8x8_blocks_high) {
|
||||
mv_ref_search[5].row = -1;
|
||||
mv_ref_search[5].col = 0;
|
||||
mv_ref_search[6].row = 0;
|
||||
mv_ref_search[6].col = -1;
|
||||
} else {
|
||||
mv_ref_search[5].row = -1;
|
||||
mv_ref_search[5].col = num_8x8_blocks_wide;
|
||||
mv_ref_search[6].row = num_8x8_blocks_high;
|
||||
mv_ref_search[6].col = -1;
|
||||
}
|
||||
#else
|
||||
mv_ref_search[5].row = -1;
|
||||
mv_ref_search[5].col = num_8x8_blocks_wide;
|
||||
mv_ref_search[6].row = num_8x8_blocks_high;
|
||||
mv_ref_search[6].col = -1;
|
||||
#endif // CONFIG_EXT_PARTITION_TYPES
|
||||
mv_ref_search[7].row = -1;
|
||||
mv_ref_search[7].col = -3;
|
||||
mv_ref_search[8].row = num_8x8_blocks_high - 1;
|
||||
mv_ref_search[8].col = -3;
|
||||
#endif
|
||||
|
||||
// Blank the reference vector list
|
||||
memset(mv_ref_list, 0, sizeof(*mv_ref_list) * MAX_MV_REF_CANDIDATES);
|
||||
|
|
@ -859,12 +818,10 @@ Done:
|
|||
|
||||
void av1_find_mv_refs(const AV1_COMMON *cm, const MACROBLOCKD *xd,
|
||||
MODE_INFO *mi, MV_REFERENCE_FRAME ref_frame,
|
||||
#if CONFIG_REF_MV
|
||||
uint8_t *ref_mv_count, CANDIDATE_MV *ref_mv_stack,
|
||||
#if CONFIG_EXT_INTER
|
||||
int16_t *compound_mode_context,
|
||||
#endif // CONFIG_EXT_INTER
|
||||
#endif
|
||||
int_mv *mv_ref_list, int mi_row, int mi_col,
|
||||
find_mv_refs_sync sync, void *const data,
|
||||
int16_t *mode_context) {
|
||||
|
|
@ -872,23 +829,17 @@ void av1_find_mv_refs(const AV1_COMMON *cm, const MACROBLOCKD *xd,
|
|||
#if CONFIG_GLOBAL_MOTION
|
||||
BLOCK_SIZE bsize = mi->mbmi.sb_type;
|
||||
#endif // CONFIG_GLOBAL_MOTION
|
||||
#if CONFIG_REF_MV
|
||||
int idx, all_zero = 1;
|
||||
#if CONFIG_GLOBAL_MOTION
|
||||
MV_REFERENCE_FRAME rf[2];
|
||||
#endif // CONFIG_GLOBAL_MOTION
|
||||
#endif // CONFIG_REF_MV
|
||||
|
||||
#if CONFIG_EXT_INTER
|
||||
av1_update_mv_context(cm, xd, mi, ref_frame, mv_ref_list, -1, mi_row, mi_col,
|
||||
#if CONFIG_REF_MV
|
||||
compound_mode_context);
|
||||
#else
|
||||
mode_context);
|
||||
#endif // CONFIG_REF_MV
|
||||
#endif // CONFIG_EXT_INTER
|
||||
|
||||
#if CONFIG_GLOBAL_MOTION
|
||||
#if CONFIG_REF_MV
|
||||
av1_set_ref_frame(rf, ref_frame);
|
||||
zeromv[0].as_int = gm_get_motion_vector(&cm->global_motion[rf[0]],
|
||||
cm->allow_high_precision_mv, bsize,
|
||||
|
|
@ -900,24 +851,14 @@ void av1_find_mv_refs(const AV1_COMMON *cm, const MACROBLOCKD *xd,
|
|||
bsize, mi_col, mi_row, 0)
|
||||
.as_int
|
||||
: 0;
|
||||
#else
|
||||
zeromv[0].as_int = gm_get_motion_vector(&cm->global_motion[ref_frame],
|
||||
cm->allow_high_precision_mv, bsize,
|
||||
mi_col, mi_row, 0)
|
||||
.as_int;
|
||||
zeromv[1].as_int = 0;
|
||||
#endif // CONFIG_REF_MV
|
||||
#else
|
||||
zeromv[0].as_int = zeromv[1].as_int = 0;
|
||||
#endif // CONFIG_GLOBAL_MOTION
|
||||
|
||||
#if CONFIG_REF_MV
|
||||
if (ref_frame <= ALTREF_FRAME)
|
||||
#endif // CONFIG_REF_MV
|
||||
find_mv_refs_idx(cm, xd, mi, ref_frame, mv_ref_list, -1, mi_row, mi_col,
|
||||
sync, data, mode_context, zeromv[0]);
|
||||
|
||||
#if CONFIG_REF_MV
|
||||
setup_ref_mv_list(cm, xd, ref_frame, ref_mv_count, ref_mv_stack, mv_ref_list,
|
||||
-1, mi_row, mi_col, mode_context);
|
||||
/* Note: If global motion is enabled, then we want to set the ALL_ZERO flag
|
||||
|
|
@ -947,7 +888,6 @@ void av1_find_mv_refs(const AV1_COMMON *cm, const MACROBLOCKD *xd,
|
|||
}
|
||||
|
||||
if (all_zero) mode_context[ref_frame] |= (1 << ALL_ZERO_FLAG_OFFSET);
|
||||
#endif
|
||||
}
|
||||
|
||||
void av1_find_best_ref_mvs(int allow_hp, int_mv *mvlist, int_mv *nearest_mv,
|
||||
|
|
@ -963,10 +903,8 @@ void av1_find_best_ref_mvs(int allow_hp, int_mv *mvlist, int_mv *nearest_mv,
|
|||
|
||||
void av1_append_sub8x8_mvs_for_idx(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
||||
int block, int ref, int mi_row, int mi_col,
|
||||
#if CONFIG_REF_MV
|
||||
CANDIDATE_MV *ref_mv_stack,
|
||||
uint8_t *ref_mv_count,
|
||||
#endif
|
||||
#if CONFIG_EXT_INTER
|
||||
int_mv *mv_list,
|
||||
#endif // CONFIG_EXT_INTER
|
||||
|
|
@ -978,13 +916,11 @@ void av1_append_sub8x8_mvs_for_idx(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
|||
b_mode_info *bmi = mi->bmi;
|
||||
int n;
|
||||
int_mv zeromv;
|
||||
#if CONFIG_REF_MV
|
||||
CANDIDATE_MV tmp_mv;
|
||||
uint8_t idx;
|
||||
uint8_t above_count = 0, left_count = 0;
|
||||
MV_REFERENCE_FRAME rf[2] = { mi->mbmi.ref_frame[ref], NONE_FRAME };
|
||||
*ref_mv_count = 0;
|
||||
#endif
|
||||
|
||||
assert(MAX_MV_REF_CANDIDATES == 2);
|
||||
|
||||
|
|
@ -999,7 +935,6 @@ void av1_append_sub8x8_mvs_for_idx(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
|||
find_mv_refs_idx(cm, xd, mi, mi->mbmi.ref_frame[ref], mv_list, block, mi_row,
|
||||
mi_col, NULL, NULL, NULL, zeromv);
|
||||
|
||||
#if CONFIG_REF_MV
|
||||
scan_blk_mbmi(cm, xd, mi_row, mi_col, block, rf, -1, 0, ref_mv_stack,
|
||||
ref_mv_count);
|
||||
above_count = *ref_mv_count;
|
||||
|
|
@ -1020,7 +955,6 @@ void av1_append_sub8x8_mvs_for_idx(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
|||
|
||||
for (idx = 0; idx < AOMMIN(MAX_MV_REF_CANDIDATES, *ref_mv_count); ++idx)
|
||||
mv_list[idx].as_int = ref_mv_stack[idx].this_mv.as_int;
|
||||
#endif
|
||||
|
||||
near_mv->as_int = 0;
|
||||
switch (block) {
|
||||
|
|
|
|||
190
third_party/aom/av1/common/mvref_common.h
vendored
190
third_party/aom/av1/common/mvref_common.h
vendored
|
|
@ -18,11 +18,7 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if CONFIG_REF_MV
|
||||
#define MVREF_NEIGHBOURS 9
|
||||
#else
|
||||
#define MVREF_NEIGHBOURS 8
|
||||
#endif
|
||||
|
||||
typedef struct position {
|
||||
int row;
|
||||
|
|
@ -45,7 +41,7 @@ typedef enum {
|
|||
// 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[MB_MODE_COUNT] = {
|
||||
static const int mode_2_counter[] = {
|
||||
9, // DC_PRED
|
||||
9, // V_PRED
|
||||
9, // H_PRED
|
||||
|
|
@ -56,7 +52,11 @@ static const int mode_2_counter[MB_MODE_COUNT] = {
|
|||
9, // D207_PRED
|
||||
9, // D63_PRED
|
||||
#if CONFIG_ALT_INTRA
|
||||
9, // SMOOTH_PRED
|
||||
9, // SMOOTH_PRED
|
||||
#if CONFIG_SMOOTH_HV
|
||||
9, // SMOOTH_V_PRED
|
||||
9, // SMOOTH_H_PRED
|
||||
#endif // CONFIG_SMOOTH_HV
|
||||
#endif // CONFIG_ALT_INTRA
|
||||
9, // TM_PRED
|
||||
0, // NEARESTMV
|
||||
|
|
@ -72,8 +72,6 @@ static const int mode_2_counter[MB_MODE_COUNT] = {
|
|||
1, // SR_NEW_NEWMV
|
||||
#endif // CONFIG_COMPOUND_SINGLEREF
|
||||
0, // NEAREST_NEARESTMV
|
||||
0, // NEAREST_NEARMV
|
||||
0, // NEAR_NEARESTMV
|
||||
0, // NEAR_NEARMV
|
||||
1, // NEAREST_NEWMV
|
||||
1, // NEW_NEARESTMV
|
||||
|
|
@ -109,158 +107,6 @@ static const int counter_to_context[19] = {
|
|||
BOTH_INTRA // 18
|
||||
};
|
||||
|
||||
#if !CONFIG_REF_MV
|
||||
static const POSITION mv_ref_blocks[BLOCK_SIZES][MVREF_NEIGHBOURS] = {
|
||||
// 4X4
|
||||
{ { -1, 0 },
|
||||
{ 0, -1 },
|
||||
{ -1, -1 },
|
||||
{ -2, 0 },
|
||||
{ 0, -2 },
|
||||
{ -2, -1 },
|
||||
{ -1, -2 },
|
||||
{ -2, -2 } },
|
||||
// 4X8
|
||||
{ { -1, 0 },
|
||||
{ 0, -1 },
|
||||
{ -1, -1 },
|
||||
{ -2, 0 },
|
||||
{ 0, -2 },
|
||||
{ -2, -1 },
|
||||
{ -1, -2 },
|
||||
{ -2, -2 } },
|
||||
// 8X4
|
||||
{ { -1, 0 },
|
||||
{ 0, -1 },
|
||||
{ -1, -1 },
|
||||
{ -2, 0 },
|
||||
{ 0, -2 },
|
||||
{ -2, -1 },
|
||||
{ -1, -2 },
|
||||
{ -2, -2 } },
|
||||
// 8X8
|
||||
{ { -1, 0 },
|
||||
{ 0, -1 },
|
||||
{ -1, -1 },
|
||||
{ -2, 0 },
|
||||
{ 0, -2 },
|
||||
{ -2, -1 },
|
||||
{ -1, -2 },
|
||||
{ -2, -2 } },
|
||||
// 8X16
|
||||
{ { 0, -1 },
|
||||
{ -1, 0 },
|
||||
{ 1, -1 },
|
||||
{ -1, -1 },
|
||||
{ 0, -2 },
|
||||
{ -2, 0 },
|
||||
{ -2, -1 },
|
||||
{ -1, -2 } },
|
||||
// 16X8
|
||||
{ { -1, 0 },
|
||||
{ 0, -1 },
|
||||
{ -1, 1 },
|
||||
{ -1, -1 },
|
||||
{ -2, 0 },
|
||||
{ 0, -2 },
|
||||
{ -1, -2 },
|
||||
{ -2, -1 } },
|
||||
// 16X16
|
||||
{ { -1, 0 },
|
||||
{ 0, -1 },
|
||||
{ -1, 1 },
|
||||
{ 1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -3, 0 },
|
||||
{ 0, -3 },
|
||||
{ -3, -3 } },
|
||||
// 16X32
|
||||
{ { 0, -1 },
|
||||
{ -1, 0 },
|
||||
{ 2, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, 1 },
|
||||
{ 0, -3 },
|
||||
{ -3, 0 },
|
||||
{ -3, -3 } },
|
||||
// 32X16
|
||||
{ { -1, 0 },
|
||||
{ 0, -1 },
|
||||
{ -1, 2 },
|
||||
{ -1, -1 },
|
||||
{ 1, -1 },
|
||||
{ -3, 0 },
|
||||
{ 0, -3 },
|
||||
{ -3, -3 } },
|
||||
// 32X32
|
||||
{ { -1, 1 },
|
||||
{ 1, -1 },
|
||||
{ -1, 2 },
|
||||
{ 2, -1 },
|
||||
{ -1, -1 },
|
||||
{ -3, 0 },
|
||||
{ 0, -3 },
|
||||
{ -3, -3 } },
|
||||
// 32X64
|
||||
{ { 0, -1 },
|
||||
{ -1, 0 },
|
||||
{ 4, -1 },
|
||||
{ -1, 2 },
|
||||
{ -1, -1 },
|
||||
{ 0, -3 },
|
||||
{ -3, 0 },
|
||||
{ 2, -1 } },
|
||||
// 64X32
|
||||
{ { -1, 0 },
|
||||
{ 0, -1 },
|
||||
{ -1, 4 },
|
||||
{ 2, -1 },
|
||||
{ -1, -1 },
|
||||
{ -3, 0 },
|
||||
{ 0, -3 },
|
||||
{ -1, 2 } },
|
||||
// 64X64
|
||||
{ { -1, 3 },
|
||||
{ 3, -1 },
|
||||
{ -1, 4 },
|
||||
{ 4, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, 0 },
|
||||
{ 0, -1 },
|
||||
{ -1, 6 } },
|
||||
#if CONFIG_EXT_PARTITION
|
||||
// TODO(debargha/jingning) Making them twice the 32x64, .. ones above
|
||||
// 64x128
|
||||
{ { 0, -2 },
|
||||
{ -2, 0 },
|
||||
{ 8, -2 },
|
||||
{ -2, 4 },
|
||||
{ -2, -2 },
|
||||
{ 0, -6 },
|
||||
{ -6, 0 },
|
||||
{ 4, -2 } },
|
||||
// 128x64
|
||||
{ { -2, 0 },
|
||||
{ 0, -2 },
|
||||
{ -2, 8 },
|
||||
{ 4, -2 },
|
||||
{ -2, -2 },
|
||||
{ -6, 0 },
|
||||
{ 0, -6 },
|
||||
{ -2, 4 } },
|
||||
// 128x128
|
||||
{ { -2, 6 },
|
||||
{ 6, -2 },
|
||||
{ -2, 8 },
|
||||
{ 8, -2 },
|
||||
{ -2, -2 },
|
||||
{ -2, 0 },
|
||||
{ 0, -2 },
|
||||
{ -2, 12 } },
|
||||
#endif // CONFIG_EXT_PARTITION
|
||||
};
|
||||
#endif
|
||||
|
||||
static const int idx_n_column_to_subblock[4][2] = {
|
||||
{ 1, 2 }, { 1, 3 }, { 3, 2 }, { 3, 3 }
|
||||
};
|
||||
|
|
@ -283,20 +129,11 @@ static INLINE void clamp_mv_ref(MV *mv, int bw, int bh, const MACROBLOCKD *xd) {
|
|||
// 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) {
|
||||
#if CONFIG_REF_MV
|
||||
(void)search_col;
|
||||
(void)block_idx;
|
||||
return candidate->mbmi.mv[which_mv];
|
||||
#else
|
||||
return block_idx >= 0 && candidate->mbmi.sb_type < BLOCK_8X8
|
||||
? candidate
|
||||
->bmi[idx_n_column_to_subblock[block_idx][search_col == 0]]
|
||||
.as_mv[which_mv]
|
||||
: candidate->mbmi.mv[which_mv];
|
||||
#endif
|
||||
}
|
||||
|
||||
#if CONFIG_REF_MV
|
||||
static INLINE int_mv get_sub_block_pred_mv(const MODE_INFO *candidate,
|
||||
int which_mv, int search_col,
|
||||
int block_idx) {
|
||||
|
|
@ -304,7 +141,6 @@ static INLINE int_mv get_sub_block_pred_mv(const MODE_INFO *candidate,
|
|||
(void)block_idx;
|
||||
return candidate->mbmi.mv[which_mv];
|
||||
}
|
||||
#endif
|
||||
|
||||
// Performs mv sign inversion if indicated by the reference frame combination.
|
||||
static INLINE int_mv scale_mv(const MB_MODE_INFO *mbmi, int ref,
|
||||
|
|
@ -384,7 +220,6 @@ static INLINE void lower_mv_precision(MV *mv, int allow_hp) {
|
|||
}
|
||||
}
|
||||
|
||||
#if CONFIG_REF_MV
|
||||
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 &&
|
||||
|
|
@ -434,8 +269,12 @@ static INLINE void av1_set_ref_frame(MV_REFERENCE_FRAME *rf,
|
|||
} else {
|
||||
rf[0] = ref_frame_type;
|
||||
rf[1] = NONE_FRAME;
|
||||
assert(ref_frame_type > INTRA_FRAME &&
|
||||
ref_frame_type < TOTAL_REFS_PER_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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -477,17 +316,14 @@ static INLINE uint8_t av1_drl_ctx(const CANDIDATE_MV *ref_mv_stack,
|
|||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
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,
|
||||
#if CONFIG_REF_MV
|
||||
uint8_t *ref_mv_count, CANDIDATE_MV *ref_mv_stack,
|
||||
#if CONFIG_EXT_INTER
|
||||
int16_t *compound_mode_context,
|
||||
#endif // CONFIG_EXT_INTER
|
||||
#endif
|
||||
int_mv *mv_ref_list, int mi_row, int mi_col,
|
||||
find_mv_refs_sync sync, void *const data,
|
||||
int16_t *mode_context);
|
||||
|
|
@ -500,10 +336,8 @@ void av1_find_best_ref_mvs(int allow_hp, int_mv *mvlist, int_mv *nearest_mv,
|
|||
|
||||
void av1_append_sub8x8_mvs_for_idx(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
||||
int block, int ref, int mi_row, int mi_col,
|
||||
#if CONFIG_REF_MV
|
||||
CANDIDATE_MV *ref_mv_stack,
|
||||
uint8_t *ref_mv_count,
|
||||
#endif
|
||||
#if CONFIG_EXT_INTER
|
||||
int_mv *mv_list,
|
||||
#endif // CONFIG_EXT_INTER
|
||||
|
|
|
|||
3
third_party/aom/av1/common/odintrin.h
vendored
3
third_party/aom/av1/common/odintrin.h
vendored
|
|
@ -14,6 +14,9 @@
|
|||
#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>
|
||||
|
|
|
|||
112
third_party/aom/av1/common/onyxc_int.h
vendored
112
third_party/aom/av1/common/onyxc_int.h
vendored
|
|
@ -100,9 +100,7 @@ typedef enum {
|
|||
|
||||
typedef struct {
|
||||
int_mv mv[2];
|
||||
#if CONFIG_REF_MV
|
||||
int_mv pred_mv[2];
|
||||
#endif
|
||||
MV_REFERENCE_FRAME ref_frame[2];
|
||||
} MV_REF;
|
||||
|
||||
|
|
@ -163,12 +161,6 @@ typedef struct AV1Common {
|
|||
int last_width;
|
||||
int last_height;
|
||||
|
||||
#if CONFIG_FRAME_SUPERRES
|
||||
// The numerator of the superres scale, the denominator is fixed
|
||||
uint8_t superres_scale_numerator;
|
||||
int superres_width, superres_height;
|
||||
#endif // CONFIG_FRAME_SUPERRES
|
||||
|
||||
// TODO(jkoleszar): this implies chroma ss right now, but could vary per
|
||||
// plane. Revisit as part of the future change to YV12_BUFFER_CONFIG to
|
||||
// support additional planes.
|
||||
|
|
@ -216,9 +208,17 @@ typedef struct AV1Common {
|
|||
|
||||
int allow_high_precision_mv;
|
||||
|
||||
#if CONFIG_PALETTE
|
||||
#if CONFIG_PALETTE || CONFIG_INTRABC
|
||||
int allow_screen_content_tools;
|
||||
#endif // CONFIG_PALETTE
|
||||
#endif // CONFIG_PALETTE || CONFIG_INTRABC
|
||||
#if CONFIG_EXT_INTER
|
||||
#if CONFIG_INTERINTRA
|
||||
int allow_interintra_compound;
|
||||
#endif // CONFIG_INTERINTRA
|
||||
#if CONFIG_WEDGE || CONFIG_COMPOUND_SEGMENT
|
||||
int allow_masked_compound;
|
||||
#endif // CONFIG_WEDGE || CONFIG_COMPOUND_SEGMENT
|
||||
#endif // CONFIG_EXT_INTER
|
||||
|
||||
// Flag signaling which frame contexts should be reset to default values.
|
||||
RESET_FRAME_CONTEXT_MODE reset_frame_context;
|
||||
|
|
@ -242,15 +242,15 @@ typedef struct AV1Common {
|
|||
|
||||
#if CONFIG_AOM_QM
|
||||
// Global quant matrix tables
|
||||
qm_val_t *giqmatrix[NUM_QM_LEVELS][2][2][TX_SIZES];
|
||||
qm_val_t *gqmatrix[NUM_QM_LEVELS][2][2][TX_SIZES];
|
||||
qm_val_t *giqmatrix[NUM_QM_LEVELS][2][2][TX_SIZES_ALL];
|
||||
qm_val_t *gqmatrix[NUM_QM_LEVELS][2][2][TX_SIZES_ALL];
|
||||
|
||||
// Local quant matrix tables for each frame
|
||||
qm_val_t *y_iqmatrix[MAX_SEGMENTS][2][TX_SIZES];
|
||||
qm_val_t *uv_iqmatrix[MAX_SEGMENTS][2][TX_SIZES];
|
||||
qm_val_t *y_iqmatrix[MAX_SEGMENTS][2][TX_SIZES_ALL];
|
||||
qm_val_t *uv_iqmatrix[MAX_SEGMENTS][2][TX_SIZES_ALL];
|
||||
// Encoder
|
||||
qm_val_t *y_qmatrix[MAX_SEGMENTS][2][TX_SIZES];
|
||||
qm_val_t *uv_qmatrix[MAX_SEGMENTS][2][TX_SIZES];
|
||||
qm_val_t *y_qmatrix[MAX_SEGMENTS][2][TX_SIZES_ALL];
|
||||
qm_val_t *uv_qmatrix[MAX_SEGMENTS][2][TX_SIZES_ALL];
|
||||
|
||||
int using_qmatrix;
|
||||
int min_qmlevel;
|
||||
|
|
@ -299,6 +299,10 @@ typedef struct AV1Common {
|
|||
InterpFilter interp_filter;
|
||||
|
||||
loop_filter_info_n lf_info;
|
||||
#if CONFIG_FRAME_SUPERRES
|
||||
// The numerator of the superres scale; the denominator is fixed.
|
||||
uint8_t superres_scale_numerator;
|
||||
#endif // CONFIG_FRAME_SUPERRES
|
||||
#if CONFIG_LOOP_RESTORATION
|
||||
RestorationInfo rst_info[MAX_MB_PLANE];
|
||||
RestorationInternal rst_internal;
|
||||
|
|
@ -331,21 +335,10 @@ typedef struct AV1Common {
|
|||
|
||||
FRAME_CONTEXT *fc; /* this frame entropy */
|
||||
FRAME_CONTEXT *frame_contexts; // FRAME_CONTEXTS
|
||||
FRAME_CONTEXT *pre_fc; // Context referenced in this frame
|
||||
unsigned int frame_context_idx; /* Context to use/update */
|
||||
FRAME_COUNTS counts;
|
||||
|
||||
#if CONFIG_SUBFRAME_PROB_UPDATE
|
||||
// The initial probabilities for a frame, before any subframe backward update,
|
||||
// and after forward update.
|
||||
av1_coeff_probs_model starting_coef_probs[TX_SIZES][PLANE_TYPES];
|
||||
// Number of subframe backward updates already done
|
||||
uint8_t coef_probs_update_idx;
|
||||
// Signal if the backward update is subframe or end-of-frame
|
||||
uint8_t partial_prob_update;
|
||||
// Frame level flag to turn on/off subframe backward update
|
||||
uint8_t do_subframe_update;
|
||||
#endif // CONFIG_SUBFRAME_PROB_UPDATE
|
||||
|
||||
unsigned int current_video_frame;
|
||||
BITSTREAM_PROFILE profile;
|
||||
|
||||
|
|
@ -393,7 +386,8 @@ typedef struct AV1Common {
|
|||
ENTROPY_CONTEXT *above_context[MAX_MB_PLANE];
|
||||
#if CONFIG_VAR_TX
|
||||
TXFM_CONTEXT *above_txfm_context;
|
||||
TXFM_CONTEXT left_txfm_context[MAX_MIB_SIZE];
|
||||
TXFM_CONTEXT *top_txfm_context[MAX_MB_PLANE];
|
||||
TXFM_CONTEXT left_txfm_context[MAX_MB_PLANE][2 * MAX_MIB_SIZE];
|
||||
#endif
|
||||
int above_context_alloc_cols;
|
||||
|
||||
|
|
@ -576,17 +570,20 @@ static INLINE void av1_init_macroblockd(AV1_COMMON *cm, MACROBLOCKD *xd,
|
|||
|
||||
static INLINE void set_skip_context(MACROBLOCKD *xd, int mi_row, int mi_col) {
|
||||
int i;
|
||||
int row_offset = mi_row;
|
||||
int col_offset = mi_col;
|
||||
for (i = 0; i < MAX_MB_PLANE; ++i) {
|
||||
struct macroblockd_plane *const pd = &xd->plane[i];
|
||||
#if CONFIG_CHROMA_SUB8X8
|
||||
if (xd->mi[0]->mbmi.sb_type < BLOCK_8X8) {
|
||||
// Offset the buffer pointer
|
||||
if (pd->subsampling_y && (mi_row & 0x01)) mi_row -= 1;
|
||||
if (pd->subsampling_x && (mi_col & 0x01)) mi_col -= 1;
|
||||
if (pd->subsampling_y && (mi_row & 0x01)) row_offset = mi_row - 1;
|
||||
if (pd->subsampling_x && (mi_col & 0x01)) col_offset = mi_col - 1;
|
||||
}
|
||||
#endif
|
||||
int above_idx = mi_col * 2;
|
||||
int left_idx = (mi_row * 2) & MAX_MIB_MASK_2;
|
||||
int above_idx = col_offset << (MI_SIZE_LOG2 - tx_size_wide_log2[0]);
|
||||
int left_idx = (row_offset & MAX_MIB_MASK)
|
||||
<< (MI_SIZE_LOG2 - tx_size_high_log2[0]);
|
||||
pd->above_context = &xd->above_context[i][above_idx >> pd->subsampling_x];
|
||||
pd->left_context = &xd->left_context[i][left_idx >> pd->subsampling_y];
|
||||
}
|
||||
|
|
@ -668,14 +665,12 @@ static INLINE void set_mi_row_col(MACROBLOCKD *xd, const TileInfo *const tile,
|
|||
|
||||
xd->n8_h = bh;
|
||||
xd->n8_w = bw;
|
||||
#if CONFIG_REF_MV
|
||||
xd->is_sec_rect = 0;
|
||||
if (xd->n8_w < xd->n8_h)
|
||||
if (mi_col & (xd->n8_h - 1)) xd->is_sec_rect = 1;
|
||||
|
||||
if (xd->n8_w > xd->n8_h)
|
||||
if (mi_row & (xd->n8_w - 1)) xd->is_sec_rect = 1;
|
||||
#endif // CONFIG_REF_MV
|
||||
}
|
||||
|
||||
static INLINE const aom_prob *get_y_mode_probs(const AV1_COMMON *cm,
|
||||
|
|
@ -688,7 +683,6 @@ static INLINE const aom_prob *get_y_mode_probs(const AV1_COMMON *cm,
|
|||
return cm->kf_y_prob[above][left];
|
||||
}
|
||||
|
||||
#if CONFIG_EC_MULTISYMBOL
|
||||
static INLINE aom_cdf_prob *get_y_mode_cdf(FRAME_CONTEXT *tile_ctx,
|
||||
const MODE_INFO *mi,
|
||||
const MODE_INFO *above_mi,
|
||||
|
|
@ -698,7 +692,6 @@ static INLINE aom_cdf_prob *get_y_mode_cdf(FRAME_CONTEXT *tile_ctx,
|
|||
const PREDICTION_MODE left = av1_left_block_mode(mi, left_mi, block);
|
||||
return tile_ctx->kf_y_cdf[above][left];
|
||||
}
|
||||
#endif
|
||||
|
||||
static INLINE void update_partition_context(MACROBLOCKD *xd, int mi_row,
|
||||
int mi_col, BLOCK_SIZE subsize,
|
||||
|
|
@ -873,8 +866,8 @@ static INLINE void av1_zero_above_context(AV1_COMMON *const cm,
|
|||
const int width = mi_col_end - mi_col_start;
|
||||
const int aligned_width = ALIGN_POWER_OF_TWO(width, cm->mib_size_log2);
|
||||
|
||||
const int offset_y = 2 * mi_col_start;
|
||||
const int width_y = 2 * aligned_width;
|
||||
const int offset_y = mi_col_start << (MI_SIZE_LOG2 - tx_size_wide_log2[0]);
|
||||
const int width_y = aligned_width << (MI_SIZE_LOG2 - tx_size_wide_log2[0]);
|
||||
const int offset_uv = offset_y >> cm->subsampling_x;
|
||||
const int width_uv = width_y >> cm->subsampling_x;
|
||||
|
||||
|
|
@ -885,7 +878,8 @@ static INLINE void av1_zero_above_context(AV1_COMMON *const cm,
|
|||
av1_zero_array(cm->above_seg_context + mi_col_start, aligned_width);
|
||||
|
||||
#if CONFIG_VAR_TX
|
||||
av1_zero_array(cm->above_txfm_context + mi_col_start, aligned_width);
|
||||
av1_zero_array(cm->above_txfm_context + (mi_col_start << TX_UNIT_WIDE_LOG2),
|
||||
aligned_width << TX_UNIT_WIDE_LOG2);
|
||||
#endif // CONFIG_VAR_TX
|
||||
}
|
||||
|
||||
|
|
@ -899,7 +893,7 @@ static INLINE void av1_zero_left_context(MACROBLOCKD *const xd) {
|
|||
|
||||
#if CONFIG_VAR_TX
|
||||
static INLINE TX_SIZE get_min_tx_size(TX_SIZE tx_size) {
|
||||
if (tx_size >= TX_SIZES_ALL) assert(0);
|
||||
assert(tx_size < TX_SIZES_ALL);
|
||||
return txsize_sqr_map[tx_size];
|
||||
}
|
||||
|
||||
|
|
@ -918,16 +912,16 @@ static INLINE void set_txfm_ctxs(TX_SIZE tx_size, int n8_w, int n8_h, int skip,
|
|||
bh = n8_h * MI_SIZE;
|
||||
}
|
||||
|
||||
set_txfm_ctx(xd->above_txfm_context, bw, n8_w);
|
||||
set_txfm_ctx(xd->left_txfm_context, bh, n8_h);
|
||||
set_txfm_ctx(xd->above_txfm_context, bw, n8_w << TX_UNIT_WIDE_LOG2);
|
||||
set_txfm_ctx(xd->left_txfm_context, bh, n8_h << TX_UNIT_HIGH_LOG2);
|
||||
}
|
||||
|
||||
static INLINE void txfm_partition_update(TXFM_CONTEXT *above_ctx,
|
||||
TXFM_CONTEXT *left_ctx,
|
||||
TX_SIZE tx_size, TX_SIZE txb_size) {
|
||||
BLOCK_SIZE bsize = txsize_to_bsize[txb_size];
|
||||
int bh = mi_size_high[bsize];
|
||||
int bw = mi_size_wide[bsize];
|
||||
int bh = mi_size_high[bsize] << TX_UNIT_HIGH_LOG2;
|
||||
int bw = mi_size_wide[bsize] << TX_UNIT_WIDE_LOG2;
|
||||
uint8_t txw = tx_size_wide[tx_size];
|
||||
uint8_t txh = tx_size_high[tx_size];
|
||||
int i;
|
||||
|
|
@ -935,6 +929,21 @@ static INLINE void txfm_partition_update(TXFM_CONTEXT *above_ctx,
|
|||
for (i = 0; i < bw; ++i) above_ctx[i] = txw;
|
||||
}
|
||||
|
||||
static INLINE TX_SIZE get_sqr_tx_size(int tx_dim) {
|
||||
TX_SIZE tx_size;
|
||||
switch (tx_dim) {
|
||||
#if CONFIG_EXT_PARTITION
|
||||
case 128:
|
||||
#endif
|
||||
case 64:
|
||||
case 32: tx_size = TX_32X32; break;
|
||||
case 16: tx_size = TX_16X16; break;
|
||||
case 8: tx_size = TX_8X8; break;
|
||||
default: tx_size = TX_4X4;
|
||||
}
|
||||
return tx_size;
|
||||
}
|
||||
|
||||
static INLINE int txfm_partition_context(TXFM_CONTEXT *above_ctx,
|
||||
TXFM_CONTEXT *left_ctx,
|
||||
BLOCK_SIZE bsize, TX_SIZE tx_size) {
|
||||
|
|
@ -942,22 +951,13 @@ static INLINE int txfm_partition_context(TXFM_CONTEXT *above_ctx,
|
|||
const uint8_t txh = tx_size_high[tx_size];
|
||||
const int above = *above_ctx < txw;
|
||||
const int left = *left_ctx < txh;
|
||||
TX_SIZE max_tx_size = max_txsize_lookup[bsize];
|
||||
int category = TXFM_PARTITION_CONTEXTS - 1;
|
||||
|
||||
// dummy return, not used by others.
|
||||
if (tx_size <= TX_4X4) return 0;
|
||||
|
||||
switch (AOMMAX(block_size_wide[bsize], block_size_high[bsize])) {
|
||||
#if CONFIG_EXT_PARTITION
|
||||
case 128:
|
||||
#endif
|
||||
case 64:
|
||||
case 32: max_tx_size = TX_32X32; break;
|
||||
case 16: max_tx_size = TX_16X16; break;
|
||||
case 8: max_tx_size = TX_8X8; break;
|
||||
default: assert(0);
|
||||
}
|
||||
TX_SIZE max_tx_size =
|
||||
get_sqr_tx_size(AOMMAX(block_size_wide[bsize], block_size_high[bsize]));
|
||||
|
||||
if (max_tx_size >= TX_8X8) {
|
||||
category = (tx_size != max_tx_size && max_tx_size > TX_8X8) +
|
||||
|
|
|
|||
58
third_party/aom/av1/common/pred_common.c
vendored
58
third_party/aom/av1/common/pred_common.c
vendored
|
|
@ -153,6 +153,48 @@ int av1_get_pred_context_intra_interp(const MACROBLOCKD *xd) {
|
|||
#endif // CONFIG_INTRA_INTERP
|
||||
#endif // CONFIG_EXT_INTRA
|
||||
|
||||
#if CONFIG_PALETTE && CONFIG_PALETTE_DELTA_ENCODING
|
||||
int av1_get_palette_cache(const MODE_INFO *above_mi, const MODE_INFO *left_mi,
|
||||
int plane, uint16_t *cache) {
|
||||
int above_n = 0, left_n = 0;
|
||||
if (above_mi)
|
||||
above_n = above_mi->mbmi.palette_mode_info.palette_size[plane != 0];
|
||||
if (left_mi)
|
||||
left_n = left_mi->mbmi.palette_mode_info.palette_size[plane != 0];
|
||||
if (above_n == 0 && left_n == 0) return 0;
|
||||
int above_idx = plane * PALETTE_MAX_SIZE;
|
||||
int left_idx = plane * PALETTE_MAX_SIZE;
|
||||
int n = 0;
|
||||
const uint16_t *above_colors =
|
||||
above_mi->mbmi.palette_mode_info.palette_colors;
|
||||
const uint16_t *left_colors = left_mi->mbmi.palette_mode_info.palette_colors;
|
||||
// Merge the sorted lists of base colors from above and left to get
|
||||
// combined sorted color cache.
|
||||
while (above_n > 0 && left_n > 0) {
|
||||
uint16_t v_above = above_colors[above_idx];
|
||||
uint16_t v_left = left_colors[left_idx];
|
||||
if (v_left < v_above) {
|
||||
if (n == 0 || v_left != cache[n - 1]) cache[n++] = v_left;
|
||||
++left_idx, --left_n;
|
||||
} else {
|
||||
if (n == 0 || v_above != cache[n - 1]) cache[n++] = v_above;
|
||||
++above_idx, --above_n;
|
||||
if (v_left == v_above) ++left_idx, --left_n;
|
||||
}
|
||||
}
|
||||
while (above_n-- > 0) {
|
||||
uint16_t val = above_colors[above_idx++];
|
||||
if (n == 0 || val != cache[n - 1]) cache[n++] = val;
|
||||
}
|
||||
while (left_n-- > 0) {
|
||||
uint16_t val = left_colors[left_idx++];
|
||||
if (n == 0 || val != cache[n - 1]) cache[n++] = val;
|
||||
}
|
||||
assert(n <= 2 * PALETTE_MAX_SIZE);
|
||||
return n;
|
||||
}
|
||||
#endif // CONFIG_PALETTE && CONFIG_PALETTE_DELTA_ENCODING
|
||||
|
||||
// The mode info data structure has a one element border above and to the
|
||||
// left of the entries corresponding to real macroblocks.
|
||||
// The prediction flags in these dummy entries are initialized to 0.
|
||||
|
|
@ -278,7 +320,7 @@ int av1_get_reference_mode_context(const AV1_COMMON *cm,
|
|||
//
|
||||
// NOTE(zoeliu): The probability of ref_frame[0] is either
|
||||
// GOLDEN_FRAME or LAST3_FRAME.
|
||||
#if CONFIG_LOWDELAY_COMPOUND
|
||||
#if CONFIG_ONE_SIDED_COMPOUND
|
||||
int av1_get_pred_context_comp_ref_p(UNUSED const AV1_COMMON *cm,
|
||||
const MACROBLOCKD *xd) {
|
||||
#else
|
||||
|
|
@ -295,7 +337,7 @@ int av1_get_pred_context_comp_ref_p(const AV1_COMMON *cm,
|
|||
// The mode info data structure has a one element border above and to the
|
||||
// left of the entries correpsonding to real macroblocks.
|
||||
// The prediction flags in these dummy entries are initialised to 0.
|
||||
#if CONFIG_LOWDELAY_COMPOUND // No change to bitstream
|
||||
#if CONFIG_ONE_SIDED_COMPOUND // No change to bitstream
|
||||
// Code seems to assume that signbias of cm->comp_bwd_ref[0] is always 1
|
||||
const int bwd_ref_sign_idx = 1;
|
||||
#else
|
||||
|
|
@ -388,7 +430,7 @@ int av1_get_pred_context_comp_ref_p(const AV1_COMMON *cm,
|
|||
//
|
||||
// NOTE(zoeliu): The probability of ref_frame[0] is LAST_FRAME,
|
||||
// conditioning on it is either LAST_FRAME or LAST2_FRAME.
|
||||
#if CONFIG_LOWDELAY_COMPOUND
|
||||
#if CONFIG_ONE_SIDED_COMPOUND
|
||||
int av1_get_pred_context_comp_ref_p1(UNUSED const AV1_COMMON *cm,
|
||||
const MACROBLOCKD *xd) {
|
||||
#else
|
||||
|
|
@ -405,7 +447,7 @@ int av1_get_pred_context_comp_ref_p1(const AV1_COMMON *cm,
|
|||
// The mode info data structure has a one element border above and to the
|
||||
// left of the entries correpsonding to real macroblocks.
|
||||
// The prediction flags in these dummy entries are initialised to 0.
|
||||
#if CONFIG_LOWDELAY_COMPOUND // No change to bitstream
|
||||
#if CONFIG_ONE_SIDED_COMPOUND // No change to bitstream
|
||||
// Code seems to assume that signbias of cm->comp_bwd_ref[0] is always 1
|
||||
const int bwd_ref_sign_idx = 1;
|
||||
#else
|
||||
|
|
@ -499,7 +541,7 @@ int av1_get_pred_context_comp_ref_p1(const AV1_COMMON *cm,
|
|||
//
|
||||
// NOTE(zoeliu): The probability of ref_frame[0] is GOLDEN_FRAME,
|
||||
// conditioning on it is either GOLDEN or LAST3.
|
||||
#if CONFIG_LOWDELAY_COMPOUND
|
||||
#if CONFIG_ONE_SIDED_COMPOUND
|
||||
int av1_get_pred_context_comp_ref_p2(UNUSED const AV1_COMMON *cm,
|
||||
const MACROBLOCKD *xd) {
|
||||
#else
|
||||
|
|
@ -516,7 +558,7 @@ int av1_get_pred_context_comp_ref_p2(const AV1_COMMON *cm,
|
|||
// The mode info data structure has a one element border above and to the
|
||||
// left of the entries correpsonding to real macroblocks.
|
||||
// The prediction flags in these dummy entries are initialised to 0.
|
||||
#if CONFIG_LOWDELAY_COMPOUND // No change to bitstream
|
||||
#if CONFIG_ONE_SIDED_COMPOUND // No change to bitstream
|
||||
// Code seems to assume that signbias of cm->comp_bwd_ref[0] is always 1
|
||||
const int bwd_ref_sign_idx = 1;
|
||||
#else
|
||||
|
|
@ -604,7 +646,7 @@ int av1_get_pred_context_comp_ref_p2(const AV1_COMMON *cm,
|
|||
}
|
||||
|
||||
// Returns a context number for the given MB prediction signal
|
||||
#if CONFIG_LOWDELAY_COMPOUND
|
||||
#if CONFIG_ONE_SIDED_COMPOUND
|
||||
int av1_get_pred_context_comp_bwdref_p(UNUSED const AV1_COMMON *cm,
|
||||
const MACROBLOCKD *xd) {
|
||||
#else
|
||||
|
|
@ -621,7 +663,7 @@ int av1_get_pred_context_comp_bwdref_p(const AV1_COMMON *cm,
|
|||
// The mode info data structure has a one element border above and to the
|
||||
// left of the entries corresponding to real macroblocks.
|
||||
// The prediction flags in these dummy entries are initialized to 0.
|
||||
#if CONFIG_LOWDELAY_COMPOUND // No change to bitstream
|
||||
#if CONFIG_ONE_SIDED_COMPOUND // No change to bitstream
|
||||
// Code seems to assume that signbias of cm->comp_bwd_ref[0] is always 1
|
||||
const int bwd_ref_sign_idx = 1;
|
||||
#else
|
||||
|
|
|
|||
21
third_party/aom/av1/common/pred_common.h
vendored
21
third_party/aom/av1/common/pred_common.h
vendored
|
|
@ -79,6 +79,15 @@ int av1_get_pred_context_intra_interp(const MACROBLOCKD *xd);
|
|||
#endif // CONFIG_INTRA_INTERP
|
||||
#endif // CONFIG_EXT_INTRA
|
||||
|
||||
#if CONFIG_PALETTE && 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 MODE_INFO *above_mi, const MODE_INFO *left_mi,
|
||||
int plane, uint16_t *cache);
|
||||
#endif // CONFIG_PALETTE && CONFIG_PALETTE_DELTA_ENCODING
|
||||
|
||||
int av1_get_intra_inter_context(const MACROBLOCKD *xd);
|
||||
|
||||
static INLINE aom_prob av1_get_intra_inter_prob(const AV1_COMMON *cm,
|
||||
|
|
@ -197,13 +206,7 @@ static INLINE int get_tx_size_context(const MACROBLOCKD *xd) {
|
|||
if (!has_left) left_ctx = above_ctx;
|
||||
|
||||
if (!has_above) above_ctx = left_ctx;
|
||||
#if CONFIG_CB4X4
|
||||
// TODO(jingning): Temporary setup. Will rework this after the cb4x4
|
||||
// framework is up running.
|
||||
return (above_ctx + left_ctx) > max_tx_size + 1;
|
||||
#else
|
||||
return (above_ctx + left_ctx) > max_tx_size;
|
||||
#endif
|
||||
return (above_ctx + left_ctx) > max_tx_size + TX_SIZE_LUMA_MIN;
|
||||
}
|
||||
|
||||
#if CONFIG_VAR_TX
|
||||
|
|
@ -222,7 +225,9 @@ static void update_tx_counts(AV1_COMMON *cm, MACROBLOCKD *xd,
|
|||
if (blk_row >= max_blocks_high || blk_col >= max_blocks_wide) return;
|
||||
|
||||
if (tx_size == plane_tx_size) {
|
||||
++xd->counts->tx_size[max_tx_size - TX_8X8][ctx][tx_size];
|
||||
int depth;
|
||||
depth = tx_size_to_depth(tx_size);
|
||||
++xd->counts->tx_size[max_tx_size - TX_SIZE_CTX_MIN][ctx][depth];
|
||||
mbmi->tx_size = tx_size;
|
||||
} else {
|
||||
int bsl = b_width_log2_lookup[bsize];
|
||||
|
|
|
|||
24843
third_party/aom/av1/common/quant_common.c
vendored
24843
third_party/aom/av1/common/quant_common.c
vendored
File diff suppressed because it is too large
Load diff
14
third_party/aom/av1/common/quant_common.h
vendored
14
third_party/aom/av1/common/quant_common.h
vendored
|
|
@ -29,11 +29,11 @@ extern "C" {
|
|||
// Total number of QM sets stored
|
||||
#define QM_LEVEL_BITS 4
|
||||
#define NUM_QM_LEVELS (1 << QM_LEVEL_BITS)
|
||||
/* Offset into the list of QMs. Actual number of levels used is
|
||||
(NUM_QM_LEVELS-AOM_QM_OFFSET)
|
||||
Lower value of AOM_QM_OFFSET implies more heavily weighted matrices.*/
|
||||
#define DEFAULT_QM_FIRST (NUM_QM_LEVELS / 2)
|
||||
#define DEFAULT_QM_LAST (NUM_QM_LEVELS - 1)
|
||||
/* Range of QMS is between first and last value, with offset applied to inter
|
||||
* blocks*/
|
||||
#define DEFAULT_QM_FIRST 5
|
||||
#define DEFAULT_QM_LAST 9
|
||||
#define DEFAULT_QM_INTER_OFFSET 0
|
||||
#endif
|
||||
|
||||
struct AV1Common;
|
||||
|
|
@ -54,9 +54,9 @@ static INLINE int aom_get_qmlevel(int qindex, int first, int last) {
|
|||
}
|
||||
void aom_qm_init(struct AV1Common *cm);
|
||||
qm_val_t *aom_iqmatrix(struct AV1Common *cm, int qindex, int comp,
|
||||
int log2sizem2, int is_intra);
|
||||
TX_SIZE tx_size, int is_intra);
|
||||
qm_val_t *aom_qmatrix(struct AV1Common *cm, int qindex, int comp,
|
||||
int log2sizem2, int is_intra);
|
||||
TX_SIZE tx_size, int is_intra);
|
||||
#endif
|
||||
|
||||
#if CONFIG_NEW_QUANT
|
||||
|
|
|
|||
502
third_party/aom/av1/common/reconinter.c
vendored
502
third_party/aom/av1/common/reconinter.c
vendored
|
|
@ -371,12 +371,12 @@ void build_compound_seg_mask(uint8_t *mask, SEG_MASK_TYPE mask_type,
|
|||
const uint8_t *src1, int src1_stride,
|
||||
BLOCK_SIZE sb_type, int h, int w) {
|
||||
switch (mask_type) {
|
||||
case DIFFWTD_42:
|
||||
diffwtd_mask(mask, 0, 42, src0, src0_stride, src1, src1_stride, sb_type,
|
||||
case DIFFWTD_38:
|
||||
diffwtd_mask(mask, 0, 38, src0, src0_stride, src1, src1_stride, sb_type,
|
||||
h, w);
|
||||
break;
|
||||
case DIFFWTD_42_INV:
|
||||
diffwtd_mask(mask, 1, 42, src0, src0_stride, src1, src1_stride, sb_type,
|
||||
case DIFFWTD_38_INV:
|
||||
diffwtd_mask(mask, 1, 38, src0, src0_stride, src1, src1_stride, sb_type,
|
||||
h, w);
|
||||
break;
|
||||
default: assert(0);
|
||||
|
|
@ -407,12 +407,12 @@ void build_compound_seg_mask_highbd(uint8_t *mask, SEG_MASK_TYPE mask_type,
|
|||
const uint8_t *src1, int src1_stride,
|
||||
BLOCK_SIZE sb_type, int h, int w, int bd) {
|
||||
switch (mask_type) {
|
||||
case DIFFWTD_42:
|
||||
case DIFFWTD_38:
|
||||
diffwtd_mask_highbd(mask, 0, 42, CONVERT_TO_SHORTPTR(src0), src0_stride,
|
||||
CONVERT_TO_SHORTPTR(src1), src1_stride, sb_type, h, w,
|
||||
bd);
|
||||
break;
|
||||
case DIFFWTD_42_INV:
|
||||
case DIFFWTD_38_INV:
|
||||
diffwtd_mask_highbd(mask, 1, 42, CONVERT_TO_SHORTPTR(src0), src0_stride,
|
||||
CONVERT_TO_SHORTPTR(src1), src1_stride, sb_type, h, w,
|
||||
bd);
|
||||
|
|
@ -459,7 +459,7 @@ static void shift_copy(const uint8_t *src, uint8_t *dst, int shift, int width) {
|
|||
}
|
||||
}
|
||||
#else
|
||||
static const double smoother_param[NSMOOTHERS] = { 2.83 };
|
||||
static const double smoother_param[NSMOOTHERS] = { 3.0 };
|
||||
#endif // MASK_MASTER_SIZE == 64
|
||||
|
||||
static void init_wedge_master_masks() {
|
||||
|
|
@ -468,21 +468,22 @@ static void init_wedge_master_masks() {
|
|||
const int h = MASK_MASTER_SIZE;
|
||||
const int stride = MASK_MASTER_STRIDE;
|
||||
for (s = 0; s < NSMOOTHERS; s++) {
|
||||
// Note: index [0] stores the masters, and [1] its complement.
|
||||
#if MASK_MASTER_SIZE == 64
|
||||
// Generate prototype by shifting the masters
|
||||
int shift = h / 4;
|
||||
for (i = 0; i < h; i += 2) {
|
||||
shift_copy(wedge_master_oblique_even[s],
|
||||
&wedge_mask_obl[s][1][WEDGE_OBLIQUE63][i * stride], shift,
|
||||
&wedge_mask_obl[s][0][WEDGE_OBLIQUE63][i * stride], shift,
|
||||
MASK_MASTER_SIZE);
|
||||
shift--;
|
||||
shift_copy(wedge_master_oblique_odd[s],
|
||||
&wedge_mask_obl[s][1][WEDGE_OBLIQUE63][(i + 1) * stride],
|
||||
&wedge_mask_obl[s][0][WEDGE_OBLIQUE63][(i + 1) * stride],
|
||||
shift, MASK_MASTER_SIZE);
|
||||
memcpy(&wedge_mask_obl[s][1][WEDGE_VERTICAL][i * stride],
|
||||
memcpy(&wedge_mask_obl[s][0][WEDGE_VERTICAL][i * stride],
|
||||
wedge_master_vertical[s],
|
||||
MASK_MASTER_SIZE * sizeof(wedge_master_vertical[s][0]));
|
||||
memcpy(&wedge_mask_obl[s][1][WEDGE_VERTICAL][(i + 1) * stride],
|
||||
memcpy(&wedge_mask_obl[s][0][WEDGE_VERTICAL][(i + 1) * stride],
|
||||
wedge_master_vertical[s],
|
||||
MASK_MASTER_SIZE * sizeof(wedge_master_vertical[s][0]));
|
||||
}
|
||||
|
|
@ -495,29 +496,29 @@ static void init_wedge_master_masks() {
|
|||
int y = (2 * i + 1 - h);
|
||||
double d = (a[0] * x + a[1] * y) / asqrt;
|
||||
const int msk = (int)rint((1.0 + tanh(d / smoother_param[s])) * 32);
|
||||
wedge_mask_obl[s][1][WEDGE_OBLIQUE63][i * stride + j] = msk;
|
||||
wedge_mask_obl[s][0][WEDGE_OBLIQUE63][i * stride + j] = msk;
|
||||
const int mskx = (int)rint((1.0 + tanh(x / smoother_param[s])) * 32);
|
||||
wedge_mask_obl[s][1][WEDGE_VERTICAL][i * stride + j] = mskx;
|
||||
wedge_mask_obl[s][0][WEDGE_VERTICAL][i * stride + j] = mskx;
|
||||
}
|
||||
}
|
||||
#endif // MASK_MASTER_SIZE == 64
|
||||
for (i = 0; i < h; ++i) {
|
||||
for (j = 0; j < w; ++j) {
|
||||
const int msk = wedge_mask_obl[s][1][WEDGE_OBLIQUE63][i * stride + j];
|
||||
wedge_mask_obl[s][1][WEDGE_OBLIQUE27][j * stride + i] = msk;
|
||||
wedge_mask_obl[s][1][WEDGE_OBLIQUE117][i * stride + w - 1 - j] =
|
||||
wedge_mask_obl[s][1][WEDGE_OBLIQUE153][(w - 1 - j) * stride + i] =
|
||||
(1 << WEDGE_WEIGHT_BITS) - msk;
|
||||
wedge_mask_obl[s][0][WEDGE_OBLIQUE63][i * stride + j] =
|
||||
wedge_mask_obl[s][0][WEDGE_OBLIQUE27][j * stride + i] =
|
||||
(1 << WEDGE_WEIGHT_BITS) - msk;
|
||||
const int msk = wedge_mask_obl[s][0][WEDGE_OBLIQUE63][i * stride + j];
|
||||
wedge_mask_obl[s][0][WEDGE_OBLIQUE27][j * stride + i] = msk;
|
||||
wedge_mask_obl[s][0][WEDGE_OBLIQUE117][i * stride + w - 1 - j] =
|
||||
wedge_mask_obl[s][0][WEDGE_OBLIQUE153][(w - 1 - j) * stride + i] =
|
||||
(1 << WEDGE_WEIGHT_BITS) - msk;
|
||||
wedge_mask_obl[s][1][WEDGE_OBLIQUE63][i * stride + j] =
|
||||
wedge_mask_obl[s][1][WEDGE_OBLIQUE27][j * stride + i] =
|
||||
(1 << WEDGE_WEIGHT_BITS) - msk;
|
||||
wedge_mask_obl[s][1][WEDGE_OBLIQUE117][i * stride + w - 1 - j] =
|
||||
wedge_mask_obl[s][1][WEDGE_OBLIQUE153][(w - 1 - j) * stride + i] =
|
||||
msk;
|
||||
const int mskx = wedge_mask_obl[s][1][WEDGE_VERTICAL][i * stride + j];
|
||||
wedge_mask_obl[s][1][WEDGE_HORIZONTAL][j * stride + i] = mskx;
|
||||
wedge_mask_obl[s][0][WEDGE_VERTICAL][i * stride + j] =
|
||||
wedge_mask_obl[s][0][WEDGE_HORIZONTAL][j * stride + i] =
|
||||
const int mskx = wedge_mask_obl[s][0][WEDGE_VERTICAL][i * stride + j];
|
||||
wedge_mask_obl[s][0][WEDGE_HORIZONTAL][j * stride + i] = mskx;
|
||||
wedge_mask_obl[s][1][WEDGE_VERTICAL][i * stride + j] =
|
||||
wedge_mask_obl[s][1][WEDGE_HORIZONTAL][j * stride + i] =
|
||||
(1 << WEDGE_WEIGHT_BITS) - mskx;
|
||||
}
|
||||
}
|
||||
|
|
@ -539,12 +540,23 @@ static void init_wedge_signs() {
|
|||
int i, w;
|
||||
if (wbits == 0) continue;
|
||||
for (w = 0; w < wtypes; ++w) {
|
||||
// Get the mask master, i.e. index [0]
|
||||
const uint8_t *mask = get_wedge_mask_inplace(w, 0, sb_type);
|
||||
int sum = 0;
|
||||
for (i = 0; i < bw; ++i) sum += mask[i];
|
||||
for (i = 0; i < bh; ++i) sum += mask[i * MASK_MASTER_STRIDE];
|
||||
sum = (sum + (bw + bh) / 2) / (bw + bh);
|
||||
wedge_params.signflip[w] = (sum < 32);
|
||||
int avg = 0;
|
||||
for (i = 0; i < bw; ++i) avg += mask[i];
|
||||
for (i = 1; i < bh; ++i) avg += mask[i * MASK_MASTER_STRIDE];
|
||||
avg = (avg + (bw + bh - 1) / 2) / (bw + bh - 1);
|
||||
// Default sign of this wedge is 1 if the average < 32, 0 otherwise.
|
||||
// If default sign is 1:
|
||||
// If sign requested is 0, we need to flip the sign and return
|
||||
// the complement i.e. index [1] instead. If sign requested is 1
|
||||
// we need to flip the sign and return index [0] instead.
|
||||
// If default sign is 0:
|
||||
// If sign requested is 0, we need to return index [0] the master
|
||||
// if sign requested is 1, we need to return the complement index [1]
|
||||
// instead.
|
||||
wedge_params.signflip[w] = (avg < 32);
|
||||
// printf("%d[%d] = %d\n", sb_type, w, wedge_params.signflip[w]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -880,7 +892,7 @@ typedef struct SubpelParams {
|
|||
int subpel_y;
|
||||
} SubpelParams;
|
||||
|
||||
void build_inter_predictors(MACROBLOCKD *xd, int plane,
|
||||
void build_inter_predictors(const AV1_COMMON *cm, MACROBLOCKD *xd, int plane,
|
||||
#if CONFIG_MOTION_VAR
|
||||
int mi_col_offset, int mi_row_offset,
|
||||
#endif // CONFIG_MOTION_VAR
|
||||
|
|
@ -893,28 +905,17 @@ void build_inter_predictors(MACROBLOCKD *xd, int plane,
|
|||
struct macroblockd_plane *const pd = &xd->plane[plane];
|
||||
#if CONFIG_MOTION_VAR
|
||||
const MODE_INFO *mi = xd->mi[mi_col_offset + xd->mi_stride * mi_row_offset];
|
||||
#if !CONFIG_CB4X4 || CONFIG_SUB8X8_MC
|
||||
const int build_for_obmc = !(mi_col_offset == 0 && mi_row_offset == 0);
|
||||
#endif // !CONFIG_CB4X4 || CONFIG_SUB8X8_MC
|
||||
#else
|
||||
const MODE_INFO *mi = xd->mi[0];
|
||||
#endif // CONFIG_MOTION_VAR
|
||||
const int is_compound = has_second_ref(&mi->mbmi);
|
||||
int is_compound = has_second_ref(&mi->mbmi);
|
||||
int ref;
|
||||
#if CONFIG_INTRABC
|
||||
const int is_intrabc = is_intrabc_block(&mi->mbmi);
|
||||
struct scale_factors sf_identity;
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
av1_setup_scale_factors_for_frame(
|
||||
&sf_identity, 64, 64, 64, 64,
|
||||
xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH);
|
||||
#else
|
||||
av1_setup_scale_factors_for_frame(&sf_identity, 64, 64, 64, 64);
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
assert(IMPLIES(is_intrabc, !is_compound));
|
||||
#endif // CONFIG_INTRABC
|
||||
#if CONFIG_GLOBAL_MOTION
|
||||
int is_global[2];
|
||||
int is_global[2] = { 0, 0 };
|
||||
for (ref = 0; ref < 1 + is_compound; ++ref) {
|
||||
WarpedMotionParams *const wm = &xd->global_motion[mi->mbmi.ref_frame[ref]];
|
||||
is_global[ref] = is_global_mv_block(mi, block, wm->wmtype);
|
||||
|
|
@ -923,47 +924,87 @@ void build_inter_predictors(MACROBLOCKD *xd, int plane,
|
|||
|
||||
#if CONFIG_CB4X4
|
||||
(void)block;
|
||||
(void)cm;
|
||||
#endif
|
||||
|
||||
#if CONFIG_SUB8X8_MC
|
||||
#if CONFIG_MOTION_VAR
|
||||
if (mi->mbmi.sb_type < BLOCK_8X8 && plane > 0 && !build_for_obmc) {
|
||||
#else
|
||||
if (mi->mbmi.sb_type < BLOCK_8X8 && plane > 0) {
|
||||
#endif // CONFIG_MOTION_VAR
|
||||
// block size in log2
|
||||
const int b4_wl = b_width_log2_lookup[mi->mbmi.sb_type];
|
||||
const int b4_hl = b_height_log2_lookup[mi->mbmi.sb_type];
|
||||
const int b8_sl = b_width_log2_lookup[BLOCK_8X8];
|
||||
#if CONFIG_MOTION_VAR && (CONFIG_CHROMA_SUB8X8 || !CONFIG_CB4X4)
|
||||
const int build_for_obmc = !(mi_col_offset == 0 && mi_row_offset == 0);
|
||||
#endif // CONFIG_MOTION_VAR && (CONFIG_CHROMA_SUB8X8 || !CONFIG_CB4X4)
|
||||
|
||||
#if CONFIG_CHROMA_SUB8X8
|
||||
const BLOCK_SIZE bsize = mi->mbmi.sb_type;
|
||||
const int ss_x = pd->subsampling_x;
|
||||
const int ss_y = pd->subsampling_y;
|
||||
int sub8x8_inter = bsize < BLOCK_8X8 && (ss_x || ss_y);
|
||||
const int row_start = (block_size_high[bsize] == 4) && ss_y ? -1 : 0;
|
||||
const int col_start = (block_size_wide[bsize] == 4) && ss_x ? -1 : 0;
|
||||
|
||||
#if CONFIG_MOTION_VAR
|
||||
if (!build_for_obmc && sub8x8_inter) {
|
||||
#else
|
||||
if (sub8x8_inter) {
|
||||
#endif // CONFIG_MOTION_VAR
|
||||
for (int row = row_start; row <= 0 && sub8x8_inter; ++row)
|
||||
for (int col = col_start; col <= 0; ++col)
|
||||
if (!is_inter_block(&xd->mi[row * xd->mi_stride + col]->mbmi))
|
||||
sub8x8_inter = 0;
|
||||
}
|
||||
|
||||
#if CONFIG_MOTION_VAR
|
||||
if (!build_for_obmc && sub8x8_inter) {
|
||||
#else
|
||||
if (sub8x8_inter) {
|
||||
#endif // CONFIG_MOTION_VAR
|
||||
// block size
|
||||
const int b4_w = 1 << b4_wl;
|
||||
const int b4_h = 1 << b4_hl;
|
||||
const int b8_s = 1 << b8_sl;
|
||||
const int b4_w = block_size_wide[bsize] >> ss_x;
|
||||
const int b4_h = block_size_high[bsize] >> ss_y;
|
||||
const BLOCK_SIZE plane_bsize = scale_chroma_bsize(bsize, ss_x, ss_y);
|
||||
const int b8_w = block_size_wide[plane_bsize] >> ss_x;
|
||||
const int b8_h = block_size_high[plane_bsize] >> ss_y;
|
||||
int idx, idy;
|
||||
|
||||
const int x_base = x;
|
||||
const int y_base = y;
|
||||
|
||||
// processing unit size
|
||||
const int x_step = w >> (b8_sl - b4_wl);
|
||||
const int y_step = h >> (b8_sl - b4_hl);
|
||||
const struct buf_2d orig_pred_buf[2] = { pd->pre[0], pd->pre[1] };
|
||||
|
||||
int row = row_start;
|
||||
for (idy = 0; idy < b8_h; idy += b4_h) {
|
||||
int col = col_start;
|
||||
for (idx = 0; idx < b8_w; idx += b4_w) {
|
||||
MB_MODE_INFO *this_mbmi = &xd->mi[row * xd->mi_stride + col]->mbmi;
|
||||
is_compound = has_second_ref(this_mbmi);
|
||||
|
||||
for (idy = 0; idy < b8_s; idy += b4_h) {
|
||||
for (idx = 0; idx < b8_s; idx += b4_w) {
|
||||
const int chr_idx = (idy * 2) + idx;
|
||||
for (ref = 0; ref < 1 + is_compound; ++ref) {
|
||||
struct buf_2d *const dst_buf = &pd->dst;
|
||||
|
||||
const RefBuffer *ref_buf =
|
||||
&cm->frame_refs[this_mbmi->ref_frame[ref] - LAST_FRAME];
|
||||
|
||||
const int c_offset = (mi_x + MI_SIZE * col_start) >> ss_x;
|
||||
const int r_offset = (mi_y + MI_SIZE * row_start) >> ss_y;
|
||||
pd->pre[ref].buf0 =
|
||||
(plane == 1) ? ref_buf->buf->u_buffer : ref_buf->buf->v_buffer;
|
||||
pd->pre[ref].buf =
|
||||
pd->pre[ref].buf0 + scaled_buffer_offset(c_offset, r_offset,
|
||||
ref_buf->buf->uv_stride,
|
||||
&ref_buf->sf);
|
||||
pd->pre[ref].width = ref_buf->buf->uv_crop_width;
|
||||
pd->pre[ref].height = ref_buf->buf->uv_crop_height;
|
||||
pd->pre[ref].stride = ref_buf->buf->uv_stride;
|
||||
|
||||
#if CONFIG_INTRABC
|
||||
const struct scale_factors *const sf =
|
||||
is_intrabc ? &sf_identity : &xd->block_refs[ref]->sf;
|
||||
is_intrabc ? &xd->sf_identity : &xd->block_refs[ref]->sf;
|
||||
struct buf_2d *const pre_buf = is_intrabc ? dst_buf : &pd->pre[ref];
|
||||
#else
|
||||
const struct scale_factors *const sf = &xd->block_refs[ref]->sf;
|
||||
struct buf_2d *const pre_buf = &pd->pre[ref];
|
||||
#endif // CONFIG_INTRABC
|
||||
uint8_t *dst = dst_buf->buf;
|
||||
const MV mv = mi->bmi[chr_idx].as_mv[ref].as_mv;
|
||||
|
||||
const MV mv = this_mbmi->mv[ref].as_mv;
|
||||
|
||||
const MV mv_q4 = clamp_mv_to_umv_border_sb(
|
||||
xd, &mv, bw, bh, pd->subsampling_x, pd->subsampling_y);
|
||||
uint8_t *pre;
|
||||
|
|
@ -977,12 +1018,13 @@ void build_inter_predictors(MACROBLOCKD *xd, int plane,
|
|||
warp_types.global_warp_allowed = is_global[ref];
|
||||
#endif // CONFIG_GLOBAL_MOTION
|
||||
#if CONFIG_WARPED_MOTION
|
||||
warp_types.local_warp_allowed = mi->mbmi.motion_mode == WARPED_CAUSAL;
|
||||
warp_types.local_warp_allowed =
|
||||
this_mbmi->motion_mode == WARPED_CAUSAL;
|
||||
#endif // CONFIG_WARPED_MOTION
|
||||
#endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
|
||||
|
||||
x = x_base + idx * x_step;
|
||||
y = y_base + idy * y_step;
|
||||
x = x_base + idx;
|
||||
y = y_base + idy;
|
||||
|
||||
dst += dst_buf->stride * y + x;
|
||||
|
||||
|
|
@ -1022,7 +1064,7 @@ void build_inter_predictors(MACROBLOCKD *xd, int plane,
|
|||
#endif // CONFIG_EXT_INTER
|
||||
av1_make_inter_predictor(
|
||||
pre, pre_buf->stride, dst, dst_buf->stride, subpel_x, subpel_y,
|
||||
sf, x_step, y_step, &conv_params, mi->mbmi.interp_filter,
|
||||
sf, b4_w, b4_h, &conv_params, this_mbmi->interp_filter,
|
||||
#if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
|
||||
&warp_types, (mi_x >> pd->subsampling_x) + x,
|
||||
(mi_y >> pd->subsampling_y) + y, plane, ref,
|
||||
|
|
@ -1032,11 +1074,17 @@ void build_inter_predictors(MACROBLOCKD *xd, int plane,
|
|||
#endif
|
||||
xs, ys, xd);
|
||||
}
|
||||
++col;
|
||||
}
|
||||
++row;
|
||||
}
|
||||
|
||||
for (ref = 0; ref < 2; ++ref) pd->pre[ref] = orig_pred_buf[ref];
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
(void)cm;
|
||||
#endif // CONFIG_CHROMA_SUB8X8
|
||||
|
||||
{
|
||||
struct buf_2d *const dst_buf = &pd->dst;
|
||||
|
|
@ -1052,7 +1100,7 @@ void build_inter_predictors(MACROBLOCKD *xd, int plane,
|
|||
for (ref = 0; ref < 1 + is_compound; ++ref) {
|
||||
#if CONFIG_INTRABC
|
||||
const struct scale_factors *const sf =
|
||||
is_intrabc ? &sf_identity : &xd->block_refs[ref]->sf;
|
||||
is_intrabc ? &xd->sf_identity : &xd->block_refs[ref]->sf;
|
||||
struct buf_2d *const pre_buf = is_intrabc ? dst_buf : &pd->pre[ref];
|
||||
#else
|
||||
const struct scale_factors *const sf = &xd->block_refs[ref]->sf;
|
||||
|
|
@ -1110,7 +1158,7 @@ void build_inter_predictors(MACROBLOCKD *xd, int plane,
|
|||
for (ref = 0; ref < 1 + is_compound; ++ref) {
|
||||
#if CONFIG_INTRABC
|
||||
const struct scale_factors *const sf =
|
||||
is_intrabc ? &sf_identity : &xd->block_refs[ref]->sf;
|
||||
is_intrabc ? &xd->sf_identity : &xd->block_refs[ref]->sf;
|
||||
struct buf_2d *const pre_buf = is_intrabc ? dst_buf : &pd->pre[ref];
|
||||
#else
|
||||
const struct scale_factors *const sf = &xd->block_refs[ref]->sf;
|
||||
|
|
@ -1159,19 +1207,28 @@ void build_inter_predictors(MACROBLOCKD *xd, int plane,
|
|||
}
|
||||
|
||||
#if CONFIG_CONVOLVE_ROUND
|
||||
// TODO(angiebird): This part needs optimization
|
||||
// TODO(angiebird): This part needs optimization
|
||||
if (conv_params.do_post_rounding) {
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
if (!(xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH))
|
||||
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH)
|
||||
av1_highbd_convolve_rounding(tmp_dst, MAX_SB_SIZE, dst, dst_buf->stride,
|
||||
w, h, FILTER_BITS * 2 + is_compound -
|
||||
conv_params.round_0 -
|
||||
conv_params.round_1,
|
||||
xd->bd);
|
||||
else
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
av1_convolve_rounding(tmp_dst, MAX_SB_SIZE, dst, dst_buf->stride, w, h,
|
||||
FILTER_BITS * 2 + is_compound -
|
||||
conv_params.round_0 - conv_params.round_1);
|
||||
av1_convolve_rounding(tmp_dst, MAX_SB_SIZE, dst, dst_buf->stride, w, h,
|
||||
FILTER_BITS * 2 + is_compound -
|
||||
conv_params.round_0 - conv_params.round_1);
|
||||
}
|
||||
#endif // CONFIG_CONVOLVE_ROUND
|
||||
}
|
||||
}
|
||||
|
||||
void av1_build_inter_predictor_sub8x8(MACROBLOCKD *xd, int plane, int i, int ir,
|
||||
int ic, int mi_row, int mi_col) {
|
||||
void av1_build_inter_predictor_sub8x8(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
||||
int plane, int i, int ir, int ic,
|
||||
int mi_row, int mi_col) {
|
||||
struct macroblockd_plane *const pd = &xd->plane[plane];
|
||||
MODE_INFO *const mi = xd->mi[0];
|
||||
const BLOCK_SIZE plane_bsize = get_plane_block_size(mi->mbmi.sb_type, pd);
|
||||
|
|
@ -1180,6 +1237,8 @@ void av1_build_inter_predictor_sub8x8(MACROBLOCKD *xd, int plane, int i, int ir,
|
|||
uint8_t *const dst = &pd->dst.buf[(ir * pd->dst.stride + ic) << 2];
|
||||
int ref;
|
||||
const int is_compound = has_second_ref(&mi->mbmi);
|
||||
(void)cm;
|
||||
|
||||
#if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
|
||||
WarpTypesAllowed warp_types;
|
||||
const int p_col = ((mi_col * MI_SIZE) >> pd->subsampling_x) + 4 * ic;
|
||||
|
|
@ -1229,7 +1288,8 @@ void av1_build_inter_predictor_sub8x8(MACROBLOCKD *xd, int plane, int i, int ir,
|
|||
}
|
||||
}
|
||||
|
||||
static void build_inter_predictors_for_planes(MACROBLOCKD *xd, BLOCK_SIZE bsize,
|
||||
static void build_inter_predictors_for_planes(const AV1_COMMON *cm,
|
||||
MACROBLOCKD *xd, BLOCK_SIZE bsize,
|
||||
int mi_row, int mi_col,
|
||||
int plane_from, int plane_to) {
|
||||
int plane;
|
||||
|
|
@ -1265,7 +1325,7 @@ static void build_inter_predictors_for_planes(MACROBLOCKD *xd, BLOCK_SIZE bsize,
|
|||
assert(pw * num_4x4_w == bw && ph * num_4x4_h == bh);
|
||||
for (y = 0; y < num_4x4_h; ++y)
|
||||
for (x = 0; x < num_4x4_w; ++x)
|
||||
build_inter_predictors(xd, plane,
|
||||
build_inter_predictors(cm, xd, plane,
|
||||
#if CONFIG_MOTION_VAR
|
||||
0, 0,
|
||||
#endif // CONFIG_MOTION_VAR
|
||||
|
|
@ -1275,7 +1335,7 @@ static void build_inter_predictors_for_planes(MACROBLOCKD *xd, BLOCK_SIZE bsize,
|
|||
#endif // CONFIG_SUPERTX && CONFIG_EXT_INTER
|
||||
mi_x, mi_y);
|
||||
} else {
|
||||
build_inter_predictors(xd, plane,
|
||||
build_inter_predictors(cm, xd, plane,
|
||||
#if CONFIG_MOTION_VAR
|
||||
0, 0,
|
||||
#endif // CONFIG_MOTION_VAR
|
||||
|
|
@ -1288,10 +1348,11 @@ static void build_inter_predictors_for_planes(MACROBLOCKD *xd, BLOCK_SIZE bsize,
|
|||
}
|
||||
}
|
||||
|
||||
void av1_build_inter_predictors_sby(MACROBLOCKD *xd, int mi_row, int mi_col,
|
||||
BUFFER_SET *ctx, BLOCK_SIZE bsize) {
|
||||
build_inter_predictors_for_planes(xd, bsize, mi_row, mi_col, 0, 0);
|
||||
#if CONFIG_EXT_INTER
|
||||
void av1_build_inter_predictors_sby(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
||||
int mi_row, int mi_col, BUFFER_SET *ctx,
|
||||
BLOCK_SIZE bsize) {
|
||||
build_inter_predictors_for_planes(cm, xd, bsize, mi_row, mi_col, 0, 0);
|
||||
#if CONFIG_EXT_INTER && CONFIG_INTERINTRA
|
||||
if (is_interintra_pred(&xd->mi[0]->mbmi)) {
|
||||
BUFFER_SET default_ctx = { { xd->plane[0].dst.buf, NULL, NULL },
|
||||
{ xd->plane[0].dst.stride, 0, 0 } };
|
||||
|
|
@ -1301,14 +1362,15 @@ void av1_build_inter_predictors_sby(MACROBLOCKD *xd, int mi_row, int mi_col,
|
|||
}
|
||||
#else
|
||||
(void)ctx;
|
||||
#endif // CONFIG_EXT_INTER
|
||||
#endif // CONFIG_EXT_INTER && CONFIG_INTERINTRA
|
||||
}
|
||||
|
||||
void av1_build_inter_predictors_sbuv(MACROBLOCKD *xd, int mi_row, int mi_col,
|
||||
BUFFER_SET *ctx, BLOCK_SIZE bsize) {
|
||||
build_inter_predictors_for_planes(xd, bsize, mi_row, mi_col, 1,
|
||||
void av1_build_inter_predictors_sbuv(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
||||
int mi_row, int mi_col, BUFFER_SET *ctx,
|
||||
BLOCK_SIZE bsize) {
|
||||
build_inter_predictors_for_planes(cm, xd, bsize, mi_row, mi_col, 1,
|
||||
MAX_MB_PLANE - 1);
|
||||
#if CONFIG_EXT_INTER
|
||||
#if CONFIG_EXT_INTER && CONFIG_INTERINTRA
|
||||
if (is_interintra_pred(&xd->mi[0]->mbmi)) {
|
||||
BUFFER_SET default_ctx = {
|
||||
{ NULL, xd->plane[1].dst.buf, xd->plane[2].dst.buf },
|
||||
|
|
@ -1321,15 +1383,16 @@ void av1_build_inter_predictors_sbuv(MACROBLOCKD *xd, int mi_row, int mi_col,
|
|||
}
|
||||
#else
|
||||
(void)ctx;
|
||||
#endif // CONFIG_EXT_INTER
|
||||
#endif // CONFIG_EXT_INTER && CONFIG_INTERINTRA
|
||||
}
|
||||
|
||||
// TODO(afergs): Check if ctx can be made constant
|
||||
void av1_build_inter_predictors_sb(MACROBLOCKD *xd, int mi_row, int mi_col,
|
||||
BUFFER_SET *ctx, BLOCK_SIZE bsize) {
|
||||
build_inter_predictors_for_planes(xd, bsize, mi_row, mi_col, 0,
|
||||
void av1_build_inter_predictors_sb(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
||||
int mi_row, int mi_col, BUFFER_SET *ctx,
|
||||
BLOCK_SIZE bsize) {
|
||||
build_inter_predictors_for_planes(cm, xd, bsize, mi_row, mi_col, 0,
|
||||
MAX_MB_PLANE - 1);
|
||||
#if CONFIG_EXT_INTER
|
||||
#if CONFIG_EXT_INTER && CONFIG_INTERINTRA
|
||||
if (is_interintra_pred(&xd->mi[0]->mbmi)) {
|
||||
BUFFER_SET default_ctx = {
|
||||
{ xd->plane[0].dst.buf, xd->plane[1].dst.buf, xd->plane[2].dst.buf },
|
||||
|
|
@ -1344,7 +1407,7 @@ void av1_build_inter_predictors_sb(MACROBLOCKD *xd, int mi_row, int mi_col,
|
|||
}
|
||||
#else
|
||||
(void)ctx;
|
||||
#endif // CONFIG_EXT_INTER
|
||||
#endif // CONFIG_EXT_INTER && CONFIG_INTERINTRA
|
||||
}
|
||||
|
||||
void av1_setup_dst_planes(struct macroblockd_plane planes[MAX_MB_PLANE],
|
||||
|
|
@ -1522,7 +1585,8 @@ void av1_build_masked_inter_predictor_complex(
|
|||
} while (--h_remain);
|
||||
}
|
||||
|
||||
void av1_build_inter_predictors_sb_sub8x8_extend(MACROBLOCKD *xd,
|
||||
void av1_build_inter_predictors_sb_sub8x8_extend(const AV1_COMMON *cm,
|
||||
MACROBLOCKD *xd,
|
||||
#if CONFIG_EXT_INTER
|
||||
int mi_row_ori, int mi_col_ori,
|
||||
#endif // CONFIG_EXT_INTER
|
||||
|
|
@ -1553,7 +1617,7 @@ void av1_build_inter_predictors_sb_sub8x8_extend(MACROBLOCKD *xd,
|
|||
const int bw = 4 * num_4x4_w;
|
||||
const int bh = 4 * num_4x4_h;
|
||||
|
||||
build_inter_predictors(xd, plane,
|
||||
build_inter_predictors(cm, xd, plane,
|
||||
#if CONFIG_MOTION_VAR
|
||||
0, 0,
|
||||
#endif // CONFIG_MOTION_VAR
|
||||
|
|
@ -1577,7 +1641,7 @@ void av1_build_inter_predictors_sb_sub8x8_extend(MACROBLOCKD *xd,
|
|||
#endif // CONFIG_EXT_INTER
|
||||
}
|
||||
|
||||
void av1_build_inter_predictors_sb_extend(MACROBLOCKD *xd,
|
||||
void av1_build_inter_predictors_sb_extend(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
||||
#if CONFIG_EXT_INTER
|
||||
int mi_row_ori, int mi_col_ori,
|
||||
#endif // CONFIG_EXT_INTER
|
||||
|
|
@ -1596,7 +1660,7 @@ void av1_build_inter_predictors_sb_extend(MACROBLOCKD *xd,
|
|||
const int bw = block_size_wide[plane_bsize];
|
||||
const int bh = block_size_high[plane_bsize];
|
||||
|
||||
build_inter_predictors(xd, plane,
|
||||
build_inter_predictors(cm, xd, plane,
|
||||
#if CONFIG_MOTION_VAR
|
||||
0, 0,
|
||||
#endif // CONFIG_MOTION_VAR
|
||||
|
|
@ -1697,10 +1761,13 @@ const uint8_t *av1_get_obmc_mask_flipped(int length) {
|
|||
void av1_count_overlappable_neighbors(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
||||
int mi_row, int mi_col) {
|
||||
int i, mi_step;
|
||||
MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
|
||||
|
||||
xd->mi[0]->mbmi.overlappable_neighbors[0] = 0;
|
||||
xd->mi[0]->mbmi.overlappable_neighbors[1] = 0;
|
||||
|
||||
if (!is_motion_variation_allowed_bsize(mbmi->sb_type)) return;
|
||||
|
||||
if (xd->up_available) {
|
||||
const int ilimit = AOMMIN(xd->n8_w, cm->mi_cols - mi_col);
|
||||
for (i = 0; i < ilimit; i += mi_step) {
|
||||
|
|
@ -1709,8 +1776,15 @@ void av1_count_overlappable_neighbors(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
|||
MODE_INFO *above_mi =
|
||||
xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride];
|
||||
MB_MODE_INFO *above_mbmi = &above_mi->mbmi;
|
||||
|
||||
mi_step = AOMMIN(xd->n8_w, mi_size_wide[above_mbmi->sb_type]);
|
||||
#if CONFIG_CHROMA_SUB8X8
|
||||
if (above_mbmi->sb_type < BLOCK_8X8) {
|
||||
++mi_col_offset;
|
||||
above_mbmi =
|
||||
&xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]->mbmi;
|
||||
}
|
||||
#endif
|
||||
BLOCK_SIZE above_bsize = AOMMAX(above_mbmi->sb_type, BLOCK_8X8);
|
||||
mi_step = AOMMIN(xd->n8_w, mi_size_wide[above_bsize]);
|
||||
|
||||
if (is_neighbor_overlappable(above_mbmi))
|
||||
xd->mi[0]->mbmi.overlappable_neighbors[0]++;
|
||||
|
|
@ -1726,7 +1800,15 @@ void av1_count_overlappable_neighbors(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
|||
xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride];
|
||||
MB_MODE_INFO *left_mbmi = &left_mi->mbmi;
|
||||
|
||||
mi_step = AOMMIN(xd->n8_h, mi_size_high[left_mbmi->sb_type]);
|
||||
#if CONFIG_CHROMA_SUB8X8
|
||||
if (left_mbmi->sb_type < BLOCK_8X8) {
|
||||
++mi_row_offset;
|
||||
left_mbmi =
|
||||
&xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]->mbmi;
|
||||
}
|
||||
#endif
|
||||
BLOCK_SIZE left_bsize = AOMMAX(left_mbmi->sb_type, BLOCK_8X8);
|
||||
mi_step = AOMMIN(xd->n8_h, mi_size_high[left_bsize]);
|
||||
|
||||
if (is_neighbor_overlappable(left_mbmi))
|
||||
xd->mi[0]->mbmi.overlappable_neighbors[1]++;
|
||||
|
|
@ -1757,7 +1839,7 @@ int skip_u4x4_pred_in_obmc(BLOCK_SIZE bsize, const struct macroblockd_plane *pd,
|
|||
#else
|
||||
case BLOCK_4X4:
|
||||
case BLOCK_8X4:
|
||||
case BLOCK_4X8: return dir == 1; break;
|
||||
case BLOCK_4X8: return dir == 0; break;
|
||||
#endif
|
||||
default: return 0;
|
||||
}
|
||||
|
|
@ -1791,10 +1873,18 @@ void av1_build_obmc_inter_prediction(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
|||
|
||||
i = 0;
|
||||
do { // for each mi in the above row
|
||||
const int mi_col_offset = i;
|
||||
const MB_MODE_INFO *const above_mbmi =
|
||||
int mi_col_offset = i;
|
||||
MB_MODE_INFO *above_mbmi =
|
||||
&xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]->mbmi;
|
||||
const BLOCK_SIZE a_bsize = above_mbmi->sb_type;
|
||||
#if CONFIG_CHROMA_SUB8X8
|
||||
if (above_mbmi->sb_type < BLOCK_8X8) {
|
||||
++mi_col_offset;
|
||||
above_mbmi =
|
||||
&xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]->mbmi;
|
||||
}
|
||||
#endif
|
||||
|
||||
const BLOCK_SIZE a_bsize = AOMMAX(BLOCK_8X8, above_mbmi->sb_type);
|
||||
const int mi_step = AOMMIN(xd->n8_w, mi_size_wide[a_bsize]);
|
||||
|
||||
if (is_neighbor_overlappable(above_mbmi)) {
|
||||
|
|
@ -1840,10 +1930,18 @@ void av1_build_obmc_inter_prediction(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
|||
|
||||
i = 0;
|
||||
do { // for each mi in the left column
|
||||
const int mi_row_offset = i;
|
||||
const MB_MODE_INFO *const left_mbmi =
|
||||
int mi_row_offset = i;
|
||||
MB_MODE_INFO *left_mbmi =
|
||||
&xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]->mbmi;
|
||||
const BLOCK_SIZE l_bsize = left_mbmi->sb_type;
|
||||
#if CONFIG_CHROMA_SUB8X8
|
||||
if (left_mbmi->sb_type < BLOCK_8X8) {
|
||||
++mi_row_offset;
|
||||
left_mbmi =
|
||||
&xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]->mbmi;
|
||||
}
|
||||
#endif
|
||||
|
||||
const BLOCK_SIZE l_bsize = AOMMAX(BLOCK_8X8, left_mbmi->sb_type);
|
||||
const int mi_step = AOMMIN(xd->n8_h, mi_size_high[l_bsize]);
|
||||
|
||||
if (is_neighbor_overlappable(left_mbmi)) {
|
||||
|
|
@ -1916,7 +2014,15 @@ void av1_build_prediction_by_above_preds(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
|||
int mi_x, mi_y, bw, bh;
|
||||
MODE_INFO *above_mi = xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride];
|
||||
MB_MODE_INFO *above_mbmi = &above_mi->mbmi;
|
||||
const BLOCK_SIZE a_bsize = above_mbmi->sb_type;
|
||||
|
||||
#if CONFIG_CHROMA_SUB8X8
|
||||
if (above_mbmi->sb_type < BLOCK_8X8) {
|
||||
++mi_col_offset;
|
||||
above_mbmi = &xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]->mbmi;
|
||||
}
|
||||
#endif
|
||||
|
||||
const BLOCK_SIZE a_bsize = AOMMAX(BLOCK_8X8, above_mbmi->sb_type);
|
||||
MB_MODE_INFO backup_mbmi;
|
||||
|
||||
mi_step = AOMMIN(xd->n8_w, mi_size_wide[a_bsize]);
|
||||
|
|
@ -1931,8 +2037,8 @@ void av1_build_prediction_by_above_preds(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
|||
|
||||
for (j = 0; j < MAX_MB_PLANE; ++j) {
|
||||
struct macroblockd_plane *const pd = &xd->plane[j];
|
||||
setup_pred_plane(&pd->dst, AOMMAX(a_bsize, BLOCK_8X8), tmp_buf[j],
|
||||
tmp_width[j], tmp_height[j], tmp_stride[j], 0, i, NULL,
|
||||
setup_pred_plane(&pd->dst, a_bsize, tmp_buf[j], tmp_width[j],
|
||||
tmp_height[j], tmp_stride[j], 0, i, NULL,
|
||||
pd->subsampling_x, pd->subsampling_y);
|
||||
}
|
||||
for (ref = 0; ref < 1 + has_second_ref(above_mbmi); ++ref) {
|
||||
|
|
@ -1960,8 +2066,8 @@ void av1_build_prediction_by_above_preds(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
|||
4);
|
||||
|
||||
if (skip_u4x4_pred_in_obmc(bsize, pd, 0)) continue;
|
||||
build_inter_predictors(xd, j, mi_col_offset, mi_row_offset, 0, bw, bh, 0,
|
||||
0, bw, bh,
|
||||
build_inter_predictors(cm, xd, j, mi_col_offset, mi_row_offset, 0, bw, bh,
|
||||
0, 0, bw, bh,
|
||||
#if CONFIG_SUPERTX && CONFIG_EXT_INTER
|
||||
0, 0,
|
||||
#endif // CONFIG_SUPERTX && CONFIG_EXT_INTER
|
||||
|
|
@ -1997,7 +2103,15 @@ void av1_build_prediction_by_left_preds(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
|||
int mi_x, mi_y, bw, bh;
|
||||
MODE_INFO *left_mi = xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride];
|
||||
MB_MODE_INFO *left_mbmi = &left_mi->mbmi;
|
||||
const BLOCK_SIZE l_bsize = left_mbmi->sb_type;
|
||||
|
||||
#if CONFIG_CHROMA_SUB8X8
|
||||
if (left_mbmi->sb_type < BLOCK_8X8) {
|
||||
++mi_row_offset;
|
||||
left_mbmi = &xd->mi[mi_col_offset + mi_row_offset * xd->mi_stride]->mbmi;
|
||||
}
|
||||
#endif
|
||||
|
||||
const BLOCK_SIZE l_bsize = AOMMAX(left_mbmi->sb_type, BLOCK_8X8);
|
||||
MB_MODE_INFO backup_mbmi;
|
||||
|
||||
mi_step = AOMMIN(xd->n8_h, mi_size_high[l_bsize]);
|
||||
|
|
@ -2012,8 +2126,8 @@ void av1_build_prediction_by_left_preds(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
|||
|
||||
for (j = 0; j < MAX_MB_PLANE; ++j) {
|
||||
struct macroblockd_plane *const pd = &xd->plane[j];
|
||||
setup_pred_plane(&pd->dst, AOMMAX(l_bsize, BLOCK_8X8), tmp_buf[j],
|
||||
tmp_width[j], tmp_height[j], tmp_stride[j], i, 0, NULL,
|
||||
setup_pred_plane(&pd->dst, l_bsize, tmp_buf[j], tmp_width[j],
|
||||
tmp_height[j], tmp_stride[j], i, 0, NULL,
|
||||
pd->subsampling_x, pd->subsampling_y);
|
||||
}
|
||||
for (ref = 0; ref < 1 + has_second_ref(left_mbmi); ++ref) {
|
||||
|
|
@ -2041,8 +2155,8 @@ void av1_build_prediction_by_left_preds(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
|||
bh = (mi_step << MI_SIZE_LOG2) >> pd->subsampling_y;
|
||||
|
||||
if (skip_u4x4_pred_in_obmc(bsize, pd, 1)) continue;
|
||||
build_inter_predictors(xd, j, mi_col_offset, mi_row_offset, 0, bw, bh, 0,
|
||||
0, bw, bh,
|
||||
build_inter_predictors(cm, xd, j, mi_col_offset, mi_row_offset, 0, bw, bh,
|
||||
0, 0, bw, bh,
|
||||
#if CONFIG_SUPERTX && CONFIG_EXT_INTER
|
||||
0, 0,
|
||||
#endif // CONFIG_SUPERTX && CONFIG_EXT_INTER
|
||||
|
|
@ -2185,7 +2299,7 @@ void av1_build_prediction_by_bottom_preds(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
|||
continue;
|
||||
|
||||
build_inter_predictors(
|
||||
xd, j, mi_col_offset, mi_row_offset, y * 2 + x, bw, bh,
|
||||
cm, xd, j, mi_col_offset, mi_row_offset, y * 2 + x, bw, bh,
|
||||
(4 * x) >> pd->subsampling_x,
|
||||
xd->n8_h == 1 ? (4 >> pd->subsampling_y) : 0, pw, bh,
|
||||
#if CONFIG_SUPERTX && CONFIG_EXT_INTER
|
||||
|
|
@ -2194,13 +2308,13 @@ void av1_build_prediction_by_bottom_preds(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
|||
mi_x, mi_y);
|
||||
}
|
||||
} else {
|
||||
build_inter_predictors(xd, j, mi_col_offset, mi_row_offset, 0, bw, bh,
|
||||
0, xd->n8_h == 1 ? (4 >> pd->subsampling_y) : 0,
|
||||
bw, bh,
|
||||
build_inter_predictors(
|
||||
cm, xd, j, mi_col_offset, mi_row_offset, 0, bw, bh, 0,
|
||||
xd->n8_h == 1 ? (4 >> pd->subsampling_y) : 0, bw, bh,
|
||||
#if CONFIG_SUPERTX && CONFIG_EXT_INTER
|
||||
0, 0,
|
||||
0, 0,
|
||||
#endif // CONFIG_SUPERTX && CONFIG_EXT_INTER
|
||||
mi_x, mi_y);
|
||||
mi_x, mi_y);
|
||||
}
|
||||
}
|
||||
#if CONFIG_EXT_INTER
|
||||
|
|
@ -2292,7 +2406,7 @@ void av1_build_prediction_by_right_preds(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
|||
if ((bp == PARTITION_VERT || bp == PARTITION_SPLIT) && x != 0)
|
||||
continue;
|
||||
|
||||
build_inter_predictors(xd, j, mi_col_offset, mi_row_offset,
|
||||
build_inter_predictors(cm, xd, j, mi_col_offset, mi_row_offset,
|
||||
y * 2 + x, bw, bh,
|
||||
xd->n8_w == 1 ? 4 >> pd->subsampling_x : 0,
|
||||
(4 * y) >> pd->subsampling_y, bw, ph,
|
||||
|
|
@ -2302,9 +2416,9 @@ void av1_build_prediction_by_right_preds(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
|||
mi_x, mi_y);
|
||||
}
|
||||
} else {
|
||||
build_inter_predictors(xd, j, mi_col_offset, mi_row_offset, 0, bw, bh,
|
||||
xd->n8_w == 1 ? 4 >> pd->subsampling_x : 0, 0,
|
||||
bw, bh,
|
||||
build_inter_predictors(cm, xd, j, mi_col_offset, mi_row_offset, 0, bw,
|
||||
bh, xd->n8_w == 1 ? 4 >> pd->subsampling_x : 0,
|
||||
0, bw, bh,
|
||||
#if CONFIG_SUPERTX && CONFIG_EXT_INTER
|
||||
0, 0,
|
||||
#endif // CONFIG_SUPERTX && CONFIG_EXT_INTER
|
||||
|
|
@ -2489,15 +2603,16 @@ void av1_build_ncobmc_inter_predictors_sb(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
|||
|
||||
#if CONFIG_EXT_INTER
|
||||
/* clang-format off */
|
||||
#if CONFIG_INTERINTRA
|
||||
#if CONFIG_EXT_PARTITION
|
||||
static const int ii_weights1d[MAX_SB_SIZE] = {
|
||||
26, 25, 24, 24, 23, 23, 22, 22, 21, 21, 20, 20, 19, 19, 18, 18, 17, 17, 17,
|
||||
16, 16, 16, 15, 15, 15, 15, 14, 14, 14, 13, 13, 13, 13, 13, 12, 12, 12, 12,
|
||||
12, 11, 11, 11, 11, 11, 11, 10, 10, 10, 10, 10, 10, 10, 10, 10, 9, 9, 9,
|
||||
9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
|
||||
60, 58, 56, 54, 52, 50, 48, 47, 45, 44, 42, 41, 39, 38, 37, 35, 34, 33, 32,
|
||||
31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 22, 21, 20, 19, 19, 18, 18, 17, 16,
|
||||
16, 15, 15, 14, 14, 13, 13, 12, 12, 12, 11, 11, 10, 10, 10, 9, 9, 9, 8,
|
||||
8, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 4, 4,
|
||||
4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
|
||||
};
|
||||
static int ii_size_scales[BLOCK_SIZES] = {
|
||||
#if CONFIG_CB4X4
|
||||
|
|
@ -2508,10 +2623,10 @@ static int ii_size_scales[BLOCK_SIZES] = {
|
|||
};
|
||||
#else
|
||||
static const int ii_weights1d[MAX_SB_SIZE] = {
|
||||
26, 25, 24, 24, 23, 23, 22, 22, 21, 21, 20, 20, 19, 19, 18, 18,
|
||||
17, 17, 17, 16, 16, 16, 15, 15, 15, 15, 14, 14, 14, 13, 13, 13,
|
||||
13, 13, 12, 12, 12, 12, 12, 11, 11, 11, 11, 11, 11, 10, 10, 10,
|
||||
10, 10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9
|
||||
60, 56, 52, 48, 45, 42, 39, 37, 34, 32, 30, 28, 26, 24, 22, 21,
|
||||
19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 10, 9, 8, 8, 7, 7,
|
||||
6, 6, 6, 5, 5, 4, 4, 4, 4, 3, 3, 3, 3, 3, 2, 2,
|
||||
2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
|
||||
};
|
||||
static int ii_size_scales[BLOCK_SIZES] = {
|
||||
#if CONFIG_CB4X4
|
||||
|
|
@ -2570,35 +2685,8 @@ static void combine_interintra(INTERINTRA_MODE mode, int use_wedge_interintra,
|
|||
}
|
||||
break;
|
||||
|
||||
case II_D63_PRED:
|
||||
case II_D117_PRED:
|
||||
for (i = 0; i < bh; ++i) {
|
||||
for (j = 0; j < bw; ++j) {
|
||||
int scale = (ii_weights1d[i * size_scale] * 3 +
|
||||
ii_weights1d[j * size_scale]) >>
|
||||
2;
|
||||
comppred[i * compstride + j] =
|
||||
AOM_BLEND_A64(scale, intrapred[i * intrastride + j],
|
||||
interpred[i * interstride + j]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case II_D207_PRED:
|
||||
case II_D153_PRED:
|
||||
for (i = 0; i < bh; ++i) {
|
||||
for (j = 0; j < bw; ++j) {
|
||||
int scale = (ii_weights1d[j * size_scale] * 3 +
|
||||
ii_weights1d[i * size_scale]) >>
|
||||
2;
|
||||
comppred[i * compstride + j] =
|
||||
AOM_BLEND_A64(scale, intrapred[i * intrastride + j],
|
||||
interpred[i * interstride + j]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case II_D135_PRED:
|
||||
#if CONFIG_ALT_INTRA
|
||||
case II_SMOOTH_PRED:
|
||||
for (i = 0; i < bh; ++i) {
|
||||
for (j = 0; j < bw; ++j) {
|
||||
int scale = ii_weights1d[(i < j ? i : j) * size_scale];
|
||||
|
|
@ -2608,21 +2696,11 @@ static void combine_interintra(INTERINTRA_MODE mode, int use_wedge_interintra,
|
|||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
case II_D45_PRED:
|
||||
for (i = 0; i < bh; ++i) {
|
||||
for (j = 0; j < bw; ++j) {
|
||||
int scale =
|
||||
(ii_weights1d[i * size_scale] + ii_weights1d[j * size_scale]) >>
|
||||
1;
|
||||
comppred[i * compstride + j] =
|
||||
AOM_BLEND_A64(scale, intrapred[i * intrastride + j],
|
||||
interpred[i * interstride + j]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
#if !CONFIG_ALT_INTRA
|
||||
case II_TM_PRED:
|
||||
#endif
|
||||
case II_DC_PRED:
|
||||
default:
|
||||
for (i = 0; i < bh; ++i) {
|
||||
|
|
@ -2686,35 +2764,8 @@ static void combine_interintra_highbd(
|
|||
}
|
||||
break;
|
||||
|
||||
case II_D63_PRED:
|
||||
case II_D117_PRED:
|
||||
for (i = 0; i < bh; ++i) {
|
||||
for (j = 0; j < bw; ++j) {
|
||||
int scale = (ii_weights1d[i * size_scale] * 3 +
|
||||
ii_weights1d[j * size_scale]) >>
|
||||
2;
|
||||
comppred[i * compstride + j] =
|
||||
AOM_BLEND_A64(scale, intrapred[i * intrastride + j],
|
||||
interpred[i * interstride + j]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case II_D207_PRED:
|
||||
case II_D153_PRED:
|
||||
for (i = 0; i < bh; ++i) {
|
||||
for (j = 0; j < bw; ++j) {
|
||||
int scale = (ii_weights1d[j * size_scale] * 3 +
|
||||
ii_weights1d[i * size_scale]) >>
|
||||
2;
|
||||
comppred[i * compstride + j] =
|
||||
AOM_BLEND_A64(scale, intrapred[i * intrastride + j],
|
||||
interpred[i * interstride + j]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case II_D135_PRED:
|
||||
#if CONFIG_ALT_INTRA
|
||||
case II_SMOOTH_PRED:
|
||||
for (i = 0; i < bh; ++i) {
|
||||
for (j = 0; j < bw; ++j) {
|
||||
int scale = ii_weights1d[(i < j ? i : j) * size_scale];
|
||||
|
|
@ -2724,21 +2775,11 @@ static void combine_interintra_highbd(
|
|||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
case II_D45_PRED:
|
||||
for (i = 0; i < bh; ++i) {
|
||||
for (j = 0; j < bw; ++j) {
|
||||
int scale =
|
||||
(ii_weights1d[i * size_scale] + ii_weights1d[j * size_scale]) >>
|
||||
1;
|
||||
comppred[i * compstride + j] =
|
||||
AOM_BLEND_A64(scale, intrapred[i * intrastride + j],
|
||||
interpred[i * interstride + j]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
#if !CONFIG_ALT_INTRA
|
||||
case II_TM_PRED:
|
||||
#endif
|
||||
case II_DC_PRED:
|
||||
default:
|
||||
for (i = 0; i < bh; ++i) {
|
||||
|
|
@ -2850,6 +2891,7 @@ void av1_build_interintra_predictors(MACROBLOCKD *xd, uint8_t *ypred,
|
|||
av1_build_interintra_predictors_sbuv(xd, upred, vpred, ustride, vstride, ctx,
|
||||
bsize);
|
||||
}
|
||||
#endif // CONFIG_INTERINTRA
|
||||
|
||||
// Builds the inter-predictor for the single ref case
|
||||
// for use in the encoder to search the wedges efficiently.
|
||||
|
|
@ -2939,13 +2981,13 @@ void av1_build_inter_predictors_for_planes_single_buf(
|
|||
for (plane = plane_from; plane <= plane_to; ++plane) {
|
||||
const BLOCK_SIZE plane_bsize =
|
||||
get_plane_block_size(bsize, &xd->plane[plane]);
|
||||
const int num_4x4_w = num_4x4_blocks_wide_lookup[plane_bsize];
|
||||
const int num_4x4_h = num_4x4_blocks_high_lookup[plane_bsize];
|
||||
const int bw = block_size_wide[plane_bsize];
|
||||
const int bh = block_size_high[plane_bsize];
|
||||
|
||||
if (xd->mi[0]->mbmi.sb_type < BLOCK_8X8 && !CONFIG_CB4X4) {
|
||||
int x, y;
|
||||
const int num_4x4_w = num_4x4_blocks_wide_lookup[plane_bsize];
|
||||
const int num_4x4_h = num_4x4_blocks_high_lookup[plane_bsize];
|
||||
assert(bsize == BLOCK_8X8);
|
||||
for (y = 0; y < num_4x4_h; ++y)
|
||||
for (x = 0; x < num_4x4_w; ++x)
|
||||
|
|
@ -3052,11 +3094,11 @@ void av1_build_wedge_inter_predictor_from_buf(
|
|||
for (plane = plane_from; plane <= plane_to; ++plane) {
|
||||
const BLOCK_SIZE plane_bsize =
|
||||
get_plane_block_size(bsize, &xd->plane[plane]);
|
||||
const int num_4x4_w = num_4x4_blocks_wide_lookup[plane_bsize];
|
||||
const int num_4x4_h = num_4x4_blocks_high_lookup[plane_bsize];
|
||||
|
||||
if (xd->mi[0]->mbmi.sb_type < BLOCK_8X8 && !CONFIG_CB4X4) {
|
||||
int x, y;
|
||||
const int num_4x4_w = num_4x4_blocks_wide_lookup[plane_bsize];
|
||||
const int num_4x4_h = num_4x4_blocks_high_lookup[plane_bsize];
|
||||
assert(bsize == BLOCK_8X8);
|
||||
for (y = 0; y < num_4x4_h; ++y)
|
||||
for (x = 0; x < num_4x4_w; ++x)
|
||||
|
|
|
|||
191
third_party/aom/av1/common/reconinter.h
vendored
191
third_party/aom/av1/common/reconinter.h
vendored
|
|
@ -32,11 +32,12 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
static INLINE int has_scale(int xs, int ys) { return xs != 16 || ys != 16; }
|
||||
|
||||
static INLINE void inter_predictor(const uint8_t *src, int src_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,
|
||||
uint8_t *dst, int dst_stride, int subpel_x,
|
||||
int subpel_y, const struct scale_factors *sf,
|
||||
int w, int h, ConvolveParams *conv_params,
|
||||
#if CONFIG_DUAL_FILTER
|
||||
const InterpFilter *interp_filter,
|
||||
#else
|
||||
|
|
@ -44,63 +45,53 @@ static INLINE void inter_predictor(const uint8_t *src, int src_stride,
|
|||
#endif
|
||||
int xs, int ys) {
|
||||
#if CONFIG_DUAL_FILTER
|
||||
InterpFilter filter_x = av1_get_plane_interp_filter(
|
||||
const InterpFilter filter_x = av1_get_plane_interp_filter(
|
||||
interp_filter[1 + 2 * conv_params->ref], conv_params->plane);
|
||||
InterpFilter filter_y = av1_get_plane_interp_filter(
|
||||
const InterpFilter filter_y = av1_get_plane_interp_filter(
|
||||
interp_filter[0 + 2 * conv_params->ref], conv_params->plane);
|
||||
InterpFilterParams interp_filter_params_x =
|
||||
const InterpFilterParams interp_filter_params_x =
|
||||
av1_get_interp_filter_params(filter_x);
|
||||
InterpFilterParams interp_filter_params_y =
|
||||
const InterpFilterParams interp_filter_params_y =
|
||||
av1_get_interp_filter_params(filter_y);
|
||||
#else
|
||||
InterpFilterParams interp_filter_params =
|
||||
const InterpFilterParams interp_filter_params_x =
|
||||
av1_get_interp_filter_params(interp_filter);
|
||||
const InterpFilterParams interp_filter_params_y = interp_filter_params_x;
|
||||
#endif
|
||||
|
||||
assert(sf);
|
||||
#if CONFIG_DUAL_FILTER
|
||||
if (interp_filter_params_x.taps == SUBPEL_TAPS &&
|
||||
interp_filter_params_y.taps == SUBPEL_TAPS && w > 2 && h > 2 &&
|
||||
conv_params->round == CONVOLVE_OPT_ROUND && xs == 16 && ys == 16) {
|
||||
const int16_t *kernel_x =
|
||||
av1_get_interp_filter_subpel_kernel(interp_filter_params_x, subpel_x);
|
||||
const int16_t *kernel_y =
|
||||
av1_get_interp_filter_subpel_kernel(interp_filter_params_y, subpel_y);
|
||||
#else
|
||||
if (interp_filter_params.taps == SUBPEL_TAPS && w > 2 && h > 2 &&
|
||||
conv_params->round == CONVOLVE_OPT_ROUND && xs == 16 && ys == 16) {
|
||||
const int16_t *kernel_x =
|
||||
av1_get_interp_filter_subpel_kernel(interp_filter_params, subpel_x);
|
||||
const int16_t *kernel_y =
|
||||
av1_get_interp_filter_subpel_kernel(interp_filter_params, subpel_y);
|
||||
#endif
|
||||
sf->predict[subpel_x != 0][subpel_y != 0][conv_params->ref](
|
||||
src, src_stride, dst, dst_stride, kernel_x, xs, kernel_y, ys, w, h);
|
||||
} else {
|
||||
// ref_idx > 0 means this is the second reference frame
|
||||
// first reference frame's prediction result is already in dst
|
||||
// therefore we need to average the first and second results
|
||||
if (has_scale(xs, ys)) {
|
||||
av1_convolve_c(src, src_stride, dst, dst_stride, w, h, interp_filter,
|
||||
subpel_x, xs, subpel_y, ys, conv_params);
|
||||
} else if (conv_params->round == CONVOLVE_OPT_NO_ROUND) {
|
||||
#if CONFIG_CONVOLVE_ROUND
|
||||
if (conv_params->round == CONVOLVE_OPT_NO_ROUND && xs == 16 && ys == 16)
|
||||
av1_convolve_2d_facade(src, src_stride, dst, dst_stride, w, h,
|
||||
av1_convolve_2d_facade(src, src_stride, dst, dst_stride, w, h,
|
||||
#if CONFIG_DUAL_FILTER
|
||||
interp_filter,
|
||||
interp_filter,
|
||||
#else // CONFIG_DUAL_FILTER
|
||||
&interp_filter,
|
||||
#endif // CONFIG_DUAL_FILTER
|
||||
subpel_x, xs, subpel_y, ys, conv_params);
|
||||
conv_params->do_post_rounding = 1;
|
||||
#else
|
||||
&interp_filter,
|
||||
#endif
|
||||
subpel_x, xs, subpel_y, ys, conv_params);
|
||||
else
|
||||
#endif
|
||||
{
|
||||
if (xs == 16 && ys == 16) {
|
||||
av1_convolve(src, src_stride, dst, dst_stride, w, h, interp_filter,
|
||||
assert(0);
|
||||
#endif // CONFIG_CONVOLVE_ROUND
|
||||
} else {
|
||||
assert(conv_params->round == CONVOLVE_OPT_ROUND);
|
||||
if (w <= 2 || h <= 2) {
|
||||
av1_convolve_c(src, src_stride, dst, dst_stride, w, h, interp_filter,
|
||||
subpel_x, xs, subpel_y, ys, conv_params);
|
||||
} else {
|
||||
// If xs == 16 || ys == 16 scaling is happening and the SSE2
|
||||
// instructions don't support scaling; use the C versions to be safe.
|
||||
av1_convolve_c(src, src_stride, dst, dst_stride, w, h, interp_filter,
|
||||
subpel_x, xs, subpel_y, ys, conv_params);
|
||||
}
|
||||
} else if (interp_filter_params_x.taps == SUBPEL_TAPS &&
|
||||
interp_filter_params_y.taps == SUBPEL_TAPS) {
|
||||
const int16_t *kernel_x =
|
||||
av1_get_interp_filter_subpel_kernel(interp_filter_params_x, subpel_x);
|
||||
const int16_t *kernel_y =
|
||||
av1_get_interp_filter_subpel_kernel(interp_filter_params_y, subpel_y);
|
||||
sf->predict[subpel_x != 0][subpel_y != 0][conv_params->ref](
|
||||
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_filter,
|
||||
subpel_x, xs, subpel_y, ys, conv_params);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -111,46 +102,59 @@ static INLINE void highbd_inter_predictor(const uint8_t *src, int src_stride,
|
|||
const int subpel_x,
|
||||
const int subpel_y,
|
||||
const struct scale_factors *sf, int w,
|
||||
int h, int ref,
|
||||
int h, ConvolveParams *conv_params,
|
||||
#if CONFIG_DUAL_FILTER
|
||||
const InterpFilter *interp_filter,
|
||||
#else
|
||||
const InterpFilter interp_filter,
|
||||
#endif
|
||||
int xs, int ys, int bd) {
|
||||
const int ref = conv_params->ref;
|
||||
// ref > 0 means this is the second reference frame
|
||||
// first reference frame's prediction result is already in dst
|
||||
// therefore we need to average the first and second results
|
||||
const int avg = ref > 0;
|
||||
#if CONFIG_DUAL_FILTER
|
||||
InterpFilterParams interp_filter_params_x =
|
||||
const InterpFilterParams interp_filter_params_x =
|
||||
av1_get_interp_filter_params(interp_filter[1 + 2 * ref]);
|
||||
InterpFilterParams interp_filter_params_y =
|
||||
const InterpFilterParams interp_filter_params_y =
|
||||
av1_get_interp_filter_params(interp_filter[0 + 2 * ref]);
|
||||
#else
|
||||
InterpFilterParams interp_filter_params =
|
||||
const InterpFilterParams interp_filter_params_x =
|
||||
av1_get_interp_filter_params(interp_filter);
|
||||
const InterpFilterParams interp_filter_params_y = interp_filter_params_x;
|
||||
#endif
|
||||
|
||||
#if CONFIG_DUAL_FILTER
|
||||
if (interp_filter_params_x.taps == SUBPEL_TAPS &&
|
||||
interp_filter_params_y.taps == SUBPEL_TAPS && w > 2 && h > 2) {
|
||||
const int16_t *kernel_x =
|
||||
av1_get_interp_filter_subpel_kernel(interp_filter_params_x, subpel_x);
|
||||
const int16_t *kernel_y =
|
||||
av1_get_interp_filter_subpel_kernel(interp_filter_params_y, subpel_y);
|
||||
#else
|
||||
if (interp_filter_params.taps == SUBPEL_TAPS && w > 2 && h > 2) {
|
||||
const int16_t *kernel_x =
|
||||
av1_get_interp_filter_subpel_kernel(interp_filter_params, subpel_x);
|
||||
const int16_t *kernel_y =
|
||||
av1_get_interp_filter_subpel_kernel(interp_filter_params, subpel_y);
|
||||
#endif // CONFIG_DUAL_FILTER
|
||||
sf->highbd_predict[subpel_x != 0][subpel_y != 0][ref](
|
||||
src, src_stride, dst, dst_stride, kernel_x, xs, kernel_y, ys, w, h, bd);
|
||||
} else {
|
||||
// ref > 0 means this is the second reference frame
|
||||
// first reference frame's prediction result is already in dst
|
||||
// therefore we need to average the first and second results
|
||||
int avg = ref > 0;
|
||||
if (has_scale(xs, ys)) {
|
||||
av1_highbd_convolve(src, src_stride, dst, dst_stride, w, h, interp_filter,
|
||||
subpel_x, xs, subpel_y, ys, avg, bd);
|
||||
} else 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,
|
||||
#if CONFIG_DUAL_FILTER
|
||||
interp_filter,
|
||||
#else // CONFIG_DUAL_FILTER
|
||||
&interp_filter,
|
||||
#endif // CONFIG_DUAL_FILTER
|
||||
subpel_x, xs, subpel_y, ys, conv_params, bd);
|
||||
conv_params->do_post_rounding = 1;
|
||||
#else
|
||||
assert(0);
|
||||
#endif // CONFIG_CONVOLVE_ROUND
|
||||
} else {
|
||||
if (interp_filter_params_x.taps == SUBPEL_TAPS &&
|
||||
interp_filter_params_y.taps == SUBPEL_TAPS && w > 2 && h > 2) {
|
||||
const int16_t *kernel_x =
|
||||
av1_get_interp_filter_subpel_kernel(interp_filter_params_x, subpel_x);
|
||||
const int16_t *kernel_y =
|
||||
av1_get_interp_filter_subpel_kernel(interp_filter_params_y, subpel_y);
|
||||
sf->highbd_predict[subpel_x != 0][subpel_y != 0][ref](
|
||||
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_filter,
|
||||
subpel_x, xs, subpel_y, ys, avg, bd);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
|
|
@ -254,7 +258,7 @@ void build_compound_seg_mask_highbd(uint8_t *mask, SEG_MASK_TYPE mask_type,
|
|||
#endif // CONFIG_COMPOUND_SEGMENT
|
||||
#endif // CONFIG_EXT_INTER
|
||||
|
||||
void build_inter_predictors(MACROBLOCKD *xd, int plane,
|
||||
void build_inter_predictors(const AV1_COMMON *cm, MACROBLOCKD *xd, int plane,
|
||||
#if CONFIG_MOTION_VAR
|
||||
int mi_col_offset, int mi_row_offset,
|
||||
#endif // CONFIG_MOTION_VAR
|
||||
|
|
@ -415,20 +419,26 @@ static INLINE void av1_make_inter_predictor(
|
|||
if (do_warp) {
|
||||
const struct macroblockd_plane *const pd = &xd->plane[plane];
|
||||
const struct buf_2d *const pre_buf = &pd->pre[ref];
|
||||
#if CONFIG_EXT_INTER
|
||||
int compute_avg =
|
||||
ref && mi->mbmi.interinter_compound_type == COMPOUND_AVERAGE;
|
||||
#else
|
||||
int compute_avg = ref;
|
||||
#endif // CONFIG_EXT_INTER
|
||||
av1_warp_plane(&final_warp_params,
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH, xd->bd,
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
pre_buf->buf0, pre_buf->width, pre_buf->height,
|
||||
pre_buf->stride, dst, p_col, p_row, w, h, dst_stride,
|
||||
pd->subsampling_x, pd->subsampling_y, xs, ys, ref);
|
||||
pd->subsampling_x, pd->subsampling_y, xs, ys, compute_avg);
|
||||
return;
|
||||
}
|
||||
#endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
|
||||
highbd_inter_predictor(src, src_stride, dst, dst_stride, subpel_x, subpel_y,
|
||||
sf, w, h, conv_params->ref, interp_filter, xs, ys,
|
||||
sf, w, h, conv_params, interp_filter, xs, ys,
|
||||
xd->bd);
|
||||
return;
|
||||
}
|
||||
|
|
@ -526,27 +536,32 @@ static INLINE MV average_split_mvs(const struct macroblockd_plane *pd,
|
|||
return res;
|
||||
}
|
||||
|
||||
void av1_build_inter_predictor_sub8x8(MACROBLOCKD *xd, int plane, int i, int ir,
|
||||
int ic, int mi_row, int mi_col);
|
||||
void av1_build_inter_predictor_sub8x8(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
||||
int plane, int i, int ir, int ic,
|
||||
int mi_row, int mi_col);
|
||||
|
||||
void av1_build_inter_predictors_sby(MACROBLOCKD *xd, int mi_row, int mi_col,
|
||||
BUFFER_SET *ctx, BLOCK_SIZE bsize);
|
||||
void av1_build_inter_predictors_sby(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
||||
int mi_row, int mi_col, BUFFER_SET *ctx,
|
||||
BLOCK_SIZE bsize);
|
||||
|
||||
void av1_build_inter_predictors_sbuv(MACROBLOCKD *xd, int mi_row, int mi_col,
|
||||
BUFFER_SET *ctx, BLOCK_SIZE bsize);
|
||||
void av1_build_inter_predictors_sbuv(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
||||
int mi_row, int mi_col, BUFFER_SET *ctx,
|
||||
BLOCK_SIZE bsize);
|
||||
|
||||
void av1_build_inter_predictors_sb(MACROBLOCKD *xd, int mi_row, int mi_col,
|
||||
BUFFER_SET *ctx, BLOCK_SIZE bsize);
|
||||
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_predictors_sb_sub8x8_extend(MACROBLOCKD *xd,
|
||||
void av1_build_inter_predictors_sb_sub8x8_extend(const AV1_COMMON *cm,
|
||||
MACROBLOCKD *xd,
|
||||
#if CONFIG_EXT_INTER
|
||||
int mi_row_ori, int mi_col_ori,
|
||||
#endif // CONFIG_EXT_INTER
|
||||
int mi_row, int mi_col,
|
||||
BLOCK_SIZE bsize, int block);
|
||||
|
||||
void av1_build_inter_predictors_sb_extend(MACROBLOCKD *xd,
|
||||
void av1_build_inter_predictors_sb_extend(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
||||
#if CONFIG_EXT_INTER
|
||||
int mi_row_ori, int mi_col_ori,
|
||||
#endif // CONFIG_EXT_INTER
|
||||
|
|
@ -783,7 +798,7 @@ const uint8_t *av1_get_compound_type_mask_inverse(
|
|||
|
||||
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(MACROBLOCKD *xd, uint8_t *ypred,
|
||||
uint8_t *upred, uint8_t *vpred,
|
||||
int ystride, int ustride, int vstride,
|
||||
|
|
@ -807,7 +822,7 @@ void av1_build_intra_predictors_for_interintra(MACROBLOCKD *xd,
|
|||
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,
|
||||
|
|
|
|||
481
third_party/aom/av1/common/reconintra.c
vendored
481
third_party/aom/av1/common/reconintra.c
vendored
|
|
@ -47,7 +47,11 @@ static const uint8_t extend_modes[INTRA_MODES] = {
|
|||
NEED_LEFT | NEED_BOTTOMLEFT, // D207
|
||||
NEED_ABOVE | NEED_ABOVERIGHT, // D63
|
||||
#if CONFIG_ALT_INTRA
|
||||
NEED_LEFT | NEED_ABOVE, // SMOOTH
|
||||
NEED_LEFT | NEED_ABOVE, // SMOOTH
|
||||
#if CONFIG_SMOOTH_HV
|
||||
NEED_LEFT | NEED_ABOVE, // SMOOTH_V
|
||||
NEED_LEFT | NEED_ABOVE, // SMOOTH_H
|
||||
#endif // CONFIG_SMOOTH_HV
|
||||
#endif // CONFIG_ALT_INTRA
|
||||
NEED_LEFT | NEED_ABOVE | NEED_ABOVELEFT, // TM
|
||||
};
|
||||
|
|
@ -443,8 +447,10 @@ static int has_top_right(BLOCK_SIZE bsize, int mi_row, int mi_col,
|
|||
const int plane_bw_unit = AOMMAX(bw_unit >> ss_x, 1);
|
||||
const int top_right_count_unit = tx_size_wide_unit[txsz];
|
||||
|
||||
#if !CONFIG_CB4X4
|
||||
// Special handling for block sizes 4x8 and 4x4.
|
||||
if (ss_x == 0 && bw_unit < 2 && col_off == 0) return 1;
|
||||
#endif
|
||||
|
||||
if (row_off > 0) { // Just need to check if enough pixels on the right.
|
||||
return col_off + top_right_count_unit < plane_bw_unit;
|
||||
|
|
@ -514,9 +520,13 @@ static int has_bottom_left(BLOCK_SIZE bsize, int mi_row, int mi_col,
|
|||
// and/or bottom-left superblocks. But only the left superblock is
|
||||
// available, so check if all required pixels fall in that superblock.
|
||||
if (blk_col_in_sb == 0) {
|
||||
const int blk_start_row_off = blk_row_in_sb << (bh_in_mi_log2 + !ss_y);
|
||||
const int blk_start_row_off = blk_row_in_sb
|
||||
<< (bh_in_mi_log2 + MI_SIZE_LOG2 -
|
||||
tx_size_wide_log2[0]) >>
|
||||
ss_y;
|
||||
const int row_off_in_sb = blk_start_row_off + row_off;
|
||||
const int sb_height_unit = MAX_MIB_SIZE << !ss_y;
|
||||
const int sb_height_unit =
|
||||
MAX_MIB_SIZE << (MI_SIZE_LOG2 - tx_size_wide_log2[0]) >> ss_y;
|
||||
return row_off_in_sb + bottom_left_count_unit < sb_height_unit;
|
||||
}
|
||||
|
||||
|
|
@ -554,6 +564,9 @@ static intra_high_pred_fn dc_pred_high[2][2][TX_SIZES];
|
|||
#endif // CONFIG_HIGHBITDEPTH
|
||||
|
||||
static void av1_init_intra_predictors_internal(void) {
|
||||
#if CONFIG_EXT_INTRA
|
||||
assert(NELEMENTS(mode_to_angle_map) == INTRA_MODES);
|
||||
#endif // CONFIG_EXT_INTRA
|
||||
#if CONFIG_TX64X64
|
||||
#define INIT_NO_4X4(p, type) \
|
||||
p[TX_8X8] = aom_##type##_predictor_8x8; \
|
||||
|
|
@ -567,7 +580,7 @@ static void av1_init_intra_predictors_internal(void) {
|
|||
p[TX_32X32] = aom_##type##_predictor_32x32
|
||||
#endif // CONFIG_TX64X64
|
||||
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
#define INIT_ALL_SIZES(p, type) \
|
||||
p[TX_2X2] = aom_##type##_predictor_2x2; \
|
||||
p[TX_4X4] = aom_##type##_predictor_4x4; \
|
||||
|
|
@ -590,6 +603,10 @@ static void av1_init_intra_predictors_internal(void) {
|
|||
#if CONFIG_ALT_INTRA
|
||||
INIT_ALL_SIZES(pred[TM_PRED], paeth);
|
||||
INIT_ALL_SIZES(pred[SMOOTH_PRED], smooth);
|
||||
#if CONFIG_SMOOTH_HV
|
||||
INIT_ALL_SIZES(pred[SMOOTH_V_PRED], smooth_v);
|
||||
INIT_ALL_SIZES(pred[SMOOTH_H_PRED], smooth_h);
|
||||
#endif // CONFIG_SMOOTH_HV
|
||||
#else
|
||||
INIT_ALL_SIZES(pred[TM_PRED], tm);
|
||||
#endif // CONFIG_ALT_INTRA
|
||||
|
|
@ -612,6 +629,10 @@ static void av1_init_intra_predictors_internal(void) {
|
|||
#if CONFIG_ALT_INTRA
|
||||
INIT_ALL_SIZES(pred_high[TM_PRED], highbd_paeth);
|
||||
INIT_ALL_SIZES(pred_high[SMOOTH_PRED], highbd_smooth);
|
||||
#if CONFIG_SMOOTH_HV
|
||||
INIT_ALL_SIZES(pred_high[SMOOTH_V_PRED], highbd_smooth_v);
|
||||
INIT_ALL_SIZES(pred_high[SMOOTH_H_PRED], highbd_smooth_h);
|
||||
#endif // CONFIG_SMOOTH_HV
|
||||
#else
|
||||
INIT_ALL_SIZES(pred_high[TM_PRED], highbd_tm);
|
||||
#endif // CONFIG_ALT_INTRA
|
||||
|
|
@ -786,6 +807,7 @@ static void dr_prediction_z2(uint8_t *dst, ptrdiff_t stride, int bs,
|
|||
#endif // CONFIG_INTRA_INTERP
|
||||
} else {
|
||||
base2 = y >> 8;
|
||||
assert(base2 >= -1);
|
||||
shift2 = y & 0xFF;
|
||||
#if CONFIG_INTRA_INTERP
|
||||
val = intra_subpel_interp(base2, shift2, left, -1, bs - 1, filter_type);
|
||||
|
|
@ -1191,8 +1213,8 @@ static void highbd_dr_predictor(uint16_t *dst, ptrdiff_t stride, int bs,
|
|||
|
||||
#if CONFIG_FILTER_INTRA
|
||||
#if USE_3TAP_INTRA_FILTER
|
||||
int av1_filter_intra_taps_3[TX_SIZES][INTRA_MODES][3] = {
|
||||
#if CONFIG_CB4X4
|
||||
static int filter_intra_taps_3[TX_SIZES][FILTER_INTRA_MODES][3] = {
|
||||
#if CONFIG_CHROMA_2X2
|
||||
{
|
||||
{ 697, 836, -509 },
|
||||
{ 993, 513, -482 },
|
||||
|
|
@ -1203,7 +1225,7 @@ int av1_filter_intra_taps_3[TX_SIZES][INTRA_MODES][3] = {
|
|||
{ 358, 687, -21 },
|
||||
{ 411, 1083, -470 },
|
||||
{ 912, 814, -702 },
|
||||
{ 883, 902, 761 },
|
||||
{ 883, 902, -761 },
|
||||
},
|
||||
#endif
|
||||
{
|
||||
|
|
@ -1216,7 +1238,7 @@ int av1_filter_intra_taps_3[TX_SIZES][INTRA_MODES][3] = {
|
|||
{ 358, 687, -21 },
|
||||
{ 411, 1083, -470 },
|
||||
{ 912, 814, -702 },
|
||||
{ 883, 902, 761 },
|
||||
{ 883, 902, -761 },
|
||||
},
|
||||
{
|
||||
{ 659, 816, -451 },
|
||||
|
|
@ -1270,8 +1292,8 @@ int av1_filter_intra_taps_3[TX_SIZES][INTRA_MODES][3] = {
|
|||
#endif // CONFIG_TX64X64
|
||||
};
|
||||
#else
|
||||
int av1_filter_intra_taps_4[TX_SIZES][INTRA_MODES][4] = {
|
||||
#if CONFIG_CB4X4
|
||||
static int filter_intra_taps_4[TX_SIZES][FILTER_INTRA_MODES][4] = {
|
||||
#if CONFIG_CHROMA_2X2
|
||||
{
|
||||
{ 735, 881, -537, -54 },
|
||||
{ 1005, 519, -488, -11 },
|
||||
|
|
@ -1375,9 +1397,9 @@ static void filter_intra_predictors_3tap(uint8_t *dst, ptrdiff_t stride, int bs,
|
|||
int buffer[33][33];
|
||||
#endif // CONFIG_TX64X64
|
||||
const TX_SIZE tx_size = get_txsize_from_blocklen(bs);
|
||||
const int c0 = av1_filter_intra_taps_3[tx_size][mode][0];
|
||||
const int c1 = av1_filter_intra_taps_3[tx_size][mode][1];
|
||||
const int c2 = av1_filter_intra_taps_3[tx_size][mode][2];
|
||||
const int c0 = filter_intra_taps_3[tx_size][mode][0];
|
||||
const int c1 = filter_intra_taps_3[tx_size][mode][1];
|
||||
const int c2 = filter_intra_taps_3[tx_size][mode][2];
|
||||
|
||||
k = 0;
|
||||
mean = 0;
|
||||
|
|
@ -1397,13 +1419,11 @@ static void filter_intra_predictors_3tap(uint8_t *dst, ptrdiff_t stride, int bs,
|
|||
ipred = c0 * buffer[r - 1][c] + c1 * buffer[r][c - 1] +
|
||||
c2 * buffer[r - 1][c - 1];
|
||||
buffer[r][c] = ROUND_POWER_OF_TWO_SIGNED(ipred, FILTER_INTRA_PREC_BITS);
|
||||
buffer[r][c] = clip_pixel(buffer[r][c] + mean) - mean;
|
||||
}
|
||||
|
||||
for (r = 0; r < bs; ++r) {
|
||||
for (c = 0; c < bs; ++c) {
|
||||
ipred = buffer[r + 1][c + 1] + mean;
|
||||
dst[c] = clip_pixel(ipred);
|
||||
}
|
||||
for (c = 0; c < bs; ++c) dst[c] = clip_pixel(buffer[r + 1][c + 1] + mean);
|
||||
dst += stride;
|
||||
}
|
||||
}
|
||||
|
|
@ -1419,10 +1439,10 @@ static void filter_intra_predictors_4tap(uint8_t *dst, ptrdiff_t stride, int bs,
|
|||
int buffer[33][65];
|
||||
#endif // CONFIG_TX64X64
|
||||
const TX_SIZE tx_size = get_txsize_from_blocklen(bs);
|
||||
const int c0 = av1_filter_intra_taps_4[tx_size][mode][0];
|
||||
const int c1 = av1_filter_intra_taps_4[tx_size][mode][1];
|
||||
const int c2 = av1_filter_intra_taps_4[tx_size][mode][2];
|
||||
const int c3 = av1_filter_intra_taps_4[tx_size][mode][3];
|
||||
const int c0 = filter_intra_taps_4[tx_size][mode][0];
|
||||
const int c1 = filter_intra_taps_4[tx_size][mode][1];
|
||||
const int c2 = filter_intra_taps_4[tx_size][mode][2];
|
||||
const int c3 = filter_intra_taps_4[tx_size][mode][3];
|
||||
|
||||
k = 0;
|
||||
mean = 0;
|
||||
|
|
@ -1442,13 +1462,11 @@ static void filter_intra_predictors_4tap(uint8_t *dst, ptrdiff_t stride, int bs,
|
|||
ipred = c0 * buffer[r - 1][c] + c1 * buffer[r][c - 1] +
|
||||
c2 * buffer[r - 1][c - 1] + c3 * buffer[r - 1][c + 1];
|
||||
buffer[r][c] = ROUND_POWER_OF_TWO_SIGNED(ipred, FILTER_INTRA_PREC_BITS);
|
||||
buffer[r][c] = clip_pixel(buffer[r][c] + mean) - mean;
|
||||
}
|
||||
|
||||
for (r = 0; r < bs; ++r) {
|
||||
for (c = 0; c < bs; ++c) {
|
||||
ipred = buffer[r + 1][c + 1] + mean;
|
||||
dst[c] = clip_pixel(ipred);
|
||||
}
|
||||
for (c = 0; c < bs; ++c) dst[c] = clip_pixel(buffer[r + 1][c + 1] + mean);
|
||||
dst += stride;
|
||||
}
|
||||
}
|
||||
|
|
@ -1457,90 +1475,90 @@ static void filter_intra_predictors_4tap(uint8_t *dst, ptrdiff_t stride, int bs,
|
|||
void av1_dc_filter_predictor_c(uint8_t *dst, ptrdiff_t stride, int bs,
|
||||
const uint8_t *above, const uint8_t *left) {
|
||||
#if USE_3TAP_INTRA_FILTER
|
||||
filter_intra_predictors_3tap(dst, stride, bs, above, left, DC_PRED);
|
||||
filter_intra_predictors_3tap(dst, stride, bs, above, left, FILTER_DC_PRED);
|
||||
#else
|
||||
filter_intra_predictors_4tap(dst, stride, bs, above, left, DC_PRED);
|
||||
filter_intra_predictors_4tap(dst, stride, bs, above, left, FILTER_DC_PRED);
|
||||
#endif
|
||||
}
|
||||
|
||||
void av1_v_filter_predictor_c(uint8_t *dst, ptrdiff_t stride, int bs,
|
||||
const uint8_t *above, const uint8_t *left) {
|
||||
#if USE_3TAP_INTRA_FILTER
|
||||
filter_intra_predictors_3tap(dst, stride, bs, above, left, V_PRED);
|
||||
filter_intra_predictors_3tap(dst, stride, bs, above, left, FILTER_V_PRED);
|
||||
#else
|
||||
filter_intra_predictors_4tap(dst, stride, bs, above, left, V_PRED);
|
||||
filter_intra_predictors_4tap(dst, stride, bs, above, left, FILTER_V_PRED);
|
||||
#endif
|
||||
}
|
||||
|
||||
void av1_h_filter_predictor_c(uint8_t *dst, ptrdiff_t stride, int bs,
|
||||
const uint8_t *above, const uint8_t *left) {
|
||||
#if USE_3TAP_INTRA_FILTER
|
||||
filter_intra_predictors_3tap(dst, stride, bs, above, left, H_PRED);
|
||||
filter_intra_predictors_3tap(dst, stride, bs, above, left, FILTER_H_PRED);
|
||||
#else
|
||||
filter_intra_predictors_4tap(dst, stride, bs, above, left, H_PRED);
|
||||
filter_intra_predictors_4tap(dst, stride, bs, above, left, FILTER_H_PRED);
|
||||
#endif
|
||||
}
|
||||
|
||||
void av1_d45_filter_predictor_c(uint8_t *dst, ptrdiff_t stride, int bs,
|
||||
const uint8_t *above, const uint8_t *left) {
|
||||
#if USE_3TAP_INTRA_FILTER
|
||||
filter_intra_predictors_3tap(dst, stride, bs, above, left, D45_PRED);
|
||||
filter_intra_predictors_3tap(dst, stride, bs, above, left, FILTER_D45_PRED);
|
||||
#else
|
||||
filter_intra_predictors_4tap(dst, stride, bs, above, left, D45_PRED);
|
||||
filter_intra_predictors_4tap(dst, stride, bs, above, left, FILTER_D45_PRED);
|
||||
#endif
|
||||
}
|
||||
|
||||
void av1_d135_filter_predictor_c(uint8_t *dst, ptrdiff_t stride, int bs,
|
||||
const uint8_t *above, const uint8_t *left) {
|
||||
#if USE_3TAP_INTRA_FILTER
|
||||
filter_intra_predictors_3tap(dst, stride, bs, above, left, D135_PRED);
|
||||
filter_intra_predictors_3tap(dst, stride, bs, above, left, FILTER_D135_PRED);
|
||||
#else
|
||||
filter_intra_predictors_4tap(dst, stride, bs, above, left, D135_PRED);
|
||||
filter_intra_predictors_4tap(dst, stride, bs, above, left, FILTER_D135_PRED);
|
||||
#endif
|
||||
}
|
||||
|
||||
void av1_d117_filter_predictor_c(uint8_t *dst, ptrdiff_t stride, int bs,
|
||||
const uint8_t *above, const uint8_t *left) {
|
||||
#if USE_3TAP_INTRA_FILTER
|
||||
filter_intra_predictors_3tap(dst, stride, bs, above, left, D117_PRED);
|
||||
filter_intra_predictors_3tap(dst, stride, bs, above, left, FILTER_D117_PRED);
|
||||
#else
|
||||
filter_intra_predictors_4tap(dst, stride, bs, above, left, D117_PRED);
|
||||
filter_intra_predictors_4tap(dst, stride, bs, above, left, FILTER_D117_PRED);
|
||||
#endif
|
||||
}
|
||||
|
||||
void av1_d153_filter_predictor_c(uint8_t *dst, ptrdiff_t stride, int bs,
|
||||
const uint8_t *above, const uint8_t *left) {
|
||||
#if USE_3TAP_INTRA_FILTER
|
||||
filter_intra_predictors_3tap(dst, stride, bs, above, left, D153_PRED);
|
||||
filter_intra_predictors_3tap(dst, stride, bs, above, left, FILTER_D153_PRED);
|
||||
#else
|
||||
filter_intra_predictors_4tap(dst, stride, bs, above, left, D153_PRED);
|
||||
filter_intra_predictors_4tap(dst, stride, bs, above, left, FILTER_D153_PRED);
|
||||
#endif
|
||||
}
|
||||
|
||||
void av1_d207_filter_predictor_c(uint8_t *dst, ptrdiff_t stride, int bs,
|
||||
const uint8_t *above, const uint8_t *left) {
|
||||
#if USE_3TAP_INTRA_FILTER
|
||||
filter_intra_predictors_3tap(dst, stride, bs, above, left, D207_PRED);
|
||||
filter_intra_predictors_3tap(dst, stride, bs, above, left, FILTER_D207_PRED);
|
||||
#else
|
||||
filter_intra_predictors_4tap(dst, stride, bs, above, left, D207_PRED);
|
||||
filter_intra_predictors_4tap(dst, stride, bs, above, left, FILTER_D207_PRED);
|
||||
#endif
|
||||
}
|
||||
|
||||
void av1_d63_filter_predictor_c(uint8_t *dst, ptrdiff_t stride, int bs,
|
||||
const uint8_t *above, const uint8_t *left) {
|
||||
#if USE_3TAP_INTRA_FILTER
|
||||
filter_intra_predictors_3tap(dst, stride, bs, above, left, D63_PRED);
|
||||
filter_intra_predictors_3tap(dst, stride, bs, above, left, FILTER_D63_PRED);
|
||||
#else
|
||||
filter_intra_predictors_4tap(dst, stride, bs, above, left, D63_PRED);
|
||||
filter_intra_predictors_4tap(dst, stride, bs, above, left, FILTER_D63_PRED);
|
||||
#endif
|
||||
}
|
||||
|
||||
void av1_tm_filter_predictor_c(uint8_t *dst, ptrdiff_t stride, int bs,
|
||||
const uint8_t *above, const uint8_t *left) {
|
||||
#if USE_3TAP_INTRA_FILTER
|
||||
filter_intra_predictors_3tap(dst, stride, bs, above, left, TM_PRED);
|
||||
filter_intra_predictors_3tap(dst, stride, bs, above, left, FILTER_TM_PRED);
|
||||
#else
|
||||
filter_intra_predictors_4tap(dst, stride, bs, above, left, TM_PRED);
|
||||
filter_intra_predictors_4tap(dst, stride, bs, above, left, FILTER_TM_PRED);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -1595,9 +1613,9 @@ static void highbd_filter_intra_predictors_3tap(uint16_t *dst, ptrdiff_t stride,
|
|||
int preds[33][33];
|
||||
#endif // CONFIG_TX64X64
|
||||
const TX_SIZE tx_size = get_txsize_from_blocklen(bs);
|
||||
const int c0 = av1_filter_intra_taps_3[tx_size][mode][0];
|
||||
const int c1 = av1_filter_intra_taps_3[tx_size][mode][1];
|
||||
const int c2 = av1_filter_intra_taps_3[tx_size][mode][2];
|
||||
const int c0 = filter_intra_taps_3[tx_size][mode][0];
|
||||
const int c1 = filter_intra_taps_3[tx_size][mode][1];
|
||||
const int c2 = filter_intra_taps_3[tx_size][mode][2];
|
||||
|
||||
k = 0;
|
||||
mean = 0;
|
||||
|
|
@ -1617,13 +1635,12 @@ static void highbd_filter_intra_predictors_3tap(uint16_t *dst, ptrdiff_t stride,
|
|||
ipred = c0 * preds[r - 1][c] + c1 * preds[r][c - 1] +
|
||||
c2 * preds[r - 1][c - 1];
|
||||
preds[r][c] = ROUND_POWER_OF_TWO_SIGNED(ipred, FILTER_INTRA_PREC_BITS);
|
||||
preds[r][c] = clip_pixel_highbd(preds[r][c] + mean, bd) - mean;
|
||||
}
|
||||
|
||||
for (r = 0; r < bs; ++r) {
|
||||
for (c = 0; c < bs; ++c) {
|
||||
ipred = preds[r + 1][c + 1] + mean;
|
||||
dst[c] = clip_pixel_highbd(ipred, bd);
|
||||
}
|
||||
for (c = 0; c < bs; ++c)
|
||||
dst[c] = clip_pixel_highbd(preds[r + 1][c + 1] + mean, bd);
|
||||
dst += stride;
|
||||
}
|
||||
}
|
||||
|
|
@ -1640,10 +1657,10 @@ static void highbd_filter_intra_predictors_4tap(uint16_t *dst, ptrdiff_t stride,
|
|||
int preds[33][65];
|
||||
#endif // CONFIG_TX64X64
|
||||
const TX_SIZE tx_size = get_txsize_from_blocklen(bs);
|
||||
const int c0 = av1_filter_intra_taps_4[tx_size][mode][0];
|
||||
const int c1 = av1_filter_intra_taps_4[tx_size][mode][1];
|
||||
const int c2 = av1_filter_intra_taps_4[tx_size][mode][2];
|
||||
const int c3 = av1_filter_intra_taps_4[tx_size][mode][3];
|
||||
const int c0 = filter_intra_taps_4[tx_size][mode][0];
|
||||
const int c1 = filter_intra_taps_4[tx_size][mode][1];
|
||||
const int c2 = filter_intra_taps_4[tx_size][mode][2];
|
||||
const int c3 = filter_intra_taps_4[tx_size][mode][3];
|
||||
|
||||
k = 0;
|
||||
mean = 0;
|
||||
|
|
@ -1663,13 +1680,12 @@ static void highbd_filter_intra_predictors_4tap(uint16_t *dst, ptrdiff_t stride,
|
|||
ipred = c0 * preds[r - 1][c] + c1 * preds[r][c - 1] +
|
||||
c2 * preds[r - 1][c - 1] + c3 * preds[r - 1][c + 1];
|
||||
preds[r][c] = ROUND_POWER_OF_TWO_SIGNED(ipred, FILTER_INTRA_PREC_BITS);
|
||||
preds[r][c] = clip_pixel_highbd(preds[r][c] + mean, bd) - mean;
|
||||
}
|
||||
|
||||
for (r = 0; r < bs; ++r) {
|
||||
for (c = 0; c < bs; ++c) {
|
||||
ipred = preds[r + 1][c + 1] + mean;
|
||||
dst[c] = clip_pixel_highbd(ipred, bd);
|
||||
}
|
||||
for (c = 0; c < bs; ++c)
|
||||
dst[c] = clip_pixel_highbd(preds[r + 1][c + 1] + mean, bd);
|
||||
dst += stride;
|
||||
}
|
||||
}
|
||||
|
|
@ -1679,11 +1695,11 @@ void av1_highbd_dc_filter_predictor_c(uint16_t *dst, ptrdiff_t stride, int bs,
|
|||
const uint16_t *above,
|
||||
const uint16_t *left, int bd) {
|
||||
#if USE_3TAP_INTRA_FILTER
|
||||
highbd_filter_intra_predictors_3tap(dst, stride, bs, above, left, DC_PRED,
|
||||
bd);
|
||||
highbd_filter_intra_predictors_3tap(dst, stride, bs, above, left,
|
||||
FILTER_DC_PRED, bd);
|
||||
#else
|
||||
highbd_filter_intra_predictors_4tap(dst, stride, bs, above, left, DC_PRED,
|
||||
bd);
|
||||
highbd_filter_intra_predictors_4tap(dst, stride, bs, above, left,
|
||||
FILTER_DC_PRED, bd);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -1691,9 +1707,11 @@ void av1_highbd_v_filter_predictor_c(uint16_t *dst, ptrdiff_t stride, int bs,
|
|||
const uint16_t *above,
|
||||
const uint16_t *left, int bd) {
|
||||
#if USE_3TAP_INTRA_FILTER
|
||||
highbd_filter_intra_predictors_3tap(dst, stride, bs, above, left, V_PRED, bd);
|
||||
highbd_filter_intra_predictors_3tap(dst, stride, bs, above, left,
|
||||
FILTER_V_PRED, bd);
|
||||
#else
|
||||
highbd_filter_intra_predictors_4tap(dst, stride, bs, above, left, V_PRED, bd);
|
||||
highbd_filter_intra_predictors_4tap(dst, stride, bs, above, left,
|
||||
FILTER_V_PRED, bd);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -1701,9 +1719,11 @@ void av1_highbd_h_filter_predictor_c(uint16_t *dst, ptrdiff_t stride, int bs,
|
|||
const uint16_t *above,
|
||||
const uint16_t *left, int bd) {
|
||||
#if USE_3TAP_INTRA_FILTER
|
||||
highbd_filter_intra_predictors_3tap(dst, stride, bs, above, left, H_PRED, bd);
|
||||
highbd_filter_intra_predictors_3tap(dst, stride, bs, above, left,
|
||||
FILTER_H_PRED, bd);
|
||||
#else
|
||||
highbd_filter_intra_predictors_4tap(dst, stride, bs, above, left, H_PRED, bd);
|
||||
highbd_filter_intra_predictors_4tap(dst, stride, bs, above, left,
|
||||
FILTER_H_PRED, bd);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -1711,11 +1731,11 @@ void av1_highbd_d45_filter_predictor_c(uint16_t *dst, ptrdiff_t stride, int bs,
|
|||
const uint16_t *above,
|
||||
const uint16_t *left, int bd) {
|
||||
#if USE_3TAP_INTRA_FILTER
|
||||
highbd_filter_intra_predictors_3tap(dst, stride, bs, above, left, D45_PRED,
|
||||
bd);
|
||||
highbd_filter_intra_predictors_3tap(dst, stride, bs, above, left,
|
||||
FILTER_D45_PRED, bd);
|
||||
#else
|
||||
highbd_filter_intra_predictors_4tap(dst, stride, bs, above, left, D45_PRED,
|
||||
bd);
|
||||
highbd_filter_intra_predictors_4tap(dst, stride, bs, above, left,
|
||||
FILTER_D45_PRED, bd);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -1723,11 +1743,11 @@ void av1_highbd_d135_filter_predictor_c(uint16_t *dst, ptrdiff_t stride, int bs,
|
|||
const uint16_t *above,
|
||||
const uint16_t *left, int bd) {
|
||||
#if USE_3TAP_INTRA_FILTER
|
||||
highbd_filter_intra_predictors_3tap(dst, stride, bs, above, left, D135_PRED,
|
||||
bd);
|
||||
highbd_filter_intra_predictors_3tap(dst, stride, bs, above, left,
|
||||
FILTER_D135_PRED, bd);
|
||||
#else
|
||||
highbd_filter_intra_predictors_4tap(dst, stride, bs, above, left, D135_PRED,
|
||||
bd);
|
||||
highbd_filter_intra_predictors_4tap(dst, stride, bs, above, left,
|
||||
FILTER_D135_PRED, bd);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -1735,11 +1755,11 @@ void av1_highbd_d117_filter_predictor_c(uint16_t *dst, ptrdiff_t stride, int bs,
|
|||
const uint16_t *above,
|
||||
const uint16_t *left, int bd) {
|
||||
#if USE_3TAP_INTRA_FILTER
|
||||
highbd_filter_intra_predictors_3tap(dst, stride, bs, above, left, D117_PRED,
|
||||
bd);
|
||||
highbd_filter_intra_predictors_3tap(dst, stride, bs, above, left,
|
||||
FILTER_D117_PRED, bd);
|
||||
#else
|
||||
highbd_filter_intra_predictors_4tap(dst, stride, bs, above, left, D117_PRED,
|
||||
bd);
|
||||
highbd_filter_intra_predictors_4tap(dst, stride, bs, above, left,
|
||||
FILTER_D117_PRED, bd);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -1747,11 +1767,11 @@ void av1_highbd_d153_filter_predictor_c(uint16_t *dst, ptrdiff_t stride, int bs,
|
|||
const uint16_t *above,
|
||||
const uint16_t *left, int bd) {
|
||||
#if USE_3TAP_INTRA_FILTER
|
||||
highbd_filter_intra_predictors_3tap(dst, stride, bs, above, left, D153_PRED,
|
||||
bd);
|
||||
highbd_filter_intra_predictors_3tap(dst, stride, bs, above, left,
|
||||
FILTER_D153_PRED, bd);
|
||||
#else
|
||||
highbd_filter_intra_predictors_4tap(dst, stride, bs, above, left, D153_PRED,
|
||||
bd);
|
||||
highbd_filter_intra_predictors_4tap(dst, stride, bs, above, left,
|
||||
FILTER_D153_PRED, bd);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -1759,11 +1779,11 @@ void av1_highbd_d207_filter_predictor_c(uint16_t *dst, ptrdiff_t stride, int bs,
|
|||
const uint16_t *above,
|
||||
const uint16_t *left, int bd) {
|
||||
#if USE_3TAP_INTRA_FILTER
|
||||
highbd_filter_intra_predictors_3tap(dst, stride, bs, above, left, D207_PRED,
|
||||
bd);
|
||||
highbd_filter_intra_predictors_3tap(dst, stride, bs, above, left,
|
||||
FILTER_D207_PRED, bd);
|
||||
#else
|
||||
highbd_filter_intra_predictors_4tap(dst, stride, bs, above, left, D207_PRED,
|
||||
bd);
|
||||
highbd_filter_intra_predictors_4tap(dst, stride, bs, above, left,
|
||||
FILTER_D207_PRED, bd);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -1771,11 +1791,11 @@ void av1_highbd_d63_filter_predictor_c(uint16_t *dst, ptrdiff_t stride, int bs,
|
|||
const uint16_t *above,
|
||||
const uint16_t *left, int bd) {
|
||||
#if USE_3TAP_INTRA_FILTER
|
||||
highbd_filter_intra_predictors_3tap(dst, stride, bs, above, left, D63_PRED,
|
||||
bd);
|
||||
highbd_filter_intra_predictors_3tap(dst, stride, bs, above, left,
|
||||
FILTER_D63_PRED, bd);
|
||||
#else
|
||||
highbd_filter_intra_predictors_4tap(dst, stride, bs, above, left, D63_PRED,
|
||||
bd);
|
||||
highbd_filter_intra_predictors_4tap(dst, stride, bs, above, left,
|
||||
FILTER_D63_PRED, bd);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -1783,11 +1803,11 @@ void av1_highbd_tm_filter_predictor_c(uint16_t *dst, ptrdiff_t stride, int bs,
|
|||
const uint16_t *above,
|
||||
const uint16_t *left, int bd) {
|
||||
#if USE_3TAP_INTRA_FILTER
|
||||
highbd_filter_intra_predictors_3tap(dst, stride, bs, above, left, TM_PRED,
|
||||
bd);
|
||||
highbd_filter_intra_predictors_3tap(dst, stride, bs, above, left,
|
||||
FILTER_TM_PRED, bd);
|
||||
#else
|
||||
highbd_filter_intra_predictors_4tap(dst, stride, bs, above, left, TM_PRED,
|
||||
bd);
|
||||
highbd_filter_intra_predictors_4tap(dst, stride, bs, above, left,
|
||||
FILTER_TM_PRED, bd);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -1832,6 +1852,87 @@ static void highbd_filter_intra_predictors(FILTER_INTRA_MODE mode,
|
|||
#endif // CONFIG_HIGHBITDEPTH
|
||||
#endif // CONFIG_FILTER_INTRA
|
||||
|
||||
#if CONFIG_INTRA_EDGE
|
||||
static int intra_edge_filter_strength(int bsz, int delta) {
|
||||
const int d = abs(delta);
|
||||
int strength = 0;
|
||||
|
||||
if (bsz == 8) {
|
||||
if (d < 8) {
|
||||
strength = 0;
|
||||
} else if (d < 32) {
|
||||
strength = 1;
|
||||
} else if (d < 90) {
|
||||
strength = 3;
|
||||
}
|
||||
} else if (bsz == 16) {
|
||||
if (d < 4) {
|
||||
strength = 0;
|
||||
} else if (d < 16) {
|
||||
strength = 1;
|
||||
} else if (d < 90) {
|
||||
strength = 3;
|
||||
}
|
||||
} else if (bsz == 32) {
|
||||
if (d < 16) {
|
||||
strength = 2;
|
||||
} else if (d < 90) {
|
||||
strength = 3;
|
||||
}
|
||||
}
|
||||
|
||||
return strength;
|
||||
}
|
||||
|
||||
static void filter_intra_edge(uint8_t *p, int sz, int strength) {
|
||||
if (!strength) return;
|
||||
|
||||
const int kernel[3][5] = {
|
||||
{ 0, 4, 8, 4, 0 }, { 0, 5, 6, 5, 0 }, { 2, 4, 4, 4, 2 }
|
||||
};
|
||||
const int filt = strength - 1;
|
||||
uint8_t edge[129];
|
||||
|
||||
memcpy(edge, p, sz * sizeof(*p));
|
||||
for (int i = 1; i < sz - 1; i++) {
|
||||
int s = 0;
|
||||
for (int j = 0; j < 5; j++) {
|
||||
int k = i - 2 + j;
|
||||
k = (k < 0) ? 0 : k;
|
||||
k = (k > sz - 1) ? sz - 1 : k;
|
||||
s += edge[k] * kernel[filt][j];
|
||||
}
|
||||
s = (s + 8) >> 4;
|
||||
p[i] = s;
|
||||
}
|
||||
}
|
||||
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
static void filter_intra_edge_high(uint16_t *p, int sz, int strength) {
|
||||
if (!strength) return;
|
||||
|
||||
const int kernel[3][5] = {
|
||||
{ 0, 4, 8, 4, 0 }, { 0, 5, 6, 5, 0 }, { 2, 4, 4, 4, 2 }
|
||||
};
|
||||
const int filt = strength - 1;
|
||||
uint16_t edge[129];
|
||||
|
||||
memcpy(edge, p, sz * sizeof(*p));
|
||||
for (int i = 1; i < sz - 1; i++) {
|
||||
int s = 0;
|
||||
for (int j = 0; j < 5; j++) {
|
||||
int k = i - 2 + j;
|
||||
k = (k < 0) ? 0 : k;
|
||||
k = (k > sz - 1) ? sz - 1 : k;
|
||||
s += edge[k] * kernel[filt][j];
|
||||
}
|
||||
s = (s + 8) >> 4;
|
||||
p[i] = s;
|
||||
}
|
||||
}
|
||||
#endif // CONFIG_INTRA_EDGE
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
static void build_intra_predictors_high(
|
||||
const MACROBLOCKD *xd, const uint8_t *ref8, int ref_stride, uint8_t *dst8,
|
||||
|
|
@ -1842,9 +1943,8 @@ static void build_intra_predictors_high(
|
|||
uint16_t *ref = CONVERT_TO_SHORTPTR(ref8);
|
||||
DECLARE_ALIGNED(16, uint16_t, left_data[MAX_TX_SIZE * 2 + 16]);
|
||||
DECLARE_ALIGNED(16, uint16_t, above_data[MAX_TX_SIZE * 2 + 16]);
|
||||
uint16_t *above_row = above_data + 16;
|
||||
uint16_t *left_col = left_data + 16;
|
||||
const uint16_t *const_above_row = above_row;
|
||||
uint16_t *const above_row = above_data + 16;
|
||||
uint16_t *const left_col = left_data + 16;
|
||||
const int bs = tx_size_wide[tx_size];
|
||||
int need_left = extend_modes[mode] & NEED_LEFT;
|
||||
int need_above = extend_modes[mode] & NEED_ABOVE;
|
||||
|
|
@ -1894,7 +1994,16 @@ static void build_intra_predictors_high(
|
|||
assert(n_bottomleft_px >= 0);
|
||||
|
||||
if ((!need_above && n_left_px == 0) || (!need_left && n_top_px == 0)) {
|
||||
#if CONFIG_INTRA_EDGE
|
||||
int val;
|
||||
if (need_left) {
|
||||
val = (n_top_px > 0) ? above_ref[0] : base + 1;
|
||||
} else {
|
||||
val = (n_left_px > 0) ? ref[-1] : base - 1;
|
||||
}
|
||||
#else
|
||||
const int val = need_left ? base + 1 : base - 1;
|
||||
#endif
|
||||
for (i = 0; i < bs; ++i) {
|
||||
aom_memset16(dst, val, bs);
|
||||
dst += dst_stride;
|
||||
|
|
@ -1927,7 +2036,15 @@ static void build_intra_predictors_high(
|
|||
if (i < (bs << need_bottom))
|
||||
aom_memset16(&left_col[i], left_col[i - 1], (bs << need_bottom) - i);
|
||||
} else {
|
||||
aom_memset16(left_col, base + 1, bs << need_bottom);
|
||||
#if CONFIG_INTRA_EDGE
|
||||
if (n_top_px > 0) {
|
||||
aom_memset16(left_col, above_ref[0], bs << need_bottom);
|
||||
} else {
|
||||
#endif
|
||||
aom_memset16(left_col, base + 1, bs << need_bottom);
|
||||
#if CONFIG_INTRA_EDGE
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1957,20 +2074,58 @@ static void build_intra_predictors_high(
|
|||
if (i < (bs << need_right))
|
||||
aom_memset16(&above_row[i], above_row[i - 1], (bs << need_right) - i);
|
||||
} else {
|
||||
aom_memset16(above_row, base - 1, bs << need_right);
|
||||
#if CONFIG_INTRA_EDGE
|
||||
if (n_left_px > 0) {
|
||||
aom_memset16(above_row, ref[-1], bs << need_right);
|
||||
} else {
|
||||
#endif
|
||||
aom_memset16(above_row, base - 1, bs << need_right);
|
||||
#if CONFIG_INTRA_EDGE
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
if (need_above_left) {
|
||||
#if CONFIG_INTRA_EDGE
|
||||
if (n_top_px > 0 && n_left_px > 0) {
|
||||
above_row[-1] = above_ref[-1];
|
||||
} else if (n_top_px > 0) {
|
||||
above_row[-1] = above_ref[0];
|
||||
} else if (n_left_px > 0) {
|
||||
above_row[-1] = ref[-1];
|
||||
} else {
|
||||
above_row[-1] = base;
|
||||
}
|
||||
#else
|
||||
above_row[-1] =
|
||||
n_top_px > 0 ? (n_left_px > 0 ? above_ref[-1] : base + 1) : base - 1;
|
||||
#endif
|
||||
left_col[-1] = above_row[-1];
|
||||
}
|
||||
|
||||
#if CONFIG_EXT_INTRA && CONFIG_INTRA_EDGE
|
||||
if (is_dr_mode && p_angle != 90 && p_angle != 180) {
|
||||
const int ab_le = need_above_left ? 1 : 0;
|
||||
if (need_above && n_top_px > 0) {
|
||||
const int strength = intra_edge_filter_strength(bs, p_angle - 90);
|
||||
const int need_right = p_angle < 90;
|
||||
const int n_px = n_top_px + ab_le + (need_right ? n_topright_px : 0);
|
||||
filter_intra_edge_high(above_row - ab_le, n_px, strength);
|
||||
}
|
||||
if (need_left && n_left_px > 0) {
|
||||
const int strength = intra_edge_filter_strength(bs, p_angle - 180);
|
||||
const int need_bottom = p_angle > 180;
|
||||
const int n_px = n_left_px + ab_le + (need_bottom ? n_bottomleft_px : 0);
|
||||
filter_intra_edge_high(left_col - ab_le, n_px, strength);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CONFIG_FILTER_INTRA
|
||||
if (filter_intra_mode_info->use_filter_intra_mode[plane != 0]) {
|
||||
highbd_filter_intra_predictors(filter_intra_mode, dst, dst_stride, bs,
|
||||
const_above_row, left_col, xd->bd);
|
||||
above_row, left_col, xd->bd);
|
||||
return;
|
||||
}
|
||||
#endif // CONFIG_FILTER_INTRA
|
||||
|
|
@ -1982,7 +2137,7 @@ static void build_intra_predictors_high(
|
|||
if (plane == 0 && av1_is_intra_filter_switchable(p_angle))
|
||||
filter = xd->mi[0]->mbmi.intra_filter;
|
||||
#endif // CONFIG_INTRA_INTERP
|
||||
highbd_dr_predictor(dst, dst_stride, bs, const_above_row, left_col,
|
||||
highbd_dr_predictor(dst, dst_stride, bs, above_row, left_col,
|
||||
#if CONFIG_INTRA_INTERP
|
||||
filter,
|
||||
#endif // CONFIG_INTRA_INTERP
|
||||
|
|
@ -1994,10 +2149,9 @@ static void build_intra_predictors_high(
|
|||
// predict
|
||||
if (mode == DC_PRED) {
|
||||
dc_pred_high[n_left_px > 0][n_top_px > 0][tx_size](
|
||||
dst, dst_stride, const_above_row, left_col, xd->bd);
|
||||
dst, dst_stride, above_row, left_col, xd->bd);
|
||||
} else {
|
||||
pred_high[mode][tx_size](dst, dst_stride, const_above_row, left_col,
|
||||
xd->bd);
|
||||
pred_high[mode][tx_size](dst, dst_stride, above_row, left_col, xd->bd);
|
||||
}
|
||||
}
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
|
|
@ -2012,9 +2166,8 @@ static void build_intra_predictors(const MACROBLOCKD *xd, const uint8_t *ref,
|
|||
const uint8_t *above_ref = ref - ref_stride;
|
||||
DECLARE_ALIGNED(16, uint8_t, left_data[MAX_TX_SIZE * 2 + 16]);
|
||||
DECLARE_ALIGNED(16, uint8_t, above_data[MAX_TX_SIZE * 2 + 16]);
|
||||
uint8_t *above_row = above_data + 16;
|
||||
uint8_t *left_col = left_data + 16;
|
||||
const uint8_t *const_above_row = above_row;
|
||||
uint8_t *const above_row = above_data + 16;
|
||||
uint8_t *const left_col = left_data + 16;
|
||||
const int bs = tx_size_wide[tx_size];
|
||||
int need_left = extend_modes[mode] & NEED_LEFT;
|
||||
int need_above = extend_modes[mode] & NEED_ABOVE;
|
||||
|
|
@ -2065,7 +2218,16 @@ static void build_intra_predictors(const MACROBLOCKD *xd, const uint8_t *ref,
|
|||
assert(n_bottomleft_px >= 0);
|
||||
|
||||
if ((!need_above && n_left_px == 0) || (!need_left && n_top_px == 0)) {
|
||||
#if CONFIG_INTRA_EDGE
|
||||
int val;
|
||||
if (need_left) {
|
||||
val = (n_top_px > 0) ? above_ref[0] : 129;
|
||||
} else {
|
||||
val = (n_left_px > 0) ? ref[-1] : 127;
|
||||
}
|
||||
#else
|
||||
const int val = need_left ? 129 : 127;
|
||||
#endif
|
||||
for (i = 0; i < bs; ++i) {
|
||||
memset(dst, val, bs);
|
||||
dst += dst_stride;
|
||||
|
|
@ -2098,7 +2260,15 @@ static void build_intra_predictors(const MACROBLOCKD *xd, const uint8_t *ref,
|
|||
if (i < (bs << need_bottom))
|
||||
memset(&left_col[i], left_col[i - 1], (bs << need_bottom) - i);
|
||||
} else {
|
||||
memset(left_col, 129, bs << need_bottom);
|
||||
#if CONFIG_INTRA_EDGE
|
||||
if (n_top_px > 0) {
|
||||
memset(left_col, above_ref[0], bs << need_bottom);
|
||||
} else {
|
||||
#endif
|
||||
memset(left_col, 129, bs << need_bottom);
|
||||
#if CONFIG_INTRA_EDGE
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2127,19 +2297,57 @@ static void build_intra_predictors(const MACROBLOCKD *xd, const uint8_t *ref,
|
|||
if (i < (bs << need_right))
|
||||
memset(&above_row[i], above_row[i - 1], (bs << need_right) - i);
|
||||
} else {
|
||||
memset(above_row, 127, bs << need_right);
|
||||
#if CONFIG_INTRA_EDGE
|
||||
if (n_left_px > 0) {
|
||||
memset(above_row, ref[-1], bs << need_right);
|
||||
} else {
|
||||
#endif
|
||||
memset(above_row, 127, bs << need_right);
|
||||
#if CONFIG_INTRA_EDGE
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
if (need_above_left) {
|
||||
#if CONFIG_INTRA_EDGE
|
||||
if (n_top_px > 0 && n_left_px > 0) {
|
||||
above_row[-1] = above_ref[-1];
|
||||
} else if (n_top_px > 0) {
|
||||
above_row[-1] = above_ref[0];
|
||||
} else if (n_left_px > 0) {
|
||||
above_row[-1] = ref[-1];
|
||||
} else {
|
||||
above_row[-1] = 128;
|
||||
}
|
||||
#else
|
||||
above_row[-1] = n_top_px > 0 ? (n_left_px > 0 ? above_ref[-1] : 129) : 127;
|
||||
#endif
|
||||
left_col[-1] = above_row[-1];
|
||||
}
|
||||
|
||||
#if CONFIG_EXT_INTRA && CONFIG_INTRA_EDGE
|
||||
if (is_dr_mode && p_angle != 90 && p_angle != 180) {
|
||||
const int ab_le = need_above_left ? 1 : 0;
|
||||
if (need_above && n_top_px > 0) {
|
||||
const int strength = intra_edge_filter_strength(bs, p_angle - 90);
|
||||
const int need_right = p_angle < 90;
|
||||
const int n_px = n_top_px + ab_le + (need_right ? n_topright_px : 0);
|
||||
filter_intra_edge(above_row - ab_le, n_px, strength);
|
||||
}
|
||||
if (need_left && n_left_px > 0) {
|
||||
const int strength = intra_edge_filter_strength(bs, p_angle - 180);
|
||||
const int need_bottom = p_angle > 180;
|
||||
const int n_px = n_left_px + ab_le + (need_bottom ? n_bottomleft_px : 0);
|
||||
filter_intra_edge(left_col - ab_le, n_px, strength);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CONFIG_FILTER_INTRA
|
||||
if (filter_intra_mode_info->use_filter_intra_mode[plane != 0]) {
|
||||
filter_intra_predictors(filter_intra_mode, dst, dst_stride, bs,
|
||||
const_above_row, left_col);
|
||||
filter_intra_predictors(filter_intra_mode, dst, dst_stride, bs, above_row,
|
||||
left_col);
|
||||
return;
|
||||
}
|
||||
#endif // CONFIG_FILTER_INTRA
|
||||
|
|
@ -2150,7 +2358,7 @@ static void build_intra_predictors(const MACROBLOCKD *xd, const uint8_t *ref,
|
|||
if (plane == 0 && av1_is_intra_filter_switchable(p_angle))
|
||||
filter = xd->mi[0]->mbmi.intra_filter;
|
||||
#endif // CONFIG_INTRA_INTERP
|
||||
dr_predictor(dst, dst_stride, tx_size, const_above_row, left_col,
|
||||
dr_predictor(dst, dst_stride, tx_size, above_row, left_col,
|
||||
#if CONFIG_INTRA_INTERP
|
||||
filter,
|
||||
#endif // CONFIG_INTRA_INTERP
|
||||
|
|
@ -2165,14 +2373,14 @@ static void build_intra_predictors(const MACROBLOCKD *xd, const uint8_t *ref,
|
|||
// CFL predict its own DC_PRED for Chromatic planes
|
||||
if (plane == AOM_PLANE_Y) {
|
||||
#endif
|
||||
dc_pred[n_left_px > 0][n_top_px > 0][tx_size](dst, dst_stride,
|
||||
const_above_row, left_col);
|
||||
dc_pred[n_left_px > 0][n_top_px > 0][tx_size](dst, dst_stride, above_row,
|
||||
left_col);
|
||||
#if CONFIG_CFL
|
||||
}
|
||||
#endif
|
||||
|
||||
} else {
|
||||
pred[mode][tx_size](dst, dst_stride, const_above_row, left_col);
|
||||
pred[mode][tx_size](dst, dst_stride, above_row, left_col);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2216,9 +2424,9 @@ static void predict_square_intra_block(const MACROBLOCKD *xd, int wpx, int hpx,
|
|||
// the frame bottom edge
|
||||
const int yd = (xd->mb_to_bottom_edge >> (3 + pd->subsampling_y)) +
|
||||
(hpx - y - txhpx) - yd_chr_offset;
|
||||
const int right_available =
|
||||
(mi_col + ((col_off + txw) >> (1 - pd->subsampling_x))) <
|
||||
xd->tile.mi_col_end;
|
||||
const int right_available = mi_col + ((col_off + txw) << pd->subsampling_x >>
|
||||
(MI_SIZE_LOG2 - tx_size_wide_log2[0])) <
|
||||
xd->tile.mi_col_end;
|
||||
const int bottom_available = (yd > 0);
|
||||
#if CONFIG_EXT_PARTITION_TYPES
|
||||
const PARTITION_TYPE partition = xd->mi[0]->mbmi.partition;
|
||||
|
|
@ -2246,30 +2454,27 @@ static void predict_square_intra_block(const MACROBLOCKD *xd, int wpx, int hpx,
|
|||
const int stride = wpx;
|
||||
int r, c;
|
||||
const uint8_t *const map = xd->plane[plane != 0].color_index_map;
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
uint16_t *palette = xd->mi[0]->mbmi.palette_mode_info.palette_colors +
|
||||
plane * PALETTE_MAX_SIZE;
|
||||
#else
|
||||
uint8_t *palette = xd->mi[0]->mbmi.palette_mode_info.palette_colors +
|
||||
plane * PALETTE_MAX_SIZE;
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
|
||||
uint16_t *dst16 = CONVERT_TO_SHORTPTR(dst);
|
||||
for (r = 0; r < bs; ++r)
|
||||
for (c = 0; c < bs; ++c)
|
||||
for (r = 0; r < bs; ++r) {
|
||||
for (c = 0; c < bs; ++c) {
|
||||
dst16[r * dst_stride + c] = palette[map[(r + y) * stride + c + x]];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (r = 0; r < bs; ++r)
|
||||
for (c = 0; c < bs; ++c)
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
for (r = 0; r < bs; ++r) {
|
||||
for (c = 0; c < bs; ++c) {
|
||||
dst[r * dst_stride + c] =
|
||||
(uint8_t)(palette[map[(r + y) * stride + c + x]]);
|
||||
(uint8_t)palette[map[(r + y) * stride + c + x]];
|
||||
}
|
||||
}
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
}
|
||||
#else
|
||||
for (r = 0; r < bs; ++r)
|
||||
for (c = 0; c < bs; ++c)
|
||||
dst[r * dst_stride + c] = palette[map[(r + y) * stride + c + x]];
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
return;
|
||||
}
|
||||
|
|
@ -2316,8 +2521,12 @@ void av1_predict_intra_block_facade(MACROBLOCKD *xd, int plane, int block_idx,
|
|||
// is signaled.
|
||||
cfl_dc_pred(xd, get_plane_block_size(block_idx, pd), tx_size);
|
||||
}
|
||||
cfl_predict_block(xd->cfl, dst, pd->dst.stride, blk_row, blk_col, tx_size,
|
||||
xd->cfl->dc_pred[plane - 1]);
|
||||
|
||||
cfl_predict_block(
|
||||
xd->cfl, dst, pd->dst.stride, blk_row, blk_col, tx_size,
|
||||
xd->cfl->dc_pred[plane - 1],
|
||||
cfl_idx_to_alpha(mbmi->cfl_alpha_idx, mbmi->cfl_alpha_signs[plane - 1],
|
||||
plane - 1));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
52
third_party/aom/av1/common/reconintra.h
vendored
52
third_party/aom/av1/common/reconintra.h
vendored
|
|
@ -19,6 +19,20 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if CONFIG_DPCM_INTRA
|
||||
static INLINE int av1_use_dpcm_intra(int plane, PREDICTION_MODE mode,
|
||||
TX_TYPE tx_type,
|
||||
const MB_MODE_INFO *const mbmi) {
|
||||
(void)mbmi;
|
||||
(void)plane;
|
||||
#if CONFIG_EXT_INTRA
|
||||
if (mbmi->sb_type >= BLOCK_8X8 && mbmi->angle_delta[plane != 0]) return 0;
|
||||
#endif // CONFIG_EXT_INTRA
|
||||
return (mode == V_PRED && (tx_type == IDTX || tx_type == H_DCT)) ||
|
||||
(mode == H_PRED && (tx_type == IDTX || tx_type == V_DCT));
|
||||
}
|
||||
#endif // CONFIG_DPCM_INTRA
|
||||
|
||||
void av1_init_intra_predictors(void);
|
||||
void av1_predict_intra_block_facade(MACROBLOCKD *xd, int plane, int block_idx,
|
||||
int blk_col, int blk_row, TX_SIZE tx_size);
|
||||
|
|
@ -27,30 +41,36 @@ void av1_predict_intra_block(const MACROBLOCKD *xd, int bw, int bh,
|
|||
const uint8_t *ref, int ref_stride, uint8_t *dst,
|
||||
int dst_stride, int aoff, int loff, int plane);
|
||||
|
||||
#if CONFIG_EXT_INTER
|
||||
#if CONFIG_EXT_INTER && 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, D45_PRED, D135_PRED,
|
||||
D117_PRED, D153_PRED, D207_PRED, D63_PRED, TM_PRED
|
||||
DC_PRED, V_PRED, H_PRED,
|
||||
#if CONFIG_ALT_INTRA
|
||||
SMOOTH_PRED
|
||||
#else
|
||||
TM_PRED
|
||||
#endif
|
||||
};
|
||||
|
||||
// Mapping of intra mode to the interintra mode
|
||||
static const INTERINTRA_MODE intra_to_interintra_mode[INTRA_MODES] = {
|
||||
II_DC_PRED, II_V_PRED, II_H_PRED, II_D45_PRED, II_D135_PRED,
|
||||
II_D117_PRED, II_D153_PRED, II_D207_PRED, II_D63_PRED,
|
||||
II_DC_PRED, II_V_PRED, II_H_PRED, II_V_PRED,
|
||||
#if CONFIG_ALT_INTRA
|
||||
II_DC_PRED, // Note: Filler value, as there's no II_SMOOTH_PRED.
|
||||
#endif // CONFIG_ALT_INTRA
|
||||
II_TM_PRED
|
||||
};
|
||||
#endif // CONFIG_EXT_INTER
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
II_SMOOTH_PRED,
|
||||
#else
|
||||
II_TM_PRED,
|
||||
#endif
|
||||
II_V_PRED, II_H_PRED, II_H_PRED, II_V_PRED,
|
||||
#if CONFIG_ALT_INTRA
|
||||
II_SMOOTH_PRED, II_SMOOTH_PRED
|
||||
#else
|
||||
II_TM_PRED
|
||||
#endif
|
||||
};
|
||||
#endif // CONFIG_EXT_INTER && CONFIG_INTERINTRA
|
||||
|
||||
#if CONFIG_FILTER_INTRA
|
||||
#define FILTER_INTRA_PREC_BITS 10
|
||||
extern int av1_filter_intra_taps_4[TX_SIZES][INTRA_MODES][4];
|
||||
#endif // CONFIG_FILTER_INTRA
|
||||
|
||||
#if CONFIG_EXT_INTRA
|
||||
|
|
@ -59,9 +79,15 @@ static INLINE int av1_is_directional_mode(PREDICTION_MODE mode,
|
|||
return mode != DC_PRED && mode != TM_PRED &&
|
||||
#if CONFIG_ALT_INTRA
|
||||
mode != SMOOTH_PRED &&
|
||||
#if CONFIG_SMOOTH_HV
|
||||
mode != SMOOTH_V_PRED && mode != SMOOTH_H_PRED &&
|
||||
#endif // CONFIG_SMOOTH_HV
|
||||
#endif // CONFIG_ALT_INTRA
|
||||
bsize >= BLOCK_8X8;
|
||||
}
|
||||
#endif // CONFIG_EXT_INTRA
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
#endif // AV1_COMMON_RECONINTRA_H_
|
||||
|
|
|
|||
193
third_party/aom/av1/common/resize.c
vendored
193
third_party/aom/av1/common/resize.c
vendored
|
|
@ -21,20 +21,23 @@
|
|||
#include "aom_dsp/aom_dsp_common.h"
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
#include "aom_ports/mem.h"
|
||||
#include "aom_scale/aom_scale.h"
|
||||
#include "av1/common/common.h"
|
||||
#include "av1/common/resize.h"
|
||||
|
||||
#include "./aom_scale_rtcd.h"
|
||||
|
||||
#define FILTER_BITS 7
|
||||
|
||||
#define INTERP_TAPS 8
|
||||
#define SUBPEL_BITS 5
|
||||
#define SUBPEL_MASK ((1 << SUBPEL_BITS) - 1)
|
||||
#define SUBPEL_BITS_RS 5
|
||||
#define SUBPEL_MASK_RS ((1 << SUBPEL_BITS_RS) - 1)
|
||||
#define INTERP_PRECISION_BITS 32
|
||||
|
||||
typedef int16_t interp_kernel[INTERP_TAPS];
|
||||
|
||||
// Filters for interpolation (0.5-band) - note this also filters integer pels.
|
||||
static const interp_kernel filteredinterp_filters500[(1 << SUBPEL_BITS)] = {
|
||||
static const interp_kernel filteredinterp_filters500[(1 << SUBPEL_BITS_RS)] = {
|
||||
{ -3, 0, 35, 64, 35, 0, -3, 0 }, { -3, -1, 34, 64, 36, 1, -3, 0 },
|
||||
{ -3, -1, 32, 64, 38, 1, -3, 0 }, { -2, -2, 31, 63, 39, 2, -3, 0 },
|
||||
{ -2, -2, 29, 63, 41, 2, -3, 0 }, { -2, -2, 28, 63, 42, 3, -4, 0 },
|
||||
|
|
@ -54,7 +57,7 @@ static const interp_kernel filteredinterp_filters500[(1 << SUBPEL_BITS)] = {
|
|||
};
|
||||
|
||||
// Filters for interpolation (0.625-band) - note this also filters integer pels.
|
||||
static const interp_kernel filteredinterp_filters625[(1 << SUBPEL_BITS)] = {
|
||||
static const interp_kernel filteredinterp_filters625[(1 << SUBPEL_BITS_RS)] = {
|
||||
{ -1, -8, 33, 80, 33, -8, -1, 0 }, { -1, -8, 30, 80, 35, -8, -1, 1 },
|
||||
{ -1, -8, 28, 80, 37, -7, -2, 1 }, { 0, -8, 26, 79, 39, -7, -2, 1 },
|
||||
{ 0, -8, 24, 79, 41, -7, -2, 1 }, { 0, -8, 22, 78, 43, -6, -2, 1 },
|
||||
|
|
@ -74,7 +77,7 @@ static const interp_kernel filteredinterp_filters625[(1 << SUBPEL_BITS)] = {
|
|||
};
|
||||
|
||||
// Filters for interpolation (0.75-band) - note this also filters integer pels.
|
||||
static const interp_kernel filteredinterp_filters750[(1 << SUBPEL_BITS)] = {
|
||||
static const interp_kernel filteredinterp_filters750[(1 << SUBPEL_BITS_RS)] = {
|
||||
{ 2, -11, 25, 96, 25, -11, 2, 0 }, { 2, -11, 22, 96, 28, -11, 2, 0 },
|
||||
{ 2, -10, 19, 95, 31, -11, 2, 0 }, { 2, -10, 17, 95, 34, -12, 2, 0 },
|
||||
{ 2, -9, 14, 94, 37, -12, 2, 0 }, { 2, -8, 12, 93, 40, -12, 1, 0 },
|
||||
|
|
@ -94,7 +97,7 @@ static const interp_kernel filteredinterp_filters750[(1 << SUBPEL_BITS)] = {
|
|||
};
|
||||
|
||||
// Filters for interpolation (0.875-band) - note this also filters integer pels.
|
||||
static const interp_kernel filteredinterp_filters875[(1 << SUBPEL_BITS)] = {
|
||||
static const interp_kernel filteredinterp_filters875[(1 << SUBPEL_BITS_RS)] = {
|
||||
{ 3, -8, 13, 112, 13, -8, 3, 0 }, { 3, -7, 10, 112, 17, -9, 3, -1 },
|
||||
{ 2, -6, 7, 111, 21, -9, 3, -1 }, { 2, -5, 4, 111, 24, -10, 3, -1 },
|
||||
{ 2, -4, 1, 110, 28, -11, 3, -1 }, { 1, -3, -1, 108, 32, -12, 4, -1 },
|
||||
|
|
@ -114,7 +117,7 @@ static const interp_kernel filteredinterp_filters875[(1 << SUBPEL_BITS)] = {
|
|||
};
|
||||
|
||||
// Filters for interpolation (full-band) - no filtering for integer pixels
|
||||
static const interp_kernel filteredinterp_filters1000[(1 << SUBPEL_BITS)] = {
|
||||
static const interp_kernel filteredinterp_filters1000[(1 << SUBPEL_BITS_RS)] = {
|
||||
{ 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 1, -3, 128, 3, -1, 0, 0 },
|
||||
{ -1, 2, -6, 127, 7, -2, 1, 0 }, { -1, 3, -9, 126, 12, -4, 1, 0 },
|
||||
{ -1, 4, -12, 125, 16, -5, 1, 0 }, { -1, 4, -14, 123, 20, -6, 2, 0 },
|
||||
|
|
@ -187,13 +190,13 @@ static void interpolate(const uint8_t *const input, int inlength,
|
|||
for (x = 0, y = offset; x < outlength; ++x, y += delta) {
|
||||
const int16_t *filter;
|
||||
int_pel = y >> INTERP_PRECISION_BITS;
|
||||
sub_pel = (y >> (INTERP_PRECISION_BITS - SUBPEL_BITS)) & SUBPEL_MASK;
|
||||
sub_pel =
|
||||
(y >> (INTERP_PRECISION_BITS - SUBPEL_BITS_RS)) & SUBPEL_MASK_RS;
|
||||
filter = interp_filters[sub_pel];
|
||||
sum = 0;
|
||||
for (k = 0; k < INTERP_TAPS; ++k) {
|
||||
const int pk = int_pel - INTERP_TAPS / 2 + 1 + k;
|
||||
sum += filter[k] *
|
||||
input[(pk < 0 ? 0 : (pk >= inlength ? inlength - 1 : pk))];
|
||||
sum += filter[k] * input[AOMMAX(AOMMIN(pk, inlength - 1), 0)];
|
||||
}
|
||||
*optr++ = clip_pixel(ROUND_POWER_OF_TWO(sum, FILTER_BITS));
|
||||
}
|
||||
|
|
@ -202,20 +205,20 @@ static void interpolate(const uint8_t *const input, int inlength,
|
|||
for (x = 0, y = offset; x < x1; ++x, y += delta) {
|
||||
const int16_t *filter;
|
||||
int_pel = y >> INTERP_PRECISION_BITS;
|
||||
sub_pel = (y >> (INTERP_PRECISION_BITS - SUBPEL_BITS)) & SUBPEL_MASK;
|
||||
sub_pel =
|
||||
(y >> (INTERP_PRECISION_BITS - SUBPEL_BITS_RS)) & SUBPEL_MASK_RS;
|
||||
filter = interp_filters[sub_pel];
|
||||
sum = 0;
|
||||
for (k = 0; k < INTERP_TAPS; ++k)
|
||||
sum += filter[k] * input[(int_pel - INTERP_TAPS / 2 + 1 + k < 0
|
||||
? 0
|
||||
: int_pel - INTERP_TAPS / 2 + 1 + k)];
|
||||
sum += filter[k] * input[AOMMAX(int_pel - INTERP_TAPS / 2 + 1 + k, 0)];
|
||||
*optr++ = clip_pixel(ROUND_POWER_OF_TWO(sum, FILTER_BITS));
|
||||
}
|
||||
// Middle part.
|
||||
for (; x <= x2; ++x, y += delta) {
|
||||
const int16_t *filter;
|
||||
int_pel = y >> INTERP_PRECISION_BITS;
|
||||
sub_pel = (y >> (INTERP_PRECISION_BITS - SUBPEL_BITS)) & SUBPEL_MASK;
|
||||
sub_pel =
|
||||
(y >> (INTERP_PRECISION_BITS - SUBPEL_BITS_RS)) & SUBPEL_MASK_RS;
|
||||
filter = interp_filters[sub_pel];
|
||||
sum = 0;
|
||||
for (k = 0; k < INTERP_TAPS; ++k)
|
||||
|
|
@ -226,18 +229,19 @@ static void interpolate(const uint8_t *const input, int inlength,
|
|||
for (; x < outlength; ++x, y += delta) {
|
||||
const int16_t *filter;
|
||||
int_pel = y >> INTERP_PRECISION_BITS;
|
||||
sub_pel = (y >> (INTERP_PRECISION_BITS - SUBPEL_BITS)) & SUBPEL_MASK;
|
||||
sub_pel =
|
||||
(y >> (INTERP_PRECISION_BITS - SUBPEL_BITS_RS)) & SUBPEL_MASK_RS;
|
||||
filter = interp_filters[sub_pel];
|
||||
sum = 0;
|
||||
for (k = 0; k < INTERP_TAPS; ++k)
|
||||
sum += filter[k] * input[(int_pel - INTERP_TAPS / 2 + 1 + k >= inlength
|
||||
? inlength - 1
|
||||
: int_pel - INTERP_TAPS / 2 + 1 + k)];
|
||||
sum += filter[k] *
|
||||
input[AOMMIN(int_pel - INTERP_TAPS / 2 + 1 + k, inlength - 1)];
|
||||
*optr++ = clip_pixel(ROUND_POWER_OF_TWO(sum, FILTER_BITS));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef __clang_analyzer__
|
||||
static void down2_symeven(const uint8_t *const input, int length,
|
||||
uint8_t *output) {
|
||||
// Actual filter len = 2 * filter_len_half.
|
||||
|
|
@ -254,9 +258,9 @@ static void down2_symeven(const uint8_t *const input, int length,
|
|||
for (i = 0; i < length; i += 2) {
|
||||
int sum = (1 << (FILTER_BITS - 1));
|
||||
for (j = 0; j < filter_len_half; ++j) {
|
||||
sum += (input[(i - j < 0 ? 0 : i - j)] +
|
||||
input[(i + 1 + j >= length ? length - 1 : i + 1 + j)]) *
|
||||
filter[j];
|
||||
sum +=
|
||||
(input[AOMMAX(i - j, 0)] + input[AOMMIN(i + 1 + j, length - 1)]) *
|
||||
filter[j];
|
||||
}
|
||||
sum >>= FILTER_BITS;
|
||||
*optr++ = clip_pixel(sum);
|
||||
|
|
@ -266,7 +270,7 @@ static void down2_symeven(const uint8_t *const input, int length,
|
|||
for (i = 0; i < l1; i += 2) {
|
||||
int sum = (1 << (FILTER_BITS - 1));
|
||||
for (j = 0; j < filter_len_half; ++j) {
|
||||
sum += (input[(i - j < 0 ? 0 : i - j)] + input[i + 1 + j]) * filter[j];
|
||||
sum += (input[AOMMAX(i - j, 0)] + input[i + 1 + j]) * filter[j];
|
||||
}
|
||||
sum >>= FILTER_BITS;
|
||||
*optr++ = clip_pixel(sum);
|
||||
|
|
@ -284,15 +288,15 @@ static void down2_symeven(const uint8_t *const input, int length,
|
|||
for (; i < length; i += 2) {
|
||||
int sum = (1 << (FILTER_BITS - 1));
|
||||
for (j = 0; j < filter_len_half; ++j) {
|
||||
sum += (input[i - j] +
|
||||
input[(i + 1 + j >= length ? length - 1 : i + 1 + j)]) *
|
||||
filter[j];
|
||||
sum +=
|
||||
(input[i - j] + input[AOMMIN(i + 1 + j, length - 1)]) * filter[j];
|
||||
}
|
||||
sum >>= FILTER_BITS;
|
||||
*optr++ = clip_pixel(sum);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void down2_symodd(const uint8_t *const input, int length,
|
||||
uint8_t *output) {
|
||||
|
|
@ -367,22 +371,19 @@ static int get_down2_steps(int in_length, int out_length) {
|
|||
|
||||
static void resize_multistep(const uint8_t *const input, int length,
|
||||
uint8_t *output, int olength, uint8_t *otmp) {
|
||||
int steps;
|
||||
if (length == olength) {
|
||||
memcpy(output, input, sizeof(output[0]) * length);
|
||||
return;
|
||||
}
|
||||
steps = get_down2_steps(length, olength);
|
||||
const int steps = get_down2_steps(length, olength);
|
||||
|
||||
if (steps > 0) {
|
||||
int s;
|
||||
uint8_t *out = NULL;
|
||||
uint8_t *otmp2;
|
||||
int filteredlength = length;
|
||||
|
||||
assert(otmp != NULL);
|
||||
otmp2 = otmp + get_down2_length(length, 1);
|
||||
for (s = 0; s < steps; ++s) {
|
||||
uint8_t *otmp2 = otmp + get_down2_length(length, 1);
|
||||
for (int s = 0; s < steps; ++s) {
|
||||
const int proj_filteredlength = get_down2_length(filteredlength, 1);
|
||||
const uint8_t *const in = (s == 0 ? input : out);
|
||||
if (s == steps - 1 && proj_filteredlength == olength)
|
||||
|
|
@ -426,8 +427,7 @@ void av1_resize_plane(const uint8_t *const input, int height, int width,
|
|||
int out_stride) {
|
||||
int i;
|
||||
uint8_t *intbuf = (uint8_t *)malloc(sizeof(uint8_t) * width2 * height);
|
||||
uint8_t *tmpbuf =
|
||||
(uint8_t *)malloc(sizeof(uint8_t) * (width < height ? height : width));
|
||||
uint8_t *tmpbuf = (uint8_t *)malloc(sizeof(uint8_t) * AOMMAX(width, height));
|
||||
uint8_t *arrbuf = (uint8_t *)malloc(sizeof(uint8_t) * height);
|
||||
uint8_t *arrbuf2 = (uint8_t *)malloc(sizeof(uint8_t) * height2);
|
||||
if (intbuf == NULL || tmpbuf == NULL || arrbuf == NULL || arrbuf2 == NULL)
|
||||
|
|
@ -489,13 +489,13 @@ static void highbd_interpolate(const uint16_t *const input, int inlength,
|
|||
for (x = 0, y = offset; x < outlength; ++x, y += delta) {
|
||||
const int16_t *filter;
|
||||
int_pel = y >> INTERP_PRECISION_BITS;
|
||||
sub_pel = (y >> (INTERP_PRECISION_BITS - SUBPEL_BITS)) & SUBPEL_MASK;
|
||||
sub_pel =
|
||||
(y >> (INTERP_PRECISION_BITS - SUBPEL_BITS_RS)) & SUBPEL_MASK_RS;
|
||||
filter = interp_filters[sub_pel];
|
||||
sum = 0;
|
||||
for (k = 0; k < INTERP_TAPS; ++k) {
|
||||
const int pk = int_pel - INTERP_TAPS / 2 + 1 + k;
|
||||
sum += filter[k] *
|
||||
input[(pk < 0 ? 0 : (pk >= inlength ? inlength - 1 : pk))];
|
||||
sum += filter[k] * input[AOMMAX(AOMMIN(pk, inlength - 1), 0)];
|
||||
}
|
||||
*optr++ = clip_pixel_highbd(ROUND_POWER_OF_TWO(sum, FILTER_BITS), bd);
|
||||
}
|
||||
|
|
@ -504,20 +504,20 @@ static void highbd_interpolate(const uint16_t *const input, int inlength,
|
|||
for (x = 0, y = offset; x < x1; ++x, y += delta) {
|
||||
const int16_t *filter;
|
||||
int_pel = y >> INTERP_PRECISION_BITS;
|
||||
sub_pel = (y >> (INTERP_PRECISION_BITS - SUBPEL_BITS)) & SUBPEL_MASK;
|
||||
sub_pel =
|
||||
(y >> (INTERP_PRECISION_BITS - SUBPEL_BITS_RS)) & SUBPEL_MASK_RS;
|
||||
filter = interp_filters[sub_pel];
|
||||
sum = 0;
|
||||
for (k = 0; k < INTERP_TAPS; ++k)
|
||||
sum += filter[k] * input[(int_pel - INTERP_TAPS / 2 + 1 + k < 0
|
||||
? 0
|
||||
: int_pel - INTERP_TAPS / 2 + 1 + k)];
|
||||
sum += filter[k] * input[AOMMAX(int_pel - INTERP_TAPS / 2 + 1 + k, 0)];
|
||||
*optr++ = clip_pixel_highbd(ROUND_POWER_OF_TWO(sum, FILTER_BITS), bd);
|
||||
}
|
||||
// Middle part.
|
||||
for (; x <= x2; ++x, y += delta) {
|
||||
const int16_t *filter;
|
||||
int_pel = y >> INTERP_PRECISION_BITS;
|
||||
sub_pel = (y >> (INTERP_PRECISION_BITS - SUBPEL_BITS)) & SUBPEL_MASK;
|
||||
sub_pel =
|
||||
(y >> (INTERP_PRECISION_BITS - SUBPEL_BITS_RS)) & SUBPEL_MASK_RS;
|
||||
filter = interp_filters[sub_pel];
|
||||
sum = 0;
|
||||
for (k = 0; k < INTERP_TAPS; ++k)
|
||||
|
|
@ -528,18 +528,18 @@ static void highbd_interpolate(const uint16_t *const input, int inlength,
|
|||
for (; x < outlength; ++x, y += delta) {
|
||||
const int16_t *filter;
|
||||
int_pel = y >> INTERP_PRECISION_BITS;
|
||||
sub_pel = (y >> (INTERP_PRECISION_BITS - SUBPEL_BITS)) & SUBPEL_MASK;
|
||||
sub_pel =
|
||||
(y >> (INTERP_PRECISION_BITS - SUBPEL_BITS_RS)) & SUBPEL_MASK_RS;
|
||||
filter = interp_filters[sub_pel];
|
||||
sum = 0;
|
||||
for (k = 0; k < INTERP_TAPS; ++k)
|
||||
sum += filter[k] * input[(int_pel - INTERP_TAPS / 2 + 1 + k >= inlength
|
||||
? inlength - 1
|
||||
: int_pel - INTERP_TAPS / 2 + 1 + k)];
|
||||
sum += filter[k] *
|
||||
input[AOMMIN(int_pel - INTERP_TAPS / 2 + 1 + k, inlength - 1)];
|
||||
*optr++ = clip_pixel_highbd(ROUND_POWER_OF_TWO(sum, FILTER_BITS), bd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef __clang_analyzer__
|
||||
static void highbd_down2_symeven(const uint16_t *const input, int length,
|
||||
uint16_t *output, int bd) {
|
||||
// Actual filter len = 2 * filter_len_half.
|
||||
|
|
@ -556,9 +556,9 @@ static void highbd_down2_symeven(const uint16_t *const input, int length,
|
|||
for (i = 0; i < length; i += 2) {
|
||||
int sum = (1 << (FILTER_BITS - 1));
|
||||
for (j = 0; j < filter_len_half; ++j) {
|
||||
sum += (input[(i - j < 0 ? 0 : i - j)] +
|
||||
input[(i + 1 + j >= length ? length - 1 : i + 1 + j)]) *
|
||||
filter[j];
|
||||
sum +=
|
||||
(input[AOMMAX(0, i - j)] + input[AOMMIN(i + 1 + j, length - 1)]) *
|
||||
filter[j];
|
||||
}
|
||||
sum >>= FILTER_BITS;
|
||||
*optr++ = clip_pixel_highbd(sum, bd);
|
||||
|
|
@ -568,7 +568,7 @@ static void highbd_down2_symeven(const uint16_t *const input, int length,
|
|||
for (i = 0; i < l1; i += 2) {
|
||||
int sum = (1 << (FILTER_BITS - 1));
|
||||
for (j = 0; j < filter_len_half; ++j) {
|
||||
sum += (input[(i - j < 0 ? 0 : i - j)] + input[i + 1 + j]) * filter[j];
|
||||
sum += (input[AOMMAX(0, i - j)] + input[i + 1 + j]) * filter[j];
|
||||
}
|
||||
sum >>= FILTER_BITS;
|
||||
*optr++ = clip_pixel_highbd(sum, bd);
|
||||
|
|
@ -586,9 +586,8 @@ static void highbd_down2_symeven(const uint16_t *const input, int length,
|
|||
for (; i < length; i += 2) {
|
||||
int sum = (1 << (FILTER_BITS - 1));
|
||||
for (j = 0; j < filter_len_half; ++j) {
|
||||
sum += (input[i - j] +
|
||||
input[(i + 1 + j >= length ? length - 1 : i + 1 + j)]) *
|
||||
filter[j];
|
||||
sum +=
|
||||
(input[i - j] + input[AOMMIN(i + 1 + j, length - 1)]) * filter[j];
|
||||
}
|
||||
sum >>= FILTER_BITS;
|
||||
*optr++ = clip_pixel_highbd(sum, bd);
|
||||
|
|
@ -612,8 +611,7 @@ static void highbd_down2_symodd(const uint16_t *const input, int length,
|
|||
for (i = 0; i < length; i += 2) {
|
||||
int sum = (1 << (FILTER_BITS - 1)) + input[i] * filter[0];
|
||||
for (j = 1; j < filter_len_half; ++j) {
|
||||
sum += (input[(i - j < 0 ? 0 : i - j)] +
|
||||
input[(i + j >= length ? length - 1 : i + j)]) *
|
||||
sum += (input[AOMMAX(i - j, 0)] + input[AOMMIN(i + j, length - 1)]) *
|
||||
filter[j];
|
||||
}
|
||||
sum >>= FILTER_BITS;
|
||||
|
|
@ -624,7 +622,7 @@ static void highbd_down2_symodd(const uint16_t *const input, int length,
|
|||
for (i = 0; i < l1; i += 2) {
|
||||
int sum = (1 << (FILTER_BITS - 1)) + input[i] * filter[0];
|
||||
for (j = 1; j < filter_len_half; ++j) {
|
||||
sum += (input[(i - j < 0 ? 0 : i - j)] + input[i + j]) * filter[j];
|
||||
sum += (input[AOMMAX(i - j, 0)] + input[i + j]) * filter[j];
|
||||
}
|
||||
sum >>= FILTER_BITS;
|
||||
*optr++ = clip_pixel_highbd(sum, bd);
|
||||
|
|
@ -642,34 +640,31 @@ static void highbd_down2_symodd(const uint16_t *const input, int length,
|
|||
for (; i < length; i += 2) {
|
||||
int sum = (1 << (FILTER_BITS - 1)) + input[i] * filter[0];
|
||||
for (j = 1; j < filter_len_half; ++j) {
|
||||
sum += (input[i - j] + input[(i + j >= length ? length - 1 : i + j)]) *
|
||||
filter[j];
|
||||
sum += (input[i - j] + input[AOMMIN(i + j, length - 1)]) * filter[j];
|
||||
}
|
||||
sum >>= FILTER_BITS;
|
||||
*optr++ = clip_pixel_highbd(sum, bd);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void highbd_resize_multistep(const uint16_t *const input, int length,
|
||||
uint16_t *output, int olength,
|
||||
uint16_t *otmp, int bd) {
|
||||
int steps;
|
||||
if (length == olength) {
|
||||
memcpy(output, input, sizeof(output[0]) * length);
|
||||
return;
|
||||
}
|
||||
steps = get_down2_steps(length, olength);
|
||||
const int steps = get_down2_steps(length, olength);
|
||||
|
||||
if (steps > 0) {
|
||||
int s;
|
||||
uint16_t *out = NULL;
|
||||
uint16_t *otmp2;
|
||||
int filteredlength = length;
|
||||
|
||||
assert(otmp != NULL);
|
||||
otmp2 = otmp + get_down2_length(length, 1);
|
||||
for (s = 0; s < steps; ++s) {
|
||||
uint16_t *otmp2 = otmp + get_down2_length(length, 1);
|
||||
for (int s = 0; s < steps; ++s) {
|
||||
const int proj_filteredlength = get_down2_length(filteredlength, 1);
|
||||
const uint16_t *const in = (s == 0 ? input : out);
|
||||
if (s == steps - 1 && proj_filteredlength == olength)
|
||||
|
|
@ -716,7 +711,7 @@ void av1_highbd_resize_plane(const uint8_t *const input, int height, int width,
|
|||
int i;
|
||||
uint16_t *intbuf = (uint16_t *)malloc(sizeof(uint16_t) * width2 * height);
|
||||
uint16_t *tmpbuf =
|
||||
(uint16_t *)malloc(sizeof(uint16_t) * (width < height ? height : width));
|
||||
(uint16_t *)malloc(sizeof(uint16_t) * AOMMAX(width, height));
|
||||
uint16_t *arrbuf = (uint16_t *)malloc(sizeof(uint16_t) * height);
|
||||
uint16_t *arrbuf2 = (uint16_t *)malloc(sizeof(uint16_t) * height2);
|
||||
if (intbuf == NULL || tmpbuf == NULL || arrbuf == NULL || arrbuf2 == NULL)
|
||||
|
|
@ -819,3 +814,69 @@ void av1_highbd_resize_frame444(const uint8_t *const y, int y_stride,
|
|||
ouv_stride, bd);
|
||||
}
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
static void resize_and_extend_frame(const YV12_BUFFER_CONFIG *src,
|
||||
YV12_BUFFER_CONFIG *dst, int bd) {
|
||||
#else
|
||||
static void resize_and_extend_frame(const YV12_BUFFER_CONFIG *src,
|
||||
YV12_BUFFER_CONFIG *dst) {
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
// TODO(dkovalev): replace YV12_BUFFER_CONFIG with aom_image_t
|
||||
int i;
|
||||
const uint8_t *const srcs[3] = { src->y_buffer, src->u_buffer,
|
||||
src->v_buffer };
|
||||
const int src_strides[3] = { src->y_stride, src->uv_stride, src->uv_stride };
|
||||
const int src_widths[3] = { src->y_crop_width, src->uv_crop_width,
|
||||
src->uv_crop_width };
|
||||
const int src_heights[3] = { src->y_crop_height, src->uv_crop_height,
|
||||
src->uv_crop_height };
|
||||
uint8_t *const dsts[3] = { dst->y_buffer, dst->u_buffer, dst->v_buffer };
|
||||
const int dst_strides[3] = { dst->y_stride, dst->uv_stride, dst->uv_stride };
|
||||
const int dst_widths[3] = { dst->y_crop_width, dst->uv_crop_width,
|
||||
dst->uv_crop_width };
|
||||
const int dst_heights[3] = { dst->y_crop_height, dst->uv_crop_height,
|
||||
dst->uv_crop_height };
|
||||
|
||||
for (i = 0; i < MAX_MB_PLANE; ++i) {
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
if (src->flags & YV12_FLAG_HIGHBITDEPTH)
|
||||
av1_highbd_resize_plane(srcs[i], src_heights[i], src_widths[i],
|
||||
src_strides[i], dsts[i], dst_heights[i],
|
||||
dst_widths[i], dst_strides[i], bd);
|
||||
else
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
av1_resize_plane(srcs[i], src_heights[i], src_widths[i], src_strides[i],
|
||||
dsts[i], dst_heights[i], dst_widths[i], dst_strides[i]);
|
||||
}
|
||||
aom_extend_frame_borders(dst);
|
||||
}
|
||||
|
||||
YV12_BUFFER_CONFIG *av1_scale_if_required_fast(AV1_COMMON *cm,
|
||||
YV12_BUFFER_CONFIG *unscaled,
|
||||
YV12_BUFFER_CONFIG *scaled) {
|
||||
if (cm->mi_cols * MI_SIZE != unscaled->y_width ||
|
||||
cm->mi_rows * MI_SIZE != unscaled->y_height) {
|
||||
// For 2x2 scaling down.
|
||||
aom_scale_frame(unscaled, scaled, unscaled->y_buffer, 9, 2, 1, 2, 1, 0);
|
||||
aom_extend_frame_borders(scaled);
|
||||
return scaled;
|
||||
} else {
|
||||
return unscaled;
|
||||
}
|
||||
}
|
||||
|
||||
YV12_BUFFER_CONFIG *av1_scale_if_required(AV1_COMMON *cm,
|
||||
YV12_BUFFER_CONFIG *unscaled,
|
||||
YV12_BUFFER_CONFIG *scaled) {
|
||||
if (cm->width != unscaled->y_width || cm->height != unscaled->y_height) {
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
resize_and_extend_frame(unscaled, scaled, (int)cm->bit_depth);
|
||||
#else
|
||||
resize_and_extend_frame(unscaled, scaled);
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
return scaled;
|
||||
} else {
|
||||
return unscaled;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
9
third_party/aom/av1/common/resize.h
vendored
9
third_party/aom/av1/common/resize.h
vendored
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include "aom/aom_integer.h"
|
||||
#include "av1/common/onyxc_int.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
@ -62,6 +63,14 @@ void av1_highbd_resize_frame444(const uint8_t *const y, int y_stride,
|
|||
int owidth, int bd);
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
|
||||
YV12_BUFFER_CONFIG *av1_scale_if_required_fast(AV1_COMMON *cm,
|
||||
YV12_BUFFER_CONFIG *unscaled,
|
||||
YV12_BUFFER_CONFIG *scaled);
|
||||
|
||||
YV12_BUFFER_CONFIG *av1_scale_if_required(AV1_COMMON *cm,
|
||||
YV12_BUFFER_CONFIG *unscaled,
|
||||
YV12_BUFFER_CONFIG *scaled);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
|
|
|||
14
third_party/aom/av1/common/restoration.c
vendored
14
third_party/aom/av1/common/restoration.c
vendored
|
|
@ -160,9 +160,16 @@ static void loop_wiener_filter_tile(uint8_t *data, int tile_idx, int width,
|
|||
int h = AOMMIN(MAX_SB_SIZE, (v_end - i + 15) & ~15);
|
||||
const uint8_t *data_p = data + i * stride + j;
|
||||
uint8_t *dst_p = dst + i * dst_stride + j;
|
||||
#if USE_WIENER_HIGH_INTERMEDIATE_PRECISION
|
||||
aom_convolve8_add_src_hip(data_p, stride, dst_p, dst_stride,
|
||||
rst->rsi->wiener_info[tile_idx].hfilter, 16,
|
||||
rst->rsi->wiener_info[tile_idx].vfilter, 16, w,
|
||||
h);
|
||||
#else
|
||||
aom_convolve8_add_src(data_p, stride, dst_p, dst_stride,
|
||||
rst->rsi->wiener_info[tile_idx].hfilter, 16,
|
||||
rst->rsi->wiener_info[tile_idx].vfilter, 16, w, h);
|
||||
#endif // USE_WIENER_HIGH_INTERMEDIATE_PRECISION
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -992,10 +999,17 @@ static void loop_wiener_filter_tile_highbd(uint16_t *data, int tile_idx,
|
|||
int h = AOMMIN(MAX_SB_SIZE, (v_end - i + 15) & ~15);
|
||||
const uint16_t *data_p = data + i * stride + j;
|
||||
uint16_t *dst_p = dst + i * dst_stride + j;
|
||||
#if USE_WIENER_HIGH_INTERMEDIATE_PRECISION
|
||||
aom_highbd_convolve8_add_src_hip(
|
||||
CONVERT_TO_BYTEPTR(data_p), stride, CONVERT_TO_BYTEPTR(dst_p),
|
||||
dst_stride, rst->rsi->wiener_info[tile_idx].hfilter, 16,
|
||||
rst->rsi->wiener_info[tile_idx].vfilter, 16, w, h, bit_depth);
|
||||
#else
|
||||
aom_highbd_convolve8_add_src(
|
||||
CONVERT_TO_BYTEPTR(data_p), stride, CONVERT_TO_BYTEPTR(dst_p),
|
||||
dst_stride, rst->rsi->wiener_info[tile_idx].hfilter, 16,
|
||||
rst->rsi->wiener_info[tile_idx].vfilter, 16, w, h, bit_depth);
|
||||
#endif // USE_WIENER_HIGH_INTERMEDIATE_PRECISION
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
7
third_party/aom/av1/common/restoration.h
vendored
7
third_party/aom/av1/common/restoration.h
vendored
|
|
@ -81,10 +81,17 @@ extern "C" {
|
|||
#define WIENER_FILT_PREC_BITS 7
|
||||
#define WIENER_FILT_STEP (1 << WIENER_FILT_PREC_BITS)
|
||||
|
||||
// Whether to use high intermediate precision filtering
|
||||
#define USE_WIENER_HIGH_INTERMEDIATE_PRECISION 1
|
||||
|
||||
// Central values for the taps
|
||||
#define WIENER_FILT_TAP0_MIDV (3)
|
||||
#define WIENER_FILT_TAP1_MIDV (-7)
|
||||
#define WIENER_FILT_TAP2_MIDV (15)
|
||||
#define WIENER_FILT_TAP3_MIDV \
|
||||
(WIENER_FILT_STEP - \
|
||||
2 * (WIENER_FILT_TAP0_MIDV + WIENER_FILT_TAP1_MIDV + \
|
||||
WIENER_FILT_TAP2_MIDV))
|
||||
|
||||
#define WIENER_FILT_TAP0_BITS 4
|
||||
#define WIENER_FILT_TAP1_BITS 5
|
||||
|
|
|
|||
106
third_party/aom/av1/common/scan.c
vendored
106
third_party/aom/av1/common/scan.c
vendored
|
|
@ -14,7 +14,7 @@
|
|||
#include "av1/common/common_data.h"
|
||||
#include "av1/common/scan.h"
|
||||
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
DECLARE_ALIGNED(16, static const int16_t, default_scan_2x2[4]) = {
|
||||
0, 1, 2, 3,
|
||||
};
|
||||
|
|
@ -73,17 +73,17 @@ DECLARE_ALIGNED(16, static const int16_t, mrow_scan_8x4[32]) = {
|
|||
};
|
||||
|
||||
DECLARE_ALIGNED(16, static const int16_t, default_scan_4x16[64]) = {
|
||||
0, 1, 4, 2, 5, 8, 3, 6, 9, 12, 7, 10, 13, 16, 11, 14,
|
||||
17, 20, 15, 18, 21, 24, 19, 22, 25, 28, 23, 26, 29, 32, 27, 30,
|
||||
33, 36, 31, 34, 37, 40, 35, 38, 41, 44, 39, 42, 45, 48, 43, 46,
|
||||
49, 52, 47, 50, 53, 56, 51, 54, 57, 60, 55, 58, 61, 59, 62, 63,
|
||||
0, 1, 4, 5, 2, 8, 6, 9, 10, 3, 12, 7, 13, 11, 14, 16,
|
||||
17, 15, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
|
||||
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
|
||||
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
|
||||
};
|
||||
|
||||
DECLARE_ALIGNED(16, static const int16_t, default_scan_16x4[64]) = {
|
||||
0, 1, 16, 2, 17, 32, 3, 18, 33, 48, 4, 19, 34, 49, 5, 20,
|
||||
35, 50, 6, 21, 36, 51, 7, 22, 37, 52, 8, 23, 38, 53, 9, 24,
|
||||
39, 54, 10, 25, 40, 55, 11, 26, 41, 56, 12, 27, 42, 57, 13, 28,
|
||||
43, 58, 14, 29, 44, 59, 15, 30, 45, 60, 31, 46, 61, 47, 62, 63,
|
||||
0, 1, 16, 17, 2, 32, 18, 33, 34, 3, 48, 19, 49, 35, 50, 4,
|
||||
20, 51, 36, 5, 52, 21, 37, 53, 6, 22, 38, 54, 7, 23, 39, 55,
|
||||
8, 24, 40, 56, 9, 25, 41, 57, 10, 26, 42, 58, 11, 27, 43, 59,
|
||||
12, 28, 44, 60, 13, 29, 45, 61, 14, 30, 46, 62, 15, 31, 47, 63,
|
||||
};
|
||||
|
||||
#if CONFIG_EXT_TX
|
||||
|
|
@ -1491,7 +1491,7 @@ DECLARE_ALIGNED(16, static const int16_t, default_scan_64x64[4096]) = {
|
|||
};
|
||||
#endif // CONFIG_TX64X64
|
||||
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
DECLARE_ALIGNED(16, static const int16_t,
|
||||
default_scan_2x2_neighbors[5 * MAX_NEIGHBORS]) = {
|
||||
0, 0, 0, 0, 0, 1, 1, 2, 0, 0,
|
||||
|
|
@ -1582,36 +1582,36 @@ DECLARE_ALIGNED(16, static const int16_t,
|
|||
|
||||
DECLARE_ALIGNED(16, static const int16_t,
|
||||
default_scan_4x16_neighbors[65 * MAX_NEIGHBORS]) = {
|
||||
0, 0, 0, 0, 0, 0, 1, 1, 1, 4, 4, 4, 2, 2, 2, 5, 5, 8, 8,
|
||||
8, 3, 6, 6, 9, 9, 12, 12, 12, 7, 10, 10, 13, 13, 16, 16, 16, 11, 14,
|
||||
14, 17, 17, 20, 20, 20, 15, 18, 18, 21, 21, 24, 24, 24, 19, 22, 22, 25, 25,
|
||||
28, 28, 28, 23, 26, 26, 29, 29, 32, 32, 32, 27, 30, 30, 33, 33, 36, 36, 36,
|
||||
31, 34, 34, 37, 37, 40, 40, 40, 35, 38, 38, 41, 41, 44, 44, 44, 39, 42, 42,
|
||||
45, 45, 48, 48, 48, 43, 46, 46, 49, 49, 52, 52, 52, 47, 50, 50, 53, 53, 56,
|
||||
56, 56, 51, 54, 54, 57, 57, 60, 55, 58, 58, 61, 59, 62, 0, 0
|
||||
0, 0, 0, 0, 0, 0, 1, 4, 1, 1, 4, 4, 2, 5, 5, 8, 6, 9, 2,
|
||||
2, 8, 8, 3, 6, 9, 12, 7, 10, 10, 13, 12, 12, 13, 16, 11, 14, 14, 17,
|
||||
15, 18, 16, 16, 17, 20, 18, 21, 19, 22, 20, 20, 21, 24, 22, 25, 23, 26, 24,
|
||||
24, 25, 28, 26, 29, 27, 30, 28, 28, 29, 32, 30, 33, 31, 34, 32, 32, 33, 36,
|
||||
34, 37, 35, 38, 36, 36, 37, 40, 38, 41, 39, 42, 40, 40, 41, 44, 42, 45, 43,
|
||||
46, 44, 44, 45, 48, 46, 49, 47, 50, 48, 48, 49, 52, 50, 53, 51, 54, 52, 52,
|
||||
53, 56, 54, 57, 55, 58, 56, 56, 57, 60, 58, 61, 59, 62, 0, 0
|
||||
};
|
||||
|
||||
DECLARE_ALIGNED(16, static const int16_t,
|
||||
default_scan_16x4_neighbors[65 * MAX_NEIGHBORS]) = {
|
||||
0, 0, 0, 0, 0, 0, 1, 1, 1, 16, 16, 16, 2, 2, 2, 17, 17, 32, 32,
|
||||
32, 3, 3, 3, 18, 18, 33, 33, 48, 4, 4, 4, 19, 19, 34, 34, 49, 5, 5,
|
||||
5, 20, 20, 35, 35, 50, 6, 6, 6, 21, 21, 36, 36, 51, 7, 7, 7, 22, 22,
|
||||
37, 37, 52, 8, 8, 8, 23, 23, 38, 38, 53, 9, 9, 9, 24, 24, 39, 39, 54,
|
||||
10, 10, 10, 25, 25, 40, 40, 55, 11, 11, 11, 26, 26, 41, 41, 56, 12, 12, 12,
|
||||
27, 27, 42, 42, 57, 13, 13, 13, 28, 28, 43, 43, 58, 14, 14, 14, 29, 29, 44,
|
||||
44, 59, 15, 30, 30, 45, 45, 60, 31, 46, 46, 61, 47, 62, 0, 0
|
||||
0, 0, 0, 0, 0, 0, 1, 16, 1, 1, 16, 16, 2, 17, 17, 32, 18, 33, 2,
|
||||
2, 32, 32, 3, 18, 33, 48, 19, 34, 34, 49, 3, 3, 4, 19, 35, 50, 20, 35,
|
||||
4, 4, 36, 51, 5, 20, 21, 36, 37, 52, 5, 5, 6, 21, 22, 37, 38, 53, 6,
|
||||
6, 7, 22, 23, 38, 39, 54, 7, 7, 8, 23, 24, 39, 40, 55, 8, 8, 9, 24,
|
||||
25, 40, 41, 56, 9, 9, 10, 25, 26, 41, 42, 57, 10, 10, 11, 26, 27, 42, 43,
|
||||
58, 11, 11, 12, 27, 28, 43, 44, 59, 12, 12, 13, 28, 29, 44, 45, 60, 13, 13,
|
||||
14, 29, 30, 45, 46, 61, 14, 14, 15, 30, 31, 46, 47, 62, 0, 0
|
||||
};
|
||||
|
||||
#if CONFIG_EXT_TX
|
||||
DECLARE_ALIGNED(16, static const int16_t,
|
||||
mrow_scan_4x16_neighbors[65 * MAX_NEIGHBORS]) = {
|
||||
0, 0, 0, 0, 0, 0, 1, 1, 1, 16, 16, 16, 2, 2, 2, 17, 17, 32, 32,
|
||||
32, 3, 3, 3, 18, 18, 33, 33, 48, 4, 4, 4, 19, 19, 34, 34, 49, 5, 5,
|
||||
5, 20, 20, 35, 35, 50, 6, 6, 6, 21, 21, 36, 36, 51, 7, 7, 7, 22, 22,
|
||||
37, 37, 52, 8, 8, 8, 23, 23, 38, 38, 53, 9, 9, 9, 24, 24, 39, 39, 54,
|
||||
10, 10, 10, 25, 25, 40, 40, 55, 11, 11, 11, 26, 26, 41, 41, 56, 12, 12, 12,
|
||||
27, 27, 42, 42, 57, 13, 13, 13, 28, 28, 43, 43, 58, 14, 14, 14, 29, 29, 44,
|
||||
44, 59, 15, 30, 30, 45, 45, 60, 31, 46, 46, 61, 47, 62, 0, 0
|
||||
0, 0, 0, 0, 1, 1, 2, 2, 0, 0, 1, 4, 2, 5, 3, 6, 4, 4, 5,
|
||||
8, 6, 9, 7, 10, 8, 8, 9, 12, 10, 13, 11, 14, 12, 12, 13, 16, 14, 17,
|
||||
15, 18, 16, 16, 17, 20, 18, 21, 19, 22, 20, 20, 21, 24, 22, 25, 23, 26, 24,
|
||||
24, 25, 28, 26, 29, 27, 30, 28, 28, 29, 32, 30, 33, 31, 34, 32, 32, 33, 36,
|
||||
34, 37, 35, 38, 36, 36, 37, 40, 38, 41, 39, 42, 40, 40, 41, 44, 42, 45, 43,
|
||||
46, 44, 44, 45, 48, 46, 49, 47, 50, 48, 48, 49, 52, 50, 53, 51, 54, 52, 52,
|
||||
53, 56, 54, 57, 55, 58, 56, 56, 57, 60, 58, 61, 59, 62, 0, 0
|
||||
};
|
||||
|
||||
DECLARE_ALIGNED(16, static const int16_t,
|
||||
|
|
@ -4249,7 +4249,7 @@ DECLARE_ALIGNED(16, static const int16_t,
|
|||
};
|
||||
#endif // CONFIG_TX64X64
|
||||
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
DECLARE_ALIGNED(16, static const int16_t, av1_default_iscan_2x2[4]) = { 0, 1, 2,
|
||||
3 };
|
||||
#endif
|
||||
|
|
@ -4307,17 +4307,17 @@ DECLARE_ALIGNED(16, static const int16_t, av1_mrow_iscan_8x4[32]) = {
|
|||
};
|
||||
|
||||
DECLARE_ALIGNED(16, static const int16_t, av1_default_iscan_4x16[64]) = {
|
||||
0, 1, 3, 6, 2, 4, 7, 10, 5, 8, 11, 14, 9, 12, 15, 18,
|
||||
13, 16, 19, 22, 17, 20, 23, 26, 21, 24, 27, 30, 25, 28, 31, 34,
|
||||
29, 32, 35, 38, 33, 36, 39, 42, 37, 40, 43, 46, 41, 44, 47, 50,
|
||||
45, 48, 51, 54, 49, 52, 55, 58, 53, 56, 59, 61, 57, 60, 62, 63,
|
||||
0, 1, 4, 9, 2, 3, 6, 11, 5, 7, 8, 13, 10, 12, 14, 17,
|
||||
15, 16, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
|
||||
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
|
||||
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
|
||||
};
|
||||
|
||||
DECLARE_ALIGNED(16, static const int16_t, av1_default_iscan_16x4[64]) = {
|
||||
0, 1, 3, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46, 50, 54,
|
||||
2, 4, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47, 51, 55, 58,
|
||||
5, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 59, 61,
|
||||
9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 60, 62, 63,
|
||||
0, 1, 4, 9, 15, 19, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60,
|
||||
2, 3, 6, 11, 16, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61,
|
||||
5, 7, 8, 13, 18, 22, 26, 30, 34, 38, 42, 46, 50, 54, 58, 62,
|
||||
10, 12, 14, 17, 20, 23, 27, 31, 35, 39, 43, 47, 51, 55, 59, 63,
|
||||
};
|
||||
|
||||
#if CONFIG_EXT_TX
|
||||
|
|
@ -4343,10 +4343,10 @@ DECLARE_ALIGNED(16, static const int16_t, av1_mcol_iscan_4x16[64]) = {
|
|||
};
|
||||
|
||||
DECLARE_ALIGNED(16, static const int16_t, av1_mcol_iscan_16x4[64]) = {
|
||||
0, 16, 32, 48, 1, 17, 33, 49, 2, 18, 34, 50, 3, 19, 35, 51,
|
||||
4, 20, 36, 52, 5, 21, 37, 53, 6, 22, 38, 54, 7, 23, 39, 55,
|
||||
8, 24, 40, 56, 9, 25, 41, 57, 10, 26, 42, 58, 11, 27, 43, 59,
|
||||
12, 28, 44, 60, 13, 29, 45, 61, 14, 30, 46, 62, 15, 31, 47, 63,
|
||||
0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60,
|
||||
1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61,
|
||||
2, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46, 50, 54, 58, 62,
|
||||
3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47, 51, 55, 59, 63,
|
||||
};
|
||||
#endif // CONFIG_EXT_TX
|
||||
|
||||
|
|
@ -5719,7 +5719,7 @@ DECLARE_ALIGNED(16, static const int16_t, av1_default_iscan_64x64[4096]) = {
|
|||
#endif // CONFIG_TX64X64
|
||||
|
||||
const SCAN_ORDER av1_default_scan_orders[TX_SIZES] = {
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
{ default_scan_2x2, av1_default_iscan_2x2, default_scan_2x2_neighbors },
|
||||
#endif
|
||||
{ default_scan_4x4, av1_default_iscan_4x4, default_scan_4x4_neighbors },
|
||||
|
|
@ -5732,7 +5732,7 @@ const SCAN_ORDER av1_default_scan_orders[TX_SIZES] = {
|
|||
};
|
||||
|
||||
const SCAN_ORDER av1_intra_scan_orders[TX_SIZES_ALL][TX_TYPES] = {
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
{
|
||||
// TX_2X2
|
||||
{ default_scan_2x2, av1_default_iscan_2x2, default_scan_2x2_neighbors },
|
||||
|
|
@ -6043,7 +6043,7 @@ const SCAN_ORDER av1_intra_scan_orders[TX_SIZES_ALL][TX_TYPES] = {
|
|||
};
|
||||
|
||||
const SCAN_ORDER av1_inter_scan_orders[TX_SIZES_ALL][TX_TYPES] = {
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
{
|
||||
// TX_2X2
|
||||
{ default_scan_2x2, av1_default_iscan_2x2, default_scan_2x2_neighbors },
|
||||
|
|
@ -6493,7 +6493,7 @@ const SCAN_ORDER av1_inter_scan_orders[TX_SIZES_ALL][TX_TYPES] = {
|
|||
static uint32_t *get_non_zero_prob(FRAME_CONTEXT *fc, TX_SIZE tx_size,
|
||||
TX_TYPE tx_type) {
|
||||
switch (tx_size) {
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
case TX_2X2: return fc->non_zero_prob_2x2[tx_type];
|
||||
#endif
|
||||
case TX_4X4: return fc->non_zero_prob_4X4[tx_type];
|
||||
|
|
@ -6515,7 +6515,7 @@ static uint32_t *get_non_zero_prob(FRAME_CONTEXT *fc, TX_SIZE tx_size,
|
|||
static int16_t *get_adapt_scan(FRAME_CONTEXT *fc, TX_SIZE tx_size,
|
||||
TX_TYPE tx_type) {
|
||||
switch (tx_size) {
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
case TX_2X2: return fc->scan_2x2[tx_type];
|
||||
#endif
|
||||
case TX_4X4: return fc->scan_4X4[tx_type];
|
||||
|
|
@ -6537,7 +6537,7 @@ static int16_t *get_adapt_scan(FRAME_CONTEXT *fc, TX_SIZE tx_size,
|
|||
static int16_t *get_adapt_iscan(FRAME_CONTEXT *fc, TX_SIZE tx_size,
|
||||
TX_TYPE tx_type) {
|
||||
switch (tx_size) {
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
case TX_2X2: return fc->iscan_2x2[tx_type];
|
||||
#endif
|
||||
case TX_4X4: return fc->iscan_4X4[tx_type];
|
||||
|
|
@ -6559,7 +6559,7 @@ static int16_t *get_adapt_iscan(FRAME_CONTEXT *fc, TX_SIZE tx_size,
|
|||
static int16_t *get_adapt_nb(FRAME_CONTEXT *fc, TX_SIZE tx_size,
|
||||
TX_TYPE tx_type) {
|
||||
switch (tx_size) {
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
case TX_2X2: return fc->nb_2x2[tx_type];
|
||||
#endif
|
||||
case TX_4X4: return fc->nb_4X4[tx_type];
|
||||
|
|
@ -6581,7 +6581,7 @@ static int16_t *get_adapt_nb(FRAME_CONTEXT *fc, TX_SIZE tx_size,
|
|||
static uint32_t *get_non_zero_counts(FRAME_COUNTS *counts, TX_SIZE tx_size,
|
||||
TX_TYPE tx_type) {
|
||||
switch (tx_size) {
|
||||
#if CONFIG_CB4X4
|
||||
#if CONFIG_CHROMA_2X2
|
||||
case TX_2X2: return counts->non_zero_count_2x2[tx_type];
|
||||
#endif
|
||||
case TX_4X4: return counts->non_zero_count_4X4[tx_type];
|
||||
|
|
@ -6606,7 +6606,7 @@ static INLINE int clamp_64(int64_t value, int low, int high) {
|
|||
|
||||
static void update_scan_prob(AV1_COMMON *cm, TX_SIZE tx_size, TX_TYPE tx_type,
|
||||
int rate_16) {
|
||||
FRAME_CONTEXT *pre_fc = &cm->frame_contexts[cm->frame_context_idx];
|
||||
FRAME_CONTEXT *pre_fc = cm->pre_fc;
|
||||
uint32_t *prev_non_zero_prob = get_non_zero_prob(pre_fc, tx_size, tx_type);
|
||||
uint32_t *non_zero_prob = get_non_zero_prob(cm->fc, tx_size, tx_type);
|
||||
uint32_t *non_zero_count = get_non_zero_counts(&cm->counts, tx_size, tx_type);
|
||||
|
|
|
|||
2
third_party/aom/av1/common/seg_common.h
vendored
2
third_party/aom/av1/common/seg_common.h
vendored
|
|
@ -48,9 +48,7 @@ struct segmentation {
|
|||
|
||||
struct segmentation_probs {
|
||||
aom_prob tree_probs[SEG_TREE_PROBS];
|
||||
#if CONFIG_EC_MULTISYMBOL
|
||||
aom_cdf_prob tree_cdf[CDF_SIZE(MAX_SEGMENTS)];
|
||||
#endif
|
||||
aom_prob pred_probs[PREDICTION_PROBS];
|
||||
};
|
||||
|
||||
|
|
|
|||
12
third_party/aom/av1/common/thread_common.c
vendored
12
third_party/aom/av1/common/thread_common.c
vendored
|
|
@ -113,7 +113,7 @@ static INLINE void loop_filter_block_plane_ver(
|
|||
break;
|
||||
case LF_PATH_SLOW:
|
||||
av1_filter_block_plane_non420_ver(cm, &planes[plane], mi, mi_row,
|
||||
mi_col);
|
||||
mi_col, plane);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -135,7 +135,7 @@ static INLINE void loop_filter_block_plane_hor(
|
|||
break;
|
||||
case LF_PATH_SLOW:
|
||||
av1_filter_block_plane_non420_hor(cm, &planes[plane], mi, mi_row,
|
||||
mi_col);
|
||||
mi_col, plane);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -168,7 +168,7 @@ static int loop_filter_ver_row_worker(AV1LfSync *const lf_sync,
|
|||
#if CONFIG_EXT_PARTITION_TYPES
|
||||
for (plane = 0; plane < num_planes; ++plane)
|
||||
av1_filter_block_plane_non420_ver(lf_data->cm, &lf_data->planes[plane],
|
||||
mi + mi_col, mi_row, mi_col);
|
||||
mi + mi_col, mi_row, mi_col, plane);
|
||||
#else
|
||||
|
||||
for (plane = 0; plane < num_planes; ++plane)
|
||||
|
|
@ -213,7 +213,7 @@ static int loop_filter_hor_row_worker(AV1LfSync *const lf_sync,
|
|||
#if CONFIG_EXT_PARTITION_TYPES
|
||||
for (plane = 0; plane < num_planes; ++plane)
|
||||
av1_filter_block_plane_non420_hor(lf_data->cm, &lf_data->planes[plane],
|
||||
mi + mi_col, mi_row, mi_col);
|
||||
mi + mi_col, mi_row, mi_col, plane);
|
||||
#else
|
||||
for (plane = 0; plane < num_planes; ++plane)
|
||||
loop_filter_block_plane_hor(lf_data->cm, lf_data->planes, plane,
|
||||
|
|
@ -263,9 +263,9 @@ static int loop_filter_row_worker(AV1LfSync *const lf_sync,
|
|||
#if CONFIG_EXT_PARTITION_TYPES
|
||||
for (plane = 0; plane < num_planes; ++plane) {
|
||||
av1_filter_block_plane_non420_ver(lf_data->cm, &lf_data->planes[plane],
|
||||
mi + mi_col, mi_row, mi_col);
|
||||
mi + mi_col, mi_row, mi_col, plane);
|
||||
av1_filter_block_plane_non420_hor(lf_data->cm, &lf_data->planes[plane],
|
||||
mi + mi_col, mi_row, mi_col);
|
||||
mi + mi_col, mi_row, mi_col, plane);
|
||||
}
|
||||
#else
|
||||
av1_setup_mask(lf_data->cm, mi_row, mi_col, mi + mi_col,
|
||||
|
|
|
|||
15
third_party/aom/av1/common/tile_common.c
vendored
15
third_party/aom/av1/common/tile_common.c
vendored
|
|
@ -86,17 +86,28 @@ void av1_update_boundary_info(const struct AV1Common *cm,
|
|||
for (col = mi_col; col < (mi_col + cm->mib_size); col++) {
|
||||
MODE_INFO *const mi = cm->mi + row * cm->mi_stride + col;
|
||||
mi->mbmi.boundary_info = 0;
|
||||
|
||||
// If horizontal dependent tile is enabled, then the horizontal
|
||||
// tile boundary is not treated as real tile boundary for loop
|
||||
// filtering, only the horizontal tile group boundary is treated
|
||||
// as tile boundary.
|
||||
// Otherwise, tile group boundary is treated the same as tile boundary.
|
||||
// Loop filtering operation is done based on the
|
||||
// loopfilter_across_tiles_enabled flag for both tile boundary and tile
|
||||
// group boundary.
|
||||
|
||||
if (cm->tile_cols * cm->tile_rows > 1) {
|
||||
#if CONFIG_DEPENDENT_HORZTILES
|
||||
#if CONFIG_TILE_GROUPS
|
||||
if (row == tile_info->mi_row_start &&
|
||||
(!cm->dependent_horz_tiles || tile_info->tg_horz_boundary))
|
||||
#if CONFIG_TILE_GROUPS
|
||||
#else
|
||||
if (row == tile_info->mi_row_start && !cm->dependent_horz_tiles)
|
||||
if (row == tile_info->mi_row_start && !cm->dependent_horz_tiles)
|
||||
#endif // CONFIG_TILE_GROUPS
|
||||
#else
|
||||
if (row == tile_info->mi_row_start)
|
||||
#endif // CONFIG_DEPENDENT_HORZTILES
|
||||
|
||||
mi->mbmi.boundary_info |= TILE_ABOVE_BOUNDARY;
|
||||
if (col == tile_info->mi_col_start)
|
||||
mi->mbmi.boundary_info |= TILE_LEFT_BOUNDARY;
|
||||
|
|
|
|||
2
third_party/aom/av1/common/tile_common.h
vendored
2
third_party/aom/av1/common/tile_common.h
vendored
|
|
@ -38,7 +38,7 @@ void av1_tile_init(TileInfo *tile, const struct AV1Common *cm, int row,
|
|||
void av1_tile_set_row(TileInfo *tile, const struct AV1Common *cm, int row);
|
||||
void av1_tile_set_col(TileInfo *tile, const struct AV1Common *cm, int col);
|
||||
#if CONFIG_DEPENDENT_HORZTILES && CONFIG_TILE_GROUPS
|
||||
void av1_tile_set_tg_boundary(TileInfo *tile, const struct AV1Common *cm,
|
||||
void av1_tile_set_tg_boundary(TileInfo *tile, const struct AV1Common *const cm,
|
||||
int row, int col);
|
||||
#endif
|
||||
void av1_get_tile_n_bits(int mi_cols, int *min_log2_tile_cols,
|
||||
|
|
|
|||
2
third_party/aom/av1/common/txb_common.c
vendored
2
third_party/aom/av1/common/txb_common.c
vendored
|
|
@ -98,7 +98,7 @@ const int16_t av1_coeff_band_32x32[1024] = {
|
|||
void av1_adapt_txb_probs(AV1_COMMON *cm, unsigned int count_sat,
|
||||
unsigned int update_factor) {
|
||||
FRAME_CONTEXT *fc = cm->fc;
|
||||
const FRAME_CONTEXT *pre_fc = &cm->frame_contexts[cm->frame_context_idx];
|
||||
const FRAME_CONTEXT *pre_fc = cm->pre_fc;
|
||||
const FRAME_COUNTS *counts = &cm->counts;
|
||||
TX_SIZE tx_size;
|
||||
int plane, ctx, level;
|
||||
|
|
|
|||
290
third_party/aom/av1/common/txb_common.h
vendored
290
third_party/aom/av1/common/txb_common.h
vendored
|
|
@ -32,48 +32,95 @@ static int base_ref_offset[BASE_CONTEXT_POSITION_NUM][2] = {
|
|||
/* clang-format on*/
|
||||
};
|
||||
|
||||
static INLINE int get_level_count(const tran_low_t *tcoeffs, int stride,
|
||||
int row, int col, int level,
|
||||
int (*nb_offset)[2], int nb_num) {
|
||||
int count = 0;
|
||||
for (int idx = 0; idx < nb_num; ++idx) {
|
||||
const int ref_row = row + nb_offset[idx][0];
|
||||
const int ref_col = col + nb_offset[idx][1];
|
||||
const int pos = ref_row * stride + ref_col;
|
||||
if (ref_row < 0 || ref_col < 0 || ref_row >= stride || ref_col >= stride)
|
||||
continue;
|
||||
tran_low_t abs_coeff = abs(tcoeffs[pos]);
|
||||
count += abs_coeff > level;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
static INLINE void get_mag(int *mag, const tran_low_t *tcoeffs, int stride,
|
||||
int row, int col, int (*nb_offset)[2], int nb_num) {
|
||||
mag[0] = 0;
|
||||
mag[1] = 0;
|
||||
for (int idx = 0; idx < nb_num; ++idx) {
|
||||
const int ref_row = row + nb_offset[idx][0];
|
||||
const int ref_col = col + nb_offset[idx][1];
|
||||
const int pos = ref_row * stride + ref_col;
|
||||
if (ref_row < 0 || ref_col < 0 || ref_row >= stride || ref_col >= stride)
|
||||
continue;
|
||||
tran_low_t abs_coeff = abs(tcoeffs[pos]);
|
||||
if (nb_offset[idx][0] >= 0 && nb_offset[idx][1] >= 0) {
|
||||
if (abs_coeff > mag[0]) {
|
||||
mag[0] = abs_coeff;
|
||||
mag[1] = 1;
|
||||
} else if (abs_coeff == mag[0]) {
|
||||
++mag[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
static INLINE int get_level_count_mag(int *mag, const tran_low_t *tcoeffs,
|
||||
int stride, int row, int col, int level,
|
||||
int (*nb_offset)[2], int nb_num) {
|
||||
int count = 0;
|
||||
*mag = 0;
|
||||
for (int idx = 0; idx < nb_num; ++idx) {
|
||||
const int ref_row = row + nb_offset[idx][0];
|
||||
const int ref_col = col + nb_offset[idx][1];
|
||||
const int pos = ref_row * stride + ref_col;
|
||||
if (ref_row < 0 || ref_col < 0 || ref_row >= stride || ref_col >= stride)
|
||||
continue;
|
||||
tran_low_t abs_coeff = abs(tcoeffs[pos]);
|
||||
count += abs_coeff > level;
|
||||
if (nb_offset[idx][0] >= 0 && nb_offset[idx][1] >= 0)
|
||||
*mag = AOMMAX(*mag, abs_coeff);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
static INLINE int get_base_ctx_from_count_mag(int row, int col, int count,
|
||||
int mag, int level) {
|
||||
const int ctx = (count + 1) >> 1;
|
||||
const int sig_mag = mag > level;
|
||||
int ctx_idx = -1;
|
||||
if (row == 0 && col == 0) {
|
||||
ctx_idx = (ctx << 1) + sig_mag;
|
||||
assert(ctx_idx < 8);
|
||||
} else if (row == 0) {
|
||||
ctx_idx = 8 + (ctx << 1) + sig_mag;
|
||||
assert(ctx_idx < 18);
|
||||
} else if (col == 0) {
|
||||
ctx_idx = 8 + 10 + (ctx << 1) + sig_mag;
|
||||
assert(ctx_idx < 28);
|
||||
} else {
|
||||
ctx_idx = 8 + 10 + 10 + (ctx << 1) + sig_mag;
|
||||
assert(ctx_idx < COEFF_BASE_CONTEXTS);
|
||||
}
|
||||
return ctx_idx;
|
||||
}
|
||||
|
||||
static INLINE int get_base_ctx(const tran_low_t *tcoeffs,
|
||||
int c, // raster order
|
||||
const int bwl, const int level) {
|
||||
const int stride = 1 << bwl;
|
||||
const int row = c >> bwl;
|
||||
const int col = c - (row << bwl);
|
||||
const int stride = 1 << bwl;
|
||||
const int level_minus_1 = level - 1;
|
||||
int ctx = 0;
|
||||
int mag = 0;
|
||||
int idx;
|
||||
int ctx_idx = -1;
|
||||
tran_low_t abs_coeff;
|
||||
|
||||
ctx = 0;
|
||||
for (idx = 0; idx < BASE_CONTEXT_POSITION_NUM; ++idx) {
|
||||
int ref_row = row + base_ref_offset[idx][0];
|
||||
int ref_col = col + base_ref_offset[idx][1];
|
||||
int pos = (ref_row << bwl) + ref_col;
|
||||
|
||||
if (ref_row < 0 || ref_col < 0 || ref_row >= stride || ref_col >= stride)
|
||||
continue;
|
||||
|
||||
abs_coeff = abs(tcoeffs[pos]);
|
||||
ctx += abs_coeff > level_minus_1;
|
||||
|
||||
if (base_ref_offset[idx][0] >= 0 && base_ref_offset[idx][1] >= 0)
|
||||
mag |= abs_coeff > level;
|
||||
}
|
||||
ctx = (ctx + 1) >> 1;
|
||||
if (row == 0 && col == 0) {
|
||||
ctx_idx = (ctx << 1) + mag;
|
||||
assert(ctx_idx < 8);
|
||||
} else if (row == 0) {
|
||||
ctx_idx = 8 + (ctx << 1) + mag;
|
||||
assert(ctx_idx < 18);
|
||||
} else if (col == 0) {
|
||||
ctx_idx = 8 + 10 + (ctx << 1) + mag;
|
||||
assert(ctx_idx < 28);
|
||||
} else {
|
||||
ctx_idx = 8 + 10 + 10 + (ctx << 1) + mag;
|
||||
assert(ctx_idx < COEFF_BASE_CONTEXTS);
|
||||
}
|
||||
int mag;
|
||||
int count =
|
||||
get_level_count_mag(&mag, tcoeffs, stride, row, col, level_minus_1,
|
||||
base_ref_offset, BASE_CONTEXT_POSITION_NUM);
|
||||
int ctx_idx = get_base_ctx_from_count_mag(row, col, count, mag, level);
|
||||
return ctx_idx;
|
||||
}
|
||||
|
||||
|
|
@ -89,34 +136,13 @@ static int br_level_map[9] = {
|
|||
0, 0, 1, 1, 2, 2, 3, 3, 3,
|
||||
};
|
||||
|
||||
static INLINE int get_level_ctx(const tran_low_t *tcoeffs,
|
||||
const int c, // raster order
|
||||
const int bwl) {
|
||||
const int row = c >> bwl;
|
||||
const int col = c - (row << bwl);
|
||||
const int stride = 1 << bwl;
|
||||
const int level_minus_1 = NUM_BASE_LEVELS;
|
||||
int ctx = 0;
|
||||
int idx;
|
||||
tran_low_t abs_coeff;
|
||||
int mag = 0, offset = 0;
|
||||
|
||||
for (idx = 0; idx < BR_CONTEXT_POSITION_NUM; ++idx) {
|
||||
int ref_row = row + br_ref_offset[idx][0];
|
||||
int ref_col = col + br_ref_offset[idx][1];
|
||||
int pos = (ref_row << bwl) + ref_col;
|
||||
|
||||
if (ref_row < 0 || ref_col < 0 || ref_row >= stride || ref_col >= stride)
|
||||
continue;
|
||||
|
||||
abs_coeff = abs(tcoeffs[pos]);
|
||||
ctx += abs_coeff > level_minus_1;
|
||||
|
||||
if (br_ref_offset[idx][0] >= 0 && br_ref_offset[idx][1] >= 0)
|
||||
mag = AOMMAX(mag, abs_coeff);
|
||||
}
|
||||
|
||||
if (mag <= 1)
|
||||
#define BR_MAG_OFFSET 1
|
||||
// TODO(angiebird): optimize this function by using a table to map from
|
||||
// count/mag to ctx
|
||||
static INLINE int get_br_ctx_from_count_mag(int row, int col, int count,
|
||||
int mag) {
|
||||
int offset = 0;
|
||||
if (mag <= BR_MAG_OFFSET)
|
||||
offset = 0;
|
||||
else if (mag <= 3)
|
||||
offset = 1;
|
||||
|
|
@ -125,8 +151,7 @@ static INLINE int get_level_ctx(const tran_low_t *tcoeffs,
|
|||
else
|
||||
offset = 3;
|
||||
|
||||
ctx = br_level_map[ctx];
|
||||
|
||||
int ctx = br_level_map[count];
|
||||
ctx += offset * BR_TMP_OFFSET;
|
||||
|
||||
// DC: 0 - 1
|
||||
|
|
@ -142,17 +167,33 @@ static INLINE int get_level_ctx(const tran_low_t *tcoeffs,
|
|||
return 8 + ctx;
|
||||
}
|
||||
|
||||
static int sig_ref_offset[11][2] = {
|
||||
static INLINE int get_br_ctx(const tran_low_t *tcoeffs,
|
||||
const int c, // raster order
|
||||
const int bwl) {
|
||||
const int stride = 1 << bwl;
|
||||
const int row = c >> bwl;
|
||||
const int col = c - (row << bwl);
|
||||
const int level_minus_1 = NUM_BASE_LEVELS;
|
||||
int mag;
|
||||
const int count =
|
||||
get_level_count_mag(&mag, tcoeffs, stride, row, col, level_minus_1,
|
||||
br_ref_offset, BR_CONTEXT_POSITION_NUM);
|
||||
const int ctx = get_br_ctx_from_count_mag(row, col, count, mag);
|
||||
return ctx;
|
||||
}
|
||||
|
||||
#define SIG_REF_OFFSET_NUM 11
|
||||
static int sig_ref_offset[SIG_REF_OFFSET_NUM][2] = {
|
||||
{ -2, -1 }, { -2, 0 }, { -2, 1 }, { -1, -2 }, { -1, -1 }, { -1, 0 },
|
||||
{ -1, 1 }, { 0, -2 }, { 0, -1 }, { 1, -2 }, { 1, -1 },
|
||||
};
|
||||
|
||||
static INLINE int get_nz_map_ctx(const tran_low_t *tcoeffs,
|
||||
const uint8_t *txb_mask,
|
||||
const int c, // raster order
|
||||
const int coeff_idx, // raster order
|
||||
const int bwl) {
|
||||
const int row = c >> bwl;
|
||||
const int col = c - (row << bwl);
|
||||
const int row = coeff_idx >> bwl;
|
||||
const int col = coeff_idx - (row << bwl);
|
||||
int ctx = 0;
|
||||
int idx;
|
||||
int stride = 1 << bwl;
|
||||
|
|
@ -178,7 +219,7 @@ static INLINE int get_nz_map_ctx(const tran_low_t *tcoeffs,
|
|||
return 5 + ctx;
|
||||
}
|
||||
|
||||
for (idx = 0; idx < 11; ++idx) {
|
||||
for (idx = 0; idx < SIG_REF_OFFSET_NUM; ++idx) {
|
||||
int ref_row = row + sig_ref_offset[idx][0];
|
||||
int ref_col = col + sig_ref_offset[idx][1];
|
||||
int pos;
|
||||
|
|
@ -212,14 +253,93 @@ static INLINE int get_nz_map_ctx(const tran_low_t *tcoeffs,
|
|||
return 14 + ctx;
|
||||
}
|
||||
|
||||
static INLINE int get_nz_count(const tran_low_t *tcoeffs, int stride, int row,
|
||||
int col, const int16_t *iscan) {
|
||||
int count = 0;
|
||||
const int pos = row * stride + col;
|
||||
for (int idx = 0; idx < SIG_REF_OFFSET_NUM; ++idx) {
|
||||
const int ref_row = row + sig_ref_offset[idx][0];
|
||||
const int ref_col = col + sig_ref_offset[idx][1];
|
||||
if (ref_row < 0 || ref_col < 0 || ref_row >= stride || ref_col >= stride)
|
||||
continue;
|
||||
const int nb_pos = ref_row * stride + ref_col;
|
||||
if (iscan[nb_pos] < iscan[pos]) count += (tcoeffs[nb_pos] != 0);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
// TODO(angiebird): optimize this function by generate a table that maps from
|
||||
// count to ctx
|
||||
static INLINE int get_nz_map_ctx_from_count(int count,
|
||||
const tran_low_t *tcoeffs,
|
||||
int coeff_idx, // raster order
|
||||
int bwl, const int16_t *iscan) {
|
||||
const int row = coeff_idx >> bwl;
|
||||
const int col = coeff_idx - (row << bwl);
|
||||
int ctx = 0;
|
||||
|
||||
if (row == 0 && col == 0) return 0;
|
||||
|
||||
if (row == 0 && col == 1) return 1 + (tcoeffs[0] != 0);
|
||||
|
||||
if (row == 1 && col == 0) return 3 + (tcoeffs[0] != 0);
|
||||
|
||||
if (row == 1 && col == 1) {
|
||||
int pos;
|
||||
ctx = (tcoeffs[0] != 0);
|
||||
|
||||
if (iscan[1] < iscan[coeff_idx]) ctx += (tcoeffs[1] != 0);
|
||||
pos = 1 << bwl;
|
||||
if (iscan[pos] < iscan[coeff_idx]) ctx += (tcoeffs[pos] != 0);
|
||||
|
||||
ctx = (ctx + 1) >> 1;
|
||||
|
||||
assert(5 + ctx <= 7);
|
||||
|
||||
return 5 + ctx;
|
||||
}
|
||||
|
||||
if (row == 0) {
|
||||
ctx = (count + 1) >> 1;
|
||||
|
||||
assert(ctx < 3);
|
||||
return 8 + ctx;
|
||||
}
|
||||
|
||||
if (col == 0) {
|
||||
ctx = (count + 1) >> 1;
|
||||
|
||||
assert(ctx < 3);
|
||||
return 11 + ctx;
|
||||
}
|
||||
|
||||
ctx = count >> 1;
|
||||
|
||||
assert(14 + ctx < 20);
|
||||
|
||||
return 14 + ctx;
|
||||
}
|
||||
|
||||
// TODO(angiebird): merge this function with get_nz_map_ctx() after proper
|
||||
// testing
|
||||
static INLINE int get_nz_map_ctx2(const tran_low_t *tcoeffs,
|
||||
const int coeff_idx, // raster order
|
||||
const int bwl, const int16_t *iscan) {
|
||||
int stride = 1 << bwl;
|
||||
const int row = coeff_idx >> bwl;
|
||||
const int col = coeff_idx - (row << bwl);
|
||||
int count = get_nz_count(tcoeffs, stride, row, col, iscan);
|
||||
return get_nz_map_ctx_from_count(count, tcoeffs, coeff_idx, bwl, iscan);
|
||||
}
|
||||
|
||||
static INLINE int get_eob_ctx(const tran_low_t *tcoeffs,
|
||||
const int c, // raster order
|
||||
const int coeff_idx, // raster order
|
||||
const int bwl) {
|
||||
(void)tcoeffs;
|
||||
if (bwl == 2) return av1_coeff_band_4x4[c];
|
||||
if (bwl == 3) return av1_coeff_band_8x8[c];
|
||||
if (bwl == 4) return av1_coeff_band_16x16[c];
|
||||
if (bwl == 5) return av1_coeff_band_32x32[c];
|
||||
if (bwl == 2) return av1_coeff_band_4x4[coeff_idx];
|
||||
if (bwl == 3) return av1_coeff_band_8x8[coeff_idx];
|
||||
if (bwl == 4) return av1_coeff_band_16x16[coeff_idx];
|
||||
if (bwl == 5) return av1_coeff_band_32x32[coeff_idx];
|
||||
|
||||
assert(0);
|
||||
return 0;
|
||||
|
|
@ -245,14 +365,14 @@ static INLINE int get_dc_sign_ctx(int dc_sign) {
|
|||
static INLINE void get_txb_ctx(BLOCK_SIZE plane_bsize, TX_SIZE tx_size,
|
||||
int plane, const ENTROPY_CONTEXT *a,
|
||||
const ENTROPY_CONTEXT *l, TXB_CTX *txb_ctx) {
|
||||
const int tx_size_in_blocks = 1 << tx_size;
|
||||
const int txb_w_unit = tx_size_wide_unit[tx_size];
|
||||
const int txb_h_unit = tx_size_high_unit[tx_size];
|
||||
int ctx_offset = (plane == 0) ? 0 : 7;
|
||||
int k;
|
||||
|
||||
if (plane_bsize > txsize_to_bsize[tx_size]) ctx_offset += 3;
|
||||
|
||||
int dc_sign = 0;
|
||||
for (k = 0; k < tx_size_in_blocks; ++k) {
|
||||
for (int k = 0; k < txb_w_unit; ++k) {
|
||||
int sign = ((uint8_t)a[k]) >> COEFF_CONTEXT_BITS;
|
||||
if (sign == 1)
|
||||
--dc_sign;
|
||||
|
|
@ -260,8 +380,10 @@ static INLINE void get_txb_ctx(BLOCK_SIZE plane_bsize, TX_SIZE tx_size,
|
|||
++dc_sign;
|
||||
else if (sign != 0)
|
||||
assert(0);
|
||||
}
|
||||
|
||||
sign = ((uint8_t)l[k]) >> COEFF_CONTEXT_BITS;
|
||||
for (int k = 0; k < txb_h_unit; ++k) {
|
||||
int sign = ((uint8_t)l[k]) >> COEFF_CONTEXT_BITS;
|
||||
if (sign == 1)
|
||||
--dc_sign;
|
||||
else if (sign == 2)
|
||||
|
|
@ -269,15 +391,21 @@ static INLINE void get_txb_ctx(BLOCK_SIZE plane_bsize, TX_SIZE tx_size,
|
|||
else if (sign != 0)
|
||||
assert(0);
|
||||
}
|
||||
|
||||
txb_ctx->dc_sign_ctx = get_dc_sign_ctx(dc_sign);
|
||||
|
||||
if (plane == 0) {
|
||||
int top = 0;
|
||||
int left = 0;
|
||||
for (k = 0; k < tx_size_in_blocks; ++k) {
|
||||
|
||||
for (int k = 0; k < txb_w_unit; ++k) {
|
||||
top = AOMMAX(top, ((uint8_t)a[k] & COEFF_CONTEXT_MASK));
|
||||
}
|
||||
|
||||
for (int k = 0; k < txb_h_unit; ++k) {
|
||||
left = AOMMAX(left, ((uint8_t)l[k] & COEFF_CONTEXT_MASK));
|
||||
}
|
||||
|
||||
top = AOMMIN(top, 255);
|
||||
left = AOMMIN(left, 255);
|
||||
|
||||
|
|
|
|||
809
third_party/aom/av1/common/warped_motion.c
vendored
809
third_party/aom/av1/common/warped_motion.c
vendored
File diff suppressed because it is too large
Load diff
53
third_party/aom/av1/common/warped_motion.h
vendored
53
third_party/aom/av1/common/warped_motion.h
vendored
|
|
@ -35,59 +35,72 @@
|
|||
|
||||
extern const int16_t warped_filter[WARPEDPIXEL_PREC_SHIFTS * 3 + 1][8];
|
||||
|
||||
typedef void (*ProjectPointsFunc)(int32_t *mat, int *points, int *proj,
|
||||
typedef void (*ProjectPointsFunc)(const int32_t *mat, int *points, int *proj,
|
||||
const int n, const int stride_points,
|
||||
const int stride_proj,
|
||||
const int subsampling_x,
|
||||
const int subsampling_y);
|
||||
|
||||
void project_points_translation(int32_t *mat, int *points, int *proj,
|
||||
void project_points_translation(const int32_t *mat, int *points, int *proj,
|
||||
const int n, const int stride_points,
|
||||
const int stride_proj, const int subsampling_x,
|
||||
const int subsampling_y);
|
||||
|
||||
void project_points_rotzoom(int32_t *mat, int *points, int *proj, const int n,
|
||||
const int stride_points, const int stride_proj,
|
||||
const int subsampling_x, const int subsampling_y);
|
||||
void project_points_rotzoom(const int32_t *mat, int *points, int *proj,
|
||||
const int n, const int stride_points,
|
||||
const int stride_proj, const int subsampling_x,
|
||||
const int subsampling_y);
|
||||
|
||||
void project_points_affine(int32_t *mat, int *points, int *proj, const int n,
|
||||
const int stride_points, const int stride_proj,
|
||||
const int subsampling_x, const int subsampling_y);
|
||||
void project_points_affine(const int32_t *mat, int *points, int *proj,
|
||||
const int n, const int stride_points,
|
||||
const int stride_proj, const int subsampling_x,
|
||||
const int subsampling_y);
|
||||
|
||||
void project_points_hortrapezoid(int32_t *mat, int *points, int *proj,
|
||||
void project_points_hortrapezoid(const int32_t *mat, int *points, int *proj,
|
||||
const int n, const int stride_points,
|
||||
const int stride_proj, const int subsampling_x,
|
||||
const int subsampling_y);
|
||||
void project_points_vertrapezoid(int32_t *mat, int *points, int *proj,
|
||||
void project_points_vertrapezoid(const int32_t *mat, int *points, int *proj,
|
||||
const int n, const int stride_points,
|
||||
const int stride_proj, const int subsampling_x,
|
||||
const int subsampling_y);
|
||||
void project_points_homography(int32_t *mat, int *points, int *proj,
|
||||
void project_points_homography(const int32_t *mat, int *points, int *proj,
|
||||
const int n, const int stride_points,
|
||||
const int stride_proj, const int subsampling_x,
|
||||
const int subsampling_y);
|
||||
|
||||
void project_points(WarpedMotionParams *wm_params, int *points, int *proj,
|
||||
void project_points(const WarpedMotionParams *wm_params, int *points, int *proj,
|
||||
const int n, const int stride_points, const int stride_proj,
|
||||
const int subsampling_x, const int subsampling_y);
|
||||
|
||||
double av1_warp_erroradv(WarpedMotionParams *wm,
|
||||
// Returns the error between the result of applying motion 'wm' to the frame
|
||||
// described by 'ref' and the frame described by 'dst'.
|
||||
int64_t av1_warp_error(WarpedMotionParams *wm,
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
int use_hbd, int bd,
|
||||
int use_hbd, int bd,
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
uint8_t *ref, int width, int height, int stride,
|
||||
uint8_t *dst, int p_col, int p_row, int p_width,
|
||||
int p_height, int p_stride, int subsampling_x,
|
||||
int subsampling_y, int x_scale, int y_scale);
|
||||
const uint8_t *ref, int width, int height, int stride,
|
||||
uint8_t *dst, int p_col, int p_row, int p_width,
|
||||
int p_height, int p_stride, int subsampling_x,
|
||||
int subsampling_y, int x_scale, int y_scale);
|
||||
|
||||
// Returns the error between the frame described by 'ref' and the frame
|
||||
// described by 'dst'.
|
||||
int64_t av1_frame_error(
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
int use_hbd, int bd,
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
const uint8_t *ref, int stride, uint8_t *dst, int p_col, int p_row,
|
||||
int p_width, int p_height, int p_stride);
|
||||
|
||||
void av1_warp_plane(WarpedMotionParams *wm,
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
int use_hbd, int bd,
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
uint8_t *ref, int width, int height, int stride,
|
||||
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, int x_scale, int y_scale, int ref_frm);
|
||||
int subsampling_y, int x_scale, int y_scale, int comp_avg);
|
||||
|
||||
int find_projection(int np, int *pts1, int *pts2, BLOCK_SIZE bsize, int mvy,
|
||||
int mvx, WarpedMotionParams *wm_params, int mi_row,
|
||||
|
|
|
|||
|
|
@ -19,13 +19,13 @@
|
|||
#define WIDTH_BOUND (16)
|
||||
#define HEIGHT_BOUND (16)
|
||||
|
||||
#if CONFIG_DUAL_FILTER
|
||||
#if CONFIG_DUAL_FILTER && USE_EXTRA_FILTER
|
||||
DECLARE_ALIGNED(16, static int8_t,
|
||||
sub_pel_filters_12sharp_signal_dir[15][2][16]);
|
||||
|
||||
DECLARE_ALIGNED(16, static int8_t,
|
||||
sub_pel_filters_12sharp_ver_signal_dir[15][6][16]);
|
||||
#endif // CONFIG_DUAL_FILTER
|
||||
#endif // CONFIG_DUAL_FILTER && USE_EXTRA_FILTER
|
||||
|
||||
#if USE_TEMPORALFILTER_12TAP
|
||||
DECLARE_ALIGNED(16, static int8_t,
|
||||
|
|
@ -39,7 +39,7 @@ typedef int8_t (*SubpelFilterCoeffs)[16];
|
|||
|
||||
static INLINE SubpelFilterCoeffs
|
||||
get_subpel_filter_signal_dir(const InterpFilterParams p, int index) {
|
||||
#if CONFIG_DUAL_FILTER
|
||||
#if CONFIG_DUAL_FILTER && USE_EXTRA_FILTER
|
||||
if (p.interp_filter == MULTITAP_SHARP) {
|
||||
return &sub_pel_filters_12sharp_signal_dir[index][0];
|
||||
}
|
||||
|
|
@ -56,7 +56,7 @@ get_subpel_filter_signal_dir(const InterpFilterParams p, int index) {
|
|||
|
||||
static INLINE SubpelFilterCoeffs
|
||||
get_subpel_filter_ver_signal_dir(const InterpFilterParams p, int index) {
|
||||
#if CONFIG_DUAL_FILTER
|
||||
#if CONFIG_DUAL_FILTER && USE_EXTRA_FILTER
|
||||
if (p.interp_filter == MULTITAP_SHARP) {
|
||||
return &sub_pel_filters_12sharp_ver_signal_dir[index][0];
|
||||
}
|
||||
|
|
@ -143,6 +143,7 @@ static void horiz_w4_ssse3(const uint8_t *src, const __m128i *f, int tapsNum,
|
|||
const __m128i k_256 = _mm_set1_epi16(1 << 8);
|
||||
const __m128i zero = _mm_setzero_si128();
|
||||
|
||||
assert(tapsNum == 10 || tapsNum == 12);
|
||||
if (10 == tapsNum) {
|
||||
src -= 1;
|
||||
}
|
||||
|
|
@ -470,6 +471,7 @@ static void filter_horiz_v8p_ssse3(const uint8_t *src_ptr, ptrdiff_t src_pitch,
|
|||
__m128i min_x2x3, max_x2x3;
|
||||
__m128i temp;
|
||||
|
||||
assert(tapsNum == 10 || tapsNum == 12);
|
||||
if (tapsNum == 10) {
|
||||
src_ptr -= 1;
|
||||
}
|
||||
|
|
@ -612,6 +614,7 @@ static void filter_horiz_v4p_ssse3(const uint8_t *src_ptr, ptrdiff_t src_pitch,
|
|||
__m128i x0, x1, x2, x3, x4, x5;
|
||||
__m128i min_x2x3, max_x2x3, temp;
|
||||
|
||||
assert(tapsNum == 10 || tapsNum == 12);
|
||||
if (tapsNum == 10) {
|
||||
src_ptr -= 1;
|
||||
}
|
||||
|
|
@ -982,7 +985,7 @@ typedef struct SimdFilter {
|
|||
int8_t (*simd_vert_filter)[6][16];
|
||||
} SimdFilter;
|
||||
|
||||
#if CONFIG_DUAL_FILTER
|
||||
#if CONFIG_DUAL_FILTER && USE_EXTRA_FILTER
|
||||
#define MULTITAP_FILTER_NUM 1
|
||||
SimdFilter simd_filters[MULTITAP_FILTER_NUM] = {
|
||||
{ MULTITAP_SHARP, &sub_pel_filters_12sharp_signal_dir[0],
|
||||
|
|
@ -1010,7 +1013,7 @@ void av1_lowbd_convolve_init_ssse3(void) {
|
|||
temporal_simd_filter.simd_vert_filter);
|
||||
}
|
||||
#endif
|
||||
#if CONFIG_DUAL_FILTER
|
||||
#if CONFIG_DUAL_FILTER && USE_EXTRA_FILTER
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < MULTITAP_FILTER_NUM; ++i) {
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ void av1_fdct32_new_sse4_1(const __m128i *input, __m128i *output,
|
|||
// stage 2
|
||||
stage_idx++;
|
||||
bit = cos_bit[stage_idx];
|
||||
cospi = cospi_arr[bit - cos_bit_min];
|
||||
cospi = cospi_arr(bit);
|
||||
buf0[0] = _mm_add_epi32(buf1[0], buf1[15]);
|
||||
buf0[15] = _mm_sub_epi32(buf1[0], buf1[15]);
|
||||
buf0[1] = _mm_add_epi32(buf1[1], buf1[14]);
|
||||
|
|
@ -94,7 +94,7 @@ void av1_fdct32_new_sse4_1(const __m128i *input, __m128i *output,
|
|||
// stage 3
|
||||
stage_idx++;
|
||||
bit = cos_bit[stage_idx];
|
||||
cospi = cospi_arr[bit - cos_bit_min];
|
||||
cospi = cospi_arr(bit);
|
||||
buf1[0] = _mm_add_epi32(buf0[0], buf0[7]);
|
||||
buf1[7] = _mm_sub_epi32(buf0[0], buf0[7]);
|
||||
buf1[1] = _mm_add_epi32(buf0[1], buf0[6]);
|
||||
|
|
@ -131,7 +131,7 @@ void av1_fdct32_new_sse4_1(const __m128i *input, __m128i *output,
|
|||
// stage 4
|
||||
stage_idx++;
|
||||
bit = cos_bit[stage_idx];
|
||||
cospi = cospi_arr[bit - cos_bit_min];
|
||||
cospi = cospi_arr(bit);
|
||||
buf0[0] = _mm_add_epi32(buf1[0], buf1[3]);
|
||||
buf0[3] = _mm_sub_epi32(buf1[0], buf1[3]);
|
||||
buf0[1] = _mm_add_epi32(buf1[1], buf1[2]);
|
||||
|
|
@ -168,7 +168,7 @@ void av1_fdct32_new_sse4_1(const __m128i *input, __m128i *output,
|
|||
// stage 5
|
||||
stage_idx++;
|
||||
bit = cos_bit[stage_idx];
|
||||
cospi = cospi_arr[bit - cos_bit_min];
|
||||
cospi = cospi_arr(bit);
|
||||
btf_32_sse4_1_type0(cospi[32], cospi[32], buf0[0], buf0[1], buf1[0],
|
||||
buf1[1], bit);
|
||||
btf_32_sse4_1_type1(cospi[48], cospi[16], buf0[2], buf0[3], buf1[2],
|
||||
|
|
@ -205,7 +205,7 @@ void av1_fdct32_new_sse4_1(const __m128i *input, __m128i *output,
|
|||
// stage 6
|
||||
stage_idx++;
|
||||
bit = cos_bit[stage_idx];
|
||||
cospi = cospi_arr[bit - cos_bit_min];
|
||||
cospi = cospi_arr(bit);
|
||||
buf0[0] = buf1[0];
|
||||
buf0[1] = buf1[1];
|
||||
buf0[2] = buf1[2];
|
||||
|
|
@ -242,7 +242,7 @@ void av1_fdct32_new_sse4_1(const __m128i *input, __m128i *output,
|
|||
// stage 7
|
||||
stage_idx++;
|
||||
bit = cos_bit[stage_idx];
|
||||
cospi = cospi_arr[bit - cos_bit_min];
|
||||
cospi = cospi_arr(bit);
|
||||
buf1[0] = buf0[0];
|
||||
buf1[1] = buf0[1];
|
||||
buf1[2] = buf0[2];
|
||||
|
|
@ -279,7 +279,7 @@ void av1_fdct32_new_sse4_1(const __m128i *input, __m128i *output,
|
|||
// stage 8
|
||||
stage_idx++;
|
||||
bit = cos_bit[stage_idx];
|
||||
cospi = cospi_arr[bit - cos_bit_min];
|
||||
cospi = cospi_arr(bit);
|
||||
buf0[0] = buf1[0];
|
||||
buf0[1] = buf1[1];
|
||||
buf0[2] = buf1[2];
|
||||
|
|
@ -383,7 +383,7 @@ void av1_fadst4_new_sse4_1(const __m128i *input, __m128i *output,
|
|||
// stage 2
|
||||
stage_idx++;
|
||||
bit = cos_bit[stage_idx];
|
||||
cospi = cospi_arr[bit - cos_bit_min];
|
||||
cospi = cospi_arr(bit);
|
||||
btf_32_sse4_1_type0(cospi[8], cospi[56], buf1[0], buf1[1], buf0[0], buf0[1],
|
||||
bit);
|
||||
btf_32_sse4_1_type0(cospi[40], cospi[24], buf1[2], buf1[3], buf0[2],
|
||||
|
|
@ -399,7 +399,7 @@ void av1_fadst4_new_sse4_1(const __m128i *input, __m128i *output,
|
|||
// stage 4
|
||||
stage_idx++;
|
||||
bit = cos_bit[stage_idx];
|
||||
cospi = cospi_arr[bit - cos_bit_min];
|
||||
cospi = cospi_arr(bit);
|
||||
buf0[0] = buf1[0];
|
||||
buf0[1] = buf1[1];
|
||||
btf_32_sse4_1_type0(cospi[32], cospi[32], buf1[2], buf1[3], buf0[2],
|
||||
|
|
@ -475,7 +475,7 @@ void av1_fadst32_new_sse4_1(const __m128i *input, __m128i *output,
|
|||
// stage 2
|
||||
stage_idx++;
|
||||
bit = cos_bit[stage_idx];
|
||||
cospi = cospi_arr[bit - cos_bit_min];
|
||||
cospi = cospi_arr(bit);
|
||||
btf_32_sse4_1_type0(cospi[1], cospi[63], buf1[0], buf1[1], buf0[0], buf0[1],
|
||||
bit);
|
||||
btf_32_sse4_1_type0(cospi[5], cospi[59], buf1[2], buf1[3], buf0[2], buf0[3],
|
||||
|
|
@ -547,7 +547,7 @@ void av1_fadst32_new_sse4_1(const __m128i *input, __m128i *output,
|
|||
// stage 4
|
||||
stage_idx++;
|
||||
bit = cos_bit[stage_idx];
|
||||
cospi = cospi_arr[bit - cos_bit_min];
|
||||
cospi = cospi_arr(bit);
|
||||
buf0[0] = buf1[0];
|
||||
buf0[1] = buf1[1];
|
||||
buf0[2] = buf1[2];
|
||||
|
|
@ -619,7 +619,7 @@ void av1_fadst32_new_sse4_1(const __m128i *input, __m128i *output,
|
|||
// stage 6
|
||||
stage_idx++;
|
||||
bit = cos_bit[stage_idx];
|
||||
cospi = cospi_arr[bit - cos_bit_min];
|
||||
cospi = cospi_arr(bit);
|
||||
buf0[0] = buf1[0];
|
||||
buf0[1] = buf1[1];
|
||||
buf0[2] = buf1[2];
|
||||
|
|
@ -691,7 +691,7 @@ void av1_fadst32_new_sse4_1(const __m128i *input, __m128i *output,
|
|||
// stage 8
|
||||
stage_idx++;
|
||||
bit = cos_bit[stage_idx];
|
||||
cospi = cospi_arr[bit - cos_bit_min];
|
||||
cospi = cospi_arr(bit);
|
||||
buf0[0] = buf1[0];
|
||||
buf0[1] = buf1[1];
|
||||
buf0[2] = buf1[2];
|
||||
|
|
@ -763,7 +763,7 @@ void av1_fadst32_new_sse4_1(const __m128i *input, __m128i *output,
|
|||
// stage 10
|
||||
stage_idx++;
|
||||
bit = cos_bit[stage_idx];
|
||||
cospi = cospi_arr[bit - cos_bit_min];
|
||||
cospi = cospi_arr(bit);
|
||||
buf0[0] = buf1[0];
|
||||
buf0[1] = buf1[1];
|
||||
btf_32_sse4_1_type0(cospi[32], cospi[32], buf1[2], buf1[3], buf0[2],
|
||||
|
|
|
|||
|
|
@ -37,16 +37,20 @@ static INLINE TxfmFuncSSE2 fwd_txfm_type_to_func(TXFM_TYPE txfm_type) {
|
|||
}
|
||||
|
||||
static INLINE void fwd_txfm2d_sse4_1(const int16_t *input, int32_t *output,
|
||||
const int stride, const TXFM_2D_CFG *cfg,
|
||||
const int stride,
|
||||
const TXFM_2D_FLIP_CFG *cfg,
|
||||
int32_t *txfm_buf) {
|
||||
const int txfm_size = cfg->txfm_size;
|
||||
const int8_t *shift = cfg->shift;
|
||||
const int8_t *stage_range_col = cfg->stage_range_col;
|
||||
const int8_t *stage_range_row = cfg->stage_range_row;
|
||||
const int8_t *cos_bit_col = cfg->cos_bit_col;
|
||||
const int8_t *cos_bit_row = cfg->cos_bit_row;
|
||||
const TxfmFuncSSE2 txfm_func_col = fwd_txfm_type_to_func(cfg->txfm_type_col);
|
||||
const TxfmFuncSSE2 txfm_func_row = fwd_txfm_type_to_func(cfg->txfm_type_row);
|
||||
// TODO(sarahparker) must correct for rectangular transforms in follow up
|
||||
const int txfm_size = cfg->row_cfg->txfm_size;
|
||||
const int8_t *shift = cfg->row_cfg->shift;
|
||||
const int8_t *stage_range_col = cfg->col_cfg->stage_range;
|
||||
const int8_t *stage_range_row = cfg->row_cfg->stage_range;
|
||||
const int8_t *cos_bit_col = cfg->col_cfg->cos_bit;
|
||||
const int8_t *cos_bit_row = cfg->row_cfg->cos_bit;
|
||||
const TxfmFuncSSE2 txfm_func_col =
|
||||
fwd_txfm_type_to_func(cfg->col_cfg->txfm_type);
|
||||
const TxfmFuncSSE2 txfm_func_row =
|
||||
fwd_txfm_type_to_func(cfg->row_cfg->txfm_type);
|
||||
|
||||
__m128i *buf_128 = (__m128i *)txfm_buf;
|
||||
__m128i *out_128 = (__m128i *)output;
|
||||
|
|
@ -69,7 +73,7 @@ void av1_fwd_txfm2d_32x32_sse4_1(const int16_t *input, int32_t *output,
|
|||
DECLARE_ALIGNED(16, int32_t, txfm_buf[1024]);
|
||||
TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(tx_type, TX_32X32);
|
||||
(void)bd;
|
||||
fwd_txfm2d_sse4_1(input, output, stride, cfg.cfg, txfm_buf);
|
||||
fwd_txfm2d_sse4_1(input, output, stride, &cfg, txfm_buf);
|
||||
}
|
||||
|
||||
void av1_fwd_txfm2d_64x64_sse4_1(const int16_t *input, int32_t *output,
|
||||
|
|
@ -77,5 +81,5 @@ void av1_fwd_txfm2d_64x64_sse4_1(const int16_t *input, int32_t *output,
|
|||
DECLARE_ALIGNED(16, int32_t, txfm_buf[4096]);
|
||||
TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_64x64_cfg(tx_type);
|
||||
(void)bd;
|
||||
fwd_txfm2d_sse4_1(input, output, stride, cfg.cfg, txfm_buf);
|
||||
fwd_txfm2d_sse4_1(input, output, stride, &cfg, txfm_buf);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
#include "./av1_rtcd.h"
|
||||
#include "av1/common/filter.h"
|
||||
|
||||
#if CONFIG_DUAL_FILTER
|
||||
#if CONFIG_DUAL_FILTER && USE_EXTRA_FILTER
|
||||
DECLARE_ALIGNED(16, static int16_t, subpel_filters_sharp[15][6][8]);
|
||||
#endif
|
||||
|
||||
|
|
@ -31,7 +31,7 @@ typedef void (*TransposeSave)(int width, int pixelsNum, uint32_t *src,
|
|||
|
||||
static INLINE HbdSubpelFilterCoeffs
|
||||
hbd_get_subpel_filter_ver_signal_dir(const InterpFilterParams p, int index) {
|
||||
#if CONFIG_DUAL_FILTER
|
||||
#if CONFIG_DUAL_FILTER && USE_EXTRA_FILTER
|
||||
if (p.interp_filter == MULTITAP_SHARP) {
|
||||
return &subpel_filters_sharp[index][0];
|
||||
}
|
||||
|
|
@ -76,7 +76,7 @@ void av1_highbd_convolve_init_sse4_1(void) {
|
|||
init_simd_filter(filter_ptr, taps, subpel_temporalfilter);
|
||||
}
|
||||
#endif
|
||||
#if CONFIG_DUAL_FILTER
|
||||
#if CONFIG_DUAL_FILTER && USE_EXTRA_FILTER
|
||||
{
|
||||
InterpFilterParams filter_params =
|
||||
av1_get_interp_filter_params(MULTITAP_SHARP);
|
||||
|
|
@ -246,6 +246,7 @@ static void highbd_filter_horiz(const uint16_t *src, int src_stride, __m128i *f,
|
|||
int tapsNum, uint32_t *buf) {
|
||||
__m128i u[8], v[6];
|
||||
|
||||
assert(tapsNum == 10 || tapsNum == 12);
|
||||
if (tapsNum == 10) {
|
||||
src -= 1;
|
||||
}
|
||||
|
|
@ -412,6 +413,7 @@ static void filter_vert_horiz_parallel(const uint16_t *src, int src_stride,
|
|||
int r = 0;
|
||||
|
||||
// TODO(luoyi) treat s[12] as a circular buffer in width = 2 case
|
||||
assert(taps == 10 || taps == 12);
|
||||
if (10 == taps) {
|
||||
i += 1;
|
||||
s[0] = zero;
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
#include "./av1_rtcd.h"
|
||||
#include "./aom_config.h"
|
||||
#include "av1/common/av1_inv_txfm2d_cfg.h"
|
||||
#include "av1/common/av1_inv_txfm1d_cfg.h"
|
||||
|
||||
// Note:
|
||||
// Total 32x4 registers to represent 32x32 block coefficients.
|
||||
|
|
@ -154,20 +154,21 @@ static void write_buffer_32x32(__m256i *in, uint16_t *output, int stride,
|
|||
}
|
||||
}
|
||||
|
||||
static INLINE __m256i half_btf_avx2(__m256i w0, __m256i n0, __m256i w1,
|
||||
__m256i n1, __m256i rounding, int bit) {
|
||||
static INLINE __m256i half_btf_avx2(const __m256i *w0, const __m256i *n0,
|
||||
const __m256i *w1, const __m256i *n1,
|
||||
const __m256i *rounding, int bit) {
|
||||
__m256i x, y;
|
||||
|
||||
x = _mm256_mullo_epi32(w0, n0);
|
||||
y = _mm256_mullo_epi32(w1, n1);
|
||||
x = _mm256_mullo_epi32(*w0, *n0);
|
||||
y = _mm256_mullo_epi32(*w1, *n1);
|
||||
x = _mm256_add_epi32(x, y);
|
||||
x = _mm256_add_epi32(x, rounding);
|
||||
x = _mm256_add_epi32(x, *rounding);
|
||||
x = _mm256_srai_epi32(x, bit);
|
||||
return x;
|
||||
}
|
||||
|
||||
static void idct32_avx2(__m256i *in, __m256i *out, int bit) {
|
||||
const int32_t *cospi = cospi_arr[bit - cos_bit_min];
|
||||
const int32_t *cospi = cospi_arr(bit);
|
||||
const __m256i cospi62 = _mm256_set1_epi32(cospi[62]);
|
||||
const __m256i cospi30 = _mm256_set1_epi32(cospi[30]);
|
||||
const __m256i cospi46 = _mm256_set1_epi32(cospi[46]);
|
||||
|
|
@ -275,22 +276,38 @@ static void idct32_avx2(__m256i *in, __m256i *out, int bit) {
|
|||
bf0[13] = bf1[13];
|
||||
bf0[14] = bf1[14];
|
||||
bf0[15] = bf1[15];
|
||||
bf0[16] = half_btf_avx2(cospi62, bf1[16], cospim2, bf1[31], rounding, bit);
|
||||
bf0[17] = half_btf_avx2(cospi30, bf1[17], cospim34, bf1[30], rounding, bit);
|
||||
bf0[18] = half_btf_avx2(cospi46, bf1[18], cospim18, bf1[29], rounding, bit);
|
||||
bf0[19] = half_btf_avx2(cospi14, bf1[19], cospim50, bf1[28], rounding, bit);
|
||||
bf0[20] = half_btf_avx2(cospi54, bf1[20], cospim10, bf1[27], rounding, bit);
|
||||
bf0[21] = half_btf_avx2(cospi22, bf1[21], cospim42, bf1[26], rounding, bit);
|
||||
bf0[22] = half_btf_avx2(cospi38, bf1[22], cospim26, bf1[25], rounding, bit);
|
||||
bf0[23] = half_btf_avx2(cospi6, bf1[23], cospim58, bf1[24], rounding, bit);
|
||||
bf0[24] = half_btf_avx2(cospi58, bf1[23], cospi6, bf1[24], rounding, bit);
|
||||
bf0[25] = half_btf_avx2(cospi26, bf1[22], cospi38, bf1[25], rounding, bit);
|
||||
bf0[26] = half_btf_avx2(cospi42, bf1[21], cospi22, bf1[26], rounding, bit);
|
||||
bf0[27] = half_btf_avx2(cospi10, bf1[20], cospi54, bf1[27], rounding, bit);
|
||||
bf0[28] = half_btf_avx2(cospi50, bf1[19], cospi14, bf1[28], rounding, bit);
|
||||
bf0[29] = half_btf_avx2(cospi18, bf1[18], cospi46, bf1[29], rounding, bit);
|
||||
bf0[30] = half_btf_avx2(cospi34, bf1[17], cospi30, bf1[30], rounding, bit);
|
||||
bf0[31] = half_btf_avx2(cospi2, bf1[16], cospi62, bf1[31], rounding, bit);
|
||||
bf0[16] =
|
||||
half_btf_avx2(&cospi62, &bf1[16], &cospim2, &bf1[31], &rounding, bit);
|
||||
bf0[17] =
|
||||
half_btf_avx2(&cospi30, &bf1[17], &cospim34, &bf1[30], &rounding, bit);
|
||||
bf0[18] =
|
||||
half_btf_avx2(&cospi46, &bf1[18], &cospim18, &bf1[29], &rounding, bit);
|
||||
bf0[19] =
|
||||
half_btf_avx2(&cospi14, &bf1[19], &cospim50, &bf1[28], &rounding, bit);
|
||||
bf0[20] =
|
||||
half_btf_avx2(&cospi54, &bf1[20], &cospim10, &bf1[27], &rounding, bit);
|
||||
bf0[21] =
|
||||
half_btf_avx2(&cospi22, &bf1[21], &cospim42, &bf1[26], &rounding, bit);
|
||||
bf0[22] =
|
||||
half_btf_avx2(&cospi38, &bf1[22], &cospim26, &bf1[25], &rounding, bit);
|
||||
bf0[23] =
|
||||
half_btf_avx2(&cospi6, &bf1[23], &cospim58, &bf1[24], &rounding, bit);
|
||||
bf0[24] =
|
||||
half_btf_avx2(&cospi58, &bf1[23], &cospi6, &bf1[24], &rounding, bit);
|
||||
bf0[25] =
|
||||
half_btf_avx2(&cospi26, &bf1[22], &cospi38, &bf1[25], &rounding, bit);
|
||||
bf0[26] =
|
||||
half_btf_avx2(&cospi42, &bf1[21], &cospi22, &bf1[26], &rounding, bit);
|
||||
bf0[27] =
|
||||
half_btf_avx2(&cospi10, &bf1[20], &cospi54, &bf1[27], &rounding, bit);
|
||||
bf0[28] =
|
||||
half_btf_avx2(&cospi50, &bf1[19], &cospi14, &bf1[28], &rounding, bit);
|
||||
bf0[29] =
|
||||
half_btf_avx2(&cospi18, &bf1[18], &cospi46, &bf1[29], &rounding, bit);
|
||||
bf0[30] =
|
||||
half_btf_avx2(&cospi34, &bf1[17], &cospi30, &bf1[30], &rounding, bit);
|
||||
bf0[31] =
|
||||
half_btf_avx2(&cospi2, &bf1[16], &cospi62, &bf1[31], &rounding, bit);
|
||||
|
||||
// stage 3
|
||||
bf1[0] = bf0[0];
|
||||
|
|
@ -301,14 +318,22 @@ static void idct32_avx2(__m256i *in, __m256i *out, int bit) {
|
|||
bf1[5] = bf0[5];
|
||||
bf1[6] = bf0[6];
|
||||
bf1[7] = bf0[7];
|
||||
bf1[8] = half_btf_avx2(cospi60, bf0[8], cospim4, bf0[15], rounding, bit);
|
||||
bf1[9] = half_btf_avx2(cospi28, bf0[9], cospim36, bf0[14], rounding, bit);
|
||||
bf1[10] = half_btf_avx2(cospi44, bf0[10], cospim20, bf0[13], rounding, bit);
|
||||
bf1[11] = half_btf_avx2(cospi12, bf0[11], cospim52, bf0[12], rounding, bit);
|
||||
bf1[12] = half_btf_avx2(cospi52, bf0[11], cospi12, bf0[12], rounding, bit);
|
||||
bf1[13] = half_btf_avx2(cospi20, bf0[10], cospi44, bf0[13], rounding, bit);
|
||||
bf1[14] = half_btf_avx2(cospi36, bf0[9], cospi28, bf0[14], rounding, bit);
|
||||
bf1[15] = half_btf_avx2(cospi4, bf0[8], cospi60, bf0[15], rounding, bit);
|
||||
bf1[8] =
|
||||
half_btf_avx2(&cospi60, &bf0[8], &cospim4, &bf0[15], &rounding, bit);
|
||||
bf1[9] =
|
||||
half_btf_avx2(&cospi28, &bf0[9], &cospim36, &bf0[14], &rounding, bit);
|
||||
bf1[10] =
|
||||
half_btf_avx2(&cospi44, &bf0[10], &cospim20, &bf0[13], &rounding, bit);
|
||||
bf1[11] =
|
||||
half_btf_avx2(&cospi12, &bf0[11], &cospim52, &bf0[12], &rounding, bit);
|
||||
bf1[12] =
|
||||
half_btf_avx2(&cospi52, &bf0[11], &cospi12, &bf0[12], &rounding, bit);
|
||||
bf1[13] =
|
||||
half_btf_avx2(&cospi20, &bf0[10], &cospi44, &bf0[13], &rounding, bit);
|
||||
bf1[14] =
|
||||
half_btf_avx2(&cospi36, &bf0[9], &cospi28, &bf0[14], &rounding, bit);
|
||||
bf1[15] =
|
||||
half_btf_avx2(&cospi4, &bf0[8], &cospi60, &bf0[15], &rounding, bit);
|
||||
bf1[16] = _mm256_add_epi32(bf0[16], bf0[17]);
|
||||
bf1[17] = _mm256_sub_epi32(bf0[16], bf0[17]);
|
||||
bf1[18] = _mm256_sub_epi32(bf0[19], bf0[18]);
|
||||
|
|
@ -331,10 +356,13 @@ static void idct32_avx2(__m256i *in, __m256i *out, int bit) {
|
|||
bf0[1] = bf1[1];
|
||||
bf0[2] = bf1[2];
|
||||
bf0[3] = bf1[3];
|
||||
bf0[4] = half_btf_avx2(cospi56, bf1[4], cospim8, bf1[7], rounding, bit);
|
||||
bf0[5] = half_btf_avx2(cospi24, bf1[5], cospim40, bf1[6], rounding, bit);
|
||||
bf0[6] = half_btf_avx2(cospi40, bf1[5], cospi24, bf1[6], rounding, bit);
|
||||
bf0[7] = half_btf_avx2(cospi8, bf1[4], cospi56, bf1[7], rounding, bit);
|
||||
bf0[4] =
|
||||
half_btf_avx2(&cospi56, &bf1[4], &cospim8, &bf1[7], &rounding, bit);
|
||||
bf0[5] =
|
||||
half_btf_avx2(&cospi24, &bf1[5], &cospim40, &bf1[6], &rounding, bit);
|
||||
bf0[6] =
|
||||
half_btf_avx2(&cospi40, &bf1[5], &cospi24, &bf1[6], &rounding, bit);
|
||||
bf0[7] = half_btf_avx2(&cospi8, &bf1[4], &cospi56, &bf1[7], &rounding, bit);
|
||||
bf0[8] = _mm256_add_epi32(bf1[8], bf1[9]);
|
||||
bf0[9] = _mm256_sub_epi32(bf1[8], bf1[9]);
|
||||
bf0[10] = _mm256_sub_epi32(bf1[11], bf1[10]);
|
||||
|
|
@ -344,40 +372,54 @@ static void idct32_avx2(__m256i *in, __m256i *out, int bit) {
|
|||
bf0[14] = _mm256_sub_epi32(bf1[15], bf1[14]);
|
||||
bf0[15] = _mm256_add_epi32(bf1[14], bf1[15]);
|
||||
bf0[16] = bf1[16];
|
||||
bf0[17] = half_btf_avx2(cospim8, bf1[17], cospi56, bf1[30], rounding, bit);
|
||||
bf0[18] = half_btf_avx2(cospim56, bf1[18], cospim8, bf1[29], rounding, bit);
|
||||
bf0[17] =
|
||||
half_btf_avx2(&cospim8, &bf1[17], &cospi56, &bf1[30], &rounding, bit);
|
||||
bf0[18] =
|
||||
half_btf_avx2(&cospim56, &bf1[18], &cospim8, &bf1[29], &rounding, bit);
|
||||
bf0[19] = bf1[19];
|
||||
bf0[20] = bf1[20];
|
||||
bf0[21] = half_btf_avx2(cospim40, bf1[21], cospi24, bf1[26], rounding, bit);
|
||||
bf0[21] =
|
||||
half_btf_avx2(&cospim40, &bf1[21], &cospi24, &bf1[26], &rounding, bit);
|
||||
bf0[22] =
|
||||
half_btf_avx2(cospim24, bf1[22], cospim40, bf1[25], rounding, bit);
|
||||
half_btf_avx2(&cospim24, &bf1[22], &cospim40, &bf1[25], &rounding, bit);
|
||||
bf0[23] = bf1[23];
|
||||
bf0[24] = bf1[24];
|
||||
bf0[25] = half_btf_avx2(cospim40, bf1[22], cospi24, bf1[25], rounding, bit);
|
||||
bf0[26] = half_btf_avx2(cospi24, bf1[21], cospi40, bf1[26], rounding, bit);
|
||||
bf0[25] =
|
||||
half_btf_avx2(&cospim40, &bf1[22], &cospi24, &bf1[25], &rounding, bit);
|
||||
bf0[26] =
|
||||
half_btf_avx2(&cospi24, &bf1[21], &cospi40, &bf1[26], &rounding, bit);
|
||||
bf0[27] = bf1[27];
|
||||
bf0[28] = bf1[28];
|
||||
bf0[29] = half_btf_avx2(cospim8, bf1[18], cospi56, bf1[29], rounding, bit);
|
||||
bf0[30] = half_btf_avx2(cospi56, bf1[17], cospi8, bf1[30], rounding, bit);
|
||||
bf0[29] =
|
||||
half_btf_avx2(&cospim8, &bf1[18], &cospi56, &bf1[29], &rounding, bit);
|
||||
bf0[30] =
|
||||
half_btf_avx2(&cospi56, &bf1[17], &cospi8, &bf1[30], &rounding, bit);
|
||||
bf0[31] = bf1[31];
|
||||
|
||||
// stage 5
|
||||
bf1[0] = half_btf_avx2(cospi32, bf0[0], cospi32, bf0[1], rounding, bit);
|
||||
bf1[1] = half_btf_avx2(cospi32, bf0[0], cospim32, bf0[1], rounding, bit);
|
||||
bf1[2] = half_btf_avx2(cospi48, bf0[2], cospim16, bf0[3], rounding, bit);
|
||||
bf1[3] = half_btf_avx2(cospi16, bf0[2], cospi48, bf0[3], rounding, bit);
|
||||
bf1[0] =
|
||||
half_btf_avx2(&cospi32, &bf0[0], &cospi32, &bf0[1], &rounding, bit);
|
||||
bf1[1] =
|
||||
half_btf_avx2(&cospi32, &bf0[0], &cospim32, &bf0[1], &rounding, bit);
|
||||
bf1[2] =
|
||||
half_btf_avx2(&cospi48, &bf0[2], &cospim16, &bf0[3], &rounding, bit);
|
||||
bf1[3] =
|
||||
half_btf_avx2(&cospi16, &bf0[2], &cospi48, &bf0[3], &rounding, bit);
|
||||
bf1[4] = _mm256_add_epi32(bf0[4], bf0[5]);
|
||||
bf1[5] = _mm256_sub_epi32(bf0[4], bf0[5]);
|
||||
bf1[6] = _mm256_sub_epi32(bf0[7], bf0[6]);
|
||||
bf1[7] = _mm256_add_epi32(bf0[6], bf0[7]);
|
||||
bf1[8] = bf0[8];
|
||||
bf1[9] = half_btf_avx2(cospim16, bf0[9], cospi48, bf0[14], rounding, bit);
|
||||
bf1[9] =
|
||||
half_btf_avx2(&cospim16, &bf0[9], &cospi48, &bf0[14], &rounding, bit);
|
||||
bf1[10] =
|
||||
half_btf_avx2(cospim48, bf0[10], cospim16, bf0[13], rounding, bit);
|
||||
half_btf_avx2(&cospim48, &bf0[10], &cospim16, &bf0[13], &rounding, bit);
|
||||
bf1[11] = bf0[11];
|
||||
bf1[12] = bf0[12];
|
||||
bf1[13] = half_btf_avx2(cospim16, bf0[10], cospi48, bf0[13], rounding, bit);
|
||||
bf1[14] = half_btf_avx2(cospi48, bf0[9], cospi16, bf0[14], rounding, bit);
|
||||
bf1[13] =
|
||||
half_btf_avx2(&cospim16, &bf0[10], &cospi48, &bf0[13], &rounding, bit);
|
||||
bf1[14] =
|
||||
half_btf_avx2(&cospi48, &bf0[9], &cospi16, &bf0[14], &rounding, bit);
|
||||
bf1[15] = bf0[15];
|
||||
bf1[16] = _mm256_add_epi32(bf0[16], bf0[19]);
|
||||
bf1[17] = _mm256_add_epi32(bf0[17], bf0[18]);
|
||||
|
|
@ -402,8 +444,10 @@ static void idct32_avx2(__m256i *in, __m256i *out, int bit) {
|
|||
bf0[2] = _mm256_sub_epi32(bf1[1], bf1[2]);
|
||||
bf0[3] = _mm256_sub_epi32(bf1[0], bf1[3]);
|
||||
bf0[4] = bf1[4];
|
||||
bf0[5] = half_btf_avx2(cospim32, bf1[5], cospi32, bf1[6], rounding, bit);
|
||||
bf0[6] = half_btf_avx2(cospi32, bf1[5], cospi32, bf1[6], rounding, bit);
|
||||
bf0[5] =
|
||||
half_btf_avx2(&cospim32, &bf1[5], &cospi32, &bf1[6], &rounding, bit);
|
||||
bf0[6] =
|
||||
half_btf_avx2(&cospi32, &bf1[5], &cospi32, &bf1[6], &rounding, bit);
|
||||
bf0[7] = bf1[7];
|
||||
bf0[8] = _mm256_add_epi32(bf1[8], bf1[11]);
|
||||
bf0[9] = _mm256_add_epi32(bf1[9], bf1[10]);
|
||||
|
|
@ -415,20 +459,26 @@ static void idct32_avx2(__m256i *in, __m256i *out, int bit) {
|
|||
bf0[15] = _mm256_add_epi32(bf1[12], bf1[15]);
|
||||
bf0[16] = bf1[16];
|
||||
bf0[17] = bf1[17];
|
||||
bf0[18] = half_btf_avx2(cospim16, bf1[18], cospi48, bf1[29], rounding, bit);
|
||||
bf0[19] = half_btf_avx2(cospim16, bf1[19], cospi48, bf1[28], rounding, bit);
|
||||
bf0[18] =
|
||||
half_btf_avx2(&cospim16, &bf1[18], &cospi48, &bf1[29], &rounding, bit);
|
||||
bf0[19] =
|
||||
half_btf_avx2(&cospim16, &bf1[19], &cospi48, &bf1[28], &rounding, bit);
|
||||
bf0[20] =
|
||||
half_btf_avx2(cospim48, bf1[20], cospim16, bf1[27], rounding, bit);
|
||||
half_btf_avx2(&cospim48, &bf1[20], &cospim16, &bf1[27], &rounding, bit);
|
||||
bf0[21] =
|
||||
half_btf_avx2(cospim48, bf1[21], cospim16, bf1[26], rounding, bit);
|
||||
half_btf_avx2(&cospim48, &bf1[21], &cospim16, &bf1[26], &rounding, bit);
|
||||
bf0[22] = bf1[22];
|
||||
bf0[23] = bf1[23];
|
||||
bf0[24] = bf1[24];
|
||||
bf0[25] = bf1[25];
|
||||
bf0[26] = half_btf_avx2(cospim16, bf1[21], cospi48, bf1[26], rounding, bit);
|
||||
bf0[27] = half_btf_avx2(cospim16, bf1[20], cospi48, bf1[27], rounding, bit);
|
||||
bf0[28] = half_btf_avx2(cospi48, bf1[19], cospi16, bf1[28], rounding, bit);
|
||||
bf0[29] = half_btf_avx2(cospi48, bf1[18], cospi16, bf1[29], rounding, bit);
|
||||
bf0[26] =
|
||||
half_btf_avx2(&cospim16, &bf1[21], &cospi48, &bf1[26], &rounding, bit);
|
||||
bf0[27] =
|
||||
half_btf_avx2(&cospim16, &bf1[20], &cospi48, &bf1[27], &rounding, bit);
|
||||
bf0[28] =
|
||||
half_btf_avx2(&cospi48, &bf1[19], &cospi16, &bf1[28], &rounding, bit);
|
||||
bf0[29] =
|
||||
half_btf_avx2(&cospi48, &bf1[18], &cospi16, &bf1[29], &rounding, bit);
|
||||
bf0[30] = bf1[30];
|
||||
bf0[31] = bf1[31];
|
||||
|
||||
|
|
@ -443,10 +493,14 @@ static void idct32_avx2(__m256i *in, __m256i *out, int bit) {
|
|||
bf1[7] = _mm256_sub_epi32(bf0[0], bf0[7]);
|
||||
bf1[8] = bf0[8];
|
||||
bf1[9] = bf0[9];
|
||||
bf1[10] = half_btf_avx2(cospim32, bf0[10], cospi32, bf0[13], rounding, bit);
|
||||
bf1[11] = half_btf_avx2(cospim32, bf0[11], cospi32, bf0[12], rounding, bit);
|
||||
bf1[12] = half_btf_avx2(cospi32, bf0[11], cospi32, bf0[12], rounding, bit);
|
||||
bf1[13] = half_btf_avx2(cospi32, bf0[10], cospi32, bf0[13], rounding, bit);
|
||||
bf1[10] =
|
||||
half_btf_avx2(&cospim32, &bf0[10], &cospi32, &bf0[13], &rounding, bit);
|
||||
bf1[11] =
|
||||
half_btf_avx2(&cospim32, &bf0[11], &cospi32, &bf0[12], &rounding, bit);
|
||||
bf1[12] =
|
||||
half_btf_avx2(&cospi32, &bf0[11], &cospi32, &bf0[12], &rounding, bit);
|
||||
bf1[13] =
|
||||
half_btf_avx2(&cospi32, &bf0[10], &cospi32, &bf0[13], &rounding, bit);
|
||||
bf1[14] = bf0[14];
|
||||
bf1[15] = bf0[15];
|
||||
bf1[16] = _mm256_add_epi32(bf0[16], bf0[23]);
|
||||
|
|
@ -487,14 +541,22 @@ static void idct32_avx2(__m256i *in, __m256i *out, int bit) {
|
|||
bf0[17] = bf1[17];
|
||||
bf0[18] = bf1[18];
|
||||
bf0[19] = bf1[19];
|
||||
bf0[20] = half_btf_avx2(cospim32, bf1[20], cospi32, bf1[27], rounding, bit);
|
||||
bf0[21] = half_btf_avx2(cospim32, bf1[21], cospi32, bf1[26], rounding, bit);
|
||||
bf0[22] = half_btf_avx2(cospim32, bf1[22], cospi32, bf1[25], rounding, bit);
|
||||
bf0[23] = half_btf_avx2(cospim32, bf1[23], cospi32, bf1[24], rounding, bit);
|
||||
bf0[24] = half_btf_avx2(cospi32, bf1[23], cospi32, bf1[24], rounding, bit);
|
||||
bf0[25] = half_btf_avx2(cospi32, bf1[22], cospi32, bf1[25], rounding, bit);
|
||||
bf0[26] = half_btf_avx2(cospi32, bf1[21], cospi32, bf1[26], rounding, bit);
|
||||
bf0[27] = half_btf_avx2(cospi32, bf1[20], cospi32, bf1[27], rounding, bit);
|
||||
bf0[20] =
|
||||
half_btf_avx2(&cospim32, &bf1[20], &cospi32, &bf1[27], &rounding, bit);
|
||||
bf0[21] =
|
||||
half_btf_avx2(&cospim32, &bf1[21], &cospi32, &bf1[26], &rounding, bit);
|
||||
bf0[22] =
|
||||
half_btf_avx2(&cospim32, &bf1[22], &cospi32, &bf1[25], &rounding, bit);
|
||||
bf0[23] =
|
||||
half_btf_avx2(&cospim32, &bf1[23], &cospi32, &bf1[24], &rounding, bit);
|
||||
bf0[24] =
|
||||
half_btf_avx2(&cospi32, &bf1[23], &cospi32, &bf1[24], &rounding, bit);
|
||||
bf0[25] =
|
||||
half_btf_avx2(&cospi32, &bf1[22], &cospi32, &bf1[25], &rounding, bit);
|
||||
bf0[26] =
|
||||
half_btf_avx2(&cospi32, &bf1[21], &cospi32, &bf1[26], &rounding, bit);
|
||||
bf0[27] =
|
||||
half_btf_avx2(&cospi32, &bf1[20], &cospi32, &bf1[27], &rounding, bit);
|
||||
bf0[28] = bf1[28];
|
||||
bf0[29] = bf1[29];
|
||||
bf0[30] = bf1[30];
|
||||
|
|
@ -539,18 +601,20 @@ static void idct32_avx2(__m256i *in, __m256i *out, int bit) {
|
|||
void av1_inv_txfm2d_add_32x32_avx2(const int32_t *coeff, uint16_t *output,
|
||||
int stride, int tx_type, int bd) {
|
||||
__m256i in[128], out[128];
|
||||
const TXFM_2D_CFG *cfg = NULL;
|
||||
const TXFM_1D_CFG *row_cfg = NULL;
|
||||
const TXFM_1D_CFG *col_cfg = NULL;
|
||||
|
||||
switch (tx_type) {
|
||||
case DCT_DCT:
|
||||
cfg = &inv_txfm_2d_cfg_dct_dct_32;
|
||||
row_cfg = &inv_txfm_1d_row_cfg_dct_32;
|
||||
col_cfg = &inv_txfm_1d_col_cfg_dct_32;
|
||||
load_buffer_32x32(coeff, in);
|
||||
transpose_32x32(in, out);
|
||||
idct32_avx2(out, in, cfg->cos_bit_row[2]);
|
||||
round_shift_32x32(in, -cfg->shift[0]);
|
||||
idct32_avx2(out, in, row_cfg->cos_bit[2]);
|
||||
round_shift_32x32(in, -row_cfg->shift[0]);
|
||||
transpose_32x32(in, out);
|
||||
idct32_avx2(out, in, cfg->cos_bit_col[2]);
|
||||
write_buffer_32x32(in, output, stride, 0, 0, -cfg->shift[1], bd);
|
||||
idct32_avx2(out, in, col_cfg->cos_bit[2]);
|
||||
write_buffer_32x32(in, output, stride, 0, 0, -row_cfg->shift[1], bd);
|
||||
break;
|
||||
default: assert(0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
#include "./av1_rtcd.h"
|
||||
#include "./aom_config.h"
|
||||
#include "av1/common/av1_inv_txfm2d_cfg.h"
|
||||
#include "av1/common/av1_inv_txfm1d_cfg.h"
|
||||
#include "av1/common/x86/highbd_txfm_utility_sse4.h"
|
||||
|
||||
static INLINE void load_buffer_4x4(const int32_t *coeff, __m128i *in) {
|
||||
|
|
@ -24,7 +24,7 @@ static INLINE void load_buffer_4x4(const int32_t *coeff, __m128i *in) {
|
|||
}
|
||||
|
||||
static void idct4x4_sse4_1(__m128i *in, int bit) {
|
||||
const int32_t *cospi = cospi_arr[bit - cos_bit_min];
|
||||
const int32_t *cospi = cospi_arr(bit);
|
||||
const __m128i cospi32 = _mm_set1_epi32(cospi[32]);
|
||||
const __m128i cospi48 = _mm_set1_epi32(cospi[48]);
|
||||
const __m128i cospi16 = _mm_set1_epi32(cospi[16]);
|
||||
|
|
@ -72,7 +72,7 @@ static void idct4x4_sse4_1(__m128i *in, int bit) {
|
|||
}
|
||||
|
||||
static void iadst4x4_sse4_1(__m128i *in, int bit) {
|
||||
const int32_t *cospi = cospi_arr[bit - cos_bit_min];
|
||||
const int32_t *cospi = cospi_arr(bit);
|
||||
const __m128i cospi32 = _mm_set1_epi32(cospi[32]);
|
||||
const __m128i cospi8 = _mm_set1_epi32(cospi[8]);
|
||||
const __m128i cospim8 = _mm_set1_epi32(-cospi[8]);
|
||||
|
|
@ -232,72 +232,82 @@ static void write_buffer_4x4(__m128i *in, uint16_t *output, int stride,
|
|||
void av1_inv_txfm2d_add_4x4_sse4_1(const int32_t *coeff, uint16_t *output,
|
||||
int stride, int tx_type, int bd) {
|
||||
__m128i in[4];
|
||||
const TXFM_2D_CFG *cfg = NULL;
|
||||
const TXFM_1D_CFG *row_cfg = NULL;
|
||||
const TXFM_1D_CFG *col_cfg = NULL;
|
||||
|
||||
switch (tx_type) {
|
||||
case DCT_DCT:
|
||||
cfg = &inv_txfm_2d_cfg_dct_dct_4;
|
||||
row_cfg = &inv_txfm_1d_row_cfg_dct_4;
|
||||
col_cfg = &inv_txfm_1d_col_cfg_dct_4;
|
||||
load_buffer_4x4(coeff, in);
|
||||
idct4x4_sse4_1(in, cfg->cos_bit_row[2]);
|
||||
idct4x4_sse4_1(in, cfg->cos_bit_col[2]);
|
||||
write_buffer_4x4(in, output, stride, 0, 0, -cfg->shift[1], bd);
|
||||
idct4x4_sse4_1(in, row_cfg->cos_bit[2]);
|
||||
idct4x4_sse4_1(in, col_cfg->cos_bit[2]);
|
||||
write_buffer_4x4(in, output, stride, 0, 0, -row_cfg->shift[1], bd);
|
||||
break;
|
||||
case ADST_DCT:
|
||||
cfg = &inv_txfm_2d_cfg_adst_dct_4;
|
||||
row_cfg = &inv_txfm_1d_row_cfg_dct_4;
|
||||
col_cfg = &inv_txfm_1d_col_cfg_adst_4;
|
||||
load_buffer_4x4(coeff, in);
|
||||
idct4x4_sse4_1(in, cfg->cos_bit_row[2]);
|
||||
iadst4x4_sse4_1(in, cfg->cos_bit_col[2]);
|
||||
write_buffer_4x4(in, output, stride, 0, 0, -cfg->shift[1], bd);
|
||||
idct4x4_sse4_1(in, row_cfg->cos_bit[2]);
|
||||
iadst4x4_sse4_1(in, col_cfg->cos_bit[2]);
|
||||
write_buffer_4x4(in, output, stride, 0, 0, -row_cfg->shift[1], bd);
|
||||
break;
|
||||
case DCT_ADST:
|
||||
cfg = &inv_txfm_2d_cfg_dct_adst_4;
|
||||
row_cfg = &inv_txfm_1d_row_cfg_adst_4;
|
||||
col_cfg = &inv_txfm_1d_col_cfg_dct_4;
|
||||
load_buffer_4x4(coeff, in);
|
||||
iadst4x4_sse4_1(in, cfg->cos_bit_row[2]);
|
||||
idct4x4_sse4_1(in, cfg->cos_bit_col[2]);
|
||||
write_buffer_4x4(in, output, stride, 0, 0, -cfg->shift[1], bd);
|
||||
iadst4x4_sse4_1(in, row_cfg->cos_bit[2]);
|
||||
idct4x4_sse4_1(in, col_cfg->cos_bit[2]);
|
||||
write_buffer_4x4(in, output, stride, 0, 0, -row_cfg->shift[1], bd);
|
||||
break;
|
||||
case ADST_ADST:
|
||||
cfg = &inv_txfm_2d_cfg_adst_adst_4;
|
||||
row_cfg = &inv_txfm_1d_row_cfg_adst_4;
|
||||
col_cfg = &inv_txfm_1d_col_cfg_adst_4;
|
||||
load_buffer_4x4(coeff, in);
|
||||
iadst4x4_sse4_1(in, cfg->cos_bit_row[2]);
|
||||
iadst4x4_sse4_1(in, cfg->cos_bit_col[2]);
|
||||
write_buffer_4x4(in, output, stride, 0, 0, -cfg->shift[1], bd);
|
||||
iadst4x4_sse4_1(in, row_cfg->cos_bit[2]);
|
||||
iadst4x4_sse4_1(in, col_cfg->cos_bit[2]);
|
||||
write_buffer_4x4(in, output, stride, 0, 0, -row_cfg->shift[1], bd);
|
||||
break;
|
||||
#if CONFIG_EXT_TX
|
||||
case FLIPADST_DCT:
|
||||
cfg = &inv_txfm_2d_cfg_adst_dct_4;
|
||||
row_cfg = &inv_txfm_1d_row_cfg_dct_4;
|
||||
col_cfg = &inv_txfm_1d_col_cfg_adst_4;
|
||||
load_buffer_4x4(coeff, in);
|
||||
idct4x4_sse4_1(in, cfg->cos_bit_row[2]);
|
||||
iadst4x4_sse4_1(in, cfg->cos_bit_col[2]);
|
||||
write_buffer_4x4(in, output, stride, 0, 1, -cfg->shift[1], bd);
|
||||
idct4x4_sse4_1(in, row_cfg->cos_bit[2]);
|
||||
iadst4x4_sse4_1(in, col_cfg->cos_bit[2]);
|
||||
write_buffer_4x4(in, output, stride, 0, 1, -row_cfg->shift[1], bd);
|
||||
break;
|
||||
case DCT_FLIPADST:
|
||||
cfg = &inv_txfm_2d_cfg_dct_adst_4;
|
||||
row_cfg = &inv_txfm_1d_row_cfg_adst_4;
|
||||
col_cfg = &inv_txfm_1d_col_cfg_dct_4;
|
||||
load_buffer_4x4(coeff, in);
|
||||
iadst4x4_sse4_1(in, cfg->cos_bit_row[2]);
|
||||
idct4x4_sse4_1(in, cfg->cos_bit_col[2]);
|
||||
write_buffer_4x4(in, output, stride, 1, 0, -cfg->shift[1], bd);
|
||||
iadst4x4_sse4_1(in, row_cfg->cos_bit[2]);
|
||||
idct4x4_sse4_1(in, col_cfg->cos_bit[2]);
|
||||
write_buffer_4x4(in, output, stride, 1, 0, -row_cfg->shift[1], bd);
|
||||
break;
|
||||
case FLIPADST_FLIPADST:
|
||||
cfg = &inv_txfm_2d_cfg_adst_adst_4;
|
||||
row_cfg = &inv_txfm_1d_row_cfg_adst_4;
|
||||
col_cfg = &inv_txfm_1d_col_cfg_adst_4;
|
||||
load_buffer_4x4(coeff, in);
|
||||
iadst4x4_sse4_1(in, cfg->cos_bit_row[2]);
|
||||
iadst4x4_sse4_1(in, cfg->cos_bit_col[2]);
|
||||
write_buffer_4x4(in, output, stride, 1, 1, -cfg->shift[1], bd);
|
||||
iadst4x4_sse4_1(in, row_cfg->cos_bit[2]);
|
||||
iadst4x4_sse4_1(in, col_cfg->cos_bit[2]);
|
||||
write_buffer_4x4(in, output, stride, 1, 1, -row_cfg->shift[1], bd);
|
||||
break;
|
||||
case ADST_FLIPADST:
|
||||
cfg = &inv_txfm_2d_cfg_adst_adst_4;
|
||||
row_cfg = &inv_txfm_1d_row_cfg_adst_4;
|
||||
col_cfg = &inv_txfm_1d_col_cfg_adst_4;
|
||||
load_buffer_4x4(coeff, in);
|
||||
iadst4x4_sse4_1(in, cfg->cos_bit_row[2]);
|
||||
iadst4x4_sse4_1(in, cfg->cos_bit_col[2]);
|
||||
write_buffer_4x4(in, output, stride, 1, 0, -cfg->shift[1], bd);
|
||||
iadst4x4_sse4_1(in, row_cfg->cos_bit[2]);
|
||||
iadst4x4_sse4_1(in, col_cfg->cos_bit[2]);
|
||||
write_buffer_4x4(in, output, stride, 1, 0, -row_cfg->shift[1], bd);
|
||||
break;
|
||||
case FLIPADST_ADST:
|
||||
cfg = &inv_txfm_2d_cfg_adst_adst_4;
|
||||
row_cfg = &inv_txfm_1d_row_cfg_adst_4;
|
||||
col_cfg = &inv_txfm_1d_col_cfg_adst_4;
|
||||
load_buffer_4x4(coeff, in);
|
||||
iadst4x4_sse4_1(in, cfg->cos_bit_row[2]);
|
||||
iadst4x4_sse4_1(in, cfg->cos_bit_col[2]);
|
||||
write_buffer_4x4(in, output, stride, 0, 1, -cfg->shift[1], bd);
|
||||
iadst4x4_sse4_1(in, row_cfg->cos_bit[2]);
|
||||
iadst4x4_sse4_1(in, col_cfg->cos_bit[2]);
|
||||
write_buffer_4x4(in, output, stride, 0, 1, -row_cfg->shift[1], bd);
|
||||
break;
|
||||
#endif // CONFIG_EXT_TX
|
||||
default: assert(0);
|
||||
|
|
@ -325,7 +335,7 @@ static void load_buffer_8x8(const int32_t *coeff, __m128i *in) {
|
|||
}
|
||||
|
||||
static void idct8x8_sse4_1(__m128i *in, __m128i *out, int bit) {
|
||||
const int32_t *cospi = cospi_arr[bit - cos_bit_min];
|
||||
const int32_t *cospi = cospi_arr(bit);
|
||||
const __m128i cospi56 = _mm_set1_epi32(cospi[56]);
|
||||
const __m128i cospim8 = _mm_set1_epi32(-cospi[8]);
|
||||
const __m128i cospi24 = _mm_set1_epi32(cospi[24]);
|
||||
|
|
@ -439,7 +449,7 @@ static void idct8x8_sse4_1(__m128i *in, __m128i *out, int bit) {
|
|||
}
|
||||
|
||||
static void iadst8x8_sse4_1(__m128i *in, __m128i *out, int bit) {
|
||||
const int32_t *cospi = cospi_arr[bit - cos_bit_min];
|
||||
const int32_t *cospi = cospi_arr(bit);
|
||||
const __m128i cospi32 = _mm_set1_epi32(cospi[32]);
|
||||
const __m128i cospi16 = _mm_set1_epi32(cospi[16]);
|
||||
const __m128i cospim16 = _mm_set1_epi32(-cospi[16]);
|
||||
|
|
@ -698,90 +708,100 @@ static void write_buffer_8x8(__m128i *in, uint16_t *output, int stride,
|
|||
void av1_inv_txfm2d_add_8x8_sse4_1(const int32_t *coeff, uint16_t *output,
|
||||
int stride, int tx_type, int bd) {
|
||||
__m128i in[16], out[16];
|
||||
const TXFM_2D_CFG *cfg = NULL;
|
||||
const TXFM_1D_CFG *row_cfg = NULL;
|
||||
const TXFM_1D_CFG *col_cfg = NULL;
|
||||
|
||||
switch (tx_type) {
|
||||
case DCT_DCT:
|
||||
cfg = &inv_txfm_2d_cfg_dct_dct_8;
|
||||
row_cfg = &inv_txfm_1d_row_cfg_dct_8;
|
||||
col_cfg = &inv_txfm_1d_col_cfg_dct_8;
|
||||
load_buffer_8x8(coeff, in);
|
||||
transpose_8x8(in, out);
|
||||
idct8x8_sse4_1(out, in, cfg->cos_bit_row[2]);
|
||||
idct8x8_sse4_1(out, in, row_cfg->cos_bit[2]);
|
||||
transpose_8x8(in, out);
|
||||
idct8x8_sse4_1(out, in, cfg->cos_bit_col[2]);
|
||||
write_buffer_8x8(in, output, stride, 0, 0, -cfg->shift[1], bd);
|
||||
idct8x8_sse4_1(out, in, col_cfg->cos_bit[2]);
|
||||
write_buffer_8x8(in, output, stride, 0, 0, -row_cfg->shift[1], bd);
|
||||
break;
|
||||
case DCT_ADST:
|
||||
cfg = &inv_txfm_2d_cfg_dct_adst_8;
|
||||
row_cfg = &inv_txfm_1d_row_cfg_adst_8;
|
||||
col_cfg = &inv_txfm_1d_col_cfg_dct_8;
|
||||
load_buffer_8x8(coeff, in);
|
||||
transpose_8x8(in, out);
|
||||
iadst8x8_sse4_1(out, in, cfg->cos_bit_row[2]);
|
||||
iadst8x8_sse4_1(out, in, row_cfg->cos_bit[2]);
|
||||
transpose_8x8(in, out);
|
||||
idct8x8_sse4_1(out, in, cfg->cos_bit_col[2]);
|
||||
write_buffer_8x8(in, output, stride, 0, 0, -cfg->shift[1], bd);
|
||||
idct8x8_sse4_1(out, in, col_cfg->cos_bit[2]);
|
||||
write_buffer_8x8(in, output, stride, 0, 0, -row_cfg->shift[1], bd);
|
||||
break;
|
||||
case ADST_DCT:
|
||||
cfg = &inv_txfm_2d_cfg_adst_dct_8;
|
||||
row_cfg = &inv_txfm_1d_row_cfg_dct_8;
|
||||
col_cfg = &inv_txfm_1d_col_cfg_adst_8;
|
||||
load_buffer_8x8(coeff, in);
|
||||
transpose_8x8(in, out);
|
||||
idct8x8_sse4_1(out, in, cfg->cos_bit_row[2]);
|
||||
idct8x8_sse4_1(out, in, row_cfg->cos_bit[2]);
|
||||
transpose_8x8(in, out);
|
||||
iadst8x8_sse4_1(out, in, cfg->cos_bit_col[2]);
|
||||
write_buffer_8x8(in, output, stride, 0, 0, -cfg->shift[1], bd);
|
||||
iadst8x8_sse4_1(out, in, col_cfg->cos_bit[2]);
|
||||
write_buffer_8x8(in, output, stride, 0, 0, -row_cfg->shift[1], bd);
|
||||
break;
|
||||
case ADST_ADST:
|
||||
cfg = &inv_txfm_2d_cfg_adst_adst_8;
|
||||
row_cfg = &inv_txfm_1d_row_cfg_adst_8;
|
||||
col_cfg = &inv_txfm_1d_col_cfg_adst_8;
|
||||
load_buffer_8x8(coeff, in);
|
||||
transpose_8x8(in, out);
|
||||
iadst8x8_sse4_1(out, in, cfg->cos_bit_row[2]);
|
||||
iadst8x8_sse4_1(out, in, row_cfg->cos_bit[2]);
|
||||
transpose_8x8(in, out);
|
||||
iadst8x8_sse4_1(out, in, cfg->cos_bit_col[2]);
|
||||
write_buffer_8x8(in, output, stride, 0, 0, -cfg->shift[1], bd);
|
||||
iadst8x8_sse4_1(out, in, col_cfg->cos_bit[2]);
|
||||
write_buffer_8x8(in, output, stride, 0, 0, -row_cfg->shift[1], bd);
|
||||
break;
|
||||
#if CONFIG_EXT_TX
|
||||
case FLIPADST_DCT:
|
||||
cfg = &inv_txfm_2d_cfg_adst_dct_8;
|
||||
row_cfg = &inv_txfm_1d_row_cfg_dct_8;
|
||||
col_cfg = &inv_txfm_1d_col_cfg_adst_8;
|
||||
load_buffer_8x8(coeff, in);
|
||||
transpose_8x8(in, out);
|
||||
idct8x8_sse4_1(out, in, cfg->cos_bit_row[2]);
|
||||
idct8x8_sse4_1(out, in, row_cfg->cos_bit[2]);
|
||||
transpose_8x8(in, out);
|
||||
iadst8x8_sse4_1(out, in, cfg->cos_bit_col[2]);
|
||||
write_buffer_8x8(in, output, stride, 0, 1, -cfg->shift[1], bd);
|
||||
iadst8x8_sse4_1(out, in, col_cfg->cos_bit[2]);
|
||||
write_buffer_8x8(in, output, stride, 0, 1, -row_cfg->shift[1], bd);
|
||||
break;
|
||||
case DCT_FLIPADST:
|
||||
cfg = &inv_txfm_2d_cfg_dct_adst_8;
|
||||
row_cfg = &inv_txfm_1d_row_cfg_adst_8;
|
||||
col_cfg = &inv_txfm_1d_col_cfg_dct_8;
|
||||
load_buffer_8x8(coeff, in);
|
||||
transpose_8x8(in, out);
|
||||
iadst8x8_sse4_1(out, in, cfg->cos_bit_row[2]);
|
||||
iadst8x8_sse4_1(out, in, row_cfg->cos_bit[2]);
|
||||
transpose_8x8(in, out);
|
||||
idct8x8_sse4_1(out, in, cfg->cos_bit_col[2]);
|
||||
write_buffer_8x8(in, output, stride, 1, 0, -cfg->shift[1], bd);
|
||||
idct8x8_sse4_1(out, in, col_cfg->cos_bit[2]);
|
||||
write_buffer_8x8(in, output, stride, 1, 0, -row_cfg->shift[1], bd);
|
||||
break;
|
||||
case ADST_FLIPADST:
|
||||
cfg = &inv_txfm_2d_cfg_adst_adst_8;
|
||||
row_cfg = &inv_txfm_1d_row_cfg_adst_8;
|
||||
col_cfg = &inv_txfm_1d_col_cfg_adst_8;
|
||||
load_buffer_8x8(coeff, in);
|
||||
transpose_8x8(in, out);
|
||||
iadst8x8_sse4_1(out, in, cfg->cos_bit_row[2]);
|
||||
iadst8x8_sse4_1(out, in, row_cfg->cos_bit[2]);
|
||||
transpose_8x8(in, out);
|
||||
iadst8x8_sse4_1(out, in, cfg->cos_bit_col[2]);
|
||||
write_buffer_8x8(in, output, stride, 1, 0, -cfg->shift[1], bd);
|
||||
iadst8x8_sse4_1(out, in, col_cfg->cos_bit[2]);
|
||||
write_buffer_8x8(in, output, stride, 1, 0, -row_cfg->shift[1], bd);
|
||||
break;
|
||||
case FLIPADST_FLIPADST:
|
||||
cfg = &inv_txfm_2d_cfg_adst_adst_8;
|
||||
row_cfg = &inv_txfm_1d_row_cfg_adst_8;
|
||||
col_cfg = &inv_txfm_1d_col_cfg_adst_8;
|
||||
load_buffer_8x8(coeff, in);
|
||||
transpose_8x8(in, out);
|
||||
iadst8x8_sse4_1(out, in, cfg->cos_bit_row[2]);
|
||||
iadst8x8_sse4_1(out, in, row_cfg->cos_bit[2]);
|
||||
transpose_8x8(in, out);
|
||||
iadst8x8_sse4_1(out, in, cfg->cos_bit_col[2]);
|
||||
write_buffer_8x8(in, output, stride, 1, 1, -cfg->shift[1], bd);
|
||||
iadst8x8_sse4_1(out, in, col_cfg->cos_bit[2]);
|
||||
write_buffer_8x8(in, output, stride, 1, 1, -row_cfg->shift[1], bd);
|
||||
break;
|
||||
case FLIPADST_ADST:
|
||||
cfg = &inv_txfm_2d_cfg_adst_adst_8;
|
||||
row_cfg = &inv_txfm_1d_row_cfg_adst_8;
|
||||
col_cfg = &inv_txfm_1d_col_cfg_adst_8;
|
||||
load_buffer_8x8(coeff, in);
|
||||
transpose_8x8(in, out);
|
||||
iadst8x8_sse4_1(out, in, cfg->cos_bit_row[2]);
|
||||
iadst8x8_sse4_1(out, in, row_cfg->cos_bit[2]);
|
||||
transpose_8x8(in, out);
|
||||
iadst8x8_sse4_1(out, in, cfg->cos_bit_col[2]);
|
||||
write_buffer_8x8(in, output, stride, 0, 1, -cfg->shift[1], bd);
|
||||
iadst8x8_sse4_1(out, in, col_cfg->cos_bit[2]);
|
||||
write_buffer_8x8(in, output, stride, 0, 1, -row_cfg->shift[1], bd);
|
||||
break;
|
||||
#endif // CONFIG_EXT_TX
|
||||
default: assert(0);
|
||||
|
|
@ -849,7 +869,7 @@ static void write_buffer_16x16(__m128i *in, uint16_t *output, int stride,
|
|||
}
|
||||
|
||||
static void idct16x16_sse4_1(__m128i *in, __m128i *out, int bit) {
|
||||
const int32_t *cospi = cospi_arr[bit - cos_bit_min];
|
||||
const int32_t *cospi = cospi_arr(bit);
|
||||
const __m128i cospi60 = _mm_set1_epi32(cospi[60]);
|
||||
const __m128i cospim4 = _mm_set1_epi32(-cospi[4]);
|
||||
const __m128i cospi28 = _mm_set1_epi32(cospi[28]);
|
||||
|
|
@ -907,24 +927,24 @@ static void idct16x16_sse4_1(__m128i *in, __m128i *out, int bit) {
|
|||
v[6] = u[6];
|
||||
v[7] = u[7];
|
||||
|
||||
v[8] = half_btf_sse4_1(cospi60, u[8], cospim4, u[15], rnding, bit);
|
||||
v[9] = half_btf_sse4_1(cospi28, u[9], cospim36, u[14], rnding, bit);
|
||||
v[10] = half_btf_sse4_1(cospi44, u[10], cospim20, u[13], rnding, bit);
|
||||
v[11] = half_btf_sse4_1(cospi12, u[11], cospim52, u[12], rnding, bit);
|
||||
v[12] = half_btf_sse4_1(cospi52, u[11], cospi12, u[12], rnding, bit);
|
||||
v[13] = half_btf_sse4_1(cospi20, u[10], cospi44, u[13], rnding, bit);
|
||||
v[14] = half_btf_sse4_1(cospi36, u[9], cospi28, u[14], rnding, bit);
|
||||
v[15] = half_btf_sse4_1(cospi4, u[8], cospi60, u[15], rnding, bit);
|
||||
v[8] = half_btf_sse4_1(&cospi60, &u[8], &cospim4, &u[15], &rnding, bit);
|
||||
v[9] = half_btf_sse4_1(&cospi28, &u[9], &cospim36, &u[14], &rnding, bit);
|
||||
v[10] = half_btf_sse4_1(&cospi44, &u[10], &cospim20, &u[13], &rnding, bit);
|
||||
v[11] = half_btf_sse4_1(&cospi12, &u[11], &cospim52, &u[12], &rnding, bit);
|
||||
v[12] = half_btf_sse4_1(&cospi52, &u[11], &cospi12, &u[12], &rnding, bit);
|
||||
v[13] = half_btf_sse4_1(&cospi20, &u[10], &cospi44, &u[13], &rnding, bit);
|
||||
v[14] = half_btf_sse4_1(&cospi36, &u[9], &cospi28, &u[14], &rnding, bit);
|
||||
v[15] = half_btf_sse4_1(&cospi4, &u[8], &cospi60, &u[15], &rnding, bit);
|
||||
|
||||
// stage 3
|
||||
u[0] = v[0];
|
||||
u[1] = v[1];
|
||||
u[2] = v[2];
|
||||
u[3] = v[3];
|
||||
u[4] = half_btf_sse4_1(cospi56, v[4], cospim8, v[7], rnding, bit);
|
||||
u[5] = half_btf_sse4_1(cospi24, v[5], cospim40, v[6], rnding, bit);
|
||||
u[6] = half_btf_sse4_1(cospi40, v[5], cospi24, v[6], rnding, bit);
|
||||
u[7] = half_btf_sse4_1(cospi8, v[4], cospi56, v[7], rnding, bit);
|
||||
u[4] = half_btf_sse4_1(&cospi56, &v[4], &cospim8, &v[7], &rnding, bit);
|
||||
u[5] = half_btf_sse4_1(&cospi24, &v[5], &cospim40, &v[6], &rnding, bit);
|
||||
u[6] = half_btf_sse4_1(&cospi40, &v[5], &cospi24, &v[6], &rnding, bit);
|
||||
u[7] = half_btf_sse4_1(&cospi8, &v[4], &cospi56, &v[7], &rnding, bit);
|
||||
u[8] = _mm_add_epi32(v[8], v[9]);
|
||||
u[9] = _mm_sub_epi32(v[8], v[9]);
|
||||
u[10] = _mm_sub_epi32(v[11], v[10]);
|
||||
|
|
@ -945,19 +965,19 @@ static void idct16x16_sse4_1(__m128i *in, __m128i *out, int bit) {
|
|||
v[1] = _mm_add_epi32(v[1], rnding);
|
||||
v[1] = _mm_srai_epi32(v[1], bit);
|
||||
|
||||
v[2] = half_btf_sse4_1(cospi48, u[2], cospim16, u[3], rnding, bit);
|
||||
v[3] = half_btf_sse4_1(cospi16, u[2], cospi48, u[3], rnding, bit);
|
||||
v[2] = half_btf_sse4_1(&cospi48, &u[2], &cospim16, &u[3], &rnding, bit);
|
||||
v[3] = half_btf_sse4_1(&cospi16, &u[2], &cospi48, &u[3], &rnding, bit);
|
||||
v[4] = _mm_add_epi32(u[4], u[5]);
|
||||
v[5] = _mm_sub_epi32(u[4], u[5]);
|
||||
v[6] = _mm_sub_epi32(u[7], u[6]);
|
||||
v[7] = _mm_add_epi32(u[6], u[7]);
|
||||
v[8] = u[8];
|
||||
v[9] = half_btf_sse4_1(cospim16, u[9], cospi48, u[14], rnding, bit);
|
||||
v[10] = half_btf_sse4_1(cospim48, u[10], cospim16, u[13], rnding, bit);
|
||||
v[9] = half_btf_sse4_1(&cospim16, &u[9], &cospi48, &u[14], &rnding, bit);
|
||||
v[10] = half_btf_sse4_1(&cospim48, &u[10], &cospim16, &u[13], &rnding, bit);
|
||||
v[11] = u[11];
|
||||
v[12] = u[12];
|
||||
v[13] = half_btf_sse4_1(cospim16, u[10], cospi48, u[13], rnding, bit);
|
||||
v[14] = half_btf_sse4_1(cospi48, u[9], cospi16, u[14], rnding, bit);
|
||||
v[13] = half_btf_sse4_1(&cospim16, &u[10], &cospi48, &u[13], &rnding, bit);
|
||||
v[14] = half_btf_sse4_1(&cospi48, &u[9], &cospi16, &u[14], &rnding, bit);
|
||||
v[15] = u[15];
|
||||
|
||||
// stage 5
|
||||
|
|
@ -1043,7 +1063,7 @@ static void idct16x16_sse4_1(__m128i *in, __m128i *out, int bit) {
|
|||
}
|
||||
|
||||
static void iadst16x16_sse4_1(__m128i *in, __m128i *out, int bit) {
|
||||
const int32_t *cospi = cospi_arr[bit - cos_bit_min];
|
||||
const int32_t *cospi = cospi_arr(bit);
|
||||
const __m128i cospi32 = _mm_set1_epi32(cospi[32]);
|
||||
const __m128i cospi48 = _mm_set1_epi32(cospi[48]);
|
||||
const __m128i cospi16 = _mm_set1_epi32(cospi[16]);
|
||||
|
|
@ -1183,18 +1203,18 @@ static void iadst16x16_sse4_1(__m128i *in, __m128i *out, int bit) {
|
|||
v[1] = u[1];
|
||||
v[2] = u[2];
|
||||
v[3] = u[3];
|
||||
v[4] = half_btf_sse4_1(cospi16, u[4], cospi48, u[5], rnding, bit);
|
||||
v[5] = half_btf_sse4_1(cospi48, u[4], cospim16, u[5], rnding, bit);
|
||||
v[6] = half_btf_sse4_1(cospim48, u[6], cospi16, u[7], rnding, bit);
|
||||
v[7] = half_btf_sse4_1(cospi16, u[6], cospi48, u[7], rnding, bit);
|
||||
v[4] = half_btf_sse4_1(&cospi16, &u[4], &cospi48, &u[5], &rnding, bit);
|
||||
v[5] = half_btf_sse4_1(&cospi48, &u[4], &cospim16, &u[5], &rnding, bit);
|
||||
v[6] = half_btf_sse4_1(&cospim48, &u[6], &cospi16, &u[7], &rnding, bit);
|
||||
v[7] = half_btf_sse4_1(&cospi16, &u[6], &cospi48, &u[7], &rnding, bit);
|
||||
v[8] = u[8];
|
||||
v[9] = u[9];
|
||||
v[10] = u[10];
|
||||
v[11] = u[11];
|
||||
v[12] = half_btf_sse4_1(cospi16, u[12], cospi48, u[13], rnding, bit);
|
||||
v[13] = half_btf_sse4_1(cospi48, u[12], cospim16, u[13], rnding, bit);
|
||||
v[14] = half_btf_sse4_1(cospim48, u[14], cospi16, u[15], rnding, bit);
|
||||
v[15] = half_btf_sse4_1(cospi16, u[14], cospi48, u[15], rnding, bit);
|
||||
v[12] = half_btf_sse4_1(&cospi16, &u[12], &cospi48, &u[13], &rnding, bit);
|
||||
v[13] = half_btf_sse4_1(&cospi48, &u[12], &cospim16, &u[13], &rnding, bit);
|
||||
v[14] = half_btf_sse4_1(&cospim48, &u[14], &cospi16, &u[15], &rnding, bit);
|
||||
v[15] = half_btf_sse4_1(&cospi16, &u[14], &cospi48, &u[15], &rnding, bit);
|
||||
|
||||
// stage 5
|
||||
u[0] = _mm_add_epi32(v[0], v[4]);
|
||||
|
|
@ -1223,14 +1243,14 @@ static void iadst16x16_sse4_1(__m128i *in, __m128i *out, int bit) {
|
|||
v[5] = u[5];
|
||||
v[6] = u[6];
|
||||
v[7] = u[7];
|
||||
v[8] = half_btf_sse4_1(cospi8, u[8], cospi56, u[9], rnding, bit);
|
||||
v[9] = half_btf_sse4_1(cospi56, u[8], cospim8, u[9], rnding, bit);
|
||||
v[10] = half_btf_sse4_1(cospi40, u[10], cospi24, u[11], rnding, bit);
|
||||
v[11] = half_btf_sse4_1(cospi24, u[10], cospim40, u[11], rnding, bit);
|
||||
v[12] = half_btf_sse4_1(cospim56, u[12], cospi8, u[13], rnding, bit);
|
||||
v[13] = half_btf_sse4_1(cospi8, u[12], cospi56, u[13], rnding, bit);
|
||||
v[14] = half_btf_sse4_1(cospim24, u[14], cospi40, u[15], rnding, bit);
|
||||
v[15] = half_btf_sse4_1(cospi40, u[14], cospi24, u[15], rnding, bit);
|
||||
v[8] = half_btf_sse4_1(&cospi8, &u[8], &cospi56, &u[9], &rnding, bit);
|
||||
v[9] = half_btf_sse4_1(&cospi56, &u[8], &cospim8, &u[9], &rnding, bit);
|
||||
v[10] = half_btf_sse4_1(&cospi40, &u[10], &cospi24, &u[11], &rnding, bit);
|
||||
v[11] = half_btf_sse4_1(&cospi24, &u[10], &cospim40, &u[11], &rnding, bit);
|
||||
v[12] = half_btf_sse4_1(&cospim56, &u[12], &cospi8, &u[13], &rnding, bit);
|
||||
v[13] = half_btf_sse4_1(&cospi8, &u[12], &cospi56, &u[13], &rnding, bit);
|
||||
v[14] = half_btf_sse4_1(&cospim24, &u[14], &cospi40, &u[15], &rnding, bit);
|
||||
v[15] = half_btf_sse4_1(&cospi40, &u[14], &cospi24, &u[15], &rnding, bit);
|
||||
|
||||
// stage 7
|
||||
u[0] = _mm_add_epi32(v[0], v[8]);
|
||||
|
|
@ -1251,22 +1271,22 @@ static void iadst16x16_sse4_1(__m128i *in, __m128i *out, int bit) {
|
|||
u[15] = _mm_sub_epi32(v[7], v[15]);
|
||||
|
||||
// stage 8
|
||||
v[0] = half_btf_sse4_1(cospi2, u[0], cospi62, u[1], rnding, bit);
|
||||
v[1] = half_btf_sse4_1(cospi62, u[0], cospim2, u[1], rnding, bit);
|
||||
v[2] = half_btf_sse4_1(cospi10, u[2], cospi54, u[3], rnding, bit);
|
||||
v[3] = half_btf_sse4_1(cospi54, u[2], cospim10, u[3], rnding, bit);
|
||||
v[4] = half_btf_sse4_1(cospi18, u[4], cospi46, u[5], rnding, bit);
|
||||
v[5] = half_btf_sse4_1(cospi46, u[4], cospim18, u[5], rnding, bit);
|
||||
v[6] = half_btf_sse4_1(cospi26, u[6], cospi38, u[7], rnding, bit);
|
||||
v[7] = half_btf_sse4_1(cospi38, u[6], cospim26, u[7], rnding, bit);
|
||||
v[8] = half_btf_sse4_1(cospi34, u[8], cospi30, u[9], rnding, bit);
|
||||
v[9] = half_btf_sse4_1(cospi30, u[8], cospim34, u[9], rnding, bit);
|
||||
v[10] = half_btf_sse4_1(cospi42, u[10], cospi22, u[11], rnding, bit);
|
||||
v[11] = half_btf_sse4_1(cospi22, u[10], cospim42, u[11], rnding, bit);
|
||||
v[12] = half_btf_sse4_1(cospi50, u[12], cospi14, u[13], rnding, bit);
|
||||
v[13] = half_btf_sse4_1(cospi14, u[12], cospim50, u[13], rnding, bit);
|
||||
v[14] = half_btf_sse4_1(cospi58, u[14], cospi6, u[15], rnding, bit);
|
||||
v[15] = half_btf_sse4_1(cospi6, u[14], cospim58, u[15], rnding, bit);
|
||||
v[0] = half_btf_sse4_1(&cospi2, &u[0], &cospi62, &u[1], &rnding, bit);
|
||||
v[1] = half_btf_sse4_1(&cospi62, &u[0], &cospim2, &u[1], &rnding, bit);
|
||||
v[2] = half_btf_sse4_1(&cospi10, &u[2], &cospi54, &u[3], &rnding, bit);
|
||||
v[3] = half_btf_sse4_1(&cospi54, &u[2], &cospim10, &u[3], &rnding, bit);
|
||||
v[4] = half_btf_sse4_1(&cospi18, &u[4], &cospi46, &u[5], &rnding, bit);
|
||||
v[5] = half_btf_sse4_1(&cospi46, &u[4], &cospim18, &u[5], &rnding, bit);
|
||||
v[6] = half_btf_sse4_1(&cospi26, &u[6], &cospi38, &u[7], &rnding, bit);
|
||||
v[7] = half_btf_sse4_1(&cospi38, &u[6], &cospim26, &u[7], &rnding, bit);
|
||||
v[8] = half_btf_sse4_1(&cospi34, &u[8], &cospi30, &u[9], &rnding, bit);
|
||||
v[9] = half_btf_sse4_1(&cospi30, &u[8], &cospim34, &u[9], &rnding, bit);
|
||||
v[10] = half_btf_sse4_1(&cospi42, &u[10], &cospi22, &u[11], &rnding, bit);
|
||||
v[11] = half_btf_sse4_1(&cospi22, &u[10], &cospim42, &u[11], &rnding, bit);
|
||||
v[12] = half_btf_sse4_1(&cospi50, &u[12], &cospi14, &u[13], &rnding, bit);
|
||||
v[13] = half_btf_sse4_1(&cospi14, &u[12], &cospim50, &u[13], &rnding, bit);
|
||||
v[14] = half_btf_sse4_1(&cospi58, &u[14], &cospi6, &u[15], &rnding, bit);
|
||||
v[15] = half_btf_sse4_1(&cospi6, &u[14], &cospim58, &u[15], &rnding, bit);
|
||||
|
||||
// stage 9
|
||||
out[0 * 4 + col] = v[1];
|
||||
|
|
@ -1298,99 +1318,109 @@ static void round_shift_16x16(__m128i *in, int shift) {
|
|||
void av1_inv_txfm2d_add_16x16_sse4_1(const int32_t *coeff, uint16_t *output,
|
||||
int stride, int tx_type, int bd) {
|
||||
__m128i in[64], out[64];
|
||||
const TXFM_2D_CFG *cfg = NULL;
|
||||
const TXFM_1D_CFG *row_cfg = NULL;
|
||||
const TXFM_1D_CFG *col_cfg = NULL;
|
||||
|
||||
switch (tx_type) {
|
||||
case DCT_DCT:
|
||||
cfg = &inv_txfm_2d_cfg_dct_dct_16;
|
||||
row_cfg = &inv_txfm_1d_row_cfg_dct_16;
|
||||
col_cfg = &inv_txfm_1d_col_cfg_dct_16;
|
||||
load_buffer_16x16(coeff, in);
|
||||
transpose_16x16(in, out);
|
||||
idct16x16_sse4_1(out, in, cfg->cos_bit_row[2]);
|
||||
round_shift_16x16(in, -cfg->shift[0]);
|
||||
idct16x16_sse4_1(out, in, row_cfg->cos_bit[2]);
|
||||
round_shift_16x16(in, -row_cfg->shift[0]);
|
||||
transpose_16x16(in, out);
|
||||
idct16x16_sse4_1(out, in, cfg->cos_bit_col[2]);
|
||||
write_buffer_16x16(in, output, stride, 0, 0, -cfg->shift[1], bd);
|
||||
idct16x16_sse4_1(out, in, col_cfg->cos_bit[2]);
|
||||
write_buffer_16x16(in, output, stride, 0, 0, -row_cfg->shift[1], bd);
|
||||
break;
|
||||
case DCT_ADST:
|
||||
cfg = &inv_txfm_2d_cfg_dct_adst_16;
|
||||
row_cfg = &inv_txfm_1d_row_cfg_adst_16;
|
||||
col_cfg = &inv_txfm_1d_col_cfg_dct_16;
|
||||
load_buffer_16x16(coeff, in);
|
||||
transpose_16x16(in, out);
|
||||
iadst16x16_sse4_1(out, in, cfg->cos_bit_row[2]);
|
||||
round_shift_16x16(in, -cfg->shift[0]);
|
||||
iadst16x16_sse4_1(out, in, row_cfg->cos_bit[2]);
|
||||
round_shift_16x16(in, -row_cfg->shift[0]);
|
||||
transpose_16x16(in, out);
|
||||
idct16x16_sse4_1(out, in, cfg->cos_bit_col[2]);
|
||||
write_buffer_16x16(in, output, stride, 0, 0, -cfg->shift[1], bd);
|
||||
idct16x16_sse4_1(out, in, col_cfg->cos_bit[2]);
|
||||
write_buffer_16x16(in, output, stride, 0, 0, -row_cfg->shift[1], bd);
|
||||
break;
|
||||
case ADST_DCT:
|
||||
cfg = &inv_txfm_2d_cfg_adst_dct_16;
|
||||
row_cfg = &inv_txfm_1d_row_cfg_dct_16;
|
||||
col_cfg = &inv_txfm_1d_col_cfg_adst_16;
|
||||
load_buffer_16x16(coeff, in);
|
||||
transpose_16x16(in, out);
|
||||
idct16x16_sse4_1(out, in, cfg->cos_bit_row[2]);
|
||||
round_shift_16x16(in, -cfg->shift[0]);
|
||||
idct16x16_sse4_1(out, in, row_cfg->cos_bit[2]);
|
||||
round_shift_16x16(in, -row_cfg->shift[0]);
|
||||
transpose_16x16(in, out);
|
||||
iadst16x16_sse4_1(out, in, cfg->cos_bit_col[2]);
|
||||
write_buffer_16x16(in, output, stride, 0, 0, -cfg->shift[1], bd);
|
||||
iadst16x16_sse4_1(out, in, col_cfg->cos_bit[2]);
|
||||
write_buffer_16x16(in, output, stride, 0, 0, -row_cfg->shift[1], bd);
|
||||
break;
|
||||
case ADST_ADST:
|
||||
cfg = &inv_txfm_2d_cfg_adst_adst_16;
|
||||
row_cfg = &inv_txfm_1d_row_cfg_adst_16;
|
||||
col_cfg = &inv_txfm_1d_col_cfg_adst_16;
|
||||
load_buffer_16x16(coeff, in);
|
||||
transpose_16x16(in, out);
|
||||
iadst16x16_sse4_1(out, in, cfg->cos_bit_row[2]);
|
||||
round_shift_16x16(in, -cfg->shift[0]);
|
||||
iadst16x16_sse4_1(out, in, row_cfg->cos_bit[2]);
|
||||
round_shift_16x16(in, -row_cfg->shift[0]);
|
||||
transpose_16x16(in, out);
|
||||
iadst16x16_sse4_1(out, in, cfg->cos_bit_col[2]);
|
||||
write_buffer_16x16(in, output, stride, 0, 0, -cfg->shift[1], bd);
|
||||
iadst16x16_sse4_1(out, in, col_cfg->cos_bit[2]);
|
||||
write_buffer_16x16(in, output, stride, 0, 0, -row_cfg->shift[1], bd);
|
||||
break;
|
||||
#if CONFIG_EXT_TX
|
||||
case FLIPADST_DCT:
|
||||
cfg = &inv_txfm_2d_cfg_adst_dct_16;
|
||||
row_cfg = &inv_txfm_1d_row_cfg_dct_16;
|
||||
col_cfg = &inv_txfm_1d_col_cfg_adst_16;
|
||||
load_buffer_16x16(coeff, in);
|
||||
transpose_16x16(in, out);
|
||||
idct16x16_sse4_1(out, in, cfg->cos_bit_row[2]);
|
||||
round_shift_16x16(in, -cfg->shift[0]);
|
||||
idct16x16_sse4_1(out, in, row_cfg->cos_bit[2]);
|
||||
round_shift_16x16(in, -row_cfg->shift[0]);
|
||||
transpose_16x16(in, out);
|
||||
iadst16x16_sse4_1(out, in, cfg->cos_bit_col[2]);
|
||||
write_buffer_16x16(in, output, stride, 0, 1, -cfg->shift[1], bd);
|
||||
iadst16x16_sse4_1(out, in, col_cfg->cos_bit[2]);
|
||||
write_buffer_16x16(in, output, stride, 0, 1, -row_cfg->shift[1], bd);
|
||||
break;
|
||||
case DCT_FLIPADST:
|
||||
cfg = &inv_txfm_2d_cfg_dct_adst_16;
|
||||
row_cfg = &inv_txfm_1d_row_cfg_adst_16;
|
||||
col_cfg = &inv_txfm_1d_col_cfg_dct_16;
|
||||
load_buffer_16x16(coeff, in);
|
||||
transpose_16x16(in, out);
|
||||
iadst16x16_sse4_1(out, in, cfg->cos_bit_row[2]);
|
||||
round_shift_16x16(in, -cfg->shift[0]);
|
||||
iadst16x16_sse4_1(out, in, row_cfg->cos_bit[2]);
|
||||
round_shift_16x16(in, -row_cfg->shift[0]);
|
||||
transpose_16x16(in, out);
|
||||
idct16x16_sse4_1(out, in, cfg->cos_bit_col[2]);
|
||||
write_buffer_16x16(in, output, stride, 1, 0, -cfg->shift[1], bd);
|
||||
idct16x16_sse4_1(out, in, col_cfg->cos_bit[2]);
|
||||
write_buffer_16x16(in, output, stride, 1, 0, -row_cfg->shift[1], bd);
|
||||
break;
|
||||
case ADST_FLIPADST:
|
||||
cfg = &inv_txfm_2d_cfg_adst_adst_16;
|
||||
row_cfg = &inv_txfm_1d_row_cfg_adst_16;
|
||||
col_cfg = &inv_txfm_1d_col_cfg_adst_16;
|
||||
load_buffer_16x16(coeff, in);
|
||||
transpose_16x16(in, out);
|
||||
iadst16x16_sse4_1(out, in, cfg->cos_bit_row[2]);
|
||||
round_shift_16x16(in, -cfg->shift[0]);
|
||||
iadst16x16_sse4_1(out, in, row_cfg->cos_bit[2]);
|
||||
round_shift_16x16(in, -row_cfg->shift[0]);
|
||||
transpose_16x16(in, out);
|
||||
iadst16x16_sse4_1(out, in, cfg->cos_bit_col[2]);
|
||||
write_buffer_16x16(in, output, stride, 1, 0, -cfg->shift[1], bd);
|
||||
iadst16x16_sse4_1(out, in, col_cfg->cos_bit[2]);
|
||||
write_buffer_16x16(in, output, stride, 1, 0, -row_cfg->shift[1], bd);
|
||||
break;
|
||||
case FLIPADST_FLIPADST:
|
||||
cfg = &inv_txfm_2d_cfg_adst_adst_16;
|
||||
row_cfg = &inv_txfm_1d_row_cfg_adst_16;
|
||||
col_cfg = &inv_txfm_1d_col_cfg_adst_16;
|
||||
load_buffer_16x16(coeff, in);
|
||||
transpose_16x16(in, out);
|
||||
iadst16x16_sse4_1(out, in, cfg->cos_bit_row[2]);
|
||||
round_shift_16x16(in, -cfg->shift[0]);
|
||||
iadst16x16_sse4_1(out, in, row_cfg->cos_bit[2]);
|
||||
round_shift_16x16(in, -row_cfg->shift[0]);
|
||||
transpose_16x16(in, out);
|
||||
iadst16x16_sse4_1(out, in, cfg->cos_bit_col[2]);
|
||||
write_buffer_16x16(in, output, stride, 1, 1, -cfg->shift[1], bd);
|
||||
iadst16x16_sse4_1(out, in, col_cfg->cos_bit[2]);
|
||||
write_buffer_16x16(in, output, stride, 1, 1, -row_cfg->shift[1], bd);
|
||||
break;
|
||||
case FLIPADST_ADST:
|
||||
cfg = &inv_txfm_2d_cfg_adst_adst_16;
|
||||
row_cfg = &inv_txfm_1d_row_cfg_adst_16;
|
||||
col_cfg = &inv_txfm_1d_col_cfg_adst_16;
|
||||
load_buffer_16x16(coeff, in);
|
||||
transpose_16x16(in, out);
|
||||
iadst16x16_sse4_1(out, in, cfg->cos_bit_row[2]);
|
||||
round_shift_16x16(in, -cfg->shift[0]);
|
||||
iadst16x16_sse4_1(out, in, row_cfg->cos_bit[2]);
|
||||
round_shift_16x16(in, -row_cfg->shift[0]);
|
||||
transpose_16x16(in, out);
|
||||
iadst16x16_sse4_1(out, in, cfg->cos_bit_col[2]);
|
||||
write_buffer_16x16(in, output, stride, 0, 1, -cfg->shift[1], bd);
|
||||
iadst16x16_sse4_1(out, in, col_cfg->cos_bit[2]);
|
||||
write_buffer_16x16(in, output, stride, 0, 1, -row_cfg->shift[1], bd);
|
||||
break;
|
||||
#endif
|
||||
default: assert(0);
|
||||
|
|
|
|||
|
|
@ -77,14 +77,15 @@ static INLINE void transpose_16x16(const __m128i *in, __m128i *out) {
|
|||
|
||||
// Note:
|
||||
// rounding = 1 << (bit - 1)
|
||||
static INLINE __m128i half_btf_sse4_1(__m128i w0, __m128i n0, __m128i w1,
|
||||
__m128i n1, __m128i rounding, int bit) {
|
||||
static INLINE __m128i half_btf_sse4_1(const __m128i *w0, const __m128i *n0,
|
||||
const __m128i *w1, const __m128i *n1,
|
||||
const __m128i *rounding, int bit) {
|
||||
__m128i x, y;
|
||||
|
||||
x = _mm_mullo_epi32(w0, n0);
|
||||
y = _mm_mullo_epi32(w1, n1);
|
||||
x = _mm_mullo_epi32(*w0, *n0);
|
||||
y = _mm_mullo_epi32(*w1, *n1);
|
||||
x = _mm_add_epi32(x, y);
|
||||
x = _mm_add_epi32(x, rounding);
|
||||
x = _mm_add_epi32(x, *rounding);
|
||||
x = _mm_srai_epi32(x, bit);
|
||||
return x;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,16 +14,13 @@
|
|||
#include "./av1_rtcd.h"
|
||||
#include "av1/common/warped_motion.h"
|
||||
|
||||
static const __m128i *const filter = (const __m128i *const)warped_filter;
|
||||
|
||||
/* SSE2 version of the rotzoom/affine warp filter */
|
||||
void av1_highbd_warp_affine_ssse3(int32_t *mat, 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, int ref_frm,
|
||||
int16_t alpha, int16_t beta, int16_t gamma,
|
||||
int16_t delta) {
|
||||
void av1_highbd_warp_affine_ssse3(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,
|
||||
int comp_avg, int16_t alpha, int16_t beta,
|
||||
int16_t gamma, int16_t delta) {
|
||||
#if HORSHEAR_REDUCE_PREC_BITS >= 5
|
||||
__m128i tmp[15];
|
||||
#else
|
||||
|
|
@ -47,23 +44,21 @@ void av1_highbd_warp_affine_ssse3(int32_t *mat, uint16_t *ref, int width,
|
|||
for (j = 0; j < p_width; j += 8) {
|
||||
// (x, y) coordinates of the center of this block in the destination
|
||||
// image
|
||||
int32_t dst_x = p_col + j + 4;
|
||||
int32_t dst_y = p_row + i + 4;
|
||||
const int32_t dst_x = p_col + j + 4;
|
||||
const int32_t dst_y = p_row + i + 4;
|
||||
|
||||
int32_t x4, y4, ix4, sx4, iy4, sy4;
|
||||
if (subsampling_x)
|
||||
x4 = ROUND_POWER_OF_TWO_SIGNED(
|
||||
mat[2] * 2 * dst_x + mat[3] * 2 * dst_y + mat[0] +
|
||||
(mat[2] + mat[3] - (1 << WARPEDMODEL_PREC_BITS)) / 2,
|
||||
1);
|
||||
x4 = (mat[2] * 4 * dst_x + mat[3] * 4 * dst_y + mat[0] * 2 +
|
||||
(mat[2] + mat[3] - (1 << WARPEDMODEL_PREC_BITS))) /
|
||||
4;
|
||||
else
|
||||
x4 = mat[2] * dst_x + mat[3] * dst_y + mat[0];
|
||||
|
||||
if (subsampling_y)
|
||||
y4 = ROUND_POWER_OF_TWO_SIGNED(
|
||||
mat[4] * 2 * dst_x + mat[5] * 2 * dst_y + mat[1] +
|
||||
(mat[4] + mat[5] - (1 << WARPEDMODEL_PREC_BITS)) / 2,
|
||||
1);
|
||||
y4 = (mat[4] * 4 * dst_x + mat[5] * 4 * dst_y + mat[1] * 2 +
|
||||
(mat[4] + mat[5] - (1 << WARPEDMODEL_PREC_BITS))) /
|
||||
4;
|
||||
else
|
||||
y4 = mat[4] * dst_x + mat[5] * dst_y + mat[1];
|
||||
|
||||
|
|
@ -72,71 +67,103 @@ void av1_highbd_warp_affine_ssse3(int32_t *mat, uint16_t *ref, int width,
|
|||
iy4 = y4 >> WARPEDMODEL_PREC_BITS;
|
||||
sy4 = y4 & ((1 << WARPEDMODEL_PREC_BITS) - 1);
|
||||
|
||||
// Horizontal filter
|
||||
for (k = -7; k < AOMMIN(8, p_height - i); ++k) {
|
||||
int iy = iy4 + k;
|
||||
if (iy < 0)
|
||||
iy = 0;
|
||||
else if (iy > height - 1)
|
||||
iy = height - 1;
|
||||
// Add in all the constant terms, including rounding and offset
|
||||
sx4 += alpha * (-4) + beta * (-4) + (1 << (WARPEDDIFF_PREC_BITS - 1)) +
|
||||
(WARPEDPIXEL_PREC_SHIFTS << WARPEDDIFF_PREC_BITS);
|
||||
sy4 += gamma * (-4) + delta * (-4) + (1 << (WARPEDDIFF_PREC_BITS - 1)) +
|
||||
(WARPEDPIXEL_PREC_SHIFTS << WARPEDDIFF_PREC_BITS);
|
||||
|
||||
// If the block is aligned such that, after clamping, every sample
|
||||
// would be taken from the leftmost/rightmost column, then we can
|
||||
// skip the expensive horizontal filter.
|
||||
if (ix4 <= -7) {
|
||||
sx4 &= ~((1 << WARP_PARAM_REDUCE_BITS) - 1);
|
||||
sy4 &= ~((1 << WARP_PARAM_REDUCE_BITS) - 1);
|
||||
|
||||
// Horizontal filter
|
||||
// If the block is aligned such that, after clamping, every sample
|
||||
// would be taken from the leftmost/rightmost column, then we can
|
||||
// skip the expensive horizontal filter.
|
||||
if (ix4 <= -7) {
|
||||
for (k = -7; k < AOMMIN(8, p_height - i); ++k) {
|
||||
int iy = iy4 + k;
|
||||
if (iy < 0)
|
||||
iy = 0;
|
||||
else if (iy > height - 1)
|
||||
iy = height - 1;
|
||||
tmp[k + 7] = _mm_set1_epi16(
|
||||
(1 << (bd + WARPEDPIXEL_FILTER_BITS - HORSHEAR_REDUCE_PREC_BITS -
|
||||
1)) +
|
||||
ref[iy * stride] *
|
||||
(1 << (WARPEDPIXEL_FILTER_BITS - HORSHEAR_REDUCE_PREC_BITS)));
|
||||
} else if (ix4 >= width + 6) {
|
||||
(1 << (WARPEDPIXEL_FILTER_BITS - HORSHEAR_REDUCE_PREC_BITS)));
|
||||
}
|
||||
} else if (ix4 >= width + 6) {
|
||||
for (k = -7; k < AOMMIN(8, p_height - i); ++k) {
|
||||
int iy = iy4 + k;
|
||||
if (iy < 0)
|
||||
iy = 0;
|
||||
else if (iy > height - 1)
|
||||
iy = height - 1;
|
||||
tmp[k + 7] = _mm_set1_epi16(
|
||||
(1 << (bd + WARPEDPIXEL_FILTER_BITS - HORSHEAR_REDUCE_PREC_BITS -
|
||||
1)) +
|
||||
ref[iy * stride + (width - 1)] *
|
||||
(1 << (WARPEDPIXEL_FILTER_BITS - HORSHEAR_REDUCE_PREC_BITS)));
|
||||
} else {
|
||||
int sx = sx4 + alpha * (-4) + beta * k +
|
||||
// Include rounding and offset here
|
||||
(1 << (WARPEDDIFF_PREC_BITS - 1)) +
|
||||
(WARPEDPIXEL_PREC_SHIFTS << WARPEDDIFF_PREC_BITS);
|
||||
(1 << (WARPEDPIXEL_FILTER_BITS - HORSHEAR_REDUCE_PREC_BITS)));
|
||||
}
|
||||
} else {
|
||||
for (k = -7; k < AOMMIN(8, p_height - i); ++k) {
|
||||
int iy = iy4 + k;
|
||||
if (iy < 0)
|
||||
iy = 0;
|
||||
else if (iy > height - 1)
|
||||
iy = height - 1;
|
||||
int sx = sx4 + beta * (k + 4);
|
||||
|
||||
// Load source pixels
|
||||
__m128i src =
|
||||
const __m128i src =
|
||||
_mm_loadu_si128((__m128i *)(ref + iy * stride + ix4 - 7));
|
||||
__m128i src2 =
|
||||
const __m128i src2 =
|
||||
_mm_loadu_si128((__m128i *)(ref + iy * stride + ix4 + 1));
|
||||
|
||||
// Filter even-index pixels
|
||||
__m128i tmp_0 = filter[(sx + 0 * alpha) >> WARPEDDIFF_PREC_BITS];
|
||||
__m128i tmp_2 = filter[(sx + 2 * alpha) >> WARPEDDIFF_PREC_BITS];
|
||||
__m128i tmp_4 = filter[(sx + 4 * alpha) >> WARPEDDIFF_PREC_BITS];
|
||||
__m128i tmp_6 = filter[(sx + 6 * alpha) >> WARPEDDIFF_PREC_BITS];
|
||||
const __m128i tmp_0 = _mm_loadu_si128(
|
||||
(__m128i *)(warped_filter +
|
||||
((sx + 0 * alpha) >> WARPEDDIFF_PREC_BITS)));
|
||||
const __m128i tmp_2 = _mm_loadu_si128(
|
||||
(__m128i *)(warped_filter +
|
||||
((sx + 2 * alpha) >> WARPEDDIFF_PREC_BITS)));
|
||||
const __m128i tmp_4 = _mm_loadu_si128(
|
||||
(__m128i *)(warped_filter +
|
||||
((sx + 4 * alpha) >> WARPEDDIFF_PREC_BITS)));
|
||||
const __m128i tmp_6 = _mm_loadu_si128(
|
||||
(__m128i *)(warped_filter +
|
||||
((sx + 6 * alpha) >> WARPEDDIFF_PREC_BITS)));
|
||||
|
||||
// coeffs 0 1 0 1 2 3 2 3 for pixels 0, 2
|
||||
__m128i tmp_8 = _mm_unpacklo_epi32(tmp_0, tmp_2);
|
||||
const __m128i tmp_8 = _mm_unpacklo_epi32(tmp_0, tmp_2);
|
||||
// coeffs 0 1 0 1 2 3 2 3 for pixels 4, 6
|
||||
__m128i tmp_10 = _mm_unpacklo_epi32(tmp_4, tmp_6);
|
||||
const __m128i tmp_10 = _mm_unpacklo_epi32(tmp_4, tmp_6);
|
||||
// coeffs 4 5 4 5 6 7 6 7 for pixels 0, 2
|
||||
__m128i tmp_12 = _mm_unpackhi_epi32(tmp_0, tmp_2);
|
||||
const __m128i tmp_12 = _mm_unpackhi_epi32(tmp_0, tmp_2);
|
||||
// coeffs 4 5 4 5 6 7 6 7 for pixels 4, 6
|
||||
__m128i tmp_14 = _mm_unpackhi_epi32(tmp_4, tmp_6);
|
||||
const __m128i tmp_14 = _mm_unpackhi_epi32(tmp_4, tmp_6);
|
||||
|
||||
// coeffs 0 1 0 1 0 1 0 1 for pixels 0, 2, 4, 6
|
||||
__m128i coeff_0 = _mm_unpacklo_epi64(tmp_8, tmp_10);
|
||||
const __m128i coeff_0 = _mm_unpacklo_epi64(tmp_8, tmp_10);
|
||||
// coeffs 2 3 2 3 2 3 2 3 for pixels 0, 2, 4, 6
|
||||
__m128i coeff_2 = _mm_unpackhi_epi64(tmp_8, tmp_10);
|
||||
const __m128i coeff_2 = _mm_unpackhi_epi64(tmp_8, tmp_10);
|
||||
// coeffs 4 5 4 5 4 5 4 5 for pixels 0, 2, 4, 6
|
||||
__m128i coeff_4 = _mm_unpacklo_epi64(tmp_12, tmp_14);
|
||||
const __m128i coeff_4 = _mm_unpacklo_epi64(tmp_12, tmp_14);
|
||||
// coeffs 6 7 6 7 6 7 6 7 for pixels 0, 2, 4, 6
|
||||
__m128i coeff_6 = _mm_unpackhi_epi64(tmp_12, tmp_14);
|
||||
const __m128i coeff_6 = _mm_unpackhi_epi64(tmp_12, tmp_14);
|
||||
|
||||
__m128i round_const =
|
||||
_mm_set1_epi32((1 << HORSHEAR_REDUCE_PREC_BITS) >> 1);
|
||||
const __m128i round_const =
|
||||
_mm_set1_epi32((1 << (bd + WARPEDPIXEL_FILTER_BITS - 1)) +
|
||||
((1 << HORSHEAR_REDUCE_PREC_BITS) >> 1));
|
||||
|
||||
// Calculate filtered results
|
||||
__m128i res_0 = _mm_madd_epi16(src, coeff_0);
|
||||
__m128i res_2 =
|
||||
const __m128i res_0 = _mm_madd_epi16(src, coeff_0);
|
||||
const __m128i res_2 =
|
||||
_mm_madd_epi16(_mm_alignr_epi8(src2, src, 4), coeff_2);
|
||||
__m128i res_4 =
|
||||
const __m128i res_4 =
|
||||
_mm_madd_epi16(_mm_alignr_epi8(src2, src, 8), coeff_4);
|
||||
__m128i res_6 =
|
||||
const __m128i res_6 =
|
||||
_mm_madd_epi16(_mm_alignr_epi8(src2, src, 12), coeff_6);
|
||||
|
||||
__m128i res_even = _mm_add_epi32(_mm_add_epi32(res_0, res_4),
|
||||
|
|
@ -145,28 +172,36 @@ void av1_highbd_warp_affine_ssse3(int32_t *mat, uint16_t *ref, int width,
|
|||
HORSHEAR_REDUCE_PREC_BITS);
|
||||
|
||||
// Filter odd-index pixels
|
||||
__m128i tmp_1 = filter[(sx + 1 * alpha) >> WARPEDDIFF_PREC_BITS];
|
||||
__m128i tmp_3 = filter[(sx + 3 * alpha) >> WARPEDDIFF_PREC_BITS];
|
||||
__m128i tmp_5 = filter[(sx + 5 * alpha) >> WARPEDDIFF_PREC_BITS];
|
||||
__m128i tmp_7 = filter[(sx + 7 * alpha) >> WARPEDDIFF_PREC_BITS];
|
||||
const __m128i tmp_1 = _mm_loadu_si128(
|
||||
(__m128i *)(warped_filter +
|
||||
((sx + 1 * alpha) >> WARPEDDIFF_PREC_BITS)));
|
||||
const __m128i tmp_3 = _mm_loadu_si128(
|
||||
(__m128i *)(warped_filter +
|
||||
((sx + 3 * alpha) >> WARPEDDIFF_PREC_BITS)));
|
||||
const __m128i tmp_5 = _mm_loadu_si128(
|
||||
(__m128i *)(warped_filter +
|
||||
((sx + 5 * alpha) >> WARPEDDIFF_PREC_BITS)));
|
||||
const __m128i tmp_7 = _mm_loadu_si128(
|
||||
(__m128i *)(warped_filter +
|
||||
((sx + 7 * alpha) >> WARPEDDIFF_PREC_BITS)));
|
||||
|
||||
__m128i tmp_9 = _mm_unpacklo_epi32(tmp_1, tmp_3);
|
||||
__m128i tmp_11 = _mm_unpacklo_epi32(tmp_5, tmp_7);
|
||||
__m128i tmp_13 = _mm_unpackhi_epi32(tmp_1, tmp_3);
|
||||
__m128i tmp_15 = _mm_unpackhi_epi32(tmp_5, tmp_7);
|
||||
const __m128i tmp_9 = _mm_unpacklo_epi32(tmp_1, tmp_3);
|
||||
const __m128i tmp_11 = _mm_unpacklo_epi32(tmp_5, tmp_7);
|
||||
const __m128i tmp_13 = _mm_unpackhi_epi32(tmp_1, tmp_3);
|
||||
const __m128i tmp_15 = _mm_unpackhi_epi32(tmp_5, tmp_7);
|
||||
|
||||
__m128i coeff_1 = _mm_unpacklo_epi64(tmp_9, tmp_11);
|
||||
__m128i coeff_3 = _mm_unpackhi_epi64(tmp_9, tmp_11);
|
||||
__m128i coeff_5 = _mm_unpacklo_epi64(tmp_13, tmp_15);
|
||||
__m128i coeff_7 = _mm_unpackhi_epi64(tmp_13, tmp_15);
|
||||
const __m128i coeff_1 = _mm_unpacklo_epi64(tmp_9, tmp_11);
|
||||
const __m128i coeff_3 = _mm_unpackhi_epi64(tmp_9, tmp_11);
|
||||
const __m128i coeff_5 = _mm_unpacklo_epi64(tmp_13, tmp_15);
|
||||
const __m128i coeff_7 = _mm_unpackhi_epi64(tmp_13, tmp_15);
|
||||
|
||||
__m128i res_1 =
|
||||
const __m128i res_1 =
|
||||
_mm_madd_epi16(_mm_alignr_epi8(src2, src, 2), coeff_1);
|
||||
__m128i res_3 =
|
||||
const __m128i res_3 =
|
||||
_mm_madd_epi16(_mm_alignr_epi8(src2, src, 6), coeff_3);
|
||||
__m128i res_5 =
|
||||
const __m128i res_5 =
|
||||
_mm_madd_epi16(_mm_alignr_epi8(src2, src, 10), coeff_5);
|
||||
__m128i res_7 =
|
||||
const __m128i res_7 =
|
||||
_mm_madd_epi16(_mm_alignr_epi8(src2, src, 14), coeff_7);
|
||||
|
||||
__m128i res_odd = _mm_add_epi32(_mm_add_epi32(res_1, res_5),
|
||||
|
|
@ -183,101 +218,118 @@ void av1_highbd_warp_affine_ssse3(int32_t *mat, uint16_t *ref, int width,
|
|||
|
||||
// Vertical filter
|
||||
for (k = -4; k < AOMMIN(4, p_height - i - 4); ++k) {
|
||||
int sy = sy4 + gamma * (-4) + delta * k +
|
||||
(1 << (WARPEDDIFF_PREC_BITS - 1)) +
|
||||
(WARPEDPIXEL_PREC_SHIFTS << WARPEDDIFF_PREC_BITS);
|
||||
int sy = sy4 + delta * (k + 4);
|
||||
|
||||
// Load from tmp and rearrange pairs of consecutive rows into the
|
||||
// column order 0 0 2 2 4 4 6 6; 1 1 3 3 5 5 7 7
|
||||
__m128i *src = tmp + (k + 4);
|
||||
__m128i src_0 = _mm_unpacklo_epi16(src[0], src[1]);
|
||||
__m128i src_2 = _mm_unpacklo_epi16(src[2], src[3]);
|
||||
__m128i src_4 = _mm_unpacklo_epi16(src[4], src[5]);
|
||||
__m128i src_6 = _mm_unpacklo_epi16(src[6], src[7]);
|
||||
const __m128i *src = tmp + (k + 4);
|
||||
const __m128i src_0 = _mm_unpacklo_epi16(src[0], src[1]);
|
||||
const __m128i src_2 = _mm_unpacklo_epi16(src[2], src[3]);
|
||||
const __m128i src_4 = _mm_unpacklo_epi16(src[4], src[5]);
|
||||
const __m128i src_6 = _mm_unpacklo_epi16(src[6], src[7]);
|
||||
|
||||
// Filter even-index pixels
|
||||
__m128i tmp_0 = filter[(sy + 0 * gamma) >> WARPEDDIFF_PREC_BITS];
|
||||
__m128i tmp_2 = filter[(sy + 2 * gamma) >> WARPEDDIFF_PREC_BITS];
|
||||
__m128i tmp_4 = filter[(sy + 4 * gamma) >> WARPEDDIFF_PREC_BITS];
|
||||
__m128i tmp_6 = filter[(sy + 6 * gamma) >> WARPEDDIFF_PREC_BITS];
|
||||
const __m128i tmp_0 = _mm_loadu_si128(
|
||||
(__m128i *)(warped_filter +
|
||||
((sy + 0 * gamma) >> WARPEDDIFF_PREC_BITS)));
|
||||
const __m128i tmp_2 = _mm_loadu_si128(
|
||||
(__m128i *)(warped_filter +
|
||||
((sy + 2 * gamma) >> WARPEDDIFF_PREC_BITS)));
|
||||
const __m128i tmp_4 = _mm_loadu_si128(
|
||||
(__m128i *)(warped_filter +
|
||||
((sy + 4 * gamma) >> WARPEDDIFF_PREC_BITS)));
|
||||
const __m128i tmp_6 = _mm_loadu_si128(
|
||||
(__m128i *)(warped_filter +
|
||||
((sy + 6 * gamma) >> WARPEDDIFF_PREC_BITS)));
|
||||
|
||||
__m128i tmp_8 = _mm_unpacklo_epi32(tmp_0, tmp_2);
|
||||
__m128i tmp_10 = _mm_unpacklo_epi32(tmp_4, tmp_6);
|
||||
__m128i tmp_12 = _mm_unpackhi_epi32(tmp_0, tmp_2);
|
||||
__m128i tmp_14 = _mm_unpackhi_epi32(tmp_4, tmp_6);
|
||||
const __m128i tmp_8 = _mm_unpacklo_epi32(tmp_0, tmp_2);
|
||||
const __m128i tmp_10 = _mm_unpacklo_epi32(tmp_4, tmp_6);
|
||||
const __m128i tmp_12 = _mm_unpackhi_epi32(tmp_0, tmp_2);
|
||||
const __m128i tmp_14 = _mm_unpackhi_epi32(tmp_4, tmp_6);
|
||||
|
||||
__m128i coeff_0 = _mm_unpacklo_epi64(tmp_8, tmp_10);
|
||||
__m128i coeff_2 = _mm_unpackhi_epi64(tmp_8, tmp_10);
|
||||
__m128i coeff_4 = _mm_unpacklo_epi64(tmp_12, tmp_14);
|
||||
__m128i coeff_6 = _mm_unpackhi_epi64(tmp_12, tmp_14);
|
||||
const __m128i coeff_0 = _mm_unpacklo_epi64(tmp_8, tmp_10);
|
||||
const __m128i coeff_2 = _mm_unpackhi_epi64(tmp_8, tmp_10);
|
||||
const __m128i coeff_4 = _mm_unpacklo_epi64(tmp_12, tmp_14);
|
||||
const __m128i coeff_6 = _mm_unpackhi_epi64(tmp_12, tmp_14);
|
||||
|
||||
__m128i res_0 = _mm_madd_epi16(src_0, coeff_0);
|
||||
__m128i res_2 = _mm_madd_epi16(src_2, coeff_2);
|
||||
__m128i res_4 = _mm_madd_epi16(src_4, coeff_4);
|
||||
__m128i res_6 = _mm_madd_epi16(src_6, coeff_6);
|
||||
const __m128i res_0 = _mm_madd_epi16(src_0, coeff_0);
|
||||
const __m128i res_2 = _mm_madd_epi16(src_2, coeff_2);
|
||||
const __m128i res_4 = _mm_madd_epi16(src_4, coeff_4);
|
||||
const __m128i res_6 = _mm_madd_epi16(src_6, coeff_6);
|
||||
|
||||
__m128i res_even = _mm_add_epi32(_mm_add_epi32(res_0, res_2),
|
||||
_mm_add_epi32(res_4, res_6));
|
||||
const __m128i res_even = _mm_add_epi32(_mm_add_epi32(res_0, res_2),
|
||||
_mm_add_epi32(res_4, res_6));
|
||||
|
||||
// Filter odd-index pixels
|
||||
__m128i src_1 = _mm_unpackhi_epi16(src[0], src[1]);
|
||||
__m128i src_3 = _mm_unpackhi_epi16(src[2], src[3]);
|
||||
__m128i src_5 = _mm_unpackhi_epi16(src[4], src[5]);
|
||||
__m128i src_7 = _mm_unpackhi_epi16(src[6], src[7]);
|
||||
const __m128i src_1 = _mm_unpackhi_epi16(src[0], src[1]);
|
||||
const __m128i src_3 = _mm_unpackhi_epi16(src[2], src[3]);
|
||||
const __m128i src_5 = _mm_unpackhi_epi16(src[4], src[5]);
|
||||
const __m128i src_7 = _mm_unpackhi_epi16(src[6], src[7]);
|
||||
|
||||
__m128i tmp_1 = filter[(sy + 1 * gamma) >> WARPEDDIFF_PREC_BITS];
|
||||
__m128i tmp_3 = filter[(sy + 3 * gamma) >> WARPEDDIFF_PREC_BITS];
|
||||
__m128i tmp_5 = filter[(sy + 5 * gamma) >> WARPEDDIFF_PREC_BITS];
|
||||
__m128i tmp_7 = filter[(sy + 7 * gamma) >> WARPEDDIFF_PREC_BITS];
|
||||
const __m128i tmp_1 = _mm_loadu_si128(
|
||||
(__m128i *)(warped_filter +
|
||||
((sy + 1 * gamma) >> WARPEDDIFF_PREC_BITS)));
|
||||
const __m128i tmp_3 = _mm_loadu_si128(
|
||||
(__m128i *)(warped_filter +
|
||||
((sy + 3 * gamma) >> WARPEDDIFF_PREC_BITS)));
|
||||
const __m128i tmp_5 = _mm_loadu_si128(
|
||||
(__m128i *)(warped_filter +
|
||||
((sy + 5 * gamma) >> WARPEDDIFF_PREC_BITS)));
|
||||
const __m128i tmp_7 = _mm_loadu_si128(
|
||||
(__m128i *)(warped_filter +
|
||||
((sy + 7 * gamma) >> WARPEDDIFF_PREC_BITS)));
|
||||
|
||||
__m128i tmp_9 = _mm_unpacklo_epi32(tmp_1, tmp_3);
|
||||
__m128i tmp_11 = _mm_unpacklo_epi32(tmp_5, tmp_7);
|
||||
__m128i tmp_13 = _mm_unpackhi_epi32(tmp_1, tmp_3);
|
||||
__m128i tmp_15 = _mm_unpackhi_epi32(tmp_5, tmp_7);
|
||||
const __m128i tmp_9 = _mm_unpacklo_epi32(tmp_1, tmp_3);
|
||||
const __m128i tmp_11 = _mm_unpacklo_epi32(tmp_5, tmp_7);
|
||||
const __m128i tmp_13 = _mm_unpackhi_epi32(tmp_1, tmp_3);
|
||||
const __m128i tmp_15 = _mm_unpackhi_epi32(tmp_5, tmp_7);
|
||||
|
||||
__m128i coeff_1 = _mm_unpacklo_epi64(tmp_9, tmp_11);
|
||||
__m128i coeff_3 = _mm_unpackhi_epi64(tmp_9, tmp_11);
|
||||
__m128i coeff_5 = _mm_unpacklo_epi64(tmp_13, tmp_15);
|
||||
__m128i coeff_7 = _mm_unpackhi_epi64(tmp_13, tmp_15);
|
||||
const __m128i coeff_1 = _mm_unpacklo_epi64(tmp_9, tmp_11);
|
||||
const __m128i coeff_3 = _mm_unpackhi_epi64(tmp_9, tmp_11);
|
||||
const __m128i coeff_5 = _mm_unpacklo_epi64(tmp_13, tmp_15);
|
||||
const __m128i coeff_7 = _mm_unpackhi_epi64(tmp_13, tmp_15);
|
||||
|
||||
__m128i res_1 = _mm_madd_epi16(src_1, coeff_1);
|
||||
__m128i res_3 = _mm_madd_epi16(src_3, coeff_3);
|
||||
__m128i res_5 = _mm_madd_epi16(src_5, coeff_5);
|
||||
__m128i res_7 = _mm_madd_epi16(src_7, coeff_7);
|
||||
const __m128i res_1 = _mm_madd_epi16(src_1, coeff_1);
|
||||
const __m128i res_3 = _mm_madd_epi16(src_3, coeff_3);
|
||||
const __m128i res_5 = _mm_madd_epi16(src_5, coeff_5);
|
||||
const __m128i res_7 = _mm_madd_epi16(src_7, coeff_7);
|
||||
|
||||
__m128i res_odd = _mm_add_epi32(_mm_add_epi32(res_1, res_3),
|
||||
_mm_add_epi32(res_5, res_7));
|
||||
const __m128i res_odd = _mm_add_epi32(_mm_add_epi32(res_1, res_3),
|
||||
_mm_add_epi32(res_5, res_7));
|
||||
|
||||
// Rearrange pixels back into the order 0 ... 7
|
||||
__m128i res_lo = _mm_unpacklo_epi32(res_even, res_odd);
|
||||
__m128i res_hi = _mm_unpackhi_epi32(res_even, res_odd);
|
||||
const __m128i res_lo = _mm_unpacklo_epi32(res_even, res_odd);
|
||||
const __m128i res_hi = _mm_unpackhi_epi32(res_even, res_odd);
|
||||
|
||||
// Round and pack into 8 bits
|
||||
__m128i round_const =
|
||||
_mm_set1_epi32((1 << VERSHEAR_REDUCE_PREC_BITS) >> 1);
|
||||
const __m128i round_const =
|
||||
_mm_set1_epi32(-(1 << (bd + VERSHEAR_REDUCE_PREC_BITS - 1)) +
|
||||
((1 << VERSHEAR_REDUCE_PREC_BITS) >> 1));
|
||||
|
||||
__m128i res_lo_round = _mm_srai_epi32(
|
||||
const __m128i res_lo_round = _mm_srai_epi32(
|
||||
_mm_add_epi32(res_lo, round_const), VERSHEAR_REDUCE_PREC_BITS);
|
||||
__m128i res_hi_round = _mm_srai_epi32(
|
||||
const __m128i res_hi_round = _mm_srai_epi32(
|
||||
_mm_add_epi32(res_hi, round_const), VERSHEAR_REDUCE_PREC_BITS);
|
||||
|
||||
__m128i res_16bit = _mm_packs_epi32(res_lo_round, res_hi_round);
|
||||
// Clamp res_16bit to the range [0, 2^bd - 1]
|
||||
__m128i max_val = _mm_set1_epi16((1 << bd) - 1);
|
||||
__m128i zero = _mm_setzero_si128();
|
||||
const __m128i max_val = _mm_set1_epi16((1 << bd) - 1);
|
||||
const __m128i zero = _mm_setzero_si128();
|
||||
res_16bit = _mm_max_epi16(_mm_min_epi16(res_16bit, max_val), zero);
|
||||
|
||||
// Store, blending with 'pred' if needed
|
||||
__m128i *p = (__m128i *)&pred[(i + k + 4) * p_stride + j];
|
||||
__m128i *const p = (__m128i *)&pred[(i + k + 4) * p_stride + j];
|
||||
|
||||
// Note: If we're outputting a 4x4 block, we need to be very careful
|
||||
// to only output 4 pixels at this point, to avoid encode/decode
|
||||
// mismatches when encoding with multiple threads.
|
||||
if (p_width == 4) {
|
||||
if (ref_frm) res_16bit = _mm_avg_epu16(res_16bit, _mm_loadl_epi64(p));
|
||||
if (comp_avg)
|
||||
res_16bit = _mm_avg_epu16(res_16bit, _mm_loadl_epi64(p));
|
||||
_mm_storel_epi64(p, res_16bit);
|
||||
} else {
|
||||
if (ref_frm) res_16bit = _mm_avg_epu16(res_16bit, _mm_loadu_si128(p));
|
||||
if (comp_avg)
|
||||
res_16bit = _mm_avg_epu16(res_16bit, _mm_loadu_si128(p));
|
||||
_mm_storeu_si128(p, res_16bit);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,67 +14,9 @@
|
|||
#include "./aom_config.h"
|
||||
#include "./av1_rtcd.h"
|
||||
|
||||
#include "aom_dsp/x86/txfm_common_avx2.h"
|
||||
#include "aom_dsp/x86/inv_txfm_common_avx2.h"
|
||||
|
||||
static INLINE void load_coeff(const tran_low_t *coeff, __m256i *in) {
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
*in = _mm256_setr_epi16(
|
||||
(int16_t)coeff[0], (int16_t)coeff[1], (int16_t)coeff[2],
|
||||
(int16_t)coeff[3], (int16_t)coeff[4], (int16_t)coeff[5],
|
||||
(int16_t)coeff[6], (int16_t)coeff[7], (int16_t)coeff[8],
|
||||
(int16_t)coeff[9], (int16_t)coeff[10], (int16_t)coeff[11],
|
||||
(int16_t)coeff[12], (int16_t)coeff[13], (int16_t)coeff[14],
|
||||
(int16_t)coeff[15]);
|
||||
#else
|
||||
*in = _mm256_loadu_si256((const __m256i *)coeff);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void load_buffer_16x16(const tran_low_t *coeff, __m256i *in) {
|
||||
int i = 0;
|
||||
while (i < 16) {
|
||||
load_coeff(coeff + (i << 4), &in[i]);
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
|
||||
static void recon_and_store(const __m256i *res, uint8_t *output) {
|
||||
const __m128i zero = _mm_setzero_si128();
|
||||
__m128i x = _mm_loadu_si128((__m128i const *)output);
|
||||
__m128i p0 = _mm_unpacklo_epi8(x, zero);
|
||||
__m128i p1 = _mm_unpackhi_epi8(x, zero);
|
||||
|
||||
p0 = _mm_add_epi16(p0, _mm256_castsi256_si128(*res));
|
||||
p1 = _mm_add_epi16(p1, _mm256_extractf128_si256(*res, 1));
|
||||
x = _mm_packus_epi16(p0, p1);
|
||||
_mm_storeu_si128((__m128i *)output, x);
|
||||
}
|
||||
|
||||
#define IDCT_ROUNDING_POS (6)
|
||||
|
||||
static void write_buffer_16x16(__m256i *in, const int stride, uint8_t *output) {
|
||||
const __m256i rounding = _mm256_set1_epi16(1 << (IDCT_ROUNDING_POS - 1));
|
||||
int i = 0;
|
||||
|
||||
while (i < 16) {
|
||||
in[i] = _mm256_add_epi16(in[i], rounding);
|
||||
in[i] = _mm256_srai_epi16(in[i], IDCT_ROUNDING_POS);
|
||||
recon_and_store(&in[i], output + i * stride);
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
|
||||
static INLINE void unpack_butter_fly(const __m256i *a0, const __m256i *a1,
|
||||
const __m256i *c0, const __m256i *c1,
|
||||
__m256i *b0, __m256i *b1) {
|
||||
__m256i x0, x1;
|
||||
x0 = _mm256_unpacklo_epi16(*a0, *a1);
|
||||
x1 = _mm256_unpackhi_epi16(*a0, *a1);
|
||||
*b0 = butter_fly(x0, x1, *c0);
|
||||
*b1 = butter_fly(x0, x1, *c1);
|
||||
}
|
||||
|
||||
static void idct16_avx2(__m256i *in) {
|
||||
void av1_idct16_avx2(__m256i *in) {
|
||||
const __m256i cospi_p30_m02 = pair256_set_epi16(cospi_30_64, -cospi_2_64);
|
||||
const __m256i cospi_p02_p30 = pair256_set_epi16(cospi_2_64, cospi_30_64);
|
||||
const __m256i cospi_p14_m18 = pair256_set_epi16(cospi_14_64, -cospi_18_64);
|
||||
|
|
@ -216,8 +158,8 @@ static void idct16_avx2(__m256i *in) {
|
|||
}
|
||||
|
||||
static void idct16(__m256i *in) {
|
||||
mm256_transpose_16x16(in);
|
||||
idct16_avx2(in);
|
||||
mm256_transpose_16x16(in, in);
|
||||
av1_idct16_avx2(in);
|
||||
}
|
||||
|
||||
static INLINE void butterfly_32b(const __m256i *a0, const __m256i *a1,
|
||||
|
|
@ -398,7 +340,7 @@ static void iadst16_avx2(__m256i *in) {
|
|||
}
|
||||
|
||||
static void iadst16(__m256i *in) {
|
||||
mm256_transpose_16x16(in);
|
||||
mm256_transpose_16x16(in, in);
|
||||
iadst16_avx2(in);
|
||||
}
|
||||
|
||||
|
|
@ -416,8 +358,8 @@ static void flip_col(uint8_t **dest, int *stride, int rows) {
|
|||
}
|
||||
|
||||
static void iidtx16(__m256i *in) {
|
||||
mm256_transpose_16x16(in);
|
||||
txfm_scaling16_avx2(Sqrt2, in);
|
||||
mm256_transpose_16x16(in, in);
|
||||
txfm_scaling16_avx2((int16_t)Sqrt2, in);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -503,5 +445,5 @@ void av1_iht16x16_256_add_avx2(const tran_low_t *input, uint8_t *dest,
|
|||
#endif // CONFIG_EXT_TX
|
||||
default: assert(0); break;
|
||||
}
|
||||
write_buffer_16x16(in, stride, dest);
|
||||
store_buffer_16xN(in, stride, dest, 16);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,14 +17,14 @@
|
|||
#include "av1/common/enums.h"
|
||||
|
||||
#if CONFIG_EXT_TX
|
||||
static INLINE void fliplr_4x4(__m128i in[2]) {
|
||||
static INLINE void fliplr_4x4(__m128i *in /*in[2]*/) {
|
||||
in[0] = _mm_shufflelo_epi16(in[0], 0x1b);
|
||||
in[0] = _mm_shufflehi_epi16(in[0], 0x1b);
|
||||
in[1] = _mm_shufflelo_epi16(in[1], 0x1b);
|
||||
in[1] = _mm_shufflehi_epi16(in[1], 0x1b);
|
||||
}
|
||||
|
||||
static INLINE void fliplr_8x8(__m128i in[8]) {
|
||||
static INLINE void fliplr_8x8(__m128i *in /*in[8]*/) {
|
||||
in[0] = mm_reverse_epi16(in[0]);
|
||||
in[1] = mm_reverse_epi16(in[1]);
|
||||
in[2] = mm_reverse_epi16(in[2]);
|
||||
|
|
@ -36,7 +36,7 @@ static INLINE void fliplr_8x8(__m128i in[8]) {
|
|||
in[7] = mm_reverse_epi16(in[7]);
|
||||
}
|
||||
|
||||
static INLINE void fliplr_16x8(__m128i in[16]) {
|
||||
static INLINE void fliplr_16x8(__m128i *in /*in[16]*/) {
|
||||
fliplr_8x8(&in[0]);
|
||||
fliplr_8x8(&in[8]);
|
||||
}
|
||||
|
|
@ -356,7 +356,7 @@ static void iidtx8_sse2(__m128i *in) {
|
|||
}
|
||||
|
||||
static INLINE void iidtx4_sse2(__m128i *in) {
|
||||
const __m128i v_scale_w = _mm_set1_epi16(Sqrt2);
|
||||
const __m128i v_scale_w = _mm_set1_epi16((int16_t)Sqrt2);
|
||||
|
||||
const __m128i v_p0l_w = _mm_mullo_epi16(in[0], v_scale_w);
|
||||
const __m128i v_p0h_w = _mm_mulhi_epi16(in[0], v_scale_w);
|
||||
|
|
|
|||
345
third_party/aom/av1/common/x86/warp_plane_sse2.c
vendored
345
third_party/aom/av1/common/x86/warp_plane_sse2.c
vendored
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016, Alliance for Open Media. All rights reserved
|
||||
* 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
|
||||
|
|
@ -14,17 +14,15 @@
|
|||
#include "./av1_rtcd.h"
|
||||
#include "av1/common/warped_motion.h"
|
||||
|
||||
static const __m128i *const filter = (const __m128i *const)warped_filter;
|
||||
|
||||
/* SSE2 version of the rotzoom/affine warp filter */
|
||||
void av1_warp_affine_sse2(int32_t *mat, 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, int ref_frm,
|
||||
void av1_warp_affine_sse2(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, int comp_avg,
|
||||
int16_t alpha, int16_t beta, int16_t gamma,
|
||||
int16_t delta) {
|
||||
__m128i tmp[15];
|
||||
int i, j, k;
|
||||
const int bd = 8;
|
||||
|
||||
/* Note: For this code to work, the left/right frame borders need to be
|
||||
extended by at least 13 pixels each. By the time we get here, other
|
||||
|
|
@ -42,23 +40,21 @@ void av1_warp_affine_sse2(int32_t *mat, uint8_t *ref, int width, int height,
|
|||
for (j = 0; j < p_width; j += 8) {
|
||||
// (x, y) coordinates of the center of this block in the destination
|
||||
// image
|
||||
int32_t dst_x = p_col + j + 4;
|
||||
int32_t dst_y = p_row + i + 4;
|
||||
const int32_t dst_x = p_col + j + 4;
|
||||
const int32_t dst_y = p_row + i + 4;
|
||||
|
||||
int32_t x4, y4, ix4, sx4, iy4, sy4;
|
||||
if (subsampling_x)
|
||||
x4 = ROUND_POWER_OF_TWO_SIGNED(
|
||||
mat[2] * 2 * dst_x + mat[3] * 2 * dst_y + mat[0] +
|
||||
(mat[2] + mat[3] - (1 << WARPEDMODEL_PREC_BITS)) / 2,
|
||||
1);
|
||||
x4 = (mat[2] * 4 * dst_x + mat[3] * 4 * dst_y + mat[0] * 2 +
|
||||
(mat[2] + mat[3] - (1 << WARPEDMODEL_PREC_BITS))) /
|
||||
4;
|
||||
else
|
||||
x4 = mat[2] * dst_x + mat[3] * dst_y + mat[0];
|
||||
|
||||
if (subsampling_y)
|
||||
y4 = ROUND_POWER_OF_TWO_SIGNED(
|
||||
mat[4] * 2 * dst_x + mat[5] * 2 * dst_y + mat[1] +
|
||||
(mat[4] + mat[5] - (1 << WARPEDMODEL_PREC_BITS)) / 2,
|
||||
1);
|
||||
y4 = (mat[4] * 4 * dst_x + mat[5] * 4 * dst_y + mat[1] * 2 +
|
||||
(mat[4] + mat[5] - (1 << WARPEDMODEL_PREC_BITS))) /
|
||||
4;
|
||||
else
|
||||
y4 = mat[4] * dst_x + mat[5] * dst_y + mat[1];
|
||||
|
||||
|
|
@ -67,76 +63,104 @@ void av1_warp_affine_sse2(int32_t *mat, uint8_t *ref, int width, int height,
|
|||
iy4 = y4 >> WARPEDMODEL_PREC_BITS;
|
||||
sy4 = y4 & ((1 << WARPEDMODEL_PREC_BITS) - 1);
|
||||
|
||||
// Horizontal filter
|
||||
for (k = -7; k < AOMMIN(8, p_height - i); ++k) {
|
||||
int iy = iy4 + k;
|
||||
if (iy < 0)
|
||||
iy = 0;
|
||||
else if (iy > height - 1)
|
||||
iy = height - 1;
|
||||
// Add in all the constant terms, including rounding and offset
|
||||
sx4 += alpha * (-4) + beta * (-4) + (1 << (WARPEDDIFF_PREC_BITS - 1)) +
|
||||
(WARPEDPIXEL_PREC_SHIFTS << WARPEDDIFF_PREC_BITS);
|
||||
sy4 += gamma * (-4) + delta * (-4) + (1 << (WARPEDDIFF_PREC_BITS - 1)) +
|
||||
(WARPEDPIXEL_PREC_SHIFTS << WARPEDDIFF_PREC_BITS);
|
||||
|
||||
// If the block is aligned such that, after clamping, every sample
|
||||
// would be taken from the leftmost/rightmost column, then we can
|
||||
// skip the expensive horizontal filter.
|
||||
if (ix4 <= -7) {
|
||||
sx4 &= ~((1 << WARP_PARAM_REDUCE_BITS) - 1);
|
||||
sy4 &= ~((1 << WARP_PARAM_REDUCE_BITS) - 1);
|
||||
|
||||
// Horizontal filter
|
||||
// If the block is aligned such that, after clamping, every sample
|
||||
// would be taken from the leftmost/rightmost column, then we can
|
||||
// skip the expensive horizontal filter.
|
||||
if (ix4 <= -7) {
|
||||
for (k = -7; k < AOMMIN(8, p_height - i); ++k) {
|
||||
int iy = iy4 + k;
|
||||
if (iy < 0)
|
||||
iy = 0;
|
||||
else if (iy > height - 1)
|
||||
iy = height - 1;
|
||||
tmp[k + 7] = _mm_set1_epi16(
|
||||
(1 << (bd + WARPEDPIXEL_FILTER_BITS - HORSHEAR_REDUCE_PREC_BITS -
|
||||
1)) +
|
||||
ref[iy * stride] *
|
||||
(1 << (WARPEDPIXEL_FILTER_BITS - HORSHEAR_REDUCE_PREC_BITS)));
|
||||
} else if (ix4 >= width + 6) {
|
||||
(1 << (WARPEDPIXEL_FILTER_BITS - HORSHEAR_REDUCE_PREC_BITS)));
|
||||
}
|
||||
} else if (ix4 >= width + 6) {
|
||||
for (k = -7; k < AOMMIN(8, p_height - i); ++k) {
|
||||
int iy = iy4 + k;
|
||||
if (iy < 0)
|
||||
iy = 0;
|
||||
else if (iy > height - 1)
|
||||
iy = height - 1;
|
||||
tmp[k + 7] = _mm_set1_epi16(
|
||||
(1 << (bd + WARPEDPIXEL_FILTER_BITS - HORSHEAR_REDUCE_PREC_BITS -
|
||||
1)) +
|
||||
ref[iy * stride + (width - 1)] *
|
||||
(1 << (WARPEDPIXEL_FILTER_BITS - HORSHEAR_REDUCE_PREC_BITS)));
|
||||
} else {
|
||||
int sx = sx4 + alpha * (-4) + beta * k +
|
||||
// Include rounding and offset here
|
||||
(1 << (WARPEDDIFF_PREC_BITS - 1)) +
|
||||
(WARPEDPIXEL_PREC_SHIFTS << WARPEDDIFF_PREC_BITS);
|
||||
(1 << (WARPEDPIXEL_FILTER_BITS - HORSHEAR_REDUCE_PREC_BITS)));
|
||||
}
|
||||
} else {
|
||||
for (k = -7; k < AOMMIN(8, p_height - i); ++k) {
|
||||
int iy = iy4 + k;
|
||||
if (iy < 0)
|
||||
iy = 0;
|
||||
else if (iy > height - 1)
|
||||
iy = height - 1;
|
||||
int sx = sx4 + beta * (k + 4);
|
||||
|
||||
// Load source pixels
|
||||
__m128i zero = _mm_setzero_si128();
|
||||
__m128i src =
|
||||
const __m128i zero = _mm_setzero_si128();
|
||||
const __m128i src =
|
||||
_mm_loadu_si128((__m128i *)(ref + iy * stride + ix4 - 7));
|
||||
|
||||
// Filter even-index pixels
|
||||
__m128i tmp_0 = _mm_loadu_si128(
|
||||
(__m128i *)(filter + ((sx + 0 * alpha) >> WARPEDDIFF_PREC_BITS)));
|
||||
__m128i tmp_2 = _mm_loadu_si128(
|
||||
(__m128i *)(filter + ((sx + 2 * alpha) >> WARPEDDIFF_PREC_BITS)));
|
||||
__m128i tmp_4 = _mm_loadu_si128(
|
||||
(__m128i *)(filter + ((sx + 4 * alpha) >> WARPEDDIFF_PREC_BITS)));
|
||||
__m128i tmp_6 = _mm_loadu_si128(
|
||||
(__m128i *)(filter + ((sx + 6 * alpha) >> WARPEDDIFF_PREC_BITS)));
|
||||
const __m128i tmp_0 = _mm_loadu_si128(
|
||||
(__m128i *)(warped_filter +
|
||||
((sx + 0 * alpha) >> WARPEDDIFF_PREC_BITS)));
|
||||
const __m128i tmp_2 = _mm_loadu_si128(
|
||||
(__m128i *)(warped_filter +
|
||||
((sx + 2 * alpha) >> WARPEDDIFF_PREC_BITS)));
|
||||
const __m128i tmp_4 = _mm_loadu_si128(
|
||||
(__m128i *)(warped_filter +
|
||||
((sx + 4 * alpha) >> WARPEDDIFF_PREC_BITS)));
|
||||
const __m128i tmp_6 = _mm_loadu_si128(
|
||||
(__m128i *)(warped_filter +
|
||||
((sx + 6 * alpha) >> WARPEDDIFF_PREC_BITS)));
|
||||
|
||||
// coeffs 0 1 0 1 2 3 2 3 for pixels 0, 2
|
||||
__m128i tmp_8 = _mm_unpacklo_epi32(tmp_0, tmp_2);
|
||||
const __m128i tmp_8 = _mm_unpacklo_epi32(tmp_0, tmp_2);
|
||||
// coeffs 0 1 0 1 2 3 2 3 for pixels 4, 6
|
||||
__m128i tmp_10 = _mm_unpacklo_epi32(tmp_4, tmp_6);
|
||||
const __m128i tmp_10 = _mm_unpacklo_epi32(tmp_4, tmp_6);
|
||||
// coeffs 4 5 4 5 6 7 6 7 for pixels 0, 2
|
||||
__m128i tmp_12 = _mm_unpackhi_epi32(tmp_0, tmp_2);
|
||||
const __m128i tmp_12 = _mm_unpackhi_epi32(tmp_0, tmp_2);
|
||||
// coeffs 4 5 4 5 6 7 6 7 for pixels 4, 6
|
||||
__m128i tmp_14 = _mm_unpackhi_epi32(tmp_4, tmp_6);
|
||||
const __m128i tmp_14 = _mm_unpackhi_epi32(tmp_4, tmp_6);
|
||||
|
||||
// coeffs 0 1 0 1 0 1 0 1 for pixels 0, 2, 4, 6
|
||||
__m128i coeff_0 = _mm_unpacklo_epi64(tmp_8, tmp_10);
|
||||
const __m128i coeff_0 = _mm_unpacklo_epi64(tmp_8, tmp_10);
|
||||
// coeffs 2 3 2 3 2 3 2 3 for pixels 0, 2, 4, 6
|
||||
__m128i coeff_2 = _mm_unpackhi_epi64(tmp_8, tmp_10);
|
||||
const __m128i coeff_2 = _mm_unpackhi_epi64(tmp_8, tmp_10);
|
||||
// coeffs 4 5 4 5 4 5 4 5 for pixels 0, 2, 4, 6
|
||||
__m128i coeff_4 = _mm_unpacklo_epi64(tmp_12, tmp_14);
|
||||
const __m128i coeff_4 = _mm_unpacklo_epi64(tmp_12, tmp_14);
|
||||
// coeffs 6 7 6 7 6 7 6 7 for pixels 0, 2, 4, 6
|
||||
__m128i coeff_6 = _mm_unpackhi_epi64(tmp_12, tmp_14);
|
||||
const __m128i coeff_6 = _mm_unpackhi_epi64(tmp_12, tmp_14);
|
||||
|
||||
__m128i round_const =
|
||||
_mm_set1_epi32((1 << HORSHEAR_REDUCE_PREC_BITS) >> 1);
|
||||
const __m128i round_const =
|
||||
_mm_set1_epi32((1 << (bd + WARPEDPIXEL_FILTER_BITS - 1)) +
|
||||
((1 << HORSHEAR_REDUCE_PREC_BITS) >> 1));
|
||||
|
||||
// Calculate filtered results
|
||||
__m128i src_0 = _mm_unpacklo_epi8(src, zero);
|
||||
__m128i res_0 = _mm_madd_epi16(src_0, coeff_0);
|
||||
__m128i src_2 = _mm_unpacklo_epi8(_mm_srli_si128(src, 2), zero);
|
||||
__m128i res_2 = _mm_madd_epi16(src_2, coeff_2);
|
||||
__m128i src_4 = _mm_unpacklo_epi8(_mm_srli_si128(src, 4), zero);
|
||||
__m128i res_4 = _mm_madd_epi16(src_4, coeff_4);
|
||||
__m128i src_6 = _mm_unpacklo_epi8(_mm_srli_si128(src, 6), zero);
|
||||
__m128i res_6 = _mm_madd_epi16(src_6, coeff_6);
|
||||
const __m128i src_0 = _mm_unpacklo_epi8(src, zero);
|
||||
const __m128i res_0 = _mm_madd_epi16(src_0, coeff_0);
|
||||
const __m128i src_2 = _mm_unpacklo_epi8(_mm_srli_si128(src, 2), zero);
|
||||
const __m128i res_2 = _mm_madd_epi16(src_2, coeff_2);
|
||||
const __m128i src_4 = _mm_unpacklo_epi8(_mm_srli_si128(src, 4), zero);
|
||||
const __m128i res_4 = _mm_madd_epi16(src_4, coeff_4);
|
||||
const __m128i src_6 = _mm_unpacklo_epi8(_mm_srli_si128(src, 6), zero);
|
||||
const __m128i res_6 = _mm_madd_epi16(src_6, coeff_6);
|
||||
|
||||
__m128i res_even = _mm_add_epi32(_mm_add_epi32(res_0, res_4),
|
||||
_mm_add_epi32(res_2, res_6));
|
||||
|
|
@ -144,33 +168,37 @@ void av1_warp_affine_sse2(int32_t *mat, uint8_t *ref, int width, int height,
|
|||
HORSHEAR_REDUCE_PREC_BITS);
|
||||
|
||||
// Filter odd-index pixels
|
||||
__m128i tmp_1 = _mm_loadu_si128(
|
||||
(__m128i *)(filter + ((sx + 1 * alpha) >> WARPEDDIFF_PREC_BITS)));
|
||||
__m128i tmp_3 = _mm_loadu_si128(
|
||||
(__m128i *)(filter + ((sx + 3 * alpha) >> WARPEDDIFF_PREC_BITS)));
|
||||
__m128i tmp_5 = _mm_loadu_si128(
|
||||
(__m128i *)(filter + ((sx + 5 * alpha) >> WARPEDDIFF_PREC_BITS)));
|
||||
__m128i tmp_7 = _mm_loadu_si128(
|
||||
(__m128i *)(filter + ((sx + 7 * alpha) >> WARPEDDIFF_PREC_BITS)));
|
||||
const __m128i tmp_1 = _mm_loadu_si128(
|
||||
(__m128i *)(warped_filter +
|
||||
((sx + 1 * alpha) >> WARPEDDIFF_PREC_BITS)));
|
||||
const __m128i tmp_3 = _mm_loadu_si128(
|
||||
(__m128i *)(warped_filter +
|
||||
((sx + 3 * alpha) >> WARPEDDIFF_PREC_BITS)));
|
||||
const __m128i tmp_5 = _mm_loadu_si128(
|
||||
(__m128i *)(warped_filter +
|
||||
((sx + 5 * alpha) >> WARPEDDIFF_PREC_BITS)));
|
||||
const __m128i tmp_7 = _mm_loadu_si128(
|
||||
(__m128i *)(warped_filter +
|
||||
((sx + 7 * alpha) >> WARPEDDIFF_PREC_BITS)));
|
||||
|
||||
__m128i tmp_9 = _mm_unpacklo_epi32(tmp_1, tmp_3);
|
||||
__m128i tmp_11 = _mm_unpacklo_epi32(tmp_5, tmp_7);
|
||||
__m128i tmp_13 = _mm_unpackhi_epi32(tmp_1, tmp_3);
|
||||
__m128i tmp_15 = _mm_unpackhi_epi32(tmp_5, tmp_7);
|
||||
const __m128i tmp_9 = _mm_unpacklo_epi32(tmp_1, tmp_3);
|
||||
const __m128i tmp_11 = _mm_unpacklo_epi32(tmp_5, tmp_7);
|
||||
const __m128i tmp_13 = _mm_unpackhi_epi32(tmp_1, tmp_3);
|
||||
const __m128i tmp_15 = _mm_unpackhi_epi32(tmp_5, tmp_7);
|
||||
|
||||
__m128i coeff_1 = _mm_unpacklo_epi64(tmp_9, tmp_11);
|
||||
__m128i coeff_3 = _mm_unpackhi_epi64(tmp_9, tmp_11);
|
||||
__m128i coeff_5 = _mm_unpacklo_epi64(tmp_13, tmp_15);
|
||||
__m128i coeff_7 = _mm_unpackhi_epi64(tmp_13, tmp_15);
|
||||
const __m128i coeff_1 = _mm_unpacklo_epi64(tmp_9, tmp_11);
|
||||
const __m128i coeff_3 = _mm_unpackhi_epi64(tmp_9, tmp_11);
|
||||
const __m128i coeff_5 = _mm_unpacklo_epi64(tmp_13, tmp_15);
|
||||
const __m128i coeff_7 = _mm_unpackhi_epi64(tmp_13, tmp_15);
|
||||
|
||||
__m128i src_1 = _mm_unpacklo_epi8(_mm_srli_si128(src, 1), zero);
|
||||
__m128i res_1 = _mm_madd_epi16(src_1, coeff_1);
|
||||
__m128i src_3 = _mm_unpacklo_epi8(_mm_srli_si128(src, 3), zero);
|
||||
__m128i res_3 = _mm_madd_epi16(src_3, coeff_3);
|
||||
__m128i src_5 = _mm_unpacklo_epi8(_mm_srli_si128(src, 5), zero);
|
||||
__m128i res_5 = _mm_madd_epi16(src_5, coeff_5);
|
||||
__m128i src_7 = _mm_unpacklo_epi8(_mm_srli_si128(src, 7), zero);
|
||||
__m128i res_7 = _mm_madd_epi16(src_7, coeff_7);
|
||||
const __m128i src_1 = _mm_unpacklo_epi8(_mm_srli_si128(src, 1), zero);
|
||||
const __m128i res_1 = _mm_madd_epi16(src_1, coeff_1);
|
||||
const __m128i src_3 = _mm_unpacklo_epi8(_mm_srli_si128(src, 3), zero);
|
||||
const __m128i res_3 = _mm_madd_epi16(src_3, coeff_3);
|
||||
const __m128i src_5 = _mm_unpacklo_epi8(_mm_srli_si128(src, 5), zero);
|
||||
const __m128i res_5 = _mm_madd_epi16(src_5, coeff_5);
|
||||
const __m128i src_7 = _mm_unpacklo_epi8(_mm_srli_si128(src, 7), zero);
|
||||
const __m128i res_7 = _mm_madd_epi16(src_7, coeff_7);
|
||||
|
||||
__m128i res_odd = _mm_add_epi32(_mm_add_epi32(res_1, res_5),
|
||||
_mm_add_epi32(res_3, res_7));
|
||||
|
|
@ -186,109 +214,116 @@ void av1_warp_affine_sse2(int32_t *mat, uint8_t *ref, int width, int height,
|
|||
|
||||
// Vertical filter
|
||||
for (k = -4; k < AOMMIN(4, p_height - i - 4); ++k) {
|
||||
int sy = sy4 + gamma * (-4) + delta * k +
|
||||
(1 << (WARPEDDIFF_PREC_BITS - 1)) +
|
||||
(WARPEDPIXEL_PREC_SHIFTS << WARPEDDIFF_PREC_BITS);
|
||||
int sy = sy4 + delta * (k + 4);
|
||||
|
||||
// Load from tmp and rearrange pairs of consecutive rows into the
|
||||
// column order 0 0 2 2 4 4 6 6; 1 1 3 3 5 5 7 7
|
||||
__m128i *src = tmp + (k + 4);
|
||||
__m128i src_0 = _mm_unpacklo_epi16(src[0], src[1]);
|
||||
__m128i src_2 = _mm_unpacklo_epi16(src[2], src[3]);
|
||||
__m128i src_4 = _mm_unpacklo_epi16(src[4], src[5]);
|
||||
__m128i src_6 = _mm_unpacklo_epi16(src[6], src[7]);
|
||||
const __m128i *src = tmp + (k + 4);
|
||||
const __m128i src_0 = _mm_unpacklo_epi16(src[0], src[1]);
|
||||
const __m128i src_2 = _mm_unpacklo_epi16(src[2], src[3]);
|
||||
const __m128i src_4 = _mm_unpacklo_epi16(src[4], src[5]);
|
||||
const __m128i src_6 = _mm_unpacklo_epi16(src[6], src[7]);
|
||||
|
||||
// Filter even-index pixels
|
||||
__m128i tmp_0 = _mm_loadu_si128(
|
||||
(__m128i *)(filter + ((sy + 0 * gamma) >> WARPEDDIFF_PREC_BITS)));
|
||||
__m128i tmp_2 = _mm_loadu_si128(
|
||||
(__m128i *)(filter + ((sy + 2 * gamma) >> WARPEDDIFF_PREC_BITS)));
|
||||
__m128i tmp_4 = _mm_loadu_si128(
|
||||
(__m128i *)(filter + ((sy + 4 * gamma) >> WARPEDDIFF_PREC_BITS)));
|
||||
__m128i tmp_6 = _mm_loadu_si128(
|
||||
(__m128i *)(filter + ((sy + 6 * gamma) >> WARPEDDIFF_PREC_BITS)));
|
||||
const __m128i tmp_0 = _mm_loadu_si128(
|
||||
(__m128i *)(warped_filter +
|
||||
((sy + 0 * gamma) >> WARPEDDIFF_PREC_BITS)));
|
||||
const __m128i tmp_2 = _mm_loadu_si128(
|
||||
(__m128i *)(warped_filter +
|
||||
((sy + 2 * gamma) >> WARPEDDIFF_PREC_BITS)));
|
||||
const __m128i tmp_4 = _mm_loadu_si128(
|
||||
(__m128i *)(warped_filter +
|
||||
((sy + 4 * gamma) >> WARPEDDIFF_PREC_BITS)));
|
||||
const __m128i tmp_6 = _mm_loadu_si128(
|
||||
(__m128i *)(warped_filter +
|
||||
((sy + 6 * gamma) >> WARPEDDIFF_PREC_BITS)));
|
||||
|
||||
__m128i tmp_8 = _mm_unpacklo_epi32(tmp_0, tmp_2);
|
||||
__m128i tmp_10 = _mm_unpacklo_epi32(tmp_4, tmp_6);
|
||||
__m128i tmp_12 = _mm_unpackhi_epi32(tmp_0, tmp_2);
|
||||
__m128i tmp_14 = _mm_unpackhi_epi32(tmp_4, tmp_6);
|
||||
const __m128i tmp_8 = _mm_unpacklo_epi32(tmp_0, tmp_2);
|
||||
const __m128i tmp_10 = _mm_unpacklo_epi32(tmp_4, tmp_6);
|
||||
const __m128i tmp_12 = _mm_unpackhi_epi32(tmp_0, tmp_2);
|
||||
const __m128i tmp_14 = _mm_unpackhi_epi32(tmp_4, tmp_6);
|
||||
|
||||
__m128i coeff_0 = _mm_unpacklo_epi64(tmp_8, tmp_10);
|
||||
__m128i coeff_2 = _mm_unpackhi_epi64(tmp_8, tmp_10);
|
||||
__m128i coeff_4 = _mm_unpacklo_epi64(tmp_12, tmp_14);
|
||||
__m128i coeff_6 = _mm_unpackhi_epi64(tmp_12, tmp_14);
|
||||
const __m128i coeff_0 = _mm_unpacklo_epi64(tmp_8, tmp_10);
|
||||
const __m128i coeff_2 = _mm_unpackhi_epi64(tmp_8, tmp_10);
|
||||
const __m128i coeff_4 = _mm_unpacklo_epi64(tmp_12, tmp_14);
|
||||
const __m128i coeff_6 = _mm_unpackhi_epi64(tmp_12, tmp_14);
|
||||
|
||||
__m128i res_0 = _mm_madd_epi16(src_0, coeff_0);
|
||||
__m128i res_2 = _mm_madd_epi16(src_2, coeff_2);
|
||||
__m128i res_4 = _mm_madd_epi16(src_4, coeff_4);
|
||||
__m128i res_6 = _mm_madd_epi16(src_6, coeff_6);
|
||||
const __m128i res_0 = _mm_madd_epi16(src_0, coeff_0);
|
||||
const __m128i res_2 = _mm_madd_epi16(src_2, coeff_2);
|
||||
const __m128i res_4 = _mm_madd_epi16(src_4, coeff_4);
|
||||
const __m128i res_6 = _mm_madd_epi16(src_6, coeff_6);
|
||||
|
||||
__m128i res_even = _mm_add_epi32(_mm_add_epi32(res_0, res_2),
|
||||
_mm_add_epi32(res_4, res_6));
|
||||
const __m128i res_even = _mm_add_epi32(_mm_add_epi32(res_0, res_2),
|
||||
_mm_add_epi32(res_4, res_6));
|
||||
|
||||
// Filter odd-index pixels
|
||||
__m128i src_1 = _mm_unpackhi_epi16(src[0], src[1]);
|
||||
__m128i src_3 = _mm_unpackhi_epi16(src[2], src[3]);
|
||||
__m128i src_5 = _mm_unpackhi_epi16(src[4], src[5]);
|
||||
__m128i src_7 = _mm_unpackhi_epi16(src[6], src[7]);
|
||||
const __m128i src_1 = _mm_unpackhi_epi16(src[0], src[1]);
|
||||
const __m128i src_3 = _mm_unpackhi_epi16(src[2], src[3]);
|
||||
const __m128i src_5 = _mm_unpackhi_epi16(src[4], src[5]);
|
||||
const __m128i src_7 = _mm_unpackhi_epi16(src[6], src[7]);
|
||||
|
||||
__m128i tmp_1 = _mm_loadu_si128(
|
||||
(__m128i *)(filter + ((sy + 1 * gamma) >> WARPEDDIFF_PREC_BITS)));
|
||||
__m128i tmp_3 = _mm_loadu_si128(
|
||||
(__m128i *)(filter + ((sy + 3 * gamma) >> WARPEDDIFF_PREC_BITS)));
|
||||
__m128i tmp_5 = _mm_loadu_si128(
|
||||
(__m128i *)(filter + ((sy + 5 * gamma) >> WARPEDDIFF_PREC_BITS)));
|
||||
__m128i tmp_7 = _mm_loadu_si128(
|
||||
(__m128i *)(filter + ((sy + 7 * gamma) >> WARPEDDIFF_PREC_BITS)));
|
||||
const __m128i tmp_1 = _mm_loadu_si128(
|
||||
(__m128i *)(warped_filter +
|
||||
((sy + 1 * gamma) >> WARPEDDIFF_PREC_BITS)));
|
||||
const __m128i tmp_3 = _mm_loadu_si128(
|
||||
(__m128i *)(warped_filter +
|
||||
((sy + 3 * gamma) >> WARPEDDIFF_PREC_BITS)));
|
||||
const __m128i tmp_5 = _mm_loadu_si128(
|
||||
(__m128i *)(warped_filter +
|
||||
((sy + 5 * gamma) >> WARPEDDIFF_PREC_BITS)));
|
||||
const __m128i tmp_7 = _mm_loadu_si128(
|
||||
(__m128i *)(warped_filter +
|
||||
((sy + 7 * gamma) >> WARPEDDIFF_PREC_BITS)));
|
||||
|
||||
__m128i tmp_9 = _mm_unpacklo_epi32(tmp_1, tmp_3);
|
||||
__m128i tmp_11 = _mm_unpacklo_epi32(tmp_5, tmp_7);
|
||||
__m128i tmp_13 = _mm_unpackhi_epi32(tmp_1, tmp_3);
|
||||
__m128i tmp_15 = _mm_unpackhi_epi32(tmp_5, tmp_7);
|
||||
const __m128i tmp_9 = _mm_unpacklo_epi32(tmp_1, tmp_3);
|
||||
const __m128i tmp_11 = _mm_unpacklo_epi32(tmp_5, tmp_7);
|
||||
const __m128i tmp_13 = _mm_unpackhi_epi32(tmp_1, tmp_3);
|
||||
const __m128i tmp_15 = _mm_unpackhi_epi32(tmp_5, tmp_7);
|
||||
|
||||
__m128i coeff_1 = _mm_unpacklo_epi64(tmp_9, tmp_11);
|
||||
__m128i coeff_3 = _mm_unpackhi_epi64(tmp_9, tmp_11);
|
||||
__m128i coeff_5 = _mm_unpacklo_epi64(tmp_13, tmp_15);
|
||||
__m128i coeff_7 = _mm_unpackhi_epi64(tmp_13, tmp_15);
|
||||
const __m128i coeff_1 = _mm_unpacklo_epi64(tmp_9, tmp_11);
|
||||
const __m128i coeff_3 = _mm_unpackhi_epi64(tmp_9, tmp_11);
|
||||
const __m128i coeff_5 = _mm_unpacklo_epi64(tmp_13, tmp_15);
|
||||
const __m128i coeff_7 = _mm_unpackhi_epi64(tmp_13, tmp_15);
|
||||
|
||||
__m128i res_1 = _mm_madd_epi16(src_1, coeff_1);
|
||||
__m128i res_3 = _mm_madd_epi16(src_3, coeff_3);
|
||||
__m128i res_5 = _mm_madd_epi16(src_5, coeff_5);
|
||||
__m128i res_7 = _mm_madd_epi16(src_7, coeff_7);
|
||||
const __m128i res_1 = _mm_madd_epi16(src_1, coeff_1);
|
||||
const __m128i res_3 = _mm_madd_epi16(src_3, coeff_3);
|
||||
const __m128i res_5 = _mm_madd_epi16(src_5, coeff_5);
|
||||
const __m128i res_7 = _mm_madd_epi16(src_7, coeff_7);
|
||||
|
||||
__m128i res_odd = _mm_add_epi32(_mm_add_epi32(res_1, res_3),
|
||||
_mm_add_epi32(res_5, res_7));
|
||||
const __m128i res_odd = _mm_add_epi32(_mm_add_epi32(res_1, res_3),
|
||||
_mm_add_epi32(res_5, res_7));
|
||||
|
||||
// Rearrange pixels back into the order 0 ... 7
|
||||
__m128i res_lo = _mm_unpacklo_epi32(res_even, res_odd);
|
||||
__m128i res_hi = _mm_unpackhi_epi32(res_even, res_odd);
|
||||
const __m128i res_lo = _mm_unpacklo_epi32(res_even, res_odd);
|
||||
const __m128i res_hi = _mm_unpackhi_epi32(res_even, res_odd);
|
||||
|
||||
// Round and pack into 8 bits
|
||||
__m128i round_const =
|
||||
_mm_set1_epi32((1 << VERSHEAR_REDUCE_PREC_BITS) >> 1);
|
||||
const __m128i round_const =
|
||||
_mm_set1_epi32(-(1 << (bd + VERSHEAR_REDUCE_PREC_BITS - 1)) +
|
||||
((1 << VERSHEAR_REDUCE_PREC_BITS) >> 1));
|
||||
|
||||
__m128i res_lo_round = _mm_srai_epi32(
|
||||
const __m128i res_lo_round = _mm_srai_epi32(
|
||||
_mm_add_epi32(res_lo, round_const), VERSHEAR_REDUCE_PREC_BITS);
|
||||
__m128i res_hi_round = _mm_srai_epi32(
|
||||
const __m128i res_hi_round = _mm_srai_epi32(
|
||||
_mm_add_epi32(res_hi, round_const), VERSHEAR_REDUCE_PREC_BITS);
|
||||
|
||||
__m128i res_16bit = _mm_packs_epi32(res_lo_round, res_hi_round);
|
||||
const __m128i res_16bit = _mm_packs_epi32(res_lo_round, res_hi_round);
|
||||
__m128i res_8bit = _mm_packus_epi16(res_16bit, res_16bit);
|
||||
|
||||
// Store, blending with 'pred' if needed
|
||||
__m128i *p = (__m128i *)&pred[(i + k + 4) * p_stride + j];
|
||||
__m128i *const p = (__m128i *)&pred[(i + k + 4) * p_stride + j];
|
||||
|
||||
// Note: If we're outputting a 4x4 block, we need to be very careful
|
||||
// to only output 4 pixels at this point, to avoid encode/decode
|
||||
// mismatches when encoding with multiple threads.
|
||||
if (p_width == 4) {
|
||||
if (ref_frm) {
|
||||
if (comp_avg) {
|
||||
const __m128i orig = _mm_cvtsi32_si128(*(uint32_t *)p);
|
||||
res_8bit = _mm_avg_epu8(res_8bit, orig);
|
||||
}
|
||||
*(uint32_t *)p = _mm_cvtsi128_si32(res_8bit);
|
||||
} else {
|
||||
if (ref_frm) res_8bit = _mm_avg_epu8(res_8bit, _mm_loadl_epi64(p));
|
||||
if (comp_avg) res_8bit = _mm_avg_epu8(res_8bit, _mm_loadl_epi64(p));
|
||||
_mm_storel_epi64(p, res_8bit);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
508
third_party/aom/av1/common/x86/warp_plane_ssse3.c
vendored
Normal file
508
third_party/aom/av1/common/x86/warp_plane_ssse3.c
vendored
Normal file
|
|
@ -0,0 +1,508 @@
|
|||
/*
|
||||
* 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 <tmmintrin.h>
|
||||
|
||||
#include "./av1_rtcd.h"
|
||||
#include "av1/common/warped_motion.h"
|
||||
|
||||
/* This is a modified version of 'warped_filter' from warped_motion.c:
|
||||
* Each coefficient is stored in 8 bits instead of 16 bits
|
||||
* The coefficients are rearranged in the column order 0, 2, 4, 6, 1, 3, 5, 7
|
||||
|
||||
This is done in order to avoid overflow: Since the tap with the largest
|
||||
coefficient could be any of taps 2, 3, 4 or 5, we can't use the summation
|
||||
order ((0 + 1) + (4 + 5)) + ((2 + 3) + (6 + 7)) used in the regular
|
||||
convolve functions.
|
||||
|
||||
Instead, we use the summation order
|
||||
((0 + 2) + (4 + 6)) + ((1 + 3) + (5 + 7)).
|
||||
The rearrangement of coefficients in this table is so that we can get the
|
||||
coefficients into the correct order more quickly.
|
||||
*/
|
||||
/* clang-format off */
|
||||
DECLARE_ALIGNED(8, static const int8_t,
|
||||
filter_8bit[WARPEDPIXEL_PREC_SHIFTS * 3 + 1][8]) = {
|
||||
#if WARPEDPIXEL_PREC_BITS == 6
|
||||
// [-1, 0)
|
||||
{ 0, 127, 0, 0, 0, 1, 0, 0}, { 0, 127, 0, 0, -1, 2, 0, 0},
|
||||
{ 1, 127, -1, 0, -3, 4, 0, 0}, { 1, 126, -2, 0, -4, 6, 1, 0},
|
||||
{ 1, 126, -3, 0, -5, 8, 1, 0}, { 1, 125, -4, 0, -6, 11, 1, 0},
|
||||
{ 1, 124, -4, 0, -7, 13, 1, 0}, { 2, 123, -5, 0, -8, 15, 1, 0},
|
||||
{ 2, 122, -6, 0, -9, 18, 1, 0}, { 2, 121, -6, 0, -10, 20, 1, 0},
|
||||
{ 2, 120, -7, 0, -11, 22, 2, 0}, { 2, 119, -8, 0, -12, 25, 2, 0},
|
||||
{ 3, 117, -8, 0, -13, 27, 2, 0}, { 3, 116, -9, 0, -13, 29, 2, 0},
|
||||
{ 3, 114, -10, 0, -14, 32, 3, 0}, { 3, 113, -10, 0, -15, 35, 2, 0},
|
||||
{ 3, 111, -11, 0, -15, 37, 3, 0}, { 3, 109, -11, 0, -16, 40, 3, 0},
|
||||
{ 3, 108, -12, 0, -16, 42, 3, 0}, { 4, 106, -13, 0, -17, 45, 3, 0},
|
||||
{ 4, 104, -13, 0, -17, 47, 3, 0}, { 4, 102, -14, 0, -17, 50, 3, 0},
|
||||
{ 4, 100, -14, 0, -17, 52, 3, 0}, { 4, 98, -15, 0, -18, 55, 4, 0},
|
||||
{ 4, 96, -15, 0, -18, 58, 3, 0}, { 4, 94, -16, 0, -18, 60, 4, 0},
|
||||
{ 4, 91, -16, 0, -18, 63, 4, 0}, { 4, 89, -16, 0, -18, 65, 4, 0},
|
||||
{ 4, 87, -17, 0, -18, 68, 4, 0}, { 4, 85, -17, 0, -18, 70, 4, 0},
|
||||
{ 4, 82, -17, 0, -18, 73, 4, 0}, { 4, 80, -17, 0, -18, 75, 4, 0},
|
||||
{ 4, 78, -18, 0, -18, 78, 4, 0}, { 4, 75, -18, 0, -17, 80, 4, 0},
|
||||
{ 4, 73, -18, 0, -17, 82, 4, 0}, { 4, 70, -18, 0, -17, 85, 4, 0},
|
||||
{ 4, 68, -18, 0, -17, 87, 4, 0}, { 4, 65, -18, 0, -16, 89, 4, 0},
|
||||
{ 4, 63, -18, 0, -16, 91, 4, 0}, { 4, 60, -18, 0, -16, 94, 4, 0},
|
||||
{ 3, 58, -18, 0, -15, 96, 4, 0}, { 4, 55, -18, 0, -15, 98, 4, 0},
|
||||
{ 3, 52, -17, 0, -14, 100, 4, 0}, { 3, 50, -17, 0, -14, 102, 4, 0},
|
||||
{ 3, 47, -17, 0, -13, 104, 4, 0}, { 3, 45, -17, 0, -13, 106, 4, 0},
|
||||
{ 3, 42, -16, 0, -12, 108, 3, 0}, { 3, 40, -16, 0, -11, 109, 3, 0},
|
||||
{ 3, 37, -15, 0, -11, 111, 3, 0}, { 2, 35, -15, 0, -10, 113, 3, 0},
|
||||
{ 3, 32, -14, 0, -10, 114, 3, 0}, { 2, 29, -13, 0, -9, 116, 3, 0},
|
||||
{ 2, 27, -13, 0, -8, 117, 3, 0}, { 2, 25, -12, 0, -8, 119, 2, 0},
|
||||
{ 2, 22, -11, 0, -7, 120, 2, 0}, { 1, 20, -10, 0, -6, 121, 2, 0},
|
||||
{ 1, 18, -9, 0, -6, 122, 2, 0}, { 1, 15, -8, 0, -5, 123, 2, 0},
|
||||
{ 1, 13, -7, 0, -4, 124, 1, 0}, { 1, 11, -6, 0, -4, 125, 1, 0},
|
||||
{ 1, 8, -5, 0, -3, 126, 1, 0}, { 1, 6, -4, 0, -2, 126, 1, 0},
|
||||
{ 0, 4, -3, 0, -1, 127, 1, 0}, { 0, 2, -1, 0, 0, 127, 0, 0},
|
||||
// [0, 1)
|
||||
{ 0, 0, 1, 0, 0, 127, 0, 0}, { 0, -1, 2, 0, 0, 127, 0, 0},
|
||||
{ 0, -3, 4, 1, 1, 127, -2, 0}, { 0, -5, 6, 1, 1, 127, -2, 0},
|
||||
{ 0, -6, 8, 1, 2, 126, -3, 0}, {-1, -7, 11, 2, 2, 126, -4, -1},
|
||||
{-1, -8, 13, 2, 3, 125, -5, -1}, {-1, -10, 16, 3, 3, 124, -6, -1},
|
||||
{-1, -11, 18, 3, 4, 123, -7, -1}, {-1, -12, 20, 3, 4, 122, -7, -1},
|
||||
{-1, -13, 23, 3, 4, 121, -8, -1}, {-2, -14, 25, 4, 5, 120, -9, -1},
|
||||
{-1, -15, 27, 4, 5, 119, -10, -1}, {-1, -16, 30, 4, 5, 118, -11, -1},
|
||||
{-2, -17, 33, 5, 6, 116, -12, -1}, {-2, -17, 35, 5, 6, 114, -12, -1},
|
||||
{-2, -18, 38, 5, 6, 113, -13, -1}, {-2, -19, 41, 6, 7, 111, -14, -2},
|
||||
{-2, -19, 43, 6, 7, 110, -15, -2}, {-2, -20, 46, 6, 7, 108, -15, -2},
|
||||
{-2, -20, 49, 6, 7, 106, -16, -2}, {-2, -21, 51, 7, 7, 104, -16, -2},
|
||||
{-2, -21, 54, 7, 7, 102, -17, -2}, {-2, -21, 56, 7, 8, 100, -18, -2},
|
||||
{-2, -22, 59, 7, 8, 98, -18, -2}, {-2, -22, 62, 7, 8, 96, -19, -2},
|
||||
{-2, -22, 64, 7, 8, 94, -19, -2}, {-2, -22, 67, 8, 8, 91, -20, -2},
|
||||
{-2, -22, 69, 8, 8, 89, -20, -2}, {-2, -22, 72, 8, 8, 87, -21, -2},
|
||||
{-2, -21, 74, 8, 8, 84, -21, -2}, {-2, -22, 77, 8, 8, 82, -21, -2},
|
||||
{-2, -21, 79, 8, 8, 79, -21, -2}, {-2, -21, 82, 8, 8, 77, -22, -2},
|
||||
{-2, -21, 84, 8, 8, 74, -21, -2}, {-2, -21, 87, 8, 8, 72, -22, -2},
|
||||
{-2, -20, 89, 8, 8, 69, -22, -2}, {-2, -20, 91, 8, 8, 67, -22, -2},
|
||||
{-2, -19, 94, 8, 7, 64, -22, -2}, {-2, -19, 96, 8, 7, 62, -22, -2},
|
||||
{-2, -18, 98, 8, 7, 59, -22, -2}, {-2, -18, 100, 8, 7, 56, -21, -2},
|
||||
{-2, -17, 102, 7, 7, 54, -21, -2}, {-2, -16, 104, 7, 7, 51, -21, -2},
|
||||
{-2, -16, 106, 7, 6, 49, -20, -2}, {-2, -15, 108, 7, 6, 46, -20, -2},
|
||||
{-2, -15, 110, 7, 6, 43, -19, -2}, {-2, -14, 111, 7, 6, 41, -19, -2},
|
||||
{-1, -13, 113, 6, 5, 38, -18, -2}, {-1, -12, 114, 6, 5, 35, -17, -2},
|
||||
{-1, -12, 116, 6, 5, 33, -17, -2}, {-1, -11, 118, 5, 4, 30, -16, -1},
|
||||
{-1, -10, 119, 5, 4, 27, -15, -1}, {-1, -9, 120, 5, 4, 25, -14, -2},
|
||||
{-1, -8, 121, 4, 3, 23, -13, -1}, {-1, -7, 122, 4, 3, 20, -12, -1},
|
||||
{-1, -7, 123, 4, 3, 18, -11, -1}, {-1, -6, 124, 3, 3, 16, -10, -1},
|
||||
{-1, -5, 125, 3, 2, 13, -8, -1}, {-1, -4, 126, 2, 2, 11, -7, -1},
|
||||
{ 0, -3, 126, 2, 1, 8, -6, 0}, { 0, -2, 127, 1, 1, 6, -5, 0},
|
||||
{ 0, -2, 127, 1, 1, 4, -3, 0}, { 0, 0, 127, 0, 0, 2, -1, 0},
|
||||
// [1, 2)
|
||||
{ 0, 0, 127, 0, 0, 1, 0, 0}, { 0, 0, 127, 0, 0, -1, 2, 0},
|
||||
{ 0, 1, 127, -1, 0, -3, 4, 0}, { 0, 1, 126, -2, 0, -4, 6, 1},
|
||||
{ 0, 1, 126, -3, 0, -5, 8, 1}, { 0, 1, 125, -4, 0, -6, 11, 1},
|
||||
{ 0, 1, 124, -4, 0, -7, 13, 1}, { 0, 2, 123, -5, 0, -8, 15, 1},
|
||||
{ 0, 2, 122, -6, 0, -9, 18, 1}, { 0, 2, 121, -6, 0, -10, 20, 1},
|
||||
{ 0, 2, 120, -7, 0, -11, 22, 2}, { 0, 2, 119, -8, 0, -12, 25, 2},
|
||||
{ 0, 3, 117, -8, 0, -13, 27, 2}, { 0, 3, 116, -9, 0, -13, 29, 2},
|
||||
{ 0, 3, 114, -10, 0, -14, 32, 3}, { 0, 3, 113, -10, 0, -15, 35, 2},
|
||||
{ 0, 3, 111, -11, 0, -15, 37, 3}, { 0, 3, 109, -11, 0, -16, 40, 3},
|
||||
{ 0, 3, 108, -12, 0, -16, 42, 3}, { 0, 4, 106, -13, 0, -17, 45, 3},
|
||||
{ 0, 4, 104, -13, 0, -17, 47, 3}, { 0, 4, 102, -14, 0, -17, 50, 3},
|
||||
{ 0, 4, 100, -14, 0, -17, 52, 3}, { 0, 4, 98, -15, 0, -18, 55, 4},
|
||||
{ 0, 4, 96, -15, 0, -18, 58, 3}, { 0, 4, 94, -16, 0, -18, 60, 4},
|
||||
{ 0, 4, 91, -16, 0, -18, 63, 4}, { 0, 4, 89, -16, 0, -18, 65, 4},
|
||||
{ 0, 4, 87, -17, 0, -18, 68, 4}, { 0, 4, 85, -17, 0, -18, 70, 4},
|
||||
{ 0, 4, 82, -17, 0, -18, 73, 4}, { 0, 4, 80, -17, 0, -18, 75, 4},
|
||||
{ 0, 4, 78, -18, 0, -18, 78, 4}, { 0, 4, 75, -18, 0, -17, 80, 4},
|
||||
{ 0, 4, 73, -18, 0, -17, 82, 4}, { 0, 4, 70, -18, 0, -17, 85, 4},
|
||||
{ 0, 4, 68, -18, 0, -17, 87, 4}, { 0, 4, 65, -18, 0, -16, 89, 4},
|
||||
{ 0, 4, 63, -18, 0, -16, 91, 4}, { 0, 4, 60, -18, 0, -16, 94, 4},
|
||||
{ 0, 3, 58, -18, 0, -15, 96, 4}, { 0, 4, 55, -18, 0, -15, 98, 4},
|
||||
{ 0, 3, 52, -17, 0, -14, 100, 4}, { 0, 3, 50, -17, 0, -14, 102, 4},
|
||||
{ 0, 3, 47, -17, 0, -13, 104, 4}, { 0, 3, 45, -17, 0, -13, 106, 4},
|
||||
{ 0, 3, 42, -16, 0, -12, 108, 3}, { 0, 3, 40, -16, 0, -11, 109, 3},
|
||||
{ 0, 3, 37, -15, 0, -11, 111, 3}, { 0, 2, 35, -15, 0, -10, 113, 3},
|
||||
{ 0, 3, 32, -14, 0, -10, 114, 3}, { 0, 2, 29, -13, 0, -9, 116, 3},
|
||||
{ 0, 2, 27, -13, 0, -8, 117, 3}, { 0, 2, 25, -12, 0, -8, 119, 2},
|
||||
{ 0, 2, 22, -11, 0, -7, 120, 2}, { 0, 1, 20, -10, 0, -6, 121, 2},
|
||||
{ 0, 1, 18, -9, 0, -6, 122, 2}, { 0, 1, 15, -8, 0, -5, 123, 2},
|
||||
{ 0, 1, 13, -7, 0, -4, 124, 1}, { 0, 1, 11, -6, 0, -4, 125, 1},
|
||||
{ 0, 1, 8, -5, 0, -3, 126, 1}, { 0, 1, 6, -4, 0, -2, 126, 1},
|
||||
{ 0, 0, 4, -3, 0, -1, 127, 1}, { 0, 0, 2, -1, 0, 0, 127, 0},
|
||||
// dummy (replicate row index 191)
|
||||
{ 0, 0, 2, -1, 0, 0, 127, 0},
|
||||
|
||||
#else
|
||||
// [-1, 0)
|
||||
{ 0, 127, 0, 0, 0, 1, 0, 0}, { 1, 127, -1, 0, -3, 4, 0, 0},
|
||||
{ 1, 126, -3, 0, -5, 8, 1, 0}, { 1, 124, -4, 0, -7, 13, 1, 0},
|
||||
{ 2, 122, -6, 0, -9, 18, 1, 0}, { 2, 120, -7, 0, -11, 22, 2, 0},
|
||||
{ 3, 117, -8, 0, -13, 27, 2, 0}, { 3, 114, -10, 0, -14, 32, 3, 0},
|
||||
{ 3, 111, -11, 0, -15, 37, 3, 0}, { 3, 108, -12, 0, -16, 42, 3, 0},
|
||||
{ 4, 104, -13, 0, -17, 47, 3, 0}, { 4, 100, -14, 0, -17, 52, 3, 0},
|
||||
{ 4, 96, -15, 0, -18, 58, 3, 0}, { 4, 91, -16, 0, -18, 63, 4, 0},
|
||||
{ 4, 87, -17, 0, -18, 68, 4, 0}, { 4, 82, -17, 0, -18, 73, 4, 0},
|
||||
{ 4, 78, -18, 0, -18, 78, 4, 0}, { 4, 73, -18, 0, -17, 82, 4, 0},
|
||||
{ 4, 68, -18, 0, -17, 87, 4, 0}, { 4, 63, -18, 0, -16, 91, 4, 0},
|
||||
{ 3, 58, -18, 0, -15, 96, 4, 0}, { 3, 52, -17, 0, -14, 100, 4, 0},
|
||||
{ 3, 47, -17, 0, -13, 104, 4, 0}, { 3, 42, -16, 0, -12, 108, 3, 0},
|
||||
{ 3, 37, -15, 0, -11, 111, 3, 0}, { 3, 32, -14, 0, -10, 114, 3, 0},
|
||||
{ 2, 27, -13, 0, -8, 117, 3, 0}, { 2, 22, -11, 0, -7, 120, 2, 0},
|
||||
{ 1, 18, -9, 0, -6, 122, 2, 0}, { 1, 13, -7, 0, -4, 124, 1, 0},
|
||||
{ 1, 8, -5, 0, -3, 126, 1, 0}, { 0, 4, -3, 0, -1, 127, 1, 0},
|
||||
// [0, 1)
|
||||
{ 0, 0, 1, 0, 0, 127, 0, 0}, { 0, -3, 4, 1, 1, 127, -2, 0},
|
||||
{ 0, -6, 8, 1, 2, 126, -3, 0}, {-1, -8, 13, 2, 3, 125, -5, -1},
|
||||
{-1, -11, 18, 3, 4, 123, -7, -1}, {-1, -13, 23, 3, 4, 121, -8, -1},
|
||||
{-1, -15, 27, 4, 5, 119, -10, -1}, {-2, -17, 33, 5, 6, 116, -12, -1},
|
||||
{-2, -18, 38, 5, 6, 113, -13, -1}, {-2, -19, 43, 6, 7, 110, -15, -2},
|
||||
{-2, -20, 49, 6, 7, 106, -16, -2}, {-2, -21, 54, 7, 7, 102, -17, -2},
|
||||
{-2, -22, 59, 7, 8, 98, -18, -2}, {-2, -22, 64, 7, 8, 94, -19, -2},
|
||||
{-2, -22, 69, 8, 8, 89, -20, -2}, {-2, -21, 74, 8, 8, 84, -21, -2},
|
||||
{-2, -21, 79, 8, 8, 79, -21, -2}, {-2, -21, 84, 8, 8, 74, -21, -2},
|
||||
{-2, -20, 89, 8, 8, 69, -22, -2}, {-2, -19, 94, 8, 7, 64, -22, -2},
|
||||
{-2, -18, 98, 8, 7, 59, -22, -2}, {-2, -17, 102, 7, 7, 54, -21, -2},
|
||||
{-2, -16, 106, 7, 6, 49, -20, -2}, {-2, -15, 110, 7, 6, 43, -19, -2},
|
||||
{-1, -13, 113, 6, 5, 38, -18, -2}, {-1, -12, 116, 6, 5, 33, -17, -2},
|
||||
{-1, -10, 119, 5, 4, 27, -15, -1}, {-1, -8, 121, 4, 3, 23, -13, -1},
|
||||
{-1, -7, 123, 4, 3, 18, -11, -1}, {-1, -5, 125, 3, 2, 13, -8, -1},
|
||||
{ 0, -3, 126, 2, 1, 8, -6, 0}, { 0, -2, 127, 1, 1, 4, -3, 0},
|
||||
// [1, 2)
|
||||
{ 0, 0, 127, 0, 0, 1, 0, 0}, { 0, 1, 127, -1, 0, -3, 4, 0},
|
||||
{ 0, 1, 126, -3, 0, -5, 8, 1}, { 0, 1, 124, -4, 0, -7, 13, 1},
|
||||
{ 0, 2, 122, -6, 0, -9, 18, 1}, { 0, 2, 120, -7, 0, -11, 22, 2},
|
||||
{ 0, 3, 117, -8, 0, -13, 27, 2}, { 0, 3, 114, -10, 0, -14, 32, 3},
|
||||
{ 0, 3, 111, -11, 0, -15, 37, 3}, { 0, 3, 108, -12, 0, -16, 42, 3},
|
||||
{ 0, 4, 104, -13, 0, -17, 47, 3}, { 0, 4, 100, -14, 0, -17, 52, 3},
|
||||
{ 0, 4, 96, -15, 0, -18, 58, 3}, { 0, 4, 91, -16, 0, -18, 63, 4},
|
||||
{ 0, 4, 87, -17, 0, -18, 68, 4}, { 0, 4, 82, -17, 0, -18, 73, 4},
|
||||
{ 0, 4, 78, -18, 0, -18, 78, 4}, { 0, 4, 73, -18, 0, -17, 82, 4},
|
||||
{ 0, 4, 68, -18, 0, -17, 87, 4}, { 0, 4, 63, -18, 0, -16, 91, 4},
|
||||
{ 0, 3, 58, -18, 0, -15, 96, 4}, { 0, 3, 52, -17, 0, -14, 100, 4},
|
||||
{ 0, 3, 47, -17, 0, -13, 104, 4}, { 0, 3, 42, -16, 0, -12, 108, 3},
|
||||
{ 0, 3, 37, -15, 0, -11, 111, 3}, { 0, 3, 32, -14, 0, -10, 114, 3},
|
||||
{ 0, 2, 27, -13, 0, -8, 117, 3}, { 0, 2, 22, -11, 0, -7, 120, 2},
|
||||
{ 0, 1, 18, -9, 0, -6, 122, 2}, { 0, 1, 13, -7, 0, -4, 124, 1},
|
||||
{ 0, 1, 8, -5, 0, -3, 126, 1}, { 0, 0, 4, -3, 0, -1, 127, 1},
|
||||
// dummy (replicate row index 95)
|
||||
{ 0, 0, 4, -3, 0, -1, 127, 1},
|
||||
#endif // WARPEDPIXEL_PREC_BITS == 6
|
||||
};
|
||||
/* clang-format on */
|
||||
|
||||
// Shuffle masks: we want to convert a sequence of bytes 0, 1, 2, ..., 15
|
||||
// in an SSE register into two sequences:
|
||||
// 0, 2, 2, 4, ..., 12, 12, 14, <don't care>
|
||||
// 1, 3, 3, 5, ..., 13, 13, 15, <don't care>
|
||||
static const uint8_t even_mask[16] = { 0, 2, 2, 4, 4, 6, 6, 8,
|
||||
8, 10, 10, 12, 12, 14, 14, 0 };
|
||||
static const uint8_t odd_mask[16] = { 1, 3, 3, 5, 5, 7, 7, 9,
|
||||
9, 11, 11, 13, 13, 15, 15, 0 };
|
||||
|
||||
void av1_warp_affine_ssse3(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, int comp_avg,
|
||||
int16_t alpha, int16_t beta, int16_t gamma,
|
||||
int16_t delta) {
|
||||
__m128i tmp[15];
|
||||
int i, j, k;
|
||||
const int bd = 8;
|
||||
|
||||
/* Note: For this code to work, the left/right frame borders need to be
|
||||
extended by at least 13 pixels each. By the time we get here, other
|
||||
code will have set up this border, but we allow an explicit check
|
||||
for debugging purposes.
|
||||
*/
|
||||
/*for (i = 0; i < height; ++i) {
|
||||
for (j = 0; j < 13; ++j) {
|
||||
assert(ref[i * stride - 13 + j] == ref[i * stride]);
|
||||
assert(ref[i * stride + width + j] == ref[i * stride + (width - 1)]);
|
||||
}
|
||||
}*/
|
||||
|
||||
for (i = 0; i < p_height; i += 8) {
|
||||
for (j = 0; j < p_width; j += 8) {
|
||||
// (x, y) coordinates of the center of this block in the destination
|
||||
// image
|
||||
const int32_t dst_x = p_col + j + 4;
|
||||
const int32_t dst_y = p_row + i + 4;
|
||||
|
||||
int32_t x4, y4, ix4, sx4, iy4, sy4;
|
||||
if (subsampling_x)
|
||||
x4 = (mat[2] * 4 * dst_x + mat[3] * 4 * dst_y + mat[0] * 2 +
|
||||
(mat[2] + mat[3] - (1 << WARPEDMODEL_PREC_BITS))) /
|
||||
4;
|
||||
else
|
||||
x4 = mat[2] * dst_x + mat[3] * dst_y + mat[0];
|
||||
|
||||
if (subsampling_y)
|
||||
y4 = (mat[4] * 4 * dst_x + mat[5] * 4 * dst_y + mat[1] * 2 +
|
||||
(mat[4] + mat[5] - (1 << WARPEDMODEL_PREC_BITS))) /
|
||||
4;
|
||||
else
|
||||
y4 = mat[4] * dst_x + mat[5] * dst_y + mat[1];
|
||||
|
||||
ix4 = x4 >> WARPEDMODEL_PREC_BITS;
|
||||
sx4 = x4 & ((1 << WARPEDMODEL_PREC_BITS) - 1);
|
||||
iy4 = y4 >> WARPEDMODEL_PREC_BITS;
|
||||
sy4 = y4 & ((1 << WARPEDMODEL_PREC_BITS) - 1);
|
||||
|
||||
// Add in all the constant terms, including rounding and offset
|
||||
sx4 += alpha * (-4) + beta * (-4) + (1 << (WARPEDDIFF_PREC_BITS - 1)) +
|
||||
(WARPEDPIXEL_PREC_SHIFTS << WARPEDDIFF_PREC_BITS);
|
||||
sy4 += gamma * (-4) + delta * (-4) + (1 << (WARPEDDIFF_PREC_BITS - 1)) +
|
||||
(WARPEDPIXEL_PREC_SHIFTS << WARPEDDIFF_PREC_BITS);
|
||||
|
||||
sx4 &= ~((1 << WARP_PARAM_REDUCE_BITS) - 1);
|
||||
sy4 &= ~((1 << WARP_PARAM_REDUCE_BITS) - 1);
|
||||
|
||||
// Horizontal filter
|
||||
// If the block is aligned such that, after clamping, every sample
|
||||
// would be taken from the leftmost/rightmost column, then we can
|
||||
// skip the expensive horizontal filter.
|
||||
if (ix4 <= -7) {
|
||||
for (k = -7; k < AOMMIN(8, p_height - i); ++k) {
|
||||
int iy = iy4 + k;
|
||||
if (iy < 0)
|
||||
iy = 0;
|
||||
else if (iy > height - 1)
|
||||
iy = height - 1;
|
||||
tmp[k + 7] = _mm_set1_epi16(
|
||||
(1 << (bd + WARPEDPIXEL_FILTER_BITS - HORSHEAR_REDUCE_PREC_BITS -
|
||||
1)) +
|
||||
ref[iy * stride] *
|
||||
(1 << (WARPEDPIXEL_FILTER_BITS - HORSHEAR_REDUCE_PREC_BITS)));
|
||||
}
|
||||
} else if (ix4 >= width + 6) {
|
||||
for (k = -7; k < AOMMIN(8, p_height - i); ++k) {
|
||||
int iy = iy4 + k;
|
||||
if (iy < 0)
|
||||
iy = 0;
|
||||
else if (iy > height - 1)
|
||||
iy = height - 1;
|
||||
tmp[k + 7] = _mm_set1_epi16(
|
||||
(1 << (bd + WARPEDPIXEL_FILTER_BITS - HORSHEAR_REDUCE_PREC_BITS -
|
||||
1)) +
|
||||
ref[iy * stride + (width - 1)] *
|
||||
(1 << (WARPEDPIXEL_FILTER_BITS - HORSHEAR_REDUCE_PREC_BITS)));
|
||||
}
|
||||
} else {
|
||||
for (k = -7; k < AOMMIN(8, p_height - i); ++k) {
|
||||
int iy = iy4 + k;
|
||||
if (iy < 0)
|
||||
iy = 0;
|
||||
else if (iy > height - 1)
|
||||
iy = height - 1;
|
||||
int sx = sx4 + beta * (k + 4);
|
||||
|
||||
// Load source pixels
|
||||
const __m128i src =
|
||||
_mm_loadu_si128((__m128i *)(ref + iy * stride + ix4 - 7));
|
||||
const __m128i src_even =
|
||||
_mm_shuffle_epi8(src, _mm_loadu_si128((__m128i *)even_mask));
|
||||
const __m128i src_odd =
|
||||
_mm_shuffle_epi8(src, _mm_loadu_si128((__m128i *)odd_mask));
|
||||
|
||||
// Filter even-index pixels
|
||||
const __m128i tmp_0 = _mm_loadl_epi64((
|
||||
__m128i *)&filter_8bit[(sx + 0 * alpha) >> WARPEDDIFF_PREC_BITS]);
|
||||
const __m128i tmp_1 = _mm_loadl_epi64((
|
||||
__m128i *)&filter_8bit[(sx + 1 * alpha) >> WARPEDDIFF_PREC_BITS]);
|
||||
const __m128i tmp_2 = _mm_loadl_epi64((
|
||||
__m128i *)&filter_8bit[(sx + 2 * alpha) >> WARPEDDIFF_PREC_BITS]);
|
||||
const __m128i tmp_3 = _mm_loadl_epi64((
|
||||
__m128i *)&filter_8bit[(sx + 3 * alpha) >> WARPEDDIFF_PREC_BITS]);
|
||||
const __m128i tmp_4 = _mm_loadl_epi64((
|
||||
__m128i *)&filter_8bit[(sx + 4 * alpha) >> WARPEDDIFF_PREC_BITS]);
|
||||
const __m128i tmp_5 = _mm_loadl_epi64((
|
||||
__m128i *)&filter_8bit[(sx + 5 * alpha) >> WARPEDDIFF_PREC_BITS]);
|
||||
const __m128i tmp_6 = _mm_loadl_epi64((
|
||||
__m128i *)&filter_8bit[(sx + 6 * alpha) >> WARPEDDIFF_PREC_BITS]);
|
||||
const __m128i tmp_7 = _mm_loadl_epi64((
|
||||
__m128i *)&filter_8bit[(sx + 7 * alpha) >> WARPEDDIFF_PREC_BITS]);
|
||||
|
||||
// Coeffs 0 2 0 2 4 6 4 6 1 3 1 3 5 7 5 7 for pixels 0 2
|
||||
const __m128i tmp_8 = _mm_unpacklo_epi16(tmp_0, tmp_2);
|
||||
// Coeffs 0 2 0 2 4 6 4 6 1 3 1 3 5 7 5 7 for pixels 1 3
|
||||
const __m128i tmp_9 = _mm_unpacklo_epi16(tmp_1, tmp_3);
|
||||
// Coeffs 0 2 0 2 4 6 4 6 1 3 1 3 5 7 5 7 for pixels 4 6
|
||||
const __m128i tmp_10 = _mm_unpacklo_epi16(tmp_4, tmp_6);
|
||||
// Coeffs 0 2 0 2 4 6 4 6 1 3 1 3 5 7 5 7 for pixels 5 7
|
||||
const __m128i tmp_11 = _mm_unpacklo_epi16(tmp_5, tmp_7);
|
||||
|
||||
// Coeffs 0 2 0 2 0 2 0 2 4 6 4 6 4 6 4 6 for pixels 0 2 4 6
|
||||
const __m128i tmp_12 = _mm_unpacklo_epi32(tmp_8, tmp_10);
|
||||
// Coeffs 1 3 1 3 1 3 1 3 5 7 5 7 5 7 5 7 for pixels 0 2 4 6
|
||||
const __m128i tmp_13 = _mm_unpackhi_epi32(tmp_8, tmp_10);
|
||||
// Coeffs 0 2 0 2 0 2 0 2 4 6 4 6 4 6 4 6 for pixels 1 3 5 7
|
||||
const __m128i tmp_14 = _mm_unpacklo_epi32(tmp_9, tmp_11);
|
||||
// Coeffs 1 3 1 3 1 3 1 3 5 7 5 7 5 7 5 7 for pixels 1 3 5 7
|
||||
const __m128i tmp_15 = _mm_unpackhi_epi32(tmp_9, tmp_11);
|
||||
|
||||
// Coeffs 0 2 for pixels 0 2 4 6 1 3 5 7
|
||||
const __m128i coeff_02 = _mm_unpacklo_epi64(tmp_12, tmp_14);
|
||||
// Coeffs 4 6 for pixels 0 2 4 6 1 3 5 7
|
||||
const __m128i coeff_46 = _mm_unpackhi_epi64(tmp_12, tmp_14);
|
||||
// Coeffs 1 3 for pixels 0 2 4 6 1 3 5 7
|
||||
const __m128i coeff_13 = _mm_unpacklo_epi64(tmp_13, tmp_15);
|
||||
// Coeffs 5 7 for pixels 0 2 4 6 1 3 5 7
|
||||
const __m128i coeff_57 = _mm_unpackhi_epi64(tmp_13, tmp_15);
|
||||
|
||||
// The pixel order we need for 'src' is:
|
||||
// 0 2 2 4 4 6 6 8 1 3 3 5 5 7 7 9
|
||||
const __m128i src_02 = _mm_unpacklo_epi64(src_even, src_odd);
|
||||
const __m128i res_02 = _mm_maddubs_epi16(src_02, coeff_02);
|
||||
// 4 6 6 8 8 10 10 12 5 7 7 9 9 11 11 13
|
||||
const __m128i src_46 = _mm_unpacklo_epi64(_mm_srli_si128(src_even, 4),
|
||||
_mm_srli_si128(src_odd, 4));
|
||||
const __m128i res_46 = _mm_maddubs_epi16(src_46, coeff_46);
|
||||
// 1 3 3 5 5 7 7 9 2 4 4 6 6 8 8 10
|
||||
const __m128i src_13 =
|
||||
_mm_unpacklo_epi64(src_odd, _mm_srli_si128(src_even, 2));
|
||||
const __m128i res_13 = _mm_maddubs_epi16(src_13, coeff_13);
|
||||
// 5 7 7 9 9 11 11 13 6 8 8 10 10 12 12 14
|
||||
const __m128i src_57 = _mm_unpacklo_epi64(
|
||||
_mm_srli_si128(src_odd, 4), _mm_srli_si128(src_even, 6));
|
||||
const __m128i res_57 = _mm_maddubs_epi16(src_57, coeff_57);
|
||||
|
||||
const __m128i round_const =
|
||||
_mm_set1_epi16((1 << (bd + WARPEDPIXEL_FILTER_BITS - 1)) +
|
||||
((1 << HORSHEAR_REDUCE_PREC_BITS) >> 1));
|
||||
|
||||
// Note: The values res_02 + res_46 and res_13 + res_57 both
|
||||
// fit into int16s at this point, but their sum may be too wide to fit
|
||||
// into an int16. However, once we also add round_const, the sum of
|
||||
// all of these fits into a uint16.
|
||||
//
|
||||
// The wrapping behaviour of _mm_add_* is used here to make sure we
|
||||
// get the correct result despite converting between different
|
||||
// (implicit) types.
|
||||
const __m128i res_even = _mm_add_epi16(res_02, res_46);
|
||||
const __m128i res_odd = _mm_add_epi16(res_13, res_57);
|
||||
const __m128i res =
|
||||
_mm_add_epi16(_mm_add_epi16(res_even, res_odd), round_const);
|
||||
tmp[k + 7] = _mm_srli_epi16(res, HORSHEAR_REDUCE_PREC_BITS);
|
||||
}
|
||||
}
|
||||
|
||||
// Vertical filter
|
||||
for (k = -4; k < AOMMIN(4, p_height - i - 4); ++k) {
|
||||
int sy = sy4 + delta * (k + 4);
|
||||
|
||||
// Load from tmp and rearrange pairs of consecutive rows into the
|
||||
// column order 0 0 2 2 4 4 6 6; 1 1 3 3 5 5 7 7
|
||||
const __m128i *src = tmp + (k + 4);
|
||||
const __m128i src_0 = _mm_unpacklo_epi16(src[0], src[1]);
|
||||
const __m128i src_2 = _mm_unpacklo_epi16(src[2], src[3]);
|
||||
const __m128i src_4 = _mm_unpacklo_epi16(src[4], src[5]);
|
||||
const __m128i src_6 = _mm_unpacklo_epi16(src[6], src[7]);
|
||||
|
||||
// Filter even-index pixels
|
||||
const __m128i tmp_0 = _mm_loadu_si128(
|
||||
(__m128i *)(warped_filter +
|
||||
((sy + 0 * gamma) >> WARPEDDIFF_PREC_BITS)));
|
||||
const __m128i tmp_2 = _mm_loadu_si128(
|
||||
(__m128i *)(warped_filter +
|
||||
((sy + 2 * gamma) >> WARPEDDIFF_PREC_BITS)));
|
||||
const __m128i tmp_4 = _mm_loadu_si128(
|
||||
(__m128i *)(warped_filter +
|
||||
((sy + 4 * gamma) >> WARPEDDIFF_PREC_BITS)));
|
||||
const __m128i tmp_6 = _mm_loadu_si128(
|
||||
(__m128i *)(warped_filter +
|
||||
((sy + 6 * gamma) >> WARPEDDIFF_PREC_BITS)));
|
||||
|
||||
const __m128i tmp_8 = _mm_unpacklo_epi32(tmp_0, tmp_2);
|
||||
const __m128i tmp_10 = _mm_unpacklo_epi32(tmp_4, tmp_6);
|
||||
const __m128i tmp_12 = _mm_unpackhi_epi32(tmp_0, tmp_2);
|
||||
const __m128i tmp_14 = _mm_unpackhi_epi32(tmp_4, tmp_6);
|
||||
|
||||
const __m128i coeff_0 = _mm_unpacklo_epi64(tmp_8, tmp_10);
|
||||
const __m128i coeff_2 = _mm_unpackhi_epi64(tmp_8, tmp_10);
|
||||
const __m128i coeff_4 = _mm_unpacklo_epi64(tmp_12, tmp_14);
|
||||
const __m128i coeff_6 = _mm_unpackhi_epi64(tmp_12, tmp_14);
|
||||
|
||||
const __m128i res_0 = _mm_madd_epi16(src_0, coeff_0);
|
||||
const __m128i res_2 = _mm_madd_epi16(src_2, coeff_2);
|
||||
const __m128i res_4 = _mm_madd_epi16(src_4, coeff_4);
|
||||
const __m128i res_6 = _mm_madd_epi16(src_6, coeff_6);
|
||||
|
||||
const __m128i res_even = _mm_add_epi32(_mm_add_epi32(res_0, res_2),
|
||||
_mm_add_epi32(res_4, res_6));
|
||||
|
||||
// Filter odd-index pixels
|
||||
const __m128i src_1 = _mm_unpackhi_epi16(src[0], src[1]);
|
||||
const __m128i src_3 = _mm_unpackhi_epi16(src[2], src[3]);
|
||||
const __m128i src_5 = _mm_unpackhi_epi16(src[4], src[5]);
|
||||
const __m128i src_7 = _mm_unpackhi_epi16(src[6], src[7]);
|
||||
|
||||
const __m128i tmp_1 = _mm_loadu_si128(
|
||||
(__m128i *)(warped_filter +
|
||||
((sy + 1 * gamma) >> WARPEDDIFF_PREC_BITS)));
|
||||
const __m128i tmp_3 = _mm_loadu_si128(
|
||||
(__m128i *)(warped_filter +
|
||||
((sy + 3 * gamma) >> WARPEDDIFF_PREC_BITS)));
|
||||
const __m128i tmp_5 = _mm_loadu_si128(
|
||||
(__m128i *)(warped_filter +
|
||||
((sy + 5 * gamma) >> WARPEDDIFF_PREC_BITS)));
|
||||
const __m128i tmp_7 = _mm_loadu_si128(
|
||||
(__m128i *)(warped_filter +
|
||||
((sy + 7 * gamma) >> WARPEDDIFF_PREC_BITS)));
|
||||
|
||||
const __m128i tmp_9 = _mm_unpacklo_epi32(tmp_1, tmp_3);
|
||||
const __m128i tmp_11 = _mm_unpacklo_epi32(tmp_5, tmp_7);
|
||||
const __m128i tmp_13 = _mm_unpackhi_epi32(tmp_1, tmp_3);
|
||||
const __m128i tmp_15 = _mm_unpackhi_epi32(tmp_5, tmp_7);
|
||||
|
||||
const __m128i coeff_1 = _mm_unpacklo_epi64(tmp_9, tmp_11);
|
||||
const __m128i coeff_3 = _mm_unpackhi_epi64(tmp_9, tmp_11);
|
||||
const __m128i coeff_5 = _mm_unpacklo_epi64(tmp_13, tmp_15);
|
||||
const __m128i coeff_7 = _mm_unpackhi_epi64(tmp_13, tmp_15);
|
||||
|
||||
const __m128i res_1 = _mm_madd_epi16(src_1, coeff_1);
|
||||
const __m128i res_3 = _mm_madd_epi16(src_3, coeff_3);
|
||||
const __m128i res_5 = _mm_madd_epi16(src_5, coeff_5);
|
||||
const __m128i res_7 = _mm_madd_epi16(src_7, coeff_7);
|
||||
|
||||
const __m128i res_odd = _mm_add_epi32(_mm_add_epi32(res_1, res_3),
|
||||
_mm_add_epi32(res_5, res_7));
|
||||
|
||||
// Rearrange pixels back into the order 0 ... 7
|
||||
const __m128i res_lo = _mm_unpacklo_epi32(res_even, res_odd);
|
||||
const __m128i res_hi = _mm_unpackhi_epi32(res_even, res_odd);
|
||||
|
||||
// Round and pack into 8 bits
|
||||
const __m128i round_const =
|
||||
_mm_set1_epi32(-(1 << (bd + VERSHEAR_REDUCE_PREC_BITS - 1)) +
|
||||
((1 << VERSHEAR_REDUCE_PREC_BITS) >> 1));
|
||||
|
||||
const __m128i res_lo_round = _mm_srai_epi32(
|
||||
_mm_add_epi32(res_lo, round_const), VERSHEAR_REDUCE_PREC_BITS);
|
||||
const __m128i res_hi_round = _mm_srai_epi32(
|
||||
_mm_add_epi32(res_hi, round_const), VERSHEAR_REDUCE_PREC_BITS);
|
||||
|
||||
const __m128i res_16bit = _mm_packs_epi32(res_lo_round, res_hi_round);
|
||||
__m128i res_8bit = _mm_packus_epi16(res_16bit, res_16bit);
|
||||
|
||||
// Store, blending with 'pred' if needed
|
||||
__m128i *const p = (__m128i *)&pred[(i + k + 4) * p_stride + j];
|
||||
|
||||
// Note: If we're outputting a 4x4 block, we need to be very careful
|
||||
// to only output 4 pixels at this point, to avoid encode/decode
|
||||
// mismatches when encoding with multiple threads.
|
||||
if (p_width == 4) {
|
||||
if (comp_avg) {
|
||||
const __m128i orig = _mm_cvtsi32_si128(*(uint32_t *)p);
|
||||
res_8bit = _mm_avg_epu8(res_8bit, orig);
|
||||
}
|
||||
*(uint32_t *)p = _mm_cvtsi128_si32(res_8bit);
|
||||
} else {
|
||||
if (comp_avg) res_8bit = _mm_avg_epu8(res_8bit, _mm_loadl_epi64(p));
|
||||
_mm_storel_epi64(p, res_8bit);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
610
third_party/aom/av1/decoder/decodeframe.c
vendored
610
third_party/aom/av1/decoder/decodeframe.c
vendored
File diff suppressed because it is too large
Load diff
650
third_party/aom/av1/decoder/decodemv.c
vendored
650
third_party/aom/av1/decoder/decodemv.c
vendored
File diff suppressed because it is too large
Load diff
2
third_party/aom/av1/decoder/decoder.c
vendored
2
third_party/aom/av1/decoder/decoder.c
vendored
|
|
@ -50,7 +50,6 @@ static void initialize_dec(void) {
|
|||
av1_init_wedge_masks();
|
||||
#endif // CONFIG_EXT_INTER
|
||||
init_done = 1;
|
||||
#if CONFIG_EC_MULTISYMBOL
|
||||
av1_indices_from_tree(av1_intra_mode_ind, av1_intra_mode_inv,
|
||||
av1_intra_mode_tree);
|
||||
av1_indices_from_tree(av1_switchable_interp_ind, av1_switchable_interp_inv,
|
||||
|
|
@ -68,7 +67,6 @@ static void initialize_dec(void) {
|
|||
#endif
|
||||
av1_indices_from_tree(av1_inter_mode_ind, av1_inter_mode_inv,
|
||||
av1_inter_mode_tree);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
2
third_party/aom/av1/decoder/decoder.h
vendored
2
third_party/aom/av1/decoder/decoder.h
vendored
|
|
@ -203,7 +203,7 @@ static INLINE void decrease_ref_count(int idx, RefCntBuffer *const frame_bufs,
|
|||
}
|
||||
}
|
||||
|
||||
#if CONFIG_EXT_REFS
|
||||
#if CONFIG_EXT_REFS || CONFIG_TEMPMV_SIGNALING
|
||||
static INLINE int dec_is_ref_frame_buf(AV1Decoder *const pbi,
|
||||
RefCntBuffer *frame_buf) {
|
||||
AV1_COMMON *const cm = &pbi->common;
|
||||
|
|
|
|||
2
third_party/aom/av1/decoder/decodetxb.c
vendored
2
third_party/aom/av1/decoder/decodetxb.c
vendored
|
|
@ -169,7 +169,7 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
|
|||
sign = aom_read_bit(r, ACCT_STR);
|
||||
}
|
||||
|
||||
ctx = get_level_ctx(tcoeffs, scan[c], bwl);
|
||||
ctx = get_br_ctx(tcoeffs, scan[c], bwl);
|
||||
|
||||
if (cm->fc->coeff_lps[tx_size][plane_type][ctx] == 0) exit(0);
|
||||
|
||||
|
|
|
|||
122
third_party/aom/av1/decoder/detokenize.c
vendored
122
third_party/aom/av1/decoder/detokenize.c
vendored
|
|
@ -106,7 +106,7 @@ static int decode_coefs(MACROBLOCKD *xd, PLANE_TYPE type, tran_low_t *dqcoeff,
|
|||
dequant_val_type_nuq *dq_val,
|
||||
#endif // CONFIG_NEW_QUANT
|
||||
#if CONFIG_AOM_QM
|
||||
const qm_val_t *iqm[2][TX_SIZES],
|
||||
const qm_val_t *iqm[2][TX_SIZES_ALL],
|
||||
#endif // CONFIG_AOM_QM
|
||||
int ctx, const int16_t *scan, const int16_t *nb,
|
||||
int16_t *max_scan_line, aom_reader *r) {
|
||||
|
|
@ -123,7 +123,6 @@ static int decode_coefs(MACROBLOCKD *xd, PLANE_TYPE type, tran_low_t *dqcoeff,
|
|||
#endif // CONFIG_AOM_QM
|
||||
int band, c = 0;
|
||||
const int tx_size_ctx = txsize_sqr_map[tx_size];
|
||||
#if CONFIG_NEW_TOKENSET
|
||||
aom_cdf_prob(*coef_head_cdfs)[COEFF_CONTEXTS][CDF_SIZE(ENTROPY_TOKENS)] =
|
||||
ec_ctx->coef_head_cdfs[tx_size_ctx][type][ref];
|
||||
aom_cdf_prob(*coef_tail_cdfs)[COEFF_CONTEXTS][CDF_SIZE(ENTROPY_TOKENS)] =
|
||||
|
|
@ -135,18 +134,6 @@ static int decode_coefs(MACROBLOCKD *xd, PLANE_TYPE type, tran_low_t *dqcoeff,
|
|||
unsigned int(*coef_counts)[COEFF_CONTEXTS][UNCONSTRAINED_NODES + 1] = NULL;
|
||||
unsigned int(*eob_branch_count)[COEFF_CONTEXTS] = NULL;
|
||||
#endif
|
||||
#else
|
||||
aom_prob(*coef_probs)[COEFF_CONTEXTS][UNCONSTRAINED_NODES] =
|
||||
ec_ctx->coef_probs[tx_size_ctx][type][ref];
|
||||
const aom_prob *prob;
|
||||
#if CONFIG_EC_MULTISYMBOL
|
||||
aom_cdf_prob(*coef_cdfs)[COEFF_CONTEXTS][CDF_SIZE(ENTROPY_TOKENS)] =
|
||||
ec_ctx->coef_cdfs[tx_size_ctx][type][ref];
|
||||
aom_cdf_prob(*cdf)[CDF_SIZE(ENTROPY_TOKENS)];
|
||||
#endif // CONFIG_EC_MULTISYMBOL
|
||||
unsigned int(*coef_counts)[COEFF_CONTEXTS][UNCONSTRAINED_NODES + 1] = NULL;
|
||||
unsigned int(*eob_branch_count)[COEFF_CONTEXTS] = NULL;
|
||||
#endif // CONFIG_NEW_TOKENSET
|
||||
uint8_t token_cache[MAX_TX_SQUARE];
|
||||
const uint8_t *band_translate = get_band_translate(tx_size);
|
||||
int dq_shift;
|
||||
|
|
@ -156,23 +143,17 @@ static int decode_coefs(MACROBLOCKD *xd, PLANE_TYPE type, tran_low_t *dqcoeff,
|
|||
const tran_low_t *dqv_val = &dq_val[0][0];
|
||||
#endif // CONFIG_NEW_QUANT
|
||||
(void)tx_type;
|
||||
#if CONFIG_AOM_QM
|
||||
(void)iqmatrix;
|
||||
#endif // CONFIG_AOM_QM
|
||||
|
||||
if (counts) {
|
||||
#if !CONFIG_NEW_TOKENSET || !CONFIG_EC_ADAPT
|
||||
#if !CONFIG_EC_ADAPT
|
||||
coef_counts = counts->coef[tx_size_ctx][type][ref];
|
||||
eob_branch_count = counts->eob_branch[tx_size_ctx][type][ref];
|
||||
#endif
|
||||
#if CONFIG_NEW_TOKENSET && !CONFIG_EC_ADAPT
|
||||
blockz_count = counts->blockz_count[tx_size_ctx][type][ref][ctx];
|
||||
#endif
|
||||
}
|
||||
|
||||
dq_shift = av1_get_tx_scale(tx_size);
|
||||
|
||||
#if CONFIG_NEW_TOKENSET
|
||||
band = *band_translate++;
|
||||
|
||||
int more_data = 1;
|
||||
|
|
@ -238,12 +219,7 @@ static int decode_coefs(MACROBLOCKD *xd, PLANE_TYPE type, tran_low_t *dqcoeff,
|
|||
*max_scan_line = AOMMAX(*max_scan_line, scan[c]);
|
||||
token_cache[scan[c]] = av1_pt_energy_class[token];
|
||||
|
||||
val = token_to_value(r, token, tx_size,
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
xd->bd);
|
||||
#else
|
||||
8);
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
val = token_to_value(r, token, tx_size, xd->bd);
|
||||
|
||||
#if CONFIG_NEW_QUANT
|
||||
v = av1_dequant_abscoeff_nuq(val, dqv, dqv_val);
|
||||
|
|
@ -258,11 +234,7 @@ static int decode_coefs(MACROBLOCKD *xd, PLANE_TYPE type, tran_low_t *dqcoeff,
|
|||
|
||||
v = aom_read_bit(r, ACCT_STR) ? -v : v;
|
||||
#if CONFIG_COEFFICIENT_RANGE_CHECKING
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
check_range(v, xd->bd);
|
||||
#else
|
||||
check_range(v, 8);
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
#endif // CONFIG_COEFFICIENT_RANGE_CHECKING
|
||||
|
||||
dqcoeff[scan[c]] = v;
|
||||
|
|
@ -273,94 +245,6 @@ static int decode_coefs(MACROBLOCKD *xd, PLANE_TYPE type, tran_low_t *dqcoeff,
|
|||
dqv = dq[1];
|
||||
ctx = get_coef_context(nb, token_cache, c);
|
||||
band = *band_translate++;
|
||||
|
||||
#else // CONFIG_NEW_TOKENSET
|
||||
while (c < max_eob) {
|
||||
int val = -1;
|
||||
band = *band_translate++;
|
||||
prob = coef_probs[band][ctx];
|
||||
if (counts) ++eob_branch_count[band][ctx];
|
||||
if (!aom_read(r, prob[EOB_CONTEXT_NODE], ACCT_STR)) {
|
||||
INCREMENT_COUNT(EOB_MODEL_TOKEN);
|
||||
break;
|
||||
}
|
||||
|
||||
#if CONFIG_NEW_QUANT
|
||||
dqv_val = &dq_val[band][0];
|
||||
#endif // CONFIG_NEW_QUANT
|
||||
|
||||
while (!aom_read(r, prob[ZERO_CONTEXT_NODE], ACCT_STR)) {
|
||||
INCREMENT_COUNT(ZERO_TOKEN);
|
||||
dqv = dq[1];
|
||||
token_cache[scan[c]] = 0;
|
||||
++c;
|
||||
if (c >= max_eob) return c; // zero tokens at the end (no eob token)
|
||||
ctx = get_coef_context(nb, token_cache, c);
|
||||
band = *band_translate++;
|
||||
prob = coef_probs[band][ctx];
|
||||
#if CONFIG_NEW_QUANT
|
||||
dqv_val = &dq_val[band][0];
|
||||
#endif // CONFIG_NEW_QUANT
|
||||
}
|
||||
|
||||
*max_scan_line = AOMMAX(*max_scan_line, scan[c]);
|
||||
|
||||
#if CONFIG_EC_MULTISYMBOL
|
||||
cdf = &coef_cdfs[band][ctx];
|
||||
token = ONE_TOKEN +
|
||||
aom_read_symbol(r, *cdf, CATEGORY6_TOKEN - ONE_TOKEN + 1, ACCT_STR);
|
||||
INCREMENT_COUNT(ONE_TOKEN + (token > ONE_TOKEN));
|
||||
assert(token != ZERO_TOKEN);
|
||||
val = token_to_value(r, token, tx_size,
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
xd->bd);
|
||||
#else
|
||||
8);
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
#else // CONFIG_EC_MULTISYMBOL
|
||||
if (!aom_read(r, prob[ONE_CONTEXT_NODE], ACCT_STR)) {
|
||||
INCREMENT_COUNT(ONE_TOKEN);
|
||||
token = ONE_TOKEN;
|
||||
val = 1;
|
||||
} else {
|
||||
INCREMENT_COUNT(TWO_TOKEN);
|
||||
token = aom_read_tree(r, av1_coef_con_tree,
|
||||
av1_pareto8_full[prob[PIVOT_NODE] - 1], ACCT_STR);
|
||||
assert(token != ZERO_TOKEN && token != ONE_TOKEN);
|
||||
val = token_to_value(r, token, tx_size,
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
xd->bd);
|
||||
#else
|
||||
8);
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
}
|
||||
#endif // CONFIG_EC_MULTISYMBOL
|
||||
#if CONFIG_NEW_QUANT
|
||||
v = av1_dequant_abscoeff_nuq(val, dqv, dqv_val);
|
||||
v = dq_shift ? ROUND_POWER_OF_TWO(v, dq_shift) : v;
|
||||
#else
|
||||
#if CONFIG_AOM_QM
|
||||
dqv = ((iqmatrix[scan[c]] * (int)dqv) + (1 << (AOM_QM_BITS - 1))) >>
|
||||
AOM_QM_BITS;
|
||||
#endif
|
||||
v = (val * dqv) >> dq_shift;
|
||||
#endif // CONFIG_NEW_QUANT
|
||||
|
||||
#if CONFIG_COEFFICIENT_RANGE_CHECKING
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
dqcoeff[scan[c]] =
|
||||
highbd_check_range((aom_read_bit(r, ACCT_STR) ? -v : v), xd->bd);
|
||||
#else
|
||||
dqcoeff[scan[c]] = check_range(aom_read_bit(r, ACCT_STR) ? -v : v, 8);
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
#else
|
||||
dqcoeff[scan[c]] = aom_read_bit(r, ACCT_STR) ? -v : v;
|
||||
#endif // CONFIG_COEFFICIENT_RANGE_CHECKING
|
||||
token_cache[scan[c]] = av1_pt_energy_class[token];
|
||||
++c;
|
||||
ctx = get_coef_context(nb, token_cache, c);
|
||||
dqv = dq[1];
|
||||
#endif // CONFIG_NEW_TOKENSET
|
||||
}
|
||||
|
||||
return c;
|
||||
|
|
|
|||
13
third_party/aom/av1/decoder/inspection.c
vendored
13
third_party/aom/av1/decoder/inspection.c
vendored
|
|
@ -14,6 +14,9 @@
|
|||
#if CONFIG_CDEF
|
||||
#include "av1/common/cdef.h"
|
||||
#endif
|
||||
#if CONFIG_CFL
|
||||
#include "av1/common/cfl.h"
|
||||
#endif
|
||||
|
||||
void ifd_init(insp_frame_data *fd, int frame_width, int frame_height) {
|
||||
fd->mi_cols = ALIGN_POWER_OF_TWO(frame_width, 3) >> MI_SIZE_LOG2;
|
||||
|
|
@ -96,6 +99,16 @@ int ifd_inspect(insp_frame_data *fd, void *decoder) {
|
|||
mi->cdef_strength =
|
||||
cm->cdef_strengths[mbmi->cdef_strength] % CLPF_STRENGTHS;
|
||||
mi->cdef_strength += mi->cdef_strength == 3;
|
||||
#endif
|
||||
#if CONFIG_CFL
|
||||
if (mbmi->uv_mode == DC_PRED) {
|
||||
mi->cfl_alpha_idx = mbmi->cfl_alpha_idx;
|
||||
mi->cfl_alpha_sign = (mbmi->cfl_alpha_signs[CFL_PRED_V] << CFL_PRED_V) +
|
||||
mbmi->cfl_alpha_signs[CFL_PRED_U];
|
||||
} else {
|
||||
mi->cfl_alpha_idx = 0;
|
||||
mi->cfl_alpha_sign = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
|||
5
third_party/aom/av1/decoder/inspection.h
vendored
5
third_party/aom/av1/decoder/inspection.h
vendored
|
|
@ -15,6 +15,7 @@
|
|||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
#include "av1/common/seg_common.h"
|
||||
#if CONFIG_ACCOUNTING
|
||||
#include "av1/decoder/accounting.h"
|
||||
#endif
|
||||
|
|
@ -49,6 +50,10 @@ struct insp_mi_data {
|
|||
int8_t cdef_level;
|
||||
int8_t cdef_strength;
|
||||
#endif
|
||||
#if CONFIG_CFL
|
||||
int8_t cfl_alpha_idx;
|
||||
int8_t cfl_alpha_sign;
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef struct insp_frame_data insp_frame_data;
|
||||
|
|
|
|||
|
|
@ -39,10 +39,10 @@ static int aom_decode_pvq_split_(aom_reader *r, od_pvq_codeword_ctx *adapt,
|
|||
count += msbs << shift;
|
||||
if (count > sum) {
|
||||
count = sum;
|
||||
#if CONFIG_DAALA_EC
|
||||
#if !CONFIG_ANS
|
||||
r->ec.error = 1;
|
||||
#else
|
||||
# error "CONFIG_PVQ currently requires CONFIG_DAALA_EC."
|
||||
# error "CONFIG_PVQ currently requires !CONFIG_ANS."
|
||||
#endif
|
||||
}
|
||||
return count;
|
||||
|
|
|
|||
|
|
@ -353,8 +353,8 @@ void av1_cyclic_refresh_check_golden_update(AV1_COMP *const cpi) {
|
|||
// frame because of the camera movement, set this frame as the golden frame.
|
||||
// Use 70% and 5% as the thresholds for golden frame refreshing.
|
||||
// Also, force this frame as a golden update frame if this frame will change
|
||||
// the resolution (resize_pending != 0).
|
||||
if (cpi->resize_pending != 0 ||
|
||||
// the resolution (av1_resize_pending != 0).
|
||||
if (av1_resize_pending(cpi) ||
|
||||
(cnt1 * 10 > (70 * rows * cols) && cnt2 * 20 < cnt1)) {
|
||||
av1_cyclic_refresh_set_golden_update(cpi);
|
||||
rc->frames_till_gf_update_due = rc->baseline_gf_interval;
|
||||
|
|
|
|||
54
third_party/aom/av1/encoder/av1_quantize.c
vendored
54
third_party/aom/av1/encoder/av1_quantize.c
vendored
|
|
@ -1594,50 +1594,48 @@ static int get_qzbin_factor(int q, aom_bit_depth_t bit_depth) {
|
|||
#endif
|
||||
}
|
||||
|
||||
void av1_init_quantizer(AV1_COMP *cpi) {
|
||||
AV1_COMMON *const cm = &cpi->common;
|
||||
QUANTS *const quants = &cpi->quants;
|
||||
void av1_build_quantizer(aom_bit_depth_t bit_depth, int y_dc_delta_q,
|
||||
int uv_dc_delta_q, int uv_ac_delta_q,
|
||||
QUANTS *const quants, Dequants *const deq) {
|
||||
int i, q, quant;
|
||||
#if CONFIG_NEW_QUANT
|
||||
int dq;
|
||||
#endif
|
||||
|
||||
for (q = 0; q < QINDEX_RANGE; q++) {
|
||||
const int qzbin_factor = get_qzbin_factor(q, cm->bit_depth);
|
||||
const int qzbin_factor = get_qzbin_factor(q, bit_depth);
|
||||
const int qrounding_factor = q == 0 ? 64 : 48;
|
||||
|
||||
for (i = 0; i < 2; ++i) {
|
||||
int qrounding_factor_fp = 64;
|
||||
// y
|
||||
quant = i == 0 ? av1_dc_quant(q, cm->y_dc_delta_q, cm->bit_depth)
|
||||
: av1_ac_quant(q, 0, cm->bit_depth);
|
||||
quant = i == 0 ? av1_dc_quant(q, y_dc_delta_q, bit_depth)
|
||||
: av1_ac_quant(q, 0, bit_depth);
|
||||
invert_quant(&quants->y_quant[q][i], &quants->y_quant_shift[q][i], quant);
|
||||
quants->y_quant_fp[q][i] = (1 << 16) / quant;
|
||||
quants->y_round_fp[q][i] = (qrounding_factor_fp * quant) >> 7;
|
||||
quants->y_zbin[q][i] = ROUND_POWER_OF_TWO(qzbin_factor * quant, 7);
|
||||
quants->y_round[q][i] = (qrounding_factor * quant) >> 7;
|
||||
cpi->y_dequant[q][i] = quant;
|
||||
deq->y_dequant[q][i] = quant;
|
||||
|
||||
// uv
|
||||
quant = i == 0 ? av1_dc_quant(q, cm->uv_dc_delta_q, cm->bit_depth)
|
||||
: av1_ac_quant(q, cm->uv_ac_delta_q, cm->bit_depth);
|
||||
quant = i == 0 ? av1_dc_quant(q, uv_dc_delta_q, bit_depth)
|
||||
: av1_ac_quant(q, uv_ac_delta_q, bit_depth);
|
||||
invert_quant(&quants->uv_quant[q][i], &quants->uv_quant_shift[q][i],
|
||||
quant);
|
||||
quants->uv_quant_fp[q][i] = (1 << 16) / quant;
|
||||
quants->uv_round_fp[q][i] = (qrounding_factor_fp * quant) >> 7;
|
||||
quants->uv_zbin[q][i] = ROUND_POWER_OF_TWO(qzbin_factor * quant, 7);
|
||||
quants->uv_round[q][i] = (qrounding_factor * quant) >> 7;
|
||||
cpi->uv_dequant[q][i] = quant;
|
||||
deq->uv_dequant[q][i] = quant;
|
||||
}
|
||||
|
||||
#if CONFIG_NEW_QUANT
|
||||
int dq;
|
||||
for (dq = 0; dq < QUANT_PROFILES; dq++) {
|
||||
for (i = 0; i < COEF_BANDS; i++) {
|
||||
const int y_quant = cpi->y_dequant[q][i != 0];
|
||||
const int uvquant = cpi->uv_dequant[q][i != 0];
|
||||
av1_get_dequant_val_nuq(y_quant, i, cpi->y_dequant_val_nuq[dq][q][i],
|
||||
const int y_quant = deq->y_dequant[q][i != 0];
|
||||
const int uvquant = deq->uv_dequant[q][i != 0];
|
||||
av1_get_dequant_val_nuq(y_quant, i, deq->y_dequant_val_nuq[dq][q][i],
|
||||
quants->y_cuml_bins_nuq[dq][q][i], dq);
|
||||
av1_get_dequant_val_nuq(uvquant, i, cpi->uv_dequant_val_nuq[dq][q][i],
|
||||
av1_get_dequant_val_nuq(uvquant, i, deq->uv_dequant_val_nuq[dq][q][i],
|
||||
quants->uv_cuml_bins_nuq[dq][q][i], dq);
|
||||
}
|
||||
}
|
||||
|
|
@ -1650,7 +1648,7 @@ void av1_init_quantizer(AV1_COMP *cpi) {
|
|||
quants->y_quant_shift[q][i] = quants->y_quant_shift[q][1];
|
||||
quants->y_zbin[q][i] = quants->y_zbin[q][1];
|
||||
quants->y_round[q][i] = quants->y_round[q][1];
|
||||
cpi->y_dequant[q][i] = cpi->y_dequant[q][1];
|
||||
deq->y_dequant[q][i] = deq->y_dequant[q][1];
|
||||
|
||||
quants->uv_quant[q][i] = quants->uv_quant[q][1];
|
||||
quants->uv_quant_fp[q][i] = quants->uv_quant_fp[q][1];
|
||||
|
|
@ -1658,11 +1656,19 @@ void av1_init_quantizer(AV1_COMP *cpi) {
|
|||
quants->uv_quant_shift[q][i] = quants->uv_quant_shift[q][1];
|
||||
quants->uv_zbin[q][i] = quants->uv_zbin[q][1];
|
||||
quants->uv_round[q][i] = quants->uv_round[q][1];
|
||||
cpi->uv_dequant[q][i] = cpi->uv_dequant[q][1];
|
||||
deq->uv_dequant[q][i] = deq->uv_dequant[q][1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void av1_init_quantizer(AV1_COMP *cpi) {
|
||||
AV1_COMMON *const cm = &cpi->common;
|
||||
QUANTS *const quants = &cpi->quants;
|
||||
Dequants *const dequants = &cpi->dequants;
|
||||
av1_build_quantizer(cm->bit_depth, cm->y_dc_delta_q, cm->uv_dc_delta_q,
|
||||
cm->uv_ac_delta_q, quants, dequants);
|
||||
}
|
||||
|
||||
void av1_init_plane_quantizers(const AV1_COMP *cpi, MACROBLOCK *x,
|
||||
int segment_id) {
|
||||
const AV1_COMMON *const cm = &cpi->common;
|
||||
|
|
@ -1712,11 +1718,12 @@ void av1_init_plane_quantizers(const AV1_COMP *cpi, MACROBLOCK *x,
|
|||
memcpy(&xd->plane[0].seg_iqmatrix[segment_id], cm->giqmatrix[qmlevel][0],
|
||||
sizeof(cm->giqmatrix[qmlevel][0]));
|
||||
#endif
|
||||
xd->plane[0].dequant = cpi->y_dequant[qindex];
|
||||
xd->plane[0].dequant = cpi->dequants.y_dequant[qindex];
|
||||
#if CONFIG_NEW_QUANT
|
||||
for (dq = 0; dq < QUANT_PROFILES; dq++) {
|
||||
x->plane[0].cuml_bins_nuq[dq] = quants->y_cuml_bins_nuq[dq][qindex];
|
||||
xd->plane[0].dequant_val_nuq[dq] = cpi->y_dequant_val_nuq[dq][qindex];
|
||||
xd->plane[0].dequant_val_nuq[dq] =
|
||||
cpi->dequants.y_dequant_val_nuq[dq][qindex];
|
||||
}
|
||||
#endif // CONFIG_NEW_QUANT
|
||||
|
||||
|
|
@ -1734,11 +1741,12 @@ void av1_init_plane_quantizers(const AV1_COMP *cpi, MACROBLOCK *x,
|
|||
memcpy(&xd->plane[i].seg_iqmatrix[segment_id], cm->giqmatrix[qmlevel][1],
|
||||
sizeof(cm->giqmatrix[qmlevel][1]));
|
||||
#endif
|
||||
xd->plane[i].dequant = cpi->uv_dequant[qindex];
|
||||
xd->plane[i].dequant = cpi->dequants.uv_dequant[qindex];
|
||||
#if CONFIG_NEW_QUANT
|
||||
for (dq = 0; dq < QUANT_PROFILES; dq++) {
|
||||
x->plane[i].cuml_bins_nuq[dq] = quants->uv_cuml_bins_nuq[dq][qindex];
|
||||
xd->plane[i].dequant_val_nuq[dq] = cpi->uv_dequant_val_nuq[dq][qindex];
|
||||
xd->plane[i].dequant_val_nuq[dq] =
|
||||
cpi->dequants.uv_dequant_val_nuq[dq][qindex];
|
||||
}
|
||||
#endif // CONFIG_NEW_QUANT
|
||||
}
|
||||
|
|
|
|||
15
third_party/aom/av1/encoder/av1_quantize.h
vendored
15
third_party/aom/av1/encoder/av1_quantize.h
vendored
|
|
@ -69,6 +69,17 @@ typedef struct {
|
|||
DECLARE_ALIGNED(16, int16_t, uv_round[QINDEX_RANGE][8]);
|
||||
} QUANTS;
|
||||
|
||||
typedef struct {
|
||||
DECLARE_ALIGNED(16, int16_t, y_dequant[QINDEX_RANGE][8]); // 8: SIMD width
|
||||
DECLARE_ALIGNED(16, int16_t, uv_dequant[QINDEX_RANGE][8]); // 8: SIMD width
|
||||
#if CONFIG_NEW_QUANT
|
||||
DECLARE_ALIGNED(16, dequant_val_type_nuq,
|
||||
y_dequant_val_nuq[QUANT_PROFILES][QINDEX_RANGE][COEF_BANDS]);
|
||||
DECLARE_ALIGNED(16, dequant_val_type_nuq,
|
||||
uv_dequant_val_nuq[QUANT_PROFILES][QINDEX_RANGE][COEF_BANDS]);
|
||||
#endif // CONFIG_NEW_QUANT
|
||||
} Dequants;
|
||||
|
||||
struct AV1_COMP;
|
||||
struct AV1Common;
|
||||
|
||||
|
|
@ -77,6 +88,10 @@ void av1_frame_init_quantizer(struct AV1_COMP *cpi);
|
|||
void av1_init_plane_quantizers(const struct AV1_COMP *cpi, MACROBLOCK *x,
|
||||
int segment_id);
|
||||
|
||||
void av1_build_quantizer(aom_bit_depth_t bit_depth, int y_dc_delta_q,
|
||||
int uv_dc_delta_q, int uv_ac_delta_q,
|
||||
QUANTS *const quants, Dequants *const deq);
|
||||
|
||||
void av1_init_quantizer(struct AV1_COMP *cpi);
|
||||
|
||||
void av1_set_quantizer(struct AV1Common *cm, int q);
|
||||
|
|
|
|||
1132
third_party/aom/av1/encoder/bitstream.c
vendored
1132
third_party/aom/av1/encoder/bitstream.c
vendored
File diff suppressed because it is too large
Load diff
28
third_party/aom/av1/encoder/block.h
vendored
28
third_party/aom/av1/encoder/block.h
vendored
|
|
@ -17,9 +17,7 @@
|
|||
#if CONFIG_PVQ
|
||||
#include "av1/encoder/encint.h"
|
||||
#endif
|
||||
#if CONFIG_REF_MV
|
||||
#include "av1/common/mvref_common.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
@ -79,13 +77,11 @@ typedef struct {
|
|||
int dc_sign_ctx[MAX_MB_PLANE]
|
||||
[MAX_SB_SQUARE / (TX_SIZE_W_MIN * TX_SIZE_H_MIN)];
|
||||
#endif
|
||||
#if CONFIG_REF_MV
|
||||
uint8_t ref_mv_count[MODE_CTX_REF_FRAMES];
|
||||
CANDIDATE_MV ref_mv_stack[MODE_CTX_REF_FRAMES][MAX_REF_MV_STACK_SIZE];
|
||||
#if CONFIG_EXT_INTER
|
||||
int16_t compound_mode_context[MODE_CTX_REF_FRAMES];
|
||||
#endif // CONFIG_EXT_INTER
|
||||
#endif
|
||||
} MB_MODE_INFO_EXT;
|
||||
|
||||
typedef struct {
|
||||
|
|
@ -141,27 +137,18 @@ struct macroblock {
|
|||
unsigned int pred_sse[TOTAL_REFS_PER_FRAME];
|
||||
int pred_mv_sad[TOTAL_REFS_PER_FRAME];
|
||||
|
||||
#if CONFIG_REF_MV
|
||||
int *nmvjointcost;
|
||||
int nmv_vec_cost[NMV_CONTEXTS][MV_JOINTS];
|
||||
int *nmvcost[NMV_CONTEXTS][2];
|
||||
int *nmvcost_hp[NMV_CONTEXTS][2];
|
||||
int **mv_cost_stack[NMV_CONTEXTS];
|
||||
int *nmvjointsadcost;
|
||||
#else
|
||||
int nmvjointcost[MV_JOINTS];
|
||||
int *nmvcost[2];
|
||||
int *nmvcost_hp[2];
|
||||
int nmvjointsadcost[MV_JOINTS];
|
||||
#endif
|
||||
|
||||
int **mvcost;
|
||||
int *nmvsadcost[2];
|
||||
int *nmvsadcost_hp[2];
|
||||
int **mvsadcost;
|
||||
|
||||
#if CONFIG_MOTION_VAR
|
||||
int32_t *wsrc_buf;
|
||||
int32_t *mask_buf;
|
||||
uint8_t *above_pred_buf;
|
||||
uint8_t *left_pred_buf;
|
||||
#endif // CONFIG_MOTION_VAR
|
||||
|
||||
#if CONFIG_PALETTE
|
||||
|
|
@ -174,9 +161,7 @@ struct macroblock {
|
|||
|
||||
#if CONFIG_VAR_TX
|
||||
uint8_t blk_skip[MAX_MB_PLANE][MAX_MIB_SIZE * MAX_MIB_SIZE * 8];
|
||||
#if CONFIG_REF_MV
|
||||
uint8_t blk_skip_drl[MAX_MB_PLANE][MAX_MIB_SIZE * MAX_MIB_SIZE * 8];
|
||||
#endif
|
||||
#endif
|
||||
|
||||
int skip;
|
||||
|
|
@ -226,8 +211,11 @@ struct macroblock {
|
|||
// This is needed when using the 8x8 Daala distortion metric during RDO,
|
||||
// because it evaluates distortion in a different order than the underlying
|
||||
// 4x4 blocks are coded.
|
||||
int rate_4x4[256];
|
||||
#endif
|
||||
int rate_4x4[MAX_SB_SQUARE / (TX_SIZE_W_MIN * TX_SIZE_H_MIN)];
|
||||
#if CONFIG_CB4X4
|
||||
DECLARE_ALIGNED(16, uint8_t, decoded_8x8[8 * 8]);
|
||||
#endif // CONFIG_CB4X4
|
||||
#endif // CONFIG_DAALA_DIST
|
||||
#if CONFIG_CFL
|
||||
// Whether luma needs to be stored during RDO.
|
||||
int cfl_store_y;
|
||||
|
|
|
|||
4
third_party/aom/av1/encoder/context_tree.h
vendored
4
third_party/aom/av1/encoder/context_tree.h
vendored
|
|
@ -34,7 +34,6 @@ typedef struct {
|
|||
uint8_t *blk_skip[MAX_MB_PLANE];
|
||||
#endif
|
||||
|
||||
// dual buffer pointers, 0: in use, 1: best in store
|
||||
tran_low_t *coeff[MAX_MB_PLANE];
|
||||
tran_low_t *qcoeff[MAX_MB_PLANE];
|
||||
tran_low_t *dqcoeff[MAX_MB_PLANE];
|
||||
|
|
@ -48,9 +47,8 @@ typedef struct {
|
|||
|
||||
int num_4x4_blk;
|
||||
int skip;
|
||||
int pred_pixel_ready;
|
||||
// For current partition, only if all Y, U, and V transform blocks'
|
||||
// coefficients are quantized to 0, skippable is set to 0.
|
||||
// coefficients are quantized to 0, skippable is set to 1.
|
||||
int skippable;
|
||||
int best_mode_index;
|
||||
int hybrid_pred_diff;
|
||||
|
|
|
|||
15
third_party/aom/av1/encoder/corner_match.c
vendored
15
third_party/aom/av1/encoder/corner_match.c
vendored
|
|
@ -9,16 +9,13 @@
|
|||
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <memory.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "./av1_rtcd.h"
|
||||
#include "av1/encoder/corner_match.h"
|
||||
|
||||
#define MATCH_SZ 13
|
||||
#define MATCH_SZ_BY2 ((MATCH_SZ - 1) / 2)
|
||||
#define MATCH_SZ_SQ (MATCH_SZ * MATCH_SZ)
|
||||
#define SEARCH_SZ 9
|
||||
#define SEARCH_SZ_BY2 ((SEARCH_SZ - 1) / 2)
|
||||
|
||||
|
|
@ -28,8 +25,8 @@
|
|||
centered at (x, y).
|
||||
*/
|
||||
static double compute_variance(unsigned char *im, int stride, int x, int y) {
|
||||
int sum = 0.0;
|
||||
int sumsq = 0.0;
|
||||
int sum = 0;
|
||||
int sumsq = 0;
|
||||
int var;
|
||||
int i, j;
|
||||
for (i = 0; i < MATCH_SZ; ++i)
|
||||
|
|
@ -46,9 +43,9 @@ static double compute_variance(unsigned char *im, int stride, int x, int y) {
|
|||
correlation/standard deviation are taken over MATCH_SZ by MATCH_SZ windows
|
||||
of each image, centered at (x1, y1) and (x2, y2) respectively.
|
||||
*/
|
||||
static double compute_cross_correlation(unsigned char *im1, int stride1, int x1,
|
||||
int y1, unsigned char *im2, int stride2,
|
||||
int x2, int y2) {
|
||||
double compute_cross_correlation_c(unsigned char *im1, int stride1, int x1,
|
||||
int y1, unsigned char *im2, int stride2,
|
||||
int x2, int y2) {
|
||||
int v1, v2;
|
||||
int sum1 = 0;
|
||||
int sum2 = 0;
|
||||
|
|
|
|||
4
third_party/aom/av1/encoder/corner_match.h
vendored
4
third_party/aom/av1/encoder/corner_match.h
vendored
|
|
@ -15,6 +15,10 @@
|
|||
#include <stdlib.h>
|
||||
#include <memory.h>
|
||||
|
||||
#define MATCH_SZ 13
|
||||
#define MATCH_SZ_BY2 ((MATCH_SZ - 1) / 2)
|
||||
#define MATCH_SZ_SQ (MATCH_SZ * MATCH_SZ)
|
||||
|
||||
typedef struct {
|
||||
int x, y;
|
||||
int rx, ry;
|
||||
|
|
|
|||
|
|
@ -12,19 +12,19 @@
|
|||
#include "encint.h"
|
||||
|
||||
void od_encode_checkpoint(const daala_enc_ctx *enc, od_rollback_buffer *rbuf) {
|
||||
#if CONFIG_DAALA_EC
|
||||
#if !CONFIG_ANS
|
||||
od_ec_enc_checkpoint(&rbuf->ec, &enc->w.ec);
|
||||
#else
|
||||
#error "CONFIG_PVQ currently requires CONFIG_DAALA_EC."
|
||||
#error "CONFIG_PVQ currently requires !CONFIG_ANS."
|
||||
#endif
|
||||
OD_COPY(&rbuf->adapt, enc->state.adapt, 1);
|
||||
}
|
||||
|
||||
void od_encode_rollback(daala_enc_ctx *enc, const od_rollback_buffer *rbuf) {
|
||||
#if CONFIG_DAALA_EC
|
||||
#if !CONFIG_ANS
|
||||
od_ec_enc_rollback(&enc->w.ec, &rbuf->ec);
|
||||
#else
|
||||
#error "CONFIG_PVQ currently requires CONFIG_DAALA_EC."
|
||||
#error "CONFIG_PVQ currently requires !CONFIG_ANS."
|
||||
#endif
|
||||
OD_COPY(enc->state.adapt, &rbuf->adapt, 1);
|
||||
}
|
||||
|
|
|
|||
57
third_party/aom/av1/encoder/dct.c
vendored
57
third_party/aom/av1/encoder/dct.c
vendored
|
|
@ -19,7 +19,7 @@
|
|||
#include "aom_ports/mem.h"
|
||||
#include "av1/common/blockd.h"
|
||||
#include "av1/common/av1_fwd_txfm1d.h"
|
||||
#include "av1/common/av1_fwd_txfm2d_cfg.h"
|
||||
#include "av1/common/av1_fwd_txfm1d_cfg.h"
|
||||
#include "av1/common/idct.h"
|
||||
|
||||
static INLINE void range_check(const tran_low_t *input, const int size,
|
||||
|
|
@ -1022,6 +1022,10 @@ static void fhalfright32(const tran_low_t *input, tran_low_t *output) {
|
|||
}
|
||||
|
||||
#if CONFIG_EXT_TX
|
||||
// TODO(sarahparker) these functions will be removed once the highbitdepth
|
||||
// codepath works properly for rectangular transforms. They have almost
|
||||
// identical versions in av1_fwd_txfm1d.c, but those are currently only
|
||||
// being used for square transforms.
|
||||
static void fidtx4(const tran_low_t *input, tran_low_t *output) {
|
||||
int i;
|
||||
for (i = 0; i < 4; ++i)
|
||||
|
|
@ -2133,8 +2137,7 @@ static void fdct64_col(const tran_low_t *input, tran_low_t *output) {
|
|||
int32_t in[64], out[64];
|
||||
int i;
|
||||
for (i = 0; i < 64; ++i) in[i] = (int32_t)input[i];
|
||||
av1_fdct64_new(in, out, fwd_cos_bit_col_dct_dct_64,
|
||||
fwd_stage_range_col_dct_dct_64);
|
||||
av1_fdct64_new(in, out, fwd_cos_bit_col_dct_64, fwd_stage_range_col_dct_64);
|
||||
for (i = 0; i < 64; ++i) output[i] = (tran_low_t)out[i];
|
||||
}
|
||||
|
||||
|
|
@ -2142,8 +2145,7 @@ static void fdct64_row(const tran_low_t *input, tran_low_t *output) {
|
|||
int32_t in[64], out[64];
|
||||
int i;
|
||||
for (i = 0; i < 64; ++i) in[i] = (int32_t)input[i];
|
||||
av1_fdct64_new(in, out, fwd_cos_bit_row_dct_dct_64,
|
||||
fwd_stage_range_row_dct_dct_64);
|
||||
av1_fdct64_new(in, out, fwd_cos_bit_row_dct_64, fwd_stage_range_row_dct_64);
|
||||
for (i = 0; i < 64; ++i) output[i] = (tran_low_t)out[i];
|
||||
}
|
||||
|
||||
|
|
@ -2225,4 +2227,49 @@ void av1_highbd_fht64x64_c(const int16_t *input, tran_low_t *output, int stride,
|
|||
}
|
||||
#endif // CONFIG_TX64X64
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
|
||||
#if CONFIG_DPCM_INTRA
|
||||
void av1_dpcm_ft4_c(const int16_t *input, int stride, TX_TYPE_1D tx_type,
|
||||
tran_low_t *output) {
|
||||
assert(tx_type < TX_TYPES_1D);
|
||||
static const transform_1d FHT[] = { fdct4, fadst4, fadst4, fidtx4 };
|
||||
const transform_1d ft = FHT[tx_type];
|
||||
tran_low_t temp_in[4];
|
||||
for (int i = 0; i < 4; ++i)
|
||||
temp_in[i] = (tran_low_t)fdct_round_shift(input[i * stride] * 4 * Sqrt2);
|
||||
ft(temp_in, output);
|
||||
}
|
||||
|
||||
void av1_dpcm_ft8_c(const int16_t *input, int stride, TX_TYPE_1D tx_type,
|
||||
tran_low_t *output) {
|
||||
assert(tx_type < TX_TYPES_1D);
|
||||
static const transform_1d FHT[] = { fdct8, fadst8, fadst8, fidtx8 };
|
||||
const transform_1d ft = FHT[tx_type];
|
||||
tran_low_t temp_in[8];
|
||||
for (int i = 0; i < 8; ++i) temp_in[i] = input[i * stride] * 4;
|
||||
ft(temp_in, output);
|
||||
}
|
||||
|
||||
void av1_dpcm_ft16_c(const int16_t *input, int stride, TX_TYPE_1D tx_type,
|
||||
tran_low_t *output) {
|
||||
assert(tx_type < TX_TYPES_1D);
|
||||
static const transform_1d FHT[] = { fdct16, fadst16, fadst16, fidtx16 };
|
||||
const transform_1d ft = FHT[tx_type];
|
||||
tran_low_t temp_in[16];
|
||||
for (int i = 0; i < 16; ++i)
|
||||
temp_in[i] = (tran_low_t)fdct_round_shift(input[i * stride] * 2 * Sqrt2);
|
||||
ft(temp_in, output);
|
||||
}
|
||||
|
||||
void av1_dpcm_ft32_c(const int16_t *input, int stride, TX_TYPE_1D tx_type,
|
||||
tran_low_t *output) {
|
||||
assert(tx_type < TX_TYPES_1D);
|
||||
static const transform_1d FHT[] = { fdct32, fhalfright32, fhalfright32,
|
||||
fidtx32 };
|
||||
const transform_1d ft = FHT[tx_type];
|
||||
tran_low_t temp_in[32];
|
||||
for (int i = 0; i < 32; ++i) temp_in[i] = input[i * stride];
|
||||
ft(temp_in, output);
|
||||
}
|
||||
#endif // CONFIG_DPCM_INTRA
|
||||
#endif // !AV1_DCT_GTEST
|
||||
|
|
|
|||
1335
third_party/aom/av1/encoder/encodeframe.c
vendored
1335
third_party/aom/av1/encoder/encodeframe.c
vendored
File diff suppressed because it is too large
Load diff
9
third_party/aom/av1/encoder/encodeframe.h
vendored
9
third_party/aom/av1/encoder/encodeframe.h
vendored
|
|
@ -25,13 +25,6 @@ struct yv12_buffer_config;
|
|||
struct AV1_COMP;
|
||||
struct ThreadData;
|
||||
|
||||
// Constants used in SOURCE_VAR_BASED_PARTITION
|
||||
#define VAR_HIST_MAX_BG_VAR 1000
|
||||
#define VAR_HIST_FACTOR 10
|
||||
#define VAR_HIST_BINS (VAR_HIST_MAX_BG_VAR / VAR_HIST_FACTOR + 1)
|
||||
#define VAR_HIST_LARGE_CUT_OFF 75
|
||||
#define VAR_HIST_SMALL_CUT_OFF 45
|
||||
|
||||
void av1_setup_src_planes(struct macroblock *x,
|
||||
const struct yv12_buffer_config *src, int mi_row,
|
||||
int mi_col);
|
||||
|
|
@ -42,8 +35,6 @@ void av1_init_tile_data(struct AV1_COMP *cpi);
|
|||
void av1_encode_tile(struct AV1_COMP *cpi, struct ThreadData *td, int tile_row,
|
||||
int tile_col);
|
||||
|
||||
void av1_set_variance_partition_thresholds(struct AV1_COMP *cpi, int q);
|
||||
|
||||
void av1_update_tx_type_count(const struct AV1Common *cm, MACROBLOCKD *xd,
|
||||
#if CONFIG_TXK_SEL
|
||||
int block, int plane,
|
||||
|
|
|
|||
703
third_party/aom/av1/encoder/encodemb.c
vendored
703
third_party/aom/av1/encoder/encodemb.c
vendored
|
|
@ -115,7 +115,7 @@ static const int plane_rd_mult[REF_TYPES][PLANE_TYPES] = {
|
|||
#if CONFIG_EC_ADAPT
|
||||
{ 10, 7 }, { 8, 5 },
|
||||
#else
|
||||
{ 10, 6 }, { 8, 5 },
|
||||
{ 10, 6 }, { 8, 6 },
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
@ -125,35 +125,31 @@ static const int plane_rd_mult[REF_TYPES][PLANE_TYPES] = {
|
|||
rd_cost1 = RDCOST(rdmult, rddiv, rate1, error1); \
|
||||
}
|
||||
|
||||
static INLINE int64_t
|
||||
get_token_bit_costs(unsigned int token_costs[2][COEFF_CONTEXTS][ENTROPY_TOKENS],
|
||||
int skip_eob, int ctx, int token) {
|
||||
#if CONFIG_NEW_TOKENSET
|
||||
static INLINE unsigned int get_token_bit_costs(
|
||||
unsigned int token_costs[2][COEFF_CONTEXTS][ENTROPY_TOKENS], int skip_eob,
|
||||
int ctx, int token) {
|
||||
(void)skip_eob;
|
||||
return token_costs[token == ZERO_TOKEN || token == EOB_TOKEN][ctx][token];
|
||||
#else
|
||||
return token_costs[skip_eob][ctx][token];
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !CONFIG_LV_MAP
|
||||
#define USE_GREEDY_OPTIMIZE_B 0
|
||||
|
||||
#if USE_GREEDY_OPTIMIZE_B
|
||||
|
||||
typedef struct av1_token_state {
|
||||
typedef struct av1_token_state_greedy {
|
||||
int16_t token;
|
||||
tran_low_t qc;
|
||||
tran_low_t dqc;
|
||||
} av1_token_state;
|
||||
} av1_token_state_greedy;
|
||||
|
||||
int av1_optimize_b(const AV1_COMMON *cm, MACROBLOCK *mb, int plane, int block,
|
||||
TX_SIZE tx_size, int ctx) {
|
||||
#if !CONFIG_PVQ
|
||||
static int optimize_b_greedy(const AV1_COMMON *cm, MACROBLOCK *mb, int plane,
|
||||
int block, TX_SIZE tx_size, int ctx) {
|
||||
MACROBLOCKD *const xd = &mb->e_mbd;
|
||||
struct macroblock_plane *const p = &mb->plane[plane];
|
||||
struct macroblockd_plane *const pd = &xd->plane[plane];
|
||||
const int ref = is_inter_block(&xd->mi[0]->mbmi);
|
||||
av1_token_state tokens[MAX_TX_SQUARE + 1][2];
|
||||
av1_token_state_greedy tokens[MAX_TX_SQUARE + 1][2];
|
||||
uint8_t token_cache[MAX_TX_SQUARE];
|
||||
const tran_low_t *const coeff = BLOCK_OFFSET(p->coeff, block);
|
||||
tran_low_t *const qcoeff = BLOCK_OFFSET(p->qcoeff, block);
|
||||
|
|
@ -176,38 +172,23 @@ int av1_optimize_b(const AV1_COMMON *cm, MACROBLOCK *mb, int plane, int block,
|
|||
#if CONFIG_NEW_QUANT
|
||||
int dq = get_dq_profile_from_ctx(mb->qindex, ctx, ref, plane_type);
|
||||
const dequant_val_type_nuq *dequant_val = pd->dequant_val_nuq[dq];
|
||||
#elif !CONFIG_AOM_QM
|
||||
const int dq_step[2] = { dequant_ptr[0] >> shift, dequant_ptr[1] >> shift };
|
||||
#endif // CONFIG_NEW_QUANT
|
||||
int sz = 0;
|
||||
const int64_t rddiv = mb->rddiv;
|
||||
int64_t rd_cost0, rd_cost1;
|
||||
int16_t t0, t1;
|
||||
int i, final_eob;
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
const int cat6_bits = av1_get_cat6_extrabits_size(tx_size, xd->bd);
|
||||
#else
|
||||
const int cat6_bits = av1_get_cat6_extrabits_size(tx_size, 8);
|
||||
#endif
|
||||
unsigned int(*token_costs)[2][COEFF_CONTEXTS][ENTROPY_TOKENS] =
|
||||
mb->token_costs[txsize_sqr_map[tx_size]][plane_type][ref];
|
||||
const int default_eob = tx_size_2d[tx_size];
|
||||
|
||||
assert((mb->qindex == 0) ^ (xd->lossless[xd->mi[0]->mbmi.segment_id] == 0));
|
||||
assert(mb->qindex > 0);
|
||||
|
||||
assert((!plane_type && !plane) || (plane_type && plane));
|
||||
assert(eob <= default_eob);
|
||||
|
||||
int64_t rdmult = (mb->rdmult * plane_rd_mult[ref][plane_type]) >> 1;
|
||||
/* CpuSpeedTest uses "--min-q=0 --max-q=0" and expects 100dB psnr
|
||||
* This creates conflict with search for a better EOB position
|
||||
* The line below is to make sure EOB search is disabled at this corner case.
|
||||
*/
|
||||
#if !CONFIG_NEW_QUANT && !CONFIG_AOM_QM
|
||||
if (dq_step[1] <= 4) {
|
||||
rdmult = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
int64_t rate0, rate1;
|
||||
for (i = 0; i < eob; i++) {
|
||||
|
|
@ -402,22 +383,10 @@ int av1_optimize_b(const AV1_COMMON *cm, MACROBLOCK *mb, int plane, int block,
|
|||
dqc_a = shift ? ROUND_POWER_OF_TWO(dqc_a, shift) : dqc_a;
|
||||
if (sz) dqc_a = -dqc_a;
|
||||
#else
|
||||
// The 32x32 transform coefficient uses half quantization step size.
|
||||
// Account for the rounding difference in the dequantized coefficeint
|
||||
// value when the quantization index is dropped from an even number
|
||||
// to an odd number.
|
||||
|
||||
#if CONFIG_AOM_QM
|
||||
tran_low_t offset = dqv >> shift;
|
||||
#else
|
||||
tran_low_t offset = dq_step[rc != 0];
|
||||
#endif
|
||||
if (shift & x_a) offset += (dqv & 0x01);
|
||||
|
||||
if (sz == 0)
|
||||
dqc_a = dqcoeff[rc] - offset;
|
||||
if (x_a < 0)
|
||||
dqc_a = -((-x_a * dqv) >> shift);
|
||||
else
|
||||
dqc_a = dqcoeff[rc] + offset;
|
||||
dqc_a = (x_a * dqv) >> shift;
|
||||
#endif // CONFIG_NEW_QUANT
|
||||
} else {
|
||||
dqc_a = 0;
|
||||
|
|
@ -483,19 +452,11 @@ int av1_optimize_b(const AV1_COMMON *cm, MACROBLOCK *mb, int plane, int block,
|
|||
|
||||
mb->plane[plane].eobs[block] = final_eob;
|
||||
return final_eob;
|
||||
|
||||
#else // !CONFIG_PVQ
|
||||
(void)cm;
|
||||
(void)tx_size;
|
||||
(void)ctx;
|
||||
struct macroblock_plane *const p = &mb->plane[plane];
|
||||
return p->eobs[block];
|
||||
#endif // !CONFIG_PVQ
|
||||
}
|
||||
|
||||
#else // USE_GREEDY_OPTIMIZE_B
|
||||
|
||||
typedef struct av1_token_state {
|
||||
typedef struct av1_token_state_org {
|
||||
int64_t error;
|
||||
int rate;
|
||||
int16_t next;
|
||||
|
|
@ -503,16 +464,15 @@ typedef struct av1_token_state {
|
|||
tran_low_t qc;
|
||||
tran_low_t dqc;
|
||||
uint8_t best_index;
|
||||
} av1_token_state;
|
||||
} av1_token_state_org;
|
||||
|
||||
int av1_optimize_b(const AV1_COMMON *cm, MACROBLOCK *mb, int plane, int block,
|
||||
TX_SIZE tx_size, int ctx) {
|
||||
#if !CONFIG_PVQ
|
||||
static int optimize_b_org(const AV1_COMMON *cm, MACROBLOCK *mb, int plane,
|
||||
int block, TX_SIZE tx_size, int ctx) {
|
||||
MACROBLOCKD *const xd = &mb->e_mbd;
|
||||
struct macroblock_plane *const p = &mb->plane[plane];
|
||||
struct macroblockd_plane *const pd = &xd->plane[plane];
|
||||
const int ref = is_inter_block(&xd->mi[0]->mbmi);
|
||||
av1_token_state tokens[MAX_TX_SQUARE + 1][2];
|
||||
av1_token_state_org tokens[MAX_TX_SQUARE + 1][2];
|
||||
uint8_t token_cache[MAX_TX_SQUARE];
|
||||
const tran_low_t *const coeff = BLOCK_OFFSET(p->coeff, block);
|
||||
tran_low_t *const qcoeff = BLOCK_OFFSET(p->qcoeff, block);
|
||||
|
|
@ -536,8 +496,6 @@ int av1_optimize_b(const AV1_COMMON *cm, MACROBLOCK *mb, int plane, int block,
|
|||
#if CONFIG_NEW_QUANT
|
||||
int dq = get_dq_profile_from_ctx(mb->qindex, ctx, ref, plane_type);
|
||||
const dequant_val_type_nuq *dequant_val = pd->dequant_val_nuq[dq];
|
||||
#elif !CONFIG_AOM_QM
|
||||
const int dq_step[2] = { dequant_ptr[0] >> shift, dequant_ptr[1] >> shift };
|
||||
#endif // CONFIG_NEW_QUANT
|
||||
int next = eob, sz = 0;
|
||||
const int64_t rdmult = (mb->rdmult * plane_rd_mult[ref][plane_type]) >> 1;
|
||||
|
|
@ -549,11 +507,7 @@ int av1_optimize_b(const AV1_COMMON *cm, MACROBLOCK *mb, int plane, int block,
|
|||
int best, band = (eob < default_eob) ? band_translate[eob]
|
||||
: band_translate[eob - 1];
|
||||
int pt, i, final_eob;
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
const int cat6_bits = av1_get_cat6_extrabits_size(tx_size, xd->bd);
|
||||
#else
|
||||
const int cat6_bits = av1_get_cat6_extrabits_size(tx_size, 8);
|
||||
#endif
|
||||
unsigned int(*token_costs)[2][COEFF_CONTEXTS][ENTROPY_TOKENS] =
|
||||
mb->token_costs[txsize_sqr_map[tx_size]][plane_type][ref];
|
||||
const uint16_t *band_counts = &band_count_table[tx_size][band];
|
||||
|
|
@ -566,11 +520,10 @@ int av1_optimize_b(const AV1_COMMON *cm, MACROBLOCK *mb, int plane, int block,
|
|||
? av1_get_qindex(&cm->seg, xd->mi[0]->mbmi.segment_id,
|
||||
cm->base_qindex)
|
||||
: cm->base_qindex;
|
||||
if (qindex == 0) {
|
||||
assert((qindex == 0) ^ (xd->lossless[xd->mi[0]->mbmi.segment_id] == 0));
|
||||
}
|
||||
assert(qindex > 0);
|
||||
(void)qindex;
|
||||
#else
|
||||
assert((mb->qindex == 0) ^ (xd->lossless[xd->mi[0]->mbmi.segment_id] == 0));
|
||||
assert(mb->qindex > 0);
|
||||
#endif
|
||||
|
||||
token_costs += band;
|
||||
|
|
@ -777,22 +730,10 @@ int av1_optimize_b(const AV1_COMMON *cm, MACROBLOCK *mb, int plane, int block,
|
|||
: tokens[i][1].dqc;
|
||||
if (sz) tokens[i][1].dqc = -tokens[i][1].dqc;
|
||||
#else
|
||||
// The 32x32 transform coefficient uses half quantization step size.
|
||||
// Account for the rounding difference in the dequantized coefficeint
|
||||
// value when the quantization index is dropped from an even number
|
||||
// to an odd number.
|
||||
|
||||
#if CONFIG_AOM_QM
|
||||
tran_low_t offset = dqv >> shift;
|
||||
#else
|
||||
tran_low_t offset = dq_step[rc != 0];
|
||||
#endif
|
||||
if (shift & x) offset += (dqv & 0x01);
|
||||
|
||||
if (sz == 0)
|
||||
tokens[i][1].dqc = dqcoeff[rc] - offset;
|
||||
if (x < 0)
|
||||
tokens[i][1].dqc = -((-x * dqv) >> shift);
|
||||
else
|
||||
tokens[i][1].dqc = dqcoeff[rc] + offset;
|
||||
tokens[i][1].dqc = (x * dqv) >> shift;
|
||||
#endif // CONFIG_NEW_QUANT
|
||||
} else {
|
||||
tokens[i][1].dqc = 0;
|
||||
|
|
@ -858,16 +799,47 @@ int av1_optimize_b(const AV1_COMMON *cm, MACROBLOCK *mb, int plane, int block,
|
|||
mb->plane[plane].eobs[block] = final_eob;
|
||||
assert(final_eob <= default_eob);
|
||||
return final_eob;
|
||||
#else // !CONFIG_PVQ
|
||||
(void)cm;
|
||||
(void)tx_size;
|
||||
(void)ctx;
|
||||
struct macroblock_plane *const p = &mb->plane[plane];
|
||||
return p->eobs[block];
|
||||
#endif // !CONFIG_PVQ
|
||||
}
|
||||
|
||||
#endif // USE_GREEDY_OPTIMIZE_B
|
||||
#endif // !CONFIG_LV_MAP
|
||||
|
||||
int av1_optimize_b(const AV1_COMMON *cm, MACROBLOCK *mb, int plane, int block,
|
||||
BLOCK_SIZE plane_bsize, TX_SIZE tx_size,
|
||||
const ENTROPY_CONTEXT *a, const ENTROPY_CONTEXT *l) {
|
||||
MACROBLOCKD *const xd = &mb->e_mbd;
|
||||
struct macroblock_plane *const p = &mb->plane[plane];
|
||||
const int eob = p->eobs[block];
|
||||
assert((mb->qindex == 0) ^ (xd->lossless[xd->mi[0]->mbmi.segment_id] == 0));
|
||||
if (eob == 0) return eob;
|
||||
if (xd->lossless[xd->mi[0]->mbmi.segment_id]) return eob;
|
||||
#if CONFIG_PVQ
|
||||
(void)cm;
|
||||
(void)tx_size;
|
||||
(void)a;
|
||||
(void)l;
|
||||
return eob;
|
||||
#endif
|
||||
|
||||
#if !CONFIG_LV_MAP
|
||||
(void)plane_bsize;
|
||||
#if CONFIG_VAR_TX
|
||||
int ctx = get_entropy_context(tx_size, a, l);
|
||||
#else
|
||||
int ctx = combine_entropy_contexts(*a, *l);
|
||||
#endif
|
||||
|
||||
#if USE_GREEDY_OPTIMIZE_B
|
||||
return optimize_b_greedy(cm, mb, plane, block, tx_size, ctx);
|
||||
#else // USE_GREEDY_OPTIMIZE_B
|
||||
return optimize_b_org(cm, mb, plane, block, tx_size, ctx);
|
||||
#endif // USE_GREEDY_OPTIMIZE_B
|
||||
#else // !CONFIG_LV_MAP
|
||||
TXB_CTX txb_ctx;
|
||||
get_txb_ctx(plane_bsize, tx_size, plane, a, l, &txb_ctx);
|
||||
return av1_optimize_txb(cm, mb, plane, block, tx_size, &txb_ctx);
|
||||
#endif // !CONFIG_LV_MAP
|
||||
}
|
||||
|
||||
#if !CONFIG_PVQ
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
|
|
@ -1158,8 +1130,7 @@ static void encode_block(int plane, int block, int blk_row, int blk_col,
|
|||
#endif
|
||||
|
||||
#if !CONFIG_PVQ
|
||||
if (p->eobs[block] && !xd->lossless[xd->mi[0]->mbmi.segment_id])
|
||||
av1_optimize_b(cm, x, plane, block, tx_size, ctx);
|
||||
av1_optimize_b(cm, x, plane, block, plane_bsize, tx_size, a, l);
|
||||
|
||||
av1_set_txb_context(x, plane, block, tx_size, a, l);
|
||||
|
||||
|
|
@ -1202,12 +1173,13 @@ static void encode_block_inter(int plane, int block, int blk_row, int blk_col,
|
|||
if (tx_size == plane_tx_size) {
|
||||
encode_block(plane, block, blk_row, blk_col, plane_bsize, tx_size, arg);
|
||||
} else {
|
||||
assert(tx_size < TX_SIZES_ALL);
|
||||
const TX_SIZE sub_txs = sub_tx_size_map[tx_size];
|
||||
assert(sub_txs < tx_size);
|
||||
// This is the square transform block partition entry point.
|
||||
int bsl = tx_size_wide_unit[sub_txs];
|
||||
int i;
|
||||
assert(bsl > 0);
|
||||
assert(tx_size < TX_SIZES_ALL);
|
||||
|
||||
for (i = 0; i < 4; ++i) {
|
||||
const int offsetr = blk_row + ((i >> 1) * bsl);
|
||||
|
|
@ -1301,8 +1273,8 @@ void av1_encode_sby_pass1(AV1_COMMON *cm, MACROBLOCK *x, BLOCK_SIZE bsize) {
|
|||
encode_block_pass1, &args);
|
||||
}
|
||||
|
||||
void av1_encode_sb(AV1_COMMON *cm, MACROBLOCK *x, BLOCK_SIZE bsize,
|
||||
const int mi_row, const int mi_col) {
|
||||
void av1_encode_sb(AV1_COMMON *cm, MACROBLOCK *x, BLOCK_SIZE bsize, int mi_row,
|
||||
int mi_col) {
|
||||
MACROBLOCKD *const xd = &x->e_mbd;
|
||||
struct optimize_ctx ctx;
|
||||
MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
|
||||
|
|
@ -1433,6 +1405,301 @@ static void encode_block_intra_and_set_context(int plane, int block,
|
|||
#endif
|
||||
}
|
||||
|
||||
#if CONFIG_DPCM_INTRA
|
||||
static int get_eob(const tran_low_t *qcoeff, intptr_t n_coeffs,
|
||||
const int16_t *scan) {
|
||||
int eob = -1;
|
||||
for (int i = (int)n_coeffs - 1; i >= 0; i--) {
|
||||
const int rc = scan[i];
|
||||
if (qcoeff[rc]) {
|
||||
eob = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return eob + 1;
|
||||
}
|
||||
|
||||
static void quantize_scaler(int coeff, int16_t zbin, int16_t round_value,
|
||||
int16_t quant, int16_t quant_shift, int16_t dequant,
|
||||
int log_scale, tran_low_t *const qcoeff,
|
||||
tran_low_t *const dqcoeff) {
|
||||
zbin = ROUND_POWER_OF_TWO(zbin, log_scale);
|
||||
round_value = ROUND_POWER_OF_TWO(round_value, log_scale);
|
||||
const int coeff_sign = (coeff >> 31);
|
||||
const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign;
|
||||
if (abs_coeff >= zbin) {
|
||||
int tmp = clamp(abs_coeff + round_value, INT16_MIN, INT16_MAX);
|
||||
tmp = ((((tmp * quant) >> 16) + tmp) * quant_shift) >> (16 - log_scale);
|
||||
*qcoeff = (tmp ^ coeff_sign) - coeff_sign;
|
||||
*dqcoeff = (*qcoeff * dequant) / (1 << log_scale);
|
||||
}
|
||||
}
|
||||
|
||||
typedef void (*dpcm_fwd_tx_func)(const int16_t *input, int stride,
|
||||
TX_TYPE_1D tx_type, tran_low_t *output);
|
||||
|
||||
static dpcm_fwd_tx_func get_dpcm_fwd_tx_func(int tx_length) {
|
||||
switch (tx_length) {
|
||||
case 4: return av1_dpcm_ft4_c;
|
||||
case 8: return av1_dpcm_ft8_c;
|
||||
case 16: return av1_dpcm_ft16_c;
|
||||
case 32:
|
||||
return av1_dpcm_ft32_c;
|
||||
// TODO(huisu): add support for TX_64X64.
|
||||
default: assert(0); return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void process_block_dpcm_vert(TX_SIZE tx_size, TX_TYPE_1D tx_type_1d,
|
||||
struct macroblockd_plane *const pd,
|
||||
struct macroblock_plane *const p,
|
||||
uint8_t *src, int src_stride, uint8_t *dst,
|
||||
int dst_stride, int16_t *src_diff,
|
||||
int diff_stride, tran_low_t *coeff,
|
||||
tran_low_t *qcoeff, tran_low_t *dqcoeff) {
|
||||
const int tx1d_width = tx_size_wide[tx_size];
|
||||
dpcm_fwd_tx_func forward_tx = get_dpcm_fwd_tx_func(tx1d_width);
|
||||
dpcm_inv_txfm_add_func inverse_tx =
|
||||
av1_get_dpcm_inv_txfm_add_func(tx1d_width);
|
||||
const int tx1d_height = tx_size_high[tx_size];
|
||||
const int log_scale = av1_get_tx_scale(tx_size);
|
||||
int q_idx = 0;
|
||||
for (int r = 0; r < tx1d_height; ++r) {
|
||||
// Update prediction.
|
||||
if (r > 0) memcpy(dst, dst - dst_stride, tx1d_width * sizeof(dst[0]));
|
||||
// Subtraction.
|
||||
for (int c = 0; c < tx1d_width; ++c) src_diff[c] = src[c] - dst[c];
|
||||
// Forward transform.
|
||||
forward_tx(src_diff, 1, tx_type_1d, coeff);
|
||||
// Quantization.
|
||||
for (int c = 0; c < tx1d_width; ++c) {
|
||||
quantize_scaler(coeff[c], p->zbin[q_idx], p->round[q_idx],
|
||||
p->quant[q_idx], p->quant_shift[q_idx],
|
||||
pd->dequant[q_idx], log_scale, &qcoeff[c], &dqcoeff[c]);
|
||||
q_idx = 1;
|
||||
}
|
||||
// Inverse transform.
|
||||
inverse_tx(dqcoeff, 1, tx_type_1d, dst);
|
||||
// Move to the next row.
|
||||
coeff += tx1d_width;
|
||||
qcoeff += tx1d_width;
|
||||
dqcoeff += tx1d_width;
|
||||
src_diff += diff_stride;
|
||||
dst += dst_stride;
|
||||
src += src_stride;
|
||||
}
|
||||
}
|
||||
|
||||
static void process_block_dpcm_horz(TX_SIZE tx_size, TX_TYPE_1D tx_type_1d,
|
||||
struct macroblockd_plane *const pd,
|
||||
struct macroblock_plane *const p,
|
||||
uint8_t *src, int src_stride, uint8_t *dst,
|
||||
int dst_stride, int16_t *src_diff,
|
||||
int diff_stride, tran_low_t *coeff,
|
||||
tran_low_t *qcoeff, tran_low_t *dqcoeff) {
|
||||
const int tx1d_height = tx_size_high[tx_size];
|
||||
dpcm_fwd_tx_func forward_tx = get_dpcm_fwd_tx_func(tx1d_height);
|
||||
dpcm_inv_txfm_add_func inverse_tx =
|
||||
av1_get_dpcm_inv_txfm_add_func(tx1d_height);
|
||||
const int tx1d_width = tx_size_wide[tx_size];
|
||||
const int log_scale = av1_get_tx_scale(tx_size);
|
||||
int q_idx = 0;
|
||||
for (int c = 0; c < tx1d_width; ++c) {
|
||||
for (int r = 0; r < tx1d_height; ++r) {
|
||||
// Update prediction.
|
||||
if (c > 0) dst[r * dst_stride] = dst[r * dst_stride - 1];
|
||||
// Subtraction.
|
||||
src_diff[r * diff_stride] = src[r * src_stride] - dst[r * dst_stride];
|
||||
}
|
||||
// Forward transform.
|
||||
tran_low_t tx_buff[64];
|
||||
forward_tx(src_diff, diff_stride, tx_type_1d, tx_buff);
|
||||
for (int r = 0; r < tx1d_height; ++r) coeff[r * tx1d_width] = tx_buff[r];
|
||||
// Quantization.
|
||||
for (int r = 0; r < tx1d_height; ++r) {
|
||||
quantize_scaler(coeff[r * tx1d_width], p->zbin[q_idx], p->round[q_idx],
|
||||
p->quant[q_idx], p->quant_shift[q_idx],
|
||||
pd->dequant[q_idx], log_scale, &qcoeff[r * tx1d_width],
|
||||
&dqcoeff[r * tx1d_width]);
|
||||
q_idx = 1;
|
||||
}
|
||||
// Inverse transform.
|
||||
for (int r = 0; r < tx1d_height; ++r) tx_buff[r] = dqcoeff[r * tx1d_width];
|
||||
inverse_tx(tx_buff, dst_stride, tx_type_1d, dst);
|
||||
// Move to the next column.
|
||||
++coeff, ++qcoeff, ++dqcoeff, ++src_diff, ++dst, ++src;
|
||||
}
|
||||
}
|
||||
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
static void hbd_process_block_dpcm_vert(
|
||||
TX_SIZE tx_size, TX_TYPE_1D tx_type_1d, int bd,
|
||||
struct macroblockd_plane *const pd, struct macroblock_plane *const p,
|
||||
uint8_t *src8, int src_stride, uint8_t *dst8, int dst_stride,
|
||||
int16_t *src_diff, int diff_stride, tran_low_t *coeff, tran_low_t *qcoeff,
|
||||
tran_low_t *dqcoeff) {
|
||||
const int tx1d_width = tx_size_wide[tx_size];
|
||||
dpcm_fwd_tx_func forward_tx = get_dpcm_fwd_tx_func(tx1d_width);
|
||||
hbd_dpcm_inv_txfm_add_func inverse_tx =
|
||||
av1_get_hbd_dpcm_inv_txfm_add_func(tx1d_width);
|
||||
uint16_t *src = CONVERT_TO_SHORTPTR(src8);
|
||||
uint16_t *dst = CONVERT_TO_SHORTPTR(dst8);
|
||||
const int tx1d_height = tx_size_high[tx_size];
|
||||
const int log_scale = av1_get_tx_scale(tx_size);
|
||||
int q_idx = 0;
|
||||
for (int r = 0; r < tx1d_height; ++r) {
|
||||
// Update prediction.
|
||||
if (r > 0) memcpy(dst, dst - dst_stride, tx1d_width * sizeof(dst[0]));
|
||||
// Subtraction.
|
||||
for (int c = 0; c < tx1d_width; ++c) src_diff[c] = src[c] - dst[c];
|
||||
// Forward transform.
|
||||
forward_tx(src_diff, 1, tx_type_1d, coeff);
|
||||
// Quantization.
|
||||
for (int c = 0; c < tx1d_width; ++c) {
|
||||
quantize_scaler(coeff[c], p->zbin[q_idx], p->round[q_idx],
|
||||
p->quant[q_idx], p->quant_shift[q_idx],
|
||||
pd->dequant[q_idx], log_scale, &qcoeff[c], &dqcoeff[c]);
|
||||
q_idx = 1;
|
||||
}
|
||||
// Inverse transform.
|
||||
inverse_tx(dqcoeff, 1, tx_type_1d, bd, dst);
|
||||
// Move to the next row.
|
||||
coeff += tx1d_width;
|
||||
qcoeff += tx1d_width;
|
||||
dqcoeff += tx1d_width;
|
||||
src_diff += diff_stride;
|
||||
dst += dst_stride;
|
||||
src += src_stride;
|
||||
}
|
||||
}
|
||||
|
||||
static void hbd_process_block_dpcm_horz(
|
||||
TX_SIZE tx_size, TX_TYPE_1D tx_type_1d, int bd,
|
||||
struct macroblockd_plane *const pd, struct macroblock_plane *const p,
|
||||
uint8_t *src8, int src_stride, uint8_t *dst8, int dst_stride,
|
||||
int16_t *src_diff, int diff_stride, tran_low_t *coeff, tran_low_t *qcoeff,
|
||||
tran_low_t *dqcoeff) {
|
||||
const int tx1d_height = tx_size_high[tx_size];
|
||||
dpcm_fwd_tx_func forward_tx = get_dpcm_fwd_tx_func(tx1d_height);
|
||||
hbd_dpcm_inv_txfm_add_func inverse_tx =
|
||||
av1_get_hbd_dpcm_inv_txfm_add_func(tx1d_height);
|
||||
uint16_t *src = CONVERT_TO_SHORTPTR(src8);
|
||||
uint16_t *dst = CONVERT_TO_SHORTPTR(dst8);
|
||||
const int tx1d_width = tx_size_wide[tx_size];
|
||||
const int log_scale = av1_get_tx_scale(tx_size);
|
||||
int q_idx = 0;
|
||||
for (int c = 0; c < tx1d_width; ++c) {
|
||||
for (int r = 0; r < tx1d_height; ++r) {
|
||||
// Update prediction.
|
||||
if (c > 0) dst[r * dst_stride] = dst[r * dst_stride - 1];
|
||||
// Subtraction.
|
||||
src_diff[r * diff_stride] = src[r * src_stride] - dst[r * dst_stride];
|
||||
}
|
||||
// Forward transform.
|
||||
tran_low_t tx_buff[64];
|
||||
forward_tx(src_diff, diff_stride, tx_type_1d, tx_buff);
|
||||
for (int r = 0; r < tx1d_height; ++r) coeff[r * tx1d_width] = tx_buff[r];
|
||||
// Quantization.
|
||||
for (int r = 0; r < tx1d_height; ++r) {
|
||||
quantize_scaler(coeff[r * tx1d_width], p->zbin[q_idx], p->round[q_idx],
|
||||
p->quant[q_idx], p->quant_shift[q_idx],
|
||||
pd->dequant[q_idx], log_scale, &qcoeff[r * tx1d_width],
|
||||
&dqcoeff[r * tx1d_width]);
|
||||
q_idx = 1;
|
||||
}
|
||||
// Inverse transform.
|
||||
for (int r = 0; r < tx1d_height; ++r) tx_buff[r] = dqcoeff[r * tx1d_width];
|
||||
inverse_tx(tx_buff, dst_stride, tx_type_1d, bd, dst);
|
||||
// Move to the next column.
|
||||
++coeff, ++qcoeff, ++dqcoeff, ++src_diff, ++dst, ++src;
|
||||
}
|
||||
}
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
|
||||
void av1_encode_block_intra_dpcm(const AV1_COMMON *cm, MACROBLOCK *x,
|
||||
PREDICTION_MODE mode, int plane, int block,
|
||||
int blk_row, int blk_col,
|
||||
BLOCK_SIZE plane_bsize, TX_SIZE tx_size,
|
||||
TX_TYPE tx_type, ENTROPY_CONTEXT *ta,
|
||||
ENTROPY_CONTEXT *tl, int8_t *skip) {
|
||||
MACROBLOCKD *const xd = &x->e_mbd;
|
||||
struct macroblock_plane *const p = &x->plane[plane];
|
||||
struct macroblockd_plane *const pd = &xd->plane[plane];
|
||||
tran_low_t *dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
|
||||
const int diff_stride = block_size_wide[plane_bsize];
|
||||
const int src_stride = p->src.stride;
|
||||
const int dst_stride = pd->dst.stride;
|
||||
const int tx1d_width = tx_size_wide[tx_size];
|
||||
const int tx1d_height = tx_size_high[tx_size];
|
||||
const SCAN_ORDER *const scan_order = get_scan(cm, tx_size, tx_type, 0);
|
||||
tran_low_t *coeff = BLOCK_OFFSET(p->coeff, block);
|
||||
tran_low_t *qcoeff = BLOCK_OFFSET(p->qcoeff, block);
|
||||
uint8_t *dst =
|
||||
&pd->dst.buf[(blk_row * dst_stride + blk_col) << tx_size_wide_log2[0]];
|
||||
uint8_t *src =
|
||||
&p->src.buf[(blk_row * src_stride + blk_col) << tx_size_wide_log2[0]];
|
||||
int16_t *src_diff =
|
||||
&p->src_diff[(blk_row * diff_stride + blk_col) << tx_size_wide_log2[0]];
|
||||
uint16_t *eob = &p->eobs[block];
|
||||
*eob = 0;
|
||||
memset(qcoeff, 0, tx1d_height * tx1d_width * sizeof(*qcoeff));
|
||||
memset(dqcoeff, 0, tx1d_height * tx1d_width * sizeof(*dqcoeff));
|
||||
|
||||
if (LIKELY(!x->skip_block)) {
|
||||
TX_TYPE_1D tx_type_1d = DCT_1D;
|
||||
switch (tx_type) {
|
||||
case IDTX: tx_type_1d = IDTX_1D; break;
|
||||
case V_DCT:
|
||||
assert(mode == H_PRED);
|
||||
tx_type_1d = DCT_1D;
|
||||
break;
|
||||
case H_DCT:
|
||||
assert(mode == V_PRED);
|
||||
tx_type_1d = DCT_1D;
|
||||
break;
|
||||
default: assert(0);
|
||||
}
|
||||
switch (mode) {
|
||||
case V_PRED:
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
|
||||
hbd_process_block_dpcm_vert(tx_size, tx_type_1d, xd->bd, pd, p, src,
|
||||
src_stride, dst, dst_stride, src_diff,
|
||||
diff_stride, coeff, qcoeff, dqcoeff);
|
||||
} else {
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
process_block_dpcm_vert(tx_size, tx_type_1d, pd, p, src, src_stride,
|
||||
dst, dst_stride, src_diff, diff_stride, coeff,
|
||||
qcoeff, dqcoeff);
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
}
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
break;
|
||||
case H_PRED:
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
|
||||
hbd_process_block_dpcm_horz(tx_size, tx_type_1d, xd->bd, pd, p, src,
|
||||
src_stride, dst, dst_stride, src_diff,
|
||||
diff_stride, coeff, qcoeff, dqcoeff);
|
||||
} else {
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
process_block_dpcm_horz(tx_size, tx_type_1d, pd, p, src, src_stride,
|
||||
dst, dst_stride, src_diff, diff_stride, coeff,
|
||||
qcoeff, dqcoeff);
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
}
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
break;
|
||||
default: assert(0);
|
||||
}
|
||||
*eob = get_eob(qcoeff, tx1d_height * tx1d_width, scan_order->scan);
|
||||
}
|
||||
|
||||
ta[blk_col] = tl[blk_row] = *eob > 0;
|
||||
if (*eob) *skip = 0;
|
||||
}
|
||||
#endif // CONFIG_DPCM_INTRA
|
||||
|
||||
void av1_encode_block_intra(int plane, int block, int blk_row, int blk_col,
|
||||
BLOCK_SIZE plane_bsize, TX_SIZE tx_size,
|
||||
void *arg) {
|
||||
|
|
@ -1449,7 +1716,33 @@ void av1_encode_block_intra(int plane, int block, int blk_row, int blk_col,
|
|||
const int dst_stride = pd->dst.stride;
|
||||
uint8_t *dst =
|
||||
&pd->dst.buf[(blk_row * dst_stride + blk_col) << tx_size_wide_log2[0]];
|
||||
#if CONFIG_CFL
|
||||
|
||||
#if CONFIG_EC_ADAPT
|
||||
FRAME_CONTEXT *const ec_ctx = xd->tile_ctx;
|
||||
#else
|
||||
FRAME_CONTEXT *const ec_ctx = cm->fc;
|
||||
#endif // CONFIG_EC_ADAPT
|
||||
|
||||
av1_predict_intra_block_encoder_facade(x, ec_ctx, plane, block, blk_col,
|
||||
blk_row, tx_size, plane_bsize);
|
||||
#else
|
||||
av1_predict_intra_block_facade(xd, plane, block, blk_col, blk_row, tx_size);
|
||||
#endif
|
||||
|
||||
#if CONFIG_DPCM_INTRA
|
||||
const int block_raster_idx = av1_block_index_to_raster_order(tx_size, block);
|
||||
const MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
|
||||
const PREDICTION_MODE mode =
|
||||
(plane == 0) ? get_y_mode(xd->mi[0], block_raster_idx) : mbmi->uv_mode;
|
||||
if (av1_use_dpcm_intra(plane, mode, tx_type, mbmi)) {
|
||||
av1_encode_block_intra_dpcm(cm, x, mode, plane, block, blk_row, blk_col,
|
||||
plane_bsize, tx_size, tx_type, args->ta,
|
||||
args->tl, args->skip);
|
||||
return;
|
||||
}
|
||||
#endif // CONFIG_DPCM_INTRA
|
||||
|
||||
av1_subtract_txb(x, plane, plane_bsize, blk_col, blk_row, tx_size);
|
||||
|
||||
const ENTROPY_CONTEXT *a = &args->ta[blk_col];
|
||||
|
|
@ -1458,9 +1751,7 @@ void av1_encode_block_intra(int plane, int block, int blk_row, int blk_col,
|
|||
if (args->enable_optimize_b) {
|
||||
av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size,
|
||||
ctx, AV1_XFORM_QUANT_FP);
|
||||
if (p->eobs[block]) {
|
||||
av1_optimize_b(cm, x, plane, block, tx_size, ctx);
|
||||
}
|
||||
av1_optimize_b(cm, x, plane, block, plane_bsize, tx_size, a, l);
|
||||
} else {
|
||||
av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size,
|
||||
ctx, AV1_XFORM_QUANT_B);
|
||||
|
|
@ -1480,16 +1771,216 @@ void av1_encode_block_intra(int plane, int block, int blk_row, int blk_col,
|
|||
// Note : *(args->skip) == mbmi->skip
|
||||
#endif
|
||||
#if CONFIG_CFL
|
||||
MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
|
||||
if (plane == AOM_PLANE_Y && x->cfl_store_y) {
|
||||
cfl_store(xd->cfl, dst, dst_stride, blk_row, blk_col, tx_size);
|
||||
}
|
||||
|
||||
if (mbmi->uv_mode == DC_PRED) {
|
||||
// TODO(ltrudeau) find a cleaner way to detect last transform block
|
||||
if (plane == AOM_PLANE_U) {
|
||||
xd->cfl->num_tx_blk[CFL_PRED_U] =
|
||||
(blk_row == 0 && blk_col == 0) ? 1
|
||||
: xd->cfl->num_tx_blk[CFL_PRED_U] + 1;
|
||||
}
|
||||
|
||||
if (plane == AOM_PLANE_V) {
|
||||
xd->cfl->num_tx_blk[CFL_PRED_V] =
|
||||
(blk_row == 0 && blk_col == 0) ? 1
|
||||
: xd->cfl->num_tx_blk[CFL_PRED_V] + 1;
|
||||
|
||||
if (mbmi->skip &&
|
||||
xd->cfl->num_tx_blk[CFL_PRED_U] == xd->cfl->num_tx_blk[CFL_PRED_V]) {
|
||||
assert(plane_bsize != BLOCK_INVALID);
|
||||
const int block_width = block_size_wide[plane_bsize];
|
||||
const int block_height = block_size_high[plane_bsize];
|
||||
|
||||
// if SKIP is chosen at the block level, and ind != 0, we must change
|
||||
// the prediction
|
||||
if (mbmi->cfl_alpha_idx != 0) {
|
||||
const struct macroblockd_plane *const pd_cb = &xd->plane[AOM_PLANE_U];
|
||||
uint8_t *const dst_cb = pd_cb->dst.buf;
|
||||
const int dst_stride_cb = pd_cb->dst.stride;
|
||||
uint8_t *const dst_cr = pd->dst.buf;
|
||||
const int dst_stride_cr = pd->dst.stride;
|
||||
for (int j = 0; j < block_height; j++) {
|
||||
for (int i = 0; i < block_width; i++) {
|
||||
dst_cb[dst_stride_cb * j + i] =
|
||||
(uint8_t)(xd->cfl->dc_pred[CFL_PRED_U] + 0.5);
|
||||
dst_cr[dst_stride_cr * j + i] =
|
||||
(uint8_t)(xd->cfl->dc_pred[CFL_PRED_V] + 0.5);
|
||||
}
|
||||
}
|
||||
mbmi->cfl_alpha_idx = 0;
|
||||
mbmi->cfl_alpha_signs[CFL_PRED_U] = CFL_SIGN_POS;
|
||||
mbmi->cfl_alpha_signs[CFL_PRED_V] = CFL_SIGN_POS;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if CONFIG_CFL
|
||||
static int cfl_alpha_dist(const uint8_t *y_pix, int y_stride, double y_avg,
|
||||
const uint8_t *src, int src_stride, int blk_width,
|
||||
int blk_height, double dc_pred, double alpha,
|
||||
int *dist_neg_out) {
|
||||
const double dc_pred_bias = dc_pred + 0.5;
|
||||
int dist = 0;
|
||||
int diff;
|
||||
|
||||
if (alpha == 0.0) {
|
||||
const int dc_pred_i = (int)dc_pred_bias;
|
||||
for (int j = 0; j < blk_height; j++) {
|
||||
for (int i = 0; i < blk_width; i++) {
|
||||
diff = src[i] - dc_pred_i;
|
||||
dist += diff * diff;
|
||||
}
|
||||
src += src_stride;
|
||||
}
|
||||
|
||||
if (dist_neg_out) *dist_neg_out = dist;
|
||||
|
||||
return dist;
|
||||
}
|
||||
|
||||
int dist_neg = 0;
|
||||
for (int j = 0; j < blk_height; j++) {
|
||||
for (int i = 0; i < blk_width; i++) {
|
||||
const double scaled_luma = alpha * (y_pix[i] - y_avg);
|
||||
const int uv = src[i];
|
||||
diff = uv - (int)(scaled_luma + dc_pred_bias);
|
||||
dist += diff * diff;
|
||||
diff = uv + (int)(scaled_luma - dc_pred_bias);
|
||||
dist_neg += diff * diff;
|
||||
}
|
||||
y_pix += y_stride;
|
||||
src += src_stride;
|
||||
}
|
||||
|
||||
if (dist_neg_out) *dist_neg_out = dist_neg;
|
||||
|
||||
return dist;
|
||||
}
|
||||
|
||||
static int cfl_compute_alpha_ind(MACROBLOCK *const x, const CFL_CTX *const cfl,
|
||||
BLOCK_SIZE bsize,
|
||||
CFL_SIGN_TYPE signs_out[CFL_SIGNS]) {
|
||||
const struct macroblock_plane *const p_u = &x->plane[AOM_PLANE_U];
|
||||
const struct macroblock_plane *const p_v = &x->plane[AOM_PLANE_V];
|
||||
const uint8_t *const src_u = p_u->src.buf;
|
||||
const uint8_t *const src_v = p_v->src.buf;
|
||||
const int src_stride_u = p_u->src.stride;
|
||||
const int src_stride_v = p_v->src.stride;
|
||||
const int block_width = block_size_wide[bsize];
|
||||
const int block_height = block_size_high[bsize];
|
||||
const double dc_pred_u = cfl->dc_pred[CFL_PRED_U];
|
||||
const double dc_pred_v = cfl->dc_pred[CFL_PRED_V];
|
||||
|
||||
// Temporary pixel buffer used to store the CfL prediction when we compute the
|
||||
// alpha index.
|
||||
uint8_t tmp_pix[MAX_SB_SQUARE];
|
||||
// Load CfL Prediction over the entire block
|
||||
const double y_avg =
|
||||
cfl_load(cfl, tmp_pix, MAX_SB_SIZE, 0, 0, block_width, block_height);
|
||||
|
||||
int sse[CFL_PRED_PLANES][CFL_MAGS_SIZE];
|
||||
sse[CFL_PRED_U][0] =
|
||||
cfl_alpha_dist(tmp_pix, MAX_SB_SIZE, y_avg, src_u, src_stride_u,
|
||||
block_width, block_height, dc_pred_u, 0, NULL);
|
||||
sse[CFL_PRED_V][0] =
|
||||
cfl_alpha_dist(tmp_pix, MAX_SB_SIZE, y_avg, src_v, src_stride_v,
|
||||
block_width, block_height, dc_pred_v, 0, NULL);
|
||||
for (int m = 1; m < CFL_MAGS_SIZE; m += 2) {
|
||||
assert(cfl_alpha_mags[m + 1] == -cfl_alpha_mags[m]);
|
||||
sse[CFL_PRED_U][m] = cfl_alpha_dist(
|
||||
tmp_pix, MAX_SB_SIZE, y_avg, src_u, src_stride_u, block_width,
|
||||
block_height, dc_pred_u, cfl_alpha_mags[m], &sse[CFL_PRED_U][m + 1]);
|
||||
sse[CFL_PRED_V][m] = cfl_alpha_dist(
|
||||
tmp_pix, MAX_SB_SIZE, y_avg, src_v, src_stride_v, block_width,
|
||||
block_height, dc_pred_v, cfl_alpha_mags[m], &sse[CFL_PRED_V][m + 1]);
|
||||
}
|
||||
|
||||
int dist;
|
||||
int64_t cost;
|
||||
int64_t best_cost;
|
||||
|
||||
// Compute least squares parameter of the entire block
|
||||
// IMPORTANT: We assume that the first code is 0,0
|
||||
int ind = 0;
|
||||
signs_out[CFL_PRED_U] = CFL_SIGN_POS;
|
||||
signs_out[CFL_PRED_V] = CFL_SIGN_POS;
|
||||
|
||||
dist = sse[CFL_PRED_U][0] + sse[CFL_PRED_V][0];
|
||||
dist *= 16;
|
||||
best_cost = RDCOST(x->rdmult, x->rddiv, cfl->costs[0], dist);
|
||||
|
||||
for (int c = 1; c < CFL_ALPHABET_SIZE; c++) {
|
||||
const int idx_u = cfl_alpha_codes[c][CFL_PRED_U];
|
||||
const int idx_v = cfl_alpha_codes[c][CFL_PRED_V];
|
||||
for (CFL_SIGN_TYPE sign_u = idx_u == 0; sign_u < CFL_SIGNS; sign_u++) {
|
||||
for (CFL_SIGN_TYPE sign_v = idx_v == 0; sign_v < CFL_SIGNS; sign_v++) {
|
||||
dist = sse[CFL_PRED_U][idx_u + (sign_u == CFL_SIGN_NEG)] +
|
||||
sse[CFL_PRED_V][idx_v + (sign_v == CFL_SIGN_NEG)];
|
||||
dist *= 16;
|
||||
cost = RDCOST(x->rdmult, x->rddiv, cfl->costs[c], dist);
|
||||
if (cost < best_cost) {
|
||||
best_cost = cost;
|
||||
ind = c;
|
||||
signs_out[CFL_PRED_U] = sign_u;
|
||||
signs_out[CFL_PRED_V] = sign_v;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ind;
|
||||
}
|
||||
|
||||
static inline void cfl_update_costs(CFL_CTX *cfl, FRAME_CONTEXT *ec_ctx) {
|
||||
assert(ec_ctx->cfl_alpha_cdf[CFL_ALPHABET_SIZE - 1] ==
|
||||
AOM_ICDF(CDF_PROB_TOP));
|
||||
const int prob_den = CDF_PROB_TOP;
|
||||
|
||||
int prob_num = AOM_ICDF(ec_ctx->cfl_alpha_cdf[0]);
|
||||
cfl->costs[0] = av1_cost_zero(get_prob(prob_num, prob_den));
|
||||
|
||||
for (int c = 1; c < CFL_ALPHABET_SIZE; c++) {
|
||||
int sign_bit_cost = (cfl_alpha_codes[c][CFL_PRED_U] != 0) +
|
||||
(cfl_alpha_codes[c][CFL_PRED_V] != 0);
|
||||
prob_num = AOM_ICDF(ec_ctx->cfl_alpha_cdf[c]) -
|
||||
AOM_ICDF(ec_ctx->cfl_alpha_cdf[c - 1]);
|
||||
cfl->costs[c] = av1_cost_zero(get_prob(prob_num, prob_den)) +
|
||||
av1_cost_literal(sign_bit_cost);
|
||||
}
|
||||
}
|
||||
|
||||
void av1_predict_intra_block_encoder_facade(MACROBLOCK *x,
|
||||
FRAME_CONTEXT *ec_ctx, int plane,
|
||||
int block_idx, int blk_col,
|
||||
int blk_row, TX_SIZE tx_size,
|
||||
BLOCK_SIZE plane_bsize) {
|
||||
MACROBLOCKD *const xd = &x->e_mbd;
|
||||
MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
|
||||
if (plane != AOM_PLANE_Y && mbmi->uv_mode == DC_PRED) {
|
||||
if (blk_col == 0 && blk_row == 0 && plane == AOM_PLANE_U) {
|
||||
CFL_CTX *const cfl = xd->cfl;
|
||||
cfl_update_costs(cfl, ec_ctx);
|
||||
cfl_dc_pred(xd, plane_bsize, tx_size);
|
||||
mbmi->cfl_alpha_idx =
|
||||
cfl_compute_alpha_ind(x, cfl, plane_bsize, mbmi->cfl_alpha_signs);
|
||||
}
|
||||
}
|
||||
av1_predict_intra_block_facade(xd, plane, block_idx, blk_col, blk_row,
|
||||
tx_size);
|
||||
}
|
||||
#endif
|
||||
|
||||
void av1_encode_intra_block_plane(AV1_COMMON *cm, MACROBLOCK *x,
|
||||
BLOCK_SIZE bsize, int plane,
|
||||
int enable_optimize_b, const int mi_row,
|
||||
const int mi_col) {
|
||||
int enable_optimize_b, int mi_row,
|
||||
int mi_col) {
|
||||
const MACROBLOCKD *const xd = &x->e_mbd;
|
||||
ENTROPY_CONTEXT ta[2 * MAX_MIB_SIZE] = { 0 };
|
||||
ENTROPY_CONTEXT tl[2 * MAX_MIB_SIZE] = { 0 };
|
||||
|
|
@ -1545,9 +2036,7 @@ PVQ_SKIP_TYPE av1_pvq_encode_helper(MACROBLOCK *x, tran_low_t *const coeff,
|
|||
DECLARE_ALIGNED(16, int32_t, ref_int32[OD_TXSIZE_MAX * OD_TXSIZE_MAX]);
|
||||
DECLARE_ALIGNED(16, int32_t, out_int32[OD_TXSIZE_MAX * OD_TXSIZE_MAX]);
|
||||
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
hbd_downshift = x->e_mbd.bd - 8;
|
||||
#endif
|
||||
|
||||
assert(OD_COEFF_SHIFT >= 4);
|
||||
// DC quantizer for PVQ
|
||||
|
|
@ -1563,10 +2052,10 @@ PVQ_SKIP_TYPE av1_pvq_encode_helper(MACROBLOCK *x, tran_low_t *const coeff,
|
|||
|
||||
*eob = 0;
|
||||
|
||||
#if CONFIG_DAALA_EC
|
||||
#if !CONFIG_ANS
|
||||
tell = od_ec_enc_tell_frac(&daala_enc->w.ec);
|
||||
#else
|
||||
#error "CONFIG_PVQ currently requires CONFIG_DAALA_EC."
|
||||
#error "CONFIG_PVQ currently requires !CONFIG_ANS."
|
||||
#endif
|
||||
|
||||
// Change coefficient ordering for pvq encoding.
|
||||
|
|
@ -1635,11 +2124,11 @@ PVQ_SKIP_TYPE av1_pvq_encode_helper(MACROBLOCK *x, tran_low_t *const coeff,
|
|||
|
||||
*eob = tx_blk_size * tx_blk_size;
|
||||
|
||||
#if CONFIG_DAALA_EC
|
||||
#if !CONFIG_ANS
|
||||
*rate = (od_ec_enc_tell_frac(&daala_enc->w.ec) - tell)
|
||||
<< (AV1_PROB_COST_SHIFT - OD_BITRES);
|
||||
#else
|
||||
#error "CONFIG_PVQ currently requires CONFIG_DAALA_EC."
|
||||
#error "CONFIG_PVQ currently requires !CONFIG_ANS."
|
||||
#endif
|
||||
assert(*rate >= 0);
|
||||
|
||||
|
|
|
|||
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