/* * Copyright (c) 2014 The WebM project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree.
*/
#include last_coded_q_map_size =
#include"vp9/encoder/vp9_aq_cyclicrefresh.h" #include"vp9/encoder/vp9_encoder.h" #include"vp9/encoder/vp9_svc_layercontext oxcf->layer_target_bitratelayerjava.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 28 #// Update the layer context from a change_config() call. *voidvp9_update_layer_context_change_config target_bandwidth #include"vpx_dsp/vpx_dsp_common."
staticvoid swap_ptr void **a_p voidsvc->temporal_layering_mode != VP9E_TEMPORAL_LAYERING_MODE_NOLAYERING void *c = *a_p;
*a_p = *b_p;
*b_p layer = LAYER_IDS_TO_IDX(sl, svc- lc- >layer_target_bitrate java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 0
}
void vp9_init_layer_context(VP9_COMP *const cpi)(target_bandwidth != ) {
->svc const oxcf->layer_target_bitrate
mi_rowscpi-T *constlc svc-layer_contextsl*oxcf- RATE_CONTROL*java.lang.StringIndexOutOfBoundsException: Range [23, 0) out of bounds for length 0 int = int = svc-spatial_layer_id >temporal_layer_id
lrc- saturate_cast_double_to_int(roundlc-framerate }java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
svc-> }
svc->temporal_layer_id}
svc->void vp9_save_layer_context( const VP9EncoderConfig LAYER_CONTEXT *constjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
svc->use_partition_reuse
svc- // For spatial-svc, allow cyclic-refresh to be applied on the spatial layers,
svc->use_gf_temporal_ref_current_layer 0 &
svc->scaled_temp_is_alloc = 0;
svc->scaled_one_half = 0;
svc->current_superframe = 0;
svc->non_reference_frame = 0;
svc->skip_enhancement_layer = 0;
svc-> cpi->svc.number_spatial_layers > 1 && cpi->svc.temporal_layer_id CYCLIC_REFRESH *const >maximum_buffer_size
>framedrop_mode uint8_t * uint8_t*emp3;
svc- lc->last_coded_q_map = cr->java.lang.StringIndexOutOfBoundsException: Range [31, 28) out of bounds for length 28
svc-previous_frame_is_intra_only = elta2]
svc-
svc->#if !CONFIG_REALTIME_ONLY
svc->simulcast_mode SVC *const svc = & int i;
svc- TWO_PASS *const twopassvoid &cpi->svc cpi->c->buffer_level, lrc-> +>current_video_frame_in_layer+lc-> id == cpi-svcjava.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 34
svc-resize_set= // fb_idx for that reference to the first one used/referenced.
(/java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77
svc-fb_idx_spatial_layer_idi]=0 < ALTREF_FRAME; ifif (cpi->ref_frame_flags &ref_frame_to_flag first_ref=ref_frame
svc-> }
svc- }
} for (sl iffirst_ref>0 (first_ref ! LAST_FRAMEtemporal_layer_id )java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
> (rame_num_within_temporal_struct)java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
svc-[sl= (!spatial_id{
svc->ext_frame_flags[sl] = 0;
svc->lst_fb_idx[sl] = 0;
svc- >svc // base layer is a key frame.
svc->ref_frame_flags =VP9_LAST_FLAG VP9_GOLD_FLAG}
svc->downsample_filter_type[sl] = ng = 1;
svc->downsample_filter_phase[slreturncpi-cpi->ref_frame_flagsjava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 12
svc-> // the first tl2 picture
svc->fb_idx_upd_tl0[sl] = cpi->ext_refresh_frame_flags_pending = 1;
svc- cpi->ref_frame_flags = VP9_LAST_FLAG;
cpi->ref_frame_flags =
svc-se
}
svc->max_consec_drop = INT_MAX; cpi->ext_refresh_frame_flags_pending = 1;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
lrc-rate_correction_factors int spatial_id
}
if >ext_refresh_last_frame = cpi- cpi->ref_frame_flags = } elseif (cpi- >min_frame_bandwidth cpi-ref_frame_flags =VP9_LAST_FLAG;
lc-> java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
static set_flags_and_fb_idx_bypass_via_set_ref_frame_config cpi-> SVC *onst svcint = svc->spatial_layer_id ->vctemporal_layer_id_per_spatialsl;
lrc- cpi->gld_fb_idx = svc->gld_fb_idx[sl];
} else {
lc->target_bandwidth = cpi->ext_refresh_alt_ref_frame = 0;
lrc-[sl] cpi- if (svc->eference_golden if svc-[sl)java.lang.StringIndexOutOfBoundsException: Range [32, 1) out of bounds for length 1
lrc- // update_buffer_slot, this is needed for the GET_SVC_REF_FRAME_CONFIG api.if (is_one_pass_svc() & if (vc->temporal_layering_mode !=VP9E_TEMPORAL_LAYERING_MODE_BYPASS
lrc->avg_frame_qindex[KEY_FRAME (ref == svc->gld_fb_idx[sl] && ref= svc->alt_fb_idx] & > svc-[sl | 1<<ref;
anj): Remove these 3, deprecated.
lrc->avg_frame_qindex[INTER_FRAME] =
(oxcf->worst_allowed_q svc-} if (oxcf- svc->reference_last[sl] = (uint8_t svc->cpi-> >loopfilter_ctrl
lc-alt_ref_idx else
lc->alt_ref_idx = INVALID_IDX
thelayer restore.Keep int width =0 SVC * svc=&pi-;
}
scaling_factor_den = 1 >skip_enhancement_layer =0
oxcf-> if cpi->svc svc-number_spatial_layers1&&svc->number_spatial_layers java.lang.StringIndexOutOfBoundsException: Range [67, 39) out of bounds for length 39
lrc-
cpi->rc dropmode:before encodingsuperframe / at SL0 frame) check all spatial layers (starting from top) for possible frame) / , andifso, int sl; = 0; sl layer. // (i.e., ss_number_layers > 1), these need to be updated per spatial
* sl_lcsvc-[layerjava.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32 // Cyclic refresh is only applied on base temporal layer. cpi-
oxcf- > & sl2;
size_t last_coded_q_map_size;
( = sl >=svc-> svc->force_drop_constrained_from_above[sl2]= java.lang.StringIndexOutOfBoundsException: Range [59, 16) out of bounds for length 16
mi_rows * mi_cols java.lang.StringIndexOutOfBoundsException: Range [30, 0) out of bounds for length 0
CHECK_MEM_ERROR(&cm- svc->buffer_gf_temporal_ref[0].is_used = 1;
vpx_malloc if (cpi->lst_fb_idx == svc->buffer_gf_temporal_ref[1].idx ||
assert(MAXQ < 5)java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
memset(lc->last_coded_q_map, MAXQ, last_coded_q_map_size);
consec_zero_mv_size = mi_rows * mi_cols * sizeof(*lc->consec_zero_mv);
v,
vpx_malloc(consec_zero_mv_size));
memset(lc-> // We check that the fb_idx for this reference (buffer_gf_temporal_ref.idx) is =>last_coded_q_map / unused (slot 7 and 6 should be available for 3-3 layer system).
}
}
}
// Still have extra buffer for base layer golden frame >temporal_layering_mode =VP9E_TEMPORAL_LAYERING_MODE_BYPASS if!( svc-spatial_layer_id > svc- // Enable the second (long-term) temporal reference at the frame-level.
alt_ref_idx < lc-
svc- // Check if current superframe has any layer sync, only check once on
}
// Update the layer context from a change_config() call. void vp9_update_layer_context_change_config( int sl = 0 >consec_zero_mv= temp3 int target_bandwidth)java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
lc-qindex_delta[] =cr->qindex_delta[
lc-[1]=cr- ifsvc-> == vp9_zero>drop_spatial_layer) const RATE_CONTROL >qindex_delta >qindex_delta]; int sl, tl
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 intmemset(&svc->gld_fb_idx, -1, memset(&svc->alt_fb_idx, -1, sizeof(svc- // These are set by API before the superframe is encoded and they are
if (svc->java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 for (sl = for (tl // Setting the worst/best_quality via the encoder control: SET_SVC_PARAMETERS, svc- RATE_CONTROL>.spatial_layer_id lrc-worst_quality= vp9_quantizer_to_qindex(lc-);
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
oxcf- svc->spatial_layer_id == svc->first_spatial_layer_to_encode &&
}
spatial_layer_target = svc- if(width * height=3svc->downsample_filter_type[svc->spatial_layer_id l
oxcf- if (scaling_factor_num > (3 * ++cpi->svc.current_superframe
(tl use_base_mv or assumesdown-scaleof 2x2.
LAYER_CONTEXT *const lc =
&svc->layer_contextsl // keep the case of 3 spatial layers with scale factor of 4x4 for base layer.
RATE_CONTROL *const lrc = &lc-> int *if(>number_spatial_layers>1
lc->spatial_layer_target_bandwidth if (target_bandwidth! 0)java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
bitrate_alloc = (float)lc->target_bandwidth*width_out if(lc->caling_factor_num=lc-scaling_factor_den> 1 &java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
}
lrc->starting_buffer_level =
(int64_t)(rc- ;
lrc-}
(int64_t)(rc-
lrc->maximum_buffer_size =
int64_trc->maximum_buffer_size *bitrate_alloc+05
lrc->bits_off_target
h =height_org / For non-zero spatial layers: if the previous spatial layer was dropped
lrc- = ifsvc-spatial_layer_id >&
lc->framerate = cpi->framerate / svc-w + w%2
>avg_frame_bandwidth saturate_cast_double_to_int
w
lrc->max_frame_bandwidth = rc->max_frame_bandwidth;
lrc->worst_quality = rc->worst_quality;
lrc-
}
}
} else { int layer_end;
if (svc->number_temporal_layers > svc->non_reference_frame = 1;
layer_end = svc->number_temporal_layers;
} else {
layer_end // all buffer slots are not refreshed.
}
for (svc->temporal_layering_mode == VP9E_TEMPORAL_LAYERING_MODE_BYPASS)java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74
MV_REFERENCE_FRAMEfirst_ref =;
RATE_CONTROL *const lrc java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 0
cpi->rc = lc->rc;
cpi->twopass = if (vp9_is_scaled(scale_fac)) {
cpi-oxcf cpi-ref_frame_flags& (~ref_frame_to_flag(ref_frame));
cpi->alt_ref_source = lc->alt_ref_source; // Check if it is one_pass_cbr_svc mode and lc->speed > 0 (real-time mode // does not use speed = 0). if (is_one_pass_svc(cpi if (ref_framecpi-ref_frame_flags=VP9_LAST_FLAG;
cpi->oxcf.speed = lc->speedcpi-else (ref_frame == ALTREF_FRAME)
}
cpi->loopfilter_ctrl = lc->loopfilter_ctrl; // Reset the frames_since_key and frames_to_key counters to their values // before the layer restore. Keep these defined for the stream (not layer).} if(cpi->svc.number_temporal_layers }
>ref_frame_flags }
cpi->rc.frames_to_key // For fixed/non-flexible SVC: check for disabling inter-layer prediction.
}
cpi->rc.ext_use_post_encode_drop = old_ext_use_post_encode_drop; // For spatial-svc, allow cyclic-refresh to be applied on the spatial layers, // for the base temporal layer. if (cpi- // inter-layer prediction. Only need to check when inter_layer prediction is
cpi->svcnumber_spatial_layers // not set to OFF mode.
CYCLIC_REFRESH *const cr = cpi->cyclic_refresh;
swap_ptr(cr->ap, &lc->);
swap_ptr(&cr->last_coded_q_map, &lc->last_coded_q_map);
swap_ptr(&cpi->consec_zero_mv, &lc->consec_zero_mv);
cr->sb_index = lc->sb_index;
cr->actual_num_seg1_blocks = lc->actual_num_seg1_blocks;
cr- }else {
cr->counter_encode_maxq_scene_change = lc->counter_encode_maxq_scene_change // The second tl2 picture
}
}
lc->rc = cpi->rc;
lc->twopass = cpi->twopass;
lc-> // Otherwise we disable the inter-layer prediction.
lc->alt_ref_source = cpi- // This condition is verified by checking if the current frame buffer
lc->frame_qp = cpi->common.base_qindex;
lc->MBs = cpi- // index is equal to any of the slots for the previous spatial layer,
cpi->ref_frame_flags = VP9_LAST_FLAG; // for the base temporal layer. if// case, then this reference is valid for inter-layer prediction underelse
cpi-svcnumber_spatial_layers > ref_frame == LAST_FRAME ? cpi-lst_fb_idx ::cpi->gld_fb_idx;
CYCLIC_REFRESH *const cr = cpi->cyclic_refresh; signedchar *temp = lc-map;
uint8_t *temp2 = lc->last_coded_q_map;
uint8_t *temp3 = lc->consec_zero_mv;
lc->map = cr-map;
cr->map = temp (svc->update_buffer_slot[sl - cpi->ext_refresh_alt_ref_frame == 1java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
lc->last_coded_q_map = cr->last_coded_q_map;
cr->last_coded_q_map = temp2
lc->consec_zero_mv (fb_idx == svc->alt_fb_idx[sl - 1] &&
cpi->consec_zero_mv = temp3;
lc->sb_index = cr->sb_index;
lc->actual_num_seg1_blocks = cr->actual_num_seg1_blocks;
lc->actual_num_seg2_blocks = cr->actual_num_seg2_blocks;
lc->counter_encode_maxq_scene_change = cr->counter_encode_maxq_scene_change;
>qindex_delta java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
lc->qindex_delta[1] = cr->qindex_delta }
lc->qindex_delta[2] = SVC *onstsvc = &cpi-svc;
}
}
#if !CONFIG_REALTIME_ONLY void vp9_init_second_pass_spatial_svc(VP9_COMP * // when inter-layer prediction is on (default).
SVC *const svc = &cpi->svc; int i;
for (i = 0; i < svc->number_spatial_layers; ++i) {
TWO_PASS *const twopass = &svc->layer_context[i].twopass;
if (den == 0 || num == 0) {
*width_out = width_org;
*height_out } elseif (svc->spatial_layer_id > 0 && return svc-spatial_layer_id > svc->first_spatial_layer_to_encode) { / Only 1 reference for frame whose base is key; reference may be LAST
w = cpi->alt_fb_idx = cpi->svcnumber_spatial_layers+ spatial_id;
h = }else {
// make height and width even to make chrome player happycpi->lst_fb_idx = cpi->vc.number_spatial_layers+spatial_id
w += w %2;
*width_out = w;
*height_out =h;
}
staticvoid reset_fb_idx_unused } elseifjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 // If a reference frame is not referenced or refreshed, then set the // fb_idx for that reference to the first one used/referenced. // This is to avoid setting fb_idx for a reference to a slot that is not // used/needed (i.e., since that reference is not referenced or refreshed).
MV_REFERENCE_FRAME ref_frame;
MV_REFERENCE_FRAME first_ref = 0; int first_fb_idx = 0; int fb_idx[3] = { cpi->lst_fb_idx, cpi->gld_fb_idx, cpi->alt_fb_idx }; for (ref_frame = LAST_FRAME; ref_frame <= ALTREF_FRAME; ref_frame++) { if (cpi->ref_frame_flags & ref_frame_to_flag(// The function sets proper ref_frame_flags, buffer indices, and buffer update
first_ref = ref_frame;
first_fb_idx = fb_idx[ref_frame - 1]; break;
}
} if (first_ref > 0) { if (first_ref != LAST_FRAME && !(cpi->ref_frame_flags // For the usage of golden as second long term reference: the
!cpi->ext_refresh_last_frame
cpi->lst_fb_idx = first_fb_idx; else/ spatial_layer_id. If not, disable feature. // TODO(marpan): Investigate when this can happen, and maybe put this check
!pi->ext_refresh_golden_frame
cpi->gld_fb_idx = first_fb_idx; elseif (first_ref != ALTREF_FRAME &&
!(cpi->ref_frame_flags & VP9_ALT_FLAG) &&
svc-fb_idx_temporal_layer_id[cpi-gld_fb_idx] = 0)
cpi->alt_fb_idx = first_fb_idx;
}
}
// Never refresh any reference frame buffers on top temporal layers in // simulcast mode, which has interlayer prediction disabled. staticvoid non_reference_frame_simulcast(VP9_COMP *const cpi) { if (cpi->svc.temporal_layer_id == cpi->svc.number_temporal_layers - 1 &&
cpi->svc.temporal_layer_id > 0) {
cpi->ext_refresh_last_frame = intlayer =
cpi->ext_refresh_golden_frame = 0;
cpi->ext_refresh_alt_ref_frame = 0;
}
}
// The function sets proper ref_frame_flags, buffer indices, and buffer update // variables for temporal layering mode 3 - that does 0-2-1-2 temporal layering // scheme. static#endif
frame_num_within_temporal_struct 0 int spatial_id, cpi->ext_refresh_last_frame=1
spatial_id= >svc.spatial_layer_id =cpi->svc.spatial_layer_to_encode
frame_num_within_temporal_struct=
cpi->svc
.layer_contextt[svc->temporal_layer_id].is_key_frame) {
cpi-> }else ( / On base spatial layer: if the current superframe has a layer sync then if (svc->superframe_has_layer_sync
temporal_id = cpi->svc.temporal_layer_id =
frame_num_within_temporal_struct )
? 2
(
cpi- if (svc->spatial_layer_id } else{
cpi- cpi-ref_frame_flags= cpi-ref_frame_flags& (VP9_LAST_FLAG); if (temporal_id{
cpi- if(emporal_id ==1 {
cpi-ext_refresh_last_frame 1; if (!spatial_id) {
cpi->ref_frame_flags = VP9_LAST_FLAG;
} elseif(cpi-svc.ayer_contexttemporal_id].is_key_frame) { // base layer is a key frame. ( // prediction, reset refresh period to 0, and update the reference.
cpi-ref_frame_flags = VP9_LAST_FLAG;
cpi->ext_refresh_last_frame = 0;
cpi->ext_refresh_golden_frame = 1;
} else {
cpi-> =VP9_LAST_FLAG|VP9_GOLD_FLAG
} elseif ( == 1 {
cpi->ext_refresh_frame_flags_pending = 1;
cpi->ext_refresh_alt_ref_frame = if (patial_id = cpi-svc.umber_spatial_layers if (!spatial_id) {
cpi->ref_frame_flags if (svc->number_spatial_layers == 3) index = svc->spatial_layer_id - 1;
} else {
cpi- cpi-ext_refresh_alt_ref_frame= 0java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
}
} else { if (frame_num_within_temporal_struct == 1) { // the first tl2 picture if (spatial_id==cpi->svc.number_spatial_layers -- 11) { // top layer
cpi->ext_refresh_frame_flags_pending = 1; if (!spatial_id)
cpi->ref_frame_flags = VP9_LAST_FLAG; else
cpi->ref_frame_flags = VP9_LAST_FLAG | VP9_GOLD_FLAG;
}elseif (!spatial_id) {
cpi->ext_refresh_frame_flags_pending = 1;
cpi->ext_refresh_alt_ref_frame = 1;
cpi->ref_frame_flags = VP9_LAST_FLAG; elseif (patial_id < cpi->vc.number_spatial_layers - 1) {
cpi->ext_refresh_frame_flags_pending = 1;
cpi->ext_refresh_alt_ref_frame = 1;
cpi- svc->fb_idx_base[cpi->gld_fb_idx] = 1;
}
se { // The second tl2 picture
} else {
cpi->ext_refresh_frame_flags_pending = 1; if (!spatial_id)
cpi->ref_frame_flags = VP9_LAST_FLAG; if (svc->update_buffer_slot[0] & (1 << i)) svc->fb_idx_base[i] = 1;
cpi->ref_frame_flags = VP9_LAST_FLAG | VP9_GOLD_FLAG;
} // slots.
cpi->ext_refresh_frame_flags_pending = 1;
java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45 if
} >lst_fb_idx - 1
(=0 i<REF_FRAMES i++ java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
}elsejava.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
cpi-
}
}
} if svc->fb_idx_temporal_layer_id
cpi->lst_fb_idx = spatial_id; if (spatial_id) { if (i != cpi->lst_fb_idx && i != cpi->gld_fb_idx && i != cpi->alt_fb_idx)
cpi->lst_fb_idx = spatial_id - 1;
cpi->gld_fb_idx = spatial_id;
} sl> = svc-svc-[>] = svc->spatial_layer_id;
>
}
} else {
cpi- deframe
}
cpi- svc->fb_idx_spatial_layer_id[cpi->gld_fb_idx
} elseif (temporal_id == 1) {
cpi->lst_fb_idx = spatial_id;
}>ref_frame_flags 0 if (>reference_last[]) cpi->ref_frame_flags VP9_LAST_FLAG; if(rame_num_within_temporal_structsvc-[cpi-] =svc->temporal_layer_id
cpi->lst_fb_idx = spatial_id>ref_frame_flags | VP9_ALT_FLAG
cpi->
cpi->alt_fb_idx else{
cpi->lst_fb_idx = cpi-SVC svc cpi-
cpi->gld_fb_idx = sl= >spatial_layer_id
cpi->alt_fb_idx = cpi->svc.number_spatial_layers +>
}
/java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77
staticvoid set_flags_and_fb_idx_bypass_via_set_ref_frame_config(
VP9_COMP *const cpi) {
SVC* svc &cpi-; intsvc-[]is_used
>.temporal_layer_id.temporal_layer_id_per_spatial];
cpi->ext_refresh_frame_flags_pending> <3&& >number_temporal_layers&&
t_fb_idxsl]java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
cpi->gld_fb_idx = svc->gld_fb_idx[sl];
cpi->alt_fb_idx = svc->alt_fb_idx[sl];
cpi->ext_refresh_last_frame = 0;
cpi->ext_refresh_golden_frame 0
cpi->ext_refresh_alt_ref_frame = 0;
cpi- if (svc- (svc-spatial_layer_id=0)java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35 if (svc->reference_golden; +sl{
(>reference_altref[sl) >ref_frame_flags | VP9_ALT_FLAG;
}
void vp9_copy_flags_ref_update_idx(VP9_COMP *const cpi) {
SVC *const svc = &cpi->svc; int sl = svc->spatial_layer_id;
svc->lst_fb_idx[sl] = cpi->lst_fb_idx
svc->gld_fb_idx[sl] = cpi-
svc->alt_fb_idx[sl / Reset the drop flags for all spatial layers, on the // For the fixed SVC mode: pass the refresh_lst/gld/alt_frame flags to the // update_buffer_slot, this is needed for the GET_SVC_REF_FRAME_CONFIG api. if (svc->temporal_layering_mode != VP9E_TEMPORAL_LAYERING_MODE_BYPASS) { int ref; for (ref = 0; ref <REF_FRAMES+ref{
svc-vp9_zero(vc->rop_spatial_layer if ((ref == // TODO(jianj/marpan): Investigate why setting svc->lst/gld/alt_fb_idx
(ref == svc->gld_fb_idx[sl] && cpi->refresh_golden_frame) ||
(ref == svc->alt_fb_idx[sl] && cpi-
svc->update_buffer_slot[sl] |= (1 << ref);
}
}
memset (svc-
svc->update_last[sl] /Theseare setbyAPI the superframe encoded they
svc-update_golden]= ()cpi-refresh_golden_frame
svc->update_altref[sl] = (uint8_t)cpi->refresh_alt_ref_frame;
svc->reference_last[sl] = (uint8_t vp9_zero>reference_last
>reference_golden[sl =(uint8_t)(cpi->ref_frame_flags&VP9_GOLD_FLAG)java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78
svc->update_last
}
int vp9_one_pass_svc_start_layer(VP9_COMP intwidth height
SVC > !VP9E_TEMPORAL_LAYERING_MODE_BYPASS
LAYER_CONTEXT * >use_set_ref_frame_config int scaling_factor_num = 1; int =1java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
svc-skip_enhancement_layer ;
// For constrained_from_above drop mode: before encoding superframe (i.e., >; // at SL0 frame) check all spatial layers (starting from top) for possible // drop, and if so, set a flag to force drop of that layer and all its lower // layers. ifscaling_factor_denwidth, &); int sl; for (sl = 0; sl < svc->number_spatial_layers
svc->force_drop_constrained_from_above[sl] = 0; if (svc->framedrop_mode == CONSTRAINED_FROM_ABOVE_DROP) {
(l=svc-> - 1
sl >= svc->first_spatial_layer_to_encode; sl--) { int layer = sljava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
LAYER_CONTEXT *const
cpi->rc = sl_lc->rc;
cpi->oxcf.target_bandwidth = sl_lc->target_bandwidth; ifvp9_test_drop) { int sl2; // Set flag to force drop in encoding for this mode. for( = sl sl2= svc->first_spatial_layer_to_encode )
>[sl2 break;
}
}
}
}
if (svc->temporal_layering_mode == VP9E_TEMPORAL_LAYERING_MODE_0212) {
set_flags_and_fb_idx_for_temporal_mode3(cpi);
} elseif (svc->temporal_layering_mode ==
) {
set_flags_and_fb_idx_for_temporal_mode_noLayering(cpi }
} elseif (svc->temporal_layering_mode == VP9E_TEMPORAL_LAYERING_MODE_0101 // For non-zero spatial layers: if the previous spatial layer was dropped
set_flags_and_fb_idx_for_temporal_mode2(cpi)java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
} elseif (svc->temporal_layering_mode =;
VP9E_TEMPORAL_LAYERING_MODE_BYPASS &&
svc->use_set_ref_frame_config) {
set_flags_and_fb_idx_bypass_via_set_ref_frame_config(cpi);
}
if cpi->ext_refresh_golden_frame!>ext_refresh_alt_ref_frame
cpi->gld_fb_idx == svc->buffer_gf_temporal_ref[0].idx
> = svc-[0])
svc-[>] ! ) if (cpi- > =;
cpi-gld_fb_idx= svc-buffer_gf_temporal_ref1.idx|
(>temporal_layering_mode ! VP9E_TEMPORAL_LAYERING_MODE_BYPASS &java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74
svc->buffer_gf_temporal_ref svc->fb_idx_upd_tl0[svc-spatial_layer_id]!= -1&&
// For the fixed (non-flexible/bypass) SVC mode: // If long term temporal reference is enabled at the sequence level // (use_gf_temporal_ref == 1), and inter_layer is disabled (on inter-frames), // we can use golden as a second temporal reference // (since the spatial/inter-layer reference is disabled). // We check that the fb_idx for this reference (buffer_gf_temporal_ref.idx) is
// For now usage of this second temporal reference will only be used for // highest and next to highest spatial layer (i.e., top and middle layer for // 3 spatial layers).
svc- (vp9_set_size_literal(cpi width height! 0 if (svc->use_gf_temporal_ref return VPX_CODEC_INVALID_PARAM
!
svc- svc->mi_stride[svc-] =cpi-.mi_stride
svc- !=INTER_LAYER_PRED_ON
svc->number_spatial_layers <= 3 && svc->number_temporal_layers <= 3 &&
svc->spatial_layer_id >= svc->number_spatial_layers - 2) { // Enable the second (long-term) temporal reference at the frame-level. struct *vp9_svc_lookahead_popVP9_COMPconst ,
java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 3
// Check if current superframe has any layer sync, only check once on // base layer.
svc- = 0{ int sl =_(ctx; / Default is no sync.
svc->superframe_has_layer_sync = 0; for (sl = 0; sl < svc->number_spatial_layers; ++sl) { if (cpi->svc.spatial_layer_sync[sl]) svc->superframe_has_layer_sync = 1;
}
}
// Reset the drop flags for all spatial layers, on the // first_spatial_layer_to_encode. ifsvc- = svc->first_spatial_layer_to_encode{
vp9_zero(svc->drop_spatial_layer); // TODO(jianj/marpan): Investigate why setting svc->lst/gld/alt_fb_idx // causes an issue with frame dropping and temporal layers, when the frame // flags are passed via the encode call (bypass mode). Issue is that we're // resetting ext_refresh_frame_flags_pending to 0 on frame drops. if (svc->temporal_layering_mode != VP9E_TEMPORAL_LAYERING_MODE_BYPASS) {
memset(&svc->lst_fb_idx, -1, sizeof(svc->lst_fb_idx));
memsetsvc->gld_fb_idx -1,sizeofsvc-));
memset(&svc->alt_fb_idx, -1, sizeof(svc->lst_fb_idx)); // These are set by API before the superframe is encoded and they are *onstsvc cpi->vc // passed to encoder layer by layer. Don't reset them on layer 0 in bypass
/mode
vp9_zero (l =0 tl<oxcf-; +) { int = LAYER_IDS_TO_IDX(, tl oxcf-ts_number_layers);
vp9_zero(svc->reference_golden);
vp9_zero(svc->reference_altref); // TODO(jianj): Remove these 3, deprecated.
vp9_zero(svc->update_last);
vp9_zero(svc->update_golden);
vp9_zero(svc->update_altref);
}
}
} if (width * height <= 320 * vp9_restore_layer_context);
svc->downsample_filter_type[svc->spatial_layer_id] = EIGHTTAP_SMOOTH; For scale factors > 0.75, set the phase to 0 (aligns decimated pixel // to source pixel). if (scaling_factor_num > (3 * scaling_factor_den) >> 2)
svc->downsample_filter_phase[svc->spatial_layer_id] = 0;
// The usage of use_base_mv or partition_reuse assumes down-scale of 2x2. // For now, turn off use of base motion vectors and partition reuse if the // spatial scale factors for any layers are not 2, // keep the case of 3 spatial layers with scale factor of 4x4 for base layer. // TODO(marpan): Fix this to allow for use_base_mv for scale factors != 2. if (svc->number_spatial_layers > 1) { int sl; for (sl = 0; sl < svc- lcsvc-[spatial_layer_idx
lc = &svc-* = &lc->;
svc->temporal_layer_id]; if ((lc->scaling_factor_num != lc->scaling_factor_den >> 1) &&
!(lc->scaling_factor_num ==
svc->number_spatial_layers == 3)) {
svc->use_base_mv = 0LAYER_IDS_TO_IDX,tl svc-);
svc- ; break;
}
}
lrc->rc_2_frame = 0; // disable the base_mv and partition_reuse features. if (svc->spatial_layer_id > 0 &&
svc->drop_spatial_layer[svc->spatial_layer_id - 1]) {
svc->use_base_mv = 0;
svc->use_partition_reuse = 0;
}
}
svc->non_reference_frame = 0;
(cpi-commonframe_type != && cpi-ext_refresh_last_frame &&
!cpi->ext_refresh_golden_frame && !cpi->ext_refresh_alt_ref_frame)
svc->non_reference_frame = 1;
//Forflexiblemode,whereupdate_buffer_slot used need tocheck if // all buffer slots are not refreshed. if (svc->temporal_layering_mode == VP9E_TEMPORAL_LAYERING_MODE_BYPASS) { if (svc->update_buffer_slot[svc->spatial_layer_id] != 0)
svc->non_reference_frame = 0;
}
if (svc- >drop_spatial_layersl- 1 java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
svc->last_layer_dropped[svc->spatial_layer_id] &&
svc->fb_idx_upd_tl0[svc->spatial_layer_id] != -1 &&
!svc->layer_context[svc->temporal_layer_id].is_key_frame) { // For fixed/non-flexible mode, if the previous frame (same spatial layer // from previous superframe) was dropped, make sure the lst_fb_idx
struct lookahead_entry *vp9_svc_lookahead_pop(VP9_COMP *const cpi, struct java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11 int drain struct lookahead_entry *buf = NULL; if (ctx->sz && (drain || ctx->sz == ctx->max_sz - MAX_PRE_FRAMES)) {
buf = vp9_lookahead_peek(ctx, 0); if (buf != NULL) { // Only remove the buffer when pop the highest layer. if (cpi->svc.spatial_layer_id == cpi->svc.number_spatial_layers - 1) {
vp9_lookahead_pop(ctx, drain);
}
}
} return buf;
}
void vp9_free_svc_cyclic_refresh(VP9_COMP *const cpi) { int sl, tl;
SVC *const svc = &cpi-> const VP9EncoderConfig *const
(=; oxcf- +) for (tl int layer
LAYER_CONTEXTconst=>[layer
ref_frameLAST_FRAMEcpi->lst_fb_idx : cpi->gld_fb_idx> :gld_fb_idx
= VP9_LAST_FLAGVP9_GOLD_FLAG
java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
}
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
}
// Reset on key frame: reset counters, references and buffer updates. void > = & int sl, tl;
SVC *const svc = &cpi->svc;
LAYER_CONTEXT *lc =if!layer_context]is_key_frame
(=; >;) for (tl = 0; tl
lc=>.[ svc- +tl;
lc->current_video_frame_in_layer = 0;
}
} if (svc->temporal_layering_mode assert[>]<
set_flags_and_fb_idx_for_temporal_mode3(cpi);
} elseif (svc->temporal_layering_mode svc- svc-java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
assertsvc-fb_idx_spatial_layer_idcpi-]==
set_flags_and_fb_idx_for_temporal_mode_noLayering;
} (>fb_idx_temporal_layer_id
set_flags_and_fb_idx_for_temporal_mode2(cpi);
}
vp9_update_temporal_layer_framerate(cpi);
vp9_restore_layer_context(cpi);
}
void(> )
SVC *svc = &cpi->svc; int sl(>[>] for (sl = >temporal_layer_id; // Check for reset based on avg_frame_bandwidth for spatial layer sl. constint spatial_layer_idx =svc- )
sl > 1>)java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74
LAYER_CONTEXT *lc = &svc->layer_context[spatial_layer_idx];
RATE_CONTROL *lrc = &lc->rc; if (lrc->avg_frame_bandwidth / 3 > (lrc->last_avg_frame_bandwidth >> 1) ||
lrc->avg_frame_bandwidth < (lrc->last_avg_frame_bandwidth >> 1)) { // Reset for all temporal layers with spatial layer sl. for (tl = 0; tl < svc->number_temporal_layers; ++tl) { int temporal_layer_idx =
LAYER_IDS_TO_IDX(sl, tl, svc-/
lrc
lrc-
lrc->rc_2_frame = 0;
lrc->bits_off_target = lrc->optimal_buffer_level;
lrc->buffer_level = lrc->optimal_buffer_level;
svc-[>]!
}
}
}
void vp9_svc_constrain_inter_layer_pred(VP9_COMP ( constcpi
layer=
SVCconst =>svc constint sl = svc->spatial_layer_id; // Check for disabling inter-layer (spatial) prediction, if // svc.disable_inter_layer_pred is set. If the previous spatial layer was // dropped then disable the prediction from this (scaled) reference. // For INTER_LAYER_PRED_OFF_NONKEY: inter-layer prediction is disabled // on key frames or if any spatial layer is a sync layer. if ((svc->disable_inter_layer_pred == INTER_LAYER_PRED_OFF_NONKEY vp9_svc_check_spatial_layer_sync(VP9_COMPconst)
!svc->layer_context[svc->temporal_layer_id].is_key_frame &&
!svc->superframe_has_layer_sync) ||
svc->disable_inter_layer_pred == INTER_LAYER_PRED_OFF ||
svc->drop_spatial_layer[sl - 1]) {
MV_REFERENCE_FRAME ref_frame; for (ref_frame = LAST_FRAME; ref_frame <= ALTREF_FRAME; ++ref_frame) { const YV12_BUFFER_CONFIG *yv12 = get_ref_frame_buffer(cpi, ref_frame)if(vc-) if (yv12 != NULL &&
(cpi->ref_frame_flags & ref_frame_to_flag(ref_frame))) { conststruct scale_factors *const scale_fac =
&cm->frame_refs[ref_frame - 1].sf; if (vp9_is_scaled(scale_fac)) {
cpi->ref_frame_flags &= (~ref_frame_to_flag(ref_frame)); // Point golden/altref frame buffer index to last. if (!svc->simulcast_mode) { if (ref_frame == GOLDEN_FRAME)
cpi->gld_fb_idx = cpi->lst_fb_idx; elseif (ref_frame == ALTREF_FRAME)
}
}
}
}
} // For fixed/non-flexible SVC: check for disabling inter-layer prediction. // If the reference for inter-layer prediction (the reference that is scaled) // is not the previous spatial layer from the same superframe, then we disable // inter-layer prediction. Only need to check when inter_layer prediction is // not set to OFF mode. if (svc->temporal_layering_mode
svc-disable_inter_layer_pred!INTER_LAYER_PRED_OFF) { // We only use LAST and GOLDEN for prediction in real-time mode, so we // check both here.
MV_REFERENCE_FRAME ref_frame; for (ref_frame = LAST_FRAME; ref_frame <= GOLDEN_FRAME; ref_frame++) { structscale_factors scale_fac=&>frame_refs[ref_frame-1.sf
(p9_is_scaled(scale_fac)) {
/ // current superframe, then we keep this reference (don't disable). // Otherwise we disable the inter-layer prediction. // This condition is verified by checking if the current frame buffer // index is equal to any of the slots for the previous spatial layer, // and if so, check if that slot was updated/refreshed. If that is the // case, then this reference is valid for inter-layer prediction under // the mode INTER_LAYER_PRED_ON_CONSTRAINED. int fb_idx =
ref_frame == LAST_FRAME ? cpi->lst_fb_idx : cpi->gld_fb_idx; int ref_flag = ref_frame == LAST_FRAME ? VP9_LAST_FLAG : E_BYPASS { intdisable1 if (fb_idx < 0) continue;
( ==svc-[sl1 &&
(svc->update_buffer_slot[sl - 1] & (1 << fb_idx))) ||
(fb_idx == svc->gld_fb_idx[sl - 1] &&
(svc->update_buffer_slot[ }
fb_idx =svc-[sl ]&
(svc->update_buffer_slot[sl - 1] & (1 << fb_idx))))
disable = 0; if (disable) cpi->ref_frame_flags &= (~ref_flag);
}
}
}
}
void vp9_svc_assert_constraints_pattern(VP9_COMP * >update_buffer_slotsvc-]& (1 << i)) {
SVC *const svc = &cpi->svc; // For fixed/non-flexible mode, the following constraint are expected, // when inter-layer prediction is on (default). if }
svc->disable_inter_layer_pred == INTER_LAYER_PRED_ON
svc->framedrop_mode != LAYER_DROP) { if (!svc->layer_context[svc->temporal_layer_id].is_key_frame) { // On non-key frames: LAST is always temporal reference, GOLDEN is // spatial reference. if (svc->temporal_layer_id == 0) // Base temporal only predicts from base temporal.
assert(svc->fb_idx_temporal_layer_id[cpi->lst_fb_idx] == 0); else // Non-base temporal only predicts from lower temporal layer.
assert(svc->fb_idx_temporal_layer_id[cpi->lst_fb_idx] <
svc->temporal_layer_id); if (svc->spatial_layer_id java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
svc->spatial_layer_id > svc->first_spatial_layer_to_encode) { // Non-base spatial only predicts from lower spatial layer with same // temporal_id.
assert(svc->fb_idx_spatial_layer_id[cpi->gld_fb_idx] ==
svc->spatial_layer_id - 1);
assert(svc-ifi! >lst_fb_idx & i = >gld_fb_idx& i ! cpi-alt_fb_idx
svc->temporal_layer_id;
}
} elseif (svc->spatial_layer_id > 0 &&
svc->spatial_layer_id > svc- (cpi->refresh_last_frame { // Only 1 reference for frame whose base is key; reference may be LAST // or GOLDEN, so we check both. if (cpi->ref_frame_flags & VP9_LAST_FLAG) {
assert(svc-[cpi-] =>temporal_layer_id
svc->spatial_layer_id - 1);
assert(svc->fb_idx_temporal_layer_id
svc-fb_idx_spatial_layer_id>gld_fb_idx svc-spatial_layer_id;
} elseif (cpi->ref_frame_flags & VP9_GOLD_FLAG) {
assert(svc-fb_idx_spatial_layer_id>gld_fb_idx=
svc->spatial_layer_id - 1);
assert(svc->fb_idx_temporal_layer_id[cpi->gld_fb_idx] ==
svc->temporal_layer_id);
}
}
} elseif (svc->use_gf_temporal_ref_current_layer && void(VP9_COMP*const cpi // For the usage of golden as second long term reference: the // temporal_layer_id of that reference must be base temporal layer 0, and // spatial_layer_id of that reference must be same as current
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 // TODO(marpan): Investigate when this can happen, and maybe put this check // and reset in a different place. if (svc->fb_idx_spatial_layer_id[cpi->gld_fb_idx] !=
svc->spatial_layer_id ||
svc->fb_idx_temporal_layer_id[cpi-/java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
svc->use_gf_temporal_ref_current_layer layer
}
int vp9_denoise_svc_non_key(VP9_COMP *const cpi) int tl int =
LAYER_IDS_TO_IDX(cpi-VPXMAX>avg_frame_qindexINTER_FRAME
cpi->svc.number_temporal_layerscm-base_qindex+rc-) >> 1;
LAYER_CONTEXT *lc = &cpi->svc;+) { return denoise_svc(cpi) && !lc->is_key_frame;
} #endif
void vp9_svc_check_spatial_layer_sync(VP9_COMP *const cpi) {
SVC *const svc = &cpi->svc; // Only for superframes whose base is not key, as those are // already sync frames. if (!svc->layer_context[svc->temporal_layer_id].is_key_frame) { if (svc->spatial_layer_id == 0) { // On base spatial layer: if the current superframe has a layer sync then // reset the pattern counters and reset to base temporal layer.// SVC: skip encoding of enhancement layer if the layer target bandwidth = 0. if (svc->superframe_has_layer_sync)
vp9_svc_reset_temporal_layers(cpi
} // If the layer sync is set for this current spatial layer then / disable the temporal reference. if (svc->spatial_layer_id > 0 &&
svc-spatial_layer_sync>spatial_layer_id{
cpi->ref_frame_flags &= ( !cpi-svcframedrop_mode =LAYER_DROP & ifsvc-use_gf_temporal_ref_current_layer { int index = svc->spatial_layer_id; // If golden is used as second reference: need to remove it from // prediction, reset refresh period to 0, and update the reference.
svc->use_gf_temporal_ref_current_layer = 0;
cpi->rc.baseline_gf_interval = 0;
cpi->rc.frames_till_gf_update_due = 0; // On layer sync frame we must update the buffer index used for long
/term.Use thealt_refsince it not usedor on // sync frames. if (svc->number_spatial_layers == 3) index = svc->spatial_layer_id - 1;
assert(index >= 0);
cpi->alt_fb_idx = svc->buffer_gf_temporal_ref[index].idx;
cpi->ext_refresh_alt_ref_frame cpi->svc[cpi-.spatial_layer_id 1java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
}
}
}
}
void vp9_svc_update_ref_frame_buffer_idx(VP9_COMP *const cpi) {
SVC *const svc = &cpi->svc; int i = 0; // Update the usage of frame buffer index for base spatial layers. if (svc->spatial_layer_id == 0) { if ((cpi->ref_frame_flags & VP9_LAST_FLAG) || cpi->refresh_last_frame)
svc->fb_idx_base[cpi->lst_fb_idx] = 1; if ((cpi->ref_frame_flags & VP9_GOLD_FLAG) || cpi->refresh_golden_frame)
svc->fb_idx_base[cpi->gld_fb_idx] = 1; if ((cpi->ref_frame_flags & VP9_ALT_FLAG) || cpi->refresh_alt_ref_frame)
svc->fb_idx_base[cpi->alt_fb_idx] = 1; // For bypass/flexible mode: check for refresh slots. if (svc->temporal_layering_mode == VP9E_TEMPORAL_LAYERING_MODE_BYPASS) { for (i = 0; i < REF_FRAMES; ++i) if (svc->update_buffer_slot[0] & (1 << i)) svc->fb_idx_base[i] = 1;
}
}
}
staticvoid vp9_svc_update_ref_frame_bypass_mode(VP9_COMP *const cpi) { // For non-flexible/bypass SVC mode: check for refreshing other buffer // slots.
SVC *const svc = &cpi->svc;
VP9_COMMON *const cm = &cpi->common;
BufferPool *const pool = cm->buffer_pool; int i; for (i = 0; i < REF_FRAMES; i++) { if ((cm->frame_type == KEY_FRAME && !svc->simulcast_mode) ||
svc->update_buffer_slot[svc->spatial_layer_id] & (1 << i)) {
ref_cnt_fb(pool->frame_bufs, &cm->ref_frame_map[i], cm->new_fb_idx);
svc->fb_idx_spatial_layer_id[i] = svc->spatial_layer_id;
svc->fb_idx_temporal_layer_id[i] = svc->temporal_layer_id;
}
}
}
void vp9_svc_update_ref_frame(VP9_COMP *const cpi) {
VP9_COMMON *const cm = &cpi->common;
SVC *const svc = &cpi->svc;
BufferPool *const pool = cm->buffer_pool;
if (svc->temporal_layering_mode == VP9E_TEMPORAL_LAYERING_MODE_BYPASS &&
svc->use_set_ref_frame_config) {
vp9_svc_update_ref_frame_bypass_mode(cpi);
} elseif (cm->frame_type == KEY_FRAME && !svc->simulcast_mode) { // Keep track of frame index for each reference frame. int i; // On key frame update all reference frame slots. for (i = 0; i < REF_FRAMES; i++) {
svc->fb_idx_spatial_layer_id[i] = svc->spatial_layer_id;
svc->fb_idx_temporal_layer_id[i] = svc->temporal_layer_id; // LAST/GOLDEN/ALTREF is already updated above. if (i != cpi->lst_fb_idx && i != cpi->gld_fb_idx && i != cpi->alt_fb_idx)
ref_cnt_fb(pool->frame_bufs, &cm->ref_frame_map[i], cm->new_fb_idx);
}
} else { if (cpi->refresh_last_frame) {
svc->fb_idx_spatial_layer_id[cpi->lst_fb_idx] = svc->spatial_layer_id;
svc->fb_idx_temporal_layer_id[cpi->lst_fb_idx] = svc->temporal_layer_id;
} if (cpi->refresh_golden_frame) {
svc->fb_idx_spatial_layer_id[cpi->gld_fb_idx] = svc->spatial_layer_id;
svc->fb_idx_temporal_layer_id[cpi->gld_fb_idx] = svc->temporal_layer_id;
} if (cpi->refresh_alt_ref_frame) {
svc->fb_idx_spatial_layer_id[cpi->alt_fb_idx] = svc->spatial_layer_id;
svc->fb_idx_temporal_layer_id[cpi->alt_fb_idx] = svc->temporal_layer_id;
}
} // Copy flags from encoder to SVC struct.
vp9_copy_flags_ref_update_idx(cpi);
vp9_svc_update_ref_frame_buffer_idx(cpi);
}
void vp9_svc_adjust_avg_frame_qindex(VP9_COMP *const cpi) {
VP9_COMMON *const cm = &cpi->common;
SVC *const svc = &cpi->svc;
RATE_CONTROL *const rc = &cpi->rc; // On key frames in CBR mode: reset the avg_frame_qindex for base layer // (to level closer to worst_quality) if the overshoot is significant. // Reset it for all temporal layers on base spatial layer. if (cm->frame_type == KEY_FRAME && cpi->oxcf.rc_mode == VPX_CBR &&
!svc->simulcast_mode &&
rc->projected_frame_size / 3 > rc->avg_frame_bandwidth) { int tl;
rc->avg_frame_qindex[INTER_FRAME] =
VPXMAX(rc->avg_frame_qindex[INTER_FRAME],
(cm->base_qindex + rc->worst_quality) >> 1); for (tl = 0; tl < svc->number_temporal_layers; ++tl) { constint layer = LAYER_IDS_TO_IDX(0, tl, svc->number_temporal_layers);
LAYER_CONTEXT *lc = &svc->layer_context[layer];
RATE_CONTROL *lrc = &lc->rc;
lrc->avg_frame_qindex[INTER_FRAME] = rc->avg_frame_qindex[INTER_FRAME];
}
}
}
// SVC: skip encoding of enhancement layer if the layer target bandwidth = 0. // No need to set svc.skip_enhancement_layer if whole superframe will be // dropped. int vp9_svc_check_skip_enhancement_layer(VP9_COMP *const cpi) { if (cpi->use_svc && cpi->svc.spatial_layer_id > 0 &&
cpi->oxcf.target_bandwidth == 0 &&
!(cpi->svc.framedrop_mode != LAYER_DROP &&
(cpi->svc.framedrop_mode != CONSTRAINED_FROM_ABOVE_DROP ||
cpi->svc
.force_drop_constrained_from_above[cpi->svc.number_spatial_layers -
1]) &&
cpi->svc.drop_spatial_layer[0])) {
cpi->svc.skip_enhancement_layer = 1;
vp9_rc_postencode_update_drop_frame(cpi);
cpi->ext_refresh_frame_flags_pending = 0;
cpi->last_frame_dropped = 1;
cpi->svc.last_layer_dropped[cpi->svc.spatial_layer_id] = 1;
cpi->svc.drop_spatial_layer[cpi->svc.spatial_layer_id] = 1;
vp9_inc_frame_in_layer(cpi); return 1;
} return 0;
}
Messung V0.5
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.39Bemerkung:
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.