summaryrefslogtreecommitdiff
path: root/vp8
diff options
context:
space:
mode:
Diffstat (limited to 'vp8')
-rw-r--r--vp8/common/blockd.h16
-rw-r--r--vp8/common/coefupdateprobs.h8
-rw-r--r--vp8/common/defaultcoefcounts.c2
-rw-r--r--vp8/common/entropy.c17
-rw-r--r--vp8/common/entropy.h7
-rw-r--r--vp8/common/idct.h1
-rw-r--r--vp8/common/idctllm.c5
-rw-r--r--vp8/common/onyx.h1
-rw-r--r--vp8/common/recon.c5
-rw-r--r--vp8/common/reconinter.c4
-rw-r--r--vp8/decoder/decodemv.c7
-rw-r--r--vp8/decoder/decodframe.c30
-rw-r--r--vp8/decoder/dequantize.c11
-rw-r--r--vp8/decoder/dequantize.h2
-rw-r--r--vp8/decoder/detokenize.c19
-rw-r--r--vp8/decoder/idct_blk.c29
-rw-r--r--vp8/decoder/onyxd_if.c5
-rw-r--r--vp8/decoder/onyxd_int.h10
-rw-r--r--vp8/encoder/bitstream.c12
-rw-r--r--vp8/encoder/dct.c16
-rw-r--r--vp8/encoder/encodeframe.c24
-rw-r--r--vp8/encoder/encodemb.c3
-rw-r--r--vp8/encoder/onyx_if.c5
-rw-r--r--vp8/encoder/onyx_int.h13
-rw-r--r--vp8/encoder/quantize.c4
-rw-r--r--vp8/encoder/quantize.h9
-rw-r--r--vp8/encoder/rdopt.c1
-rw-r--r--vp8/encoder/tokenize.c3
-rw-r--r--vp8/encoder/tokenize.h3
29 files changed, 157 insertions, 115 deletions
diff --git a/vp8/common/blockd.h b/vp8/common/blockd.h
index 6482b2a89..d2ef84256 100644
--- a/vp8/common/blockd.h
+++ b/vp8/common/blockd.h
@@ -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
diff --git a/vp8/common/coefupdateprobs.h b/vp8/common/coefupdateprobs.h
index 029941440..6fe5fcc6f 100644
--- a/vp8/common/coefupdateprobs.h
+++ b/vp8/common/coefupdateprobs.h
@@ -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
diff --git a/vp8/common/defaultcoefcounts.c b/vp8/common/defaultcoefcounts.c
index a0258bd03..34d1fb1d5 100644
--- a/vp8/common/defaultcoefcounts.c
+++ b/vp8/common/defaultcoefcounts.c
@@ -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
diff --git a/vp8/common/entropy.c b/vp8/common/entropy.c
index 58328ceb5..ca37aab22 100644
--- a/vp8/common/entropy.c
+++ b/vp8/common/entropy.c
@@ -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();
diff --git a/vp8/common/entropy.h b/vp8/common/entropy.h
index 786452712..d3e841c3e 100644
--- a/vp8/common/entropy.h
+++ b/vp8/common/entropy.h
@@ -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
diff --git a/vp8/common/idct.h b/vp8/common/idct.h
index aa1fb5e42..d1890b9e5 100644
--- a/vp8/common/idct.h
+++ b/vp8/common/idct.h
@@ -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
diff --git a/vp8/common/idctllm.c b/vp8/common/idctllm.c
index 9d3e30413..4f3a01b1b 100644
--- a/vp8/common/idctllm.c
+++ b/vp8/common/idctllm.c
@@ -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++)
diff --git a/vp8/common/onyx.h b/vp8/common/onyx.h
index b9ef26576..545798ac7 100644
--- a/vp8/common/onyx.h
+++ b/vp8/common/onyx.h
@@ -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
diff --git a/vp8/common/recon.c b/vp8/common/recon.c
index c82639645..d72d6e410 100644
--- a/vp8/common/recon.c
+++ b/vp8/common/recon.c
@@ -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
-
}
diff --git a/vp8/common/reconinter.c b/vp8/common/reconinter.c
index fb1e90939..3b0405ca1 100644
--- a/vp8/common/reconinter.c
+++ b/vp8/common/reconinter.c
@@ -464,3 +464,7 @@ void vp8_build_uvmvs(MACROBLOCKD *x, int fullpixel)
}
}
}
+
+
+
+
diff --git a/vp8/decoder/decodemv.c b/vp8/decoder/decodemv.c
index 815112ed3..f23fd00b4 100644
--- a/vp8/decoder/decodemv.c
+++ b/vp8/decoder/decodemv.c
@@ -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
diff --git a/vp8/decoder/decodframe.c b/vp8/decoder/decodframe.c
index 09fb6d0df..dbfe909ae 100644
--- a/vp8/decoder/decodframe.c
+++ b/vp8/decoder/decodframe.c
@@ -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;
diff --git a/vp8/decoder/dequantize.c b/vp8/decoder/dequantize.c
index 0e17cf9af..956acba8f 100644
--- a/vp8/decoder/dequantize.c
+++ b/vp8/decoder/dequantize.c
@@ -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++)
diff --git a/vp8/decoder/dequantize.h b/vp8/decoder/dequantize.h
index 15d5bbe91..5ae6f9619 100644
--- a/vp8/decoder/dequantize.h
+++ b/vp8/decoder/dequantize.h
@@ -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, \
diff --git a/vp8/decoder/detokenize.c b/vp8/decoder/detokenize.c
index 6d78e6022..6121490eb 100644
--- a/vp8/decoder/detokenize.c
+++ b/vp8/decoder/detokenize.c
@@ -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)
diff --git a/vp8/decoder/idct_blk.c b/vp8/decoder/idct_blk.c
index 44a223157..2015d5255 100644
--- a/vp8/decoder/idct_blk.c
+++ b/vp8/decoder/idct_blk.c
@@ -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;
diff --git a/vp8/decoder/onyxd_if.c b/vp8/decoder/onyxd_if.c
index 1e2c3138f..b4d78d656 100644
--- a/vp8/decoder/onyxd_if.c
+++ b/vp8/decoder/onyxd_if.c
@@ -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++;
diff --git a/vp8/decoder/onyxd_int.h b/vp8/decoder/onyxd_int.h
index c31623dfa..6309915ab 100644
--- a/vp8/decoder/onyxd_int.h
+++ b/vp8/decoder/onyxd_int.h
@@ -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;
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 <math.h>
#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
#include <assert.h>
#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