From 8c31484ea1fbac128e31a951a004f6f91bc1ef2f Mon Sep 17 00:00:00 2001 From: Yaowu Xu Date: Wed, 20 Jul 2011 14:21:24 -0700 Subject: fix more merge issues With this fix, the experimental branch now builds and encodes correctly with the following two configure options respectively: --enable-experimental --enable-t8x8 --enable-experimental Change-Id: I3147c33c503fe713a85fd371e4f1a974805778bf --- vp8/encoder/bitstream.c | 12 ++++-------- vp8/encoder/dct.c | 16 ++++++++-------- vp8/encoder/encodeframe.c | 24 +++++++++++++++--------- vp8/encoder/encodemb.c | 3 ++- vp8/encoder/onyx_if.c | 5 ++--- vp8/encoder/onyx_int.h | 13 ++++++------- vp8/encoder/quantize.c | 4 +++- vp8/encoder/quantize.h | 9 ++++++--- vp8/encoder/rdopt.c | 1 - vp8/encoder/tokenize.c | 3 --- vp8/encoder/tokenize.h | 3 ++- 11 files changed, 48 insertions(+), 45 deletions(-) (limited to 'vp8/encoder') diff --git a/vp8/encoder/bitstream.c b/vp8/encoder/bitstream.c index f915b6963..64d1c9304 100644 --- a/vp8/encoder/bitstream.c +++ b/vp8/encoder/bitstream.c @@ -192,10 +192,6 @@ static void pack_tokens_c(vp8_writer *w, const TOKENEXTRA *p, int xcount) n--; i = 2; } - if (n == 0) { - printf("Fatal Error: n=0\n"); - fflush(stdout); - } do { @@ -870,8 +866,8 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi) VP8_COMMON *const pc = & cpi->common; vp8_writer *const w = & cpi->bc; const MV_CONTEXT *mvc = pc->fc.mvc; -#if CONFIG_SEGMENTATION MACROBLOCKD *xd = &cpi->mb.e_mbd; +#if CONFIG_SEGMENTATION int left_id, above_id; int i; int sum; @@ -1136,6 +1132,8 @@ static void write_kfmodes(VP8_COMP *cpi) /* const */ MODE_INFO *m = c->mi; #if CONFIG_SEGMENTATION + int left_id, above_id; + int i; int index = 0; #endif int mb_row = -1; @@ -2063,9 +2061,7 @@ void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest, unsigned long *size) active_section = 1; #endif } -#if CONFIG_SEGMENTATION - //printf("%d\n",segment_cost); -#endif + vp8_stop_encode(bc); oh.first_partition_length_in_bytes = cpi->bc.pos; diff --git a/vp8/encoder/dct.c b/vp8/encoder/dct.c index 9584dc765..fd4c62cd4 100644 --- a/vp8/encoder/dct.c +++ b/vp8/encoder/dct.c @@ -16,7 +16,7 @@ - +#if CONFIG_T8X8 void vp8_short_fdct8x8_c(short *block, short *coefs, int pitch) { int j1, i, j, k; @@ -126,6 +126,7 @@ void vp8_short_fhaar2x2_c(short *input, short *output, int pitch) //pitch = 8 op1[8]=ip1[0] - ip1[1] - ip1[4] + ip1[8]; } +#endif void vp8_short_fdct4x4_c(short *input, short *output, int pitch) { int i; @@ -176,6 +177,11 @@ void vp8_short_fdct4x4_c(short *input, short *output, int pitch) } } +void vp8_short_fdct8x4_c(short *input, short *output, int pitch) +{ + vp8_short_fdct4x4_c(input, output, pitch); + vp8_short_fdct4x4_c(input + 4, output + 16, pitch); +} void vp8_short_walsh4x4_c(short *input, short *output, int pitch) { @@ -194,7 +200,7 @@ void vp8_short_walsh4x4_c(short *input, short *output, int pitch) c1 = ((ip[1] - ip[3])<<2); b1 = ((ip[0] - ip[2])<<2); - op[0] = a1 + d1+ (a1!=0); + op[0] = a1 + d1 + (a1!=0); #else a1 = ((ip[0] + ip[2])); d1 = ((ip[1] + ip[3])); @@ -246,9 +252,3 @@ void vp8_short_walsh4x4_c(short *input, short *output, int pitch) op++; } } - -void vp8_short_fdct8x4_c(short *input, short *output, int pitch) -{ - vp8_short_fdct4x4_c(input, output, pitch); - vp8_short_fdct4x4_c(input + 4, output + 16, pitch); -} diff --git a/vp8/encoder/encodeframe.c b/vp8/encoder/encodeframe.c index 4b76b23f2..ba5409754 100644 --- a/vp8/encoder/encodeframe.c +++ b/vp8/encoder/encodeframe.c @@ -573,6 +573,7 @@ void encode_mb_row(VP8_COMP *cpi, int recon_uv_stride = cm->yv12_fb[ref_fb_idx].uv_stride; int map_index = (mb_row * cpi->common.mb_cols); #if CONFIG_SEGMENTATION + int left_id, above_id; int sum; #endif #if CONFIG_MULTITHREAD @@ -585,6 +586,7 @@ void encode_mb_row(VP8_COMP *cpi, else last_row_current_mb_col = &rightmost_col; #endif + // reset above block coeffs xd->above_context = cm->above_context; @@ -664,14 +666,18 @@ void encode_mb_row(VP8_COMP *cpi, if (xd->segmentation_enabled) { // Code to set segment id in xd->mbmi.segment_id for current MB (with range checking) +#if CONFIG_T8X8 // Reset segment_id to 0 or 1 so that the default transform mode is 4x4 if (cpi->segmentation_map[map_index+mb_col] <= 3) xd->mode_info_context->mbmi.segment_id = cpi->segmentation_map[map_index+mb_col]&1; +#else + if (cpi->segmentation_map[map_index+mb_col] <= 3) + xd->mode_info_context->mbmi.segment_id = cpi->segmentation_map[map_index+mb_col]; +#endif else xd->mode_info_context->mbmi.segment_id = 0; vp8cx_mb_init_quantizer(cpi, x); - } else xd->mode_info_context->mbmi.segment_id = 0; // Set to Segment 0 by default @@ -819,6 +825,7 @@ void encode_mb_row(VP8_COMP *cpi, // this is to account for the border xd->mode_info_context++; x->partition_info++; + #if CONFIG_MULTITHREAD if ((cpi->b_multi_threaded != 0) && (mb_row == cm->mb_rows - 1)) { @@ -826,6 +833,7 @@ void encode_mb_row(VP8_COMP *cpi, } #endif } + void init_encode_frame_mb_context(VP8_COMP *cpi) { MACROBLOCK *const x = & cpi->mb; @@ -922,7 +930,7 @@ void vp8_encode_frame(VP8_COMP *cpi) TOKENEXTRA *tp = cpi->tok; #if CONFIG_SEGMENTATION int segment_counts[MAX_MB_SEGMENTS + SEEK_SEGID]; - int prob[3] = {255, 255, 255}; + int prob[3]; int new_cost, original_cost; #else int segment_counts[MAX_MB_SEGMENTS]; @@ -1479,20 +1487,18 @@ int vp8cx_encode_intra_macro_block(VP8_COMP *cpi, MACROBLOCK *x, TOKENEXTRA **t) x->e_mbd.mode_info_context->mbmi.segment_id |= (vp8_8x8_selection_intra(x) << 1); #endif vp8_encode_intra16x16mby(IF_RTCD(&cpi->rtcd), x); - - vp8_encode_intra16x16mbuv(IF_RTCD(&cpi->rtcd), x); - sum_intra_stats(cpi, x); - vp8_tokenize_mb(cpi, &x->e_mbd, t); + } + vp8_encode_intra16x16mbuv(IF_RTCD(&cpi->rtcd), x); + sum_intra_stats(cpi, x); + vp8_tokenize_mb(cpi, &x->e_mbd, t); #if CONFIG_T8X8 if( x->e_mbd.mode_info_context->mbmi.segment_id >=2) cpi->t8x8_count++; else cpi->t4x4_count++; #endif - } return rate; } - #ifdef SPEEDSTATS extern int cnt_pm; #endif @@ -1568,7 +1574,7 @@ int vp8cx_encode_inter_macroblock cpi->last_mb_distortion = distortion; #endif - // MB level adjustment to quantizer setup + // MB level adjutment to quantizer setup if (xd->segmentation_enabled) { // If cyclic update enabled diff --git a/vp8/encoder/encodemb.c b/vp8/encoder/encodemb.c index 00a19bd88..408a5956e 100644 --- a/vp8/encoder/encodemb.c +++ b/vp8/encoder/encodemb.c @@ -122,6 +122,7 @@ static void build_dcblock(MACROBLOCK *x) src_diff_ptr[i] = x->coeff[i * 16]; } } +#if CONFIG_T8X8 void vp8_build_dcblock_8x8(MACROBLOCK *x) { short *src_diff_ptr = &x->src_diff[384]; @@ -135,7 +136,7 @@ void vp8_build_dcblock_8x8(MACROBLOCK *x) src_diff_ptr[4] = x->coeff[8 * 16]; src_diff_ptr[8] = x->coeff[12 * 16]; } - +#endif void vp8_transform_mbuv(MACROBLOCK *x) { int i; diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c index c857704fc..3adc13689 100644 --- a/vp8/encoder/onyx_if.c +++ b/vp8/encoder/onyx_if.c @@ -46,8 +46,6 @@ #define RTCD(x) NULL #endif -#define OUTPUT_YUV_REC - extern void vp8cx_pick_filter_level_fast(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi); extern void vp8cx_set_alt_lf_level(VP8_COMP *cpi, int filt_val); extern void vp8cx_pick_filter_level(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi); @@ -113,7 +111,7 @@ FILE *yuv_rec_file; #if 0 FILE *framepsnr; -FILE ikf_list; +FILE *kf_list; FILE *keyfile; #endif @@ -139,6 +137,7 @@ unsigned int cnt_ef = 0; extern unsigned __int64 Sectionbits[500]; #endif #ifdef MODE_STATS +extern unsigned __int64 Sectionbits[50]; extern int y_modes[5] ; extern int uv_modes[4] ; extern int b_modes[10] ; diff --git a/vp8/encoder/onyx_int.h b/vp8/encoder/onyx_int.h index 81e2ebcac..a27822da6 100644 --- a/vp8/encoder/onyx_int.h +++ b/vp8/encoder/onyx_int.h @@ -32,15 +32,12 @@ #include "lookahead.h" //#define SPEEDSTATS 1 -#define MODE_STATS 1 -//#define ENC_DEBUG - #define MIN_GF_INTERVAL 4 #define DEFAULT_GF_INTERVAL 7 #define KEY_FRAME_CONTEXT 5 -#define MAX_LAG_BUFFERS (CONFIG_REALTIME_ONLY? 1 : 25)//1:25 +#define MAX_LAG_BUFFERS (CONFIG_REALTIME_ONLY? 1 : 25) #define AF_THRESH 25 #define AF_THRESH2 100 @@ -477,8 +474,10 @@ typedef struct VP8_COMP int gf_update_recommended; int skip_true_count; int skip_false_count; - int t4x4_count; - int t8x8_count; +#if CONFIG_T8X8 + int t4x4_count; + int t8x8_count; +#endif unsigned char *segmentation_map; signed char segment_feature_data[MB_LVL_MAX][MAX_MB_SEGMENTS]; // Segment data (can be deltas or absolute values) @@ -646,7 +645,7 @@ int rd_cost_intra_mb(MACROBLOCKD *x); void vp8_tokenize_mb(VP8_COMP *, MACROBLOCKD *, TOKENEXTRA **); void vp8_set_speed_features(VP8_COMP *cpi); -extern void vp8_write_yuv_frame(const char *name, YV12_BUFFER_CONFIG *s); + #if CONFIG_DEBUG #define CHECK_MEM_ERROR(lval,expr) do {\ lval = (expr); \ diff --git a/vp8/encoder/quantize.c b/vp8/encoder/quantize.c index f109135b7..328eabbf9 100644 --- a/vp8/encoder/quantize.c +++ b/vp8/encoder/quantize.c @@ -81,10 +81,11 @@ void vp8_fast_quantize_b_c(BLOCK *b, BLOCKD *d) short *qcoeff_ptr = d->qcoeff; short *dqcoeff_ptr = d->dqcoeff; short *dequant_ptr = d->dequant; +#if CONFIG_T8X8 vpx_memset(qcoeff_ptr, 0, 32); vpx_memset(dqcoeff_ptr, 0, 32); - +#endif eob = -1; for (i = 0; i < 16; i++) { @@ -1325,3 +1326,4 @@ void vp8_set_quantizer(struct VP8_COMP *cpi, int Q) vp8cx_init_quantizer(cpi); } + diff --git a/vp8/encoder/quantize.h b/vp8/encoder/quantize.h index a6a6078b0..1a2bad667 100644 --- a/vp8/encoder/quantize.h +++ b/vp8/encoder/quantize.h @@ -45,7 +45,7 @@ extern prototype_quantize_block_pair(vp8_quantize_quantb_pair); #define vp8_quantize_fastquantb vp8_fast_quantize_b_c #endif extern prototype_quantize_block(vp8_quantize_fastquantb); - +#if CONFIG_T8X8 #ifndef vp8_quantize_quantb_8x8 #define vp8_quantize_quantb_8x8 vp8_regular_quantize_b_8x8 #endif @@ -65,7 +65,7 @@ extern prototype_quantize_block(vp8_quantize_quantb_2x2); #define vp8_quantize_fastquantb_2x2 vp8_fast_quantize_b_2x2_c #endif extern prototype_quantize_block(vp8_quantize_fastquantb_2x2); - +#endif #ifndef vp8_quantize_fastquantb_pair #define vp8_quantize_fastquantb_pair vp8_fast_quantize_b_pair_c @@ -77,10 +77,12 @@ typedef struct prototype_quantize_block(*quantb); prototype_quantize_block_pair(*quantb_pair); prototype_quantize_block(*fastquantb); +#if CONFIG_T8X8 prototype_quantize_block(*quantb_8x8); prototype_quantize_block(*fastquantb_8x8); prototype_quantize_block(*quantb_2x2); prototype_quantize_block(*fastquantb_2x2); +#endif prototype_quantize_block_pair(*fastquantb_pair); } vp8_quantize_rtcd_vtable_t; @@ -106,9 +108,10 @@ extern prototype_quantize_mb(vp8_quantize_mby); #endif extern void vp8_strict_quantize_b(BLOCK *b,BLOCKD *d); +#if CONFIG_T8X8 extern void vp8_strict_quantize_b_8x8(BLOCK *b,BLOCKD *d); extern void vp8_strict_quantize_b_2x2(BLOCK *b,BLOCKD *d); - +#endif struct VP8_COMP; extern void vp8_set_quantizer(struct VP8_COMP *cpi, int Q); extern void vp8cx_frame_init_quantizer(struct VP8_COMP *cpi); diff --git a/vp8/encoder/rdopt.c b/vp8/encoder/rdopt.c index 5e61271a4..3d77bb35a 100644 --- a/vp8/encoder/rdopt.c +++ b/vp8/encoder/rdopt.c @@ -1051,7 +1051,6 @@ static unsigned int vp8_encode_inter_mb_segment(MACROBLOCK *x, int const *labels } - static const unsigned int segmentation_to_sseshift[4] = {3, 3, 2, 0}; diff --git a/vp8/encoder/tokenize.c b/vp8/encoder/tokenize.c index 62581b87f..e1e124844 100644 --- a/vp8/encoder/tokenize.c +++ b/vp8/encoder/tokenize.c @@ -11,7 +11,6 @@ #include #include -#include #include #include #include "onyx_int.h" @@ -598,7 +597,6 @@ void print_context_counters() # define Comma( X) (X? ",":"") - type = 0; do @@ -933,7 +931,6 @@ static __inline void stuff1st_order_b *a = *l = pt; } - static __inline void stuff1st_order_buv ( diff --git a/vp8/encoder/tokenize.h b/vp8/encoder/tokenize.h index d7ef529b8..cd122f19c 100644 --- a/vp8/encoder/tokenize.h +++ b/vp8/encoder/tokenize.h @@ -38,9 +38,10 @@ void init_context_counters(); void print_context_counters(); extern _int64 context_counters[BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS]; +#if CONFIG_T8X8 extern _int64 context_counters_8x8[BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS]; #endif - +#endif extern const int *vp8_dct_value_cost_ptr; /* TODO: The Token field should be broken out into a separate char array to * improve cache locality, since it's needed for costing when the rest of the -- cgit v1.2.3