Merge "Cleaning up vp9_bitstream.{c, h} files."

This commit is contained in:
Dmitry Kovalev 2014-02-28 11:01:55 -08:00 committed by Gerrit Code Review
commit d5e6f09585
4 changed files with 27 additions and 29 deletions

View File

@ -16,19 +16,19 @@
#include "vpx_mem/vpx_mem.h" #include "vpx_mem/vpx_mem.h"
#include "vpx_ports/mem_ops.h" #include "vpx_ports/mem_ops.h"
#include "vp9/common/vp9_entropy.h"
#include "vp9/common/vp9_entropymode.h" #include "vp9/common/vp9_entropymode.h"
#include "vp9/common/vp9_entropymv.h" #include "vp9/common/vp9_entropymv.h"
#include "vp9/common/vp9_tile_common.h"
#include "vp9/common/vp9_seg_common.h"
#include "vp9/common/vp9_pred_common.h"
#include "vp9/common/vp9_entropy.h"
#include "vp9/common/vp9_mvref_common.h" #include "vp9/common/vp9_mvref_common.h"
#include "vp9/common/vp9_systemdependent.h"
#include "vp9/common/vp9_pragmas.h" #include "vp9/common/vp9_pragmas.h"
#include "vp9/common/vp9_pred_common.h"
#include "vp9/common/vp9_seg_common.h"
#include "vp9/common/vp9_systemdependent.h"
#include "vp9/common/vp9_tile_common.h"
#include "vp9/encoder/vp9_mcomp.h"
#include "vp9/encoder/vp9_encodemv.h"
#include "vp9/encoder/vp9_bitstream.h" #include "vp9/encoder/vp9_bitstream.h"
#include "vp9/encoder/vp9_encodemv.h"
#include "vp9/encoder/vp9_mcomp.h"
#include "vp9/encoder/vp9_segmentation.h" #include "vp9/encoder/vp9_segmentation.h"
#include "vp9/encoder/vp9_subexp.h" #include "vp9/encoder/vp9_subexp.h"
#include "vp9/encoder/vp9_tokenize.h" #include "vp9/encoder/vp9_tokenize.h"
@ -62,7 +62,7 @@ static void write_inter_mode(vp9_writer *w, MB_PREDICTION_MODE mode,
&inter_mode_encodings[INTER_OFFSET(mode)]); &inter_mode_encodings[INTER_OFFSET(mode)]);
} }
void vp9_encode_unsigned_max(struct vp9_write_bit_buffer *wb, static void encode_unsigned_max(struct vp9_write_bit_buffer *wb,
int data, int max) { int data, int max) {
vp9_wb_write_literal(wb, data, get_unsigned_bits(max)); vp9_wb_write_literal(wb, data, get_unsigned_bits(max));
} }
@ -109,15 +109,14 @@ static int write_skip(const VP9_COMP *cpi, int segment_id, MODE_INFO *m,
} }
} }
void vp9_update_skip_probs(VP9_COMMON *cm, vp9_writer *w) { static void update_skip_probs(VP9_COMMON *cm, vp9_writer *w) {
int k; int k;
for (k = 0; k < SKIP_CONTEXTS; ++k) for (k = 0; k < SKIP_CONTEXTS; ++k)
vp9_cond_prob_diff_update(w, &cm->fc.skip_probs[k], cm->counts.skip[k]); vp9_cond_prob_diff_update(w, &cm->fc.skip_probs[k], cm->counts.skip[k]);
} }
static void update_switchable_interp_probs(VP9_COMP *cpi, vp9_writer *w) { static void update_switchable_interp_probs(VP9_COMMON *cm, vp9_writer *w) {
VP9_COMMON *const cm = &cpi->common;
int j; int j;
for (j = 0; j < SWITCHABLE_FILTER_CONTEXTS; ++j) for (j = 0; j < SWITCHABLE_FILTER_CONTEXTS; ++j)
prob_diff_update(vp9_switchable_interp_tree, prob_diff_update(vp9_switchable_interp_tree,
@ -125,9 +124,8 @@ static void update_switchable_interp_probs(VP9_COMP *cpi, vp9_writer *w) {
cm->counts.switchable_interp[j], SWITCHABLE_FILTERS, w); cm->counts.switchable_interp[j], SWITCHABLE_FILTERS, w);
} }
static void pack_mb_tokens(vp9_writer* const w, static void pack_mb_tokens(vp9_writer *w,
TOKENEXTRA **tp, TOKENEXTRA **tp, const TOKENEXTRA *stop) {
const TOKENEXTRA *const stop) {
TOKENEXTRA *p = *tp; TOKENEXTRA *p = *tp;
while (p < stop && p->token != EOSB_TOKEN) { while (p < stop && p->token != EOSB_TOKEN) {
@ -236,7 +234,7 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m, vp9_writer *bc) {
MACROBLOCK *const x = &cpi->mb; MACROBLOCK *const x = &cpi->mb;
MACROBLOCKD *const xd = &x->e_mbd; MACROBLOCKD *const xd = &x->e_mbd;
const struct segmentation *const seg = &cm->seg; const struct segmentation *const seg = &cm->seg;
MB_MODE_INFO *const mi = &m->mbmi; const MB_MODE_INFO *const mi = &m->mbmi;
const MV_REFERENCE_FRAME ref0 = mi->ref_frame[0]; const MV_REFERENCE_FRAME ref0 = mi->ref_frame[0];
const MV_REFERENCE_FRAME ref1 = mi->ref_frame[1]; const MV_REFERENCE_FRAME ref1 = mi->ref_frame[1];
const MB_PREDICTION_MODE mode = mi->mode; const MB_PREDICTION_MODE mode = mi->mode;
@ -819,10 +817,10 @@ static void encode_segmentation(VP9_COMP *cpi,
const int data_max = vp9_seg_feature_data_max(j); const int data_max = vp9_seg_feature_data_max(j);
if (vp9_is_segfeature_signed(j)) { if (vp9_is_segfeature_signed(j)) {
vp9_encode_unsigned_max(wb, abs(data), data_max); encode_unsigned_max(wb, abs(data), data_max);
vp9_wb_write_bit(wb, data < 0); vp9_wb_write_bit(wb, data < 0);
} else { } else {
vp9_encode_unsigned_max(wb, data, data_max); encode_unsigned_max(wb, data, data_max);
} }
} }
} }
@ -831,9 +829,7 @@ static void encode_segmentation(VP9_COMP *cpi,
} }
static void encode_txfm_probs(VP9_COMP *cpi, vp9_writer *w) { static void encode_txfm_probs(VP9_COMMON *cm, vp9_writer *w) {
VP9_COMMON *const cm = &cpi->common;
// Mode // Mode
vp9_write_literal(w, MIN(cm->tx_mode, ALLOW_32X32), 2); vp9_write_literal(w, MIN(cm->tx_mode, ALLOW_32X32), 2);
if (cm->tx_mode >= ALLOW_32X32) if (cm->tx_mode >= ALLOW_32X32)
@ -1151,7 +1147,7 @@ static size_t write_compressed_header(VP9_COMP *cpi, uint8_t *data) {
if (xd->lossless) if (xd->lossless)
cm->tx_mode = ONLY_4X4; cm->tx_mode = ONLY_4X4;
else else
encode_txfm_probs(cpi, &header_bc); encode_txfm_probs(cm, &header_bc);
update_coef_probs(cpi, &header_bc); update_coef_probs(cpi, &header_bc);
@ -1159,7 +1155,7 @@ static size_t write_compressed_header(VP9_COMP *cpi, uint8_t *data) {
active_section = 2; active_section = 2;
#endif #endif
vp9_update_skip_probs(cm, &header_bc); update_skip_probs(cm, &header_bc);
if (!frame_is_intra_only(cm)) { if (!frame_is_intra_only(cm)) {
int i; int i;
@ -1174,7 +1170,7 @@ static size_t write_compressed_header(VP9_COMP *cpi, uint8_t *data) {
vp9_zero(cm->counts.inter_mode); vp9_zero(cm->counts.inter_mode);
if (cm->interp_filter == SWITCHABLE) if (cm->interp_filter == SWITCHABLE)
update_switchable_interp_probs(cpi, &header_bc); update_switchable_interp_probs(cm, &header_bc);
for (i = 0; i < INTRA_INTER_CONTEXTS; i++) for (i = 0; i < INTRA_INTER_CONTEXTS; i++)
vp9_cond_prob_diff_update(&header_bc, &fc->intra_inter_prob[i], vp9_cond_prob_diff_update(&header_bc, &fc->intra_inter_prob[i],

View File

@ -16,7 +16,11 @@
extern "C" { extern "C" {
#endif #endif
void vp9_update_skip_probs(VP9_COMMON *cm, vp9_writer *bc); struct VP9_COMP;
void vp9_entropy_mode_init();
void vp9_pack_bitstream(struct VP9_COMP *cpi, uint8_t *dest, size_t *size);
#ifdef __cplusplus #ifdef __cplusplus
} // extern "C" } // extern "C"

View File

@ -27,6 +27,7 @@
#include "vp9/common/vp9_systemdependent.h" #include "vp9/common/vp9_systemdependent.h"
#include "vp9/common/vp9_tile_common.h" #include "vp9/common/vp9_tile_common.h"
#include "vp9/encoder/vp9_bitstream.h"
#include "vp9/encoder/vp9_encodemv.h" #include "vp9/encoder/vp9_encodemv.h"
#include "vp9/encoder/vp9_firstpass.h" #include "vp9/encoder/vp9_firstpass.h"
#include "vp9/encoder/vp9_mbgraph.h" #include "vp9/encoder/vp9_mbgraph.h"
@ -39,7 +40,6 @@
#include "vp9/encoder/vp9_vaq.h" #include "vp9/encoder/vp9_vaq.h"
#include "vp9/encoder/vp9_resize.h" #include "vp9/encoder/vp9_resize.h"
void vp9_entropy_mode_init();
void vp9_coef_tree_initialize(); void vp9_coef_tree_initialize();
#define DEFAULT_INTERP_FILTER SWITCHABLE #define DEFAULT_INTERP_FILTER SWITCHABLE

View File

@ -714,8 +714,6 @@ static YV12_BUFFER_CONFIG *get_ref_frame_buffer(VP9_COMP *cpi,
void vp9_encode_frame(VP9_COMP *cpi); void vp9_encode_frame(VP9_COMP *cpi);
void vp9_pack_bitstream(VP9_COMP *cpi, uint8_t *dest, size_t *size);
void vp9_set_speed_features(VP9_COMP *cpi); void vp9_set_speed_features(VP9_COMP *cpi);
int vp9_calc_ss_err(const YV12_BUFFER_CONFIG *source, int vp9_calc_ss_err(const YV12_BUFFER_CONFIG *source,