diff options
Diffstat (limited to 'vp8/decoder')
-rw-r--r-- | vp8/decoder/decodemv.c | 50 | ||||
-rw-r--r-- | vp8/decoder/decodframe.c | 13 | ||||
-rw-r--r-- | vp8/decoder/onyxd_if.c | 9 | ||||
-rw-r--r-- | vp8/decoder/onyxd_int.h | 3 |
4 files changed, 63 insertions, 12 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 c454bbc70..7089c92de 100644 --- a/vp8/decoder/decodframe.c +++ b/vp8/decoder/decodframe.c @@ -574,7 +574,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; @@ -661,7 +660,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. */ @@ -697,9 +695,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)) @@ -821,7 +822,6 @@ int vp8_decode_frame(VP8D_COMP *pbi) fclose(z); } - { /* read coef probability tree */ @@ -844,6 +844,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/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 512f1fc0f..70cb0fe3c 100644 --- a/vp8/decoder/onyxd_int.h +++ b/vp8/decoder/onyxd_int.h @@ -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. */ |