summaryrefslogtreecommitdiff
path: root/vp8/encoder
diff options
context:
space:
mode:
Diffstat (limited to 'vp8/encoder')
-rw-r--r--vp8/encoder/boolhuff.c22
-rw-r--r--vp8/encoder/boolhuff.h36
-rw-r--r--vp8/encoder/denoising.c47
-rw-r--r--vp8/encoder/mcomp.h28
-rw-r--r--vp8/encoder/modecosts.h2
-rw-r--r--vp8/encoder/onyx_if.c6
-rw-r--r--vp8/encoder/pickinter.c21
-rw-r--r--vp8/encoder/rdopt.c12
-rw-r--r--vp8/encoder/rdopt.h18
-rw-r--r--vp8/encoder/treewriter.h4
10 files changed, 97 insertions, 99 deletions
diff --git a/vp8/encoder/boolhuff.c b/vp8/encoder/boolhuff.c
index 04f8db933..d1ed3c10c 100644
--- a/vp8/encoder/boolhuff.c
+++ b/vp8/encoder/boolhuff.c
@@ -42,26 +42,26 @@ const unsigned int vp8_prob_cost[256] = {
12, 10, 9, 7, 6, 4, 3, 1, 1
};
-void vp8_start_encode(BOOL_CODER *br, unsigned char *source,
+void vp8_start_encode(BOOL_CODER *bc, unsigned char *source,
unsigned char *source_end) {
- br->lowvalue = 0;
- br->range = 255;
- br->count = -24;
- br->buffer = source;
- br->buffer_end = source_end;
- br->pos = 0;
+ bc->lowvalue = 0;
+ bc->range = 255;
+ bc->count = -24;
+ bc->buffer = source;
+ bc->buffer_end = source_end;
+ bc->pos = 0;
}
-void vp8_stop_encode(BOOL_CODER *br) {
+void vp8_stop_encode(BOOL_CODER *bc) {
int i;
- for (i = 0; i < 32; ++i) vp8_encode_bool(br, 0, 128);
+ for (i = 0; i < 32; ++i) vp8_encode_bool(bc, 0, 128);
}
-void vp8_encode_value(BOOL_CODER *br, int data, int bits) {
+void vp8_encode_value(BOOL_CODER *bc, int data, int bits) {
int bit;
for (bit = bits - 1; bit >= 0; bit--) {
- vp8_encode_bool(br, (1 & (data >> bit)), 0x80);
+ vp8_encode_bool(bc, (1 & (data >> bit)), 0x80);
}
}
diff --git a/vp8/encoder/boolhuff.h b/vp8/encoder/boolhuff.h
index 2cf62def1..029f9628a 100644
--- a/vp8/encoder/boolhuff.h
+++ b/vp8/encoder/boolhuff.h
@@ -35,11 +35,11 @@ typedef struct {
struct vpx_internal_error_info *error;
} BOOL_CODER;
-extern void vp8_start_encode(BOOL_CODER *bc, unsigned char *buffer,
- unsigned char *buffer_end);
+void vp8_start_encode(BOOL_CODER *bc, unsigned char *source,
+ unsigned char *source_end);
-extern void vp8_encode_value(BOOL_CODER *br, int data, int bits);
-extern void vp8_stop_encode(BOOL_CODER *bc);
+void vp8_encode_value(BOOL_CODER *bc, int data, int bits);
+void vp8_stop_encode(BOOL_CODER *bc);
extern const unsigned int vp8_prob_cost[256];
DECLARE_ALIGNED(16, extern const unsigned char, vp8_norm[256]);
@@ -56,11 +56,11 @@ static int validate_buffer(const unsigned char *start, size_t len,
return 0;
}
-static void vp8_encode_bool(BOOL_CODER *br, int bit, int probability) {
+static void vp8_encode_bool(BOOL_CODER *bc, int bit, int probability) {
unsigned int split;
- int count = br->count;
- unsigned int range = br->range;
- unsigned int lowvalue = br->lowvalue;
+ int count = bc->count;
+ unsigned int range = bc->range;
+ unsigned int lowvalue = bc->lowvalue;
int shift;
#ifdef VP8_ENTROPY_STATS
@@ -80,7 +80,7 @@ static void vp8_encode_bool(BOOL_CODER *br, int bit, int probability) {
if (bit) {
lowvalue += split;
- range = br->range - split;
+ range = bc->range - split;
}
shift = vp8_norm[range];
@@ -92,18 +92,18 @@ static void vp8_encode_bool(BOOL_CODER *br, int bit, int probability) {
int offset = shift - count;
if ((lowvalue << (offset - 1)) & 0x80000000) {
- int x = br->pos - 1;
+ int x = bc->pos - 1;
- while (x >= 0 && br->buffer[x] == 0xff) {
- br->buffer[x] = (unsigned char)0;
+ while (x >= 0 && bc->buffer[x] == 0xff) {
+ bc->buffer[x] = (unsigned char)0;
x--;
}
- br->buffer[x] += 1;
+ bc->buffer[x] += 1;
}
- validate_buffer(br->buffer + br->pos, 1, br->buffer_end, br->error);
- br->buffer[br->pos++] = (lowvalue >> (24 - offset));
+ validate_buffer(bc->buffer + bc->pos, 1, bc->buffer_end, bc->error);
+ bc->buffer[bc->pos++] = (lowvalue >> (24 - offset));
lowvalue <<= offset;
shift = count;
@@ -112,9 +112,9 @@ static void vp8_encode_bool(BOOL_CODER *br, int bit, int probability) {
}
lowvalue <<= shift;
- br->count = count;
- br->lowvalue = lowvalue;
- br->range = range;
+ bc->count = count;
+ bc->lowvalue = lowvalue;
+ bc->range = range;
}
#ifdef __cplusplus
diff --git a/vp8/encoder/denoising.c b/vp8/encoder/denoising.c
index eb963b97e..e54d1e9f4 100644
--- a/vp8/encoder/denoising.c
+++ b/vp8/encoder/denoising.c
@@ -213,13 +213,12 @@ int vp8_denoiser_filter_c(unsigned char *mc_running_avg_y, int mc_avg_y_stride,
return FILTER_BLOCK;
}
-int vp8_denoiser_filter_uv_c(unsigned char *mc_running_avg_uv,
- int mc_avg_uv_stride,
- unsigned char *running_avg_uv, int avg_uv_stride,
+int vp8_denoiser_filter_uv_c(unsigned char *mc_running_avg, int mc_avg_stride,
+ unsigned char *running_avg, int avg_stride,
unsigned char *sig, int sig_stride,
unsigned int motion_magnitude,
int increase_denoising) {
- unsigned char *running_avg_uv_start = running_avg_uv;
+ unsigned char *running_avg_start = running_avg;
unsigned char *sig_start = sig;
int sum_diff_thresh;
int r, c;
@@ -259,13 +258,13 @@ int vp8_denoiser_filter_uv_c(unsigned char *mc_running_avg_uv,
int adjustment = 0;
int absdiff = 0;
- diff = mc_running_avg_uv[c] - sig[c];
+ diff = mc_running_avg[c] - sig[c];
absdiff = abs(diff);
// When |diff| <= |3 + shift_inc1|, use pixel value from
// last denoised raw.
if (absdiff <= 3 + shift_inc1) {
- running_avg_uv[c] = mc_running_avg_uv[c];
+ running_avg[c] = mc_running_avg[c];
sum_diff += diff;
} else {
if (absdiff >= 4 && absdiff <= 7) {
@@ -277,16 +276,16 @@ int vp8_denoiser_filter_uv_c(unsigned char *mc_running_avg_uv,
}
if (diff > 0) {
if ((sig[c] + adjustment) > 255) {
- running_avg_uv[c] = 255;
+ running_avg[c] = 255;
} else {
- running_avg_uv[c] = sig[c] + adjustment;
+ running_avg[c] = sig[c] + adjustment;
}
sum_diff += adjustment;
} else {
if ((sig[c] - adjustment) < 0) {
- running_avg_uv[c] = 0;
+ running_avg[c] = 0;
} else {
- running_avg_uv[c] = sig[c] - adjustment;
+ running_avg[c] = sig[c] - adjustment;
}
sum_diff -= adjustment;
}
@@ -294,8 +293,8 @@ int vp8_denoiser_filter_uv_c(unsigned char *mc_running_avg_uv,
}
/* Update pointers for next iteration. */
sig += sig_stride;
- mc_running_avg_uv += mc_avg_uv_stride;
- running_avg_uv += avg_uv_stride;
+ mc_running_avg += mc_avg_stride;
+ running_avg += avg_stride;
}
sum_diff_thresh = SUM_DIFF_THRESHOLD_UV;
@@ -314,27 +313,27 @@ int vp8_denoiser_filter_uv_c(unsigned char *mc_running_avg_uv,
// Only apply the adjustment for max delta up to 3.
if (delta < 4) {
sig -= sig_stride * 8;
- mc_running_avg_uv -= mc_avg_uv_stride * 8;
- running_avg_uv -= avg_uv_stride * 8;
+ mc_running_avg -= mc_avg_stride * 8;
+ running_avg -= avg_stride * 8;
for (r = 0; r < 8; ++r) {
for (c = 0; c < 8; ++c) {
- int diff = mc_running_avg_uv[c] - sig[c];
+ int diff = mc_running_avg[c] - sig[c];
int adjustment = abs(diff);
if (adjustment > delta) adjustment = delta;
if (diff > 0) {
// Bring denoised signal down.
- if (running_avg_uv[c] - adjustment < 0) {
- running_avg_uv[c] = 0;
+ if (running_avg[c] - adjustment < 0) {
+ running_avg[c] = 0;
} else {
- running_avg_uv[c] = running_avg_uv[c] - adjustment;
+ running_avg[c] = running_avg[c] - adjustment;
}
sum_diff -= adjustment;
} else if (diff < 0) {
// Bring denoised signal up.
- if (running_avg_uv[c] + adjustment > 255) {
- running_avg_uv[c] = 255;
+ if (running_avg[c] + adjustment > 255) {
+ running_avg[c] = 255;
} else {
- running_avg_uv[c] = running_avg_uv[c] + adjustment;
+ running_avg[c] = running_avg[c] + adjustment;
}
sum_diff += adjustment;
}
@@ -342,8 +341,8 @@ int vp8_denoiser_filter_uv_c(unsigned char *mc_running_avg_uv,
// TODO(marpan): Check here if abs(sum_diff) has gone below the
// threshold sum_diff_thresh, and if so, we can exit the row loop.
sig += sig_stride;
- mc_running_avg_uv += mc_avg_uv_stride;
- running_avg_uv += avg_uv_stride;
+ mc_running_avg += mc_avg_stride;
+ running_avg += avg_stride;
}
if (abs(sum_diff) > sum_diff_thresh) return COPY_BLOCK;
} else {
@@ -351,7 +350,7 @@ int vp8_denoiser_filter_uv_c(unsigned char *mc_running_avg_uv,
}
}
- vp8_copy_mem8x8(running_avg_uv_start, avg_uv_stride, sig_start, sig_stride);
+ vp8_copy_mem8x8(running_avg_start, avg_stride, sig_start, sig_stride);
return FILTER_BLOCK;
}
diff --git a/vp8/encoder/mcomp.h b/vp8/encoder/mcomp.h
index 490b0b872..397f872e2 100644
--- a/vp8/encoder/mcomp.h
+++ b/vp8/encoder/mcomp.h
@@ -19,8 +19,8 @@ extern "C" {
#endif
#ifdef VP8_ENTROPY_STATS
-extern void init_mv_ref_counts();
-extern void accum_mv_refs(MB_PREDICTION_MODE, const int near_mv_ref_cts[4]);
+void init_mv_ref_counts();
+void accum_mv_refs(MB_PREDICTION_MODE, const int near_mv_ref_cts[4]);
#endif
/* The maximum number of steps in a step search given the largest allowed
@@ -34,15 +34,15 @@ extern void accum_mv_refs(MB_PREDICTION_MODE, const int near_mv_ref_cts[4]);
/* Maximum size of the first step in full pel units */
#define MAX_FIRST_STEP (1 << (MAX_MVSEARCH_STEPS - 1))
-extern void print_mode_context(void);
-extern int vp8_mv_bit_cost(int_mv *mv, int_mv *ref, int *mvcost[2], int Weight);
-extern void vp8_init_dsmotion_compensation(MACROBLOCK *x, int stride);
-extern void vp8_init3smotion_compensation(MACROBLOCK *x, int stride);
+void print_mode_context(void);
+int vp8_mv_bit_cost(int_mv *mv, int_mv *ref, int *mvcost[2], int Weight);
+void vp8_init_dsmotion_compensation(MACROBLOCK *x, int stride);
+void vp8_init3smotion_compensation(MACROBLOCK *x, int stride);
-extern int vp8_hex_search(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv,
- int_mv *best_mv, int search_param, int error_per_bit,
- const vp8_variance_fn_ptr_t *vf, int *mvsadcost[2],
- int *mvcost[2], int_mv *center_mv);
+int vp8_hex_search(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv,
+ int_mv *best_mv, int search_param, int sad_per_bit,
+ const vp8_variance_fn_ptr_t *vfp, int *mvsadcost[2],
+ int *mvcost[2], int_mv *center_mv);
typedef int(fractional_mv_step_fp)(MACROBLOCK *x, BLOCK *b, BLOCKD *d,
int_mv *bestmv, int_mv *ref_mv,
@@ -51,10 +51,10 @@ typedef int(fractional_mv_step_fp)(MACROBLOCK *x, BLOCK *b, BLOCKD *d,
int *mvcost[2], int *distortion,
unsigned int *sse);
-extern fractional_mv_step_fp vp8_find_best_sub_pixel_step_iteratively;
-extern fractional_mv_step_fp vp8_find_best_sub_pixel_step;
-extern fractional_mv_step_fp vp8_find_best_half_pixel_step;
-extern fractional_mv_step_fp vp8_skip_fractional_mv_step;
+fractional_mv_step_fp vp8_find_best_sub_pixel_step_iteratively;
+fractional_mv_step_fp vp8_find_best_sub_pixel_step;
+fractional_mv_step_fp vp8_find_best_half_pixel_step;
+fractional_mv_step_fp vp8_skip_fractional_mv_step;
typedef int (*vp8_full_search_fn_t)(MACROBLOCK *x, BLOCK *b, BLOCKD *d,
int_mv *ref_mv, int sad_per_bit,
diff --git a/vp8/encoder/modecosts.h b/vp8/encoder/modecosts.h
index 422a79b36..09ee2b552 100644
--- a/vp8/encoder/modecosts.h
+++ b/vp8/encoder/modecosts.h
@@ -17,7 +17,7 @@ extern "C" {
struct VP8_COMP;
-void vp8_init_mode_costs(struct VP8_COMP *x);
+void vp8_init_mode_costs(struct VP8_COMP *c);
#ifdef __cplusplus
} // extern "C"
diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c
index 2da940199..ddd588294 100644
--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -2106,8 +2106,8 @@ struct VP8_COMP *vp8_create_compressor(VP8_CONFIG *oxcf) {
return cpi;
}
-void vp8_remove_compressor(VP8_COMP **ptr) {
- VP8_COMP *cpi = *ptr;
+void vp8_remove_compressor(VP8_COMP **comp) {
+ VP8_COMP *cpi = *comp;
if (!cpi) return;
@@ -2326,7 +2326,7 @@ void vp8_remove_compressor(VP8_COMP **ptr) {
vp8_remove_common(&cpi->common);
vpx_free(cpi);
- *ptr = 0;
+ *comp = 0;
#ifdef OUTPUT_YUV_SRC
fclose(yuv_file);
diff --git a/vp8/encoder/pickinter.c b/vp8/encoder/pickinter.c
index 1bb54fc2b..6bb3cacc5 100644
--- a/vp8/encoder/pickinter.c
+++ b/vp8/encoder/pickinter.c
@@ -173,9 +173,8 @@ static int get_prediction_error(BLOCK *be, BLOCKD *b) {
static int pick_intra4x4block(MACROBLOCK *x, int ib,
B_PREDICTION_MODE *best_mode,
- const int *mode_costs,
-
- int *bestrate, int *bestdistortion) {
+ const int *mode_costs, int *bestrate,
+ int *bestdistortion) {
BLOCKD *b = &x->e_mbd.block[ib];
BLOCK *be = &x->block[ib];
int dst_stride = x->e_mbd.dst.y_stride;
@@ -1303,9 +1302,9 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
update_mvcount(x, &best_ref_mv);
}
-void vp8_pick_intra_mode(MACROBLOCK *x, int *rate_) {
+void vp8_pick_intra_mode(MACROBLOCK *x, int *rate) {
int error4x4, error16x16 = INT_MAX;
- int rate, best_rate = 0, distortion, best_sse;
+ int rate_, best_rate = 0, distortion, best_sse;
MB_PREDICTION_MODE mode, best_mode = DC_PRED;
int this_rd;
unsigned int sse;
@@ -1323,23 +1322,23 @@ void vp8_pick_intra_mode(MACROBLOCK *x, int *rate_) {
xd->predictor, 16);
distortion = vpx_variance16x16(*(b->base_src), b->src_stride, xd->predictor,
16, &sse);
- rate = x->mbmode_cost[xd->frame_type][mode];
- this_rd = RDCOST(x->rdmult, x->rddiv, rate, distortion);
+ rate_ = x->mbmode_cost[xd->frame_type][mode];
+ this_rd = RDCOST(x->rdmult, x->rddiv, rate_, distortion);
if (error16x16 > this_rd) {
error16x16 = this_rd;
best_mode = mode;
best_sse = sse;
- best_rate = rate;
+ best_rate = rate_;
}
}
xd->mode_info_context->mbmi.mode = best_mode;
- error4x4 = pick_intra4x4mby_modes(x, &rate, &best_sse);
+ error4x4 = pick_intra4x4mby_modes(x, &rate_, &best_sse);
if (error4x4 < error16x16) {
xd->mode_info_context->mbmi.mode = B_PRED;
- best_rate = rate;
+ best_rate = rate_;
}
- *rate_ = best_rate;
+ *rate = best_rate;
}
diff --git a/vp8/encoder/rdopt.c b/vp8/encoder/rdopt.c
index b4182c5cd..679d66bbf 100644
--- a/vp8/encoder/rdopt.c
+++ b/vp8/encoder/rdopt.c
@@ -2358,11 +2358,11 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
rd_update_mvcount(x, &best_ref_mv);
}
-void vp8_rd_pick_intra_mode(MACROBLOCK *x, int *rate_) {
+void vp8_rd_pick_intra_mode(MACROBLOCK *x, int *rate) {
int error4x4, error16x16;
int rate4x4, rate16x16 = 0, rateuv;
int dist4x4, dist16x16, distuv;
- int rate;
+ int rate_;
int rate4x4_tokenonly = 0;
int rate16x16_tokenonly = 0;
int rateuv_tokenonly = 0;
@@ -2370,7 +2370,7 @@ void vp8_rd_pick_intra_mode(MACROBLOCK *x, int *rate_) {
x->e_mbd.mode_info_context->mbmi.ref_frame = INTRA_FRAME;
rd_pick_intra_mbuv_mode(x, &rateuv, &rateuv_tokenonly, &distuv);
- rate = rateuv;
+ rate_ = rateuv;
error16x16 = rd_pick_intra16x16mby_mode(x, &rate16x16, &rate16x16_tokenonly,
&dist16x16);
@@ -2380,10 +2380,10 @@ void vp8_rd_pick_intra_mode(MACROBLOCK *x, int *rate_) {
if (error4x4 < error16x16) {
x->e_mbd.mode_info_context->mbmi.mode = B_PRED;
- rate += rate4x4;
+ rate_ += rate4x4;
} else {
- rate += rate16x16;
+ rate_ += rate16x16;
}
- *rate_ = rate;
+ *rate = rate_;
}
diff --git a/vp8/encoder/rdopt.h b/vp8/encoder/rdopt.h
index e22b58b8a..cc3db8197 100644
--- a/vp8/encoder/rdopt.h
+++ b/vp8/encoder/rdopt.h
@@ -63,12 +63,12 @@ static INLINE void insertsortsad(int arr[], int idx[], int len) {
}
}
-extern void vp8_initialize_rd_consts(VP8_COMP *cpi, MACROBLOCK *x, int Qvalue);
-extern void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x,
- int recon_yoffset, int recon_uvoffset,
- int *returnrate, int *returndistortion,
- int *returnintra, int mb_row, int mb_col);
-extern void vp8_rd_pick_intra_mode(MACROBLOCK *x, int *rate);
+void vp8_initialize_rd_consts(VP8_COMP *cpi, MACROBLOCK *x, int Qvalue);
+void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
+ int recon_uvoffset, int *returnrate,
+ int *returndistortion, int *returnintra, int mb_row,
+ int mb_col);
+void vp8_rd_pick_intra_mode(MACROBLOCK *x, int *rate);
static INLINE void get_plane_pointers(const YV12_BUFFER_CONFIG *fb,
unsigned char *plane[3],
@@ -110,9 +110,9 @@ static INLINE void get_reference_search_order(const VP8_COMP *cpi,
for (; i < 4; ++i) ref_frame_map[i] = -1;
}
-extern void vp8_mv_pred(VP8_COMP *cpi, MACROBLOCKD *xd, const MODE_INFO *here,
- int_mv *mvp, int refframe, int *ref_frame_sign_bias,
- int *sr, int near_sadidx[]);
+void vp8_mv_pred(VP8_COMP *cpi, MACROBLOCKD *xd, const MODE_INFO *here,
+ int_mv *mvp, int refframe, int *ref_frame_sign_bias, int *sr,
+ int near_sadidx[]);
void vp8_cal_sad(VP8_COMP *cpi, MACROBLOCKD *xd, MACROBLOCK *x,
int recon_yoffset, int near_sadidx[]);
int VP8_UVSSE(MACROBLOCK *x);
diff --git a/vp8/encoder/treewriter.h b/vp8/encoder/treewriter.h
index 0d7b06e56..c02683a58 100644
--- a/vp8/encoder/treewriter.h
+++ b/vp8/encoder/treewriter.h
@@ -91,9 +91,9 @@ static INLINE int vp8_cost_token(vp8_tree t, const vp8_prob *const p,
/* Fill array of costs for all possible token values. */
-void vp8_cost_tokens(int *Costs, const vp8_prob *, vp8_tree);
+void vp8_cost_tokens(int *c, const vp8_prob *, vp8_tree);
-void vp8_cost_tokens2(int *Costs, const vp8_prob *, vp8_tree, int);
+void vp8_cost_tokens2(int *c, const vp8_prob *, vp8_tree, int);
#ifdef __cplusplus
} // extern "C"