Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: source/libvpx/vp9/encoder/vp9_svc_layercontext.c

Issue 996503002: libvpx: Pull from upstream (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/libvpx.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2014 The WebM project authors. All Rights Reserved. 2 * Copyright (c) 2014 The WebM project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 lc->target_bandwidth = oxcf->ss_target_bitrate[layer]; 84 lc->target_bandwidth = oxcf->ss_target_bitrate[layer];
85 lrc->last_q[KEY_FRAME] = oxcf->best_allowed_q; 85 lrc->last_q[KEY_FRAME] = oxcf->best_allowed_q;
86 lrc->last_q[INTER_FRAME] = oxcf->best_allowed_q; 86 lrc->last_q[INTER_FRAME] = oxcf->best_allowed_q;
87 lrc->avg_frame_qindex[KEY_FRAME] = (oxcf->worst_allowed_q + 87 lrc->avg_frame_qindex[KEY_FRAME] = (oxcf->worst_allowed_q +
88 oxcf->best_allowed_q) / 2; 88 oxcf->best_allowed_q) / 2;
89 lrc->avg_frame_qindex[INTER_FRAME] = (oxcf->worst_allowed_q + 89 lrc->avg_frame_qindex[INTER_FRAME] = (oxcf->worst_allowed_q +
90 oxcf->best_allowed_q) / 2; 90 oxcf->best_allowed_q) / 2;
91 if (oxcf->ss_enable_auto_arf[layer]) 91 if (oxcf->ss_enable_auto_arf[layer])
92 lc->alt_ref_idx = alt_ref_idx++; 92 lc->alt_ref_idx = alt_ref_idx++;
93 else 93 else
94 lc->alt_ref_idx = -1; 94 lc->alt_ref_idx = INVALID_IDX;
95 lc->gold_ref_idx = -1; 95 lc->gold_ref_idx = INVALID_IDX;
96 } 96 }
97 97
98 lrc->buffer_level = oxcf->starting_buffer_level_ms * 98 lrc->buffer_level = oxcf->starting_buffer_level_ms *
99 lc->target_bandwidth / 1000; 99 lc->target_bandwidth / 1000;
100 lrc->bits_off_target = lrc->buffer_level; 100 lrc->bits_off_target = lrc->buffer_level;
101 } 101 }
102 102
103 // Still have extra buffer for base layer golden frame 103 // Still have extra buffer for base layer golden frame
104 if (!(svc->number_temporal_layers > 1 && cpi->oxcf.rc_mode == VPX_CBR) 104 if (!(svc->number_temporal_layers > 1 && cpi->oxcf.rc_mode == VPX_CBR)
105 && alt_ref_idx < REF_FRAMES) 105 && alt_ref_idx < REF_FRAMES)
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 cpi->svc.empty_frame_height = (cpi->svc.empty_frame_height + 1) & ~1; 373 cpi->svc.empty_frame_height = (cpi->svc.empty_frame_height + 1) & ~1;
374 if (cpi->svc.empty_frame_height < 16) 374 if (cpi->svc.empty_frame_height < 16)
375 cpi->svc.empty_frame_height = 16; 375 cpi->svc.empty_frame_height = 16;
376 376
377 width = cpi->svc.empty_frame_width; 377 width = cpi->svc.empty_frame_width;
378 height = cpi->svc.empty_frame_height; 378 height = cpi->svc.empty_frame_height;
379 } 379 }
380 } 380 }
381 } 381 }
382 382
383 if (vp9_set_size_literal(cpi, width, height) != 0)
384 return VPX_CODEC_INVALID_PARAM;
385
386 cpi->oxcf.worst_allowed_q = vp9_quantizer_to_qindex(lc->max_q); 383 cpi->oxcf.worst_allowed_q = vp9_quantizer_to_qindex(lc->max_q);
387 cpi->oxcf.best_allowed_q = vp9_quantizer_to_qindex(lc->min_q); 384 cpi->oxcf.best_allowed_q = vp9_quantizer_to_qindex(lc->min_q);
388 385
389 vp9_change_config(cpi, &cpi->oxcf); 386 vp9_change_config(cpi, &cpi->oxcf);
387
388 if (vp9_set_size_literal(cpi, width, height) != 0)
389 return VPX_CODEC_INVALID_PARAM;
390
390 vp9_set_high_precision_mv(cpi, 1); 391 vp9_set_high_precision_mv(cpi, 1);
391 392
392 cpi->alt_ref_source = get_layer_context(cpi)->alt_ref_source; 393 cpi->alt_ref_source = get_layer_context(cpi)->alt_ref_source;
393 394
394 return 0; 395 return 0;
395 } 396 }
396 397
397 struct lookahead_entry *vp9_svc_lookahead_pop(VP9_COMP *const cpi, 398 struct lookahead_entry *vp9_svc_lookahead_pop(VP9_COMP *const cpi,
398 struct lookahead_ctx *ctx, 399 struct lookahead_ctx *ctx,
399 int drain) { 400 int drain) {
400 struct lookahead_entry *buf = NULL; 401 struct lookahead_entry *buf = NULL;
401 402
402 if (ctx->sz && (drain || ctx->sz == ctx->max_sz - MAX_PRE_FRAMES)) { 403 if (ctx->sz && (drain || ctx->sz == ctx->max_sz - MAX_PRE_FRAMES)) {
403 buf = vp9_lookahead_peek(ctx, 0); 404 buf = vp9_lookahead_peek(ctx, 0);
404 if (buf != NULL) { 405 if (buf != NULL) {
405 // Only remove the buffer when pop the highest layer. 406 // Only remove the buffer when pop the highest layer.
406 if (cpi->svc.spatial_layer_id == cpi->svc.number_spatial_layers - 1) { 407 if (cpi->svc.spatial_layer_id == cpi->svc.number_spatial_layers - 1) {
407 vp9_lookahead_pop(ctx, drain); 408 vp9_lookahead_pop(ctx, drain);
408 } 409 }
409 } 410 }
410 } 411 }
411 412
412 return buf; 413 return buf;
413 } 414 }
414 #endif 415 #endif
OLDNEW
« no previous file with comments | « source/libvpx/vp9/encoder/vp9_rdopt.c ('k') | source/libvpx/vp9/encoder/x86/vp9_avg_intrin_sse2.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698