mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-11 17:57: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
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 {
|
||||
|
|
|
|||
2303
third_party/aom/av1/encoder/rdopt.c
vendored
2303
third_party/aom/av1/encoder/rdopt.c
vendored
File diff suppressed because it is too large
Load diff
8
third_party/aom/av1/encoder/rdopt.h
vendored
8
third_party/aom/av1/encoder/rdopt.h
vendored
|
|
@ -78,8 +78,8 @@ static INLINE int av1_cost_skip_txb(MACROBLOCK *x, const TXB_CTX *const txb_ctx,
|
|||
}
|
||||
|
||||
static INLINE int av1_cost_coeffs(const AV1_COMMON *const cm, MACROBLOCK *x,
|
||||
int plane, int blk_row, int blk_col,
|
||||
int block, TX_SIZE tx_size,
|
||||
int plane, int block, TX_SIZE tx_size,
|
||||
const TX_TYPE tx_type,
|
||||
const TXB_CTX *const txb_ctx,
|
||||
int use_fast_coef_costing) {
|
||||
#if TXCOEFF_COST_TIMER
|
||||
|
|
@ -87,8 +87,8 @@ static INLINE int av1_cost_coeffs(const AV1_COMMON *const cm, MACROBLOCK *x,
|
|||
aom_usec_timer_start(&timer);
|
||||
#endif
|
||||
(void)use_fast_coef_costing;
|
||||
const int cost = av1_cost_coeffs_txb(cm, x, plane, blk_row, blk_col, block,
|
||||
tx_size, txb_ctx);
|
||||
const int cost =
|
||||
av1_cost_coeffs_txb(cm, x, plane, block, tx_size, tx_type, txb_ctx);
|
||||
#if TXCOEFF_COST_TIMER
|
||||
AV1_COMMON *tmp_cm = (AV1_COMMON *)&cpi->common;
|
||||
aom_usec_timer_mark(&timer);
|
||||
|
|
|
|||
43
third_party/aom/av1/encoder/speed_features.c
vendored
43
third_party/aom/av1/encoder/speed_features.c
vendored
|
|
@ -89,9 +89,27 @@ static void set_good_speed_feature_framesize_dependent(AV1_COMP *cpi,
|
|||
SPEED_FEATURES *sf,
|
||||
int speed) {
|
||||
AV1_COMMON *const cm = &cpi->common;
|
||||
const int is_720p_or_larger = AOMMIN(cm->width, cm->height) >= 720;
|
||||
const int is_480p_or_larger = AOMMIN(cm->width, cm->height) >= 480;
|
||||
|
||||
if (is_480p_or_larger) {
|
||||
sf->use_square_partition_only_threshold = BLOCK_128X128;
|
||||
} else {
|
||||
sf->use_square_partition_only_threshold = BLOCK_64X64;
|
||||
}
|
||||
|
||||
if (speed >= 1) {
|
||||
if (is_720p_or_larger) {
|
||||
sf->use_square_partition_only_threshold = BLOCK_128X128;
|
||||
} else if (is_480p_or_larger) {
|
||||
sf->use_square_partition_only_threshold = BLOCK_64X64;
|
||||
} else {
|
||||
sf->use_square_partition_only_threshold = BLOCK_32X32;
|
||||
}
|
||||
}
|
||||
|
||||
if (speed >= 2) {
|
||||
if (AOMMIN(cm->width, cm->height) >= 720) {
|
||||
if (is_720p_or_larger) {
|
||||
sf->disable_split_mask =
|
||||
cm->show_frame ? DISABLE_ALL_SPLIT : DISABLE_ALL_INTER_SPLIT;
|
||||
sf->adaptive_pred_interp_filter = 0;
|
||||
|
|
@ -106,7 +124,7 @@ static void set_good_speed_feature_framesize_dependent(AV1_COMP *cpi,
|
|||
}
|
||||
|
||||
if (speed >= 3) {
|
||||
if (AOMMIN(cm->width, cm->height) >= 720) {
|
||||
if (is_720p_or_larger) {
|
||||
sf->disable_split_mask = DISABLE_ALL_SPLIT;
|
||||
sf->schedule_mode_search = cm->base_qindex < 220 ? 1 : 0;
|
||||
sf->partition_search_breakout_dist_thr = (1 << 25);
|
||||
|
|
@ -130,7 +148,7 @@ static void set_good_speed_feature_framesize_dependent(AV1_COMP *cpi,
|
|||
}
|
||||
|
||||
if (speed >= 4) {
|
||||
if (AOMMIN(cm->width, cm->height) >= 720) {
|
||||
if (is_720p_or_larger) {
|
||||
sf->partition_search_breakout_dist_thr = (1 << 26);
|
||||
} else {
|
||||
sf->partition_search_breakout_dist_thr = (1 << 24);
|
||||
|
|
@ -149,6 +167,7 @@ static void set_good_speed_features_framesize_independent(AV1_COMP *cpi,
|
|||
sf->reduce_inter_modes = 1;
|
||||
sf->prune_ext_partition_types_search_level = 1;
|
||||
sf->ml_prune_ab_partition = 1;
|
||||
sf->ml_prune_4_partition = 1;
|
||||
sf->adaptive_txb_search_level = 1;
|
||||
sf->jnt_comp_skip_mv_search = 1;
|
||||
sf->model_based_prune_tx_search_level = 1;
|
||||
|
|
@ -195,7 +214,9 @@ static void set_good_speed_features_framesize_independent(AV1_COMP *cpi,
|
|||
sf->comp_inter_joint_search_thresh = BLOCK_SIZES_ALL;
|
||||
|
||||
sf->partition_search_breakout_rate_thr = 80;
|
||||
sf->auto_min_max_partition_size = RELAXED_NEIGHBORING_MIN_MAX;
|
||||
// Note: This speed feature is disable as it seems to be worse in
|
||||
// compression/quality and is also slower.
|
||||
// sf->auto_min_max_partition_size = RELAXED_NEIGHBORING_MIN_MAX;
|
||||
sf->allow_partition_search_skip = 1;
|
||||
sf->disable_wedge_search_var_thresh = 100;
|
||||
sf->fast_wedge_sign_estimate = 1;
|
||||
|
|
@ -221,7 +242,8 @@ static void set_good_speed_features_framesize_independent(AV1_COMP *cpi,
|
|||
if (speed >= 4) {
|
||||
sf->tx_type_search.fast_intra_tx_type_search = 1;
|
||||
sf->tx_type_search.fast_inter_tx_type_search = 1;
|
||||
sf->use_square_partition_only = !boosted;
|
||||
sf->use_square_partition_only_threshold =
|
||||
boosted ? BLOCK_128X128 : BLOCK_4X4;
|
||||
sf->tx_size_search_method =
|
||||
frame_is_intra_only(cm) ? USE_FULL_RD : USE_LARGESTALL;
|
||||
sf->mv.subpel_search_method = SUBPEL_TREE_PRUNED;
|
||||
|
|
@ -242,7 +264,7 @@ static void set_good_speed_features_framesize_independent(AV1_COMP *cpi,
|
|||
sf->intra_uv_mode_mask[TX_32X32] = UV_INTRA_DC_H_V_CFL;
|
||||
sf->intra_y_mode_mask[TX_16X16] = INTRA_DC_H_V;
|
||||
sf->intra_uv_mode_mask[TX_16X16] = UV_INTRA_DC_H_V_CFL;
|
||||
sf->use_square_partition_only = 1;
|
||||
sf->use_square_partition_only_threshold = BLOCK_4X4;
|
||||
sf->tx_size_search_method = USE_LARGESTALL;
|
||||
sf->mv.search_method = BIGDIA;
|
||||
sf->mv.subpel_search_method = SUBPEL_TREE_PRUNED_MORE;
|
||||
|
|
@ -363,9 +385,11 @@ static void set_dev_sf(AV1_COMP *cpi, SPEED_FEATURES *sf, int speed) {
|
|||
if (speed & PARTITION_SF) {
|
||||
if ((cpi->twopass.fr_content_type == FC_GRAPHICS_ANIMATION) ||
|
||||
has_internal_image_edge(cpi)) {
|
||||
sf->use_square_partition_only = !frame_is_boosted(cpi);
|
||||
sf->use_square_partition_only_threshold =
|
||||
frame_is_boosted(cpi) ? BLOCK_128X128 : BLOCK_4X4;
|
||||
} else {
|
||||
sf->use_square_partition_only = !frame_is_intra_only(cm);
|
||||
sf->use_square_partition_only_threshold =
|
||||
frame_is_intra_only(cm) ? BLOCK_128X128 : BLOCK_4X4;
|
||||
}
|
||||
sf->less_rectangular_check = 1;
|
||||
sf->prune_ext_partition_types_search_level = 2;
|
||||
|
|
@ -438,7 +462,7 @@ void av1_set_speed_features_framesize_independent(AV1_COMP *cpi) {
|
|||
sf->tx_type_search.skip_tx_search = 0;
|
||||
sf->selective_ref_frame = 0;
|
||||
sf->less_rectangular_check = 0;
|
||||
sf->use_square_partition_only = 0;
|
||||
sf->use_square_partition_only_threshold = BLOCK_128X128;
|
||||
sf->auto_min_max_partition_size = NOT_IN_USE;
|
||||
sf->rd_auto_partition_min_limit = BLOCK_4X4;
|
||||
sf->default_max_partition_size = BLOCK_LARGEST;
|
||||
|
|
@ -493,6 +517,7 @@ void av1_set_speed_features_framesize_independent(AV1_COMP *cpi) {
|
|||
sf->simple_model_rd_from_var = 0;
|
||||
sf->prune_ext_partition_types_search_level = 0;
|
||||
sf->ml_prune_ab_partition = 0;
|
||||
sf->ml_prune_4_partition = 0;
|
||||
sf->fast_cdef_search = 0;
|
||||
|
||||
// Set this at the appropriate speed levels
|
||||
|
|
|
|||
7
third_party/aom/av1/encoder/speed_features.h
vendored
7
third_party/aom/av1/encoder/speed_features.h
vendored
|
|
@ -400,6 +400,9 @@ typedef struct SPEED_FEATURES {
|
|||
// Use a ML model to prune horz_a, horz_b, vert_a and vert_b partitions.
|
||||
int ml_prune_ab_partition;
|
||||
|
||||
// Use a ML model to prune horz4 and vert4 partitions.
|
||||
int ml_prune_4_partition;
|
||||
|
||||
int fast_cdef_search;
|
||||
|
||||
// 2-pass coding block partition search
|
||||
|
|
@ -413,8 +416,8 @@ typedef struct SPEED_FEATURES {
|
|||
// rd than partition type split.
|
||||
int less_rectangular_check;
|
||||
|
||||
// Disable testing non square partitions. (eg 16x32)
|
||||
int use_square_partition_only;
|
||||
// Use square partition only beyond this block size.
|
||||
BLOCK_SIZE use_square_partition_only_threshold;
|
||||
|
||||
// Sets min and max partition sizes for this superblock based on the
|
||||
// same superblock in last encoded frame, and the left and above neighbor.
|
||||
|
|
|
|||
|
|
@ -535,10 +535,10 @@ static void adjust_arnr_filter(AV1_COMP *cpi, int distance, int group_boost,
|
|||
// Adjust the strength based on active max q.
|
||||
if (cpi->common.current_video_frame > 1)
|
||||
q = ((int)av1_convert_qindex_to_q(cpi->rc.avg_frame_qindex[INTER_FRAME],
|
||||
cpi->common.bit_depth));
|
||||
cpi->common.seq_params.bit_depth));
|
||||
else
|
||||
q = ((int)av1_convert_qindex_to_q(cpi->rc.avg_frame_qindex[KEY_FRAME],
|
||||
cpi->common.bit_depth));
|
||||
cpi->common.seq_params.bit_depth));
|
||||
if (q > 16) {
|
||||
strength = oxcf->arnr_strength;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -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/encoder/x86/av1_txfm1d_sse4.h"
|
||||
|
||||
void av1_fdct32_new_sse4_1(const __m128i *input, __m128i *output,
|
||||
|
|
|
|||
2068
third_party/aom/av1/encoder/x86/av1_fwd_txfm2d_avx2.c
vendored
Normal file
2068
third_party/aom/av1/encoder/x86/av1_fwd_txfm2d_avx2.c
vendored
Normal file
File diff suppressed because it is too large
Load diff
103
third_party/aom/av1/encoder/x86/av1_fwd_txfm_avx2.h
vendored
Normal file
103
third_party/aom/av1/encoder/x86/av1_fwd_txfm_avx2.h
vendored
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
/*
|
||||
* 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_FWD_TXFM_AVX2_H_
|
||||
#define AV1_FWD_TXFM_AVX2_H_
|
||||
#include <immintrin.h>
|
||||
|
||||
static INLINE __m256i av1_round_shift_32_avx2(__m256i vec, int bit) {
|
||||
__m256i tmp, round;
|
||||
round = _mm256_set1_epi32(1 << (bit - 1));
|
||||
tmp = _mm256_add_epi32(vec, round);
|
||||
return _mm256_srai_epi32(tmp, bit);
|
||||
}
|
||||
|
||||
// out0 = in0*w0 + in1*w1
|
||||
// out1 = -in1*w0 + in0*w1
|
||||
static INLINE void btf_32_avx2_type0(const int32_t w0, const int32_t w1,
|
||||
__m256i *in0, __m256i *in1,
|
||||
const __m256i _r, const int32_t cos_bit) {
|
||||
__m256i _in0 = *in0;
|
||||
__m256i _in1 = *in1;
|
||||
const __m256i ww0 = _mm256_set1_epi32(w0);
|
||||
const __m256i ww1 = _mm256_set1_epi32(w1);
|
||||
const __m256i in0_w0 = _mm256_mullo_epi32(_in0, ww0);
|
||||
const __m256i in1_w1 = _mm256_mullo_epi32(_in1, ww1);
|
||||
__m256i temp0 = _mm256_add_epi32(in0_w0, in1_w1);
|
||||
temp0 = _mm256_add_epi32(temp0, _r);
|
||||
*in0 = _mm256_srai_epi32(temp0, cos_bit);
|
||||
const __m256i in0_w1 = _mm256_mullo_epi32(_in0, ww1);
|
||||
const __m256i in1_w0 = _mm256_mullo_epi32(_in1, ww0);
|
||||
__m256i temp1 = _mm256_sub_epi32(in0_w1, in1_w0);
|
||||
temp1 = _mm256_add_epi32(temp1, _r);
|
||||
*in1 = _mm256_srai_epi32(temp1, cos_bit);
|
||||
}
|
||||
|
||||
static INLINE void btf_32_avx2_type1(const int32_t w0, const int32_t w1,
|
||||
__m256i *in0, __m256i *in1,
|
||||
const __m256i _r, const int32_t cos_bit) {
|
||||
__m256i _in0 = *in0;
|
||||
__m256i _in1 = *in1;
|
||||
const __m256i ww0 = _mm256_set1_epi32(w0);
|
||||
const __m256i ww1 = _mm256_set1_epi32(w1);
|
||||
const __m256i in0_w0 = _mm256_mullo_epi32(_in0, ww0);
|
||||
const __m256i in1_w1 = _mm256_mullo_epi32(_in1, ww1);
|
||||
__m256i temp0 = _mm256_add_epi32(in0_w0, in1_w1);
|
||||
temp0 = _mm256_add_epi32(temp0, _r);
|
||||
*in0 = _mm256_srai_epi32(temp0, cos_bit);
|
||||
const __m256i in0_w1 = _mm256_mullo_epi32(_in0, ww1);
|
||||
const __m256i in1_w0 = _mm256_mullo_epi32(_in1, ww0);
|
||||
__m256i temp1 = _mm256_sub_epi32(in1_w0, in0_w1);
|
||||
temp1 = _mm256_add_epi32(temp1, _r);
|
||||
*in1 = _mm256_srai_epi32(temp1, cos_bit);
|
||||
}
|
||||
|
||||
// out0 = in0*w0 + in1*w1
|
||||
// out1 = -in1*w0 + in0*w1
|
||||
static INLINE void btf_32_avx2_type0_new(const __m256i ww0, const __m256i ww1,
|
||||
__m256i *in0, __m256i *in1,
|
||||
const __m256i _r,
|
||||
const int32_t cos_bit) {
|
||||
__m256i _in0 = *in0;
|
||||
__m256i _in1 = *in1;
|
||||
const __m256i in0_w0 = _mm256_mullo_epi32(_in0, ww0);
|
||||
const __m256i in1_w1 = _mm256_mullo_epi32(_in1, ww1);
|
||||
__m256i temp0 = _mm256_add_epi32(in0_w0, in1_w1);
|
||||
temp0 = _mm256_add_epi32(temp0, _r);
|
||||
*in0 = _mm256_srai_epi32(temp0, cos_bit);
|
||||
const __m256i in0_w1 = _mm256_mullo_epi32(_in0, ww1);
|
||||
const __m256i in1_w0 = _mm256_mullo_epi32(_in1, ww0);
|
||||
__m256i temp1 = _mm256_sub_epi32(in0_w1, in1_w0);
|
||||
temp1 = _mm256_add_epi32(temp1, _r);
|
||||
*in1 = _mm256_srai_epi32(temp1, cos_bit);
|
||||
}
|
||||
|
||||
// out0 = in0*w0 + in1*w1
|
||||
// out1 = in1*w0 - in0*w1
|
||||
static INLINE void btf_32_avx2_type1_new(const __m256i ww0, const __m256i ww1,
|
||||
__m256i *in0, __m256i *in1,
|
||||
const __m256i _r,
|
||||
const int32_t cos_bit) {
|
||||
__m256i _in0 = *in0;
|
||||
__m256i _in1 = *in1;
|
||||
const __m256i in0_w0 = _mm256_mullo_epi32(_in0, ww0);
|
||||
const __m256i in1_w1 = _mm256_mullo_epi32(_in1, ww1);
|
||||
__m256i temp0 = _mm256_add_epi32(in0_w0, in1_w1);
|
||||
temp0 = _mm256_add_epi32(temp0, _r);
|
||||
*in0 = _mm256_srai_epi32(temp0, cos_bit);
|
||||
const __m256i in0_w1 = _mm256_mullo_epi32(_in0, ww1);
|
||||
const __m256i in1_w0 = _mm256_mullo_epi32(_in1, ww0);
|
||||
__m256i temp1 = _mm256_sub_epi32(in1_w0, in0_w1);
|
||||
temp1 = _mm256_add_epi32(temp1, _r);
|
||||
*in1 = _mm256_srai_epi32(temp1, cos_bit);
|
||||
}
|
||||
|
||||
#endif // AV1_FWD_TXFM_AVX2_H_
|
||||
|
|
@ -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 <stdlib.h>
|
||||
#include <memory.h>
|
||||
#include <math.h>
|
||||
|
|
|
|||
215
third_party/aom/av1/encoder/x86/wedge_utils_avx2.c
vendored
Normal file
215
third_party/aom/av1/encoder/x86/wedge_utils_avx2.c
vendored
Normal file
|
|
@ -0,0 +1,215 @@
|
|||
/*
|
||||
* 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 <immintrin.h>
|
||||
#include <smmintrin.h>
|
||||
|
||||
#include "aom_dsp/x86/synonyms.h"
|
||||
|
||||
#include "aom/aom_integer.h"
|
||||
|
||||
#include "av1/common/reconinter.h"
|
||||
|
||||
#define MAX_MASK_VALUE (1 << WEDGE_WEIGHT_BITS)
|
||||
|
||||
/**
|
||||
* See av1_wedge_sse_from_residuals_c
|
||||
*/
|
||||
uint64_t av1_wedge_sse_from_residuals_avx2(const int16_t *r1, const int16_t *d,
|
||||
const uint8_t *m, int N) {
|
||||
int n = -N;
|
||||
|
||||
uint64_t csse;
|
||||
|
||||
const __m256i v_mask_max_w = _mm256_set1_epi16(MAX_MASK_VALUE);
|
||||
const __m256i v_zext_q = _mm256_set1_epi64x(0xffffffff);
|
||||
|
||||
__m256i v_acc0_q = _mm256_setzero_si256();
|
||||
|
||||
assert(N % 64 == 0);
|
||||
|
||||
r1 += N;
|
||||
d += N;
|
||||
m += N;
|
||||
|
||||
do {
|
||||
const __m256i v_r0_w = _mm256_lddqu_si256((__m256i *)(r1 + n));
|
||||
const __m256i v_d0_w = _mm256_lddqu_si256((__m256i *)(d + n));
|
||||
const __m128i v_m01_b = _mm_lddqu_si128((__m128i *)(m + n));
|
||||
|
||||
const __m256i v_rd0l_w = _mm256_unpacklo_epi16(v_d0_w, v_r0_w);
|
||||
const __m256i v_rd0h_w = _mm256_unpackhi_epi16(v_d0_w, v_r0_w);
|
||||
const __m256i v_m0_w = _mm256_cvtepu8_epi16(v_m01_b);
|
||||
|
||||
const __m256i v_m0l_w = _mm256_unpacklo_epi16(v_m0_w, v_mask_max_w);
|
||||
const __m256i v_m0h_w = _mm256_unpackhi_epi16(v_m0_w, v_mask_max_w);
|
||||
|
||||
const __m256i v_t0l_d = _mm256_madd_epi16(v_rd0l_w, v_m0l_w);
|
||||
const __m256i v_t0h_d = _mm256_madd_epi16(v_rd0h_w, v_m0h_w);
|
||||
|
||||
const __m256i v_t0_w = _mm256_packs_epi32(v_t0l_d, v_t0h_d);
|
||||
|
||||
const __m256i v_sq0_d = _mm256_madd_epi16(v_t0_w, v_t0_w);
|
||||
|
||||
const __m256i v_sum0_q = _mm256_add_epi64(
|
||||
_mm256_and_si256(v_sq0_d, v_zext_q), _mm256_srli_epi64(v_sq0_d, 32));
|
||||
|
||||
v_acc0_q = _mm256_add_epi64(v_acc0_q, v_sum0_q);
|
||||
|
||||
n += 16;
|
||||
} while (n);
|
||||
|
||||
v_acc0_q = _mm256_add_epi64(v_acc0_q, _mm256_srli_si256(v_acc0_q, 8));
|
||||
__m128i v_acc_q_0 = _mm256_castsi256_si128(v_acc0_q);
|
||||
__m128i v_acc_q_1 = _mm256_extracti128_si256(v_acc0_q, 1);
|
||||
v_acc_q_0 = _mm_add_epi64(v_acc_q_0, v_acc_q_1);
|
||||
#if ARCH_X86_64
|
||||
csse = (uint64_t)_mm_extract_epi64(v_acc_q_0, 0);
|
||||
#else
|
||||
xx_storel_64(&csse, v_acc_q_0);
|
||||
#endif
|
||||
|
||||
return ROUND_POWER_OF_TWO(csse, 2 * WEDGE_WEIGHT_BITS);
|
||||
}
|
||||
|
||||
/**
|
||||
* See av1_wedge_sign_from_residuals_c
|
||||
*/
|
||||
int av1_wedge_sign_from_residuals_avx2(const int16_t *ds, const uint8_t *m,
|
||||
int N, int64_t limit) {
|
||||
int64_t acc;
|
||||
__m256i v_acc0_d = _mm256_setzero_si256();
|
||||
|
||||
// Input size limited to 8192 by the use of 32 bit accumulators and m
|
||||
// being between [0, 64]. Overflow might happen at larger sizes,
|
||||
// though it is practically impossible on real video input.
|
||||
assert(N < 8192);
|
||||
assert(N % 64 == 0);
|
||||
|
||||
do {
|
||||
const __m256i v_m01_b = _mm256_lddqu_si256((__m256i *)(m));
|
||||
const __m256i v_m23_b = _mm256_lddqu_si256((__m256i *)(m + 32));
|
||||
|
||||
const __m256i v_d0_w = _mm256_lddqu_si256((__m256i *)(ds));
|
||||
const __m256i v_d1_w = _mm256_lddqu_si256((__m256i *)(ds + 16));
|
||||
const __m256i v_d2_w = _mm256_lddqu_si256((__m256i *)(ds + 32));
|
||||
const __m256i v_d3_w = _mm256_lddqu_si256((__m256i *)(ds + 48));
|
||||
|
||||
const __m256i v_m0_w =
|
||||
_mm256_cvtepu8_epi16(_mm256_castsi256_si128(v_m01_b));
|
||||
const __m256i v_m1_w =
|
||||
_mm256_cvtepu8_epi16(_mm256_extracti128_si256(v_m01_b, 1));
|
||||
const __m256i v_m2_w =
|
||||
_mm256_cvtepu8_epi16(_mm256_castsi256_si128(v_m23_b));
|
||||
const __m256i v_m3_w =
|
||||
_mm256_cvtepu8_epi16(_mm256_extracti128_si256(v_m23_b, 1));
|
||||
|
||||
const __m256i v_p0_d = _mm256_madd_epi16(v_d0_w, v_m0_w);
|
||||
const __m256i v_p1_d = _mm256_madd_epi16(v_d1_w, v_m1_w);
|
||||
const __m256i v_p2_d = _mm256_madd_epi16(v_d2_w, v_m2_w);
|
||||
const __m256i v_p3_d = _mm256_madd_epi16(v_d3_w, v_m3_w);
|
||||
|
||||
const __m256i v_p01_d = _mm256_add_epi32(v_p0_d, v_p1_d);
|
||||
const __m256i v_p23_d = _mm256_add_epi32(v_p2_d, v_p3_d);
|
||||
|
||||
const __m256i v_p0123_d = _mm256_add_epi32(v_p01_d, v_p23_d);
|
||||
|
||||
v_acc0_d = _mm256_add_epi32(v_acc0_d, v_p0123_d);
|
||||
|
||||
ds += 64;
|
||||
m += 64;
|
||||
|
||||
N -= 64;
|
||||
} while (N);
|
||||
|
||||
__m256i v_sign_d = _mm256_srai_epi32(v_acc0_d, 31);
|
||||
v_acc0_d = _mm256_add_epi64(_mm256_unpacklo_epi32(v_acc0_d, v_sign_d),
|
||||
_mm256_unpackhi_epi32(v_acc0_d, v_sign_d));
|
||||
|
||||
__m256i v_acc_q = _mm256_add_epi64(v_acc0_d, _mm256_srli_si256(v_acc0_d, 8));
|
||||
|
||||
__m128i v_acc_q_0 = _mm256_castsi256_si128(v_acc_q);
|
||||
__m128i v_acc_q_1 = _mm256_extracti128_si256(v_acc_q, 1);
|
||||
v_acc_q_0 = _mm_add_epi64(v_acc_q_0, v_acc_q_1);
|
||||
|
||||
#if ARCH_X86_64
|
||||
acc = (uint64_t)_mm_extract_epi64(v_acc_q_0, 0);
|
||||
#else
|
||||
xx_storel_64(&acc, v_acc_q_0);
|
||||
#endif
|
||||
|
||||
return acc > limit;
|
||||
}
|
||||
|
||||
/**
|
||||
* av1_wedge_compute_delta_squares_c
|
||||
*/
|
||||
void av1_wedge_compute_delta_squares_avx2(int16_t *d, const int16_t *a,
|
||||
const int16_t *b, int N) {
|
||||
const __m256i v_neg_w = _mm256_set1_epi32(0xffff0001);
|
||||
|
||||
assert(N % 64 == 0);
|
||||
|
||||
do {
|
||||
const __m256i v_a0_w = _mm256_lddqu_si256((__m256i *)(a));
|
||||
const __m256i v_b0_w = _mm256_lddqu_si256((__m256i *)(b));
|
||||
const __m256i v_a1_w = _mm256_lddqu_si256((__m256i *)(a + 16));
|
||||
const __m256i v_b1_w = _mm256_lddqu_si256((__m256i *)(b + 16));
|
||||
const __m256i v_a2_w = _mm256_lddqu_si256((__m256i *)(a + 32));
|
||||
const __m256i v_b2_w = _mm256_lddqu_si256((__m256i *)(b + 32));
|
||||
const __m256i v_a3_w = _mm256_lddqu_si256((__m256i *)(a + 48));
|
||||
const __m256i v_b3_w = _mm256_lddqu_si256((__m256i *)(b + 48));
|
||||
|
||||
const __m256i v_ab0l_w = _mm256_unpacklo_epi16(v_a0_w, v_b0_w);
|
||||
const __m256i v_ab0h_w = _mm256_unpackhi_epi16(v_a0_w, v_b0_w);
|
||||
const __m256i v_ab1l_w = _mm256_unpacklo_epi16(v_a1_w, v_b1_w);
|
||||
const __m256i v_ab1h_w = _mm256_unpackhi_epi16(v_a1_w, v_b1_w);
|
||||
const __m256i v_ab2l_w = _mm256_unpacklo_epi16(v_a2_w, v_b2_w);
|
||||
const __m256i v_ab2h_w = _mm256_unpackhi_epi16(v_a2_w, v_b2_w);
|
||||
const __m256i v_ab3l_w = _mm256_unpacklo_epi16(v_a3_w, v_b3_w);
|
||||
const __m256i v_ab3h_w = _mm256_unpackhi_epi16(v_a3_w, v_b3_w);
|
||||
|
||||
// Negate top word of pairs
|
||||
const __m256i v_abl0n_w = _mm256_sign_epi16(v_ab0l_w, v_neg_w);
|
||||
const __m256i v_abh0n_w = _mm256_sign_epi16(v_ab0h_w, v_neg_w);
|
||||
const __m256i v_abl1n_w = _mm256_sign_epi16(v_ab1l_w, v_neg_w);
|
||||
const __m256i v_abh1n_w = _mm256_sign_epi16(v_ab1h_w, v_neg_w);
|
||||
const __m256i v_abl2n_w = _mm256_sign_epi16(v_ab2l_w, v_neg_w);
|
||||
const __m256i v_abh2n_w = _mm256_sign_epi16(v_ab2h_w, v_neg_w);
|
||||
const __m256i v_abl3n_w = _mm256_sign_epi16(v_ab3l_w, v_neg_w);
|
||||
const __m256i v_abh3n_w = _mm256_sign_epi16(v_ab3h_w, v_neg_w);
|
||||
|
||||
const __m256i v_r0l_w = _mm256_madd_epi16(v_ab0l_w, v_abl0n_w);
|
||||
const __m256i v_r0h_w = _mm256_madd_epi16(v_ab0h_w, v_abh0n_w);
|
||||
const __m256i v_r1l_w = _mm256_madd_epi16(v_ab1l_w, v_abl1n_w);
|
||||
const __m256i v_r1h_w = _mm256_madd_epi16(v_ab1h_w, v_abh1n_w);
|
||||
const __m256i v_r2l_w = _mm256_madd_epi16(v_ab2l_w, v_abl2n_w);
|
||||
const __m256i v_r2h_w = _mm256_madd_epi16(v_ab2h_w, v_abh2n_w);
|
||||
const __m256i v_r3l_w = _mm256_madd_epi16(v_ab3l_w, v_abl3n_w);
|
||||
const __m256i v_r3h_w = _mm256_madd_epi16(v_ab3h_w, v_abh3n_w);
|
||||
|
||||
const __m256i v_r0_w = _mm256_packs_epi32(v_r0l_w, v_r0h_w);
|
||||
const __m256i v_r1_w = _mm256_packs_epi32(v_r1l_w, v_r1h_w);
|
||||
const __m256i v_r2_w = _mm256_packs_epi32(v_r2l_w, v_r2h_w);
|
||||
const __m256i v_r3_w = _mm256_packs_epi32(v_r3l_w, v_r3h_w);
|
||||
|
||||
_mm256_store_si256((__m256i *)(d), v_r0_w);
|
||||
_mm256_store_si256((__m256i *)(d + 16), v_r1_w);
|
||||
_mm256_store_si256((__m256i *)(d + 32), v_r2_w);
|
||||
_mm256_store_si256((__m256i *)(d + 48), v_r3_w);
|
||||
|
||||
a += 64;
|
||||
b += 64;
|
||||
d += 64;
|
||||
N -= 64;
|
||||
} while (N);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue