These rate control parameters are for the Vizier experiment. They are defined as rational numbers.
Unified · Split
| @@ -1281,14 +1281,26 @@ static vpx_codec_enc_cfg_map_t vp8e_usage_cfg_map[] = { · 1280 unmodified lines | ||
| 1281 | 1281 | |
| 1282 | 1282 | VPX_SS_DEFAULT_LAYERS, /* ss_number_layers */ |
| 1283 | 1283 | { 0 }, |
| 1284 | − { 0 }, /* ss_target_bitrate */ | |
| 1285 | − 1, /* ts_number_layers */ | |
| 1286 | − { 0 }, /* ts_target_bitrate */ | |
| 1287 | − { 0 }, /* ts_rate_decimator */ | |
| 1288 | − 0, /* ts_periodicity */ | |
| 1289 | − { 0 }, /* ts_layer_id */ | |
| 1290 | − { 0 }, /* layer_target_bitrate */ | |
| 1291 | − 0 /* temporal_layering_mode */ | |
| 1284 | + { 0 }, /* ss_target_bitrate */ | |
| 1285 | + 1, /* ts_number_layers */ | |
| 1286 | + { 0 }, /* ts_target_bitrate */ | |
| 1287 | + { 0 }, /* ts_rate_decimator */ | |
| 1288 | + 0, /* ts_periodicity */ | |
| 1289 | + { 0 }, /* ts_layer_id */ | |
| 1290 | + { 0 }, /* layer_target_bitrate */ | |
| 1291 | + 0, /* temporal_layering_mode */ | |
| 1292 | + { 0, 0 }, /* active_wq_factor */ | |
| 1293 | + { 0, 0 }, /* base_err_per_mb */ | |
| 1294 | + { 0, 0 }, /* sr_default_decay_limit */ | |
| 1295 | + { 0, 0 }, /* sr_diff_factor */ | |
| 1296 | + { 0, 0 }, /* kf_err_per_mb */ | |
| 1297 | + { 0, 0 }, /* kf_frame_min_boost */ | |
| 1298 | + { 0, 0 }, /* kf_frame_max_boost_first */ | |
| 1299 | + { 0, 0 }, /* kf_frame_max_boost_subs */ | |
| 1300 | + { 0, 0 }, /* kf_max_total_boost */ | |
| 1301 | + { 0, 0 }, /* gf_max_total_boost */ | |
| 1302 | + { 0, 0 }, /* gf_frame_max_boost */ | |
| 1303 | + { 0, 0 }, /* zm_power_factor */ | |
| 1292 | 1304 | } }, |
| 1293 | 1305 | }; |
| 1294 | 1306 | |
| @@ -1883,14 +1883,26 @@ static vpx_codec_enc_cfg_map_t encoder_usage_cfg_map[] = { · 1882 unmodified lines | ||
| 1883 | 1883 | |
| 1884 | 1884 | VPX_SS_DEFAULT_LAYERS, // ss_number_layers |
| 1885 | 1885 | { 0 }, |
| 1886 | − { 0 }, // ss_target_bitrate | |
| 1887 | − 1, // ts_number_layers | |
| 1888 | − { 0 }, // ts_target_bitrate | |
| 1889 | − { 0 }, // ts_rate_decimator | |
| 1890 | − 0, // ts_periodicity | |
| 1891 | − { 0 }, // ts_layer_id | |
| 1892 | − { 0 }, // layer_taget_bitrate | |
| 1893 | − 0 // temporal_layering_mode | |
| 1886 | + { 0 }, // ss_target_bitrate | |
| 1887 | + 1, // ts_number_layers | |
| 1888 | + { 0 }, // ts_target_bitrate | |
| 1889 | + { 0 }, // ts_rate_decimator | |
| 1890 | + 0, // ts_periodicity | |
| 1891 | + { 0 }, // ts_layer_id | |
| 1892 | + { 0 }, // layer_taget_bitrate | |
| 1893 | + 0, // temporal_layering_mode | |
| 1894 | + { 0, 0 }, // active_wq_factor | |
| 1895 | + { 0, 0 }, // base_err_per_mb | |
| 1896 | + { 0, 0 }, // sr_default_decay_limit | |
| 1897 | + { 0, 0 }, // sr_diff_factor | |
| 1898 | + { 0, 0 }, // kf_err_per_mb | |
| 1899 | + { 0, 0 }, // kf_frame_min_boost | |
| 1900 | + { 0, 0 }, // kf_frame_max_boost_first | |
| 1901 | + { 0, 0 }, // kf_frame_max_boost_subs | |
| 1902 | + { 0, 0 }, // kf_max_total_boost | |
| 1903 | + { 0, 0 }, // gf_max_total_boost | |
| 1904 | + { 0, 0 }, // gf_frame_max_boost | |
| 1905 | + { 0, 0 }, // zm_power_factor | |
| 1894 | 1906 | } }, |
| 1895 | 1907 | }; |
| 1896 | 1908 | |
| @@ -693,6 +693,90 @@ typedef struct vpx_codec_enc_cfg { · 692 unmodified lines | ||
| 693 | 693 | * |
| 694 | 694 | */ |
| 695 | 695 | int temporal_layering_mode; |
| 696 | + | |
| 697 | + /*!\brief Active worst quality factor. | |
| 698 | + * | |
| 699 | + * Rate control parameters, set from external experiment results. | |
| 700 | + * | |
| 701 | + */ | |
| 702 | + vpx_rational_t active_wq_factor; | |
| 703 | + | |
| 704 | + /*!\brief Base error per macroblock. | |
| 705 | + * | |
| 706 | + * Rate control parameters, set from external experiment results. | |
| 707 | + * | |
| 708 | + */ | |
| 709 | + vpx_rational_t base_err_per_mb; | |
| 710 | + | |
| 711 | + /*!\brief Second reference default decay limit. | |
| 712 | + * | |
| 713 | + * Rate control parameters, set from external experiment results. | |
| 714 | + * | |
| 715 | + */ | |
| 716 | + vpx_rational_t sr_default_decay_limit; | |
| 717 | + | |
| 718 | + /*!\brief Second reference difference factor. | |
| 719 | + * | |
| 720 | + * Rate control parameters, set from external experiment results. | |
| 721 | + * | |
| 722 | + */ | |
| 723 | + vpx_rational_t sr_diff_factor; | |
| 724 | + | |
| 725 | + /*!\brief Keyframe error per macroblock. | |
| 726 | + * | |
| 727 | + * Rate control parameters, set from external experiment results. | |
| 728 | + * | |
| 729 | + */ | |
| 730 | + vpx_rational_t kf_err_per_mb; | |
| 731 | + | |
| 732 | + /*!\brief Keyframe minimum boost. | |
| 733 | + * | |
| 734 | + * Rate control parameters, set from external experiment results. | |
| 735 | + * | |
| 736 | + */ | |
| 737 | + vpx_rational_t kf_frame_min_boost; | |
| 738 | + | |
| 739 | + /*!\brief Keyframe maximum boost, for the first keyframe in a chunk. | |
| 740 | + * | |
| 741 | + * Rate control parameters, set from external experiment results. | |
| 742 | + * | |
| 743 | + */ | |
| 744 | + vpx_rational_t kf_frame_max_boost_first; | |
| 745 | + | |
| 746 | + /*!\brief Keyframe maximum boost, for subsequent keyframes. | |
| 747 | + * | |
| 748 | + * Rate control parameters, set from external experiment results. | |
| 749 | + * | |
| 750 | + */ | |
| 751 | + vpx_rational_t kf_frame_max_boost_subs; | |
| 752 | + | |
| 753 | + /*!\brief Keyframe maximum total boost. | |
| 754 | + * | |
| 755 | + * Rate control parameters, set from external experiment results. | |
| 756 | + * | |
| 757 | + */ | |
| 758 | + vpx_rational_t kf_max_total_boost; | |
| 759 | + | |
| 760 | + /*!\brief Golden frame maximum total boost. | |
| 761 | + * | |
| 762 | + * Rate control parameters, set from external experiment results. | |
| 763 | + * | |
| 764 | + */ | |
| 765 | + vpx_rational_t gf_max_total_boost; | |
| 766 | + | |
| 767 | + /*!\brief Golden frame maximum boost. | |
| 768 | + * | |
| 769 | + * Rate control parameters, set from external experiment results. | |
| 770 | + * | |
| 771 | + */ | |
| 772 | + vpx_rational_t gf_frame_max_boost; | |
| 773 | + | |
| 774 | + /*!\brief Zero motion power factor. | |
| 775 | + * | |
| 776 | + * Rate control parameters, set from external experiment results. | |
| 777 | + * | |
| 778 | + */ | |
| 779 | + vpx_rational_t zm_power_factor; | |
| 696 | 780 | } vpx_codec_enc_cfg_t; /**< alias for struct vpx_codec_enc_cfg */ |
| 697 | 781 | |
| 698 | 782 | /*!\brief vp9 svc extra configure parameters |
| @@ -287,6 +287,46 @@ static const arg_def_t *rc_args[] = { · 286 unmodified lines | ||
| 287 | 287 | &buf_sz, &buf_initial_sz, &buf_optimal_sz, NULL |
| 288 | 288 | }; |
| 289 | 289 | |
| 290 | +#if CONFIG_VP9_ENCODER | |
| 291 | +static const arg_def_t active_wq_factor = | |
| 292 | + ARG_DEF(NULL, "active-wq-factor", 1, "Active worst quality factor"); | |
| 293 | +static const arg_def_t base_err_per_mb = | |
| 294 | + ARG_DEF(NULL, "base-err-per-mb", 1, "Base error per macroblock"); | |
| 295 | +static const arg_def_t sr_default_decay_limit = ARG_DEF( | |
| 296 | + NULL, "sr-default-decay-limit", 1, "Second reference default decay limit"); | |
| 297 | +static const arg_def_t sr_diff_factor = | |
| 298 | + ARG_DEF(NULL, "sr-diff-factor", 1, "Second reference diff factor"); | |
| 299 | +static const arg_def_t kf_err_per_mb = | |
| 300 | + ARG_DEF(NULL, "kf-err-per-mb", 1, "Keyframe error per macroblock"); | |
| 301 | +static const arg_def_t kf_frame_min_boost = | |
| 302 | + ARG_DEF(NULL, "kf-frame-min-boost", 1, "Keyframe min boost"); | |
| 303 | +static const arg_def_t kf_frame_max_boost_first = ARG_DEF( | |
| 304 | + NULL, "kf-frame-max-boost-first", 1, "Max for the first keyframe boost"); | |
| 305 | +static const arg_def_t kf_frame_max_boost_subs = ARG_DEF( | |
| 306 | + NULL, "kf-frame-max-boost-subs", 1, "Max for subsequent keyframe boost"); | |
| 307 | +static const arg_def_t kf_max_total_boost = | |
| 308 | + ARG_DEF(NULL, "kf-max-total-boost", 1, "Keyframe max total boost"); | |
| 309 | +static const arg_def_t gf_max_total_boost = | |
| 310 | + ARG_DEF(NULL, "gf-max-total-boost", 1, "Golden frame max total boost"); | |
| 311 | +static const arg_def_t gf_frame_max_boost = | |
| 312 | + ARG_DEF(NULL, "gf-frame-max-boost", 1, "Golden frame max boost"); | |
| 313 | +static const arg_def_t zm_power_factor = | |
| 314 | + ARG_DEF(NULL, "zm-power-factor", 1, "Zero motion power factor"); | |
| 315 | +static const arg_def_t *vizier_rc_args[] = { &active_wq_factor, | |
| 316 | + &base_err_per_mb, | |
| 317 | + &sr_default_decay_limit, | |
| 318 | + &sr_diff_factor, | |
| 319 | + &kf_err_per_mb, | |
| 320 | + &kf_frame_min_boost, | |
| 321 | + &kf_frame_max_boost_first, | |
| 322 | + &kf_frame_max_boost_subs, | |
| 323 | + &kf_max_total_boost, | |
| 324 | + &gf_max_total_boost, | |
| 325 | + &gf_frame_max_boost, | |
| 326 | + &zm_power_factor, | |
| 327 | + NULL }; | |
| 328 | +#endif | |
| 329 | + | |
| 290 | 330 | static const arg_def_t bias_pct = |
| 291 | 331 | ARG_DEF(NULL, "bias-pct", 1, "CBR/VBR bias (0=CBR, 100=VBR)"); |
| 292 | 332 | static const arg_def_t minsection_pct = |
| @@ -573,6 +613,8 @@ static void show_help(FILE *fout, int shorthelp) { · 280 unmodified lines | ||
| 573 | 613 | #if CONFIG_VP9_ENCODER |
| 574 | 614 | fprintf(fout, "\nVP9 Specific Options:\n"); |
| 575 | 615 | arg_show_usage(fout, vp9_args); |
| 616 | + fprintf(fout, "\nVizier Rate Control Options:\n"); | |
| 617 | + arg_show_usage(fout, vizier_rc_args); | |
| 576 | 618 | #endif |
| 577 | 619 | fprintf(fout, |
| 578 | 620 | "\nStream timebase (--timebase):\n" |
| @@ -983,6 +1025,32 @@ static int parse_stream_params(struct VpxEncoderConfig *global, · 404 unmodified lines | ||
| 983 | 1025 | config->cfg.kf_max_dist = arg_parse_uint(&arg); |
| 984 | 1026 | } else if (arg_match(&arg, &kf_disabled, argi)) { |
| 985 | 1027 | config->cfg.kf_mode = VPX_KF_DISABLED; |
| 1028 | +#if CONFIG_VP9_ENCODER | |
| 1029 | + } else if (arg_match(&arg, &active_wq_factor, argi)) { | |
| 1030 | + config->cfg.active_wq_factor = arg_parse_rational(&arg); | |
| 1031 | + } else if (arg_match(&arg, &base_err_per_mb, argi)) { | |
| 1032 | + config->cfg.base_err_per_mb = arg_parse_rational(&arg); | |
| 1033 | + } else if (arg_match(&arg, &sr_default_decay_limit, argi)) { | |
| 1034 | + config->cfg.sr_default_decay_limit = arg_parse_rational(&arg); | |
| 1035 | + } else if (arg_match(&arg, &sr_diff_factor, argi)) { | |
| 1036 | + config->cfg.sr_diff_factor = arg_parse_rational(&arg); | |
| 1037 | + } else if (arg_match(&arg, &kf_err_per_mb, argi)) { | |
| 1038 | + config->cfg.kf_err_per_mb = arg_parse_rational(&arg); | |
| 1039 | + } else if (arg_match(&arg, &kf_frame_min_boost, argi)) { | |
| 1040 | + config->cfg.kf_frame_min_boost = arg_parse_rational(&arg); | |
| 1041 | + } else if (arg_match(&arg, &kf_frame_max_boost_first, argi)) { | |
| 1042 | + config->cfg.kf_frame_max_boost_first = arg_parse_rational(&arg); | |
| 1043 | + } else if (arg_match(&arg, &kf_frame_max_boost_subs, argi)) { | |
| 1044 | + config->cfg.kf_frame_max_boost_subs = arg_parse_rational(&arg); | |
| 1045 | + } else if (arg_match(&arg, &kf_max_total_boost, argi)) { | |
| 1046 | + config->cfg.kf_max_total_boost = arg_parse_rational(&arg); | |
| 1047 | + } else if (arg_match(&arg, &gf_max_total_boost, argi)) { | |
| 1048 | + config->cfg.gf_max_total_boost = arg_parse_rational(&arg); | |
| 1049 | + } else if (arg_match(&arg, &gf_frame_max_boost, argi)) { | |
| 1050 | + config->cfg.gf_frame_max_boost = arg_parse_rational(&arg); | |
| 1051 | + } else if (arg_match(&arg, &zm_power_factor, argi)) { | |
| 1052 | + config->cfg.zm_power_factor = arg_parse_rational(&arg); | |
| 1053 | +#endif | |
| 986 | 1054 | #if CONFIG_VP9_HIGHBITDEPTH |
| 987 | 1055 | } else if (arg_match(&arg, &test16bitinternalarg, argi)) { |
| 988 | 1056 | if (strcmp(global->codec->name, "vp9") == 0) { |
| @@ -1177,6 +1245,9 @@ static void show_stream_config(struct stream_state *stream, · 188 unmodified lines | ||
| 1177 | 1245 | SHOW(kf_mode); |
| 1178 | 1246 | SHOW(kf_min_dist); |
| 1179 | 1247 | SHOW(kf_max_dist); |
| 1248 | + // Temporary use for debug | |
| 1249 | + SHOW(active_wq_factor.num); | |
| 1250 | + SHOW(active_wq_factor.den); | |
| 1180 | 1251 | } |
| 1181 | 1252 | |
| 1182 | 1253 | static void open_output_file(struct stream_state *stream, |