From: Ronald S. Bultje Date: Tue, 30 Oct 2012 21:25:33 +0000 (-0700) Subject: Adjust style to match Google Coding Style a little more closely. X-Git-Tag: v1.3.0~1217^2~141 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d115dbc24c341739ed89cf5698f81be6aee24b27;p=platform%2Fupstream%2Flibvpx.git Adjust style to match Google Coding Style a little more closely. Most of these were picked up in the previous commit (prefix change from vp8_ to vp9_), but I'm pushing this separately so that it's easier to review. Change-Id: I91e959895778b8632d7d33375523df8a7568a490 --- diff --git a/vp8/common/onyx.h b/vp8/common/onyx.h index 703de7d..c8f2b4e 100644 --- a/vp8/common/onyx.h +++ b/vp8/common/onyx.h @@ -172,7 +172,7 @@ extern "C" } VP8_CONFIG; - void vp9_initialize(); + void vp9_initialize_enc(); VP8_PTR vp9_create_compressor(VP8_CONFIG *oxcf); void vp9_remove_compressor(VP8_PTR *comp); @@ -182,18 +182,41 @@ extern "C" // receive a frames worth of data caller can assume that a copy of this frame is made // and not just a copy of the pointer.. - int vp9_receive_raw_frame(VP8_PTR comp, unsigned int frame_flags, YV12_BUFFER_CONFIG *sd, int64_t time_stamp, int64_t end_time_stamp); - int vp9_get_compressed_data(VP8_PTR comp, unsigned int *frame_flags, unsigned long *size, unsigned char *dest, int64_t *time_stamp, int64_t *time_end, int flush); - int vp9_get_preview_raw_frame(VP8_PTR comp, YV12_BUFFER_CONFIG *dest, vp8_ppflags_t *flags); + int vp9_receive_raw_frame(VP8_PTR comp, unsigned int frame_flags, + YV12_BUFFER_CONFIG *sd, int64_t time_stamp, + int64_t end_time_stamp); + + int vp9_get_compressed_data(VP8_PTR comp, unsigned int *frame_flags, + unsigned long *size, unsigned char *dest, + int64_t *time_stamp, int64_t *time_end, + int flush); + + int vp9_get_preview_raw_frame(VP8_PTR comp, YV12_BUFFER_CONFIG *dest, + vp8_ppflags_t *flags); int vp9_use_as_reference(VP8_PTR comp, int ref_frame_flags); + int vp9_update_reference(VP8_PTR comp, int ref_frame_flags); - int vp9_get_reference(VP8_PTR comp, VP8_REFFRAME ref_frame_flag, YV12_BUFFER_CONFIG *sd); - int vp9_set_reference(VP8_PTR comp, VP8_REFFRAME ref_frame_flag, YV12_BUFFER_CONFIG *sd); + + int vp9_get_reference_enc(VP8_PTR comp, VP8_REFFRAME ref_frame_flag, + YV12_BUFFER_CONFIG *sd); + + int vp9_set_reference_enc(VP8_PTR comp, VP8_REFFRAME ref_frame_flag, + YV12_BUFFER_CONFIG *sd); + int vp9_update_entropy(VP8_PTR comp, int update); - int vp9_set_roimap(VP8_PTR comp, unsigned char *map, unsigned int rows, unsigned int cols, int delta_q[4], int delta_lf[4], unsigned int threshold[4]); - int vp9_set_active_map(VP8_PTR comp, unsigned char *map, unsigned int rows, unsigned int cols); - int vp9_set_internal_size(VP8_PTR comp, VPX_SCALING horiz_mode, VPX_SCALING vert_mode); + + int vp9_set_roimap(VP8_PTR comp, unsigned char *map, + unsigned int rows, unsigned int cols, + int delta_q[4], int delta_lf[4], + unsigned int threshold[4]); + + int vp9_set_active_map(VP8_PTR comp, unsigned char *map, + unsigned int rows, unsigned int cols); + + int vp9_set_internal_size(VP8_PTR comp, + VPX_SCALING horiz_mode, VPX_SCALING vert_mode); + int vp9_get_quantizer(VP8_PTR c); #ifdef __cplusplus diff --git a/vp8/encoder/bitstream.c b/vp8/encoder/bitstream.c index 1554535..6cd8fa9 100644 --- a/vp8/encoder/bitstream.c +++ b/vp8/encoder/bitstream.c @@ -1860,7 +1860,8 @@ static void segment_reference_frames(VP8_COMP *cpi) { } } -void vp9_pack_bitstream(VP8_COMP *cpi, unsigned char *dest, unsigned long *size) { +void vp9_pack_bitstream(VP8_COMP *cpi, unsigned char *dest, + unsigned long *size) { int i, j; VP8_HEADER oh; VP8_COMMON *const pc = &cpi->common; @@ -1883,12 +1884,15 @@ void vp9_pack_bitstream(VP8_COMP *cpi, unsigned char *dest, unsigned long *size) compute_update_table(); - // vp8_kf_default_bmode_probs() is called in vp9_setup_key_frame() once for each - // K frame before encode frame. pc->kf_bmode_prob doesn't get changed anywhere - // else. No need to call it again here. --yw - // vp8_kf_default_bmode_probs( pc->kf_bmode_prob); + /* vp8_kf_default_bmode_probs() is called in vp9_setup_key_frame() once + * for each K frame before encode frame. pc->kf_bmode_prob doesn't get + * changed anywhere else. No need to call it again here. --yw + * vp8_kf_default_bmode_probs( pc->kf_bmode_prob); + */ - // every keyframe send startcode, width, height, scale factor, clamp and color type + /* every keyframe send startcode, width, height, scale factor, clamp + * and color type. + */ if (oh.type == KEY_FRAME) { int v; diff --git a/vp8/encoder/dct.c b/vp8/encoder/dct.c index 4a1d338..b56b611 100644 --- a/vp8/encoder/dct.c +++ b/vp8/encoder/dct.c @@ -503,7 +503,7 @@ void vp9_short_fdct8x8_c(short *InputData, short *OutputData, int pitch) { } } -void vp9_short_fhaar2x2_c(short *input, short *output, int pitch) { // pitch = 8 +void vp9_short_fhaar2x2_c(short *input, short *output, int pitch) { /* [1 1; 1 -1] orthogonal transform */ /* use position: 0,1, 4, 8 */ int i; @@ -517,7 +517,6 @@ void vp9_short_fhaar2x2_c(short *input, short *output, int pitch) { // pitch = 8 op1[1] = (ip1[0] - ip1[1] + ip1[4] - ip1[8]) >> 1; op1[4] = (ip1[0] + ip1[1] - ip1[4] - ip1[8]) >> 1; op1[8] = (ip1[0] - ip1[1] - ip1[4] + ip1[8]) >> 1; - } /* For test */ diff --git a/vp8/encoder/encodeframe.c b/vp8/encoder/encodeframe.c index a3a97e8..45d5ac2 100644 --- a/vp8/encoder/encodeframe.c +++ b/vp8/encoder/encodeframe.c @@ -54,31 +54,36 @@ int enc_debug = 0; int mb_row_debug, mb_col_debug; #endif -extern void vp9cx_initialize_me_consts(VP8_COMP *cpi, int QIndex); +extern void vp9_initialize_me_consts(VP8_COMP *cpi, int QIndex); + extern void vp9_auto_select_speed(VP8_COMP *cpi); -extern void vp8cx_init_mbrthread_data(VP8_COMP *cpi, - MACROBLOCK *x, - MB_ROW_COMP *mbr_ei, - int mb_row, - int count); + int64_t vp9_rd_pick_inter_mode_sb(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int recon_uvoffset, int *returnrate, int *returndistortion); -extern void vp9cx_pick_mode_inter_macroblock(VP8_COMP *cpi, MACROBLOCK *x, - int recon_yoffset, - int recon_uvoffset, int *r, int *d); + +extern void vp9_pick_mode_inter_macroblock(VP8_COMP *cpi, MACROBLOCK *x, + int recon_yoffset, + int recon_uvoffset, int *r, int *d); + void vp9_build_block_offsets(MACROBLOCK *x); + void vp9_setup_block_ptrs(MACROBLOCK *x); -void vp9cx_encode_inter_macroblock(VP8_COMP *cpi, MACROBLOCK *x, TOKENEXTRA **t, - int recon_yoffset, int recon_uvoffset, - int output_enabled); -void vp9cx_encode_inter_superblock(VP8_COMP *cpi, MACROBLOCK *x, TOKENEXTRA **t, - int recon_yoffset, int recon_uvoffset, int mb_col, int mb_row); -void vp9cx_encode_intra_macro_block(VP8_COMP *cpi, MACROBLOCK *x, - TOKENEXTRA **t, int output_enabled); -void vp9cx_encode_intra_super_block(VP8_COMP *cpi, - MACROBLOCK *x, - TOKENEXTRA **t, int mb_col); + +void vp9_encode_inter_macroblock(VP8_COMP *cpi, MACROBLOCK *x, TOKENEXTRA **t, + int recon_yoffset, int recon_uvoffset, + int output_enabled); + +void vp9_encode_inter_superblock(VP8_COMP *cpi, MACROBLOCK *x, TOKENEXTRA **t, + int recon_yoffset, int recon_uvoffset, + int mb_col, int mb_row); + +void vp9_encode_intra_macro_block(VP8_COMP *cpi, MACROBLOCK *x, + TOKENEXTRA **t, int output_enabled); + +void vp9_encode_intra_super_block(VP8_COMP *cpi, MACROBLOCK *x, + TOKENEXTRA **t, int mb_col); + static void adjust_act_zbin(VP8_COMP *cpi, MACROBLOCK *x); #ifdef MODE_STATS @@ -605,7 +610,7 @@ static void pick_mb_modes(VP8_COMP *cpi, if (mbmi->segment_id > 3) mbmi->segment_id = 0; - vp9cx_mb_init_quantizer(cpi, x); + vp9_mb_init_quantizer(cpi, x); } else // Set to Segment 0 by default mbmi->segment_id = 0; @@ -629,7 +634,7 @@ static void pick_mb_modes(VP8_COMP *cpi, *totaldist += d; // Dummy encode, do not do the tokenization - vp9cx_encode_intra_macro_block(cpi, x, tp, 0); + vp9_encode_intra_macro_block(cpi, x, tp, 0); // Note the encoder may have changed the segment_id // Save the coding context @@ -650,14 +655,14 @@ static void pick_mb_modes(VP8_COMP *cpi, cpi->seg0_progress = (((mb_col & ~1) * 2 + (mb_row & ~1) * cm->mb_cols + i) << 16) / cm->MBs; } - vp9cx_pick_mode_inter_macroblock(cpi, x, recon_yoffset, - recon_uvoffset, &r, &d); + vp9_pick_mode_inter_macroblock(cpi, x, recon_yoffset, + recon_uvoffset, &r, &d); *totalrate += r; *totaldist += d; // Dummy encode, do not do the tokenization - vp9cx_encode_inter_macroblock(cpi, x, tp, - recon_yoffset, recon_uvoffset, 0); + vp9_encode_inter_macroblock(cpi, x, tp, + recon_yoffset, recon_uvoffset, 0); seg_id = mbmi->segment_id; if (cpi->mb.e_mbd.segmentation_enabled && seg_id == 0) { @@ -797,7 +802,7 @@ static void pick_sb_modes (VP8_COMP *cpi, if (xd->mode_info_context->mbmi.segment_id > 3) xd->mode_info_context->mbmi.segment_id = 0; - vp9cx_mb_init_quantizer(cpi, x); + vp9_mb_init_quantizer(cpi, x); } else /* Set to Segment 0 by default */ @@ -972,7 +977,7 @@ static void encode_sb(VP8_COMP *cpi, // Is segmentation enabled if (xd->segmentation_enabled) { - vp9cx_mb_init_quantizer(cpi, x); + vp9_mb_init_quantizer(cpi, x); } x->active_ptr = cpi->active_map + map_index; @@ -987,10 +992,10 @@ static void encode_sb(VP8_COMP *cpi, if (cm->frame_type == KEY_FRAME) { #if CONFIG_SUPERBLOCKS if (xd->mode_info_context->mbmi.encoded_as_sb) - vp9cx_encode_intra_super_block(cpi, x, tp, mb_col); + vp9_encode_intra_super_block(cpi, x, tp, mb_col); else #endif - vp9cx_encode_intra_macro_block(cpi, x, tp, 1); + vp9_encode_intra_macro_block(cpi, x, tp, 1); // Note the encoder may have changed the segment_id #ifdef MODE_STATS @@ -1013,11 +1018,12 @@ static void encode_sb(VP8_COMP *cpi, #if CONFIG_SUPERBLOCKS if (xd->mode_info_context->mbmi.encoded_as_sb) - vp9cx_encode_inter_superblock(cpi, x, tp, recon_yoffset, recon_uvoffset, mb_col, mb_row); + vp9_encode_inter_superblock(cpi, x, tp, recon_yoffset, recon_uvoffset, + mb_col, mb_row); else #endif - vp9cx_encode_inter_macroblock(cpi, x, tp, - recon_yoffset, recon_uvoffset, 1); + vp9_encode_inter_macroblock(cpi, x, tp, + recon_yoffset, recon_uvoffset, 1); // Note the encoder may have changed the segment_id #ifdef MODE_STATS @@ -1360,10 +1366,10 @@ static void encode_frame_internal(VP8_COMP *cpi) { vp8_zero(cpi->coef_counts_16x16); vp8_zero(cpi->hybrid_coef_counts_16x16); - vp9cx_frame_init_quantizer(cpi); + vp9_frame_init_quantizer(cpi); vp9_initialize_rd_consts(cpi, cm->base_qindex + cm->y1dc_delta_q); - vp9cx_initialize_me_consts(cpi, cm->base_qindex); + vp9_initialize_me_consts(cpi, cm->base_qindex); if (cpi->oxcf.tuning == VP8_TUNE_SSIM) { // Initialize encode frame context. @@ -1846,10 +1852,10 @@ static void update_sb_skip_coeff_state(VP8_COMP *cpi, } } -void vp9cx_encode_intra_super_block(VP8_COMP *cpi, - MACROBLOCK *x, - TOKENEXTRA **t, - int mb_col) { +void vp9_encode_intra_super_block(VP8_COMP *cpi, + MACROBLOCK *x, + TOKENEXTRA **t, + int mb_col) { const int output_enabled = 1; int n; MACROBLOCKD *xd = &x->e_mbd; @@ -1926,10 +1932,10 @@ void vp9cx_encode_intra_super_block(VP8_COMP *cpi, } #endif /* CONFIG_SUPERBLOCKS */ -void vp9cx_encode_intra_macro_block(VP8_COMP *cpi, - MACROBLOCK *x, - TOKENEXTRA **t, - int output_enabled) { +void vp9_encode_intra_macro_block(VP8_COMP *cpi, + MACROBLOCK *x, + TOKENEXTRA **t, + int output_enabled) { MB_MODE_INFO * mbmi = &x->e_mbd.mode_info_context->mbmi; if ((cpi->oxcf.tuning == VP8_TUNE_SSIM) && output_enabled) { adjust_act_zbin(cpi, x); @@ -1984,9 +1990,9 @@ extern int cnt_pm; extern void vp9_fix_contexts(MACROBLOCKD *xd); -void vp9cx_encode_inter_macroblock (VP8_COMP *cpi, MACROBLOCK *x, - TOKENEXTRA **t, int recon_yoffset, - int recon_uvoffset, int output_enabled) { +void vp9_encode_inter_macroblock(VP8_COMP *cpi, MACROBLOCK *x, + TOKENEXTRA **t, int recon_yoffset, + int recon_uvoffset, int output_enabled) { VP8_COMMON *cm = &cpi->common; MACROBLOCKD *const xd = &x->e_mbd; MB_MODE_INFO * mbmi = &xd->mode_info_context->mbmi; @@ -2170,8 +2176,9 @@ void vp9cx_encode_inter_macroblock (VP8_COMP *cpi, MACROBLOCK *x, } #if CONFIG_SUPERBLOCKS -void vp9cx_encode_inter_superblock(VP8_COMP *cpi, MACROBLOCK *x, TOKENEXTRA **t, - int recon_yoffset, int recon_uvoffset, int mb_col, int mb_row) { +void vp9_encode_inter_superblock(VP8_COMP *cpi, MACROBLOCK *x, TOKENEXTRA **t, + int recon_yoffset, int recon_uvoffset, + int mb_col, int mb_row) { const int output_enabled = 1; VP8_COMMON *cm = &cpi->common; MACROBLOCKD *xd = &x->e_mbd; diff --git a/vp8/encoder/encodeintra.c b/vp8/encoder/encodeintra.c index 597d218..1757f24 100644 --- a/vp8/encoder/encodeintra.c +++ b/vp8/encoder/encodeintra.c @@ -77,7 +77,7 @@ void vp9_encode_intra4x4block(const VP8_ENCODER_RTCD *rtcd, vp9_ht_quantize_b_4x4(be, b, tx_type); vp8_ihtllm_c(b->dqcoeff, b->diff, 32, tx_type, 4); } else { - x->vp9_short_fdct4x4(be->src_diff, be->coeff, 32) ; + x->vp9_short_fdct4x4(be->src_diff, be->coeff, 32); x->quantize_b_4x4(be, b) ; vp8_inverse_transform_b_4x4(IF_RTCD(&rtcd->common->idct), b, 32) ; } diff --git a/vp8/encoder/firstpass.c b/vp8/encoder/firstpass.c index f29e663..49c1819 100644 --- a/vp8/encoder/firstpass.c +++ b/vp8/encoder/firstpass.c @@ -40,9 +40,14 @@ #endif extern void vp9_build_block_offsets(MACROBLOCK *x); + extern void vp9_setup_block_ptrs(MACROBLOCK *x); -extern void vp9cx_frame_init_quantizer(VP8_COMP *cpi); -extern void vp9_set_mbmode_and_mvs(MACROBLOCK *x, MB_PREDICTION_MODE mb, int_mv *mv); + +extern void vp9_frame_init_quantizer(VP8_COMP *cpi); + +extern void vp9_set_mbmode_and_mvs(MACROBLOCK *x, MB_PREDICTION_MODE mb, + int_mv *mv); + extern void vp9_alloc_compressor_data(VP8_COMP *cpi); #define IIFACTOR 12.5 @@ -485,7 +490,7 @@ void vp9_first_pass(VP8_COMP *cpi) { // set up frame new frame for intra coded blocks vp8_setup_intra_recon(new_yv12); - vp9cx_frame_init_quantizer(cpi); + vp9_frame_init_quantizer(cpi); // Initialise the MV cost table to the defaults // if( cm->current_video_frame == 0) @@ -1138,11 +1143,15 @@ void vp9_init_second_pass(VP8_COMP *cpi) { // encoded in the second pass is a guess. However the sum duration is not. // Its calculated based on the actual durations of all frames from the first // pass. - vp9_new_frame_rate(cpi, 10000000.0 * cpi->twopass.total_stats->count / cpi->twopass.total_stats->duration); + vp9_new_frame_rate(cpi, + 10000000.0 * cpi->twopass.total_stats->count / + cpi->twopass.total_stats->duration); cpi->output_frame_rate = cpi->oxcf.frame_rate; - cpi->twopass.bits_left = (int64_t)(cpi->twopass.total_stats->duration * cpi->oxcf.target_bandwidth / 10000000.0); - cpi->twopass.bits_left -= (int64_t)(cpi->twopass.total_stats->duration * two_pass_min_rate / 10000000.0); + cpi->twopass.bits_left = (int64_t)(cpi->twopass.total_stats->duration * + cpi->oxcf.target_bandwidth / 10000000.0); + cpi->twopass.bits_left -= (int64_t)(cpi->twopass.total_stats->duration * + two_pass_min_rate / 10000000.0); // Calculate a minimum intra value to be used in determining the IIratio // scores used in the second pass. We have this minimum to make sure diff --git a/vp8/encoder/generic/csystemdependent.c b/vp8/encoder/generic/csystemdependent.c index 3b8d71d..8cb992b 100644 --- a/vp8/encoder/generic/csystemdependent.c +++ b/vp8/encoder/generic/csystemdependent.c @@ -17,8 +17,12 @@ void vp9_arch_x86_encoder_init(VP8_COMP *cpi); void vp8_arch_arm_encoder_init(VP8_COMP *cpi); -void (*vp9_yv12_copy_partial_frame_ptr)(YV12_BUFFER_CONFIG *src_ybc, YV12_BUFFER_CONFIG *dst_ybc, int Fraction); -extern void vp9_yv12_copy_partial_frame(YV12_BUFFER_CONFIG *src_ybc, YV12_BUFFER_CONFIG *dst_ybc, int Fraction); +void (*vp9_yv12_copy_partial_frame_ptr)(YV12_BUFFER_CONFIG *src_ybc, + YV12_BUFFER_CONFIG *dst_ybc, + int fraction); +extern void vp9_yv12_copy_partial_frame(YV12_BUFFER_CONFIG *src_ybc, + YV12_BUFFER_CONFIG *dst_ybc, + int fraction); void vp9_cmachine_specific_config(VP8_COMP *cpi) { #if CONFIG_RUNTIME_CPU_DETECT diff --git a/vp8/encoder/modecosts.c b/vp8/encoder/modecosts.c index f944261..5111a81 100644 --- a/vp8/encoder/modecosts.c +++ b/vp8/encoder/modecosts.c @@ -17,21 +17,17 @@ void vp9_init_mode_costs(VP8_COMP *c) { VP8_COMMON *x = &c->common; - { - const vp8_tree_p T = vp8_bmode_tree; - - int i = 0; - - do { - int j = 0; - - do { - vp9_cost_tokens((int *)c->mb.bmode_costs[i][j], x->kf_bmode_prob[i][j], T); - } while (++j < VP8_BINTRAMODES); - } while (++i < VP8_BINTRAMODES); - - vp9_cost_tokens((int *)c->mb.inter_bmode_costs, x->fc.bmode_prob, T); + const vp8_tree_p T = vp8_bmode_tree; + int i, j; + + for (i = 0; i < VP8_BINTRAMODES; i++) { + for (j = 0; j < VP8_BINTRAMODES; j++) { + vp9_cost_tokens((int *)c->mb.bmode_costs[i][j], + x->kf_bmode_prob[i][j], T); + } } + + vp9_cost_tokens((int *)c->mb.inter_bmode_costs, x->fc.bmode_prob, T); vp9_cost_tokens((int *)c->mb.inter_bmode_costs, x->fc.sub_mv_ref_prob[0], vp8_sub_mv_ref_tree); @@ -46,11 +42,8 @@ void vp9_init_mode_costs(VP8_COMP *c) { vp9_cost_tokens(c->mb.i8x8_mode_costs, x->fc.i8x8_mode_prob, vp8_i8x8_mode_tree); - { - int i; - for (i = 0; i <= VP8_SWITCHABLE_FILTERS; ++i) - vp9_cost_tokens((int *)c->mb.switchable_interp_costs[i], - x->fc.switchable_interp_prob[i], - vp8_switchable_interp_tree); - } + for (i = 0; i <= VP8_SWITCHABLE_FILTERS; ++i) + vp9_cost_tokens((int *)c->mb.switchable_interp_costs[i], + x->fc.switchable_interp_prob[i], + vp8_switchable_interp_tree); } diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c index 4667b06..92ba0c8 100644 --- a/vp8/encoder/onyx_if.c +++ b/vp8/encoder/onyx_if.c @@ -60,20 +60,34 @@ #define RTCD(x) NULL #endif -extern void vp9cx_pick_filter_level_fast(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi); -extern void vp9cx_set_alt_lf_level(VP8_COMP *cpi, int filt_val); -extern void vp9cx_pick_filter_level(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi); +extern void vp9_pick_filter_level_fast(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi); + +extern void vp9_set_alt_lf_level(VP8_COMP *cpi, int filt_val); + +extern void vp9_pick_filter_level(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi); extern void vp9_cmachine_specific_config(VP8_COMP *cpi); -extern void vp8_deblock_frame(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *post, int filt_lvl, int low_var_thresh, int flag); + +extern void vp8_deblock_frame(YV12_BUFFER_CONFIG *source, + YV12_BUFFER_CONFIG *post, + int filt_lvl, int low_var_thresh, int flag); + extern void print_parms(VP8_CONFIG *ocf, char *filenam); + extern unsigned int vp8_get_processor_freq(); + extern void print_tree_update_probs(); + extern void vp8cx_create_encoder_threads(VP8_COMP *cpi); + extern void vp8cx_remove_encoder_threads(VP8_COMP *cpi); + #if HAVE_ARMV7 -extern void vp8_yv12_copy_frame_func_neon(YV12_BUFFER_CONFIG *src_ybc, YV12_BUFFER_CONFIG *dst_ybc); -extern void vp8_yv12_copy_src_frame_func_neon(YV12_BUFFER_CONFIG *src_ybc, YV12_BUFFER_CONFIG *dst_ybc); +extern void vp8_yv12_copy_frame_func_neon(YV12_BUFFER_CONFIG *src_ybc, + YV12_BUFFER_CONFIG *dst_ybc); + +extern void vp8_yv12_copy_src_frame_func_neon(YV12_BUFFER_CONFIG *src_ybc, + YV12_BUFFER_CONFIG *dst_ybc); #endif int vp9_calc_ss_err(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *dest); @@ -166,7 +180,7 @@ extern unsigned int inter_uv_modes[VP8_UV_MODES]; extern unsigned int inter_b_modes[B_MODE_COUNT]; #endif -extern void vp9cx_init_quantizer(VP8_COMP *cpi); +extern void vp9_init_quantizer(VP8_COMP *cpi); int vp8cx_base_skip_false_prob[QINDEX_RANGE][3]; @@ -306,7 +320,7 @@ static void update_base_skip_probs(VP8_COMP *cpi) { } -void vp9_initialize() { +void vp9_initialize_enc() { static int init_done = 0; if (!init_done) { @@ -1172,9 +1186,11 @@ void vp9_set_speed_features(VP8_COMP *cpi) { } if (cpi->sf.search_method == NSTEP) { - vp9_init3smotion_compensation(&cpi->mb, cm->yv12_fb[cm->lst_fb_idx].y_stride); + vp9_init3smotion_compensation(&cpi->mb, + cm->yv12_fb[cm->lst_fb_idx].y_stride); } else if (cpi->sf.search_method == DIAMOND) { - vp9_init_dsmotion_compensation(&cpi->mb, cm->yv12_fb[cm->lst_fb_idx].y_stride); + vp9_init_dsmotion_compensation(&cpi->mb, + cm->yv12_fb[cm->lst_fb_idx].y_stride); } cpi->mb.vp9_short_fdct16x16 = vp9_short_fdct16x16; @@ -1202,7 +1218,7 @@ void vp9_set_speed_features(VP8_COMP *cpi) { cpi->mb.quantize_b_16x16 = vp9_regular_quantize_b_16x16; cpi->mb.quantize_b_2x2 = vp9_regular_quantize_b_2x2; - vp9cx_init_quantizer(cpi); + vp9_init_quantizer(cpi); #if CONFIG_RUNTIME_CPU_DETECT cpi->mb.e_mbd.rtcd = &cpi->common.rtcd; @@ -1997,9 +2013,12 @@ VP8_PTR vp9_create_compressor(VP8_CONFIG *oxcf) { // make sure frame 1 is okay cpi->error_bins[0] = cpi->common.MBs; - // vp9cx_init_quantizer() is first called here. Add check in vp9cx_frame_init_quantizer() so that vp9cx_init_quantizer is only called later - // when needed. This will avoid unnecessary calls of vp9cx_init_quantizer() for every frame. - vp9cx_init_quantizer(cpi); + /* vp9_init_quantizer() is first called here. Add check in + * vp9_frame_init_quantizer() so that vp9_init_quantizer is only + * called later when needed. This will avoid unnecessary calls of + * vp9_init_quantizer() for every frame. + */ + vp9_init_quantizer(cpi); vp8_loop_filter_init(cm); @@ -2386,7 +2405,8 @@ int vp9_update_reference(VP8_PTR ptr, int ref_frame_flags) { return 0; } -int vp9_get_reference(VP8_PTR ptr, VP8_REFFRAME ref_frame_flag, YV12_BUFFER_CONFIG *sd) { +int vp9_get_reference_enc(VP8_PTR ptr, VP8_REFFRAME ref_frame_flag, + YV12_BUFFER_CONFIG *sd) { VP8_COMP *cpi = (VP8_COMP *)(ptr); VP8_COMMON *cm = &cpi->common; int ref_fb_idx; @@ -2404,7 +2424,9 @@ int vp9_get_reference(VP8_PTR ptr, VP8_REFFRAME ref_frame_flag, YV12_BUFFER_CONF return 0; } -int vp9_set_reference(VP8_PTR ptr, VP8_REFFRAME ref_frame_flag, YV12_BUFFER_CONFIG *sd) { + +int vp9_set_reference_enc(VP8_PTR ptr, VP8_REFFRAME ref_frame_flag, + YV12_BUFFER_CONFIG *sd) { VP8_COMP *cpi = (VP8_COMP *)(ptr); VP8_COMMON *cm = &cpi->common; @@ -2786,17 +2808,16 @@ static void loopfilter_frame(VP8_COMP *cpi, VP8_COMMON *cm) { vpx_usec_timer_start(&timer); if (cpi->sf.auto_filter == 0) - vp9cx_pick_filter_level_fast(cpi->Source, cpi); - + vp9_pick_filter_level_fast(cpi->Source, cpi); else - vp9cx_pick_filter_level(cpi->Source, cpi); + vp9_pick_filter_level(cpi->Source, cpi); vpx_usec_timer_mark(&timer); cpi->time_pick_lpf += vpx_usec_timer_elapsed(&timer); } if (cm->filter_level > 0) { - vp9cx_set_alt_lf_level(cpi, cm->filter_level); + vp9_set_alt_lf_level(cpi, cm->filter_level); vp8_loop_filter_frame(cm, &cpi->mb.e_mbd); } @@ -3110,7 +3131,8 @@ static void encode_frame_to_data_rate else zbin_oq_high = ZBIN_OQ_MAX; - vp9_compute_frame_size_bounds(cpi, &frame_under_shoot_limit, &frame_over_shoot_limit); + vp9_compute_frame_size_bounds(cpi, &frame_under_shoot_limit, + &frame_over_shoot_limit); // Limit Q range for the adaptive loop. bottom_index = cpi->active_best_quality; @@ -3926,7 +3948,8 @@ static void encode_frame_to_data_rate } } -static void Pass2Encode(VP8_COMP *cpi, unsigned long *size, unsigned char *dest, unsigned int *frame_flags) { +static void Pass2Encode(VP8_COMP *cpi, unsigned long *size, + unsigned char *dest, unsigned int *frame_flags) { if (!cpi->common.refresh_alt_ref_frame) vp9_second_pass(cpi); @@ -3953,7 +3976,9 @@ extern void vp8_pop_neon(int64_t *store); #endif -int vp9_receive_raw_frame(VP8_PTR ptr, unsigned int frame_flags, YV12_BUFFER_CONFIG *sd, int64_t time_stamp, int64_t end_time) { +int vp9_receive_raw_frame(VP8_PTR ptr, unsigned int frame_flags, + YV12_BUFFER_CONFIG *sd, int64_t time_stamp, + int64_t end_time) { #if HAVE_ARMV7 int64_t store_reg[8]; #endif @@ -3972,8 +3997,8 @@ int vp9_receive_raw_frame(VP8_PTR ptr, unsigned int frame_flags, YV12_BUFFER_CON #endif vpx_usec_timer_start(&timer); - if (vp9_lookahead_push(cpi->lookahead, sd, time_stamp, end_time, - frame_flags, cpi->active_map_enabled ? cpi->active_map : NULL)) + if (vp9_lookahead_push(cpi->lookahead, sd, time_stamp, end_time, frame_flags, + cpi->active_map_enabled ? cpi->active_map : NULL)) res = -1; cm->clr_type = sd->clrtype; vpx_usec_timer_mark(&timer); @@ -4005,7 +4030,9 @@ static int frame_is_reference(const VP8_COMP *cpi) { } -int vp9_get_compressed_data(VP8_PTR ptr, unsigned int *frame_flags, unsigned long *size, unsigned char *dest, int64_t *time_stamp, int64_t *time_end, int flush) { +int vp9_get_compressed_data(VP8_PTR ptr, unsigned int *frame_flags, + unsigned long *size, unsigned char *dest, + int64_t *time_stamp, int64_t *time_end, int flush) { #if HAVE_ARMV7 int64_t store_reg[8]; #endif @@ -4321,7 +4348,8 @@ int vp9_get_compressed_data(VP8_PTR ptr, unsigned int *frame_flags, unsigned lon return 0; } -int vp9_get_preview_raw_frame(VP8_PTR comp, YV12_BUFFER_CONFIG *dest, vp8_ppflags_t *flags) { +int vp9_get_preview_raw_frame(VP8_PTR comp, YV12_BUFFER_CONFIG *dest, + vp8_ppflags_t *flags) { VP8_COMP *cpi = (VP8_COMP *) comp; if (cpi->common.refresh_alt_ref_frame) @@ -4348,7 +4376,9 @@ int vp9_get_preview_raw_frame(VP8_PTR comp, YV12_BUFFER_CONFIG *dest, vp8_ppflag } } -int vp9_set_roimap(VP8_PTR comp, unsigned char *map, unsigned int rows, unsigned int cols, int delta_q[4], int delta_lf[4], unsigned int threshold[4]) { +int vp9_set_roimap(VP8_PTR comp, unsigned char *map, unsigned int rows, + unsigned int cols, int delta_q[4], int delta_lf[4], + unsigned int threshold[4]) { VP8_COMP *cpi = (VP8_COMP *) comp; signed char feature_data[SEG_LVL_MAX][MAX_MB_SEGMENTS]; MACROBLOCKD *xd = &cpi->mb.e_mbd; @@ -4405,7 +4435,8 @@ int vp9_set_roimap(VP8_PTR comp, unsigned char *map, unsigned int rows, unsigned return 0; } -int vp9_set_active_map(VP8_PTR comp, unsigned char *map, unsigned int rows, unsigned int cols) { +int vp9_set_active_map(VP8_PTR comp, unsigned char *map, + unsigned int rows, unsigned int cols) { VP8_COMP *cpi = (VP8_COMP *) comp; if (rows == cpi->common.mb_rows && cols == cpi->common.mb_cols) { @@ -4422,7 +4453,8 @@ int vp9_set_active_map(VP8_PTR comp, unsigned char *map, unsigned int rows, unsi } } -int vp9_set_internal_size(VP8_PTR comp, VPX_SCALING horiz_mode, VPX_SCALING vert_mode) { +int vp9_set_internal_size(VP8_PTR comp, + VPX_SCALING horiz_mode, VPX_SCALING vert_mode) { VP8_COMP *cpi = (VP8_COMP *) comp; if (horiz_mode <= ONETWO) diff --git a/vp8/encoder/onyx_int.h b/vp8/encoder/onyx_int.h index c95600c..f768ec5 100644 --- a/vp8/encoder/onyx_int.h +++ b/vp8/encoder/onyx_int.h @@ -757,16 +757,13 @@ typedef struct VP8_COMP { } VP8_COMP; -void control_data_rate(VP8_COMP *cpi); - void vp9_encode_frame(VP8_COMP *cpi); -void vp9_pack_bitstream(VP8_COMP *cpi, unsigned char *dest, unsigned long *size); +void vp9_pack_bitstream(VP8_COMP *cpi, unsigned char *dest, + unsigned long *size); void vp9_activity_masking(VP8_COMP *cpi, MACROBLOCK *x); -int rd_cost_intra_mb(MACROBLOCKD *x); - void vp9_tokenize_mb(VP8_COMP *, MACROBLOCKD *, TOKENEXTRA **, int dry_run); void vp9_stuff_mb(VP8_COMP *cpi, MACROBLOCKD *xd, TOKENEXTRA **t, int dry_run); diff --git a/vp8/encoder/picklpf.c b/vp8/encoder/picklpf.c index f8fd6e7..f938f1e 100644 --- a/vp8/encoder/picklpf.c +++ b/vp8/encoder/picklpf.c @@ -33,21 +33,12 @@ extern void vp8_yv12_copy_frame_yonly_no_extend_frame_borders_neon(YV12_BUFFER_C #define IF_RTCD(x) NULL #endif -extern void -(*vp9_yv12_copy_partial_frame_ptr)(YV12_BUFFER_CONFIG *src_ybc, - YV12_BUFFER_CONFIG *dst_ybc, - int Fraction); - -extern void vp8_loop_filter_frame_segment -( - VP8_COMMON *cm, - MACROBLOCKD *xd, - int default_filt_lvl, - int segment -); - -void -vp9_yv12_copy_partial_frame(YV12_BUFFER_CONFIG *src_ybc, YV12_BUFFER_CONFIG *dst_ybc, int Fraction) { +extern void(*vp9_yv12_copy_partial_frame_ptr)(YV12_BUFFER_CONFIG *src_ybc, + YV12_BUFFER_CONFIG *dst_ybc, + int fraction); + +void vp9_yv12_copy_partial_frame(YV12_BUFFER_CONFIG *src_ybc, + YV12_BUFFER_CONFIG *dst_ybc, int Fraction) { unsigned char *src_y, *dst_y; int yheight; int ystride; @@ -72,6 +63,7 @@ vp9_yv12_copy_partial_frame(YV12_BUFFER_CONFIG *src_ybc, YV12_BUFFER_CONFIG *dst vpx_memcpy(dst_y, src_y, ystride * (linestocopy + 16)); } + static int vp8_calc_partial_ssl_err(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *dest, int Fraction) { int i, j; @@ -146,7 +138,7 @@ static int get_max_filter_level(VP8_COMP *cpi, int base_qindex) { return max_filter_level; } -void vp9cx_pick_filter_level_fast(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi) { +void vp9_pick_filter_level_fast(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi) { VP8_COMMON *cm = &cpi->common; int best_err = 0; @@ -226,7 +218,8 @@ void vp9cx_pick_filter_level_fast(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi) { filt_err = vp8_calc_partial_ssl_err(sd, cm->frame_to_show, 3); // Re-instate the unfiltered frame - vp9_yv12_copy_partial_frame_ptr(&cpi->last_frame_uf, cm->frame_to_show, 3); + vp9_yv12_copy_partial_frame_ptr(&cpi->last_frame_uf, + cm->frame_to_show, 3); // Update the best case record or exit loop. if (filt_err < best_err) { @@ -252,10 +245,10 @@ void vp9cx_pick_filter_level_fast(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi) { } // Stub function for now Alt LF not used -void vp9cx_set_alt_lf_level(VP8_COMP *cpi, int filt_val) { +void vp9_set_alt_lf_level(VP8_COMP *cpi, int filt_val) { } -void vp9cx_pick_filter_level(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi) { +void vp9_pick_filter_level(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi) { VP8_COMMON *cm = &cpi->common; int best_err = 0; @@ -307,7 +300,7 @@ void vp9cx_pick_filter_level(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi) { filter_step = (filt_mid < 16) ? 4 : filt_mid / 4; // Get baseline error score - vp9cx_set_alt_lf_level(cpi, filt_mid); + vp9_set_alt_lf_level(cpi, filt_mid); vp8_loop_filter_frame_yonly(cm, &cpi->mb.e_mbd, filt_mid); best_err = vp9_calc_ss_err(sd, cm->frame_to_show); @@ -347,7 +340,7 @@ void vp9cx_pick_filter_level(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi) { if ((filt_direction <= 0) && (filt_low != filt_mid)) { // Get Low filter error score - vp9cx_set_alt_lf_level(cpi, filt_low); + vp9_set_alt_lf_level(cpi, filt_low); vp8_loop_filter_frame_yonly(cm, &cpi->mb.e_mbd, filt_low); filt_err = vp9_calc_ss_err(sd, cm->frame_to_show); @@ -382,7 +375,7 @@ void vp9cx_pick_filter_level(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi) { // Now look at filt_high if ((filt_direction >= 0) && (filt_high != filt_mid)) { - vp9cx_set_alt_lf_level(cpi, filt_high); + vp9_set_alt_lf_level(cpi, filt_high); vp8_loop_filter_frame_yonly(cm, &cpi->mb.e_mbd, filt_high); filt_err = vp9_calc_ss_err(sd, cm->frame_to_show); diff --git a/vp8/encoder/quantize.c b/vp8/encoder/quantize.c index c06557f..d0a0ea4 100644 --- a/vp8/encoder/quantize.c +++ b/vp8/encoder/quantize.c @@ -349,7 +349,8 @@ void vp9_regular_quantize_b_16x16(BLOCK *b, BLOCKD *d) { * these two C functions if corresponding optimized routine is not available. * NEON optimized version implements currently the fast quantization for pair * of blocks. */ -void vp9_regular_quantize_b_4x4_pair(BLOCK *b1, BLOCK *b2, BLOCKD *d1, BLOCKD *d2) { +void vp9_regular_quantize_b_4x4_pair(BLOCK *b1, BLOCK *b2, + BLOCKD *d1, BLOCKD *d2) { vp9_regular_quantize_b_4x4(b1, d1); vp9_regular_quantize_b_4x4(b2, d2); } @@ -366,7 +367,7 @@ static void invert_quant(short *quant, *shift = l; } -void vp9cx_init_quantizer(VP8_COMP *cpi) { +void vp9_init_quantizer(VP8_COMP *cpi) { int i; int quant_val; int Q; @@ -530,7 +531,7 @@ void vp9cx_init_quantizer(VP8_COMP *cpi) { } } -void vp9cx_mb_init_quantizer(VP8_COMP *cpi, MACROBLOCK *x) { +void vp9_mb_init_quantizer(VP8_COMP *cpi, MACROBLOCK *x) { int i; int QIndex; MACROBLOCKD *xd = &x->e_mbd; @@ -687,12 +688,12 @@ void vp9_update_zbin_extra(VP8_COMP *cpi, MACROBLOCK *x) { x->block[24].zbin_extra = (short)zbin_extra; } -void vp9cx_frame_init_quantizer(VP8_COMP *cpi) { +void vp9_frame_init_quantizer(VP8_COMP *cpi) { // Clear Zbin mode boost for default case cpi->zbin_mode_boost = 0; // MB level quantizer setup - vp9cx_mb_init_quantizer(cpi, &cpi->mb); + vp9_mb_init_quantizer(cpi, &cpi->mb); } void vp9_set_quantizer(struct VP8_COMP *cpi, int Q) { @@ -711,5 +712,5 @@ void vp9_set_quantizer(struct VP8_COMP *cpi, int Q) { // quantizer has to be reinitialized if any delta_q changes. // As there are not any here for now this is inactive code. // if(update) - // vp9cx_init_quantizer(cpi); + // vp9_init_quantizer(cpi); } diff --git a/vp8/encoder/quantize.h b/vp8/encoder/quantize.h index 8fe27b8..51a7d91 100644 --- a/vp8/encoder/quantize.h +++ b/vp8/encoder/quantize.h @@ -83,10 +83,15 @@ extern prototype_quantize_block(vp8_quantize_quantb_16x16); extern prototype_quantize_mb(vp9_quantize_mby_16x16); struct VP8_COMP; + extern void vp9_set_quantizer(struct VP8_COMP *cpi, int Q); -extern void vp9cx_frame_init_quantizer(struct VP8_COMP *cpi); + +extern void vp9_frame_init_quantizer(struct VP8_COMP *cpi); + extern void vp9_update_zbin_extra(struct VP8_COMP *cpi, MACROBLOCK *x); -extern void vp9cx_mb_init_quantizer(struct VP8_COMP *cpi, MACROBLOCK *x); -extern void vp9cx_init_quantizer(struct VP8_COMP *cpi); + +extern void vp9_mb_init_quantizer(struct VP8_COMP *cpi, MACROBLOCK *x); + +extern void vp9_init_quantizer(struct VP8_COMP *cpi); #endif diff --git a/vp8/encoder/ratectrl.c b/vp8/encoder/ratectrl.c index eea2a90..5cd4896 100644 --- a/vp8/encoder/ratectrl.c +++ b/vp8/encoder/ratectrl.c @@ -650,7 +650,8 @@ void vp9_adjust_key_frame_context(VP8_COMP *cpi) { } -void vp9_compute_frame_size_bounds(VP8_COMP *cpi, int *frame_under_shoot_limit, int *frame_over_shoot_limit) { +void vp9_compute_frame_size_bounds(VP8_COMP *cpi, int *frame_under_shoot_limit, + int *frame_over_shoot_limit) { // Set-up bounds on acceptable frame size: if (cpi->oxcf.fixed_q >= 0) { // Fixed Q scenario: frame size never outranges target (there is no target!) diff --git a/vp8/encoder/ratectrl.h b/vp8/encoder/ratectrl.h index bd49813..8add1da 100644 --- a/vp8/encoder/ratectrl.h +++ b/vp8/encoder/ratectrl.h @@ -22,7 +22,9 @@ extern void vp9_setup_key_frame(VP8_COMP *cpi); extern void vp9_update_rate_correction_factors(VP8_COMP *cpi, int damp_var); extern int vp9_regulate_q(VP8_COMP *cpi, int target_bits_per_frame); extern void vp9_adjust_key_frame_context(VP8_COMP *cpi); -extern void vp9_compute_frame_size_bounds(VP8_COMP *cpi, int *frame_under_shoot_limit, int *frame_over_shoot_limit); +extern void vp9_compute_frame_size_bounds(VP8_COMP *cpi, + int *frame_under_shoot_limit, + int *frame_over_shoot_limit); // return of 0 means drop frame extern int vp9_pick_frame_size(VP8_COMP *cpi); diff --git a/vp8/encoder/rdopt.c b/vp8/encoder/rdopt.c index 8c9bc63..18e596e 100644 --- a/vp8/encoder/rdopt.c +++ b/vp8/encoder/rdopt.c @@ -52,7 +52,7 @@ #define IF_RTCD(x) NULL #endif -extern void vp9cx_mb_init_quantizer(VP8_COMP *cpi, MACROBLOCK *x); +extern void vp9_mb_init_quantizer(VP8_COMP *cpi, MACROBLOCK *x); extern void vp9_update_zbin_extra(VP8_COMP *cpi, MACROBLOCK *x); #define MAXF(a,b) (((a) > (b)) ? (a) : (b)) @@ -217,8 +217,8 @@ const MODE_DEFINITION vp8_mode_order[MAX_MODES] = { #endif static void fill_token_costs( - unsigned int (*c)[COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS], - const vp8_prob(*p)[COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES], + unsigned int (*c)[COEF_BANDS][PREV_COEF_CONTEXTS][MAX_ENTROPY_TOKENS], + const vp8_prob(*p)[COEF_BANDS][PREV_COEF_CONTEXTS][ENTROPY_NODES], int block_type_counts) { int i, j, k; @@ -226,22 +226,21 @@ static void fill_token_costs( for (j = 0; j < COEF_BANDS; j++) for (k = 0; k < PREV_COEF_CONTEXTS; k++) { if (k == 0 && ((j > 0 && i > 0) || (j > 1 && i == 0))) - vp9_cost_tokens_skip((int *)(c [i][j][k]), - p [i][j][k], + vp9_cost_tokens_skip((int *)(c[i][j][k]), + p[i][j][k], vp8_coef_tree); else - vp9_cost_tokens((int *)(c [i][j][k]), - p [i][j][k], + vp9_cost_tokens((int *)(c[i][j][k]), + p[i][j][k], vp8_coef_tree); } } -static int rd_iifactor [ 32 ] = { 4, 4, 3, 2, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - }; +static int rd_iifactor[32] = { 4, 4, 3, 2, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, }; // 3* dc_qlookup[Q]*dc_qlookup[Q]; @@ -269,7 +268,7 @@ static int compute_rd_mult(int qindex) { return (11 * q * q) >> 6; } -void vp9cx_initialize_me_consts(VP8_COMP *cpi, int QIndex) { +void vp9_initialize_me_consts(VP8_COMP *cpi, int QIndex) { cpi->mb.sadperbit16 = sad_per_bit16lut[QIndex]; cpi->mb.sadperbit4 = sad_per_bit4lut[QIndex]; } @@ -3530,8 +3529,10 @@ static int64_t handle_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, return this_rd; // if 0, this will be re-calculated by caller } -void vp9_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int recon_uvoffset, - int *returnrate, int *returndistortion, int64_t *returnintra) { +void vp9_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, + int recon_yoffset, int recon_uvoffset, + int *returnrate, int *returndistortion, + int64_t *returnintra) { VP8_COMMON *cm = &cpi->common; MACROBLOCKD *xd = &x->e_mbd; union b_mode_info best_bmodes[16]; @@ -4815,10 +4816,10 @@ int64_t vp9_rd_pick_inter_mode_sb(VP8_COMP *cpi, MACROBLOCK *x, } #endif -void vp9cx_pick_mode_inter_macroblock(VP8_COMP *cpi, MACROBLOCK *x, - int recon_yoffset, - int recon_uvoffset, - int *totalrate, int *totaldist) { +void vp9_pick_mode_inter_macroblock(VP8_COMP *cpi, MACROBLOCK *x, + int recon_yoffset, + int recon_uvoffset, + int *totalrate, int *totaldist) { MACROBLOCKD *const xd = &x->e_mbd; MB_MODE_INFO * mbmi = &x->e_mbd.mode_info_context->mbmi; int rate, distortion; diff --git a/vp8/encoder/rdopt.h b/vp8/encoder/rdopt.h index 67fd661..95413e4 100644 --- a/vp8/encoder/rdopt.h +++ b/vp8/encoder/rdopt.h @@ -16,22 +16,26 @@ #define RDCOST_8x8(RM,DM,R,D) ( ((128+((int64_t)R)*(RM)) >> 8) + ((int64_t)DM)*(D) ) extern void vp9_initialize_rd_consts(VP8_COMP *cpi, int Qvalue); -extern void vp9_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int recon_uvoffset, - int *returnrate, int *returndistortion, int64_t *returnintra); -extern void vp9_rd_pick_intra_mode(VP8_COMP *cpi, MACROBLOCK *x, int *r, int *d); -extern void vp9_rd_pick_intra_mode_sb(VP8_COMP *cpi, MACROBLOCK *x, int *r, int *d); - -extern void vp9_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[] -); + +extern void vp9_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, + int recon_yoffset, int recon_uvoffset, + int *returnrate, int *returndistortion, + int64_t *returnintra); + +extern void vp9_rd_pick_intra_mode(VP8_COMP *cpi, MACROBLOCK *x, + int *r, int *d); + +extern void vp9_rd_pick_intra_mode_sb(VP8_COMP *cpi, MACROBLOCK *x, + int *r, int *d); + +extern void vp9_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[]); + extern void vp9_init_me_luts(); -extern void vp9_set_mbmode_and_mvs(MACROBLOCK *x, MB_PREDICTION_MODE mb, int_mv *mv); + +extern void vp9_set_mbmode_and_mvs(MACROBLOCK *x, + MB_PREDICTION_MODE mb, int_mv *mv); + #endif diff --git a/vp8/encoder/sad_c.c b/vp8/encoder/sad_c.c index fdada23..3325141 100644 --- a/vp8/encoder/sad_c.c +++ b/vp8/encoder/sad_c.c @@ -30,47 +30,37 @@ unsigned int vp9_sad16x16_c(const unsigned char *src_ptr, return sad_mx_n_c(src_ptr, src_stride, ref_ptr, ref_stride, 16, 16); } -unsigned int vp9_sad8x8_c( - const unsigned char *src_ptr, - int src_stride, - const unsigned char *ref_ptr, - int ref_stride, - int max_sad) { - +unsigned int vp9_sad8x8_c(const unsigned char *src_ptr, + int src_stride, + const unsigned char *ref_ptr, + int ref_stride, + int max_sad) { return sad_mx_n_c(src_ptr, src_stride, ref_ptr, ref_stride, 8, 8); } -unsigned int vp9_sad16x8_c( - const unsigned char *src_ptr, - int src_stride, - const unsigned char *ref_ptr, - int ref_stride, - int max_sad) { - +unsigned int vp9_sad16x8_c(const unsigned char *src_ptr, + int src_stride, + const unsigned char *ref_ptr, + int ref_stride, + int max_sad) { return sad_mx_n_c(src_ptr, src_stride, ref_ptr, ref_stride, 16, 8); - } - -unsigned int vp9_sad8x16_c( - const unsigned char *src_ptr, - int src_stride, - const unsigned char *ref_ptr, - int ref_stride, - int max_sad) { - +unsigned int vp9_sad8x16_c(const unsigned char *src_ptr, + int src_stride, + const unsigned char *ref_ptr, + int ref_stride, + int max_sad) { return sad_mx_n_c(src_ptr, src_stride, ref_ptr, ref_stride, 8, 16); } -unsigned int vp9_sad4x4_c( - const unsigned char *src_ptr, - int src_stride, - const unsigned char *ref_ptr, - int ref_stride, - int max_sad) { - +unsigned int vp9_sad4x4_c(const unsigned char *src_ptr, + int src_stride, + const unsigned char *ref_ptr, + int ref_stride, + int max_sad) { return sad_mx_n_c(src_ptr, src_stride, ref_ptr, ref_stride, 4, 4); } @@ -80,9 +70,12 @@ void vp9_sad32x32x3_c(const unsigned char *src_ptr, int ref_stride, unsigned int *sad_array ) { - sad_array[0] = vp9_sad32x32_c(src_ptr, src_stride, ref_ptr, ref_stride, 0x7fffffff); - sad_array[1] = vp9_sad32x32_c(src_ptr, src_stride, ref_ptr + 1, ref_stride, 0x7fffffff); - sad_array[2] = vp9_sad32x32_c(src_ptr, src_stride, ref_ptr + 2, ref_stride, 0x7fffffff); + sad_array[0] = vp9_sad32x32_c(src_ptr, src_stride, + ref_ptr, ref_stride, 0x7fffffff); + sad_array[1] = vp9_sad32x32_c(src_ptr, src_stride, + ref_ptr + 1, ref_stride, 0x7fffffff); + sad_array[2] = vp9_sad32x32_c(src_ptr, src_stride, + ref_ptr + 2, ref_stride, 0x7fffffff); } void vp9_sad32x32x8_c(const unsigned char *src_ptr, @@ -91,159 +84,250 @@ void vp9_sad32x32x8_c(const unsigned char *src_ptr, int ref_stride, unsigned short *sad_array ) { - sad_array[0] = (unsigned short)vp9_sad32x32_c(src_ptr, src_stride, ref_ptr, ref_stride, 0x7fffffff); - sad_array[1] = (unsigned short)vp9_sad32x32_c(src_ptr, src_stride, ref_ptr + 1, ref_stride, 0x7fffffff); - sad_array[2] = (unsigned short)vp9_sad32x32_c(src_ptr, src_stride, ref_ptr + 2, ref_stride, 0x7fffffff); - sad_array[3] = (unsigned short)vp9_sad32x32_c(src_ptr, src_stride, ref_ptr + 3, ref_stride, 0x7fffffff); - sad_array[4] = (unsigned short)vp9_sad32x32_c(src_ptr, src_stride, ref_ptr + 4, ref_stride, 0x7fffffff); - sad_array[5] = (unsigned short)vp9_sad32x32_c(src_ptr, src_stride, ref_ptr + 5, ref_stride, 0x7fffffff); - sad_array[6] = (unsigned short)vp9_sad32x32_c(src_ptr, src_stride, ref_ptr + 6, ref_stride, 0x7fffffff); - sad_array[7] = (unsigned short)vp9_sad32x32_c(src_ptr, src_stride, ref_ptr + 7, ref_stride, 0x7fffffff); + sad_array[0] = (unsigned short)vp9_sad32x32_c(src_ptr, src_stride, + ref_ptr, ref_stride, + 0x7fffffff); + sad_array[1] = (unsigned short)vp9_sad32x32_c(src_ptr, src_stride, + ref_ptr + 1, ref_stride, + 0x7fffffff); + sad_array[2] = (unsigned short)vp9_sad32x32_c(src_ptr, src_stride, + ref_ptr + 2, ref_stride, + 0x7fffffff); + sad_array[3] = (unsigned short)vp9_sad32x32_c(src_ptr, src_stride, + ref_ptr + 3, ref_stride, + 0x7fffffff); + sad_array[4] = (unsigned short)vp9_sad32x32_c(src_ptr, src_stride, + ref_ptr + 4, ref_stride, + 0x7fffffff); + sad_array[5] = (unsigned short)vp9_sad32x32_c(src_ptr, src_stride, + ref_ptr + 5, ref_stride, + 0x7fffffff); + sad_array[6] = (unsigned short)vp9_sad32x32_c(src_ptr, src_stride, + ref_ptr + 6, ref_stride, + 0x7fffffff); + sad_array[7] = (unsigned short)vp9_sad32x32_c(src_ptr, src_stride, + ref_ptr + 7, ref_stride, + 0x7fffffff); } -void vp9_sad16x16x3_c( - const unsigned char *src_ptr, - int src_stride, - const unsigned char *ref_ptr, - int ref_stride, - unsigned int *sad_array -) { - sad_array[0] = vp9_sad16x16_c(src_ptr, src_stride, ref_ptr, ref_stride, 0x7fffffff); - sad_array[1] = vp9_sad16x16_c(src_ptr, src_stride, ref_ptr + 1, ref_stride, 0x7fffffff); - sad_array[2] = vp9_sad16x16_c(src_ptr, src_stride, ref_ptr + 2, ref_stride, 0x7fffffff); +void vp9_sad16x16x3_c(const unsigned char *src_ptr, + int src_stride, + const unsigned char *ref_ptr, + int ref_stride, + unsigned int *sad_array) { + sad_array[0] = vp9_sad16x16_c(src_ptr, src_stride, + ref_ptr, ref_stride, 0x7fffffff); + sad_array[1] = vp9_sad16x16_c(src_ptr, src_stride, + ref_ptr + 1, ref_stride, 0x7fffffff); + sad_array[2] = vp9_sad16x16_c(src_ptr, src_stride, + ref_ptr + 2, ref_stride, 0x7fffffff); } -void vp9_sad16x16x8_c( - const unsigned char *src_ptr, - int src_stride, - const unsigned char *ref_ptr, - int ref_stride, - unsigned short *sad_array -) { - sad_array[0] = (unsigned short)vp9_sad16x16_c(src_ptr, src_stride, ref_ptr, ref_stride, 0x7fffffff); - sad_array[1] = (unsigned short)vp9_sad16x16_c(src_ptr, src_stride, ref_ptr + 1, ref_stride, 0x7fffffff); - sad_array[2] = (unsigned short)vp9_sad16x16_c(src_ptr, src_stride, ref_ptr + 2, ref_stride, 0x7fffffff); - sad_array[3] = (unsigned short)vp9_sad16x16_c(src_ptr, src_stride, ref_ptr + 3, ref_stride, 0x7fffffff); - sad_array[4] = (unsigned short)vp9_sad16x16_c(src_ptr, src_stride, ref_ptr + 4, ref_stride, 0x7fffffff); - sad_array[5] = (unsigned short)vp9_sad16x16_c(src_ptr, src_stride, ref_ptr + 5, ref_stride, 0x7fffffff); - sad_array[6] = (unsigned short)vp9_sad16x16_c(src_ptr, src_stride, ref_ptr + 6, ref_stride, 0x7fffffff); - sad_array[7] = (unsigned short)vp9_sad16x16_c(src_ptr, src_stride, ref_ptr + 7, ref_stride, 0x7fffffff); +void vp9_sad16x16x8_c(const unsigned char *src_ptr, + int src_stride, + const unsigned char *ref_ptr, + int ref_stride, + unsigned short *sad_array) { + sad_array[0] = (unsigned short)vp9_sad16x16_c(src_ptr, src_stride, + ref_ptr, ref_stride, + 0x7fffffff); + sad_array[1] = (unsigned short)vp9_sad16x16_c(src_ptr, src_stride, + ref_ptr + 1, ref_stride, + 0x7fffffff); + sad_array[2] = (unsigned short)vp9_sad16x16_c(src_ptr, src_stride, + ref_ptr + 2, ref_stride, + 0x7fffffff); + sad_array[3] = (unsigned short)vp9_sad16x16_c(src_ptr, src_stride, + ref_ptr + 3, ref_stride, + 0x7fffffff); + sad_array[4] = (unsigned short)vp9_sad16x16_c(src_ptr, src_stride, + ref_ptr + 4, ref_stride, + 0x7fffffff); + sad_array[5] = (unsigned short)vp9_sad16x16_c(src_ptr, src_stride, + ref_ptr + 5, ref_stride, + 0x7fffffff); + sad_array[6] = (unsigned short)vp9_sad16x16_c(src_ptr, src_stride, + ref_ptr + 6, ref_stride, + 0x7fffffff); + sad_array[7] = (unsigned short)vp9_sad16x16_c(src_ptr, src_stride, + ref_ptr + 7, ref_stride, + 0x7fffffff); } -void vp9_sad16x8x3_c( - const unsigned char *src_ptr, - int src_stride, - const unsigned char *ref_ptr, - int ref_stride, - unsigned int *sad_array -) { - sad_array[0] = vp9_sad16x8_c(src_ptr, src_stride, ref_ptr, ref_stride, 0x7fffffff); - sad_array[1] = vp9_sad16x8_c(src_ptr, src_stride, ref_ptr + 1, ref_stride, 0x7fffffff); - sad_array[2] = vp9_sad16x8_c(src_ptr, src_stride, ref_ptr + 2, ref_stride, 0x7fffffff); +void vp9_sad16x8x3_c(const unsigned char *src_ptr, + int src_stride, + const unsigned char *ref_ptr, + int ref_stride, + unsigned int *sad_array) { + sad_array[0] = vp9_sad16x8_c(src_ptr, src_stride, + ref_ptr, ref_stride, 0x7fffffff); + sad_array[1] = vp9_sad16x8_c(src_ptr, src_stride, + ref_ptr + 1, ref_stride, 0x7fffffff); + sad_array[2] = vp9_sad16x8_c(src_ptr, src_stride, + ref_ptr + 2, ref_stride, 0x7fffffff); } -void vp9_sad16x8x8_c( - const unsigned char *src_ptr, - int src_stride, - const unsigned char *ref_ptr, - int ref_stride, - unsigned short *sad_array -) { - sad_array[0] = (unsigned short)vp9_sad16x8_c(src_ptr, src_stride, ref_ptr, ref_stride, 0x7fffffff); - sad_array[1] = (unsigned short)vp9_sad16x8_c(src_ptr, src_stride, ref_ptr + 1, ref_stride, 0x7fffffff); - sad_array[2] = (unsigned short)vp9_sad16x8_c(src_ptr, src_stride, ref_ptr + 2, ref_stride, 0x7fffffff); - sad_array[3] = (unsigned short)vp9_sad16x8_c(src_ptr, src_stride, ref_ptr + 3, ref_stride, 0x7fffffff); - sad_array[4] = (unsigned short)vp9_sad16x8_c(src_ptr, src_stride, ref_ptr + 4, ref_stride, 0x7fffffff); - sad_array[5] = (unsigned short)vp9_sad16x8_c(src_ptr, src_stride, ref_ptr + 5, ref_stride, 0x7fffffff); - sad_array[6] = (unsigned short)vp9_sad16x8_c(src_ptr, src_stride, ref_ptr + 6, ref_stride, 0x7fffffff); - sad_array[7] = (unsigned short)vp9_sad16x8_c(src_ptr, src_stride, ref_ptr + 7, ref_stride, 0x7fffffff); +void vp9_sad16x8x8_c(const unsigned char *src_ptr, + int src_stride, + const unsigned char *ref_ptr, + int ref_stride, + unsigned short *sad_array) { + sad_array[0] = (unsigned short)vp9_sad16x8_c(src_ptr, src_stride, + ref_ptr, ref_stride, + 0x7fffffff); + sad_array[1] = (unsigned short)vp9_sad16x8_c(src_ptr, src_stride, + ref_ptr + 1, ref_stride, + 0x7fffffff); + sad_array[2] = (unsigned short)vp9_sad16x8_c(src_ptr, src_stride, + ref_ptr + 2, ref_stride, + 0x7fffffff); + sad_array[3] = (unsigned short)vp9_sad16x8_c(src_ptr, src_stride, + ref_ptr + 3, ref_stride, + 0x7fffffff); + sad_array[4] = (unsigned short)vp9_sad16x8_c(src_ptr, src_stride, + ref_ptr + 4, ref_stride, + 0x7fffffff); + sad_array[5] = (unsigned short)vp9_sad16x8_c(src_ptr, src_stride, + ref_ptr + 5, ref_stride, + 0x7fffffff); + sad_array[6] = (unsigned short)vp9_sad16x8_c(src_ptr, src_stride, + ref_ptr + 6, ref_stride, + 0x7fffffff); + sad_array[7] = (unsigned short)vp9_sad16x8_c(src_ptr, src_stride, + ref_ptr + 7, ref_stride, + 0x7fffffff); } -void vp9_sad8x8x3_c( - const unsigned char *src_ptr, - int src_stride, - const unsigned char *ref_ptr, - int ref_stride, - unsigned int *sad_array -) { - sad_array[0] = vp9_sad8x8_c(src_ptr, src_stride, ref_ptr, ref_stride, 0x7fffffff); - sad_array[1] = vp9_sad8x8_c(src_ptr, src_stride, ref_ptr + 1, ref_stride, 0x7fffffff); - sad_array[2] = vp9_sad8x8_c(src_ptr, src_stride, ref_ptr + 2, ref_stride, 0x7fffffff); +void vp9_sad8x8x3_c(const unsigned char *src_ptr, + int src_stride, + const unsigned char *ref_ptr, + int ref_stride, + unsigned int *sad_array) { + sad_array[0] = vp9_sad8x8_c(src_ptr, src_stride, + ref_ptr, ref_stride, 0x7fffffff); + sad_array[1] = vp9_sad8x8_c(src_ptr, src_stride, + ref_ptr + 1, ref_stride, 0x7fffffff); + sad_array[2] = vp9_sad8x8_c(src_ptr, src_stride, + ref_ptr + 2, ref_stride, 0x7fffffff); } -void vp9_sad8x8x8_c( - const unsigned char *src_ptr, - int src_stride, - const unsigned char *ref_ptr, - int ref_stride, - unsigned short *sad_array -) { - sad_array[0] = (unsigned short)vp9_sad8x8_c(src_ptr, src_stride, ref_ptr, ref_stride, 0x7fffffff); - sad_array[1] = (unsigned short)vp9_sad8x8_c(src_ptr, src_stride, ref_ptr + 1, ref_stride, 0x7fffffff); - sad_array[2] = (unsigned short)vp9_sad8x8_c(src_ptr, src_stride, ref_ptr + 2, ref_stride, 0x7fffffff); - sad_array[3] = (unsigned short)vp9_sad8x8_c(src_ptr, src_stride, ref_ptr + 3, ref_stride, 0x7fffffff); - sad_array[4] = (unsigned short)vp9_sad8x8_c(src_ptr, src_stride, ref_ptr + 4, ref_stride, 0x7fffffff); - sad_array[5] = (unsigned short)vp9_sad8x8_c(src_ptr, src_stride, ref_ptr + 5, ref_stride, 0x7fffffff); - sad_array[6] = (unsigned short)vp9_sad8x8_c(src_ptr, src_stride, ref_ptr + 6, ref_stride, 0x7fffffff); - sad_array[7] = (unsigned short)vp9_sad8x8_c(src_ptr, src_stride, ref_ptr + 7, ref_stride, 0x7fffffff); +void vp9_sad8x8x8_c(const unsigned char *src_ptr, + int src_stride, + const unsigned char *ref_ptr, + int ref_stride, + unsigned short *sad_array) { + sad_array[0] = (unsigned short)vp9_sad8x8_c(src_ptr, src_stride, + ref_ptr, ref_stride, + 0x7fffffff); + sad_array[1] = (unsigned short)vp9_sad8x8_c(src_ptr, src_stride, + ref_ptr + 1, ref_stride, + 0x7fffffff); + sad_array[2] = (unsigned short)vp9_sad8x8_c(src_ptr, src_stride, + ref_ptr + 2, ref_stride, + 0x7fffffff); + sad_array[3] = (unsigned short)vp9_sad8x8_c(src_ptr, src_stride, + ref_ptr + 3, ref_stride, + 0x7fffffff); + sad_array[4] = (unsigned short)vp9_sad8x8_c(src_ptr, src_stride, + ref_ptr + 4, ref_stride, + 0x7fffffff); + sad_array[5] = (unsigned short)vp9_sad8x8_c(src_ptr, src_stride, + ref_ptr + 5, ref_stride, + 0x7fffffff); + sad_array[6] = (unsigned short)vp9_sad8x8_c(src_ptr, src_stride, + ref_ptr + 6, ref_stride, + 0x7fffffff); + sad_array[7] = (unsigned short)vp9_sad8x8_c(src_ptr, src_stride, + ref_ptr + 7, ref_stride, + 0x7fffffff); } -void vp9_sad8x16x3_c( - const unsigned char *src_ptr, - int src_stride, - const unsigned char *ref_ptr, - int ref_stride, - unsigned int *sad_array -) { - sad_array[0] = vp9_sad8x16_c(src_ptr, src_stride, ref_ptr, ref_stride, 0x7fffffff); - sad_array[1] = vp9_sad8x16_c(src_ptr, src_stride, ref_ptr + 1, ref_stride, 0x7fffffff); - sad_array[2] = vp9_sad8x16_c(src_ptr, src_stride, ref_ptr + 2, ref_stride, 0x7fffffff); +void vp9_sad8x16x3_c(const unsigned char *src_ptr, + int src_stride, + const unsigned char *ref_ptr, + int ref_stride, + unsigned int *sad_array) { + sad_array[0] = vp9_sad8x16_c(src_ptr, src_stride, + ref_ptr, ref_stride, 0x7fffffff); + sad_array[1] = vp9_sad8x16_c(src_ptr, src_stride, + ref_ptr + 1, ref_stride, 0x7fffffff); + sad_array[2] = vp9_sad8x16_c(src_ptr, src_stride, + ref_ptr + 2, ref_stride, 0x7fffffff); } -void vp9_sad8x16x8_c( - const unsigned char *src_ptr, - int src_stride, - const unsigned char *ref_ptr, - int ref_stride, - unsigned short *sad_array -) { - sad_array[0] = (unsigned short)vp9_sad8x16_c(src_ptr, src_stride, ref_ptr, ref_stride, 0x7fffffff); - sad_array[1] = (unsigned short)vp9_sad8x16_c(src_ptr, src_stride, ref_ptr + 1, ref_stride, 0x7fffffff); - sad_array[2] = (unsigned short)vp9_sad8x16_c(src_ptr, src_stride, ref_ptr + 2, ref_stride, 0x7fffffff); - sad_array[3] = (unsigned short)vp9_sad8x16_c(src_ptr, src_stride, ref_ptr + 3, ref_stride, 0x7fffffff); - sad_array[4] = (unsigned short)vp9_sad8x16_c(src_ptr, src_stride, ref_ptr + 4, ref_stride, 0x7fffffff); - sad_array[5] = (unsigned short)vp9_sad8x16_c(src_ptr, src_stride, ref_ptr + 5, ref_stride, 0x7fffffff); - sad_array[6] = (unsigned short)vp9_sad8x16_c(src_ptr, src_stride, ref_ptr + 6, ref_stride, 0x7fffffff); - sad_array[7] = (unsigned short)vp9_sad8x16_c(src_ptr, src_stride, ref_ptr + 7, ref_stride, 0x7fffffff); +void vp9_sad8x16x8_c(const unsigned char *src_ptr, + int src_stride, + const unsigned char *ref_ptr, + int ref_stride, + unsigned short *sad_array) { + sad_array[0] = (unsigned short)vp9_sad8x16_c(src_ptr, src_stride, + ref_ptr, ref_stride, + 0x7fffffff); + sad_array[1] = (unsigned short)vp9_sad8x16_c(src_ptr, src_stride, + ref_ptr + 1, ref_stride, + 0x7fffffff); + sad_array[2] = (unsigned short)vp9_sad8x16_c(src_ptr, src_stride, + ref_ptr + 2, ref_stride, + 0x7fffffff); + sad_array[3] = (unsigned short)vp9_sad8x16_c(src_ptr, src_stride, + ref_ptr + 3, ref_stride, + 0x7fffffff); + sad_array[4] = (unsigned short)vp9_sad8x16_c(src_ptr, src_stride, + ref_ptr + 4, ref_stride, + 0x7fffffff); + sad_array[5] = (unsigned short)vp9_sad8x16_c(src_ptr, src_stride, + ref_ptr + 5, ref_stride, + 0x7fffffff); + sad_array[6] = (unsigned short)vp9_sad8x16_c(src_ptr, src_stride, + ref_ptr + 6, ref_stride, + 0x7fffffff); + sad_array[7] = (unsigned short)vp9_sad8x16_c(src_ptr, src_stride, + ref_ptr + 7, ref_stride, + 0x7fffffff); } -void vp9_sad4x4x3_c( - const unsigned char *src_ptr, - int src_stride, - const unsigned char *ref_ptr, - int ref_stride, - unsigned int *sad_array -) { - sad_array[0] = vp9_sad4x4_c(src_ptr, src_stride, ref_ptr, ref_stride, 0x7fffffff); - sad_array[1] = vp9_sad4x4_c(src_ptr, src_stride, ref_ptr + 1, ref_stride, 0x7fffffff); - sad_array[2] = vp9_sad4x4_c(src_ptr, src_stride, ref_ptr + 2, ref_stride, 0x7fffffff); +void vp9_sad4x4x3_c(const unsigned char *src_ptr, + int src_stride, + const unsigned char *ref_ptr, + int ref_stride, + unsigned int *sad_array) { + sad_array[0] = vp9_sad4x4_c(src_ptr, src_stride, + ref_ptr, ref_stride, 0x7fffffff); + sad_array[1] = vp9_sad4x4_c(src_ptr, src_stride, + ref_ptr + 1, ref_stride, 0x7fffffff); + sad_array[2] = vp9_sad4x4_c(src_ptr, src_stride, + ref_ptr + 2, ref_stride, 0x7fffffff); } -void vp9_sad4x4x8_c( - const unsigned char *src_ptr, - int src_stride, - const unsigned char *ref_ptr, - int ref_stride, - unsigned short *sad_array -) { - sad_array[0] = (unsigned short)vp9_sad4x4_c(src_ptr, src_stride, ref_ptr, ref_stride, 0x7fffffff); - sad_array[1] = (unsigned short)vp9_sad4x4_c(src_ptr, src_stride, ref_ptr + 1, ref_stride, 0x7fffffff); - sad_array[2] = (unsigned short)vp9_sad4x4_c(src_ptr, src_stride, ref_ptr + 2, ref_stride, 0x7fffffff); - sad_array[3] = (unsigned short)vp9_sad4x4_c(src_ptr, src_stride, ref_ptr + 3, ref_stride, 0x7fffffff); - sad_array[4] = (unsigned short)vp9_sad4x4_c(src_ptr, src_stride, ref_ptr + 4, ref_stride, 0x7fffffff); - sad_array[5] = (unsigned short)vp9_sad4x4_c(src_ptr, src_stride, ref_ptr + 5, ref_stride, 0x7fffffff); - sad_array[6] = (unsigned short)vp9_sad4x4_c(src_ptr, src_stride, ref_ptr + 6, ref_stride, 0x7fffffff); - sad_array[7] = (unsigned short)vp9_sad4x4_c(src_ptr, src_stride, ref_ptr + 7, ref_stride, 0x7fffffff); +void vp9_sad4x4x8_c(const unsigned char *src_ptr, + int src_stride, + const unsigned char *ref_ptr, + int ref_stride, + unsigned short *sad_array) { + sad_array[0] = (unsigned short)vp9_sad4x4_c(src_ptr, src_stride, + ref_ptr, ref_stride, + 0x7fffffff); + sad_array[1] = (unsigned short)vp9_sad4x4_c(src_ptr, src_stride, + ref_ptr + 1, ref_stride, + 0x7fffffff); + sad_array[2] = (unsigned short)vp9_sad4x4_c(src_ptr, src_stride, + ref_ptr + 2, ref_stride, + 0x7fffffff); + sad_array[3] = (unsigned short)vp9_sad4x4_c(src_ptr, src_stride, + ref_ptr + 3, ref_stride, + 0x7fffffff); + sad_array[4] = (unsigned short)vp9_sad4x4_c(src_ptr, src_stride, + ref_ptr + 4, ref_stride, + 0x7fffffff); + sad_array[5] = (unsigned short)vp9_sad4x4_c(src_ptr, src_stride, + ref_ptr + 5, ref_stride, + 0x7fffffff); + sad_array[6] = (unsigned short)vp9_sad4x4_c(src_ptr, src_stride, + ref_ptr + 6, ref_stride, + 0x7fffffff); + sad_array[7] = (unsigned short)vp9_sad4x4_c(src_ptr, src_stride, + ref_ptr + 7, ref_stride, + 0x7fffffff); } void vp9_sad32x32x4d_c(const unsigned char *src_ptr, @@ -252,84 +336,97 @@ void vp9_sad32x32x4d_c(const unsigned char *src_ptr, int ref_stride, unsigned int *sad_array ) { - sad_array[0] = vp9_sad32x32_c(src_ptr, src_stride, ref_ptr[0], ref_stride, 0x7fffffff); - sad_array[1] = vp9_sad32x32_c(src_ptr, src_stride, ref_ptr[1], ref_stride, 0x7fffffff); - sad_array[2] = vp9_sad32x32_c(src_ptr, src_stride, ref_ptr[2], ref_stride, 0x7fffffff); - sad_array[3] = vp9_sad32x32_c(src_ptr, src_stride, ref_ptr[3], ref_stride, 0x7fffffff); + sad_array[0] = vp9_sad32x32_c(src_ptr, src_stride, + ref_ptr[0], ref_stride, 0x7fffffff); + sad_array[1] = vp9_sad32x32_c(src_ptr, src_stride, + ref_ptr[1], ref_stride, 0x7fffffff); + sad_array[2] = vp9_sad32x32_c(src_ptr, src_stride, + ref_ptr[2], ref_stride, 0x7fffffff); + sad_array[3] = vp9_sad32x32_c(src_ptr, src_stride, + ref_ptr[3], ref_stride, 0x7fffffff); } -void vp9_sad16x16x4d_c( - const unsigned char *src_ptr, - int src_stride, - unsigned char *ref_ptr[], - int ref_stride, - unsigned int *sad_array -) { - sad_array[0] = vp9_sad16x16_c(src_ptr, src_stride, ref_ptr[0], ref_stride, 0x7fffffff); - sad_array[1] = vp9_sad16x16_c(src_ptr, src_stride, ref_ptr[1], ref_stride, 0x7fffffff); - sad_array[2] = vp9_sad16x16_c(src_ptr, src_stride, ref_ptr[2], ref_stride, 0x7fffffff); - sad_array[3] = vp9_sad16x16_c(src_ptr, src_stride, ref_ptr[3], ref_stride, 0x7fffffff); +void vp9_sad16x16x4d_c(const unsigned char *src_ptr, + int src_stride, + unsigned char *ref_ptr[], + int ref_stride, + unsigned int *sad_array) { + sad_array[0] = vp9_sad16x16_c(src_ptr, src_stride, + ref_ptr[0], ref_stride, 0x7fffffff); + sad_array[1] = vp9_sad16x16_c(src_ptr, src_stride, + ref_ptr[1], ref_stride, 0x7fffffff); + sad_array[2] = vp9_sad16x16_c(src_ptr, src_stride, + ref_ptr[2], ref_stride, 0x7fffffff); + sad_array[3] = vp9_sad16x16_c(src_ptr, src_stride, + ref_ptr[3], ref_stride, 0x7fffffff); } -void vp9_sad16x8x4d_c( - const unsigned char *src_ptr, - int src_stride, - unsigned char *ref_ptr[], - int ref_stride, - unsigned int *sad_array -) { - sad_array[0] = vp9_sad16x8_c(src_ptr, src_stride, ref_ptr[0], ref_stride, 0x7fffffff); - sad_array[1] = vp9_sad16x8_c(src_ptr, src_stride, ref_ptr[1], ref_stride, 0x7fffffff); - sad_array[2] = vp9_sad16x8_c(src_ptr, src_stride, ref_ptr[2], ref_stride, 0x7fffffff); - sad_array[3] = vp9_sad16x8_c(src_ptr, src_stride, ref_ptr[3], ref_stride, 0x7fffffff); +void vp9_sad16x8x4d_c(const unsigned char *src_ptr, + int src_stride, + unsigned char *ref_ptr[], + int ref_stride, + unsigned int *sad_array) { + sad_array[0] = vp9_sad16x8_c(src_ptr, src_stride, + ref_ptr[0], ref_stride, 0x7fffffff); + sad_array[1] = vp9_sad16x8_c(src_ptr, src_stride, + ref_ptr[1], ref_stride, 0x7fffffff); + sad_array[2] = vp9_sad16x8_c(src_ptr, src_stride, + ref_ptr[2], ref_stride, 0x7fffffff); + sad_array[3] = vp9_sad16x8_c(src_ptr, src_stride, + ref_ptr[3], ref_stride, 0x7fffffff); } -void vp9_sad8x8x4d_c( - const unsigned char *src_ptr, - int src_stride, - unsigned char *ref_ptr[], - int ref_stride, - unsigned int *sad_array -) { - sad_array[0] = vp9_sad8x8_c(src_ptr, src_stride, ref_ptr[0], ref_stride, 0x7fffffff); - sad_array[1] = vp9_sad8x8_c(src_ptr, src_stride, ref_ptr[1], ref_stride, 0x7fffffff); - sad_array[2] = vp9_sad8x8_c(src_ptr, src_stride, ref_ptr[2], ref_stride, 0x7fffffff); - sad_array[3] = vp9_sad8x8_c(src_ptr, src_stride, ref_ptr[3], ref_stride, 0x7fffffff); +void vp9_sad8x8x4d_c(const unsigned char *src_ptr, + int src_stride, + unsigned char *ref_ptr[], + int ref_stride, + unsigned int *sad_array) { + sad_array[0] = vp9_sad8x8_c(src_ptr, src_stride, + ref_ptr[0], ref_stride, 0x7fffffff); + sad_array[1] = vp9_sad8x8_c(src_ptr, src_stride, + ref_ptr[1], ref_stride, 0x7fffffff); + sad_array[2] = vp9_sad8x8_c(src_ptr, src_stride, + ref_ptr[2], ref_stride, 0x7fffffff); + sad_array[3] = vp9_sad8x8_c(src_ptr, src_stride, + ref_ptr[3], ref_stride, 0x7fffffff); } -void vp9_sad8x16x4d_c( - const unsigned char *src_ptr, - int src_stride, - unsigned char *ref_ptr[], - int ref_stride, - unsigned int *sad_array -) { - sad_array[0] = vp9_sad8x16_c(src_ptr, src_stride, ref_ptr[0], ref_stride, 0x7fffffff); - sad_array[1] = vp9_sad8x16_c(src_ptr, src_stride, ref_ptr[1], ref_stride, 0x7fffffff); - sad_array[2] = vp9_sad8x16_c(src_ptr, src_stride, ref_ptr[2], ref_stride, 0x7fffffff); - sad_array[3] = vp9_sad8x16_c(src_ptr, src_stride, ref_ptr[3], ref_stride, 0x7fffffff); +void vp9_sad8x16x4d_c(const unsigned char *src_ptr, + int src_stride, + unsigned char *ref_ptr[], + int ref_stride, + unsigned int *sad_array) { + sad_array[0] = vp9_sad8x16_c(src_ptr, src_stride, + ref_ptr[0], ref_stride, 0x7fffffff); + sad_array[1] = vp9_sad8x16_c(src_ptr, src_stride, + ref_ptr[1], ref_stride, 0x7fffffff); + sad_array[2] = vp9_sad8x16_c(src_ptr, src_stride, + ref_ptr[2], ref_stride, 0x7fffffff); + sad_array[3] = vp9_sad8x16_c(src_ptr, src_stride, + ref_ptr[3], ref_stride, 0x7fffffff); } -void vp9_sad4x4x4d_c( - const unsigned char *src_ptr, - int src_stride, - unsigned char *ref_ptr[], - int ref_stride, - unsigned int *sad_array -) { - sad_array[0] = vp9_sad4x4_c(src_ptr, src_stride, ref_ptr[0], ref_stride, 0x7fffffff); - sad_array[1] = vp9_sad4x4_c(src_ptr, src_stride, ref_ptr[1], ref_stride, 0x7fffffff); - sad_array[2] = vp9_sad4x4_c(src_ptr, src_stride, ref_ptr[2], ref_stride, 0x7fffffff); - sad_array[3] = vp9_sad4x4_c(src_ptr, src_stride, ref_ptr[3], ref_stride, 0x7fffffff); +void vp9_sad4x4x4d_c(const unsigned char *src_ptr, + int src_stride, + unsigned char *ref_ptr[], + int ref_stride, + unsigned int *sad_array) { + sad_array[0] = vp9_sad4x4_c(src_ptr, src_stride, + ref_ptr[0], ref_stride, 0x7fffffff); + sad_array[1] = vp9_sad4x4_c(src_ptr, src_stride, + ref_ptr[1], ref_stride, 0x7fffffff); + sad_array[2] = vp9_sad4x4_c(src_ptr, src_stride, + ref_ptr[2], ref_stride, 0x7fffffff); + sad_array[3] = vp9_sad4x4_c(src_ptr, src_stride, + ref_ptr[3], ref_stride, 0x7fffffff); } /* Copy 2 macroblocks to a buffer */ -void vp9_copy32xn_c( - unsigned char *src_ptr, - int src_stride, - unsigned char *dst_ptr, - int dst_stride, - int height) { +void vp9_copy32xn_c(unsigned char *src_ptr, + int src_stride, + unsigned char *dst_ptr, + int dst_stride, + int height) { int r; for (r = 0; r < height; r++) { diff --git a/vp8/encoder/segmentation.h b/vp8/encoder/segmentation.h index bf36505..4ef6c79 100644 --- a/vp8/encoder/segmentation.h +++ b/vp8/encoder/segmentation.h @@ -16,14 +16,16 @@ #ifndef __INC_SEGMENTATION_H__ #define __INC_SEGMENTATION_H__ 1 -extern void vp9_update_gf_useage_maps(VP8_COMP *cpi, VP8_COMMON *cm, MACROBLOCK *x); +extern void vp9_update_gf_useage_maps(VP8_COMP *cpi, VP8_COMMON *cm, + MACROBLOCK *x); extern void vp9_enable_segmentation(VP8_PTR ptr); extern void vp9_disable_segmentation(VP8_PTR ptr); // Valid values for a segment are 0 to 3 // Segmentation map is arrange as [Rows][Columns] -extern void vp9_set_segmentation_map(VP8_PTR ptr, unsigned char *segmentation_map); +extern void vp9_set_segmentation_map(VP8_PTR ptr, + unsigned char *segmentation_map); // The values given for each segment can be either deltas (from the default // value chosen for the frame) or absolute values. @@ -36,7 +38,8 @@ extern void vp9_set_segmentation_map(VP8_PTR ptr, unsigned char *segmentation_ma // abs_delta = SEGMENT_DELTADATA (deltas) abs_delta = SEGMENT_ABSDATA (use // the absolute values given). // -extern void vp9_set_segment_data(VP8_PTR ptr, signed char *feature_data, unsigned char abs_delta); +extern void vp9_set_segment_data(VP8_PTR ptr, signed char *feature_data, + unsigned char abs_delta); extern void vp9_choose_segmap_coding_method(VP8_COMP *cpi); diff --git a/vp8/encoder/variance_c.c b/vp8/encoder/variance_c.c index 3a093b7..2684df7 100644 --- a/vp8/encoder/variance_c.c +++ b/vp8/encoder/variance_c.c @@ -13,30 +13,25 @@ #include "vp8/common/filter.h" -unsigned int vp9_get_mb_ss_c -( - const short *src_ptr -) { - unsigned int i = 0, sum = 0; +unsigned int vp9_get_mb_ss_c(const short *src_ptr) { + unsigned int i, sum = 0; - do { + for (i = 0; i < 256; i++) { sum += (src_ptr[i] * src_ptr[i]); - i++; - } while (i < 256); + } return sum; } -static void variance( - const unsigned char *src_ptr, - int source_stride, - const unsigned char *ref_ptr, - int recon_stride, - int w, - int h, - unsigned int *sse, - int *sum) { +static void variance(const unsigned char *src_ptr, + int source_stride, + const unsigned char *ref_ptr, + int recon_stride, + int w, + int h, + unsigned int *sse, + int *sum) { int i, j; int diff; @@ -70,89 +65,78 @@ unsigned int vp9_variance32x32_c(const unsigned char *src_ptr, } #endif -unsigned int vp9_variance16x16_c( - const unsigned char *src_ptr, - int source_stride, - const unsigned char *ref_ptr, - int recon_stride, - unsigned int *sse) { +unsigned int vp9_variance16x16_c(const unsigned char *src_ptr, + int source_stride, + const unsigned char *ref_ptr, + int recon_stride, + unsigned int *sse) { unsigned int var; int avg; - variance(src_ptr, source_stride, ref_ptr, recon_stride, 16, 16, &var, &avg); *sse = var; return (var - ((avg * avg) >> 8)); } -unsigned int vp9_variance8x16_c( - const unsigned char *src_ptr, - int source_stride, - const unsigned char *ref_ptr, - int recon_stride, - unsigned int *sse) { +unsigned int vp9_variance8x16_c(const unsigned char *src_ptr, + int source_stride, + const unsigned char *ref_ptr, + int recon_stride, + unsigned int *sse) { unsigned int var; int avg; - variance(src_ptr, source_stride, ref_ptr, recon_stride, 8, 16, &var, &avg); *sse = var; return (var - ((avg * avg) >> 7)); } -unsigned int vp9_variance16x8_c( - const unsigned char *src_ptr, - int source_stride, - const unsigned char *ref_ptr, - int recon_stride, - unsigned int *sse) { +unsigned int vp9_variance16x8_c(const unsigned char *src_ptr, + int source_stride, + const unsigned char *ref_ptr, + int recon_stride, + unsigned int *sse) { unsigned int var; int avg; - variance(src_ptr, source_stride, ref_ptr, recon_stride, 16, 8, &var, &avg); *sse = var; return (var - ((avg * avg) >> 7)); } -unsigned int vp9_variance8x8_c( - const unsigned char *src_ptr, - int source_stride, - const unsigned char *ref_ptr, - int recon_stride, - unsigned int *sse) { +unsigned int vp9_variance8x8_c(const unsigned char *src_ptr, + int source_stride, + const unsigned char *ref_ptr, + int recon_stride, + unsigned int *sse) { unsigned int var; int avg; - variance(src_ptr, source_stride, ref_ptr, recon_stride, 8, 8, &var, &avg); *sse = var; return (var - ((avg * avg) >> 6)); } -unsigned int vp9_variance4x4_c( - const unsigned char *src_ptr, - int source_stride, - const unsigned char *ref_ptr, - int recon_stride, - unsigned int *sse) { +unsigned int vp9_variance4x4_c(const unsigned char *src_ptr, + int source_stride, + const unsigned char *ref_ptr, + int recon_stride, + unsigned int *sse) { unsigned int var; int avg; - variance(src_ptr, source_stride, ref_ptr, recon_stride, 4, 4, &var, &avg); *sse = var; return (var - ((avg * avg) >> 4)); } -unsigned int vp9_mse16x16_c( - const unsigned char *src_ptr, - int source_stride, - const unsigned char *ref_ptr, - int recon_stride, - unsigned int *sse) { +unsigned int vp9_mse16x16_c(const unsigned char *src_ptr, + int source_stride, + const unsigned char *ref_ptr, + int recon_stride, + unsigned int *sse) { unsigned int var; int avg; @@ -190,16 +174,13 @@ unsigned int vp9_mse16x16_c( * to the next. * ****************************************************************************/ -static void var_filter_block2d_bil_first_pass -( - const unsigned char *src_ptr, - unsigned short *output_ptr, - unsigned int src_pixels_per_line, - int pixel_step, - unsigned int output_height, - unsigned int output_width, - const short *vp8_filter -) { +static void var_filter_block2d_bil_first_pass(const unsigned char *src_ptr, + unsigned short *output_ptr, + unsigned int src_pixels_per_line, + int pixel_step, + unsigned int output_height, + unsigned int output_width, + const short *vp8_filter) { unsigned int i, j; for (i = 0; i < output_height; i++) { @@ -245,16 +226,13 @@ static void var_filter_block2d_bil_first_pass * to the next. * ****************************************************************************/ -static void var_filter_block2d_bil_second_pass -( - const unsigned short *src_ptr, - unsigned char *output_ptr, - unsigned int src_pixels_per_line, - unsigned int pixel_step, - unsigned int output_height, - unsigned int output_width, - const short *vp8_filter -) { +static void var_filter_block2d_bil_second_pass(const unsigned short *src_ptr, + unsigned char *output_ptr, + unsigned int src_pixels_per_line, + unsigned int pixel_step, + unsigned int output_height, + unsigned int output_width, + const short *vp8_filter) { unsigned int i, j; int Temp; @@ -275,16 +253,13 @@ static void var_filter_block2d_bil_second_pass } -unsigned int vp9_sub_pixel_variance4x4_c -( - const unsigned char *src_ptr, - int src_pixels_per_line, - int xoffset, - int yoffset, - const unsigned char *dst_ptr, - int dst_pixels_per_line, - unsigned int *sse -) { +unsigned int vp9_sub_pixel_variance4x4_c(const unsigned char *src_ptr, + int src_pixels_per_line, + int xoffset, + int yoffset, + const unsigned char *dst_ptr, + int dst_pixels_per_line, + unsigned int *sse) { unsigned char temp2[20 * 16]; const short *HFilter, *VFilter; unsigned short FData3[5 * 4]; // Temp data bufffer used in filtering @@ -302,16 +277,13 @@ unsigned int vp9_sub_pixel_variance4x4_c } -unsigned int vp9_sub_pixel_variance8x8_c -( - const unsigned char *src_ptr, - int src_pixels_per_line, - int xoffset, - int yoffset, - const unsigned char *dst_ptr, - int dst_pixels_per_line, - unsigned int *sse -) { +unsigned int vp9_sub_pixel_variance8x8_c(const unsigned char *src_ptr, + int src_pixels_per_line, + int xoffset, + int yoffset, + const unsigned char *dst_ptr, + int dst_pixels_per_line, + unsigned int *sse) { unsigned short FData3[9 * 8]; // Temp data bufffer used in filtering unsigned char temp2[20 * 16]; const short *HFilter, *VFilter; @@ -325,16 +297,13 @@ unsigned int vp9_sub_pixel_variance8x8_c return vp9_variance8x8_c(temp2, 8, dst_ptr, dst_pixels_per_line, sse); } -unsigned int vp9_sub_pixel_variance16x16_c -( - const unsigned char *src_ptr, - int src_pixels_per_line, - int xoffset, - int yoffset, - const unsigned char *dst_ptr, - int dst_pixels_per_line, - unsigned int *sse -) { +unsigned int vp9_sub_pixel_variance16x16_c(const unsigned char *src_ptr, + int src_pixels_per_line, + int xoffset, + int yoffset, + const unsigned char *dst_ptr, + int dst_pixels_per_line, + unsigned int *sse) { unsigned short FData3[17 * 16]; // Temp data bufffer used in filtering unsigned char temp2[20 * 16]; const short *HFilter, *VFilter; @@ -370,12 +339,11 @@ unsigned int vp9_sub_pixel_variance32x32_c(const unsigned char *src_ptr, } #endif -unsigned int vp9_variance_halfpixvar16x16_h_c( - const unsigned char *src_ptr, - int source_stride, - const unsigned char *ref_ptr, - int recon_stride, - unsigned int *sse) { +unsigned int vp9_variance_halfpixvar16x16_h_c(const unsigned char *src_ptr, + int source_stride, + const unsigned char *ref_ptr, + int recon_stride, + unsigned int *sse) { return vp9_sub_pixel_variance16x16_c(src_ptr, source_stride, 8, 0, ref_ptr, recon_stride, sse); } @@ -402,23 +370,21 @@ unsigned int vp9_variance_halfpixvar16x16_v_c(const unsigned char *src_ptr, } #if CONFIG_SUPERBLOCKS -unsigned int vp9_variance_halfpixvar32x32_v_c( - const unsigned char *src_ptr, - int source_stride, - const unsigned char *ref_ptr, - int recon_stride, - unsigned int *sse) { +unsigned int vp9_variance_halfpixvar32x32_v_c(const unsigned char *src_ptr, + int source_stride, + const unsigned char *ref_ptr, + int recon_stride, + unsigned int *sse) { return vp9_sub_pixel_variance32x32_c(src_ptr, source_stride, 0, 8, ref_ptr, recon_stride, sse); } #endif -unsigned int vp9_variance_halfpixvar16x16_hv_c( - const unsigned char *src_ptr, - int source_stride, - const unsigned char *ref_ptr, - int recon_stride, - unsigned int *sse) { +unsigned int vp9_variance_halfpixvar16x16_hv_c(const unsigned char *src_ptr, + int source_stride, + const unsigned char *ref_ptr, + int recon_stride, + unsigned int *sse) { return vp9_sub_pixel_variance16x16_c(src_ptr, source_stride, 8, 8, ref_ptr, recon_stride, sse); } @@ -434,17 +400,16 @@ unsigned int vp9_variance_halfpixvar32x32_hv_c(const unsigned char *src_ptr, } #endif -unsigned int vp9_sub_pixel_mse16x16_c -( - const unsigned char *src_ptr, - int src_pixels_per_line, - int xoffset, - int yoffset, - const unsigned char *dst_ptr, - int dst_pixels_per_line, - unsigned int *sse -) { - vp9_sub_pixel_variance16x16_c(src_ptr, src_pixels_per_line, xoffset, yoffset, dst_ptr, dst_pixels_per_line, sse); +unsigned int vp9_sub_pixel_mse16x16_c(const unsigned char *src_ptr, + int src_pixels_per_line, + int xoffset, + int yoffset, + const unsigned char *dst_ptr, + int dst_pixels_per_line, + unsigned int *sse) { + vp9_sub_pixel_variance16x16_c(src_ptr, src_pixels_per_line, + xoffset, yoffset, dst_ptr, + dst_pixels_per_line, sse); return *sse; } @@ -456,21 +421,20 @@ unsigned int vp9_sub_pixel_mse32x32_c(const unsigned char *src_ptr, const unsigned char *dst_ptr, int dst_pixels_per_line, unsigned int *sse) { - vp9_sub_pixel_variance32x32_c(src_ptr, src_pixels_per_line, xoffset, yoffset, dst_ptr, dst_pixels_per_line, sse); + vp9_sub_pixel_variance32x32_c(src_ptr, src_pixels_per_line, + xoffset, yoffset, dst_ptr, + dst_pixels_per_line, sse); return *sse; } #endif -unsigned int vp9_sub_pixel_variance16x8_c -( - const unsigned char *src_ptr, - int src_pixels_per_line, - int xoffset, - int yoffset, - const unsigned char *dst_ptr, - int dst_pixels_per_line, - unsigned int *sse -) { +unsigned int vp9_sub_pixel_variance16x8_c(const unsigned char *src_ptr, + int src_pixels_per_line, + int xoffset, + int yoffset, + const unsigned char *dst_ptr, + int dst_pixels_per_line, + unsigned int *sse) { unsigned short FData3[16 * 9]; // Temp data bufffer used in filtering unsigned char temp2[20 * 16]; const short *HFilter, *VFilter; @@ -484,37 +448,33 @@ unsigned int vp9_sub_pixel_variance16x8_c return vp9_variance16x8_c(temp2, 16, dst_ptr, dst_pixels_per_line, sse); } -unsigned int vp9_sub_pixel_variance8x16_c -( - const unsigned char *src_ptr, - int src_pixels_per_line, - int xoffset, - int yoffset, - const unsigned char *dst_ptr, - int dst_pixels_per_line, - unsigned int *sse -) { +unsigned int vp9_sub_pixel_variance8x16_c(const unsigned char *src_ptr, + int src_pixels_per_line, + int xoffset, + int yoffset, + const unsigned char *dst_ptr, + int dst_pixels_per_line, + unsigned int *sse) { unsigned short FData3[9 * 16]; // Temp data bufffer used in filtering unsigned char temp2[20 * 16]; const short *HFilter, *VFilter; - HFilter = vp8_bilinear_filters[xoffset]; VFilter = vp8_bilinear_filters[yoffset]; - - var_filter_block2d_bil_first_pass(src_ptr, FData3, src_pixels_per_line, 1, 17, 8, HFilter); + var_filter_block2d_bil_first_pass(src_ptr, FData3, src_pixels_per_line, + 1, 17, 8, HFilter); var_filter_block2d_bil_second_pass(FData3, temp2, 8, 8, 16, 8, VFilter); return vp9_variance8x16_c(temp2, 8, dst_ptr, dst_pixels_per_line, sse); } + #if CONFIG_NEWBESTREFMV -unsigned int vp8_variance2x16_c( - const unsigned char *src_ptr, - const int source_stride, - const unsigned char *ref_ptr, - const int recon_stride, - unsigned int *sse) { +unsigned int vp8_variance2x16_c(const unsigned char *src_ptr, + const int source_stride, + const unsigned char *ref_ptr, + const int recon_stride, + unsigned int *sse) { unsigned int var; int avg; @@ -523,12 +483,11 @@ unsigned int vp8_variance2x16_c( return (var - ((avg * avg) >> 5)); } -unsigned int vp8_variance16x2_c( - const unsigned char *src_ptr, - const int source_stride, - const unsigned char *ref_ptr, - const int recon_stride, - unsigned int *sse) { +unsigned int vp8_variance16x2_c(const unsigned char *src_ptr, + const int source_stride, + const unsigned char *ref_ptr, + const int recon_stride, + unsigned int *sse) { unsigned int var; int avg; @@ -537,16 +496,13 @@ unsigned int vp8_variance16x2_c( return (var - ((avg * avg) >> 5)); } -unsigned int vp8_sub_pixel_variance16x2_c -( - const unsigned char *src_ptr, - const int src_pixels_per_line, - const int xoffset, - const int yoffset, - const unsigned char *dst_ptr, - const int dst_pixels_per_line, - unsigned int *sse -) { +unsigned int vp8_sub_pixel_variance16x2_c(const unsigned char *src_ptr, + const int src_pixels_per_line, + const int xoffset, + const int yoffset, + const unsigned char *dst_ptr, + const int dst_pixels_per_line, + unsigned int *sse) { unsigned short FData3[16 * 3]; // Temp data bufffer used in filtering unsigned char temp2[20 * 16]; const short *HFilter, *VFilter; @@ -561,16 +517,13 @@ unsigned int vp8_sub_pixel_variance16x2_c return vp8_variance16x2_c(temp2, 16, dst_ptr, dst_pixels_per_line, sse); } -unsigned int vp8_sub_pixel_variance2x16_c -( - const unsigned char *src_ptr, - const int src_pixels_per_line, - const int xoffset, - const int yoffset, - const unsigned char *dst_ptr, - const int dst_pixels_per_line, - unsigned int *sse -) { +unsigned int vp8_sub_pixel_variance2x16_c(const unsigned char *src_ptr, + const int src_pixels_per_line, + const int xoffset, + const int yoffset, + const unsigned char *dst_ptr, + const int dst_pixels_per_line, + unsigned int *sse) { unsigned short FData3[2 * 17]; // Temp data bufffer used in filtering unsigned char temp2[2 * 16]; const short *HFilter, *VFilter; diff --git a/vp8/vp8_cx_iface.c b/vp8/vp8_cx_iface.c index 1b8dba0..9b77a69 100644 --- a/vp8/vp8_cx_iface.c +++ b/vp8/vp8_cx_iface.c @@ -364,7 +364,7 @@ static vpx_codec_err_t vp8e_set_config(vpx_codec_alg_priv_t *ctx, } -int vp9_reverse_trans(int); +int vp9_reverse_trans(int q); static vpx_codec_err_t get_param(vpx_codec_alg_priv_t *ctx, @@ -379,7 +379,8 @@ static vpx_codec_err_t get_param(vpx_codec_alg_priv_t *ctx, switch (ctrl_id) { MAP(VP8E_GET_LAST_QUANTIZER, vp9_get_quantizer(ctx->cpi)); - MAP(VP8E_GET_LAST_QUANTIZER_64, vp9_reverse_trans(vp9_get_quantizer(ctx->cpi))); + MAP(VP8E_GET_LAST_QUANTIZER_64, + vp9_reverse_trans(vp9_get_quantizer(ctx->cpi))); } return VPX_CODEC_OK; @@ -482,7 +483,7 @@ static vpx_codec_err_t vp8e_common_init(vpx_codec_ctx_t *ctx, priv->deprecated_mode = NO_MODE_SET; - vp9_initialize(); + vp9_initialize_enc(); res = validate_config(priv, &priv->cfg, &priv->vp8_cfg); @@ -674,8 +675,10 @@ static vpx_codec_err_t vp8e_encode(vpx_codec_alg_priv_t *ctx, cx_data_sz = ctx->cx_data_sz; lib_flags = 0; - while (cx_data_sz >= ctx->cx_data_sz / 2 - && -1 != vp9_get_compressed_data(ctx->cpi, &lib_flags, &size, cx_data, &dst_time_stamp, &dst_end_time_stamp, !img)) { + while (cx_data_sz >= ctx->cx_data_sz / 2 && + -1 != vp9_get_compressed_data(ctx->cpi, &lib_flags, &size, + cx_data, &dst_time_stamp, + &dst_end_time_stamp, !img)) { if (size) { vpx_codec_pts_t round, delta; vpx_codec_cx_pkt_t pkt; @@ -766,7 +769,7 @@ static vpx_codec_err_t vp8e_set_reference(vpx_codec_alg_priv_t *ctx, YV12_BUFFER_CONFIG sd; image2yuvconfig(&frame->img, &sd); - vp9_set_reference(ctx->cpi, frame->frame_type, &sd); + vp9_set_reference_enc(ctx->cpi, frame->frame_type, &sd); return VPX_CODEC_OK; } else return VPX_CODEC_INVALID_PARAM; @@ -784,7 +787,7 @@ static vpx_codec_err_t vp8e_get_reference(vpx_codec_alg_priv_t *ctx, YV12_BUFFER_CONFIG sd; image2yuvconfig(&frame->img, &sd); - vp9_get_reference(ctx->cpi, frame->frame_type, &sd); + vp9_get_reference_enc(ctx->cpi, frame->frame_type, &sd); return VPX_CODEC_OK; } else return VPX_CODEC_INVALID_PARAM; @@ -894,7 +897,8 @@ static vpx_codec_err_t vp8e_set_roi_map(vpx_codec_alg_priv_t *ctx, if (data) { vpx_roi_map_t *roi = (vpx_roi_map_t *)data; - if (!vp9_set_roimap(ctx->cpi, roi->roi_map, roi->rows, roi->cols, roi->delta_q, roi->delta_lf, roi->static_threshold)) + if (!vp9_set_roimap(ctx->cpi, roi->roi_map, roi->rows, roi->cols, + roi->delta_q, roi->delta_lf, roi->static_threshold)) return VPX_CODEC_OK; else return VPX_CODEC_INVALID_PARAM; @@ -929,7 +933,8 @@ static vpx_codec_err_t vp8e_set_scalemode(vpx_codec_alg_priv_t *ctx, if (data) { int res; vpx_scaling_mode_t scalemode = *(vpx_scaling_mode_t *)data; - res = vp9_set_internal_size(ctx->cpi, scalemode.h_scaling_mode, scalemode.v_scaling_mode); + res = vp9_set_internal_size(ctx->cpi, scalemode.h_scaling_mode, + scalemode.v_scaling_mode); if (!res) { /*force next frame a key frame to effect scaling mode */