Lines Matching refs:cpi

17 void vp9_init_layer_context(VP9_COMP *const cpi) {
18 SVC *const svc = &cpi->svc;
19 const VP9EncoderConfig *const oxcf = &cpi->oxcf;
27 if (svc->number_temporal_layers > 1 && cpi->oxcf.rc_mode == VPX_CBR) {
55 if (svc->number_temporal_layers > 1 && cpi->oxcf.rc_mode == VPX_CBR) {
80 if (!(svc->number_temporal_layers > 1 && cpi->oxcf.rc_mode == VPX_CBR)
86 void vp9_update_layer_context_change_config(VP9_COMP *const cpi,
88 SVC *const svc = &cpi->svc;
89 const VP9EncoderConfig *const oxcf = &cpi->oxcf;
90 const RATE_CONTROL *const rc = &cpi->rc;
95 if (svc->number_temporal_layers > 1 && cpi->oxcf.rc_mode == VPX_CBR) {
105 if (svc->number_temporal_layers > 1 && cpi->oxcf.rc_mode == VPX_CBR) {
121 if (svc->number_temporal_layers > 1 && cpi->oxcf.rc_mode == VPX_CBR) {
122 lc->framerate = cpi->framerate / oxcf->ts_rate_decimator[layer];
124 lc->framerate = cpi->framerate;
134 static LAYER_CONTEXT *get_layer_context(VP9_COMP *const cpi) {
135 return (cpi->svc.number_temporal_layers > 1 && cpi->oxcf.rc_mode == VPX_CBR) ?
136 &cpi->svc.layer_context[cpi->svc.temporal_layer_id] :
137 &cpi->svc.layer_context[cpi->svc.spatial_layer_id];
140 void vp9_update_temporal_layer_framerate(VP9_COMP *const cpi) {
141 SVC *const svc = &cpi->svc;
142 const VP9EncoderConfig *const oxcf = &cpi->oxcf;
143 LAYER_CONTEXT *const lc = get_layer_context(cpi);
147 lc->framerate = cpi->framerate / oxcf->ts_rate_decimator[layer];
149 lrc->max_frame_bandwidth = cpi->rc.max_frame_bandwidth;
155 cpi->framerate / oxcf->ts_rate_decimator[layer - 1];
163 void vp9_update_spatial_layer_framerate(VP9_COMP *const cpi, double framerate) {
164 const VP9EncoderConfig *const oxcf = &cpi->oxcf;
165 LAYER_CONTEXT *const lc = get_layer_context(cpi);
174 vp9_rc_set_gf_max_interval(cpi, lrc);
177 void vp9_restore_layer_context(VP9_COMP *const cpi) {
178 LAYER_CONTEXT *const lc = get_layer_context(cpi);
179 const int old_frame_since_key = cpi->rc.frames_since_key;
180 const int old_frame_to_key = cpi->rc.frames_to_key;
182 cpi->rc = lc->rc;
183 cpi->twopass = lc->twopass;
184 cpi->oxcf.target_bandwidth = lc->target_bandwidth;
185 cpi->alt_ref_source = lc->alt_ref_source;
188 if (cpi->svc.number_temporal_layers > 1) {
189 cpi->rc.frames_since_key = old_frame_since_key;
190 cpi->rc.frames_to_key = old_frame_to_key;
194 void vp9_save_layer_context(VP9_COMP *const cpi) {
195 const VP9EncoderConfig *const oxcf = &cpi->oxcf;
196 LAYER_CONTEXT *const lc = get_layer_context(cpi);
198 lc->rc = cpi->rc;
199 lc->twopass = cpi->twopass;
201 lc->alt_ref_source = cpi->alt_ref_source;
204 void vp9_init_second_pass_spatial_svc(VP9_COMP *cpi) {
205 SVC *const svc = &cpi->svc;
212 vp9_init_second_pass(cpi);
220 void vp9_inc_frame_in_layer(VP9_COMP *const cpi) {
222 (cpi->svc.number_temporal_layers > 1 && cpi->oxcf.rc_mode == VPX_CBR) ?
223 &cpi->svc.layer_context[cpi->svc.temporal_layer_id] :
224 &cpi->svc.layer_context[cpi->svc.spatial_layer_id];
229 int vp9_is_upper_layer_key_frame(const VP9_COMP *const cpi) {
230 return is_two_pass_svc(cpi) &&
231 cpi->svc.spatial_layer_id > 0 &&
232 cpi->svc.layer_context[cpi->svc.spatial_layer_id].is_key_frame;
255 int vp9_svc_start_frame(VP9_COMP *const cpi) {
258 int count = 1 << (cpi->svc.number_temporal_layers - 1);
260 cpi->svc.spatial_layer_id = cpi->svc.spatial_layer_to_encode;
261 lc = &cpi->svc.layer_context[cpi->svc.spatial_layer_id];
263 cpi->svc.temporal_layer_id = 0;
265 ++cpi->svc.temporal_layer_id;
269 cpi->ref_frame_flags = VP9_ALT_FLAG | VP9_GOLD_FLAG | VP9_LAST_FLAG;
271 cpi->lst_fb_idx = cpi->svc.spatial_layer_id;
273 if (cpi->svc.spatial_layer_id == 0)
274 cpi->gld_fb_idx = (lc->gold_ref_idx >= 0) ?
275 lc->gold_ref_idx : cpi->lst_fb_idx;
277 cpi->gld_fb_idx = cpi->svc.spatial_layer_id - 1;
280 if (cpi->svc.spatial_layer_id >= 2) {
281 cpi->alt_fb_idx = cpi->svc.spatial_layer_id - 2;
283 cpi->alt_fb_idx = cpi->lst_fb_idx;
284 cpi->ref_frame_flags &= (~VP9_LAST_FLAG & ~VP9_ALT_FLAG);
287 if (cpi->oxcf.ss_play_alternate[cpi->svc.spatial_layer_id]) {
288 cpi->alt_fb_idx = lc->alt_ref_idx;
290 cpi->ref_frame_flags &= (~VP9_ALT_FLAG);
293 if (cpi->svc.spatial_layer_id == 0) {
294 cpi->alt_fb_idx = cpi->lst_fb_idx;
297 &cpi->svc.layer_context[cpi->svc.spatial_layer_id - 1];
299 if (cpi->oxcf.ss_play_alternate[cpi->svc.spatial_layer_id - 1] &&
301 cpi->alt_fb_idx = lc_lower->alt_ref_idx;
302 else if (cpi->svc.spatial_layer_id >= 2)
303 cpi->alt_fb_idx = cpi->svc.spatial_layer_id - 2;
305 cpi->alt_fb_idx = cpi->lst_fb_idx;
310 get_layer_resolution(cpi->oxcf.width, cpi->oxcf.height,
313 if (vp9_set_size_literal(cpi, width, height) != 0)
316 cpi->oxcf.worst_allowed_q = vp9_quantizer_to_qindex(lc->max_q);
317 cpi->oxcf.best_allowed_q = vp9_quantizer_to_qindex(lc->min_q);
319 vp9_change_config(cpi, &cpi->oxcf);
321 vp9_set_high_precision_mv(cpi, 1);
323 cpi->alt_ref_source = get_layer_context(cpi)->alt_ref_source;
328 struct lookahead_entry *vp9_svc_lookahead_pop(VP9_COMP *const cpi,
337 if (cpi->svc.spatial_layer_id == cpi->svc.number_spatial_layers - 1) {