summaryrefslogtreecommitdiff
path: root/vp8/decoder
diff options
context:
space:
mode:
Diffstat (limited to 'vp8/decoder')
-rw-r--r--vp8/decoder/decodemv.c50
-rw-r--r--vp8/decoder/decodframe.c13
-rw-r--r--vp8/decoder/detokenize.c24
-rw-r--r--vp8/decoder/generic/dsystemdependent.c9
-rw-r--r--vp8/decoder/onyxd_if.c9
-rw-r--r--vp8/decoder/onyxd_int.h9
6 files changed, 87 insertions, 27 deletions
diff --git a/vp8/decoder/decodemv.c b/vp8/decoder/decodemv.c
index ded5fa4eb..d67cb54fa 100644
--- a/vp8/decoder/decodemv.c
+++ b/vp8/decoder/decodemv.c
@@ -245,11 +245,13 @@ unsigned char vp8_mbsplit_fill_offset[4][16] = {
-
void vp8_mb_mode_mv_init(VP8D_COMP *pbi)
{
vp8_reader *const bc = & pbi->bc;
MV_CONTEXT *const mvc = pbi->common.fc.mvc;
+#if CONFIG_SEGMENTATION
+ MACROBLOCKD *const xd = & pbi->mb;
+#endif
pbi->prob_skip_false = 0;
if (pbi->common.mb_no_coeff_skip)
@@ -284,6 +286,9 @@ void vp8_mb_mode_mv_init(VP8D_COMP *pbi)
}
read_mvcontexts(bc, mvc);
+#if CONFIG_SEGMENTATION
+ xd->temporal_update = vp8_read_bit(bc);
+#endif
}
}
@@ -294,7 +299,11 @@ void vp8_read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
vp8_reader *const bc = & pbi->bc;
MV_CONTEXT *const mvc = pbi->common.fc.mvc;
const int mis = pbi->common.mode_info_stride;
-
+#if CONFIG_SEGMENTATION
+ MACROBLOCKD *const xd = & pbi->mb;
+ int sum;
+ int index = mb_row * pbi->common.mb_cols + mb_col;
+#endif
MV *const mv = & mbmi->mv.as_mv;
int mb_to_left_edge;
int mb_to_right_edge;
@@ -305,7 +314,6 @@ void vp8_read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
mb_to_bottom_edge = pbi->mb.mb_to_bottom_edge;
mb_to_top_edge -= LEFT_TOP_MARGIN;
mb_to_bottom_edge += RIGHT_BOTTOM_MARGIN;
-
mbmi->need_to_clamp_mvs = 0;
/* Distance of Mb to the various image edges.
* These specified to 8th pel as they are always compared to MV values that are in 1/8th pel units
@@ -320,7 +328,41 @@ void vp8_read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
/* If required read in new segmentation data for this MB */
if (pbi->mb.update_mb_segmentation_map)
- vp8_read_mb_features(bc, mbmi, &pbi->mb);
+ {
+#if CONFIG_SEGMENTATION
+ if (xd->temporal_update)
+ {
+ sum = 0;
+
+ if (mb_col != 0)
+ sum += (mi-1)->mbmi.segment_flag;
+ if (mb_row != 0)
+ sum += (mi-pbi->common.mb_cols)->mbmi.segment_flag;
+
+ if (vp8_read(bc, xd->mb_segment_tree_probs[3+sum]) == 0)
+ {
+ mbmi->segment_id = pbi->segmentation_map[index];
+ mbmi->segment_flag = 0;
+ }
+ else
+ {
+ vp8_read_mb_features(bc, &mi->mbmi, &pbi->mb);
+ mbmi->segment_flag = 1;
+ pbi->segmentation_map[index] = mbmi->segment_id;
+ }
+
+ }
+ else
+ {
+ vp8_read_mb_features(bc, &mi->mbmi, &pbi->mb);
+ pbi->segmentation_map[index] = mbmi->segment_id;
+ }
+ index++;
+#else
+ vp8_read_mb_features(bc, &mi->mbmi, &pbi->mb);
+#endif
+ }
+
/* Read the macroblock coeff skip flag if this feature is in use, else default to 0 */
if (pbi->common.mb_no_coeff_skip)
diff --git a/vp8/decoder/decodframe.c b/vp8/decoder/decodframe.c
index 5769100ec..323ab9a3f 100644
--- a/vp8/decoder/decodframe.c
+++ b/vp8/decoder/decodframe.c
@@ -575,7 +575,6 @@ int vp8_decode_frame(VP8D_COMP *pbi)
const unsigned char *data = (const unsigned char *)pbi->Source;
const unsigned char *const 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;
@@ -662,7 +661,6 @@ int vp8_decode_frame(VP8D_COMP *pbi)
/* Is segmentation enabled */
xd->segmentation_enabled = (unsigned char)vp8_read_bit(bc);
-
if (xd->segmentation_enabled)
{
/* Signal whether or not the segmentation map is being explicitly updated this frame. */
@@ -698,9 +696,12 @@ int vp8_decode_frame(VP8D_COMP *pbi)
{
/* Which macro block level features are enabled */
vpx_memset(xd->mb_segment_tree_probs, 255, sizeof(xd->mb_segment_tree_probs));
-
+#if CONFIG_SEGMENTATION
/* Read the probs used to decode the segment id for each macro block. */
+ for (i = 0; i < MB_FEATURE_TREE_PROBS+3; i++)
+#else
for (i = 0; i < MB_FEATURE_TREE_PROBS; i++)
+#endif
{
/* If not explicitly set value is defaulted to 255 by memset above */
if (vp8_read_bit(bc))
@@ -822,7 +823,6 @@ int vp8_decode_frame(VP8D_COMP *pbi)
fclose(z);
}
-
{
/* read coef probability tree */
@@ -845,6 +845,11 @@ int vp8_decode_frame(VP8D_COMP *pbi)
vpx_memcpy(&xd->pre, &pc->yv12_fb[pc->lst_fb_idx], sizeof(YV12_BUFFER_CONFIG));
vpx_memcpy(&xd->dst, &pc->yv12_fb[pc->new_fb_idx], sizeof(YV12_BUFFER_CONFIG));
+#if CONFIG_SEGMENTATION
+ // Create the encoder segmentation map and set all entries to 0
+ CHECK_MEM_ERROR(pbi->segmentation_map, vpx_calloc((pc->mb_rows * pc->mb_cols), 1));
+#endif
+
/* set up frame new frame for intra coded blocks */
#if CONFIG_MULTITHREAD
if (!(pbi->b_multithreaded_rd) || pc->multi_token_partition == ONE_PARTITION || !(pc->filter_level))
diff --git a/vp8/decoder/detokenize.c b/vp8/decoder/detokenize.c
index 83fa14d67..e4440f0f6 100644
--- a/vp8/decoder/detokenize.c
+++ b/vp8/decoder/detokenize.c
@@ -38,23 +38,23 @@ typedef struct
{
INT16 min_val;
INT16 Length;
- UINT8 Probs[12];
+ UINT8 Probs[14];
} TOKENEXTRABITS;
*/
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, 0, 0 } }, /* ZERO_TOKEN */
+ { 1, 0, { 0, 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, 0, 0 } }, /* TWO_TOKEN */
+ { 3, 0, { 0, 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, 0, 0 } }, /* FOUR_TOKEN */
+ { 5, 0, { 159, 0, 0, 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, 0, 0 } }, /* DCT_VAL_CATEGORY2 */
+ { 11, 2, { 140, 148, 173, 0, 0, 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, 0, 0 } }, /* DCT_VAL_CATEGORY4 */
+ { 35, 4, { 130, 134, 141, 157, 180, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, /* DCT_VAL_CATEGORY5 */
+ { 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 */
};
diff --git a/vp8/decoder/generic/dsystemdependent.c b/vp8/decoder/generic/dsystemdependent.c
index 2406deaaf..f76653231 100644
--- a/vp8/decoder/generic/dsystemdependent.c
+++ b/vp8/decoder/generic/dsystemdependent.c
@@ -33,7 +33,16 @@ void vp8_dmachine_specific_config(VP8D_COMP *pbi)
vp8_arch_x86_decode_init(pbi);
#endif
+
#if ARCH_ARM
vp8_arch_arm_decode_init(pbi);
#endif
+
+#if CONFIG_EXTEND_QRANGE
+ pbi->dequant.idct_add = vp8_dequant_idct_add_c;
+ pbi->dequant.dc_idct_add = vp8_dequant_dc_idct_add_c;
+ pbi->dequant.dc_idct_add_y_block = vp8_dequant_dc_idct_add_y_block_c;
+ pbi->dequant.idct_add_y_block = vp8_dequant_idct_add_y_block_c;
+ pbi->dequant.idct_add_uv_block = vp8_dequant_idct_add_uv_block_c;
+#endif
}
diff --git a/vp8/decoder/onyxd_if.c b/vp8/decoder/onyxd_if.c
index bfb00a531..0fc49ac79 100644
--- a/vp8/decoder/onyxd_if.c
+++ b/vp8/decoder/onyxd_if.c
@@ -87,7 +87,6 @@ void vp8dx_initialize()
}
}
-
VP8D_PTR vp8dx_create_decompressor(VP8D_CONFIG *oxcf)
{
VP8D_COMP *pbi = vpx_memalign(32, sizeof(VP8D_COMP));
@@ -137,13 +136,17 @@ VP8D_PTR vp8dx_create_decompressor(VP8D_CONFIG *oxcf)
return (VP8D_PTR) pbi;
}
-
void vp8dx_remove_decompressor(VP8D_PTR ptr)
{
VP8D_COMP *pbi = (VP8D_COMP *) ptr;
if (!pbi)
return;
+#if CONFIG_SEGMENTATION
+ // Delete sementation map
+ if (pbi->segmentation_map != 0)
+ vpx_free(pbi->segmentation_map);
+#endif
#if CONFIG_MULTITHREAD
if (pbi->b_multithreaded_rd)
@@ -462,6 +465,8 @@ int vp8dx_receive_compressed_data(VP8D_PTR ptr, unsigned long size, const unsign
#if 0
/* DEBUG code */
/*vp8_recon_write_yuv_frame("recon.yuv", cm->frame_to_show);*/
+ vp8_recon_write_yuv_frame("recon.yuv", cm->frame_to_show);
+
if (cm->current_video_frame <= 5)
write_dx_frame_to_file(cm->frame_to_show, cm->current_video_frame);
#endif
diff --git a/vp8/decoder/onyxd_int.h b/vp8/decoder/onyxd_int.h
index ac1e332e8..70cb0fe3c 100644
--- a/vp8/decoder/onyxd_int.h
+++ b/vp8/decoder/onyxd_int.h
@@ -41,9 +41,9 @@ typedef struct
typedef struct
{
- INT16 min_val;
- INT16 Length;
- UINT8 Probs[12];
+ INT16 min_val;
+ INT16 Length;
+ UINT8 Probs[14];
} TOKENEXTRABITS;
typedef struct
@@ -81,7 +81,7 @@ typedef struct VP8Decompressor
const unsigned char *Source;
unsigned int source_sz;
-
+ unsigned char *segmentation_map;
unsigned int CPUFreq;
unsigned int decode_microseconds;
unsigned int time_decoding;
@@ -95,7 +95,6 @@ typedef struct VP8Decompressor
int current_mb_col_main;
int decoding_thread_count;
int allocated_decoding_thread_count;
-
int mt_baseline_filter_level[MAX_MB_SEGMENTS];
int sync_range;
int *mt_current_mb_col; /* Each row remembers its already decoded column. */