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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 RANGE_CHECK(extra_cfg, arnr_max_frames, 0, 15); | 204 RANGE_CHECK(extra_cfg, arnr_max_frames, 0, 15); |
205 RANGE_CHECK_HI(extra_cfg, arnr_strength, 6); | 205 RANGE_CHECK_HI(extra_cfg, arnr_strength, 6); |
206 RANGE_CHECK(extra_cfg, arnr_type, 1, 3); | 206 RANGE_CHECK(extra_cfg, arnr_type, 1, 3); |
207 RANGE_CHECK(extra_cfg, cq_level, 0, 63); | 207 RANGE_CHECK(extra_cfg, cq_level, 0, 63); |
208 | 208 |
209 // TODO(yaowu): remove this when ssim tuning is implemented for vp9 | 209 // TODO(yaowu): remove this when ssim tuning is implemented for vp9 |
210 if (extra_cfg->tuning == VP8_TUNE_SSIM) | 210 if (extra_cfg->tuning == VP8_TUNE_SSIM) |
211 ERROR("Option --tune=ssim is not currently supported in VP9."); | 211 ERROR("Option --tune=ssim is not currently supported in VP9."); |
212 | 212 |
213 if (cfg->g_pass == VPX_RC_LAST_PASS) { | 213 if (cfg->g_pass == VPX_RC_LAST_PASS) { |
214 size_t packet_sz = sizeof(FIRSTPASS_STATS); | 214 const size_t packet_sz = sizeof(FIRSTPASS_STATS); |
215 int n_packets = (int)(cfg->rc_twopass_stats_in.sz / packet_sz); | 215 const int n_packets = (int)(cfg->rc_twopass_stats_in.sz / packet_sz); |
216 const FIRSTPASS_STATS *stats; | 216 const FIRSTPASS_STATS *stats; |
217 | 217 |
218 if (cfg->rc_twopass_stats_in.buf == NULL) | 218 if (cfg->rc_twopass_stats_in.buf == NULL) |
219 ERROR("rc_twopass_stats_in.buf not set."); | 219 ERROR("rc_twopass_stats_in.buf not set."); |
220 | 220 |
221 if (cfg->rc_twopass_stats_in.sz % packet_sz) | 221 if (cfg->rc_twopass_stats_in.sz % packet_sz) |
222 ERROR("rc_twopass_stats_in.sz indicates truncated packet."); | 222 ERROR("rc_twopass_stats_in.sz indicates truncated packet."); |
223 | 223 |
224 if (cfg->ss_number_layers > 1) { | 224 if (cfg->ss_number_layers > 1) { |
225 int i; | 225 int i; |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 case VPX_RC_FIRST_PASS: | 311 case VPX_RC_FIRST_PASS: |
312 oxcf->mode = TWO_PASS_FIRST; | 312 oxcf->mode = TWO_PASS_FIRST; |
313 break; | 313 break; |
314 case VPX_RC_LAST_PASS: | 314 case VPX_RC_LAST_PASS: |
315 oxcf->mode = TWO_PASS_SECOND_BEST; | 315 oxcf->mode = TWO_PASS_SECOND_BEST; |
316 break; | 316 break; |
317 } | 317 } |
318 | 318 |
319 oxcf->lag_in_frames = cfg->g_pass == VPX_RC_FIRST_PASS ? 0 | 319 oxcf->lag_in_frames = cfg->g_pass == VPX_RC_FIRST_PASS ? 0 |
320 : cfg->g_lag_in_frames; | 320 : cfg->g_lag_in_frames; |
| 321 oxcf->rc_mode = cfg->rc_end_usage; |
321 | 322 |
322 oxcf->rc_mode = RC_MODE_VBR; | 323 // Convert target bandwidth from Kbit/s to Bit/s |
323 if (cfg->rc_end_usage == VPX_CQ) | 324 oxcf->target_bandwidth = 1000 * cfg->rc_target_bitrate; |
324 oxcf->rc_mode = RC_MODE_CONSTRAINED_QUALITY; | |
325 else if (cfg->rc_end_usage == VPX_Q) | |
326 oxcf->rc_mode = RC_MODE_CONSTANT_QUALITY; | |
327 else if (cfg->rc_end_usage == VPX_CBR) | |
328 oxcf->rc_mode = RC_MODE_CBR; | |
329 | |
330 oxcf->target_bandwidth = cfg->rc_target_bitrate; | |
331 oxcf->rc_max_intra_bitrate_pct = extra_cfg->rc_max_intra_bitrate_pct; | 325 oxcf->rc_max_intra_bitrate_pct = extra_cfg->rc_max_intra_bitrate_pct; |
332 | 326 |
333 oxcf->best_allowed_q = vp9_quantizer_to_qindex(cfg->rc_min_quantizer); | 327 oxcf->best_allowed_q = |
334 oxcf->worst_allowed_q = vp9_quantizer_to_qindex(cfg->rc_max_quantizer); | 328 extra_cfg->lossless ? 0 : vp9_quantizer_to_qindex(cfg->rc_min_quantizer); |
| 329 oxcf->worst_allowed_q = |
| 330 extra_cfg->lossless ? 0 : vp9_quantizer_to_qindex(cfg->rc_max_quantizer); |
335 oxcf->cq_level = vp9_quantizer_to_qindex(extra_cfg->cq_level); | 331 oxcf->cq_level = vp9_quantizer_to_qindex(extra_cfg->cq_level); |
336 oxcf->fixed_q = -1; | 332 oxcf->fixed_q = -1; |
337 | 333 |
338 oxcf->under_shoot_pct = cfg->rc_undershoot_pct; | 334 oxcf->under_shoot_pct = cfg->rc_undershoot_pct; |
339 oxcf->over_shoot_pct = cfg->rc_overshoot_pct; | 335 oxcf->over_shoot_pct = cfg->rc_overshoot_pct; |
340 | 336 |
341 oxcf->allow_spatial_resampling = cfg->rc_resize_allowed; | 337 oxcf->allow_spatial_resampling = cfg->rc_resize_allowed; |
342 oxcf->scaled_frame_width = cfg->rc_scaled_width; | 338 oxcf->scaled_frame_width = cfg->rc_scaled_width; |
343 oxcf->scaled_frame_height = cfg->rc_scaled_height; | 339 oxcf->scaled_frame_height = cfg->rc_scaled_height; |
344 | 340 |
345 oxcf->maximum_buffer_size = cfg->rc_buf_sz; | 341 oxcf->maximum_buffer_size_ms = cfg->rc_buf_sz; |
346 oxcf->starting_buffer_level = cfg->rc_buf_initial_sz; | 342 oxcf->starting_buffer_level_ms = cfg->rc_buf_initial_sz; |
347 oxcf->optimal_buffer_level = cfg->rc_buf_optimal_sz; | 343 oxcf->optimal_buffer_level_ms = cfg->rc_buf_optimal_sz; |
348 | 344 |
349 oxcf->drop_frames_water_mark = cfg->rc_dropframe_thresh; | 345 oxcf->drop_frames_water_mark = cfg->rc_dropframe_thresh; |
350 | 346 |
351 oxcf->two_pass_vbrbias = cfg->rc_2pass_vbr_bias_pct; | 347 oxcf->two_pass_vbrbias = cfg->rc_2pass_vbr_bias_pct; |
352 oxcf->two_pass_vbrmin_section = cfg->rc_2pass_vbr_minsection_pct; | 348 oxcf->two_pass_vbrmin_section = cfg->rc_2pass_vbr_minsection_pct; |
353 oxcf->two_pass_vbrmax_section = cfg->rc_2pass_vbr_maxsection_pct; | 349 oxcf->two_pass_vbrmax_section = cfg->rc_2pass_vbr_maxsection_pct; |
354 | 350 |
355 oxcf->auto_key = cfg->kf_mode == VPX_KF_AUTO && | 351 oxcf->auto_key = cfg->kf_mode == VPX_KF_AUTO && |
356 cfg->kf_min_dist != cfg->kf_max_dist; | 352 cfg->kf_min_dist != cfg->kf_max_dist; |
357 | 353 |
(...skipping 10 matching lines...) Expand all Loading... |
368 | 364 |
369 oxcf->arnr_max_frames = extra_cfg->arnr_max_frames; | 365 oxcf->arnr_max_frames = extra_cfg->arnr_max_frames; |
370 oxcf->arnr_strength = extra_cfg->arnr_strength; | 366 oxcf->arnr_strength = extra_cfg->arnr_strength; |
371 oxcf->arnr_type = extra_cfg->arnr_type; | 367 oxcf->arnr_type = extra_cfg->arnr_type; |
372 | 368 |
373 oxcf->tuning = extra_cfg->tuning; | 369 oxcf->tuning = extra_cfg->tuning; |
374 | 370 |
375 oxcf->tile_columns = extra_cfg->tile_columns; | 371 oxcf->tile_columns = extra_cfg->tile_columns; |
376 oxcf->tile_rows = extra_cfg->tile_rows; | 372 oxcf->tile_rows = extra_cfg->tile_rows; |
377 | 373 |
378 oxcf->lossless = extra_cfg->lossless; | |
379 | |
380 oxcf->error_resilient_mode = cfg->g_error_resilient; | 374 oxcf->error_resilient_mode = cfg->g_error_resilient; |
381 oxcf->frame_parallel_decoding_mode = extra_cfg->frame_parallel_decoding_mode; | 375 oxcf->frame_parallel_decoding_mode = extra_cfg->frame_parallel_decoding_mode; |
382 | 376 |
383 oxcf->aq_mode = extra_cfg->aq_mode; | 377 oxcf->aq_mode = extra_cfg->aq_mode; |
384 | 378 |
385 oxcf->frame_periodic_boost = extra_cfg->frame_periodic_boost; | 379 oxcf->frame_periodic_boost = extra_cfg->frame_periodic_boost; |
386 | 380 |
387 oxcf->ss_number_layers = cfg->ss_number_layers; | 381 oxcf->ss_number_layers = cfg->ss_number_layers; |
388 | 382 |
389 if (oxcf->ss_number_layers > 1) { | 383 if (oxcf->ss_number_layers > 1) { |
390 vp9_copy(oxcf->ss_target_bitrate, cfg->ss_target_bitrate); | 384 int i; |
| 385 for (i = 0; i < VPX_SS_MAX_LAYERS; ++i) |
| 386 oxcf->ss_target_bitrate[i] = 1000 * cfg->ss_target_bitrate[i]; |
391 } else if (oxcf->ss_number_layers == 1) { | 387 } else if (oxcf->ss_number_layers == 1) { |
392 oxcf->ss_target_bitrate[0] = (int)oxcf->target_bandwidth; | 388 oxcf->ss_target_bitrate[0] = (int)oxcf->target_bandwidth; |
393 } | 389 } |
394 | 390 |
395 oxcf->ts_number_layers = cfg->ts_number_layers; | 391 oxcf->ts_number_layers = cfg->ts_number_layers; |
396 | 392 |
397 if (oxcf->ts_number_layers > 1) { | 393 if (oxcf->ts_number_layers > 1) { |
398 vp9_copy(oxcf->ts_target_bitrate, cfg->ts_target_bitrate); | 394 int i; |
399 vp9_copy(oxcf->ts_rate_decimator, cfg->ts_rate_decimator); | 395 for (i = 0; i < VPX_TS_MAX_LAYERS; ++i) { |
| 396 oxcf->ts_target_bitrate[i] = 1000 * cfg->ts_target_bitrate[i]; |
| 397 oxcf->ts_rate_decimator[i] = cfg->ts_rate_decimator[i]; |
| 398 } |
400 } else if (oxcf->ts_number_layers == 1) { | 399 } else if (oxcf->ts_number_layers == 1) { |
401 oxcf->ts_target_bitrate[0] = (int)oxcf->target_bandwidth; | 400 oxcf->ts_target_bitrate[0] = (int)oxcf->target_bandwidth; |
402 oxcf->ts_rate_decimator[0] = 1; | 401 oxcf->ts_rate_decimator[0] = 1; |
403 } | 402 } |
404 | 403 |
405 /* | 404 /* |
406 printf("Current VP9 Settings: \n"); | 405 printf("Current VP9 Settings: \n"); |
407 printf("target_bandwidth: %d\n", oxcf->target_bandwidth); | 406 printf("target_bandwidth: %d\n", oxcf->target_bandwidth); |
408 printf("noise_sensitivity: %d\n", oxcf->noise_sensitivity); | 407 printf("noise_sensitivity: %d\n", oxcf->noise_sensitivity); |
409 printf("sharpness: %d\n", oxcf->sharpness); | 408 printf("sharpness: %d\n", oxcf->sharpness); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 | 454 |
456 if (res == VPX_CODEC_OK) { | 455 if (res == VPX_CODEC_OK) { |
457 ctx->cfg = *cfg; | 456 ctx->cfg = *cfg; |
458 set_encoder_config(&ctx->oxcf, &ctx->cfg, &ctx->extra_cfg); | 457 set_encoder_config(&ctx->oxcf, &ctx->cfg, &ctx->extra_cfg); |
459 vp9_change_config(ctx->cpi, &ctx->oxcf); | 458 vp9_change_config(ctx->cpi, &ctx->oxcf); |
460 } | 459 } |
461 | 460 |
462 return res; | 461 return res; |
463 } | 462 } |
464 | 463 |
465 static vpx_codec_err_t ctrl_get_param(vpx_codec_alg_priv_t *ctx, int ctrl_id, | 464 static vpx_codec_err_t ctrl_get_quantizer(vpx_codec_alg_priv_t *ctx, |
466 va_list args) { | 465 va_list args) { |
467 void *arg = va_arg(args, void *); | 466 int *const arg = va_arg(args, int *); |
468 | |
469 #define MAP(id, var) case id: *(RECAST(id, arg)) = var; break | |
470 | |
471 if (arg == NULL) | 467 if (arg == NULL) |
472 return VPX_CODEC_INVALID_PARAM; | 468 return VPX_CODEC_INVALID_PARAM; |
473 | 469 *arg = vp9_get_quantizer(ctx->cpi); |
474 switch (ctrl_id) { | |
475 MAP(VP8E_GET_LAST_QUANTIZER, vp9_get_quantizer(ctx->cpi)); | |
476 MAP(VP8E_GET_LAST_QUANTIZER_64, | |
477 vp9_qindex_to_quantizer(vp9_get_quantizer(ctx->cpi))); | |
478 } | |
479 | |
480 return VPX_CODEC_OK; | 470 return VPX_CODEC_OK; |
481 #undef MAP | |
482 } | 471 } |
483 | 472 |
| 473 static vpx_codec_err_t ctrl_get_quantizer64(vpx_codec_alg_priv_t *ctx, |
| 474 va_list args) { |
| 475 int *const arg = va_arg(args, int *); |
| 476 if (arg == NULL) |
| 477 return VPX_CODEC_INVALID_PARAM; |
| 478 *arg = vp9_qindex_to_quantizer(vp9_get_quantizer(ctx->cpi)); |
| 479 return VPX_CODEC_OK; |
| 480 } |
484 | 481 |
485 static vpx_codec_err_t ctrl_set_param(vpx_codec_alg_priv_t *ctx, int ctrl_id, | 482 static vpx_codec_err_t update_extra_cfg(vpx_codec_alg_priv_t *ctx, |
486 va_list args) { | 483 const struct vp9_extracfg *extra_cfg) { |
487 vpx_codec_err_t res = VPX_CODEC_OK; | 484 const vpx_codec_err_t res = validate_config(ctx, &ctx->cfg, extra_cfg); |
488 struct vp9_extracfg extra_cfg = ctx->extra_cfg; | |
489 | |
490 #define MAP(id, var) case id: var = CAST(id, args); break; | |
491 | |
492 switch (ctrl_id) { | |
493 MAP(VP8E_SET_CPUUSED, extra_cfg.cpu_used); | |
494 MAP(VP8E_SET_ENABLEAUTOALTREF, extra_cfg.enable_auto_alt_ref); | |
495 MAP(VP8E_SET_NOISE_SENSITIVITY, extra_cfg.noise_sensitivity); | |
496 MAP(VP8E_SET_SHARPNESS, extra_cfg.sharpness); | |
497 MAP(VP8E_SET_STATIC_THRESHOLD, extra_cfg.static_thresh); | |
498 MAP(VP9E_SET_TILE_COLUMNS, extra_cfg.tile_columns); | |
499 MAP(VP9E_SET_TILE_ROWS, extra_cfg.tile_rows); | |
500 MAP(VP8E_SET_ARNR_MAXFRAMES, extra_cfg.arnr_max_frames); | |
501 MAP(VP8E_SET_ARNR_STRENGTH, extra_cfg.arnr_strength); | |
502 MAP(VP8E_SET_ARNR_TYPE, extra_cfg.arnr_type); | |
503 MAP(VP8E_SET_TUNING, extra_cfg.tuning); | |
504 MAP(VP8E_SET_CQ_LEVEL, extra_cfg.cq_level); | |
505 MAP(VP8E_SET_MAX_INTRA_BITRATE_PCT, extra_cfg.rc_max_intra_bitrate_pct); | |
506 MAP(VP9E_SET_LOSSLESS, extra_cfg.lossless); | |
507 MAP(VP9E_SET_FRAME_PARALLEL_DECODING, | |
508 extra_cfg.frame_parallel_decoding_mode); | |
509 MAP(VP9E_SET_AQ_MODE, extra_cfg.aq_mode); | |
510 MAP(VP9E_SET_FRAME_PERIODIC_BOOST, extra_cfg.frame_periodic_boost); | |
511 } | |
512 | |
513 res = validate_config(ctx, &ctx->cfg, &extra_cfg); | |
514 | |
515 if (res == VPX_CODEC_OK) { | 485 if (res == VPX_CODEC_OK) { |
516 ctx->extra_cfg = extra_cfg; | 486 ctx->extra_cfg = *extra_cfg; |
517 set_encoder_config(&ctx->oxcf, &ctx->cfg, &ctx->extra_cfg); | 487 set_encoder_config(&ctx->oxcf, &ctx->cfg, &ctx->extra_cfg); |
518 vp9_change_config(ctx->cpi, &ctx->oxcf); | 488 vp9_change_config(ctx->cpi, &ctx->oxcf); |
519 } | 489 } |
| 490 return res; |
| 491 } |
520 | 492 |
521 return res; | 493 static vpx_codec_err_t ctrl_set_cpuused(vpx_codec_alg_priv_t *ctx, |
522 #undef MAP | 494 va_list args) { |
| 495 struct vp9_extracfg extra_cfg = ctx->extra_cfg; |
| 496 extra_cfg.cpu_used = CAST(VP8E_SET_CPUUSED, args); |
| 497 return update_extra_cfg(ctx, &extra_cfg); |
| 498 } |
| 499 |
| 500 static vpx_codec_err_t ctrl_set_enable_auto_alt_ref(vpx_codec_alg_priv_t *ctx, |
| 501 va_list args) { |
| 502 struct vp9_extracfg extra_cfg = ctx->extra_cfg; |
| 503 extra_cfg.enable_auto_alt_ref = CAST(VP8E_SET_ENABLEAUTOALTREF, args); |
| 504 return update_extra_cfg(ctx, &extra_cfg); |
| 505 } |
| 506 |
| 507 static vpx_codec_err_t ctrl_set_noise_sensitivity(vpx_codec_alg_priv_t *ctx, |
| 508 va_list args) { |
| 509 struct vp9_extracfg extra_cfg = ctx->extra_cfg; |
| 510 extra_cfg.noise_sensitivity = CAST(VP8E_SET_NOISE_SENSITIVITY, args); |
| 511 return update_extra_cfg(ctx, &extra_cfg); |
| 512 } |
| 513 |
| 514 static vpx_codec_err_t ctrl_set_sharpness(vpx_codec_alg_priv_t *ctx, |
| 515 va_list args) { |
| 516 struct vp9_extracfg extra_cfg = ctx->extra_cfg; |
| 517 extra_cfg.sharpness = CAST(VP8E_SET_SHARPNESS, args); |
| 518 return update_extra_cfg(ctx, &extra_cfg); |
| 519 } |
| 520 |
| 521 static vpx_codec_err_t ctrl_set_static_thresh(vpx_codec_alg_priv_t *ctx, |
| 522 va_list args) { |
| 523 struct vp9_extracfg extra_cfg = ctx->extra_cfg; |
| 524 extra_cfg.static_thresh = CAST(VP8E_SET_STATIC_THRESHOLD, args); |
| 525 return update_extra_cfg(ctx, &extra_cfg); |
| 526 } |
| 527 |
| 528 static vpx_codec_err_t ctrl_set_tile_columns(vpx_codec_alg_priv_t *ctx, |
| 529 va_list args) { |
| 530 struct vp9_extracfg extra_cfg = ctx->extra_cfg; |
| 531 extra_cfg.tile_columns = CAST(VP9E_SET_TILE_COLUMNS, args); |
| 532 return update_extra_cfg(ctx, &extra_cfg); |
| 533 } |
| 534 |
| 535 static vpx_codec_err_t ctrl_set_tile_rows(vpx_codec_alg_priv_t *ctx, |
| 536 va_list args) { |
| 537 struct vp9_extracfg extra_cfg = ctx->extra_cfg; |
| 538 extra_cfg.tile_rows = CAST(VP9E_SET_TILE_ROWS, args); |
| 539 return update_extra_cfg(ctx, &extra_cfg); |
| 540 } |
| 541 |
| 542 static vpx_codec_err_t ctrl_set_arnr_max_frames(vpx_codec_alg_priv_t *ctx, |
| 543 va_list args) { |
| 544 struct vp9_extracfg extra_cfg = ctx->extra_cfg; |
| 545 extra_cfg.arnr_max_frames = CAST(VP8E_SET_ARNR_MAXFRAMES, args); |
| 546 return update_extra_cfg(ctx, &extra_cfg); |
| 547 } |
| 548 |
| 549 static vpx_codec_err_t ctrl_set_arnr_strength(vpx_codec_alg_priv_t *ctx, |
| 550 va_list args) { |
| 551 struct vp9_extracfg extra_cfg = ctx->extra_cfg; |
| 552 extra_cfg.arnr_strength = CAST(VP8E_SET_ARNR_STRENGTH, args); |
| 553 return update_extra_cfg(ctx, &extra_cfg); |
| 554 } |
| 555 |
| 556 static vpx_codec_err_t ctrl_set_arnr_type(vpx_codec_alg_priv_t *ctx, |
| 557 va_list args) { |
| 558 struct vp9_extracfg extra_cfg = ctx->extra_cfg; |
| 559 extra_cfg.arnr_type = CAST(VP8E_SET_ARNR_TYPE, args); |
| 560 return update_extra_cfg(ctx, &extra_cfg); |
| 561 } |
| 562 |
| 563 static vpx_codec_err_t ctrl_set_tuning(vpx_codec_alg_priv_t *ctx, |
| 564 va_list args) { |
| 565 struct vp9_extracfg extra_cfg = ctx->extra_cfg; |
| 566 extra_cfg.tuning = CAST(VP8E_SET_TUNING, args); |
| 567 return update_extra_cfg(ctx, &extra_cfg); |
| 568 } |
| 569 |
| 570 static vpx_codec_err_t ctrl_set_cq_level(vpx_codec_alg_priv_t *ctx, |
| 571 va_list args) { |
| 572 struct vp9_extracfg extra_cfg = ctx->extra_cfg; |
| 573 extra_cfg.cq_level = CAST(VP8E_SET_CQ_LEVEL, args); |
| 574 return update_extra_cfg(ctx, &extra_cfg); |
| 575 } |
| 576 |
| 577 static vpx_codec_err_t ctrl_set_rc_max_intra_bitrate_pct( |
| 578 vpx_codec_alg_priv_t *ctx, va_list args) { |
| 579 struct vp9_extracfg extra_cfg = ctx->extra_cfg; |
| 580 extra_cfg.rc_max_intra_bitrate_pct = |
| 581 CAST(VP8E_SET_MAX_INTRA_BITRATE_PCT, args); |
| 582 return update_extra_cfg(ctx, &extra_cfg); |
| 583 } |
| 584 |
| 585 static vpx_codec_err_t ctrl_set_lossless(vpx_codec_alg_priv_t *ctx, |
| 586 va_list args) { |
| 587 struct vp9_extracfg extra_cfg = ctx->extra_cfg; |
| 588 extra_cfg.lossless = CAST(VP9E_SET_LOSSLESS, args); |
| 589 return update_extra_cfg(ctx, &extra_cfg); |
| 590 } |
| 591 |
| 592 static vpx_codec_err_t ctrl_set_frame_parallel_decoding_mode( |
| 593 vpx_codec_alg_priv_t *ctx, va_list args) { |
| 594 struct vp9_extracfg extra_cfg = ctx->extra_cfg; |
| 595 extra_cfg.frame_parallel_decoding_mode = |
| 596 CAST(VP9E_SET_FRAME_PARALLEL_DECODING, args); |
| 597 return update_extra_cfg(ctx, &extra_cfg); |
| 598 } |
| 599 |
| 600 static vpx_codec_err_t ctrl_set_aq_mode(vpx_codec_alg_priv_t *ctx, |
| 601 va_list args) { |
| 602 struct vp9_extracfg extra_cfg = ctx->extra_cfg; |
| 603 extra_cfg.aq_mode = CAST(VP9E_SET_AQ_MODE, args); |
| 604 return update_extra_cfg(ctx, &extra_cfg); |
| 605 } |
| 606 |
| 607 static vpx_codec_err_t ctrl_set_frame_periodic_boost(vpx_codec_alg_priv_t *ctx, |
| 608 va_list args) { |
| 609 struct vp9_extracfg extra_cfg = ctx->extra_cfg; |
| 610 extra_cfg.frame_periodic_boost = CAST(VP9E_SET_FRAME_PERIODIC_BOOST, args); |
| 611 return update_extra_cfg(ctx, &extra_cfg); |
523 } | 612 } |
524 | 613 |
525 static vpx_codec_err_t encoder_init(vpx_codec_ctx_t *ctx, | 614 static vpx_codec_err_t encoder_init(vpx_codec_ctx_t *ctx, |
526 vpx_codec_priv_enc_mr_cfg_t *data) { | 615 vpx_codec_priv_enc_mr_cfg_t *data) { |
527 vpx_codec_err_t res = VPX_CODEC_OK; | 616 vpx_codec_err_t res = VPX_CODEC_OK; |
| 617 (void)data; |
528 | 618 |
529 if (ctx->priv == NULL) { | 619 if (ctx->priv == NULL) { |
530 int i; | 620 int i; |
531 vpx_codec_enc_cfg_t *cfg; | 621 vpx_codec_enc_cfg_t *cfg; |
532 struct vpx_codec_alg_priv *priv = calloc(1, sizeof(*priv)); | 622 struct vpx_codec_alg_priv *priv = calloc(1, sizeof(*priv)); |
533 | 623 |
534 if (priv == NULL) | 624 if (priv == NULL) |
535 return VPX_CODEC_MEM_ERROR; | 625 return VPX_CODEC_MEM_ERROR; |
536 | 626 |
537 ctx->priv = &priv->base; | 627 ctx->priv = &priv->base; |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
873 vpx_codec_pkt_list_add(&ctx->pkt_list.head, &pkt); | 963 vpx_codec_pkt_list_add(&ctx->pkt_list.head, &pkt); |
874 cx_data += size; | 964 cx_data += size; |
875 cx_data_sz -= size; | 965 cx_data_sz -= size; |
876 } | 966 } |
877 } | 967 } |
878 } | 968 } |
879 | 969 |
880 return res; | 970 return res; |
881 } | 971 } |
882 | 972 |
883 static const vpx_codec_cx_pkt_t *encoder_get_cxdata(vpx_codec_alg_priv_t *ctx, | 973 static const vpx_codec_cx_pkt_t *encoder_get_cxdata(vpx_codec_alg_priv_t *ctx, |
884 vpx_codec_iter_t *iter) { | 974 vpx_codec_iter_t *iter) { |
885 return vpx_codec_pkt_list_get(&ctx->pkt_list.head, iter); | 975 return vpx_codec_pkt_list_get(&ctx->pkt_list.head, iter); |
886 } | 976 } |
887 | 977 |
888 static vpx_codec_err_t ctrl_set_reference(vpx_codec_alg_priv_t *ctx, | 978 static vpx_codec_err_t ctrl_set_reference(vpx_codec_alg_priv_t *ctx, |
889 int ctr_id, va_list args) { | 979 va_list args) { |
890 vpx_ref_frame_t *const frame = va_arg(args, vpx_ref_frame_t *); | 980 vpx_ref_frame_t *const frame = va_arg(args, vpx_ref_frame_t *); |
891 | 981 |
892 if (frame != NULL) { | 982 if (frame != NULL) { |
893 YV12_BUFFER_CONFIG sd; | 983 YV12_BUFFER_CONFIG sd; |
894 | 984 |
895 image2yuvconfig(&frame->img, &sd); | 985 image2yuvconfig(&frame->img, &sd); |
896 vp9_set_reference_enc(ctx->cpi, ref_frame_to_vp9_reframe(frame->frame_type), | 986 vp9_set_reference_enc(ctx->cpi, ref_frame_to_vp9_reframe(frame->frame_type), |
897 &sd); | 987 &sd); |
898 return VPX_CODEC_OK; | 988 return VPX_CODEC_OK; |
899 } else { | 989 } else { |
900 return VPX_CODEC_INVALID_PARAM; | 990 return VPX_CODEC_INVALID_PARAM; |
901 } | 991 } |
902 } | 992 } |
903 | 993 |
904 static vpx_codec_err_t ctrl_copy_reference(vpx_codec_alg_priv_t *ctx, | 994 static vpx_codec_err_t ctrl_copy_reference(vpx_codec_alg_priv_t *ctx, |
905 int ctr_id, va_list args) { | 995 va_list args) { |
906 vpx_ref_frame_t *const frame = va_arg(args, vpx_ref_frame_t *); | 996 vpx_ref_frame_t *const frame = va_arg(args, vpx_ref_frame_t *); |
907 | 997 |
908 if (frame != NULL) { | 998 if (frame != NULL) { |
909 YV12_BUFFER_CONFIG sd; | 999 YV12_BUFFER_CONFIG sd; |
910 | 1000 |
911 image2yuvconfig(&frame->img, &sd); | 1001 image2yuvconfig(&frame->img, &sd); |
912 vp9_copy_reference_enc(ctx->cpi, | 1002 vp9_copy_reference_enc(ctx->cpi, |
913 ref_frame_to_vp9_reframe(frame->frame_type), &sd); | 1003 ref_frame_to_vp9_reframe(frame->frame_type), &sd); |
914 return VPX_CODEC_OK; | 1004 return VPX_CODEC_OK; |
915 } else { | 1005 } else { |
916 return VPX_CODEC_INVALID_PARAM; | 1006 return VPX_CODEC_INVALID_PARAM; |
917 } | 1007 } |
918 } | 1008 } |
919 | 1009 |
920 static vpx_codec_err_t ctrl_get_reference(vpx_codec_alg_priv_t *ctx, | 1010 static vpx_codec_err_t ctrl_get_reference(vpx_codec_alg_priv_t *ctx, |
921 int ctr_id, va_list args) { | 1011 va_list args) { |
922 vp9_ref_frame_t *frame = va_arg(args, vp9_ref_frame_t *); | 1012 vp9_ref_frame_t *const frame = va_arg(args, vp9_ref_frame_t *); |
923 | 1013 |
924 if (frame != NULL) { | 1014 if (frame != NULL) { |
925 YV12_BUFFER_CONFIG* fb; | 1015 YV12_BUFFER_CONFIG *fb; |
926 | 1016 |
927 vp9_get_reference_enc(ctx->cpi, frame->idx, &fb); | 1017 vp9_get_reference_enc(ctx->cpi, frame->idx, &fb); |
928 yuvconfig2image(&frame->img, fb, NULL); | 1018 yuvconfig2image(&frame->img, fb, NULL); |
929 return VPX_CODEC_OK; | 1019 return VPX_CODEC_OK; |
930 } else { | 1020 } else { |
931 return VPX_CODEC_INVALID_PARAM; | 1021 return VPX_CODEC_INVALID_PARAM; |
932 } | 1022 } |
933 } | 1023 } |
934 | 1024 |
935 static vpx_codec_err_t ctrl_set_previewpp(vpx_codec_alg_priv_t *ctx, | 1025 static vpx_codec_err_t ctrl_set_previewpp(vpx_codec_alg_priv_t *ctx, |
936 int ctr_id, va_list args) { | 1026 va_list args) { |
937 #if CONFIG_VP9_POSTPROC | 1027 #if CONFIG_VP9_POSTPROC |
938 vp8_postproc_cfg_t *config = va_arg(args, vp8_postproc_cfg_t *); | 1028 vp8_postproc_cfg_t *config = va_arg(args, vp8_postproc_cfg_t *); |
939 (void)ctr_id; | |
940 | |
941 if (config != NULL) { | 1029 if (config != NULL) { |
942 ctx->preview_ppcfg = *config; | 1030 ctx->preview_ppcfg = *config; |
943 return VPX_CODEC_OK; | 1031 return VPX_CODEC_OK; |
944 } else { | 1032 } else { |
945 return VPX_CODEC_INVALID_PARAM; | 1033 return VPX_CODEC_INVALID_PARAM; |
946 } | 1034 } |
947 #else | 1035 #else |
948 (void)ctx; | 1036 (void)ctx; |
949 (void)ctr_id; | |
950 (void)args; | 1037 (void)args; |
951 return VPX_CODEC_INCAPABLE; | 1038 return VPX_CODEC_INCAPABLE; |
952 #endif | 1039 #endif |
953 } | 1040 } |
954 | 1041 |
955 | 1042 |
956 static vpx_image_t *encoder_get_preview(vpx_codec_alg_priv_t *ctx) { | 1043 static vpx_image_t *encoder_get_preview(vpx_codec_alg_priv_t *ctx) { |
957 YV12_BUFFER_CONFIG sd; | 1044 YV12_BUFFER_CONFIG sd; |
958 vp9_ppflags_t flags = {0}; | 1045 vp9_ppflags_t flags; |
| 1046 vp9_zero(flags); |
959 | 1047 |
960 if (ctx->preview_ppcfg.post_proc_flag) { | 1048 if (ctx->preview_ppcfg.post_proc_flag) { |
961 flags.post_proc_flag = ctx->preview_ppcfg.post_proc_flag; | 1049 flags.post_proc_flag = ctx->preview_ppcfg.post_proc_flag; |
962 flags.deblocking_level = ctx->preview_ppcfg.deblocking_level; | 1050 flags.deblocking_level = ctx->preview_ppcfg.deblocking_level; |
963 flags.noise_level = ctx->preview_ppcfg.noise_level; | 1051 flags.noise_level = ctx->preview_ppcfg.noise_level; |
964 } | 1052 } |
965 | 1053 |
966 if (vp9_get_preview_raw_frame(ctx->cpi, &sd, &flags) == 0) { | 1054 if (vp9_get_preview_raw_frame(ctx->cpi, &sd, &flags) == 0) { |
967 yuvconfig2image(&ctx->preview_img, &sd, NULL); | 1055 yuvconfig2image(&ctx->preview_img, &sd, NULL); |
968 return &ctx->preview_img; | 1056 return &ctx->preview_img; |
969 } else { | 1057 } else { |
970 return NULL; | 1058 return NULL; |
971 } | 1059 } |
972 } | 1060 } |
973 | 1061 |
974 static vpx_codec_err_t ctrl_update_entropy(vpx_codec_alg_priv_t *ctx, | 1062 static vpx_codec_err_t ctrl_update_entropy(vpx_codec_alg_priv_t *ctx, |
975 int ctr_id, va_list args) { | 1063 va_list args) { |
976 const int update = va_arg(args, int); | 1064 const int update = va_arg(args, int); |
| 1065 |
977 vp9_update_entropy(ctx->cpi, update); | 1066 vp9_update_entropy(ctx->cpi, update); |
978 return VPX_CODEC_OK; | 1067 return VPX_CODEC_OK; |
979 } | 1068 } |
980 | 1069 |
981 static vpx_codec_err_t ctrl_update_reference(vpx_codec_alg_priv_t *ctx, | 1070 static vpx_codec_err_t ctrl_update_reference(vpx_codec_alg_priv_t *ctx, |
982 int ctr_id, va_list args) { | 1071 va_list args) { |
983 const int ref_frame_flags = va_arg(args, int); | 1072 const int ref_frame_flags = va_arg(args, int); |
| 1073 |
984 vp9_update_reference(ctx->cpi, ref_frame_flags); | 1074 vp9_update_reference(ctx->cpi, ref_frame_flags); |
985 return VPX_CODEC_OK; | 1075 return VPX_CODEC_OK; |
986 } | 1076 } |
987 | 1077 |
988 static vpx_codec_err_t ctrl_use_reference(vpx_codec_alg_priv_t *ctx, | 1078 static vpx_codec_err_t ctrl_use_reference(vpx_codec_alg_priv_t *ctx, |
989 int ctr_id, va_list args) { | 1079 va_list args) { |
990 const int reference_flag = va_arg(args, int); | 1080 const int reference_flag = va_arg(args, int); |
| 1081 |
991 vp9_use_as_reference(ctx->cpi, reference_flag); | 1082 vp9_use_as_reference(ctx->cpi, reference_flag); |
992 return VPX_CODEC_OK; | 1083 return VPX_CODEC_OK; |
993 } | 1084 } |
994 | 1085 |
995 static vpx_codec_err_t ctrl_set_roi_map(vpx_codec_alg_priv_t *ctx, | 1086 static vpx_codec_err_t ctrl_set_roi_map(vpx_codec_alg_priv_t *ctx, |
996 int ctr_id, va_list args) { | 1087 va_list args) { |
| 1088 (void)ctx; |
| 1089 (void)args; |
| 1090 |
997 // TODO(yaowu): Need to re-implement and test for VP9. | 1091 // TODO(yaowu): Need to re-implement and test for VP9. |
998 return VPX_CODEC_INVALID_PARAM; | 1092 return VPX_CODEC_INVALID_PARAM; |
999 } | 1093 } |
1000 | 1094 |
1001 | 1095 |
1002 static vpx_codec_err_t ctrl_set_active_map(vpx_codec_alg_priv_t *ctx, | 1096 static vpx_codec_err_t ctrl_set_active_map(vpx_codec_alg_priv_t *ctx, |
1003 int ctr_id, va_list args) { | 1097 va_list args) { |
1004 vpx_active_map_t *const map = va_arg(args, vpx_active_map_t *); | 1098 vpx_active_map_t *const map = va_arg(args, vpx_active_map_t *); |
1005 | 1099 |
1006 if (map) { | 1100 if (map) { |
1007 if (!vp9_set_active_map(ctx->cpi, map->active_map, | 1101 if (!vp9_set_active_map(ctx->cpi, map->active_map, |
1008 (int)map->rows, (int)map->cols)) | 1102 (int)map->rows, (int)map->cols)) |
1009 return VPX_CODEC_OK; | 1103 return VPX_CODEC_OK; |
1010 else | 1104 else |
1011 return VPX_CODEC_INVALID_PARAM; | 1105 return VPX_CODEC_INVALID_PARAM; |
1012 } else { | 1106 } else { |
1013 return VPX_CODEC_INVALID_PARAM; | 1107 return VPX_CODEC_INVALID_PARAM; |
1014 } | 1108 } |
1015 } | 1109 } |
1016 | 1110 |
1017 static vpx_codec_err_t ctrl_set_scale_mode(vpx_codec_alg_priv_t *ctx, | 1111 static vpx_codec_err_t ctrl_set_scale_mode(vpx_codec_alg_priv_t *ctx, |
1018 int ctr_id, va_list args) { | 1112 va_list args) { |
1019 vpx_scaling_mode_t *const mode = va_arg(args, vpx_scaling_mode_t *); | 1113 vpx_scaling_mode_t *const mode = va_arg(args, vpx_scaling_mode_t *); |
1020 | 1114 |
1021 if (mode) { | 1115 if (mode) { |
1022 const int res = vp9_set_internal_size(ctx->cpi, | 1116 const int res = vp9_set_internal_size(ctx->cpi, |
1023 (VPX_SCALING)mode->h_scaling_mode, | 1117 (VPX_SCALING)mode->h_scaling_mode, |
1024 (VPX_SCALING)mode->v_scaling_mode); | 1118 (VPX_SCALING)mode->v_scaling_mode); |
1025 return (res == 0) ? VPX_CODEC_OK : VPX_CODEC_INVALID_PARAM; | 1119 return (res == 0) ? VPX_CODEC_OK : VPX_CODEC_INVALID_PARAM; |
1026 } else { | 1120 } else { |
1027 return VPX_CODEC_INVALID_PARAM; | 1121 return VPX_CODEC_INVALID_PARAM; |
1028 } | 1122 } |
1029 } | 1123 } |
1030 | 1124 |
1031 static vpx_codec_err_t ctrl_set_svc(vpx_codec_alg_priv_t *ctx, int ctr_id, | 1125 static vpx_codec_err_t ctrl_set_svc(vpx_codec_alg_priv_t *ctx, va_list args) { |
1032 va_list args) { | |
1033 int data = va_arg(args, int); | 1126 int data = va_arg(args, int); |
1034 const vpx_codec_enc_cfg_t *cfg = &ctx->cfg; | 1127 const vpx_codec_enc_cfg_t *cfg = &ctx->cfg; |
| 1128 |
1035 vp9_set_svc(ctx->cpi, data); | 1129 vp9_set_svc(ctx->cpi, data); |
1036 // CBR or two pass mode for SVC with both temporal and spatial layers | 1130 // CBR or two pass mode for SVC with both temporal and spatial layers |
1037 // not yet supported. | 1131 // not yet supported. |
1038 if (data == 1 && | 1132 if (data == 1 && |
1039 (cfg->rc_end_usage == VPX_CBR || | 1133 (cfg->rc_end_usage == VPX_CBR || |
1040 cfg->g_pass == VPX_RC_FIRST_PASS || | 1134 cfg->g_pass == VPX_RC_FIRST_PASS || |
1041 cfg->g_pass == VPX_RC_LAST_PASS) && | 1135 cfg->g_pass == VPX_RC_LAST_PASS) && |
1042 cfg->ss_number_layers > 1 && | 1136 cfg->ss_number_layers > 1 && |
1043 cfg->ts_number_layers > 1) { | 1137 cfg->ts_number_layers > 1) { |
1044 return VPX_CODEC_INVALID_PARAM; | 1138 return VPX_CODEC_INVALID_PARAM; |
1045 } | 1139 } |
1046 return VPX_CODEC_OK; | 1140 return VPX_CODEC_OK; |
1047 } | 1141 } |
1048 | 1142 |
1049 static vpx_codec_err_t ctrl_set_svc_layer_id(vpx_codec_alg_priv_t *ctx, | 1143 static vpx_codec_err_t ctrl_set_svc_layer_id(vpx_codec_alg_priv_t *ctx, |
1050 int ctr_id, | |
1051 va_list args) { | 1144 va_list args) { |
1052 vpx_svc_layer_id_t *const data = va_arg(args, vpx_svc_layer_id_t *); | 1145 vpx_svc_layer_id_t *const data = va_arg(args, vpx_svc_layer_id_t *); |
1053 VP9_COMP *const cpi = (VP9_COMP *)ctx->cpi; | 1146 VP9_COMP *const cpi = (VP9_COMP *)ctx->cpi; |
1054 SVC *const svc = &cpi->svc; | 1147 SVC *const svc = &cpi->svc; |
| 1148 |
1055 svc->spatial_layer_id = data->spatial_layer_id; | 1149 svc->spatial_layer_id = data->spatial_layer_id; |
1056 svc->temporal_layer_id = data->temporal_layer_id; | 1150 svc->temporal_layer_id = data->temporal_layer_id; |
1057 // Checks on valid layer_id input. | 1151 // Checks on valid layer_id input. |
1058 if (svc->temporal_layer_id < 0 || | 1152 if (svc->temporal_layer_id < 0 || |
1059 svc->temporal_layer_id >= (int)ctx->cfg.ts_number_layers) { | 1153 svc->temporal_layer_id >= (int)ctx->cfg.ts_number_layers) { |
1060 return VPX_CODEC_INVALID_PARAM; | 1154 return VPX_CODEC_INVALID_PARAM; |
1061 } | 1155 } |
1062 if (svc->spatial_layer_id < 0 || | 1156 if (svc->spatial_layer_id < 0 || |
1063 svc->spatial_layer_id >= (int)ctx->cfg.ss_number_layers) { | 1157 svc->spatial_layer_id >= (int)ctx->cfg.ss_number_layers) { |
1064 return VPX_CODEC_INVALID_PARAM; | 1158 return VPX_CODEC_INVALID_PARAM; |
1065 } | 1159 } |
1066 return VPX_CODEC_OK; | 1160 return VPX_CODEC_OK; |
1067 } | 1161 } |
1068 | 1162 |
1069 static vpx_codec_err_t ctrl_set_svc_parameters(vpx_codec_alg_priv_t *ctx, | 1163 static vpx_codec_err_t ctrl_set_svc_parameters(vpx_codec_alg_priv_t *ctx, |
1070 int ctr_id, va_list args) { | 1164 va_list args) { |
1071 VP9_COMP *const cpi = ctx->cpi; | 1165 VP9_COMP *const cpi = ctx->cpi; |
1072 vpx_svc_parameters_t *const params = va_arg(args, vpx_svc_parameters_t *); | 1166 vpx_svc_parameters_t *const params = va_arg(args, vpx_svc_parameters_t *); |
1073 | 1167 |
1074 if (params == NULL) | 1168 if (params == NULL) |
1075 return VPX_CODEC_INVALID_PARAM; | 1169 return VPX_CODEC_INVALID_PARAM; |
1076 | 1170 |
1077 cpi->svc.spatial_layer_id = params->spatial_layer; | 1171 cpi->svc.spatial_layer_id = params->spatial_layer; |
1078 cpi->svc.temporal_layer_id = params->temporal_layer; | 1172 cpi->svc.temporal_layer_id = params->temporal_layer; |
1079 | 1173 |
1080 cpi->lst_fb_idx = params->lst_fb_idx; | 1174 cpi->lst_fb_idx = params->lst_fb_idx; |
(...skipping 17 matching lines...) Expand all Loading... |
1098 {VP8E_UPD_ENTROPY, ctrl_update_entropy}, | 1192 {VP8E_UPD_ENTROPY, ctrl_update_entropy}, |
1099 {VP8E_UPD_REFERENCE, ctrl_update_reference}, | 1193 {VP8E_UPD_REFERENCE, ctrl_update_reference}, |
1100 {VP8E_USE_REFERENCE, ctrl_use_reference}, | 1194 {VP8E_USE_REFERENCE, ctrl_use_reference}, |
1101 | 1195 |
1102 // Setters | 1196 // Setters |
1103 {VP8_SET_REFERENCE, ctrl_set_reference}, | 1197 {VP8_SET_REFERENCE, ctrl_set_reference}, |
1104 {VP8_SET_POSTPROC, ctrl_set_previewpp}, | 1198 {VP8_SET_POSTPROC, ctrl_set_previewpp}, |
1105 {VP8E_SET_ROI_MAP, ctrl_set_roi_map}, | 1199 {VP8E_SET_ROI_MAP, ctrl_set_roi_map}, |
1106 {VP8E_SET_ACTIVEMAP, ctrl_set_active_map}, | 1200 {VP8E_SET_ACTIVEMAP, ctrl_set_active_map}, |
1107 {VP8E_SET_SCALEMODE, ctrl_set_scale_mode}, | 1201 {VP8E_SET_SCALEMODE, ctrl_set_scale_mode}, |
1108 {VP8E_SET_CPUUSED, ctrl_set_param}, | 1202 {VP8E_SET_CPUUSED, ctrl_set_cpuused}, |
1109 {VP8E_SET_NOISE_SENSITIVITY, ctrl_set_param}, | 1203 {VP8E_SET_NOISE_SENSITIVITY, ctrl_set_noise_sensitivity}, |
1110 {VP8E_SET_ENABLEAUTOALTREF, ctrl_set_param}, | 1204 {VP8E_SET_ENABLEAUTOALTREF, ctrl_set_enable_auto_alt_ref}, |
1111 {VP8E_SET_SHARPNESS, ctrl_set_param}, | 1205 {VP8E_SET_SHARPNESS, ctrl_set_sharpness}, |
1112 {VP8E_SET_STATIC_THRESHOLD, ctrl_set_param}, | 1206 {VP8E_SET_STATIC_THRESHOLD, ctrl_set_static_thresh}, |
1113 {VP9E_SET_TILE_COLUMNS, ctrl_set_param}, | 1207 {VP9E_SET_TILE_COLUMNS, ctrl_set_tile_columns}, |
1114 {VP9E_SET_TILE_ROWS, ctrl_set_param}, | 1208 {VP9E_SET_TILE_ROWS, ctrl_set_tile_rows}, |
1115 {VP8E_SET_ARNR_MAXFRAMES, ctrl_set_param}, | 1209 {VP8E_SET_ARNR_MAXFRAMES, ctrl_set_arnr_max_frames}, |
1116 {VP8E_SET_ARNR_STRENGTH, ctrl_set_param}, | 1210 {VP8E_SET_ARNR_STRENGTH, ctrl_set_arnr_strength}, |
1117 {VP8E_SET_ARNR_TYPE, ctrl_set_param}, | 1211 {VP8E_SET_ARNR_TYPE, ctrl_set_arnr_type}, |
1118 {VP8E_SET_TUNING, ctrl_set_param}, | 1212 {VP8E_SET_TUNING, ctrl_set_tuning}, |
1119 {VP8E_SET_CQ_LEVEL, ctrl_set_param}, | 1213 {VP8E_SET_CQ_LEVEL, ctrl_set_cq_level}, |
1120 {VP8E_SET_MAX_INTRA_BITRATE_PCT, ctrl_set_param}, | 1214 {VP8E_SET_MAX_INTRA_BITRATE_PCT, ctrl_set_rc_max_intra_bitrate_pct}, |
1121 {VP9E_SET_LOSSLESS, ctrl_set_param}, | 1215 {VP9E_SET_LOSSLESS, ctrl_set_lossless}, |
1122 {VP9E_SET_FRAME_PARALLEL_DECODING, ctrl_set_param}, | 1216 {VP9E_SET_FRAME_PARALLEL_DECODING, ctrl_set_frame_parallel_decoding_mode}, |
1123 {VP9E_SET_AQ_MODE, ctrl_set_param}, | 1217 {VP9E_SET_AQ_MODE, ctrl_set_aq_mode}, |
1124 {VP9E_SET_FRAME_PERIODIC_BOOST, ctrl_set_param}, | 1218 {VP9E_SET_FRAME_PERIODIC_BOOST, ctrl_set_frame_periodic_boost}, |
1125 {VP9E_SET_SVC, ctrl_set_svc}, | 1219 {VP9E_SET_SVC, ctrl_set_svc}, |
1126 {VP9E_SET_SVC_PARAMETERS, ctrl_set_svc_parameters}, | 1220 {VP9E_SET_SVC_PARAMETERS, ctrl_set_svc_parameters}, |
1127 {VP9E_SET_SVC_LAYER_ID, ctrl_set_svc_layer_id}, | 1221 {VP9E_SET_SVC_LAYER_ID, ctrl_set_svc_layer_id}, |
1128 | 1222 |
1129 // Getters | 1223 // Getters |
1130 {VP8E_GET_LAST_QUANTIZER, ctrl_get_param}, | 1224 {VP8E_GET_LAST_QUANTIZER, ctrl_get_quantizer}, |
1131 {VP8E_GET_LAST_QUANTIZER_64, ctrl_get_param}, | 1225 {VP8E_GET_LAST_QUANTIZER_64, ctrl_get_quantizer64}, |
1132 {VP9_GET_REFERENCE, ctrl_get_reference}, | 1226 {VP9_GET_REFERENCE, ctrl_get_reference}, |
1133 | 1227 |
1134 { -1, NULL}, | 1228 { -1, NULL}, |
1135 }; | 1229 }; |
1136 | 1230 |
1137 static vpx_codec_enc_cfg_map_t encoder_usage_cfg_map[] = { | 1231 static vpx_codec_enc_cfg_map_t encoder_usage_cfg_map[] = { |
1138 { | 1232 { |
1139 0, | 1233 0, |
1140 { // NOLINT | 1234 { // NOLINT |
1141 0, // g_usage | 1235 0, // g_usage |
(...skipping 12 matching lines...) Expand all Loading... |
1154 | 1248 |
1155 0, // rc_dropframe_thresh | 1249 0, // rc_dropframe_thresh |
1156 0, // rc_resize_allowed | 1250 0, // rc_resize_allowed |
1157 1, // rc_scaled_width | 1251 1, // rc_scaled_width |
1158 1, // rc_scaled_height | 1252 1, // rc_scaled_height |
1159 60, // rc_resize_down_thresold | 1253 60, // rc_resize_down_thresold |
1160 30, // rc_resize_up_thresold | 1254 30, // rc_resize_up_thresold |
1161 | 1255 |
1162 VPX_VBR, // rc_end_usage | 1256 VPX_VBR, // rc_end_usage |
1163 #if VPX_ENCODER_ABI_VERSION > (1 + VPX_CODEC_ABI_VERSION) | 1257 #if VPX_ENCODER_ABI_VERSION > (1 + VPX_CODEC_ABI_VERSION) |
1164 {0}, // rc_twopass_stats_in | 1258 {NULL, 0}, // rc_twopass_stats_in |
1165 #endif | 1259 #endif |
1166 256, // rc_target_bandwidth | 1260 256, // rc_target_bandwidth |
1167 0, // rc_min_quantizer | 1261 0, // rc_min_quantizer |
1168 63, // rc_max_quantizer | 1262 63, // rc_max_quantizer |
1169 100, // rc_undershoot_pct | 1263 100, // rc_undershoot_pct |
1170 100, // rc_overshoot_pct | 1264 100, // rc_overshoot_pct |
1171 | 1265 |
1172 6000, // rc_max_buffer_size | 1266 6000, // rc_max_buffer_size |
1173 4000, // rc_buffer_initial_size | 1267 4000, // rc_buffer_initial_size |
1174 5000, // rc_buffer_optimal_size | 1268 5000, // rc_buffer_optimal_size |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1207 encoder_init, // vpx_codec_init_fn_t | 1301 encoder_init, // vpx_codec_init_fn_t |
1208 encoder_destroy, // vpx_codec_destroy_fn_t | 1302 encoder_destroy, // vpx_codec_destroy_fn_t |
1209 encoder_ctrl_maps, // vpx_codec_ctrl_fn_map_t | 1303 encoder_ctrl_maps, // vpx_codec_ctrl_fn_map_t |
1210 NOT_IMPLEMENTED, // vpx_codec_get_mmap_fn_t | 1304 NOT_IMPLEMENTED, // vpx_codec_get_mmap_fn_t |
1211 NOT_IMPLEMENTED, // vpx_codec_set_mmap_fn_t | 1305 NOT_IMPLEMENTED, // vpx_codec_set_mmap_fn_t |
1212 { // NOLINT | 1306 { // NOLINT |
1213 NOT_IMPLEMENTED, // vpx_codec_peek_si_fn_t | 1307 NOT_IMPLEMENTED, // vpx_codec_peek_si_fn_t |
1214 NOT_IMPLEMENTED, // vpx_codec_get_si_fn_t | 1308 NOT_IMPLEMENTED, // vpx_codec_get_si_fn_t |
1215 NOT_IMPLEMENTED, // vpx_codec_decode_fn_t | 1309 NOT_IMPLEMENTED, // vpx_codec_decode_fn_t |
1216 NOT_IMPLEMENTED, // vpx_codec_frame_get_fn_t | 1310 NOT_IMPLEMENTED, // vpx_codec_frame_get_fn_t |
| 1311 NOT_IMPLEMENTED // vpx_codec_set_fb_fn_t |
1217 }, | 1312 }, |
1218 { // NOLINT | 1313 { // NOLINT |
1219 encoder_usage_cfg_map, // vpx_codec_enc_cfg_map_t | 1314 encoder_usage_cfg_map, // vpx_codec_enc_cfg_map_t |
1220 encoder_encode, // vpx_codec_encode_fn_t | 1315 encoder_encode, // vpx_codec_encode_fn_t |
1221 encoder_get_cxdata, // vpx_codec_get_cx_data_fn_t | 1316 encoder_get_cxdata, // vpx_codec_get_cx_data_fn_t |
1222 encoder_set_config, // vpx_codec_enc_config_set_fn_t | 1317 encoder_set_config, // vpx_codec_enc_config_set_fn_t |
1223 NOT_IMPLEMENTED, // vpx_codec_get_global_headers_fn_t | 1318 NOT_IMPLEMENTED, // vpx_codec_get_global_headers_fn_t |
1224 encoder_get_preview, // vpx_codec_get_preview_frame_fn_t | 1319 encoder_get_preview, // vpx_codec_get_preview_frame_fn_t |
1225 NOT_IMPLEMENTED , // vpx_codec_enc_mr_get_mem_loc_fn_t | 1320 NOT_IMPLEMENTED // vpx_codec_enc_mr_get_mem_loc_fn_t |
1226 } | 1321 } |
1227 }; | 1322 }; |
OLD | NEW |