cfg_.rc_target_bitrate = i;
ResetModel();
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
- ASSERT_GE(cfg_.rc_target_bitrate, effective_datarate_)
+ ASSERT_GE(cfg_.rc_target_bitrate, effective_datarate_ * 0.95)
<< " The datarate for the file exceeds the target!";
ASSERT_LE(cfg_.rc_target_bitrate, file_datarate_ * 1.3)
/* MSVS uses _f{seek,tell}i64. */
#define fseeko _fseeki64
#define ftello _ftelli64
-typedef long _off_t; // NOLINT - MSVS compatible type
-typedef __int64 off_t; // fseeki64 compatible type
-#define _OFF_T_DEFINED
#elif defined(_WIN32)
-/* MinGW defines off_t as long and uses f{seek,tell}o64/off64_t for large
- * files. */
+/* MinGW uses f{seek,tell}o64 for large files. */
#define fseeko fseeko64
#define ftello ftello64
-#define off_t off64_t
#endif /* _WIN32 */
#if CONFIG_OS_SUPPORT
/* Use 32-bit file operations in WebM file format when building ARM
* executables (.axf) with RVCT. */
#if !CONFIG_OS_SUPPORT
-typedef long off_t; /* NOLINT */
#define fseeko fseek
#define ftello ftell
#endif /* CONFIG_OS_SUPPORT */
struct VpxInputContext {
const char *filename;
FILE *file;
- off_t length;
+ int64_t length;
struct FileTypeDetectionBuffer detect;
enum VideoFileType file_type;
uint32_t width;
static int is_background(VP9_COMP *cpi, const TileInfo *const tile,
int mi_row, int mi_col) {
- MACROBLOCK *const x = &cpi->mb;
uint8_t *src, *pre;
int src_stride, pre_stride;
int this_sad = 0;
int threshold = 0;
- vp9_setup_src_planes(x, cpi->Source, mi_row, mi_col);
- src_stride = x->plane[0].src.stride;
- src = x->plane[0].src.buf;
+ // This assumes the input source frames are of the same dimension.
+ src_stride = cpi->Source->y_stride;
+ src = cpi->Source->y_buffer + (mi_row * MI_SIZE) * src_stride +
+ (mi_col * MI_SIZE);
pre_stride = cpi->Last_Source->y_stride;
pre = cpi->Last_Source->y_buffer + (mi_row * MI_SIZE) * pre_stride +
(mi_col * MI_SIZE);
// Copy data over into macro block data structures.
vp9_setup_src_planes(x, cpi->Source, 0, 0);
- // TODO(jkoleszar): are these initializations required?
- vp9_setup_pre_planes(xd, 0, get_ref_frame_buffer(cpi, LAST_FRAME), 0, 0,
- NULL);
- vp9_setup_dst_planes(xd, get_frame_new_buffer(cm), 0, 0);
-
vp9_setup_block_planes(&x->e_mbd, cm->subsampling_x, cm->subsampling_y);
- xd->mi[0]->mbmi.mode = DC_PRED;
- xd->mi[0]->mbmi.uv_mode = DC_PRED;
-
// Note: this memset assumes above_context[0], [1] and [2]
// are allocated as part of the same buffer.
vpx_memset(xd->above_context[0], 0,
const int num_mbs = cpi->common.MBs;
const double section_err = stats->coded_error / stats->count;
const double err_per_mb = section_err / num_mbs;
- const double speed_term = 1.0 + 0.04 * cpi->speed;
+ const double speed_term = 1.0 + 0.04 * cpi->oxcf.speed;
const int target_norm_bits_per_mb = ((uint64_t)section_target_bandwidth <<
BPER_MB_NORMBITS) / num_mbs;
int q;
// Further step/diamond searches as necessary
int step_param = cpi->sf.reduce_first_step_size +
- (cpi->speed < 8 ? (cpi->speed > 5 ? 1 : 0) : 2);
- step_param = MIN(step_param, (cpi->sf.max_step_search_steps - 2));
+ (cpi->oxcf.speed > 5 ? 1 : 0);
+ step_param = MIN(step_param, cpi->sf.max_step_search_steps - 2);
vp9_set_mv_search_range(x, ref_mv);
cpi->oxcf = *oxcf;
- if (cpi->oxcf.cpu_used == -6)
- cpi->oxcf.play_alternate = 0;
-
switch (cpi->oxcf.mode) {
// Real time and one pass deprecated in test code base
case ONE_PASS_GOOD:
cpi->pass = 0;
- cpi->oxcf.cpu_used = clamp(cpi->oxcf.cpu_used, -5, 5);
break;
case ONE_PASS_BEST:
case TWO_PASS_SECOND_GOOD:
cpi->pass = 2;
- cpi->oxcf.cpu_used = clamp(cpi->oxcf.cpu_used, -5, 5);
break;
case TWO_PASS_SECOND_BEST:
case REALTIME:
cpi->pass = 0;
+ cpi->oxcf.play_alternate = 0;
break;
}
(int)cpi->oxcf.target_bandwidth);
}
- cpi->speed = abs(cpi->oxcf.cpu_used);
-
#if CONFIG_MULTIPLE_ARF
vp9_zero(cpi->alt_ref_source);
#else
int noise_sensitivity; // pre processing blur: recommendation 0
int sharpness; // sharpening output: recommendation 0:
- int cpu_used;
+ int speed;
unsigned int rc_max_intra_bitrate_pct;
MODE mode;
int mbgraph_n_frames; // number of frames filled in the above
int static_mb_pct; // % forced skip mbs by segmentation
- // for real time encoding
- int speed;
-
- int cpu_used;
int pass;
int ref_frame_flags;
x->pred_sse[ref] = sse;
// Fast approximate the modelling function.
- if (cpi->speed > 4) {
+ if (cpi->oxcf.speed > 4) {
int64_t rate;
int64_t dist;
int64_t square_error = sse;
SPEED_FEATURES *const sf = &cpi->sf;
VP9_COMMON *const cm = &cpi->common;
const VP9_CONFIG *const oxcf = &cpi->oxcf;
- const int speed = cpi->speed < 0 ? -cpi->speed : cpi->speed;
int i;
// best quality defaults
case TWO_PASS_FIRST:
case ONE_PASS_GOOD:
case TWO_PASS_SECOND_GOOD:
- set_good_speed_feature(cpi, cm, sf, speed);
+ set_good_speed_feature(cpi, cm, sf, oxcf->speed);
break;
case REALTIME:
- set_rt_speed_feature(cm, sf, speed);
+ set_rt_speed_feature(cm, sf, oxcf->speed);
break;
}
xd->plane[0].pre[0].buf = frame_ptr_buf;
xd->plane[0].pre[0].stride = stride;
- // Further step/diamond searches as necessary
- if (cpi->speed < 8)
- step_param = cpi->sf.reduce_first_step_size + ((cpi->speed > 5) ? 1 : 0);
- else
- step_param = cpi->sf.reduce_first_step_size + 2;
- step_param = MIN(step_param, (cpi->sf.max_step_search_steps - 2));
+ step_param = cpi->sf.reduce_first_step_size + (cpi->oxcf.speed > 5 ? 1 : 0);
+ step_param = MIN(step_param, cpi->sf.max_step_search_steps - 2);
/*cpi->sf.search_method == HEX*/
// Ignore mv costing by sending NULL pointer instead of cost arrays
oxcf->key_freq = cfg->kf_max_dist;
- oxcf->cpu_used = extra_cfg->cpu_used;
+ oxcf->speed = clamp(abs(extra_cfg->cpu_used), 0, 7);
oxcf->encode_breakout = extra_cfg->static_thresh;
oxcf->play_alternate = extra_cfg->enable_auto_alt_ref;
oxcf->noise_sensitivity = extra_cfg->noise_sensitivity;
*got_data = 0;
while ((pkt = vpx_codec_get_cx_data(&stream->encoder, &iter))) {
static size_t fsize = 0;
- static off_t ivf_header_pos = 0;
+ static int64_t ivf_header_pos = 0;
switch (pkt->kind) {
case VPX_CODEC_CX_FRAME_PKT:
fsize += pkt->data.frame.sz;
if (!(pkt->data.frame.flags & VPX_FRAME_IS_FRAGMENT)) {
- off_t currpos = ftello(stream->file);
+ const int64_t currpos = ftello(stream->file);
fseeko(stream->file, ivf_header_pos, SEEK_SET);
ivf_write_frame_size(stream->file, fsize);
fseeko(stream->file, currpos, SEEK_SET);
int frames_in = 0, seen_frames = 0;
int64_t estimated_time_left = -1;
int64_t average_rate = -1;
- off_t lagged_count = 0;
+ int64_t lagged_count = 0;
open_input_file(&input);
int64_t rate;
if (global.limit) {
- off_t frame_in_lagged = (seen_frames - lagged_count) * 1000;
+ const int64_t frame_in_lagged = (seen_frames - lagged_count) * 1000;
rate = cx_time ? frame_in_lagged * (int64_t)1000000 / cx_time : 0;
remaining = 1000 * (global.limit - global.skip_frames
- seen_frames + lagged_count);
} else {
- off_t input_pos = ftello(input.file);
- off_t input_pos_lagged = input_pos - lagged_count;
- int64_t limit = input.length;
+ const int64_t input_pos = ftello(input.file);
+ const int64_t input_pos_lagged = input_pos - lagged_count;
+ const int64_t limit = input.length;
rate = cx_time ? input_pos_lagged * (int64_t)1000000 / cx_time : 0;
remaining = limit - input_pos + lagged_count;