Home | History | Annotate | Download | only in encoder

Lines Matching refs:oxcf

1134             if (cpi->oxcf.encode_breakout > 2000)
1135 min = cpi->oxcf.encode_breakout;
1303 buffers = cpi->oxcf.lag_in_frames;
1313 cpi->oxcf.Width, cpi->oxcf.Height,
1321 cpi->oxcf.Width, cpi->oxcf.Height, 16))
1435 cpi->oxcf.frame_rate = framerate;
1436 cpi->output_frame_rate = cpi->oxcf.frame_rate;
1437 cpi->per_frame_bandwidth = (int)(cpi->oxcf.target_bandwidth / cpi->output_frame_rate);
1438 cpi->av_per_frame_bandwidth = (int)(cpi->oxcf.target_bandwidth / cpi->output_frame_rate);
1439 cpi->min_frame_bandwidth = (int)(cpi->av_per_frame_bandwidth * cpi->oxcf.two_pass_vbrmin_section / 100);
1450 if (cpi->oxcf.play_alternate && cpi->oxcf.lag_in_frames)
1452 if (cpi->max_gf_interval > cpi->oxcf.lag_in_frames - 1)
1453 cpi->max_gf_interval = cpi->oxcf.lag_in_frames - 1;
1469 void vp8_init_config(VP8_PTR ptr, VP8_CONFIG *oxcf)
1484 cm->version = oxcf->Version;
1487 if (oxcf == 0)
1492 cpi->oxcf.best_allowed_q = MINQ;
1493 cpi->oxcf.worst_allowed_q = MAXQ;
1495 cpi->oxcf.end_usage = USAGE_STREAM_FROM_SERVER;
1496 cpi->oxcf.starting_buffer_level = 4000;
1497 cpi->oxcf.optimal_buffer_level = 5000;
1498 cpi->oxcf.maximum_buffer_size = 6000;
1499 cpi->oxcf.under_shoot_pct = 90;
1500 cpi->oxcf.allow_df = 0;
1501 cpi->oxcf.drop_frames_water_mark = 20;
1503 cpi->oxcf.allow_spatial_resampling = 0;
1504 cpi->oxcf.resample_down_water_mark = 40;
1505 cpi->oxcf.resample_up_water_mark = 60;
1507 cpi->oxcf.fixed_q = cpi->interquantizer;
1517 cpi->oxcf.two_pass_vbrbias = 50;
1518 cpi->oxcf.two_pass_vbrmax_section = 400;
1519 cpi->oxcf.two_pass_vbrmin_section = 0;
1521 cpi->oxcf.Sharpness = 0;
1522 oxcf.noise_sensitivity = 0;
1525 cpi->oxcf = *oxcf;
1528 switch (cpi->oxcf.Mode)
1535 if (cpi->oxcf.cpu_used < -16)
1537 cpi->oxcf.cpu_used = -16;
1540 if (cpi->oxcf.cpu_used > 16)
1541 cpi->oxcf.cpu_used = 16;
1550 if (cpi->oxcf.cpu_used < -5)
1552 cpi->oxcf.cpu_used = -5;
1555 if (cpi->oxcf.cpu_used > 5)
1556 cpi->oxcf.cpu_used = 5;
1573 if (cpi->oxcf.cpu_used < -5)
1575 cpi->oxcf.cpu_used = -5;
1578 if (cpi->oxcf.cpu_used > 5)
1579 cpi->oxcf.cpu_used = 5;
1592 cpi->oxcf.worst_allowed_q = q_trans[oxcf->worst_allowed_q];
1593 cpi->oxcf.best_allowed_q = q_trans[oxcf->best_allowed_q];
1595 if (oxcf->fixed_q >= 0)
1597 if (oxcf->worst_allowed_q < 0)
1598 cpi->oxcf.fixed_q = q_trans[0];
1600 cpi->oxcf.fixed_q = q_trans[oxcf->worst_allowed_q];
1602 if (oxcf->alt_q < 0)
1603 cpi->oxcf.alt_q = q_trans[0];
1605 cpi->oxcf.alt_q = q_trans[oxcf->alt_q];
1607 if (oxcf->key_q < 0)
1608 cpi->oxcf.key_q = q_trans[0];
1610 cpi->oxcf.key_q = q_trans[oxcf->key_q];
1612 if (oxcf->gold_q < 0)
1613 cpi->oxcf.gold_q = q_trans[0];
1615 cpi->oxcf.gold_q = q_trans[oxcf->gold_q];
1619 cpi->baseline_gf_interval = cpi->oxcf.alt_freq ? cpi->oxcf.alt_freq : DEFAULT_GF_INTERVAL;
1628 if (cpi->oxcf.token_partitions >= 0 && cpi->oxcf.token_partitions <= 3)
1629 cm->multi_token_partition = (TOKEN_PARTITION) cpi->oxcf.token_partitions;
1637 cpi->segment_encode_breakout[i] = cpi->oxcf.encode_breakout;
1641 if (cpi->oxcf.fixed_q > MAXQ)
1642 cpi->oxcf.fixed_q = MAXQ;
1645 if (cpi->oxcf.end_usage == USAGE_LOCAL_FILE_PLAYBACK)
1647 cpi->oxcf.starting_buffer_level = 60000;
1648 cpi->oxcf.optimal_buffer_level = 60000;
1649 cpi->oxcf.maximum_buffer_size = 240000;
1655 cpi->oxcf.target_bandwidth *= 1000;
1656 cpi->oxcf.starting_buffer_level =
1657 rescale(cpi->oxcf.starting_buffer_level,
1658 cpi->oxcf.target_bandwidth, 1000);
1660 if (cpi->oxcf.optimal_buffer_level == 0)
1661 cpi->oxcf.optimal_buffer_level = cpi->oxcf.target_bandwidth / 8;
1663 cpi->oxcf.optimal_buffer_level =
1664 rescale(cpi->oxcf.optimal_buffer_level,
1665 cpi->oxcf.target_bandwidth, 1000);
1667 if (cpi->oxcf.maximum_buffer_size == 0)
1668 cpi->oxcf.maximum_buffer_size = cpi->oxcf.target_bandwidth / 8;
1670 cpi->oxcf.maximum_buffer_size =
1671 rescale(cpi->oxcf.maximum_buffer_size,
1672 cpi->oxcf.target_bandwidth, 1000);
1674 cpi->buffer_level = cpi->oxcf.starting_buffer_level;
1675 cpi->bits_off_target = cpi->oxcf.starting_buffer_level;
1677 vp8_new_frame_rate(cpi, cpi->oxcf.frame_rate);
1678 cpi->worst_quality = cpi->oxcf.worst_allowed_q;
1679 cpi->active_worst_quality = cpi->oxcf.worst_allowed_q;
1680 cpi->avg_frame_qindex = cpi->oxcf.worst_allowed_q;
1681 cpi->best_quality = cpi->oxcf.best_allowed_q;
1682 cpi->active_best_quality = cpi->oxcf.best_allowed_q;
1683 cpi->buffered_mode = (cpi->oxcf.optimal_buffer_level > 0) ? TRUE : FALSE;
1694 cpi->drop_frames_allowed = cpi->oxcf.allow_df && cpi->buffered_mode;
1703 cpi->target_bandwidth = cpi->oxcf.target_bandwidth;
1705 cm->Width = cpi->oxcf.Width ;
1706 cm->Height = cpi->oxcf.Height ;
1714 if (cpi->oxcf.Sharpness > 7)
1715 cpi->oxcf.Sharpness = 7;
1717 cm->sharpness_level = cpi->oxcf.Sharpness;
1728 cm->Width = (hs - 1 + cpi->oxcf.Width * hr) / hs;
1729 cm->Height = (vs - 1 + cpi->oxcf.Height * vr) / vs;
1744 if (cpi->oxcf.fixed_q >= 0)
1746 cpi->last_q[0] = cpi->oxcf.fixed_q;
1747 cpi->last_q[1] = cpi->oxcf.fixed_q;
1750 cpi->Speed = cpi->oxcf.cpu_used;
1753 if (cpi->oxcf.lag_in_frames == 0)
1755 cpi->oxcf.allow_lag = 0;
1758 else if (cpi->oxcf.lag_in_frames > MAX_LAG_BUFFERS)
1759 cpi->oxcf.lag_in_frames = MAX_LAG_BUFFERS;
1794 void vp8_change_config(VP8_PTR ptr, VP8_CONFIG *oxcf)
1802 if (!oxcf)
1805 if (cm->version != oxcf->Version)
1807 cm->version = oxcf->Version;
1811 cpi->oxcf = *oxcf;
1813 switch (cpi->oxcf.Mode)
1820 if (cpi->oxcf.cpu_used < -16)
1822 cpi->oxcf.cpu_used = -16;
1825 if (cpi->oxcf.cpu_used > 16)
1826 cpi->oxcf.cpu_used = 16;
1835 if (cpi->oxcf.cpu_used < -5)
1837 cpi->oxcf.cpu_used = -5;
1840 if (cpi->oxcf.cpu_used > 5)
1841 cpi->oxcf.cpu_used = 5;
1858 if (cpi->oxcf.cpu_used < -5)
1860 cpi->oxcf.cpu_used = -5;
1863 if (cpi->oxcf.cpu_used > 5)
1864 cpi->oxcf.cpu_used = 5;
1877 cpi->oxcf.worst_allowed_q = q_trans[oxcf->worst_allowed_q];
1878 cpi->oxcf.best_allowed_q = q_trans[oxcf->best_allowed_q];
1880 if (oxcf->fixed_q >= 0)
1882 if (oxcf->worst_allowed_q < 0)
1883 cpi->oxcf.fixed_q = q_trans[0];
1885 cpi->oxcf.fixed_q = q_trans[oxcf->worst_allowed_q];
1887 if (oxcf->alt_q < 0)
1888 cpi->oxcf.alt_q = q_trans[0];
1890 cpi->oxcf.alt_q = q_trans[oxcf->alt_q];
1892 if (oxcf->key_q < 0)
1893 cpi->oxcf.key_q = q_trans[0];
1895 cpi->oxcf.key_q = q_trans[oxcf->key_q];
1897 if (oxcf->gold_q < 0)
1898 cpi->oxcf.gold_q = q_trans[0];
1900 cpi->oxcf.gold_q = q_trans[oxcf->gold_q];
1904 cpi->baseline_gf_interval = cpi->oxcf.alt_freq ? cpi->oxcf.alt_freq : DEFAULT_GF_INTERVAL;
1914 if (cpi->oxcf.token_partitions >= 0 && cpi->oxcf.token_partitions <= 3)
1915 cm->multi_token_partition = (TOKEN_PARTITION) cpi->oxcf.token_partitions;
1923 cpi->segment_encode_breakout[i] = cpi->oxcf.encode_breakout;
1927 if (cpi->oxcf.fixed_q > MAXQ)
1928 cpi->oxcf.fixed_q = MAXQ;
1931 if (cpi->oxcf.end_usage == USAGE_LOCAL_FILE_PLAYBACK)
1933 cpi->oxcf.starting_buffer_level = 60000;
1934 cpi->oxcf.optimal_buffer_level = 60000;
1935 cpi->oxcf.maximum_buffer_size = 240000;
1940 cpi->oxcf.target_bandwidth *= 1000;
1942 cpi->oxcf.starting_buffer_level =
1943 rescale(cpi->oxcf.starting_buffer_level,
1944 cpi->oxcf.target_bandwidth, 1000);
1946 if (cpi->oxcf.optimal_buffer_level == 0)
1947 cpi->oxcf.optimal_buffer_level = cpi->oxcf.target_bandwidth / 8;
1949 cpi->oxcf.optimal_buffer_level =
1950 rescale(cpi->oxcf.optimal_buffer_level,
1951 cpi->oxcf.target_bandwidth, 1000);
1953 if (cpi->oxcf.maximum_buffer_size == 0)
1954 cpi->oxcf.maximum_buffer_size = cpi->oxcf.target_bandwidth / 8;
1956 cpi->oxcf.maximum_buffer_size =
1957 rescale(cpi->oxcf.maximum_buffer_size,
1958 cpi->oxcf.target_bandwidth, 1000);
1960 cpi->buffer_level = cpi->oxcf.starting_buffer_level;
1961 cpi->bits_off_target = cpi->oxcf.starting_buffer_level;
1963 vp8_new_frame_rate(cpi, cpi->oxcf.frame_rate);
1964 cpi->worst_quality = cpi->oxcf.worst_allowed_q;
1965 cpi->active_worst_quality = cpi->oxcf.worst_allowed_q;
1966 cpi->avg_frame_qindex = cpi->oxcf.worst_allowed_q;
1967 cpi->best_quality = cpi->oxcf.best_allowed_q;
1968 cpi->active_best_quality = cpi->oxcf.best_allowed_q;
1969 cpi->buffered_mode = (cpi->oxcf.optimal_buffer_level > 0) ? TRUE : FALSE;
1980 cpi->drop_frames_allowed = cpi->oxcf.allow_df && cpi->buffered_mode;
1989 cpi->target_bandwidth = cpi->oxcf.target_bandwidth;
1991 cm->Width = cpi->oxcf.Width ;
1992 cm->Height = cpi->oxcf.Height ;
2000 if (cpi->oxcf.Sharpness > 7)
2001 cpi->oxcf.Sharpness = 7;
2003 cm->sharpness_level = cpi->oxcf.Sharpness;
2014 cm->Width = (hs - 1 + cpi->oxcf.Width * hr) / hs;
2015 cm->Height = (vs - 1 + cpi->oxcf.Height * vr) / vs;
2030 if (cpi->oxcf.fixed_q >= 0)
2032 cpi->last_q[0] = cpi->oxcf.fixed_q;
2033 cpi->last_q[1] = cpi->oxcf.fixed_q;
2036 cpi->Speed = cpi->oxcf.cpu_used;
2039 if (cpi->oxcf.lag_in_frames == 0)
2041 cpi->oxcf.allow_lag = 0;
2044 else if (cpi->oxcf.lag_in_frames > MAX_LAG_BUFFERS)
2045 cpi->oxcf.lag_in_frames = MAX_LAG_BUFFERS;
2080 VP8_PTR vp8_create_compressor(VP8_CONFIG *oxcf)
2118 vp8_init_config((VP8_PTR)cpi, oxcf);
2185 cpi->cyclic_refresh_mode_enabled = cpi->oxcf.error_resilient_mode;
2206 cpi->key_frame_frequency = cpi->oxcf.key_freq;
2255 cpi->ni_av_qi = cpi->oxcf.worst_allowed_q;
2295 cpi->output_pkt_list = oxcf->output_pkt_list;
2306 int packets = oxcf->two_pass_stats_in.sz / packet_sz;
2308 cpi->stats_in = oxcf->two_pass_stats_in.buf;
2472 fprintf(f, "minq:%d -maxq:%d skipture:skipfalse = %d:%d\n", cpi->oxcf.best_allowed_q, cpi->oxcf.worst_allowed_q, skiptruecount, skipfalsecount);
2504 double dr = (double)cpi->oxcf.frame_rate * (double)bytes * (double)8 / (double)count / (double)1000 ;
2936 if (cpi->oxcf.allow_spatial_resampling && (cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER))
2943 if (cpi->buffer_level < (cpi->oxcf.resample_down_water_mark * cpi->oxcf.optimal_buffer_level / 100))
2949 else if (cpi->buffer_level > (cpi->oxcf.resample_up_water_mark * cpi->oxcf.optimal_buffer_level / 100))
2958 new_width = ((hs - 1) + (cpi->oxcf.Width * hr)) / hs;
2959 new_height = ((vs - 1) + (cpi->oxcf.Height * vr)) / vs;
2990 cpi->this_frame_target = cpi->oxcf.target_bandwidth / 2;
2994 if (cpi->oxcf.error_resilient_mode == 1 || (cpi->compressor_speed == 2))
3153 if (cpi->oxcf.fixed_q >= 0 &&
3154 cpi->oxcf.play_alternate && !cpi->common.refresh_alt_ref_frame)
3463 int drop_mark = cpi->oxcf.drop_frames_water_mark * cpi->oxcf.optimal_buffer_level / 100;
3510 (cpi->oxcf.auto_key && (cpi->frames_since_key % cpi->key_frame_frequency == 0)))
3622 if ((cm->frame_type == KEY_FRAME)) // && cpi->oxcf.allow_spatial_resampling )
3658 if ((cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER) &&
3659 (cpi->buffer_level >= cpi->oxcf.optimal_buffer_level) && cpi->buffered_mode)
3668 if (cpi->buffer_level < cpi->oxcf.maximum_buffer_size)
3670 buff_lvl_step = (cpi->oxcf.maximum_buffer_size - cpi->oxcf.optimal_buffer_level) / Adjustment;
3674 Adjustment = (cpi->buffer_level - cpi->oxcf.optimal_buffer_level) / buff_lvl_step;
3735 if (cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER)
3738 if (cpi->buffer_level >= cpi->oxcf.maximum_buffer_size)
3741 else if (cpi->buffer_level > cpi->oxcf.optimal_buffer_level)
3743 int Fraction = ((cpi->buffer_level - cpi->oxcf.optimal_buffer_level) * 128) / (cpi->oxcf.maximum_buffer_size - cpi->oxcf.optimal_buffer_level);
3794 if (cpi->oxcf.noise_sensitivity > 0)
3799 switch (cpi->oxcf.noise_sensitivity)
3840 // cpi->oxcf.noise_sensitivity);
3945 if (cpi->pass != 2 && cpi->oxcf.auto_key && cm->frame_type != KEY_FRAME)
3995 if (((cpi->pass != 2) || (cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER)) &&
4185 if (!cpi->oxcf.error_resilient_mode && cm->refresh_golden_frame)
4233 if (cpi->oxcf.error_resilient_mode == 1)
4346 (cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER) &&
4347 (cpi->buffer_level < cpi->oxcf.drop_frames_water_mark * cpi->oxcf.optimal_buffer_level / 100) &&
4439 (cpi->oxcf.starting_buffer_level-cpi->bits_off_target),
4457 (cpi->oxcf.starting_buffer_level-cpi->bits_off_target),
4530 if (cpi->oxcf.error_resilient_mode)
4541 if (cpi->oxcf.play_alternate && cpi->common.refresh_alt_ref_frame)
4678 double two_pass_min_rate = (double)(cpi->oxcf.target_bandwidth
4679 *cpi->oxcf.two_pass_vbrmin_section / 100);
4680 cpi->bits_left += (long long)(two_pass_min_rate / cpi->oxcf.frame_rate);
4712 if (cpi->source_buffer_count != 0 && cpi->source_buffer_count >= cpi->oxcf.lag_in_frames)
4732 if (cpi->oxcf.allow_lag)
4738 which_buffer = cpi->oxcf.lag_in_frames - 1;
4740 if (cpi->source_buffer_count < cpi->oxcf.lag_in_frames - 1)
4820 if ((cpi->source_buffer_count == cpi->oxcf.lag_in_frames && cpi->oxcf.lag_in_frames > 0)
4821 || (!cpi->oxcf.allow_lag && cpi->source_buffer_count > 0)
4834 if (cpi->oxcf.error_resilient_mode == 0 &&
4835 cpi->oxcf.play_alternate &&
4838 cpi->oxcf.lag_in_frames != 0)
4840 cpi->last_alt_ref_sei = (cpi->source_encode_index + cpi->frames_till_gf_update_due) % cpi->oxcf.lag_in_frames;
4844 if (cpi->oxcf.arnr_max_frames > 0)
4850 int i, besti = -1, pastin = cpi->oxcf.arnr_strength;
4855 start_frame += cpi->oxcf.lag_in_frames;
4863 cpi->oxcf.arnr_strength = i;
4878 cpi->oxcf.arnr_strength = besti;
4920 if (cpi->oxcf.allow_lag)
4930 cpi->source_encode_index = (cpi->source_encode_index + 1) % cpi->oxcf.lag_in_frames;
4996 vp8_new_frame_rate(cpi, (7 * cpi->oxcf.frame_rate + this_fps) / 8);
5181 if (cpi->common.frame_type != 0 && cpi->common.base_qindex == cpi->oxcf.worst_allowed_q)