Commit 01ce04bc authored by Paul Wilkins's avatar Paul Wilkins
Browse files

Further segment feature extensions.

This quite large check in includes the following:

Merge in some code from Ronald (mbgraph.c) that scans a Gf/arf group.
This is used as a basis for a simple segmentation for the normal frames
in a gf/arf group. This code also uses satd functions from Yaowu.

Adds functionality for coding the latest possible position of an EOB for
blocks in the segment. (Currently 0-15 only, hence just for 4x4 dct).
Where the EOB position is 0 this acts like "skip" and the normal coding
of skip at the per mb level is disabled.

Added functions (seg_common.c) for setting and reading segment feature
elements. These may want to be optimized away at some point but while the
mecahnism is in a state of flux they provide a single location for making
changes and keep things a bit cleaner.

This is still proof of concept code. Currently the tested feature set:-

Quantizer,
Loop Filter level,
Reference frame,
Prediction Mode,
EOB end stop.

TBD:-

Add functions for setting and reading the feature data with range
and validity checking.

Handling of signed and unsigned feature data. At the moment all is assumed
to be signed and a sign bit is coded but many cannot be negative.

Correct handling of EOB feature with intra coded blocks.

Testing/trapping of legal/illegal ref frame and mode combinations.

Transform size switch plus merge and test with 8c8 DCT work

Merge and test with Sumans Segmenation coding optimizations

