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 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 } | 503 } |
504 | 504 |
505 for (i = 0; i < si->layers; ++i) { | 505 for (i = 0; i < si->layers; ++i) { |
506 if (total > 0) { | 506 if (total > 0) { |
507 enc_cfg->ss_target_bitrate[i] = (unsigned int) | 507 enc_cfg->ss_target_bitrate[i] = (unsigned int) |
508 (enc_cfg->rc_target_bitrate * alloc_ratio[i] / total); | 508 (enc_cfg->rc_target_bitrate * alloc_ratio[i] / total); |
509 } | 509 } |
510 } | 510 } |
511 } | 511 } |
512 | 512 |
| 513 #if CONFIG_SPATIAL_SVC |
513 for (i = 0; i < si->layers; ++i) | 514 for (i = 0; i < si->layers; ++i) |
514 enc_cfg->ss_enable_auto_alt_ref[i] = si->enable_auto_alt_ref[i]; | 515 enc_cfg->ss_enable_auto_alt_ref[i] = si->enable_auto_alt_ref[i]; |
| 516 #endif |
515 | 517 |
516 // modify encoder configuration | 518 // modify encoder configuration |
517 enc_cfg->ss_number_layers = si->layers; | 519 enc_cfg->ss_number_layers = si->layers; |
518 enc_cfg->ts_number_layers = 1; // Temporal layers not used in this encoder. | 520 enc_cfg->ts_number_layers = 1; // Temporal layers not used in this encoder. |
519 | 521 |
520 // TODO(ivanmaltz): determine if these values need to be set explicitly for | 522 // TODO(ivanmaltz): determine if these values need to be set explicitly for |
521 // svc, or if the normal default/override mechanism can be used | 523 // svc, or if the normal default/override mechanism can be used |
522 enc_cfg->rc_dropframe_thresh = 0; | 524 enc_cfg->rc_dropframe_thresh = 0; |
523 enc_cfg->rc_resize_allowed = 0; | 525 enc_cfg->rc_resize_allowed = 0; |
524 | 526 |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 } | 704 } |
703 si->rc_stats_buf = p; | 705 si->rc_stats_buf = p; |
704 si->rc_stats_buf_size = new_size; | 706 si->rc_stats_buf_size = new_size; |
705 } | 707 } |
706 | 708 |
707 memcpy(si->rc_stats_buf + si->rc_stats_buf_used, | 709 memcpy(si->rc_stats_buf + si->rc_stats_buf_used, |
708 cx_pkt->data.twopass_stats.buf, cx_pkt->data.twopass_stats.sz); | 710 cx_pkt->data.twopass_stats.buf, cx_pkt->data.twopass_stats.sz); |
709 si->rc_stats_buf_used += cx_pkt->data.twopass_stats.sz; | 711 si->rc_stats_buf_used += cx_pkt->data.twopass_stats.sz; |
710 break; | 712 break; |
711 } | 713 } |
| 714 #if CONFIG_SPATIAL_SVC |
712 case VPX_CODEC_SPATIAL_SVC_LAYER_SIZES: { | 715 case VPX_CODEC_SPATIAL_SVC_LAYER_SIZES: { |
713 int i; | 716 int i; |
714 for (i = 0; i < si->layers; ++i) | 717 for (i = 0; i < si->layers; ++i) |
715 si->bytes_sum[i] += cx_pkt->data.layer_sizes[i]; | 718 si->bytes_sum[i] += cx_pkt->data.layer_sizes[i]; |
716 break; | 719 break; |
717 } | 720 } |
| 721 #endif |
718 default: { | 722 default: { |
719 break; | 723 break; |
720 } | 724 } |
721 } | 725 } |
722 } | 726 } |
723 | 727 |
724 if (rawimg != NULL) { | 728 if (rawimg != NULL) { |
725 ++si->frame_within_gop; | 729 ++si->frame_within_gop; |
726 ++si->encode_frame_count; | 730 ++si->encode_frame_count; |
727 } | 731 } |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 return si->rc_stats_buf_used; | 869 return si->rc_stats_buf_used; |
866 } | 870 } |
867 | 871 |
868 char *vpx_svc_get_rc_stats_buffer(const SvcContext *svc_ctx) { | 872 char *vpx_svc_get_rc_stats_buffer(const SvcContext *svc_ctx) { |
869 const SvcInternal *const si = get_const_svc_internal(svc_ctx); | 873 const SvcInternal *const si = get_const_svc_internal(svc_ctx); |
870 if (svc_ctx == NULL || si == NULL) return NULL; | 874 if (svc_ctx == NULL || si == NULL) return NULL; |
871 return si->rc_stats_buf; | 875 return si->rc_stats_buf; |
872 } | 876 } |
873 | 877 |
874 | 878 |
OLD | NEW |