| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2010 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 RANGE_CHECK_HI(cfg, rc_resize_down_thresh, 100); | 169 RANGE_CHECK_HI(cfg, rc_resize_down_thresh, 100); |
| 170 RANGE_CHECK(cfg, g_pass, VPX_RC_ONE_PASS, VPX_RC_LAST_PASS); | 170 RANGE_CHECK(cfg, g_pass, VPX_RC_ONE_PASS, VPX_RC_LAST_PASS); |
| 171 | 171 |
| 172 if (cfg->rc_resize_allowed == 1) { | 172 if (cfg->rc_resize_allowed == 1) { |
| 173 RANGE_CHECK(cfg, rc_scaled_width, 1, cfg->g_w); | 173 RANGE_CHECK(cfg, rc_scaled_width, 1, cfg->g_w); |
| 174 RANGE_CHECK(cfg, rc_scaled_height, 1, cfg->g_h); | 174 RANGE_CHECK(cfg, rc_scaled_height, 1, cfg->g_h); |
| 175 } | 175 } |
| 176 | 176 |
| 177 RANGE_CHECK(cfg, ss_number_layers, 1, VPX_SS_MAX_LAYERS); | 177 RANGE_CHECK(cfg, ss_number_layers, 1, VPX_SS_MAX_LAYERS); |
| 178 | 178 |
| 179 #ifdef CONFIG_SPATIAL_SVC | 179 #if CONFIG_SPATIAL_SVC |
| 180 if (cfg->ss_number_layers > 1) { | 180 if (cfg->ss_number_layers > 1) { |
| 181 unsigned int i, alt_ref_sum = 0; | 181 unsigned int i, alt_ref_sum = 0; |
| 182 for (i = 0; i < cfg->ss_number_layers; ++i) { | 182 for (i = 0; i < cfg->ss_number_layers; ++i) { |
| 183 if (cfg->ss_enable_auto_alt_ref[i]) | 183 if (cfg->ss_enable_auto_alt_ref[i]) |
| 184 ++alt_ref_sum; | 184 ++alt_ref_sum; |
| 185 } | 185 } |
| 186 if (alt_ref_sum > REF_FRAMES - cfg->ss_number_layers) | 186 if (alt_ref_sum > REF_FRAMES - cfg->ss_number_layers) |
| 187 ERROR("Not enough ref buffers for svc alt ref frames"); | 187 ERROR("Not enough ref buffers for svc alt ref frames"); |
| 188 } | 188 } |
| 189 #endif | 189 #endif |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 oxcf->aq_mode = extra_cfg->aq_mode; | 396 oxcf->aq_mode = extra_cfg->aq_mode; |
| 397 | 397 |
| 398 oxcf->frame_periodic_boost = extra_cfg->frame_periodic_boost; | 398 oxcf->frame_periodic_boost = extra_cfg->frame_periodic_boost; |
| 399 | 399 |
| 400 oxcf->ss_number_layers = cfg->ss_number_layers; | 400 oxcf->ss_number_layers = cfg->ss_number_layers; |
| 401 | 401 |
| 402 if (oxcf->ss_number_layers > 1) { | 402 if (oxcf->ss_number_layers > 1) { |
| 403 int i; | 403 int i; |
| 404 for (i = 0; i < VPX_SS_MAX_LAYERS; ++i) { | 404 for (i = 0; i < VPX_SS_MAX_LAYERS; ++i) { |
| 405 oxcf->ss_target_bitrate[i] = 1000 * cfg->ss_target_bitrate[i]; | 405 oxcf->ss_target_bitrate[i] = 1000 * cfg->ss_target_bitrate[i]; |
| 406 #ifdef CONFIG_SPATIAL_SVC | 406 #if CONFIG_SPATIAL_SVC |
| 407 oxcf->ss_play_alternate[i] = cfg->ss_enable_auto_alt_ref[i]; | 407 oxcf->ss_play_alternate[i] = cfg->ss_enable_auto_alt_ref[i]; |
| 408 #endif | 408 #endif |
| 409 } | 409 } |
| 410 } else if (oxcf->ss_number_layers == 1) { | 410 } else if (oxcf->ss_number_layers == 1) { |
| 411 oxcf->ss_target_bitrate[0] = (int)oxcf->target_bandwidth; | 411 oxcf->ss_target_bitrate[0] = (int)oxcf->target_bandwidth; |
| 412 } | 412 } |
| 413 | 413 |
| 414 oxcf->ts_number_layers = cfg->ts_number_layers; | 414 oxcf->ts_number_layers = cfg->ts_number_layers; |
| 415 | 415 |
| 416 if (oxcf->ts_number_layers > 1) { | 416 if (oxcf->ts_number_layers > 1) { |
| (...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 881 | 881 |
| 882 while (cx_data_sz >= ctx->cx_data_sz / 2 && | 882 while (cx_data_sz >= ctx->cx_data_sz / 2 && |
| 883 -1 != vp9_get_compressed_data(ctx->cpi, &lib_flags, &size, | 883 -1 != vp9_get_compressed_data(ctx->cpi, &lib_flags, &size, |
| 884 cx_data, &dst_time_stamp, | 884 cx_data, &dst_time_stamp, |
| 885 &dst_end_time_stamp, !img)) { | 885 &dst_end_time_stamp, !img)) { |
| 886 if (size) { | 886 if (size) { |
| 887 vpx_codec_pts_t round, delta; | 887 vpx_codec_pts_t round, delta; |
| 888 vpx_codec_cx_pkt_t pkt; | 888 vpx_codec_cx_pkt_t pkt; |
| 889 VP9_COMP *const cpi = (VP9_COMP *)ctx->cpi; | 889 VP9_COMP *const cpi = (VP9_COMP *)ctx->cpi; |
| 890 | 890 |
| 891 #ifdef CONFIG_SPATIAL_SVC | 891 #if CONFIG_SPATIAL_SVC |
| 892 if (cpi->use_svc && cpi->svc.number_temporal_layers == 1) | 892 if (cpi->use_svc && cpi->svc.number_temporal_layers == 1) |
| 893 cpi->svc.layer_context[cpi->svc.spatial_layer_id].layer_size += size; | 893 cpi->svc.layer_context[cpi->svc.spatial_layer_id].layer_size += size; |
| 894 #endif | 894 #endif |
| 895 | 895 |
| 896 // Pack invisible frames with the next visible frame | 896 // Pack invisible frames with the next visible frame |
| 897 if (cpi->common.show_frame == 0 | 897 if (cpi->common.show_frame == 0 |
| 898 #ifdef CONFIG_SPATIAL_SVC | 898 #if CONFIG_SPATIAL_SVC |
| 899 || (cpi->use_svc && cpi->svc.number_temporal_layers == 1 && | 899 || (cpi->use_svc && cpi->svc.number_temporal_layers == 1 && |
| 900 cpi->svc.spatial_layer_id < cpi->svc.number_spatial_layers - 1) | 900 cpi->svc.spatial_layer_id < cpi->svc.number_spatial_layers - 1) |
| 901 #endif | 901 #endif |
| 902 ) { | 902 ) { |
| 903 if (ctx->pending_cx_data == 0) | 903 if (ctx->pending_cx_data == 0) |
| 904 ctx->pending_cx_data = cx_data; | 904 ctx->pending_cx_data = cx_data; |
| 905 ctx->pending_cx_data_sz += size; | 905 ctx->pending_cx_data_sz += size; |
| 906 ctx->pending_frame_sizes[ctx->pending_frame_count++] = size; | 906 ctx->pending_frame_sizes[ctx->pending_frame_count++] = size; |
| 907 ctx->pending_frame_magnitude |= size; | 907 ctx->pending_frame_magnitude |= size; |
| 908 cx_data += size; | 908 cx_data += size; |
| 909 cx_data_sz -= size; | 909 cx_data_sz -= size; |
| 910 continue; | 910 continue; |
| 911 } | 911 } |
| 912 | 912 |
| 913 // Add the frame packet to the list of returned packets. | 913 // Add the frame packet to the list of returned packets. |
| 914 round = (vpx_codec_pts_t)10000000 * ctx->cfg.g_timebase.num / 2 - 1; | 914 round = (vpx_codec_pts_t)10000000 * ctx->cfg.g_timebase.num / 2 - 1; |
| 915 delta = (dst_end_time_stamp - dst_time_stamp); | 915 delta = (dst_end_time_stamp - dst_time_stamp); |
| 916 pkt.kind = VPX_CODEC_CX_FRAME_PKT; | 916 pkt.kind = VPX_CODEC_CX_FRAME_PKT; |
| 917 pkt.data.frame.pts = | 917 pkt.data.frame.pts = |
| 918 (dst_time_stamp * ctx->cfg.g_timebase.den + round) | 918 (dst_time_stamp * ctx->cfg.g_timebase.den + round) |
| 919 / ctx->cfg.g_timebase.num / 10000000; | 919 / ctx->cfg.g_timebase.num / 10000000; |
| 920 pkt.data.frame.duration = (unsigned long) | 920 pkt.data.frame.duration = (unsigned long) |
| 921 ((delta * ctx->cfg.g_timebase.den + round) | 921 ((delta * ctx->cfg.g_timebase.den + round) |
| 922 / ctx->cfg.g_timebase.num / 10000000); | 922 / ctx->cfg.g_timebase.num / 10000000); |
| 923 pkt.data.frame.flags = lib_flags << 16; | 923 pkt.data.frame.flags = lib_flags << 16; |
| 924 | 924 |
| 925 if (lib_flags & FRAMEFLAGS_KEY | 925 if (lib_flags & FRAMEFLAGS_KEY |
| 926 #ifdef CONFIG_SPATIAL_SVC | 926 #if CONFIG_SPATIAL_SVC |
| 927 || (cpi->use_svc && cpi->svc.number_temporal_layers == 1 && | 927 || (cpi->use_svc && cpi->svc.number_temporal_layers == 1 && |
| 928 cpi->svc.layer_context[0].is_key_frame) | 928 cpi->svc.layer_context[0].is_key_frame) |
| 929 #endif | 929 #endif |
| 930 ) | 930 ) |
| 931 pkt.data.frame.flags |= VPX_FRAME_IS_KEY; | 931 pkt.data.frame.flags |= VPX_FRAME_IS_KEY; |
| 932 | 932 |
| 933 if (cpi->common.show_frame == 0) { | 933 if (cpi->common.show_frame == 0) { |
| 934 pkt.data.frame.flags |= VPX_FRAME_IS_INVISIBLE; | 934 pkt.data.frame.flags |= VPX_FRAME_IS_INVISIBLE; |
| 935 | 935 |
| 936 // This timestamp should be as close as possible to the | 936 // This timestamp should be as close as possible to the |
| (...skipping 21 matching lines...) Expand all Loading... |
| 958 ctx->pending_frame_count = 0; | 958 ctx->pending_frame_count = 0; |
| 959 ctx->pending_frame_magnitude = 0; | 959 ctx->pending_frame_magnitude = 0; |
| 960 } else { | 960 } else { |
| 961 pkt.data.frame.buf = cx_data; | 961 pkt.data.frame.buf = cx_data; |
| 962 pkt.data.frame.sz = size; | 962 pkt.data.frame.sz = size; |
| 963 } | 963 } |
| 964 pkt.data.frame.partition_id = -1; | 964 pkt.data.frame.partition_id = -1; |
| 965 vpx_codec_pkt_list_add(&ctx->pkt_list.head, &pkt); | 965 vpx_codec_pkt_list_add(&ctx->pkt_list.head, &pkt); |
| 966 cx_data += size; | 966 cx_data += size; |
| 967 cx_data_sz -= size; | 967 cx_data_sz -= size; |
| 968 #ifdef CONFIG_SPATIAL_SVC | 968 #if CONFIG_SPATIAL_SVC |
| 969 if (cpi->use_svc && cpi->svc.number_temporal_layers == 1) { | 969 if (cpi->use_svc && cpi->svc.number_temporal_layers == 1) { |
| 970 vpx_codec_cx_pkt_t pkt = {0}; | 970 vpx_codec_cx_pkt_t pkt = {0}; |
| 971 int i; | 971 int i; |
| 972 pkt.kind = VPX_CODEC_SPATIAL_SVC_LAYER_SIZES; | 972 pkt.kind = VPX_CODEC_SPATIAL_SVC_LAYER_SIZES; |
| 973 for (i = 0; i < cpi->svc.number_spatial_layers; ++i) { | 973 for (i = 0; i < cpi->svc.number_spatial_layers; ++i) { |
| 974 pkt.data.layer_sizes[i] = cpi->svc.layer_context[i].layer_size; | 974 pkt.data.layer_sizes[i] = cpi->svc.layer_context[i].layer_size; |
| 975 cpi->svc.layer_context[i].layer_size = 0; | 975 cpi->svc.layer_context[i].layer_size = 0; |
| 976 } | 976 } |
| 977 vpx_codec_pkt_list_add(&ctx->pkt_list.head, &pkt); | 977 vpx_codec_pkt_list_add(&ctx->pkt_list.head, &pkt); |
| 978 } | 978 } |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1280 50, // rc_two_pass_vbrbias | 1280 50, // rc_two_pass_vbrbias |
| 1281 0, // rc_two_pass_vbrmin_section | 1281 0, // rc_two_pass_vbrmin_section |
| 1282 2000, // rc_two_pass_vbrmax_section | 1282 2000, // rc_two_pass_vbrmax_section |
| 1283 | 1283 |
| 1284 // keyframing settings (kf) | 1284 // keyframing settings (kf) |
| 1285 VPX_KF_AUTO, // g_kfmode | 1285 VPX_KF_AUTO, // g_kfmode |
| 1286 0, // kf_min_dist | 1286 0, // kf_min_dist |
| 1287 9999, // kf_max_dist | 1287 9999, // kf_max_dist |
| 1288 | 1288 |
| 1289 VPX_SS_DEFAULT_LAYERS, // ss_number_layers | 1289 VPX_SS_DEFAULT_LAYERS, // ss_number_layers |
| 1290 #ifdef CONFIG_SPATIAL_SVC | 1290 #if CONFIG_SPATIAL_SVC |
| 1291 {0}, | 1291 {0}, |
| 1292 #endif | 1292 #endif |
| 1293 {0}, // ss_target_bitrate | 1293 {0}, // ss_target_bitrate |
| 1294 1, // ts_number_layers | 1294 1, // ts_number_layers |
| 1295 {0}, // ts_target_bitrate | 1295 {0}, // ts_target_bitrate |
| 1296 {0}, // ts_rate_decimator | 1296 {0}, // ts_rate_decimator |
| 1297 0, // ts_periodicity | 1297 0, // ts_periodicity |
| 1298 {0}, // ts_layer_id | 1298 {0}, // ts_layer_id |
| 1299 #if VPX_ENCODER_ABI_VERSION == (1 + VPX_CODEC_ABI_VERSION) | 1299 #if VPX_ENCODER_ABI_VERSION == (1 + VPX_CODEC_ABI_VERSION) |
| 1300 "vp8.fpf" // first pass filename | 1300 "vp8.fpf" // first pass filename |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1326 { // NOLINT | 1326 { // NOLINT |
| 1327 encoder_usage_cfg_map, // vpx_codec_enc_cfg_map_t | 1327 encoder_usage_cfg_map, // vpx_codec_enc_cfg_map_t |
| 1328 encoder_encode, // vpx_codec_encode_fn_t | 1328 encoder_encode, // vpx_codec_encode_fn_t |
| 1329 encoder_get_cxdata, // vpx_codec_get_cx_data_fn_t | 1329 encoder_get_cxdata, // vpx_codec_get_cx_data_fn_t |
| 1330 encoder_set_config, // vpx_codec_enc_config_set_fn_t | 1330 encoder_set_config, // vpx_codec_enc_config_set_fn_t |
| 1331 NOT_IMPLEMENTED, // vpx_codec_get_global_headers_fn_t | 1331 NOT_IMPLEMENTED, // vpx_codec_get_global_headers_fn_t |
| 1332 encoder_get_preview, // vpx_codec_get_preview_frame_fn_t | 1332 encoder_get_preview, // vpx_codec_get_preview_frame_fn_t |
| 1333 NOT_IMPLEMENTED // vpx_codec_enc_mr_get_mem_loc_fn_t | 1333 NOT_IMPLEMENTED // vpx_codec_enc_mr_get_mem_loc_fn_t |
| 1334 } | 1334 } |
| 1335 }; | 1335 }; |
| OLD | NEW |