Commit 8c31484e authored by Yaowu Xu's avatar Yaowu Xu

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
parent 1c24eb2b
......@@ -94,14 +94,14 @@ typedef enum
MB_MODE_COUNT
} MB_PREDICTION_MODE;
// Macroblock level features
/* Macroblock level features */
typedef enum
{
MB_LVL_ALT_Q = 0, // Use alternate Quantizer ....
MB_LVL_ALT_LF = 1, // Use alternate loop filter value...
MB_LVL_MAX = 2, // Number of MB level features supported
} MB_LVL_FEATURES;
MB_LVL_ALT_Q = 0, /* Use alternate Quantizer .... */
MB_LVL_ALT_LF = 1, /* Use alternate loop filter value... */
MB_LVL_MAX = 2 /* Number of MB level features supported */
} MB_LVL_FEATURES;
/* Segment Feature Masks */
#define SEGMENT_ALTQ 0x01
......@@ -163,8 +163,9 @@ typedef struct
MB_PREDICTION_MODE mode, uv_mode;
MV_REFERENCE_FRAME ref_frame;
int_mv mv;
#if CONFIG_SEGMENTATION
unsigned char segment_flag;
#endif
unsigned char partitioning;
unsigned char mb_skip_coeff; /* does this mb has coefficients at all, 1=no coefficients, 0=need decode tokens */
unsigned char need_to_clamp_mvs;
......@@ -237,11 +238,11 @@ typedef struct
/* 0 (do not update) 1 (update) the macroblock segmentation feature data. */
unsigned char mb_segement_abs_delta;
unsigned char temporal_update;
/* Per frame flags that define which MB level features (such as quantizer or loop filter level) */
/* are enabled and when enabled the proabilities used to decode the per MB flags in MB_MODE_INFO */
#if CONFIG_SEGMENTATION
vp8_prob mb_segment_tree_probs[MB_FEATURE_TREE_PROBS + 3]; // Probability Tree used to code Segment number
unsigned char temporal_update;
#else
vp8_prob mb_segment_tree_probs[MB_FEATURE_TREE_PROBS];
#endif
......@@ -275,7 +276,6 @@ typedef struct
void *current_bc;
int corrupted;
#if CONFIG_RUNTIME_CPU_DETECT
......
......@@ -183,8 +183,11 @@ const vp8_prob vp8_coef_update_probs [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTE
},
},
};
const vp8_prob vp8_coef_update_probs_8x8 [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES] =
#if CONFIG_T8X8
const vp8_prob vp8_coef_update_probs_8x8 [BLOCK_TYPES]
[COEF_BANDS]
[PREV_COEF_CONTEXTS]
[ENTROPY_NODES] =
{
{
{
......@@ -356,3 +359,4 @@ const vp8_prob vp8_coef_update_probs_8x8 [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_C
},
};
#endif
\ No newline at end of file
......@@ -225,6 +225,7 @@ const unsigned int vp8_default_coef_counts[BLOCK_TYPES]
};
#if CONFIG_T8X8
const unsigned int vp8_default_coef_counts_8x8[BLOCK_TYPES]
[COEF_BANDS]
[PREV_COEF_CONTEXTS]
......@@ -400,3 +401,4 @@ const unsigned int vp8_default_coef_counts_8x8[BLOCK_TYPES]
}
}
};
#endif
\ No newline at end of file
......@@ -120,14 +120,21 @@ static const Prob Pcat2[] = { 165, 145};
static const Prob Pcat3[] = { 173, 148, 140};
static const Prob Pcat4[] = { 176, 155, 140, 135};
static const Prob Pcat5[] = { 180, 157, 141, 134, 130};
#if CONFIG_EXTEND_QRANGE
static const Prob Pcat6[] =
{ 254, 254, 252, 249, 243, 230, 196, 177, 153, 140, 133, 130, 129};
#else
static const Prob Pcat6[] =
{ 254, 254, 243, 230, 196, 177, 153, 140, 133, 130, 129};
#endif
static vp8_tree_index cat1[2], cat2[4], cat3[6], cat4[8], cat5[10], cat6[22];
void vp8_init_scan_order_mask()
{
int i;
for (i = 0; i < 16; i++)
{
vp8_default_zig_zag_mask[vp8_default_zig_zag1d[i]] = 1 << i;
......@@ -160,7 +167,11 @@ static void init_bit_trees()
init_bit_tree(cat3, 3);
init_bit_tree(cat4, 4);
init_bit_tree(cat5, 5);
#if CONFIG_EXTEND_QRANGE
init_bit_tree(cat6, 13);
#else
init_bit_tree(cat6, 11);
#endif
}
vp8_extra_bit_struct vp8_extra_bits[12] =
......@@ -175,7 +186,11 @@ vp8_extra_bit_struct vp8_extra_bits[12] =
{ cat3, Pcat3, 3, 11},
{ cat4, Pcat4, 4, 19},
{ cat5, Pcat5, 5, 35},
#if CONFIG_EXTEND_QRANGE
{ cat6, Pcat6, 13, 67},
#else
{ cat6, Pcat6, 11, 67},
#endif
{ 0, 0, 0, 0}
};
#include "defaultcoefcounts.h"
......@@ -183,6 +198,7 @@ vp8_extra_bit_struct vp8_extra_bits[12] =
void vp8_default_coef_probs(VP8_COMMON *pc)
{
int h = 0;
do
{
int i = 0;
......@@ -234,6 +250,7 @@ void vp8_default_coef_probs(VP8_COMMON *pc)
#endif
}
void vp8_coef_tree_initialize()
{
init_bit_trees();
......
......@@ -50,8 +50,11 @@ extern vp8_extra_bit_struct vp8_extra_bits[12]; /* indexed by token value */
#define PROB_UPDATE_BASELINE_COST 7
#define MAX_PROB 255
#if CONFIG_EXTEND_QRANGE
#define DCT_MAX_VALUE 8192
#else
#define DCT_MAX_VALUE 2048
#endif
/* Coefficients are predicted via a 3-dimensional probability table. */
......@@ -104,6 +107,6 @@ extern DECLARE_ALIGNED(64, const int, vp8_default_zig_zag1d_8x8[64]);
extern short vp8_default_zig_zag_mask_8x8[64];//int64_t
#endif
extern const int vp8_mb_feature_data_bits[MB_LVL_MAX];
void vp8_coef_tree_initialize(void);
void vp8_coef_tree_initialize(void);
#endif
......@@ -74,6 +74,7 @@ extern prototype_idct(vp8_idct_idct16);
#endif
extern prototype_idct_scalar_add(vp8_idct_idct1_scalar_add);
#ifndef vp8_idct_iwalsh1
#define vp8_idct_iwalsh1 vp8_short_inv_walsh4x4_1_c
#endif
......
......@@ -203,7 +203,6 @@ void vp8_short_inv_walsh4x4_c(short *input, short *output)
ip += 4;
op += 4;
}
//printf("here2\n");
}
void vp8_short_inv_walsh4x4_1_c(short *input, short *output)
......@@ -213,9 +212,9 @@ void vp8_short_inv_walsh4x4_1_c(short *input, short *output)
short *op = output;
#if !CONFIG_EXTEND_QRANGE
a1 = ((input[0] + 3) >> 3);
a1 = (input[0] + 3 )>> 3;
#else
a1 = ((input[0] + 1) >> 2);
a1 = (input[0] + 1 )>> 2;
#endif
for (i = 0; i < 4; i++)
......
......@@ -126,7 +126,6 @@ extern "C"
//(5)=Two Pass - Second Pass Best. The encoder uses the statistics that were generated in the first
// encoding pass to create the compressed output using the highest possible quality, and taking a
// longer amount of time to encode.. ( speed setting ignored )
int Mode; //
// Key Framing Operations
......
......@@ -12,7 +12,7 @@
#include "vpx_ports/config.h"
#include "recon.h"
#include "blockd.h"
#include <stdio.h>
void vp8_recon_b_c
(
unsigned char *pred_ptr,
......@@ -133,7 +133,6 @@ void vp8_recon_mby_c(const vp8_recon_rtcd_vtable_t *rtcd, MACROBLOCKD *x)
RECON_INVOKE(rtcd, recon4)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
}
#endif
}
void vp8_recon_mb_c(const vp8_recon_rtcd_vtable_t *rtcd, MACROBLOCKD *x)
......@@ -172,7 +171,6 @@ void vp8_recon_mb_c(const vp8_recon_rtcd_vtable_t *rtcd, MACROBLOCKD *x)
RECON_INVOKE(rtcd, recon4)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
}
for (i = 16; i < 24; i += 2)
{
BLOCKD *b = &x->block[i];
......@@ -180,5 +178,4 @@ void vp8_recon_mb_c(const vp8_recon_rtcd_vtable_t *rtcd, MACROBLOCKD *x)
RECON_INVOKE(rtcd, recon2)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
}
#endif
}
......@@ -464,3 +464,7 @@ void vp8_build_uvmvs(MACROBLOCKD *x, int fullpixel)
}
}
}
......@@ -18,8 +18,6 @@
#if CONFIG_DEBUG
#include <assert.h>
#endif
extern int frame_count;
static int vp8_read_bmode(vp8_reader *bc, const vp8_prob *p)
{
const int i = vp8_treed_read(bc, vp8_bmode_tree, p);
......@@ -62,7 +60,6 @@ static void vp8_read_mb_features(vp8_reader *r, MB_MODE_INFO *mi, MACROBLOCKD *x
else
mi->segment_id = (unsigned char)(vp8_read(r, x->mb_segment_tree_probs[1]));
}
//printf("vp8_read_mb_features Segment = %d of frame %d\n", mi->segment_id, frame_count);
}
static void vp8_kfread_modes(VP8D_COMP *pbi, MODE_INFO *m, int mb_row, int mb_col)
......@@ -80,7 +77,6 @@ static void vp8_kfread_modes(VP8D_COMP *pbi, MODE_INFO *m, int mb_row, int mb_co
if (pbi->mb.update_mb_segmentation_map)
vp8_read_mb_features(bc, &m->mbmi, &pbi->mb);
//printf("vp8_kfread_modes segment = %d\n", m->mbmi.segment_id);
/* Read the macroblock coeff skip flag if this feature is in use, else default to 0 */
if (pbi->common.mb_no_coeff_skip)
......@@ -316,14 +312,12 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
{
mbmi->segment_id = pbi->segmentation_map[index];
mbmi->segment_flag = 0;
//printf("vp8_read_mb_modes_mv Temporal Update if %d\n", mbmi->segment_id);
}
else
{
vp8_read_mb_features(bc, &mi->mbmi, &pbi->mb);
mbmi->segment_flag = 1;
pbi->segmentation_map[index] = mbmi->segment_id;
//printf("vp8_read_mb_modes_mv Temporal Update else %d\n", mbmi->segment_id);
}
}
......@@ -331,7 +325,6 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
{
vp8_read_mb_features(bc, &mi->mbmi, &pbi->mb);
pbi->segmentation_map[index] = mbmi->segment_id;
//printf("vp8_read_mb_modes_mv Not Temporal Update %d\n", mbmi->segment_id);
}
index++;
#else
......
......@@ -241,13 +241,14 @@ static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd,
if (eobtotal == 0 && mode != B_PRED && mode != SPLITMV)
{
/* Special case: Force the loopfilter to skip when eobtotal and
* mb_skip_coeff are zero.
* */
* mb_skip_coeff are zero.
* */
xd->mode_info_context->mbmi.mb_skip_coeff = 1;
skip_recon_mb(pbi, xd);
return;
}
if (xd->segmentation_enabled)
mb_init_dequantizer(pbi, xd);
......@@ -259,7 +260,7 @@ static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd,
if (mode != B_PRED)
{
RECON_INVOKE(&pbi->common.rtcd.recon,
build_intra_predictors_mby)(xd);
build_intra_predictors_mby)(xd);
} else {
vp8_intra_prediction_down_copy(xd);
}
......@@ -275,8 +276,8 @@ static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd,
vp8dx_bool_error(xd->current_bc)))
{
/* MB with corrupt residuals or corrupt mode/motion vectors.
* Better to use the predictor as reconstruction.
*/
* Better to use the predictor as reconstruction.
*/
vpx_memset(xd->qcoeff, 0, sizeof(xd->qcoeff));
vp8_conceal_corrupt_mb(xd);
return;
......@@ -290,7 +291,7 @@ static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd,
{
BLOCKD *b = &xd->block[i];
RECON_INVOKE(RTCD_VTABLE(recon), intra4x4_predict)
(b, b->bmi.as_mode, b->predictor);
(b, b->bmi.as_mode, b->predictor);
if (xd->eobs[i] > 1)
{
......@@ -306,6 +307,7 @@ static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd,
((int *)b->qcoeff)[0] = 0;
}
}
}
else if (mode == SPLITMV)
{
......@@ -366,8 +368,6 @@ static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd,
else
#endif
{
DEQUANT_INVOKE(&pbi->dequant, block)(b);
if (xd->eobs[24] > 1)
{
IDCT_INVOKE(RTCD_VTABLE(idct), iwalsh16)(&b->dqcoeff[0], b->diff);
......@@ -390,7 +390,6 @@ static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd,
(xd->qcoeff, xd->block[0].dequant,
xd->predictor, xd->dst.y_buffer,
xd->dst.y_stride, xd->eobs, xd->block[24].diff);
}
}
#if CONFIG_T8X8
if(xd->mode_info_context->mbmi.segment_id >= 2)
......@@ -403,15 +402,13 @@ static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd,
}
else
#endif
{
DEQUANT_INVOKE (&pbi->dequant, idct_add_uv_block)
(xd->qcoeff+16*16, xd->block[16].dequant,
xd->predictor+16*16, xd->dst.u_buffer, xd->dst.v_buffer,
xd->dst.uv_stride, xd->eobs+16);
}
DEQUANT_INVOKE (&pbi->dequant, idct_add_uv_block)
(xd->qcoeff+16*16, xd->block[16].dequant,
xd->predictor+16*16, xd->dst.u_buffer, xd->dst.v_buffer,
xd->dst.uv_stride, xd->eobs+16);
}
}
static int get_delta_q(vp8_reader *bc, int prev, int *q_update)
......@@ -749,6 +746,7 @@ int vp8_decode_frame(VP8D_COMP *pbi)
const unsigned char *data = (const unsigned char *)pbi->Source;
const unsigned char *data_end = data + pbi->source_sz;
ptrdiff_t first_partition_length_in_bytes;
int mb_row;
int i, j, k, l;
const int *const mb_feature_data_bits = vp8_mb_feature_data_bits;
......
......@@ -36,7 +36,7 @@ void vp8_dequantize_b_c(BLOCKD *d)
for (i = 0; i < 16; i++)
{
DQ[i] = Q[i] * DQC[i];
DQ[i] = Q[i] * DQC[i];
}
}
......@@ -50,12 +50,12 @@ void vp8_dequant_idct_add_c(short *input, short *dq, unsigned char *pred,
for (i = 0; i < 16; i++)
{
input[i] = dq[i] * input[i];
input[i] = dq[i] * input[i];
}
/* the idct halves ( >> 1) the pitch */
vp8_short_idct4x4llm_c(input, output, 4 << 1);
vpx_memset(input, 0, 32);
for (r = 0; r < 4; r++)
......@@ -88,17 +88,18 @@ void vp8_dequant_dc_idct_add_c(short *input, short *dq, unsigned char *pred,
short *diff_ptr = output;
int r, c;
input[0] = (short)Dc;
for (i = 1; i < 16; i++)
{
input[i] = dq[i] * input[i];
input[i] = dq[i] * input[i];
}
/* the idct halves ( >> 1) the pitch */
vp8_short_idct4x4llm_c(input, output, 4 << 1);
vpx_memset(input, 0, 32);
for (r = 0; r < 4; r++)
{
for (c = 0; c < 4; c++)
......
......@@ -42,7 +42,7 @@
unsigned char *pre, unsigned char *dst_u, \
unsigned char *dst_v, int stride, char *eobs)
#if 1//CONFIG_T8X8
#if CONFIG_T8X8
#define prototype_dequant_dc_idct_add_y_block_8x8(sym) \
void sym(short *q, short *dq, \
unsigned char *pre, unsigned char *dst, \
......
......@@ -59,7 +59,7 @@ typedef struct
UINT8 Probs[14];
} TOKENEXTRABITS;
*/
#if CONFIG_EXTEND_QRANGE
DECLARE_ALIGNED(16, static const TOKENEXTRABITS, vp8d_token_extra_bits2[MAX_ENTROPY_TOKENS]) =
{
{ 0, -1, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, /* ZERO_TOKEN */
......@@ -75,6 +75,23 @@ DECLARE_ALIGNED(16, static const TOKENEXTRABITS, vp8d_token_extra_bits2[MAX_ENTR
{ 67, 12, { 129, 130, 133, 140, 153, 177, 196, 230, 243, 249, 252, 254, 254, 0 } }, /* DCT_VAL_CATEGORY6 */
{ 0, -1, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, /* EOB TOKEN */
};
#else
DECLARE_ALIGNED(16, static const TOKENEXTRABITS, vp8d_token_extra_bits2[MAX_ENTROPY_TOKENS]) =
{
{ 0, -1, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, /* ZERO_TOKEN */
{ 1, 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, /* ONE_TOKEN */
{ 2, 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, /* TWO_TOKEN */
{ 3, 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, /* THREE_TOKEN */
{ 4, 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, /* FOUR_TOKEN */
{ 5, 0, { 159, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, /* DCT_VAL_CATEGORY1 */
{ 7, 1, { 145, 165, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, /* DCT_VAL_CATEGORY2 */
{ 11, 2, { 140, 148, 173, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, /* DCT_VAL_CATEGORY3 */
{ 19, 3, { 135, 140, 155, 176, 0, 0, 0, 0, 0, 0, 0, 0 } }, /* DCT_VAL_CATEGORY4 */
{ 35, 4, { 130, 134, 141, 157, 180, 0, 0, 0, 0, 0, 0, 0 } }, /* DCT_VAL_CATEGORY5 */
{ 67, 10, { 129, 130, 133, 140, 153, 177, 196, 230, 243, 254, 254, 0 } }, /* DCT_VAL_CATEGORY6 */
{ 0, -1, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, /* EOB TOKEN */
};
#endif
void vp8_reset_mb_tokens_context(MACROBLOCKD *x)
......
......@@ -30,13 +30,10 @@ void vp8_dequant_dc_idct_add_y_block_c
{
for (j = 0; j < 4; j++)
{
if (*eobs++ <= 1)
{
vp8_dc_only_idct_add_c (dc[0], pre, dst, 16, stride);
}
else
if (*eobs++ > 1)
vp8_dequant_dc_idct_add_c (q, dq, pre, dst, 16, stride, dc[0]);
else
vp8_dc_only_idct_add_c (dc[0], pre, dst, 16, stride);
q += 16;
pre += 4;
......@@ -59,13 +56,14 @@ void vp8_dequant_idct_add_y_block_c
{
for (j = 0; j < 4; j++)
{
if (*eobs++ <= 1)
if (*eobs++ > 1)
vp8_dequant_idct_add_c (q, dq, pre, dst, 16, stride);
else
{
vp8_dc_only_idct_add_c (q[0]*dq[0], pre, dst, 16, stride);
((int *)q)[0] = 0;
}
else
vp8_dequant_idct_add_c (q, dq, pre, dst, 16, stride);
q += 16;
pre += 4;
dst += 4;
......@@ -86,13 +84,14 @@ void vp8_dequant_idct_add_uv_block_c
{
for (j = 0; j < 2; j++)
{
if (*eobs++ <= 1)
if (*eobs++ > 1)
vp8_dequant_idct_add_c (q, dq, pre, dstu, 8, stride);
else
{
vp8_dc_only_idct_add_c (q[0]*dq[0], pre, dstu, 8, stride);
((int *)q)[0] = 0;
}
else
vp8_dequant_idct_add_c (q, dq, pre, dstu, 8, stride);
q += 16;
pre += 4;
dstu += 4;
......@@ -106,14 +105,14 @@ void vp8_dequant_idct_add_uv_block_c
{
for (j = 0; j < 2; j++)
{
if (*eobs++ <= 1)
if (*eobs++ > 1)
vp8_dequant_idct_add_c (q, dq, pre, dstv, 8, stride);
else
{
vp8_dc_only_idct_add_c (q[0]*dq[0], pre, dstv, 8, stride);
((int *)q)[0] = 0;
}
else
vp8_dequant_idct_add_c (q, dq, pre, dstv, 8, stride);
q += 16;
pre += 4;
dstv += 4;
......
......@@ -157,7 +157,7 @@ void vp8dx_remove_decompressor(VP8D_PTR ptr)
if (!pbi)
return;
#if CONFIG_SEGMENTATION
// Delete sementation map
// Delete sementation map
if (pbi->segmentation_map != 0)
vpx_free(pbi->segmentation_map);
#endif
......@@ -514,8 +514,6 @@ int vp8dx_receive_compressed_data(VP8D_PTR ptr, unsigned long size, const unsign
{
/* Apply the loop filter if appropriate. */
vp8_loop_filter_frame(cm, &pbi->mb, cm->filter_level);
//vp8_print_yuv_rec_mb(cm, 9, 10);
cm->last_frame_type = cm->frame_type;
cm->last_filter_type = cm->filter_type;
......@@ -554,7 +552,6 @@ int vp8dx_receive_compressed_data(VP8D_PTR ptr, unsigned long size, const unsign
/*vp8_print_modes_and_motion_vectors( cm->mi, cm->mb_rows,cm->mb_cols, cm->current_video_frame);*/
//printf("Decoded frame (%d) %d\n", cm->show_frame, cm->current_video_frame);
if (cm->show_frame)
cm->current_video_frame++;
......
......@@ -44,13 +44,21 @@ typedef struct
int size;
} DATARATE;
#if CONFIG_EXTEND_QRANGE
typedef struct
{
INT16 min_val;
INT16 Length;
UINT8 Probs[14];
} TOKENEXTRABITS;
#else
typedef struct
{
INT16 min_val;
INT16 Length;
UINT8 Probs[12];
} TOKENEXTRABITS;
#endif
typedef struct
{
int const *scan;
......
......@@ -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;
......
......@@ -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);
}
......@@ -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;