mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-11-13 13:07:06 +00:00
[libvpx] Update to v1.12.0
This commit is contained in:
1 parent
287a71dc66
commit
b5046d2a76
572 files changed
+52900
-29493
No files matched your search
@@ -19,7 +19,7 @@
|
||||
#include "vpx/vpx_codec.h"
|
||||
#include "vpx_dsp/vpx_dsp_common.h"
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
#include "vpx_ports/mem.h"
|
||||
#include "vpx_ports/compiler_attributes.h"
|
||||
|
||||
#include "vp9/common/vp9_blockd.h"
|
||||
#include "vp9/common/vp9_common.h"
|
||||
@@ -771,24 +771,27 @@ static void block_yrd(VP9_COMP *cpi, MACROBLOCK *x, RD_COST *this_rdc,
|
||||
const int16_t *src_diff;
|
||||
src_diff = &p->src_diff[(r * diff_stride + c) << 2];
|
||||
|
||||
// skip block condition should be handled before this is called.
|
||||
assert(!x->skip_block);
|
||||
|
||||
switch (tx_size) {
|
||||
case TX_16X16:
|
||||
vpx_hadamard_16x16(src_diff, diff_stride, coeff);
|
||||
vp9_quantize_fp(coeff, 256, x->skip_block, p->round_fp, p->quant_fp,
|
||||
qcoeff, dqcoeff, pd->dequant, eob, scan_order->scan,
|
||||
vp9_quantize_fp(coeff, 256, p->round_fp, p->quant_fp, qcoeff,
|
||||
dqcoeff, pd->dequant, eob, scan_order->scan,
|
||||
scan_order->iscan);
|
||||
break;
|
||||
case TX_8X8:
|
||||
vpx_hadamard_8x8(src_diff, diff_stride, coeff);
|
||||
vp9_quantize_fp(coeff, 64, x->skip_block, p->round_fp, p->quant_fp,
|
||||
qcoeff, dqcoeff, pd->dequant, eob, scan_order->scan,
|
||||
vp9_quantize_fp(coeff, 64, p->round_fp, p->quant_fp, qcoeff,
|
||||
dqcoeff, pd->dequant, eob, scan_order->scan,
|
||||
scan_order->iscan);
|
||||
break;
|
||||
default:
|
||||
assert(tx_size == TX_4X4);
|
||||
x->fwd_txfm4x4(src_diff, coeff, diff_stride);
|
||||
vp9_quantize_fp(coeff, 16, x->skip_block, p->round_fp, p->quant_fp,
|
||||
qcoeff, dqcoeff, pd->dequant, eob, scan_order->scan,
|
||||
vp9_quantize_fp(coeff, 16, p->round_fp, p->quant_fp, qcoeff,
|
||||
dqcoeff, pd->dequant, eob, scan_order->scan,
|
||||
scan_order->iscan);
|
||||
break;
|
||||
}
|
||||
@@ -1127,7 +1130,7 @@ static INLINE void update_thresh_freq_fact_row_mt(
|
||||
}
|
||||
|
||||
static INLINE void update_thresh_freq_fact(
|
||||
VP9_COMP *cpi, TileDataEnc *tile_data, int source_variance,
|
||||
VP9_COMP *cpi, TileDataEnc *tile_data, unsigned int source_variance,
|
||||
BLOCK_SIZE bsize, MV_REFERENCE_FRAME ref_frame, THR_MODES best_mode_idx,
|
||||
PREDICTION_MODE mode) {
|
||||
THR_MODES thr_mode_idx = mode_idx[ref_frame][mode_offset(mode)];
|
||||
@@ -1247,7 +1250,7 @@ static INLINE void find_predictors(
|
||||
VP9_COMP *cpi, MACROBLOCK *x, MV_REFERENCE_FRAME ref_frame,
|
||||
int_mv frame_mv[MB_MODE_COUNT][MAX_REF_FRAMES],
|
||||
int const_motion[MAX_REF_FRAMES], int *ref_frame_skip_mask,
|
||||
const int flag_list[4], TileDataEnc *tile_data, int mi_row, int mi_col,
|
||||
TileDataEnc *tile_data, int mi_row, int mi_col,
|
||||
struct buf_2d yv12_mb[4][MAX_MB_PLANE], BLOCK_SIZE bsize,
|
||||
int force_skip_low_temp_var, int comp_pred_allowed) {
|
||||
VP9_COMMON *const cm = &cpi->common;
|
||||
@@ -1259,7 +1262,7 @@ static INLINE void find_predictors(
|
||||
frame_mv[NEWMV][ref_frame].as_int = INVALID_MV;
|
||||
frame_mv[ZEROMV][ref_frame].as_int = 0;
|
||||
// this needs various further optimizations. to be continued..
|
||||
if ((cpi->ref_frame_flags & flag_list[ref_frame]) && (yv12 != NULL)) {
|
||||
if ((cpi->ref_frame_flags & ref_frame_to_flag(ref_frame)) && (yv12 != NULL)) {
|
||||
int_mv *const candidates = x->mbmi_ext->ref_mvs[ref_frame];
|
||||
const struct scale_factors *const sf = &cm->frame_refs[ref_frame - 1].sf;
|
||||
vp9_setup_pred_block(xd, yv12_mb[ref_frame], yv12, mi_row, mi_col, sf, sf);
|
||||
@@ -1501,7 +1504,8 @@ static void search_filter_ref(VP9_COMP *cpi, MACROBLOCK *x, RD_COST *this_rdc,
|
||||
int best_early_term = 0;
|
||||
int best_flag_preduv_computed[2] = { 0 };
|
||||
INTERP_FILTER filter_start = force_smooth_filter ? EIGHTTAP_SMOOTH : EIGHTTAP;
|
||||
for (filter = filter_start; filter <= EIGHTTAP_SMOOTH; ++filter) {
|
||||
INTERP_FILTER filter_end = EIGHTTAP_SMOOTH;
|
||||
for (filter = filter_start; filter <= filter_end; ++filter) {
|
||||
int64_t cost;
|
||||
mi->interp_filter = filter;
|
||||
vp9_build_inter_predictors_sby(xd, mi_row, mi_col, bsize);
|
||||
@@ -1531,9 +1535,11 @@ static void search_filter_ref(VP9_COMP *cpi, MACROBLOCK *x, RD_COST *this_rdc,
|
||||
free_pred_buffer(*this_mode_pred);
|
||||
*this_mode_pred = current_pred;
|
||||
}
|
||||
current_pred = &tmp[get_pred_buffer(tmp, 3)];
|
||||
pd->dst.buf = current_pred->data;
|
||||
pd->dst.stride = bw;
|
||||
if (filter != filter_end) {
|
||||
current_pred = &tmp[get_pred_buffer(tmp, 3)];
|
||||
pd->dst.buf = current_pred->data;
|
||||
pd->dst.stride = bw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1554,6 +1560,9 @@ static void search_filter_ref(VP9_COMP *cpi, MACROBLOCK *x, RD_COST *this_rdc,
|
||||
if (reuse_inter_pred) {
|
||||
pd->dst.buf = (*this_mode_pred)->data;
|
||||
pd->dst.stride = (*this_mode_pred)->stride;
|
||||
} else if (best_filter < filter_end) {
|
||||
mi->interp_filter = best_filter;
|
||||
vp9_build_inter_predictors_sby(xd, mi_row, mi_col, bsize);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1684,8 +1693,6 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, TileDataEnc *tile_data,
|
||||
int_mv frame_mv[MB_MODE_COUNT][MAX_REF_FRAMES];
|
||||
uint8_t mode_checked[MB_MODE_COUNT][MAX_REF_FRAMES];
|
||||
struct buf_2d yv12_mb[4][MAX_MB_PLANE];
|
||||
static const int flag_list[4] = { 0, VP9_LAST_FLAG, VP9_GOLD_FLAG,
|
||||
VP9_ALT_FLAG };
|
||||
RD_COST this_rdc, best_rdc;
|
||||
// var_y and sse_y are saved to be used in skipping checking
|
||||
unsigned int var_y = UINT_MAX;
|
||||
@@ -1713,9 +1720,9 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, TileDataEnc *tile_data,
|
||||
// process.
|
||||
// tmp[3] points to dst buffer, and the other 3 point to allocated buffers.
|
||||
PRED_BUFFER tmp[4];
|
||||
DECLARE_ALIGNED(16, uint8_t, pred_buf[3 * 64 * 64]);
|
||||
DECLARE_ALIGNED(16, uint8_t, pred_buf[3 * 64 * 64] VPX_UNINITIALIZED);
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
DECLARE_ALIGNED(16, uint16_t, pred_buf_16[3 * 64 * 64]);
|
||||
DECLARE_ALIGNED(16, uint16_t, pred_buf_16[3 * 64 * 64] VPX_UNINITIALIZED);
|
||||
#endif
|
||||
struct buf_2d orig_dst = pd->dst;
|
||||
PRED_BUFFER *this_mode_pred = NULL;
|
||||
@@ -1919,14 +1926,14 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, TileDataEnc *tile_data,
|
||||
// constrain the inter mode to only test zero motion.
|
||||
if (cpi->use_svc && svc->force_zero_mode_spatial_ref &&
|
||||
svc->spatial_layer_id > 0 && !gf_temporal_ref) {
|
||||
if (cpi->ref_frame_flags & flag_list[LAST_FRAME]) {
|
||||
if (cpi->ref_frame_flags & VP9_LAST_FLAG) {
|
||||
struct scale_factors *const sf = &cm->frame_refs[LAST_FRAME - 1].sf;
|
||||
if (vp9_is_scaled(sf)) {
|
||||
svc_force_zero_mode[LAST_FRAME - 1] = 1;
|
||||
inter_layer_ref = LAST_FRAME;
|
||||
}
|
||||
}
|
||||
if (cpi->ref_frame_flags & flag_list[GOLDEN_FRAME]) {
|
||||
if (cpi->ref_frame_flags & VP9_GOLD_FLAG) {
|
||||
struct scale_factors *const sf = &cm->frame_refs[GOLDEN_FRAME - 1].sf;
|
||||
if (vp9_is_scaled(sf)) {
|
||||
svc_force_zero_mode[GOLDEN_FRAME - 1] = 1;
|
||||
@@ -1951,7 +1958,7 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, TileDataEnc *tile_data,
|
||||
cpi->rc.avg_frame_low_motion < 60))
|
||||
usable_ref_frame = LAST_FRAME;
|
||||
|
||||
if (!((cpi->ref_frame_flags & flag_list[GOLDEN_FRAME]) &&
|
||||
if (!((cpi->ref_frame_flags & VP9_GOLD_FLAG) &&
|
||||
!svc_force_zero_mode[GOLDEN_FRAME - 1] && !force_skip_low_temp_var))
|
||||
use_golden_nonzeromv = 0;
|
||||
|
||||
@@ -1979,12 +1986,11 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, TileDataEnc *tile_data,
|
||||
// Skip find_predictor if the reference frame is not in the
|
||||
// ref_frame_flags (i.e., not used as a reference for this frame).
|
||||
skip_ref_find_pred[ref_frame] =
|
||||
!(cpi->ref_frame_flags & flag_list[ref_frame]);
|
||||
!(cpi->ref_frame_flags & ref_frame_to_flag(ref_frame));
|
||||
if (!skip_ref_find_pred[ref_frame]) {
|
||||
find_predictors(cpi, x, ref_frame, frame_mv, const_motion,
|
||||
&ref_frame_skip_mask, flag_list, tile_data, mi_row,
|
||||
mi_col, yv12_mb, bsize, force_skip_low_temp_var,
|
||||
comp_modes > 0);
|
||||
&ref_frame_skip_mask, tile_data, mi_row, mi_col, yv12_mb,
|
||||
bsize, force_skip_low_temp_var, comp_modes > 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2008,7 +2014,7 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, TileDataEnc *tile_data,
|
||||
// than current layer: force check of GF-ZEROMV before early exit
|
||||
// due to skip flag.
|
||||
if (svc->spatial_layer_id > 0 && no_scaling &&
|
||||
(cpi->ref_frame_flags & flag_list[GOLDEN_FRAME]) &&
|
||||
(cpi->ref_frame_flags & VP9_GOLD_FLAG) &&
|
||||
cm->base_qindex > svc->lower_layer_qindex + 10)
|
||||
force_test_gf_zeromv = 1;
|
||||
|
||||
@@ -2088,7 +2094,8 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, TileDataEnc *tile_data,
|
||||
if (comp_pred) {
|
||||
if (!cpi->allow_comp_inter_inter) continue;
|
||||
// Skip compound inter modes if ARF is not available.
|
||||
if (!(cpi->ref_frame_flags & flag_list[second_ref_frame])) continue;
|
||||
if (!(cpi->ref_frame_flags & ref_frame_to_flag(second_ref_frame)))
|
||||
continue;
|
||||
// Do not allow compound prediction if the segment level reference frame
|
||||
// feature is in use as in this case there can only be one reference.
|
||||
if (segfeature_active(seg, mi->segment_id, SEG_LVL_REF_FRAME)) continue;
|
||||
@@ -2101,7 +2108,7 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, TileDataEnc *tile_data,
|
||||
(!cpi->use_svc && sse_zeromv_normalized < thresh_skip_golden)))
|
||||
continue;
|
||||
|
||||
if (!(cpi->ref_frame_flags & flag_list[ref_frame])) continue;
|
||||
if (!(cpi->ref_frame_flags & ref_frame_to_flag(ref_frame))) continue;
|
||||
|
||||
// For screen content. If zero_temp_sad source is computed: skip
|
||||
// non-zero motion check for stationary blocks. If the superblock is
|
||||
@@ -2184,7 +2191,7 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, TileDataEnc *tile_data,
|
||||
if (usable_ref_frame < ALTREF_FRAME) {
|
||||
if (!force_skip_low_temp_var && usable_ref_frame > LAST_FRAME) {
|
||||
i = (ref_frame == LAST_FRAME) ? GOLDEN_FRAME : LAST_FRAME;
|
||||
if ((cpi->ref_frame_flags & flag_list[i]))
|
||||
if ((cpi->ref_frame_flags & ref_frame_to_flag(i)))
|
||||
if (x->pred_mv_sad[ref_frame] > (x->pred_mv_sad[i] << 1))
|
||||
ref_frame_skip_mask |= (1 << ref_frame);
|
||||
}
|
||||
@@ -2193,9 +2200,9 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, TileDataEnc *tile_data,
|
||||
ref_frame == ALTREF_FRAME)) {
|
||||
int ref1 = (ref_frame == GOLDEN_FRAME) ? LAST_FRAME : GOLDEN_FRAME;
|
||||
int ref2 = (ref_frame == ALTREF_FRAME) ? LAST_FRAME : ALTREF_FRAME;
|
||||
if (((cpi->ref_frame_flags & flag_list[ref1]) &&
|
||||
if (((cpi->ref_frame_flags & ref_frame_to_flag(ref1)) &&
|
||||
(x->pred_mv_sad[ref_frame] > (x->pred_mv_sad[ref1] << 1))) ||
|
||||
((cpi->ref_frame_flags & flag_list[ref2]) &&
|
||||
((cpi->ref_frame_flags & ref_frame_to_flag(ref2)) &&
|
||||
(x->pred_mv_sad[ref_frame] > (x->pred_mv_sad[ref2] << 1))))
|
||||
ref_frame_skip_mask |= (1 << ref_frame);
|
||||
}
|
||||
@@ -2482,7 +2489,7 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, TileDataEnc *tile_data,
|
||||
perform_intra_pred =
|
||||
svc->temporal_layer_id == 0 ||
|
||||
svc->layer_context[svc->temporal_layer_id].is_key_frame ||
|
||||
!(cpi->ref_frame_flags & flag_list[GOLDEN_FRAME]) ||
|
||||
!(cpi->ref_frame_flags & VP9_GOLD_FLAG) ||
|
||||
(!svc->layer_context[svc->temporal_layer_id].is_key_frame &&
|
||||
svc_force_zero_mode[best_pickmode.best_ref_frame - 1]);
|
||||
inter_mode_thresh = (inter_mode_thresh << 1) + inter_mode_thresh;
|
||||
@@ -2554,6 +2561,10 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, TileDataEnc *tile_data,
|
||||
if (!((1 << this_mode) & cpi->sf.intra_y_mode_bsize_mask[bsize]))
|
||||
continue;
|
||||
|
||||
if (cpi->sf.rt_intra_dc_only_low_content && this_mode != DC_PRED &&
|
||||
x->content_state_sb != kVeryHighSad)
|
||||
continue;
|
||||
|
||||
if ((cpi->sf.adaptive_rd_thresh_row_mt &&
|
||||
rd_less_than_thresh_row_mt(best_rdc.rdcost, mode_rd_thresh,
|
||||
&rd_thresh_freq_fact[mode_index])) ||
|
||||
@@ -2737,8 +2748,6 @@ void vp9_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x, int mi_row,
|
||||
MV_REFERENCE_FRAME best_ref_frame = NONE;
|
||||
unsigned char segment_id = mi->segment_id;
|
||||
struct buf_2d yv12_mb[4][MAX_MB_PLANE];
|
||||
static const int flag_list[4] = { 0, VP9_LAST_FLAG, VP9_GOLD_FLAG,
|
||||
VP9_ALT_FLAG };
|
||||
int64_t best_rd = INT64_MAX;
|
||||
b_mode_info bsi[MAX_REF_FRAMES][4];
|
||||
int ref_frame_skip_mask = 0;
|
||||
@@ -2754,7 +2763,8 @@ void vp9_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x, int mi_row,
|
||||
int_mv dummy_mv[2];
|
||||
x->pred_mv_sad[ref_frame] = INT_MAX;
|
||||
|
||||
if ((cpi->ref_frame_flags & flag_list[ref_frame]) && (yv12 != NULL)) {
|
||||
if ((cpi->ref_frame_flags & ref_frame_to_flag(ref_frame)) &&
|
||||
(yv12 != NULL)) {
|
||||
int_mv *const candidates = mbmi_ext->ref_mvs[ref_frame];
|
||||
const struct scale_factors *const sf = &cm->frame_refs[ref_frame - 1].sf;
|
||||
vp9_setup_pred_block(xd, yv12_mb[ref_frame], yv12, mi_row, mi_col, sf,
|
||||
|
||||
Reference in new issue
Block a user