mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-09 00:37:32 +09:00
Update libaom to rev b25610052a1398032320008d69b51d2da94f5928
This commit is contained in:
parent
8493557d20
commit
3d109dd4fc
240 changed files with 16977 additions and 6139 deletions
10
third_party/aom/av1/av1.cmake
vendored
10
third_party/aom/av1/av1.cmake
vendored
|
|
@ -45,7 +45,6 @@ list(APPEND AOM_AV1_COMMON_SOURCES
|
|||
"${AOM_ROOT}/av1/common/entropymv.c"
|
||||
"${AOM_ROOT}/av1/common/entropymv.h"
|
||||
"${AOM_ROOT}/av1/common/enums.h"
|
||||
"${AOM_ROOT}/av1/common/filter.c"
|
||||
"${AOM_ROOT}/av1/common/filter.h"
|
||||
"${AOM_ROOT}/av1/common/frame_buffers.c"
|
||||
"${AOM_ROOT}/av1/common/frame_buffers.h"
|
||||
|
|
@ -274,7 +273,10 @@ list(APPEND AOM_AV1_ENCODER_INTRIN_SSE4_1
|
|||
list(APPEND AOM_AV1_ENCODER_INTRIN_AVX2
|
||||
"${AOM_ROOT}/av1/encoder/x86/av1_quantize_avx2.c"
|
||||
"${AOM_ROOT}/av1/encoder/x86/av1_highbd_quantize_avx2.c"
|
||||
"${AOM_ROOT}/av1/encoder/x86/error_intrin_avx2.c")
|
||||
"${AOM_ROOT}/av1/encoder/x86/error_intrin_avx2.c"
|
||||
"${AOM_ROOT}/av1/encoder/x86/av1_fwd_txfm_avx2.h"
|
||||
"${AOM_ROOT}/av1/encoder/x86/av1_fwd_txfm2d_avx2.c"
|
||||
"${AOM_ROOT}/av1/encoder/x86/wedge_utils_avx2.c")
|
||||
|
||||
list(APPEND AOM_AV1_ENCODER_INTRIN_NEON
|
||||
"${AOM_ROOT}/av1/encoder/arm/neon/quantize_neon.c")
|
||||
|
|
@ -296,7 +298,9 @@ list(APPEND AOM_AV1_COMMON_INTRIN_NEON
|
|||
"${AOM_ROOT}/av1/common/arm/blend_a64_vmask_neon.c"
|
||||
"${AOM_ROOT}/av1/common/arm/reconinter_neon.c"
|
||||
"${AOM_ROOT}/av1/common/arm/wiener_convolve_neon.c"
|
||||
"${AOM_ROOT}/av1/common/arm/intrapred_neon.c"
|
||||
"${AOM_ROOT}/av1/common/arm/selfguided_neon.c"
|
||||
"${AOM_ROOT}/av1/common/arm/av1_inv_txfm_neon.c"
|
||||
"${AOM_ROOT}/av1/common/arm/av1_inv_txfm_neon.h"
|
||||
"${AOM_ROOT}/av1/common/cdef_block_neon.c")
|
||||
|
||||
list(APPEND AOM_AV1_ENCODER_INTRIN_SSE4_2
|
||||
|
|
|
|||
59
third_party/aom/av1/av1_cx_iface.c
vendored
59
third_party/aom/av1/av1_cx_iface.c
vendored
|
|
@ -94,6 +94,10 @@ struct av1_extracfg {
|
|||
int enable_warped_motion; // sequence level
|
||||
int allow_warped_motion; // frame level
|
||||
int enable_superres;
|
||||
#if CONFIG_DENOISE
|
||||
float noise_level;
|
||||
int noise_block_size;
|
||||
#endif
|
||||
};
|
||||
|
||||
static struct av1_extracfg default_extra_cfg = {
|
||||
|
|
@ -160,6 +164,10 @@ static struct av1_extracfg default_extra_cfg = {
|
|||
1, // enable_warped_motion at sequence level
|
||||
1, // allow_warped_motion at frame level
|
||||
1, // superres
|
||||
#if CONFIG_DENOISE
|
||||
0, // noise_level
|
||||
32, // noise_block_size
|
||||
#endif
|
||||
};
|
||||
|
||||
struct aom_codec_alg_priv {
|
||||
|
|
@ -464,7 +472,7 @@ static aom_codec_err_t set_encoder_config(
|
|||
oxcf->buffer_model.num_units_in_decoding_tick = cfg->g_timebase.num;
|
||||
oxcf->timing_info.equal_picture_interval = 0;
|
||||
oxcf->decoder_model_info_present_flag = 1;
|
||||
oxcf->buffer_removal_delay_present = 1;
|
||||
oxcf->buffer_removal_time_present = 1;
|
||||
oxcf->display_model_info_present_flag = 1;
|
||||
}
|
||||
if (oxcf->init_framerate > 180) {
|
||||
|
|
@ -612,6 +620,10 @@ static aom_codec_err_t set_encoder_config(
|
|||
oxcf->film_grain_test_vector = extra_cfg->film_grain_test_vector;
|
||||
oxcf->film_grain_table_filename = extra_cfg->film_grain_table_filename;
|
||||
}
|
||||
#if CONFIG_DENOISE
|
||||
oxcf->noise_level = extra_cfg->noise_level;
|
||||
oxcf->noise_block_size = extra_cfg->noise_block_size;
|
||||
#endif
|
||||
oxcf->large_scale_tile = cfg->large_scale_tile;
|
||||
oxcf->single_tile_decoding =
|
||||
(oxcf->large_scale_tile) ? extra_cfg->single_tile_decoding : 0;
|
||||
|
|
@ -710,7 +722,7 @@ static aom_codec_err_t encoder_set_config(aom_codec_alg_priv_t *ctx,
|
|||
ctx->cfg = *cfg;
|
||||
set_encoder_config(&ctx->oxcf, &ctx->cfg, &ctx->extra_cfg);
|
||||
// On profile change, request a key frame
|
||||
force_key |= ctx->cpi->common.profile != ctx->oxcf.profile;
|
||||
force_key |= ctx->cpi->common.seq_params.profile != ctx->oxcf.profile;
|
||||
av1_change_config(ctx->cpi, &ctx->oxcf);
|
||||
}
|
||||
|
||||
|
|
@ -1055,6 +1067,23 @@ static aom_codec_err_t ctrl_set_film_grain_table(aom_codec_alg_priv_t *ctx,
|
|||
return update_extra_cfg(ctx, &extra_cfg);
|
||||
}
|
||||
|
||||
#if CONFIG_DENOISE
|
||||
static aom_codec_err_t ctrl_set_denoise_noise_level(aom_codec_alg_priv_t *ctx,
|
||||
va_list args) {
|
||||
struct av1_extracfg extra_cfg = ctx->extra_cfg;
|
||||
extra_cfg.noise_level =
|
||||
((float)CAST(AV1E_SET_DENOISE_NOISE_LEVEL, args)) / 10.0f;
|
||||
return update_extra_cfg(ctx, &extra_cfg);
|
||||
}
|
||||
|
||||
static aom_codec_err_t ctrl_set_denoise_block_size(aom_codec_alg_priv_t *ctx,
|
||||
va_list args) {
|
||||
struct av1_extracfg extra_cfg = ctx->extra_cfg;
|
||||
extra_cfg.noise_block_size = CAST(AV1E_SET_DENOISE_BLOCK_SIZE, args);
|
||||
return update_extra_cfg(ctx, &extra_cfg);
|
||||
}
|
||||
#endif
|
||||
|
||||
static aom_codec_err_t ctrl_set_deltaq_mode(aom_codec_alg_priv_t *ctx,
|
||||
va_list args) {
|
||||
struct av1_extracfg extra_cfg = ctx->extra_cfg;
|
||||
|
|
@ -1119,7 +1148,7 @@ static aom_codec_err_t encoder_init(aom_codec_ctx_t *ctx,
|
|||
}
|
||||
|
||||
priv->extra_cfg = default_extra_cfg;
|
||||
once(av1_initialize_enc);
|
||||
aom_once(av1_initialize_enc);
|
||||
|
||||
res = validate_config(priv, &priv->cfg, &priv->extra_cfg);
|
||||
|
||||
|
|
@ -1200,6 +1229,9 @@ static aom_codec_err_t encoder_encode(aom_codec_alg_priv_t *ctx,
|
|||
|
||||
volatile aom_enc_frame_flags_t flags = enc_flags;
|
||||
|
||||
// The jmp_buf is valid only for the duration of the function that calls
|
||||
// setjmp(). Therefore, this function must reset the 'setjmp' field to 0
|
||||
// before it returns.
|
||||
if (setjmp(cpi->common.error.jmp)) {
|
||||
cpi->common.error.setjmp = 0;
|
||||
res = update_error_state(ctx, &cpi->common.error);
|
||||
|
|
@ -1259,7 +1291,6 @@ static aom_codec_err_t encoder_encode(aom_codec_alg_priv_t *ctx,
|
|||
if (cx_data_sz < ctx->cx_data_sz / 2) {
|
||||
aom_internal_error(&cpi->common.error, AOM_CODEC_ERROR,
|
||||
"Compressed data buffer too small");
|
||||
return AOM_CODEC_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1275,8 +1306,8 @@ static aom_codec_err_t encoder_encode(aom_codec_alg_priv_t *ctx,
|
|||
!img, timebase)) {
|
||||
if (cpi->common.seq_params.frame_id_numbers_present_flag) {
|
||||
if (cpi->common.invalid_delta_frame_id_minus_1) {
|
||||
ctx->base.err_detail = "Invalid delta_frame_id_minus_1";
|
||||
return AOM_CODEC_ERROR;
|
||||
aom_internal_error(&cpi->common.error, AOM_CODEC_ERROR,
|
||||
"Invalid delta_frame_id_minus_1");
|
||||
}
|
||||
}
|
||||
cpi->seq_params_locked = 1;
|
||||
|
|
@ -1305,7 +1336,7 @@ static aom_codec_err_t encoder_encode(aom_codec_alg_priv_t *ctx,
|
|||
// OBUs are preceded/succeeded by an unsigned leb128 coded integer.
|
||||
if (write_uleb_obu_size(obu_header_size, obu_payload_size,
|
||||
ctx->pending_cx_data) != AOM_CODEC_OK) {
|
||||
return AOM_CODEC_ERROR;
|
||||
aom_internal_error(&cpi->common.error, AOM_CODEC_ERROR, NULL);
|
||||
}
|
||||
|
||||
frame_size += obu_header_size + obu_payload_size + length_field_size;
|
||||
|
|
@ -1315,7 +1346,7 @@ static aom_codec_err_t encoder_encode(aom_codec_alg_priv_t *ctx,
|
|||
size_t curr_frame_size = frame_size;
|
||||
if (av1_convert_sect5obus_to_annexb(cx_data, &curr_frame_size) !=
|
||||
AOM_CODEC_OK) {
|
||||
return AOM_CODEC_ERROR;
|
||||
aom_internal_error(&cpi->common.error, AOM_CODEC_ERROR, NULL);
|
||||
}
|
||||
frame_size = curr_frame_size;
|
||||
|
||||
|
|
@ -1327,7 +1358,7 @@ static aom_codec_err_t encoder_encode(aom_codec_alg_priv_t *ctx,
|
|||
}
|
||||
if (write_uleb_obu_size(0, (uint32_t)frame_size, cx_data) !=
|
||||
AOM_CODEC_OK) {
|
||||
return AOM_CODEC_ERROR;
|
||||
aom_internal_error(&cpi->common.error, AOM_CODEC_ERROR, NULL);
|
||||
}
|
||||
frame_size += length_field_size;
|
||||
}
|
||||
|
|
@ -1358,7 +1389,7 @@ static aom_codec_err_t encoder_encode(aom_codec_alg_priv_t *ctx,
|
|||
}
|
||||
if (write_uleb_obu_size(0, (uint32_t)tu_size, ctx->pending_cx_data) !=
|
||||
AOM_CODEC_OK) {
|
||||
return AOM_CODEC_ERROR;
|
||||
aom_internal_error(&cpi->common.error, AOM_CODEC_ERROR, NULL);
|
||||
}
|
||||
ctx->pending_cx_data_sz += length_field_size;
|
||||
}
|
||||
|
|
@ -1710,6 +1741,10 @@ static aom_codec_ctrl_fn_map_t encoder_ctrl_maps[] = {
|
|||
{ AV1E_SET_SINGLE_TILE_DECODING, ctrl_set_single_tile_decoding },
|
||||
{ AV1E_SET_FILM_GRAIN_TEST_VECTOR, ctrl_set_film_grain_test_vector },
|
||||
{ AV1E_SET_FILM_GRAIN_TABLE, ctrl_set_film_grain_table },
|
||||
#if CONFIG_DENOISE
|
||||
{ AV1E_SET_DENOISE_NOISE_LEVEL, ctrl_set_denoise_noise_level },
|
||||
{ AV1E_SET_DENOISE_BLOCK_SIZE, ctrl_set_denoise_block_size },
|
||||
#endif // CONFIG_FILM_GRAIN
|
||||
{ AV1E_ENABLE_MOTION_VECTOR_UNIT_TEST, ctrl_enable_motion_vector_unit_test },
|
||||
|
||||
// Getters
|
||||
|
|
@ -1728,7 +1763,7 @@ static aom_codec_enc_cfg_map_t encoder_usage_cfg_map[] = {
|
|||
{
|
||||
// NOLINT
|
||||
0, // g_usage
|
||||
8, // g_threads
|
||||
0, // g_threads
|
||||
0, // g_profile
|
||||
|
||||
320, // g_width
|
||||
|
|
@ -1810,7 +1845,7 @@ CODEC_INTERFACE(aom_codec_av1_cx) = {
|
|||
NULL, // aom_codec_peek_si_fn_t
|
||||
NULL, // aom_codec_get_si_fn_t
|
||||
NULL, // aom_codec_decode_fn_t
|
||||
NULL, // aom_codec_frame_get_fn_t
|
||||
NULL, // aom_codec_get_frame_fn_t
|
||||
NULL // aom_codec_set_fb_fn_t
|
||||
},
|
||||
{
|
||||
|
|
|
|||
135
third_party/aom/av1/av1_dx_iface.c
vendored
135
third_party/aom/av1/av1_dx_iface.c
vendored
|
|
@ -50,6 +50,7 @@ struct aom_codec_alg_priv {
|
|||
int decode_tile_col;
|
||||
unsigned int tile_mode;
|
||||
unsigned int ext_tile_debug;
|
||||
unsigned int row_mt;
|
||||
EXTERNAL_REFERENCES ext_refs;
|
||||
unsigned int is_annexb;
|
||||
int operating_point;
|
||||
|
|
@ -61,7 +62,7 @@ struct aom_codec_alg_priv {
|
|||
int last_submit_worker_id;
|
||||
int next_output_worker_id;
|
||||
int available_threads;
|
||||
aom_image_t *image_with_grain;
|
||||
aom_image_t *image_with_grain[MAX_NUM_SPATIAL_LAYERS];
|
||||
int need_resync; // wait for key/intra-only frame
|
||||
// BufferPool that holds all reference frames. Shared by all the FrameWorkers.
|
||||
BufferPool *buffer_pool;
|
||||
|
|
@ -101,7 +102,7 @@ static aom_codec_err_t decoder_init(aom_codec_ctx_t *ctx,
|
|||
// default values
|
||||
priv->cfg.cfg.ext_partition = 1;
|
||||
}
|
||||
priv->image_with_grain = NULL;
|
||||
av1_zero(priv->image_with_grain);
|
||||
}
|
||||
|
||||
return AOM_CODEC_OK;
|
||||
|
|
@ -139,7 +140,9 @@ static aom_codec_err_t decoder_destroy(aom_codec_alg_priv_t *ctx) {
|
|||
|
||||
aom_free(ctx->frame_workers);
|
||||
aom_free(ctx->buffer_pool);
|
||||
if (ctx->image_with_grain) aom_img_free(ctx->image_with_grain);
|
||||
for (int i = 0; i < MAX_NUM_SPATIAL_LAYERS; i++) {
|
||||
if (ctx->image_with_grain[i]) aom_img_free(ctx->image_with_grain[i]);
|
||||
}
|
||||
aom_free(ctx);
|
||||
return AOM_CODEC_OK;
|
||||
}
|
||||
|
|
@ -339,16 +342,16 @@ static int frame_worker_hook(void *arg1, void *arg2) {
|
|||
const uint8_t *data = frame_worker_data->data;
|
||||
(void)arg2;
|
||||
|
||||
frame_worker_data->result = av1_receive_compressed_data(
|
||||
frame_worker_data->pbi, frame_worker_data->data_size, &data);
|
||||
int result = av1_receive_compressed_data(frame_worker_data->pbi,
|
||||
frame_worker_data->data_size, &data);
|
||||
frame_worker_data->data_end = data;
|
||||
|
||||
if (frame_worker_data->result != 0) {
|
||||
if (result != 0) {
|
||||
// Check decode result in serial decode.
|
||||
frame_worker_data->pbi->cur_buf->buf.corrupted = 1;
|
||||
frame_worker_data->pbi->need_resync = 1;
|
||||
}
|
||||
return !frame_worker_data->result;
|
||||
return !result;
|
||||
}
|
||||
|
||||
static aom_codec_err_t init_decoder(aom_codec_alg_priv_t *ctx) {
|
||||
|
|
@ -429,6 +432,7 @@ static aom_codec_err_t init_decoder(aom_codec_alg_priv_t *ctx) {
|
|||
frame_worker_data->pbi->operating_point = ctx->operating_point;
|
||||
frame_worker_data->pbi->output_all_layers = ctx->output_all_layers;
|
||||
frame_worker_data->pbi->ext_tile_debug = ctx->ext_tile_debug;
|
||||
frame_worker_data->pbi->row_mt = ctx->row_mt;
|
||||
|
||||
worker->hook = (AVxWorkerHook)frame_worker_hook;
|
||||
if (!winterface->reset(worker)) {
|
||||
|
|
@ -489,6 +493,7 @@ static aom_codec_err_t decode_one(aom_codec_alg_priv_t *ctx,
|
|||
frame_worker_data->pbi->dec_tile_row = ctx->decode_tile_row;
|
||||
frame_worker_data->pbi->dec_tile_col = ctx->decode_tile_col;
|
||||
frame_worker_data->pbi->ext_tile_debug = ctx->ext_tile_debug;
|
||||
frame_worker_data->pbi->row_mt = ctx->row_mt;
|
||||
frame_worker_data->pbi->ext_refs = ctx->ext_refs;
|
||||
|
||||
frame_worker_data->pbi->common.is_annexb = ctx->is_annexb;
|
||||
|
|
@ -592,21 +597,31 @@ static aom_codec_err_t decoder_decode(aom_codec_alg_priv_t *ctx,
|
|||
return res;
|
||||
}
|
||||
|
||||
aom_image_t *add_grain_if_needed(aom_image_t *img, aom_image_t *grain_img_buf,
|
||||
aom_film_grain_t *grain_params) {
|
||||
// If grain_params->apply_grain is false, returns img. Otherwise, adds film
|
||||
// grain to img, saves the result in *grain_img_ptr (allocating *grain_img_ptr
|
||||
// if necessary), and returns *grain_img_ptr.
|
||||
static aom_image_t *add_grain_if_needed(aom_image_t *img,
|
||||
aom_image_t **grain_img_ptr,
|
||||
aom_film_grain_t *grain_params) {
|
||||
if (!grain_params->apply_grain) return img;
|
||||
|
||||
if (grain_img_buf &&
|
||||
(img->d_w != grain_img_buf->d_w || img->d_h != grain_img_buf->d_h ||
|
||||
img->fmt != grain_img_buf->fmt || !(img->d_h % 2) || !(img->d_w % 2))) {
|
||||
aom_img_free(grain_img_buf);
|
||||
grain_img_buf = NULL;
|
||||
aom_image_t *grain_img_buf = *grain_img_ptr;
|
||||
|
||||
const int w_even = ALIGN_POWER_OF_TWO(img->d_w, 1);
|
||||
const int h_even = ALIGN_POWER_OF_TWO(img->d_h, 1);
|
||||
|
||||
if (grain_img_buf) {
|
||||
const int alloc_w = ALIGN_POWER_OF_TWO(grain_img_buf->d_w, 1);
|
||||
const int alloc_h = ALIGN_POWER_OF_TWO(grain_img_buf->d_h, 1);
|
||||
if (w_even != alloc_w || h_even != alloc_h ||
|
||||
img->fmt != grain_img_buf->fmt) {
|
||||
aom_img_free(grain_img_buf);
|
||||
grain_img_buf = NULL;
|
||||
}
|
||||
}
|
||||
if (!grain_img_buf) {
|
||||
int w_even = img->d_w % 2 ? img->d_w + 1 : img->d_w;
|
||||
int h_even = img->d_h % 2 ? img->d_h + 1 : img->d_h;
|
||||
grain_img_buf = aom_img_alloc(NULL, img->fmt, w_even, h_even, 16);
|
||||
grain_img_buf->bit_depth = img->bit_depth;
|
||||
*grain_img_ptr = grain_img_buf;
|
||||
}
|
||||
|
||||
av1_add_film_grain(grain_params, img, grain_img_buf);
|
||||
|
|
@ -649,8 +664,6 @@ static aom_image_t *decoder_get_frame(aom_codec_alg_priv_t *ctx,
|
|||
aom_film_grain_t *grain_params;
|
||||
if (av1_get_raw_frame(frame_worker_data->pbi, *index, &sd,
|
||||
&grain_params) == 0) {
|
||||
*index += 1; // Advance the iterator to point to the next image
|
||||
|
||||
AV1Decoder *const pbi = frame_worker_data->pbi;
|
||||
AV1_COMMON *const cm = &pbi->common;
|
||||
RefCntBuffer *const frame_bufs = cm->buffer_pool->frame_bufs;
|
||||
|
|
@ -659,6 +672,7 @@ static aom_image_t *decoder_get_frame(aom_codec_alg_priv_t *ctx,
|
|||
yuvconfig2image(&ctx->img, sd, frame_worker_data->user_priv);
|
||||
|
||||
if (!pbi->ext_tile_debug && cm->large_scale_tile) {
|
||||
*index += 1; // Advance the iterator to point to the next image
|
||||
img = &ctx->img;
|
||||
img->img_data = pbi->tile_list_output;
|
||||
img->sz = pbi->tile_list_size;
|
||||
|
|
@ -688,11 +702,14 @@ static aom_image_t *decoder_get_frame(aom_codec_alg_priv_t *ctx,
|
|||
const int tile_col = AOMMIN(pbi->dec_tile_col, cm->tile_cols - 1);
|
||||
const int mi_col = tile_col * cm->tile_width;
|
||||
const int ssx = ctx->img.x_chroma_shift;
|
||||
const int is_hbd =
|
||||
(ctx->img.fmt & AOM_IMG_FMT_HIGHBITDEPTH) ? 1 : 0;
|
||||
int plane;
|
||||
ctx->img.planes[0] += mi_col * MI_SIZE;
|
||||
ctx->img.planes[0] += mi_col * MI_SIZE * (1 + is_hbd);
|
||||
if (num_planes > 1) {
|
||||
for (plane = 1; plane < MAX_MB_PLANE; ++plane) {
|
||||
ctx->img.planes[plane] += mi_col * (MI_SIZE >> ssx);
|
||||
ctx->img.planes[plane] +=
|
||||
mi_col * (MI_SIZE >> ssx) * (1 + is_hbd);
|
||||
}
|
||||
}
|
||||
ctx->img.d_w =
|
||||
|
|
@ -703,7 +720,10 @@ static aom_image_t *decoder_get_frame(aom_codec_alg_priv_t *ctx,
|
|||
img = &ctx->img;
|
||||
img->temporal_id = cm->temporal_layer_id;
|
||||
img->spatial_id = cm->spatial_layer_id;
|
||||
return add_grain_if_needed(img, ctx->image_with_grain, grain_params);
|
||||
aom_image_t *res = add_grain_if_needed(
|
||||
img, &ctx->image_with_grain[*index], grain_params);
|
||||
*index += 1; // Advance the iterator to point to the next image
|
||||
return res;
|
||||
}
|
||||
} else {
|
||||
// Decoding failed. Release the worker thread.
|
||||
|
|
@ -999,7 +1019,7 @@ static aom_codec_err_t ctrl_get_bit_depth(aom_codec_alg_priv_t *ctx,
|
|||
FrameWorkerData *const frame_worker_data =
|
||||
(FrameWorkerData *)worker->data1;
|
||||
const AV1_COMMON *const cm = &frame_worker_data->pbi->common;
|
||||
*bit_depth = cm->bit_depth;
|
||||
*bit_depth = cm->seq_params.bit_depth;
|
||||
return AOM_CODEC_OK;
|
||||
} else {
|
||||
return AOM_CODEC_ERROR;
|
||||
|
|
@ -1009,6 +1029,64 @@ static aom_codec_err_t ctrl_get_bit_depth(aom_codec_alg_priv_t *ctx,
|
|||
return AOM_CODEC_INVALID_PARAM;
|
||||
}
|
||||
|
||||
static aom_img_fmt_t get_img_format(int subsampling_x, int subsampling_y,
|
||||
int use_highbitdepth) {
|
||||
aom_img_fmt_t fmt = 0;
|
||||
|
||||
if (subsampling_x == 0 && subsampling_y == 0)
|
||||
fmt = AOM_IMG_FMT_I444;
|
||||
else if (subsampling_x == 1 && subsampling_y == 0)
|
||||
fmt = AOM_IMG_FMT_I422;
|
||||
else if (subsampling_x == 1 && subsampling_y == 1)
|
||||
fmt = AOM_IMG_FMT_I420;
|
||||
|
||||
if (use_highbitdepth) fmt |= AOM_IMG_FMT_HIGHBITDEPTH;
|
||||
return fmt;
|
||||
}
|
||||
|
||||
static aom_codec_err_t ctrl_get_img_format(aom_codec_alg_priv_t *ctx,
|
||||
va_list args) {
|
||||
aom_img_fmt_t *const img_fmt = va_arg(args, aom_img_fmt_t *);
|
||||
AVxWorker *const worker = &ctx->frame_workers[ctx->next_output_worker_id];
|
||||
|
||||
if (img_fmt) {
|
||||
if (worker) {
|
||||
FrameWorkerData *const frame_worker_data =
|
||||
(FrameWorkerData *)worker->data1;
|
||||
const AV1_COMMON *const cm = &frame_worker_data->pbi->common;
|
||||
|
||||
*img_fmt = get_img_format(cm->seq_params.subsampling_x,
|
||||
cm->seq_params.subsampling_y,
|
||||
cm->seq_params.use_highbitdepth);
|
||||
return AOM_CODEC_OK;
|
||||
} else {
|
||||
return AOM_CODEC_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
return AOM_CODEC_INVALID_PARAM;
|
||||
}
|
||||
|
||||
static aom_codec_err_t ctrl_get_tile_size(aom_codec_alg_priv_t *ctx,
|
||||
va_list args) {
|
||||
unsigned int *const tile_size = va_arg(args, unsigned int *);
|
||||
AVxWorker *const worker = &ctx->frame_workers[ctx->next_output_worker_id];
|
||||
|
||||
if (tile_size) {
|
||||
if (worker) {
|
||||
FrameWorkerData *const frame_worker_data =
|
||||
(FrameWorkerData *)worker->data1;
|
||||
const AV1_COMMON *const cm = &frame_worker_data->pbi->common;
|
||||
*tile_size =
|
||||
((cm->tile_width * MI_SIZE) << 16) + cm->tile_height * MI_SIZE;
|
||||
return AOM_CODEC_OK;
|
||||
} else {
|
||||
return AOM_CODEC_ERROR;
|
||||
}
|
||||
}
|
||||
return AOM_CODEC_INVALID_PARAM;
|
||||
}
|
||||
|
||||
static aom_codec_err_t ctrl_set_invert_tile_order(aom_codec_alg_priv_t *ctx,
|
||||
va_list args) {
|
||||
ctx->invert_tile_order = va_arg(args, int);
|
||||
|
|
@ -1124,6 +1202,12 @@ static aom_codec_err_t ctrl_ext_tile_debug(aom_codec_alg_priv_t *ctx,
|
|||
return AOM_CODEC_OK;
|
||||
}
|
||||
|
||||
static aom_codec_err_t ctrl_set_row_mt(aom_codec_alg_priv_t *ctx,
|
||||
va_list args) {
|
||||
ctx->row_mt = va_arg(args, unsigned int);
|
||||
return AOM_CODEC_OK;
|
||||
}
|
||||
|
||||
static aom_codec_ctrl_fn_map_t decoder_ctrl_maps[] = {
|
||||
{ AV1_COPY_REFERENCE, ctrl_copy_reference },
|
||||
|
||||
|
|
@ -1145,6 +1229,7 @@ static aom_codec_ctrl_fn_map_t decoder_ctrl_maps[] = {
|
|||
{ AV1D_SET_OUTPUT_ALL_LAYERS, ctrl_set_output_all_layers },
|
||||
{ AV1_SET_INSPECTION_CALLBACK, ctrl_set_inspection_callback },
|
||||
{ AV1D_EXT_TILE_DEBUG, ctrl_ext_tile_debug },
|
||||
{ AV1D_SET_ROW_MT, ctrl_set_row_mt },
|
||||
{ AV1D_SET_EXT_REF_PTR, ctrl_set_ext_ref_ptr },
|
||||
|
||||
// Getters
|
||||
|
|
@ -1152,6 +1237,8 @@ static aom_codec_ctrl_fn_map_t decoder_ctrl_maps[] = {
|
|||
{ AOMD_GET_LAST_QUANTIZER, ctrl_get_last_quantizer },
|
||||
{ AOMD_GET_LAST_REF_UPDATES, ctrl_get_last_ref_updates },
|
||||
{ AV1D_GET_BIT_DEPTH, ctrl_get_bit_depth },
|
||||
{ AV1D_GET_IMG_FORMAT, ctrl_get_img_format },
|
||||
{ AV1D_GET_TILE_SIZE, ctrl_get_tile_size },
|
||||
{ AV1D_GET_DISPLAY_SIZE, ctrl_get_render_size },
|
||||
{ AV1D_GET_FRAME_SIZE, ctrl_get_frame_size },
|
||||
{ AV1_GET_ACCOUNTING, ctrl_get_accounting },
|
||||
|
|
@ -1180,7 +1267,7 @@ CODEC_INTERFACE(aom_codec_av1_dx) = {
|
|||
decoder_peek_si, // aom_codec_peek_si_fn_t
|
||||
decoder_get_si, // aom_codec_get_si_fn_t
|
||||
decoder_decode, // aom_codec_decode_fn_t
|
||||
decoder_get_frame, // aom_codec_frame_get_fn_t
|
||||
decoder_get_frame, // aom_codec_get_frame_fn_t
|
||||
decoder_set_fb_fn, // aom_codec_set_fb_fn_t
|
||||
},
|
||||
{
|
||||
|
|
|
|||
4
third_party/aom/av1/common/alloccommon.c
vendored
4
third_party/aom/av1/common/alloccommon.c
vendored
|
|
@ -137,11 +137,11 @@ void av1_alloc_restoration_buffers(AV1_COMMON *cm) {
|
|||
// Now we need to allocate enough space to store the line buffers for the
|
||||
// stripes
|
||||
const int frame_w = cm->superres_upscaled_width;
|
||||
const int use_highbd = cm->use_highbitdepth ? 1 : 0;
|
||||
const int use_highbd = cm->seq_params.use_highbitdepth ? 1 : 0;
|
||||
|
||||
for (int p = 0; p < num_planes; ++p) {
|
||||
const int is_uv = p > 0;
|
||||
const int ss_x = is_uv && cm->subsampling_x;
|
||||
const int ss_x = is_uv && cm->seq_params.subsampling_x;
|
||||
const int plane_w = ((frame_w + ss_x) >> ss_x) + 2 * RESTORATION_EXTRA_HORZ;
|
||||
const int stride = ALIGN_POWER_OF_TWO(plane_w, 5);
|
||||
const int buf_size = num_stripes * stride * RESTORATION_CTX_VERT
|
||||
|
|
|
|||
844
third_party/aom/av1/common/arm/av1_inv_txfm_neon.c
vendored
Normal file
844
third_party/aom/av1/common/arm/av1_inv_txfm_neon.c
vendored
Normal file
|
|
@ -0,0 +1,844 @@
|
|||
/*
|
||||
* Copyright (c) 2018, Alliance for Open Media. All rights reserved
|
||||
*
|
||||
* This source code is subject to the terms of the BSD 2 Clause License and
|
||||
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
|
||||
* was not distributed with this source code in the LICENSE file, you can
|
||||
* obtain it at www.aomedia.org/license/software. If the Alliance for Open
|
||||
* Media Patent License 1.0 was not distributed with this source code in the
|
||||
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
|
||||
*/
|
||||
|
||||
#include "config/aom_config.h"
|
||||
#include "config/aom_dsp_rtcd.h"
|
||||
#include "config/av1_rtcd.h"
|
||||
|
||||
#include "av1/common/av1_inv_txfm1d.h"
|
||||
#include "av1/common/av1_inv_txfm1d_cfg.h"
|
||||
#include "av1/common/av1_txfm.h"
|
||||
#include "av1/common/enums.h"
|
||||
#include "av1/common/idct.h"
|
||||
#include "av1/common/arm/av1_inv_txfm_neon.h"
|
||||
|
||||
static INLINE TxSetType find_TxSetType(TX_SIZE tx_size) {
|
||||
const TX_SIZE tx_size_sqr_up = txsize_sqr_up_map[tx_size];
|
||||
TxSetType tx_set_type;
|
||||
if (tx_size_sqr_up > TX_32X32) {
|
||||
tx_set_type = EXT_TX_SET_DCTONLY;
|
||||
} else if (tx_size_sqr_up == TX_32X32) {
|
||||
tx_set_type = EXT_TX_SET_DCT_IDTX;
|
||||
} else {
|
||||
tx_set_type = EXT_TX_SET_ALL16;
|
||||
}
|
||||
return tx_set_type;
|
||||
}
|
||||
|
||||
// 1D itx types
|
||||
typedef enum ATTRIBUTE_PACKED {
|
||||
IDCT_1D,
|
||||
IADST_1D,
|
||||
IFLIPADST_1D = IADST_1D,
|
||||
IIDENTITY_1D,
|
||||
ITX_TYPES_1D,
|
||||
} ITX_TYPE_1D;
|
||||
|
||||
static const ITX_TYPE_1D vitx_1d_tab[TX_TYPES] = {
|
||||
IDCT_1D, IADST_1D, IDCT_1D, IADST_1D,
|
||||
IFLIPADST_1D, IDCT_1D, IFLIPADST_1D, IADST_1D,
|
||||
IFLIPADST_1D, IIDENTITY_1D, IDCT_1D, IIDENTITY_1D,
|
||||
IADST_1D, IIDENTITY_1D, IFLIPADST_1D, IIDENTITY_1D,
|
||||
};
|
||||
|
||||
static const ITX_TYPE_1D hitx_1d_tab[TX_TYPES] = {
|
||||
IDCT_1D, IDCT_1D, IADST_1D, IADST_1D,
|
||||
IDCT_1D, IFLIPADST_1D, IFLIPADST_1D, IFLIPADST_1D,
|
||||
IADST_1D, IIDENTITY_1D, IIDENTITY_1D, IDCT_1D,
|
||||
IIDENTITY_1D, IADST_1D, IIDENTITY_1D, IFLIPADST_1D,
|
||||
};
|
||||
|
||||
// 1D functions
|
||||
static const transform_1d_neon lowbd_txfm_all_1d_arr[TX_SIZES][ITX_TYPES_1D] = {
|
||||
{ av1_idct4_new, av1_iadst4_new, av1_iidentity4_c },
|
||||
{ av1_idct8_new, av1_iadst8_new, av1_iidentity8_c },
|
||||
{ av1_idct16_new, av1_iadst16_new, av1_iidentity16_c },
|
||||
{ av1_idct32_new, NULL, NULL },
|
||||
{ av1_idct64_new, NULL, NULL },
|
||||
};
|
||||
|
||||
// Functions for blocks with eob at DC and within
|
||||
// topleft 8x8, 16x16, 32x32 corner
|
||||
static const transform_1d_neon
|
||||
lowbd_txfm_all_1d_zeros_w8_arr[TX_SIZES][ITX_TYPES_1D][4] = {
|
||||
{
|
||||
{ av1_idct4_new, av1_idct4_new, NULL, NULL },
|
||||
{ av1_iadst4_new, av1_iadst4_new, NULL, NULL },
|
||||
{ av1_iidentity4_c, av1_iidentity4_c, NULL, NULL },
|
||||
},
|
||||
{ { av1_idct8_new, av1_idct8_new, NULL, NULL },
|
||||
{ av1_iadst8_new, av1_iadst8_new, NULL, NULL },
|
||||
{ av1_iidentity8_c, av1_iidentity8_c, NULL, NULL } },
|
||||
{
|
||||
{ av1_idct16_new, av1_idct16_new, av1_idct16_new, NULL },
|
||||
{ av1_iadst16_new, av1_iadst16_new, av1_iadst16_new, NULL },
|
||||
{ av1_iidentity16_c, av1_iidentity16_c, av1_iidentity16_c, NULL },
|
||||
},
|
||||
{ { av1_idct32_new, av1_idct32_new, av1_idct32_new, av1_idct32_new },
|
||||
{ NULL, NULL, NULL, NULL },
|
||||
{ av1_iidentity32_c, av1_iidentity32_c, av1_iidentity32_c,
|
||||
av1_iidentity32_c } },
|
||||
{ { av1_idct64_new, av1_idct64_new, av1_idct64_new, av1_idct64_new },
|
||||
{ NULL, NULL, NULL, NULL },
|
||||
{ NULL, NULL, NULL, NULL } }
|
||||
};
|
||||
static INLINE void lowbd_inv_txfm2d_add_idtx_neon(const int32_t *input,
|
||||
uint8_t *output, int stride,
|
||||
TX_TYPE tx_type,
|
||||
TX_SIZE tx_size, int eob) {
|
||||
DECLARE_ALIGNED(32, int, txfm_buf[32 * 32 + 32 + 32]);
|
||||
int32_t *temp_in = txfm_buf;
|
||||
|
||||
int eobx, eoby;
|
||||
get_eobx_eoby_scan_default(&eobx, &eoby, tx_size, eob);
|
||||
const int8_t *shift = inv_txfm_shift_ls[tx_size];
|
||||
const int txw_idx = get_txw_idx(tx_size);
|
||||
const int txh_idx = get_txh_idx(tx_size);
|
||||
const int cos_bit_col = inv_cos_bit_col[txw_idx][txh_idx];
|
||||
const int cos_bit_row = inv_cos_bit_row[txw_idx][txh_idx];
|
||||
const int txfm_size_col = tx_size_wide[tx_size];
|
||||
const int txfm_size_row = tx_size_high[tx_size];
|
||||
const int buf_size_nonzero_h_div8 = (eoby + 8) >> 3;
|
||||
|
||||
const int rect_type = get_rect_tx_log_ratio(txfm_size_col, txfm_size_row);
|
||||
const int buf_offset = AOMMAX(txfm_size_row, txfm_size_col);
|
||||
|
||||
int32_t *temp_out = temp_in + buf_offset;
|
||||
int32_t *buf = temp_out + buf_offset;
|
||||
int32_t *buf_ptr = buf;
|
||||
const int8_t stage_range[MAX_TXFM_STAGE_NUM] = { 16 };
|
||||
int r, bd = 8;
|
||||
|
||||
const int fun_idx_x = lowbd_txfm_all_1d_zeros_idx[eobx];
|
||||
const int fun_idx_y = lowbd_txfm_all_1d_zeros_idx[eoby];
|
||||
const transform_1d_neon row_txfm =
|
||||
lowbd_txfm_all_1d_zeros_w8_arr[txw_idx][hitx_1d_tab[tx_type]][fun_idx_x];
|
||||
const transform_1d_neon col_txfm =
|
||||
lowbd_txfm_all_1d_zeros_w8_arr[txh_idx][vitx_1d_tab[tx_type]][fun_idx_y];
|
||||
|
||||
assert(col_txfm != NULL);
|
||||
assert(row_txfm != NULL);
|
||||
|
||||
// row tx
|
||||
int row_start = (buf_size_nonzero_h_div8 * 8);
|
||||
for (int i = 0; i < row_start; i++) {
|
||||
if (abs(rect_type) == 1) {
|
||||
for (int j = 0; j < txfm_size_col; j++)
|
||||
temp_in[j] = round_shift((int64_t)input[j] * NewInvSqrt2, NewSqrt2Bits);
|
||||
row_txfm(temp_in, buf_ptr, cos_bit_row, stage_range);
|
||||
} else {
|
||||
row_txfm(input, buf_ptr, cos_bit_row, stage_range);
|
||||
}
|
||||
av1_round_shift_array(buf_ptr, txfm_size_col, -shift[0]);
|
||||
input += txfm_size_col;
|
||||
buf_ptr += txfm_size_col;
|
||||
}
|
||||
|
||||
// Doing memset for the rows which are not processed in row transform.
|
||||
memset(buf_ptr, 0,
|
||||
sizeof(int32_t) * txfm_size_col * (txfm_size_row - row_start));
|
||||
|
||||
// col tx
|
||||
for (int c = 0; c < txfm_size_col; c++) {
|
||||
for (r = 0; r < txfm_size_row; ++r) temp_in[r] = buf[r * txfm_size_col + c];
|
||||
|
||||
col_txfm(temp_in, temp_out, cos_bit_col, stage_range);
|
||||
av1_round_shift_array(temp_out, txfm_size_row, -shift[1]);
|
||||
|
||||
for (r = 0; r < txfm_size_row; ++r) {
|
||||
output[r * stride + c] =
|
||||
highbd_clip_pixel_add(output[r * stride + c], temp_out[r], bd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static INLINE void lowbd_inv_txfm2d_add_v_identity_neon(
|
||||
const int32_t *input, uint8_t *output, int stride, TX_TYPE tx_type,
|
||||
TX_SIZE tx_size, int eob) {
|
||||
DECLARE_ALIGNED(32, int, txfm_buf[32 * 32 + 32 + 32]);
|
||||
int32_t *temp_in = txfm_buf;
|
||||
|
||||
int eobx, eoby;
|
||||
get_eobx_eoby_scan_v_identity(&eobx, &eoby, tx_size, eob);
|
||||
const int8_t *shift = inv_txfm_shift_ls[tx_size];
|
||||
const int txw_idx = get_txw_idx(tx_size);
|
||||
const int txh_idx = get_txh_idx(tx_size);
|
||||
const int cos_bit_col = inv_cos_bit_col[txw_idx][txh_idx];
|
||||
const int cos_bit_row = inv_cos_bit_row[txw_idx][txh_idx];
|
||||
const int txfm_size_col = tx_size_wide[tx_size];
|
||||
const int txfm_size_row = tx_size_high[tx_size];
|
||||
const int buf_size_nonzero_h_div8 = (eoby + 8) >> 3;
|
||||
|
||||
const int rect_type = get_rect_tx_log_ratio(txfm_size_col, txfm_size_row);
|
||||
const int buf_offset = AOMMAX(txfm_size_row, txfm_size_col);
|
||||
|
||||
int32_t *temp_out = temp_in + buf_offset;
|
||||
int32_t *buf = temp_out + buf_offset;
|
||||
int32_t *buf_ptr = buf;
|
||||
const int8_t stage_range[MAX_TXFM_STAGE_NUM] = { 16 };
|
||||
int r, bd = 8;
|
||||
|
||||
const int fun_idx_x = lowbd_txfm_all_1d_zeros_idx[eobx];
|
||||
const int fun_idx_y = lowbd_txfm_all_1d_zeros_idx[eoby];
|
||||
const transform_1d_neon row_txfm =
|
||||
lowbd_txfm_all_1d_zeros_w8_arr[txw_idx][hitx_1d_tab[tx_type]][fun_idx_x];
|
||||
const transform_1d_neon col_txfm =
|
||||
lowbd_txfm_all_1d_zeros_w8_arr[txh_idx][vitx_1d_tab[tx_type]][fun_idx_y];
|
||||
|
||||
assert(col_txfm != NULL);
|
||||
assert(row_txfm != NULL);
|
||||
int ud_flip, lr_flip;
|
||||
get_flip_cfg(tx_type, &ud_flip, &lr_flip);
|
||||
|
||||
// row tx
|
||||
int row_start = (buf_size_nonzero_h_div8 * 8);
|
||||
for (int i = 0; i < row_start; i++) {
|
||||
if (abs(rect_type) == 1) {
|
||||
for (int j = 0; j < txfm_size_col; j++)
|
||||
temp_in[j] = round_shift((int64_t)input[j] * NewInvSqrt2, NewSqrt2Bits);
|
||||
row_txfm(temp_in, buf_ptr, cos_bit_row, stage_range);
|
||||
} else {
|
||||
row_txfm(input, buf_ptr, cos_bit_row, stage_range);
|
||||
}
|
||||
av1_round_shift_array(buf_ptr, txfm_size_col, -shift[0]);
|
||||
input += txfm_size_col;
|
||||
buf_ptr += txfm_size_col;
|
||||
}
|
||||
// Doing memset for the rows which are not processed in row transform.
|
||||
memset(buf_ptr, 0,
|
||||
sizeof(int32_t) * txfm_size_col * (txfm_size_row - row_start));
|
||||
|
||||
// col tx
|
||||
for (int c = 0; c < txfm_size_col; c++) {
|
||||
if (lr_flip == 0) {
|
||||
for (r = 0; r < txfm_size_row; ++r)
|
||||
temp_in[r] = buf[r * txfm_size_col + c];
|
||||
} else {
|
||||
// flip left right
|
||||
for (r = 0; r < txfm_size_row; ++r)
|
||||
temp_in[r] = buf[r * txfm_size_col + (txfm_size_col - c - 1)];
|
||||
}
|
||||
col_txfm(temp_in, temp_out, cos_bit_col, stage_range);
|
||||
av1_round_shift_array(temp_out, txfm_size_row, -shift[1]);
|
||||
|
||||
if (ud_flip == 0) {
|
||||
for (r = 0; r < txfm_size_row; ++r) {
|
||||
output[r * stride + c] =
|
||||
highbd_clip_pixel_add(output[r * stride + c], temp_out[r], bd);
|
||||
}
|
||||
} else {
|
||||
// flip upside down
|
||||
for (r = 0; r < txfm_size_row; ++r) {
|
||||
output[r * stride + c] = highbd_clip_pixel_add(
|
||||
output[r * stride + c], temp_out[txfm_size_row - r - 1], bd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static INLINE void lowbd_inv_txfm2d_add_h_identity_neon(
|
||||
const int32_t *input, uint8_t *output, int stride, TX_TYPE tx_type,
|
||||
TX_SIZE tx_size, int eob) {
|
||||
DECLARE_ALIGNED(32, int, txfm_buf[32 * 32 + 32 + 32]);
|
||||
int32_t *temp_in = txfm_buf;
|
||||
|
||||
int eobx, eoby;
|
||||
get_eobx_eoby_scan_h_identity(&eobx, &eoby, tx_size, eob);
|
||||
const int8_t *shift = inv_txfm_shift_ls[tx_size];
|
||||
const int txw_idx = get_txw_idx(tx_size);
|
||||
const int txh_idx = get_txh_idx(tx_size);
|
||||
const int cos_bit_col = inv_cos_bit_col[txw_idx][txh_idx];
|
||||
const int cos_bit_row = inv_cos_bit_row[txw_idx][txh_idx];
|
||||
const int txfm_size_col = tx_size_wide[tx_size];
|
||||
const int txfm_size_row = tx_size_high[tx_size];
|
||||
const int buf_size_nonzero_h_div8 = (eoby + 8) >> 3;
|
||||
|
||||
const int rect_type = get_rect_tx_log_ratio(txfm_size_col, txfm_size_row);
|
||||
const int buf_offset = AOMMAX(txfm_size_row, txfm_size_col);
|
||||
|
||||
int32_t *temp_out = temp_in + buf_offset;
|
||||
int32_t *buf = temp_out + buf_offset;
|
||||
int32_t *buf_ptr = buf;
|
||||
const int8_t stage_range[MAX_TXFM_STAGE_NUM] = { 16 };
|
||||
int r, bd = 8;
|
||||
|
||||
const int fun_idx_x = lowbd_txfm_all_1d_zeros_idx[eobx];
|
||||
const int fun_idx_y = lowbd_txfm_all_1d_zeros_idx[eoby];
|
||||
const transform_1d_neon row_txfm =
|
||||
lowbd_txfm_all_1d_zeros_w8_arr[txw_idx][hitx_1d_tab[tx_type]][fun_idx_x];
|
||||
const transform_1d_neon col_txfm =
|
||||
lowbd_txfm_all_1d_zeros_w8_arr[txh_idx][vitx_1d_tab[tx_type]][fun_idx_y];
|
||||
|
||||
assert(col_txfm != NULL);
|
||||
assert(row_txfm != NULL);
|
||||
int ud_flip, lr_flip;
|
||||
get_flip_cfg(tx_type, &ud_flip, &lr_flip);
|
||||
|
||||
// row tx
|
||||
int row_start = (buf_size_nonzero_h_div8 * 8);
|
||||
for (int i = 0; i < row_start; i++) {
|
||||
if (abs(rect_type) == 1) {
|
||||
for (int j = 0; j < txfm_size_col; j++)
|
||||
temp_in[j] = round_shift((int64_t)input[j] * NewInvSqrt2, NewSqrt2Bits);
|
||||
row_txfm(temp_in, buf_ptr, cos_bit_row, stage_range);
|
||||
} else {
|
||||
row_txfm(input, buf_ptr, cos_bit_row, stage_range);
|
||||
}
|
||||
av1_round_shift_array(buf_ptr, txfm_size_col, -shift[0]);
|
||||
input += txfm_size_col;
|
||||
buf_ptr += txfm_size_col;
|
||||
}
|
||||
// Doing memset for the rows which are not processed in row transform.
|
||||
memset(buf_ptr, 0,
|
||||
sizeof(int32_t) * txfm_size_col * (txfm_size_row - row_start));
|
||||
|
||||
// col tx
|
||||
for (int c = 0; c < txfm_size_col; c++) {
|
||||
if (lr_flip == 0) {
|
||||
for (r = 0; r < txfm_size_row; ++r)
|
||||
temp_in[r] = buf[r * txfm_size_col + c];
|
||||
} else {
|
||||
// flip left right
|
||||
for (r = 0; r < txfm_size_row; ++r)
|
||||
temp_in[r] = buf[r * txfm_size_col + (txfm_size_col - c - 1)];
|
||||
}
|
||||
col_txfm(temp_in, temp_out, cos_bit_col, stage_range);
|
||||
av1_round_shift_array(temp_out, txfm_size_row, -shift[1]);
|
||||
|
||||
if (ud_flip == 0) {
|
||||
for (r = 0; r < txfm_size_row; ++r) {
|
||||
output[r * stride + c] =
|
||||
highbd_clip_pixel_add(output[r * stride + c], temp_out[r], bd);
|
||||
}
|
||||
} else {
|
||||
// flip upside down
|
||||
for (r = 0; r < txfm_size_row; ++r) {
|
||||
output[r * stride + c] = highbd_clip_pixel_add(
|
||||
output[r * stride + c], temp_out[txfm_size_row - r - 1], bd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static INLINE void lowbd_inv_txfm2d_add_4x4_neon(const int32_t *input,
|
||||
uint8_t *output, int stride,
|
||||
TX_TYPE tx_type,
|
||||
TX_SIZE tx_size, int eob) {
|
||||
(void)eob;
|
||||
DECLARE_ALIGNED(32, int, txfm_buf[4 * 4 + 8 + 8]);
|
||||
int32_t *temp_in = txfm_buf;
|
||||
|
||||
const int8_t *shift = inv_txfm_shift_ls[tx_size];
|
||||
const int txw_idx = get_txw_idx(tx_size);
|
||||
const int txh_idx = get_txh_idx(tx_size);
|
||||
const int cos_bit_row = inv_cos_bit_row[txw_idx][txh_idx];
|
||||
const int cos_bit_col = inv_cos_bit_col[txw_idx][txh_idx];
|
||||
const int txfm_size_col = tx_size_wide[tx_size];
|
||||
const int txfm_size_row = tx_size_high[tx_size];
|
||||
const int buf_offset = AOMMAX(txfm_size_row, txfm_size_col);
|
||||
int32_t *temp_out = temp_in + buf_offset;
|
||||
int32_t *buf = temp_out + buf_offset;
|
||||
int32_t *buf_ptr = buf;
|
||||
const int8_t stage_range[MAX_TXFM_STAGE_NUM] = { 16 };
|
||||
int r, bd = 8;
|
||||
const transform_1d_neon row_txfm =
|
||||
lowbd_txfm_all_1d_arr[txw_idx][hitx_1d_tab[tx_type]];
|
||||
const transform_1d_neon col_txfm =
|
||||
lowbd_txfm_all_1d_arr[txh_idx][vitx_1d_tab[tx_type]];
|
||||
|
||||
int ud_flip, lr_flip;
|
||||
get_flip_cfg(tx_type, &ud_flip, &lr_flip);
|
||||
|
||||
for (int i = 0; i < txfm_size_row; i++) {
|
||||
row_txfm(input, buf_ptr, cos_bit_row, stage_range);
|
||||
|
||||
input += txfm_size_col;
|
||||
buf_ptr += txfm_size_col;
|
||||
}
|
||||
|
||||
for (int c = 0; c < txfm_size_col; ++c) {
|
||||
if (lr_flip == 0) {
|
||||
for (r = 0; r < txfm_size_row; ++r)
|
||||
temp_in[r] = buf[r * txfm_size_col + c];
|
||||
} else {
|
||||
// flip left right
|
||||
for (r = 0; r < txfm_size_row; ++r)
|
||||
temp_in[r] = buf[r * txfm_size_col + (txfm_size_col - c - 1)];
|
||||
}
|
||||
col_txfm(temp_in, temp_out, cos_bit_col, stage_range);
|
||||
av1_round_shift_array(temp_out, txfm_size_row, -shift[1]);
|
||||
|
||||
if (ud_flip == 0) {
|
||||
for (r = 0; r < txfm_size_row; ++r) {
|
||||
output[r * stride + c] =
|
||||
highbd_clip_pixel_add(output[r * stride + c], temp_out[r], bd);
|
||||
}
|
||||
} else {
|
||||
// flip upside down
|
||||
for (r = 0; r < txfm_size_row; ++r) {
|
||||
output[r * stride + c] = highbd_clip_pixel_add(
|
||||
output[r * stride + c], temp_out[txfm_size_row - r - 1], bd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void lowbd_inv_txfm2d_add_4x8_neon(const int32_t *input, uint8_t *output,
|
||||
int stride, TX_TYPE tx_type, TX_SIZE tx_size,
|
||||
int eob) {
|
||||
(void)eob;
|
||||
DECLARE_ALIGNED(32, int, txfm_buf[4 * 8 + 8 + 8]);
|
||||
int32_t *temp_in = txfm_buf;
|
||||
|
||||
const int8_t *shift = inv_txfm_shift_ls[tx_size];
|
||||
const int txw_idx = get_txw_idx(tx_size);
|
||||
const int txh_idx = get_txh_idx(tx_size);
|
||||
const int cos_bit_row = inv_cos_bit_row[txw_idx][txh_idx];
|
||||
const int cos_bit_col = inv_cos_bit_col[txw_idx][txh_idx];
|
||||
const int txfm_size_col = tx_size_wide[tx_size];
|
||||
const int txfm_size_row = tx_size_high[tx_size];
|
||||
const int buf_offset = AOMMAX(txfm_size_row, txfm_size_col);
|
||||
int32_t *temp_out = temp_in + buf_offset;
|
||||
int32_t *buf = temp_out + buf_offset;
|
||||
int32_t *buf_ptr = buf;
|
||||
const int8_t stage_range[MAX_TXFM_STAGE_NUM] = { 16 };
|
||||
int r, bd = 8;
|
||||
const transform_1d_neon row_txfm =
|
||||
lowbd_txfm_all_1d_arr[txw_idx][hitx_1d_tab[tx_type]];
|
||||
const transform_1d_neon col_txfm =
|
||||
lowbd_txfm_all_1d_arr[txh_idx][vitx_1d_tab[tx_type]];
|
||||
|
||||
int ud_flip, lr_flip;
|
||||
get_flip_cfg(tx_type, &ud_flip, &lr_flip);
|
||||
|
||||
for (int i = 0; i < txfm_size_row; i++) {
|
||||
for (int j = 0; j < txfm_size_col; j++)
|
||||
temp_in[j] = round_shift((int64_t)input[j] * NewInvSqrt2, NewSqrt2Bits);
|
||||
|
||||
row_txfm(temp_in, buf_ptr, cos_bit_row, stage_range);
|
||||
input += txfm_size_col;
|
||||
buf_ptr += txfm_size_col;
|
||||
}
|
||||
|
||||
for (int c = 0; c < txfm_size_col; ++c) {
|
||||
if (lr_flip == 0) {
|
||||
for (r = 0; r < txfm_size_row; ++r)
|
||||
temp_in[r] = buf[r * txfm_size_col + c];
|
||||
} else {
|
||||
// flip left right
|
||||
for (r = 0; r < txfm_size_row; ++r)
|
||||
temp_in[r] = buf[r * txfm_size_col + (txfm_size_col - c - 1)];
|
||||
}
|
||||
col_txfm(temp_in, temp_out, cos_bit_col, stage_range);
|
||||
av1_round_shift_array(temp_out, txfm_size_row, -shift[1]);
|
||||
|
||||
if (ud_flip == 0) {
|
||||
for (r = 0; r < txfm_size_row; ++r) {
|
||||
output[r * stride + c] =
|
||||
highbd_clip_pixel_add(output[r * stride + c], temp_out[r], bd);
|
||||
}
|
||||
} else {
|
||||
// flip upside down
|
||||
for (r = 0; r < txfm_size_row; ++r) {
|
||||
output[r * stride + c] = highbd_clip_pixel_add(
|
||||
output[r * stride + c], temp_out[txfm_size_row - r - 1], bd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void lowbd_inv_txfm2d_add_8x4_neon(const int32_t *input, uint8_t *output,
|
||||
int stride, TX_TYPE tx_type, TX_SIZE tx_size,
|
||||
int eob) {
|
||||
(void)eob;
|
||||
DECLARE_ALIGNED(32, int, txfm_buf[8 * 4 + 8 + 8]);
|
||||
int32_t *temp_in = txfm_buf;
|
||||
|
||||
const int8_t *shift = inv_txfm_shift_ls[tx_size];
|
||||
const int txw_idx = get_txw_idx(tx_size);
|
||||
const int txh_idx = get_txh_idx(tx_size);
|
||||
const int cos_bit_row = inv_cos_bit_row[txw_idx][txh_idx];
|
||||
const int cos_bit_col = inv_cos_bit_col[txw_idx][txh_idx];
|
||||
const int txfm_size_col = tx_size_wide[tx_size];
|
||||
const int txfm_size_row = tx_size_high[tx_size];
|
||||
const int buf_offset = AOMMAX(txfm_size_row, txfm_size_col);
|
||||
int32_t *temp_out = temp_in + buf_offset;
|
||||
int32_t *buf = temp_out + buf_offset;
|
||||
int32_t *buf_ptr = buf;
|
||||
const int8_t stage_range[MAX_TXFM_STAGE_NUM] = { 16 };
|
||||
int r, bd = 8;
|
||||
const transform_1d_neon row_txfm =
|
||||
lowbd_txfm_all_1d_arr[txw_idx][hitx_1d_tab[tx_type]];
|
||||
const transform_1d_neon col_txfm =
|
||||
lowbd_txfm_all_1d_arr[txh_idx][vitx_1d_tab[tx_type]];
|
||||
|
||||
int ud_flip, lr_flip;
|
||||
get_flip_cfg(tx_type, &ud_flip, &lr_flip);
|
||||
|
||||
for (int i = 0; i < txfm_size_row; i++) {
|
||||
for (int j = 0; j < txfm_size_col; j++)
|
||||
temp_in[j] = round_shift((int64_t)input[j] * NewInvSqrt2, NewSqrt2Bits);
|
||||
|
||||
row_txfm(temp_in, buf_ptr, cos_bit_row, stage_range);
|
||||
input += txfm_size_col;
|
||||
buf_ptr += txfm_size_col;
|
||||
}
|
||||
|
||||
for (int c = 0; c < txfm_size_col; ++c) {
|
||||
if (lr_flip == 0) {
|
||||
for (r = 0; r < txfm_size_row; ++r)
|
||||
temp_in[r] = buf[r * txfm_size_col + c];
|
||||
} else {
|
||||
// flip left right
|
||||
for (r = 0; r < txfm_size_row; ++r)
|
||||
temp_in[r] = buf[r * txfm_size_col + (txfm_size_col - c - 1)];
|
||||
}
|
||||
col_txfm(temp_in, temp_out, cos_bit_col, stage_range);
|
||||
av1_round_shift_array(temp_out, txfm_size_row, -shift[1]);
|
||||
|
||||
if (ud_flip == 0) {
|
||||
for (r = 0; r < txfm_size_row; ++r) {
|
||||
output[r * stride + c] =
|
||||
highbd_clip_pixel_add(output[r * stride + c], temp_out[r], bd);
|
||||
}
|
||||
} else {
|
||||
// flip upside down
|
||||
for (r = 0; r < txfm_size_row; ++r) {
|
||||
output[r * stride + c] = highbd_clip_pixel_add(
|
||||
output[r * stride + c], temp_out[txfm_size_row - r - 1], bd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void lowbd_inv_txfm2d_add_4x16_neon(const int32_t *input, uint8_t *output,
|
||||
int stride, TX_TYPE tx_type,
|
||||
TX_SIZE tx_size, int eob) {
|
||||
(void)eob;
|
||||
DECLARE_ALIGNED(32, int, txfm_buf[4 * 16 + 16 + 16]);
|
||||
int32_t *temp_in = txfm_buf;
|
||||
|
||||
const int8_t *shift = inv_txfm_shift_ls[tx_size];
|
||||
const int txw_idx = get_txw_idx(tx_size);
|
||||
const int txh_idx = get_txh_idx(tx_size);
|
||||
const int cos_bit_row = inv_cos_bit_row[txw_idx][txh_idx];
|
||||
const int cos_bit_col = inv_cos_bit_col[txw_idx][txh_idx];
|
||||
const int txfm_size_col = tx_size_wide[tx_size];
|
||||
const int txfm_size_row = tx_size_high[tx_size];
|
||||
const int buf_offset = AOMMAX(txfm_size_row, txfm_size_col);
|
||||
int32_t *temp_out = temp_in + buf_offset;
|
||||
int32_t *buf = temp_out + buf_offset;
|
||||
int32_t *buf_ptr = buf;
|
||||
const int8_t stage_range[MAX_TXFM_STAGE_NUM] = { 16 };
|
||||
int r, bd = 8;
|
||||
const transform_1d_neon row_txfm =
|
||||
lowbd_txfm_all_1d_arr[txw_idx][hitx_1d_tab[tx_type]];
|
||||
const transform_1d_neon col_txfm =
|
||||
lowbd_txfm_all_1d_arr[txh_idx][vitx_1d_tab[tx_type]];
|
||||
|
||||
int ud_flip, lr_flip;
|
||||
get_flip_cfg(tx_type, &ud_flip, &lr_flip);
|
||||
|
||||
for (int i = 0; i < txfm_size_row; i++) {
|
||||
row_txfm(input, buf_ptr, cos_bit_row, stage_range);
|
||||
av1_round_shift_array(buf_ptr, txfm_size_col, -shift[0]);
|
||||
input += txfm_size_col;
|
||||
buf_ptr += txfm_size_col;
|
||||
}
|
||||
|
||||
for (int c = 0; c < txfm_size_col; ++c) {
|
||||
if (lr_flip == 0) {
|
||||
for (r = 0; r < txfm_size_row; ++r)
|
||||
temp_in[r] = buf[r * txfm_size_col + c];
|
||||
} else {
|
||||
// flip left right
|
||||
for (r = 0; r < txfm_size_row; ++r)
|
||||
temp_in[r] = buf[r * txfm_size_col + (txfm_size_col - c - 1)];
|
||||
}
|
||||
col_txfm(temp_in, temp_out, cos_bit_col, stage_range);
|
||||
av1_round_shift_array(temp_out, txfm_size_row, -shift[1]);
|
||||
|
||||
if (ud_flip == 0) {
|
||||
for (r = 0; r < txfm_size_row; ++r) {
|
||||
output[r * stride + c] =
|
||||
highbd_clip_pixel_add(output[r * stride + c], temp_out[r], bd);
|
||||
}
|
||||
} else {
|
||||
// flip upside down
|
||||
for (r = 0; r < txfm_size_row; ++r) {
|
||||
output[r * stride + c] = highbd_clip_pixel_add(
|
||||
output[r * stride + c], temp_out[txfm_size_row - r - 1], bd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void lowbd_inv_txfm2d_add_16x4_neon(const int32_t *input, uint8_t *output,
|
||||
int stride, TX_TYPE tx_type,
|
||||
TX_SIZE tx_size, int eob) {
|
||||
(void)eob;
|
||||
|
||||
DECLARE_ALIGNED(32, int, txfm_buf[16 * 4 + 16 + 16]);
|
||||
int32_t *temp_in = txfm_buf;
|
||||
|
||||
const int8_t *shift = inv_txfm_shift_ls[tx_size];
|
||||
const int txw_idx = get_txw_idx(tx_size);
|
||||
const int txh_idx = get_txh_idx(tx_size);
|
||||
const int cos_bit_row = inv_cos_bit_row[txw_idx][txh_idx];
|
||||
const int cos_bit_col = inv_cos_bit_col[txw_idx][txh_idx];
|
||||
const int txfm_size_col = tx_size_wide[tx_size];
|
||||
const int txfm_size_row = tx_size_high[tx_size];
|
||||
const int buf_offset = AOMMAX(txfm_size_row, txfm_size_col);
|
||||
int32_t *temp_out = temp_in + buf_offset;
|
||||
int32_t *buf = temp_out + buf_offset;
|
||||
int32_t *buf_ptr = buf;
|
||||
const int8_t stage_range[MAX_TXFM_STAGE_NUM] = { 16 };
|
||||
int r, bd = 8;
|
||||
const transform_1d_neon row_txfm =
|
||||
lowbd_txfm_all_1d_arr[txw_idx][hitx_1d_tab[tx_type]];
|
||||
const transform_1d_neon col_txfm =
|
||||
lowbd_txfm_all_1d_arr[txh_idx][vitx_1d_tab[tx_type]];
|
||||
|
||||
int ud_flip, lr_flip;
|
||||
get_flip_cfg(tx_type, &ud_flip, &lr_flip);
|
||||
|
||||
for (int i = 0; i < txfm_size_row; i++) {
|
||||
row_txfm(input, buf_ptr, cos_bit_row, stage_range);
|
||||
av1_round_shift_array(buf_ptr, txfm_size_col, -shift[0]);
|
||||
input += txfm_size_col;
|
||||
buf_ptr += txfm_size_col;
|
||||
}
|
||||
|
||||
for (int c = 0; c < txfm_size_col; ++c) {
|
||||
if (lr_flip == 0) {
|
||||
for (r = 0; r < txfm_size_row; ++r)
|
||||
temp_in[r] = buf[r * txfm_size_col + c];
|
||||
} else {
|
||||
// flip left right
|
||||
for (r = 0; r < txfm_size_row; ++r)
|
||||
temp_in[r] = buf[r * txfm_size_col + (txfm_size_col - c - 1)];
|
||||
}
|
||||
col_txfm(temp_in, temp_out, cos_bit_col, stage_range);
|
||||
av1_round_shift_array(temp_out, txfm_size_row, -shift[1]);
|
||||
|
||||
if (ud_flip == 0) {
|
||||
for (r = 0; r < txfm_size_row; ++r) {
|
||||
output[r * stride + c] =
|
||||
highbd_clip_pixel_add(output[r * stride + c], temp_out[r], bd);
|
||||
}
|
||||
} else {
|
||||
// flip upside down
|
||||
for (r = 0; r < txfm_size_row; ++r) {
|
||||
output[r * stride + c] = highbd_clip_pixel_add(
|
||||
output[r * stride + c], temp_out[txfm_size_row - r - 1], bd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static INLINE void lowbd_inv_txfm2d_add_no_identity_neon(
|
||||
const int32_t *input, uint8_t *output, int stride, TX_TYPE tx_type,
|
||||
TX_SIZE tx_size, int eob) {
|
||||
DECLARE_ALIGNED(32, int, txfm_buf[64 * 64 + 64 + 64]);
|
||||
int32_t *temp_in = txfm_buf;
|
||||
|
||||
int eobx, eoby, ud_flip, lr_flip, row_start;
|
||||
get_eobx_eoby_scan_default(&eobx, &eoby, tx_size, eob);
|
||||
const int8_t *shift = inv_txfm_shift_ls[tx_size];
|
||||
const int txw_idx = get_txw_idx(tx_size);
|
||||
const int txh_idx = get_txh_idx(tx_size);
|
||||
const int cos_bit_col = inv_cos_bit_col[txw_idx][txh_idx];
|
||||
const int cos_bit_row = inv_cos_bit_row[txw_idx][txh_idx];
|
||||
const int txfm_size_col = tx_size_wide[tx_size];
|
||||
const int txfm_size_row = tx_size_high[tx_size];
|
||||
const int buf_size_nonzero_h_div8 = (eoby + 8) >> 3;
|
||||
const int rect_type = get_rect_tx_log_ratio(txfm_size_col, txfm_size_row);
|
||||
const int buf_offset = AOMMAX(txfm_size_row, txfm_size_col);
|
||||
|
||||
int32_t *temp_out = temp_in + buf_offset;
|
||||
int32_t *buf = temp_out + buf_offset;
|
||||
int32_t *buf_ptr = buf;
|
||||
const int8_t stage_range[MAX_TXFM_STAGE_NUM] = { 16 };
|
||||
const int bd = 8;
|
||||
int r;
|
||||
|
||||
const int fun_idx_x = lowbd_txfm_all_1d_zeros_idx[eobx];
|
||||
const int fun_idx_y = lowbd_txfm_all_1d_zeros_idx[eoby];
|
||||
const transform_1d_neon row_txfm =
|
||||
lowbd_txfm_all_1d_zeros_w8_arr[txw_idx][hitx_1d_tab[tx_type]][fun_idx_x];
|
||||
const transform_1d_neon col_txfm =
|
||||
lowbd_txfm_all_1d_zeros_w8_arr[txh_idx][vitx_1d_tab[tx_type]][fun_idx_y];
|
||||
|
||||
assert(col_txfm != NULL);
|
||||
assert(row_txfm != NULL);
|
||||
|
||||
get_flip_cfg(tx_type, &ud_flip, &lr_flip);
|
||||
row_start = (buf_size_nonzero_h_div8 << 3);
|
||||
|
||||
for (int i = 0; i < row_start; i++) {
|
||||
if (abs(rect_type) == 1) {
|
||||
for (int j = 0; j < txfm_size_col; j++)
|
||||
temp_in[j] = round_shift((int64_t)input[j] * NewInvSqrt2, NewSqrt2Bits);
|
||||
row_txfm(temp_in, buf_ptr, cos_bit_row, stage_range);
|
||||
} else {
|
||||
row_txfm(input, buf_ptr, cos_bit_row, stage_range);
|
||||
}
|
||||
av1_round_shift_array(buf_ptr, txfm_size_col, -shift[0]);
|
||||
input += txfm_size_col;
|
||||
buf_ptr += txfm_size_col;
|
||||
}
|
||||
|
||||
// Doing memset for the rows which are not processed in row transform.
|
||||
memset(buf_ptr, 0,
|
||||
sizeof(int32_t) * txfm_size_col * (txfm_size_row - row_start));
|
||||
|
||||
for (int c = 0; c < txfm_size_col; c++) {
|
||||
if (lr_flip == 0) {
|
||||
for (r = 0; r < txfm_size_row; ++r)
|
||||
temp_in[r] = buf[r * txfm_size_col + c];
|
||||
} else {
|
||||
// flip left right
|
||||
for (r = 0; r < txfm_size_row; ++r)
|
||||
temp_in[r] = buf[r * txfm_size_col + (txfm_size_col - c - 1)];
|
||||
}
|
||||
col_txfm(temp_in, temp_out, cos_bit_col, stage_range);
|
||||
av1_round_shift_array(temp_out, txfm_size_row, -shift[1]);
|
||||
|
||||
if (ud_flip == 0) {
|
||||
for (r = 0; r < txfm_size_row; ++r) {
|
||||
output[r * stride + c] =
|
||||
highbd_clip_pixel_add(output[r * stride + c], temp_out[r], bd);
|
||||
}
|
||||
} else {
|
||||
// flip upside down
|
||||
for (r = 0; r < txfm_size_row; ++r) {
|
||||
output[r * stride + c] = highbd_clip_pixel_add(
|
||||
output[r * stride + c], temp_out[txfm_size_row - r - 1], bd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static INLINE void lowbd_inv_txfm2d_add_universe_neon(
|
||||
const int32_t *input, uint8_t *output, int stride, TX_TYPE tx_type,
|
||||
TX_SIZE tx_size, int eob) {
|
||||
switch (tx_type) {
|
||||
case IDTX:
|
||||
lowbd_inv_txfm2d_add_idtx_neon(input, output, stride, tx_type, tx_size,
|
||||
eob);
|
||||
break;
|
||||
|
||||
case H_DCT:
|
||||
case H_ADST:
|
||||
case H_FLIPADST:
|
||||
lowbd_inv_txfm2d_add_v_identity_neon(input, output, stride, tx_type,
|
||||
tx_size, eob);
|
||||
break;
|
||||
|
||||
case V_DCT:
|
||||
case V_ADST:
|
||||
case V_FLIPADST:
|
||||
lowbd_inv_txfm2d_add_h_identity_neon(input, output, stride, tx_type,
|
||||
tx_size, eob);
|
||||
break;
|
||||
|
||||
default:
|
||||
lowbd_inv_txfm2d_add_no_identity_neon(input, output, stride, tx_type,
|
||||
tx_size, eob);
|
||||
break;
|
||||
}
|
||||
}
|
||||
void av1_lowbd_inv_txfm2d_add_neon(const int32_t *input, uint8_t *output,
|
||||
int stride, TX_TYPE tx_type, TX_SIZE tx_size,
|
||||
int eob) {
|
||||
int row;
|
||||
switch (tx_size) {
|
||||
case TX_4X4:
|
||||
lowbd_inv_txfm2d_add_4x4_neon(input, output, stride, tx_type, tx_size,
|
||||
eob);
|
||||
break;
|
||||
|
||||
case TX_4X8:
|
||||
lowbd_inv_txfm2d_add_4x8_neon(input, output, stride, tx_type, tx_size,
|
||||
eob);
|
||||
break;
|
||||
|
||||
case TX_8X4:
|
||||
lowbd_inv_txfm2d_add_8x4_neon(input, output, stride, tx_type, tx_size,
|
||||
eob);
|
||||
break;
|
||||
|
||||
case TX_4X16:
|
||||
lowbd_inv_txfm2d_add_4x16_neon(input, output, stride, tx_type, tx_size,
|
||||
eob);
|
||||
break;
|
||||
|
||||
case TX_16X4:
|
||||
lowbd_inv_txfm2d_add_16x4_neon(input, output, stride, tx_type, tx_size,
|
||||
eob);
|
||||
break;
|
||||
|
||||
case TX_16X64: {
|
||||
lowbd_inv_txfm2d_add_universe_neon(input, output, stride, tx_type,
|
||||
tx_size, eob);
|
||||
} break;
|
||||
|
||||
case TX_64X16: {
|
||||
int32_t mod_input[64 * 16];
|
||||
for (row = 0; row < 16; ++row) {
|
||||
memcpy(mod_input + row * 64, input + row * 32, 32 * sizeof(*mod_input));
|
||||
memset(mod_input + row * 64 + 32, 0, 32 * sizeof(*mod_input));
|
||||
}
|
||||
lowbd_inv_txfm2d_add_universe_neon(mod_input, output, stride, tx_type,
|
||||
tx_size, eob);
|
||||
} break;
|
||||
|
||||
case TX_32X64: {
|
||||
lowbd_inv_txfm2d_add_universe_neon(input, output, stride, tx_type,
|
||||
tx_size, eob);
|
||||
} break;
|
||||
|
||||
case TX_64X32: {
|
||||
int32_t mod_input[64 * 32];
|
||||
for (row = 0; row < 32; ++row) {
|
||||
memcpy(mod_input + row * 64, input + row * 32, 32 * sizeof(*mod_input));
|
||||
memset(mod_input + row * 64 + 32, 0, 32 * sizeof(*mod_input));
|
||||
}
|
||||
lowbd_inv_txfm2d_add_universe_neon(mod_input, output, stride, tx_type,
|
||||
tx_size, eob);
|
||||
} break;
|
||||
|
||||
case TX_64X64: {
|
||||
int32_t mod_input[64 * 64];
|
||||
for (row = 0; row < 32; ++row) {
|
||||
memcpy(mod_input + row * 64, input + row * 32, 32 * sizeof(*mod_input));
|
||||
memset(mod_input + row * 64 + 32, 0, 32 * sizeof(*mod_input));
|
||||
}
|
||||
lowbd_inv_txfm2d_add_universe_neon(mod_input, output, stride, tx_type,
|
||||
tx_size, eob);
|
||||
} break;
|
||||
|
||||
default:
|
||||
lowbd_inv_txfm2d_add_universe_neon(input, output, stride, tx_type,
|
||||
tx_size, eob);
|
||||
break;
|
||||
}
|
||||
}
|
||||
void av1_inv_txfm_add_neon(const tran_low_t *dqcoeff, uint8_t *dst, int stride,
|
||||
const TxfmParam *txfm_param) {
|
||||
const TX_TYPE tx_type = txfm_param->tx_type;
|
||||
if (!txfm_param->lossless) {
|
||||
av1_lowbd_inv_txfm2d_add_neon(dqcoeff, dst, stride, tx_type,
|
||||
txfm_param->tx_size, txfm_param->eob);
|
||||
} else {
|
||||
av1_inv_txfm_add_c(dqcoeff, dst, stride, txfm_param);
|
||||
}
|
||||
}
|
||||
152
third_party/aom/av1/common/arm/av1_inv_txfm_neon.h
vendored
Normal file
152
third_party/aom/av1/common/arm/av1_inv_txfm_neon.h
vendored
Normal file
|
|
@ -0,0 +1,152 @@
|
|||
/*
|
||||
* Copyright (c) 2018, Alliance for Open Media. All rights reserved
|
||||
*
|
||||
* This source code is subject to the terms of the BSD 2 Clause License and
|
||||
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
|
||||
* was not distributed with this source code in the LICENSE file, you can
|
||||
* obtain it at www.aomedia.org/license/software. If the Alliance for Open
|
||||
* Media Patent License 1.0 was not distributed with this source code in the
|
||||
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
|
||||
*/
|
||||
#ifndef AV1_COMMON_ARM_AV1_INV_TXFM_NEON_H_
|
||||
#define AV1_COMMON_ARM_AV1_INV_TXFM_NEON_H_
|
||||
|
||||
#include "config/aom_config.h"
|
||||
#include "config/av1_rtcd.h"
|
||||
|
||||
#include "aom/aom_integer.h"
|
||||
#include "av1/common/enums.h"
|
||||
#include "av1/common/av1_inv_txfm1d.h"
|
||||
#include "av1/common/av1_inv_txfm1d_cfg.h"
|
||||
#include "av1/common/av1_txfm.h"
|
||||
|
||||
typedef void (*transform_1d_neon)(const int32_t *input, int32_t *output,
|
||||
const int8_t cos_bit,
|
||||
const int8_t *stage_ptr);
|
||||
|
||||
DECLARE_ALIGNED(16, static const int16_t, av1_eob_to_eobxy_8x8_default[8]) = {
|
||||
0x0707, 0x0707, 0x0707, 0x0707, 0x0707, 0x0707, 0x0707, 0x0707,
|
||||
};
|
||||
|
||||
DECLARE_ALIGNED(16, static const int16_t,
|
||||
av1_eob_to_eobxy_16x16_default[16]) = {
|
||||
0x0707, 0x0707, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f,
|
||||
0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f,
|
||||
};
|
||||
|
||||
DECLARE_ALIGNED(16, static const int16_t,
|
||||
av1_eob_to_eobxy_32x32_default[32]) = {
|
||||
0x0707, 0x0f0f, 0x0f0f, 0x0f0f, 0x1f1f, 0x1f1f, 0x1f1f, 0x1f1f,
|
||||
0x1f1f, 0x1f1f, 0x1f1f, 0x1f1f, 0x1f1f, 0x1f1f, 0x1f1f, 0x1f1f,
|
||||
0x1f1f, 0x1f1f, 0x1f1f, 0x1f1f, 0x1f1f, 0x1f1f, 0x1f1f, 0x1f1f,
|
||||
0x1f1f, 0x1f1f, 0x1f1f, 0x1f1f, 0x1f1f, 0x1f1f, 0x1f1f, 0x1f1f,
|
||||
};
|
||||
|
||||
DECLARE_ALIGNED(16, static const int16_t, av1_eob_to_eobxy_8x16_default[16]) = {
|
||||
0x0707, 0x0707, 0x0707, 0x0707, 0x0707, 0x0f07, 0x0f07, 0x0f07,
|
||||
0x0f07, 0x0f07, 0x0f07, 0x0f07, 0x0f07, 0x0f07, 0x0f07, 0x0f07,
|
||||
};
|
||||
|
||||
DECLARE_ALIGNED(16, static const int16_t, av1_eob_to_eobxy_16x8_default[8]) = {
|
||||
0x0707, 0x0707, 0x070f, 0x070f, 0x070f, 0x070f, 0x070f, 0x070f,
|
||||
};
|
||||
|
||||
DECLARE_ALIGNED(16, static const int16_t,
|
||||
av1_eob_to_eobxy_16x32_default[32]) = {
|
||||
0x0707, 0x0707, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f,
|
||||
0x0f0f, 0x1f0f, 0x1f0f, 0x1f0f, 0x1f0f, 0x1f0f, 0x1f0f, 0x1f0f,
|
||||
0x1f0f, 0x1f0f, 0x1f0f, 0x1f0f, 0x1f0f, 0x1f0f, 0x1f0f, 0x1f0f,
|
||||
0x1f0f, 0x1f0f, 0x1f0f, 0x1f0f, 0x1f0f, 0x1f0f, 0x1f0f, 0x1f0f,
|
||||
};
|
||||
|
||||
DECLARE_ALIGNED(16, static const int16_t,
|
||||
av1_eob_to_eobxy_32x16_default[16]) = {
|
||||
0x0707, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f1f, 0x0f1f, 0x0f1f, 0x0f1f,
|
||||
0x0f1f, 0x0f1f, 0x0f1f, 0x0f1f, 0x0f1f, 0x0f1f, 0x0f1f, 0x0f1f,
|
||||
};
|
||||
|
||||
DECLARE_ALIGNED(16, static const int16_t, av1_eob_to_eobxy_8x32_default[32]) = {
|
||||
0x0707, 0x0707, 0x0707, 0x0707, 0x0707, 0x0f07, 0x0f07, 0x0f07,
|
||||
0x0f07, 0x0f07, 0x0f07, 0x0f07, 0x0f07, 0x1f07, 0x1f07, 0x1f07,
|
||||
0x1f07, 0x1f07, 0x1f07, 0x1f07, 0x1f07, 0x1f07, 0x1f07, 0x1f07,
|
||||
0x1f07, 0x1f07, 0x1f07, 0x1f07, 0x1f07, 0x1f07, 0x1f07, 0x1f07,
|
||||
};
|
||||
|
||||
DECLARE_ALIGNED(16, static const int16_t, av1_eob_to_eobxy_32x8_default[8]) = {
|
||||
0x0707, 0x070f, 0x070f, 0x071f, 0x071f, 0x071f, 0x071f, 0x071f,
|
||||
};
|
||||
|
||||
DECLARE_ALIGNED(16, static const int16_t *,
|
||||
av1_eob_to_eobxy_default[TX_SIZES_ALL]) = {
|
||||
NULL,
|
||||
av1_eob_to_eobxy_8x8_default,
|
||||
av1_eob_to_eobxy_16x16_default,
|
||||
av1_eob_to_eobxy_32x32_default,
|
||||
av1_eob_to_eobxy_32x32_default,
|
||||
NULL,
|
||||
NULL,
|
||||
av1_eob_to_eobxy_8x16_default,
|
||||
av1_eob_to_eobxy_16x8_default,
|
||||
av1_eob_to_eobxy_16x32_default,
|
||||
av1_eob_to_eobxy_32x16_default,
|
||||
av1_eob_to_eobxy_32x32_default,
|
||||
av1_eob_to_eobxy_32x32_default,
|
||||
NULL,
|
||||
NULL,
|
||||
av1_eob_to_eobxy_8x32_default,
|
||||
av1_eob_to_eobxy_32x8_default,
|
||||
av1_eob_to_eobxy_16x32_default,
|
||||
av1_eob_to_eobxy_32x16_default,
|
||||
};
|
||||
|
||||
static const int lowbd_txfm_all_1d_zeros_idx[32] = {
|
||||
0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||
};
|
||||
|
||||
// Transform block width in log2 for eob (size of 64 map to 32)
|
||||
static const int tx_size_wide_log2_eob[TX_SIZES_ALL] = {
|
||||
2, 3, 4, 5, 5, 2, 3, 3, 4, 4, 5, 5, 5, 2, 4, 3, 5, 4, 5,
|
||||
};
|
||||
|
||||
static int eob_fill[32] = {
|
||||
0, 7, 7, 7, 7, 7, 7, 7, 15, 15, 15, 15, 15, 15, 15, 15,
|
||||
31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
|
||||
};
|
||||
|
||||
static INLINE void get_eobx_eoby_scan_default(int *eobx, int *eoby,
|
||||
TX_SIZE tx_size, int eob) {
|
||||
if (eob == 1) {
|
||||
*eobx = 0;
|
||||
*eoby = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
const int tx_w_log2 = tx_size_wide_log2_eob[tx_size];
|
||||
const int eob_row = (eob - 1) >> tx_w_log2;
|
||||
const int eobxy = av1_eob_to_eobxy_default[tx_size][eob_row];
|
||||
*eobx = eobxy & 0xFF;
|
||||
*eoby = eobxy >> 8;
|
||||
}
|
||||
|
||||
static INLINE void get_eobx_eoby_scan_v_identity(int *eobx, int *eoby,
|
||||
TX_SIZE tx_size, int eob) {
|
||||
eob -= 1;
|
||||
const int txfm_size_row = tx_size_high[tx_size];
|
||||
const int eoby_max = AOMMIN(32, txfm_size_row) - 1;
|
||||
*eobx = eob / (eoby_max + 1);
|
||||
*eoby = (eob >= eoby_max) ? eoby_max : eob_fill[eob];
|
||||
}
|
||||
|
||||
static INLINE void get_eobx_eoby_scan_h_identity(int *eobx, int *eoby,
|
||||
TX_SIZE tx_size, int eob) {
|
||||
eob -= 1;
|
||||
const int txfm_size_col = tx_size_wide[tx_size];
|
||||
const int eobx_max = AOMMIN(32, txfm_size_col) - 1;
|
||||
*eobx = (eob >= eobx_max) ? eobx_max : eob_fill[eob];
|
||||
const int temp_eoby = eob / (eobx_max + 1);
|
||||
assert(temp_eoby < 32);
|
||||
*eoby = eob_fill[temp_eoby];
|
||||
}
|
||||
|
||||
#endif // AV1_COMMON_ARM_AV1_INV_TXFM_NEON_H_
|
||||
24
third_party/aom/av1/common/arm/convolve_neon.c
vendored
24
third_party/aom/av1/common/arm/convolve_neon.c
vendored
|
|
@ -164,8 +164,8 @@ static INLINE uint8x8_t convolve8_vert_8x4_s32(
|
|||
|
||||
void av1_convolve_x_sr_neon(const uint8_t *src, int src_stride, uint8_t *dst,
|
||||
int dst_stride, int w, int h,
|
||||
InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y,
|
||||
const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y,
|
||||
const int subpel_x_q4, const int subpel_y_q4,
|
||||
ConvolveParams *conv_params) {
|
||||
const uint8_t horiz_offset = filter_params_x->taps / 2 - 1;
|
||||
|
|
@ -182,7 +182,7 @@ void av1_convolve_x_sr_neon(const uint8_t *src, int src_stride, uint8_t *dst,
|
|||
((conv_params->round_0 + conv_params->round_1) == 2 * FILTER_BITS));
|
||||
|
||||
const int16_t *x_filter = av1_get_interp_filter_subpel_kernel(
|
||||
*filter_params_x, subpel_x_q4 & SUBPEL_MASK);
|
||||
filter_params_x, subpel_x_q4 & SUBPEL_MASK);
|
||||
|
||||
const int16x8_t shift_round_0 = vdupq_n_s16(-conv_params->round_0);
|
||||
const int16x8_t shift_by_bits = vdupq_n_s16(-bits);
|
||||
|
|
@ -485,8 +485,8 @@ void av1_convolve_x_sr_neon(const uint8_t *src, int src_stride, uint8_t *dst,
|
|||
|
||||
void av1_convolve_y_sr_neon(const uint8_t *src, int src_stride, uint8_t *dst,
|
||||
int dst_stride, int w, int h,
|
||||
InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y,
|
||||
const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y,
|
||||
const int subpel_x_q4, const int subpel_y_q4,
|
||||
ConvolveParams *conv_params) {
|
||||
const int vert_offset = filter_params_y->taps / 2 - 1;
|
||||
|
|
@ -502,7 +502,7 @@ void av1_convolve_y_sr_neon(const uint8_t *src, int src_stride, uint8_t *dst,
|
|||
((conv_params->round_0 + conv_params->round_1) == (2 * FILTER_BITS)));
|
||||
|
||||
const int16_t *y_filter = av1_get_interp_filter_subpel_kernel(
|
||||
*filter_params_y, subpel_y_q4 & SUBPEL_MASK);
|
||||
filter_params_y, subpel_y_q4 & SUBPEL_MASK);
|
||||
|
||||
if (w <= 4) {
|
||||
uint8x8_t d01, d23;
|
||||
|
|
@ -680,8 +680,8 @@ void av1_convolve_y_sr_neon(const uint8_t *src, int src_stride, uint8_t *dst,
|
|||
|
||||
void av1_convolve_2d_sr_neon(const uint8_t *src, int src_stride, uint8_t *dst,
|
||||
int dst_stride, int w, int h,
|
||||
InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y,
|
||||
const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y,
|
||||
const int subpel_x_q4, const int subpel_y_q4,
|
||||
ConvolveParams *conv_params) {
|
||||
int im_dst_stride;
|
||||
|
|
@ -711,7 +711,7 @@ void av1_convolve_2d_sr_neon(const uint8_t *src, int src_stride, uint8_t *dst,
|
|||
const int16x8_t vec_round_bits = vdupq_n_s16(-round_bits);
|
||||
const int offset_bits = bd + 2 * FILTER_BITS - conv_params->round_0;
|
||||
const int16_t *x_filter = av1_get_interp_filter_subpel_kernel(
|
||||
*filter_params_x, subpel_x_q4 & SUBPEL_MASK);
|
||||
filter_params_x, subpel_x_q4 & SUBPEL_MASK);
|
||||
|
||||
int16_t x_filter_tmp[8];
|
||||
int16x8_t filter_x_coef = vld1q_s16(x_filter);
|
||||
|
|
@ -896,7 +896,7 @@ void av1_convolve_2d_sr_neon(const uint8_t *src, int src_stride, uint8_t *dst,
|
|||
const int32_t sub_const = (1 << (offset_bits - conv_params->round_1)) +
|
||||
(1 << (offset_bits - conv_params->round_1 - 1));
|
||||
const int16_t *y_filter = av1_get_interp_filter_subpel_kernel(
|
||||
*filter_params_y, subpel_y_q4 & SUBPEL_MASK);
|
||||
filter_params_y, subpel_y_q4 & SUBPEL_MASK);
|
||||
|
||||
const int32x4_t round_shift_vec = vdupq_n_s32(-(conv_params->round_1));
|
||||
const int32x4_t offset_const = vdupq_n_s32(1 << offset_bits);
|
||||
|
|
@ -1086,8 +1086,8 @@ void av1_convolve_2d_sr_neon(const uint8_t *src, int src_stride, uint8_t *dst,
|
|||
}
|
||||
void av1_convolve_2d_copy_sr_neon(const uint8_t *src, int src_stride,
|
||||
uint8_t *dst, int dst_stride, int w, int h,
|
||||
InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y,
|
||||
const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y,
|
||||
const int subpel_x_q4, const int subpel_y_q4,
|
||||
ConvolveParams *conv_params) {
|
||||
(void)filter_params_x;
|
||||
|
|
|
|||
79
third_party/aom/av1/common/arm/intrapred_neon.c
vendored
79
third_party/aom/av1/common/arm/intrapred_neon.c
vendored
|
|
@ -1,79 +0,0 @@
|
|||
/*
|
||||
*
|
||||
* Copyright (c) 2018, Alliance for Open Media. All rights reserved
|
||||
*
|
||||
* This source code is subject to the terms of the BSD 2 Clause License and
|
||||
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
|
||||
* was not distributed with this source code in the LICENSE file, you can
|
||||
* obtain it at www.aomedia.org/license/software. If the Alliance for Open
|
||||
* Media Patent License 1.0 was not distributed with this source code in the
|
||||
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
|
||||
*/
|
||||
#include <arm_neon.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "aom_mem/aom_mem.h"
|
||||
#include "aom_ports/mem.h"
|
||||
#include "av1/common/arm/mem_neon.h"
|
||||
#include "config/aom_dsp_rtcd.h"
|
||||
|
||||
static INLINE void highbd_dc_predictor_neon(uint16_t *dst, ptrdiff_t stride,
|
||||
int bw, const uint16_t *above,
|
||||
const uint16_t *left) {
|
||||
assert(bw >= 4);
|
||||
assert(IS_POWER_OF_TWO(bw));
|
||||
int expected_dc, sum = 0;
|
||||
const int count = bw * 2;
|
||||
uint32x4_t sum_q = vdupq_n_u32(0);
|
||||
uint32x2_t sum_d;
|
||||
uint16_t *dst_1;
|
||||
if (bw >= 8) {
|
||||
for (int i = 0; i < bw; i += 8) {
|
||||
sum_q = vpadalq_u16(sum_q, vld1q_u16(above));
|
||||
sum_q = vpadalq_u16(sum_q, vld1q_u16(left));
|
||||
above += 8;
|
||||
left += 8;
|
||||
}
|
||||
sum_d = vadd_u32(vget_low_u32(sum_q), vget_high_u32(sum_q));
|
||||
sum = vget_lane_s32(vreinterpret_s32_u64(vpaddl_u32(sum_d)), 0);
|
||||
expected_dc = (sum + (count >> 1)) / count;
|
||||
const uint16x8_t dc = vdupq_n_u16((uint16_t)expected_dc);
|
||||
for (int r = 0; r < bw; r++) {
|
||||
dst_1 = dst;
|
||||
for (int i = 0; i < bw; i += 8) {
|
||||
vst1q_u16(dst_1, dc);
|
||||
dst_1 += 8;
|
||||
}
|
||||
dst += stride;
|
||||
}
|
||||
} else { // 4x4
|
||||
sum_q = vaddl_u16(vld1_u16(above), vld1_u16(left));
|
||||
sum_d = vadd_u32(vget_low_u32(sum_q), vget_high_u32(sum_q));
|
||||
sum = vget_lane_s32(vreinterpret_s32_u64(vpaddl_u32(sum_d)), 0);
|
||||
expected_dc = (sum + (count >> 1)) / count;
|
||||
const uint16x4_t dc = vdup_n_u16((uint16_t)expected_dc);
|
||||
for (int r = 0; r < bw; r++) {
|
||||
vst1_u16(dst, dc);
|
||||
dst += stride;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define intra_pred_highbd_sized(type, width) \
|
||||
void aom_highbd_##type##_predictor_##width##x##width##_neon( \
|
||||
uint16_t *dst, ptrdiff_t stride, const uint16_t *above, \
|
||||
const uint16_t *left, int bd) { \
|
||||
(void)bd; \
|
||||
highbd_##type##_predictor_neon(dst, stride, width, above, left); \
|
||||
}
|
||||
|
||||
#define intra_pred_square(type) \
|
||||
intra_pred_highbd_sized(type, 4); \
|
||||
intra_pred_highbd_sized(type, 8); \
|
||||
intra_pred_highbd_sized(type, 16); \
|
||||
intra_pred_highbd_sized(type, 32); \
|
||||
intra_pred_highbd_sized(type, 64);
|
||||
|
||||
intra_pred_square(dc);
|
||||
|
||||
#undef intra_pred_square
|
||||
|
|
@ -515,8 +515,8 @@ static INLINE void jnt_convolve_2d_vert_neon(
|
|||
|
||||
void av1_jnt_convolve_2d_neon(const uint8_t *src, int src_stride, uint8_t *dst8,
|
||||
int dst8_stride, int w, int h,
|
||||
InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y,
|
||||
const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y,
|
||||
const int subpel_x_q4, const int subpel_y_q4,
|
||||
ConvolveParams *conv_params) {
|
||||
assert(!(w % 4));
|
||||
|
|
@ -532,9 +532,9 @@ void av1_jnt_convolve_2d_neon(const uint8_t *src, int src_stride, uint8_t *dst8,
|
|||
const int round_0 = conv_params->round_0 - 1;
|
||||
const uint8_t *src_ptr = src - vert_offset * src_stride - horiz_offset;
|
||||
const int16_t *x_filter = av1_get_interp_filter_subpel_kernel(
|
||||
*filter_params_x, subpel_x_q4 & SUBPEL_MASK);
|
||||
filter_params_x, subpel_x_q4 & SUBPEL_MASK);
|
||||
const int16_t *y_filter = av1_get_interp_filter_subpel_kernel(
|
||||
*filter_params_y, subpel_y_q4 & SUBPEL_MASK);
|
||||
filter_params_y, subpel_y_q4 & SUBPEL_MASK);
|
||||
|
||||
int16_t x_filter_tmp[8];
|
||||
int16x8_t filter_x_coef = vld1q_s16(x_filter);
|
||||
|
|
@ -553,8 +553,8 @@ void av1_jnt_convolve_2d_neon(const uint8_t *src, int src_stride, uint8_t *dst8,
|
|||
|
||||
void av1_jnt_convolve_2d_copy_neon(const uint8_t *src, int src_stride,
|
||||
uint8_t *dst8, int dst8_stride, int w, int h,
|
||||
InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y,
|
||||
const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y,
|
||||
const int subpel_x_q4, const int subpel_y_q4,
|
||||
ConvolveParams *conv_params) {
|
||||
uint8x8_t res0_8, res1_8, res2_8, res3_8, tmp_shift0, tmp_shift1, tmp_shift2,
|
||||
|
|
@ -679,8 +679,8 @@ void av1_jnt_convolve_2d_copy_neon(const uint8_t *src, int src_stride,
|
|||
|
||||
void av1_jnt_convolve_x_neon(const uint8_t *src, int src_stride, uint8_t *dst8,
|
||||
int dst8_stride, int w, int h,
|
||||
InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y,
|
||||
const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y,
|
||||
const int subpel_x_q4, const int subpel_y_q4,
|
||||
ConvolveParams *conv_params) {
|
||||
assert(!(w % 4));
|
||||
|
|
@ -705,7 +705,7 @@ void av1_jnt_convolve_x_neon(const uint8_t *src, int src_stride, uint8_t *dst8,
|
|||
|
||||
// horizontal filter
|
||||
const int16_t *x_filter = av1_get_interp_filter_subpel_kernel(
|
||||
*filter_params_x, subpel_x_q4 & SUBPEL_MASK);
|
||||
filter_params_x, subpel_x_q4 & SUBPEL_MASK);
|
||||
|
||||
const uint8_t *src_ptr = src - horiz_offset;
|
||||
|
||||
|
|
@ -1013,8 +1013,8 @@ void av1_jnt_convolve_x_neon(const uint8_t *src, int src_stride, uint8_t *dst8,
|
|||
|
||||
void av1_jnt_convolve_y_neon(const uint8_t *src, int src_stride, uint8_t *dst8,
|
||||
int dst8_stride, int w, int h,
|
||||
InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y,
|
||||
const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y,
|
||||
const int subpel_x_q4, const int subpel_y_q4,
|
||||
ConvolveParams *conv_params) {
|
||||
assert(!(w % 4));
|
||||
|
|
@ -1040,7 +1040,7 @@ void av1_jnt_convolve_y_neon(const uint8_t *src, int src_stride, uint8_t *dst8,
|
|||
|
||||
// vertical filter
|
||||
const int16_t *y_filter = av1_get_interp_filter_subpel_kernel(
|
||||
*filter_params_y, subpel_y_q4 & SUBPEL_MASK);
|
||||
filter_params_y, subpel_y_q4 & SUBPEL_MASK);
|
||||
|
||||
const uint8_t *src_ptr = src - (vert_offset * src_stride);
|
||||
|
||||
|
|
|
|||
84
third_party/aom/av1/common/arm/mem_neon.h
vendored
84
third_party/aom/av1/common/arm/mem_neon.h
vendored
|
|
@ -22,6 +22,14 @@ static INLINE void store_row2_u8_8x8(uint8_t *s, int p, const uint8x8_t s0,
|
|||
s += p;
|
||||
}
|
||||
|
||||
/* These intrinsics require immediate values, so we must use #defines
|
||||
to enforce that. */
|
||||
#define load_u8_4x1(s, s0, lane) \
|
||||
do { \
|
||||
*(s0) = vreinterpret_u8_u32( \
|
||||
vld1_lane_u32((uint32_t *)(s), vreinterpret_u32_u8(*(s0)), lane)); \
|
||||
} while (0)
|
||||
|
||||
static INLINE void load_u8_8x8(const uint8_t *s, ptrdiff_t p,
|
||||
uint8x8_t *const s0, uint8x8_t *const s1,
|
||||
uint8x8_t *const s2, uint8x8_t *const s3,
|
||||
|
|
@ -128,6 +136,13 @@ static INLINE void load_s16_4x4(const int16_t *s, ptrdiff_t p,
|
|||
*s3 = vld1_s16(s);
|
||||
}
|
||||
|
||||
/* These intrinsics require immediate values, so we must use #defines
|
||||
to enforce that. */
|
||||
#define store_u8_4x1(s, s0, lane) \
|
||||
do { \
|
||||
vst1_lane_u32((uint32_t *)(s), vreinterpret_u32_u8(s0), lane); \
|
||||
} while (0)
|
||||
|
||||
static INLINE void store_u8_8x8(uint8_t *s, ptrdiff_t p, const uint8x8_t s0,
|
||||
const uint8x8_t s1, const uint8x8_t s2,
|
||||
const uint8x8_t s3, const uint8x8_t s4,
|
||||
|
|
@ -242,6 +257,30 @@ static INLINE void store_s16_8x8(int16_t *s, ptrdiff_t dst_stride,
|
|||
vst1q_s16(s, s7);
|
||||
}
|
||||
|
||||
static INLINE void store_s16_4x4(int16_t *s, ptrdiff_t dst_stride,
|
||||
const int16x4_t s0, const int16x4_t s1,
|
||||
const int16x4_t s2, const int16x4_t s3) {
|
||||
vst1_s16(s, s0);
|
||||
s += dst_stride;
|
||||
vst1_s16(s, s1);
|
||||
s += dst_stride;
|
||||
vst1_s16(s, s2);
|
||||
s += dst_stride;
|
||||
vst1_s16(s, s3);
|
||||
}
|
||||
|
||||
static INLINE void store_s16_8x4(int16_t *s, ptrdiff_t dst_stride,
|
||||
const int16x8_t s0, const int16x8_t s1,
|
||||
const int16x8_t s2, const int16x8_t s3) {
|
||||
vst1q_s16(s, s0);
|
||||
s += dst_stride;
|
||||
vst1q_s16(s, s1);
|
||||
s += dst_stride;
|
||||
vst1q_s16(s, s2);
|
||||
s += dst_stride;
|
||||
vst1q_s16(s, s3);
|
||||
}
|
||||
|
||||
static INLINE void load_s16_8x8(const int16_t *s, ptrdiff_t p,
|
||||
int16x8_t *const s0, int16x8_t *const s1,
|
||||
int16x8_t *const s2, int16x8_t *const s3,
|
||||
|
|
@ -398,4 +437,49 @@ static INLINE void load_unaligned_u16_4x4(const uint16_t *buf, uint32_t stride,
|
|||
*tu1 = vsetq_lane_u64(a, *tu1, 1);
|
||||
}
|
||||
|
||||
static INLINE void load_s32_4x4(int32_t *s, int32_t p, int32x4_t *s1,
|
||||
int32x4_t *s2, int32x4_t *s3, int32x4_t *s4) {
|
||||
*s1 = vld1q_s32(s);
|
||||
s += p;
|
||||
*s2 = vld1q_s32(s);
|
||||
s += p;
|
||||
*s3 = vld1q_s32(s);
|
||||
s += p;
|
||||
*s4 = vld1q_s32(s);
|
||||
}
|
||||
|
||||
static INLINE void store_s32_4x4(int32_t *s, int32_t p, int32x4_t s1,
|
||||
int32x4_t s2, int32x4_t s3, int32x4_t s4) {
|
||||
vst1q_s32(s, s1);
|
||||
s += p;
|
||||
vst1q_s32(s, s2);
|
||||
s += p;
|
||||
vst1q_s32(s, s3);
|
||||
s += p;
|
||||
vst1q_s32(s, s4);
|
||||
}
|
||||
|
||||
static INLINE void load_u32_4x4(uint32_t *s, int32_t p, uint32x4_t *s1,
|
||||
uint32x4_t *s2, uint32x4_t *s3,
|
||||
uint32x4_t *s4) {
|
||||
*s1 = vld1q_u32(s);
|
||||
s += p;
|
||||
*s2 = vld1q_u32(s);
|
||||
s += p;
|
||||
*s3 = vld1q_u32(s);
|
||||
s += p;
|
||||
*s4 = vld1q_u32(s);
|
||||
}
|
||||
|
||||
static INLINE void store_u32_4x4(uint32_t *s, int32_t p, uint32x4_t s1,
|
||||
uint32x4_t s2, uint32x4_t s3, uint32x4_t s4) {
|
||||
vst1q_u32(s, s1);
|
||||
s += p;
|
||||
vst1q_u32(s, s2);
|
||||
s += p;
|
||||
vst1q_u32(s, s3);
|
||||
s += p;
|
||||
vst1q_u32(s, s4);
|
||||
}
|
||||
|
||||
#endif // AV1_COMMON_ARM_MEM_NEON_H_
|
||||
|
|
|
|||
1506
third_party/aom/av1/common/arm/selfguided_neon.c
vendored
Normal file
1506
third_party/aom/av1/common/arm/selfguided_neon.c
vendored
Normal file
File diff suppressed because it is too large
Load diff
38
third_party/aom/av1/common/arm/transpose_neon.h
vendored
38
third_party/aom/av1/common/arm/transpose_neon.h
vendored
|
|
@ -419,4 +419,42 @@ static INLINE void transpose_s16_4x4d(int16x4_t *a0, int16x4_t *a1,
|
|||
*a3 = vreinterpret_s16_s32(c1.val[1]);
|
||||
}
|
||||
|
||||
static INLINE int32x4x2_t aom_vtrnq_s64_to_s32(int32x4_t a0, int32x4_t a1) {
|
||||
int32x4x2_t b0;
|
||||
b0.val[0] = vcombine_s32(vget_low_s32(a0), vget_low_s32(a1));
|
||||
b0.val[1] = vcombine_s32(vget_high_s32(a0), vget_high_s32(a1));
|
||||
return b0;
|
||||
}
|
||||
|
||||
static INLINE void transpose_s32_4x4(int32x4_t *a0, int32x4_t *a1,
|
||||
int32x4_t *a2, int32x4_t *a3) {
|
||||
// Swap 32 bit elements. Goes from:
|
||||
// a0: 00 01 02 03
|
||||
// a1: 10 11 12 13
|
||||
// a2: 20 21 22 23
|
||||
// a3: 30 31 32 33
|
||||
// to:
|
||||
// b0.val[0]: 00 10 02 12
|
||||
// b0.val[1]: 01 11 03 13
|
||||
// b1.val[0]: 20 30 22 32
|
||||
// b1.val[1]: 21 31 23 33
|
||||
|
||||
const int32x4x2_t b0 = vtrnq_s32(*a0, *a1);
|
||||
const int32x4x2_t b1 = vtrnq_s32(*a2, *a3);
|
||||
|
||||
// Swap 64 bit elements resulting in:
|
||||
// c0.val[0]: 00 10 20 30
|
||||
// c0.val[1]: 02 12 22 32
|
||||
// c1.val[0]: 01 11 21 31
|
||||
// c1.val[1]: 03 13 23 33
|
||||
|
||||
const int32x4x2_t c0 = aom_vtrnq_s64_to_s32(b0.val[0], b1.val[0]);
|
||||
const int32x4x2_t c1 = aom_vtrnq_s64_to_s32(b0.val[1], b1.val[1]);
|
||||
|
||||
*a0 = c0.val[0];
|
||||
*a1 = c1.val[0];
|
||||
*a2 = c0.val[1];
|
||||
*a3 = c1.val[1];
|
||||
}
|
||||
|
||||
#endif // AV1_COMMON_ARM_TRANSPOSE_NEON_H_
|
||||
|
|
|
|||
51
third_party/aom/av1/common/av1_loopfilter.c
vendored
51
third_party/aom/av1/common/av1_loopfilter.c
vendored
|
|
@ -1308,7 +1308,7 @@ static int compare_ref_dst(AV1_COMMON *const cm, uint8_t *ref_buf,
|
|||
end <<= MI_SIZE_LOG2;
|
||||
uint8_t *ref0 = ref_buf;
|
||||
uint8_t *dst0 = dst_buf;
|
||||
if (cm->use_highbitdepth) {
|
||||
if (cm->seq_params.use_highbitdepth) {
|
||||
const uint16_t *ref16 = CONVERT_TO_SHORTPTR(ref_buf);
|
||||
const uint16_t *dst16 = CONVERT_TO_SHORTPTR(dst_buf);
|
||||
for (int j = 0; j < 4; ++j) {
|
||||
|
|
@ -1404,11 +1404,11 @@ void av1_filter_block_plane_ver(AV1_COMMON *const cm,
|
|||
uint64_t mask_8x8_1 = (mask_8x8 >> shift_next) & mask_cutoff;
|
||||
uint64_t mask_4x4_1 = (mask_4x4 >> shift_next) & mask_cutoff;
|
||||
|
||||
if (cm->use_highbitdepth)
|
||||
if (cm->seq_params.use_highbitdepth)
|
||||
highbd_filter_selectively_vert_row2(
|
||||
ssx, CONVERT_TO_SHORTPTR(dst->buf), dst->stride, pl, mask_16x16_0,
|
||||
mask_8x8_0, mask_4x4_0, mask_16x16_1, mask_8x8_1, mask_4x4_1,
|
||||
&cm->lf_info, lfl, lfl2, (int)cm->bit_depth);
|
||||
&cm->lf_info, lfl, lfl2, (int)cm->seq_params.bit_depth);
|
||||
else
|
||||
filter_selectively_vert_row2(ssx, dst->buf, dst->stride, pl,
|
||||
mask_16x16_0, mask_8x8_0, mask_4x4_0,
|
||||
|
|
@ -1474,10 +1474,11 @@ void av1_filter_block_plane_hor(AV1_COMMON *const cm,
|
|||
mask_8x8 = (mask_8x8 >> shift) & mask_cutoff;
|
||||
mask_4x4 = (mask_4x4 >> shift) & mask_cutoff;
|
||||
|
||||
if (cm->use_highbitdepth)
|
||||
highbd_filter_selectively_horiz(
|
||||
CONVERT_TO_SHORTPTR(dst->buf), dst->stride, pl, ssx, mask_16x16,
|
||||
mask_8x8, mask_4x4, &cm->lf_info, lfl, (int)cm->bit_depth);
|
||||
if (cm->seq_params.use_highbitdepth)
|
||||
highbd_filter_selectively_horiz(CONVERT_TO_SHORTPTR(dst->buf),
|
||||
dst->stride, pl, ssx, mask_16x16,
|
||||
mask_8x8, mask_4x4, &cm->lf_info, lfl,
|
||||
(int)cm->seq_params.bit_depth);
|
||||
else
|
||||
filter_selectively_horiz(dst->buf, dst->stride, pl, ssx, mask_16x16,
|
||||
mask_8x8, mask_4x4, &cm->lf_info, lfl);
|
||||
|
|
@ -1652,6 +1653,8 @@ void av1_filter_block_plane_vert(const AV1_COMMON *const cm,
|
|||
const int dst_stride = plane_ptr->dst.stride;
|
||||
const int y_range = (MAX_MIB_SIZE >> scale_vert);
|
||||
const int x_range = (MAX_MIB_SIZE >> scale_horz);
|
||||
const int use_highbitdepth = cm->seq_params.use_highbitdepth;
|
||||
const aom_bit_depth_t bit_depth = cm->seq_params.bit_depth;
|
||||
for (int y = 0; y < y_range; y += row_step) {
|
||||
uint8_t *p = dst_ptr + y * MI_SIZE * dst_stride;
|
||||
for (int x = 0; x < x_range;) {
|
||||
|
|
@ -1677,40 +1680,40 @@ void av1_filter_block_plane_vert(const AV1_COMMON *const cm,
|
|||
switch (params.filter_length) {
|
||||
// apply 4-tap filtering
|
||||
case 4:
|
||||
if (cm->use_highbitdepth)
|
||||
if (use_highbitdepth)
|
||||
aom_highbd_lpf_vertical_4(CONVERT_TO_SHORTPTR(p), dst_stride,
|
||||
params.mblim, params.lim, params.hev_thr,
|
||||
cm->bit_depth);
|
||||
bit_depth);
|
||||
else
|
||||
aom_lpf_vertical_4(p, dst_stride, params.mblim, params.lim,
|
||||
params.hev_thr);
|
||||
break;
|
||||
case 6: // apply 6-tap filter for chroma plane only
|
||||
assert(plane != 0);
|
||||
if (cm->use_highbitdepth)
|
||||
if (use_highbitdepth)
|
||||
aom_highbd_lpf_vertical_6(CONVERT_TO_SHORTPTR(p), dst_stride,
|
||||
params.mblim, params.lim, params.hev_thr,
|
||||
cm->bit_depth);
|
||||
bit_depth);
|
||||
else
|
||||
aom_lpf_vertical_6(p, dst_stride, params.mblim, params.lim,
|
||||
params.hev_thr);
|
||||
break;
|
||||
// apply 8-tap filtering
|
||||
case 8:
|
||||
if (cm->use_highbitdepth)
|
||||
if (use_highbitdepth)
|
||||
aom_highbd_lpf_vertical_8(CONVERT_TO_SHORTPTR(p), dst_stride,
|
||||
params.mblim, params.lim, params.hev_thr,
|
||||
cm->bit_depth);
|
||||
bit_depth);
|
||||
else
|
||||
aom_lpf_vertical_8(p, dst_stride, params.mblim, params.lim,
|
||||
params.hev_thr);
|
||||
break;
|
||||
// apply 14-tap filtering
|
||||
case 14:
|
||||
if (cm->use_highbitdepth)
|
||||
if (use_highbitdepth)
|
||||
aom_highbd_lpf_vertical_14(CONVERT_TO_SHORTPTR(p), dst_stride,
|
||||
params.mblim, params.lim, params.hev_thr,
|
||||
cm->bit_depth);
|
||||
bit_depth);
|
||||
else
|
||||
aom_lpf_vertical_14(p, dst_stride, params.mblim, params.lim,
|
||||
params.hev_thr);
|
||||
|
|
@ -1737,6 +1740,8 @@ void av1_filter_block_plane_horz(const AV1_COMMON *const cm,
|
|||
const int dst_stride = plane_ptr->dst.stride;
|
||||
const int y_range = (MAX_MIB_SIZE >> scale_vert);
|
||||
const int x_range = (MAX_MIB_SIZE >> scale_horz);
|
||||
const int use_highbitdepth = cm->seq_params.use_highbitdepth;
|
||||
const aom_bit_depth_t bit_depth = cm->seq_params.bit_depth;
|
||||
for (int x = 0; x < x_range; x += col_step) {
|
||||
uint8_t *p = dst_ptr + x * MI_SIZE;
|
||||
for (int y = 0; y < y_range;) {
|
||||
|
|
@ -1762,10 +1767,10 @@ void av1_filter_block_plane_horz(const AV1_COMMON *const cm,
|
|||
switch (params.filter_length) {
|
||||
// apply 4-tap filtering
|
||||
case 4:
|
||||
if (cm->use_highbitdepth)
|
||||
if (use_highbitdepth)
|
||||
aom_highbd_lpf_horizontal_4(CONVERT_TO_SHORTPTR(p), dst_stride,
|
||||
params.mblim, params.lim,
|
||||
params.hev_thr, cm->bit_depth);
|
||||
params.hev_thr, bit_depth);
|
||||
else
|
||||
aom_lpf_horizontal_4(p, dst_stride, params.mblim, params.lim,
|
||||
params.hev_thr);
|
||||
|
|
@ -1773,30 +1778,30 @@ void av1_filter_block_plane_horz(const AV1_COMMON *const cm,
|
|||
// apply 6-tap filtering
|
||||
case 6:
|
||||
assert(plane != 0);
|
||||
if (cm->use_highbitdepth)
|
||||
if (use_highbitdepth)
|
||||
aom_highbd_lpf_horizontal_6(CONVERT_TO_SHORTPTR(p), dst_stride,
|
||||
params.mblim, params.lim,
|
||||
params.hev_thr, cm->bit_depth);
|
||||
params.hev_thr, bit_depth);
|
||||
else
|
||||
aom_lpf_horizontal_6(p, dst_stride, params.mblim, params.lim,
|
||||
params.hev_thr);
|
||||
break;
|
||||
// apply 8-tap filtering
|
||||
case 8:
|
||||
if (cm->use_highbitdepth)
|
||||
if (use_highbitdepth)
|
||||
aom_highbd_lpf_horizontal_8(CONVERT_TO_SHORTPTR(p), dst_stride,
|
||||
params.mblim, params.lim,
|
||||
params.hev_thr, cm->bit_depth);
|
||||
params.hev_thr, bit_depth);
|
||||
else
|
||||
aom_lpf_horizontal_8(p, dst_stride, params.mblim, params.lim,
|
||||
params.hev_thr);
|
||||
break;
|
||||
// apply 14-tap filtering
|
||||
case 14:
|
||||
if (cm->use_highbitdepth)
|
||||
if (use_highbitdepth)
|
||||
aom_highbd_lpf_horizontal_14(CONVERT_TO_SHORTPTR(p), dst_stride,
|
||||
params.mblim, params.lim,
|
||||
params.hev_thr, cm->bit_depth);
|
||||
params.hev_thr, bit_depth);
|
||||
else
|
||||
aom_lpf_horizontal_14(p, dst_stride, params.mblim, params.lim,
|
||||
params.hev_thr);
|
||||
|
|
|
|||
6
third_party/aom/av1/common/av1_rtcd.c
vendored
6
third_party/aom/av1/common/av1_rtcd.c
vendored
|
|
@ -16,7 +16,7 @@
|
|||
#include "aom_ports/aom_once.h"
|
||||
|
||||
void av1_rtcd() {
|
||||
// TODO(JBB): Remove this once, by insuring that both the encoder and
|
||||
// decoder setup functions are protected by once();
|
||||
once(setup_rtcd_internal);
|
||||
// TODO(JBB): Remove this aom_once, by insuring that both the encoder and
|
||||
// decoder setup functions are protected by aom_once();
|
||||
aom_once(setup_rtcd_internal);
|
||||
}
|
||||
|
|
|
|||
50
third_party/aom/av1/common/av1_rtcd_defs.pl
vendored
50
third_party/aom/av1/common/av1_rtcd_defs.pl
vendored
|
|
@ -106,7 +106,7 @@ specialize qw/av1_highbd_convolve8_vert/, "$sse2_x86_64";
|
|||
|
||||
#inv txfm
|
||||
add_proto qw/void av1_inv_txfm_add/, "const tran_low_t *dqcoeff, uint8_t *dst, int stride, const TxfmParam *txfm_param";
|
||||
specialize qw/av1_inv_txfm_add ssse3 avx2/;
|
||||
specialize qw/av1_inv_txfm_add ssse3 avx2 neon/;
|
||||
|
||||
add_proto qw/void av1_highbd_iwht4x4_1_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int bd";
|
||||
add_proto qw/void av1_highbd_iwht4x4_16_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int bd";
|
||||
|
|
@ -181,7 +181,7 @@ if (aom_config("CONFIG_AV1_ENCODER") eq "yes") {
|
|||
|
||||
#fwd txfm
|
||||
add_proto qw/void av1_lowbd_fwd_txfm/, "const int16_t *src_diff, tran_low_t *coeff, int diff_stride, TxfmParam *txfm_param";
|
||||
specialize qw/av1_lowbd_fwd_txfm sse2 sse4_1/;
|
||||
specialize qw/av1_lowbd_fwd_txfm sse2 sse4_1 avx2/;
|
||||
|
||||
add_proto qw/void av1_fwd_txfm2d_4x8/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd";
|
||||
add_proto qw/void av1_fwd_txfm2d_8x4/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd";
|
||||
|
|
@ -241,11 +241,11 @@ if (aom_config("CONFIG_AV1_ENCODER") eq "yes") {
|
|||
specialize qw/av1_txb_init_levels sse4_1/;
|
||||
|
||||
add_proto qw/uint64_t av1_wedge_sse_from_residuals/, "const int16_t *r1, const int16_t *d, const uint8_t *m, int N";
|
||||
specialize qw/av1_wedge_sse_from_residuals sse2/;
|
||||
specialize qw/av1_wedge_sse_from_residuals sse2 avx2/;
|
||||
add_proto qw/int av1_wedge_sign_from_residuals/, "const int16_t *ds, const uint8_t *m, int N, int64_t limit";
|
||||
specialize qw/av1_wedge_sign_from_residuals sse2/;
|
||||
specialize qw/av1_wedge_sign_from_residuals sse2 avx2/;
|
||||
add_proto qw/void av1_wedge_compute_delta_squares/, "int16_t *d, const int16_t *a, const int16_t *b, int N";
|
||||
specialize qw/av1_wedge_compute_delta_squares sse2/;
|
||||
specialize qw/av1_wedge_compute_delta_squares sse2 avx2/;
|
||||
|
||||
# hash
|
||||
add_proto qw/uint32_t av1_get_crc32c_value/, "void *crc_calculator, uint8_t *p, int length";
|
||||
|
|
@ -288,34 +288,34 @@ if (aom_config("CONFIG_AV1_ENCODER") eq "yes") {
|
|||
# LOOP_RESTORATION functions
|
||||
|
||||
add_proto qw/void apply_selfguided_restoration/, "const uint8_t *dat, int width, int height, int stride, int eps, const int *xqd, uint8_t *dst, int dst_stride, int32_t *tmpbuf, int bit_depth, int highbd";
|
||||
specialize qw/apply_selfguided_restoration sse4_1 avx2/;
|
||||
specialize qw/apply_selfguided_restoration sse4_1 avx2 neon/;
|
||||
|
||||
add_proto qw/void av1_selfguided_restoration/, "const uint8_t *dgd8, int width, int height,
|
||||
int dgd_stride, int32_t *flt0, int32_t *flt1, int flt_stride,
|
||||
int sgr_params_idx, int bit_depth, int highbd";
|
||||
specialize qw/av1_selfguided_restoration sse4_1 avx2/;
|
||||
specialize qw/av1_selfguided_restoration sse4_1 avx2 neon/;
|
||||
|
||||
# CONVOLVE_ROUND/COMPOUND_ROUND functions
|
||||
|
||||
add_proto qw/void av1_convolve_2d_sr/, "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, InterpFilterParams *filter_params_x, InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params";
|
||||
add_proto qw/void av1_convolve_2d_copy_sr/, "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, InterpFilterParams *filter_params_x, InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params";
|
||||
add_proto qw/void av1_convolve_x_sr/, "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, InterpFilterParams *filter_params_x, InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params";
|
||||
add_proto qw/void av1_convolve_y_sr/, "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, InterpFilterParams *filter_params_x, InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params";
|
||||
add_proto qw/void av1_jnt_convolve_2d/, "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, InterpFilterParams *filter_params_x, InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params";
|
||||
add_proto qw/void av1_jnt_convolve_2d_copy/, "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, InterpFilterParams *filter_params_x, InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params";
|
||||
add_proto qw/void av1_jnt_convolve_x/, "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, InterpFilterParams *filter_params_x, InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params";
|
||||
add_proto qw/void av1_jnt_convolve_y/, "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, InterpFilterParams *filter_params_x, InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params";
|
||||
add_proto qw/void av1_highbd_convolve_2d_copy_sr/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, InterpFilterParams *filter_params_x, InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params, int bd";
|
||||
add_proto qw/void av1_highbd_convolve_2d_sr/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, InterpFilterParams *filter_params_x, InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params, int bd";
|
||||
add_proto qw/void av1_highbd_convolve_x_sr/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, InterpFilterParams *filter_params_x, InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params, int bd";
|
||||
add_proto qw/void av1_highbd_convolve_y_sr/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, InterpFilterParams *filter_params_x, InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params, int bd";
|
||||
add_proto qw/void av1_highbd_jnt_convolve_2d/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, InterpFilterParams *filter_params_x, InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params, int bd";
|
||||
add_proto qw/void av1_highbd_jnt_convolve_x/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, InterpFilterParams *filter_params_x, InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params, int bd";
|
||||
add_proto qw/void av1_highbd_jnt_convolve_y/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, InterpFilterParams *filter_params_x, InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params, int bd";
|
||||
add_proto qw/void av1_highbd_jnt_convolve_2d_copy/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, InterpFilterParams *filter_params_x, InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params, int bd";
|
||||
add_proto qw/void av1_convolve_2d_sr/, "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params";
|
||||
add_proto qw/void av1_convolve_2d_copy_sr/, "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params";
|
||||
add_proto qw/void av1_convolve_x_sr/, "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params";
|
||||
add_proto qw/void av1_convolve_y_sr/, "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params";
|
||||
add_proto qw/void av1_jnt_convolve_2d/, "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params";
|
||||
add_proto qw/void av1_jnt_convolve_2d_copy/, "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params";
|
||||
add_proto qw/void av1_jnt_convolve_x/, "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params";
|
||||
add_proto qw/void av1_jnt_convolve_y/, "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params";
|
||||
add_proto qw/void av1_highbd_convolve_2d_copy_sr/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params, int bd";
|
||||
add_proto qw/void av1_highbd_convolve_2d_sr/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params, int bd";
|
||||
add_proto qw/void av1_highbd_convolve_x_sr/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params, int bd";
|
||||
add_proto qw/void av1_highbd_convolve_y_sr/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params, int bd";
|
||||
add_proto qw/void av1_highbd_jnt_convolve_2d/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params, int bd";
|
||||
add_proto qw/void av1_highbd_jnt_convolve_x/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params, int bd";
|
||||
add_proto qw/void av1_highbd_jnt_convolve_y/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params, int bd";
|
||||
add_proto qw/void av1_highbd_jnt_convolve_2d_copy/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params, int bd";
|
||||
|
||||
add_proto qw/void av1_convolve_2d_scale/, "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, InterpFilterParams *filter_params_x, InterpFilterParams *filter_params_y, const int subpel_x_qn, const int x_step_qn, const int subpel_y_q4, const int y_step_qn, ConvolveParams *conv_params";
|
||||
add_proto qw/void av1_highbd_convolve_2d_scale/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, InterpFilterParams *filter_params_x, InterpFilterParams *filter_params_y, const int subpel_x_q4, const int x_step_qn, const int subpel_y_q4, const int y_step_qn, ConvolveParams *conv_params, int bd";
|
||||
add_proto qw/void av1_convolve_2d_scale/, "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_qn, const int x_step_qn, const int subpel_y_q4, const int y_step_qn, ConvolveParams *conv_params";
|
||||
add_proto qw/void av1_highbd_convolve_2d_scale/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_q4, const int x_step_qn, const int subpel_y_q4, const int y_step_qn, ConvolveParams *conv_params, int bd";
|
||||
|
||||
specialize qw/av1_convolve_2d_sr sse2 avx2 neon/;
|
||||
specialize qw/av1_convolve_2d_copy_sr sse2 avx2 neon/;
|
||||
|
|
|
|||
47
third_party/aom/av1/common/av1_txfm.h
vendored
47
third_party/aom/av1/common/av1_txfm.h
vendored
|
|
@ -171,53 +171,6 @@ static INLINE void set_flip_cfg(TX_TYPE tx_type, TXFM_2D_FLIP_CFG *cfg) {
|
|||
get_flip_cfg(tx_type, &cfg->ud_flip, &cfg->lr_flip);
|
||||
}
|
||||
|
||||
static INLINE TX_SIZE av1_rotate_tx_size(TX_SIZE tx_size) {
|
||||
switch (tx_size) {
|
||||
case TX_4X4: return TX_4X4;
|
||||
case TX_8X8: return TX_8X8;
|
||||
case TX_16X16: return TX_16X16;
|
||||
case TX_32X32: return TX_32X32;
|
||||
case TX_64X64: return TX_64X64;
|
||||
case TX_32X64: return TX_64X32;
|
||||
case TX_64X32: return TX_32X64;
|
||||
case TX_4X8: return TX_8X4;
|
||||
case TX_8X4: return TX_4X8;
|
||||
case TX_8X16: return TX_16X8;
|
||||
case TX_16X8: return TX_8X16;
|
||||
case TX_16X32: return TX_32X16;
|
||||
case TX_32X16: return TX_16X32;
|
||||
case TX_4X16: return TX_16X4;
|
||||
case TX_16X4: return TX_4X16;
|
||||
case TX_8X32: return TX_32X8;
|
||||
case TX_32X8: return TX_8X32;
|
||||
case TX_16X64: return TX_64X16;
|
||||
case TX_64X16: return TX_16X64;
|
||||
default: assert(0); return TX_INVALID;
|
||||
}
|
||||
}
|
||||
|
||||
static INLINE TX_TYPE av1_rotate_tx_type(TX_TYPE tx_type) {
|
||||
switch (tx_type) {
|
||||
case DCT_DCT: return DCT_DCT;
|
||||
case ADST_DCT: return DCT_ADST;
|
||||
case DCT_ADST: return ADST_DCT;
|
||||
case ADST_ADST: return ADST_ADST;
|
||||
case FLIPADST_DCT: return DCT_FLIPADST;
|
||||
case DCT_FLIPADST: return FLIPADST_DCT;
|
||||
case FLIPADST_FLIPADST: return FLIPADST_FLIPADST;
|
||||
case ADST_FLIPADST: return FLIPADST_ADST;
|
||||
case FLIPADST_ADST: return ADST_FLIPADST;
|
||||
case IDTX: return IDTX;
|
||||
case V_DCT: return H_DCT;
|
||||
case H_DCT: return V_DCT;
|
||||
case V_ADST: return H_ADST;
|
||||
case H_ADST: return V_ADST;
|
||||
case V_FLIPADST: return H_FLIPADST;
|
||||
case H_FLIPADST: return V_FLIPADST;
|
||||
default: assert(0); return TX_TYPES;
|
||||
}
|
||||
}
|
||||
|
||||
// Utility function that returns the log of the ratio of the col and row
|
||||
// sizes.
|
||||
static INLINE int get_rect_tx_log_ratio(int col, int row) {
|
||||
|
|
|
|||
47
third_party/aom/av1/common/blockd.h
vendored
47
third_party/aom/av1/common/blockd.h
vendored
|
|
@ -605,6 +605,12 @@ static INLINE int get_bitdepth_data_path_index(const MACROBLOCKD *xd) {
|
|||
return xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH ? 1 : 0;
|
||||
}
|
||||
|
||||
static INLINE uint8_t *get_buf_by_bd(const MACROBLOCKD *xd, uint8_t *buf16) {
|
||||
return (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH)
|
||||
? CONVERT_TO_BYTEPTR(buf16)
|
||||
: buf16;
|
||||
}
|
||||
|
||||
static INLINE int get_sqr_bsize_idx(BLOCK_SIZE bsize) {
|
||||
switch (bsize) {
|
||||
case BLOCK_4X4: return 0;
|
||||
|
|
@ -674,6 +680,15 @@ static const int av1_ext_tx_used[EXT_TX_SET_TYPES][TX_TYPES] = {
|
|||
{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
|
||||
};
|
||||
|
||||
static const uint16_t av1_ext_tx_used_flag[EXT_TX_SET_TYPES] = {
|
||||
0x0001, // 0000 0000 0000 0001
|
||||
0x0201, // 0000 0010 0000 0001
|
||||
0x020F, // 0000 0010 0000 1111
|
||||
0x0E0F, // 0000 1110 0000 1111
|
||||
0x0FFF, // 0000 1111 1111 1111
|
||||
0xFFFF, // 1111 1111 1111 1111
|
||||
};
|
||||
|
||||
static INLINE TxSetType av1_get_ext_tx_set_type(TX_SIZE tx_size, int is_inter,
|
||||
int use_reduced_set) {
|
||||
const TX_SIZE tx_size_sqr_up = txsize_sqr_up_map[tx_size];
|
||||
|
|
@ -1145,38 +1160,6 @@ static INLINE PLANE_TYPE get_plane_type(int plane) {
|
|||
return (plane == 0) ? PLANE_TYPE_Y : PLANE_TYPE_UV;
|
||||
}
|
||||
|
||||
static INLINE void transpose_uint8(uint8_t *dst, int dst_stride,
|
||||
const uint8_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];
|
||||
}
|
||||
|
||||
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];
|
||||
}
|
||||
|
||||
static INLINE void transpose_int16(int16_t *dst, int dst_stride,
|
||||
const int16_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];
|
||||
}
|
||||
|
||||
static INLINE void transpose_int32(int32_t *dst, int dst_stride,
|
||||
const int32_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];
|
||||
}
|
||||
|
||||
static INLINE int av1_get_max_eob(TX_SIZE tx_size) {
|
||||
if (tx_size == TX_64X64 || tx_size == TX_64X32 || tx_size == TX_32X64) {
|
||||
return 1024;
|
||||
|
|
|
|||
6
third_party/aom/av1/common/cdef.c
vendored
6
third_party/aom/av1/common/cdef.c
vendored
|
|
@ -110,7 +110,7 @@ void copy_rect8_16bit_to_16bit_c(uint16_t *dst, int dstride,
|
|||
static void copy_sb8_16(AOM_UNUSED AV1_COMMON *cm, uint16_t *dst, int dstride,
|
||||
const uint8_t *src, int src_voffset, int src_hoffset,
|
||||
int sstride, int vsize, int hsize) {
|
||||
if (cm->use_highbitdepth) {
|
||||
if (cm->seq_params.use_highbitdepth) {
|
||||
const uint16_t *base =
|
||||
&CONVERT_TO_SHORTPTR(src)[src_voffset * sstride + src_hoffset];
|
||||
copy_rect8_16bit_to_16bit(dst, dstride, base, sstride, vsize, hsize);
|
||||
|
|
@ -153,7 +153,7 @@ void av1_cdef_frame(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm,
|
|||
int mi_high_l2[3];
|
||||
int xdec[3];
|
||||
int ydec[3];
|
||||
int coeff_shift = AOMMAX(cm->bit_depth - 8, 0);
|
||||
int coeff_shift = AOMMAX(cm->seq_params.bit_depth - 8, 0);
|
||||
const int nvfb = (cm->mi_rows + MI_SIZE_64X64 - 1) / MI_SIZE_64X64;
|
||||
const int nhfb = (cm->mi_cols + MI_SIZE_64X64 - 1) / MI_SIZE_64X64;
|
||||
av1_setup_dst_planes(xd->plane, cm->seq_params.sb_size, frame, 0, 0, 0,
|
||||
|
|
@ -363,7 +363,7 @@ void av1_cdef_frame(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm,
|
|||
vsize + 2 * CDEF_VBORDER, CDEF_HBORDER, CDEF_VERY_LARGE);
|
||||
}
|
||||
|
||||
if (cm->use_highbitdepth) {
|
||||
if (cm->seq_params.use_highbitdepth) {
|
||||
cdef_filter_fb(
|
||||
NULL,
|
||||
&CONVERT_TO_SHORTPTR(
|
||||
|
|
|
|||
15
third_party/aom/av1/common/cfl.c
vendored
15
third_party/aom/av1/common/cfl.c
vendored
|
|
@ -15,21 +15,14 @@
|
|||
|
||||
#include "config/av1_rtcd.h"
|
||||
|
||||
void cfl_init(CFL_CTX *cfl, AV1_COMMON *cm) {
|
||||
void cfl_init(CFL_CTX *cfl, const SequenceHeader *seq_params) {
|
||||
assert(block_size_wide[CFL_MAX_BLOCK_SIZE] == CFL_BUF_LINE);
|
||||
assert(block_size_high[CFL_MAX_BLOCK_SIZE] == CFL_BUF_LINE);
|
||||
if (!(cm->subsampling_x == 0 && cm->subsampling_y == 0) &&
|
||||
!(cm->subsampling_x == 1 && cm->subsampling_y == 1) &&
|
||||
!(cm->subsampling_x == 1 && cm->subsampling_y == 0)) {
|
||||
aom_internal_error(&cm->error, AOM_CODEC_UNSUP_BITSTREAM,
|
||||
"Only 4:4:4, 4:2:2 and 4:2:0 are currently supported by "
|
||||
"CfL, %d %d subsampling is not supported.\n",
|
||||
cm->subsampling_x, cm->subsampling_y);
|
||||
}
|
||||
|
||||
memset(&cfl->recon_buf_q3, 0, sizeof(cfl->recon_buf_q3));
|
||||
memset(&cfl->ac_buf_q3, 0, sizeof(cfl->ac_buf_q3));
|
||||
cfl->subsampling_x = cm->subsampling_x;
|
||||
cfl->subsampling_y = cm->subsampling_y;
|
||||
cfl->subsampling_x = seq_params->subsampling_x;
|
||||
cfl->subsampling_y = seq_params->subsampling_y;
|
||||
cfl->are_parameters_computed = 0;
|
||||
cfl->store_y = 0;
|
||||
// The DC_PRED cache is disabled by default and is only enabled in
|
||||
|
|
|
|||
154
third_party/aom/av1/common/convolve.c
vendored
154
third_party/aom/av1/common/convolve.c
vendored
|
|
@ -75,8 +75,8 @@ void av1_highbd_convolve_horiz_rs_c(const uint16_t *src, int src_stride,
|
|||
|
||||
void av1_convolve_2d_sr_c(const uint8_t *src, int src_stride, uint8_t *dst,
|
||||
int dst_stride, int w, int h,
|
||||
InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y,
|
||||
const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y,
|
||||
const int subpel_x_q4, const int subpel_y_q4,
|
||||
ConvolveParams *conv_params) {
|
||||
int16_t im_block[(MAX_SB_SIZE + MAX_FILTER_TAP - 1) * MAX_SB_SIZE];
|
||||
|
|
@ -91,7 +91,7 @@ void av1_convolve_2d_sr_c(const uint8_t *src, int src_stride, uint8_t *dst,
|
|||
// horizontal filter
|
||||
const uint8_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);
|
||||
filter_params_x, subpel_x_q4 & SUBPEL_MASK);
|
||||
for (int y = 0; y < im_h; ++y) {
|
||||
for (int x = 0; x < w; ++x) {
|
||||
int32_t sum = (1 << (bd + FILTER_BITS - 1));
|
||||
|
|
@ -107,7 +107,7 @@ void av1_convolve_2d_sr_c(const uint8_t *src, int src_stride, uint8_t *dst,
|
|||
// vertical filter
|
||||
int16_t *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);
|
||||
filter_params_y, subpel_y_q4 & SUBPEL_MASK);
|
||||
const int offset_bits = bd + 2 * FILTER_BITS - conv_params->round_0;
|
||||
for (int y = 0; y < h; ++y) {
|
||||
for (int x = 0; x < w; ++x) {
|
||||
|
|
@ -126,8 +126,8 @@ void av1_convolve_2d_sr_c(const uint8_t *src, int src_stride, uint8_t *dst,
|
|||
|
||||
void av1_convolve_y_sr_c(const uint8_t *src, int src_stride, uint8_t *dst,
|
||||
int dst_stride, int w, int h,
|
||||
InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y,
|
||||
const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y,
|
||||
const int subpel_x_q4, const int subpel_y_q4,
|
||||
ConvolveParams *conv_params) {
|
||||
const int fo_vert = filter_params_y->taps / 2 - 1;
|
||||
|
|
@ -141,7 +141,7 @@ void av1_convolve_y_sr_c(const uint8_t *src, int src_stride, uint8_t *dst,
|
|||
|
||||
// vertical filter
|
||||
const int16_t *y_filter = av1_get_interp_filter_subpel_kernel(
|
||||
*filter_params_y, subpel_y_q4 & SUBPEL_MASK);
|
||||
filter_params_y, subpel_y_q4 & SUBPEL_MASK);
|
||||
for (int y = 0; y < h; ++y) {
|
||||
for (int x = 0; x < w; ++x) {
|
||||
int32_t res = 0;
|
||||
|
|
@ -156,8 +156,8 @@ void av1_convolve_y_sr_c(const uint8_t *src, int src_stride, uint8_t *dst,
|
|||
|
||||
void av1_convolve_x_sr_c(const uint8_t *src, int src_stride, uint8_t *dst,
|
||||
int dst_stride, int w, int h,
|
||||
InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y,
|
||||
const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y,
|
||||
const int subpel_x_q4, const int subpel_y_q4,
|
||||
ConvolveParams *conv_params) {
|
||||
const int fo_horiz = filter_params_x->taps / 2 - 1;
|
||||
|
|
@ -172,7 +172,7 @@ void av1_convolve_x_sr_c(const uint8_t *src, int src_stride, uint8_t *dst,
|
|||
|
||||
// horizontal filter
|
||||
const int16_t *x_filter = av1_get_interp_filter_subpel_kernel(
|
||||
*filter_params_x, subpel_x_q4 & SUBPEL_MASK);
|
||||
filter_params_x, subpel_x_q4 & SUBPEL_MASK);
|
||||
for (int y = 0; y < h; ++y) {
|
||||
for (int x = 0; x < w; ++x) {
|
||||
int32_t res = 0;
|
||||
|
|
@ -187,8 +187,8 @@ void av1_convolve_x_sr_c(const uint8_t *src, int src_stride, uint8_t *dst,
|
|||
|
||||
void av1_convolve_2d_copy_sr_c(const uint8_t *src, int src_stride, uint8_t *dst,
|
||||
int dst_stride, int w, int h,
|
||||
InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y,
|
||||
const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y,
|
||||
const int subpel_x_q4, const int subpel_y_q4,
|
||||
ConvolveParams *conv_params) {
|
||||
(void)filter_params_x;
|
||||
|
|
@ -204,8 +204,8 @@ void av1_convolve_2d_copy_sr_c(const uint8_t *src, int src_stride, uint8_t *dst,
|
|||
|
||||
void av1_jnt_convolve_2d_c(const uint8_t *src, int src_stride, uint8_t *dst8,
|
||||
int dst8_stride, int w, int h,
|
||||
InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y,
|
||||
const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y,
|
||||
const int subpel_x_q4, const int subpel_y_q4,
|
||||
ConvolveParams *conv_params) {
|
||||
CONV_BUF_TYPE *dst = conv_params->dst;
|
||||
|
|
@ -222,7 +222,7 @@ void av1_jnt_convolve_2d_c(const uint8_t *src, int src_stride, uint8_t *dst8,
|
|||
// horizontal filter
|
||||
const uint8_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);
|
||||
filter_params_x, subpel_x_q4 & SUBPEL_MASK);
|
||||
for (int y = 0; y < im_h; ++y) {
|
||||
for (int x = 0; x < w; ++x) {
|
||||
int32_t sum = (1 << (bd + FILTER_BITS - 1));
|
||||
|
|
@ -238,7 +238,7 @@ void av1_jnt_convolve_2d_c(const uint8_t *src, int src_stride, uint8_t *dst8,
|
|||
// vertical filter
|
||||
int16_t *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);
|
||||
filter_params_y, subpel_y_q4 & SUBPEL_MASK);
|
||||
const int offset_bits = bd + 2 * FILTER_BITS - conv_params->round_0;
|
||||
for (int y = 0; y < h; ++y) {
|
||||
for (int x = 0; x < w; ++x) {
|
||||
|
|
@ -270,8 +270,8 @@ void av1_jnt_convolve_2d_c(const uint8_t *src, int src_stride, uint8_t *dst8,
|
|||
|
||||
void av1_jnt_convolve_y_c(const uint8_t *src, int src_stride, uint8_t *dst8,
|
||||
int dst8_stride, int w, int h,
|
||||
InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y,
|
||||
const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y,
|
||||
const int subpel_x_q4, const int subpel_y_q4,
|
||||
ConvolveParams *conv_params) {
|
||||
CONV_BUF_TYPE *dst = conv_params->dst;
|
||||
|
|
@ -289,7 +289,7 @@ void av1_jnt_convolve_y_c(const uint8_t *src, int src_stride, uint8_t *dst8,
|
|||
|
||||
// vertical filter
|
||||
const int16_t *y_filter = av1_get_interp_filter_subpel_kernel(
|
||||
*filter_params_y, subpel_y_q4 & SUBPEL_MASK);
|
||||
filter_params_y, subpel_y_q4 & SUBPEL_MASK);
|
||||
for (int y = 0; y < h; ++y) {
|
||||
for (int x = 0; x < w; ++x) {
|
||||
int32_t res = 0;
|
||||
|
|
@ -320,8 +320,8 @@ void av1_jnt_convolve_y_c(const uint8_t *src, int src_stride, uint8_t *dst8,
|
|||
|
||||
void av1_jnt_convolve_x_c(const uint8_t *src, int src_stride, uint8_t *dst8,
|
||||
int dst8_stride, int w, int h,
|
||||
InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y,
|
||||
const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y,
|
||||
const int subpel_x_q4, const int subpel_y_q4,
|
||||
ConvolveParams *conv_params) {
|
||||
CONV_BUF_TYPE *dst = conv_params->dst;
|
||||
|
|
@ -339,7 +339,7 @@ void av1_jnt_convolve_x_c(const uint8_t *src, int src_stride, uint8_t *dst8,
|
|||
|
||||
// horizontal filter
|
||||
const int16_t *x_filter = av1_get_interp_filter_subpel_kernel(
|
||||
*filter_params_x, subpel_x_q4 & SUBPEL_MASK);
|
||||
filter_params_x, subpel_x_q4 & SUBPEL_MASK);
|
||||
for (int y = 0; y < h; ++y) {
|
||||
for (int x = 0; x < w; ++x) {
|
||||
int32_t res = 0;
|
||||
|
|
@ -370,8 +370,8 @@ void av1_jnt_convolve_x_c(const uint8_t *src, int src_stride, uint8_t *dst8,
|
|||
|
||||
void av1_jnt_convolve_2d_copy_c(const uint8_t *src, int src_stride,
|
||||
uint8_t *dst8, int dst8_stride, int w, int h,
|
||||
InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y,
|
||||
const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y,
|
||||
const int subpel_x_q4, const int subpel_y_q4,
|
||||
ConvolveParams *conv_params) {
|
||||
CONV_BUF_TYPE *dst = conv_params->dst;
|
||||
|
|
@ -412,8 +412,8 @@ void av1_jnt_convolve_2d_copy_c(const uint8_t *src, int src_stride,
|
|||
|
||||
void av1_convolve_2d_scale_c(const uint8_t *src, int src_stride, uint8_t *dst8,
|
||||
int dst8_stride, int w, int h,
|
||||
InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y,
|
||||
const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y,
|
||||
const int subpel_x_qn, const int x_step_qn,
|
||||
const int subpel_y_qn, const int y_step_qn,
|
||||
ConvolveParams *conv_params) {
|
||||
|
|
@ -439,7 +439,7 @@ void av1_convolve_2d_scale_c(const uint8_t *src, int src_stride, uint8_t *dst8,
|
|||
const int x_filter_idx = (x_qn & SCALE_SUBPEL_MASK) >> SCALE_EXTRA_BITS;
|
||||
assert(x_filter_idx < SUBPEL_SHIFTS);
|
||||
const int16_t *x_filter =
|
||||
av1_get_interp_filter_subpel_kernel(*filter_params_x, x_filter_idx);
|
||||
av1_get_interp_filter_subpel_kernel(filter_params_x, x_filter_idx);
|
||||
int32_t sum = (1 << (bd + FILTER_BITS - 1));
|
||||
for (int k = 0; k < filter_params_x->taps; ++k) {
|
||||
sum += x_filter[k] * src_x[k - fo_horiz];
|
||||
|
|
@ -461,7 +461,7 @@ void av1_convolve_2d_scale_c(const uint8_t *src, int src_stride, uint8_t *dst8,
|
|||
const int y_filter_idx = (y_qn & SCALE_SUBPEL_MASK) >> SCALE_EXTRA_BITS;
|
||||
assert(y_filter_idx < SUBPEL_SHIFTS);
|
||||
const int16_t *y_filter =
|
||||
av1_get_interp_filter_subpel_kernel(*filter_params_y, y_filter_idx);
|
||||
av1_get_interp_filter_subpel_kernel(filter_params_y, y_filter_idx);
|
||||
int32_t sum = 1 << offset_bits;
|
||||
for (int k = 0; k < filter_params_y->taps; ++k) {
|
||||
sum += y_filter[k] * src_y[(k - fo_vert) * im_stride];
|
||||
|
|
@ -498,8 +498,8 @@ void av1_convolve_2d_scale_c(const uint8_t *src, int src_stride, uint8_t *dst8,
|
|||
|
||||
static void convolve_2d_scale_wrapper(
|
||||
const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w,
|
||||
int h, InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y, const int subpel_x_qn,
|
||||
int h, const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y, const int subpel_x_qn,
|
||||
const int x_step_qn, const int subpel_y_qn, const int y_step_qn,
|
||||
ConvolveParams *conv_params) {
|
||||
if (conv_params->is_compound) {
|
||||
|
|
@ -520,25 +520,27 @@ void av1_convolve_2d_facade(const uint8_t *src, int src_stride, uint8_t *dst,
|
|||
(void)y_step_q4;
|
||||
(void)dst;
|
||||
(void)dst_stride;
|
||||
|
||||
InterpFilterParams filter_params_x, filter_params_y;
|
||||
av1_get_convolve_filter_params(interp_filters, &filter_params_x,
|
||||
&filter_params_y, w, h);
|
||||
InterpFilter filter_x = av1_extract_interp_filter(interp_filters, 1);
|
||||
InterpFilter filter_y = av1_extract_interp_filter(interp_filters, 0);
|
||||
const InterpFilterParams *filter_params_x =
|
||||
av1_get_interp_filter_params_with_block_size(filter_x, w);
|
||||
const InterpFilterParams *filter_params_y =
|
||||
av1_get_interp_filter_params_with_block_size(filter_y, h);
|
||||
|
||||
if (scaled)
|
||||
convolve_2d_scale_wrapper(src, src_stride, dst, dst_stride, w, h,
|
||||
&filter_params_x, &filter_params_y, subpel_x_q4,
|
||||
filter_params_x, filter_params_y, subpel_x_q4,
|
||||
x_step_q4, subpel_y_q4, y_step_q4, conv_params);
|
||||
else
|
||||
sf->convolve[subpel_x_q4 != 0][subpel_y_q4 != 0][conv_params->is_compound](
|
||||
src, src_stride, dst, dst_stride, w, h, &filter_params_x,
|
||||
&filter_params_y, subpel_x_q4, subpel_y_q4, conv_params);
|
||||
src, src_stride, dst, dst_stride, w, h, filter_params_x,
|
||||
filter_params_y, subpel_x_q4, subpel_y_q4, conv_params);
|
||||
}
|
||||
|
||||
void av1_highbd_convolve_2d_copy_sr_c(
|
||||
const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w,
|
||||
int h, InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y, const int subpel_x_q4,
|
||||
int h, const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y, const int subpel_x_q4,
|
||||
const int subpel_y_q4, ConvolveParams *conv_params, int bd) {
|
||||
(void)filter_params_x;
|
||||
(void)filter_params_y;
|
||||
|
|
@ -554,8 +556,8 @@ void av1_highbd_convolve_2d_copy_sr_c(
|
|||
|
||||
void av1_highbd_convolve_x_sr_c(const uint16_t *src, int src_stride,
|
||||
uint16_t *dst, int dst_stride, int w, int h,
|
||||
InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y,
|
||||
const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y,
|
||||
const int subpel_x_q4, const int subpel_y_q4,
|
||||
ConvolveParams *conv_params, int bd) {
|
||||
const int fo_horiz = filter_params_x->taps / 2 - 1;
|
||||
|
|
@ -569,7 +571,7 @@ void av1_highbd_convolve_x_sr_c(const uint16_t *src, int src_stride,
|
|||
|
||||
// horizontal filter
|
||||
const int16_t *x_filter = av1_get_interp_filter_subpel_kernel(
|
||||
*filter_params_x, subpel_x_q4 & SUBPEL_MASK);
|
||||
filter_params_x, subpel_x_q4 & SUBPEL_MASK);
|
||||
for (int y = 0; y < h; ++y) {
|
||||
for (int x = 0; x < w; ++x) {
|
||||
int32_t res = 0;
|
||||
|
|
@ -585,8 +587,8 @@ void av1_highbd_convolve_x_sr_c(const uint16_t *src, int src_stride,
|
|||
|
||||
void av1_highbd_convolve_y_sr_c(const uint16_t *src, int src_stride,
|
||||
uint16_t *dst, int dst_stride, int w, int h,
|
||||
InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y,
|
||||
const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y,
|
||||
const int subpel_x_q4, const int subpel_y_q4,
|
||||
ConvolveParams *conv_params, int bd) {
|
||||
const int fo_vert = filter_params_y->taps / 2 - 1;
|
||||
|
|
@ -599,7 +601,7 @@ void av1_highbd_convolve_y_sr_c(const uint16_t *src, int src_stride,
|
|||
((conv_params->round_0 + conv_params->round_1) == (2 * FILTER_BITS)));
|
||||
// vertical filter
|
||||
const int16_t *y_filter = av1_get_interp_filter_subpel_kernel(
|
||||
*filter_params_y, subpel_y_q4 & SUBPEL_MASK);
|
||||
filter_params_y, subpel_y_q4 & SUBPEL_MASK);
|
||||
for (int y = 0; y < h; ++y) {
|
||||
for (int x = 0; x < w; ++x) {
|
||||
int32_t res = 0;
|
||||
|
|
@ -614,8 +616,8 @@ void av1_highbd_convolve_y_sr_c(const uint16_t *src, int src_stride,
|
|||
|
||||
void av1_highbd_convolve_2d_sr_c(const uint16_t *src, int src_stride,
|
||||
uint16_t *dst, int dst_stride, int w, int h,
|
||||
InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y,
|
||||
const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y,
|
||||
const int subpel_x_q4, const int subpel_y_q4,
|
||||
ConvolveParams *conv_params, int bd) {
|
||||
int16_t im_block[(MAX_SB_SIZE + MAX_FILTER_TAP - 1) * MAX_SB_SIZE];
|
||||
|
|
@ -630,7 +632,7 @@ void av1_highbd_convolve_2d_sr_c(const uint16_t *src, int src_stride,
|
|||
// 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);
|
||||
filter_params_x, subpel_x_q4 & SUBPEL_MASK);
|
||||
for (int y = 0; y < im_h; ++y) {
|
||||
for (int x = 0; x < w; ++x) {
|
||||
int32_t sum = (1 << (bd + FILTER_BITS - 1));
|
||||
|
|
@ -646,7 +648,7 @@ void av1_highbd_convolve_2d_sr_c(const uint16_t *src, int src_stride,
|
|||
// vertical filter
|
||||
int16_t *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);
|
||||
filter_params_y, subpel_y_q4 & SUBPEL_MASK);
|
||||
const int offset_bits = bd + 2 * FILTER_BITS - conv_params->round_0;
|
||||
for (int y = 0; y < h; ++y) {
|
||||
for (int x = 0; x < w; ++x) {
|
||||
|
|
@ -666,8 +668,9 @@ void av1_highbd_convolve_2d_sr_c(const uint16_t *src, int src_stride,
|
|||
|
||||
void av1_highbd_jnt_convolve_2d_c(const uint16_t *src, int src_stride,
|
||||
uint16_t *dst16, int dst16_stride, int w,
|
||||
int h, InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y,
|
||||
int h,
|
||||
const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y,
|
||||
const int subpel_x_q4, const int subpel_y_q4,
|
||||
ConvolveParams *conv_params, int bd) {
|
||||
int x, y, k;
|
||||
|
|
@ -685,7 +688,7 @@ void av1_highbd_jnt_convolve_2d_c(const uint16_t *src, int src_stride,
|
|||
// 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);
|
||||
filter_params_x, subpel_x_q4 & SUBPEL_MASK);
|
||||
for (y = 0; y < im_h; ++y) {
|
||||
for (x = 0; x < w; ++x) {
|
||||
int32_t sum = (1 << (bd + FILTER_BITS - 1));
|
||||
|
|
@ -703,7 +706,7 @@ void av1_highbd_jnt_convolve_2d_c(const uint16_t *src, int src_stride,
|
|||
int16_t *src_vert = im_block + fo_vert * im_stride;
|
||||
const int offset_bits = bd + 2 * FILTER_BITS - conv_params->round_0;
|
||||
const int16_t *y_filter = av1_get_interp_filter_subpel_kernel(
|
||||
*filter_params_y, subpel_y_q4 & SUBPEL_MASK);
|
||||
filter_params_y, subpel_y_q4 & SUBPEL_MASK);
|
||||
for (y = 0; y < h; ++y) {
|
||||
for (x = 0; x < w; ++x) {
|
||||
int32_t sum = 1 << offset_bits;
|
||||
|
|
@ -734,8 +737,9 @@ void av1_highbd_jnt_convolve_2d_c(const uint16_t *src, int src_stride,
|
|||
|
||||
void av1_highbd_jnt_convolve_x_c(const uint16_t *src, int src_stride,
|
||||
uint16_t *dst16, int dst16_stride, int w,
|
||||
int h, InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y,
|
||||
int h,
|
||||
const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y,
|
||||
const int subpel_x_q4, const int subpel_y_q4,
|
||||
ConvolveParams *conv_params, int bd) {
|
||||
CONV_BUF_TYPE *dst = conv_params->dst;
|
||||
|
|
@ -753,7 +757,7 @@ void av1_highbd_jnt_convolve_x_c(const uint16_t *src, int src_stride,
|
|||
assert(bits >= 0);
|
||||
// horizontal filter
|
||||
const int16_t *x_filter = av1_get_interp_filter_subpel_kernel(
|
||||
*filter_params_x, subpel_x_q4 & SUBPEL_MASK);
|
||||
filter_params_x, subpel_x_q4 & SUBPEL_MASK);
|
||||
for (int y = 0; y < h; ++y) {
|
||||
for (int x = 0; x < w; ++x) {
|
||||
int32_t res = 0;
|
||||
|
|
@ -784,8 +788,9 @@ void av1_highbd_jnt_convolve_x_c(const uint16_t *src, int src_stride,
|
|||
|
||||
void av1_highbd_jnt_convolve_y_c(const uint16_t *src, int src_stride,
|
||||
uint16_t *dst16, int dst16_stride, int w,
|
||||
int h, InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y,
|
||||
int h,
|
||||
const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y,
|
||||
const int subpel_x_q4, const int subpel_y_q4,
|
||||
ConvolveParams *conv_params, int bd) {
|
||||
CONV_BUF_TYPE *dst = conv_params->dst;
|
||||
|
|
@ -803,7 +808,7 @@ void av1_highbd_jnt_convolve_y_c(const uint16_t *src, int src_stride,
|
|||
assert(bits >= 0);
|
||||
// vertical filter
|
||||
const int16_t *y_filter = av1_get_interp_filter_subpel_kernel(
|
||||
*filter_params_y, subpel_y_q4 & SUBPEL_MASK);
|
||||
filter_params_y, subpel_y_q4 & SUBPEL_MASK);
|
||||
for (int y = 0; y < h; ++y) {
|
||||
for (int x = 0; x < w; ++x) {
|
||||
int32_t res = 0;
|
||||
|
|
@ -834,8 +839,8 @@ void av1_highbd_jnt_convolve_y_c(const uint16_t *src, int src_stride,
|
|||
|
||||
void av1_highbd_jnt_convolve_2d_copy_c(
|
||||
const uint16_t *src, int src_stride, uint16_t *dst16, int dst16_stride,
|
||||
int w, int h, InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y, const int subpel_x_q4,
|
||||
int w, int h, const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y, const int subpel_x_q4,
|
||||
const int subpel_y_q4, ConvolveParams *conv_params, int bd) {
|
||||
CONV_BUF_TYPE *dst = conv_params->dst;
|
||||
int dst_stride = conv_params->dst_stride;
|
||||
|
|
@ -875,8 +880,8 @@ void av1_highbd_jnt_convolve_2d_copy_c(
|
|||
|
||||
void av1_highbd_convolve_2d_scale_c(const uint16_t *src, int src_stride,
|
||||
uint16_t *dst, int dst_stride, int w, int h,
|
||||
InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y,
|
||||
const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y,
|
||||
const int subpel_x_qn, const int x_step_qn,
|
||||
const int subpel_y_qn, const int y_step_qn,
|
||||
ConvolveParams *conv_params, int bd) {
|
||||
|
|
@ -900,7 +905,7 @@ void av1_highbd_convolve_2d_scale_c(const uint16_t *src, int src_stride,
|
|||
const int x_filter_idx = (x_qn & SCALE_SUBPEL_MASK) >> SCALE_EXTRA_BITS;
|
||||
assert(x_filter_idx < SUBPEL_SHIFTS);
|
||||
const int16_t *x_filter =
|
||||
av1_get_interp_filter_subpel_kernel(*filter_params_x, x_filter_idx);
|
||||
av1_get_interp_filter_subpel_kernel(filter_params_x, x_filter_idx);
|
||||
int32_t sum = (1 << (bd + FILTER_BITS - 1));
|
||||
for (int k = 0; k < filter_params_x->taps; ++k) {
|
||||
sum += x_filter[k] * src_x[k - fo_horiz];
|
||||
|
|
@ -922,7 +927,7 @@ void av1_highbd_convolve_2d_scale_c(const uint16_t *src, int src_stride,
|
|||
const int y_filter_idx = (y_qn & SCALE_SUBPEL_MASK) >> SCALE_EXTRA_BITS;
|
||||
assert(y_filter_idx < SUBPEL_SHIFTS);
|
||||
const int16_t *y_filter =
|
||||
av1_get_interp_filter_subpel_kernel(*filter_params_y, y_filter_idx);
|
||||
av1_get_interp_filter_subpel_kernel(filter_params_y, y_filter_idx);
|
||||
int32_t sum = 1 << offset_bits;
|
||||
for (int k = 0; k < filter_params_y->taps; ++k) {
|
||||
sum += y_filter[k] * src_y[(k - fo_vert) * im_stride];
|
||||
|
|
@ -971,9 +976,12 @@ void av1_highbd_convolve_2d_facade(const uint8_t *src8, int src_stride,
|
|||
(void)dst_stride;
|
||||
|
||||
const uint16_t *src = CONVERT_TO_SHORTPTR(src8);
|
||||
InterpFilterParams filter_params_x, filter_params_y;
|
||||
av1_get_convolve_filter_params(interp_filters, &filter_params_x,
|
||||
&filter_params_y, w, h);
|
||||
InterpFilter filter_x = av1_extract_interp_filter(interp_filters, 1);
|
||||
InterpFilter filter_y = av1_extract_interp_filter(interp_filters, 0);
|
||||
const InterpFilterParams *filter_params_x =
|
||||
av1_get_interp_filter_params_with_block_size(filter_x, w);
|
||||
const InterpFilterParams *filter_params_y =
|
||||
av1_get_interp_filter_params_with_block_size(filter_y, h);
|
||||
|
||||
if (scaled) {
|
||||
uint16_t *dst = CONVERT_TO_SHORTPTR(dst8);
|
||||
|
|
@ -981,16 +989,16 @@ void av1_highbd_convolve_2d_facade(const uint8_t *src8, int src_stride,
|
|||
assert(conv_params->dst != NULL);
|
||||
}
|
||||
av1_highbd_convolve_2d_scale(src, src_stride, dst, dst_stride, w, h,
|
||||
&filter_params_x, &filter_params_y,
|
||||
subpel_x_q4, x_step_q4, subpel_y_q4, y_step_q4,
|
||||
conv_params, bd);
|
||||
filter_params_x, filter_params_y, subpel_x_q4,
|
||||
x_step_q4, subpel_y_q4, y_step_q4, conv_params,
|
||||
bd);
|
||||
} else {
|
||||
uint16_t *dst = CONVERT_TO_SHORTPTR(dst8);
|
||||
|
||||
sf->highbd_convolve[subpel_x_q4 != 0][subpel_y_q4 !=
|
||||
0][conv_params->is_compound](
|
||||
src, src_stride, dst, dst_stride, w, h, &filter_params_x,
|
||||
&filter_params_y, subpel_x_q4, subpel_y_q4, conv_params, bd);
|
||||
src, src_stride, dst, dst_stride, w, h, filter_params_x,
|
||||
filter_params_y, subpel_x_q4, subpel_y_q4, conv_params, bd);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
18
third_party/aom/av1/common/convolve.h
vendored
18
third_party/aom/av1/common/convolve.h
vendored
|
|
@ -40,27 +40,17 @@ typedef struct ConvolveParams {
|
|||
|
||||
typedef void (*aom_convolve_fn_t)(const uint8_t *src, int src_stride,
|
||||
uint8_t *dst, int dst_stride, int w, int h,
|
||||
InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y,
|
||||
const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y,
|
||||
const int subpel_x_q4, const int subpel_y_q4,
|
||||
ConvolveParams *conv_params);
|
||||
|
||||
typedef void (*aom_highbd_convolve_fn_t)(
|
||||
const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w,
|
||||
int h, InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y, const int subpel_x_q4,
|
||||
int h, const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y, const int subpel_x_q4,
|
||||
const int subpel_y_q4, ConvolveParams *conv_params, int bd);
|
||||
|
||||
static INLINE void av1_get_convolve_filter_params(InterpFilters interp_filters,
|
||||
InterpFilterParams *params_x,
|
||||
InterpFilterParams *params_y,
|
||||
int w, int h) {
|
||||
InterpFilter filter_x = av1_extract_interp_filter(interp_filters, 1);
|
||||
InterpFilter filter_y = av1_extract_interp_filter(interp_filters, 0);
|
||||
*params_x = av1_get_interp_filter_params_with_block_size(filter_x, w);
|
||||
*params_y = av1_get_interp_filter_params_with_block_size(filter_y, h);
|
||||
}
|
||||
|
||||
struct AV1Common;
|
||||
struct scale_factors;
|
||||
|
||||
|
|
|
|||
2
third_party/aom/av1/common/enums.h
vendored
2
third_party/aom/av1/common/enums.h
vendored
|
|
@ -557,6 +557,7 @@ typedef uint8_t TXFM_CONTEXT;
|
|||
#define BWDREF_FRAME 5
|
||||
#define ALTREF2_FRAME 6
|
||||
#define ALTREF_FRAME 7
|
||||
#define EXTREF_FRAME REF_FRAMES
|
||||
#define LAST_REF_FRAMES (LAST3_FRAME - LAST_FRAME + 1)
|
||||
|
||||
#define INTER_REFS_PER_FRAME (ALTREF_FRAME - LAST_FRAME + 1)
|
||||
|
|
@ -607,6 +608,7 @@ typedef enum ATTRIBUTE_PACKED {
|
|||
|
||||
// In large_scale_tile coding, external references are used.
|
||||
#define MAX_EXTERNAL_REFERENCES 128
|
||||
#define MAX_TILES 512
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
|
|
|
|||
120
third_party/aom/av1/common/filter.c
vendored
120
third_party/aom/av1/common/filter.c
vendored
|
|
@ -1,120 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, Alliance for Open Media. All rights reserved
|
||||
*
|
||||
* This source code is subject to the terms of the BSD 2 Clause License and
|
||||
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
|
||||
* was not distributed with this source code in the LICENSE file, you can
|
||||
* obtain it at www.aomedia.org/license/software. If the Alliance for Open
|
||||
* Media Patent License 1.0 was not distributed with this source code in the
|
||||
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "av1/common/filter.h"
|
||||
|
||||
DECLARE_ALIGNED(256, static const InterpKernel,
|
||||
bilinear_filters[SUBPEL_SHIFTS]) = {
|
||||
{ 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 0, 0, 120, 8, 0, 0, 0 },
|
||||
{ 0, 0, 0, 112, 16, 0, 0, 0 }, { 0, 0, 0, 104, 24, 0, 0, 0 },
|
||||
{ 0, 0, 0, 96, 32, 0, 0, 0 }, { 0, 0, 0, 88, 40, 0, 0, 0 },
|
||||
{ 0, 0, 0, 80, 48, 0, 0, 0 }, { 0, 0, 0, 72, 56, 0, 0, 0 },
|
||||
{ 0, 0, 0, 64, 64, 0, 0, 0 }, { 0, 0, 0, 56, 72, 0, 0, 0 },
|
||||
{ 0, 0, 0, 48, 80, 0, 0, 0 }, { 0, 0, 0, 40, 88, 0, 0, 0 },
|
||||
{ 0, 0, 0, 32, 96, 0, 0, 0 }, { 0, 0, 0, 24, 104, 0, 0, 0 },
|
||||
{ 0, 0, 0, 16, 112, 0, 0, 0 }, { 0, 0, 0, 8, 120, 0, 0, 0 }
|
||||
};
|
||||
|
||||
DECLARE_ALIGNED(256, static const InterpKernel,
|
||||
sub_pel_filters_8[SUBPEL_SHIFTS]) = {
|
||||
{ 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 2, -6, 126, 8, -2, 0, 0 },
|
||||
{ 0, 2, -10, 122, 18, -4, 0, 0 }, { 0, 2, -12, 116, 28, -8, 2, 0 },
|
||||
{ 0, 2, -14, 110, 38, -10, 2, 0 }, { 0, 2, -14, 102, 48, -12, 2, 0 },
|
||||
{ 0, 2, -16, 94, 58, -12, 2, 0 }, { 0, 2, -14, 84, 66, -12, 2, 0 },
|
||||
{ 0, 2, -14, 76, 76, -14, 2, 0 }, { 0, 2, -12, 66, 84, -14, 2, 0 },
|
||||
{ 0, 2, -12, 58, 94, -16, 2, 0 }, { 0, 2, -12, 48, 102, -14, 2, 0 },
|
||||
{ 0, 2, -10, 38, 110, -14, 2, 0 }, { 0, 2, -8, 28, 116, -12, 2, 0 },
|
||||
{ 0, 0, -4, 18, 122, -10, 2, 0 }, { 0, 0, -2, 8, 126, -6, 2, 0 }
|
||||
};
|
||||
|
||||
DECLARE_ALIGNED(256, static const InterpKernel,
|
||||
sub_pel_filters_8sharp[SUBPEL_SHIFTS]) = {
|
||||
{ 0, 0, 0, 128, 0, 0, 0, 0 }, { -2, 2, -6, 126, 8, -2, 2, 0 },
|
||||
{ -2, 6, -12, 124, 16, -6, 4, -2 }, { -2, 8, -18, 120, 26, -10, 6, -2 },
|
||||
{ -4, 10, -22, 116, 38, -14, 6, -2 }, { -4, 10, -22, 108, 48, -18, 8, -2 },
|
||||
{ -4, 10, -24, 100, 60, -20, 8, -2 }, { -4, 10, -24, 90, 70, -22, 10, -2 },
|
||||
{ -4, 12, -24, 80, 80, -24, 12, -4 }, { -2, 10, -22, 70, 90, -24, 10, -4 },
|
||||
{ -2, 8, -20, 60, 100, -24, 10, -4 }, { -2, 8, -18, 48, 108, -22, 10, -4 },
|
||||
{ -2, 6, -14, 38, 116, -22, 10, -4 }, { -2, 6, -10, 26, 120, -18, 8, -2 },
|
||||
{ -2, 4, -6, 16, 124, -12, 6, -2 }, { 0, 2, -2, 8, 126, -6, 2, -2 }
|
||||
};
|
||||
|
||||
DECLARE_ALIGNED(256, static const InterpKernel,
|
||||
sub_pel_filters_8smooth[SUBPEL_SHIFTS]) = {
|
||||
{ 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 2, 28, 62, 34, 2, 0, 0 },
|
||||
{ 0, 0, 26, 62, 36, 4, 0, 0 }, { 0, 0, 22, 62, 40, 4, 0, 0 },
|
||||
{ 0, 0, 20, 60, 42, 6, 0, 0 }, { 0, 0, 18, 58, 44, 8, 0, 0 },
|
||||
{ 0, 0, 16, 56, 46, 10, 0, 0 }, { 0, -2, 16, 54, 48, 12, 0, 0 },
|
||||
{ 0, -2, 14, 52, 52, 14, -2, 0 }, { 0, 0, 12, 48, 54, 16, -2, 0 },
|
||||
{ 0, 0, 10, 46, 56, 16, 0, 0 }, { 0, 0, 8, 44, 58, 18, 0, 0 },
|
||||
{ 0, 0, 6, 42, 60, 20, 0, 0 }, { 0, 0, 4, 40, 62, 22, 0, 0 },
|
||||
{ 0, 0, 4, 36, 62, 26, 0, 0 }, { 0, 0, 2, 34, 62, 28, 2, 0 }
|
||||
};
|
||||
|
||||
static const InterpFilterParams
|
||||
av1_interp_filter_params_list[SWITCHABLE_FILTERS + 1] = {
|
||||
{ (const int16_t *)sub_pel_filters_8, SUBPEL_TAPS, SUBPEL_SHIFTS,
|
||||
EIGHTTAP_REGULAR },
|
||||
{ (const int16_t *)sub_pel_filters_8smooth, SUBPEL_TAPS, SUBPEL_SHIFTS,
|
||||
EIGHTTAP_SMOOTH },
|
||||
{ (const int16_t *)sub_pel_filters_8sharp, SUBPEL_TAPS, SUBPEL_SHIFTS,
|
||||
MULTITAP_SHARP },
|
||||
{ (const int16_t *)bilinear_filters, SUBPEL_TAPS, SUBPEL_SHIFTS,
|
||||
BILINEAR }
|
||||
};
|
||||
|
||||
DECLARE_ALIGNED(256, static const InterpKernel,
|
||||
sub_pel_filters_4[SUBPEL_SHIFTS]) = {
|
||||
{ 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 0, -4, 126, 8, -2, 0, 0 },
|
||||
{ 0, 0, -8, 122, 18, -4, 0, 0 }, { 0, 0, -10, 116, 28, -6, 0, 0 },
|
||||
{ 0, 0, -12, 110, 38, -8, 0, 0 }, { 0, 0, -12, 102, 48, -10, 0, 0 },
|
||||
{ 0, 0, -14, 94, 58, -10, 0, 0 }, { 0, 0, -12, 84, 66, -10, 0, 0 },
|
||||
{ 0, 0, -12, 76, 76, -12, 0, 0 }, { 0, 0, -10, 66, 84, -12, 0, 0 },
|
||||
{ 0, 0, -10, 58, 94, -14, 0, 0 }, { 0, 0, -10, 48, 102, -12, 0, 0 },
|
||||
{ 0, 0, -8, 38, 110, -12, 0, 0 }, { 0, 0, -6, 28, 116, -10, 0, 0 },
|
||||
{ 0, 0, -4, 18, 122, -8, 0, 0 }, { 0, 0, -2, 8, 126, -4, 0, 0 }
|
||||
};
|
||||
DECLARE_ALIGNED(256, static const InterpKernel,
|
||||
sub_pel_filters_4smooth[SUBPEL_SHIFTS]) = {
|
||||
{ 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 0, 30, 62, 34, 2, 0, 0 },
|
||||
{ 0, 0, 26, 62, 36, 4, 0, 0 }, { 0, 0, 22, 62, 40, 4, 0, 0 },
|
||||
{ 0, 0, 20, 60, 42, 6, 0, 0 }, { 0, 0, 18, 58, 44, 8, 0, 0 },
|
||||
{ 0, 0, 16, 56, 46, 10, 0, 0 }, { 0, 0, 14, 54, 48, 12, 0, 0 },
|
||||
{ 0, 0, 12, 52, 52, 12, 0, 0 }, { 0, 0, 12, 48, 54, 14, 0, 0 },
|
||||
{ 0, 0, 10, 46, 56, 16, 0, 0 }, { 0, 0, 8, 44, 58, 18, 0, 0 },
|
||||
{ 0, 0, 6, 42, 60, 20, 0, 0 }, { 0, 0, 4, 40, 62, 22, 0, 0 },
|
||||
{ 0, 0, 4, 36, 62, 26, 0, 0 }, { 0, 0, 2, 34, 62, 30, 0, 0 }
|
||||
};
|
||||
|
||||
static const InterpFilterParams av1_interp_4tap[2] = {
|
||||
{ (const int16_t *)sub_pel_filters_4, SUBPEL_TAPS, SUBPEL_SHIFTS,
|
||||
EIGHTTAP_REGULAR },
|
||||
{ (const int16_t *)sub_pel_filters_4smooth, SUBPEL_TAPS, SUBPEL_SHIFTS,
|
||||
EIGHTTAP_SMOOTH },
|
||||
};
|
||||
|
||||
InterpFilterParams av1_get_interp_filter_params_with_block_size(
|
||||
const InterpFilter interp_filter, const int w) {
|
||||
if (w <= 4 &&
|
||||
(interp_filter == MULTITAP_SHARP || interp_filter == EIGHTTAP_REGULAR))
|
||||
return av1_interp_4tap[0];
|
||||
else if (w <= 4 && interp_filter == EIGHTTAP_SMOOTH)
|
||||
return av1_interp_4tap[1];
|
||||
|
||||
return av1_interp_filter_params_list[interp_filter];
|
||||
}
|
||||
|
||||
const int16_t *av1_get_interp_filter_kernel(const InterpFilter interp_filter) {
|
||||
return (const int16_t *)av1_interp_filter_params_list[interp_filter]
|
||||
.filter_ptr;
|
||||
}
|
||||
116
third_party/aom/av1/common/filter.h
vendored
116
third_party/aom/av1/common/filter.h
vendored
|
|
@ -64,8 +64,8 @@ static INLINE InterpFilter av1_unswitchable_filter(InterpFilter filter) {
|
|||
return filter == SWITCHABLE ? EIGHTTAP_REGULAR : filter;
|
||||
}
|
||||
|
||||
#define LOG_SWITCHABLE_FILTERS \
|
||||
2 /* (1 << LOG_SWITCHABLE_FILTERS) > SWITCHABLE_FILTERS */
|
||||
/* (1 << LOG_SWITCHABLE_FILTERS) > SWITCHABLE_FILTERS */
|
||||
#define LOG_SWITCHABLE_FILTERS 2
|
||||
|
||||
#define MAX_SUBPEL_TAPS 12
|
||||
#define SWITCHABLE_FILTER_CONTEXTS ((SWITCHABLE_FILTERS + 1) * 4)
|
||||
|
|
@ -79,14 +79,116 @@ typedef struct InterpFilterParams {
|
|||
InterpFilter interp_filter;
|
||||
} InterpFilterParams;
|
||||
|
||||
const int16_t *av1_get_interp_filter_kernel(const InterpFilter interp_filter);
|
||||
DECLARE_ALIGNED(256, static const InterpKernel,
|
||||
av1_bilinear_filters[SUBPEL_SHIFTS]) = {
|
||||
{ 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 0, 0, 120, 8, 0, 0, 0 },
|
||||
{ 0, 0, 0, 112, 16, 0, 0, 0 }, { 0, 0, 0, 104, 24, 0, 0, 0 },
|
||||
{ 0, 0, 0, 96, 32, 0, 0, 0 }, { 0, 0, 0, 88, 40, 0, 0, 0 },
|
||||
{ 0, 0, 0, 80, 48, 0, 0, 0 }, { 0, 0, 0, 72, 56, 0, 0, 0 },
|
||||
{ 0, 0, 0, 64, 64, 0, 0, 0 }, { 0, 0, 0, 56, 72, 0, 0, 0 },
|
||||
{ 0, 0, 0, 48, 80, 0, 0, 0 }, { 0, 0, 0, 40, 88, 0, 0, 0 },
|
||||
{ 0, 0, 0, 32, 96, 0, 0, 0 }, { 0, 0, 0, 24, 104, 0, 0, 0 },
|
||||
{ 0, 0, 0, 16, 112, 0, 0, 0 }, { 0, 0, 0, 8, 120, 0, 0, 0 }
|
||||
};
|
||||
|
||||
InterpFilterParams av1_get_interp_filter_params_with_block_size(
|
||||
const InterpFilter interp_filter, const int w);
|
||||
DECLARE_ALIGNED(256, static const InterpKernel,
|
||||
av1_sub_pel_filters_8[SUBPEL_SHIFTS]) = {
|
||||
{ 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 2, -6, 126, 8, -2, 0, 0 },
|
||||
{ 0, 2, -10, 122, 18, -4, 0, 0 }, { 0, 2, -12, 116, 28, -8, 2, 0 },
|
||||
{ 0, 2, -14, 110, 38, -10, 2, 0 }, { 0, 2, -14, 102, 48, -12, 2, 0 },
|
||||
{ 0, 2, -16, 94, 58, -12, 2, 0 }, { 0, 2, -14, 84, 66, -12, 2, 0 },
|
||||
{ 0, 2, -14, 76, 76, -14, 2, 0 }, { 0, 2, -12, 66, 84, -14, 2, 0 },
|
||||
{ 0, 2, -12, 58, 94, -16, 2, 0 }, { 0, 2, -12, 48, 102, -14, 2, 0 },
|
||||
{ 0, 2, -10, 38, 110, -14, 2, 0 }, { 0, 2, -8, 28, 116, -12, 2, 0 },
|
||||
{ 0, 0, -4, 18, 122, -10, 2, 0 }, { 0, 0, -2, 8, 126, -6, 2, 0 }
|
||||
};
|
||||
|
||||
DECLARE_ALIGNED(256, static const InterpKernel,
|
||||
av1_sub_pel_filters_8sharp[SUBPEL_SHIFTS]) = {
|
||||
{ 0, 0, 0, 128, 0, 0, 0, 0 }, { -2, 2, -6, 126, 8, -2, 2, 0 },
|
||||
{ -2, 6, -12, 124, 16, -6, 4, -2 }, { -2, 8, -18, 120, 26, -10, 6, -2 },
|
||||
{ -4, 10, -22, 116, 38, -14, 6, -2 }, { -4, 10, -22, 108, 48, -18, 8, -2 },
|
||||
{ -4, 10, -24, 100, 60, -20, 8, -2 }, { -4, 10, -24, 90, 70, -22, 10, -2 },
|
||||
{ -4, 12, -24, 80, 80, -24, 12, -4 }, { -2, 10, -22, 70, 90, -24, 10, -4 },
|
||||
{ -2, 8, -20, 60, 100, -24, 10, -4 }, { -2, 8, -18, 48, 108, -22, 10, -4 },
|
||||
{ -2, 6, -14, 38, 116, -22, 10, -4 }, { -2, 6, -10, 26, 120, -18, 8, -2 },
|
||||
{ -2, 4, -6, 16, 124, -12, 6, -2 }, { 0, 2, -2, 8, 126, -6, 2, -2 }
|
||||
};
|
||||
|
||||
DECLARE_ALIGNED(256, static const InterpKernel,
|
||||
av1_sub_pel_filters_8smooth[SUBPEL_SHIFTS]) = {
|
||||
{ 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 2, 28, 62, 34, 2, 0, 0 },
|
||||
{ 0, 0, 26, 62, 36, 4, 0, 0 }, { 0, 0, 22, 62, 40, 4, 0, 0 },
|
||||
{ 0, 0, 20, 60, 42, 6, 0, 0 }, { 0, 0, 18, 58, 44, 8, 0, 0 },
|
||||
{ 0, 0, 16, 56, 46, 10, 0, 0 }, { 0, -2, 16, 54, 48, 12, 0, 0 },
|
||||
{ 0, -2, 14, 52, 52, 14, -2, 0 }, { 0, 0, 12, 48, 54, 16, -2, 0 },
|
||||
{ 0, 0, 10, 46, 56, 16, 0, 0 }, { 0, 0, 8, 44, 58, 18, 0, 0 },
|
||||
{ 0, 0, 6, 42, 60, 20, 0, 0 }, { 0, 0, 4, 40, 62, 22, 0, 0 },
|
||||
{ 0, 0, 4, 36, 62, 26, 0, 0 }, { 0, 0, 2, 34, 62, 28, 2, 0 }
|
||||
};
|
||||
|
||||
static const InterpFilterParams
|
||||
av1_interp_filter_params_list[SWITCHABLE_FILTERS + 1] = {
|
||||
{ (const int16_t *)av1_sub_pel_filters_8, SUBPEL_TAPS, SUBPEL_SHIFTS,
|
||||
EIGHTTAP_REGULAR },
|
||||
{ (const int16_t *)av1_sub_pel_filters_8smooth, SUBPEL_TAPS,
|
||||
SUBPEL_SHIFTS, EIGHTTAP_SMOOTH },
|
||||
{ (const int16_t *)av1_sub_pel_filters_8sharp, SUBPEL_TAPS, SUBPEL_SHIFTS,
|
||||
MULTITAP_SHARP },
|
||||
{ (const int16_t *)av1_bilinear_filters, SUBPEL_TAPS, SUBPEL_SHIFTS,
|
||||
BILINEAR }
|
||||
};
|
||||
|
||||
DECLARE_ALIGNED(256, static const InterpKernel,
|
||||
av1_sub_pel_filters_4[SUBPEL_SHIFTS]) = {
|
||||
{ 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 0, -4, 126, 8, -2, 0, 0 },
|
||||
{ 0, 0, -8, 122, 18, -4, 0, 0 }, { 0, 0, -10, 116, 28, -6, 0, 0 },
|
||||
{ 0, 0, -12, 110, 38, -8, 0, 0 }, { 0, 0, -12, 102, 48, -10, 0, 0 },
|
||||
{ 0, 0, -14, 94, 58, -10, 0, 0 }, { 0, 0, -12, 84, 66, -10, 0, 0 },
|
||||
{ 0, 0, -12, 76, 76, -12, 0, 0 }, { 0, 0, -10, 66, 84, -12, 0, 0 },
|
||||
{ 0, 0, -10, 58, 94, -14, 0, 0 }, { 0, 0, -10, 48, 102, -12, 0, 0 },
|
||||
{ 0, 0, -8, 38, 110, -12, 0, 0 }, { 0, 0, -6, 28, 116, -10, 0, 0 },
|
||||
{ 0, 0, -4, 18, 122, -8, 0, 0 }, { 0, 0, -2, 8, 126, -4, 0, 0 }
|
||||
};
|
||||
DECLARE_ALIGNED(256, static const InterpKernel,
|
||||
av1_sub_pel_filters_4smooth[SUBPEL_SHIFTS]) = {
|
||||
{ 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 0, 30, 62, 34, 2, 0, 0 },
|
||||
{ 0, 0, 26, 62, 36, 4, 0, 0 }, { 0, 0, 22, 62, 40, 4, 0, 0 },
|
||||
{ 0, 0, 20, 60, 42, 6, 0, 0 }, { 0, 0, 18, 58, 44, 8, 0, 0 },
|
||||
{ 0, 0, 16, 56, 46, 10, 0, 0 }, { 0, 0, 14, 54, 48, 12, 0, 0 },
|
||||
{ 0, 0, 12, 52, 52, 12, 0, 0 }, { 0, 0, 12, 48, 54, 14, 0, 0 },
|
||||
{ 0, 0, 10, 46, 56, 16, 0, 0 }, { 0, 0, 8, 44, 58, 18, 0, 0 },
|
||||
{ 0, 0, 6, 42, 60, 20, 0, 0 }, { 0, 0, 4, 40, 62, 22, 0, 0 },
|
||||
{ 0, 0, 4, 36, 62, 26, 0, 0 }, { 0, 0, 2, 34, 62, 30, 0, 0 }
|
||||
};
|
||||
|
||||
// For w<=4, MULTITAP_SHARP is the same as EIGHTTAP_REGULAR
|
||||
static const InterpFilterParams av1_interp_4tap[SWITCHABLE_FILTERS + 1] = {
|
||||
{ (const int16_t *)av1_sub_pel_filters_4, SUBPEL_TAPS, SUBPEL_SHIFTS,
|
||||
EIGHTTAP_REGULAR },
|
||||
{ (const int16_t *)av1_sub_pel_filters_4smooth, SUBPEL_TAPS, SUBPEL_SHIFTS,
|
||||
EIGHTTAP_SMOOTH },
|
||||
{ (const int16_t *)av1_sub_pel_filters_4, SUBPEL_TAPS, SUBPEL_SHIFTS,
|
||||
EIGHTTAP_REGULAR },
|
||||
{ (const int16_t *)av1_bilinear_filters, SUBPEL_TAPS, SUBPEL_SHIFTS,
|
||||
BILINEAR },
|
||||
};
|
||||
|
||||
static INLINE const InterpFilterParams *
|
||||
av1_get_interp_filter_params_with_block_size(const InterpFilter interp_filter,
|
||||
const int w) {
|
||||
if (w <= 4) return &av1_interp_4tap[interp_filter];
|
||||
return &av1_interp_filter_params_list[interp_filter];
|
||||
}
|
||||
|
||||
static INLINE const int16_t *av1_get_interp_filter_kernel(
|
||||
const InterpFilter interp_filter) {
|
||||
return av1_interp_filter_params_list[interp_filter].filter_ptr;
|
||||
}
|
||||
|
||||
static INLINE const int16_t *av1_get_interp_filter_subpel_kernel(
|
||||
const InterpFilterParams filter_params, const int subpel) {
|
||||
return filter_params.filter_ptr + filter_params.taps * subpel;
|
||||
const InterpFilterParams *const filter_params, const int subpel) {
|
||||
return filter_params->filter_ptr + filter_params->taps * subpel;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
3
third_party/aom/av1/common/mv.h
vendored
3
third_party/aom/av1/common/mv.h
vendored
|
|
@ -294,9 +294,6 @@ static INLINE void clamp_mv(MV *mv, int min_col, int max_col, int min_row,
|
|||
mv->row = clamp(mv->row, min_row, max_row);
|
||||
}
|
||||
|
||||
static INLINE int mv_has_subpel(const MV *mv) {
|
||||
return (mv->row & SUBPEL_MASK) || (mv->col & SUBPEL_MASK);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
|
|
|||
2
third_party/aom/av1/common/mvref_common.h
vendored
2
third_party/aom/av1/common/mvref_common.h
vendored
|
|
@ -44,7 +44,7 @@ static INLINE int get_relative_dist(const AV1_COMMON *cm, int a, int b) {
|
|||
assert(b >= 0 && b < (1 << bits));
|
||||
|
||||
int diff = a - b;
|
||||
int m = 1 << (bits - 1);
|
||||
const int m = 1 << (bits - 1);
|
||||
diff = (diff & (m - 1)) - (diff & m);
|
||||
return diff;
|
||||
}
|
||||
|
|
|
|||
78
third_party/aom/av1/common/onyxc_int.h
vendored
78
third_party/aom/av1/common/onyxc_int.h
vendored
|
|
@ -184,7 +184,10 @@ typedef struct BitstreamLevel {
|
|||
uint8_t minor;
|
||||
} BitstreamLevel;
|
||||
|
||||
/* Initial version of sequence header structure */
|
||||
// Sequence header structure.
|
||||
// Note: All syntax elements of sequence_header_obu that need to be
|
||||
// bit-identical across multiple sequence headers must be part of this struct,
|
||||
// so that consistency is checked by are_seq_headers_consistent() function.
|
||||
typedef struct SequenceHeader {
|
||||
int num_bits_width;
|
||||
int num_bits_height;
|
||||
|
|
@ -205,7 +208,6 @@ typedef struct SequenceHeader {
|
|||
// 2 - adaptive
|
||||
int still_picture; // Video is a single frame still picture
|
||||
int reduced_still_picture_hdr; // Use reduced header for still picture
|
||||
int monochrome; // Monochorme video
|
||||
int enable_filter_intra; // enables/disables filterintra
|
||||
int enable_intra_edge_filter; // enables/disables corner/edge/upsampling
|
||||
int enable_interintra_compound; // enables/disables interintra_compound
|
||||
|
|
@ -229,6 +231,9 @@ typedef struct SequenceHeader {
|
|||
// enabled for that frame.
|
||||
int enable_cdef; // To turn on/off CDEF
|
||||
int enable_restoration; // To turn on/off loop restoration
|
||||
BITSTREAM_PROFILE profile;
|
||||
|
||||
// Operating point info.
|
||||
int operating_points_cnt_minus_1;
|
||||
int operating_point_idc[MAX_NUM_OPERATING_POINTS];
|
||||
int display_model_info_present_flag;
|
||||
|
|
@ -236,15 +241,26 @@ typedef struct SequenceHeader {
|
|||
BitstreamLevel level[MAX_NUM_OPERATING_POINTS];
|
||||
uint8_t tier[MAX_NUM_OPERATING_POINTS]; // seq_tier in the spec. One bit: 0
|
||||
// or 1.
|
||||
|
||||
// Color config.
|
||||
aom_bit_depth_t bit_depth; // AOM_BITS_8 in profile 0 or 1,
|
||||
// AOM_BITS_10 or AOM_BITS_12 in profile 2 or 3.
|
||||
int use_highbitdepth; // If true, we need to use 16bit frame buffers.
|
||||
int monochrome; // Monochorme video
|
||||
aom_color_primaries_t color_primaries;
|
||||
aom_transfer_characteristics_t transfer_characteristics;
|
||||
aom_matrix_coefficients_t matrix_coefficients;
|
||||
int color_range;
|
||||
int subsampling_x; // Chroma subsampling for x
|
||||
int subsampling_y; // Chroma subsampling for y
|
||||
aom_chroma_sample_position_t chroma_sample_position;
|
||||
int separate_uv_delta_q;
|
||||
|
||||
int film_grain_params_present;
|
||||
} SequenceHeader;
|
||||
|
||||
typedef struct AV1Common {
|
||||
struct aom_internal_error_info error;
|
||||
aom_color_primaries_t color_primaries;
|
||||
aom_transfer_characteristics_t transfer_characteristics;
|
||||
aom_matrix_coefficients_t matrix_coefficients;
|
||||
aom_chroma_sample_position_t chroma_sample_position;
|
||||
int color_range;
|
||||
int width;
|
||||
int height;
|
||||
int render_width;
|
||||
|
|
@ -253,18 +269,11 @@ typedef struct AV1Common {
|
|||
int last_height;
|
||||
int timing_info_present;
|
||||
aom_timing_info_t timing_info;
|
||||
int buffer_removal_delay_present;
|
||||
int buffer_removal_time_present;
|
||||
aom_dec_model_info_t buffer_model;
|
||||
aom_dec_model_op_parameters_t op_params[MAX_NUM_OPERATING_POINTS + 1];
|
||||
aom_op_timing_info_t op_frame_timing[MAX_NUM_OPERATING_POINTS + 1];
|
||||
int tu_presentation_delay_flag;
|
||||
int64_t tu_presentation_delay;
|
||||
|
||||
// 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.
|
||||
int subsampling_x;
|
||||
int subsampling_y;
|
||||
uint32_t frame_presentation_time;
|
||||
|
||||
int largest_tile_id;
|
||||
size_t largest_tile_size;
|
||||
|
|
@ -273,8 +282,6 @@ typedef struct AV1Common {
|
|||
// Scale of the current frame with respect to itself.
|
||||
struct scale_factors sf_identity;
|
||||
|
||||
// Marks if we need to use 16bit frame buffers (1: yes, 0: no).
|
||||
int use_highbitdepth;
|
||||
YV12_BUFFER_CONFIG *frame_to_show;
|
||||
RefCntBuffer *prev_frame;
|
||||
|
||||
|
|
@ -342,8 +349,6 @@ typedef struct AV1Common {
|
|||
int u_ac_delta_q;
|
||||
int v_ac_delta_q;
|
||||
|
||||
int separate_uv_delta_q;
|
||||
|
||||
// The dequantizers below are true dequntizers used only in the
|
||||
// dequantization process. They have the same coefficient
|
||||
// shift/scale as TX.
|
||||
|
|
@ -447,10 +452,7 @@ typedef struct AV1Common {
|
|||
unsigned int frame_offset;
|
||||
|
||||
unsigned int current_video_frame;
|
||||
BITSTREAM_PROFILE profile;
|
||||
|
||||
// AOM_BITS_8 in profile 0 or 1, AOM_BITS_10 or AOM_BITS_12 in profile 2 or 3.
|
||||
aom_bit_depth_t bit_depth;
|
||||
aom_bit_depth_t dequant_bit_depth; // bit_depth of current dequantizer
|
||||
|
||||
int error_resilient_mode;
|
||||
|
|
@ -494,9 +496,8 @@ typedef struct AV1Common {
|
|||
ENTROPY_CONTEXT **above_context[MAX_MB_PLANE];
|
||||
TXFM_CONTEXT **above_txfm_context;
|
||||
WarpedMotionParams global_motion[REF_FRAMES];
|
||||
aom_film_grain_table_t *film_grain_table;
|
||||
int film_grain_params_present;
|
||||
aom_film_grain_t film_grain_params;
|
||||
|
||||
int cdef_pri_damping;
|
||||
int cdef_sec_damping;
|
||||
int nb_cdef_strengths;
|
||||
|
|
@ -590,7 +591,7 @@ static INLINE int get_free_fb(AV1_COMMON *cm) {
|
|||
if (frame_bufs[i].ref_count == 0) break;
|
||||
|
||||
if (i != FRAME_BUFFERS) {
|
||||
if (frame_bufs[i].buf.use_external_refernce_buffers) {
|
||||
if (frame_bufs[i].buf.use_external_reference_buffers) {
|
||||
// If this frame buffer's y_buffer, u_buffer, and v_buffer point to the
|
||||
// external reference buffers. Restore the buffer pointers to point to the
|
||||
// internally allocated memory.
|
||||
|
|
@ -598,7 +599,7 @@ static INLINE int get_free_fb(AV1_COMMON *cm) {
|
|||
ybf->y_buffer = ybf->store_buf_adr[0];
|
||||
ybf->u_buffer = ybf->store_buf_adr[1];
|
||||
ybf->v_buffer = ybf->store_buf_adr[2];
|
||||
ybf->use_external_refernce_buffers = 0;
|
||||
ybf->use_external_reference_buffers = 0;
|
||||
}
|
||||
|
||||
frame_bufs[i].ref_count = 1;
|
||||
|
|
@ -683,15 +684,7 @@ static INLINE void ensure_mv_buffer(RefCntBuffer *buf, AV1_COMMON *cm) {
|
|||
}
|
||||
}
|
||||
|
||||
static INLINE int mi_cols_aligned_to_sb(const AV1_COMMON *cm) {
|
||||
return ALIGN_POWER_OF_TWO(cm->mi_cols, cm->seq_params.mib_size_log2);
|
||||
}
|
||||
|
||||
static INLINE int mi_rows_aligned_to_sb(const AV1_COMMON *cm) {
|
||||
return ALIGN_POWER_OF_TWO(cm->mi_rows, cm->seq_params.mib_size_log2);
|
||||
}
|
||||
|
||||
void cfl_init(CFL_CTX *cfl, AV1_COMMON *cm);
|
||||
void cfl_init(CFL_CTX *cfl, const SequenceHeader *seq_params);
|
||||
|
||||
static INLINE int av1_num_planes(const AV1_COMMON *cm) {
|
||||
return cm->seq_params.monochrome ? 1 : MAX_MB_PLANE;
|
||||
|
|
@ -734,7 +727,7 @@ static INLINE void av1_init_macroblockd(AV1_COMMON *cm, MACROBLOCKD *xd,
|
|||
}
|
||||
xd->mi_stride = cm->mi_stride;
|
||||
xd->error_info = &cm->error;
|
||||
cfl_init(&xd->cfl, cm);
|
||||
cfl_init(&xd->cfl, &cm->seq_params);
|
||||
}
|
||||
|
||||
static INLINE void set_skip_context(MACROBLOCKD *xd, int mi_row, int mi_col,
|
||||
|
|
@ -1066,17 +1059,18 @@ static INLINE int max_intra_block_height(const MACROBLOCKD *xd,
|
|||
return ALIGN_POWER_OF_TWO(max_blocks_high, tx_size_high_log2[tx_size]);
|
||||
}
|
||||
|
||||
static INLINE void av1_zero_above_context(AV1_COMMON *const cm,
|
||||
static INLINE void av1_zero_above_context(AV1_COMMON *const cm, const MACROBLOCKD *xd,
|
||||
int mi_col_start, int mi_col_end, const int tile_row) {
|
||||
const SequenceHeader *const seq_params = &cm->seq_params;
|
||||
const int num_planes = av1_num_planes(cm);
|
||||
const int width = mi_col_end - mi_col_start;
|
||||
const int aligned_width =
|
||||
ALIGN_POWER_OF_TWO(width, cm->seq_params.mib_size_log2);
|
||||
ALIGN_POWER_OF_TWO(width, seq_params->mib_size_log2);
|
||||
|
||||
const int offset_y = mi_col_start;
|
||||
const int width_y = aligned_width;
|
||||
const int offset_uv = offset_y >> cm->subsampling_x;
|
||||
const int width_uv = width_y >> cm->subsampling_x;
|
||||
const int offset_uv = offset_y >> seq_params->subsampling_x;
|
||||
const int width_uv = width_y >> seq_params->subsampling_x;
|
||||
|
||||
av1_zero_array(cm->above_context[0][tile_row] + offset_y, width_y);
|
||||
if (num_planes > 1) {
|
||||
|
|
@ -1084,7 +1078,7 @@ static INLINE void av1_zero_above_context(AV1_COMMON *const cm,
|
|||
av1_zero_array(cm->above_context[1][tile_row] + offset_uv, width_uv);
|
||||
av1_zero_array(cm->above_context[2][tile_row] + offset_uv, width_uv);
|
||||
} else {
|
||||
aom_internal_error(&cm->error, AOM_CODEC_CORRUPT_FRAME,
|
||||
aom_internal_error(xd->error_info, AOM_CODEC_CORRUPT_FRAME,
|
||||
"Invalid value of planes");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
23
third_party/aom/av1/common/quant_common.c
vendored
23
third_party/aom/av1/common/quant_common.c
vendored
|
|
@ -223,29 +223,6 @@ int16_t av1_ac_quant_QTX(int qindex, int delta, aom_bit_depth_t bit_depth) {
|
|||
return av1_ac_quant_Q3(qindex, delta, bit_depth);
|
||||
}
|
||||
|
||||
int16_t av1_qindex_from_ac_Q3(int ac_Q3, aom_bit_depth_t bit_depth) {
|
||||
int i;
|
||||
const int16_t *tab = ac_qlookup_Q3;
|
||||
switch (bit_depth) {
|
||||
case AOM_BITS_10: {
|
||||
tab = ac_qlookup_10_Q3;
|
||||
break;
|
||||
}
|
||||
case AOM_BITS_12: {
|
||||
tab = ac_qlookup_12_Q3;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
assert(0 && "bit_depth should be AOM_BITS_8, AOM_BITS_10 or AOM_BITS_12");
|
||||
return -1;
|
||||
}
|
||||
(void)bit_depth;
|
||||
for (i = 0; i < QINDEX_RANGE; i++) {
|
||||
if (ac_Q3 <= tab[i]) return i;
|
||||
}
|
||||
return QINDEX_RANGE - 1;
|
||||
}
|
||||
|
||||
int av1_get_qindex(const struct segmentation *seg, int segment_id,
|
||||
int base_qindex) {
|
||||
if (segfeature_active(seg, segment_id, SEG_LVL_ALT_Q)) {
|
||||
|
|
|
|||
1
third_party/aom/av1/common/quant_common.h
vendored
1
third_party/aom/av1/common/quant_common.h
vendored
|
|
@ -42,7 +42,6 @@ int16_t av1_dc_quant_Q3(int qindex, int delta, aom_bit_depth_t bit_depth);
|
|||
int16_t av1_ac_quant_Q3(int qindex, int delta, aom_bit_depth_t bit_depth);
|
||||
int16_t av1_dc_quant_QTX(int qindex, int delta, aom_bit_depth_t bit_depth);
|
||||
int16_t av1_ac_quant_QTX(int qindex, int delta, aom_bit_depth_t bit_depth);
|
||||
int16_t av1_qindex_from_ac_Q3(int ac_Q3, aom_bit_depth_t bit_depth);
|
||||
|
||||
int av1_get_qindex(const struct segmentation *seg, int segment_id,
|
||||
int base_qindex);
|
||||
|
|
|
|||
65
third_party/aom/av1/common/reconinter.c
vendored
65
third_party/aom/av1/common/reconinter.c
vendored
|
|
@ -627,9 +627,7 @@ void av1_make_masked_inter_predictor(
|
|||
tmp_buf[INTER_PRED_BYTES_PER_PIXEL * MAX_SB_SQUARE]);
|
||||
#undef INTER_PRED_BYTES_PER_PIXEL
|
||||
|
||||
uint8_t *tmp_dst = (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH)
|
||||
? CONVERT_TO_BYTEPTR(tmp_buf)
|
||||
: tmp_buf;
|
||||
uint8_t *tmp_dst = get_buf_by_bd(xd, tmp_buf);
|
||||
|
||||
const int tmp_buf_stride = MAX_SB_SIZE;
|
||||
CONV_BUF_TYPE *org_dst = conv_params->dst;
|
||||
|
|
@ -1002,8 +1000,8 @@ void av1_build_inter_predictors_sby(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
|||
BUFFER_SET default_ctx = { { xd->plane[0].dst.buf, NULL, NULL },
|
||||
{ xd->plane[0].dst.stride, 0, 0 } };
|
||||
if (!ctx) ctx = &default_ctx;
|
||||
av1_build_interintra_predictors_sby(cm, xd, xd->plane[0].dst.buf,
|
||||
xd->plane[0].dst.stride, ctx, bsize);
|
||||
av1_build_interintra_predictors_sbp(cm, xd, xd->plane[0].dst.buf,
|
||||
xd->plane[0].dst.stride, ctx, 0, bsize);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1609,10 +1607,10 @@ void av1_build_intra_predictors_for_interintra(const AV1_COMMON *cm,
|
|||
const int ssy = xd->plane[plane].subsampling_y;
|
||||
BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, ssx, ssy);
|
||||
PREDICTION_MODE mode = interintra_to_intra_mode[xd->mi[0]->interintra_mode];
|
||||
xd->mi[0]->angle_delta[PLANE_TYPE_Y] = 0;
|
||||
xd->mi[0]->angle_delta[PLANE_TYPE_UV] = 0;
|
||||
xd->mi[0]->filter_intra_mode_info.use_filter_intra = 0;
|
||||
xd->mi[0]->use_intrabc = 0;
|
||||
assert(xd->mi[0]->angle_delta[PLANE_TYPE_Y] == 0);
|
||||
assert(xd->mi[0]->angle_delta[PLANE_TYPE_UV] == 0);
|
||||
assert(xd->mi[0]->filter_intra_mode_info.use_filter_intra == 0);
|
||||
assert(xd->mi[0]->use_intrabc == 0);
|
||||
|
||||
av1_predict_intra_block(cm, xd, pd->width, pd->height,
|
||||
max_txsize_rect_lookup[plane_bsize], mode, 0, 0,
|
||||
|
|
@ -1642,42 +1640,23 @@ void av1_combine_interintra(MACROBLOCKD *xd, BLOCK_SIZE bsize, int plane,
|
|||
inter_pred, inter_stride, intra_pred, intra_stride);
|
||||
}
|
||||
|
||||
void av1_build_interintra_predictors_sby(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
||||
uint8_t *ypred, int ystride,
|
||||
BUFFER_SET *ctx, BLOCK_SIZE bsize) {
|
||||
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
|
||||
DECLARE_ALIGNED(16, uint16_t, intrapredictor[MAX_SB_SQUARE]);
|
||||
av1_build_intra_predictors_for_interintra(
|
||||
cm, xd, bsize, 0, ctx, CONVERT_TO_BYTEPTR(intrapredictor), MAX_SB_SIZE);
|
||||
av1_combine_interintra(xd, bsize, 0, ypred, ystride,
|
||||
CONVERT_TO_BYTEPTR(intrapredictor), MAX_SB_SIZE);
|
||||
return;
|
||||
}
|
||||
{
|
||||
DECLARE_ALIGNED(16, uint8_t, intrapredictor[MAX_SB_SQUARE]);
|
||||
av1_build_intra_predictors_for_interintra(cm, xd, bsize, 0, ctx,
|
||||
intrapredictor, MAX_SB_SIZE);
|
||||
av1_combine_interintra(xd, bsize, 0, ypred, ystride, intrapredictor,
|
||||
MAX_SB_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
void av1_build_interintra_predictors_sbc(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
||||
uint8_t *upred, int ustride,
|
||||
// build interintra_predictors for one plane
|
||||
void av1_build_interintra_predictors_sbp(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
||||
uint8_t *pred, int stride,
|
||||
BUFFER_SET *ctx, int plane,
|
||||
BLOCK_SIZE bsize) {
|
||||
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
|
||||
DECLARE_ALIGNED(16, uint16_t, uintrapredictor[MAX_SB_SQUARE]);
|
||||
DECLARE_ALIGNED(16, uint16_t, intrapredictor[MAX_SB_SQUARE]);
|
||||
av1_build_intra_predictors_for_interintra(
|
||||
cm, xd, bsize, plane, ctx, CONVERT_TO_BYTEPTR(uintrapredictor),
|
||||
cm, xd, bsize, plane, ctx, CONVERT_TO_BYTEPTR(intrapredictor),
|
||||
MAX_SB_SIZE);
|
||||
av1_combine_interintra(xd, bsize, plane, upred, ustride,
|
||||
CONVERT_TO_BYTEPTR(uintrapredictor), MAX_SB_SIZE);
|
||||
av1_combine_interintra(xd, bsize, plane, pred, stride,
|
||||
CONVERT_TO_BYTEPTR(intrapredictor), MAX_SB_SIZE);
|
||||
} else {
|
||||
DECLARE_ALIGNED(16, uint8_t, uintrapredictor[MAX_SB_SQUARE]);
|
||||
DECLARE_ALIGNED(16, uint8_t, intrapredictor[MAX_SB_SQUARE]);
|
||||
av1_build_intra_predictors_for_interintra(cm, xd, bsize, plane, ctx,
|
||||
uintrapredictor, MAX_SB_SIZE);
|
||||
av1_combine_interintra(xd, bsize, plane, upred, ustride, uintrapredictor,
|
||||
intrapredictor, MAX_SB_SIZE);
|
||||
av1_combine_interintra(xd, bsize, plane, pred, stride, intrapredictor,
|
||||
MAX_SB_SIZE);
|
||||
}
|
||||
}
|
||||
|
|
@ -1686,8 +1665,8 @@ void av1_build_interintra_predictors_sbuv(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
|||
uint8_t *upred, uint8_t *vpred,
|
||||
int ustride, int vstride,
|
||||
BUFFER_SET *ctx, BLOCK_SIZE bsize) {
|
||||
av1_build_interintra_predictors_sbc(cm, xd, upred, ustride, ctx, 1, bsize);
|
||||
av1_build_interintra_predictors_sbc(cm, xd, vpred, vstride, ctx, 2, bsize);
|
||||
av1_build_interintra_predictors_sbp(cm, xd, upred, ustride, ctx, 1, bsize);
|
||||
av1_build_interintra_predictors_sbp(cm, xd, vpred, vstride, ctx, 2, bsize);
|
||||
}
|
||||
|
||||
void av1_build_interintra_predictors(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
||||
|
|
@ -1695,7 +1674,7 @@ void av1_build_interintra_predictors(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
|||
uint8_t *vpred, int ystride, int ustride,
|
||||
int vstride, BUFFER_SET *ctx,
|
||||
BLOCK_SIZE bsize) {
|
||||
av1_build_interintra_predictors_sby(cm, xd, ypred, ystride, ctx, bsize);
|
||||
av1_build_interintra_predictors_sbp(cm, xd, ypred, ystride, ctx, 0, bsize);
|
||||
av1_build_interintra_predictors_sbuv(cm, xd, upred, vpred, ustride, vstride,
|
||||
ctx, bsize);
|
||||
}
|
||||
|
|
@ -1713,9 +1692,7 @@ static void build_inter_predictors_single_buf(MACROBLOCKD *xd, int plane,
|
|||
|
||||
const struct scale_factors *const sf = &xd->block_refs[ref]->sf;
|
||||
struct buf_2d *const pre_buf = &pd->pre[ref];
|
||||
const int hbd = xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH;
|
||||
uint8_t *const dst =
|
||||
(hbd ? CONVERT_TO_BYTEPTR(ext_dst) : ext_dst) + ext_dst_stride * y + x;
|
||||
uint8_t *const dst = get_buf_by_bd(xd, ext_dst) + ext_dst_stride * y + x;
|
||||
const MV mv = mi->mv[ref].as_mv;
|
||||
|
||||
ConvolveParams conv_params = get_conv_params(ref, 0, plane, xd->bd);
|
||||
|
|
|
|||
10
third_party/aom/av1/common/reconinter.h
vendored
10
third_party/aom/av1/common/reconinter.h
vendored
|
|
@ -412,12 +412,9 @@ void av1_build_interintra_predictors(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
|||
int vstride, BUFFER_SET *ctx,
|
||||
BLOCK_SIZE bsize);
|
||||
|
||||
void av1_build_interintra_predictors_sby(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
||||
uint8_t *ypred, int ystride,
|
||||
BUFFER_SET *ctx, BLOCK_SIZE bsize);
|
||||
|
||||
void av1_build_interintra_predictors_sbc(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
||||
uint8_t *upred, int ustride,
|
||||
// build interintra_predictors for one plane
|
||||
void av1_build_interintra_predictors_sbp(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
||||
uint8_t *pred, int stride,
|
||||
BUFFER_SET *ctx, int plane,
|
||||
BLOCK_SIZE bsize);
|
||||
|
||||
|
|
@ -429,6 +426,7 @@ void av1_build_interintra_predictors_sbuv(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
|||
void av1_build_intra_predictors_for_interintra(
|
||||
const AV1_COMMON *cm, MACROBLOCKD *xd, BLOCK_SIZE bsize, int plane,
|
||||
BUFFER_SET *ctx, uint8_t *intra_pred, int intra_stride);
|
||||
|
||||
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);
|
||||
|
|
|
|||
19
third_party/aom/av1/common/reconintra.c
vendored
19
third_party/aom/av1/common/reconintra.c
vendored
|
|
@ -1071,13 +1071,6 @@ static void filter_intra_edge_corner_high(uint16_t *p_above, uint16_t *p_left) {
|
|||
p_left[-1] = s;
|
||||
}
|
||||
|
||||
static int use_intra_edge_upsample(int bs0, int bs1, int delta, int type) {
|
||||
const int d = abs(delta);
|
||||
const int blk_wh = bs0 + bs1;
|
||||
if (d <= 0 || d >= 40) return 0;
|
||||
return type ? (blk_wh <= 8) : (blk_wh <= 16);
|
||||
}
|
||||
|
||||
void av1_upsample_intra_edge_c(uint8_t *p, int sz) {
|
||||
// interpolate half-sample positions
|
||||
assert(sz <= MAX_UPSAMPLE_SZ);
|
||||
|
|
@ -1284,13 +1277,13 @@ static void build_intra_predictors_high(
|
|||
}
|
||||
}
|
||||
upsample_above =
|
||||
use_intra_edge_upsample(txwpx, txhpx, p_angle - 90, filt_type);
|
||||
av1_use_intra_edge_upsample(txwpx, txhpx, p_angle - 90, filt_type);
|
||||
if (need_above && upsample_above) {
|
||||
const int n_px = txwpx + (need_right ? txhpx : 0);
|
||||
av1_upsample_intra_edge_high(above_row, n_px, xd->bd);
|
||||
}
|
||||
upsample_left =
|
||||
use_intra_edge_upsample(txhpx, txwpx, p_angle - 180, filt_type);
|
||||
av1_use_intra_edge_upsample(txhpx, txwpx, p_angle - 180, filt_type);
|
||||
if (need_left && upsample_left) {
|
||||
const int n_px = txhpx + (need_bottom ? txwpx : 0);
|
||||
av1_upsample_intra_edge_high(left_col, n_px, xd->bd);
|
||||
|
|
@ -1467,13 +1460,13 @@ static void build_intra_predictors(const MACROBLOCKD *xd, const uint8_t *ref,
|
|||
}
|
||||
}
|
||||
upsample_above =
|
||||
use_intra_edge_upsample(txwpx, txhpx, p_angle - 90, filt_type);
|
||||
av1_use_intra_edge_upsample(txwpx, txhpx, p_angle - 90, filt_type);
|
||||
if (need_above && upsample_above) {
|
||||
const int n_px = txwpx + (need_right ? txhpx : 0);
|
||||
av1_upsample_intra_edge(above_row, n_px);
|
||||
}
|
||||
upsample_left =
|
||||
use_intra_edge_upsample(txhpx, txwpx, p_angle - 180, filt_type);
|
||||
av1_use_intra_edge_upsample(txhpx, txwpx, p_angle - 180, filt_type);
|
||||
if (need_left && upsample_left) {
|
||||
const int n_px = txhpx + (need_bottom ? txwpx : 0);
|
||||
av1_upsample_intra_edge(left_col, n_px);
|
||||
|
|
@ -1642,4 +1635,6 @@ void av1_predict_intra_block_facade(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
|||
dst_stride, dst, dst_stride, blk_col, blk_row, plane);
|
||||
}
|
||||
|
||||
void av1_init_intra_predictors(void) { once(init_intra_predictors_internal); }
|
||||
void av1_init_intra_predictors(void) {
|
||||
aom_once(init_intra_predictors_internal);
|
||||
}
|
||||
|
|
|
|||
10
third_party/aom/av1/common/reconintra.h
vendored
10
third_party/aom/av1/common/reconintra.h
vendored
|
|
@ -12,6 +12,8 @@
|
|||
#ifndef AV1_COMMON_RECONINTRA_H_
|
||||
#define AV1_COMMON_RECONINTRA_H_
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "aom/aom_integer.h"
|
||||
#include "av1/common/blockd.h"
|
||||
#include "av1/common/onyxc_int.h"
|
||||
|
|
@ -103,6 +105,14 @@ static INLINE int av1_get_dy(int angle) {
|
|||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
static INLINE int av1_use_intra_edge_upsample(int bs0, int bs1, int delta,
|
||||
int type) {
|
||||
const int d = abs(delta);
|
||||
const int blk_wh = bs0 + bs1;
|
||||
if (d <= 0 || d >= 40) return 0;
|
||||
return type ? (blk_wh <= 8) : (blk_wh <= 16);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
|
|
|||
41
third_party/aom/av1/common/resize.c
vendored
41
third_party/aom/av1/common/resize.c
vendored
|
|
@ -1100,7 +1100,7 @@ void av1_upscale_normative_rows(const AV1_COMMON *cm, const uint8_t *src,
|
|||
int src_stride, uint8_t *dst, int dst_stride,
|
||||
int plane, int rows) {
|
||||
const int is_uv = (plane > 0);
|
||||
const int ss_x = is_uv && cm->subsampling_x;
|
||||
const int ss_x = is_uv && cm->seq_params.subsampling_x;
|
||||
const int downscaled_plane_width = ROUND_POWER_OF_TWO(cm->width, ss_x);
|
||||
const int upscaled_plane_width =
|
||||
ROUND_POWER_OF_TWO(cm->superres_upscaled_width, ss_x);
|
||||
|
|
@ -1141,10 +1141,11 @@ void av1_upscale_normative_rows(const AV1_COMMON *cm, const uint8_t *src,
|
|||
const int pad_left = (j == 0);
|
||||
const int pad_right = (j == cm->tile_cols - 1);
|
||||
|
||||
if (cm->use_highbitdepth)
|
||||
highbd_upscale_normative_rect(
|
||||
src_ptr, rows, src_width, src_stride, dst_ptr, rows, dst_width,
|
||||
dst_stride, x_step_qn, x0_qn, pad_left, pad_right, cm->bit_depth);
|
||||
if (cm->seq_params.use_highbitdepth)
|
||||
highbd_upscale_normative_rect(src_ptr, rows, src_width, src_stride,
|
||||
dst_ptr, rows, dst_width, dst_stride,
|
||||
x_step_qn, x0_qn, pad_left, pad_right,
|
||||
cm->seq_params.bit_depth);
|
||||
else
|
||||
upscale_normative_rect(src_ptr, rows, src_width, src_stride, dst_ptr,
|
||||
rows, dst_width, dst_stride, x_step_qn, x0_qn,
|
||||
|
|
@ -1175,7 +1176,7 @@ YV12_BUFFER_CONFIG *av1_scale_if_required(AV1_COMMON *cm,
|
|||
const int num_planes = av1_num_planes(cm);
|
||||
if (cm->width != unscaled->y_crop_width ||
|
||||
cm->height != unscaled->y_crop_height) {
|
||||
av1_resize_and_extend_frame(unscaled, scaled, (int)cm->bit_depth,
|
||||
av1_resize_and_extend_frame(unscaled, scaled, (int)cm->seq_params.bit_depth,
|
||||
num_planes);
|
||||
return scaled;
|
||||
} else {
|
||||
|
|
@ -1232,6 +1233,7 @@ static void copy_buffer_config(const YV12_BUFFER_CONFIG *const src,
|
|||
void av1_superres_upscale(AV1_COMMON *cm, BufferPool *const pool) {
|
||||
const int num_planes = av1_num_planes(cm);
|
||||
if (!av1_superres_scaled(cm)) return;
|
||||
const SequenceHeader *const seq_params = &cm->seq_params;
|
||||
|
||||
YV12_BUFFER_CONFIG copy_buffer;
|
||||
memset(©_buffer, 0, sizeof(copy_buffer));
|
||||
|
|
@ -1239,10 +1241,10 @@ void av1_superres_upscale(AV1_COMMON *cm, BufferPool *const pool) {
|
|||
YV12_BUFFER_CONFIG *const frame_to_show = get_frame_new_buffer(cm);
|
||||
|
||||
const int aligned_width = ALIGN_POWER_OF_TWO(cm->width, 3);
|
||||
if (aom_alloc_frame_buffer(©_buffer, aligned_width, cm->height,
|
||||
cm->subsampling_x, cm->subsampling_y,
|
||||
cm->use_highbitdepth, AOM_BORDER_IN_PIXELS,
|
||||
cm->byte_alignment))
|
||||
if (aom_alloc_frame_buffer(
|
||||
©_buffer, aligned_width, cm->height, seq_params->subsampling_x,
|
||||
seq_params->subsampling_y, seq_params->use_highbitdepth,
|
||||
AOM_BORDER_IN_PIXELS, cm->byte_alignment))
|
||||
aom_internal_error(&cm->error, AOM_CODEC_MEM_ERROR,
|
||||
"Failed to allocate copy buffer for superres upscaling");
|
||||
|
||||
|
|
@ -1269,11 +1271,11 @@ void av1_superres_upscale(AV1_COMMON *cm, BufferPool *const pool) {
|
|||
"Failed to free current frame buffer before superres upscaling");
|
||||
|
||||
// aom_realloc_frame_buffer() leaves config data for frame_to_show intact
|
||||
if (aom_realloc_frame_buffer(frame_to_show, cm->superres_upscaled_width,
|
||||
cm->superres_upscaled_height,
|
||||
cm->subsampling_x, cm->subsampling_y,
|
||||
cm->use_highbitdepth, AOM_BORDER_IN_PIXELS,
|
||||
cm->byte_alignment, fb, cb, cb_priv))
|
||||
if (aom_realloc_frame_buffer(
|
||||
frame_to_show, cm->superres_upscaled_width,
|
||||
cm->superres_upscaled_height, seq_params->subsampling_x,
|
||||
seq_params->subsampling_y, seq_params->use_highbitdepth,
|
||||
AOM_BORDER_IN_PIXELS, cm->byte_alignment, fb, cb, cb_priv))
|
||||
aom_internal_error(
|
||||
&cm->error, AOM_CODEC_MEM_ERROR,
|
||||
"Failed to allocate current frame buffer for superres upscaling");
|
||||
|
|
@ -1283,10 +1285,11 @@ void av1_superres_upscale(AV1_COMMON *cm, BufferPool *const pool) {
|
|||
|
||||
// Don't use callbacks on the encoder.
|
||||
// aom_alloc_frame_buffer() clears the config data for frame_to_show
|
||||
if (aom_alloc_frame_buffer(frame_to_show, cm->superres_upscaled_width,
|
||||
cm->superres_upscaled_height, cm->subsampling_x,
|
||||
cm->subsampling_y, cm->use_highbitdepth,
|
||||
AOM_BORDER_IN_PIXELS, cm->byte_alignment))
|
||||
if (aom_alloc_frame_buffer(
|
||||
frame_to_show, cm->superres_upscaled_width,
|
||||
cm->superres_upscaled_height, seq_params->subsampling_x,
|
||||
seq_params->subsampling_y, seq_params->use_highbitdepth,
|
||||
AOM_BORDER_IN_PIXELS, cm->byte_alignment))
|
||||
aom_internal_error(
|
||||
&cm->error, AOM_CODEC_MEM_ERROR,
|
||||
"Failed to reallocate current frame buffer for superres upscaling");
|
||||
|
|
|
|||
40
third_party/aom/av1/common/restoration.c
vendored
40
third_party/aom/av1/common/restoration.c
vendored
|
|
@ -42,8 +42,8 @@ const sgr_params_type sgr_params[SGRPROJ_PARAMS] = {
|
|||
AV1PixelRect av1_whole_frame_rect(const AV1_COMMON *cm, int is_uv) {
|
||||
AV1PixelRect rect;
|
||||
|
||||
int ss_x = is_uv && cm->subsampling_x;
|
||||
int ss_y = is_uv && cm->subsampling_y;
|
||||
int ss_x = is_uv && cm->seq_params.subsampling_x;
|
||||
int ss_y = is_uv && cm->seq_params.subsampling_y;
|
||||
|
||||
rect.top = 0;
|
||||
rect.bottom = ROUND_POWER_OF_TWO(cm->height, ss_y);
|
||||
|
|
@ -1146,16 +1146,17 @@ void av1_loop_restoration_filter_frame_init(AV1LrStruct *lr_ctxt,
|
|||
YV12_BUFFER_CONFIG *frame,
|
||||
AV1_COMMON *cm, int optimized_lr,
|
||||
int num_planes) {
|
||||
const int bit_depth = cm->bit_depth;
|
||||
const int highbd = cm->use_highbitdepth;
|
||||
const SequenceHeader *const seq_params = &cm->seq_params;
|
||||
const int bit_depth = seq_params->bit_depth;
|
||||
const int highbd = seq_params->use_highbitdepth;
|
||||
lr_ctxt->dst = &cm->rst_frame;
|
||||
|
||||
const int frame_width = frame->crop_widths[0];
|
||||
const int frame_height = frame->crop_heights[0];
|
||||
if (aom_realloc_frame_buffer(lr_ctxt->dst, frame_width, frame_height,
|
||||
cm->subsampling_x, cm->subsampling_y,
|
||||
cm->use_highbitdepth, AOM_BORDER_IN_PIXELS,
|
||||
cm->byte_alignment, NULL, NULL, NULL) < 0)
|
||||
if (aom_realloc_frame_buffer(
|
||||
lr_ctxt->dst, frame_width, frame_height, seq_params->subsampling_x,
|
||||
seq_params->subsampling_y, highbd, AOM_BORDER_IN_PIXELS,
|
||||
cm->byte_alignment, NULL, NULL, NULL) < 0)
|
||||
aom_internal_error(&cm->error, AOM_CODEC_MEM_ERROR,
|
||||
"Failed to allocate restoration dst buffer");
|
||||
|
||||
|
|
@ -1180,8 +1181,8 @@ void av1_loop_restoration_filter_frame_init(AV1LrStruct *lr_ctxt,
|
|||
highbd);
|
||||
|
||||
lr_plane_ctxt->rsi = rsi;
|
||||
lr_plane_ctxt->ss_x = is_uv && cm->subsampling_x;
|
||||
lr_plane_ctxt->ss_y = is_uv && cm->subsampling_y;
|
||||
lr_plane_ctxt->ss_x = is_uv && seq_params->subsampling_x;
|
||||
lr_plane_ctxt->ss_y = is_uv && seq_params->subsampling_y;
|
||||
lr_plane_ctxt->highbd = highbd;
|
||||
lr_plane_ctxt->bit_depth = bit_depth;
|
||||
lr_plane_ctxt->data8 = frame->buffers[plane];
|
||||
|
|
@ -1337,7 +1338,7 @@ void av1_foreach_rest_unit_in_plane(const struct AV1Common *cm, int plane,
|
|||
int32_t *tmpbuf,
|
||||
RestorationLineBuffers *rlbs) {
|
||||
const int is_uv = plane > 0;
|
||||
const int ss_y = is_uv && cm->subsampling_y;
|
||||
const int ss_y = is_uv && cm->seq_params.subsampling_y;
|
||||
|
||||
const RestorationInfo *rsi = &cm->rst_info[plane];
|
||||
|
||||
|
|
@ -1350,7 +1351,7 @@ void av1_foreach_rest_unit_in_plane(const struct AV1Common *cm, int plane,
|
|||
int av1_loop_restoration_corners_in_sb(const struct AV1Common *cm, int plane,
|
||||
int mi_row, int mi_col, BLOCK_SIZE bsize,
|
||||
int *rcol0, int *rcol1, int *rrow0,
|
||||
int *rrow1, int *tile_tl_idx) {
|
||||
int *rrow1) {
|
||||
assert(rcol0 && rcol1 && rrow0 && rrow1);
|
||||
|
||||
if (bsize != cm->seq_params.sb_size) return 0;
|
||||
|
|
@ -1383,8 +1384,8 @@ int av1_loop_restoration_corners_in_sb(const struct AV1Common *cm, int plane,
|
|||
const int vert_units = av1_lr_count_units_in_tile(size, tile_h);
|
||||
|
||||
// The size of an MI-unit on this plane of the image
|
||||
const int ss_x = is_uv && cm->subsampling_x;
|
||||
const int ss_y = is_uv && cm->subsampling_y;
|
||||
const int ss_x = is_uv && cm->seq_params.subsampling_x;
|
||||
const int ss_y = is_uv && cm->seq_params.subsampling_y;
|
||||
const int mi_size_x = MI_SIZE >> ss_x;
|
||||
const int mi_size_y = MI_SIZE >> ss_y;
|
||||
|
||||
|
|
@ -1419,9 +1420,6 @@ int av1_loop_restoration_corners_in_sb(const struct AV1Common *cm, int plane,
|
|||
*rcol1 = AOMMIN((mi_rel_col1 * mi_to_num_x + rnd_x) / denom_x, horz_units);
|
||||
*rrow1 = AOMMIN((mi_rel_row1 * mi_to_num_y + rnd_y) / denom_y, vert_units);
|
||||
|
||||
const int tile_idx = 0;
|
||||
*tile_tl_idx = tile_idx * rsi->units_per_tile;
|
||||
|
||||
return *rcol0 < *rcol1 && *rrow0 < *rrow1;
|
||||
}
|
||||
|
||||
|
|
@ -1468,7 +1466,7 @@ static void save_deblock_boundary_lines(
|
|||
int upscaled_width;
|
||||
int line_bytes;
|
||||
if (av1_superres_scaled(cm)) {
|
||||
const int ss_x = is_uv && cm->subsampling_x;
|
||||
const int ss_x = is_uv && cm->seq_params.subsampling_x;
|
||||
upscaled_width = (cm->superres_upscaled_width + ss_x) >> ss_x;
|
||||
line_bytes = upscaled_width << use_highbd;
|
||||
if (use_highbd)
|
||||
|
|
@ -1515,7 +1513,7 @@ static void save_cdef_boundary_lines(const YV12_BUFFER_CONFIG *frame,
|
|||
// At the point where this function is called, we've already applied
|
||||
// superres. So we don't need to extend the lines here, we can just
|
||||
// pull directly from the topmost row of the upscaled frame.
|
||||
const int ss_x = is_uv && cm->subsampling_x;
|
||||
const int ss_x = is_uv && cm->seq_params.subsampling_x;
|
||||
const int upscaled_width = av1_superres_scaled(cm)
|
||||
? (cm->superres_upscaled_width + ss_x) >> ss_x
|
||||
: src_width;
|
||||
|
|
@ -1535,7 +1533,7 @@ static void save_tile_row_boundary_lines(const YV12_BUFFER_CONFIG *frame,
|
|||
int use_highbd, int plane,
|
||||
AV1_COMMON *cm, int after_cdef) {
|
||||
const int is_uv = plane > 0;
|
||||
const int ss_y = is_uv && cm->subsampling_y;
|
||||
const int ss_y = is_uv && cm->seq_params.subsampling_y;
|
||||
const int stripe_height = RESTORATION_PROC_UNIT_SIZE >> ss_y;
|
||||
const int stripe_off = RESTORATION_UNIT_OFFSET >> ss_y;
|
||||
|
||||
|
|
@ -1600,7 +1598,7 @@ static void save_tile_row_boundary_lines(const YV12_BUFFER_CONFIG *frame,
|
|||
void av1_loop_restoration_save_boundary_lines(const YV12_BUFFER_CONFIG *frame,
|
||||
AV1_COMMON *cm, int after_cdef) {
|
||||
const int num_planes = av1_num_planes(cm);
|
||||
const int use_highbd = cm->use_highbitdepth;
|
||||
const int use_highbd = cm->seq_params.use_highbitdepth;
|
||||
for (int p = 0; p < num_planes; ++p) {
|
||||
save_tile_row_boundary_lines(frame, use_highbd, p, cm, after_cdef);
|
||||
}
|
||||
|
|
|
|||
2
third_party/aom/av1/common/restoration.h
vendored
2
third_party/aom/av1/common/restoration.h
vendored
|
|
@ -346,7 +346,7 @@ void av1_foreach_rest_unit_in_plane(const struct AV1Common *cm, int plane,
|
|||
int av1_loop_restoration_corners_in_sb(const struct AV1Common *cm, int plane,
|
||||
int mi_row, int mi_col, BLOCK_SIZE bsize,
|
||||
int *rcol0, int *rcol1, int *rrow0,
|
||||
int *rrow1, int *tile_tl_idx);
|
||||
int *rrow1);
|
||||
|
||||
void av1_loop_restoration_save_boundary_lines(const YV12_BUFFER_CONFIG *frame,
|
||||
struct AV1Common *cm,
|
||||
|
|
|
|||
7
third_party/aom/av1/common/scan.h
vendored
7
third_party/aom/av1/common/scan.h
vendored
|
|
@ -39,13 +39,6 @@ extern const SCAN_ORDER av1_scan_orders[TX_SIZES_ALL][TX_TYPES];
|
|||
|
||||
void av1_deliver_eob_threshold(const AV1_COMMON *cm, MACROBLOCKD *xd);
|
||||
|
||||
static INLINE int get_coef_context(const int16_t *neighbors,
|
||||
const uint8_t *token_cache, int c) {
|
||||
return (1 + token_cache[neighbors[MAX_NEIGHBORS * c + 0]] +
|
||||
token_cache[neighbors[MAX_NEIGHBORS * c + 1]]) >>
|
||||
1;
|
||||
}
|
||||
|
||||
static INLINE const SCAN_ORDER *get_default_scan(TX_SIZE tx_size,
|
||||
TX_TYPE tx_type) {
|
||||
return &av1_scan_orders[tx_size][tx_type];
|
||||
|
|
|
|||
2
third_party/aom/av1/common/thread_common.c
vendored
2
third_party/aom/av1/common/thread_common.c
vendored
|
|
@ -572,7 +572,7 @@ static void enqueue_lr_jobs(AV1LrSync *lr_sync, AV1LrStruct *lr_ctxt,
|
|||
for (int plane = 0; plane < num_planes; plane++) {
|
||||
if (cm->rst_info[plane].frame_restoration_type == RESTORE_NONE) continue;
|
||||
const int is_uv = plane > 0;
|
||||
const int ss_y = is_uv && cm->subsampling_y;
|
||||
const int ss_y = is_uv && cm->seq_params.subsampling_y;
|
||||
|
||||
AV1PixelRect tile_rect = ctxt[plane].tile_rect;
|
||||
const int unit_size = ctxt[plane].rsi->restoration_unit_size;
|
||||
|
|
|
|||
4
third_party/aom/av1/common/tile_common.c
vendored
4
third_party/aom/av1/common/tile_common.c
vendored
|
|
@ -179,8 +179,8 @@ AV1PixelRect av1_get_tile_rect(const TileInfo *tile_info, const AV1_COMMON *cm,
|
|||
r.bottom = AOMMIN(r.bottom, frame_h);
|
||||
|
||||
// Convert to coordinates in the appropriate plane
|
||||
const int ss_x = is_uv && cm->subsampling_x;
|
||||
const int ss_y = is_uv && cm->subsampling_y;
|
||||
const int ss_x = is_uv && cm->seq_params.subsampling_x;
|
||||
const int ss_y = is_uv && cm->seq_params.subsampling_y;
|
||||
|
||||
r.left = ROUND_POWER_OF_TWO(r.left, ss_x);
|
||||
r.right = ROUND_POWER_OF_TWO(r.right, ss_x);
|
||||
|
|
|
|||
4
third_party/aom/av1/common/timing.c
vendored
4
third_party/aom/av1/common/timing.c
vendored
|
|
@ -53,8 +53,8 @@ int64_t max_level_bitrate(BITSTREAM_PROFILE seq_profile, int seq_level_idx,
|
|||
|
||||
void set_aom_dec_model_info(aom_dec_model_info_t *decoder_model) {
|
||||
decoder_model->encoder_decoder_buffer_delay_length = 16;
|
||||
decoder_model->buffer_removal_delay_length = 10;
|
||||
decoder_model->frame_presentation_delay_length = 10;
|
||||
decoder_model->buffer_removal_time_length = 10;
|
||||
decoder_model->frame_presentation_time_length = 10;
|
||||
}
|
||||
|
||||
void set_dec_model_op_parameters(aom_dec_model_op_parameters_t *op_params) {
|
||||
|
|
|
|||
10
third_party/aom/av1/common/timing.h
vendored
10
third_party/aom/av1/common/timing.h
vendored
|
|
@ -27,23 +27,23 @@ typedef struct aom_timing {
|
|||
typedef struct aom_dec_model_info {
|
||||
uint32_t num_units_in_decoding_tick;
|
||||
int encoder_decoder_buffer_delay_length;
|
||||
int buffer_removal_delay_length;
|
||||
int frame_presentation_delay_length;
|
||||
int buffer_removal_time_length;
|
||||
int frame_presentation_time_length;
|
||||
} aom_dec_model_info_t;
|
||||
|
||||
typedef struct aom_dec_model_op_parameters {
|
||||
int decoder_model_param_present_flag;
|
||||
int64_t bitrate;
|
||||
int64_t buffer_size;
|
||||
int decoder_buffer_delay;
|
||||
int encoder_buffer_delay;
|
||||
uint32_t decoder_buffer_delay;
|
||||
uint32_t encoder_buffer_delay;
|
||||
int low_delay_mode_flag;
|
||||
int display_model_param_present_flag;
|
||||
int initial_display_delay;
|
||||
} aom_dec_model_op_parameters_t;
|
||||
|
||||
typedef struct aom_op_timing_info_t {
|
||||
int64_t buffer_removal_delay;
|
||||
uint32_t buffer_removal_time;
|
||||
} aom_op_timing_info_t;
|
||||
|
||||
void set_aom_dec_model_info(aom_dec_model_info_t *decoder_model);
|
||||
|
|
|
|||
25
third_party/aom/av1/common/txb_common.h
vendored
25
third_party/aom/av1/common/txb_common.h
vendored
|
|
@ -466,31 +466,6 @@ static AOM_FORCE_INLINE int get_nz_mag(const uint8_t *const levels,
|
|||
return mag;
|
||||
}
|
||||
|
||||
static INLINE int get_nz_count(const uint8_t *const levels, const int bwl,
|
||||
const TX_CLASS tx_class) {
|
||||
int count;
|
||||
|
||||
count = (levels[1] != 0); // { 0, 1 }
|
||||
count += (levels[(1 << bwl) + TX_PAD_HOR] != 0); // { 1, 0 }
|
||||
|
||||
for (int idx = 0; idx < SIG_REF_DIFF_OFFSET_NUM; ++idx) {
|
||||
const int row_offset =
|
||||
((tx_class == TX_CLASS_2D) ? sig_ref_diff_offset[idx][0]
|
||||
: ((tx_class == TX_CLASS_VERT)
|
||||
? sig_ref_diff_offset_vert[idx][0]
|
||||
: sig_ref_diff_offset_horiz[idx][0]));
|
||||
const int col_offset =
|
||||
((tx_class == TX_CLASS_2D) ? sig_ref_diff_offset[idx][1]
|
||||
: ((tx_class == TX_CLASS_VERT)
|
||||
? sig_ref_diff_offset_vert[idx][1]
|
||||
: sig_ref_diff_offset_horiz[idx][1]));
|
||||
const int nb_pos =
|
||||
(row_offset << bwl) + (row_offset << TX_PAD_HOR_LOG2) + col_offset;
|
||||
count += (levels[nb_pos] != 0);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
#define NZ_MAP_CTX_0 SIG_COEF_CONTEXTS_2D
|
||||
#define NZ_MAP_CTX_5 (NZ_MAP_CTX_0 + 5)
|
||||
#define NZ_MAP_CTX_10 (NZ_MAP_CTX_0 + 10)
|
||||
|
|
|
|||
27
third_party/aom/av1/common/warped_motion.c
vendored
27
third_party/aom/av1/common/warped_motion.c
vendored
|
|
@ -92,33 +92,6 @@ static const int error_measure_lut[512] = {
|
|||
};
|
||||
/* clang-format on */
|
||||
|
||||
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) {
|
||||
for (int i = 0; i < n; ++i) {
|
||||
const int x = *(points++), y = *(points++);
|
||||
if (subsampling_x)
|
||||
*(proj++) = ROUND_POWER_OF_TWO_SIGNED(
|
||||
mat[2] * 2 * x + mat[3] * 2 * y + mat[0] +
|
||||
(mat[2] + mat[3] - (1 << WARPEDMODEL_PREC_BITS)) / 2,
|
||||
WARPEDDIFF_PREC_BITS + 1);
|
||||
else
|
||||
*(proj++) = ROUND_POWER_OF_TWO_SIGNED(mat[2] * x + mat[3] * y + mat[0],
|
||||
WARPEDDIFF_PREC_BITS);
|
||||
if (subsampling_y)
|
||||
*(proj++) = ROUND_POWER_OF_TWO_SIGNED(
|
||||
mat[4] * 2 * x + mat[5] * 2 * y + mat[1] +
|
||||
(mat[4] + mat[5] - (1 << WARPEDMODEL_PREC_BITS)) / 2,
|
||||
WARPEDDIFF_PREC_BITS + 1);
|
||||
else
|
||||
*(proj++) = ROUND_POWER_OF_TWO_SIGNED(mat[4] * x + mat[5] * y + mat[1],
|
||||
WARPEDDIFF_PREC_BITS);
|
||||
points += stride_points - 2;
|
||||
proj += stride_proj - 2;
|
||||
}
|
||||
}
|
||||
|
||||
// For warping, we really use a 6-tap filter, but we do blocks of 8 pixels
|
||||
// at a time. The zoom/rotation/shear in the model are applied to the
|
||||
// "fractional" position of each pixel, which therefore varies within
|
||||
|
|
|
|||
5
third_party/aom/av1/common/warped_motion.h
vendored
5
third_party/aom/av1/common/warped_motion.h
vendored
|
|
@ -68,11 +68,6 @@ static const uint8_t warp_pad_right[14][16] = {
|
|||
{ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
|
||||
};
|
||||
|
||||
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);
|
||||
|
||||
// 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, int use_hbd, int bd,
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ static void hfilter8(const uint8_t *src, int src_stride, int16_t *dst, int w,
|
|||
const int filter_idx = (x_qn & SCALE_SUBPEL_MASK) >> SCALE_EXTRA_BITS;
|
||||
assert(filter_idx < SUBPEL_SHIFTS);
|
||||
const int16_t *filter =
|
||||
av1_get_interp_filter_subpel_kernel(*filter_params, filter_idx);
|
||||
av1_get_interp_filter_subpel_kernel(filter_params, filter_idx);
|
||||
|
||||
// Load the filter coefficients
|
||||
const __m128i coefflo = _mm_loadu_si128((__m128i *)filter);
|
||||
|
|
@ -140,7 +140,7 @@ static void vfilter8(const int16_t *src, int src_stride, uint8_t *dst,
|
|||
const int filter_idx = (y_qn & SCALE_SUBPEL_MASK) >> SCALE_EXTRA_BITS;
|
||||
assert(filter_idx < SUBPEL_SHIFTS);
|
||||
const int16_t *filter =
|
||||
av1_get_interp_filter_subpel_kernel(*filter_params, filter_idx);
|
||||
av1_get_interp_filter_subpel_kernel(filter_params, filter_idx);
|
||||
|
||||
const __m128i coeff0716 = _mm_loadu_si128((__m128i *)filter);
|
||||
int x;
|
||||
|
|
@ -232,8 +232,8 @@ static void vfilter8(const int16_t *src, int src_stride, uint8_t *dst,
|
|||
}
|
||||
void av1_convolve_2d_scale_sse4_1(const uint8_t *src, int src_stride,
|
||||
uint8_t *dst8, int dst8_stride, int w, int h,
|
||||
InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y,
|
||||
const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y,
|
||||
const int subpel_x_qn, const int x_step_qn,
|
||||
const int subpel_y_qn, const int y_step_qn,
|
||||
ConvolveParams *conv_params) {
|
||||
|
|
@ -278,7 +278,7 @@ static void highbd_hfilter8(const uint16_t *src, int src_stride, int16_t *dst,
|
|||
const int filter_idx = (x_qn & SCALE_SUBPEL_MASK) >> SCALE_EXTRA_BITS;
|
||||
assert(filter_idx < SUBPEL_SHIFTS);
|
||||
const int16_t *filter =
|
||||
av1_get_interp_filter_subpel_kernel(*filter_params, filter_idx);
|
||||
av1_get_interp_filter_subpel_kernel(filter_params, filter_idx);
|
||||
|
||||
// Load the filter coefficients
|
||||
const __m128i coefflo = _mm_loadu_si128((__m128i *)filter);
|
||||
|
|
@ -372,7 +372,7 @@ static void highbd_vfilter8(const int16_t *src, int src_stride, uint16_t *dst,
|
|||
const int filter_idx = (y_qn & SCALE_SUBPEL_MASK) >> SCALE_EXTRA_BITS;
|
||||
assert(filter_idx < SUBPEL_SHIFTS);
|
||||
const int16_t *filter =
|
||||
av1_get_interp_filter_subpel_kernel(*filter_params, filter_idx);
|
||||
av1_get_interp_filter_subpel_kernel(filter_params, filter_idx);
|
||||
|
||||
const __m128i coeff0716 = _mm_loadu_si128((__m128i *)filter);
|
||||
int x;
|
||||
|
|
@ -472,8 +472,8 @@ static void highbd_vfilter8(const int16_t *src, int src_stride, uint16_t *dst,
|
|||
|
||||
void av1_highbd_convolve_2d_scale_sse4_1(
|
||||
const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w,
|
||||
int h, InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y, const int subpel_x_qn,
|
||||
int h, const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y, const int subpel_x_qn,
|
||||
const int x_step_qn, const int subpel_y_qn, const int y_step_qn,
|
||||
ConvolveParams *conv_params, int bd) {
|
||||
// TODO(yaowu): Move this out of stack
|
||||
|
|
|
|||
1052
third_party/aom/av1/common/x86/av1_inv_txfm_avx2.c
vendored
1052
third_party/aom/av1/common/x86/av1_inv_txfm_avx2.c
vendored
File diff suppressed because it is too large
Load diff
141
third_party/aom/av1/common/x86/av1_inv_txfm_avx2.h
vendored
141
third_party/aom/av1/common/x86/av1_inv_txfm_avx2.h
vendored
|
|
@ -19,37 +19,12 @@
|
|||
#include "aom/aom_integer.h"
|
||||
#include "aom_dsp/x86/transpose_sse2.h"
|
||||
#include "aom_dsp/x86/txfm_common_sse2.h"
|
||||
#include "aom_dsp/x86/txfm_common_avx2.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define pair_set_w16_epi16(a, b) \
|
||||
_mm256_set1_epi32((int32_t)(((uint16_t)(a)) | (((uint32_t)(b)) << 16)))
|
||||
|
||||
#define btf_16_w16_avx2(w0, w1, in0, in1, out0, out1) \
|
||||
{ \
|
||||
__m256i t0 = _mm256_unpacklo_epi16(in0, in1); \
|
||||
__m256i t1 = _mm256_unpackhi_epi16(in0, in1); \
|
||||
__m256i u0 = _mm256_madd_epi16(t0, w0); \
|
||||
__m256i u1 = _mm256_madd_epi16(t1, w0); \
|
||||
__m256i v0 = _mm256_madd_epi16(t0, w1); \
|
||||
__m256i v1 = _mm256_madd_epi16(t1, w1); \
|
||||
\
|
||||
__m256i a0 = _mm256_add_epi32(u0, __rounding); \
|
||||
__m256i a1 = _mm256_add_epi32(u1, __rounding); \
|
||||
__m256i b0 = _mm256_add_epi32(v0, __rounding); \
|
||||
__m256i b1 = _mm256_add_epi32(v1, __rounding); \
|
||||
\
|
||||
__m256i c0 = _mm256_srai_epi32(a0, cos_bit); \
|
||||
__m256i c1 = _mm256_srai_epi32(a1, cos_bit); \
|
||||
__m256i d0 = _mm256_srai_epi32(b0, cos_bit); \
|
||||
__m256i d1 = _mm256_srai_epi32(b1, cos_bit); \
|
||||
\
|
||||
out0 = _mm256_packs_epi32(c0, c1); \
|
||||
out1 = _mm256_packs_epi32(d0, d1); \
|
||||
}
|
||||
|
||||
// half input is zero
|
||||
#define btf_16_w16_0_avx2(w0, w1, in, out0, out1) \
|
||||
{ \
|
||||
|
|
@ -60,111 +35,6 @@ extern "C" {
|
|||
out1 = _mm256_mulhrs_epi16(_in, _w1); \
|
||||
}
|
||||
|
||||
#define btf_16_adds_subs_avx2(in0, in1) \
|
||||
{ \
|
||||
const __m256i _in0 = in0; \
|
||||
const __m256i _in1 = in1; \
|
||||
in0 = _mm256_adds_epi16(_in0, _in1); \
|
||||
in1 = _mm256_subs_epi16(_in0, _in1); \
|
||||
}
|
||||
|
||||
#define btf_16_subs_adds_avx2(in0, in1) \
|
||||
{ \
|
||||
const __m256i _in0 = in0; \
|
||||
const __m256i _in1 = in1; \
|
||||
in1 = _mm256_subs_epi16(_in0, _in1); \
|
||||
in0 = _mm256_adds_epi16(_in0, _in1); \
|
||||
}
|
||||
|
||||
#define btf_16_adds_subs_out_avx2(out0, out1, in0, in1) \
|
||||
{ \
|
||||
const __m256i _in0 = in0; \
|
||||
const __m256i _in1 = in1; \
|
||||
out0 = _mm256_adds_epi16(_in0, _in1); \
|
||||
out1 = _mm256_subs_epi16(_in0, _in1); \
|
||||
}
|
||||
|
||||
static INLINE __m256i load_32bit_to_16bit_w16_avx2(const int32_t *a) {
|
||||
const __m256i a_low = _mm256_lddqu_si256((const __m256i *)a);
|
||||
const __m256i b = _mm256_packs_epi32(a_low, *(const __m256i *)(a + 8));
|
||||
return _mm256_permute4x64_epi64(b, 0xD8);
|
||||
}
|
||||
|
||||
static INLINE void load_buffer_32bit_to_16bit_w16_avx2(const int32_t *in,
|
||||
int stride, __m256i *out,
|
||||
int out_size) {
|
||||
for (int i = 0; i < out_size; ++i) {
|
||||
out[i] = load_32bit_to_16bit_w16_avx2(in + i * stride);
|
||||
}
|
||||
}
|
||||
|
||||
static INLINE void transpose_16bit_16x16_avx2(const __m256i *const in,
|
||||
__m256i *const out) {
|
||||
// Unpack 16 bit elements. Goes from:
|
||||
// in[0]: 00 01 02 03 08 09 0a 0b 04 05 06 07 0c 0d 0e 0f
|
||||
// in[1]: 10 11 12 13 18 19 1a 1b 14 15 16 17 1c 1d 1e 1f
|
||||
// in[2]: 20 21 22 23 28 29 2a 2b 24 25 26 27 2c 2d 2e 2f
|
||||
// in[3]: 30 31 32 33 38 39 3a 3b 34 35 36 37 3c 3d 3e 3f
|
||||
// in[4]: 40 41 42 43 48 49 4a 4b 44 45 46 47 4c 4d 4e 4f
|
||||
// in[5]: 50 51 52 53 58 59 5a 5b 54 55 56 57 5c 5d 5e 5f
|
||||
// in[6]: 60 61 62 63 68 69 6a 6b 64 65 66 67 6c 6d 6e 6f
|
||||
// in[7]: 70 71 72 73 78 79 7a 7b 74 75 76 77 7c 7d 7e 7f
|
||||
// in[8]: 80 81 82 83 88 89 8a 8b 84 85 86 87 8c 8d 8e 8f
|
||||
// to:
|
||||
// a0: 00 10 01 11 02 12 03 13 04 14 05 15 06 16 07 17
|
||||
// a1: 20 30 21 31 22 32 23 33 24 34 25 35 26 36 27 37
|
||||
// a2: 40 50 41 51 42 52 43 53 44 54 45 55 46 56 47 57
|
||||
// a3: 60 70 61 71 62 72 63 73 64 74 65 75 66 76 67 77
|
||||
// ...
|
||||
__m256i a[16];
|
||||
for (int i = 0; i < 16; i += 2) {
|
||||
a[i / 2 + 0] = _mm256_unpacklo_epi16(in[i], in[i + 1]);
|
||||
a[i / 2 + 8] = _mm256_unpackhi_epi16(in[i], in[i + 1]);
|
||||
}
|
||||
__m256i b[16];
|
||||
for (int i = 0; i < 16; i += 2) {
|
||||
b[i / 2 + 0] = _mm256_unpacklo_epi32(a[i], a[i + 1]);
|
||||
b[i / 2 + 8] = _mm256_unpackhi_epi32(a[i], a[i + 1]);
|
||||
}
|
||||
__m256i c[16];
|
||||
for (int i = 0; i < 16; i += 2) {
|
||||
c[i / 2 + 0] = _mm256_unpacklo_epi64(b[i], b[i + 1]);
|
||||
c[i / 2 + 8] = _mm256_unpackhi_epi64(b[i], b[i + 1]);
|
||||
}
|
||||
out[0 + 0] = _mm256_permute2x128_si256(c[0], c[1], 0x20);
|
||||
out[1 + 0] = _mm256_permute2x128_si256(c[8], c[9], 0x20);
|
||||
out[2 + 0] = _mm256_permute2x128_si256(c[4], c[5], 0x20);
|
||||
out[3 + 0] = _mm256_permute2x128_si256(c[12], c[13], 0x20);
|
||||
|
||||
out[0 + 8] = _mm256_permute2x128_si256(c[0], c[1], 0x31);
|
||||
out[1 + 8] = _mm256_permute2x128_si256(c[8], c[9], 0x31);
|
||||
out[2 + 8] = _mm256_permute2x128_si256(c[4], c[5], 0x31);
|
||||
out[3 + 8] = _mm256_permute2x128_si256(c[12], c[13], 0x31);
|
||||
|
||||
out[4 + 0] = _mm256_permute2x128_si256(c[0 + 2], c[1 + 2], 0x20);
|
||||
out[5 + 0] = _mm256_permute2x128_si256(c[8 + 2], c[9 + 2], 0x20);
|
||||
out[6 + 0] = _mm256_permute2x128_si256(c[4 + 2], c[5 + 2], 0x20);
|
||||
out[7 + 0] = _mm256_permute2x128_si256(c[12 + 2], c[13 + 2], 0x20);
|
||||
|
||||
out[4 + 8] = _mm256_permute2x128_si256(c[0 + 2], c[1 + 2], 0x31);
|
||||
out[5 + 8] = _mm256_permute2x128_si256(c[8 + 2], c[9 + 2], 0x31);
|
||||
out[6 + 8] = _mm256_permute2x128_si256(c[4 + 2], c[5 + 2], 0x31);
|
||||
out[7 + 8] = _mm256_permute2x128_si256(c[12 + 2], c[13 + 2], 0x31);
|
||||
}
|
||||
|
||||
static INLINE void round_shift_16bit_w16_avx2(__m256i *in, int size, int bit) {
|
||||
if (bit < 0) {
|
||||
__m256i scale = _mm256_set1_epi16(1 << (bit + 15));
|
||||
for (int i = 0; i < size; ++i) {
|
||||
in[i] = _mm256_mulhrs_epi16(in[i], scale);
|
||||
}
|
||||
} else if (bit > 0) {
|
||||
for (int i = 0; i < size; ++i) {
|
||||
in[i] = _mm256_slli_epi16(in[i], bit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static INLINE void round_shift_avx2(const __m256i *input, __m256i *output,
|
||||
int size) {
|
||||
const __m256i scale = _mm256_set1_epi16(NewInvSqrt2 * 8);
|
||||
|
|
@ -173,12 +43,6 @@ static INLINE void round_shift_avx2(const __m256i *input, __m256i *output,
|
|||
}
|
||||
}
|
||||
|
||||
static INLINE void flip_buf_av2(__m256i *in, __m256i *out, int size) {
|
||||
for (int i = 0; i < size; ++i) {
|
||||
out[size - i - 1] = in[i];
|
||||
}
|
||||
}
|
||||
|
||||
static INLINE void write_recon_w16_avx2(__m256i res, uint8_t *output) {
|
||||
__m128i pred = _mm_loadu_si128((__m128i const *)(output));
|
||||
__m256i u = _mm256_adds_epi16(_mm256_cvtepu8_epi16(pred), res);
|
||||
|
|
@ -197,9 +61,6 @@ static INLINE void lowbd_write_buffer_16xn_avx2(__m256i *in, uint8_t *output,
|
|||
}
|
||||
}
|
||||
|
||||
typedef void (*transform_1d_avx2)(const __m256i *input, __m256i *output,
|
||||
int8_t cos_bit);
|
||||
|
||||
void av1_lowbd_inv_txfm2d_add_avx2(const int32_t *input, uint8_t *output,
|
||||
int stride, TX_TYPE tx_type, TX_SIZE tx_size,
|
||||
int eob);
|
||||
|
|
|
|||
11
third_party/aom/av1/common/x86/av1_txfm_sse4.c
vendored
11
third_party/aom/av1/common/x86/av1_txfm_sse4.c
vendored
|
|
@ -1,3 +1,14 @@
|
|||
/*
|
||||
* Copyright (c) 2018, Alliance for Open Media. All rights reserved
|
||||
*
|
||||
* This source code is subject to the terms of the BSD 2 Clause License and
|
||||
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
|
||||
* was not distributed with this source code in the LICENSE file, you can
|
||||
* obtain it at www.aomedia.org/license/software. If the Alliance for Open
|
||||
* Media Patent License 1.0 was not distributed with this source code in the
|
||||
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
|
||||
*/
|
||||
|
||||
#include "config/aom_dsp_rtcd.h"
|
||||
|
||||
#include "av1/common/av1_txfm.h"
|
||||
|
|
|
|||
11
third_party/aom/av1/common/x86/av1_txfm_sse4.h
vendored
11
third_party/aom/av1/common/x86/av1_txfm_sse4.h
vendored
|
|
@ -1,3 +1,14 @@
|
|||
/*
|
||||
* Copyright (c) 2018, Alliance for Open Media. All rights reserved
|
||||
*
|
||||
* This source code is subject to the terms of the BSD 2 Clause License and
|
||||
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
|
||||
* was not distributed with this source code in the LICENSE file, you can
|
||||
* obtain it at www.aomedia.org/license/software. If the Alliance for Open
|
||||
* Media Patent License 1.0 was not distributed with this source code in the
|
||||
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
|
||||
*/
|
||||
|
||||
#ifndef AV1_TXFM_SSE4_H_
|
||||
#define AV1_TXFM_SSE4_H_
|
||||
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@
|
|||
|
||||
void av1_convolve_2d_sr_avx2(const uint8_t *src, int src_stride, uint8_t *dst,
|
||||
int dst_stride, int w, int h,
|
||||
InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y,
|
||||
const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y,
|
||||
const int subpel_x_q4, const int subpel_y_q4,
|
||||
ConvolveParams *conv_params) {
|
||||
const int bd = 8;
|
||||
|
|
@ -46,10 +46,10 @@ void av1_convolve_2d_sr_avx2(const uint8_t *src, int src_stride, uint8_t *dst,
|
|||
|
||||
assert(conv_params->round_0 > 0);
|
||||
|
||||
filt[0] = _mm256_load_si256((__m256i const *)filt1_global_avx2);
|
||||
filt[1] = _mm256_load_si256((__m256i const *)filt2_global_avx2);
|
||||
filt[2] = _mm256_load_si256((__m256i const *)filt3_global_avx2);
|
||||
filt[3] = _mm256_load_si256((__m256i const *)filt4_global_avx2);
|
||||
filt[0] = _mm256_load_si256((__m256i const *)filt_global_avx2);
|
||||
filt[1] = _mm256_load_si256((__m256i const *)(filt_global_avx2 + 32));
|
||||
filt[2] = _mm256_load_si256((__m256i const *)(filt_global_avx2 + 32 * 2));
|
||||
filt[3] = _mm256_load_si256((__m256i const *)(filt_global_avx2 + 32 * 3));
|
||||
|
||||
prepare_coeffs_lowbd(filter_params_x, subpel_x_q4, coeffs_h);
|
||||
prepare_coeffs(filter_params_y, subpel_y_q4, coeffs_v);
|
||||
|
|
@ -180,8 +180,8 @@ static INLINE void copy_128(const uint8_t *src, uint8_t *dst) {
|
|||
|
||||
void av1_convolve_2d_copy_sr_avx2(const uint8_t *src, int src_stride,
|
||||
uint8_t *dst, int dst_stride, int w, int h,
|
||||
InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y,
|
||||
const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y,
|
||||
const int subpel_x_q4, const int subpel_y_q4,
|
||||
ConvolveParams *conv_params) {
|
||||
(void)filter_params_x;
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@
|
|||
|
||||
void av1_convolve_2d_sr_sse2(const uint8_t *src, int src_stride, uint8_t *dst,
|
||||
int dst_stride, int w, int h,
|
||||
InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y,
|
||||
const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y,
|
||||
const int subpel_x_q4, const int subpel_y_q4,
|
||||
ConvolveParams *conv_params) {
|
||||
const int bd = 8;
|
||||
|
|
@ -46,7 +46,7 @@ void av1_convolve_2d_sr_sse2(const uint8_t *src, int src_stride, uint8_t *dst,
|
|||
/* Horizontal filter */
|
||||
{
|
||||
const int16_t *x_filter = av1_get_interp_filter_subpel_kernel(
|
||||
*filter_params_x, subpel_x_q4 & SUBPEL_MASK);
|
||||
filter_params_x, subpel_x_q4 & SUBPEL_MASK);
|
||||
const __m128i coeffs_x = _mm_loadu_si128((__m128i *)x_filter);
|
||||
|
||||
// coeffs 0 1 0 1 2 3 2 3
|
||||
|
|
@ -112,7 +112,7 @@ void av1_convolve_2d_sr_sse2(const uint8_t *src, int src_stride, uint8_t *dst,
|
|||
/* Vertical filter */
|
||||
{
|
||||
const int16_t *y_filter = av1_get_interp_filter_subpel_kernel(
|
||||
*filter_params_y, subpel_y_q4 & SUBPEL_MASK);
|
||||
filter_params_y, subpel_y_q4 & SUBPEL_MASK);
|
||||
const __m128i coeffs_y = _mm_loadu_si128((__m128i *)y_filter);
|
||||
|
||||
// coeffs 0 1 0 1 2 3 2 3
|
||||
|
|
@ -239,8 +239,8 @@ static INLINE void copy_128(const uint8_t *src, uint8_t *dst) {
|
|||
|
||||
void av1_convolve_2d_copy_sr_sse2(const uint8_t *src, int src_stride,
|
||||
uint8_t *dst, int dst_stride, int w, int h,
|
||||
InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y,
|
||||
const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y,
|
||||
const int subpel_x_q4, const int subpel_y_q4,
|
||||
ConvolveParams *conv_params) {
|
||||
(void)filter_params_x;
|
||||
|
|
@ -357,8 +357,8 @@ void av1_convolve_2d_copy_sr_sse2(const uint8_t *src, int src_stride,
|
|||
|
||||
void av1_jnt_convolve_2d_copy_sse2(const uint8_t *src, int src_stride,
|
||||
uint8_t *dst0, int dst_stride0, int w, int h,
|
||||
InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y,
|
||||
const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y,
|
||||
const int subpel_x_q4, const int subpel_y_q4,
|
||||
ConvolveParams *conv_params) {
|
||||
const int bd = 8;
|
||||
|
|
|
|||
16
third_party/aom/av1/common/x86/convolve_avx2.c
vendored
16
third_party/aom/av1/common/x86/convolve_avx2.c
vendored
|
|
@ -19,8 +19,8 @@
|
|||
|
||||
void av1_convolve_y_sr_avx2(const uint8_t *src, int src_stride, uint8_t *dst,
|
||||
int dst_stride, int w, int h,
|
||||
InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y,
|
||||
const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y,
|
||||
const int subpel_x_q4, const int subpel_y_q4,
|
||||
ConvolveParams *conv_params) {
|
||||
int i, j;
|
||||
|
|
@ -176,8 +176,8 @@ void av1_convolve_y_sr_avx2(const uint8_t *src, int src_stride, uint8_t *dst,
|
|||
|
||||
void av1_convolve_x_sr_avx2(const uint8_t *src, int src_stride, uint8_t *dst,
|
||||
int dst_stride, int w, int h,
|
||||
InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y,
|
||||
const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y,
|
||||
const int subpel_x_q4, const int subpel_y_q4,
|
||||
ConvolveParams *conv_params) {
|
||||
int i, j;
|
||||
|
|
@ -187,10 +187,10 @@ void av1_convolve_x_sr_avx2(const uint8_t *src, int src_stride, uint8_t *dst,
|
|||
|
||||
__m256i filt[4], coeffs[4];
|
||||
|
||||
filt[0] = _mm256_load_si256((__m256i const *)filt1_global_avx2);
|
||||
filt[1] = _mm256_load_si256((__m256i const *)filt2_global_avx2);
|
||||
filt[2] = _mm256_load_si256((__m256i const *)filt3_global_avx2);
|
||||
filt[3] = _mm256_load_si256((__m256i const *)filt4_global_avx2);
|
||||
filt[0] = _mm256_load_si256((__m256i const *)filt_global_avx2);
|
||||
filt[1] = _mm256_load_si256((__m256i const *)(filt_global_avx2 + 32));
|
||||
filt[2] = _mm256_load_si256((__m256i const *)(filt_global_avx2 + 32 * 2));
|
||||
filt[3] = _mm256_load_si256((__m256i const *)(filt_global_avx2 + 32 * 3));
|
||||
|
||||
prepare_coeffs_lowbd(filter_params_x, subpel_x_q4, coeffs);
|
||||
|
||||
|
|
|
|||
10
third_party/aom/av1/common/x86/convolve_sse2.c
vendored
10
third_party/aom/av1/common/x86/convolve_sse2.c
vendored
|
|
@ -23,7 +23,7 @@ static INLINE void prepare_coeffs(const InterpFilterParams *const filter_params,
|
|||
const int subpel_q4,
|
||||
__m128i *const coeffs /* [4] */) {
|
||||
const int16_t *const y_filter = av1_get_interp_filter_subpel_kernel(
|
||||
*filter_params, subpel_q4 & SUBPEL_MASK);
|
||||
filter_params, subpel_q4 & SUBPEL_MASK);
|
||||
const __m128i coeffs_y = _mm_loadu_si128((__m128i *)y_filter);
|
||||
// coeffs 0 1 0 1 2 3 2 3
|
||||
const __m128i tmp_0 = _mm_unpacklo_epi32(coeffs_y, coeffs_y);
|
||||
|
|
@ -78,8 +78,8 @@ static INLINE __m128i convolve_hi_y(const __m128i *const s,
|
|||
|
||||
void av1_convolve_y_sr_sse2(const uint8_t *src, int src_stride,
|
||||
const uint8_t *dst, int dst_stride, int w, int h,
|
||||
InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y,
|
||||
const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y,
|
||||
const int subpel_x_q4, const int subpel_y_q4,
|
||||
ConvolveParams *conv_params) {
|
||||
const int fo_vert = filter_params_y->taps / 2 - 1;
|
||||
|
|
@ -239,8 +239,8 @@ void av1_convolve_y_sr_sse2(const uint8_t *src, int src_stride,
|
|||
|
||||
void av1_convolve_x_sr_sse2(const uint8_t *src, int src_stride,
|
||||
const uint8_t *dst, int dst_stride, int w, int h,
|
||||
InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y,
|
||||
const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y,
|
||||
const int subpel_x_q4, const int subpel_y_q4,
|
||||
ConvolveParams *conv_params) {
|
||||
const int fo_horiz = filter_params_x->taps / 2 - 1;
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@
|
|||
|
||||
void av1_highbd_convolve_2d_sr_avx2(const uint16_t *src, int src_stride,
|
||||
uint16_t *dst, int dst_stride, int w, int h,
|
||||
InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y,
|
||||
const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y,
|
||||
const int subpel_x_q4,
|
||||
const int subpel_y_q4,
|
||||
ConvolveParams *conv_params, int bd) {
|
||||
|
|
@ -222,8 +222,8 @@ static INLINE void copy_128(const uint16_t *src, uint16_t *dst) {
|
|||
|
||||
void av1_highbd_convolve_2d_copy_sr_avx2(
|
||||
const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w,
|
||||
int h, InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y, const int subpel_x_q4,
|
||||
int h, const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y, const int subpel_x_q4,
|
||||
const int subpel_y_q4, ConvolveParams *conv_params, int bd) {
|
||||
(void)filter_params_x;
|
||||
(void)filter_params_y;
|
||||
|
|
|
|||
|
|
@ -73,8 +73,8 @@ static INLINE void copy_128(const uint16_t *src, uint16_t *dst) {
|
|||
|
||||
void av1_highbd_convolve_2d_copy_sr_sse2(
|
||||
const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w,
|
||||
int h, InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y, const int subpel_x_q4,
|
||||
int h, const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y, const int subpel_x_q4,
|
||||
const int subpel_y_q4, ConvolveParams *conv_params, int bd) {
|
||||
(void)filter_params_x;
|
||||
(void)filter_params_y;
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@
|
|||
|
||||
void av1_highbd_jnt_convolve_2d_copy_sse4_1(
|
||||
const uint16_t *src, int src_stride, uint16_t *dst0, int dst_stride0, int w,
|
||||
int h, InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y, const int subpel_x_q4,
|
||||
int h, const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y, const int subpel_x_q4,
|
||||
const int subpel_y_q4, ConvolveParams *conv_params, int bd) {
|
||||
CONV_BUF_TYPE *dst = conv_params->dst;
|
||||
int dst_stride = conv_params->dst_stride;
|
||||
|
|
@ -169,8 +169,8 @@ void av1_highbd_jnt_convolve_2d_copy_sse4_1(
|
|||
|
||||
void av1_highbd_jnt_convolve_2d_sse4_1(
|
||||
const uint16_t *src, int src_stride, uint16_t *dst0, int dst_stride0, int w,
|
||||
int h, InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y, const int subpel_x_q4,
|
||||
int h, const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y, const int subpel_x_q4,
|
||||
const int subpel_y_q4, ConvolveParams *conv_params, int bd) {
|
||||
DECLARE_ALIGNED(16, int16_t,
|
||||
im_block[(MAX_SB_SIZE + MAX_FILTER_TAP - 1) * MAX_SB_SIZE]);
|
||||
|
|
@ -207,7 +207,7 @@ void av1_highbd_jnt_convolve_2d_sse4_1(
|
|||
/* Horizontal filter */
|
||||
{
|
||||
const int16_t *x_filter = av1_get_interp_filter_subpel_kernel(
|
||||
*filter_params_x, subpel_x_q4 & SUBPEL_MASK);
|
||||
filter_params_x, subpel_x_q4 & SUBPEL_MASK);
|
||||
const __m128i coeffs_x = _mm_loadu_si128((__m128i *)x_filter);
|
||||
|
||||
// coeffs 0 1 0 1 2 3 2 3
|
||||
|
|
@ -274,7 +274,7 @@ void av1_highbd_jnt_convolve_2d_sse4_1(
|
|||
/* Vertical filter */
|
||||
{
|
||||
const int16_t *y_filter = av1_get_interp_filter_subpel_kernel(
|
||||
*filter_params_y, subpel_y_q4 & SUBPEL_MASK);
|
||||
filter_params_y, subpel_y_q4 & SUBPEL_MASK);
|
||||
const __m128i coeffs_y = _mm_loadu_si128((__m128i *)y_filter);
|
||||
|
||||
// coeffs 0 1 0 1 2 3 2 3
|
||||
|
|
|
|||
|
|
@ -20,13 +20,11 @@
|
|||
#include "aom_dsp/x86/convolve_sse2.h"
|
||||
#include "av1/common/convolve.h"
|
||||
|
||||
void av1_highbd_convolve_2d_sr_ssse3(const uint16_t *src, int src_stride,
|
||||
uint16_t *dst, int dst_stride, int w,
|
||||
int h, InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y,
|
||||
const int subpel_x_q4,
|
||||
const int subpel_y_q4,
|
||||
ConvolveParams *conv_params, int bd) {
|
||||
void av1_highbd_convolve_2d_sr_ssse3(
|
||||
const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w,
|
||||
int h, const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y, const int subpel_x_q4,
|
||||
const int subpel_y_q4, ConvolveParams *conv_params, int bd) {
|
||||
DECLARE_ALIGNED(32, int16_t, im_block[(MAX_SB_SIZE + MAX_FILTER_TAP) * 8]);
|
||||
int im_h = h + filter_params_y->taps - 1;
|
||||
int im_stride = 8;
|
||||
|
|
|
|||
|
|
@ -25,8 +25,8 @@
|
|||
|
||||
void av1_highbd_jnt_convolve_2d_copy_avx2(
|
||||
const uint16_t *src, int src_stride, uint16_t *dst0, int dst_stride0, int w,
|
||||
int h, InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y, const int subpel_x_q4,
|
||||
int h, const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y, const int subpel_x_q4,
|
||||
const int subpel_y_q4, ConvolveParams *conv_params, int bd) {
|
||||
CONV_BUF_TYPE *dst = conv_params->dst;
|
||||
int dst_stride = conv_params->dst_stride;
|
||||
|
|
@ -224,13 +224,11 @@ void av1_highbd_jnt_convolve_2d_copy_avx2(
|
|||
}
|
||||
}
|
||||
|
||||
void av1_highbd_jnt_convolve_2d_avx2(const uint16_t *src, int src_stride,
|
||||
uint16_t *dst0, int dst_stride0, 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_jnt_convolve_2d_avx2(
|
||||
const uint16_t *src, int src_stride, uint16_t *dst0, int dst_stride0, int w,
|
||||
int h, const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y, const int subpel_x_q4,
|
||||
const int subpel_y_q4, ConvolveParams *conv_params, int bd) {
|
||||
DECLARE_ALIGNED(32, int16_t, im_block[(MAX_SB_SIZE + MAX_FILTER_TAP) * 8]);
|
||||
CONV_BUF_TYPE *dst = conv_params->dst;
|
||||
int dst_stride = conv_params->dst_stride;
|
||||
|
|
@ -459,13 +457,11 @@ void av1_highbd_jnt_convolve_2d_avx2(const uint16_t *src, int src_stride,
|
|||
}
|
||||
}
|
||||
|
||||
void av1_highbd_jnt_convolve_x_avx2(const uint16_t *src, int src_stride,
|
||||
uint16_t *dst0, int dst_stride0, 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_jnt_convolve_x_avx2(
|
||||
const uint16_t *src, int src_stride, uint16_t *dst0, int dst_stride0, int w,
|
||||
int h, const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y, const int subpel_x_q4,
|
||||
const int subpel_y_q4, ConvolveParams *conv_params, int bd) {
|
||||
CONV_BUF_TYPE *dst = conv_params->dst;
|
||||
int dst_stride = conv_params->dst_stride;
|
||||
const int fo_horiz = filter_params_x->taps / 2 - 1;
|
||||
|
|
@ -628,13 +624,11 @@ void av1_highbd_jnt_convolve_x_avx2(const uint16_t *src, int src_stride,
|
|||
}
|
||||
}
|
||||
|
||||
void av1_highbd_jnt_convolve_y_avx2(const uint16_t *src, int src_stride,
|
||||
uint16_t *dst0, int dst_stride0, 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_jnt_convolve_y_avx2(
|
||||
const uint16_t *src, int src_stride, uint16_t *dst0, int dst_stride0, int w,
|
||||
int h, const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y, const int subpel_x_q4,
|
||||
const int subpel_y_q4, ConvolveParams *conv_params, int bd) {
|
||||
CONV_BUF_TYPE *dst = conv_params->dst;
|
||||
int dst_stride = conv_params->dst_stride;
|
||||
const int fo_vert = filter_params_y->taps / 2 - 1;
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@
|
|||
|
||||
void av1_highbd_jnt_convolve_y_sse4_1(
|
||||
const uint16_t *src, int src_stride, uint16_t *dst0, int dst_stride0, int w,
|
||||
int h, InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y, const int subpel_x_q4,
|
||||
int h, const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y, const int subpel_x_q4,
|
||||
const int subpel_y_q4, ConvolveParams *conv_params, int bd) {
|
||||
CONV_BUF_TYPE *dst = conv_params->dst;
|
||||
int dst_stride = conv_params->dst_stride;
|
||||
|
|
@ -259,8 +259,8 @@ void av1_highbd_jnt_convolve_y_sse4_1(
|
|||
|
||||
void av1_highbd_jnt_convolve_x_sse4_1(
|
||||
const uint16_t *src, int src_stride, uint16_t *dst0, int dst_stride0, int w,
|
||||
int h, InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y, const int subpel_x_q4,
|
||||
int h, const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y, const int subpel_x_q4,
|
||||
const int subpel_y_q4, ConvolveParams *conv_params, int bd) {
|
||||
CONV_BUF_TYPE *dst = conv_params->dst;
|
||||
int dst_stride = conv_params->dst_stride;
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@
|
|||
|
||||
void av1_jnt_convolve_x_avx2(const uint8_t *src, int src_stride, uint8_t *dst0,
|
||||
int dst_stride0, int w, int h,
|
||||
InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y,
|
||||
const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y,
|
||||
const int subpel_x_q4, const int subpel_y_q4,
|
||||
ConvolveParams *conv_params) {
|
||||
CONV_BUF_TYPE *dst = conv_params->dst;
|
||||
|
|
@ -53,10 +53,10 @@ void av1_jnt_convolve_x_avx2(const uint8_t *src, int src_stride, uint8_t *dst0,
|
|||
assert(bits >= 0);
|
||||
assert(conv_params->round_0 > 0);
|
||||
|
||||
filt[0] = _mm256_load_si256((__m256i const *)filt1_global_avx2);
|
||||
filt[1] = _mm256_load_si256((__m256i const *)filt2_global_avx2);
|
||||
filt[2] = _mm256_load_si256((__m256i const *)filt3_global_avx2);
|
||||
filt[3] = _mm256_load_si256((__m256i const *)filt4_global_avx2);
|
||||
filt[0] = _mm256_load_si256((__m256i const *)filt_global_avx2);
|
||||
filt[1] = _mm256_load_si256((__m256i const *)(filt_global_avx2 + 32));
|
||||
filt[2] = _mm256_load_si256((__m256i const *)(filt_global_avx2 + 32 * 2));
|
||||
filt[3] = _mm256_load_si256((__m256i const *)(filt_global_avx2 + 32 * 3));
|
||||
|
||||
prepare_coeffs_lowbd(filter_params_x, subpel_x_q4, coeffs);
|
||||
|
||||
|
|
@ -126,8 +126,8 @@ void av1_jnt_convolve_x_avx2(const uint8_t *src, int src_stride, uint8_t *dst0,
|
|||
|
||||
void av1_jnt_convolve_y_avx2(const uint8_t *src, int src_stride, uint8_t *dst0,
|
||||
int dst_stride0, int w, int h,
|
||||
InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y,
|
||||
const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y,
|
||||
const int subpel_x_q4, const int subpel_y_q4,
|
||||
ConvolveParams *conv_params) {
|
||||
CONV_BUF_TYPE *dst = conv_params->dst;
|
||||
|
|
@ -389,8 +389,8 @@ void av1_jnt_convolve_y_avx2(const uint8_t *src, int src_stride, uint8_t *dst0,
|
|||
|
||||
void av1_jnt_convolve_2d_avx2(const uint8_t *src, int src_stride, uint8_t *dst0,
|
||||
int dst_stride0, int w, int h,
|
||||
InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y,
|
||||
const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y,
|
||||
const int subpel_x_q4, const int subpel_y_q4,
|
||||
ConvolveParams *conv_params) {
|
||||
CONV_BUF_TYPE *dst = conv_params->dst;
|
||||
|
|
@ -422,10 +422,10 @@ void av1_jnt_convolve_2d_avx2(const uint8_t *src, int src_stride, uint8_t *dst0,
|
|||
|
||||
assert(conv_params->round_0 > 0);
|
||||
|
||||
filt[0] = _mm256_load_si256((__m256i const *)filt1_global_avx2);
|
||||
filt[1] = _mm256_load_si256((__m256i const *)filt2_global_avx2);
|
||||
filt[2] = _mm256_load_si256((__m256i const *)filt3_global_avx2);
|
||||
filt[3] = _mm256_load_si256((__m256i const *)filt4_global_avx2);
|
||||
filt[0] = _mm256_load_si256((__m256i const *)filt_global_avx2);
|
||||
filt[1] = _mm256_load_si256((__m256i const *)(filt_global_avx2 + 32));
|
||||
filt[2] = _mm256_load_si256((__m256i const *)(filt_global_avx2 + 32 * 2));
|
||||
filt[3] = _mm256_load_si256((__m256i const *)(filt_global_avx2 + 32 * 3));
|
||||
|
||||
prepare_coeffs_lowbd(filter_params_x, subpel_x_q4, coeffs_x);
|
||||
prepare_coeffs(filter_params_y, subpel_y_q4, coeffs_y);
|
||||
|
|
@ -581,8 +581,8 @@ void av1_jnt_convolve_2d_avx2(const uint8_t *src, int src_stride, uint8_t *dst0,
|
|||
|
||||
void av1_jnt_convolve_2d_copy_avx2(const uint8_t *src, int src_stride,
|
||||
uint8_t *dst0, int dst_stride0, int w, int h,
|
||||
InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y,
|
||||
const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y,
|
||||
const int subpel_x_q4, const int subpel_y_q4,
|
||||
ConvolveParams *conv_params) {
|
||||
const int bd = 8;
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@
|
|||
|
||||
void av1_jnt_convolve_x_sse2(const uint8_t *src, int src_stride, uint8_t *dst0,
|
||||
int dst_stride0, int w, int h,
|
||||
InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y,
|
||||
const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y,
|
||||
const int subpel_x_q4, const int subpel_y_q4,
|
||||
ConvolveParams *conv_params) {
|
||||
const int bd = 8;
|
||||
|
|
@ -152,8 +152,8 @@ void av1_jnt_convolve_x_sse2(const uint8_t *src, int src_stride, uint8_t *dst0,
|
|||
|
||||
void av1_jnt_convolve_y_sse2(const uint8_t *src, int src_stride, uint8_t *dst0,
|
||||
int dst_stride0, int w, int h,
|
||||
InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y,
|
||||
const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y,
|
||||
const int subpel_x_q4, const int subpel_y_q4,
|
||||
ConvolveParams *conv_params) {
|
||||
const int bd = 8;
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@
|
|||
|
||||
void av1_jnt_convolve_2d_ssse3(const uint8_t *src, int src_stride,
|
||||
uint8_t *dst0, int dst_stride0, int w, int h,
|
||||
InterpFilterParams *filter_params_x,
|
||||
InterpFilterParams *filter_params_y,
|
||||
const InterpFilterParams *filter_params_x,
|
||||
const InterpFilterParams *filter_params_y,
|
||||
const int subpel_x_q4, const int subpel_y_q4,
|
||||
ConvolveParams *conv_params) {
|
||||
CONV_BUF_TYPE *dst = conv_params->dst;
|
||||
|
|
@ -56,7 +56,7 @@ void av1_jnt_convolve_2d_ssse3(const uint8_t *src, int src_stride,
|
|||
/* Horizontal filter */
|
||||
{
|
||||
const int16_t *x_filter = av1_get_interp_filter_subpel_kernel(
|
||||
*filter_params_x, subpel_x_q4 & SUBPEL_MASK);
|
||||
filter_params_x, subpel_x_q4 & SUBPEL_MASK);
|
||||
const __m128i coeffs_x = _mm_loadu_si128((__m128i *)x_filter);
|
||||
|
||||
// coeffs 0 1 0 1 2 3 2 3
|
||||
|
|
@ -124,7 +124,7 @@ void av1_jnt_convolve_2d_ssse3(const uint8_t *src, int src_stride,
|
|||
/* Vertical filter */
|
||||
{
|
||||
const int16_t *y_filter = av1_get_interp_filter_subpel_kernel(
|
||||
*filter_params_y, subpel_y_q4 & SUBPEL_MASK);
|
||||
filter_params_y, subpel_y_q4 & SUBPEL_MASK);
|
||||
const __m128i coeffs_y = _mm_loadu_si128((__m128i *)y_filter);
|
||||
|
||||
// coeffs 0 1 0 1 2 3 2 3
|
||||
|
|
|
|||
11
third_party/aom/av1/common/x86/selfguided_sse4.c
vendored
11
third_party/aom/av1/common/x86/selfguided_sse4.c
vendored
|
|
@ -1,3 +1,14 @@
|
|||
/*
|
||||
* Copyright (c) 2018, Alliance for Open Media. All rights reserved
|
||||
*
|
||||
* This source code is subject to the terms of the BSD 2 Clause License and
|
||||
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
|
||||
* was not distributed with this source code in the LICENSE file, you can
|
||||
* obtain it at www.aomedia.org/license/software. If the Alliance for Open
|
||||
* Media Patent License 1.0 was not distributed with this source code in the
|
||||
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
|
||||
*/
|
||||
|
||||
#include <smmintrin.h>
|
||||
|
||||
#include "config/aom_config.h"
|
||||
|
|
|
|||
1742
third_party/aom/av1/decoder/decodeframe.c
vendored
1742
third_party/aom/av1/decoder/decodeframe.c
vendored
File diff suppressed because it is too large
Load diff
29
third_party/aom/av1/decoder/decodeframe.h
vendored
29
third_party/aom/av1/decoder/decodeframe.h
vendored
|
|
@ -18,12 +18,13 @@ extern "C" {
|
|||
|
||||
struct AV1Decoder;
|
||||
struct aom_read_bit_buffer;
|
||||
struct ThreadData;
|
||||
|
||||
// Reads the middle part of the sequence header OBU (from
|
||||
// frame_width_bits_minus_1 to enable_restoration) into cm->seq_params (a
|
||||
// SequenceHeader). Reports errors by calling rb->error_handler() or
|
||||
// aom_internal_error().
|
||||
void read_sequence_header(AV1_COMMON *cm, struct aom_read_bit_buffer *rb);
|
||||
// frame_width_bits_minus_1 to enable_restoration) into seq_params.
|
||||
// Reports errors by calling rb->error_handler() or aom_internal_error().
|
||||
void av1_read_sequence_header(AV1_COMMON *cm, struct aom_read_bit_buffer *rb,
|
||||
SequenceHeader *seq_params);
|
||||
|
||||
void av1_read_frame_size(struct aom_read_bit_buffer *rb, int num_bits_width,
|
||||
int num_bits_height, int *width, int *height);
|
||||
|
|
@ -34,11 +35,14 @@ BITSTREAM_PROFILE av1_read_profile(struct aom_read_bit_buffer *rb);
|
|||
int av1_check_trailing_bits(struct AV1Decoder *pbi,
|
||||
struct aom_read_bit_buffer *rb);
|
||||
|
||||
int av1_decode_frame_headers_and_setup(struct AV1Decoder *pbi,
|
||||
struct aom_read_bit_buffer *rb,
|
||||
const uint8_t *data,
|
||||
const uint8_t **p_data_end,
|
||||
int trailing_bits_present);
|
||||
// On success, returns the frame header size. On failure, calls
|
||||
// aom_internal_error and does not return.
|
||||
// TODO(wtc): Figure out and document the p_data_end parameter.
|
||||
uint32_t av1_decode_frame_headers_and_setup(struct AV1Decoder *pbi,
|
||||
struct aom_read_bit_buffer *rb,
|
||||
const uint8_t *data,
|
||||
const uint8_t **p_data_end,
|
||||
int trailing_bits_present);
|
||||
|
||||
void av1_decode_tg_tiles_and_wrapup(struct AV1Decoder *pbi, const uint8_t *data,
|
||||
const uint8_t *data_end,
|
||||
|
|
@ -47,8 +51,9 @@ void av1_decode_tg_tiles_and_wrapup(struct AV1Decoder *pbi, const uint8_t *data,
|
|||
|
||||
// Implements the color_config() function in the spec. Reports errors by
|
||||
// calling rb->error_handler() or aom_internal_error().
|
||||
void av1_read_color_config(AV1_COMMON *cm, struct aom_read_bit_buffer *rb,
|
||||
int allow_lowbitdepth);
|
||||
void av1_read_color_config(struct aom_read_bit_buffer *rb,
|
||||
int allow_lowbitdepth, SequenceHeader *seq_params,
|
||||
struct aom_internal_error_info *error_info);
|
||||
|
||||
// Implements the timing_info() function in the spec. Reports errors by calling
|
||||
// rb->error_handler().
|
||||
|
|
@ -69,7 +74,7 @@ struct aom_read_bit_buffer *av1_init_read_bit_buffer(
|
|||
struct AV1Decoder *pbi, struct aom_read_bit_buffer *rb, const uint8_t *data,
|
||||
const uint8_t *data_end);
|
||||
|
||||
void av1_free_mc_tmp_buf(void *td, int use_highbd);
|
||||
void av1_free_mc_tmp_buf(struct ThreadData *thread_data, int use_highbd);
|
||||
|
||||
void av1_set_single_tile_decoding_mode(AV1_COMMON *const cm);
|
||||
|
||||
|
|
|
|||
13
third_party/aom/av1/decoder/decodemv.c
vendored
13
third_party/aom/av1/decoder/decodemv.c
vendored
|
|
@ -290,7 +290,7 @@ static int read_segment_id(AV1_COMMON *const cm, const MACROBLOCKD *const xd,
|
|||
av1_neg_deinterleave(coded_id, pred, seg->last_active_segid + 1);
|
||||
|
||||
if (segment_id < 0 || segment_id > seg->last_active_segid) {
|
||||
aom_internal_error(&cm->error, AOM_CODEC_CORRUPT_FRAME,
|
||||
aom_internal_error(xd->error_info, AOM_CODEC_CORRUPT_FRAME,
|
||||
"Corrupted segment_ids");
|
||||
}
|
||||
return segment_id;
|
||||
|
|
@ -573,7 +573,7 @@ static void read_palette_mode_info(AV1_COMMON *const cm, MACROBLOCKD *const xd,
|
|||
aom_read_symbol(r, xd->tile_ctx->palette_y_size_cdf[bsize_ctx],
|
||||
PALETTE_SIZES, ACCT_STR) +
|
||||
2;
|
||||
read_palette_colors_y(xd, cm->bit_depth, pmi, r);
|
||||
read_palette_colors_y(xd, cm->seq_params.bit_depth, pmi, r);
|
||||
}
|
||||
}
|
||||
if (num_planes > 1 && mbmi->uv_mode == UV_DC_PRED &&
|
||||
|
|
@ -587,7 +587,7 @@ static void read_palette_mode_info(AV1_COMMON *const cm, MACROBLOCKD *const xd,
|
|||
aom_read_symbol(r, xd->tile_ctx->palette_uv_size_cdf[bsize_ctx],
|
||||
PALETTE_SIZES, ACCT_STR) +
|
||||
2;
|
||||
read_palette_colors_uv(xd, cm->bit_depth, pmi, r);
|
||||
read_palette_colors_uv(xd, cm->seq_params.bit_depth, pmi, r);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1299,7 +1299,7 @@ static void read_inter_block_mode_info(AV1Decoder *const pbi,
|
|||
}
|
||||
|
||||
if (is_compound != is_inter_compound_mode(mbmi->mode)) {
|
||||
aom_internal_error(&cm->error, AOM_CODEC_CORRUPT_FRAME,
|
||||
aom_internal_error(xd->error_info, AOM_CODEC_CORRUPT_FRAME,
|
||||
"Prediction mode %d invalid with ref frame %d %d",
|
||||
mbmi->mode, mbmi->ref_frame[0], mbmi->ref_frame[1]);
|
||||
}
|
||||
|
|
@ -1480,8 +1480,9 @@ static void read_inter_block_mode_info(AV1Decoder *const pbi,
|
|||
}
|
||||
}
|
||||
|
||||
xd->cfl.is_chroma_reference = is_chroma_reference(
|
||||
mi_row, mi_col, bsize, cm->subsampling_x, cm->subsampling_y);
|
||||
xd->cfl.is_chroma_reference =
|
||||
is_chroma_reference(mi_row, mi_col, bsize, cm->seq_params.subsampling_x,
|
||||
cm->seq_params.subsampling_y);
|
||||
xd->cfl.store_y = store_cfl_required(cm, xd);
|
||||
|
||||
#if DEC_MISMATCH_DEBUG
|
||||
|
|
|
|||
56
third_party/aom/av1/decoder/decoder.c
vendored
56
third_party/aom/av1/decoder/decoder.c
vendored
|
|
@ -71,6 +71,7 @@ static void dec_free_mi(AV1_COMMON *cm) {
|
|||
cm->mip = NULL;
|
||||
aom_free(cm->mi_grid_base);
|
||||
cm->mi_grid_base = NULL;
|
||||
cm->mi_alloc_size = 0;
|
||||
}
|
||||
|
||||
AV1Decoder *av1_decoder_create(BufferPool *const pool) {
|
||||
|
|
@ -81,6 +82,9 @@ AV1Decoder *av1_decoder_create(BufferPool *const pool) {
|
|||
|
||||
av1_zero(*pbi);
|
||||
|
||||
// The jmp_buf is valid only for the duration of the function that calls
|
||||
// setjmp(). Therefore, this function must reset the 'setjmp' field to 0
|
||||
// before it returns.
|
||||
if (setjmp(cm->error.jmp)) {
|
||||
cm->error.setjmp = 0;
|
||||
av1_decoder_remove(pbi);
|
||||
|
|
@ -98,7 +102,7 @@ AV1Decoder *av1_decoder_create(BufferPool *const pool) {
|
|||
memset(cm->frame_contexts, 0, FRAME_CONTEXTS * sizeof(*cm->frame_contexts));
|
||||
|
||||
pbi->need_resync = 1;
|
||||
once(initialize_dec);
|
||||
aom_once(initialize_dec);
|
||||
|
||||
// Initialize the references to not point to any frame buffers.
|
||||
memset(&cm->ref_frame_map, -1, sizeof(cm->ref_frame_map));
|
||||
|
|
@ -108,7 +112,7 @@ AV1Decoder *av1_decoder_create(BufferPool *const pool) {
|
|||
pbi->decoding_first_frame = 1;
|
||||
pbi->common.buffer_pool = pool;
|
||||
|
||||
cm->bit_depth = AOM_BITS_8;
|
||||
cm->seq_params.bit_depth = AOM_BITS_8;
|
||||
cm->dequant_bit_depth = AOM_BITS_8;
|
||||
|
||||
cm->alloc_mi = av1_dec_alloc_mi;
|
||||
|
|
@ -146,6 +150,12 @@ void av1_dealloc_dec_jobs(struct AV1DecTileMTData *tile_mt_info) {
|
|||
}
|
||||
}
|
||||
|
||||
void av1_dec_free_cb_buf(AV1Decoder *pbi) {
|
||||
aom_free(pbi->cb_buffer_base);
|
||||
pbi->cb_buffer_base = NULL;
|
||||
pbi->cb_buffer_alloc_size = 0;
|
||||
}
|
||||
|
||||
void av1_decoder_remove(AV1Decoder *pbi) {
|
||||
int i;
|
||||
|
||||
|
|
@ -161,7 +171,7 @@ void av1_decoder_remove(AV1Decoder *pbi) {
|
|||
if (pbi->thread_data) {
|
||||
for (int worker_idx = 0; worker_idx < pbi->max_threads - 1; worker_idx++) {
|
||||
DecWorkerData *const thread_data = pbi->thread_data + worker_idx;
|
||||
const int use_highbd = pbi->common.use_highbitdepth ? 1 : 0;
|
||||
const int use_highbd = pbi->common.seq_params.use_highbitdepth ? 1 : 0;
|
||||
av1_free_mc_tmp_buf(thread_data->td, use_highbd);
|
||||
aom_free(thread_data->td);
|
||||
}
|
||||
|
|
@ -172,6 +182,20 @@ void av1_decoder_remove(AV1Decoder *pbi) {
|
|||
AVxWorker *const worker = &pbi->tile_workers[i];
|
||||
aom_get_worker_interface()->end(worker);
|
||||
}
|
||||
#if CONFIG_MULTITHREAD
|
||||
if (pbi->row_mt_mutex_ != NULL) {
|
||||
pthread_mutex_destroy(pbi->row_mt_mutex_);
|
||||
aom_free(pbi->row_mt_mutex_);
|
||||
}
|
||||
if (pbi->row_mt_cond_ != NULL) {
|
||||
pthread_cond_destroy(pbi->row_mt_cond_);
|
||||
aom_free(pbi->row_mt_cond_);
|
||||
}
|
||||
#endif
|
||||
for (i = 0; i < pbi->allocated_tiles; i++) {
|
||||
TileDataDec *const tile_data = pbi->tile_data + i;
|
||||
av1_dec_row_mt_dealloc(&tile_data->dec_row_mt_sync);
|
||||
}
|
||||
aom_free(pbi->tile_data);
|
||||
aom_free(pbi->tile_workers);
|
||||
|
||||
|
|
@ -181,10 +205,11 @@ void av1_decoder_remove(AV1Decoder *pbi) {
|
|||
av1_dealloc_dec_jobs(&pbi->tile_mt_info);
|
||||
}
|
||||
|
||||
av1_dec_free_cb_buf(pbi);
|
||||
#if CONFIG_ACCOUNTING
|
||||
aom_accounting_clear(&pbi->accounting);
|
||||
#endif
|
||||
const int use_highbd = pbi->common.use_highbitdepth ? 1 : 0;
|
||||
const int use_highbd = pbi->common.seq_params.use_highbitdepth ? 1 : 0;
|
||||
av1_free_mc_tmp_buf(&pbi->td, use_highbd);
|
||||
|
||||
aom_free(pbi);
|
||||
|
|
@ -279,7 +304,7 @@ aom_codec_err_t av1_set_reference_dec(AV1_COMMON *cm, int idx,
|
|||
ref_buf->y_buffer = sd->y_buffer;
|
||||
ref_buf->u_buffer = sd->u_buffer;
|
||||
ref_buf->v_buffer = sd->v_buffer;
|
||||
ref_buf->use_external_refernce_buffers = 1;
|
||||
ref_buf->use_external_reference_buffers = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -414,7 +439,10 @@ int av1_receive_compressed_data(AV1Decoder *pbi, size_t size,
|
|||
|
||||
// Find a free frame buffer. Return error if can not find any.
|
||||
cm->new_fb_idx = get_free_fb(cm);
|
||||
if (cm->new_fb_idx == INVALID_IDX) return AOM_CODEC_MEM_ERROR;
|
||||
if (cm->new_fb_idx == INVALID_IDX) {
|
||||
cm->error.error_code = AOM_CODEC_MEM_ERROR;
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Assign a MV array to the frame buffer.
|
||||
cm->cur_frame = &pool->frame_bufs[cm->new_fb_idx];
|
||||
|
|
@ -423,6 +451,9 @@ int av1_receive_compressed_data(AV1Decoder *pbi, size_t size,
|
|||
|
||||
pbi->cur_buf = &frame_bufs[cm->new_fb_idx];
|
||||
|
||||
// The jmp_buf is valid only for the duration of the function that calls
|
||||
// setjmp(). Therefore, this function must reset the 'setjmp' field to 0
|
||||
// before it returns.
|
||||
if (setjmp(cm->error.jmp)) {
|
||||
const AVxWorkerInterface *const winterface = aom_get_worker_interface();
|
||||
int i;
|
||||
|
|
@ -474,7 +505,13 @@ int av1_receive_compressed_data(AV1Decoder *pbi, size_t size,
|
|||
int frame_decoded =
|
||||
aom_decode_frame_from_obus(pbi, source, source + size, psource);
|
||||
|
||||
if (cm->error.error_code != AOM_CODEC_OK) return 1;
|
||||
if (cm->error.error_code != AOM_CODEC_OK) {
|
||||
lock_buffer_pool(pool);
|
||||
decrease_ref_count(cm->new_fb_idx, frame_bufs, pool);
|
||||
unlock_buffer_pool(pool);
|
||||
cm->error.setjmp = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if TXCOEFF_TIMER
|
||||
cm->cum_txcoeff_timer += cm->txcoeff_timer;
|
||||
|
|
@ -493,7 +530,10 @@ int av1_receive_compressed_data(AV1Decoder *pbi, size_t size,
|
|||
pbi->decoding_first_frame = 0;
|
||||
}
|
||||
|
||||
if (cm->error.error_code != AOM_CODEC_OK) return 1;
|
||||
if (cm->error.error_code != AOM_CODEC_OK) {
|
||||
cm->error.setjmp = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
aom_clear_system_state();
|
||||
|
||||
|
|
|
|||
96
third_party/aom/av1/decoder/decoder.h
vendored
96
third_party/aom/av1/decoder/decoder.h
vendored
|
|
@ -33,6 +33,20 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef void (*decode_block_visitor_fn_t)(const AV1_COMMON *const cm,
|
||||
MACROBLOCKD *const xd,
|
||||
aom_reader *const r, const int plane,
|
||||
const int row, const int col,
|
||||
const TX_SIZE tx_size);
|
||||
|
||||
typedef void (*predict_inter_block_visitor_fn_t)(AV1_COMMON *const cm,
|
||||
MACROBLOCKD *const xd,
|
||||
int mi_row, int mi_col,
|
||||
BLOCK_SIZE bsize);
|
||||
|
||||
typedef void (*cfl_store_inter_block_visitor_fn_t)(AV1_COMMON *const cm,
|
||||
MACROBLOCKD *const xd);
|
||||
|
||||
typedef struct ThreadData {
|
||||
aom_reader *bit_reader;
|
||||
DECLARE_ALIGNED(32, MACROBLOCKD, xd);
|
||||
|
|
@ -41,12 +55,54 @@ typedef struct ThreadData {
|
|||
CB_BUFFER cb_buffer_base;
|
||||
uint8_t *mc_buf[2];
|
||||
int32_t mc_buf_size;
|
||||
|
||||
decode_block_visitor_fn_t read_coeffs_tx_intra_block_visit;
|
||||
decode_block_visitor_fn_t predict_and_recon_intra_block_visit;
|
||||
decode_block_visitor_fn_t read_coeffs_tx_inter_block_visit;
|
||||
decode_block_visitor_fn_t inverse_tx_inter_block_visit;
|
||||
predict_inter_block_visitor_fn_t predict_inter_block_visit;
|
||||
cfl_store_inter_block_visitor_fn_t cfl_store_inter_block_visit;
|
||||
} ThreadData;
|
||||
|
||||
typedef struct AV1DecRowMTJobInfo {
|
||||
int tile_row;
|
||||
int tile_col;
|
||||
int mi_row;
|
||||
} AV1DecRowMTJobInfo;
|
||||
|
||||
typedef struct AV1DecRowMTSyncData {
|
||||
#if CONFIG_MULTITHREAD
|
||||
pthread_mutex_t *mutex_;
|
||||
pthread_cond_t *cond_;
|
||||
#endif
|
||||
int allocated_sb_rows;
|
||||
int *cur_sb_col;
|
||||
int sync_range;
|
||||
int mi_rows;
|
||||
int mi_cols;
|
||||
int mi_rows_parse_done;
|
||||
int mi_rows_decode_started;
|
||||
int num_threads_working;
|
||||
} AV1DecRowMTSync;
|
||||
|
||||
typedef struct AV1DecRowMTInfo {
|
||||
int tile_rows_start;
|
||||
int tile_rows_end;
|
||||
int tile_cols_start;
|
||||
int tile_cols_end;
|
||||
int start_tile;
|
||||
int end_tile;
|
||||
int mi_rows_parse_done;
|
||||
int mi_rows_decode_started;
|
||||
int mi_rows_to_decode;
|
||||
int row_mt_exit;
|
||||
} AV1DecRowMTInfo;
|
||||
|
||||
typedef struct TileDataDec {
|
||||
TileInfo tile_info;
|
||||
aom_reader bit_reader;
|
||||
DECLARE_ALIGNED(16, FRAME_CONTEXT, tctx);
|
||||
AV1DecRowMTSync dec_row_mt_sync;
|
||||
} TileDataDec;
|
||||
|
||||
typedef struct TileBufferDec {
|
||||
|
|
@ -139,9 +195,8 @@ typedef struct AV1Decoder {
|
|||
int acct_enabled;
|
||||
Accounting accounting;
|
||||
#endif
|
||||
size_t uncomp_hdr_size; // Size of the uncompressed header
|
||||
int tg_size; // Number of tiles in the current tilegroup
|
||||
int tg_start; // First tile in the current tilegroup
|
||||
int tg_size; // Number of tiles in the current tilegroup
|
||||
int tg_start; // First tile in the current tilegroup
|
||||
int tg_size_bit_offset;
|
||||
int sequence_header_ready;
|
||||
#if CONFIG_INSPECTION
|
||||
|
|
@ -162,12 +217,27 @@ typedef struct AV1Decoder {
|
|||
int tile_count_minus_1;
|
||||
uint32_t coded_tile_data_size;
|
||||
unsigned int ext_tile_debug; // for ext-tile software debug & testing
|
||||
unsigned int row_mt;
|
||||
EXTERNAL_REFERENCES ext_refs;
|
||||
size_t tile_list_size;
|
||||
uint8_t *tile_list_output;
|
||||
size_t buffer_sz;
|
||||
|
||||
CB_BUFFER *cb_buffer_base;
|
||||
int cb_buffer_alloc_size;
|
||||
|
||||
int allocated_row_mt_sync_rows;
|
||||
|
||||
#if CONFIG_MULTITHREAD
|
||||
pthread_mutex_t *row_mt_mutex_;
|
||||
pthread_cond_t *row_mt_cond_;
|
||||
#endif
|
||||
|
||||
AV1DecRowMTInfo frame_row_mt_info;
|
||||
} AV1Decoder;
|
||||
|
||||
// Returns 0 on success. Sets pbi->common.error.error_code to a nonzero error
|
||||
// code and returns a nonzero value on failure.
|
||||
int av1_receive_compressed_data(struct AV1Decoder *pbi, size_t size,
|
||||
const uint8_t **dest);
|
||||
|
||||
|
|
@ -192,6 +262,10 @@ struct AV1Decoder *av1_decoder_create(BufferPool *const pool);
|
|||
void av1_decoder_remove(struct AV1Decoder *pbi);
|
||||
void av1_dealloc_dec_jobs(struct AV1DecTileMTData *tile_jobs_sync);
|
||||
|
||||
void av1_dec_row_mt_dealloc(AV1DecRowMTSync *dec_row_mt_sync);
|
||||
|
||||
void av1_dec_free_cb_buf(AV1Decoder *pbi);
|
||||
|
||||
static INLINE void decrease_ref_count(int idx, RefCntBuffer *const frame_bufs,
|
||||
BufferPool *const pool) {
|
||||
if (idx >= 0) {
|
||||
|
|
@ -207,18 +281,6 @@ static INLINE void decrease_ref_count(int idx, RefCntBuffer *const frame_bufs,
|
|||
}
|
||||
}
|
||||
|
||||
static INLINE int dec_is_ref_frame_buf(AV1Decoder *const pbi,
|
||||
RefCntBuffer *frame_buf) {
|
||||
AV1_COMMON *const cm = &pbi->common;
|
||||
int i;
|
||||
for (i = 0; i < INTER_REFS_PER_FRAME; ++i) {
|
||||
RefBuffer *const ref_frame = &cm->frame_refs[i];
|
||||
if (ref_frame->idx == INVALID_IDX) continue;
|
||||
if (frame_buf == &cm->buffer_pool->frame_bufs[ref_frame->idx]) break;
|
||||
}
|
||||
return (i < INTER_REFS_PER_FRAME);
|
||||
}
|
||||
|
||||
#define ACCT_STR __func__
|
||||
static INLINE int av1_read_uniform(aom_reader *r, int n) {
|
||||
const int l = get_unsigned_bits(n);
|
||||
|
|
@ -238,6 +300,10 @@ void av1_visit_palette(AV1Decoder *const pbi, MACROBLOCKD *const xd, int mi_row,
|
|||
int mi_col, aom_reader *r, BLOCK_SIZE bsize,
|
||||
palette_visitor_fn_t visit);
|
||||
|
||||
typedef void (*block_visitor_fn_t)(AV1Decoder *const pbi, ThreadData *const td,
|
||||
int mi_row, int mi_col, aom_reader *r,
|
||||
PARTITION_TYPE partition, BLOCK_SIZE bsize);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
|
|
|||
31
third_party/aom/av1/decoder/decodetxb.c
vendored
31
third_party/aom/av1/decoder/decodetxb.c
vendored
|
|
@ -320,10 +320,14 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *const xd,
|
|||
return cul_level;
|
||||
}
|
||||
|
||||
uint8_t av1_read_coeffs_txb_facade(const AV1_COMMON *const cm,
|
||||
MACROBLOCKD *const xd, aom_reader *const r,
|
||||
const int row, const int col,
|
||||
const int plane, const TX_SIZE tx_size) {
|
||||
void av1_read_coeffs_txb_facade(const AV1_COMMON *const cm,
|
||||
MACROBLOCKD *const xd, aom_reader *const r,
|
||||
const int plane, const int row, const int col,
|
||||
const TX_SIZE tx_size) {
|
||||
#if TXCOEFF_TIMER
|
||||
struct aom_usec_timer timer;
|
||||
aom_usec_timer_start(&timer);
|
||||
#endif
|
||||
MB_MODE_INFO *const mbmi = xd->mi[0];
|
||||
struct macroblockd_plane *const pd = &xd->plane[plane];
|
||||
|
||||
|
|
@ -337,5 +341,22 @@ uint8_t av1_read_coeffs_txb_facade(const AV1_COMMON *const cm,
|
|||
const uint8_t cul_level =
|
||||
av1_read_coeffs_txb(cm, xd, r, row, col, plane, &txb_ctx, tx_size);
|
||||
av1_set_contexts(xd, pd, plane, plane_bsize, tx_size, cul_level, col, row);
|
||||
return cul_level;
|
||||
|
||||
if (is_inter_block(mbmi)) {
|
||||
PLANE_TYPE plane_type = get_plane_type(plane);
|
||||
// tx_type will be read out in av1_read_coeffs_txb_facade
|
||||
const TX_TYPE tx_type = av1_get_tx_type(plane_type, xd, row, col, tx_size,
|
||||
cm->reduced_tx_set_used);
|
||||
|
||||
if (plane == 0)
|
||||
update_txk_array(mbmi->txk_type, mbmi->sb_type, row, col, tx_size,
|
||||
tx_type);
|
||||
}
|
||||
|
||||
#if TXCOEFF_TIMER
|
||||
aom_usec_timer_mark(&timer);
|
||||
const int64_t elapsed_time = aom_usec_timer_elapsed(&timer);
|
||||
cm->txcoeff_timer += elapsed_time;
|
||||
++cm->txb_count;
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
8
third_party/aom/av1/decoder/decodetxb.h
vendored
8
third_party/aom/av1/decoder/decodetxb.h
vendored
|
|
@ -25,8 +25,8 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *const xd,
|
|||
const TXB_CTX *const txb_ctx,
|
||||
const TX_SIZE tx_size);
|
||||
|
||||
uint8_t av1_read_coeffs_txb_facade(const AV1_COMMON *const cm,
|
||||
MACROBLOCKD *const xd, aom_reader *const r,
|
||||
const int row, const int col,
|
||||
const int plane, const TX_SIZE tx_size);
|
||||
void av1_read_coeffs_txb_facade(const AV1_COMMON *const cm,
|
||||
MACROBLOCKD *const xd, aom_reader *const r,
|
||||
const int plane, const int row, const int col,
|
||||
const TX_SIZE tx_size);
|
||||
#endif // DECODETXB_H_
|
||||
|
|
|
|||
8
third_party/aom/av1/decoder/dthread.c
vendored
8
third_party/aom/av1/decoder/dthread.c
vendored
|
|
@ -157,8 +157,8 @@ void av1_frameworker_copy_context(AVxWorker *const dst_worker,
|
|||
dst_worker_data->pbi->need_resync = src_worker_data->pbi->need_resync;
|
||||
av1_frameworker_unlock_stats(src_worker);
|
||||
|
||||
dst_cm->bit_depth = src_cm->bit_depth;
|
||||
dst_cm->use_highbitdepth = src_cm->use_highbitdepth;
|
||||
dst_cm->seq_params.bit_depth = src_cm->seq_params.bit_depth;
|
||||
dst_cm->seq_params.use_highbitdepth = src_cm->seq_params.use_highbitdepth;
|
||||
// TODO(zoeliu): To handle parallel decoding
|
||||
dst_cm->prev_frame =
|
||||
src_cm->show_existing_frame ? src_cm->prev_frame : src_cm->cur_frame;
|
||||
|
|
@ -166,8 +166,8 @@ void av1_frameworker_copy_context(AVxWorker *const dst_worker,
|
|||
!src_cm->show_existing_frame ? src_cm->width : src_cm->last_width;
|
||||
dst_cm->last_height =
|
||||
!src_cm->show_existing_frame ? src_cm->height : src_cm->last_height;
|
||||
dst_cm->subsampling_x = src_cm->subsampling_x;
|
||||
dst_cm->subsampling_y = src_cm->subsampling_y;
|
||||
dst_cm->seq_params.subsampling_x = src_cm->seq_params.subsampling_x;
|
||||
dst_cm->seq_params.subsampling_y = src_cm->seq_params.subsampling_y;
|
||||
dst_cm->frame_type = src_cm->frame_type;
|
||||
dst_cm->last_show_frame = !src_cm->show_existing_frame
|
||||
? src_cm->show_frame
|
||||
|
|
|
|||
1
third_party/aom/av1/decoder/dthread.h
vendored
1
third_party/aom/av1/decoder/dthread.h
vendored
|
|
@ -39,7 +39,6 @@ typedef struct FrameWorkerData {
|
|||
const uint8_t *data_end;
|
||||
size_t data_size;
|
||||
void *user_priv;
|
||||
int result;
|
||||
int worker_id;
|
||||
int received_frame;
|
||||
|
||||
|
|
|
|||
254
third_party/aom/av1/decoder/obu.c
vendored
254
third_party/aom/av1/decoder/obu.c
vendored
|
|
@ -161,6 +161,17 @@ static int is_obu_in_current_operating_point(AV1Decoder *pbi,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int byte_alignment(AV1_COMMON *const cm,
|
||||
struct aom_read_bit_buffer *const rb) {
|
||||
while (rb->bit_offset & 7) {
|
||||
if (aom_rb_read_bit(rb)) {
|
||||
cm->error.error_code = AOM_CODEC_CORRUPT_FRAME;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static uint32_t read_temporal_delimiter_obu() { return 0; }
|
||||
|
||||
// Returns a boolean that indicates success.
|
||||
|
|
@ -173,6 +184,13 @@ static int read_bitstream_level(BitstreamLevel *bl,
|
|||
return 1;
|
||||
}
|
||||
|
||||
// Returns whether two sequence headers are consistent with each other.
|
||||
// TODO(huisu,wtc@google.com): make sure the code matches the spec exactly.
|
||||
static int are_seq_headers_consistent(const SequenceHeader *seq_params_old,
|
||||
const SequenceHeader *seq_params_new) {
|
||||
return !memcmp(seq_params_old, seq_params_new, sizeof(SequenceHeader));
|
||||
}
|
||||
|
||||
// On success, sets pbi->sequence_header_ready to 1 and returns the number of
|
||||
// bytes read from 'rb'.
|
||||
// On failure, sets pbi->common.error.error_code and returns 0.
|
||||
|
|
@ -184,14 +202,17 @@ static uint32_t read_sequence_header_obu(AV1Decoder *pbi,
|
|||
// Verify rb has been configured to report errors.
|
||||
assert(rb->error_handler);
|
||||
|
||||
cm->profile = av1_read_profile(rb);
|
||||
if (cm->profile > PROFILE_2) {
|
||||
// Use a local variable to store the information as we decode. At the end,
|
||||
// if no errors have occurred, cm->seq_params is updated.
|
||||
SequenceHeader sh = cm->seq_params;
|
||||
SequenceHeader *const seq_params = &sh;
|
||||
|
||||
seq_params->profile = av1_read_profile(rb);
|
||||
if (seq_params->profile > PROFILE_2) {
|
||||
cm->error.error_code = AOM_CODEC_UNSUP_BITSTREAM;
|
||||
return 0;
|
||||
}
|
||||
|
||||
SequenceHeader *const seq_params = &cm->seq_params;
|
||||
|
||||
// Still picture or not
|
||||
seq_params->still_picture = aom_rb_read_bit(rb);
|
||||
seq_params->reduced_still_picture_hdr = aom_rb_read_bit(rb);
|
||||
|
|
@ -252,7 +273,8 @@ static uint32_t read_sequence_header_obu(AV1Decoder *pbi,
|
|||
(cm->timing_info.equal_picture_interval ||
|
||||
cm->op_params[i].decoder_model_param_present_flag)) {
|
||||
cm->op_params[i].bitrate = max_level_bitrate(
|
||||
cm->profile, major_minor_to_seq_level_idx(seq_params->level[i]),
|
||||
seq_params->profile,
|
||||
major_minor_to_seq_level_idx(seq_params->level[i]),
|
||||
seq_params->tier[i]);
|
||||
// Level with seq_level_idx = 31 returns a high "dummy" bitrate to pass
|
||||
// the check
|
||||
|
|
@ -305,30 +327,49 @@ static uint32_t read_sequence_header_obu(AV1Decoder *pbi,
|
|||
return 0;
|
||||
}
|
||||
|
||||
read_sequence_header(cm, rb);
|
||||
av1_read_sequence_header(cm, rb, seq_params);
|
||||
|
||||
av1_read_color_config(cm, rb, pbi->allow_lowbitdepth);
|
||||
av1_read_color_config(rb, pbi->allow_lowbitdepth, seq_params, &cm->error);
|
||||
if (!(seq_params->subsampling_x == 0 && seq_params->subsampling_y == 0) &&
|
||||
!(seq_params->subsampling_x == 1 && seq_params->subsampling_y == 1) &&
|
||||
!(seq_params->subsampling_x == 1 && seq_params->subsampling_y == 0)) {
|
||||
aom_internal_error(&cm->error, AOM_CODEC_UNSUP_BITSTREAM,
|
||||
"Only 4:4:4, 4:2:2 and 4:2:0 are currently supported, "
|
||||
"%d %d subsampling is not supported.\n",
|
||||
seq_params->subsampling_x, seq_params->subsampling_y);
|
||||
}
|
||||
|
||||
cm->film_grain_params_present = aom_rb_read_bit(rb);
|
||||
seq_params->film_grain_params_present = aom_rb_read_bit(rb);
|
||||
|
||||
if (av1_check_trailing_bits(pbi, rb) != 0) {
|
||||
// cm->error.error_code is already set.
|
||||
return 0;
|
||||
}
|
||||
|
||||
// If a sequence header has been decoded before, we check if the new
|
||||
// one is consistent with the old one.
|
||||
if (pbi->sequence_header_ready) {
|
||||
if (!are_seq_headers_consistent(&cm->seq_params, seq_params)) {
|
||||
aom_internal_error(&cm->error, AOM_CODEC_UNSUP_BITSTREAM,
|
||||
"Inconsistent sequence headers received.");
|
||||
}
|
||||
}
|
||||
|
||||
cm->seq_params = *seq_params;
|
||||
pbi->sequence_header_ready = 1;
|
||||
|
||||
return ((rb->bit_offset - saved_bit_offset + 7) >> 3);
|
||||
}
|
||||
|
||||
// On success, returns the frame header size. On failure, calls
|
||||
// aom_internal_error and does not return.
|
||||
static uint32_t read_frame_header_obu(AV1Decoder *pbi,
|
||||
struct aom_read_bit_buffer *rb,
|
||||
const uint8_t *data,
|
||||
const uint8_t **p_data_end,
|
||||
int trailing_bits_present) {
|
||||
av1_decode_frame_headers_and_setup(pbi, rb, data, p_data_end,
|
||||
trailing_bits_present);
|
||||
return (uint32_t)(pbi->uncomp_hdr_size);
|
||||
return av1_decode_frame_headers_and_setup(pbi, rb, data, p_data_end,
|
||||
trailing_bits_present);
|
||||
}
|
||||
|
||||
static int32_t read_tile_group_header(AV1Decoder *pbi,
|
||||
|
|
@ -353,7 +394,6 @@ static int32_t read_tile_group_header(AV1Decoder *pbi,
|
|||
aom_internal_error(
|
||||
&cm->error, AOM_CODEC_UNSUP_BITSTREAM,
|
||||
"For OBU_FRAME type obu tile_start_and_end_present_flag must be 0");
|
||||
cm->error.error_code = AOM_CODEC_CORRUPT_FRAME;
|
||||
return -1;
|
||||
}
|
||||
*start_tile =
|
||||
|
|
@ -371,9 +411,12 @@ static uint32_t read_one_tile_group_obu(
|
|||
int start_tile, end_tile;
|
||||
int32_t header_size, tg_payload_size;
|
||||
|
||||
assert((rb->bit_offset & 7) == 0);
|
||||
assert(rb->bit_buffer + aom_rb_bytes_read(rb) == data);
|
||||
|
||||
header_size = read_tile_group_header(pbi, rb, &start_tile, &end_tile,
|
||||
tile_start_implicit);
|
||||
if (header_size == -1) return 0;
|
||||
if (header_size == -1 || byte_alignment(cm, rb)) return 0;
|
||||
if (start_tile > end_tile) return header_size;
|
||||
data += header_size;
|
||||
av1_decode_tg_tiles_and_wrapup(pbi, data, data_end, p_data_end, start_tile,
|
||||
|
|
@ -386,6 +429,87 @@ static uint32_t read_one_tile_group_obu(
|
|||
return header_size + tg_payload_size;
|
||||
}
|
||||
|
||||
static void alloc_tile_list_buffer(AV1Decoder *pbi) {
|
||||
// TODO(yunqing): for now, copy each tile's decoded YUV data directly to the
|
||||
// output buffer. This needs to be modified according to the application
|
||||
// requirement.
|
||||
AV1_COMMON *const cm = &pbi->common;
|
||||
const int tile_width_in_pixels = cm->tile_width * MI_SIZE;
|
||||
const int tile_height_in_pixels = cm->tile_height * MI_SIZE;
|
||||
const int ssy = cm->seq_params.subsampling_y;
|
||||
const int ssx = cm->seq_params.subsampling_x;
|
||||
const int num_planes = av1_num_planes(cm);
|
||||
const size_t yplane_tile_size = tile_height_in_pixels * tile_width_in_pixels;
|
||||
const size_t uvplane_tile_size =
|
||||
(num_planes > 1)
|
||||
? (tile_height_in_pixels >> ssy) * (tile_width_in_pixels >> ssx)
|
||||
: 0;
|
||||
const size_t tile_size = (cm->seq_params.use_highbitdepth ? 2 : 1) *
|
||||
(yplane_tile_size + 2 * uvplane_tile_size);
|
||||
pbi->tile_list_size = tile_size * (pbi->tile_count_minus_1 + 1);
|
||||
|
||||
if (pbi->tile_list_size > pbi->buffer_sz) {
|
||||
if (pbi->tile_list_output != NULL) aom_free(pbi->tile_list_output);
|
||||
pbi->tile_list_output = NULL;
|
||||
|
||||
pbi->tile_list_output = (uint8_t *)aom_memalign(32, pbi->tile_list_size);
|
||||
if (pbi->tile_list_output == NULL)
|
||||
aom_internal_error(&cm->error, AOM_CODEC_MEM_ERROR,
|
||||
"Failed to allocate the tile list output buffer");
|
||||
pbi->buffer_sz = pbi->tile_list_size;
|
||||
}
|
||||
}
|
||||
|
||||
static void copy_decoded_tile_to_tile_list_buffer(AV1Decoder *pbi,
|
||||
uint8_t **output) {
|
||||
AV1_COMMON *const cm = &pbi->common;
|
||||
const int tile_width_in_pixels = cm->tile_width * MI_SIZE;
|
||||
const int tile_height_in_pixels = cm->tile_height * MI_SIZE;
|
||||
const int ssy = cm->seq_params.subsampling_y;
|
||||
const int ssx = cm->seq_params.subsampling_x;
|
||||
const int num_planes = av1_num_planes(cm);
|
||||
|
||||
// Copy decoded tile to the tile list output buffer.
|
||||
YV12_BUFFER_CONFIG *cur_frame = get_frame_new_buffer(cm);
|
||||
const int mi_row = pbi->dec_tile_row * cm->tile_height;
|
||||
const int mi_col = pbi->dec_tile_col * cm->tile_width;
|
||||
const int is_hbd = (cur_frame->flags & YV12_FLAG_HIGHBITDEPTH) ? 1 : 0;
|
||||
uint8_t *bufs[MAX_MB_PLANE] = { NULL, NULL, NULL };
|
||||
int strides[MAX_MB_PLANE] = { 0, 0, 0 };
|
||||
int plane;
|
||||
|
||||
for (plane = 0; plane < num_planes; ++plane) {
|
||||
int shift_x = plane > 0 ? ssx : 0;
|
||||
int shift_y = plane > 0 ? ssy : 0;
|
||||
|
||||
bufs[plane] = cur_frame->buffers[plane];
|
||||
strides[plane] =
|
||||
(plane > 0) ? cur_frame->strides[1] : cur_frame->strides[0];
|
||||
|
||||
bufs[plane] += mi_row * (MI_SIZE >> shift_y) * strides[plane] +
|
||||
mi_col * (MI_SIZE >> shift_x);
|
||||
|
||||
if (is_hbd) {
|
||||
bufs[plane] = (uint8_t *)CONVERT_TO_SHORTPTR(bufs[plane]);
|
||||
strides[plane] *= 2;
|
||||
}
|
||||
|
||||
int w, h;
|
||||
w = (plane > 0 && shift_x > 0) ? ((tile_width_in_pixels + 1) >> shift_x)
|
||||
: tile_width_in_pixels;
|
||||
w *= (1 + is_hbd);
|
||||
h = (plane > 0 && shift_y > 0) ? ((tile_height_in_pixels + 1) >> shift_y)
|
||||
: tile_height_in_pixels;
|
||||
int j;
|
||||
|
||||
for (j = 0; j < h; ++j) {
|
||||
memcpy(*output, bufs[plane], w);
|
||||
bufs[plane] += strides[plane];
|
||||
*output += w;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Only called while large_scale_tile = 1.
|
||||
static uint32_t read_and_decode_one_tile_list(AV1Decoder *pbi,
|
||||
struct aom_read_bit_buffer *rb,
|
||||
|
|
@ -404,39 +528,13 @@ static uint32_t read_and_decode_one_tile_list(AV1Decoder *pbi,
|
|||
pbi->output_frame_width_in_tiles_minus_1 = aom_rb_read_literal(rb, 8);
|
||||
pbi->output_frame_height_in_tiles_minus_1 = aom_rb_read_literal(rb, 8);
|
||||
pbi->tile_count_minus_1 = aom_rb_read_literal(rb, 16);
|
||||
if (pbi->tile_count_minus_1 > 511) {
|
||||
if (pbi->tile_count_minus_1 > MAX_TILES - 1) {
|
||||
cm->error.error_code = AOM_CODEC_CORRUPT_FRAME;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Allocate output frame buffer for the tile list.
|
||||
// TODO(yunqing): for now, copy each tile's decoded YUV data directly to the
|
||||
// output buffer. This needs to be modified according to the application
|
||||
// requirement.
|
||||
const int tile_width_in_pixels = cm->tile_width * MI_SIZE;
|
||||
const int tile_height_in_pixels = cm->tile_height * MI_SIZE;
|
||||
const int ssy = cm->subsampling_y;
|
||||
const int ssx = cm->subsampling_x;
|
||||
const int num_planes = av1_num_planes(cm);
|
||||
const size_t yplane_tile_size = tile_height_in_pixels * tile_width_in_pixels;
|
||||
const size_t uvplane_tile_size =
|
||||
(num_planes > 1)
|
||||
? (tile_height_in_pixels >> ssy) * (tile_width_in_pixels >> ssx)
|
||||
: 0;
|
||||
const size_t tile_size = (cm->use_highbitdepth ? 2 : 1) *
|
||||
(yplane_tile_size + 2 * uvplane_tile_size);
|
||||
pbi->tile_list_size = tile_size * (pbi->tile_count_minus_1 + 1);
|
||||
|
||||
if (pbi->tile_list_size > pbi->buffer_sz) {
|
||||
if (pbi->tile_list_output != NULL) aom_free(pbi->tile_list_output);
|
||||
pbi->tile_list_output = NULL;
|
||||
|
||||
pbi->tile_list_output = (uint8_t *)aom_memalign(32, pbi->tile_list_size);
|
||||
if (pbi->tile_list_output == NULL)
|
||||
aom_internal_error(&cm->error, AOM_CODEC_MEM_ERROR,
|
||||
"Failed to allocate the tile list output buffer");
|
||||
pbi->buffer_sz = pbi->tile_list_size;
|
||||
}
|
||||
alloc_tile_list_buffer(pbi);
|
||||
|
||||
uint32_t tile_list_info_bytes = 4;
|
||||
tile_list_payload_size += tile_list_info_bytes;
|
||||
|
|
@ -485,45 +583,8 @@ static uint32_t read_and_decode_one_tile_list(AV1Decoder *pbi,
|
|||
data = *p_data_end;
|
||||
assert(data <= data_end);
|
||||
|
||||
// Copy decoded tile to the tile list output buffer.
|
||||
YV12_BUFFER_CONFIG *cur_frame = get_frame_new_buffer(cm);
|
||||
const int mi_row = pbi->dec_tile_row * cm->tile_height;
|
||||
const int mi_col = pbi->dec_tile_col * cm->tile_width;
|
||||
const int is_hbd = (cur_frame->flags & YV12_FLAG_HIGHBITDEPTH) ? 1 : 0;
|
||||
uint8_t *bufs[MAX_MB_PLANE] = { NULL, NULL, NULL };
|
||||
int strides[MAX_MB_PLANE] = { 0, 0, 0 };
|
||||
int plane;
|
||||
|
||||
for (plane = 0; plane < num_planes; ++plane) {
|
||||
int shift_x = plane > 0 ? ssx : 0;
|
||||
int shift_y = plane > 0 ? ssy : 0;
|
||||
|
||||
bufs[plane] = cur_frame->buffers[plane];
|
||||
strides[plane] =
|
||||
(plane > 0) ? cur_frame->strides[1] : cur_frame->strides[0];
|
||||
if (is_hbd) {
|
||||
bufs[plane] = (uint8_t *)CONVERT_TO_SHORTPTR(cur_frame->buffers[plane]);
|
||||
strides[plane] =
|
||||
(plane > 0) ? 2 * cur_frame->strides[1] : 2 * cur_frame->strides[0];
|
||||
}
|
||||
|
||||
bufs[plane] += mi_row * (MI_SIZE >> shift_y) * strides[plane] +
|
||||
mi_col * (MI_SIZE >> shift_x);
|
||||
|
||||
int w, h;
|
||||
w = (plane > 0 && shift_x > 0) ? ((tile_width_in_pixels + 1) >> shift_x)
|
||||
: tile_width_in_pixels;
|
||||
w *= (1 + is_hbd);
|
||||
h = (plane > 0 && shift_y > 0) ? ((tile_height_in_pixels + 1) >> shift_y)
|
||||
: tile_height_in_pixels;
|
||||
int j;
|
||||
|
||||
for (j = 0; j < h; ++j) {
|
||||
memcpy(output, bufs[plane], w);
|
||||
bufs[plane] += strides[plane];
|
||||
output += w;
|
||||
}
|
||||
}
|
||||
// Copy the decoded tile to the tile list output buffer.
|
||||
copy_decoded_tile_to_tile_list_buffer(pbi, &output);
|
||||
}
|
||||
|
||||
*frame_decoding_finished = 1;
|
||||
|
|
@ -710,7 +771,6 @@ aom_codec_err_t aom_read_obu_header_and_size(const uint8_t *data,
|
|||
return AOM_CODEC_OK;
|
||||
}
|
||||
|
||||
#define EXT_TILE_DEBUG 0
|
||||
// On success, returns a boolean that indicates whether the decoding of the
|
||||
// current frame is finished. On failure, sets cm->error.error_code and
|
||||
// returns -1.
|
||||
|
|
@ -720,7 +780,7 @@ int aom_decode_frame_from_obus(struct AV1Decoder *pbi, const uint8_t *data,
|
|||
AV1_COMMON *const cm = &pbi->common;
|
||||
int frame_decoding_finished = 0;
|
||||
int is_first_tg_obu_received = 1;
|
||||
int frame_header_size = 0;
|
||||
uint32_t frame_header_size = 0;
|
||||
int seq_header_received = 0;
|
||||
size_t seq_header_size = 0;
|
||||
ObuHeader obu_header;
|
||||
|
|
@ -785,7 +845,7 @@ int aom_decode_frame_from_obus(struct AV1Decoder *pbi, const uint8_t *data,
|
|||
}
|
||||
}
|
||||
|
||||
av1_init_read_bit_buffer(pbi, &rb, data, data_end);
|
||||
av1_init_read_bit_buffer(pbi, &rb, data, data + payload_size);
|
||||
|
||||
switch (obu_header.type) {
|
||||
case OBU_TEMPORAL_DELIMITER:
|
||||
|
|
@ -813,21 +873,35 @@ int aom_decode_frame_from_obus(struct AV1Decoder *pbi, const uint8_t *data,
|
|||
// Only decode first frame header received
|
||||
if (!pbi->seen_frame_header ||
|
||||
(cm->large_scale_tile && !pbi->camera_frame_header_ready)) {
|
||||
pbi->seen_frame_header = 1;
|
||||
frame_header_size = read_frame_header_obu(
|
||||
pbi, &rb, data, p_data_end, obu_header.type != OBU_FRAME);
|
||||
if (cm->large_scale_tile) pbi->camera_frame_header_ready = 1;
|
||||
pbi->seen_frame_header = 1;
|
||||
if (!pbi->ext_tile_debug && cm->large_scale_tile)
|
||||
pbi->camera_frame_header_ready = 1;
|
||||
} else {
|
||||
// TODO(wtc): Verify that the frame_header_obu is identical to the
|
||||
// original frame_header_obu. For now just skip frame_header_size
|
||||
// bytes in the bit buffer.
|
||||
if (frame_header_size > payload_size) {
|
||||
cm->error.error_code = AOM_CODEC_CORRUPT_FRAME;
|
||||
return -1;
|
||||
}
|
||||
assert(rb.bit_offset == 0);
|
||||
rb.bit_offset = 8 * frame_header_size;
|
||||
}
|
||||
decoded_payload_size = frame_header_size;
|
||||
pbi->frame_header_size = (size_t)frame_header_size;
|
||||
pbi->frame_header_size = frame_header_size;
|
||||
|
||||
if (cm->show_existing_frame) {
|
||||
if (obu_header.type == OBU_FRAME) {
|
||||
cm->error.error_code = AOM_CODEC_UNSUP_BITSTREAM;
|
||||
return -1;
|
||||
}
|
||||
frame_decoding_finished = 1;
|
||||
pbi->seen_frame_header = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
#if !EXT_TILE_DEBUG
|
||||
// In large scale tile coding, decode the common camera frame header
|
||||
// before any tile list OBU.
|
||||
if (!pbi->ext_tile_debug && pbi->camera_frame_header_ready) {
|
||||
|
|
@ -838,17 +912,18 @@ int aom_decode_frame_from_obus(struct AV1Decoder *pbi, const uint8_t *data,
|
|||
*p_data_end = data_end;
|
||||
break;
|
||||
}
|
||||
#endif // EXT_TILE_DEBUG
|
||||
|
||||
if (obu_header.type != OBU_FRAME) break;
|
||||
obu_payload_offset = frame_header_size;
|
||||
// Byte align the reader before reading the tile group.
|
||||
if (byte_alignment(cm, &rb)) return -1;
|
||||
AOM_FALLTHROUGH_INTENDED; // fall through to read tile group.
|
||||
case OBU_TILE_GROUP:
|
||||
if (!pbi->seen_frame_header) {
|
||||
cm->error.error_code = AOM_CODEC_CORRUPT_FRAME;
|
||||
return -1;
|
||||
}
|
||||
if ((size_t)(data_end - data) < obu_payload_offset) {
|
||||
if (obu_payload_offset > payload_size) {
|
||||
cm->error.error_code = AOM_CODEC_CORRUPT_FRAME;
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -904,4 +979,3 @@ int aom_decode_frame_from_obus(struct AV1Decoder *pbi, const uint8_t *data,
|
|||
|
||||
return frame_decoding_finished;
|
||||
}
|
||||
#undef EXT_TILE_DEBUG
|
||||
|
|
|
|||
8
third_party/aom/av1/encoder/aq_complexity.c
vendored
8
third_party/aom/av1/encoder/aq_complexity.c
vendored
|
|
@ -66,7 +66,8 @@ void av1_setup_in_frame_q_adj(AV1_COMP *cpi) {
|
|||
cpi->refresh_alt_ref_frame ||
|
||||
(cpi->refresh_golden_frame && !cpi->rc.is_src_frame_alt_ref)) {
|
||||
int segment;
|
||||
const int aq_strength = get_aq_c_strength(cm->base_qindex, cm->bit_depth);
|
||||
const int aq_strength =
|
||||
get_aq_c_strength(cm->base_qindex, cm->seq_params.bit_depth);
|
||||
|
||||
// Clear down the segment map.
|
||||
memset(cpi->segmentation_map, DEFAULT_AQ2_SEG, cm->mi_rows * cm->mi_cols);
|
||||
|
|
@ -93,7 +94,7 @@ void av1_setup_in_frame_q_adj(AV1_COMP *cpi) {
|
|||
|
||||
qindex_delta = av1_compute_qdelta_by_rate(
|
||||
&cpi->rc, cm->frame_type, cm->base_qindex,
|
||||
aq_c_q_adj_factor[aq_strength][segment], cm->bit_depth);
|
||||
aq_c_q_adj_factor[aq_strength][segment], cm->seq_params.bit_depth);
|
||||
|
||||
// For AQ complexity mode, we dont allow Q0 in a segment if the base
|
||||
// Q is not 0. Q0 (lossless) implies 4x4 only and in AQ mode 2 a segment
|
||||
|
|
@ -138,7 +139,8 @@ void av1_caq_select_segment(const AV1_COMP *cpi, MACROBLOCK *mb, BLOCK_SIZE bs,
|
|||
const int target_rate = (int)(num / denom);
|
||||
double logvar;
|
||||
double low_var_thresh;
|
||||
const int aq_strength = get_aq_c_strength(cm->base_qindex, cm->bit_depth);
|
||||
const int aq_strength =
|
||||
get_aq_c_strength(cm->base_qindex, cm->seq_params.bit_depth);
|
||||
|
||||
aom_clear_system_state();
|
||||
low_var_thresh = (cpi->oxcf.pass == 2) ? AOMMAX(cpi->twopass.mb_av_energy,
|
||||
|
|
|
|||
40
third_party/aom/av1/encoder/aq_cyclicrefresh.c
vendored
40
third_party/aom/av1/encoder/aq_cyclicrefresh.c
vendored
|
|
@ -137,8 +137,9 @@ static int candidate_refresh_aq(const CYCLIC_REFRESH *cr,
|
|||
static int compute_deltaq(const AV1_COMP *cpi, int q, double rate_factor) {
|
||||
const CYCLIC_REFRESH *const cr = cpi->cyclic_refresh;
|
||||
const RATE_CONTROL *const rc = &cpi->rc;
|
||||
int deltaq = av1_compute_qdelta_by_rate(rc, cpi->common.frame_type, q,
|
||||
rate_factor, cpi->common.bit_depth);
|
||||
int deltaq =
|
||||
av1_compute_qdelta_by_rate(rc, cpi->common.frame_type, q, rate_factor,
|
||||
cpi->common.seq_params.bit_depth);
|
||||
if ((-deltaq) > cr->max_qdelta_perc * q / 100) {
|
||||
deltaq = -cr->max_qdelta_perc * q / 100;
|
||||
}
|
||||
|
|
@ -164,15 +165,16 @@ int av1_cyclic_refresh_estimate_bits_at_q(const AV1_COMP *cpi,
|
|||
estimated_bits =
|
||||
(int)((1.0 - weight_segment1 - weight_segment2) *
|
||||
av1_estimate_bits_at_q(cm->frame_type, cm->base_qindex, mbs,
|
||||
correction_factor, cm->bit_depth) +
|
||||
weight_segment1 *
|
||||
av1_estimate_bits_at_q(cm->frame_type,
|
||||
cm->base_qindex + cr->qindex_delta[1],
|
||||
mbs, correction_factor, cm->bit_depth) +
|
||||
weight_segment2 *
|
||||
av1_estimate_bits_at_q(cm->frame_type,
|
||||
cm->base_qindex + cr->qindex_delta[2],
|
||||
mbs, correction_factor, cm->bit_depth));
|
||||
correction_factor,
|
||||
cm->seq_params.bit_depth) +
|
||||
weight_segment1 * av1_estimate_bits_at_q(
|
||||
cm->frame_type,
|
||||
cm->base_qindex + cr->qindex_delta[1], mbs,
|
||||
correction_factor, cm->seq_params.bit_depth) +
|
||||
weight_segment2 * av1_estimate_bits_at_q(
|
||||
cm->frame_type,
|
||||
cm->base_qindex + cr->qindex_delta[2], mbs,
|
||||
correction_factor, cm->seq_params.bit_depth));
|
||||
return estimated_bits;
|
||||
}
|
||||
|
||||
|
|
@ -197,12 +199,13 @@ int av1_cyclic_refresh_rc_bits_per_mb(const AV1_COMP *cpi, int i,
|
|||
// Compute delta-q corresponding to qindex i.
|
||||
int deltaq = compute_deltaq(cpi, i, cr->rate_ratio_qdelta);
|
||||
// Take segment weighted average for bits per mb.
|
||||
bits_per_mb = (int)((1.0 - weight_segment) *
|
||||
av1_rc_bits_per_mb(cm->frame_type, i,
|
||||
correction_factor, cm->bit_depth) +
|
||||
weight_segment *
|
||||
av1_rc_bits_per_mb(cm->frame_type, i + deltaq,
|
||||
correction_factor, cm->bit_depth));
|
||||
bits_per_mb =
|
||||
(int)((1.0 - weight_segment) *
|
||||
av1_rc_bits_per_mb(cm->frame_type, i, correction_factor,
|
||||
cm->seq_params.bit_depth) +
|
||||
weight_segment * av1_rc_bits_per_mb(cm->frame_type, i + deltaq,
|
||||
correction_factor,
|
||||
cm->seq_params.bit_depth));
|
||||
return bits_per_mb;
|
||||
}
|
||||
|
||||
|
|
@ -507,7 +510,8 @@ void av1_cyclic_refresh_setup(AV1_COMP *const cpi) {
|
|||
} else {
|
||||
int qindex_delta = 0;
|
||||
int qindex2;
|
||||
const double q = av1_convert_qindex_to_q(cm->base_qindex, cm->bit_depth);
|
||||
const double q =
|
||||
av1_convert_qindex_to_q(cm->base_qindex, cm->seq_params.bit_depth);
|
||||
aom_clear_system_state();
|
||||
// Set rate threshold to some multiple (set to 2 for now) of the target
|
||||
// rate (target is given by sb64_target_rate and scaled by 256).
|
||||
|
|
|
|||
8
third_party/aom/av1/encoder/aq_variance.c
vendored
8
third_party/aom/av1/encoder/aq_variance.c
vendored
|
|
@ -71,7 +71,7 @@ void av1_vaq_frame_setup(AV1_COMP *cpi) {
|
|||
for (i = 0; i < MAX_SEGMENTS; ++i) {
|
||||
int qindex_delta =
|
||||
av1_compute_qdelta_by_rate(&cpi->rc, cm->frame_type, cm->base_qindex,
|
||||
rate_ratio[i], cm->bit_depth);
|
||||
rate_ratio[i], cm->seq_params.bit_depth);
|
||||
|
||||
// We don't allow qindex 0 in a segment if the base value is not 0.
|
||||
// Q index 0 (lossless) implies 4x4 encoding only and in AQ mode a segment
|
||||
|
|
@ -235,9 +235,9 @@ int av1_compute_deltaq_from_energy_level(const AV1_COMP *const cpi,
|
|||
|
||||
const int rate_level = SEGMENT_ID(block_var_level);
|
||||
const AV1_COMMON *const cm = &cpi->common;
|
||||
int qindex_delta =
|
||||
av1_compute_qdelta_by_rate(&cpi->rc, cm->frame_type, cm->base_qindex,
|
||||
rate_ratio[rate_level], cm->bit_depth);
|
||||
int qindex_delta = av1_compute_qdelta_by_rate(
|
||||
&cpi->rc, cm->frame_type, cm->base_qindex, rate_ratio[rate_level],
|
||||
cm->seq_params.bit_depth);
|
||||
|
||||
if ((cm->base_qindex != 0) && ((cm->base_qindex + qindex_delta) == 0)) {
|
||||
qindex_delta = -cm->base_qindex + 1;
|
||||
|
|
|
|||
8
third_party/aom/av1/encoder/av1_quantize.c
vendored
8
third_party/aom/av1/encoder/av1_quantize.c
vendored
|
|
@ -613,9 +613,9 @@ 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->u_dc_delta_q,
|
||||
cm->u_ac_delta_q, cm->v_dc_delta_q, cm->v_ac_delta_q,
|
||||
quants, dequants);
|
||||
av1_build_quantizer(cm->seq_params.bit_depth, cm->y_dc_delta_q,
|
||||
cm->u_dc_delta_q, cm->u_ac_delta_q, cm->v_dc_delta_q,
|
||||
cm->v_ac_delta_q, quants, dequants);
|
||||
}
|
||||
|
||||
void av1_init_plane_quantizers(const AV1_COMP *cpi, MACROBLOCK *x,
|
||||
|
|
@ -713,7 +713,7 @@ void av1_set_quantizer(AV1_COMMON *cm, int q) {
|
|||
cm->qm_u = aom_get_qmlevel(cm->base_qindex + cm->u_ac_delta_q,
|
||||
cm->min_qmlevel, cm->max_qmlevel);
|
||||
|
||||
if (!cm->separate_uv_delta_q)
|
||||
if (!cm->seq_params.separate_uv_delta_q)
|
||||
cm->qm_v = cm->qm_u;
|
||||
else
|
||||
cm->qm_v = aom_get_qmlevel(cm->base_qindex + cm->v_ac_delta_q,
|
||||
|
|
|
|||
232
third_party/aom/av1/encoder/bitstream.c
vendored
232
third_party/aom/av1/encoder/bitstream.c
vendored
|
|
@ -769,7 +769,7 @@ static void write_palette_mode_info(const AV1_COMMON *cm, const MACROBLOCKD *xd,
|
|||
aom_write_symbol(w, n - PALETTE_MIN_SIZE,
|
||||
xd->tile_ctx->palette_y_size_cdf[bsize_ctx],
|
||||
PALETTE_SIZES);
|
||||
write_palette_colors_y(xd, pmi, cm->bit_depth, w);
|
||||
write_palette_colors_y(xd, pmi, cm->seq_params.bit_depth, w);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -786,7 +786,7 @@ static void write_palette_mode_info(const AV1_COMMON *cm, const MACROBLOCKD *xd,
|
|||
aom_write_symbol(w, n - PALETTE_MIN_SIZE,
|
||||
xd->tile_ctx->palette_uv_size_cdf[bsize_ctx],
|
||||
PALETTE_SIZES);
|
||||
write_palette_colors_uv(xd, pmi, cm->bit_depth, w);
|
||||
write_palette_colors_uv(xd, pmi, cm->seq_params.bit_depth, w);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1421,8 +1421,8 @@ static void write_inter_txb_coeff(AV1_COMMON *const cm, MACROBLOCK *const x,
|
|||
for (blk_col = col >> pd->subsampling_x; blk_col < unit_width;
|
||||
blk_col += bkw) {
|
||||
pack_txb_tokens(w, cm, x, tok, tok_end, xd, mbmi, plane, plane_bsize,
|
||||
cm->bit_depth, *block, blk_row, blk_col, max_tx_size,
|
||||
token_stats);
|
||||
cm->seq_params.bit_depth, *block, blk_row, blk_col,
|
||||
max_tx_size, token_stats);
|
||||
*block += step;
|
||||
}
|
||||
}
|
||||
|
|
@ -1612,14 +1612,13 @@ static void write_modes_sb(AV1_COMP *const cpi, const TileInfo *const tile,
|
|||
|
||||
const int num_planes = av1_num_planes(cm);
|
||||
for (int plane = 0; plane < num_planes; ++plane) {
|
||||
int rcol0, rcol1, rrow0, rrow1, tile_tl_idx;
|
||||
int rcol0, rcol1, rrow0, rrow1;
|
||||
if (av1_loop_restoration_corners_in_sb(cm, plane, mi_row, mi_col, bsize,
|
||||
&rcol0, &rcol1, &rrow0, &rrow1,
|
||||
&tile_tl_idx)) {
|
||||
&rcol0, &rcol1, &rrow0, &rrow1)) {
|
||||
const int rstride = cm->rst_info[plane].horz_units_per_tile;
|
||||
for (int rrow = rrow0; rrow < rrow1; ++rrow) {
|
||||
for (int rcol = rcol0; rcol < rcol1; ++rcol) {
|
||||
const int runit_idx = tile_tl_idx + rcol + rrow * rstride;
|
||||
const int runit_idx = rcol + rrow * rstride;
|
||||
const RestorationUnitInfo *rui =
|
||||
&cm->rst_info[plane].unit_info[runit_idx];
|
||||
loop_restoration_write_sb_coeffs(cm, xd, rui, w, plane,
|
||||
|
|
@ -1705,7 +1704,7 @@ static void write_modes(AV1_COMP *const cpi, const TileInfo *const tile,
|
|||
const int mi_col_end = tile->mi_col_end;
|
||||
int mi_row, mi_col;
|
||||
|
||||
av1_zero_above_context(cm, mi_col_start, mi_col_end, tile->tile_row);
|
||||
av1_zero_above_context(cm, xd, mi_col_start, mi_col_end, tile->tile_row);
|
||||
av1_init_above_context(cm, xd, tile->tile_row);
|
||||
|
||||
if (cpi->common.delta_q_present_flag) {
|
||||
|
|
@ -1779,7 +1778,7 @@ static void encode_restoration_mode(AV1_COMMON *cm,
|
|||
}
|
||||
|
||||
if (num_planes > 1) {
|
||||
int s = AOMMIN(cm->subsampling_x, cm->subsampling_y);
|
||||
int s = AOMMIN(cm->seq_params.subsampling_x, cm->seq_params.subsampling_y);
|
||||
if (s && !chroma_none) {
|
||||
aom_wb_write_bit(wb, cm->rst_info[1].restoration_unit_size !=
|
||||
cm->rst_info[0].restoration_unit_size);
|
||||
|
|
@ -2020,7 +2019,7 @@ static void encode_quantization(const AV1_COMMON *const cm,
|
|||
if (num_planes > 1) {
|
||||
int diff_uv_delta = (cm->u_dc_delta_q != cm->v_dc_delta_q) ||
|
||||
(cm->u_ac_delta_q != cm->v_ac_delta_q);
|
||||
if (cm->separate_uv_delta_q) aom_wb_write_bit(wb, diff_uv_delta);
|
||||
if (cm->seq_params.separate_uv_delta_q) aom_wb_write_bit(wb, diff_uv_delta);
|
||||
write_delta_q(wb, cm->u_dc_delta_q);
|
||||
write_delta_q(wb, cm->u_ac_delta_q);
|
||||
if (diff_uv_delta) {
|
||||
|
|
@ -2032,7 +2031,7 @@ static void encode_quantization(const AV1_COMMON *const cm,
|
|||
if (cm->using_qmatrix) {
|
||||
aom_wb_write_literal(wb, cm->qm_y, QM_LEVEL_BITS);
|
||||
aom_wb_write_literal(wb, cm->qm_u, QM_LEVEL_BITS);
|
||||
if (!cm->separate_uv_delta_q)
|
||||
if (!cm->seq_params.separate_uv_delta_q)
|
||||
assert(cm->qm_u == cm->qm_v);
|
||||
else
|
||||
aom_wb_write_literal(wb, cm->qm_v, QM_LEVEL_BITS);
|
||||
|
|
@ -2240,7 +2239,8 @@ static int get_refresh_mask_gf16(AV1_COMP *cpi) {
|
|||
#endif // USE_GF16_MULTI_LAYER
|
||||
|
||||
static int get_refresh_mask(AV1_COMP *cpi) {
|
||||
if (cpi->common.frame_type == KEY_FRAME || frame_is_sframe(&cpi->common))
|
||||
if ((cpi->common.frame_type == KEY_FRAME && cpi->common.show_frame) ||
|
||||
frame_is_sframe(&cpi->common))
|
||||
return 0xFF;
|
||||
|
||||
int refresh_mask = 0;
|
||||
|
|
@ -2258,9 +2258,15 @@ static int get_refresh_mask(AV1_COMP *cpi) {
|
|||
// LAST3_FRAME.
|
||||
refresh_mask |=
|
||||
(cpi->refresh_last_frame << cpi->ref_fb_idx[LAST_REF_FRAMES - 1]);
|
||||
|
||||
#if USE_SYMM_MULTI_LAYER
|
||||
refresh_mask |=
|
||||
(cpi->new_bwdref_update_rule == 1)
|
||||
? (cpi->refresh_bwd_ref_frame << cpi->ref_fb_idx[EXTREF_FRAME - 1])
|
||||
: (cpi->refresh_bwd_ref_frame << cpi->ref_fb_idx[BWDREF_FRAME - 1]);
|
||||
#else
|
||||
refresh_mask |=
|
||||
(cpi->refresh_bwd_ref_frame << cpi->ref_fb_idx[BWDREF_FRAME - 1]);
|
||||
#endif
|
||||
refresh_mask |=
|
||||
(cpi->refresh_alt2_ref_frame << cpi->ref_fb_idx[ALTREF2_FRAME - 1]);
|
||||
|
||||
|
|
@ -2419,80 +2425,82 @@ static void write_profile(BITSTREAM_PROFILE profile,
|
|||
aom_wb_write_literal(wb, profile, PROFILE_BITS);
|
||||
}
|
||||
|
||||
static void write_bitdepth(AV1_COMMON *const cm,
|
||||
static void write_bitdepth(const SequenceHeader *const seq_params,
|
||||
struct aom_write_bit_buffer *wb) {
|
||||
// Profile 0/1: [0] for 8 bit, [1] 10-bit
|
||||
// Profile 2: [0] for 8 bit, [10] 10-bit, [11] - 12-bit
|
||||
aom_wb_write_bit(wb, cm->bit_depth == AOM_BITS_8 ? 0 : 1);
|
||||
if (cm->profile == PROFILE_2 && cm->bit_depth != AOM_BITS_8) {
|
||||
aom_wb_write_bit(wb, cm->bit_depth == AOM_BITS_10 ? 0 : 1);
|
||||
aom_wb_write_bit(wb, seq_params->bit_depth == AOM_BITS_8 ? 0 : 1);
|
||||
if (seq_params->profile == PROFILE_2 && seq_params->bit_depth != AOM_BITS_8) {
|
||||
aom_wb_write_bit(wb, seq_params->bit_depth == AOM_BITS_10 ? 0 : 1);
|
||||
}
|
||||
}
|
||||
|
||||
static void write_color_config(AV1_COMMON *const cm,
|
||||
static void write_color_config(const SequenceHeader *const seq_params,
|
||||
struct aom_write_bit_buffer *wb) {
|
||||
write_bitdepth(cm, wb);
|
||||
const int is_monochrome = cm->seq_params.monochrome;
|
||||
write_bitdepth(seq_params, wb);
|
||||
const int is_monochrome = seq_params->monochrome;
|
||||
// monochrome bit
|
||||
if (cm->profile != PROFILE_1)
|
||||
if (seq_params->profile != PROFILE_1)
|
||||
aom_wb_write_bit(wb, is_monochrome);
|
||||
else
|
||||
assert(!is_monochrome);
|
||||
if (cm->color_primaries == AOM_CICP_CP_UNSPECIFIED &&
|
||||
cm->transfer_characteristics == AOM_CICP_TC_UNSPECIFIED &&
|
||||
cm->matrix_coefficients == AOM_CICP_MC_UNSPECIFIED) {
|
||||
if (seq_params->color_primaries == AOM_CICP_CP_UNSPECIFIED &&
|
||||
seq_params->transfer_characteristics == AOM_CICP_TC_UNSPECIFIED &&
|
||||
seq_params->matrix_coefficients == AOM_CICP_MC_UNSPECIFIED) {
|
||||
aom_wb_write_bit(wb, 0); // No color description present
|
||||
} else {
|
||||
aom_wb_write_bit(wb, 1); // Color description present
|
||||
aom_wb_write_literal(wb, cm->color_primaries, 8);
|
||||
aom_wb_write_literal(wb, cm->transfer_characteristics, 8);
|
||||
aom_wb_write_literal(wb, cm->matrix_coefficients, 8);
|
||||
aom_wb_write_literal(wb, seq_params->color_primaries, 8);
|
||||
aom_wb_write_literal(wb, seq_params->transfer_characteristics, 8);
|
||||
aom_wb_write_literal(wb, seq_params->matrix_coefficients, 8);
|
||||
}
|
||||
if (is_monochrome) {
|
||||
// 0: [16, 235] (i.e. xvYCC), 1: [0, 255]
|
||||
aom_wb_write_bit(wb, cm->color_range);
|
||||
aom_wb_write_bit(wb, seq_params->color_range);
|
||||
return;
|
||||
}
|
||||
if (cm->color_primaries == AOM_CICP_CP_BT_709 &&
|
||||
cm->transfer_characteristics == AOM_CICP_TC_SRGB &&
|
||||
cm->matrix_coefficients ==
|
||||
if (seq_params->color_primaries == AOM_CICP_CP_BT_709 &&
|
||||
seq_params->transfer_characteristics == AOM_CICP_TC_SRGB &&
|
||||
seq_params->matrix_coefficients ==
|
||||
AOM_CICP_MC_IDENTITY) { // it would be better to remove this
|
||||
// dependency too
|
||||
assert(cm->subsampling_x == 0 && cm->subsampling_y == 0);
|
||||
assert(cm->profile == PROFILE_1 ||
|
||||
(cm->profile == PROFILE_2 && cm->bit_depth == AOM_BITS_12));
|
||||
assert(seq_params->subsampling_x == 0 && seq_params->subsampling_y == 0);
|
||||
assert(seq_params->profile == PROFILE_1 ||
|
||||
(seq_params->profile == PROFILE_2 &&
|
||||
seq_params->bit_depth == AOM_BITS_12));
|
||||
} else {
|
||||
// 0: [16, 235] (i.e. xvYCC), 1: [0, 255]
|
||||
aom_wb_write_bit(wb, cm->color_range);
|
||||
if (cm->profile == PROFILE_0) {
|
||||
aom_wb_write_bit(wb, seq_params->color_range);
|
||||
if (seq_params->profile == PROFILE_0) {
|
||||
// 420 only
|
||||
assert(cm->subsampling_x == 1 && cm->subsampling_y == 1);
|
||||
} else if (cm->profile == PROFILE_1) {
|
||||
assert(seq_params->subsampling_x == 1 && seq_params->subsampling_y == 1);
|
||||
} else if (seq_params->profile == PROFILE_1) {
|
||||
// 444 only
|
||||
assert(cm->subsampling_x == 0 && cm->subsampling_y == 0);
|
||||
} else if (cm->profile == PROFILE_2) {
|
||||
if (cm->bit_depth == AOM_BITS_12) {
|
||||
assert(seq_params->subsampling_x == 0 && seq_params->subsampling_y == 0);
|
||||
} else if (seq_params->profile == PROFILE_2) {
|
||||
if (seq_params->bit_depth == AOM_BITS_12) {
|
||||
// 420, 444 or 422
|
||||
aom_wb_write_bit(wb, cm->subsampling_x);
|
||||
if (cm->subsampling_x == 0) {
|
||||
assert(cm->subsampling_y == 0 &&
|
||||
aom_wb_write_bit(wb, seq_params->subsampling_x);
|
||||
if (seq_params->subsampling_x == 0) {
|
||||
assert(seq_params->subsampling_y == 0 &&
|
||||
"4:4:0 subsampling not allowed in AV1");
|
||||
} else {
|
||||
aom_wb_write_bit(wb, cm->subsampling_y);
|
||||
aom_wb_write_bit(wb, seq_params->subsampling_y);
|
||||
}
|
||||
} else {
|
||||
// 422 only
|
||||
assert(cm->subsampling_x == 1 && cm->subsampling_y == 0);
|
||||
assert(seq_params->subsampling_x == 1 &&
|
||||
seq_params->subsampling_y == 0);
|
||||
}
|
||||
}
|
||||
if (cm->matrix_coefficients == AOM_CICP_MC_IDENTITY) {
|
||||
assert(cm->subsampling_x == 0 && cm->subsampling_y == 0);
|
||||
if (seq_params->matrix_coefficients == AOM_CICP_MC_IDENTITY) {
|
||||
assert(seq_params->subsampling_x == 0 && seq_params->subsampling_y == 0);
|
||||
}
|
||||
if (cm->subsampling_x == 1 && cm->subsampling_y == 1) {
|
||||
aom_wb_write_literal(wb, cm->chroma_sample_position, 2);
|
||||
if (seq_params->subsampling_x == 1 && seq_params->subsampling_y == 1) {
|
||||
aom_wb_write_literal(wb, seq_params->chroma_sample_position, 2);
|
||||
}
|
||||
}
|
||||
aom_wb_write_bit(wb, cm->separate_uv_delta_q);
|
||||
aom_wb_write_bit(wb, seq_params->separate_uv_delta_q);
|
||||
}
|
||||
|
||||
static void write_timing_info_header(AV1_COMMON *const cm,
|
||||
|
|
@ -2517,8 +2525,8 @@ static void write_decoder_model_info(AV1_COMMON *const cm,
|
|||
wb, cm->buffer_model.encoder_decoder_buffer_delay_length - 1, 5);
|
||||
aom_wb_write_unsigned_literal(wb, cm->buffer_model.num_units_in_decoding_tick,
|
||||
32); // Number of units in decoding tick
|
||||
aom_wb_write_literal(wb, cm->buffer_model.buffer_removal_delay_length - 1, 5);
|
||||
aom_wb_write_literal(wb, cm->buffer_model.frame_presentation_delay_length - 1,
|
||||
aom_wb_write_literal(wb, cm->buffer_model.buffer_removal_time_length - 1, 5);
|
||||
aom_wb_write_literal(wb, cm->buffer_model.frame_presentation_time_length - 1,
|
||||
5);
|
||||
}
|
||||
|
||||
|
|
@ -2533,23 +2541,25 @@ static void write_dec_model_op_parameters(AV1_COMMON *const cm,
|
|||
// aom_wb_write_bit(wb, cm->op_params[op_num].has_parameters);
|
||||
// if (!cm->op_params[op_num].has_parameters) return;
|
||||
|
||||
aom_wb_write_literal(wb, cm->op_params[op_num].decoder_buffer_delay,
|
||||
cm->buffer_model.encoder_decoder_buffer_delay_length);
|
||||
aom_wb_write_unsigned_literal(
|
||||
wb, cm->op_params[op_num].decoder_buffer_delay,
|
||||
cm->buffer_model.encoder_decoder_buffer_delay_length);
|
||||
|
||||
aom_wb_write_literal(wb, cm->op_params[op_num].encoder_buffer_delay,
|
||||
cm->buffer_model.encoder_decoder_buffer_delay_length);
|
||||
aom_wb_write_unsigned_literal(
|
||||
wb, cm->op_params[op_num].encoder_buffer_delay,
|
||||
cm->buffer_model.encoder_decoder_buffer_delay_length);
|
||||
|
||||
aom_wb_write_bit(wb, cm->op_params[op_num].low_delay_mode_flag);
|
||||
|
||||
cm->op_frame_timing[op_num].buffer_removal_delay =
|
||||
cm->op_frame_timing[op_num].buffer_removal_time =
|
||||
0; // reset the decoded frame counter
|
||||
}
|
||||
|
||||
static void write_tu_pts_info(AV1_COMMON *const cm,
|
||||
struct aom_write_bit_buffer *wb) {
|
||||
aom_wb_write_unsigned_literal(
|
||||
wb, (uint32_t)cm->tu_presentation_delay,
|
||||
cm->buffer_model.frame_presentation_delay_length);
|
||||
wb, cm->frame_presentation_time,
|
||||
cm->buffer_model.frame_presentation_time_length);
|
||||
}
|
||||
|
||||
static void write_film_grain_params(AV1_COMP *cpi,
|
||||
|
|
@ -2601,8 +2611,8 @@ static void write_film_grain_params(AV1_COMP *cpi,
|
|||
pars->chroma_scaling_from_luma = 0; // for monochrome override to 0
|
||||
|
||||
if (cm->seq_params.monochrome || pars->chroma_scaling_from_luma ||
|
||||
((cm->subsampling_x == 1) && (cm->subsampling_y == 1) &&
|
||||
(pars->num_y_points == 0))) {
|
||||
((cm->seq_params.subsampling_x == 1) &&
|
||||
(cm->seq_params.subsampling_y == 1) && (pars->num_y_points == 0))) {
|
||||
pars->num_cb_points = 0;
|
||||
pars->num_cr_points = 0;
|
||||
} else {
|
||||
|
|
@ -2931,18 +2941,19 @@ static void write_uncompressed_header_obu(AV1_COMP *cpi,
|
|||
struct aom_write_bit_buffer *saved_wb,
|
||||
struct aom_write_bit_buffer *wb) {
|
||||
AV1_COMMON *const cm = &cpi->common;
|
||||
const SequenceHeader *const seq_params = &cm->seq_params;
|
||||
MACROBLOCKD *const xd = &cpi->td.mb.e_mbd;
|
||||
|
||||
// NOTE: By default all coded frames to be used as a reference
|
||||
cm->is_reference_frame = 1;
|
||||
cm->frame_type = cm->intra_only ? INTRA_ONLY_FRAME : cm->frame_type;
|
||||
|
||||
if (cm->seq_params.still_picture) {
|
||||
if (seq_params->still_picture) {
|
||||
assert(cm->show_existing_frame == 0);
|
||||
assert(cm->show_frame == 1);
|
||||
assert(cm->frame_type == KEY_FRAME);
|
||||
}
|
||||
if (!cm->seq_params.reduced_still_picture_hdr) {
|
||||
if (!seq_params->reduced_still_picture_hdr) {
|
||||
if (cm->show_existing_frame) {
|
||||
RefCntBuffer *const frame_bufs = cm->buffer_pool->frame_bufs;
|
||||
const int frame_to_show = cm->ref_frame_map[cpi->existing_fb_idx_to_show];
|
||||
|
|
@ -2957,12 +2968,12 @@ static void write_uncompressed_header_obu(AV1_COMP *cpi,
|
|||
aom_wb_write_bit(wb, 1); // show_existing_frame
|
||||
aom_wb_write_literal(wb, cpi->existing_fb_idx_to_show, 3);
|
||||
|
||||
if (cm->seq_params.decoder_model_info_present_flag &&
|
||||
if (seq_params->decoder_model_info_present_flag &&
|
||||
cm->timing_info.equal_picture_interval == 0) {
|
||||
write_tu_pts_info(cm, wb);
|
||||
}
|
||||
if (cm->seq_params.frame_id_numbers_present_flag) {
|
||||
int frame_id_len = cm->seq_params.frame_id_length;
|
||||
if (seq_params->frame_id_numbers_present_flag) {
|
||||
int frame_id_len = seq_params->frame_id_length;
|
||||
int display_frame_id = cm->ref_frame_id[cpi->existing_fb_idx_to_show];
|
||||
aom_wb_write_literal(wb, display_frame_id, frame_id_len);
|
||||
}
|
||||
|
|
@ -2983,7 +2994,7 @@ static void write_uncompressed_header_obu(AV1_COMP *cpi,
|
|||
|
||||
aom_wb_write_bit(wb, cm->show_frame);
|
||||
if (cm->show_frame) {
|
||||
if (cm->seq_params.decoder_model_info_present_flag &&
|
||||
if (seq_params->decoder_model_info_present_flag &&
|
||||
cm->timing_info.equal_picture_interval == 0)
|
||||
write_tu_pts_info(cm, wb);
|
||||
} else {
|
||||
|
|
@ -2997,18 +3008,18 @@ static void write_uncompressed_header_obu(AV1_COMP *cpi,
|
|||
}
|
||||
aom_wb_write_bit(wb, cm->disable_cdf_update);
|
||||
|
||||
if (cm->seq_params.force_screen_content_tools == 2) {
|
||||
if (seq_params->force_screen_content_tools == 2) {
|
||||
aom_wb_write_bit(wb, cm->allow_screen_content_tools);
|
||||
} else {
|
||||
assert(cm->allow_screen_content_tools ==
|
||||
cm->seq_params.force_screen_content_tools);
|
||||
seq_params->force_screen_content_tools);
|
||||
}
|
||||
|
||||
if (cm->allow_screen_content_tools) {
|
||||
if (cm->seq_params.force_integer_mv == 2) {
|
||||
if (seq_params->force_integer_mv == 2) {
|
||||
aom_wb_write_bit(wb, cm->cur_frame_force_integer_mv);
|
||||
} else {
|
||||
assert(cm->cur_frame_force_integer_mv == cm->seq_params.force_integer_mv);
|
||||
assert(cm->cur_frame_force_integer_mv == seq_params->force_integer_mv);
|
||||
}
|
||||
} else {
|
||||
assert(cm->cur_frame_force_integer_mv == 0);
|
||||
|
|
@ -3018,53 +3029,57 @@ static void write_uncompressed_header_obu(AV1_COMP *cpi,
|
|||
int frame_size_override_flag = 0;
|
||||
cm->frame_refs_short_signaling = 0;
|
||||
|
||||
if (cm->seq_params.reduced_still_picture_hdr) {
|
||||
assert(cm->width == cm->seq_params.max_frame_width &&
|
||||
cm->height == cm->seq_params.max_frame_height);
|
||||
if (seq_params->reduced_still_picture_hdr) {
|
||||
assert(cm->width == seq_params->max_frame_width &&
|
||||
cm->height == seq_params->max_frame_height);
|
||||
} else {
|
||||
if (cm->seq_params.frame_id_numbers_present_flag) {
|
||||
int frame_id_len = cm->seq_params.frame_id_length;
|
||||
if (seq_params->frame_id_numbers_present_flag) {
|
||||
int frame_id_len = seq_params->frame_id_length;
|
||||
aom_wb_write_literal(wb, cm->current_frame_id, frame_id_len);
|
||||
}
|
||||
|
||||
if (cm->width > cm->seq_params.max_frame_width ||
|
||||
cm->height > cm->seq_params.max_frame_height) {
|
||||
if (cm->width > seq_params->max_frame_width ||
|
||||
cm->height > seq_params->max_frame_height) {
|
||||
aom_internal_error(&cm->error, AOM_CODEC_UNSUP_BITSTREAM,
|
||||
"Frame dimensions are larger than the maximum values");
|
||||
}
|
||||
|
||||
frame_size_override_flag =
|
||||
frame_is_sframe(cm) ? 1
|
||||
: (cm->width != cm->seq_params.max_frame_width ||
|
||||
cm->height != cm->seq_params.max_frame_height);
|
||||
: (cm->width != seq_params->max_frame_width ||
|
||||
cm->height != seq_params->max_frame_height);
|
||||
if (!frame_is_sframe(cm)) aom_wb_write_bit(wb, frame_size_override_flag);
|
||||
|
||||
if (cm->seq_params.enable_order_hint)
|
||||
if (seq_params->enable_order_hint)
|
||||
aom_wb_write_literal(wb, cm->frame_offset,
|
||||
cm->seq_params.order_hint_bits_minus_1 + 1);
|
||||
seq_params->order_hint_bits_minus_1 + 1);
|
||||
|
||||
if (!cm->error_resilient_mode && !frame_is_intra_only(cm)) {
|
||||
aom_wb_write_literal(wb, cm->primary_ref_frame, PRIMARY_REF_BITS);
|
||||
}
|
||||
}
|
||||
|
||||
if (cm->seq_params.decoder_model_info_present_flag) {
|
||||
aom_wb_write_bit(wb, cm->buffer_removal_delay_present);
|
||||
if (cm->buffer_removal_delay_present) {
|
||||
if (seq_params->decoder_model_info_present_flag) {
|
||||
aom_wb_write_bit(wb, cm->buffer_removal_time_present);
|
||||
if (cm->buffer_removal_time_present) {
|
||||
for (int op_num = 0;
|
||||
op_num < cm->seq_params.operating_points_cnt_minus_1 + 1; op_num++) {
|
||||
op_num < seq_params->operating_points_cnt_minus_1 + 1; op_num++) {
|
||||
if (cm->op_params[op_num].decoder_model_param_present_flag) {
|
||||
if (((cm->seq_params.operating_point_idc[op_num] >>
|
||||
if (((seq_params->operating_point_idc[op_num] >>
|
||||
cm->temporal_layer_id) &
|
||||
0x1 &&
|
||||
(cm->seq_params.operating_point_idc[op_num] >>
|
||||
(seq_params->operating_point_idc[op_num] >>
|
||||
(cm->spatial_layer_id + 8)) &
|
||||
0x1) ||
|
||||
cm->seq_params.operating_point_idc[op_num] == 0) {
|
||||
aom_wb_write_literal(
|
||||
wb, (uint32_t)cm->op_frame_timing[op_num].buffer_removal_delay,
|
||||
cm->buffer_model.buffer_removal_delay_length);
|
||||
cm->op_frame_timing[op_num].buffer_removal_delay++;
|
||||
seq_params->operating_point_idc[op_num] == 0) {
|
||||
aom_wb_write_unsigned_literal(
|
||||
wb, cm->op_frame_timing[op_num].buffer_removal_time,
|
||||
cm->buffer_model.buffer_removal_time_length);
|
||||
cm->op_frame_timing[op_num].buffer_removal_time++;
|
||||
if (cm->op_frame_timing[op_num].buffer_removal_time == 0) {
|
||||
aom_internal_error(&cm->error, AOM_CODEC_UNSUP_BITSTREAM,
|
||||
"buffer_removal_time overflowed");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3122,7 +3137,7 @@ static void write_uncompressed_header_obu(AV1_COMP *cpi,
|
|||
|
||||
if (!frame_is_intra_only(cm) || cpi->refresh_frame_mask != 0xFF) {
|
||||
// Write all ref frame order hints if error_resilient_mode == 1
|
||||
if (cm->error_resilient_mode && cm->seq_params.enable_order_hint) {
|
||||
if (cm->error_resilient_mode && seq_params->enable_order_hint) {
|
||||
RefCntBuffer *const frame_bufs = cm->buffer_pool->frame_bufs;
|
||||
for (int ref_idx = 0; ref_idx < REF_FRAMES; ref_idx++) {
|
||||
// Get buffer index
|
||||
|
|
@ -3131,7 +3146,7 @@ static void write_uncompressed_header_obu(AV1_COMP *cpi,
|
|||
|
||||
// Write order hint to bit stream
|
||||
aom_wb_write_literal(wb, frame_bufs[buf_idx].cur_frame_offset,
|
||||
cm->seq_params.order_hint_bits_minus_1 + 1);
|
||||
seq_params->order_hint_bits_minus_1 + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3156,7 +3171,7 @@ static void write_uncompressed_header_obu(AV1_COMP *cpi,
|
|||
// automatically.
|
||||
#define FRAME_REFS_SHORT_SIGNALING 0
|
||||
#if FRAME_REFS_SHORT_SIGNALING
|
||||
cm->frame_refs_short_signaling = cm->seq_params.enable_order_hint;
|
||||
cm->frame_refs_short_signaling = seq_params->enable_order_hint;
|
||||
#endif // FRAME_REFS_SHORT_SIGNALING
|
||||
|
||||
if (cm->frame_refs_short_signaling) {
|
||||
|
|
@ -3167,7 +3182,7 @@ static void write_uncompressed_header_obu(AV1_COMP *cpi,
|
|||
check_frame_refs_short_signaling(cpi);
|
||||
}
|
||||
|
||||
if (cm->seq_params.enable_order_hint)
|
||||
if (seq_params->enable_order_hint)
|
||||
aom_wb_write_bit(wb, cm->frame_refs_short_signaling);
|
||||
|
||||
if (cm->frame_refs_short_signaling) {
|
||||
|
|
@ -3183,10 +3198,10 @@ static void write_uncompressed_header_obu(AV1_COMP *cpi,
|
|||
if (!cm->frame_refs_short_signaling)
|
||||
aom_wb_write_literal(wb, get_ref_frame_map_idx(cpi, ref_frame),
|
||||
REF_FRAMES_LOG2);
|
||||
if (cm->seq_params.frame_id_numbers_present_flag) {
|
||||
if (seq_params->frame_id_numbers_present_flag) {
|
||||
int i = get_ref_frame_map_idx(cpi, ref_frame);
|
||||
int frame_id_len = cm->seq_params.frame_id_length;
|
||||
int diff_len = cm->seq_params.delta_frame_id_length;
|
||||
int frame_id_len = seq_params->frame_id_length;
|
||||
int diff_len = seq_params->delta_frame_id_length;
|
||||
int delta_frame_id_minus_1 =
|
||||
((cm->current_frame_id - cm->ref_frame_id[i] +
|
||||
(1 << frame_id_len)) %
|
||||
|
|
@ -3222,7 +3237,7 @@ static void write_uncompressed_header_obu(AV1_COMP *cpi,
|
|||
}
|
||||
|
||||
const int might_bwd_adapt =
|
||||
!(cm->seq_params.reduced_still_picture_hdr) && !(cm->disable_cdf_update);
|
||||
!(seq_params->reduced_still_picture_hdr) && !(cm->disable_cdf_update);
|
||||
if (cm->large_scale_tile)
|
||||
cm->refresh_frame_context = REFRESH_FRAME_CONTEXT_DISABLED;
|
||||
|
||||
|
|
@ -3282,7 +3297,8 @@ static void write_uncompressed_header_obu(AV1_COMP *cpi,
|
|||
|
||||
if (!frame_is_intra_only(cm)) write_global_motion(cpi, wb);
|
||||
|
||||
if (cm->film_grain_params_present && (cm->show_frame || cm->showable_frame)) {
|
||||
if (seq_params->film_grain_params_present &&
|
||||
(cm->show_frame || cm->showable_frame)) {
|
||||
int flip_back_update_parameters_flag = 0;
|
||||
if (cm->frame_type != INTER_FRAME &&
|
||||
cm->film_grain_params.update_parameters == 0) {
|
||||
|
|
@ -3497,7 +3513,7 @@ static uint32_t write_sequence_header_obu(AV1_COMP *cpi, uint8_t *const dst) {
|
|||
struct aom_write_bit_buffer wb = { dst, 0 };
|
||||
uint32_t size = 0;
|
||||
|
||||
write_profile(cm->profile, &wb);
|
||||
write_profile(cm->seq_params.profile, &wb);
|
||||
|
||||
// Still picture or not
|
||||
aom_wb_write_bit(&wb, cm->seq_params.still_picture);
|
||||
|
|
@ -3551,9 +3567,9 @@ static uint32_t write_sequence_header_obu(AV1_COMP *cpi, uint8_t *const dst) {
|
|||
}
|
||||
write_sequence_header(cpi, &wb);
|
||||
|
||||
write_color_config(cm, &wb);
|
||||
write_color_config(&cm->seq_params, &wb);
|
||||
|
||||
aom_wb_write_bit(&wb, cm->film_grain_params_present);
|
||||
aom_wb_write_bit(&wb, cm->seq_params.film_grain_params_present);
|
||||
|
||||
add_trailing_bits(&wb);
|
||||
|
||||
|
|
@ -3960,7 +3976,7 @@ int av1_pack_bitstream(AV1_COMP *const cpi, uint8_t *dst, size_t *size) {
|
|||
// The TD is now written outside the frame encode loop
|
||||
|
||||
// write sequence header obu if KEY_FRAME, preceded by 4-byte size
|
||||
if (cm->frame_type == KEY_FRAME) {
|
||||
if (cm->frame_type == KEY_FRAME && cm->show_frame) {
|
||||
obu_header_size = write_obu_header(OBU_SEQUENCE_HEADER, 0, data);
|
||||
|
||||
obu_payload_size = write_sequence_header_obu(cpi, data + obu_header_size);
|
||||
|
|
|
|||
2
third_party/aom/av1/encoder/block.h
vendored
2
third_party/aom/av1/encoder/block.h
vendored
|
|
@ -224,6 +224,7 @@ struct macroblock {
|
|||
int sadperbit4;
|
||||
int rdmult;
|
||||
int mb_energy;
|
||||
int sb_energy_level;
|
||||
int *m_search_count_ptr;
|
||||
int *ex_search_count_ptr;
|
||||
|
||||
|
|
@ -258,7 +259,6 @@ struct macroblock {
|
|||
MvLimits mv_limits;
|
||||
|
||||
uint8_t blk_skip[MAX_MIB_SIZE * MAX_MIB_SIZE];
|
||||
uint8_t blk_skip_drl[MAX_MIB_SIZE * MAX_MIB_SIZE];
|
||||
|
||||
int skip;
|
||||
int skip_chroma_rd;
|
||||
|
|
|
|||
11
third_party/aom/av1/encoder/dwt.c
vendored
11
third_party/aom/av1/encoder/dwt.c
vendored
|
|
@ -1,3 +1,14 @@
|
|||
/*
|
||||
* Copyright (c) 2018, Alliance for Open Media. All rights reserved
|
||||
*
|
||||
* This source code is subject to the terms of the BSD 2 Clause License and
|
||||
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
|
||||
* was not distributed with this source code in the LICENSE file, you can
|
||||
* obtain it at www.aomedia.org/license/software. If the Alliance for Open
|
||||
* Media Patent License 1.0 was not distributed with this source code in the
|
||||
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
|
|
|||
11
third_party/aom/av1/encoder/dwt.h
vendored
11
third_party/aom/av1/encoder/dwt.h
vendored
|
|
@ -1,3 +1,14 @@
|
|||
/*
|
||||
* Copyright (c) 2018, Alliance for Open Media. All rights reserved
|
||||
*
|
||||
* This source code is subject to the terms of the BSD 2 Clause License and
|
||||
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
|
||||
* was not distributed with this source code in the LICENSE file, you can
|
||||
* obtain it at www.aomedia.org/license/software. If the Alliance for Open
|
||||
* Media Patent License 1.0 was not distributed with this source code in the
|
||||
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
|
||||
*/
|
||||
|
||||
#include "av1/common/common.h"
|
||||
#include "av1/common/enums.h"
|
||||
|
||||
|
|
|
|||
263
third_party/aom/av1/encoder/encodeframe.c
vendored
263
third_party/aom/av1/encoder/encodeframe.c
vendored
|
|
@ -41,7 +41,6 @@
|
|||
#include "av1/common/seg_common.h"
|
||||
#include "av1/common/tile_common.h"
|
||||
|
||||
#include "av1/encoder/ab_partition_model_weights.h"
|
||||
#include "av1/encoder/aq_complexity.h"
|
||||
#include "av1/encoder/aq_cyclicrefresh.h"
|
||||
#include "av1/encoder/aq_variance.h"
|
||||
|
|
@ -54,6 +53,7 @@
|
|||
#include "av1/encoder/ethread.h"
|
||||
#include "av1/encoder/extend.h"
|
||||
#include "av1/encoder/ml.h"
|
||||
#include "av1/encoder/partition_model_weights.h"
|
||||
#include "av1/encoder/rd.h"
|
||||
#include "av1/encoder/rdopt.h"
|
||||
#include "av1/encoder/segmentation.h"
|
||||
|
|
@ -2099,7 +2099,7 @@ static void rd_auto_partition_range(AV1_COMP *cpi, const TileInfo *const tile,
|
|||
// When use_square_partition_only is true, make sure at least one square
|
||||
// partition is allowed by selecting the next smaller square size as
|
||||
// *min_block_size.
|
||||
if (cpi->sf.use_square_partition_only) {
|
||||
if (min_size >= cpi->sf.use_square_partition_only_threshold) {
|
||||
min_size = AOMMIN(min_size, next_square_size[max_size]);
|
||||
}
|
||||
|
||||
|
|
@ -2363,6 +2363,7 @@ static int64_t dist_8x8_yuv(const AV1_COMP *const cpi, MACROBLOCK *const x,
|
|||
static void reset_partition(PC_TREE *pc_tree, BLOCK_SIZE bsize) {
|
||||
pc_tree->partitioning = PARTITION_NONE;
|
||||
pc_tree->cb_search_range = SEARCH_FULL_PLANE;
|
||||
pc_tree->none.skip = 0;
|
||||
|
||||
if (bsize >= BLOCK_8X8) {
|
||||
BLOCK_SIZE subsize = get_partition_subsize(bsize, PARTITION_SPLIT);
|
||||
|
|
@ -2876,6 +2877,168 @@ static void ml_prune_ab_partition(BLOCK_SIZE bsize, int part_ctx, int var_ctx,
|
|||
}
|
||||
}
|
||||
|
||||
#define FEATURES 18
|
||||
#define LABELS 4
|
||||
// Use a ML model to predict if horz4 and vert4 should be considered.
|
||||
static void ml_prune_4_partition(const AV1_COMP *const cpi,
|
||||
const MACROBLOCK *const x, BLOCK_SIZE bsize,
|
||||
int part_ctx, int64_t best_rd,
|
||||
int64_t horz_rd[2], int64_t vert_rd[2],
|
||||
int64_t split_rd[4],
|
||||
int *const partition_horz4_allowed,
|
||||
int *const partition_vert4_allowed) {
|
||||
if (best_rd >= 1000000000) return;
|
||||
const NN_CONFIG *nn_config = NULL;
|
||||
switch (bsize) {
|
||||
case BLOCK_16X16: nn_config = &av1_4_partition_nnconfig_16; break;
|
||||
case BLOCK_32X32: nn_config = &av1_4_partition_nnconfig_32; break;
|
||||
case BLOCK_64X64: nn_config = &av1_4_partition_nnconfig_64; break;
|
||||
default: assert(0 && "Unexpected bsize.");
|
||||
}
|
||||
if (!nn_config) return;
|
||||
|
||||
aom_clear_system_state();
|
||||
|
||||
// Generate features.
|
||||
float features[FEATURES];
|
||||
int feature_index = 0;
|
||||
features[feature_index++] = (float)part_ctx;
|
||||
features[feature_index++] = (float)get_unsigned_bits(x->source_variance);
|
||||
|
||||
const int rdcost = (int)AOMMIN(INT_MAX, best_rd);
|
||||
int sub_block_rdcost[8] = { 0 };
|
||||
int rd_index = 0;
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
if (horz_rd[i] > 0 && horz_rd[i] < 1000000000)
|
||||
sub_block_rdcost[rd_index] = (int)horz_rd[i];
|
||||
++rd_index;
|
||||
}
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
if (vert_rd[i] > 0 && vert_rd[i] < 1000000000)
|
||||
sub_block_rdcost[rd_index] = (int)vert_rd[i];
|
||||
++rd_index;
|
||||
}
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
if (split_rd[i] > 0 && split_rd[i] < 1000000000)
|
||||
sub_block_rdcost[rd_index] = (int)split_rd[i];
|
||||
++rd_index;
|
||||
}
|
||||
for (int i = 0; i < 8; ++i) {
|
||||
// Ratio between the sub-block RD and the whole-block RD.
|
||||
float rd_ratio = 1.0f;
|
||||
if (sub_block_rdcost[i] > 0 && sub_block_rdcost[i] < rdcost)
|
||||
rd_ratio = (float)sub_block_rdcost[i] / (float)rdcost;
|
||||
features[feature_index++] = rd_ratio;
|
||||
}
|
||||
|
||||
// Get variance of the 1:4 and 4:1 sub-blocks.
|
||||
unsigned int horz_4_source_var[4] = { 0 };
|
||||
unsigned int vert_4_source_var[4] = { 0 };
|
||||
{
|
||||
BLOCK_SIZE horz_4_bs = get_partition_subsize(bsize, PARTITION_HORZ_4);
|
||||
BLOCK_SIZE vert_4_bs = get_partition_subsize(bsize, PARTITION_VERT_4);
|
||||
const int src_stride = x->plane[0].src.stride;
|
||||
const uint8_t *src = x->plane[0].src.buf;
|
||||
const MACROBLOCKD *const xd = &x->e_mbd;
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
const uint8_t *horz_src =
|
||||
src + i * block_size_high[horz_4_bs] * src_stride;
|
||||
const uint8_t *vert_src = src + i * block_size_wide[vert_4_bs];
|
||||
unsigned int horz_var, vert_var, sse;
|
||||
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
|
||||
switch (xd->bd) {
|
||||
case 10:
|
||||
horz_var = cpi->fn_ptr[horz_4_bs].vf(
|
||||
horz_src, src_stride, CONVERT_TO_BYTEPTR(AV1_HIGH_VAR_OFFS_10),
|
||||
0, &sse);
|
||||
vert_var = cpi->fn_ptr[vert_4_bs].vf(
|
||||
vert_src, src_stride, CONVERT_TO_BYTEPTR(AV1_HIGH_VAR_OFFS_10),
|
||||
0, &sse);
|
||||
break;
|
||||
case 12:
|
||||
horz_var = cpi->fn_ptr[horz_4_bs].vf(
|
||||
horz_src, src_stride, CONVERT_TO_BYTEPTR(AV1_HIGH_VAR_OFFS_12),
|
||||
0, &sse);
|
||||
vert_var = cpi->fn_ptr[vert_4_bs].vf(
|
||||
vert_src, src_stride, CONVERT_TO_BYTEPTR(AV1_HIGH_VAR_OFFS_12),
|
||||
0, &sse);
|
||||
break;
|
||||
case 8:
|
||||
default:
|
||||
horz_var = cpi->fn_ptr[horz_4_bs].vf(
|
||||
horz_src, src_stride, CONVERT_TO_BYTEPTR(AV1_HIGH_VAR_OFFS_8),
|
||||
0, &sse);
|
||||
vert_var = cpi->fn_ptr[vert_4_bs].vf(
|
||||
vert_src, src_stride, CONVERT_TO_BYTEPTR(AV1_HIGH_VAR_OFFS_8),
|
||||
0, &sse);
|
||||
break;
|
||||
}
|
||||
horz_4_source_var[i] =
|
||||
ROUND_POWER_OF_TWO(horz_var, num_pels_log2_lookup[horz_4_bs]);
|
||||
vert_4_source_var[i] =
|
||||
ROUND_POWER_OF_TWO(vert_var, num_pels_log2_lookup[vert_4_bs]);
|
||||
} else {
|
||||
horz_var = cpi->fn_ptr[horz_4_bs].vf(horz_src, src_stride, AV1_VAR_OFFS,
|
||||
0, &sse);
|
||||
vert_var = cpi->fn_ptr[vert_4_bs].vf(vert_src, src_stride, AV1_VAR_OFFS,
|
||||
0, &sse);
|
||||
horz_4_source_var[i] =
|
||||
ROUND_POWER_OF_TWO(horz_var, num_pels_log2_lookup[horz_4_bs]);
|
||||
vert_4_source_var[i] =
|
||||
ROUND_POWER_OF_TWO(vert_var, num_pels_log2_lookup[vert_4_bs]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const float denom = (float)(x->source_variance + 1);
|
||||
const float low_b = 0.1f;
|
||||
const float high_b = 10.0f;
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
// Ratio between the 4:1 sub-block variance and the whole-block variance.
|
||||
float var_ratio = (float)(horz_4_source_var[i] + 1) / denom;
|
||||
if (var_ratio < low_b) var_ratio = low_b;
|
||||
if (var_ratio > high_b) var_ratio = high_b;
|
||||
features[feature_index++] = var_ratio;
|
||||
}
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
// Ratio between the 1:4 sub-block RD and the whole-block RD.
|
||||
float var_ratio = (float)(vert_4_source_var[i] + 1) / denom;
|
||||
if (var_ratio < low_b) var_ratio = low_b;
|
||||
if (var_ratio > high_b) var_ratio = high_b;
|
||||
features[feature_index++] = var_ratio;
|
||||
}
|
||||
assert(feature_index == FEATURES);
|
||||
|
||||
// Calculate scores using the NN model.
|
||||
float score[LABELS] = { 0.0f };
|
||||
av1_nn_predict(features, nn_config, score);
|
||||
int int_score[LABELS];
|
||||
int max_score = -1000;
|
||||
for (int i = 0; i < LABELS; ++i) {
|
||||
int_score[i] = (int)(100 * score[i]);
|
||||
max_score = AOMMAX(int_score[i], max_score);
|
||||
}
|
||||
|
||||
// Make decisions based on the model scores.
|
||||
int thresh = max_score;
|
||||
switch (bsize) {
|
||||
case BLOCK_16X16: thresh -= 400; break;
|
||||
case BLOCK_32X32: thresh -= 400; break;
|
||||
case BLOCK_64X64: thresh -= 100; break;
|
||||
default: break;
|
||||
}
|
||||
*partition_horz4_allowed = 0;
|
||||
*partition_vert4_allowed = 0;
|
||||
for (int i = 0; i < LABELS; ++i) {
|
||||
if (int_score[i] >= thresh) {
|
||||
if ((i >> 0) & 1) *partition_horz4_allowed = 1;
|
||||
if ((i >> 1) & 1) *partition_vert4_allowed = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
#undef FEATURES
|
||||
#undef LABELS
|
||||
|
||||
// TODO(jingning,jimbankoski,rbultje): properly skip partition types that are
|
||||
// unlikely to be selected depending on previous rate-distortion optimization
|
||||
// results, for encoding speed-up.
|
||||
|
|
@ -3003,7 +3166,8 @@ static void rd_pick_partition(const AV1_COMP *const cpi, ThreadData *td,
|
|||
partition_vert_allowed &= partition_allowed || !has_cols;
|
||||
do_square_split &= bsize > min_size;
|
||||
}
|
||||
if (cpi->sf.use_square_partition_only) {
|
||||
|
||||
if (bsize > cpi->sf.use_square_partition_only_threshold) {
|
||||
partition_horz_allowed &= !has_rows;
|
||||
partition_vert_allowed &= !has_cols;
|
||||
}
|
||||
|
|
@ -3480,13 +3644,6 @@ BEGIN_PARTITION_SEARCH:
|
|||
const int ext_partition_allowed =
|
||||
do_rectangular_split && bsize > BLOCK_8X8 && partition_none_allowed;
|
||||
|
||||
// partition4_allowed is 1 if we can use a PARTITION_HORZ_4 or
|
||||
// PARTITION_VERT_4 for this block. This is almost the same as
|
||||
// ext_partition_allowed, except that we don't allow 128x32 or 32x128 blocks,
|
||||
// so we require that bsize is not BLOCK_128X128.
|
||||
const int partition4_allowed =
|
||||
ext_partition_allowed && bsize != BLOCK_128X128;
|
||||
|
||||
// The standard AB partitions are allowed whenever ext-partition-types are
|
||||
// allowed
|
||||
int horzab_partition_allowed = ext_partition_allowed;
|
||||
|
|
@ -3642,15 +3799,34 @@ BEGIN_PARTITION_SEARCH:
|
|||
restore_context(x, &x_ctx, mi_row, mi_col, bsize, num_planes);
|
||||
}
|
||||
|
||||
// PARTITION_HORZ_4
|
||||
// partition4_allowed is 1 if we can use a PARTITION_HORZ_4 or
|
||||
// PARTITION_VERT_4 for this block. This is almost the same as
|
||||
// ext_partition_allowed, except that we don't allow 128x32 or 32x128 blocks,
|
||||
// so we require that bsize is not BLOCK_128X128.
|
||||
const int partition4_allowed =
|
||||
ext_partition_allowed && bsize != BLOCK_128X128;
|
||||
int partition_horz4_allowed = partition4_allowed && partition_horz_allowed;
|
||||
int partition_vert4_allowed = partition4_allowed && partition_vert_allowed;
|
||||
if (cpi->sf.prune_ext_partition_types_search_level == 2) {
|
||||
partition_horz4_allowed &= (pc_tree->partitioning == PARTITION_HORZ ||
|
||||
pc_tree->partitioning == PARTITION_HORZ_A ||
|
||||
pc_tree->partitioning == PARTITION_HORZ_B ||
|
||||
pc_tree->partitioning == PARTITION_SPLIT ||
|
||||
pc_tree->partitioning == PARTITION_NONE);
|
||||
partition_vert4_allowed &= (pc_tree->partitioning == PARTITION_VERT ||
|
||||
pc_tree->partitioning == PARTITION_VERT_A ||
|
||||
pc_tree->partitioning == PARTITION_VERT_B ||
|
||||
pc_tree->partitioning == PARTITION_SPLIT ||
|
||||
pc_tree->partitioning == PARTITION_NONE);
|
||||
}
|
||||
if (cpi->sf.ml_prune_4_partition && partition4_allowed &&
|
||||
partition_horz_allowed && partition_vert_allowed) {
|
||||
ml_prune_4_partition(cpi, x, bsize, pc_tree->partitioning, best_rdc.rdcost,
|
||||
horz_rd, vert_rd, split_rd, &partition_horz4_allowed,
|
||||
&partition_vert4_allowed);
|
||||
}
|
||||
|
||||
// PARTITION_HORZ_4
|
||||
if (partition_horz4_allowed && has_rows &&
|
||||
(do_rectangular_split || active_h_edge(cpi, mi_row, mi_step))) {
|
||||
av1_init_rd_stats(&sum_rdc);
|
||||
|
|
@ -3687,14 +3863,6 @@ BEGIN_PARTITION_SEARCH:
|
|||
}
|
||||
|
||||
// PARTITION_VERT_4
|
||||
int partition_vert4_allowed = partition4_allowed && partition_vert_allowed;
|
||||
if (cpi->sf.prune_ext_partition_types_search_level == 2) {
|
||||
partition_vert4_allowed &= (pc_tree->partitioning == PARTITION_VERT ||
|
||||
pc_tree->partitioning == PARTITION_VERT_A ||
|
||||
pc_tree->partitioning == PARTITION_VERT_B ||
|
||||
pc_tree->partitioning == PARTITION_SPLIT ||
|
||||
pc_tree->partitioning == PARTITION_NONE);
|
||||
}
|
||||
if (partition_vert4_allowed && has_cols &&
|
||||
(do_rectangular_split || active_v_edge(cpi, mi_row, mi_step))) {
|
||||
av1_init_rd_stats(&sum_rdc);
|
||||
|
|
@ -3857,6 +4025,7 @@ static void encode_rd_sb_row(AV1_COMP *cpi, ThreadData *td,
|
|||
}
|
||||
xd->cur_frame_force_integer_mv = cm->cur_frame_force_integer_mv;
|
||||
|
||||
x->sb_energy_level = 0;
|
||||
if (cm->delta_q_present_flag) {
|
||||
// Delta-q modulation based on variance
|
||||
av1_setup_src_planes(x, cpi->source, mi_row, mi_col, num_planes);
|
||||
|
|
@ -3865,11 +4034,13 @@ static void encode_rd_sb_row(AV1_COMP *cpi, ThreadData *td,
|
|||
if (DELTAQ_MODULATION == 1) {
|
||||
const int block_wavelet_energy_level =
|
||||
av1_block_wavelet_energy_level(cpi, x, cm->seq_params.sb_size);
|
||||
x->sb_energy_level = block_wavelet_energy_level;
|
||||
offset_qindex = av1_compute_deltaq_from_energy_level(
|
||||
cpi, block_wavelet_energy_level);
|
||||
} else {
|
||||
const int block_var_level =
|
||||
av1_block_energy(cpi, x, cm->seq_params.sb_size);
|
||||
x->sb_energy_level = block_var_level;
|
||||
offset_qindex =
|
||||
av1_compute_deltaq_from_energy_level(cpi, block_var_level);
|
||||
}
|
||||
|
|
@ -3943,6 +4114,8 @@ static void encode_rd_sb_row(AV1_COMP *cpi, ThreadData *td,
|
|||
x->use_cb_search_range = 0;
|
||||
init_first_partition_pass_stats_tables(x->first_partition_pass_stats);
|
||||
if (cpi->sf.two_pass_partition_search &&
|
||||
cpi->sf.use_square_partition_only_threshold <
|
||||
cm->seq_params.sb_size &&
|
||||
mi_row + mi_size_high[cm->seq_params.sb_size] < cm->mi_rows &&
|
||||
mi_col + mi_size_wide[cm->seq_params.sb_size] < cm->mi_cols &&
|
||||
cm->frame_type != KEY_FRAME) {
|
||||
|
|
@ -4030,7 +4203,8 @@ static void init_encode_frame_mb_context(AV1_COMP *cpi) {
|
|||
// Copy data over into macro block data structures.
|
||||
av1_setup_src_planes(x, cpi->source, 0, 0, num_planes);
|
||||
|
||||
av1_setup_block_planes(xd, cm->subsampling_x, cm->subsampling_y, num_planes);
|
||||
av1_setup_block_planes(xd, cm->seq_params.subsampling_x,
|
||||
cm->seq_params.subsampling_y, num_planes);
|
||||
}
|
||||
|
||||
static MV_REFERENCE_FRAME get_frame_type(const AV1_COMP *cpi) {
|
||||
|
|
@ -4116,8 +4290,8 @@ void av1_encode_tile(AV1_COMP *cpi, ThreadData *td, int tile_row,
|
|||
TOKENEXTRA *tok = cpi->tile_tok[tile_row][tile_col];
|
||||
int mi_row;
|
||||
|
||||
av1_zero_above_context(cm, tile_info->mi_col_start, tile_info->mi_col_end,
|
||||
tile_row);
|
||||
av1_zero_above_context(cm, &td->mb.e_mbd, tile_info->mi_col_start,
|
||||
tile_info->mi_col_end, tile_row);
|
||||
av1_init_above_context(cm, &td->mb.e_mbd, tile_row);
|
||||
|
||||
// Set up pointers to per thread motion search counters.
|
||||
|
|
@ -4128,7 +4302,7 @@ void av1_encode_tile(AV1_COMP *cpi, ThreadData *td, int tile_row,
|
|||
this_tile->tctx = *cm->fc;
|
||||
td->mb.e_mbd.tile_ctx = &this_tile->tctx;
|
||||
|
||||
cfl_init(&td->mb.e_mbd.cfl, cm);
|
||||
cfl_init(&td->mb.e_mbd.cfl, &cm->seq_params);
|
||||
|
||||
av1_crc32c_calculator_init(&td->mb.mb_rd_record.crc_calculator);
|
||||
|
||||
|
|
@ -4263,25 +4437,24 @@ static int is_screen_content(const uint8_t *src, int use_hbd, int bd,
|
|||
return counts * blk_h * blk_w * 10 > width * height;
|
||||
}
|
||||
|
||||
static const uint8_t ref_frame_flag_list[REF_FRAMES] = { 0,
|
||||
AOM_LAST_FLAG,
|
||||
AOM_LAST2_FLAG,
|
||||
AOM_LAST3_FLAG,
|
||||
AOM_GOLD_FLAG,
|
||||
AOM_BWD_FLAG,
|
||||
AOM_ALT2_FLAG,
|
||||
AOM_ALT_FLAG };
|
||||
|
||||
// Enforce the number of references for each arbitrary frame limited to
|
||||
// (INTER_REFS_PER_FRAME - 1)
|
||||
static void enforce_max_ref_frames(AV1_COMP *cpi) {
|
||||
AV1_COMMON *const cm = &cpi->common;
|
||||
static const int flag_list[REF_FRAMES] = { 0,
|
||||
AOM_LAST_FLAG,
|
||||
AOM_LAST2_FLAG,
|
||||
AOM_LAST3_FLAG,
|
||||
AOM_GOLD_FLAG,
|
||||
AOM_BWD_FLAG,
|
||||
AOM_ALT2_FLAG,
|
||||
AOM_ALT_FLAG };
|
||||
MV_REFERENCE_FRAME ref_frame;
|
||||
int total_valid_refs = 0;
|
||||
|
||||
(void)flag_list;
|
||||
|
||||
for (ref_frame = LAST_FRAME; ref_frame <= ALTREF_FRAME; ++ref_frame) {
|
||||
if (cpi->ref_frame_flags & flag_list[ref_frame]) total_valid_refs++;
|
||||
if (cpi->ref_frame_flags & ref_frame_flag_list[ref_frame])
|
||||
total_valid_refs++;
|
||||
}
|
||||
|
||||
// NOTE(zoeliu): When all the possible reference frames are availble, we
|
||||
|
|
@ -4617,7 +4790,6 @@ static void encode_frame_internal(AV1_COMP *cpi) {
|
|||
cm->prev_mi = cm->allow_ref_frame_mvs ? cm->prev_mip : NULL;
|
||||
|
||||
x->txb_split_count = 0;
|
||||
av1_zero(x->blk_skip_drl);
|
||||
|
||||
av1_zero(rdc->global_motion_used);
|
||||
av1_zero(cpi->gmparams_cost);
|
||||
|
|
@ -4672,8 +4844,9 @@ static void encode_frame_internal(AV1_COMP *cpi) {
|
|||
}
|
||||
|
||||
compute_global_motion_feature_based(
|
||||
model, cpi->source, ref_buf[frame], cpi->common.bit_depth,
|
||||
inliers_by_motion, params_by_motion, RANSAC_NUM_MOTIONS);
|
||||
model, cpi->source, ref_buf[frame],
|
||||
cpi->common.seq_params.bit_depth, inliers_by_motion,
|
||||
params_by_motion, RANSAC_NUM_MOTIONS);
|
||||
|
||||
for (i = 0; i < RANSAC_NUM_MOTIONS; ++i) {
|
||||
if (inliers_by_motion[i] == 0) continue;
|
||||
|
|
@ -4734,6 +4907,15 @@ static void encode_frame_internal(AV1_COMP *cpi) {
|
|||
cpi->gmtype_cost[cm->global_motion[frame].wmtype] -
|
||||
cpi->gmtype_cost[IDENTITY];
|
||||
}
|
||||
// clear disabled ref_frames
|
||||
for (frame = LAST_FRAME; frame <= ALTREF_FRAME; ++frame) {
|
||||
const int ref_disabled =
|
||||
!(cpi->ref_frame_flags & ref_frame_flag_list[frame]);
|
||||
if (ref_disabled && cpi->sf.recode_loop != DISALLOW_RECODE) {
|
||||
cpi->gmparams_cost[frame] = 0;
|
||||
cm->global_motion[frame] = default_warp_params;
|
||||
}
|
||||
}
|
||||
cpi->global_motion_search_done = 1;
|
||||
}
|
||||
memcpy(cm->cur_frame->global_motion, cm->global_motion,
|
||||
|
|
@ -5082,8 +5264,9 @@ static void encode_superblock(const AV1_COMP *const cpi, TileDataEnc *tile_data,
|
|||
}
|
||||
|
||||
if (!is_inter) {
|
||||
xd->cfl.is_chroma_reference = is_chroma_reference(
|
||||
mi_row, mi_col, bsize, cm->subsampling_x, cm->subsampling_y);
|
||||
xd->cfl.is_chroma_reference =
|
||||
is_chroma_reference(mi_row, mi_col, bsize, cm->seq_params.subsampling_x,
|
||||
cm->seq_params.subsampling_y);
|
||||
xd->cfl.store_y = store_cfl_required(cm, xd);
|
||||
mbmi->skip = 1;
|
||||
for (int plane = 0; plane < num_planes; ++plane) {
|
||||
|
|
|
|||
602
third_party/aom/av1/encoder/encoder.c
vendored
602
third_party/aom/av1/encoder/encoder.c
vendored
File diff suppressed because it is too large
Load diff
20
third_party/aom/av1/encoder/encoder.h
vendored
20
third_party/aom/av1/encoder/encoder.h
vendored
|
|
@ -41,6 +41,9 @@
|
|||
#include "aom_dsp/ssim.h"
|
||||
#endif
|
||||
#include "aom_dsp/variance.h"
|
||||
#if CONFIG_DENOISE
|
||||
#include "aom_dsp/noise_model.h"
|
||||
#endif
|
||||
#include "aom/internal/aom_codec_internal.h"
|
||||
#include "aom_util/aom_thread.h"
|
||||
|
||||
|
|
@ -277,7 +280,7 @@ typedef struct AV1EncoderConfig {
|
|||
aom_timing_info_t timing_info;
|
||||
int decoder_model_info_present_flag;
|
||||
int display_model_info_present_flag;
|
||||
int buffer_removal_delay_present;
|
||||
int buffer_removal_time_present;
|
||||
aom_dec_model_info_t buffer_model;
|
||||
aom_dec_model_op_parameters_t op_params[MAX_NUM_OPERATING_POINTS + 1];
|
||||
aom_op_timing_info_t op_frame_timing[MAX_NUM_OPERATING_POINTS + 1];
|
||||
|
|
@ -301,6 +304,11 @@ typedef struct AV1EncoderConfig {
|
|||
int allow_warped_motion;
|
||||
int enable_superres;
|
||||
unsigned int save_as_annexb;
|
||||
|
||||
#if CONFIG_DENOISE
|
||||
float noise_level;
|
||||
int noise_block_size;
|
||||
#endif
|
||||
} AV1EncoderConfig;
|
||||
|
||||
static INLINE int is_lossless_requested(const AV1EncoderConfig *cfg) {
|
||||
|
|
@ -472,6 +480,7 @@ typedef struct AV1_COMP {
|
|||
AV1EncoderConfig oxcf;
|
||||
struct lookahead_ctx *lookahead;
|
||||
struct lookahead_entry *alt_ref_source;
|
||||
int no_show_kf;
|
||||
|
||||
int optimize_speed_feature;
|
||||
int optimize_seg_arr[MAX_SEGMENTS];
|
||||
|
|
@ -504,6 +513,9 @@ typedef struct AV1_COMP {
|
|||
int refresh_bwd_ref_frame;
|
||||
int refresh_alt2_ref_frame;
|
||||
int refresh_alt_ref_frame;
|
||||
#if USE_SYMM_MULTI_LAYER
|
||||
int new_bwdref_update_rule;
|
||||
#endif
|
||||
|
||||
int ext_refresh_frame_flags_pending;
|
||||
int ext_refresh_last_frame;
|
||||
|
|
@ -666,7 +678,6 @@ typedef struct AV1_COMP {
|
|||
int existing_fb_idx_to_show;
|
||||
int is_arf_filter_off[MAX_EXT_ARFS + 1];
|
||||
int num_extra_arfs;
|
||||
int arf_map[MAX_EXT_ARFS + 1];
|
||||
int arf_pos_in_gf[MAX_EXT_ARFS + 1];
|
||||
int arf_pos_for_ovrly[MAX_EXT_ARFS + 1];
|
||||
int global_motion_search_done;
|
||||
|
|
@ -687,6 +698,11 @@ typedef struct AV1_COMP {
|
|||
AV1LfSync lf_row_sync;
|
||||
AV1LrSync lr_row_sync;
|
||||
AV1LrStruct lr_ctxt;
|
||||
|
||||
aom_film_grain_table_t *film_grain_table;
|
||||
#if CONFIG_DENOISE
|
||||
struct aom_denoise_and_model_t *denoise_and_model;
|
||||
#endif
|
||||
} AV1_COMP;
|
||||
|
||||
void av1_initialize_enc(void);
|
||||
|
|
|
|||
18
third_party/aom/av1/encoder/encodetxb.c
vendored
18
third_party/aom/av1/encoder/encodetxb.c
vendored
|
|
@ -792,9 +792,8 @@ static AOM_FORCE_INLINE int warehouse_efficients_txb(
|
|||
}
|
||||
|
||||
int av1_cost_coeffs_txb(const AV1_COMMON *const cm, const MACROBLOCK *x,
|
||||
const int plane, const int blk_row, const int blk_col,
|
||||
const int block, const TX_SIZE tx_size,
|
||||
const TXB_CTX *const txb_ctx) {
|
||||
const int plane, const int block, const TX_SIZE tx_size,
|
||||
const TX_TYPE tx_type, const TXB_CTX *const txb_ctx) {
|
||||
const struct macroblock_plane *p = &x->plane[plane];
|
||||
const int eob = p->eobs[block];
|
||||
const TX_SIZE txs_ctx = get_txsize_entropy_ctx(tx_size);
|
||||
|
|
@ -806,8 +805,6 @@ int av1_cost_coeffs_txb(const AV1_COMMON *const cm, const MACROBLOCK *x,
|
|||
}
|
||||
|
||||
const MACROBLOCKD *const xd = &x->e_mbd;
|
||||
const TX_TYPE tx_type = av1_get_tx_type(plane_type, xd, blk_row, blk_col,
|
||||
tx_size, cm->reduced_tx_set_used);
|
||||
const TX_CLASS tx_class = tx_type_to_class[tx_type];
|
||||
|
||||
#define WAREHOUSE_EFFICIENTS_TXB_CASE(tx_class_literal) \
|
||||
|
|
@ -1583,9 +1580,14 @@ int av1_optimize_txb_new(const struct AV1_COMP *cpi, MACROBLOCK *x, int plane,
|
|||
const int64_t rdmult =
|
||||
((x->rdmult * plane_rd_mult[is_inter][plane_type] << (2 * (xd->bd - 8))) +
|
||||
2) >>
|
||||
(sharpness + (cpi->oxcf.aq_mode == VARIANCE_AQ && mbmi->segment_id < 4
|
||||
? 7 - mbmi->segment_id
|
||||
: 2));
|
||||
(sharpness +
|
||||
(cpi->oxcf.aq_mode == VARIANCE_AQ && mbmi->segment_id < 4
|
||||
? 7 - mbmi->segment_id
|
||||
: 2) +
|
||||
(cpi->oxcf.aq_mode != VARIANCE_AQ &&
|
||||
cpi->oxcf.deltaq_mode > NO_DELTA_Q && x->sb_energy_level < 0
|
||||
? (3 - x->sb_energy_level)
|
||||
: 0));
|
||||
|
||||
uint8_t levels_buf[TX_PAD_2D];
|
||||
uint8_t *const levels = set_levels(levels_buf, width);
|
||||
|
|
|
|||
10
third_party/aom/av1/encoder/encodetxb.h
vendored
10
third_party/aom/av1/encoder/encodetxb.h
vendored
|
|
@ -50,9 +50,8 @@ typedef struct TxbInfo {
|
|||
void av1_alloc_txb_buf(AV1_COMP *cpi);
|
||||
void av1_free_txb_buf(AV1_COMP *cpi);
|
||||
int av1_cost_coeffs_txb(const AV1_COMMON *const cm, const MACROBLOCK *x,
|
||||
const int plane, const int blk_row, const int blk_col,
|
||||
const int block, const TX_SIZE tx_size,
|
||||
const TXB_CTX *const txb_ctx);
|
||||
const int plane, const int block, const TX_SIZE tx_size,
|
||||
const TX_TYPE tx_type, const TXB_CTX *const txb_ctx);
|
||||
void av1_write_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
|
||||
aom_writer *w, int blk_row, int blk_col, int plane,
|
||||
TX_SIZE tx_size, const tran_low_t *tcoeff,
|
||||
|
|
@ -77,9 +76,10 @@ void av1_set_coeff_buffer(const AV1_COMP *const cpi, MACROBLOCK *const x,
|
|||
int mi_row, int mi_col);
|
||||
|
||||
void hbt_destroy();
|
||||
int av1_optimize_txb_new(const AV1_COMP *cpi, MACROBLOCK *x, int plane,
|
||||
int av1_optimize_txb_new(const struct AV1_COMP *cpi, MACROBLOCK *x, int plane,
|
||||
int block, TX_SIZE tx_size, TX_TYPE tx_type,
|
||||
const TXB_CTX *txb_ctx, int *rate_cost, int sharpness);
|
||||
const TXB_CTX *const txb_ctx, int *rate_cost,
|
||||
int sharpness);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
7
third_party/aom/av1/encoder/ethread.c
vendored
7
third_party/aom/av1/encoder/ethread.c
vendored
|
|
@ -44,7 +44,7 @@ static int enc_worker_hook(EncWorkerData *const thread_data, void *unused) {
|
|||
av1_encode_tile(cpi, thread_data->td, tile_row, tile_col);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void av1_encode_tiles_mt(AV1_COMP *cpi) {
|
||||
|
|
@ -126,12 +126,11 @@ void av1_encode_tiles_mt(AV1_COMP *cpi) {
|
|||
|
||||
for (i = 0; i < num_workers; i++) {
|
||||
AVxWorker *const worker = &cpi->workers[i];
|
||||
EncWorkerData *thread_data;
|
||||
EncWorkerData *const thread_data = &cpi->tile_thr_data[i];
|
||||
|
||||
worker->hook = (AVxWorkerHook)enc_worker_hook;
|
||||
worker->data1 = &cpi->tile_thr_data[i];
|
||||
worker->data1 = thread_data;
|
||||
worker->data2 = NULL;
|
||||
thread_data = (EncWorkerData *)worker->data1;
|
||||
|
||||
// Before encoding a frame, copy the thread data from cpi.
|
||||
if (thread_data->td != &cpi->td) {
|
||||
|
|
|
|||
495
third_party/aom/av1/encoder/firstpass.c
vendored
495
third_party/aom/av1/encoder/firstpass.c
vendored
|
|
@ -486,6 +486,7 @@ void av1_first_pass(AV1_COMP *cpi, const struct lookahead_entry *source) {
|
|||
int mb_row, mb_col;
|
||||
MACROBLOCK *const x = &cpi->td.mb;
|
||||
AV1_COMMON *const cm = &cpi->common;
|
||||
const SequenceHeader *const seq_params = &cm->seq_params;
|
||||
const int num_planes = av1_num_planes(cm);
|
||||
MACROBLOCKD *const xd = &x->e_mbd;
|
||||
TileInfo tile;
|
||||
|
|
@ -524,7 +525,7 @@ void av1_first_pass(AV1_COMP *cpi, const struct lookahead_entry *source) {
|
|||
double intra_factor;
|
||||
double brightness_factor;
|
||||
BufferPool *const pool = cm->buffer_pool;
|
||||
const int qindex = find_fp_qindex(cm->bit_depth);
|
||||
const int qindex = find_fp_qindex(seq_params->bit_depth);
|
||||
const int mb_scale = mi_size_wide[BLOCK_16X16];
|
||||
|
||||
int *raw_motion_err_list;
|
||||
|
|
@ -555,11 +556,11 @@ void av1_first_pass(AV1_COMP *cpi, const struct lookahead_entry *source) {
|
|||
set_first_pass_params(cpi);
|
||||
av1_set_quantizer(cm, qindex);
|
||||
|
||||
av1_setup_block_planes(&x->e_mbd, cm->subsampling_x, cm->subsampling_y,
|
||||
num_planes);
|
||||
av1_setup_block_planes(&x->e_mbd, seq_params->subsampling_x,
|
||||
seq_params->subsampling_y, num_planes);
|
||||
|
||||
av1_setup_src_planes(x, cpi->source, 0, 0, num_planes);
|
||||
av1_setup_dst_planes(xd->plane, cm->seq_params.sb_size, new_yv12, 0, 0, 0,
|
||||
av1_setup_dst_planes(xd->plane, seq_params->sb_size, new_yv12, 0, 0, 0,
|
||||
num_planes);
|
||||
|
||||
if (!frame_is_intra_only(cm)) {
|
||||
|
|
@ -654,14 +655,14 @@ void av1_first_pass(AV1_COMP *cpi, const struct lookahead_entry *source) {
|
|||
image_data_start_row = mb_row;
|
||||
}
|
||||
|
||||
if (cm->use_highbitdepth) {
|
||||
switch (cm->bit_depth) {
|
||||
if (seq_params->use_highbitdepth) {
|
||||
switch (seq_params->bit_depth) {
|
||||
case AOM_BITS_8: break;
|
||||
case AOM_BITS_10: this_error >>= 4; break;
|
||||
case AOM_BITS_12: this_error >>= 8; break;
|
||||
default:
|
||||
assert(0 &&
|
||||
"cm->bit_depth should be AOM_BITS_8, "
|
||||
"seq_params->bit_depth should be AOM_BITS_8, "
|
||||
"AOM_BITS_10 or AOM_BITS_12");
|
||||
return;
|
||||
}
|
||||
|
|
@ -674,7 +675,7 @@ void av1_first_pass(AV1_COMP *cpi, const struct lookahead_entry *source) {
|
|||
else
|
||||
intra_factor += 1.0;
|
||||
|
||||
if (cm->use_highbitdepth)
|
||||
if (seq_params->use_highbitdepth)
|
||||
level_sample = CONVERT_TO_SHORTPTR(x->plane[0].src.buf)[0];
|
||||
else
|
||||
level_sample = x->plane[0].src.buf[0];
|
||||
|
|
@ -1156,10 +1157,10 @@ static int get_twopass_worst_quality(const AV1_COMP *cpi,
|
|||
for (q = rc->best_quality; q < rc->worst_quality; ++q) {
|
||||
const double factor = calc_correction_factor(
|
||||
av_err_per_mb, ERR_DIVISOR - ediv_size_correction, FACTOR_PT_LOW,
|
||||
FACTOR_PT_HIGH, q, cpi->common.bit_depth);
|
||||
FACTOR_PT_HIGH, q, cpi->common.seq_params.bit_depth);
|
||||
const int bits_per_mb = av1_rc_bits_per_mb(
|
||||
INTER_FRAME, q, factor * speed_term * group_weight_factor,
|
||||
cpi->common.bit_depth);
|
||||
cpi->common.seq_params.bit_depth);
|
||||
if (bits_per_mb <= target_norm_bits_per_mb) break;
|
||||
}
|
||||
|
||||
|
|
@ -1377,7 +1378,7 @@ static double calc_frame_boost(AV1_COMP *cpi, const FIRSTPASS_STATS *this_frame,
|
|||
double this_frame_mv_in_out, double max_boost) {
|
||||
double frame_boost;
|
||||
const double lq = av1_convert_qindex_to_q(
|
||||
cpi->rc.avg_frame_qindex[INTER_FRAME], cpi->common.bit_depth);
|
||||
cpi->rc.avg_frame_qindex[INTER_FRAME], cpi->common.seq_params.bit_depth);
|
||||
const double boost_q_correction = AOMMIN((0.5 + (lq * 0.015)), 1.5);
|
||||
int num_mbs = (cpi->oxcf.resize_mode != RESIZE_NONE) ? cpi->initial_mbs
|
||||
: cpi->common.MBs;
|
||||
|
|
@ -2130,6 +2131,319 @@ static void define_gf_group_structure_16(AV1_COMP *cpi) {
|
|||
}
|
||||
#endif // USE_GF16_MULTI_LAYER
|
||||
|
||||
#if USE_SYMM_MULTI_LAYER
|
||||
void check_frame_params(GF_GROUP *const gf_group, int gf_interval,
|
||||
int frame_nums) {
|
||||
static const char *update_type_strings[] = {
|
||||
"KF_UPDATE", "LF_UPDATE", "GF_UPDATE",
|
||||
"ARF_UPDATE", "OVERLAY_UPDATE", "BRF_UPDATE",
|
||||
"LAST_BIPRED_UPDATE", "BIPRED_UPDATE", "INTNL_OVERLAY_UPDATE",
|
||||
"INTNL_ARF_UPDATE"
|
||||
};
|
||||
FILE *fid = fopen("GF_PARAMS.txt", "a");
|
||||
|
||||
fprintf(fid, "\n{%d}\n", gf_interval);
|
||||
for (int i = 0; i <= frame_nums; ++i) {
|
||||
fprintf(fid, "%s %d %d %d %d\n",
|
||||
update_type_strings[gf_group->update_type[i]],
|
||||
gf_group->arf_src_offset[i], gf_group->arf_pos_in_gf[i],
|
||||
gf_group->arf_update_idx[i], gf_group->pyramid_level[i]);
|
||||
}
|
||||
fclose(fid);
|
||||
}
|
||||
|
||||
static int update_type_2_rf_level(FRAME_UPDATE_TYPE update_type) {
|
||||
// Derive rf_level from update_type
|
||||
switch (update_type) {
|
||||
case LF_UPDATE: return INTER_NORMAL;
|
||||
case ARF_UPDATE: return GF_ARF_STD;
|
||||
case OVERLAY_UPDATE: return INTER_NORMAL;
|
||||
case BRF_UPDATE: return GF_ARF_LOW;
|
||||
case LAST_BIPRED_UPDATE: return INTER_NORMAL;
|
||||
case BIPRED_UPDATE: return INTER_NORMAL;
|
||||
case INTNL_ARF_UPDATE: return GF_ARF_LOW;
|
||||
case INTNL_OVERLAY_UPDATE: return INTER_NORMAL;
|
||||
default: return INTER_NORMAL;
|
||||
}
|
||||
}
|
||||
|
||||
static void set_multi_layer_params(GF_GROUP *const gf_group, int l, int r,
|
||||
int *frame_ind, int arf_ind, int level) {
|
||||
if (r - l == 2) {
|
||||
// leaf node, not a look-ahead frame
|
||||
gf_group->update_type[*frame_ind] = LF_UPDATE;
|
||||
gf_group->arf_src_offset[*frame_ind] = 0;
|
||||
gf_group->arf_pos_in_gf[*frame_ind] = 0;
|
||||
gf_group->arf_update_idx[*frame_ind] = arf_ind;
|
||||
gf_group->pyramid_level[*frame_ind] = level;
|
||||
++(*frame_ind);
|
||||
} else {
|
||||
int m = (l + r) / 2;
|
||||
int arf_pos_in_gf = *frame_ind;
|
||||
|
||||
gf_group->update_type[*frame_ind] = INTNL_ARF_UPDATE;
|
||||
gf_group->arf_src_offset[*frame_ind] = m - l - 1;
|
||||
gf_group->arf_pos_in_gf[*frame_ind] = 0;
|
||||
gf_group->arf_update_idx[*frame_ind] = 1; // mark all internal ARF 1
|
||||
gf_group->pyramid_level[*frame_ind] = level;
|
||||
++(*frame_ind);
|
||||
|
||||
// set parameters for frames displayed before this frame
|
||||
set_multi_layer_params(gf_group, l, m, frame_ind, 1, level - 1);
|
||||
|
||||
// for overlay frames, we need to record the position of its corresponding
|
||||
// arf frames for bit allocation
|
||||
gf_group->update_type[*frame_ind] = INTNL_OVERLAY_UPDATE;
|
||||
gf_group->arf_src_offset[*frame_ind] = 0;
|
||||
gf_group->arf_pos_in_gf[*frame_ind] = arf_pos_in_gf;
|
||||
gf_group->arf_update_idx[*frame_ind] = 1;
|
||||
gf_group->pyramid_level[*frame_ind] = 0;
|
||||
++(*frame_ind);
|
||||
|
||||
// set parameters for frames displayed after this frame
|
||||
set_multi_layer_params(gf_group, m, r, frame_ind, arf_ind, level - 1);
|
||||
}
|
||||
}
|
||||
|
||||
static INLINE unsigned char get_pyramid_height(int pyramid_width) {
|
||||
assert(pyramid_width <= 16 && pyramid_width >= 4 &&
|
||||
"invalid gf interval for pyramid structure");
|
||||
|
||||
return pyramid_width == 16 ? 4 : (pyramid_width >= 8 ? 3 : 2);
|
||||
}
|
||||
|
||||
static int construct_multi_layer_gf_structure(GF_GROUP *const gf_group,
|
||||
const int gf_interval) {
|
||||
int frame_index = 0;
|
||||
gf_group->pyramid_height = get_pyramid_height(gf_interval);
|
||||
|
||||
// At the beginning of each GF group it will be a key or overlay frame,
|
||||
gf_group->update_type[frame_index] = OVERLAY_UPDATE;
|
||||
gf_group->arf_src_offset[frame_index] = 0;
|
||||
gf_group->arf_pos_in_gf[frame_index] = 0;
|
||||
gf_group->arf_update_idx[frame_index] = 0;
|
||||
gf_group->pyramid_level[frame_index] = 0;
|
||||
++frame_index;
|
||||
|
||||
// ALT0
|
||||
gf_group->update_type[frame_index] = ARF_UPDATE;
|
||||
gf_group->arf_src_offset[frame_index] = gf_interval - 1;
|
||||
gf_group->arf_pos_in_gf[frame_index] = 0;
|
||||
gf_group->arf_update_idx[frame_index] = 0;
|
||||
gf_group->pyramid_level[frame_index] = gf_group->pyramid_height;
|
||||
++frame_index;
|
||||
|
||||
// set parameters for the rest of the frames
|
||||
set_multi_layer_params(gf_group, 0, gf_interval, &frame_index, 0,
|
||||
gf_group->pyramid_height - 1);
|
||||
|
||||
// check_frame_params(gf_group, gf_interval, frame_index);
|
||||
|
||||
return frame_index;
|
||||
}
|
||||
|
||||
void define_customized_gf_group_structure(AV1_COMP *cpi) {
|
||||
RATE_CONTROL *const rc = &cpi->rc;
|
||||
TWO_PASS *const twopass = &cpi->twopass;
|
||||
GF_GROUP *const gf_group = &twopass->gf_group;
|
||||
const int key_frame = cpi->common.frame_type == KEY_FRAME;
|
||||
|
||||
assert(rc->baseline_gf_interval == 4 || rc->baseline_gf_interval == 8 ||
|
||||
rc->baseline_gf_interval == 16);
|
||||
|
||||
const int gf_update_frames =
|
||||
construct_multi_layer_gf_structure(gf_group, rc->baseline_gf_interval);
|
||||
int frame_index;
|
||||
|
||||
cpi->num_extra_arfs = 0;
|
||||
|
||||
for (frame_index = 0; frame_index < gf_update_frames; ++frame_index) {
|
||||
// Set unused variables to default values
|
||||
gf_group->bidir_pred_enabled[frame_index] = 0;
|
||||
gf_group->brf_src_offset[frame_index] = 0;
|
||||
|
||||
// Special handle for the first frame for assigning update_type
|
||||
if (frame_index == 0) {
|
||||
// For key frames the frame target rate is already set and it
|
||||
// is also the golden frame.
|
||||
if (key_frame) {
|
||||
gf_group->update_type[frame_index] = KF_UPDATE;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (rc->source_alt_ref_active) {
|
||||
gf_group->update_type[frame_index] = OVERLAY_UPDATE;
|
||||
} else {
|
||||
gf_group->update_type[frame_index] = GF_UPDATE;
|
||||
}
|
||||
} else {
|
||||
if (gf_group->update_type[frame_index] == INTNL_ARF_UPDATE)
|
||||
++cpi->num_extra_arfs;
|
||||
}
|
||||
|
||||
// Assign rf level based on update type
|
||||
gf_group->rf_level[frame_index] =
|
||||
update_type_2_rf_level(gf_group->update_type[frame_index]);
|
||||
}
|
||||
|
||||
// NOTE: We need to configure the frame at the end of the sequence + 1 that
|
||||
// will be the start frame for the next group. Otherwise prior to the
|
||||
// call to av1_rc_get_second_pass_params() the data will be undefined.
|
||||
if (rc->source_alt_ref_pending) {
|
||||
gf_group->update_type[frame_index] = OVERLAY_UPDATE;
|
||||
gf_group->rf_level[frame_index] = INTER_NORMAL;
|
||||
} else {
|
||||
gf_group->update_type[frame_index] = GF_UPDATE;
|
||||
gf_group->rf_level[frame_index] = GF_ARF_STD;
|
||||
}
|
||||
|
||||
gf_group->bidir_pred_enabled[frame_index] = 0;
|
||||
gf_group->brf_src_offset[frame_index] = 0;
|
||||
gf_group->arf_update_idx[frame_index] = 0;
|
||||
// This value is only used for INTNL_OVERLAY_UPDATE
|
||||
gf_group->arf_pos_in_gf[frame_index] = 0;
|
||||
|
||||
// This parameter is useless?
|
||||
gf_group->arf_ref_idx[frame_index] = 0;
|
||||
|
||||
check_frame_params(gf_group, rc->baseline_gf_interval, gf_update_frames);
|
||||
}
|
||||
|
||||
// It is an example of how to define a GF stucture manually. The function will
|
||||
// result in exactly the same GF group structure as
|
||||
// define_customized_gf_group_structure() when rc->baseline_gf_interval == 4
|
||||
#if USE_MANUAL_GF4_STRUCT
|
||||
#define GF_INTERVAL_4 4
|
||||
static const unsigned char gf4_multi_layer_params[][GF_FRAME_PARAMS] = {
|
||||
{
|
||||
// gf_group->index == 0 (Frame 0)
|
||||
// It can also be KEY frame. Will assign the proper value
|
||||
// in define_gf_group_structure
|
||||
OVERLAY_UPDATE, // update_type (default value)
|
||||
0, // arf_src_offset
|
||||
0, // arf_pos_in_gf
|
||||
0 // arf_update_idx
|
||||
},
|
||||
{
|
||||
// gf_group->index == 1 (Frame 4)
|
||||
ARF_UPDATE, // update_type
|
||||
GF_INTERVAL_4 - 1, // arf_src_offset
|
||||
0, // arf_pos_in_gf
|
||||
0 // arf_update_idx
|
||||
},
|
||||
{
|
||||
// gf_group->index == 2 (Frame 2)
|
||||
INTNL_ARF_UPDATE, // update_type
|
||||
(GF_INTERVAL_4 >> 1) - 1, // arf_src_offset
|
||||
0, // arf_pos_in_gf
|
||||
0 // arf_update_idx
|
||||
},
|
||||
{
|
||||
// gf_group->index == 3 (Frame 1)
|
||||
LAST_BIPRED_UPDATE, // update_type
|
||||
0, // arf_src_offset
|
||||
0, // arf_pos_in_gf
|
||||
0 // arf_update_idx
|
||||
},
|
||||
|
||||
{
|
||||
// gf_group->index == 4 (Frame 2 - OVERLAY)
|
||||
INTNL_OVERLAY_UPDATE, // update_type
|
||||
0, // arf_src_offset
|
||||
2, // arf_pos_in_gf
|
||||
0 // arf_update_idx
|
||||
},
|
||||
{
|
||||
// gf_group->index == 5 (Frame 3)
|
||||
LF_UPDATE, // update_type
|
||||
0, // arf_src_offset
|
||||
0, // arf_pos_in_gf
|
||||
1 // arf_update_idx
|
||||
}
|
||||
};
|
||||
|
||||
static int define_gf_group_structure_4(AV1_COMP *cpi) {
|
||||
RATE_CONTROL *const rc = &cpi->rc;
|
||||
TWO_PASS *const twopass = &cpi->twopass;
|
||||
GF_GROUP *const gf_group = &twopass->gf_group;
|
||||
const int key_frame = cpi->common.frame_type == KEY_FRAME;
|
||||
|
||||
assert(rc->baseline_gf_interval == GF_INTERVAL_4);
|
||||
|
||||
const int gf_update_frames = rc->baseline_gf_interval + 2;
|
||||
int frame_index;
|
||||
|
||||
for (frame_index = 0; frame_index < gf_update_frames; ++frame_index) {
|
||||
int param_idx = 0;
|
||||
|
||||
gf_group->bidir_pred_enabled[frame_index] = 0;
|
||||
|
||||
if (frame_index == 0) {
|
||||
// gf_group->arf_src_offset[frame_index] = 0;
|
||||
gf_group->brf_src_offset[frame_index] = 0;
|
||||
gf_group->bidir_pred_enabled[frame_index] = 0;
|
||||
|
||||
// For key frames the frame target rate is already set and it
|
||||
// is also the golden frame.
|
||||
if (key_frame) continue;
|
||||
|
||||
gf_group->update_type[frame_index] =
|
||||
gf4_multi_layer_params[frame_index][param_idx++];
|
||||
|
||||
if (rc->source_alt_ref_active) {
|
||||
gf_group->update_type[frame_index] = OVERLAY_UPDATE;
|
||||
} else {
|
||||
gf_group->update_type[frame_index] = GF_UPDATE;
|
||||
}
|
||||
param_idx++;
|
||||
} else {
|
||||
gf_group->update_type[frame_index] =
|
||||
gf4_multi_layer_params[frame_index][param_idx++];
|
||||
}
|
||||
|
||||
// setup other parameters
|
||||
gf_group->rf_level[frame_index] =
|
||||
update_type_2_rf_level(gf_group->update_type[frame_index]);
|
||||
|
||||
// == arf_src_offset ==
|
||||
gf_group->arf_src_offset[frame_index] =
|
||||
gf4_multi_layer_params[frame_index][param_idx++];
|
||||
|
||||
// == arf_pos_in_gf ==
|
||||
gf_group->arf_pos_in_gf[frame_index] =
|
||||
gf4_multi_layer_params[frame_index][param_idx++];
|
||||
|
||||
// == arf_update_idx ==
|
||||
gf_group->brf_src_offset[frame_index] =
|
||||
gf4_multi_layer_params[frame_index][param_idx];
|
||||
}
|
||||
|
||||
// NOTE: We need to configure the frame at the end of the sequence + 1 that
|
||||
// will be the start frame for the next group. Otherwise prior to the
|
||||
// call to av1_rc_get_second_pass_params() the data will be undefined.
|
||||
gf_group->arf_update_idx[frame_index] = 0;
|
||||
gf_group->arf_ref_idx[frame_index] = 0;
|
||||
|
||||
if (rc->source_alt_ref_pending) {
|
||||
gf_group->update_type[frame_index] = OVERLAY_UPDATE;
|
||||
gf_group->rf_level[frame_index] = INTER_NORMAL;
|
||||
|
||||
} else {
|
||||
gf_group->update_type[frame_index] = GF_UPDATE;
|
||||
gf_group->rf_level[frame_index] = GF_ARF_STD;
|
||||
}
|
||||
|
||||
gf_group->bidir_pred_enabled[frame_index] = 0;
|
||||
gf_group->brf_src_offset[frame_index] = 0;
|
||||
|
||||
// This value is only used for INTNL_OVERLAY_UPDATE
|
||||
gf_group->arf_pos_in_gf[frame_index] = 0;
|
||||
|
||||
return gf_update_frames;
|
||||
}
|
||||
#endif // USE_MANUAL_GF4_STRUCT
|
||||
#endif // USE_SYMM_MULTI_LAYER
|
||||
|
||||
static void define_gf_group_structure(AV1_COMP *cpi) {
|
||||
RATE_CONTROL *const rc = &cpi->rc;
|
||||
|
||||
|
|
@ -2139,6 +2453,25 @@ static void define_gf_group_structure(AV1_COMP *cpi) {
|
|||
return;
|
||||
}
|
||||
#endif // USE_GF16_MULTI_LAYER
|
||||
#if USE_SYMM_MULTI_LAYER
|
||||
const int valid_customized_gf_length = rc->baseline_gf_interval == 4 ||
|
||||
rc->baseline_gf_interval == 8 ||
|
||||
rc->baseline_gf_interval == 16;
|
||||
// used the new structure only if extra_arf is allowed
|
||||
if (valid_customized_gf_length && rc->source_alt_ref_pending &&
|
||||
cpi->extra_arf_allowed > 0) {
|
||||
#if USE_MANUAL_GF4_STRUCT
|
||||
if (rc->baseline_gf_interval == 4)
|
||||
define_gf_group_structure_4(cpi);
|
||||
else
|
||||
#endif
|
||||
define_customized_gf_group_structure(cpi);
|
||||
cpi->new_bwdref_update_rule = 1;
|
||||
return;
|
||||
} else {
|
||||
cpi->new_bwdref_update_rule = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
TWO_PASS *const twopass = &cpi->twopass;
|
||||
GF_GROUP *const gf_group = &twopass->gf_group;
|
||||
|
|
@ -2322,9 +2655,8 @@ static void define_gf_group_structure(AV1_COMP *cpi) {
|
|||
}
|
||||
|
||||
// NOTE: We need to configure the frame at the end of the sequence + 1 that
|
||||
// will
|
||||
// be the start frame for the next group. Otherwise prior to the call to
|
||||
// av1_rc_get_second_pass_params() the data will be undefined.
|
||||
// will be the start frame for the next group. Otherwise prior to the
|
||||
// call to av1_rc_get_second_pass_params() the data will be undefined.
|
||||
gf_group->arf_update_idx[frame_index] = 0;
|
||||
gf_group->arf_ref_idx[frame_index] = 0;
|
||||
|
||||
|
|
@ -2438,6 +2770,17 @@ static void allocate_gf_group_bits(AV1_COMP *cpi, int64_t gf_group_bits,
|
|||
// TODO(zoeliu): To investigate whether the allocated bits on
|
||||
// BIPRED_UPDATE frames need to be further adjusted.
|
||||
gf_group->bit_allocation[frame_index] = target_frame_size;
|
||||
#if USE_SYMM_MULTI_LAYER
|
||||
} else if (cpi->new_bwdref_update_rule == 1 &&
|
||||
gf_group->update_type[frame_index] == INTNL_OVERLAY_UPDATE) {
|
||||
int arf_pos = gf_group->arf_pos_in_gf[frame_index];
|
||||
gf_group->bit_allocation[frame_index] = 0;
|
||||
|
||||
// Tried boosting up the allocated bits on backward reference frame
|
||||
// by (target_frame_size >> 2) as in the original setting. However it
|
||||
// does not bring gains for pyramid structure with GF length = 16.
|
||||
gf_group->bit_allocation[arf_pos] = target_frame_size;
|
||||
#endif
|
||||
} else {
|
||||
assert(gf_group->update_type[frame_index] == LF_UPDATE ||
|
||||
gf_group->update_type[frame_index] == INTNL_OVERLAY_UPDATE);
|
||||
|
|
@ -2453,10 +2796,11 @@ static void allocate_gf_group_bits(AV1_COMP *cpi, int64_t gf_group_bits,
|
|||
}
|
||||
}
|
||||
|
||||
// NOTE: We need to configure the frame at the end of the sequence + 1 that
|
||||
// will be the start frame for the next group. Otherwise prior to the
|
||||
// call to av1_rc_get_second_pass_params() the data will be undefined.
|
||||
#if USE_SYMM_MULTI_LAYER
|
||||
if (cpi->new_bwdref_update_rule == 0 && rc->source_alt_ref_pending) {
|
||||
#else
|
||||
if (rc->source_alt_ref_pending) {
|
||||
#endif
|
||||
if (cpi->num_extra_arfs) {
|
||||
// NOTE: For bit allocation, move the allocated bits associated with
|
||||
// INTNL_OVERLAY_UPDATE to the corresponding INTNL_ARF_UPDATE.
|
||||
|
|
@ -2489,7 +2833,10 @@ static void define_gf_group(AV1_COMP *cpi, FIRSTPASS_STATS *this_frame) {
|
|||
int i;
|
||||
|
||||
double boost_score = 0.0;
|
||||
#if !FIX_GF_INTERVAL_LENGTH
|
||||
double old_boost_score = 0.0;
|
||||
double mv_ratio_accumulator_thresh;
|
||||
#endif
|
||||
double gf_group_err = 0.0;
|
||||
#if GROUP_ADAPTIVE_MAXQ
|
||||
double gf_group_raw_error = 0.0;
|
||||
|
|
@ -2509,7 +2856,7 @@ static void define_gf_group(AV1_COMP *cpi, FIRSTPASS_STATS *this_frame) {
|
|||
double this_frame_mv_in_out = 0.0;
|
||||
double mv_in_out_accumulator = 0.0;
|
||||
double abs_mv_in_out_accumulator = 0.0;
|
||||
double mv_ratio_accumulator_thresh;
|
||||
|
||||
unsigned int allow_alt_ref = is_altref_enabled(cpi);
|
||||
|
||||
int f_boost = 0;
|
||||
|
|
@ -2551,18 +2898,18 @@ static void define_gf_group(AV1_COMP *cpi, FIRSTPASS_STATS *this_frame) {
|
|||
gf_group_skip_pct -= this_frame->intra_skip_pct;
|
||||
gf_group_inactive_zone_rows -= this_frame->inactive_zone_rows;
|
||||
}
|
||||
|
||||
#if !FIX_GF_INTERVAL_LENGTH
|
||||
// Motion breakout threshold for loop below depends on image size.
|
||||
mv_ratio_accumulator_thresh =
|
||||
(cpi->initial_height + cpi->initial_width) / 4.0;
|
||||
|
||||
#endif
|
||||
// Set a maximum and minimum interval for the GF group.
|
||||
// If the image appears almost completely static we can extend beyond this.
|
||||
{
|
||||
int int_max_q = (int)(av1_convert_qindex_to_q(twopass->active_worst_quality,
|
||||
cpi->common.bit_depth));
|
||||
int int_lbq = (int)(av1_convert_qindex_to_q(rc->last_boosted_qindex,
|
||||
cpi->common.bit_depth));
|
||||
int int_max_q = (int)(av1_convert_qindex_to_q(
|
||||
twopass->active_worst_quality, cpi->common.seq_params.bit_depth));
|
||||
int int_lbq = (int)(av1_convert_qindex_to_q(
|
||||
rc->last_boosted_qindex, cpi->common.seq_params.bit_depth));
|
||||
|
||||
active_min_gf_interval = rc->min_gf_interval + AOMMIN(2, int_max_q / 200);
|
||||
if (active_min_gf_interval > rc->max_gf_interval)
|
||||
|
|
@ -2643,7 +2990,10 @@ static void define_gf_group(AV1_COMP *cpi, FIRSTPASS_STATS *this_frame) {
|
|||
boost_score +=
|
||||
decay_accumulator *
|
||||
calc_frame_boost(cpi, &next_frame, this_frame_mv_in_out, GF_MAX_BOOST);
|
||||
|
||||
#if FIX_GF_INTERVAL_LENGTH
|
||||
if (i == (FIXED_GF_LENGTH + 1)) break;
|
||||
#else
|
||||
// Skip breaking condition for FIX_GF_INTERVAL_LENGTH
|
||||
// Break out conditions.
|
||||
if (
|
||||
// Break at active_max_gf_interval unless almost totally static.
|
||||
|
|
@ -2666,9 +3016,9 @@ static void define_gf_group(AV1_COMP *cpi, FIRSTPASS_STATS *this_frame) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
*this_frame = next_frame;
|
||||
old_boost_score = boost_score;
|
||||
#endif // FIX_GF_INTERVAL_LENGTH
|
||||
*this_frame = next_frame;
|
||||
}
|
||||
twopass->gf_zeromotion_pct = (int)(zero_motion_accumulator * 1000.0);
|
||||
|
||||
|
|
@ -2693,7 +3043,18 @@ static void define_gf_group(AV1_COMP *cpi, FIRSTPASS_STATS *this_frame) {
|
|||
}
|
||||
|
||||
// Set the interval until the next gf.
|
||||
rc->baseline_gf_interval = i - (is_key_frame || rc->source_alt_ref_pending);
|
||||
if (cpi->oxcf.fwd_kf_enabled) {
|
||||
// Ensure the gf group before the next keyframe will contain an altref
|
||||
if ((rc->frames_to_key - i < rc->min_gf_interval) &&
|
||||
(rc->frames_to_key != i)) {
|
||||
rc->baseline_gf_interval = AOMMIN(rc->frames_to_key - rc->min_gf_interval,
|
||||
rc->static_scene_max_gf_interval);
|
||||
} else {
|
||||
rc->baseline_gf_interval = i;
|
||||
}
|
||||
} else {
|
||||
rc->baseline_gf_interval = i - (is_key_frame || rc->source_alt_ref_pending);
|
||||
}
|
||||
if (non_zero_stdev_count) avg_raw_err_stdev /= non_zero_stdev_count;
|
||||
|
||||
// Disable extra altrefs and backward refs for "still" gf group:
|
||||
|
|
@ -2711,12 +3072,23 @@ static void define_gf_group(AV1_COMP *cpi, FIRSTPASS_STATS *this_frame) {
|
|||
if (!cpi->extra_arf_allowed) {
|
||||
cpi->num_extra_arfs = 0;
|
||||
} else {
|
||||
#if USE_SYMM_MULTI_LAYER
|
||||
if (rc->baseline_gf_interval == 4 && rc->source_alt_ref_pending)
|
||||
cpi->num_extra_arfs = 1;
|
||||
else
|
||||
cpi->num_extra_arfs = get_number_of_extra_arfs(
|
||||
rc->baseline_gf_interval, rc->source_alt_ref_pending);
|
||||
#else
|
||||
// Compute how many extra alt_refs we can have
|
||||
cpi->num_extra_arfs = get_number_of_extra_arfs(rc->baseline_gf_interval,
|
||||
rc->source_alt_ref_pending);
|
||||
#endif // USE_SYMM_MULTI_LAYER
|
||||
}
|
||||
|
||||
#if !USE_SYMM_MULTI_LAYER
|
||||
// Currently at maximum two extra ARFs' are allowed
|
||||
assert(cpi->num_extra_arfs <= MAX_EXT_ARFS);
|
||||
#endif
|
||||
|
||||
rc->frames_till_gf_update_due = rc->baseline_gf_interval;
|
||||
|
||||
|
|
@ -3393,8 +3765,17 @@ static void configure_buffer_updates(AV1_COMP *cpi) {
|
|||
case INTNL_ARF_UPDATE:
|
||||
cpi->refresh_last_frame = 0;
|
||||
cpi->refresh_golden_frame = 0;
|
||||
cpi->refresh_bwd_ref_frame = 0;
|
||||
cpi->refresh_alt2_ref_frame = 1;
|
||||
#if USE_SYMM_MULTI_LAYER
|
||||
if (cpi->new_bwdref_update_rule == 1) {
|
||||
cpi->refresh_bwd_ref_frame = 1;
|
||||
cpi->refresh_alt2_ref_frame = 0;
|
||||
} else {
|
||||
#endif
|
||||
cpi->refresh_bwd_ref_frame = 0;
|
||||
cpi->refresh_alt2_ref_frame = 1;
|
||||
#if USE_SYMM_MULTI_LAYER
|
||||
}
|
||||
#endif
|
||||
cpi->refresh_alt_ref_frame = 0;
|
||||
break;
|
||||
|
||||
|
|
@ -3402,6 +3783,51 @@ static void configure_buffer_updates(AV1_COMP *cpi) {
|
|||
}
|
||||
}
|
||||
|
||||
void av1_configure_buffer_updates_firstpass(AV1_COMP *cpi,
|
||||
FRAME_UPDATE_TYPE update_type) {
|
||||
RATE_CONTROL *rc = &cpi->rc;
|
||||
|
||||
cpi->refresh_last_frame = 1;
|
||||
cpi->refresh_golden_frame = 0;
|
||||
cpi->refresh_bwd_ref_frame = 0;
|
||||
cpi->refresh_alt2_ref_frame = 0;
|
||||
cpi->refresh_alt_ref_frame = 0;
|
||||
|
||||
rc->is_bwd_ref_frame = 0;
|
||||
|
||||
switch (update_type) {
|
||||
case ARF_UPDATE:
|
||||
cpi->refresh_alt_ref_frame = 1;
|
||||
cpi->refresh_last_frame = 0;
|
||||
cpi->refresh_golden_frame = 0;
|
||||
cpi->refresh_bwd_ref_frame = 0;
|
||||
cpi->refresh_alt2_ref_frame = 0;
|
||||
|
||||
rc->is_src_frame_alt_ref = 0;
|
||||
break;
|
||||
case INTNL_ARF_UPDATE:
|
||||
cpi->refresh_alt2_ref_frame = 1;
|
||||
cpi->refresh_last_frame = 0;
|
||||
cpi->refresh_golden_frame = 0;
|
||||
cpi->refresh_bwd_ref_frame = 0;
|
||||
cpi->refresh_alt_ref_frame = 0;
|
||||
rc->is_src_frame_alt_ref = 0;
|
||||
rc->is_src_frame_ext_arf = 0;
|
||||
|
||||
break;
|
||||
case BIPRED_UPDATE:
|
||||
cpi->refresh_bwd_ref_frame = 1;
|
||||
cpi->refresh_last_frame = 0;
|
||||
cpi->refresh_golden_frame = 0;
|
||||
cpi->refresh_alt2_ref_frame = 0;
|
||||
cpi->refresh_alt_ref_frame = 0;
|
||||
|
||||
rc->is_bwd_ref_frame = 1;
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
static int is_skippable_frame(const AV1_COMP *cpi) {
|
||||
// If the current frame does not have non-zero motion vector detected in the
|
||||
// first pass, and so do its previous and forward frames, then this frame
|
||||
|
|
@ -3444,7 +3870,12 @@ void av1_rc_get_second_pass_params(AV1_COMP *cpi) {
|
|||
target_rate = av1_rc_clamp_pframe_target_size(cpi, target_rate);
|
||||
rc->base_frame_target = target_rate;
|
||||
|
||||
cm->frame_type = INTER_FRAME;
|
||||
if (cpi->no_show_kf) {
|
||||
assert(gf_group->update_type[gf_group->index] == ARF_UPDATE);
|
||||
cm->frame_type = KEY_FRAME;
|
||||
} else {
|
||||
cm->frame_type = INTER_FRAME;
|
||||
}
|
||||
|
||||
// Do the firstpass stats indicate that this frame is skippable for the
|
||||
// partition search?
|
||||
|
|
@ -3479,7 +3910,7 @@ void av1_rc_get_second_pass_params(AV1_COMP *cpi) {
|
|||
twopass->baseline_active_worst_quality = tmp_q;
|
||||
rc->ni_av_qi = tmp_q;
|
||||
rc->last_q[INTER_FRAME] = tmp_q;
|
||||
rc->avg_q = av1_convert_qindex_to_q(tmp_q, cm->bit_depth);
|
||||
rc->avg_q = av1_convert_qindex_to_q(tmp_q, cm->seq_params.bit_depth);
|
||||
rc->avg_frame_qindex[INTER_FRAME] = tmp_q;
|
||||
rc->last_q[KEY_FRAME] = (tmp_q + cpi->oxcf.best_allowed_q) / 2;
|
||||
rc->avg_frame_qindex[KEY_FRAME] = rc->last_q[KEY_FRAME];
|
||||
|
|
|
|||
7
third_party/aom/av1/encoder/firstpass.h
vendored
7
third_party/aom/av1/encoder/firstpass.h
vendored
|
|
@ -122,6 +122,11 @@ typedef struct {
|
|||
unsigned char arf_src_offset[(MAX_LAG_BUFFERS * 2) + 1];
|
||||
unsigned char arf_update_idx[(MAX_LAG_BUFFERS * 2) + 1];
|
||||
unsigned char arf_ref_idx[(MAX_LAG_BUFFERS * 2) + 1];
|
||||
#if USE_SYMM_MULTI_LAYER
|
||||
unsigned char arf_pos_in_gf[(MAX_LAG_BUFFERS * 2) + 1];
|
||||
unsigned char pyramid_level[(MAX_LAG_BUFFERS * 2) + 1];
|
||||
unsigned char pyramid_height;
|
||||
#endif
|
||||
unsigned char brf_src_offset[(MAX_LAG_BUFFERS * 2) + 1];
|
||||
unsigned char bidir_pred_enabled[(MAX_LAG_BUFFERS * 2) + 1];
|
||||
unsigned char ref_fb_idx_map[(MAX_LAG_BUFFERS * 2) + 1][REF_FRAMES];
|
||||
|
|
@ -186,6 +191,8 @@ void av1_end_first_pass(struct AV1_COMP *cpi);
|
|||
|
||||
void av1_init_second_pass(struct AV1_COMP *cpi);
|
||||
void av1_rc_get_second_pass_params(struct AV1_COMP *cpi);
|
||||
void av1_configure_buffer_updates_firstpass(struct AV1_COMP *cpi,
|
||||
FRAME_UPDATE_TYPE update_type);
|
||||
|
||||
// Post encode update of the rate control parameters for 2-pass
|
||||
void av1_twopass_postencode_update(struct AV1_COMP *cpi);
|
||||
|
|
|
|||
11
third_party/aom/av1/encoder/hash_motion.c
vendored
11
third_party/aom/av1/encoder/hash_motion.c
vendored
|
|
@ -1,3 +1,14 @@
|
|||
/*
|
||||
* Copyright (c) 2018, Alliance for Open Media. All rights reserved
|
||||
*
|
||||
* This source code is subject to the terms of the BSD 2 Clause License and
|
||||
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
|
||||
* was not distributed with this source code in the LICENSE file, you can
|
||||
* obtain it at www.aomedia.org/license/software. If the Alliance for Open
|
||||
* Media Patent License 1.0 was not distributed with this source code in the
|
||||
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "config/av1_rtcd.h"
|
||||
|
|
|
|||
|
|
@ -1311,6 +1311,481 @@ static const NN_CONFIG av1_ab_partition_nnconfig_16 = {
|
|||
#undef FEATURE_SIZE
|
||||
#undef LABEL_SIZE
|
||||
|
||||
#define FEATURE_SIZE 18
|
||||
#define LABEL_SIZE 4
|
||||
|
||||
static const float av1_4_partition_nn_weights_16_layer0[FEATURE_SIZE * 48] = {
|
||||
0.121894f, 0.058485f, 0.702226f, 0.015457f, -0.123380f, -0.573450f,
|
||||
0.319576f, 0.118808f, 0.166057f, 0.526984f, 0.015211f, -0.025050f,
|
||||
0.085717f, -0.028221f, -0.580062f, -0.270530f, -0.092371f, 0.037679f,
|
||||
0.083573f, 0.007112f, -0.358623f, -0.264443f, -0.064819f, 0.022013f,
|
||||
-0.040077f, -0.291967f, -0.293100f, 0.072266f, -0.270572f, -0.292253f,
|
||||
-0.260105f, -0.294472f, -0.275752f, 0.054315f, 0.000085f, 0.105115f,
|
||||
-0.363572f, -0.016542f, 0.185943f, -0.359903f, 0.038765f, -0.377668f,
|
||||
0.172692f, 0.127749f, -0.031275f, -0.242528f, -0.145880f, -0.055247f,
|
||||
-0.000265f, -0.355224f, 0.089917f, -0.377841f, -0.209766f, 0.030899f,
|
||||
0.039546f, -0.375030f, -0.041605f, 0.137677f, 0.021282f, -0.150442f,
|
||||
-0.189445f, 0.009293f, -0.316033f, 0.038745f, -0.278761f, 0.005692f,
|
||||
-0.071763f, -0.302936f, -0.224572f, -0.211841f, 0.057503f, 0.005435f,
|
||||
-0.930979f, 0.115513f, 0.689958f, 0.221318f, 1.003891f, 0.359540f,
|
||||
-0.640534f, -0.162373f, -0.118105f, 0.205587f, 0.019710f, 0.025067f,
|
||||
-0.025344f, 0.002831f, 0.033078f, 0.040175f, -0.007502f, 0.026272f,
|
||||
0.083443f, -0.880884f, 0.436948f, 0.293297f, 0.051678f, -0.133328f,
|
||||
-0.180323f, 0.667835f, 0.070733f, -0.003060f, -0.221804f, 0.146601f,
|
||||
0.064024f, 0.056758f, -0.077361f, 0.105587f, -0.185500f, -0.133552f,
|
||||
0.138269f, 0.165055f, 0.628284f, 0.846449f, 0.058825f, 0.223157f,
|
||||
0.277896f, -0.381303f, 0.408241f, 0.643301f, 0.067494f, 0.120822f,
|
||||
-0.182491f, -0.111373f, -0.033374f, 0.131387f, -0.114654f, 0.114318f,
|
||||
0.094718f, -0.052232f, 0.385903f, 1.212304f, 0.425305f, -0.052993f,
|
||||
0.291474f, -0.319730f, 0.023090f, -0.317259f, 0.011181f, -0.034185f,
|
||||
-0.100671f, 0.186185f, -0.432511f, -0.115957f, -0.067746f, -0.177810f,
|
||||
-0.226700f, 0.004464f, 0.006809f, 0.171360f, -0.080723f, 0.099826f,
|
||||
-0.062301f, -0.358755f, -0.202549f, -0.084616f, -0.042313f, -0.325560f,
|
||||
0.010452f, -0.341089f, -0.013566f, -0.340129f, 0.034675f, -0.036518f,
|
||||
-0.036473f, -0.192892f, 0.650235f, 0.609437f, -0.160982f, 0.125535f,
|
||||
-1.004575f, 0.521969f, 1.318091f, 0.614004f, -0.106622f, -0.077453f,
|
||||
-0.037328f, -0.081940f, 0.007640f, 0.026654f, -0.080332f, -0.077356f,
|
||||
-0.288170f, -0.319680f, -0.131712f, -0.150985f, 0.073218f, 0.089502f,
|
||||
-0.280502f, 0.003941f, -0.249937f, 0.244263f, 0.023269f, 0.080263f,
|
||||
0.073172f, -0.200036f, 0.022381f, 0.008592f, -0.339517f, -0.135073f,
|
||||
0.177199f, 0.208363f, 0.652360f, 0.272990f, 0.609535f, 0.145805f,
|
||||
0.022527f, -0.088378f, 0.205008f, 0.101021f, -0.019673f, -0.252681f,
|
||||
0.116034f, -0.062052f, 0.009991f, 0.138933f, -0.182428f, 0.052542f,
|
||||
-0.350825f, -0.122654f, -0.154687f, 0.066747f, 0.021541f, -0.212169f,
|
||||
-0.087093f, -0.087488f, 0.178129f, -0.146544f, 0.013919f, -0.273899f,
|
||||
0.223753f, -0.187327f, -0.118795f, -0.191892f, -0.355979f, 0.023794f,
|
||||
-0.135236f, 0.058918f, 0.069080f, 0.279287f, 0.369689f, 1.134526f,
|
||||
0.659511f, 0.250223f, 0.286040f, 0.515284f, 0.067791f, -0.156385f,
|
||||
0.143283f, 0.050884f, 0.089956f, -0.040850f, -0.003650f, -0.081162f,
|
||||
0.086004f, 0.116578f, 0.826254f, 0.504869f, -0.196022f, -0.207279f,
|
||||
0.200503f, -0.196801f, 0.008211f, 0.411158f, -0.075855f, -0.036690f,
|
||||
0.111519f, -0.057838f, -0.005846f, 0.111067f, 0.174712f, -0.078054f,
|
||||
0.765897f, 0.018670f, -0.306960f, -0.020034f, -0.332875f, 0.662707f,
|
||||
-0.461233f, -1.007542f, -0.693995f, -1.243352f, -0.014745f, 0.004036f,
|
||||
-0.009141f, 0.003325f, -0.011233f, -0.000819f, 0.006369f, 0.002418f,
|
||||
-0.035906f, -0.005135f, 1.073830f, 1.020736f, -0.182611f, -1.038976f,
|
||||
-0.226695f, -0.375663f, 0.364568f, 0.620995f, -0.018615f, 0.011347f,
|
||||
0.045786f, 0.041077f, 0.010886f, -0.148428f, 0.028007f, -0.022322f,
|
||||
-0.165985f, 0.233315f, -0.277531f, -0.329683f, -0.516967f, -0.390750f,
|
||||
0.006948f, 0.133744f, -0.375681f, -0.116877f, -0.009441f, -0.008597f,
|
||||
-0.160679f, 0.102150f, -0.142647f, -0.117501f, 0.035035f, 0.228687f,
|
||||
-1.117397f, -0.005171f, -0.008708f, 0.413042f, -0.298532f, 0.614909f,
|
||||
-0.181084f, -0.711770f, 0.344033f, 0.287220f, -0.112848f, -0.052866f,
|
||||
-0.222466f, 0.025029f, -0.107558f, 0.137036f, -0.276661f, -0.038808f,
|
||||
-0.057448f, 0.037563f, 0.526020f, 0.447997f, 0.288366f, 0.264815f,
|
||||
0.319974f, -0.193091f, 0.353830f, 0.412950f, -0.280454f, 0.092737f,
|
||||
0.070919f, 0.043336f, 0.041214f, -0.052147f, 0.010860f, 0.191325f,
|
||||
0.079783f, -0.425672f, -0.053469f, -0.005495f, 0.184526f, -0.166171f,
|
||||
0.084459f, -0.042165f, -0.261759f, -0.248723f, -0.073483f, -0.377884f,
|
||||
-0.189614f, -0.054146f, -0.261279f, 0.196347f, -0.087568f, 0.070533f,
|
||||
-0.145492f, -0.041500f, -0.465861f, 0.077369f, 0.020645f, -0.440232f,
|
||||
-0.414585f, -0.168627f, -0.050011f, -0.336676f, -0.344943f, -0.288140f,
|
||||
0.085513f, -0.200425f, 0.218516f, 0.049604f, -0.280952f, -0.242674f,
|
||||
-1.969931f, 0.013374f, -0.039643f, 1.113947f, 0.018568f, 0.916330f,
|
||||
-0.302934f, -0.225816f, 0.189529f, -0.361971f, 0.021073f, -0.050143f,
|
||||
-0.041415f, 0.015126f, 0.018091f, -0.082401f, 0.017152f, 0.064856f,
|
||||
0.156170f, 0.145323f, -0.281409f, 0.213357f, -0.058966f, 0.158668f,
|
||||
0.033742f, 0.378820f, -0.662875f, -0.455532f, -0.702928f, 0.234325f,
|
||||
0.139627f, -1.360650f, 0.040921f, -0.044373f, -0.059999f, -0.048565f,
|
||||
0.115339f, -0.105888f, -0.170567f, -0.206097f, -0.349537f, 0.107941f,
|
||||
-0.356286f, -0.374928f, 0.143257f, -0.317790f, 0.079875f, -0.359345f,
|
||||
0.081321f, -0.219772f, -0.077213f, 0.110624f, -0.252329f, -0.266481f,
|
||||
0.190135f, 0.121214f, 0.661064f, -0.037820f, -0.373068f, -0.065209f,
|
||||
-0.286154f, -0.120695f, -0.110670f, -0.193589f, -0.010867f, -0.048054f,
|
||||
-0.032010f, 0.110627f, 0.054094f, -0.884309f, -1.171623f, -0.386911f,
|
||||
-0.756058f, 0.030362f, 0.563628f, -0.334227f, -0.111213f, 1.143898f,
|
||||
-0.940454f, 0.084510f, 0.671010f, 0.312244f, -0.052592f, -0.014376f,
|
||||
0.039965f, -0.010763f, -0.114936f, -0.146020f, 0.015874f, 0.027439f,
|
||||
-1.702315f, 0.148702f, 0.153021f, 0.363147f, -0.488933f, 0.220772f,
|
||||
0.640310f, -0.173911f, -0.169523f, -0.082261f, -0.014854f, 0.024414f,
|
||||
0.061041f, -0.013998f, 0.086539f, 0.000466f, 0.037472f, -0.010665f,
|
||||
-0.326646f, 0.106971f, 0.405589f, 0.555345f, -0.318315f, 0.526498f,
|
||||
0.119246f, 0.022213f, 0.171237f, 0.214651f, 0.062904f, -0.023764f,
|
||||
0.011831f, 0.079644f, -0.096530f, -0.054373f, -0.306309f, -0.203709f,
|
||||
-0.353217f, -0.350005f, -0.329549f, 0.062679f, -0.387625f, -0.237111f,
|
||||
-0.025050f, -0.193987f, 0.002235f, -0.380821f, -0.051036f, -0.136020f,
|
||||
0.077989f, -0.361691f, 0.120485f, 0.157746f, 0.073394f, -0.284401f,
|
||||
0.113221f, 0.109808f, 0.000197f, 0.122523f, 0.081411f, -0.048544f,
|
||||
-0.136577f, -0.007158f, -0.208952f, -0.276831f, 0.260479f, -1.392915f,
|
||||
-0.865248f, 0.114577f, -0.000749f, -0.060338f, -0.091176f, -0.108421f,
|
||||
0.221256f, 0.100176f, -0.877560f, -1.248838f, 0.643005f, 0.064580f,
|
||||
-0.049878f, 0.267988f, -0.434340f, -0.299254f, -0.097572f, 0.009606f,
|
||||
0.063810f, -0.090525f, 0.027760f, 0.043484f, 0.041697f, 0.108024f,
|
||||
-0.359586f, -0.197090f, 0.121397f, 0.152206f, -0.391126f, -0.283145f,
|
||||
0.008754f, -0.059022f, -0.218745f, 0.043042f, -0.056716f, 0.153051f,
|
||||
-0.210372f, -0.029681f, -0.288354f, 0.065242f, -0.189376f, 0.115013f,
|
||||
-0.251488f, -0.533091f, 0.037768f, -0.319107f, -0.161364f, -0.103967f,
|
||||
0.063271f, -0.313289f, -0.312093f, -0.045239f, 0.150607f, 0.001487f,
|
||||
0.019602f, -0.338031f, -0.036214f, 0.112736f, -0.367762f, 0.122367f,
|
||||
0.094670f, 0.175590f, 0.301041f, -0.135257f, 0.539620f, 0.328619f,
|
||||
-0.163971f, 0.137256f, 0.238805f, 0.483722f, 0.121353f, 0.083630f,
|
||||
-0.283568f, 0.291661f, -0.061122f, -0.195295f, 0.153459f, -0.153727f,
|
||||
-0.238839f, -0.071736f, 0.601437f, -0.664072f, 0.230827f, 0.198753f,
|
||||
-0.039196f, 0.206751f, 0.529020f, 0.904132f, -0.219471f, 0.186694f,
|
||||
-0.208608f, -0.093385f, -0.161617f, 0.003930f, -0.429869f, -0.123563f,
|
||||
0.626098f, -0.002495f, -0.245511f, -1.069848f, 0.296115f, -0.940267f,
|
||||
-1.649122f, -0.512937f, -0.802874f, -1.000239f, -0.027629f, 0.020434f,
|
||||
-0.003030f, 0.035986f, -0.004812f, -0.009193f, -0.004644f, -0.024347f,
|
||||
0.068439f, -0.314339f, 0.095057f, -0.212372f, 0.197523f, -0.040878f,
|
||||
-0.272164f, -0.243326f, -0.204955f, 0.157199f, -0.049964f, -0.091537f,
|
||||
-0.058012f, -0.306650f, 0.098621f, -0.146778f, -0.154447f, -0.177889f,
|
||||
-0.009698f, 0.025427f, 0.350576f, -0.448237f, -0.068823f, 1.224960f,
|
||||
-0.776883f, -0.692167f, -0.948497f, -0.492598f, 0.029440f, -0.056460f,
|
||||
0.021654f, 0.004352f, 0.041508f, -0.027179f, 0.006789f, -0.023573f,
|
||||
0.207775f, -0.280273f, -0.347984f, -0.129935f, 0.151512f, -0.087294f,
|
||||
-0.494352f, -0.341424f, 0.044084f, -0.064080f, 0.073091f, -0.145574f,
|
||||
0.094715f, -0.258786f, -0.020419f, -0.401823f, 0.009397f, -0.138642f,
|
||||
-0.034953f, -0.077419f, 0.636610f, 0.314980f, 1.110610f, -0.343368f,
|
||||
0.696647f, -0.649667f, 0.653491f, -0.096006f, -0.090469f, -0.066975f,
|
||||
-0.105864f, -0.015666f, 0.102056f, -0.105344f, -0.273495f, -0.014686f,
|
||||
0.122031f, 0.139524f, -1.042029f, -0.562510f, 0.885644f, 1.088059f,
|
||||
0.189223f, 0.049404f, -0.167371f, 0.018703f, -0.208390f, -0.159002f,
|
||||
-0.377130f, -0.151118f, 0.117861f, 0.026986f, -0.032433f, 0.081603f,
|
||||
-0.106729f, -0.040134f, 0.015161f, 0.290572f, 0.241446f, 1.390085f,
|
||||
0.438915f, -0.358097f, -0.171799f, 0.879758f, -0.014110f, 0.029562f,
|
||||
-0.073583f, -0.125817f, -0.036512f, -0.040275f, 0.037997f, 0.120979f,
|
||||
0.064538f, -0.038841f, 0.034797f, 0.110229f, -0.239779f, -0.004558f,
|
||||
0.226534f, 0.111286f, -0.268198f, 0.237673f, -0.328237f, -0.090774f,
|
||||
-0.269690f, -0.202147f, -0.181808f, -0.305238f, 0.110058f, -0.169217f,
|
||||
-0.300125f, 0.069031f, -0.081358f, -0.376174f, -0.349980f, 0.071443f,
|
||||
-0.396278f, -0.389503f, -0.190410f, -0.014767f, -0.265229f, -0.099787f,
|
||||
0.079847f, -0.214580f, -0.235661f, -0.184227f, 0.111099f, -0.083945f,
|
||||
-0.153809f, -0.284092f, -0.132497f, -0.154841f, -0.517157f, -0.640603f,
|
||||
-0.357036f, -0.486142f, -0.182819f, -0.475022f, 0.079282f, 0.081168f,
|
||||
-0.120831f, -0.016048f, -0.232495f, 0.214329f, -0.055058f, 0.032856f,
|
||||
0.061753f, 0.003226f, 0.097028f, 0.084535f, -1.563199f, 0.434928f,
|
||||
-0.403710f, 0.520696f, -0.401696f, 0.450568f, -0.074121f, 0.076622f,
|
||||
-0.098421f, 0.167036f, -0.255250f, -0.526313f, -0.933693f, -0.558104f,
|
||||
0.194341f, 0.173326f, 0.071112f, -0.651961f, -1.327587f, -0.705289f,
|
||||
-1.138889f, 0.197167f, -0.714654f, -0.113891f, 0.080158f, 0.000301f,
|
||||
0.057905f, 0.060718f, -0.635995f, 0.100026f, -0.038239f, -0.025530f,
|
||||
};
|
||||
|
||||
static const float av1_4_partition_nn_bias_16_layer0[48] = {
|
||||
-0.079252f, -0.083606f, -0.112759f, -0.071622f, 0.444562f, 0.215649f,
|
||||
-0.337661f, -0.242379f, -0.053829f, 0.165168f, -0.076613f, -0.190579f,
|
||||
-0.060175f, -0.571661f, -0.454075f, -1.462711f, -0.161563f, -0.088748f,
|
||||
-0.030279f, -0.456293f, -0.134473f, -0.194976f, 0.044373f, -0.503954f,
|
||||
-0.083563f, 0.123344f, 0.011821f, 0.085445f, -0.050294f, -0.135194f,
|
||||
0.057815f, 0.543558f, -0.090602f, -0.104671f, -0.285075f, 0.354335f,
|
||||
1.037007f, -0.023879f, -0.025025f, -0.094408f, -0.101200f, -0.142105f,
|
||||
-0.380607f, -0.059067f, -0.113017f, -0.137448f, -0.177840f, 0.468505f,
|
||||
};
|
||||
|
||||
static const float av1_4_partition_nn_weights_16_layer1[48 * LABEL_SIZE] = {
|
||||
0.174954f, -0.239117f, 0.073252f, 0.258881f, 0.579781f, 0.441827f,
|
||||
0.372037f, -0.062362f, 0.068477f, 0.376811f, -0.130520f, 0.214951f,
|
||||
-0.200674f, 0.240347f, 0.152954f, 1.360264f, 0.334630f, -0.064789f,
|
||||
-0.270826f, 0.212699f, 0.045669f, -0.150852f, -0.412603f, 0.122481f,
|
||||
-0.230246f, 0.005004f, 0.321417f, -0.554083f, -0.186742f, -0.197687f,
|
||||
-0.028669f, -0.138559f, -0.117773f, 0.024953f, 0.326367f, -0.109951f,
|
||||
-1.098959f, -0.136134f, 0.563218f, 0.191799f, 0.126191f, -0.093113f,
|
||||
0.185371f, 0.058468f, 0.245247f, -0.138064f, -0.471573f, -0.209372f,
|
||||
-0.111171f, 0.222275f, -0.350556f, -0.106336f, 0.268877f, 0.090639f,
|
||||
-0.083008f, -0.190791f, -0.243922f, -0.121182f, -0.133733f, -0.078450f,
|
||||
0.099751f, 0.353020f, -0.199079f, -0.463492f, -0.647884f, 0.166611f,
|
||||
-0.464034f, 0.045096f, -0.312178f, -0.190972f, -0.468297f, 0.662376f,
|
||||
-0.197071f, -0.653123f, -0.354365f, -0.088501f, -0.302671f, 0.140713f,
|
||||
0.885444f, 0.350273f, -0.003345f, 0.217260f, 0.219156f, 0.240653f,
|
||||
0.347840f, 0.101849f, -0.244565f, -0.166971f, 0.091056f, 0.319912f,
|
||||
0.268459f, 0.250726f, -0.155819f, -0.087588f, 0.010749f, -0.192344f,
|
||||
0.344808f, 0.223482f, -0.189563f, -0.067317f, -0.348191f, -0.085265f,
|
||||
0.259318f, 0.102408f, 0.096675f, -0.255564f, -0.168480f, -0.068189f,
|
||||
-0.457704f, 0.010565f, 0.228573f, -0.124421f, 0.202488f, 0.148519f,
|
||||
0.002180f, 0.099099f, -0.179019f, 0.245414f, -0.038307f, 0.116897f,
|
||||
-0.031377f, 0.368533f, -0.793891f, 0.148614f, 0.075441f, 0.102465f,
|
||||
-0.310002f, -0.355369f, -0.206713f, -0.262276f, 0.068578f, -0.044980f,
|
||||
0.092689f, -0.181058f, 0.016279f, 0.155965f, 0.545361f, -0.390699f,
|
||||
-0.042457f, 0.110238f, 0.114640f, 0.112525f, 0.522221f, 0.533164f,
|
||||
-0.331720f, -0.212966f, 0.140823f, 0.251311f, -0.006092f, -0.800438f,
|
||||
0.007981f, -0.585140f, -0.006526f, 0.541683f, -0.298498f, 0.084322f,
|
||||
-0.056467f, -0.361806f, -0.256347f, -1.419173f, -0.159093f, 0.023017f,
|
||||
0.667915f, -0.176995f, 0.022307f, -0.169493f, 0.581377f, 0.044929f,
|
||||
0.044914f, -0.056290f, 0.324196f, 0.648043f, -0.089381f, -0.054971f,
|
||||
0.064782f, 0.629356f, -0.003760f, -0.123822f, 0.144133f, -0.378821f,
|
||||
1.116858f, 0.128552f, -0.668783f, 0.207194f, -0.437781f, -0.283321f,
|
||||
-0.549404f, 0.010538f, 0.208997f, 0.231396f, -0.174347f, 0.161910f,
|
||||
};
|
||||
|
||||
static const float av1_4_partition_nn_bias_16_layer1[LABEL_SIZE] = {
|
||||
-0.197883f,
|
||||
-0.136696f,
|
||||
0.094115f,
|
||||
0.612799f,
|
||||
};
|
||||
|
||||
static const NN_CONFIG av1_4_partition_nnconfig_16 = {
|
||||
FEATURE_SIZE, // num_inputs
|
||||
LABEL_SIZE, // num_outputs
|
||||
1, // num_hidden_layers
|
||||
{
|
||||
48, // num_hidden_nodes
|
||||
},
|
||||
{
|
||||
av1_4_partition_nn_weights_16_layer0,
|
||||
av1_4_partition_nn_weights_16_layer1,
|
||||
},
|
||||
{
|
||||
av1_4_partition_nn_bias_16_layer0,
|
||||
av1_4_partition_nn_bias_16_layer1,
|
||||
},
|
||||
};
|
||||
|
||||
static const float av1_4_partition_nn_weights_32_layer0[FEATURE_SIZE * 32] = {
|
||||
0.114554f, 0.043669f, 0.313291f, 0.167688f, -0.413357f, 0.088232f,
|
||||
0.301915f, -0.358117f, 0.267711f, -0.252716f, -0.038531f, -0.032805f,
|
||||
-0.025382f, 0.023624f, -0.949694f, -0.065480f, -0.375721f, -0.697319f,
|
||||
-0.117387f, -0.204309f, -0.190797f, -0.223867f, -0.190248f, 0.026668f,
|
||||
0.199717f, 0.216902f, -0.239241f, -0.096894f, -0.225046f, 0.246523f,
|
||||
0.002333f, -0.254385f, -0.205815f, 0.123139f, -0.476923f, 0.137557f,
|
||||
0.059686f, -0.124013f, 0.974675f, 0.889753f, 0.378940f, 0.526413f,
|
||||
-0.208747f, -0.001913f, 0.094081f, 0.848010f, 0.062042f, 0.159831f,
|
||||
0.071016f, 0.024437f, 0.212611f, 0.039501f, -0.149922f, -0.055229f,
|
||||
-0.229270f, 0.129004f, -0.182803f, 0.291223f, -1.197804f, -0.916991f,
|
||||
-0.024095f, 0.738729f, -0.300326f, 0.402480f, 0.023944f, -0.022613f,
|
||||
-0.004554f, 0.001784f, 0.035143f, -0.202237f, 0.080252f, -0.003912f,
|
||||
-0.040345f, -0.121881f, 0.126672f, 0.093507f, -0.081305f, -0.081099f,
|
||||
-0.218824f, -0.459254f, -0.055250f, -0.095096f, 0.207278f, 0.245259f,
|
||||
-0.380849f, -0.334458f, -0.351449f, -0.513045f, -0.407823f, -0.222423f,
|
||||
0.103205f, -0.299965f, -0.211472f, -0.348690f, -0.283688f, -0.152743f,
|
||||
-0.204005f, -0.173636f, 0.020302f, -0.109112f, 0.081203f, -0.137344f,
|
||||
-0.364582f, -0.343133f, -0.176167f, -0.446541f, 0.144844f, -0.268105f,
|
||||
-0.003889f, -0.309560f, -0.236092f, -0.299450f, 0.248269f, 0.207510f,
|
||||
-0.279023f, -0.272472f, -0.166427f, 0.205973f, -0.345692f, -0.238400f,
|
||||
-0.319178f, -0.327246f, -0.321756f, 0.043191f, -0.027520f, -0.029310f,
|
||||
0.161379f, 0.031154f, -0.605365f, -0.230926f, 0.261142f, -0.262678f,
|
||||
-0.373351f, -0.326245f, 0.279222f, 0.684357f, -0.864302f, 0.036132f,
|
||||
0.239307f, 0.136262f, 0.124002f, -0.410379f, -0.172722f, -0.376670f,
|
||||
-0.195889f, 0.037292f, -0.055295f, 1.022308f, 0.237600f, -0.618435f,
|
||||
0.366154f, 0.168308f, -0.473467f, -0.756558f, -0.044830f, 0.019057f,
|
||||
-0.084214f, -0.007789f, -0.066028f, -0.074562f, 0.002082f, 0.001007f,
|
||||
-0.269676f, -0.164768f, -0.027271f, -0.098935f, 0.009431f, 0.254431f,
|
||||
0.124238f, -0.198181f, 0.142723f, -0.112997f, -0.164224f, -0.355160f,
|
||||
0.135330f, -0.379557f, 0.079392f, 0.210607f, -0.354927f, -0.277678f,
|
||||
-0.931111f, 0.056208f, -0.347710f, -0.355415f, 0.826145f, 0.390625f,
|
||||
0.374414f, -0.205685f, 0.562485f, 0.152288f, 0.130635f, 0.056622f,
|
||||
0.057972f, 0.095526f, -0.082436f, -0.085938f, -0.070570f, -0.087634f,
|
||||
0.335934f, 0.084860f, 0.544424f, -0.278917f, 0.476740f, 0.050927f,
|
||||
-1.288817f, -0.078320f, -0.553041f, -0.160538f, -0.109365f, -0.127146f,
|
||||
-0.032524f, -0.105117f, -0.182965f, -0.024723f, 0.083317f, 0.060073f,
|
||||
-0.042945f, 0.015249f, 1.241504f, 0.662613f, 0.530496f, -0.180519f,
|
||||
-1.099086f, -0.825844f, 0.551856f, -0.025009f, -0.006619f, -0.001049f,
|
||||
0.014828f, -0.035166f, -0.241091f, -0.136364f, -0.003219f, -0.014581f,
|
||||
-0.379945f, -0.226191f, -0.161241f, -0.496390f, -0.147175f, -0.118004f,
|
||||
-0.128206f, -0.389770f, -0.184288f, -0.119076f, -0.379211f, 0.236180f,
|
||||
-0.468730f, -0.175170f, 0.136433f, 0.167739f, -0.377602f, 0.135772f,
|
||||
0.040972f, -0.193974f, -0.319475f, -0.016469f, -0.412027f, -0.322605f,
|
||||
0.111125f, -0.078456f, -0.387234f, -0.401605f, -0.088717f, -0.340682f,
|
||||
0.010556f, 0.058256f, -0.127352f, 0.017665f, 0.072632f, -0.171966f,
|
||||
-0.117342f, -0.166050f, -0.182689f, -0.073182f, 0.096279f, -0.260229f,
|
||||
0.025216f, -0.332236f, -0.218706f, -0.200153f, -0.110303f, 0.073499f,
|
||||
-0.280123f, 0.132262f, -0.308330f, -0.119036f, -0.303874f, -0.065445f,
|
||||
-0.412137f, 0.057167f, 0.044582f, -0.330952f, -0.232572f, 0.039732f,
|
||||
-0.326877f, -0.300569f, -0.467164f, -0.371499f, 0.034430f, 0.058277f,
|
||||
-0.042485f, -0.409028f, -0.110889f, -0.500758f, -0.343141f, 0.042023f,
|
||||
-1.071050f, 0.086854f, -0.004932f, -0.259698f, 0.125301f, -0.742663f,
|
||||
-0.370517f, -0.772840f, 0.193628f, 0.554676f, 0.051283f, -0.196639f,
|
||||
0.040344f, 0.027391f, -0.040501f, 0.038303f, 0.032972f, -0.014638f,
|
||||
0.097720f, -0.206897f, -0.015480f, 0.008543f, 0.034469f, 0.127234f,
|
||||
-0.396463f, -0.390189f, 0.117538f, -0.435622f, 0.043420f, -0.241987f,
|
||||
-0.118254f, -0.190349f, 0.190273f, -0.085625f, -0.141253f, -0.377438f,
|
||||
-0.249211f, 0.214512f, -0.363191f, -0.754851f, 0.238045f, 1.127635f,
|
||||
0.173947f, -0.357620f, 0.073671f, 0.220617f, 0.072067f, -0.076214f,
|
||||
-0.044583f, -0.018371f, 0.010952f, -0.135116f, 0.076597f, 0.034480f,
|
||||
-0.070212f, -0.454429f, -0.135215f, 0.163851f, -0.625990f, -0.283991f,
|
||||
0.284051f, 0.182935f, -0.048717f, 0.002484f, -0.009086f, 0.321724f,
|
||||
0.125162f, -0.069624f, -0.430299f, -0.007224f, -0.284725f, -0.475662f,
|
||||
0.123807f, -0.313614f, -0.103142f, 0.072125f, 0.100320f, -0.185558f,
|
||||
-0.481522f, -0.247311f, -0.386762f, -0.258850f, 0.178844f, -0.381231f,
|
||||
-0.436001f, -0.374834f, 0.230104f, -0.500679f, 0.170880f, 0.029657f,
|
||||
-0.105857f, -0.366671f, -0.268833f, 0.036885f, -0.026776f, 0.037837f,
|
||||
-0.362095f, -0.254933f, 0.129650f, 0.007945f, -0.304715f, -0.100813f,
|
||||
-0.342849f, -0.269223f, 0.178490f, 0.186735f, -0.353995f, 0.050381f,
|
||||
-0.440186f, 0.025985f, 1.096969f, 1.132937f, 0.581545f, 0.271734f,
|
||||
-0.109169f, -0.014239f, 0.688644f, 0.602702f, 0.048616f, 0.022335f,
|
||||
0.037545f, 0.081667f, -0.109038f, -0.088565f, -0.002506f, -0.041420f,
|
||||
-0.132515f, 0.187312f, 0.677273f, 1.111182f, 0.199096f, -0.211551f,
|
||||
-0.896508f, 0.257981f, 0.007803f, 0.160343f, -0.124864f, -0.097150f,
|
||||
0.225090f, 0.242900f, -0.195665f, 0.011310f, 0.160765f, 0.169195f,
|
||||
-0.081994f, -0.017372f, -0.566190f, -0.902086f, 0.027768f, 0.511419f,
|
||||
0.076009f, -0.165861f, 0.240487f, 0.006298f, -0.153334f, 0.041249f,
|
||||
0.387092f, 0.313011f, -0.032269f, 0.019024f, 0.052568f, 0.124247f,
|
||||
0.197640f, 0.002537f, 0.651044f, 0.829828f, -0.446444f, -0.402042f,
|
||||
-0.469399f, -0.019842f, 0.371960f, 0.140373f, -0.044808f, 0.008283f,
|
||||
0.093791f, 0.052149f, 0.143123f, -0.449571f, -0.868816f, -0.265661f,
|
||||
-0.225232f, -0.014704f, 0.543836f, -0.374498f, 0.561647f, 1.309445f,
|
||||
0.056789f, -0.048447f, 0.255758f, 0.644553f, -0.124802f, 0.097419f,
|
||||
-0.149336f, 0.021596f, -0.043699f, 0.057591f, -0.000077f, 0.034488f,
|
||||
-0.049353f, -0.007799f, 0.437914f, 0.509369f, 0.674428f, 1.858949f,
|
||||
-0.205964f, 0.060776f, 0.184213f, 0.037177f, -0.062535f, -0.115408f,
|
||||
0.076498f, 0.010235f, -0.142253f, 0.009983f, 0.073436f, 0.038716f,
|
||||
-0.369983f, -0.185959f, -0.137867f, 0.032134f, 0.213814f, -0.125571f,
|
||||
0.247874f, -0.166871f, -0.160890f, 0.147029f, 0.267143f, -0.298488f,
|
||||
-0.210203f, -0.188313f, -0.085024f, -0.244962f, -0.189833f, -0.261242f,
|
||||
0.399519f, 0.143200f, -0.776419f, -0.374639f, -0.022066f, 0.582904f,
|
||||
0.006430f, -0.139134f, -0.491894f, -0.430579f, -0.358221f, -0.231365f,
|
||||
-0.398255f, -0.173231f, 0.211789f, -0.036121f, -0.266856f, 0.042956f,
|
||||
-1.138513f, -0.070313f, 0.158803f, 0.406989f, -0.015974f, 0.651020f,
|
||||
-0.468982f, -0.310019f, 0.416922f, 0.895162f, 0.019921f, 0.004023f,
|
||||
0.006962f, 0.000863f, -0.216395f, -0.074913f, -0.002613f, 0.026703f,
|
||||
};
|
||||
|
||||
static const float av1_4_partition_nn_bias_32_layer0[32] = {
|
||||
0.133615f, -0.113389f, -0.575989f, 0.589389f, -0.193574f, -0.132463f,
|
||||
0.000000f, 0.060317f, 0.264577f, -0.060599f, 0.540147f, -0.127782f,
|
||||
-0.548802f, -0.172235f, -0.193032f, -0.026301f, -0.177527f, 0.267821f,
|
||||
-0.115455f, -0.137162f, -0.079595f, -0.041443f, -0.043856f, -0.657220f,
|
||||
-0.448931f, 0.446300f, 0.250002f, 0.223559f, -0.647723f, -0.014369f,
|
||||
0.084333f, -0.056270f,
|
||||
};
|
||||
|
||||
static const float av1_4_partition_nn_weights_32_layer1[32 * LABEL_SIZE] = {
|
||||
-0.069633f, -0.087239f, 0.365816f, -0.068579f, 0.231198f, -0.067856f,
|
||||
-0.139892f, -0.100235f, -0.488166f, -0.150112f, -0.005546f, 0.210832f,
|
||||
0.778888f, 0.169624f, 0.089968f, -0.243569f, 0.353483f, 0.032296f,
|
||||
-0.157408f, 0.286885f, -0.063537f, -0.324055f, -0.161464f, 0.430600f,
|
||||
0.277707f, -0.196463f, 0.154647f, 0.059804f, 0.176408f, 0.303179f,
|
||||
-0.040156f, 0.375810f, -0.363032f, -0.186808f, -0.264561f, -0.158937f,
|
||||
-0.007949f, -0.076394f, 0.056475f, 0.308528f, 0.695387f, 0.051336f,
|
||||
0.433063f, -0.229948f, -1.210712f, 0.036286f, 0.183868f, -0.117660f,
|
||||
0.230134f, -0.093469f, 0.237918f, 0.625986f, -0.236671f, -0.377172f,
|
||||
0.331091f, -0.394004f, -0.214349f, 0.243940f, -0.600348f, 0.069843f,
|
||||
0.088325f, 0.225775f, 0.276884f, -0.604493f, 0.769812f, 0.259574f,
|
||||
0.086220f, 0.511515f, -0.282584f, -0.157719f, 0.278778f, -0.332732f,
|
||||
0.068985f, -0.237236f, -0.006102f, -0.154883f, 0.710288f, -0.245896f,
|
||||
-0.255895f, -0.398038f, 0.304084f, -0.317065f, 0.192609f, -0.235613f,
|
||||
0.461340f, 0.117194f, 0.116817f, 0.196150f, 0.421622f, -0.264495f,
|
||||
0.617852f, -0.351756f, -0.310016f, 0.135932f, -0.242622f, -0.073094f,
|
||||
0.042077f, 0.039230f, -0.482715f, 0.553187f, 0.360637f, 0.313484f,
|
||||
-0.131540f, -0.104731f, 0.374704f, 0.222173f, 0.437657f, 0.029827f,
|
||||
-0.545156f, -0.203176f, 0.267824f, 0.169237f, -0.057871f, 0.552197f,
|
||||
0.272243f, 0.025681f, -0.262192f, 0.255934f, -0.202407f, -0.483317f,
|
||||
-0.204721f, 0.288807f, -0.030735f, -0.047161f, -0.780724f, 0.381939f,
|
||||
-0.295318f, 0.537378f,
|
||||
};
|
||||
|
||||
static const float av1_4_partition_nn_bias_32_layer1[LABEL_SIZE] = {
|
||||
-0.332518f,
|
||||
0.114452f,
|
||||
0.098949f,
|
||||
0.465896f,
|
||||
};
|
||||
|
||||
static const NN_CONFIG av1_4_partition_nnconfig_32 = {
|
||||
FEATURE_SIZE, // num_inputs
|
||||
LABEL_SIZE, // num_outputs
|
||||
1, // num_hidden_layers
|
||||
{
|
||||
32, // num_hidden_nodes
|
||||
},
|
||||
{
|
||||
av1_4_partition_nn_weights_32_layer0,
|
||||
av1_4_partition_nn_weights_32_layer1,
|
||||
},
|
||||
{
|
||||
av1_4_partition_nn_bias_32_layer0,
|
||||
av1_4_partition_nn_bias_32_layer1,
|
||||
},
|
||||
};
|
||||
|
||||
static const float av1_4_partition_nn_weights_64_layer0[FEATURE_SIZE * 16] = {
|
||||
0.256343f, -0.021774f, -0.117102f, 0.416930f, 0.188160f, 0.148768f,
|
||||
-0.611181f, -0.121607f, -0.394825f, -0.875025f, -0.167071f, 0.016408f,
|
||||
0.222769f, -0.199332f, 0.058667f, -0.679529f, 0.081744f, 0.044438f,
|
||||
-0.182941f, -0.110339f, -0.137822f, -0.096164f, -0.132319f, 0.140036f,
|
||||
-0.049503f, -0.309894f, -0.323991f, 0.166113f, 0.138104f, -0.263629f,
|
||||
-0.368460f, -0.273989f, 0.147239f, 0.044566f, -0.363357f, -0.030792f,
|
||||
0.020734f, 0.068506f, -0.434214f, 0.581644f, -1.244146f, -0.569162f,
|
||||
0.179499f, -0.188900f, 0.078431f, -0.392126f, -0.006431f, 0.112146f,
|
||||
-0.065892f, -0.051319f, 0.094607f, 0.251700f, -0.000650f, 0.011911f,
|
||||
0.080449f, 0.022816f, 0.322382f, 0.577070f, 0.927738f, 0.178707f,
|
||||
-0.101237f, -0.212521f, 0.560261f, -0.206492f, -0.077591f, -0.069960f,
|
||||
0.025727f, 0.041122f, -0.735228f, -0.506091f, -0.600776f, -0.117829f,
|
||||
0.103556f, 0.141823f, 0.853448f, 0.339488f, 0.994022f, 0.121693f,
|
||||
-2.065366f, -0.352510f, -0.174323f, -0.323400f, -0.002193f, 0.004161f,
|
||||
0.042469f, -0.005319f, -0.305784f, -0.371353f, 0.011194f, -0.018597f,
|
||||
0.209260f, 0.071577f, 0.242470f, -0.856593f, 0.288842f, 1.062608f,
|
||||
-0.300472f, 0.221623f, -0.813563f, -0.250347f, -0.081455f, -0.092779f,
|
||||
-0.168132f, -0.180640f, -0.075130f, -0.052906f, -0.015645f, 0.127158f,
|
||||
-0.006546f, 0.051671f, 0.545608f, 1.101804f, 0.288086f, 1.107046f,
|
||||
-0.200012f, 0.220182f, -0.189220f, -0.554973f, 0.040711f, -0.058029f,
|
||||
0.043737f, 0.016164f, -0.391790f, -0.287770f, -0.046545f, 0.045071f,
|
||||
0.190005f, -0.076963f, 0.836839f, 1.633266f, 0.902928f, 0.991972f,
|
||||
-0.127932f, 0.293680f, -0.035984f, 0.476179f, -0.098024f, 0.068314f,
|
||||
-0.058365f, 0.096221f, -0.000321f, -0.128840f, 0.136441f, -0.061853f,
|
||||
0.270367f, -0.184129f, -0.373670f, -0.177381f, 0.262109f, -0.378013f,
|
||||
-0.053249f, -0.456389f, 0.222972f, -0.228067f, -0.115210f, -0.277797f,
|
||||
0.096913f, -0.014512f, -0.015533f, 0.026389f, -0.360536f, -0.078477f,
|
||||
-0.203186f, 0.199574f, 0.770476f, 0.595592f, 0.360828f, 0.547721f,
|
||||
-0.804787f, 0.389690f, -0.437645f, 0.576776f, 0.081903f, 0.082750f,
|
||||
0.007166f, -0.143755f, 0.114462f, 0.472432f, -0.058974f, 0.077761f,
|
||||
-2.015181f, -0.054942f, -0.110894f, 0.529188f, -0.003300f, 0.913895f,
|
||||
-0.324643f, 0.316135f, -0.291729f, 1.072647f, -0.029236f, 0.045592f,
|
||||
-0.039399f, 0.043472f, -0.303244f, -0.108761f, -0.011154f, 0.009693f,
|
||||
-0.374985f, 0.027758f, 0.302075f, -0.295758f, -0.165563f, -0.297259f,
|
||||
-0.485624f, -0.469310f, -0.028247f, -0.124440f, -0.428082f, 0.096325f,
|
||||
0.089003f, -0.301585f, 0.022474f, 0.077477f, -0.032233f, -0.231036f,
|
||||
0.143206f, 0.169113f, -0.556486f, 0.346327f, -0.667790f, 0.126983f,
|
||||
0.179727f, 0.397307f, -0.490612f, -1.708789f, -0.040336f, -0.028547f,
|
||||
-0.091319f, -0.119367f, -0.518796f, -0.543383f, 0.037162f, 0.031344f,
|
||||
-0.131692f, 0.119353f, 0.799313f, 0.443848f, -0.499919f, -1.002983f,
|
||||
0.375477f, 0.221096f, -0.238033f, 0.284849f, 0.021897f, 0.023338f,
|
||||
-0.059067f, 0.117276f, 0.039540f, 0.049630f, 0.175150f, 0.014166f,
|
||||
-0.071486f, 0.091234f, -1.007432f, -1.417378f, 0.640528f, 1.442576f,
|
||||
-0.257183f, -0.597016f, 0.861785f, 0.276121f, -0.098017f, 0.120514f,
|
||||
-0.133184f, 0.106529f, 0.171644f, 0.059513f, 0.215952f, -0.009441f,
|
||||
-0.505313f, 0.063174f, 0.229148f, -0.344213f, 0.862721f, 1.549941f,
|
||||
-0.220129f, 0.493094f, 0.264095f, 0.143641f, 0.084968f, -0.078266f,
|
||||
0.032335f, -0.019006f, -0.098205f, 0.119213f, -0.103465f, 0.072811f,
|
||||
};
|
||||
|
||||
static const float av1_4_partition_nn_bias_64_layer0[16] = {
|
||||
0.111611f, -0.067682f, 0.633594f, 0.143559f, -1.051284f, -0.266625f,
|
||||
-0.829789f, -0.956123f, -0.153484f, -0.787741f, 0.004832f, -0.080769f,
|
||||
0.235166f, 0.449468f, 0.294689f, -0.395300f,
|
||||
};
|
||||
|
||||
static const float av1_4_partition_nn_weights_64_layer1[16 * LABEL_SIZE] = {
|
||||
-0.069999f, -0.093710f, -0.423714f, -0.028138f, 0.684415f, 0.141445f,
|
||||
0.507161f, 0.435533f, -0.263268f, 0.585105f, 0.235301f, 0.127536f,
|
||||
-0.688639f, -0.217993f, -0.540066f, 0.406718f, 0.018210f, -0.077349f,
|
||||
-0.124823f, -0.488220f, -0.957026f, 0.302632f, 0.285490f, -0.411356f,
|
||||
0.091089f, 0.103862f, -0.549291f, 0.148628f, 0.640603f, -0.601018f,
|
||||
0.178024f, 0.601370f, 0.313780f, 0.051938f, 0.524083f, 0.814631f,
|
||||
-0.415522f, -0.738849f, 0.477881f, -0.342864f, 0.105181f, 0.040010f,
|
||||
-0.177521f, 0.400646f, 0.167093f, 0.388279f, -0.898439f, -0.111936f,
|
||||
0.469875f, -0.099528f, -0.217370f, 0.283742f, -0.033798f, -0.142797f,
|
||||
-0.174057f, -1.293311f, -0.038777f, -0.003846f, 0.093642f, -0.527150f,
|
||||
-0.021259f, 0.194651f, -0.276294f, -0.109514f,
|
||||
};
|
||||
|
||||
static const float av1_4_partition_nn_bias_64_layer1[LABEL_SIZE] = {
|
||||
-0.688947f,
|
||||
0.121075f,
|
||||
0.289597f,
|
||||
0.948091f,
|
||||
};
|
||||
|
||||
static const NN_CONFIG av1_4_partition_nnconfig_64 = {
|
||||
FEATURE_SIZE, // num_inputs
|
||||
LABEL_SIZE, // num_outputs
|
||||
1, // num_hidden_layers
|
||||
{
|
||||
16, // num_hidden_nodes
|
||||
},
|
||||
{
|
||||
av1_4_partition_nn_weights_64_layer0,
|
||||
av1_4_partition_nn_weights_64_layer1,
|
||||
},
|
||||
{
|
||||
av1_4_partition_nn_bias_64_layer0,
|
||||
av1_4_partition_nn_bias_64_layer1,
|
||||
},
|
||||
};
|
||||
|
||||
#undef FEATURE_SIZE
|
||||
#undef LABEL_SIZE
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
8
third_party/aom/av1/encoder/pickcdef.c
vendored
8
third_party/aom/av1/encoder/pickcdef.c
vendored
|
|
@ -296,7 +296,7 @@ void av1_cdef_search(YV12_BUFFER_CONFIG *frame, const YV12_BUFFER_CONFIG *ref,
|
|||
int ydec[3];
|
||||
int pli;
|
||||
int cdef_count;
|
||||
int coeff_shift = AOMMAX(cm->bit_depth - 8, 0);
|
||||
int coeff_shift = AOMMAX(cm->seq_params.bit_depth - 8, 0);
|
||||
uint64_t best_tot_mse = (uint64_t)1 << 63;
|
||||
uint64_t tot_mse;
|
||||
int sb_count;
|
||||
|
|
@ -317,8 +317,8 @@ void av1_cdef_search(YV12_BUFFER_CONFIG *frame, const YV12_BUFFER_CONFIG *ref,
|
|||
DECLARE_ALIGNED(32, uint16_t, inbuf[CDEF_INBUF_SIZE]);
|
||||
uint16_t *in;
|
||||
DECLARE_ALIGNED(32, uint16_t, tmp_dst[1 << (MAX_SB_SIZE_LOG2 * 2)]);
|
||||
quantizer =
|
||||
av1_ac_quant_Q3(cm->base_qindex, 0, cm->bit_depth) >> (cm->bit_depth - 8);
|
||||
quantizer = av1_ac_quant_Q3(cm->base_qindex, 0, cm->seq_params.bit_depth) >>
|
||||
(cm->seq_params.bit_depth - 8);
|
||||
lambda = .12 * quantizer * quantizer / 256.;
|
||||
|
||||
av1_setup_dst_planes(xd->plane, cm->seq_params.sb_size, frame, 0, 0, 0,
|
||||
|
|
@ -361,7 +361,7 @@ void av1_cdef_search(YV12_BUFFER_CONFIG *frame, const YV12_BUFFER_CONFIG *ref,
|
|||
|
||||
for (r = 0; r < frame_height; ++r) {
|
||||
for (c = 0; c < frame_width; ++c) {
|
||||
if (cm->use_highbitdepth) {
|
||||
if (cm->seq_params.use_highbitdepth) {
|
||||
src[pli][r * stride[pli] + c] = CONVERT_TO_SHORTPTR(
|
||||
xd->plane[pli].dst.buf)[r * xd->plane[pli].dst.stride + c];
|
||||
ref_coeff[pli][r * stride[pli] + c] =
|
||||
|
|
|
|||
12
third_party/aom/av1/encoder/picklpf.c
vendored
12
third_party/aom/av1/encoder/picklpf.c
vendored
|
|
@ -82,10 +82,8 @@ static int64_t try_filter_frame(const YV12_BUFFER_CONFIG *sd,
|
|||
plane + 1, partial_frame);
|
||||
#endif
|
||||
|
||||
int highbd = 0;
|
||||
highbd = cm->use_highbitdepth;
|
||||
|
||||
filt_err = aom_get_sse_plane(sd, cm->frame_to_show, plane, highbd);
|
||||
filt_err = aom_get_sse_plane(sd, cm->frame_to_show, plane,
|
||||
cm->seq_params.use_highbitdepth);
|
||||
|
||||
// Re-instate the unfiltered frame
|
||||
yv12_copy_plane(&cpi->last_frame_uf, cm->frame_to_show, plane);
|
||||
|
|
@ -202,7 +200,7 @@ void av1_pick_filter_level(const YV12_BUFFER_CONFIG *sd, AV1_COMP *cpi,
|
|||
} else if (method >= LPF_PICK_FROM_Q) {
|
||||
const int min_filter_level = 0;
|
||||
const int max_filter_level = av1_get_max_filter_level(cpi);
|
||||
const int q = av1_ac_quant_Q3(cm->base_qindex, 0, cm->bit_depth);
|
||||
const int q = av1_ac_quant_Q3(cm->base_qindex, 0, cm->seq_params.bit_depth);
|
||||
// These values were determined by linear fitting the result of the
|
||||
// searched level for 8 bit depth:
|
||||
// Keyframes: filt_guess = q * 0.06699 - 1.60817
|
||||
|
|
@ -211,7 +209,7 @@ void av1_pick_filter_level(const YV12_BUFFER_CONFIG *sd, AV1_COMP *cpi,
|
|||
// And high bit depth separately:
|
||||
// filt_guess = q * 0.316206 + 3.87252
|
||||
int filt_guess;
|
||||
switch (cm->bit_depth) {
|
||||
switch (cm->seq_params.bit_depth) {
|
||||
case AOM_BITS_8:
|
||||
filt_guess = (cm->frame_type == KEY_FRAME)
|
||||
? ROUND_POWER_OF_TWO(q * 17563 - 421574, 18)
|
||||
|
|
@ -229,7 +227,7 @@ void av1_pick_filter_level(const YV12_BUFFER_CONFIG *sd, AV1_COMP *cpi,
|
|||
"or AOM_BITS_12");
|
||||
return;
|
||||
}
|
||||
if (cm->bit_depth != AOM_BITS_8 && cm->frame_type == KEY_FRAME)
|
||||
if (cm->seq_params.bit_depth != AOM_BITS_8 && cm->frame_type == KEY_FRAME)
|
||||
filt_guess -= 4;
|
||||
// TODO(chengchen): retrain the model for Y, U, V filter levels
|
||||
lf->filter_level[0] = clamp(filt_guess, min_filter_level, max_filter_level);
|
||||
|
|
|
|||
21
third_party/aom/av1/encoder/pickrst.c
vendored
21
third_party/aom/av1/encoder/pickrst.c
vendored
|
|
@ -163,8 +163,8 @@ static int64_t try_restoration_unit(const RestSearchCtxt *rsc,
|
|||
const int is_uv = plane > 0;
|
||||
const RestorationInfo *rsi = &cm->rst_info[plane];
|
||||
RestorationLineBuffers rlbs;
|
||||
const int bit_depth = cm->bit_depth;
|
||||
const int highbd = cm->use_highbitdepth;
|
||||
const int bit_depth = cm->seq_params.bit_depth;
|
||||
const int highbd = cm->seq_params.use_highbitdepth;
|
||||
|
||||
const YV12_BUFFER_CONFIG *fts = cm->frame_to_show;
|
||||
// TODO(yunqing): For now, only use optimized LR filter in decoder. Can be
|
||||
|
|
@ -173,7 +173,8 @@ static int64_t try_restoration_unit(const RestSearchCtxt *rsc,
|
|||
|
||||
av1_loop_restoration_filter_unit(
|
||||
limits, rui, &rsi->boundaries, &rlbs, tile_rect, rsc->tile_stripe0,
|
||||
is_uv && cm->subsampling_x, is_uv && cm->subsampling_y, highbd, bit_depth,
|
||||
is_uv && cm->seq_params.subsampling_x,
|
||||
is_uv && cm->seq_params.subsampling_y, highbd, bit_depth,
|
||||
fts->buffers[plane], fts->strides[is_uv], rsc->dst->buffers[plane],
|
||||
rsc->dst->strides[is_uv], cm->rst_tmpbuf, optimized_lr);
|
||||
|
||||
|
|
@ -540,8 +541,8 @@ static void search_sgrproj(const RestorationTileLimits *limits,
|
|||
|
||||
const MACROBLOCK *const x = rsc->x;
|
||||
const AV1_COMMON *const cm = rsc->cm;
|
||||
const int highbd = cm->use_highbitdepth;
|
||||
const int bit_depth = cm->bit_depth;
|
||||
const int highbd = cm->seq_params.use_highbitdepth;
|
||||
const int bit_depth = cm->seq_params.bit_depth;
|
||||
|
||||
uint8_t *dgd_start =
|
||||
rsc->dgd_buffer + limits->v_start * rsc->dgd_stride + limits->h_start;
|
||||
|
|
@ -549,8 +550,8 @@ static void search_sgrproj(const RestorationTileLimits *limits,
|
|||
rsc->src_buffer + limits->v_start * rsc->src_stride + limits->h_start;
|
||||
|
||||
const int is_uv = rsc->plane > 0;
|
||||
const int ss_x = is_uv && cm->subsampling_x;
|
||||
const int ss_y = is_uv && cm->subsampling_y;
|
||||
const int ss_x = is_uv && cm->seq_params.subsampling_x;
|
||||
const int ss_y = is_uv && cm->seq_params.subsampling_y;
|
||||
const int procunit_width = RESTORATION_PROC_UNIT_SIZE >> ss_x;
|
||||
const int procunit_height = RESTORATION_PROC_UNIT_SIZE >> ss_y;
|
||||
|
||||
|
|
@ -1067,7 +1068,7 @@ static void search_wiener(const RestorationTileLimits *limits,
|
|||
double vfilterd[WIENER_WIN], hfilterd[WIENER_WIN];
|
||||
|
||||
const AV1_COMMON *const cm = rsc->cm;
|
||||
if (cm->use_highbitdepth) {
|
||||
if (cm->seq_params.use_highbitdepth) {
|
||||
compute_stats_highbd(wiener_win, rsc->dgd_buffer, rsc->src_buffer,
|
||||
limits->h_start, limits->h_end, limits->v_start,
|
||||
limits->v_end, rsc->dgd_stride, rsc->src_stride, M, H);
|
||||
|
|
@ -1149,7 +1150,7 @@ static void search_norestore(const RestorationTileLimits *limits,
|
|||
RestSearchCtxt *rsc = (RestSearchCtxt *)priv;
|
||||
RestUnitSearchInfo *rusi = &rsc->rusi[rest_unit_idx];
|
||||
|
||||
const int highbd = rsc->cm->use_highbitdepth;
|
||||
const int highbd = rsc->cm->seq_params.use_highbitdepth;
|
||||
rusi->sse[RESTORE_NONE] = sse_restoration_unit(
|
||||
limits, rsc->src, rsc->cm->frame_to_show, rsc->plane, highbd);
|
||||
|
||||
|
|
@ -1280,7 +1281,7 @@ void av1_pick_filter_restoration(const YV12_BUFFER_CONFIG *src, AV1_COMP *cpi) {
|
|||
double best_cost = 0;
|
||||
RestorationType best_rtype = RESTORE_NONE;
|
||||
|
||||
const int highbd = rsc.cm->use_highbitdepth;
|
||||
const int highbd = rsc.cm->seq_params.use_highbitdepth;
|
||||
extend_frame(rsc.dgd_buffer, rsc.plane_width, rsc.plane_height,
|
||||
rsc.dgd_stride, RESTORATION_BORDER, RESTORATION_BORDER,
|
||||
highbd);
|
||||
|
|
|
|||
208
third_party/aom/av1/encoder/pustats.h
vendored
208
third_party/aom/av1/encoder/pustats.h
vendored
|
|
@ -18,91 +18,79 @@ extern "C" {
|
|||
|
||||
#include "av1/encoder/ml.h"
|
||||
|
||||
#define NUM_FEATURES 20
|
||||
#define NUM_FEATURES 11
|
||||
#define NUM_HIDDEN_LAYERS 2
|
||||
#define HIDDEN_LAYERS_0_NODES 10
|
||||
#define HIDDEN_LAYERS_0_NODES 12
|
||||
#define HIDDEN_LAYERS_1_NODES 10
|
||||
#define LOGITS_NODES 1
|
||||
|
||||
static const float
|
||||
av1_pustats_rate_hiddenlayer_0_kernel[NUM_FEATURES *
|
||||
HIDDEN_LAYERS_0_NODES] = {
|
||||
13.8498f, 19.6630f, 13.3036f, 5.2448f, -18.0270f, 21.6671f,
|
||||
-0.2135f, -0.0060f, 0.1211f, -0.3549f, -0.3550f, 0.0190f,
|
||||
0.0167f, -0.1192f, 0.2003f, 8.6663f, 32.0264f, 9.9558f,
|
||||
9.0935f, -110.4994f, 51.8056f, 64.8041f, 58.5392f, 53.0189f,
|
||||
-61.6300f, 4.7540f, -0.0140f, 0.0185f, -15.8050f, 0.0790f,
|
||||
0.0707f, 0.0784f, 0.0766f, -0.3030f, 0.0392f, 49.3312f,
|
||||
63.3326f, 61.4025f, 54.2723f, -62.2769f, -147.1736f, -84.9432f,
|
||||
-82.5422f, -70.4857f, 46.7622f, -1.0285f, -0.4809f, 0.0068f,
|
||||
1.0888f, -0.0515f, -0.0384f, -0.0232f, -0.0396f, 0.2429f,
|
||||
0.2040f, -144.4016f, -88.0868f, -80.3134f, -70.6685f, 66.8528f,
|
||||
-53.8097f, -45.4011f, -52.8680f, -58.7226f, 99.7830f, 2.3728f,
|
||||
0.0229f, 0.0002f, -0.3288f, -0.0563f, -0.0550f, -0.0552f,
|
||||
-0.0563f, 0.2214f, 0.0139f, -60.8965f, -45.5251f, -50.4188f,
|
||||
-51.5623f, 85.7369f, 77.3415f, 47.4930f, 53.8120f, 58.2311f,
|
||||
-45.9650f, -2.4938f, 0.1639f, -0.5270f, -75.4622f, -0.0026f,
|
||||
0.0031f, 0.0047f, 0.0015f, 0.0092f, 0.0654f, 75.6402f,
|
||||
54.7447f, 54.8156f, 52.6834f, -9.1246f, -34.0108f, -35.6423f,
|
||||
-34.2911f, -38.5444f, 72.1123f, 10.9750f, -0.1595f, 0.1983f,
|
||||
22.5724f, -0.0556f, -0.0618f, -0.0571f, -0.0608f, 0.2439f,
|
||||
-0.0805f, -32.5107f, -28.9688f, -33.7284f, -48.1365f, 61.5297f,
|
||||
39.2492f, -35.1928f, -11.5000f, 7.7038f, -94.2469f, 13.5586f,
|
||||
0.7541f, 0.0105f, 4.4041f, 0.1799f, 0.1339f, 0.1567f,
|
||||
-0.6668f, -0.7384f, 0.2185f, 17.1700f, -26.4601f, -1.8970f,
|
||||
38.9635f, -30.1916f, 31.8139f, 14.6157f, 10.0565f, 3.3340f,
|
||||
-40.6985f, -2.1186f, 0.0116f, 0.0962f, 0.7115f, -1.4071f,
|
||||
-1.3701f, -1.4728f, -1.3404f, -1.7286f, 5.5632f, 28.4998f,
|
||||
5.4087f, 16.2668f, 11.8693f, -39.4153f, 106.3281f, 38.3075f,
|
||||
39.4933f, 47.3805f, -15.0514f, -21.2421f, -0.2358f, -0.0024f,
|
||||
0.3505f, -0.0429f, -0.0377f, -0.0322f, -0.0344f, 0.2020f,
|
||||
0.1417f, 99.6711f, 35.3896f, 43.1117f, 59.8879f, -17.8250f,
|
||||
-16.6976f, 18.5100f, 6.3383f, 25.3020f, -55.8824f, 25.1027f,
|
||||
-0.9926f, -0.0738f, -1.4892f, 0.0269f, -0.0051f, -5.8168f,
|
||||
-0.0579f, -0.1500f, 0.7224f, 8.3066f, -3.8805f, -12.1482f,
|
||||
14.3492f, -20.8118f,
|
||||
21.5067f, 22.6709f, 0.0049f, 0.9288f, -0.0100f, 0.0060f, -0.0071f,
|
||||
-0.0085f, 0.0348f, -0.1273f, 10.1154f, 6.3405f, 7.8589f, -0.0652f,
|
||||
-4.6352f, 0.0445f, -3.2748f, 0.1025f, -0.0385f, -0.4505f, 1.1320f,
|
||||
3.2634f, 23.2420f, -7.9056f, 0.0522f, -18.1555f, 0.0977f, 0.1155f,
|
||||
-0.0138f, 0.0267f, -0.3992f, 0.2735f, 22.8063f, 35.1043f, 3.8140f,
|
||||
-0.0295f, 0.0771f, -0.6938f, 0.0302f, -0.0266f, 0.0989f, -0.0794f,
|
||||
0.2981f, 33.3333f, -24.1150f, 1.4986f, -0.0975f, -15.3938f, -0.0858f,
|
||||
-0.0845f, -0.0869f, -0.0858f, 0.3542f, 0.0155f, -18.2629f, 9.6688f,
|
||||
-11.9643f, -0.2904f, -5.3026f, -0.1011f, -0.1202f, 0.0127f, -0.0269f,
|
||||
0.3434f, 0.0595f, 16.6800f, 41.4730f, 6.9269f, -0.0512f, -1.4540f,
|
||||
0.0468f, 0.0077f, 0.0983f, 0.1265f, -0.5234f, 0.9477f, 36.6470f,
|
||||
-0.4838f, -0.2269f, -0.1143f, -0.3907f, -0.5005f, -0.0179f, -0.1057f,
|
||||
0.1233f, -0.4412f, -0.0474f, 0.1140f, -21.6813f, -0.9077f, -0.0078f,
|
||||
-3.3306f, 0.0417f, 0.0412f, 0.0427f, 0.0418f, -0.1699f, 0.0072f,
|
||||
-22.3335f, 16.1203f, -10.1220f, -0.0019f, 0.0005f, -0.0054f, -0.0155f,
|
||||
-0.0302f, -0.0379f, 0.1276f, 0.1568f, 21.6175f, 12.2919f, 11.0327f,
|
||||
-0.2000f, -8.6691f, -0.5593f, -0.5952f, -0.4203f, -0.4857f, -1.1239f,
|
||||
3.1404f, -13.1098f, -5.9165f, 22.2060f, -0.0312f, -3.9642f, -0.0344f,
|
||||
-0.0656f, -0.0273f, -0.0465f, 0.1412f, -6.1974f, 9.3661f,
|
||||
};
|
||||
|
||||
static const float av1_pustats_rate_hiddenlayer_0_bias[HIDDEN_LAYERS_0_NODES] =
|
||||
{
|
||||
17.6566f, 62.2217f, -107.2644f, -56.2255f, 68.2252f,
|
||||
-37.5662f, 9.587f, 18.5206f, 69.6873f, 4.3903f,
|
||||
-14.3065f, 2.059f, -62.9916f, -50.1209f, 57.643f, -59.3737f,
|
||||
-30.4737f, -0.1112f, 72.5427f, 55.402f, 24.9523f, 18.5834f,
|
||||
};
|
||||
|
||||
static const float
|
||||
av1_pustats_rate_hiddenlayer_1_kernel[HIDDEN_LAYERS_0_NODES *
|
||||
HIDDEN_LAYERS_1_NODES] = {
|
||||
-0.0494f, 0.3505f, -0.0461f, -1.3451f, 0.0198f, -0.0746f, -0.2217f,
|
||||
-0.9525f, 0.0633f, -0.0737f, -0.3568f, 1.8569f, -0.0189f, -1.8269f,
|
||||
0.6281f, -1.3266f, -0.9202f, 2.8978f, -0.6437f, -0.8709f, -1.5066f,
|
||||
-1.0582f, -1.9509f, -0.0417f, -0.1315f, -0.3368f, 0.0014f, -0.5734f,
|
||||
-1.4640f, -1.6042f, 3.3911f, -1.6815f, -1.9026f, -4.8702f, -0.1012f,
|
||||
-1.4517f, -3.2156f, 0.8448f, 0.2331f, -0.1593f, 2.6627f, -0.8451f,
|
||||
-1.7382f, 0.9303f, 2.3003f, -0.0659f, 0.5772f, 0.4253f, 0.2083f,
|
||||
0.3649f, -0.9198f, -0.2183f, -0.5381f, -1.0831f, 2.0359f, 0.0040f,
|
||||
-0.0871f, -0.1715f, 2.2453f, 0.5099f, -0.5900f, -0.6313f, -1.3028f,
|
||||
-1.7257f, 1.4130f, -0.7189f, -0.4336f, 1.9266f, 1.7495f, -0.3321f,
|
||||
0.2827f, 0.4015f, -0.5044f, -1.0420f, -0.1258f, -0.0342f, -0.1190f,
|
||||
-3.1263f, 0.7485f, -0.3161f, -0.2224f, 2.5533f, -0.2121f, -1.3389f,
|
||||
0.5556f, -0.9407f, -0.7456f, 1.4137f, -0.0353f, -0.0521f, 2.4382f,
|
||||
0.1493f, -11.5631f, -1.6178f, 3.5538f, -3.6538f, -0.5972f, -3.0038f,
|
||||
-2.1640f, 0.5754f,
|
||||
0.3883f, -0.2784f, -0.2850f, 0.4894f, -2.2450f, 0.4511f, -0.1969f,
|
||||
-0.0077f, -1.4924f, 0.1138f, -2.9848f, 1.0211f, -0.1712f, -0.1952f,
|
||||
-0.4774f, 0.0761f, -0.3186f, -0.1002f, 0.8663f, 0.5026f, 1.1920f,
|
||||
0.9337f, 0.3911f, -0.3841f, -0.0037f, 0.7295f, -0.3183f, 0.1829f,
|
||||
-1.3670f, -0.1046f, 0.6629f, 0.0619f, -0.1551f, 0.8174f, 2.1521f,
|
||||
-1.3323f, -0.0527f, -0.5772f, 0.2001f, -0.6270f, -1.0625f, 0.3342f,
|
||||
0.6676f, 0.4605f, -2.0049f, 0.7781f, 0.0713f, -0.0824f, -0.4529f,
|
||||
0.1757f, -0.1338f, -0.2319f, -0.2864f, 0.1248f, 0.3887f, -0.1676f,
|
||||
1.8422f, 0.6435f, 1.2123f, -0.5667f, -0.2423f, -0.0314f, 0.2411f,
|
||||
-0.5013f, 0.0422f, 0.2559f, 0.4435f, -0.1223f, 1.5167f, 0.3939f,
|
||||
1.0898f, 0.0795f, -0.9251f, -0.0813f, -0.5929f, -0.0741f, 4.0687f,
|
||||
-0.4368f, -0.0984f, 0.0837f, 3.6169f, 0.0662f, -0.1679f, -0.8090f,
|
||||
-0.2610f, -0.5791f, 0.0642f, -0.2979f, -0.9036f, 0.2898f, 0.3265f,
|
||||
0.4660f, -1.6358f, -0.0347f, 0.1087f, 0.0353f, 0.5687f, -0.5242f,
|
||||
-0.4895f, 0.7693f, -1.3829f, -0.2244f, -0.2880f, 0.0575f, 2.0563f,
|
||||
-0.2322f, -1.1597f, 1.6125f, -0.0925f, 1.3540f, 0.1432f, 0.3993f,
|
||||
-0.0303f, -1.1438f, -1.7323f, -0.4329f, 2.9443f, -0.5724f, 0.0122f,
|
||||
-1.0829f,
|
||||
};
|
||||
|
||||
static const float av1_pustats_rate_hiddenlayer_1_bias[HIDDEN_LAYERS_1_NODES] =
|
||||
{
|
||||
69.1995f, 41.7369f, -1.4885f, -35.785f, 26.1678f,
|
||||
58.4472f, 36.2223f, 66.327f, 50.8867f, 2.8306f,
|
||||
-10.3717f, 37.304f, -36.7221f, -52.7572f, 44.0877f,
|
||||
41.1631f, 36.3299f, -48.6087f, -4.5189f, 13.0611f,
|
||||
};
|
||||
|
||||
static const float
|
||||
av1_pustats_rate_logits_kernel[HIDDEN_LAYERS_1_NODES * LOGITS_NODES] = {
|
||||
1.811f, 0.9009f, 0.0694f, -0.9985f, -0.039f,
|
||||
0.2076f, 0.5643f, 0.5408f, 0.6071f, 0.277f,
|
||||
0.8362f, 1.0615f, -1.5178f, -1.2959f, 1.3233f,
|
||||
1.4909f, 1.3554f, -0.8626f, -0.618f, -0.9458f,
|
||||
};
|
||||
|
||||
static const float av1_pustats_rate_logits_bias[LOGITS_NODES] = {
|
||||
39.5529f,
|
||||
30.6878f,
|
||||
};
|
||||
|
||||
static const NN_CONFIG av1_pustats_rate_nnconfig = {
|
||||
|
|
@ -125,78 +113,70 @@ static const NN_CONFIG av1_pustats_rate_nnconfig = {
|
|||
static const float
|
||||
av1_pustats_dist_hiddenlayer_0_kernel[NUM_FEATURES *
|
||||
HIDDEN_LAYERS_0_NODES] = {
|
||||
-39.0787f, -212.9998f, -174.2088f, -264.1454f, 292.7151f, -60.8750f,
|
||||
-5.9915f, 0.0712f, -60.2312f, -0.2020f, -0.2135f, -0.1663f,
|
||||
-0.0711f, 0.2267f, 0.9152f, -36.1294f, -159.9320f, -222.9809f,
|
||||
-270.2556f, 300.7162f, 159.9224f, -172.5735f, -7.6852f, 54.3985f,
|
||||
110.6721f, 19.2907f, -15.1039f, -0.0457f, 0.3289f, 0.4529f,
|
||||
-8.2222f, 1.3213f, -0.8378f, -0.2605f, 3.9600f, 17.3407f,
|
||||
113.1116f, 34.6326f, 11.6688f, 109.3541f, 240.8123f, 45.0615f,
|
||||
80.7443f, 39.2500f, -21.0931f, -27.1989f, -0.4264f, -0.1345f,
|
||||
1.6269f, -0.0716f, 0.0989f, -0.1382f, 0.0248f, 0.0913f,
|
||||
4.3903f, 244.1014f, 32.2567f, 58.6171f, 62.2273f, -2.8647f,
|
||||
-227.5659f, 16.0031f, -70.5256f, 23.8071f, 290.7356f, 13.6094f,
|
||||
-2.1842f, 0.0104f, -2.8760f, 0.3708f, 0.8501f, -3.2964f,
|
||||
-0.2088f, -0.4474f, 1.2248f, 40.5180f, -130.7891f, -188.1583f,
|
||||
-174.0906f, 205.9622f, 0.3425f, 0.2531f, 0.2822f, 0.0488f,
|
||||
0.1416f, -0.0433f, -0.1195f, -0.0413f, -0.0708f, -0.0787f,
|
||||
-0.0889f, -0.4022f, -0.5055f, -0.4715f, 0.2315f, 0.1021f,
|
||||
-0.3676f, -0.3499f, -0.0715f, 0.1913f, 205.7521f, 125.2265f,
|
||||
92.0640f, 77.5566f, -164.4280f, -19.3715f, -0.1346f, -0.4060f,
|
||||
0.5042f, -0.2395f, -0.1329f, -0.1397f, 0.2175f, 0.2895f,
|
||||
5.5019f, 198.9799f, 114.0018f, 94.9015f, 86.8434f, -183.4237f,
|
||||
121.5626f, 94.8945f, 65.0803f, 93.6487f, -346.5279f, -47.6168f,
|
||||
0.0633f, 0.0135f, -0.0692f, -0.1015f, -0.1146f, -0.1341f,
|
||||
-0.1175f, 0.4186f, 0.1505f, 130.7402f, 107.8443f, 62.8497f,
|
||||
65.3501f, -312.7407f, 282.8321f, 98.1531f, 75.6648f, 25.8733f,
|
||||
-176.9298f, -37.2695f, -0.3760f, 0.0017f, 0.1030f, -0.1483f,
|
||||
0.0787f, -0.0962f, 0.4109f, -0.2292f, 9.1681f, 274.3607f,
|
||||
60.9538f, 75.9405f, 68.3776f, -167.3098f, -335.1045f, -69.2583f,
|
||||
-76.3441f, -16.5793f, 218.5244f, 28.2405f, 0.9169f, -0.0026f,
|
||||
-0.8077f, -1.5756f, -0.0804f, 0.1404f, 1.2656f, 0.0272f,
|
||||
-0.2529f, -340.8659f, -112.7778f, -58.3890f, -4.1224f, 108.1709f,
|
||||
-180.7382f, -93.7114f, -77.8686f, -131.8134f, 353.3893f, 4.8233f,
|
||||
0.0205f, 0.0000f, -1.1654f, -0.0161f, -0.0255f, -0.0358f,
|
||||
-0.0412f, 0.1103f, 0.1041f, -188.9934f, -110.1792f, -88.6301f,
|
||||
-93.7226f, 336.9746f,
|
||||
0.7770f, 1.0881f, 0.0177f, 0.4939f, -0.2541f, -0.2672f, -0.1705f,
|
||||
-0.1940f, -0.6395f, 1.2928f, 3.6240f, 2.4445f, 1.6790f, 0.0265f,
|
||||
0.1897f, 0.1776f, 0.0422f, 0.0197f, -0.0466f, 0.0462f, -1.0827f,
|
||||
2.0231f, 1.8044f, 2.7022f, 0.0064f, 0.2255f, -0.0552f, -0.1010f,
|
||||
-0.0581f, -0.0781f, 0.2614f, -3.4085f, 1.7478f, 0.1155f, -0.1458f,
|
||||
-0.0031f, -0.1797f, -0.4378f, -0.0539f, 0.0607f, -0.1347f, -0.3142f,
|
||||
-0.2014f, -0.4484f, -0.2808f, 1.5913f, 0.0046f, -0.0610f, -0.6479f,
|
||||
-0.7278f, -0.5592f, -0.6695f, -0.8120f, 2.9056f, -1.1501f, 9.3618f,
|
||||
4.2486f, 0.0011f, -0.1499f, -0.0834f, 0.1282f, 0.0409f, 0.1670f,
|
||||
-0.1398f, -0.4661f, 13.7700f, 8.2061f, -0.0685f, 0.0061f, -0.2951f,
|
||||
0.0169f, 0.0520f, 0.0040f, 0.0374f, 0.0467f, -0.0107f, 14.2664f,
|
||||
-2.2489f, -0.2516f, -0.0061f, -0.9921f, 0.1223f, 0.1212f, 0.1199f,
|
||||
0.1185f, -0.4867f, 0.0325f, -5.0757f, -8.7853f, 1.0450f, 0.0169f,
|
||||
0.5462f, 0.0051f, 0.1330f, 0.0143f, 0.1429f, -0.0258f, 0.2769f,
|
||||
-12.8839f, 22.3093f, 1.2761f, 0.0037f, -1.2459f, -0.0466f, 0.0003f,
|
||||
-0.0464f, -0.0067f, 0.2361f, 0.0355f, 23.3833f, 10.9218f, 2.6811f,
|
||||
0.0222f, -1.1055f, 0.1825f, 0.0575f, 0.0114f, -0.1259f, 0.3148f,
|
||||
-2.0047f, 11.9559f, 5.7375f, 0.8802f, 0.0042f, -0.2469f, -0.1040f,
|
||||
-1.5679f, 0.1969f, -0.0184f, 0.0157f, 0.6688f, 3.4492f,
|
||||
};
|
||||
|
||||
static const float av1_pustats_dist_hiddenlayer_0_bias[HIDDEN_LAYERS_0_NODES] =
|
||||
{ -175.6918f, 43.4519f, 154.196f, -81.1015f, -0.0758f,
|
||||
136.5695f, 110.8713f, 142.029f, -153.0901f, -145.2688f };
|
||||
{
|
||||
4.5051f, -4.5858f, 1.4693f, 0.f, 3.7968f, -3.6292f,
|
||||
-7.3112f, 10.9743f, 8.027f, -2.2692f, -8.748f, -1.3689f,
|
||||
};
|
||||
|
||||
static const float
|
||||
av1_pustats_dist_hiddenlayer_1_kernel[HIDDEN_LAYERS_0_NODES *
|
||||
HIDDEN_LAYERS_1_NODES] = {
|
||||
-0.1727f, -0.2859f, -0.3757f, -0.4260f, -0.5441f, -0.0666f, -0.3792f,
|
||||
-0.1335f, -0.1521f, -0.0821f, -3.1590f, 0.2711f, 0.5889f, 0.0878f,
|
||||
0.4693f, 0.7773f, -9.2989f, 0.0414f, 0.4485f, 22.8958f, -3.7024f,
|
||||
-2.4672f, -43.2908f, 0.0956f, 0.4431f, 2.3429f, 1.7183f, 0.3985f,
|
||||
-0.2275f, -3.1583f, -0.3485f, 0.3280f, 0.3763f, 0.2069f, 0.4231f,
|
||||
0.7366f, -6.9527f, 0.0713f, 0.1359f, 16.6500f, -1.7655f, -0.1651f,
|
||||
0.1280f, -0.2678f, -0.2120f, 1.6243f, 1.8773f, -0.7543f, -0.3292f,
|
||||
-0.7627f, -0.2001f, -0.1125f, -0.8100f, -0.1866f, 0.0567f, -0.4002f,
|
||||
3.2429f, 0.6427f, -0.3759f, -11.6518f, -2.2893f, 0.7708f, -1.8637f,
|
||||
1.7148f, 0.3124f, -0.7129f, -0.4927f, 0.1964f, -0.2570f, -25.0783f,
|
||||
2.5061f, 0.1457f, -1.1239f, 0.0570f, -0.2526f, -0.0669f, 0.6791f,
|
||||
1.1531f, -0.7246f, -0.3180f, -0.0015f, -0.0061f, -0.1626f, -0.0181f,
|
||||
0.1271f, -0.0140f, -0.6027f, 0.0736f, -0.0157f, 1.2420f, -6.4055f,
|
||||
0.2128f, -0.0386f, 0.3446f, 0.1840f, -0.7208f, -1.6979f, -0.0442f,
|
||||
0.3230f, -1.9745f,
|
||||
-0.0182f, -0.0925f, -0.0311f, -0.2962f, 0.1177f, -0.0027f, -0.2136f,
|
||||
-1.2094f, 0.0935f, -0.1403f, -0.1477f, -0.0752f, 0.1519f, -0.4726f,
|
||||
-0.3521f, 0.4199f, -0.0168f, -0.2927f, -0.2510f, 0.0706f, -0.2920f,
|
||||
0.2046f, -0.0400f, -0.2114f, 0.4240f, -0.7070f, 0.4964f, 0.4471f,
|
||||
0.3841f, -0.0918f, -0.6140f, 0.6056f, -0.1123f, 0.3944f, -0.0178f,
|
||||
-1.7702f, -0.4434f, 0.0560f, 0.1565f, -0.0793f, -0.0041f, 0.0052f,
|
||||
-0.1843f, 0.2400f, -0.0605f, 0.3196f, -0.0286f, -0.0002f, -0.0595f,
|
||||
-0.0493f, -0.2636f, -0.3994f, -0.1871f, -0.3298f, -0.0788f, -1.0685f,
|
||||
0.1900f, -0.5549f, -0.1350f, -0.0153f, -0.1195f, -0.5874f, 1.0468f,
|
||||
0.0212f, -0.2306f, -0.2677f, -0.3000f, -1.0702f, -0.1725f, -0.0656f,
|
||||
-0.0226f, 0.0616f, -0.3453f, 0.0810f, 0.4838f, -0.3780f, -1.4486f,
|
||||
0.7777f, -0.0459f, -0.6568f, 0.0589f, -1.0286f, -0.6001f, 0.0826f,
|
||||
0.4794f, -0.0586f, -0.1759f, 0.3811f, -0.1313f, 0.3829f, -0.0968f,
|
||||
-2.0445f, -0.3566f, -0.1491f, -0.0745f, -0.0202f, 0.0839f, 0.0470f,
|
||||
-0.2432f, 0.3013f, -0.0743f, -0.3479f, 0.0749f, -5.2490f, 0.0209f,
|
||||
-0.1653f, -0.0826f, -0.0535f, 0.3225f, -0.3786f, -0.0104f, 0.3091f,
|
||||
0.3652f, 0.1757f, -0.3252f, -1.1022f, -0.0574f, -0.4473f, 0.3469f,
|
||||
-0.5539f,
|
||||
};
|
||||
|
||||
static const float av1_pustats_dist_hiddenlayer_1_bias[HIDDEN_LAYERS_1_NODES] =
|
||||
{ 0.f, 70.3414f, 9.6036f, -118.1096f, 49.2507f,
|
||||
95.1849f, 81.8015f, 167.0967f, -337.7945f, 169.8344f };
|
||||
{
|
||||
11.9337f, -0.3681f, -6.1324f, 12.674f, 9.0956f,
|
||||
4.6069f, -4.4158f, -12.4848f, 10.8473f, 5.7633f,
|
||||
};
|
||||
|
||||
static const float
|
||||
av1_pustats_dist_logits_kernel[HIDDEN_LAYERS_1_NODES * LOGITS_NODES] = {
|
||||
-0.3627f, 1.2272f, 0.2201f, -1.7406f, -0.6885f,
|
||||
0.8487f, -0.2761f, 0.7731f, -5.2096f, -0.7351f,
|
||||
0.3245f, 0.2979f, -0.157f, -0.1441f, 0.1413f,
|
||||
-0.7496f, -0.1737f, -0.5322f, 0.0748f, 0.2518f,
|
||||
};
|
||||
|
||||
static const float av1_pustats_dist_logits_bias[LOGITS_NODES] = {
|
||||
48.2331f,
|
||||
4.6065f,
|
||||
};
|
||||
|
||||
static const NN_CONFIG av1_pustats_dist_nnconfig = {
|
||||
|
|
|
|||
591
third_party/aom/av1/encoder/rate_distortion_model_params.h
vendored
Normal file
591
third_party/aom/av1/encoder/rate_distortion_model_params.h
vendored
Normal file
|
|
@ -0,0 +1,591 @@
|
|||
/*
|
||||
* Copyright (c) 2018, Alliance for Open Media. All rights reserved
|
||||
*
|
||||
* This source code is subject to the terms of the BSD 2 Clause License and
|
||||
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
|
||||
* was not distributed with this source code in the LICENSE file, you can
|
||||
* obtain it at www.aomedia.org/license/software. If the Alliance for Open
|
||||
* Media Patent License 1.0 was not distributed with this source code in the
|
||||
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
|
||||
*/
|
||||
|
||||
#ifndef AV1_ENCODER_RATE_DISTORTION_MODEL_PARAMS_H_
|
||||
#define AV1_ENCODER_RATE_DISTORTION_MODEL_PARAMS_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "av1/encoder/ml.h"
|
||||
|
||||
// 22 float features +
|
||||
// 2 categorical features with 4 possible values, converted to one-hot vectors.
|
||||
// So, total 22 + 2 * 4 = 30 features.
|
||||
#define NUM_FEATURES 30
|
||||
#define NUM_HIDDEN_LAYERS 1
|
||||
#define NUM_HIDDEN_NODES 96
|
||||
#define NUM_OUTPUTS 1
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// RDCost model
|
||||
|
||||
static const float
|
||||
av1_rdcost_model_nn_weights_layer0[NUM_FEATURES * NUM_HIDDEN_NODES] = {
|
||||
-0.0699f, 0.2790f, 0.1915f, 0.2669f, 0.4637f, 0.4095f,
|
||||
0.2129f, 0.0634f, 0.2306f, -0.2232f, -0.5711f, -0.6493f,
|
||||
-0.7406f, -0.8440f, 0.4105f, 0.1392f, 0.5218f, -0.1618f,
|
||||
-0.1719f, 0.3409f, 0.1111f, -0.3609f, -0.2929f, 0.3869f,
|
||||
-0.5373f, 0.0700f, 0.2572f, 0.2483f, -0.0314f, 0.5228f,
|
||||
0.0169f, -0.1357f, 0.0419f, -0.1722f, 0.1303f, 0.1198f,
|
||||
-0.0013f, 0.1309f, 0.0293f, -0.1941f, 0.0668f, -0.0643f,
|
||||
-0.0381f, 0.1249f, -0.0731f, -0.1649f, 0.0964f, 0.0270f,
|
||||
0.1354f, 0.0538f, -0.2064f, -0.2067f, -0.0569f, 0.0449f,
|
||||
0.1680f, -0.0732f, -0.0785f, 0.1884f, -0.2137f, -0.0189f,
|
||||
0.2976f, 0.2818f, -0.0222f, 0.2658f, 0.0488f, 0.2778f,
|
||||
-0.1110f, 0.2069f, -0.0072f, -0.0095f, -0.1105f, -0.1365f,
|
||||
-0.4245f, -0.4751f, -0.0736f, 0.2333f, 0.0653f, -0.0249f,
|
||||
0.0055f, -0.0838f, -0.0489f, -0.2597f, 0.2621f, -0.0251f,
|
||||
-0.0545f, 0.0816f, -0.0816f, 0.3396f, -0.1047f, 0.3678f,
|
||||
0.1487f, -0.0270f, 0.2574f, 0.1018f, 0.2560f, -0.0598f,
|
||||
-0.0446f, -0.1792f, 0.5336f, -0.1590f, -0.9820f, -0.6514f,
|
||||
-0.6304f, -0.8359f, -0.0699f, 0.0295f, -0.0057f, -0.3088f,
|
||||
-0.1466f, 0.2220f, -0.1980f, -0.3400f, -0.1228f, 0.2667f,
|
||||
-0.4816f, 0.0155f, -0.0194f, 0.2051f, 0.0513f, 0.1575f,
|
||||
-121.4240f, -126.6840f, -124.1106f, -127.6184f, -85.0333f, -26.6396f,
|
||||
2.7020f, 102.0452f, -85.5128f, 0.0076f, 122.2206f, 107.5265f,
|
||||
108.3773f, 93.4847f, 20.3705f, -89.6993f, -176.9070f, -41.7543f,
|
||||
-123.0293f, -91.6437f, -205.7099f, -62.5346f, -83.2987f, 21.3830f,
|
||||
56.6341f, -120.8647f, -127.7562f, -121.6688f, -127.4225f, -74.8045f,
|
||||
-15.9247f, -14.6468f, -14.7788f, -15.4498f, -18.5514f, -11.1579f,
|
||||
-5.8164f, -3.4318f, 0.8100f, 0.0642f, 203.5111f, 189.6872f,
|
||||
190.4776f, 176.4784f, -4.9427f, -12.5324f, -7.6861f, 21.9182f,
|
||||
-6.7864f, -7.1906f, -8.1292f, 21.4780f, -7.8016f, -5.2653f,
|
||||
61.8526f, -15.5105f, -14.6900f, -14.1459f, -15.4350f, -19.1379f,
|
||||
-0.7876f, -1.8558f, -4.6035f, -6.8405f, -0.2904f, 2.3202f,
|
||||
1.8127f, -2.9397f, -0.8187f, -0.6098f, 22.6173f, 10.3668f,
|
||||
12.9363f, 2.4541f, 6.6700f, 0.3804f, -3.3117f, 8.5464f,
|
||||
-25.8348f, 1.8698f, -9.5753f, 8.5558f, -16.3576f, 7.2217f,
|
||||
35.3115f, -1.1447f, -2.6530f, -4.7027f, -5.7024f, -0.9513f,
|
||||
0.8393f, 0.7085f, 0.7879f, 0.3728f, 3.0574f, 1.1360f,
|
||||
26.0531f, 4.1084f, -1.7340f, 0.1683f, -450.7927f, -444.5818f,
|
||||
-442.5239f, -438.1168f, 2.4924f, -0.0147f, -0.0797f, -47.5322f,
|
||||
-1.7638f, -0.8608f, -0.6500f, -44.4326f, -0.9027f, 2.5560f,
|
||||
-267.6517f, 0.2642f, 0.9457f, 0.7944f, 0.3609f, 3.2742f,
|
||||
-74.3400f, -81.6894f, -76.2162f, -69.2979f, -90.2476f, -39.7389f,
|
||||
2.2545f, 36.5095f, -60.1129f, -1.0383f, 87.0348f, 83.9940f,
|
||||
83.7199f, 80.8609f, 14.9075f, -78.7405f, -74.3549f, -4.2382f,
|
||||
-23.9739f, -91.8469f, -67.2654f, -21.5293f, -9.9857f, 11.8391f,
|
||||
35.8223f, -74.2551f, -81.0729f, -73.8347f, -70.3798f, -86.8052f,
|
||||
0.1701f, -0.1136f, 0.0060f, -0.0496f, -0.1727f, 0.0195f,
|
||||
-0.1040f, 0.1027f, 0.0467f, -0.2538f, -0.1322f, 0.0860f,
|
||||
0.0093f, -0.2801f, -0.0958f, 0.0497f, -0.0582f, -0.0311f,
|
||||
0.1840f, 0.0752f, 0.0282f, 0.0297f, 0.0607f, 0.0650f,
|
||||
0.0893f, 0.1297f, 0.0373f, 0.0040f, -0.0973f, 0.0248f,
|
||||
-0.1419f, 0.0322f, -0.0712f, 0.0860f, -0.0426f, -0.1989f,
|
||||
0.1393f, -0.1183f, 0.0735f, -0.1895f, 0.1447f, -0.0056f,
|
||||
-0.1833f, 0.0884f, 0.0949f, 0.0476f, 0.0551f, 0.2125f,
|
||||
-0.1537f, -0.0141f, -0.2182f, 0.1567f, 0.0457f, -0.1485f,
|
||||
-0.1177f, 0.0391f, 0.1982f, -0.1288f, 0.1165f, -0.2019f,
|
||||
0.4550f, 0.5179f, 0.4311f, 0.1861f, 0.6199f, 0.4542f,
|
||||
0.2034f, 0.1128f, 1.3489f, -0.2525f, -2.1139f, -2.2444f,
|
||||
-2.3679f, -2.3378f, 0.5682f, 0.1348f, 0.3032f, -1.5835f,
|
||||
0.2883f, 0.1693f, 0.0439f, -1.4556f, 0.3818f, 0.4875f,
|
||||
-1.8899f, 0.2510f, 0.6450f, 0.6082f, 0.5962f, 0.8131f,
|
||||
12.0281f, 13.3899f, 13.6249f, 15.8068f, -1.5453f, 6.7456f,
|
||||
-6.0877f, 26.2596f, 6.2223f, -0.5922f, 134.1428f, 128.8985f,
|
||||
128.7538f, 123.0920f, 1.3207f, 18.3069f, 15.7436f, 46.5230f,
|
||||
24.7455f, 15.0688f, 19.9965f, 34.7236f, 19.7171f, 1.2018f,
|
||||
49.7274f, 11.8957f, 13.1578f, 14.0451f, 15.3544f, -3.5601f,
|
||||
1.0048f, 0.9479f, 1.1832f, 2.0635f, -2.9808f, 2.0803f,
|
||||
-7.5815f, 8.4733f, -4.2008f, 0.1217f, 226.5257f, 210.7018f,
|
||||
211.6235f, 195.2605f, 0.8283f, 1.0977f, 1.4858f, 41.1242f,
|
||||
1.5822f, 0.8742f, 2.0440f, 33.6213f, 1.6177f, 0.9661f,
|
||||
65.0014f, 1.4197f, 1.0109f, 1.3153f, 1.5470f, -3.2833f,
|
||||
2.0858f, 2.0012f, 2.1088f, 2.5593f, -0.9422f, 1.8554f,
|
||||
-6.5378f, 0.6780f, 2.3186f, 0.0506f, 218.3285f, 203.4055f,
|
||||
204.0362f, 188.7854f, 0.3701f, 2.5257f, 3.5172f, 28.8144f,
|
||||
2.1511f, 3.4676f, 2.6337f, 28.5113f, 2.4254f, -0.0548f,
|
||||
59.4511f, 2.0757f, 2.1551f, 2.2271f, 2.5300f, -1.4173f,
|
||||
91.9240f, 88.2142f, 83.6155f, 82.2482f, -9.2566f, 10.9654f,
|
||||
-2.6974f, 62.6750f, -3.6298f, -0.1245f, 69.6721f, 67.1340f,
|
||||
66.9162f, 64.1994f, -83.6778f, 76.8107f, 69.7832f, 64.9261f,
|
||||
68.4901f, 76.3615f, 70.8108f, 63.5435f, 69.1973f, -83.6034f,
|
||||
24.8275f, 90.1923f, 87.6831f, 82.9783f, 81.8558f, -7.1010f,
|
||||
95.1656f, 88.3853f, 80.5835f, 79.5990f, -3.0720f, 8.1290f,
|
||||
-0.6151f, 63.6425f, -4.5833f, -0.0063f, 70.1861f, 66.6250f,
|
||||
66.6148f, 63.0886f, -89.2863f, 74.7684f, 64.8897f, 60.4134f,
|
||||
62.5241f, 78.7076f, 61.7234f, 60.1688f, 61.9509f, -89.4098f,
|
||||
30.3361f, 92.9144f, 88.5954f, 79.6336f, 79.2453f, -0.4101f,
|
||||
0.6287f, 0.8050f, 0.4417f, 0.5419f, 0.5972f, 1.3037f,
|
||||
0.4316f, -0.0013f, -0.3673f, -0.4952f, 6.1773f, 5.7825f,
|
||||
6.1705f, 5.3848f, 1.7607f, -0.0152f, -0.2924f, 0.8199f,
|
||||
1.3326f, 0.7197f, -0.6332f, 1.1127f, 1.0472f, 1.8468f,
|
||||
3.4419f, 0.8233f, 0.7175f, 0.8514f, 0.6372f, 0.9472f,
|
||||
-0.0813f, -0.0197f, -0.0096f, -0.2015f, 0.1133f, -0.0305f,
|
||||
0.0578f, 0.1375f, -0.0750f, -0.1702f, 0.1246f, -0.1782f,
|
||||
0.2017f, 0.0425f, -0.0602f, 0.1837f, 0.1044f, -0.1273f,
|
||||
-0.1431f, 0.0672f, -0.1807f, -0.1045f, -0.1355f, -0.0497f,
|
||||
-0.0561f, -0.0633f, 0.1907f, -0.0777f, 0.1203f, 0.0754f,
|
||||
0.4079f, 0.2001f, 0.0558f, 0.0622f, 0.2951f, 0.6541f,
|
||||
-0.0068f, 0.1070f, 0.4469f, -0.1266f, -1.3035f, -1.3324f,
|
||||
-1.3612f, -0.9966f, 0.7986f, 0.3192f, -0.5028f, -0.3844f,
|
||||
-0.4079f, 0.6690f, -0.5109f, -0.2719f, -0.4958f, 1.0310f,
|
||||
-0.8044f, 0.1447f, 0.4221f, 0.3194f, 0.3063f, 0.5520f,
|
||||
0.4667f, -5.7238f, -0.5602f, 12.6339f, -15.1865f, -14.9035f,
|
||||
-3.0726f, 9.5347f, -24.6225f, -2.7086f, 89.8557f, 95.0657f,
|
||||
93.8693f, 99.1085f, -35.9483f, -18.0363f, -1.6298f, 25.3484f,
|
||||
39.3975f, -15.3199f, 5.7664f, 17.2367f, 25.2788f, -36.5648f,
|
||||
29.1426f, 0.3857f, -5.2117f, 0.0533f, 12.1707f, -11.1735f,
|
||||
0.2673f, 0.0090f, 0.1574f, 0.0904f, 0.0281f, 0.1144f,
|
||||
0.1123f, -0.0061f, 0.0954f, -0.0094f, -0.4387f, -0.5006f,
|
||||
-0.2560f, -0.2326f, -0.1769f, 0.0465f, 0.1273f, -0.1627f,
|
||||
0.2987f, -0.3041f, 0.1131f, -0.3620f, 0.0932f, -0.0649f,
|
||||
-0.4597f, 0.2535f, -0.0994f, 0.1390f, 0.1279f, 0.4207f,
|
||||
-39.1159f, -42.6382f, -38.4225f, -31.2301f, -28.2382f, -28.1176f,
|
||||
-9.5822f, 1.1886f, -1.2964f, -0.7908f, 154.9819f, 147.1914f,
|
||||
147.0482f, 138.7535f, -21.7014f, -35.7117f, -28.8802f, -3.8968f,
|
||||
-21.5007f, -28.2213f, -28.4878f, -3.7558f, -26.8317f, -22.8491f,
|
||||
50.9464f, -37.0918f, -42.8811f, -39.3079f, -32.1904f, -26.6354f,
|
||||
-72.5346f, -75.5751f, -72.6896f, -71.3671f, -35.3279f, -21.6077f,
|
||||
-5.8259f, 38.7516f, -6.8012f, 0.0172f, 170.0685f, 157.4452f,
|
||||
158.2334f, 145.0102f, 10.0653f, -45.1775f, -56.4571f, -5.1165f,
|
||||
-75.8980f, -46.8672f, -55.3642f, -6.5631f, -81.0258f, 10.1348f,
|
||||
55.9786f, -70.8124f, -75.7040f, -73.9831f, -70.8786f, -34.9723f,
|
||||
88.6239f, 86.5330f, 80.9333f, 79.6833f, -10.0096f, 10.6312f,
|
||||
-4.2350f, 62.6230f, -3.2991f, -0.0843f, 75.8659f, 72.7886f,
|
||||
72.5301f, 68.8265f, -81.8276f, 70.3025f, 62.9511f, 62.5706f,
|
||||
69.1842f, 69.3637f, 65.4820f, 65.4357f, 71.5347f, -82.1064f,
|
||||
24.1925f, 86.2418f, 85.4985f, 80.4091f, 79.5378f, -9.3877f,
|
||||
-7.6594f, -4.9581f, -10.6385f, -20.2307f, -44.2261f, -13.7557f,
|
||||
-4.5344f, 18.1793f, -10.5522f, -1.5878f, 110.3187f, 102.4945f,
|
||||
102.3305f, 94.1324f, -25.2665f, 9.8172f, -4.4791f, 69.4972f,
|
||||
-6.7571f, 5.8378f, -11.6101f, 70.7066f, -4.9327f, -24.0513f,
|
||||
41.4598f, -7.0600f, -7.0940f, -10.2478f, -18.9616f, -46.7505f,
|
||||
90.9365f, 86.0260f, 73.2934f, 69.3406f, 3.3863f, 3.8524f,
|
||||
0.6536f, 63.2150f, -10.6304f, 0.0291f, 73.0071f, 69.7660f,
|
||||
69.0457f, 65.5611f, -92.3379f, 74.2756f, 54.5025f, 84.3183f,
|
||||
53.7481f, 73.5624f, 55.3827f, 82.3242f, 53.5432f, -92.5355f,
|
||||
25.3457f, 89.1858f, 84.4763f, 72.9840f, 69.1889f, 4.6719f,
|
||||
-0.0129f, 0.1995f, 0.2069f, 0.0358f, 0.1209f, -0.1185f,
|
||||
-0.1217f, -0.1456f, 0.0125f, -0.1354f, 0.0510f, -0.0572f,
|
||||
0.1397f, 0.1453f, -0.0086f, 0.0107f, 0.0232f, 0.1508f,
|
||||
0.0884f, -0.0967f, -0.1786f, 0.1361f, -0.1399f, -0.2021f,
|
||||
-0.0242f, -0.2169f, 0.0133f, 0.0116f, -0.1489f, -0.0093f,
|
||||
-0.0796f, 0.1507f, 0.0906f, 0.0228f, -0.0166f, -0.1875f,
|
||||
0.0471f, 0.1184f, -0.0007f, -0.2732f, -0.1386f, -0.2057f,
|
||||
-0.0213f, -0.1699f, 0.0996f, 0.1562f, 0.1850f, -0.0362f,
|
||||
-0.2059f, 0.0258f, -0.0135f, -0.1276f, 0.0034f, 0.2023f,
|
||||
0.0857f, -0.0085f, -0.1955f, -0.1666f, -0.0920f, 0.0971f,
|
||||
-0.0292f, -0.0512f, -0.0753f, -0.0739f, -0.0873f, -0.1200f,
|
||||
0.0220f, -0.1359f, 0.2013f, -0.0445f, 0.1143f, -0.1484f,
|
||||
-0.1556f, -0.0003f, 0.1711f, -0.0724f, -0.0531f, 0.1126f,
|
||||
0.0476f, -0.0057f, 0.0088f, 0.0792f, -0.0438f, -0.1118f,
|
||||
-0.0244f, 0.0712f, 0.0930f, -0.0203f, 0.1662f, -0.0695f,
|
||||
-12.3872f, -18.7022f, -13.4237f, -1.4731f, -18.6843f, -14.1515f,
|
||||
-7.5057f, 40.2090f, -2.7774f, -1.8433f, 123.6006f, 119.0557f,
|
||||
118.2758f, 113.6423f, -32.6216f, -19.5865f, -16.2897f, 17.2068f,
|
||||
6.3559f, -17.8742f, 0.7098f, 11.5970f, -10.1104f, -33.1830f,
|
||||
39.5617f, -10.5499f, -17.8137f, -14.7185f, -2.6172f, -14.6004f,
|
||||
0.3893f, 0.4443f, 0.5305f, 0.3049f, 0.8316f, 0.8679f,
|
||||
0.2265f, 0.2393f, 1.1970f, -0.2891f, -1.8666f, -1.8266f,
|
||||
-1.6984f, -1.8787f, 0.8706f, 0.4208f, 0.5076f, -0.8436f,
|
||||
-0.1623f, 0.8008f, 0.1512f, -1.0839f, -0.3002f, 0.9263f,
|
||||
-1.3031f, 0.5964f, 0.3413f, 0.5551f, 0.2618f, 0.7018f,
|
||||
-0.1320f, -0.1944f, -0.0209f, -0.0877f, 0.0721f, -0.0840f,
|
||||
0.0589f, 0.1019f, 0.1927f, -0.2011f, -0.1117f, 0.1575f,
|
||||
0.1080f, -0.0516f, 0.2154f, -0.1231f, 0.0426f, -0.0522f,
|
||||
-0.1824f, -0.1923f, -0.1206f, -0.1724f, -0.0798f, 0.0401f,
|
||||
-0.2170f, 0.0293f, -0.0853f, 0.1517f, 0.2128f, -0.1934f,
|
||||
0.0406f, 0.0517f, 0.0822f, -0.0150f, 0.0943f, -0.0989f,
|
||||
-0.1802f, -0.1453f, -0.1967f, -0.1797f, 0.1545f, -0.1217f,
|
||||
0.1755f, -0.1604f, -0.0515f, 0.0509f, 0.0310f, -0.1220f,
|
||||
-0.1770f, -0.0157f, 0.1989f, -0.0069f, 0.1766f, 0.1267f,
|
||||
-0.0517f, -0.0396f, 0.0346f, 0.1946f, 0.1162f, -0.1345f,
|
||||
-106.6179f, -110.5917f, -107.5476f, -108.0601f, -61.1687f, -22.4247f,
|
||||
2.6632f, 109.5208f, -66.1177f, 0.0062f, 159.9339f, 144.7755f,
|
||||
145.5032f, 128.9872f, 18.9180f, -75.3569f, -105.0866f, -52.0704f,
|
||||
-119.1299f, -74.7543f, -109.9468f, -59.0682f, -104.5754f, 19.2878f,
|
||||
67.2573f, -104.8061f, -111.8610f, -106.6751f, -107.3537f, -56.4758f,
|
||||
-0.6967f, -0.8495f, -0.9586f, -1.0461f, 1.4522f, -0.2762f,
|
||||
28.2828f, 2.9157f, -2.1062f, 0.1566f, -467.2388f, -461.0685f,
|
||||
-459.0092f, -453.8370f, 1.5422f, -0.8186f, -0.4884f, -53.0399f,
|
||||
-2.0255f, -1.1348f, -1.1039f, -50.2489f, -1.4821f, 1.8021f,
|
||||
-258.0319f, -1.0865f, -0.5542f, -1.0443f, -1.2732f, 1.8413f,
|
||||
0.2377f, 0.1937f, -0.0116f, 0.0935f, -0.0599f, 0.0118f,
|
||||
-0.0875f, 0.0455f, -0.1301f, -0.1081f, -0.2622f, -0.1960f,
|
||||
0.0393f, -0.1490f, 0.1852f, -0.0964f, -0.0741f, 0.0419f,
|
||||
0.1162f, -0.0274f, 0.1200f, -0.0333f, -0.1337f, 0.2141f,
|
||||
0.0664f, 0.1044f, -0.1744f, 0.1060f, -0.1468f, 0.0679f,
|
||||
0.0218f, 0.0494f, 0.1064f, 0.1363f, 0.0013f, 0.1331f,
|
||||
-0.2095f, 0.2088f, -0.0399f, -0.1811f, 0.0678f, -0.1974f,
|
||||
0.1855f, -0.0968f, -0.2008f, 0.0162f, -0.0096f, -0.1493f,
|
||||
0.2170f, -0.1248f, -0.2055f, 0.1276f, -0.0269f, -0.1697f,
|
||||
-0.0662f, 0.1073f, -0.0029f, -0.1051f, -0.1573f, 0.2106f,
|
||||
-0.2020f, -0.1565f, 0.0335f, -0.1818f, -0.1665f, 0.2169f,
|
||||
0.1974f, -0.1470f, -0.1738f, -0.2038f, 0.0558f, -0.0441f,
|
||||
0.0065f, -0.1485f, -0.1366f, -0.2131f, 0.1042f, 0.0349f,
|
||||
-0.1804f, -0.1361f, -0.0116f, -0.1012f, -0.0860f, 0.0606f,
|
||||
-0.2077f, 0.1826f, -0.1014f, -0.0721f, -0.1517f, 0.1022f,
|
||||
-0.1110f, -0.0186f, 0.1505f, 0.1797f, 0.0911f, 0.0340f,
|
||||
0.1702f, -0.1404f, -0.0566f, -0.2744f, -0.1943f, -0.1871f,
|
||||
0.0046f, 0.0306f, -0.0436f, 0.1625f, -0.1302f, 0.0175f,
|
||||
0.1570f, -0.1425f, 0.0779f, 0.1398f, 0.0929f, 0.0897f,
|
||||
0.0458f, -0.0936f, 0.1321f, -0.1355f, 0.0974f, 0.0457f,
|
||||
-73.3516f, -75.0655f, -72.1062f, -72.4624f, -34.8640f, -14.3727f,
|
||||
-4.4720f, 66.4982f, -18.8358f, 0.0397f, 174.2172f, 160.4959f,
|
||||
161.1034f, 147.3250f, 9.5507f, -45.0180f, -73.1609f, -1.5230f,
|
||||
-74.8677f, -43.8559f, -68.7622f, -4.8971f, -82.1922f, 9.6490f,
|
||||
64.7115f, -71.8566f, -75.3879f, -72.5479f, -71.7161f, -34.8056f,
|
||||
0.1442f, 0.1558f, 0.1267f, -0.1261f, -0.0506f, -0.0823f,
|
||||
-0.1807f, -0.0889f, -0.2098f, -0.1295f, -0.2046f, -0.1749f,
|
||||
-0.1197f, -0.1380f, 0.0799f, -0.0889f, -0.1209f, 0.1919f,
|
||||
0.1947f, -0.2086f, -0.1042f, -0.0468f, 0.0232f, 0.1052f,
|
||||
-0.0535f, 0.1398f, 0.1713f, -0.1522f, 0.1453f, 0.0286f,
|
||||
-64.8503f, -67.6746f, -63.6497f, -60.4614f, -35.6091f, -20.1605f,
|
||||
-3.6082f, 84.2801f, -37.8552f, -2.2371f, 132.4947f, 123.5057f,
|
||||
123.5776f, 113.9060f, -14.8772f, -40.7130f, -79.1391f, -10.7024f,
|
||||
-65.7831f, -43.6078f, -79.6847f, -13.0743f, -69.2533f, -16.0171f,
|
||||
50.4868f, -64.3678f, -68.7061f, -64.0823f, -59.3413f, -28.9405f,
|
||||
77.1601f, 75.4899f, 69.8696f, 67.8764f, -22.7548f, 5.9814f,
|
||||
-3.2826f, 57.9754f, -5.9500f, -0.0014f, 77.2251f, 74.0737f,
|
||||
73.7004f, 70.5072f, -80.9661f, 69.3065f, 55.8337f, 76.8831f,
|
||||
57.9902f, 63.4765f, 56.4748f, 70.0282f, 61.0874f, -81.3960f,
|
||||
26.2594f, 76.0367f, 74.9115f, 69.2361f, 66.9262f, -20.1637f,
|
||||
0.1886f, -0.1108f, 0.1262f, 0.0189f, 0.1382f, 0.0859f,
|
||||
-0.1874f, -0.1986f, -0.0171f, -0.1400f, -0.2944f, -0.0750f,
|
||||
-0.0395f, -0.2092f, -0.0878f, 0.1216f, -0.0870f, -0.1613f,
|
||||
0.2495f, 0.0754f, 0.0244f, -0.1205f, -0.0196f, -0.1729f,
|
||||
0.1170f, 0.1585f, 0.1482f, -0.1705f, -0.1337f, 0.0199f,
|
||||
13.0897f, 9.1111f, 6.7413f, 6.3907f, -28.1187f, 0.4556f,
|
||||
-5.3116f, 30.7293f, -16.3644f, -0.0365f, 118.9118f, 111.6125f,
|
||||
111.3227f, 103.4680f, -30.1883f, 8.9328f, -4.1876f, 79.3936f,
|
||||
-9.0522f, 12.7861f, -1.2736f, 78.0446f, -5.9485f, -30.5716f,
|
||||
27.8951f, 13.9613f, 6.7173f, 5.2345f, 8.3271f, -27.3705f,
|
||||
1.0488f, 1.0864f, 1.0710f, 1.7332f, -3.0561f, 1.1622f,
|
||||
-7.6688f, 3.0491f, -1.3865f, 0.0769f, 222.5451f, 207.8170f,
|
||||
208.1767f, 193.1396f, 0.4447f, 2.1654f, 1.8929f, 35.1469f,
|
||||
1.1783f, 2.6199f, 1.1611f, 26.2989f, 3.4446f, 0.1551f,
|
||||
65.6529f, 1.2229f, 0.9851f, 1.0241f, 1.4373f, -3.3421f,
|
||||
0.1388f, 0.0756f, 0.2047f, 0.1140f, 0.0945f, 0.2038f,
|
||||
0.1038f, -0.2068f, -0.0626f, -0.1937f, 0.1347f, -0.0464f,
|
||||
-0.0866f, 0.0250f, 0.0264f, -0.1556f, -0.1625f, 0.1028f,
|
||||
-0.1255f, -0.0854f, 0.1033f, 0.0008f, -0.2133f, -0.0317f,
|
||||
0.1725f, -0.1054f, -0.1900f, 0.0383f, 0.0440f, -0.1900f,
|
||||
-30.0811f, -30.9929f, -29.3194f, -26.8347f, -20.5957f, -4.1595f,
|
||||
-1.9066f, 42.4707f, -9.0435f, 0.0064f, 175.7328f, 163.1350f,
|
||||
163.5085f, 151.1648f, 4.4620f, -20.6011f, -19.3402f, 1.5468f,
|
||||
-32.0920f, -25.4581f, -12.3706f, -2.1636f, -32.4569f, 3.9365f,
|
||||
61.0117f, -28.4195f, -31.0837f, -30.2749f, -27.5522f, -22.8688f,
|
||||
-0.3000f, 0.0092f, -0.3675f, -0.4113f, 0.0033f, 0.1138f,
|
||||
0.2182f, -0.5803f, 0.7507f, -0.2529f, -1.7724f, -1.4702f,
|
||||
-1.5805f, -1.4294f, 0.1435f, -0.0168f, 0.2356f, -0.4373f,
|
||||
-0.4500f, -0.4803f, -0.0041f, -0.3878f, 0.1321f, 0.2761f,
|
||||
-1.1975f, -0.3509f, -0.0465f, -0.4050f, -0.1110f, 0.2233f,
|
||||
0.0950f, 0.0974f, -0.1600f, -0.1753f, -0.0328f, 0.0741f,
|
||||
-0.0706f, 0.1839f, -0.0833f, -0.1367f, -0.1094f, -0.1739f,
|
||||
-0.1069f, 0.0370f, -0.1404f, 0.1631f, -0.1570f, 0.2117f,
|
||||
-0.1891f, 0.0395f, 0.1081f, 0.1760f, 0.0997f, 0.0853f,
|
||||
-0.1018f, 0.1306f, -0.0924f, -0.2078f, 0.0801f, -0.0949f,
|
||||
0.5803f, 0.5578f, 0.4089f, 0.1912f, 0.6774f, 0.3145f,
|
||||
0.3992f, -0.1316f, 1.3142f, -0.2457f, -2.3536f, -2.4939f,
|
||||
-2.3165f, -2.4879f, 0.2321f, 0.1901f, 0.1789f, -1.5215f,
|
||||
0.2645f, 0.2231f, 0.2411f, -1.2361f, 0.2971f, 0.1421f,
|
||||
-1.6715f, 0.3158f, 0.2476f, 0.3596f, 0.3029f, 0.9297f,
|
||||
-88.8401f, -89.5209f, -86.1926f, -87.4196f, -39.6504f, -17.9684f,
|
||||
-4.2702f, 80.2017f, -29.1676f, -0.4190f, 150.2820f, 138.4751f,
|
||||
139.1087f, 126.6569f, 13.7188f, -57.0739f, -80.3383f, -18.8351f,
|
||||
-87.4103f, -56.0072f, -82.7707f, -23.1871f, -93.6787f, 13.9287f,
|
||||
59.6213f, -87.4843f, -90.4227f, -86.2635f, -86.6841f, -37.9086f,
|
||||
0.1184f, -0.2169f, -0.1915f, 0.0543f, 0.1253f, -0.1370f,
|
||||
0.0836f, -0.1198f, 0.1544f, -0.2004f, -0.1118f, -0.0786f,
|
||||
0.1517f, -0.1000f, -0.1055f, 0.0936f, -0.1579f, 0.1098f,
|
||||
-0.0234f, -0.0499f, 0.0951f, -0.1711f, 0.0186f, -0.2008f,
|
||||
0.1777f, 0.1386f, -0.1495f, -0.0684f, -0.2149f, -0.1198f,
|
||||
-0.6205f, -0.7209f, -0.5487f, -0.9080f, 1.3400f, 0.0085f,
|
||||
28.2837f, 3.2217f, -1.8463f, 0.1620f, -464.3599f, -458.4327f,
|
||||
-455.9967f, -451.0393f, 1.6619f, -0.6944f, -0.3167f, -52.3630f,
|
||||
-1.6971f, -0.7340f, -0.8923f, -49.2771f, -1.1177f, 1.8810f,
|
||||
-258.9386f, -1.0765f, -0.7279f, -0.5208f, -0.8839f, 1.8175f,
|
||||
-78.8510f, -80.5740f, -77.8843f, -77.9798f, -36.5560f, -16.0818f,
|
||||
-5.5362f, 66.4228f, -16.8150f, 0.0036f, 181.8365f, 167.7181f,
|
||||
168.2344f, 153.9725f, 11.2659f, -47.5786f, -92.6978f, 6.7573f,
|
||||
-68.7704f, -48.3850f, -95.3637f, 8.8888f, -76.9497f, 11.2243f,
|
||||
60.9020f, -77.6515f, -80.7610f, -78.4537f, -77.4659f, -36.2872f,
|
||||
-0.0936f, 0.1966f, -0.2121f, 0.0193f, 0.0489f, -0.1445f,
|
||||
0.0060f, 0.0358f, -0.0783f, -0.0985f, -0.2072f, -0.0802f,
|
||||
-0.0185f, 0.1868f, -0.0631f, 0.1260f, -0.0675f, 0.2167f,
|
||||
-0.2174f, -0.1085f, 0.1483f, -0.1655f, -0.1040f, 0.1605f,
|
||||
-0.1673f, -0.0148f, -0.1856f, -0.1454f, 0.1603f, -0.1620f,
|
||||
-0.9205f, -1.2716f, -3.6561f, -5.0834f, -0.7934f, 1.8710f,
|
||||
2.2999f, -2.9516f, -1.7631f, -0.3804f, 41.2998f, 26.2358f,
|
||||
28.9763f, 15.7315f, 5.2164f, 3.2963f, -5.4457f, 18.6310f,
|
||||
-25.0076f, 5.4368f, -12.0085f, 17.1462f, -14.6992f, 5.6365f,
|
||||
48.6207f, -1.0921f, -1.8723f, -3.5354f, -5.1774f, -1.0200f,
|
||||
-0.1065f, -0.2021f, 0.0332f, 0.1692f, -0.1239f, 0.1325f,
|
||||
-0.0660f, -0.0567f, 0.2107f, -0.2084f, -0.0263f, 0.1411f,
|
||||
0.0178f, 0.0451f, 0.2024f, -0.1756f, -0.0771f, -0.1690f,
|
||||
-0.2097f, -0.2130f, 0.0714f, 0.0172f, -0.0310f, 0.0649f,
|
||||
-0.1550f, 0.0701f, 0.0306f, -0.1750f, -0.1988f, -0.2060f,
|
||||
0.0005f, -0.1325f, -0.1823f, -0.0900f, -0.1291f, -0.1817f,
|
||||
0.0144f, 0.0951f, -0.1954f, -0.0171f, -0.1985f, 0.0875f,
|
||||
0.0901f, -0.0857f, 0.1681f, 0.0465f, 0.1023f, 0.0985f,
|
||||
-0.2152f, -0.1723f, -0.0825f, 0.0203f, -0.1206f, -0.1431f,
|
||||
-0.1552f, 0.1344f, 0.0398f, 0.0169f, 0.2180f, -0.1530f,
|
||||
2.7964f, 2.7312f, 2.8831f, 3.4729f, -3.1366f, 2.4043f,
|
||||
-7.2004f, 1.4128f, 2.8648f, 0.0578f, 225.5640f, 210.3712f,
|
||||
210.6907f, 195.0339f, 0.3140f, 1.8060f, 2.7355f, 33.6917f,
|
||||
3.3542f, 3.3682f, 1.7371f, 31.2424f, 3.4094f, -0.1192f,
|
||||
63.0864f, 3.0562f, 2.8633f, 2.6777f, 3.5495f, -4.2616f,
|
||||
-1.4034f, 0.3930f, -4.6756f, -9.9870f, -27.8511f, 5.6071f,
|
||||
-1.0862f, 34.4907f, -10.4831f, -0.0281f, 117.2617f, 104.9590f,
|
||||
106.1515f, 93.9707f, -16.8801f, 5.3036f, -21.7458f, 98.5306f,
|
||||
-20.7596f, 6.4733f, -17.6440f, 98.3097f, -31.9540f, -17.0600f,
|
||||
27.4543f, -0.6140f, -1.6182f, -4.9167f, -8.9017f, -26.2485f,
|
||||
-0.1952f, -0.0462f, -0.1958f, 0.1679f, -0.1592f, -0.1634f,
|
||||
-0.0507f, -0.0542f, 0.0038f, -0.0343f, 0.0567f, -0.1983f,
|
||||
0.0250f, -0.0762f, 0.0902f, -0.0343f, 0.1240f, 0.1161f,
|
||||
0.1237f, 0.1870f, 0.0346f, 0.0340f, 0.0625f, -0.0355f,
|
||||
0.0278f, -0.1043f, 0.1755f, 0.0253f, 0.1750f, -0.2070f,
|
||||
-5.5531f, -5.3122f, -4.9348f, -4.4782f, -7.5686f, -1.5478f,
|
||||
-5.4341f, 0.5087f, -2.1382f, 0.0798f, 208.3677f, 194.0083f,
|
||||
194.4168f, 179.3082f, 1.4443f, -1.5038f, -1.4021f, 25.9363f,
|
||||
-4.0635f, -2.6785f, -1.6640f, 22.2589f, -1.4910f, 1.4715f,
|
||||
59.1972f, -4.9638f, -5.1920f, -4.9193f, -5.2649f, -8.0556f,
|
||||
20.1226f, 12.0195f, 9.7385f, 10.7058f, -27.4201f, 8.4869f,
|
||||
-5.0826f, 32.9212f, -2.0674f, -0.0290f, 120.5002f, 112.3222f,
|
||||
112.3287f, 104.1107f, -20.6293f, 14.8534f, -0.8748f, 103.1141f,
|
||||
-1.1368f, 15.3716f, 2.7653f, 91.7285f, -0.5991f, -20.7338f,
|
||||
35.9363f, 20.5104f, 11.1988f, 9.0368f, 10.6355f, -26.5309f,
|
||||
-0.2058f, -0.2176f, 0.1331f, -0.1415f, -0.0825f, -0.0470f,
|
||||
-0.0615f, 0.1274f, 0.0076f, -0.0575f, -0.2065f, 0.0866f,
|
||||
0.2166f, -0.1942f, -0.1952f, 0.1323f, -0.1016f, 0.1803f,
|
||||
-0.0424f, 0.1555f, 0.1118f, 0.1559f, 0.0337f, -0.0341f,
|
||||
-0.0430f, 0.1988f, -0.0553f, -0.0255f, 0.1817f, 0.0608f,
|
||||
0.1431f, 0.0686f, -0.0245f, -0.2107f, 0.2001f, -0.0964f,
|
||||
-0.0090f, 0.1151f, -0.0365f, -0.1986f, 0.1740f, -0.2098f,
|
||||
0.0013f, 0.1369f, 0.1910f, 0.1801f, -0.2019f, 0.0348f,
|
||||
-0.1175f, 0.0627f, -0.1929f, -0.0099f, 0.1349f, 0.1804f,
|
||||
-0.1071f, -0.1651f, -0.1146f, -0.0259f, 0.1626f, -0.0271f,
|
||||
0.1393f, 0.1304f, -0.0200f, 0.0924f, -0.0839f, -0.0031f,
|
||||
-0.1311f, 0.0350f, -0.1330f, -0.0911f, 0.1949f, -0.0209f,
|
||||
-0.1883f, 0.0269f, 0.2040f, 0.1552f, 0.1532f, 0.1157f,
|
||||
-0.1102f, -0.1220f, -0.0808f, -0.1050f, 0.1716f, 0.0846f,
|
||||
-0.0180f, -0.1037f, 0.2063f, 0.1237f, 0.1253f, -0.0496f,
|
||||
-0.0183f, 0.0491f, 0.1703f, -0.0824f, -0.0702f, -0.1100f,
|
||||
-0.0965f, 0.0130f, -0.1222f, -0.1081f, 0.0329f, 0.2115f,
|
||||
-0.1438f, 0.0799f, -0.1602f, -0.0330f, 0.0501f, 0.1072f,
|
||||
-0.0744f, -0.1783f, -0.0240f, 0.0777f, -0.1944f, 0.0438f,
|
||||
-0.0033f, -0.1873f, 0.0984f, -0.0318f, 0.0773f, 0.1489f,
|
||||
0.3966f, 0.4711f, 0.3972f, 0.0623f, 0.5970f, 0.1018f,
|
||||
0.1375f, -0.1881f, 0.8921f, -0.1854f, -2.1138f, -2.1178f,
|
||||
-1.8295f, -2.1703f, 0.5784f, -0.1937f, -0.0728f, -0.9953f,
|
||||
0.2442f, -0.4074f, -0.1591f, -1.1660f, 0.4832f, 0.2203f,
|
||||
-1.4957f, 0.1544f, 0.1810f, 0.2275f, 0.4075f, 0.8153f,
|
||||
0.0715f, 0.0222f, 0.0463f, -0.0201f, 0.0396f, 0.5951f,
|
||||
-0.2779f, -0.0306f, 0.7532f, -0.1596f, -4.1080f, -3.7925f,
|
||||
-3.8522f, -3.2468f, 0.7728f, 0.0188f, -0.1448f, 0.4084f,
|
||||
-0.4666f, -0.1036f, -1.1469f, 0.4243f, 0.2778f, 0.9023f,
|
||||
-3.0216f, 0.0384f, -0.3348f, -0.0314f, -0.2788f, 0.0479f,
|
||||
139.0773f, 131.6164f, 115.0392f, 111.1817f, 41.7596f, 9.5379f,
|
||||
1.8542f, 46.9890f, -12.8221f, 0.0241f, 52.9779f, 51.5268f,
|
||||
50.8060f, 48.7028f, -132.9665f, 118.3478f, 101.1239f, 81.4608f,
|
||||
75.4251f, 121.0643f, 97.8947f, 86.8911f, 74.5576f, -133.7606f,
|
||||
29.2657f, 135.8916f, 131.3661f, 114.1687f, 111.0784f, 31.3790f,
|
||||
-0.0807f, -0.0657f, -0.0027f, 0.0410f, 0.0765f, 0.1194f,
|
||||
0.0953f, -0.0060f, 0.1531f, -0.2339f, 0.1488f, -0.0615f,
|
||||
-0.0579f, 0.0761f, 0.1250f, -0.0469f, 0.1480f, 0.0683f,
|
||||
-0.0049f, 0.1558f, 0.2168f, -0.0736f, 0.1135f, -0.1244f,
|
||||
0.0725f, -0.1297f, -0.0215f, -0.0412f, -0.1632f, -0.0200f,
|
||||
-0.1346f, -0.1954f, 0.0053f, 0.0151f, 0.1379f, -0.1497f,
|
||||
-0.0102f, -0.0336f, 0.0900f, -0.1706f, -0.0932f, -0.2084f,
|
||||
0.1242f, -0.2027f, 0.0849f, -0.2139f, -0.2015f, 0.0944f,
|
||||
-0.0984f, 0.2082f, 0.1625f, -0.0227f, -0.1676f, 0.1021f,
|
||||
0.1516f, 0.0245f, 0.0955f, -0.1488f, -0.0057f, 0.1783f,
|
||||
-0.8568f, -0.8175f, -0.6282f, -1.3107f, 1.5712f, 0.1044f,
|
||||
28.2289f, 3.0885f, -1.9829f, 0.1600f, -465.9583f, -459.5893f,
|
||||
-457.5055f, -452.7600f, 1.7229f, -0.6620f, -0.1065f, -52.8017f,
|
||||
-2.0293f, -0.8224f, -1.0389f, -49.9049f, -1.2250f, 1.7647f,
|
||||
-259.2465f, -1.0978f, -0.5169f, -0.8721f, -0.8197f, 1.9158f,
|
||||
16.2234f, 15.8523f, 13.8343f, 9.8509f, -21.4326f, 15.7650f,
|
||||
-6.4451f, 34.8575f, 1.1387f, -0.0223f, 117.7213f, 109.8494f,
|
||||
109.7624f, 101.8532f, -20.3275f, 16.0812f, 4.9165f, 92.4919f,
|
||||
4.1615f, 13.8451f, 9.2112f, 97.1580f, -8.7037f, -20.4420f,
|
||||
27.1105f, 17.4922f, 13.9998f, 12.3888f, 11.4705f, -20.9568f,
|
||||
0.5457f, 0.5322f, 0.2823f, 0.3581f, 0.5359f, 0.1576f,
|
||||
0.1969f, -0.0136f, -0.2748f, -0.3168f, -0.3918f, -0.2167f,
|
||||
-0.1797f, -0.1869f, 0.2986f, -0.2116f, -0.4226f, -0.2022f,
|
||||
0.9452f, 0.5474f, -0.1218f, 0.2067f, -0.1600f, 0.1937f,
|
||||
0.0808f, 0.4877f, 0.5106f, 0.2626f, 0.5076f, 0.6228f,
|
||||
0.5124f, 0.4044f, 0.4023f, 0.1222f, 2.5446f, 0.9623f,
|
||||
24.9875f, 4.7442f, -2.0551f, 0.1642f, -449.9478f, -444.1841f,
|
||||
-442.0153f, -437.1498f, 2.3209f, -0.6986f, -0.3456f, -47.4074f,
|
||||
-1.2374f, -1.0939f, -0.9112f, -41.1851f, -0.5064f, 2.4209f,
|
||||
-263.4446f, -0.0433f, 0.3460f, 0.1475f, 0.3770f, 2.9154f,
|
||||
0.2032f, 0.1527f, 0.2161f, -0.1981f, 0.1893f, -0.2003f,
|
||||
0.1734f, 0.1713f, 0.1207f, -0.2073f, -0.1018f, 0.0770f,
|
||||
0.0728f, 0.1665f, 0.0689f, 0.1884f, -0.1399f, -0.1326f,
|
||||
-0.0518f, -0.1948f, 0.1576f, -0.1835f, 0.1436f, 0.0497f,
|
||||
0.0883f, -0.1253f, -0.0417f, -0.0507f, -0.1555f, 0.2076f,
|
||||
-2.4080f, 6.1616f, -0.8564f, -13.6773f, -32.7238f, -16.3144f,
|
||||
-1.9828f, 20.5110f, -17.0191f, -1.7154f, 103.6642f, 95.3675f,
|
||||
95.5662f, 86.9504f, -35.5340f, 19.6681f, -2.4900f, 65.0847f,
|
||||
-15.8119f, 13.7256f, -4.6753f, 63.4713f, -6.5992f, -34.2369f,
|
||||
41.3959f, -1.5528f, 3.8106f, -0.7762f, -12.3204f, -35.1734f,
|
||||
-83.9509f, -87.4861f, -83.5925f, -81.5047f, -54.1256f, -45.7506f,
|
||||
-13.5325f, -6.0331f, -8.5062f, 0.0261f, 189.9450f, 177.7870f,
|
||||
178.6945f, 164.9762f, 9.8521f, -68.0619f, -68.6145f, 6.5056f,
|
||||
-55.9651f, -66.9540f, -65.3349f, -2.1954f, -57.2408f, 8.6577f,
|
||||
60.6966f, -82.1056f, -88.5245f, -83.3057f, -80.7283f, -50.5285f,
|
||||
-0.1397f, 0.1862f, -0.0691f, -0.0906f, 0.1560f, 0.1377f,
|
||||
-0.0066f, -0.0213f, 0.0708f, -0.0386f, -0.0015f, -0.0020f,
|
||||
-0.2122f, 0.0747f, 0.0795f, 0.0229f, 0.1923f, -0.1661f,
|
||||
0.0895f, 0.1176f, 0.1398f, -0.0443f, 0.0934f, 0.0638f,
|
||||
-0.1924f, 0.0602f, 0.0404f, 0.1597f, 0.1387f, -0.0601f,
|
||||
-28.3967f, -21.8483f, -25.5175f, -29.9252f, 2.0161f, -3.0092f,
|
||||
7.7435f, 28.2367f, -35.0188f, -0.1578f, 105.0164f, 93.4495f,
|
||||
94.9134f, 81.0315f, 4.3602f, 8.1303f, -37.7665f, -16.6986f,
|
||||
-40.8902f, 8.2542f, -33.3215f, -2.0457f, -69.0245f, 4.1016f,
|
||||
47.2770f, -25.8268f, -23.6034f, -26.4339f, -27.8305f, 8.4468f,
|
||||
13.8742f, 8.3874f, 4.2044f, 1.4619f, -40.2909f, -0.6358f,
|
||||
-0.7982f, 36.1931f, -17.3147f, -0.3348f, 106.8135f, 96.5298f,
|
||||
97.8829f, 86.9994f, -25.8170f, 15.0652f, -0.9181f, 85.8544f,
|
||||
2.5475f, 9.8009f, -3.5931f, 89.2017f, -3.7252f, -25.2986f,
|
||||
22.5505f, 14.0434f, 7.0708f, 4.6646f, 1.5807f, -39.4024f,
|
||||
-0.1436f, 0.0256f, 0.0274f, -0.2126f, 0.0401f, 0.0745f,
|
||||
-0.0379f, -0.0357f, 0.0777f, -0.0709f, -0.1093f, -0.2047f,
|
||||
-0.0713f, -0.0478f, -0.0908f, 0.1963f, 0.1282f, 0.0977f,
|
||||
0.1304f, 0.2058f, 0.0700f, 0.0518f, 0.0239f, 0.0686f,
|
||||
-0.1909f, 0.0828f, -0.1243f, -0.1920f, 0.1908f, -0.0808f,
|
||||
90.8028f, 89.2894f, 84.5339f, 83.3491f, -13.3838f, 12.0240f,
|
||||
-3.9443f, 63.0867f, -2.5321f, -0.0099f, 68.9140f, 66.3206f,
|
||||
66.0278f, 63.1498f, -83.7261f, 74.3448f, 73.4998f, 64.8477f,
|
||||
69.7701f, 74.5878f, 71.0331f, 63.2116f, 74.3162f, -83.9282f,
|
||||
20.8163f, 89.6818f, 88.6452f, 83.7338f, 82.9360f, -13.2357f,
|
||||
0.1299f, -0.1765f, -0.0168f, -0.1372f, -0.1183f, 0.0472f,
|
||||
0.1312f, 0.0267f, 0.0194f, -0.1593f, 0.0059f, 0.1775f,
|
||||
0.0668f, -0.1239f, -0.1982f, -0.1415f, -0.1659f, -0.1148f,
|
||||
0.0136f, 0.0913f, -0.1254f, -0.0357f, 0.0892f, 0.0835f,
|
||||
-0.0554f, 0.1969f, -0.0888f, -0.0623f, -0.0236f, -0.1492f,
|
||||
0.4196f, 0.3218f, 0.2287f, 0.5095f, 0.7210f, 0.2279f,
|
||||
0.4523f, -0.1832f, 1.3095f, -0.2041f, -2.1443f, -2.1947f,
|
||||
-1.9292f, -2.1142f, 0.5840f, 0.1018f, 0.1011f, -1.6565f,
|
||||
0.4325f, 0.0424f, 0.2836f, -1.7183f, 0.2595f, 0.2686f,
|
||||
-1.8784f, 0.3891f, 0.3050f, 0.6195f, 0.2896f, 0.5905f,
|
||||
-5.3024f, -3.2518f, -12.5192f, -29.1732f, 1.6538f, -1.8315f,
|
||||
9.9788f, 10.5155f, 6.3234f, -0.3460f, 76.9925f, 51.3785f,
|
||||
55.7120f, 29.0432f, 5.5901f, 25.6578f, -3.9565f, 13.0509f,
|
||||
-106.0371f, 23.2124f, -18.2004f, 8.4618f, -69.3585f, 5.5651f,
|
||||
80.0565f, -6.4941f, -5.3742f, -14.4209f, -24.1565f, 6.6801f,
|
||||
-22.0585f, -20.9909f, -26.7939f, -29.6890f, -14.5085f, 2.1866f,
|
||||
-4.2608f, 17.3977f, -30.8824f, -0.4017f, 135.6957f, 126.9320f,
|
||||
127.0044f, 118.1835f, -1.8768f, -0.8629f, -32.0882f, 44.7862f,
|
||||
-23.9174f, 1.6485f, -27.9940f, 51.9078f, -48.5279f, -1.7550f,
|
||||
49.9230f, -19.9785f, -22.4647f, -27.6911f, -27.3197f, -10.6545f,
|
||||
-0.1922f, -0.1999f, -0.1396f, 0.1065f, 0.0085f, -0.1940f,
|
||||
0.0351f, 0.1285f, -0.0292f, -0.1296f, 0.1543f, -0.2082f,
|
||||
-0.1758f, 0.0719f, 0.0764f, 0.1394f, -0.0255f, -0.0370f,
|
||||
0.1615f, -0.0568f, 0.1920f, -0.1631f, 0.0199f, 0.1884f,
|
||||
0.0693f, 0.1074f, -0.0273f, 0.1540f, 0.0098f, 0.2111f,
|
||||
0.1805f, -0.0555f, 0.1159f, 0.0469f, 0.1789f, -0.1711f,
|
||||
-0.1304f, 0.1912f, -0.0737f, -0.1408f, 0.1804f, -0.2023f,
|
||||
-0.0467f, -0.1019f, -0.0136f, 0.0691f, 0.1454f, -0.0213f,
|
||||
0.0929f, -0.0958f, 0.1299f, 0.1137f, 0.1175f, 0.1042f,
|
||||
-0.2081f, -0.0737f, 0.0582f, 0.1640f, 0.2120f, -0.0646f,
|
||||
-0.0326f, 0.1976f, 0.1182f, -0.1365f, -0.1784f, 0.2113f,
|
||||
0.0469f, 0.0763f, -0.0197f, -0.1902f, 0.1259f, 0.1598f,
|
||||
-0.0180f, -0.1339f, -0.1675f, -0.1884f, -0.1973f, 0.1529f,
|
||||
0.1160f, 0.2154f, -0.1446f, -0.1395f, 0.0355f, 0.1513f,
|
||||
-0.2086f, -0.1135f, -0.1502f, -0.0018f, 0.0486f, -0.0110f,
|
||||
-0.0843f, -0.0716f, -0.1367f, 0.0753f, 0.0114f, 0.0475f,
|
||||
-0.0632f, 0.2045f, -0.0512f, -0.0906f, -0.1071f, -0.1957f,
|
||||
0.1361f, 0.1821f, -0.1684f, -0.1383f, 0.1059f, 0.1579f,
|
||||
-0.0064f, -0.1205f, -0.0718f, -0.1323f, -0.0174f, -0.1092f,
|
||||
-0.1915f, 0.1978f, -0.1245f, 0.1297f, -0.1542f, 0.1556f,
|
||||
-0.1752f, 0.0718f, -0.1020f, -0.1970f, 0.0518f, -0.0888f,
|
||||
0.0541f, -0.1922f, -0.1467f, -0.0653f, -0.1940f, -0.0800f,
|
||||
-0.1096f, -0.0796f, -0.1310f, 0.0191f, -0.1077f, -0.0973f,
|
||||
0.1566f, 0.0074f, 0.0500f, -0.0415f, -0.2116f, 0.0227f,
|
||||
0.0895f, 0.1528f, 0.1404f, 0.0467f, 0.0462f, -0.0973f,
|
||||
-0.1669f, 0.0551f, 0.1167f, -0.1470f, -0.0542f, -0.1006f,
|
||||
0.2104f, 0.1039f, -0.0211f, -0.1726f, -0.0694f, -0.0270f,
|
||||
0.0277f, -0.0715f, -0.2055f, -0.1502f, -0.1718f, -0.0043f,
|
||||
0.0174f, 0.1019f, -0.0233f, -0.1518f, -0.1331f, -0.0001f,
|
||||
-0.1483f, -0.2115f, 0.0666f, 0.0014f, 0.1601f, -0.0690f,
|
||||
};
|
||||
|
||||
static const float av1_rdcost_model_nn_biases_layer0[NUM_HIDDEN_NODES] = {
|
||||
0.156824f, 0.f, 0.130013f, 0.084482f, -129.058197f, -15.090252f,
|
||||
-3.859116f, 0.736356f, -81.361557f, -0.001922f, -0.000713f, 0.440181f,
|
||||
14.982646f, 1.282223f, 2.23122f, 94.26635f, 93.920929f, 0.614672f,
|
||||
0.f, 0.315858f, 4.746014f, 0.116901f, -35.661354f, -75.148285f,
|
||||
92.006989f, -14.112332f, 86.673157f, -0.000307f, -0.000544f, 0.f,
|
||||
-7.851313f, 0.505186f, 0.f, 0.f, -111.681091f, -0.937782f,
|
||||
0.035789f, 0.f, 0.f, -0.00102f, -75.180527f, 0.f,
|
||||
-63.821148f, 79.592392f, 0.085068f, 11.184906f, 1.25406f, 0.f,
|
||||
-29.779242f, -0.181732f, 0.f, 0.425554f, -90.78405f, 0.f,
|
||||
-0.828326f, -81.132179f, 0.f, -2.757063f, 0.f, 0.f,
|
||||
2.967951f, -4.440599f, 0.f, -5.105355f, 14.734543f, 0.f,
|
||||
0.f, 0.f, 0.f, 0.295342f, -0.026907f, 133.375412f,
|
||||
-0.000855f, 0.f, -0.875029f, 15.665165f, 0.437296f, 0.321257f,
|
||||
-0.001932f, -4.235782f, -87.187782f, 0.f, -28.84696f, 7.055514f,
|
||||
0.f, 95.548302f, -0.000425f, 0.38969f, -13.88008f, -27.347931f,
|
||||
0.f, 0.f, 0.f, -0.000026f, 0.f, 0.f,
|
||||
};
|
||||
|
||||
static const float
|
||||
av1_rdcost_model_nn_weights_layer1[NUM_HIDDEN_NODES * NUM_OUTPUTS] = {
|
||||
-0.101706f, -0.14411f, -0.139118f, -0.132945f, 118.811302f,
|
||||
3.137232f, -32.969776f, -4.150725f, 26.263071f, 0.092841f,
|
||||
0.174125f, -0.028195f, 15.712872f, 17.722702f, 5.666006f,
|
||||
-121.143929f, -131.933731f, -3.000318f, -0.032063f, -0.380065f,
|
||||
-1.660653f, -0.164802f, 7.177527f, 87.759155f, -119.564224f,
|
||||
-98.051651f, -110.581116f, -0.069982f, 0.023906f, 0.183792f,
|
||||
40.606274f, -0.080804f, -0.053744f, -0.187848f, 157.44313f,
|
||||
-4.820149f, 0.089499f, 0.070232f, -0.043038f, 0.072996f,
|
||||
93.347313f, 0.225259f, 103.223228f, -110.682541f, 0.14314f,
|
||||
-89.827538f, 6.505952f, -0.076949f, 73.816132f, -0.063416f,
|
||||
-0.23736f, -0.066059f, 116.049599f, 0.120871f, -4.708246f,
|
||||
107.501671f, -0.206708f, -32.688675f, 0.047608f, -0.105907f,
|
||||
6.505825f, -75.461891f, -0.160341f, 6.532121f, -84.868111f,
|
||||
-0.065622f, 0.044756f, 0.008672f, 0.017155f, 0.046108f,
|
||||
-0.218818f, -126.507957f, 0.028271f, 0.180625f, -4.707376f,
|
||||
-121.524307f, -0.03853f, -4.103166f, -0.018947f, -95.768463f,
|
||||
15.941695f, 0.147154f, -102.863029f, -72.521698f, -0.037133f,
|
||||
-138.1492f, 0.210016f, -0.084692f, -68.693665f, -52.523472f,
|
||||
-0.133385f, -0.17438f, 0.008654f, -0.035642f, -0.145202f,
|
||||
0.211135f,
|
||||
};
|
||||
|
||||
static const float av1_rdcost_model_nn_biases_layer1[NUM_OUTPUTS] = {
|
||||
0.251909f
|
||||
};
|
||||
|
||||
static const NN_CONFIG av1_rdcost_model_nnconfig = {
|
||||
NUM_FEATURES,
|
||||
NUM_OUTPUTS,
|
||||
NUM_HIDDEN_LAYERS,
|
||||
{
|
||||
NUM_HIDDEN_NODES,
|
||||
},
|
||||
{
|
||||
av1_rdcost_model_nn_weights_layer0,
|
||||
av1_rdcost_model_nn_weights_layer1,
|
||||
},
|
||||
{
|
||||
av1_rdcost_model_nn_biases_layer0,
|
||||
av1_rdcost_model_nn_biases_layer1,
|
||||
},
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#undef NUM_FEATURES
|
||||
#undef NUM_HIDDEN_LAYERS
|
||||
#undef NUM_HIDDEN_NODES
|
||||
#undef NUM_OUTPUTS
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // AV1_ENCODER_RATE_DISTORTION_MODEL_PARAMS_H_
|
||||
186
third_party/aom/av1/encoder/ratectrl.c
vendored
186
third_party/aom/av1/encoder/ratectrl.c
vendored
|
|
@ -421,9 +421,9 @@ void av1_rc_update_rate_correction_factors(AV1_COMP *cpi, int width,
|
|||
projected_size_based_on_q =
|
||||
av1_cyclic_refresh_estimate_bits_at_q(cpi, rate_correction_factor);
|
||||
} else {
|
||||
projected_size_based_on_q =
|
||||
av1_estimate_bits_at_q(cpi->common.frame_type, cm->base_qindex, MBs,
|
||||
rate_correction_factor, cm->bit_depth);
|
||||
projected_size_based_on_q = av1_estimate_bits_at_q(
|
||||
cpi->common.frame_type, cm->base_qindex, MBs, rate_correction_factor,
|
||||
cm->seq_params.bit_depth);
|
||||
}
|
||||
// Work out a size correction factor.
|
||||
if (projected_size_based_on_q > FRAME_OVERHEAD_BITS)
|
||||
|
|
@ -495,7 +495,7 @@ int av1_rc_regulate_q(const AV1_COMP *cpi, int target_bits_per_frame,
|
|||
(int)av1_cyclic_refresh_rc_bits_per_mb(cpi, i, correction_factor);
|
||||
} else {
|
||||
bits_per_mb_at_this_q = (int)av1_rc_bits_per_mb(
|
||||
cm->frame_type, i, correction_factor, cm->bit_depth);
|
||||
cm->frame_type, i, correction_factor, cm->seq_params.bit_depth);
|
||||
}
|
||||
|
||||
if (bits_per_mb_at_this_q <= target_bits_per_mb) {
|
||||
|
|
@ -643,7 +643,8 @@ static int rc_pick_q_and_bounds_one_pass_cbr(const AV1_COMP *cpi, int width,
|
|||
int active_worst_quality = calc_active_worst_quality_one_pass_cbr(cpi);
|
||||
int q;
|
||||
int *rtc_minq;
|
||||
ASSIGN_MINQ_TABLE(cm->bit_depth, rtc_minq);
|
||||
const int bit_depth = cm->seq_params.bit_depth;
|
||||
ASSIGN_MINQ_TABLE(bit_depth, rtc_minq);
|
||||
|
||||
if (frame_is_intra_only(cm)) {
|
||||
active_best_quality = rc->best_quality;
|
||||
|
|
@ -652,17 +653,17 @@ static int rc_pick_q_and_bounds_one_pass_cbr(const AV1_COMP *cpi, int width,
|
|||
// based on the ambient Q to reduce the risk of popping.
|
||||
if (rc->this_key_frame_forced) {
|
||||
int qindex = rc->last_boosted_qindex;
|
||||
double last_boosted_q = av1_convert_qindex_to_q(qindex, cm->bit_depth);
|
||||
int delta_qindex = av1_compute_qdelta(
|
||||
rc, last_boosted_q, (last_boosted_q * 0.75), cm->bit_depth);
|
||||
double last_boosted_q = av1_convert_qindex_to_q(qindex, bit_depth);
|
||||
int delta_qindex = av1_compute_qdelta(rc, last_boosted_q,
|
||||
(last_boosted_q * 0.75), bit_depth);
|
||||
active_best_quality = AOMMAX(qindex + delta_qindex, rc->best_quality);
|
||||
} else if (cm->current_video_frame > 0) {
|
||||
// not first frame of one pass and kf_boost is set
|
||||
double q_adj_factor = 1.0;
|
||||
double q_val;
|
||||
|
||||
active_best_quality = get_kf_active_quality(
|
||||
rc, rc->avg_frame_qindex[KEY_FRAME], cm->bit_depth);
|
||||
active_best_quality =
|
||||
get_kf_active_quality(rc, rc->avg_frame_qindex[KEY_FRAME], bit_depth);
|
||||
|
||||
// Allow somewhat lower kf minq with small image formats.
|
||||
if ((width * height) <= (352 * 288)) {
|
||||
|
|
@ -671,9 +672,9 @@ static int rc_pick_q_and_bounds_one_pass_cbr(const AV1_COMP *cpi, int width,
|
|||
|
||||
// Convert the adjustment factor to a qindex delta
|
||||
// on active_best_quality.
|
||||
q_val = av1_convert_qindex_to_q(active_best_quality, cm->bit_depth);
|
||||
q_val = av1_convert_qindex_to_q(active_best_quality, bit_depth);
|
||||
active_best_quality +=
|
||||
av1_compute_qdelta(rc, q_val, q_val * q_adj_factor, cm->bit_depth);
|
||||
av1_compute_qdelta(rc, q_val, q_val * q_adj_factor, bit_depth);
|
||||
}
|
||||
} else if (!rc->is_src_frame_alt_ref &&
|
||||
(cpi->refresh_golden_frame || cpi->refresh_alt_ref_frame)) {
|
||||
|
|
@ -686,7 +687,7 @@ static int rc_pick_q_and_bounds_one_pass_cbr(const AV1_COMP *cpi, int width,
|
|||
} else {
|
||||
q = active_worst_quality;
|
||||
}
|
||||
active_best_quality = get_gf_active_quality(rc, q, cm->bit_depth);
|
||||
active_best_quality = get_gf_active_quality(rc, q, bit_depth);
|
||||
} else {
|
||||
// Use the lower of active_worst_quality and recent/average Q.
|
||||
if (cm->current_video_frame > 1) {
|
||||
|
|
@ -716,8 +717,8 @@ static int rc_pick_q_and_bounds_one_pass_cbr(const AV1_COMP *cpi, int width,
|
|||
!(cm->current_video_frame == 0)) {
|
||||
int qdelta = 0;
|
||||
aom_clear_system_state();
|
||||
qdelta = av1_compute_qdelta_by_rate(
|
||||
&cpi->rc, cm->frame_type, active_worst_quality, 2.0, cm->bit_depth);
|
||||
qdelta = av1_compute_qdelta_by_rate(&cpi->rc, cm->frame_type,
|
||||
active_worst_quality, 2.0, bit_depth);
|
||||
*top_index = active_worst_quality + qdelta;
|
||||
*top_index = AOMMAX(*top_index, *bottom_index);
|
||||
}
|
||||
|
|
@ -768,27 +769,27 @@ static int rc_pick_q_and_bounds_one_pass_vbr(const AV1_COMP *cpi, int width,
|
|||
int active_worst_quality = calc_active_worst_quality_one_pass_vbr(cpi);
|
||||
int q;
|
||||
int *inter_minq;
|
||||
ASSIGN_MINQ_TABLE(cm->bit_depth, inter_minq);
|
||||
const int bit_depth = cm->seq_params.bit_depth;
|
||||
ASSIGN_MINQ_TABLE(bit_depth, inter_minq);
|
||||
|
||||
if (frame_is_intra_only(cm)) {
|
||||
if (oxcf->rc_mode == AOM_Q) {
|
||||
const int qindex = cq_level;
|
||||
const double q_val = av1_convert_qindex_to_q(qindex, cm->bit_depth);
|
||||
const double q_val = av1_convert_qindex_to_q(qindex, bit_depth);
|
||||
const int delta_qindex =
|
||||
av1_compute_qdelta(rc, q_val, q_val * 0.25, cm->bit_depth);
|
||||
av1_compute_qdelta(rc, q_val, q_val * 0.25, bit_depth);
|
||||
active_best_quality = AOMMAX(qindex + delta_qindex, rc->best_quality);
|
||||
} else if (rc->this_key_frame_forced) {
|
||||
const int qindex = rc->last_boosted_qindex;
|
||||
const double last_boosted_q =
|
||||
av1_convert_qindex_to_q(qindex, cm->bit_depth);
|
||||
const double last_boosted_q = av1_convert_qindex_to_q(qindex, bit_depth);
|
||||
const int delta_qindex = av1_compute_qdelta(
|
||||
rc, last_boosted_q, last_boosted_q * 0.75, cm->bit_depth);
|
||||
rc, last_boosted_q, last_boosted_q * 0.75, bit_depth);
|
||||
active_best_quality = AOMMAX(qindex + delta_qindex, rc->best_quality);
|
||||
} else { // not first frame of one pass and kf_boost is set
|
||||
double q_adj_factor = 1.0;
|
||||
|
||||
active_best_quality = get_kf_active_quality(
|
||||
rc, rc->avg_frame_qindex[KEY_FRAME], cm->bit_depth);
|
||||
active_best_quality =
|
||||
get_kf_active_quality(rc, rc->avg_frame_qindex[KEY_FRAME], bit_depth);
|
||||
|
||||
// Allow somewhat lower kf minq with small image formats.
|
||||
if ((width * height) <= (352 * 288)) {
|
||||
|
|
@ -798,9 +799,9 @@ static int rc_pick_q_and_bounds_one_pass_vbr(const AV1_COMP *cpi, int width,
|
|||
// Convert the adjustment factor to a qindex delta on active_best_quality.
|
||||
{
|
||||
const double q_val =
|
||||
av1_convert_qindex_to_q(active_best_quality, cm->bit_depth);
|
||||
av1_convert_qindex_to_q(active_best_quality, bit_depth);
|
||||
active_best_quality +=
|
||||
av1_compute_qdelta(rc, q_val, q_val * q_adj_factor, cm->bit_depth);
|
||||
av1_compute_qdelta(rc, q_val, q_val * q_adj_factor, bit_depth);
|
||||
}
|
||||
}
|
||||
} else if (!rc->is_src_frame_alt_ref &&
|
||||
|
|
@ -815,30 +816,30 @@ static int rc_pick_q_and_bounds_one_pass_vbr(const AV1_COMP *cpi, int width,
|
|||
// For constrained quality dont allow Q less than the cq level
|
||||
if (oxcf->rc_mode == AOM_CQ) {
|
||||
if (q < cq_level) q = cq_level;
|
||||
active_best_quality = get_gf_active_quality(rc, q, cm->bit_depth);
|
||||
active_best_quality = get_gf_active_quality(rc, q, bit_depth);
|
||||
// Constrained quality use slightly lower active best.
|
||||
active_best_quality = active_best_quality * 15 / 16;
|
||||
} else if (oxcf->rc_mode == AOM_Q) {
|
||||
const int qindex = cq_level;
|
||||
const double q_val = av1_convert_qindex_to_q(qindex, cm->bit_depth);
|
||||
const double q_val = av1_convert_qindex_to_q(qindex, bit_depth);
|
||||
const int delta_qindex =
|
||||
(cpi->refresh_alt_ref_frame)
|
||||
? av1_compute_qdelta(rc, q_val, q_val * 0.40, cm->bit_depth)
|
||||
: av1_compute_qdelta(rc, q_val, q_val * 0.50, cm->bit_depth);
|
||||
? av1_compute_qdelta(rc, q_val, q_val * 0.40, bit_depth)
|
||||
: av1_compute_qdelta(rc, q_val, q_val * 0.50, bit_depth);
|
||||
active_best_quality = AOMMAX(qindex + delta_qindex, rc->best_quality);
|
||||
} else {
|
||||
active_best_quality = get_gf_active_quality(rc, q, cm->bit_depth);
|
||||
active_best_quality = get_gf_active_quality(rc, q, bit_depth);
|
||||
}
|
||||
} else {
|
||||
if (oxcf->rc_mode == AOM_Q) {
|
||||
const int qindex = cq_level;
|
||||
const double q_val = av1_convert_qindex_to_q(qindex, cm->bit_depth);
|
||||
const double q_val = av1_convert_qindex_to_q(qindex, bit_depth);
|
||||
const double delta_rate[FIXED_GF_INTERVAL] = { 0.50, 1.0, 0.85, 1.0,
|
||||
0.70, 1.0, 0.85, 1.0 };
|
||||
const int delta_qindex = av1_compute_qdelta(
|
||||
rc, q_val,
|
||||
q_val * delta_rate[cm->current_video_frame % FIXED_GF_INTERVAL],
|
||||
cm->bit_depth);
|
||||
bit_depth);
|
||||
active_best_quality = AOMMAX(qindex + delta_qindex, rc->best_quality);
|
||||
} else {
|
||||
// Use the lower of active_worst_quality and recent/average Q.
|
||||
|
|
@ -868,12 +869,12 @@ static int rc_pick_q_and_bounds_one_pass_vbr(const AV1_COMP *cpi, int width,
|
|||
aom_clear_system_state();
|
||||
if (cm->frame_type == KEY_FRAME && !rc->this_key_frame_forced &&
|
||||
!(cm->current_video_frame == 0)) {
|
||||
qdelta = av1_compute_qdelta_by_rate(
|
||||
&cpi->rc, cm->frame_type, active_worst_quality, 2.0, cm->bit_depth);
|
||||
qdelta = av1_compute_qdelta_by_rate(&cpi->rc, cm->frame_type,
|
||||
active_worst_quality, 2.0, bit_depth);
|
||||
} else if (!rc->is_src_frame_alt_ref &&
|
||||
(cpi->refresh_golden_frame || cpi->refresh_alt_ref_frame)) {
|
||||
qdelta = av1_compute_qdelta_by_rate(
|
||||
&cpi->rc, cm->frame_type, active_worst_quality, 1.75, cm->bit_depth);
|
||||
&cpi->rc, cm->frame_type, active_worst_quality, 1.75, bit_depth);
|
||||
}
|
||||
*top_index = active_worst_quality + qdelta;
|
||||
*top_index = AOMMAX(*top_index, *bottom_index);
|
||||
|
|
@ -908,9 +909,9 @@ int av1_frame_type_qdelta(const AV1_COMP *cpi, int rf_level, int q) {
|
|||
INTER_FRAME, INTER_FRAME, INTER_FRAME, INTER_FRAME, INTER_FRAME, KEY_FRAME
|
||||
};
|
||||
const AV1_COMMON *const cm = &cpi->common;
|
||||
int qdelta =
|
||||
av1_compute_qdelta_by_rate(&cpi->rc, frame_type[rf_level], q,
|
||||
rate_factor_deltas[rf_level], cm->bit_depth);
|
||||
int qdelta = av1_compute_qdelta_by_rate(&cpi->rc, frame_type[rf_level], q,
|
||||
rate_factor_deltas[rf_level],
|
||||
cm->seq_params.bit_depth);
|
||||
return qdelta;
|
||||
}
|
||||
|
||||
|
|
@ -927,7 +928,15 @@ static int rc_pick_q_and_bounds_two_pass(const AV1_COMP *cpi, int width,
|
|||
int active_worst_quality = cpi->twopass.active_worst_quality;
|
||||
int q;
|
||||
int *inter_minq;
|
||||
ASSIGN_MINQ_TABLE(cm->bit_depth, inter_minq);
|
||||
const int bit_depth = cm->seq_params.bit_depth;
|
||||
ASSIGN_MINQ_TABLE(bit_depth, inter_minq);
|
||||
|
||||
#if CUSTOMIZED_GF
|
||||
const int is_intrl_arf_boost =
|
||||
gf_group->update_type[gf_group->index] == INTNL_ARF_UPDATE;
|
||||
#else
|
||||
const int is_intrl_arf_boost = cpi->refresh_alt2_ref_frame;
|
||||
#endif // CUSTOMIZED_GF
|
||||
|
||||
if (frame_is_intra_only(cm)) {
|
||||
// Handle the special case for key frames forced when we have reached
|
||||
|
|
@ -941,16 +950,16 @@ static int rc_pick_q_and_bounds_two_pass(const AV1_COMP *cpi, int width,
|
|||
if (cpi->twopass.last_kfgroup_zeromotion_pct >= STATIC_MOTION_THRESH) {
|
||||
qindex = AOMMIN(rc->last_kf_qindex, rc->last_boosted_qindex);
|
||||
active_best_quality = qindex;
|
||||
last_boosted_q = av1_convert_qindex_to_q(qindex, cm->bit_depth);
|
||||
last_boosted_q = av1_convert_qindex_to_q(qindex, bit_depth);
|
||||
delta_qindex = av1_compute_qdelta(rc, last_boosted_q,
|
||||
last_boosted_q * 1.25, cm->bit_depth);
|
||||
last_boosted_q * 1.25, bit_depth);
|
||||
active_worst_quality =
|
||||
AOMMIN(qindex + delta_qindex, active_worst_quality);
|
||||
} else {
|
||||
qindex = rc->last_boosted_qindex;
|
||||
last_boosted_q = av1_convert_qindex_to_q(qindex, cm->bit_depth);
|
||||
last_boosted_q = av1_convert_qindex_to_q(qindex, bit_depth);
|
||||
delta_qindex = av1_compute_qdelta(rc, last_boosted_q,
|
||||
last_boosted_q * 0.75, cm->bit_depth);
|
||||
last_boosted_q * 0.75, bit_depth);
|
||||
active_best_quality = AOMMAX(qindex + delta_qindex, rc->best_quality);
|
||||
}
|
||||
} else {
|
||||
|
|
@ -960,7 +969,7 @@ static int rc_pick_q_and_bounds_two_pass(const AV1_COMP *cpi, int width,
|
|||
|
||||
// Baseline value derived from cpi->active_worst_quality and kf boost.
|
||||
active_best_quality =
|
||||
get_kf_active_quality(rc, active_worst_quality, cm->bit_depth);
|
||||
get_kf_active_quality(rc, active_worst_quality, bit_depth);
|
||||
|
||||
// Allow somewhat lower kf minq with small image formats.
|
||||
if ((width * height) <= (352 * 288)) {
|
||||
|
|
@ -972,12 +981,12 @@ static int rc_pick_q_and_bounds_two_pass(const AV1_COMP *cpi, int width,
|
|||
|
||||
// Convert the adjustment factor to a qindex delta
|
||||
// on active_best_quality.
|
||||
q_val = av1_convert_qindex_to_q(active_best_quality, cm->bit_depth);
|
||||
q_val = av1_convert_qindex_to_q(active_best_quality, bit_depth);
|
||||
active_best_quality +=
|
||||
av1_compute_qdelta(rc, q_val, q_val * q_adj_factor, cm->bit_depth);
|
||||
av1_compute_qdelta(rc, q_val, q_val * q_adj_factor, bit_depth);
|
||||
}
|
||||
} else if (!rc->is_src_frame_alt_ref &&
|
||||
(cpi->refresh_golden_frame || cpi->refresh_alt2_ref_frame ||
|
||||
(cpi->refresh_golden_frame || is_intrl_arf_boost ||
|
||||
cpi->refresh_alt_ref_frame)) {
|
||||
// Use the lower of active_worst_quality and recent
|
||||
// average Q as basis for GF/ARF best Q limit unless last frame was
|
||||
|
|
@ -992,24 +1001,45 @@ static int rc_pick_q_and_bounds_two_pass(const AV1_COMP *cpi, int width,
|
|||
if (oxcf->rc_mode == AOM_CQ) {
|
||||
if (q < cq_level) q = cq_level;
|
||||
|
||||
active_best_quality = get_gf_active_quality(rc, q, cm->bit_depth);
|
||||
active_best_quality = get_gf_active_quality(rc, q, bit_depth);
|
||||
|
||||
// Constrained quality use slightly lower active best.
|
||||
active_best_quality = active_best_quality * 15 / 16;
|
||||
|
||||
} else if (oxcf->rc_mode == AOM_Q) {
|
||||
if (!cpi->refresh_alt_ref_frame && !cpi->refresh_alt2_ref_frame) {
|
||||
if (!cpi->refresh_alt_ref_frame && !is_intrl_arf_boost) {
|
||||
active_best_quality = cq_level;
|
||||
} else {
|
||||
active_best_quality = get_gf_active_quality(rc, q, cm->bit_depth);
|
||||
|
||||
// Modify best quality for second level arfs. For mode AOM_Q this
|
||||
// becomes the baseline frame q.
|
||||
if (gf_group->rf_level[gf_group->index] == GF_ARF_LOW)
|
||||
active_best_quality = (active_best_quality + cq_level + 1) / 2;
|
||||
active_best_quality = get_gf_active_quality(rc, q, bit_depth);
|
||||
#if USE_SYMM_MULTI_LAYER
|
||||
if (cpi->new_bwdref_update_rule && is_intrl_arf_boost) {
|
||||
int this_height = gf_group->pyramid_level[gf_group->index];
|
||||
while (this_height < gf_group->pyramid_height) {
|
||||
active_best_quality = (active_best_quality + cq_level + 1) / 2;
|
||||
++this_height;
|
||||
}
|
||||
} else {
|
||||
#endif
|
||||
// Modify best quality for second level arfs. For mode AOM_Q this
|
||||
// becomes the baseline frame q.
|
||||
if (gf_group->rf_level[gf_group->index] == GF_ARF_LOW)
|
||||
active_best_quality = (active_best_quality + cq_level + 1) / 2;
|
||||
#if USE_SYMM_MULTI_LAYER
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
active_best_quality = get_gf_active_quality(rc, q, cm->bit_depth);
|
||||
active_best_quality = get_gf_active_quality(rc, q, bit_depth);
|
||||
#if USE_SYMM_MULTI_LAYER
|
||||
if (cpi->new_bwdref_update_rule && is_intrl_arf_boost) {
|
||||
int this_height = gf_group->pyramid_level[gf_group->index];
|
||||
while (this_height < gf_group->pyramid_height) {
|
||||
active_best_quality =
|
||||
(active_best_quality + active_worst_quality + 1) / 2;
|
||||
++this_height;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
if (oxcf->rc_mode == AOM_Q) {
|
||||
|
|
@ -1031,7 +1061,7 @@ static int rc_pick_q_and_bounds_two_pass(const AV1_COMP *cpi, int width,
|
|||
(cpi->twopass.gf_zeromotion_pct < VLOW_MOTION_THRESHOLD)) {
|
||||
if (frame_is_intra_only(cm) ||
|
||||
(!rc->is_src_frame_alt_ref &&
|
||||
(cpi->refresh_golden_frame || cpi->refresh_alt2_ref_frame ||
|
||||
(cpi->refresh_golden_frame || is_intrl_arf_boost ||
|
||||
cpi->refresh_alt_ref_frame))) {
|
||||
active_best_quality -=
|
||||
(cpi->twopass.extend_minq + cpi->twopass.extend_minq_fast);
|
||||
|
|
@ -1056,7 +1086,7 @@ static int rc_pick_q_and_bounds_two_pass(const AV1_COMP *cpi, int width,
|
|||
// Modify active_best_quality for downscaled normal frames.
|
||||
if (av1_frame_scaled(cm) && !frame_is_kf_gf_arf(cpi)) {
|
||||
int qdelta = av1_compute_qdelta_by_rate(
|
||||
rc, cm->frame_type, active_best_quality, 2.0, cm->bit_depth);
|
||||
rc, cm->frame_type, active_best_quality, 2.0, bit_depth);
|
||||
active_best_quality =
|
||||
AOMMAX(active_best_quality + qdelta, rc->best_quality);
|
||||
}
|
||||
|
|
@ -1164,6 +1194,16 @@ static void update_alt_ref_frame_stats(AV1_COMP *cpi) {
|
|||
|
||||
static void update_golden_frame_stats(AV1_COMP *cpi) {
|
||||
RATE_CONTROL *const rc = &cpi->rc;
|
||||
#if CUSTOMIZED_GF
|
||||
const TWO_PASS *const twopass = &cpi->twopass;
|
||||
const GF_GROUP *const gf_group = &twopass->gf_group;
|
||||
const int is_intrnl_arf =
|
||||
cpi->oxcf.pass == 2
|
||||
? gf_group->update_type[gf_group->index] == INTNL_ARF_UPDATE
|
||||
: cpi->refresh_alt2_ref_frame;
|
||||
#else
|
||||
const int is_intnl_arf = cpi->refresh_alt2_ref_frame;
|
||||
#endif
|
||||
|
||||
// Update the Golden frame usage counts.
|
||||
// NOTE(weitinglin): If we use show_existing_frame for an OVERLAY frame,
|
||||
|
|
@ -1184,14 +1224,7 @@ static void update_golden_frame_stats(AV1_COMP *cpi) {
|
|||
} else if (!rc->source_alt_ref_pending) {
|
||||
rc->source_alt_ref_active = 0;
|
||||
}
|
||||
|
||||
// Decrement count down till next gf
|
||||
if (rc->frames_till_gf_update_due > 0) rc->frames_till_gf_update_due--;
|
||||
|
||||
} else if (!cpi->refresh_alt_ref_frame && !cpi->refresh_alt2_ref_frame) {
|
||||
// Decrement count down till next gf
|
||||
if (rc->frames_till_gf_update_due > 0) rc->frames_till_gf_update_due--;
|
||||
|
||||
} else if (!cpi->refresh_alt_ref_frame && !is_intrnl_arf) {
|
||||
rc->frames_since_golden++;
|
||||
}
|
||||
}
|
||||
|
|
@ -1199,6 +1232,17 @@ static void update_golden_frame_stats(AV1_COMP *cpi) {
|
|||
void av1_rc_postencode_update(AV1_COMP *cpi, uint64_t bytes_used) {
|
||||
const AV1_COMMON *const cm = &cpi->common;
|
||||
RATE_CONTROL *const rc = &cpi->rc;
|
||||
#if CUSTOMIZED_GF
|
||||
const TWO_PASS *const twopass = &cpi->twopass;
|
||||
const GF_GROUP *const gf_group = &twopass->gf_group;
|
||||
const int is_intrnl_arf =
|
||||
cpi->oxcf.pass == 2
|
||||
? gf_group->update_type[gf_group->index] == INTNL_ARF_UPDATE
|
||||
: cpi->refresh_alt2_ref_frame;
|
||||
#else
|
||||
const int is_intrnl_arf = cpi->refresh_alt2_ref_frame;
|
||||
#endif
|
||||
|
||||
const int qindex = cm->base_qindex;
|
||||
|
||||
if (cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ && cm->seg.enabled) {
|
||||
|
|
@ -1218,13 +1262,13 @@ void av1_rc_postencode_update(AV1_COMP *cpi, uint64_t bytes_used) {
|
|||
ROUND_POWER_OF_TWO(3 * rc->avg_frame_qindex[KEY_FRAME] + qindex, 2);
|
||||
} else {
|
||||
if (!rc->is_src_frame_alt_ref &&
|
||||
!(cpi->refresh_golden_frame || cpi->refresh_alt2_ref_frame ||
|
||||
!(cpi->refresh_golden_frame || is_intrnl_arf ||
|
||||
cpi->refresh_alt_ref_frame)) {
|
||||
rc->last_q[INTER_FRAME] = qindex;
|
||||
rc->avg_frame_qindex[INTER_FRAME] =
|
||||
ROUND_POWER_OF_TWO(3 * rc->avg_frame_qindex[INTER_FRAME] + qindex, 2);
|
||||
rc->ni_frames++;
|
||||
rc->tot_q += av1_convert_qindex_to_q(qindex, cm->bit_depth);
|
||||
rc->tot_q += av1_convert_qindex_to_q(qindex, cm->seq_params.bit_depth);
|
||||
rc->avg_q = rc->tot_q / rc->ni_frames;
|
||||
// Calculate the average Q for normal inter frames (not key or GFU
|
||||
// frames).
|
||||
|
|
@ -1240,7 +1284,7 @@ void av1_rc_postencode_update(AV1_COMP *cpi, uint64_t bytes_used) {
|
|||
// This is used to help set quality in forced key frames to reduce popping
|
||||
if ((qindex < rc->last_boosted_qindex) || (cm->frame_type == KEY_FRAME) ||
|
||||
(!rc->constrained_gf_group &&
|
||||
(cpi->refresh_alt_ref_frame || cpi->refresh_alt2_ref_frame ||
|
||||
(cpi->refresh_alt_ref_frame || is_intrnl_arf ||
|
||||
(cpi->refresh_golden_frame && !rc->is_src_frame_alt_ref)))) {
|
||||
rc->last_boosted_qindex = qindex;
|
||||
}
|
||||
|
|
@ -1591,6 +1635,10 @@ void av1_rc_set_gf_interval_range(const AV1_COMP *const cpi,
|
|||
if (rc->max_gf_interval > rc->static_scene_max_gf_interval)
|
||||
rc->max_gf_interval = rc->static_scene_max_gf_interval;
|
||||
|
||||
#if FIX_GF_INTERVAL_LENGTH
|
||||
rc->max_gf_interval = FIXED_GF_LENGTH + 1;
|
||||
#endif
|
||||
|
||||
// Clamp min to max
|
||||
rc->min_gf_interval = AOMMIN(rc->min_gf_interval, rc->max_gf_interval);
|
||||
}
|
||||
|
|
|
|||
14
third_party/aom/av1/encoder/ratectrl.h
vendored
14
third_party/aom/av1/encoder/ratectrl.h
vendored
|
|
@ -24,6 +24,20 @@ extern "C" {
|
|||
// Bits Per MB at different Q (Multiplied by 512)
|
||||
#define BPER_MB_NORMBITS 9
|
||||
|
||||
#define CUSTOMIZED_GF 1
|
||||
#define FIX_GF_INTERVAL_LENGTH 0
|
||||
|
||||
#if FIX_GF_INTERVAL_LENGTH
|
||||
#define FIXED_GF_LENGTH 16
|
||||
#define USE_SYMM_MULTI_LAYER 1
|
||||
#else
|
||||
#define USE_SYMM_MULTI_LAYER 0
|
||||
#endif
|
||||
|
||||
#if USE_SYMM_MULTI_LAYER
|
||||
#define USE_MANUAL_GF4_STRUCT 0
|
||||
#endif
|
||||
|
||||
#define MIN_GF_INTERVAL 4
|
||||
#define MAX_GF_INTERVAL 16
|
||||
#define FIXED_GF_INTERVAL 8 // Used in some testing modes only
|
||||
|
|
|
|||
12
third_party/aom/av1/encoder/rd.c
vendored
12
third_party/aom/av1/encoder/rd.c
vendored
|
|
@ -44,9 +44,6 @@
|
|||
|
||||
#define RD_THRESH_POW 1.25
|
||||
|
||||
// Factor to weigh the rate for switchable interp filters.
|
||||
#define SWITCHABLE_INTERP_RATE_FACTOR 1
|
||||
|
||||
// The baseline rd thresholds for breaking out of the rd loop for
|
||||
// certain modes are assumed to be based on 8x8 blocks.
|
||||
// This table is used to correct for block size.
|
||||
|
|
@ -357,9 +354,10 @@ static const int rd_frame_type_factor[FRAME_UPDATE_TYPES] = {
|
|||
};
|
||||
|
||||
int av1_compute_rd_mult(const AV1_COMP *cpi, int qindex) {
|
||||
const int64_t q = av1_dc_quant_Q3(qindex, 0, cpi->common.bit_depth);
|
||||
const int64_t q =
|
||||
av1_dc_quant_Q3(qindex, 0, cpi->common.seq_params.bit_depth);
|
||||
int64_t rdmult = 0;
|
||||
switch (cpi->common.bit_depth) {
|
||||
switch (cpi->common.seq_params.bit_depth) {
|
||||
case AOM_BITS_8: rdmult = 88 * q * q / 24; break;
|
||||
case AOM_BITS_10: rdmult = ROUND_POWER_OF_TWO(88 * q * q / 24, 4); break;
|
||||
case AOM_BITS_12: rdmult = ROUND_POWER_OF_TWO(88 * q * q / 24, 8); break;
|
||||
|
|
@ -394,7 +392,7 @@ static int compute_rd_thresh_factor(int qindex, aom_bit_depth_t bit_depth) {
|
|||
}
|
||||
|
||||
void av1_initialize_me_consts(const AV1_COMP *cpi, MACROBLOCK *x, int qindex) {
|
||||
switch (cpi->common.bit_depth) {
|
||||
switch (cpi->common.seq_params.bit_depth) {
|
||||
case AOM_BITS_8:
|
||||
x->sadperbit16 = sad_per_bit16lut_8[qindex];
|
||||
x->sadperbit4 = sad_per_bit4lut_8[qindex];
|
||||
|
|
@ -420,7 +418,7 @@ static void set_block_thresholds(const AV1_COMMON *cm, RD_OPT *rd) {
|
|||
clamp(av1_get_qindex(&cm->seg, segment_id, cm->base_qindex) +
|
||||
cm->y_dc_delta_q,
|
||||
0, MAXQ);
|
||||
const int q = compute_rd_thresh_factor(qindex, cm->bit_depth);
|
||||
const int q = compute_rd_thresh_factor(qindex, cm->seq_params.bit_depth);
|
||||
|
||||
for (bsize = 0; bsize < BLOCK_SIZES_ALL; ++bsize) {
|
||||
// Threshold here seems unnecessarily harsh but fine given actual
|
||||
|
|
|
|||
3
third_party/aom/av1/encoder/rd.h
vendored
3
third_party/aom/av1/encoder/rd.h
vendored
|
|
@ -43,6 +43,9 @@ extern "C" {
|
|||
#define RD_THRESH_MAX_FACT 64
|
||||
#define RD_THRESH_INC 1
|
||||
|
||||
// Factor to weigh the rate for switchable interp filters.
|
||||
#define SWITCHABLE_INTERP_RATE_FACTOR 1
|
||||
|
||||
// This enumerator type needs to be kept aligned with the mode order in
|
||||
// const MODE_DEFINITION av1_mode_order[MAX_MODES] used in the rd code.
|
||||
typedef enum {
|
||||
|
|
|
|||
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