OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 for (i = 0; i < svc_ctx->spatial_layers; ++i) { | 343 for (i = 0; i < svc_ctx->spatial_layers; ++i) { |
344 if (si->svc_params.scaling_factor_den[i] > 0) { | 344 if (si->svc_params.scaling_factor_den[i] > 0) { |
345 alloc_ratio[i] = (float)(si->svc_params.scaling_factor_num[i] * 1.0 / | 345 alloc_ratio[i] = (float)(si->svc_params.scaling_factor_num[i] * 1.0 / |
346 si->svc_params.scaling_factor_den[i]); | 346 si->svc_params.scaling_factor_den[i]); |
347 | 347 |
348 alloc_ratio[i] *= alloc_ratio[i]; | 348 alloc_ratio[i] *= alloc_ratio[i]; |
349 total += alloc_ratio[i]; | 349 total += alloc_ratio[i]; |
350 } | 350 } |
351 } | 351 } |
352 | 352 |
353 for (i = 0; i < svc_ctx->spatial_layers; ++i) { | 353 for (i = 0; i < VPX_SS_MAX_LAYERS; ++i) { |
354 if (total > 0) { | 354 if (total > 0) { |
355 enc_cfg->ss_target_bitrate[i] = (unsigned int) | 355 enc_cfg->ss_target_bitrate[i] = (unsigned int) |
356 (enc_cfg->rc_target_bitrate * alloc_ratio[i] / total); | 356 (enc_cfg->rc_target_bitrate * alloc_ratio[i] / total); |
357 } | 357 } |
358 } | 358 } |
359 } | 359 } |
360 } | 360 } |
361 | 361 |
362 vpx_codec_err_t vpx_svc_init(SvcContext *svc_ctx, vpx_codec_ctx_t *codec_ctx, | 362 vpx_codec_err_t vpx_svc_init(SvcContext *svc_ctx, vpx_codec_ctx_t *codec_ctx, |
363 vpx_codec_iface_t *iface, | 363 vpx_codec_iface_t *iface, |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 if (svc_ctx == NULL) return; | 599 if (svc_ctx == NULL) return; |
600 // do not use get_svc_internal as it will unnecessarily allocate an | 600 // do not use get_svc_internal as it will unnecessarily allocate an |
601 // SvcInternal if it was not already allocated | 601 // SvcInternal if it was not already allocated |
602 si = (SvcInternal *)svc_ctx->internal; | 602 si = (SvcInternal *)svc_ctx->internal; |
603 if (si != NULL) { | 603 if (si != NULL) { |
604 free(si); | 604 free(si); |
605 svc_ctx->internal = NULL; | 605 svc_ctx->internal = NULL; |
606 } | 606 } |
607 } | 607 } |
608 | 608 |
OLD | NEW |