Change-Id: Iee12e83661c7abbd1e0ce6810915eb4ec35e2d8e
parent 152ce6b2
...@@ -108,7 +108,7 @@ typedef enum ...@@ -108,7 +108,7 @@ typedef enum
SEG_LVL_REF_FRAME = 2, // Optional Segment reference frame SEG_LVL_REF_FRAME = 2, // Optional Segment reference frame
SEG_LVL_MODE = 3, // Optional Segment mode SEG_LVL_MODE = 3, // Optional Segment mode
SEG_LVL_EOB = 4, // EOB end stop marker. SEG_LVL_EOB = 4, // EOB end stop marker.
SEG_LVL_TRANSFORM = 6, // Block transform size. SEG_LVL_TRANSFORM = 5, // Block transform size.
SEG_LVL_MAX = 6 // Number of MB level features supported SEG_LVL_MAX = 6 // Number of MB level features supported
#else #else
......
...@@ -14,6 +14,10 @@ ...@@ -14,6 +14,10 @@
#include "onyxc_int.h" #include "onyxc_int.h"
#include "vpx_mem/vpx_mem.h" #include "vpx_mem/vpx_mem.h"
#if CONFIG_SEGFEATURES
#include "vp8/common/seg_common.h"
#endif
typedef unsigned char uc; typedef unsigned char uc;
prototype_loopfilter(vp8_loop_filter_horizontal_edge_c); prototype_loopfilter(vp8_loop_filter_horizontal_edge_c);
...@@ -194,7 +198,7 @@ void vp8_loop_filter_init(VP8_COMMON *cm) ...@@ -194,7 +198,7 @@ void vp8_loop_filter_init(VP8_COMMON *cm)
} }
void vp8_loop_filter_frame_init(VP8_COMMON *cm, void vp8_loop_filter_frame_init(VP8_COMMON *cm,
MACROBLOCKD *mbd, MACROBLOCKD *xd,
int default_filt_lvl) int default_filt_lvl)
{ {
int seg, /* segment number */ int seg, /* segment number */
...@@ -218,25 +222,24 @@ void vp8_loop_filter_frame_init(VP8_COMMON *cm, ...@@ -218,25 +222,24 @@ void vp8_loop_filter_frame_init(VP8_COMMON *cm,
// Set the baseline filter values for each segment // Set the baseline filter values for each segment
#if CONFIG_SEGFEATURES #if CONFIG_SEGFEATURES
if ( mbd->segmentation_enabled && if ( segfeature_active( xd, seg, SEG_LVL_ALT_LF ) )
( mbd->segment_feature_mask[seg] & (1 << SEG_LVL_ALT_LF) ) )
#else #else
if ( mbd->segmentation_enabled ) if ( xd->segmentation_enabled )
#endif #endif
{ {
/* Abs value */ /* Abs value */
if (mbd->mb_segement_abs_delta == SEGMENT_ABSDATA) if (xd->mb_segement_abs_delta == SEGMENT_ABSDATA)
{ {
lvl_seg = mbd->segment_feature_data[seg][SEG_LVL_ALT_LF]; lvl_seg = xd->segment_feature_data[seg][SEG_LVL_ALT_LF];
} }
else /* Delta Value */ else /* Delta Value */
{ {
lvl_seg += mbd->segment_feature_data[seg][SEG_LVL_ALT_LF]; lvl_seg += xd->segment_feature_data[seg][SEG_LVL_ALT_LF];
lvl_seg = (lvl_seg > 0) ? ((lvl_seg > 63) ? 63: lvl_seg) : 0; lvl_seg = (lvl_seg > 0) ? ((lvl_seg > 63) ? 63: lvl_seg) : 0;
} }
} }
if (!mbd->mode_ref_lf_delta_enabled) if (!xd->mode_ref_lf_delta_enabled)
{ {
/* we could get rid of this if we assume that deltas are set to /* we could get rid of this if we assume that deltas are set to
* zero when not in use; encoder always uses deltas * zero when not in use; encoder always uses deltas
...@@ -251,12 +254,12 @@ void vp8_loop_filter_frame_init(VP8_COMMON *cm, ...@@ -251,12 +254,12 @@ void vp8_loop_filter_frame_init(VP8_COMMON *cm,
ref = INTRA_FRAME; ref = INTRA_FRAME;
/* Apply delta for reference frame */ /* Apply delta for reference frame */
lvl_ref += mbd->ref_lf_deltas[ref]; lvl_ref += xd->ref_lf_deltas[ref];
/* Apply delta for Intra modes */ /* Apply delta for Intra modes */
mode = 0; /* B_PRED */ mode = 0; /* B_PRED */
/* Only the split mode BPRED has a further special case */ /* Only the split mode BPRED has a further special case */
lvl_mode = lvl_ref + mbd->mode_lf_deltas[mode]; lvl_mode = lvl_ref + xd->mode_lf_deltas[mode];
lvl_mode = (lvl_mode > 0) ? (lvl_mode > 63 ? 63 : lvl_mode) : 0; /* clamp */ lvl_mode = (lvl_mode > 0) ? (lvl_mode > 63 ? 63 : lvl_mode) : 0; /* clamp */
lfi->lvl[seg][ref][mode] = lvl_mode; lfi->lvl[seg][ref][mode] = lvl_mode;
...@@ -271,12 +274,12 @@ void vp8_loop_filter_frame_init(VP8_COMMON *cm, ...@@ -271,12 +274,12 @@ void vp8_loop_filter_frame_init(VP8_COMMON *cm,
int lvl_ref = lvl_seg; int lvl_ref = lvl_seg;
/* Apply delta for reference frame */ /* Apply delta for reference frame */
lvl_ref += mbd->ref_lf_deltas[ref]; lvl_ref += xd->ref_lf_deltas[ref];
/* Apply delta for Inter modes */ /* Apply delta for Inter modes */
for (mode = 1; mode < 4; mode++) for (mode = 1; mode < 4; mode++)
{ {
lvl_mode = lvl_ref + mbd->mode_lf_deltas[mode]; lvl_mode = lvl_ref + xd->mode_lf_deltas[mode];
lvl_mode = (lvl_mode > 0) ? (lvl_mode > 63 ? 63 : lvl_mode) : 0; /* clamp */ lvl_mode = (lvl_mode > 0) ? (lvl_mode > 63 ? 63 : lvl_mode) : 0; /* clamp */
lfi->lvl[seg][ref][mode] = lvl_mode; lfi->lvl[seg][ref][mode] = lvl_mode;
......
/*
* Copyright (c) 2010 The WebM project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "vp8/common/seg_common.h"
// These functions provide access to new segment level features.
// Eventually these function may be "optimized out" but for the moment,
// the coding mechanism is still subject to change so these provide a
// convenient single point of change.
int segfeature_active( MACROBLOCKD *xd,
int segment_id,
SEG_LVL_FEATURES feature_id )
{
// Return true if mask bit set and segmentation enabled.
return ( xd->segmentation_enabled &&
( xd->segment_feature_mask[segment_id] &
(0x01 << feature_id) ) );
}
void enable_segfeature( MACROBLOCKD *xd,
int segment_id,
SEG_LVL_FEATURES feature_id )
{
xd->segment_feature_mask[segment_id] |= (0x01 << feature_id);
}
void disable_segfeature( MACROBLOCKD *xd,
int segment_id,
SEG_LVL_FEATURES feature_id )
{
xd->segment_feature_mask[segment_id] &= ~(1 << feature_id);
}
// TBD? Functions to read and write segment data with range / validity checking
\ No newline at end of file
/*
* Copyright (c) 2010 The WebM project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "type_aliases.h"
#include "vp8/common/blockd.h"
#ifndef __INC_SEG_COMMON_H__
#define __INC_SEG_COMMON_H__ 1
int segfeature_active( MACROBLOCKD *xd,
int segment_id,
SEG_LVL_FEATURES feature_id );
void enable_segfeature( MACROBLOCKD *xd,
int segment_id,
SEG_LVL_FEATURES feature_id );
void disable_segfeature( MACROBLOCKD *xd,
int segment_id,
SEG_LVL_FEATURES feature_id );
#endif /* __INC_SEG_COMMON_H__ */
...@@ -15,6 +15,14 @@ ...@@ -15,6 +15,14 @@
#include "onyxd_int.h" #include "onyxd_int.h"
#include "vp8/common/findnearmv.h" #include "vp8/common/findnearmv.h"
#if CONFIG_SEGFEATURES
#include "vp8/common/seg_common.h"
#endif
#if CONFIG_SEGMENTATION
#include "vp8/common/seg_common.h"
#endif
#if CONFIG_DEBUG #if CONFIG_DEBUG
#include <assert.h> #include <assert.h>
#endif #endif
...@@ -85,11 +93,33 @@ static void vp8_kfread_modes(VP8D_COMP *pbi, MODE_INFO *m, int mb_row, int mb_co ...@@ -85,11 +93,33 @@ static void vp8_kfread_modes(VP8D_COMP *pbi, MODE_INFO *m, int mb_row, int mb_co
if (pbi->mb.update_mb_segmentation_map) if (pbi->mb.update_mb_segmentation_map)
vp8_read_mb_features(bc, &m->mbmi, &pbi->mb); vp8_read_mb_features(bc, &m->mbmi, &pbi->mb);
/* Read the macroblock coeff skip flag if this feature is in use, else default to 0 */ #if CONFIG_SEGFEATURES
if ( pbi->common.mb_no_coeff_skip &&
( !segfeature_active( &pbi->mb,
m->mbmi.segment_id, SEG_LVL_EOB ) ||
(pbi->mb.segment_feature_data[m->mbmi.segment_id]
[SEG_LVL_EOB] != 0) ) )
#else
// Read the macroblock coeff skip flag if this feature is in use,
// else default to 0
if (pbi->common.mb_no_coeff_skip) if (pbi->common.mb_no_coeff_skip)
#endif
m->mbmi.mb_skip_coeff = vp8_read(bc, pbi->prob_skip_false); m->mbmi.mb_skip_coeff = vp8_read(bc, pbi->prob_skip_false);
else else
m->mbmi.mb_skip_coeff = 0; {
#if CONFIG_SEGFEATURES
if ( segfeature_active( &pbi->mb,
m->mbmi.segment_id, SEG_LVL_EOB ) &&
(pbi->mb.segment_feature_data[m->mbmi.segment_id]
[SEG_LVL_EOB] == 0) )
{
m->mbmi.mb_skip_coeff = 1;
}
else
#endif
m->mbmi.mb_skip_coeff = 0;
}
#if CONFIG_QIMODE #if CONFIG_QIMODE
y_mode = (MB_PREDICTION_MODE) vp8_kfread_ymode(bc, y_mode = (MB_PREDICTION_MODE) vp8_kfread_ymode(bc,
pbi->common.kf_ymode_prob[pbi->common.kf_ymode_probs_index]); pbi->common.kf_ymode_prob[pbi->common.kf_ymode_probs_index]);
...@@ -210,7 +240,7 @@ static MV_REFERENCE_FRAME read_ref_frame( VP8D_COMP *pbi, ...@@ -210,7 +240,7 @@ static MV_REFERENCE_FRAME read_ref_frame( VP8D_COMP *pbi,
MACROBLOCKD *const xd = &pbi->mb; MACROBLOCKD *const xd = &pbi->mb;
// Is the segment level refernce frame feature enabled for this segment // Is the segment level refernce frame feature enabled for this segment
if ( xd->segment_feature_mask[segment_id] & (0x01 << SEG_LVL_REF_FRAME) ) if ( segfeature_active( xd, segment_id, SEG_LVL_REF_FRAME ) )
{ {
ref_frame = ref_frame =
xd->segment_feature_data[segment_id][SEG_LVL_REF_FRAME]; xd->segment_feature_data[segment_id][SEG_LVL_REF_FRAME];
...@@ -398,12 +428,34 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi, ...@@ -398,12 +428,34 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
#endif #endif
} }
#if CONFIG_SEGFEATURES
/* Read the macroblock coeff skip flag if this feature is in use, else default to 0 */ if ( pbi->common.mb_no_coeff_skip &&
( !segfeature_active( xd,
mbmi->segment_id, SEG_LVL_EOB ) ||
(xd->segment_feature_data[mbmi->segment_id]
[SEG_LVL_EOB] != 0) ) )
#else
if (pbi->common.mb_no_coeff_skip) if (pbi->common.mb_no_coeff_skip)
#endif
{
// Read the macroblock coeff skip flag if this feature is in use,
// else default to 0
mbmi->mb_skip_coeff = vp8_read(bc, pbi->prob_skip_false); mbmi->mb_skip_coeff = vp8_read(bc, pbi->prob_skip_false);
}
else else
mbmi->mb_skip_coeff = 0; {
#if CONFIG_SEGFEATURES
if ( segfeature_active( xd,
mbmi->segment_id, SEG_LVL_EOB ) &&
(xd->segment_feature_data[mbmi->segment_id]
[SEG_LVL_EOB] == 0) )
{
mbmi->mb_skip_coeff = 1;
}
else
#endif
mbmi->mb_skip_coeff = 0;
}
// Read the reference frame // Read the reference frame
mbmi->ref_frame = read_ref_frame( pbi, mbmi->segment_id ); mbmi->ref_frame = read_ref_frame( pbi, mbmi->segment_id );
...@@ -421,8 +473,7 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi, ...@@ -421,8 +473,7 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
#if CONFIG_SEGFEATURES #if CONFIG_SEGFEATURES
// Is the segment level mode feature enabled for this segment // Is the segment level mode feature enabled for this segment
if ( xd->segment_feature_mask[mbmi->segment_id] & if ( segfeature_active( xd, mbmi->segment_id, SEG_LVL_MODE ) )
(0x01 << SEG_LVL_MODE) )
{ {
mbmi->mode = mbmi->mode =
xd->segment_feature_data[mbmi->segment_id][SEG_LVL_MODE]; xd->segment_feature_data[mbmi->segment_id][SEG_LVL_MODE];
......
...@@ -37,6 +37,10 @@ ...@@ -37,6 +37,10 @@
#include "decoderthreading.h" #include "decoderthreading.h"
#include "dboolhuff.h" #include "dboolhuff.h"
#if CONFIG_SEGFEATURES
#include "vp8/common/seg_common.h"
#endif
#include <assert.h> #include <assert.h>
#include <stdio.h> #include <stdio.h>
...@@ -78,8 +82,7 @@ void mb_init_dequantizer(VP8D_COMP *pbi, MACROBLOCKD *xd) ...@@ -78,8 +82,7 @@ void mb_init_dequantizer(VP8D_COMP *pbi, MACROBLOCKD *xd)
// Set the Q baseline allowing for any segment level adjustment // Set the Q baseline allowing for any segment level adjustment
#if CONFIG_SEGFEATURES #if CONFIG_SEGFEATURES
if ( xd->segmentation_enabled && if ( segfeature_active( xd, segment_id, SEG_LVL_ALT_Q ) )
( xd->segment_feature_mask[segment_id] & (1 << SEG_LVL_ALT_Q) ) )
#else #else
if ( xd->segmentation_enabled ) if ( xd->segmentation_enabled )
#endif #endif
...@@ -1056,9 +1059,8 @@ int vp8_decode_frame(VP8D_COMP *pbi) ...@@ -1056,9 +1059,8 @@ int vp8_decode_frame(VP8D_COMP *pbi)
{ {
#if CONFIG_SEGFEATURES #if CONFIG_SEGFEATURES
// Update the feature data and mask // Update the feature data and mask
xd->segment_feature_mask[j] |= (1 << i); enable_segfeature(xd, j, i);
#endif #endif
xd->segment_feature_data[j][i] = (signed char)vp8_read_literal(bc, mb_feature_data_bits[i]); xd->segment_feature_data[j][i] = (signed char)vp8_read_literal(bc, mb_feature_data_bits[i]);
if (vp8_read_bit(bc)) if (vp8_read_bit(bc))
......
...@@ -16,6 +16,10 @@ ...@@ -16,6 +16,10 @@
#include "vpx_ports/mem.h" #include "vpx_ports/mem.h"
#include "detokenize.h" #include "detokenize.h"
#if CONFIG_SEGFEATURES
#include "vp8/common/seg_common.h"
#endif
#define BOOL_DATA UINT8 #define BOOL_DATA UINT8
#define OCB_X PREV_COEF_CONTEXTS * ENTROPY_NODES #define OCB_X PREV_COEF_CONTEXTS * ENTROPY_NODES
...@@ -611,15 +615,15 @@ BLOCK_FINISHED_8x8: ...@@ -611,15 +615,15 @@ BLOCK_FINISHED_8x8:
} }
#endif #endif
int vp8_decode_mb_tokens(VP8D_COMP *dx, MACROBLOCKD *x) int vp8_decode_mb_tokens(VP8D_COMP *dx, MACROBLOCKD *xd)
{ {
ENTROPY_CONTEXT *A = (ENTROPY_CONTEXT *)x->above_context; ENTROPY_CONTEXT *A = (ENTROPY_CONTEXT *)xd->above_context;
ENTROPY_CONTEXT *L = (ENTROPY_CONTEXT *)x->left_context; ENTROPY_CONTEXT *L = (ENTROPY_CONTEXT *)xd->left_context;
const FRAME_CONTEXT * const fc = &dx->common.fc; const FRAME_CONTEXT * const fc = &dx->common.fc;
BOOL_DECODER *bc = x->current_bc; BOOL_DECODER *bc = xd->current_bc;
char *eobs = x->eobs; char *eobs = xd->eobs;
ENTROPY_CONTEXT *a; ENTROPY_CONTEXT *a;
ENTROPY_CONTEXT *l; ENTROPY_CONTEXT *l;
...@@ -647,17 +651,27 @@ int vp8_decode_mb_tokens(VP8D_COMP *dx, MACROBLOCKD *x) ...@@ -647,17 +651,27 @@ int vp8_decode_mb_tokens(VP8D_COMP *dx, MACROBLOCKD *x)
INT16 v; INT16 v;
const vp8_prob *Prob; const vp8_prob *Prob;
#if CONFIG_SEGFEATURES
int seg_eob = 16;
int segment_id = xd->mode_info_context->mbmi.segment_id;
if ( segfeature_active( xd, segment_id, SEG_LVL_EOB ) )
{
seg_eob = xd->segment_feature_data[segment_id][SEG_LVL_EOB];
}
#endif
type = 3; type = 3;
i = 0; i = 0;
stop = 16; stop = 16;
scan = vp8_default_zig_zag1d; scan = vp8_default_zig_zag1d;
qcoeff_ptr = &x->qcoeff[0]; qcoeff_ptr = &xd->qcoeff[0];
if (x->mode_info_context->mbmi.mode != B_PRED && if (xd->mode_info_context->mbmi.mode != B_PRED &&
#if CONFIG_I8X8 #if CONFIG_I8X8
x->mode_info_context->mbmi.mode != I8X8_PRED && xd->mode_info_context->mbmi.mode != I8X8_PRED &&
#endif #endif
x->mode_info_context->mbmi.mode != SPLITMV) xd->mode_info_context->mbmi.mode != SPLITMV)
{ {
i = 24; i = 24;
stop = 24; stop = 24;
...@@ -687,6 +701,11 @@ BLOCK_LOOP: ...@@ -687,6 +701,11 @@ BLOCK_LOOP:
Prob += v * ENTROPY_NODES; Prob += v * ENTROPY_NODES;
DO_WHILE: DO_WHILE:
#if CONFIG_SEGFEATURES
if ( c == seg_eob )
goto BLOCK_FINISHED;
#endif
Prob += coef_bands_x[c]; Prob += coef_bands_x[c];
DECODE_AND_BRANCH_IF_ZERO(Prob[EOB_CONTEXT_NODE], BLOCK_FINISHED); DECODE_AND_BRANCH_IF_ZERO(Prob[EOB_CONTEXT_NODE], BLOCK_FINISHED);
......
...@@ -24,9 +24,15 @@ ...@@ -24,9 +24,15 @@
#include "bitstream.h" #include "bitstream.h"
#include "defaultcoefcounts.h" #include "defaultcoefcounts.h"
#if CONFIG_SEGFEATURES
#include "vp8/common/seg_common.h"
#endif
#if CONFIG_SEGMENTATION #if CONFIG_SEGMENTATION
static int segment_cost = 0; static int segment_cost = 0;
#endif #endif
const int vp8cx_base_skip_false_prob[128] = const int vp8cx_base_skip_false_prob[128] =
{ {
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
...@@ -954,6 +960,7 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi) ...@@ -954,6 +960,7 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi)
const MB_MODE_INFO *const mi = & m->mbmi; const MB_MODE_INFO *const mi = & m->mbmi;
const MV_REFERENCE_FRAME rf = mi->ref_frame; const MV_REFERENCE_FRAME rf = mi->ref_frame;
const MB_PREDICTION_MODE mode = mi->mode; const MB_PREDICTION_MODE mode = mi->mode;
const int segment_id = mi->segment_id;
//MACROBLOCKD *xd = &cpi->mb.e_mbd; //MACROBLOCKD *xd = &cpi->mb.e_mbd;
...@@ -973,7 +980,7 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi) ...@@ -973,7 +980,7 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi)
#ifdef MODE_STATS #ifdef MODE_STATS
#if CONFIG_SEGMENTATION #if CONFIG_SEGMENTATION
segment_modes_inter[mi->segment_id]++; segment_modes_inter[segment_id]++;
#endif #endif
#endif #endif
if (cpi->mb.e_mbd.update_mb_segmentation_map) if (cpi->mb.e_mbd.update_mb_segmentation_map)
...@@ -997,13 +1004,13 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi) ...@@ -997,13 +1004,13 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi)
vp8_write(w,1,xd->mb_segment_tree_probs[3+sum]); vp8_write(w,1,xd->mb_segment_tree_probs[3+sum]);
segment_cost += vp8_cost_one(xd->mb_segment_tree_probs[3+sum]); segment_cost += vp8_cost_one(xd->mb_segment_tree_probs[3+sum]);
write_mb_features(w, mi, &cpi->mb.e_mbd); write_mb_features(w, mi, &cpi->mb.e_mbd);
cpi->segmentation_map[index] = mi->segment_id; cpi->segmentation_map[index] = segment_id;
} }
} }
else else
{ {
write_mb_features(w, mi, &cpi->mb.e_mbd); write_mb_features(w, mi, &cpi->mb.e_mbd);
cpi->segmentation_map[index] = mi->segment_id; cpi->segmentation_map[index] = segment_id;
} }
index++; index++;
#else #else
...@@ -1011,15 +1018,22 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi) ...@@ -1011,15 +1018,22 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi)
#endif #endif
} }
#if CONFIG_SEGFEATURES
if ( pc->mb_no_coeff_skip &&
( !segfeature_active( xd, segment_id, SEG_LVL_EOB ) ||
(xd->segment_feature_data[segment_id][SEG_LVL_EOB] != 0) ) )
#else
if (pc->mb_no_coeff_skip) if (pc->mb_no_coeff_skip)
vp8_encode_bool(w, m->mbmi.mb_skip_coeff, prob_skip_false); #endif
{
vp8_encode_bool(w, mi->mb_skip_coeff, prob_skip_false);
}
if (rf == INTRA_FRAME) if (rf == INTRA_FRAME)
{ {
#if CONFIG_SEGFEATURES #if CONFIG_SEGFEATURES
// Is the segment coding of reference frame enabled // Is the segment coding of reference frame enabled
if ( !( xd->segment_feature_mask[mi->segment_id] & if ( !segfeature_active( xd, segment_id, SEG_LVL_REF_FRAME ) )
(0x01 << SEG_LVL_REF_FRAME) ) )
#endif #endif
{ {
vp8_write(w, 0, cpi->prob_intra_coded); vp8_write(w, 0, cpi->prob_intra_coded);
...@@ -1047,9 +1061,8 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi) ...@@ -1047,9 +1061,8 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi)
vp8_prob mv_ref_p [VP8_MVREFS-1]; vp8_prob mv_ref_p [VP8_MVREFS-1];
#if CONFIG_SEGFEATURES #if CONFIG_SEGFEATURES
// Is the segment coding of reference frame enabled // Test to see if segment level coding of ref frame is enabled
if ( !( xd->segment_feature_mask[mi->segment_id] & if ( !segfeature_active( xd, segment_id, SEG_LVL_REF_FRAME ) )
(0x01 << SEG_LVL_REF_FRAME) ) )
#endif #endif
{ {
vp8_write(w, 1, cpi->prob_intra_coded);