| @@ -635,40 +635,7 @@ static vpx_codec_err_t set_encoder_config( · 634 unmodified lines |
| 635 | } | 635 | } |
| 636 | | 636 | |
| 637 | if (get_level_index(oxcf->target_level) >= 0) config_target_level(oxcf); | 637 | if (get_level_index(oxcf->target_level) >= 0) config_target_level(oxcf); |
| 638 | /* | 638 | // vp9_dump_encoder_config(oxcf); |
| 639 | printf("Current VP9 Settings: \n"); | | |
| 640 | printf("target_bandwidth: %d\n", oxcf->target_bandwidth); | | |
| 641 | printf("target_level: %d\n", oxcf->target_level); | | |
| 642 | printf("noise_sensitivity: %d\n", oxcf->noise_sensitivity); | | |
| 643 | printf("sharpness: %d\n", oxcf->sharpness); | | |
| 644 | printf("cpu_used: %d\n", oxcf->cpu_used); | | |
| 645 | printf("Mode: %d\n", oxcf->mode); | | |
| 646 | printf("auto_key: %d\n", oxcf->auto_key); | | |
| 647 | printf("key_freq: %d\n", oxcf->key_freq); | | |
| 648 | printf("end_usage: %d\n", oxcf->end_usage); | | |
| 649 | printf("under_shoot_pct: %d\n", oxcf->under_shoot_pct); | | |
| 650 | printf("over_shoot_pct: %d\n", oxcf->over_shoot_pct); | | |
| 651 | printf("starting_buffer_level: %d\n", oxcf->starting_buffer_level); | | |
| 652 | printf("optimal_buffer_level: %d\n", oxcf->optimal_buffer_level); | | |
| 653 | printf("maximum_buffer_size: %d\n", oxcf->maximum_buffer_size); | | |
| 654 | printf("fixed_q: %d\n", oxcf->fixed_q); | | |
| 655 | printf("worst_allowed_q: %d\n", oxcf->worst_allowed_q); | | |
| 656 | printf("best_allowed_q: %d\n", oxcf->best_allowed_q); | | |
| 657 | printf("allow_spatial_resampling: %d\n", oxcf->allow_spatial_resampling); | | |
| 658 | printf("scaled_frame_width: %d\n", oxcf->scaled_frame_width); | | |
| 659 | printf("scaled_frame_height: %d\n", oxcf->scaled_frame_height); | | |
| 660 | printf("two_pass_vbrbias: %d\n", oxcf->two_pass_vbrbias); | | |
| 661 | printf("two_pass_vbrmin_section: %d\n", oxcf->two_pass_vbrmin_section); | | |
| 662 | printf("two_pass_vbrmax_section: %d\n", oxcf->two_pass_vbrmax_section); | | |
| 663 | printf("vbr_corpus_complexity: %d\n", oxcf->vbr_corpus_complexity); | | |
| 664 | printf("lag_in_frames: %d\n", oxcf->lag_in_frames); | | |
| 665 | printf("enable_auto_arf: %d\n", oxcf->enable_auto_arf); | | |
| 666 | printf("Version: %d\n", oxcf->Version); | | |
| 667 | printf("encode_breakout: %d\n", oxcf->encode_breakout); | | |
| 668 | printf("error resilient: %d\n", oxcf->error_resilient_mode); | | |
| 669 | printf("frame parallel detokenization: %d\n", | | |
| 670 | oxcf->frame_parallel_decoding_mode); | | |
| 671 | */ | | |
| 672 | return VPX_CODEC_OK; | 639 | return VPX_CODEC_OK; |
| 673 | } | 640 | } |
| 674 | | 641 | |
| @@ -1913,10 +1880,6 @@ static vpx_codec_enc_cfg_t get_enc_cfg(int frame_width, int frame_height, · 1238 unmodified lines |
| 1913 | | 1880 | |
| 1914 | static vp9_extracfg get_extra_cfg() { | 1881 | static vp9_extracfg get_extra_cfg() { |
| 1915 | vp9_extracfg extra_cfg = default_extra_cfg; | 1882 | vp9_extracfg extra_cfg = default_extra_cfg; |
| 1916 | // TODO(angiebird) figure out whether we can modify default_extra_cfg | | |
| 1917 | // directly. | | |
| 1918 | extra_cfg.tile_columns = 0; | | |
| 1919 | extra_cfg.frame_parallel_decoding_mode = 0; | | |
| 1920 | return extra_cfg; | 1883 | return extra_cfg; |
| 1921 | } | 1884 | } |
| 1922 | | 1885 | |
| @@ -1924,14 +1887,180 @@ VP9EncoderConfig vp9_get_encoder_config(int frame_width, int frame_height, · 1 unmodified line |
| 1924 | vpx_rational_t frame_rate, | 1887 | vpx_rational_t frame_rate, |
| 1925 | int target_bitrate, | 1888 | int target_bitrate, |
| 1926 | vpx_enc_pass enc_pass) { | 1889 | vpx_enc_pass enc_pass) { |
| | 1890 | /* This function will generate the same VP9EncoderConfig used by the |
| | 1891 | * vpxenc command given below. |
| | 1892 | * The configs in the vpxenc command corresponds to parameters of |
| | 1893 | * vp9_get_encoder_config() as follows. |
| | 1894 | * |
| | 1895 | * WIDTH: frame_width |
| | 1896 | * HEIGHT: frame_height |
| | 1897 | * FPS: frame_rate |
| | 1898 | * BITRATE: target_bitrate |
| | 1899 | * |
| | 1900 | * INPUT, OUTPUT, LIMIT will not affect VP9EncoderConfig |
| | 1901 | * |
| | 1902 | * vpxenc command: |
| | 1903 | * INPUT=bus_cif.y4m |
| | 1904 | * OUTPUT=output.webm |
| | 1905 | * WIDTH=352 |
| | 1906 | * HEIGHT=288 |
| | 1907 | * BITRATE=600 |
| | 1908 | * FPS=30/1 |
| | 1909 | * LIMIT=150 |
| | 1910 | * ./vpxenc --limit=$LIMIT --width=$WIDTH --height=$HEIGHT --fps=$FPS |
| | 1911 | * --lag-in-frames=25 \ |
| | 1912 | * --codec=vp9 --good --cpu-used=0 --threads=0 --profile=0 \ |
| | 1913 | * --min-q=0 --max-q=63 --auto-alt-ref=1 --passes=2 --kf-max-dist=150 \ |
| | 1914 | * --kf-min-dist=0 --drop-frame=0 --static-thresh=0 --bias-pct=50 \ |
| | 1915 | * --minsection-pct=0 --maxsection-pct=150 --arnr-maxframes=7 --psnr \ |
| | 1916 | * --arnr-strength=5 --sharpness=0 --undershoot-pct=100 --overshoot-pct=100 \ |
| | 1917 | * --frame-parallel=0 --tile-columns=0 --cpu-used=0 --end-usage=vbr \ |
| | 1918 | * --target-bitrate=$BITRATE -o $OUTPUT $INPUT |
| | 1919 | */ |
| | 1920 | |
| 1927 | VP9EncoderConfig oxcf; | 1921 | VP9EncoderConfig oxcf; |
| 1928 | vp9_extracfg extra_cfg = get_extra_cfg(); | 1922 | vp9_extracfg extra_cfg = get_extra_cfg(); |
| 1929 | vpx_codec_enc_cfg_t enc_cfg = get_enc_cfg( | 1923 | vpx_codec_enc_cfg_t enc_cfg = get_enc_cfg( |
| 1930 | frame_width, frame_height, frame_rate, target_bitrate, enc_pass); | 1924 | frame_width, frame_height, frame_rate, target_bitrate, enc_pass); |
| 1931 | set_encoder_config(&oxcf, &enc_cfg, &extra_cfg); | 1925 | set_encoder_config(&oxcf, &enc_cfg, &extra_cfg); |
| | 1926 | |
| | 1927 | // These settings are made to match the settings of the vpxenc command. |
| | 1928 | oxcf.key_freq = 150; |
| | 1929 | oxcf.under_shoot_pct = 100; |
| | 1930 | oxcf.over_shoot_pct = 100; |
| | 1931 | oxcf.max_threads = 0; |
| | 1932 | oxcf.tile_columns = 0; |
| | 1933 | oxcf.frame_parallel_decoding_mode = 0; |
| | 1934 | oxcf.two_pass_vbrmax_section = 150; |
| 1932 | return oxcf; | 1935 | return oxcf; |
| 1933 | } | 1936 | } |
| 1934 | | 1937 | |
| | 1938 | #define DUMP_STRUCT_VALUE(struct, value) \ |
| | 1939 | printf(#value " %" PRId64 "\n", (int64_t)(struct)->value) |
| | 1940 | |
| | 1941 | void vp9_dump_encoder_config(const VP9EncoderConfig *oxcf) { |
| | 1942 | DUMP_STRUCT_VALUE(oxcf, profile); |
| | 1943 | DUMP_STRUCT_VALUE(oxcf, bit_depth); |
| | 1944 | DUMP_STRUCT_VALUE(oxcf, width); |
| | 1945 | DUMP_STRUCT_VALUE(oxcf, height); |
| | 1946 | DUMP_STRUCT_VALUE(oxcf, input_bit_depth); |
| | 1947 | DUMP_STRUCT_VALUE(oxcf, init_framerate); |
| | 1948 | // TODO(angiebird): dump g_timebase |
| | 1949 | // TODO(angiebird): dump g_timebase_in_ts |
| | 1950 | |
| | 1951 | DUMP_STRUCT_VALUE(oxcf, target_bandwidth); |
| | 1952 | |
| | 1953 | DUMP_STRUCT_VALUE(oxcf, noise_sensitivity); |
| | 1954 | DUMP_STRUCT_VALUE(oxcf, sharpness); |
| | 1955 | DUMP_STRUCT_VALUE(oxcf, speed); |
| | 1956 | DUMP_STRUCT_VALUE(oxcf, rc_max_intra_bitrate_pct); |
| | 1957 | DUMP_STRUCT_VALUE(oxcf, rc_max_inter_bitrate_pct); |
| | 1958 | DUMP_STRUCT_VALUE(oxcf, gf_cbr_boost_pct); |
| | 1959 | |
| | 1960 | DUMP_STRUCT_VALUE(oxcf, mode); |
| | 1961 | DUMP_STRUCT_VALUE(oxcf, pass); |
| | 1962 | |
| | 1963 | // Key Framing Operations |
| | 1964 | DUMP_STRUCT_VALUE(oxcf, auto_key); |
| | 1965 | DUMP_STRUCT_VALUE(oxcf, key_freq); |
| | 1966 | |
| | 1967 | DUMP_STRUCT_VALUE(oxcf, lag_in_frames); |
| | 1968 | |
| | 1969 | // ---------------------------------------------------------------- |
| | 1970 | // DATARATE CONTROL OPTIONS |
| | 1971 | |
| | 1972 | // vbr, cbr, constrained quality or constant quality |
| | 1973 | DUMP_STRUCT_VALUE(oxcf, rc_mode); |
| | 1974 | |
| | 1975 | // buffer targeting aggressiveness |
| | 1976 | DUMP_STRUCT_VALUE(oxcf, under_shoot_pct); |
| | 1977 | DUMP_STRUCT_VALUE(oxcf, over_shoot_pct); |
| | 1978 | |
| | 1979 | // buffering parameters |
| | 1980 | // TODO(angiebird): dump tarting_buffer_level_ms |
| | 1981 | // TODO(angiebird): dump ptimal_buffer_level_ms |
| | 1982 | // TODO(angiebird): dump maximum_buffer_size_ms |
| | 1983 | |
| | 1984 | // Frame drop threshold. |
| | 1985 | DUMP_STRUCT_VALUE(oxcf, drop_frames_water_mark); |
| | 1986 | |
| | 1987 | // controlling quality |
| | 1988 | DUMP_STRUCT_VALUE(oxcf, fixed_q); |
| | 1989 | DUMP_STRUCT_VALUE(oxcf, worst_allowed_q); |
| | 1990 | DUMP_STRUCT_VALUE(oxcf, best_allowed_q); |
| | 1991 | DUMP_STRUCT_VALUE(oxcf, cq_level); |
| | 1992 | DUMP_STRUCT_VALUE(oxcf, aq_mode); |
| | 1993 | |
| | 1994 | // Special handling of Adaptive Quantization for AltRef frames |
| | 1995 | DUMP_STRUCT_VALUE(oxcf, alt_ref_aq); |
| | 1996 | |
| | 1997 | // Internal frame size scaling. |
| | 1998 | DUMP_STRUCT_VALUE(oxcf, resize_mode); |
| | 1999 | DUMP_STRUCT_VALUE(oxcf, scaled_frame_width); |
| | 2000 | DUMP_STRUCT_VALUE(oxcf, scaled_frame_height); |
| | 2001 | |
| | 2002 | // Enable feature to reduce the frame quantization every x frames. |
| | 2003 | DUMP_STRUCT_VALUE(oxcf, frame_periodic_boost); |
| | 2004 | |
| | 2005 | // two pass datarate control |
| | 2006 | DUMP_STRUCT_VALUE(oxcf, two_pass_vbrbias); |
| | 2007 | DUMP_STRUCT_VALUE(oxcf, two_pass_vbrmin_section); |
| | 2008 | DUMP_STRUCT_VALUE(oxcf, two_pass_vbrmax_section); |
| | 2009 | DUMP_STRUCT_VALUE(oxcf, vbr_corpus_complexity); |
| | 2010 | // END DATARATE CONTROL OPTIONS |
| | 2011 | // ---------------------------------------------------------------- |
| | 2012 | |
| | 2013 | // Spatial and temporal scalability. |
| | 2014 | DUMP_STRUCT_VALUE(oxcf, ss_number_layers); |
| | 2015 | DUMP_STRUCT_VALUE(oxcf, ts_number_layers); |
| | 2016 | |
| | 2017 | // Bitrate allocation for spatial layers. |
| | 2018 | // TODO(angiebird): dump layer_target_bitrate[VPX_MAX_LAYERS] |
| | 2019 | // TODO(angiebird): dump ss_target_bitrate[VPX_SS_MAX_LAYERS] |
| | 2020 | // TODO(angiebird): dump ss_enable_auto_arf[VPX_SS_MAX_LAYERS] |
| | 2021 | // TODO(angiebird): dump ts_rate_decimator[VPX_TS_MAX_LAYERS] |
| | 2022 | |
| | 2023 | DUMP_STRUCT_VALUE(oxcf, enable_auto_arf); |
| | 2024 | DUMP_STRUCT_VALUE(oxcf, encode_breakout); |
| | 2025 | DUMP_STRUCT_VALUE(oxcf, error_resilient_mode); |
| | 2026 | DUMP_STRUCT_VALUE(oxcf, frame_parallel_decoding_mode); |
| | 2027 | |
| | 2028 | DUMP_STRUCT_VALUE(oxcf, arnr_max_frames); |
| | 2029 | DUMP_STRUCT_VALUE(oxcf, arnr_strength); |
| | 2030 | |
| | 2031 | DUMP_STRUCT_VALUE(oxcf, min_gf_interval); |
| | 2032 | DUMP_STRUCT_VALUE(oxcf, max_gf_interval); |
| | 2033 | |
| | 2034 | DUMP_STRUCT_VALUE(oxcf, tile_columns); |
| | 2035 | DUMP_STRUCT_VALUE(oxcf, tile_rows); |
| | 2036 | |
| | 2037 | DUMP_STRUCT_VALUE(oxcf, enable_tpl_model); |
| | 2038 | |
| | 2039 | DUMP_STRUCT_VALUE(oxcf, max_threads); |
| | 2040 | |
| | 2041 | DUMP_STRUCT_VALUE(oxcf, target_level); |
| | 2042 | |
| | 2043 | // TODO(angiebird): dump two_pass_stats_in |
| | 2044 | |
| | 2045 | #if CONFIG_FP_MB_STATS |
| | 2046 | // TODO(angiebird): dump firstpass_mb_stats_in |
| | 2047 | #endif |
| | 2048 | |
| | 2049 | DUMP_STRUCT_VALUE(oxcf, tuning); |
| | 2050 | DUMP_STRUCT_VALUE(oxcf, content); |
| | 2051 | #if CONFIG_VP9_HIGHBITDEPTH |
| | 2052 | DUMP_STRUCT_VALUE(oxcf, use_highbitdepth); |
| | 2053 | #endif |
| | 2054 | DUMP_STRUCT_VALUE(oxcf, color_space); |
| | 2055 | DUMP_STRUCT_VALUE(oxcf, color_range); |
| | 2056 | DUMP_STRUCT_VALUE(oxcf, render_width); |
| | 2057 | DUMP_STRUCT_VALUE(oxcf, render_height); |
| | 2058 | DUMP_STRUCT_VALUE(oxcf, temporal_layering_mode); |
| | 2059 | |
| | 2060 | DUMP_STRUCT_VALUE(oxcf, row_mt); |
| | 2061 | DUMP_STRUCT_VALUE(oxcf, motion_vector_unit_test); |
| | 2062 | } |
| | 2063 | |
| 1935 | FRAME_INFO vp9_get_frame_info(const VP9EncoderConfig *oxcf) { | 2064 | FRAME_INFO vp9_get_frame_info(const VP9EncoderConfig *oxcf) { |
| 1936 | FRAME_INFO frame_info; | 2065 | FRAME_INFO frame_info; |
| 1937 | int dummy; | 2066 | int dummy; |