vp10_cond_prob_diff_update(w, &probs[i], branch_ct[i]);
}
-static void write_selected_tx_size(const VP9_COMMON *cm,
+static void write_selected_tx_size(const VP10_COMMON *cm,
const MACROBLOCKD *xd, vpx_writer *w) {
TX_SIZE tx_size = xd->mi[0]->mbmi.tx_size;
BLOCK_SIZE bsize = xd->mi[0]->mbmi.sb_type;
}
}
-static int write_skip(const VP9_COMMON *cm, const MACROBLOCKD *xd,
+static int write_skip(const VP10_COMMON *cm, const MACROBLOCKD *xd,
int segment_id, const MODE_INFO *mi, vpx_writer *w) {
if (segfeature_active(&cm->seg, segment_id, SEG_LVL_SKIP)) {
return 1;
}
}
-static void update_skip_probs(VP9_COMMON *cm, vpx_writer *w,
+static void update_skip_probs(VP10_COMMON *cm, vpx_writer *w,
FRAME_COUNTS *counts) {
int k;
vp10_cond_prob_diff_update(w, &cm->fc->skip_probs[k], counts->skip[k]);
}
-static void update_switchable_interp_probs(VP9_COMMON *cm, vpx_writer *w,
+static void update_switchable_interp_probs(VP10_COMMON *cm, vpx_writer *w,
FRAME_COUNTS *counts) {
int j;
for (j = 0; j < SWITCHABLE_FILTER_CONTEXTS; ++j)
}
// This function encodes the reference frame
-static void write_ref_frames(const VP9_COMMON *cm, const MACROBLOCKD *xd,
+static void write_ref_frames(const VP10_COMMON *cm, const MACROBLOCKD *xd,
vpx_writer *w) {
const MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
const int is_compound = has_second_ref(mbmi);
}
}
-static void pack_inter_mode_mvs(VP9_COMP *cpi, const MODE_INFO *mi,
+static void pack_inter_mode_mvs(VP10_COMP *cpi, const MODE_INFO *mi,
vpx_writer *w) {
- VP9_COMMON *const cm = &cpi->common;
+ VP10_COMMON *const cm = &cpi->common;
const nmv_context *nmvc = &cm->fc->nmvc;
const MACROBLOCK *const x = &cpi->td.mb;
const MACROBLOCKD *const xd = &x->e_mbd;
}
}
-static void write_mb_modes_kf(const VP9_COMMON *cm, const MACROBLOCKD *xd,
+static void write_mb_modes_kf(const VP10_COMMON *cm, const MACROBLOCKD *xd,
MODE_INFO **mi_8x8, vpx_writer *w) {
const struct segmentation *const seg = &cm->seg;
const MODE_INFO *const mi = mi_8x8[0];
write_intra_mode(w, mbmi->uv_mode, vp10_kf_uv_mode_prob[mbmi->mode]);
}
-static void write_modes_b(VP9_COMP *cpi, const TileInfo *const tile,
+static void write_modes_b(VP10_COMP *cpi, const TileInfo *const tile,
vpx_writer *w, TOKENEXTRA **tok,
const TOKENEXTRA *const tok_end,
int mi_row, int mi_col) {
- const VP9_COMMON *const cm = &cpi->common;
+ const VP10_COMMON *const cm = &cpi->common;
MACROBLOCKD *const xd = &cpi->td.mb.e_mbd;
MODE_INFO *m;
pack_mb_tokens(w, tok, tok_end, cm->bit_depth);
}
-static void write_partition(const VP9_COMMON *const cm,
+static void write_partition(const VP10_COMMON *const cm,
const MACROBLOCKD *const xd,
int hbs, int mi_row, int mi_col,
PARTITION_TYPE p, BLOCK_SIZE bsize, vpx_writer *w) {
}
}
-static void write_modes_sb(VP9_COMP *cpi,
+static void write_modes_sb(VP10_COMP *cpi,
const TileInfo *const tile, vpx_writer *w,
TOKENEXTRA **tok, const TOKENEXTRA *const tok_end,
int mi_row, int mi_col, BLOCK_SIZE bsize) {
- const VP9_COMMON *const cm = &cpi->common;
+ const VP10_COMMON *const cm = &cpi->common;
MACROBLOCKD *const xd = &cpi->td.mb.e_mbd;
const int bsl = b_width_log2_lookup[bsize];
update_partition_context(xd, mi_row, mi_col, subsize, bsize);
}
-static void write_modes(VP9_COMP *cpi,
+static void write_modes(VP10_COMP *cpi,
const TileInfo *const tile, vpx_writer *w,
TOKENEXTRA **tok, const TOKENEXTRA *const tok_end) {
- const VP9_COMMON *const cm = &cpi->common;
+ const VP10_COMMON *const cm = &cpi->common;
MACROBLOCKD *const xd = &cpi->td.mb.e_mbd;
int mi_row, mi_col;
}
}
-static void build_tree_distribution(VP9_COMP *cpi, TX_SIZE tx_size,
+static void build_tree_distribution(VP10_COMP *cpi, TX_SIZE tx_size,
vp10_coeff_stats *coef_branch_ct,
vp10_coeff_probs_model *coef_probs) {
vp10_coeff_count *coef_counts = cpi->td.rd_counts.coef_counts[tx_size];
}
}
-static void update_coef_probs_common(vpx_writer* const bc, VP9_COMP *cpi,
+static void update_coef_probs_common(vpx_writer* const bc, VP10_COMP *cpi,
TX_SIZE tx_size,
vp10_coeff_stats *frame_branch_ct,
vp10_coeff_probs_model *new_coef_probs) {
}
}
-static void update_coef_probs(VP9_COMP *cpi, vpx_writer* w) {
+static void update_coef_probs(VP10_COMP *cpi, vpx_writer* w) {
const TX_MODE tx_mode = cpi->common.tx_mode;
const TX_SIZE max_tx_size = tx_mode_to_biggest_tx_size[tx_mode];
TX_SIZE tx_size;
if (lf->mode_ref_delta_enabled) {
vpx_wb_write_bit(wb, lf->mode_ref_delta_update);
if (lf->mode_ref_delta_update) {
- for (i = 0; i < MAX_REF_LF_DELTAS; i++) {
+ for (i = 0; i < MAX_REF_FRAMES; i++) {
const int delta = lf->ref_deltas[i];
const int changed = delta != lf->last_ref_deltas[i];
vpx_wb_write_bit(wb, changed);
}
}
-static void encode_quantization(const VP9_COMMON *const cm,
+static void encode_quantization(const VP10_COMMON *const cm,
struct vpx_write_bit_buffer *wb) {
vpx_wb_write_literal(wb, cm->base_qindex, QINDEX_BITS);
write_delta_q(wb, cm->y_dc_delta_q);
write_delta_q(wb, cm->uv_ac_delta_q);
}
-static void encode_segmentation(VP9_COMMON *cm, MACROBLOCKD *xd,
+static void encode_segmentation(VP10_COMMON *cm, MACROBLOCKD *xd,
struct vpx_write_bit_buffer *wb) {
int i, j;
}
}
-static void encode_txfm_probs(VP9_COMMON *cm, vpx_writer *w,
+static void encode_txfm_probs(VP10_COMMON *cm, vpx_writer *w,
FRAME_COUNTS *counts) {
// Mode
- vpx_write_literal(w, MIN(cm->tx_mode, ALLOW_32X32), 2);
+ vpx_write_literal(w, VPXMIN(cm->tx_mode, ALLOW_32X32), 2);
if (cm->tx_mode >= ALLOW_32X32)
vpx_write_bit(w, cm->tx_mode == TX_MODE_SELECT);
vpx_wb_write_literal(wb, filter_to_literal[filter], 2);
}
-static void fix_interp_filter(VP9_COMMON *cm, FRAME_COUNTS *counts) {
+static void fix_interp_filter(VP10_COMMON *cm, FRAME_COUNTS *counts) {
if (cm->interp_filter == SWITCHABLE) {
// Check to see if only one of the filters is actually used
int count[SWITCHABLE_FILTERS];
}
}
-static void write_tile_info(const VP9_COMMON *const cm,
+static void write_tile_info(const VP10_COMMON *const cm,
struct vpx_write_bit_buffer *wb) {
int min_log2_tile_cols, max_log2_tile_cols, ones;
vp10_get_tile_n_bits(cm->mi_cols, &min_log2_tile_cols, &max_log2_tile_cols);
vpx_wb_write_bit(wb, cm->log2_tile_rows != 1);
}
-static int get_refresh_mask(VP9_COMP *cpi) {
+static int get_refresh_mask(VP10_COMP *cpi) {
if (vp10_preserve_existing_gf(cpi)) {
// We have decided to preserve the previously existing golden frame as our
// new ARF frame. However, in the short term we leave it in the GF slot and,
}
}
-static size_t encode_tiles(VP9_COMP *cpi, uint8_t *data_ptr) {
- VP9_COMMON *const cm = &cpi->common;
+static size_t encode_tiles(VP10_COMP *cpi, uint8_t *data_ptr) {
+ VP10_COMMON *const cm = &cpi->common;
vpx_writer residual_bc;
int tile_row, tile_col;
TOKENEXTRA *tok_end;
return total_size;
}
-static void write_display_size(const VP9_COMMON *cm,
+static void write_display_size(const VP10_COMMON *cm,
struct vpx_write_bit_buffer *wb) {
const int scaling_active = cm->width != cm->display_width ||
cm->height != cm->display_height;
}
}
-static void write_frame_size(const VP9_COMMON *cm,
+static void write_frame_size(const VP10_COMMON *cm,
struct vpx_write_bit_buffer *wb) {
vpx_wb_write_literal(wb, cm->width - 1, 16);
vpx_wb_write_literal(wb, cm->height - 1, 16);
write_display_size(cm, wb);
}
-static void write_frame_size_with_refs(VP9_COMP *cpi,
+static void write_frame_size_with_refs(VP10_COMP *cpi,
struct vpx_write_bit_buffer *wb) {
- VP9_COMMON *const cm = &cpi->common;
+ VP10_COMMON *const cm = &cpi->common;
int found = 0;
MV_REFERENCE_FRAME ref_frame;
for (ref_frame = LAST_FRAME; ref_frame <= ALTREF_FRAME; ++ref_frame) {
YV12_BUFFER_CONFIG *cfg = get_ref_frame_buffer(cpi, ref_frame);
- // Set "found" to 0 for temporal svc and for spatial svc key frame
- if (cpi->use_svc &&
- ((cpi->svc.number_temporal_layers > 1 &&
- cpi->oxcf.rc_mode == VPX_CBR) ||
- (cpi->svc.number_spatial_layers > 1 &&
- cpi->svc.layer_context[cpi->svc.spatial_layer_id].is_key_frame) ||
- (is_two_pass_svc(cpi) &&
- cpi->svc.encode_empty_frame_state == ENCODING &&
- cpi->svc.layer_context[0].frames_from_key_frame <
- cpi->svc.number_temporal_layers + 1))) {
- found = 0;
- } else if (cfg != NULL) {
+ if (cfg != NULL) {
found = cm->width == cfg->y_crop_width &&
cm->height == cfg->y_crop_height;
}
}
static void write_sync_code(struct vpx_write_bit_buffer *wb) {
- vpx_wb_write_literal(wb, VP9_SYNC_CODE_0, 8);
- vpx_wb_write_literal(wb, VP9_SYNC_CODE_1, 8);
- vpx_wb_write_literal(wb, VP9_SYNC_CODE_2, 8);
+ vpx_wb_write_literal(wb, VP10_SYNC_CODE_0, 8);
+ vpx_wb_write_literal(wb, VP10_SYNC_CODE_1, 8);
+ vpx_wb_write_literal(wb, VP10_SYNC_CODE_2, 8);
}
static void write_profile(BITSTREAM_PROFILE profile,
}
static void write_bitdepth_colorspace_sampling(
- VP9_COMMON *const cm, struct vpx_write_bit_buffer *wb) {
+ VP10_COMMON *const cm, struct vpx_write_bit_buffer *wb) {
if (cm->profile >= PROFILE_2) {
assert(cm->bit_depth > VPX_BITS_8);
vpx_wb_write_bit(wb, cm->bit_depth == VPX_BITS_10 ? 0 : 1);
}
}
-static void write_uncompressed_header(VP9_COMP *cpi,
+static void write_uncompressed_header(VP10_COMP *cpi,
struct vpx_write_bit_buffer *wb) {
- VP9_COMMON *const cm = &cpi->common;
+ VP10_COMMON *const cm = &cpi->common;
MACROBLOCKD *const xd = &cpi->td.mb.e_mbd;
vpx_wb_write_literal(wb, VP9_FRAME_MARKER, 2);
write_bitdepth_colorspace_sampling(cm, wb);
write_frame_size(cm, wb);
} else {
- // In spatial svc if it's not error_resilient_mode then we need to code all
- // visible frames as invisible. But we need to keep the show_frame flag so
- // that the publisher could know whether it is supposed to be visible.
- // So we will code the show_frame flag as it is. Then code the intra_only
- // bit here. This will make the bitstream incompatible. In the player we
- // will change to show_frame flag to 0, then add an one byte frame with
- // show_existing_frame flag which tells the decoder which frame we want to
- // show.
if (!cm->show_frame)
vpx_wb_write_bit(wb, cm->intra_only);
write_tile_info(cm, wb);
}
-static size_t write_compressed_header(VP9_COMP *cpi, uint8_t *data) {
- VP9_COMMON *const cm = &cpi->common;
+static size_t write_compressed_header(VP10_COMP *cpi, uint8_t *data) {
+ VP10_COMMON *const cm = &cpi->common;
MACROBLOCKD *const xd = &cpi->td.mb.e_mbd;
FRAME_CONTEXT *const fc = cm->fc;
FRAME_COUNTS *counts = cpi->td.counts;
return header_bc.pos;
}
-void vp10_pack_bitstream(VP9_COMP *cpi, uint8_t *dest, size_t *size) {
+void vp10_pack_bitstream(VP10_COMP *cpi, uint8_t *dest, size_t *size) {
uint8_t *data = dest;
size_t first_part_size, uncompressed_hdr_size;
struct vpx_write_bit_buffer wb = {data, 0};