| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 vp9e_tune_content content; | 44 vp9e_tune_content content; |
| 45 vpx_color_space_t color_space; | 45 vpx_color_space_t color_space; |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 static struct vp9_extracfg default_extra_cfg = { | 48 static struct vp9_extracfg default_extra_cfg = { |
| 49 0, // cpu_used | 49 0, // cpu_used |
| 50 1, // enable_auto_alt_ref | 50 1, // enable_auto_alt_ref |
| 51 0, // noise_sensitivity | 51 0, // noise_sensitivity |
| 52 0, // sharpness | 52 0, // sharpness |
| 53 0, // static_thresh | 53 0, // static_thresh |
| 54 0, // tile_columns | 54 6, // tile_columns |
| 55 0, // tile_rows | 55 0, // tile_rows |
| 56 7, // arnr_max_frames | 56 7, // arnr_max_frames |
| 57 5, // arnr_strength | 57 5, // arnr_strength |
| 58 VP8_TUNE_PSNR, // tuning | 58 VP8_TUNE_PSNR, // tuning |
| 59 10, // cq_level | 59 10, // cq_level |
| 60 0, // rc_max_intra_bitrate_pct | 60 0, // rc_max_intra_bitrate_pct |
| 61 0, // rc_max_inter_bitrate_pct | 61 0, // rc_max_inter_bitrate_pct |
| 62 0, // gf_cbr_boost_pct | 62 0, // gf_cbr_boost_pct |
| 63 0, // lossless | 63 0, // lossless |
| 64 0, // frame_parallel_decoding_mode | 64 1, // frame_parallel_decoding_mode |
| 65 NO_AQ, // aq_mode | 65 NO_AQ, // aq_mode |
| 66 0, // frame_periodic_delta_q | 66 0, // frame_periodic_delta_q |
| 67 VPX_BITS_8, // Bit depth | 67 VPX_BITS_8, // Bit depth |
| 68 VP9E_CONTENT_DEFAULT, // content | 68 VP9E_CONTENT_DEFAULT, // content |
| 69 VPX_CS_UNKNOWN, // color space | 69 VPX_CS_UNKNOWN, // color space |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 struct vpx_codec_alg_priv { | 72 struct vpx_codec_alg_priv { |
| 73 vpx_codec_priv_t base; | 73 vpx_codec_priv_t base; |
| 74 vpx_codec_enc_cfg_t cfg; | 74 vpx_codec_enc_cfg_t cfg; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 RANGE_CHECK_HI(cfg, g_profile, 3); | 151 RANGE_CHECK_HI(cfg, g_profile, 3); |
| 152 | 152 |
| 153 RANGE_CHECK_HI(cfg, rc_max_quantizer, 63); | 153 RANGE_CHECK_HI(cfg, rc_max_quantizer, 63); |
| 154 RANGE_CHECK_HI(cfg, rc_min_quantizer, cfg->rc_max_quantizer); | 154 RANGE_CHECK_HI(cfg, rc_min_quantizer, cfg->rc_max_quantizer); |
| 155 RANGE_CHECK_BOOL(extra_cfg, lossless); | 155 RANGE_CHECK_BOOL(extra_cfg, lossless); |
| 156 RANGE_CHECK(extra_cfg, aq_mode, 0, AQ_MODE_COUNT - 1); | 156 RANGE_CHECK(extra_cfg, aq_mode, 0, AQ_MODE_COUNT - 1); |
| 157 RANGE_CHECK(extra_cfg, frame_periodic_boost, 0, 1); | 157 RANGE_CHECK(extra_cfg, frame_periodic_boost, 0, 1); |
| 158 RANGE_CHECK_HI(cfg, g_threads, 64); | 158 RANGE_CHECK_HI(cfg, g_threads, 64); |
| 159 RANGE_CHECK_HI(cfg, g_lag_in_frames, MAX_LAG_BUFFERS); | 159 RANGE_CHECK_HI(cfg, g_lag_in_frames, MAX_LAG_BUFFERS); |
| 160 RANGE_CHECK(cfg, rc_end_usage, VPX_VBR, VPX_Q); | 160 RANGE_CHECK(cfg, rc_end_usage, VPX_VBR, VPX_Q); |
| 161 RANGE_CHECK_HI(cfg, rc_undershoot_pct, 1000); | 161 RANGE_CHECK_HI(cfg, rc_undershoot_pct, 100); |
| 162 RANGE_CHECK_HI(cfg, rc_overshoot_pct, 1000); | 162 RANGE_CHECK_HI(cfg, rc_overshoot_pct, 100); |
| 163 RANGE_CHECK_HI(cfg, rc_2pass_vbr_bias_pct, 100); | 163 RANGE_CHECK_HI(cfg, rc_2pass_vbr_bias_pct, 100); |
| 164 RANGE_CHECK(cfg, kf_mode, VPX_KF_DISABLED, VPX_KF_AUTO); | 164 RANGE_CHECK(cfg, kf_mode, VPX_KF_DISABLED, VPX_KF_AUTO); |
| 165 RANGE_CHECK_BOOL(cfg, rc_resize_allowed); | 165 RANGE_CHECK_BOOL(cfg, rc_resize_allowed); |
| 166 RANGE_CHECK_HI(cfg, rc_dropframe_thresh, 100); | 166 RANGE_CHECK_HI(cfg, rc_dropframe_thresh, 100); |
| 167 RANGE_CHECK_HI(cfg, rc_resize_up_thresh, 100); | 167 RANGE_CHECK_HI(cfg, rc_resize_up_thresh, 100); |
| 168 RANGE_CHECK_HI(cfg, rc_resize_down_thresh, 100); | 168 RANGE_CHECK_HI(cfg, rc_resize_down_thresh, 100); |
| 169 RANGE_CHECK(cfg, g_pass, VPX_RC_ONE_PASS, VPX_RC_LAST_PASS); | 169 RANGE_CHECK(cfg, g_pass, VPX_RC_ONE_PASS, VPX_RC_LAST_PASS); |
| 170 | 170 |
| 171 if (cfg->rc_resize_allowed == 1) { | 171 if (cfg->rc_resize_allowed == 1) { |
| 172 RANGE_CHECK(cfg, rc_scaled_width, 0, cfg->g_w); | 172 RANGE_CHECK(cfg, rc_scaled_width, 0, cfg->g_w); |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 543 // value, but we don't track the initial config, only the last successful | 543 // value, but we don't track the initial config, only the last successful |
| 544 // config. | 544 // config. |
| 545 if (cfg->g_lag_in_frames > ctx->cfg.g_lag_in_frames) | 545 if (cfg->g_lag_in_frames > ctx->cfg.g_lag_in_frames) |
| 546 ERROR("Cannot increase lag_in_frames"); | 546 ERROR("Cannot increase lag_in_frames"); |
| 547 | 547 |
| 548 res = validate_config(ctx, cfg, &ctx->extra_cfg); | 548 res = validate_config(ctx, cfg, &ctx->extra_cfg); |
| 549 | 549 |
| 550 if (res == VPX_CODEC_OK) { | 550 if (res == VPX_CODEC_OK) { |
| 551 ctx->cfg = *cfg; | 551 ctx->cfg = *cfg; |
| 552 set_encoder_config(&ctx->oxcf, &ctx->cfg, &ctx->extra_cfg); | 552 set_encoder_config(&ctx->oxcf, &ctx->cfg, &ctx->extra_cfg); |
| 553 // On profile change, request a key frame |
| 554 force_key |= ctx->cpi->common.profile != ctx->oxcf.profile; |
| 553 vp9_change_config(ctx->cpi, &ctx->oxcf); | 555 vp9_change_config(ctx->cpi, &ctx->oxcf); |
| 554 } | 556 } |
| 555 | 557 |
| 556 if (force_key) | 558 if (force_key) |
| 557 ctx->next_frame_flags |= VPX_EFLAG_FORCE_KF; | 559 ctx->next_frame_flags |= VPX_EFLAG_FORCE_KF; |
| 558 | 560 |
| 559 return res; | 561 return res; |
| 560 } | 562 } |
| 561 | 563 |
| 562 static vpx_codec_err_t ctrl_get_quantizer(vpx_codec_alg_priv_t *ctx, | 564 static vpx_codec_err_t ctrl_get_quantizer(vpx_codec_alg_priv_t *ctx, |
| (...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1405 {VP9E_GET_SVC_LAYER_ID, ctrl_get_svc_layer_id}, | 1407 {VP9E_GET_SVC_LAYER_ID, ctrl_get_svc_layer_id}, |
| 1406 | 1408 |
| 1407 { -1, NULL}, | 1409 { -1, NULL}, |
| 1408 }; | 1410 }; |
| 1409 | 1411 |
| 1410 static vpx_codec_enc_cfg_map_t encoder_usage_cfg_map[] = { | 1412 static vpx_codec_enc_cfg_map_t encoder_usage_cfg_map[] = { |
| 1411 { | 1413 { |
| 1412 0, | 1414 0, |
| 1413 { // NOLINT | 1415 { // NOLINT |
| 1414 0, // g_usage | 1416 0, // g_usage |
| 1415 0, // g_threads | 1417 8, // g_threads |
| 1416 0, // g_profile | 1418 0, // g_profile |
| 1417 | 1419 |
| 1418 320, // g_width | 1420 320, // g_width |
| 1419 240, // g_height | 1421 240, // g_height |
| 1420 VPX_BITS_8, // g_bit_depth | 1422 VPX_BITS_8, // g_bit_depth |
| 1421 8, // g_input_bit_depth | 1423 8, // g_input_bit_depth |
| 1422 | 1424 |
| 1423 {1, 30}, // g_timebase | 1425 {1, 30}, // g_timebase |
| 1424 | 1426 |
| 1425 0, // g_error_resilient | 1427 0, // g_error_resilient |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1498 1, // 1 cfg map | 1500 1, // 1 cfg map |
| 1499 encoder_usage_cfg_map, // vpx_codec_enc_cfg_map_t | 1501 encoder_usage_cfg_map, // vpx_codec_enc_cfg_map_t |
| 1500 encoder_encode, // vpx_codec_encode_fn_t | 1502 encoder_encode, // vpx_codec_encode_fn_t |
| 1501 encoder_get_cxdata, // vpx_codec_get_cx_data_fn_t | 1503 encoder_get_cxdata, // vpx_codec_get_cx_data_fn_t |
| 1502 encoder_set_config, // vpx_codec_enc_config_set_fn_t | 1504 encoder_set_config, // vpx_codec_enc_config_set_fn_t |
| 1503 NULL, // vpx_codec_get_global_headers_fn_t | 1505 NULL, // vpx_codec_get_global_headers_fn_t |
| 1504 encoder_get_preview, // vpx_codec_get_preview_frame_fn_t | 1506 encoder_get_preview, // vpx_codec_get_preview_frame_fn_t |
| 1505 NULL // vpx_codec_enc_mr_get_mem_loc_fn_t | 1507 NULL // vpx_codec_enc_mr_get_mem_loc_fn_t |
| 1506 } | 1508 } |
| 1507 }; | 1509 }; |
| OLD | NEW |