summaryrefslogtreecommitdiff
path: root/vp8
diff options
context:
space:
mode:
authorPaul Wilkins <paulwilkins@google.com>2011-11-03 16:58:26 +0000
committerPaul Wilkins <paulwilkins@google.com>2011-11-04 10:42:12 +0000
commita258bba1fb6b93cbaf65b8bf3c892bff9fe9ace2 (patch)
tree5cffb031ca44a1780187d199112bf59965b5fb39 /vp8
parent2bbde25003f5f67e2d60449712521890cadf7774 (diff)
downloadlibvpx-a258bba1fb6b93cbaf65b8bf3c892bff9fe9ace2.tar
libvpx-a258bba1fb6b93cbaf65b8bf3c892bff9fe9ace2.tar.gz
libvpx-a258bba1fb6b93cbaf65b8bf3c892bff9fe9ace2.tar.bz2
libvpx-a258bba1fb6b93cbaf65b8bf3c892bff9fe9ace2.zip
Segment Feature Data Access
No change to functionality or output. Updates to the segment feature data structure now all done through functions such as set_segdata() and get_segdata() in seg_common.c. The reason for this is to make changing the structures (if needed) and debug easier. In addition it provides a single location for subsequent addition of range and validity checks. For example valid combination of mode and reference frame. Change-Id: I2e866505562db4e4cb6f17a472b25b4465f01add
Diffstat (limited to 'vp8')
-rw-r--r--vp8/common/loopfilter.c24
-rw-r--r--vp8/decoder/decodemv.c20
-rw-r--r--vp8/decoder/decodframe.c9
-rw-r--r--vp8/decoder/detokenize.c2
-rw-r--r--vp8/encoder/bitstream.c6
-rw-r--r--vp8/encoder/onyx_if.c29
-rw-r--r--vp8/encoder/pickinter.c2
-rw-r--r--vp8/encoder/quantize.c10
-rw-r--r--vp8/encoder/rdopt.c4
-rw-r--r--vp8/encoder/tokenize.c6
10 files changed, 53 insertions, 59 deletions
diff --git a/vp8/common/loopfilter.c b/vp8/common/loopfilter.c
index 0ee151e82..98657fcc3 100644
--- a/vp8/common/loopfilter.c
+++ b/vp8/common/loopfilter.c
@@ -227,11 +227,11 @@ void vp8_loop_filter_frame_init(VP8_COMMON *cm,
/* Abs value */
if (xd->mb_segement_abs_delta == SEGMENT_ABSDATA)
{
- lvl_seg = xd->segment_feature_data[seg][SEG_LVL_ALT_LF];
+ lvl_seg = get_segdata( xd, seg, SEG_LVL_ALT_LF );
}
else /* Delta Value */
{
- lvl_seg += xd->segment_feature_data[seg][SEG_LVL_ALT_LF];
+ lvl_seg += get_segdata( xd, seg, SEG_LVL_ALT_LF );;
lvl_seg = (lvl_seg > 0) ? ((lvl_seg > 63) ? 63: lvl_seg) : 0;
}
}
@@ -288,7 +288,7 @@ void vp8_loop_filter_frame_init(VP8_COMMON *cm,
void vp8_loop_filter_frame
(
VP8_COMMON *cm,
- MACROBLOCKD *mbd
+ MACROBLOCKD *xd
)
{
YV12_BUFFER_CONFIG *post = cm->frame_to_show;
@@ -308,7 +308,7 @@ void vp8_loop_filter_frame
const MODE_INFO *mode_info_context = cm->mi;
/* Initialize the loop filter for this frame. */
- vp8_loop_filter_frame_init(cm, mbd, cm->filter_level);
+ vp8_loop_filter_frame_init(cm, xd, cm->filter_level);
/* Set up the buffer pointers */
y_ptr = post->y_buffer;
@@ -396,7 +396,7 @@ void vp8_loop_filter_frame
void vp8_loop_filter_frame_yonly
(
VP8_COMMON *cm,
- MACROBLOCKD *mbd,
+ MACROBLOCKD *xd,
int default_filt_lvl
)
{
@@ -421,7 +421,7 @@ void vp8_loop_filter_frame_yonly
#endif
/* Initialize the loop filter for this frame. */
- vp8_loop_filter_frame_init( cm, mbd, default_filt_lvl);
+ vp8_loop_filter_frame_init( cm, xd, default_filt_lvl);
/* Set up the buffer pointers */
y_ptr = post->y_buffer;
@@ -503,7 +503,7 @@ void vp8_loop_filter_frame_yonly
void vp8_loop_filter_partial_frame
(
VP8_COMMON *cm,
- MACROBLOCKD *mbd,
+ MACROBLOCKD *xd,
int default_filt_lvl
)
{
@@ -520,7 +520,7 @@ void vp8_loop_filter_partial_frame
loop_filter_info lfi;
int filter_level;
- int alt_flt_enabled = mbd->segmentation_enabled;
+ int alt_flt_enabled = xd->segmentation_enabled;
FRAME_TYPE frame_type = cm->frame_type;
const MODE_INFO *mode_info_context;
@@ -545,15 +545,15 @@ void vp8_loop_filter_partial_frame
{
for (i = 0; i < MAX_MB_SEGMENTS; i++)
{ /* Abs value */
- if (mbd->mb_segement_abs_delta == SEGMENT_ABSDATA)
+ if (xd->mb_segement_abs_delta == SEGMENT_ABSDATA)
{
- lvl_seg[i] = mbd->segment_feature_data[i][SEG_LVL_ALT_LF];
+ lvl_seg[i] = get_segdata( xd, i, SEG_LVL_ALT_LF );
}
/* Delta Value */
else
{
- lvl_seg[i] = default_filt_lvl
- + mbd->segment_feature_data[i][SEG_LVL_ALT_LF];
+ lvl_seg[i] = default_filt_lvl +
+ get_segdata( xd, i, SEG_LVL_ALT_LF );
lvl_seg[i] = (lvl_seg[i] > 0) ?
((lvl_seg[i] > 63) ? 63: lvl_seg[i]) : 0;
}
diff --git a/vp8/decoder/decodemv.c b/vp8/decoder/decodemv.c
index fcafcccf0..d279ebaec 100644
--- a/vp8/decoder/decodemv.c
+++ b/vp8/decoder/decodemv.c
@@ -96,8 +96,8 @@ static void vp8_kfread_modes(VP8D_COMP *pbi, MODE_INFO *m, int mb_row, int mb_co
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) ) )
+ ( get_segdata( &pbi->mb,
+ m->mbmi.segment_id, SEG_LVL_EOB ) != 0 ) ) )
{
m->mbmi.mb_skip_coeff = vp8_read(bc, pbi->prob_skip_false);
}
@@ -106,8 +106,8 @@ static void vp8_kfread_modes(VP8D_COMP *pbi, MODE_INFO *m, int mb_row, int mb_co
//#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) )
+ ( get_segdata( &pbi->mb,
+ m->mbmi.segment_id, SEG_LVL_EOB ) == 0 ) )
{
m->mbmi.mb_skip_coeff = 1;
}
@@ -278,9 +278,9 @@ static MV_REFERENCE_FRAME read_ref_frame( VP8D_COMP *pbi,
if ( check_segref( xd, segment_id, INTRA_FRAME ) )
ref_frame = (MV_REFERENCE_FRAME) vp8_read(bc, pbi->prob_intra);
else
- ref_frame = 1; // note this unchanged = LAST
+ ref_frame = LAST_FRAME;
- if ( ref_frame )
+ if ( ref_frame == LAST_FRAME )
{
// Now consider last vs (golden or alt) flag....
// If Last is not enabled
@@ -501,8 +501,7 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
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) ) )
+ (get_segdata( xd, mbmi->segment_id, SEG_LVL_EOB ) != 0) ) )
{
// Read the macroblock coeff skip flag if this feature is in use,
// else default to 0
@@ -513,8 +512,7 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
//#if CONFIG_SEGFEATURES
if ( segfeature_active( xd,
mbmi->segment_id, SEG_LVL_EOB ) &&
- (xd->segment_feature_data[mbmi->segment_id]
- [SEG_LVL_EOB] == 0) )
+ (get_segdata( xd, mbmi->segment_id, SEG_LVL_EOB ) == 0) )
{
mbmi->mb_skip_coeff = 1;
}
@@ -541,7 +539,7 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
if ( segfeature_active( xd, mbmi->segment_id, SEG_LVL_MODE ) )
{
mbmi->mode =
- xd->segment_feature_data[mbmi->segment_id][SEG_LVL_MODE];
+ get_segdata( xd, mbmi->segment_id, SEG_LVL_MODE );
}
else
{
diff --git a/vp8/decoder/decodframe.c b/vp8/decoder/decodframe.c
index e81a8c58b..4fdc3ea3d 100644
--- a/vp8/decoder/decodframe.c
+++ b/vp8/decoder/decodframe.c
@@ -85,13 +85,13 @@ void mb_init_dequantizer(VP8D_COMP *pbi, MACROBLOCKD *xd)
{
/* Abs Value */
if (xd->mb_segement_abs_delta == SEGMENT_ABSDATA)
- QIndex = xd->segment_feature_data[segment_id][SEG_LVL_ALT_Q];
+ QIndex = get_segdata( xd, segment_id, SEG_LVL_ALT_Q );
/* Delta Value */
else
{
QIndex = pc->base_qindex +
- xd->segment_feature_data[segment_id][SEG_LVL_ALT_Q];
+ get_segdata( xd, segment_id, SEG_LVL_ALT_Q );
QIndex = (QIndex >= 0) ? ((QIndex <= MAXQ) ? QIndex : MAXQ) : 0; /* Clamp to valid range */
}
}
@@ -804,10 +804,7 @@ static void init_frame(VP8D_COMP *pbi)
// Reset the segment feature data to the default stats:
// Features disabled, 0, with delta coding (Default state).
//#if CONFIG_SEGFEATURES
- vpx_memset(xd->segment_feature_mask, 0,
- sizeof(xd->segment_feature_mask));
- vpx_memset(xd->segment_feature_data, 0,
- sizeof(xd->segment_feature_data));
+ clearall_segfeatures( xd );
xd->mb_segement_abs_delta = SEGMENT_DELTADATA;
diff --git a/vp8/decoder/detokenize.c b/vp8/decoder/detokenize.c
index e69a7d34f..f2a5db8f1 100644
--- a/vp8/decoder/detokenize.c
+++ b/vp8/decoder/detokenize.c
@@ -656,7 +656,7 @@ int vp8_decode_mb_tokens(VP8D_COMP *dx, MACROBLOCKD *xd)
if ( segfeature_active( xd, segment_id, SEG_LVL_EOB ) )
{
- seg_eob = xd->segment_feature_data[segment_id][SEG_LVL_EOB];
+ seg_eob = get_segdata( xd, segment_id, SEG_LVL_EOB );
}
type = 3;
diff --git a/vp8/encoder/bitstream.c b/vp8/encoder/bitstream.c
index ef21e2a86..be99f3850 100644
--- a/vp8/encoder/bitstream.c
+++ b/vp8/encoder/bitstream.c
@@ -887,7 +887,7 @@ static void encode_ref_frame( vp8_writer *const w,
segment_id,
SEG_LVL_REF_FRAME );
- // No segment features or segment reference frame featuure is disabled
+ // No segment features or segment reference frame feature is disabled
if ( !seg_ref_active )
{
if (rf == INTRA_FRAME)
@@ -1108,7 +1108,7 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi)
//#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) ) )
+ ( get_segdata( xd, segment_id, SEG_LVL_EOB ) != 0 ) ) )
{
vp8_encode_bool(w, mi->mb_skip_coeff, prob_skip_false);
}
@@ -1320,7 +1320,7 @@ static void write_kfmodes(VP8_COMP *cpi)
//#if CONFIG_SEGFEATURES
if ( c->mb_no_coeff_skip &&
( !segfeature_active( xd, segment_id, SEG_LVL_EOB ) ||
- (xd->segment_feature_data[segment_id][SEG_LVL_EOB] != 0) ) )
+ (get_segdata( xd, segment_id, SEG_LVL_EOB ) != 0) ) )
{
vp8_encode_bool(bc, m->mbmi.mb_skip_coeff, prob_skip_false);
}
diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c
index a6ad0c705..1902c7ca1 100644
--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -336,10 +336,9 @@ static void setup_features(VP8_COMP *cpi)
xd->update_mb_segmentation_map = 0;
xd->update_mb_segmentation_data = 0;
vpx_memset(xd->mb_segment_tree_probs, 255, sizeof(xd->mb_segment_tree_probs));
- vpx_memset(xd->segment_feature_data, 0, sizeof(xd->segment_feature_data));
//#if CONFIG_SEGFEATURES
- vpx_memset(xd->segment_feature_mask, 0, sizeof(xd->segment_feature_mask));
+ clearall_segfeatures( xd );
xd->mode_ref_lf_delta_enabled = 0;
xd->mode_ref_lf_delta_update = 0;
@@ -529,9 +528,8 @@ static void init_seg_features(VP8_COMP *cpi)
xd->update_mb_segmentation_map = 1;
xd->update_mb_segmentation_data = 1;
- xd->segment_feature_data[1][SEG_LVL_ALT_Q] =
- -(2+(cpi->ni_av_qi >> 3));
- xd->segment_feature_data[1][SEG_LVL_ALT_LF] = -2;
+ set_segdata( xd, 1, SEG_LVL_ALT_Q, -(2+(cpi->ni_av_qi >> 3)) );
+ set_segdata( xd, 1, SEG_LVL_ALT_LF, -2 );
enable_segfeature(xd, 1, SEG_LVL_ALT_Q);
enable_segfeature(xd, 1, SEG_LVL_ALT_LF);
@@ -554,20 +552,21 @@ static void init_seg_features(VP8_COMP *cpi)
xd->update_mb_segmentation_data = 1;
xd->mb_segement_abs_delta = SEGMENT_DELTADATA;
- xd->segment_feature_data[1][SEG_LVL_ALT_Q] = 5;
- xd->segment_feature_data[1][SEG_LVL_ALT_LF] = -2;
-
+ set_segdata( xd, 1, SEG_LVL_ALT_Q, 5 );
enable_segfeature(xd, 1, SEG_LVL_ALT_Q);
+
+ set_segdata( xd, 1, SEG_LVL_ALT_LF, -2 );
enable_segfeature(xd, 1, SEG_LVL_ALT_LF);
if ( high_q )
{
set_segref(xd, 1, ALTREF_FRAME);
- xd->segment_feature_data[1][SEG_LVL_MODE] = ZEROMV;
- xd->segment_feature_data[1][SEG_LVL_EOB] = 0;
-
enable_segfeature(xd, 1, SEG_LVL_REF_FRAME);
+
+ set_segdata( xd, 1, SEG_LVL_MODE, ZEROMV );
enable_segfeature(xd, 1, SEG_LVL_MODE);
+
+ set_segdata( xd, 1, SEG_LVL_EOB, 0 );
enable_segfeature(xd, 1, SEG_LVL_EOB);
}
}
@@ -601,16 +600,16 @@ static void init_seg_features(VP8_COMP *cpi)
set_segref(xd, 0, ALTREF_FRAME);
clear_segref(xd, 1);
set_segref(xd, 1, ALTREF_FRAME);
- xd->segment_feature_data[0][SEG_LVL_MODE] = ZEROMV;
- xd->segment_feature_data[1][SEG_LVL_MODE] = ZEROMV;
+ set_segdata( xd, 0, SEG_LVL_MODE, ZEROMV );
+ set_segdata( xd, 1, SEG_LVL_MODE, ZEROMV );
// Skip all MBs if high Q
if ( high_q )
{
enable_segfeature(xd, 0, SEG_LVL_EOB);
enable_segfeature(xd, 1, SEG_LVL_EOB);
- xd->segment_feature_data[0][SEG_LVL_EOB] = 0;
- xd->segment_feature_data[1][SEG_LVL_EOB] = 0;
+ set_segdata( xd, 0, SEG_LVL_EOB, 0 );
+ set_segdata( xd, 1, SEG_LVL_EOB, 0 );
}
// Enable data udpate
diff --git a/vp8/encoder/pickinter.c b/vp8/encoder/pickinter.c
index ee9c43a15..5fd0c905e 100644
--- a/vp8/encoder/pickinter.c
+++ b/vp8/encoder/pickinter.c
@@ -536,7 +536,7 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
}
if ( segfeature_active( xd, segment_id, SEG_LVL_MODE ) &&
( this_mode !=
- xd->segment_feature_data[segment_id][SEG_LVL_MODE]))
+ get_segdata( xd, segment_id, SEG_LVL_MODE ) ) )
{
continue;
}
diff --git a/vp8/encoder/quantize.c b/vp8/encoder/quantize.c
index c34749c97..e95fa60e6 100644
--- a/vp8/encoder/quantize.c
+++ b/vp8/encoder/quantize.c
@@ -1179,13 +1179,13 @@ void vp8cx_mb_init_quantizer(VP8_COMP *cpi, MACROBLOCK *x)
{
// Abs Value
if (xd->mb_segement_abs_delta == SEGMENT_ABSDATA)
- QIndex = xd->segment_feature_data[segment_id][SEG_LVL_ALT_Q];
+ QIndex = get_segdata( xd, segment_id, SEG_LVL_ALT_Q );
// Delta Value
else
{
QIndex = cpi->common.base_qindex +
- xd->segment_feature_data[segment_id][SEG_LVL_ALT_Q];
+ get_segdata( xd, segment_id, SEG_LVL_ALT_Q );
// Clamp to valid range
QIndex = (QIndex >= 0) ? ((QIndex <= MAXQ) ? QIndex : MAXQ) : 0;
@@ -1215,7 +1215,7 @@ void vp8cx_mb_init_quantizer(VP8_COMP *cpi, MACROBLOCK *x)
if ( segfeature_active( xd, segment_id, SEG_LVL_EOB ) )
{
x->block[i].eob_max_offset =
- xd->segment_feature_data[segment_id][SEG_LVL_EOB];
+ get_segdata( xd, segment_id, SEG_LVL_EOB );
}
else
x->block[i].eob_max_offset = 16;
@@ -1242,7 +1242,7 @@ void vp8cx_mb_init_quantizer(VP8_COMP *cpi, MACROBLOCK *x)
if ( segfeature_active( xd, segment_id, SEG_LVL_EOB ) )
{
x->block[i].eob_max_offset =
- xd->segment_feature_data[segment_id][SEG_LVL_EOB];
+ get_segdata( xd, segment_id, SEG_LVL_EOB );
}
else
x->block[i].eob_max_offset = 16;
@@ -1269,7 +1269,7 @@ void vp8cx_mb_init_quantizer(VP8_COMP *cpi, MACROBLOCK *x)
if ( segfeature_active( xd, segment_id, SEG_LVL_EOB ) )
{
x->block[24].eob_max_offset =
- xd->segment_feature_data[segment_id][SEG_LVL_EOB];
+ get_segdata( xd, segment_id, SEG_LVL_EOB );
}
else
x->block[24].eob_max_offset = 16;
diff --git a/vp8/encoder/rdopt.c b/vp8/encoder/rdopt.c
index a2d132e5c..b8ae6c066 100644
--- a/vp8/encoder/rdopt.c
+++ b/vp8/encoder/rdopt.c
@@ -2138,8 +2138,8 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
continue;
}
if ( segfeature_active( xd, segment_id, SEG_LVL_MODE ) &&
- ( this_mode !=
- xd->segment_feature_data[segment_id][SEG_LVL_MODE]))
+ ( this_mode !=
+ get_segdata( xd, segment_id, SEG_LVL_MODE ) ) )
{
continue;
}
diff --git a/vp8/encoder/tokenize.c b/vp8/encoder/tokenize.c
index 24be76bd9..362d9bfaf 100644
--- a/vp8/encoder/tokenize.c
+++ b/vp8/encoder/tokenize.c
@@ -190,7 +190,7 @@ static void tokenize2nd_order_b
if ( segfeature_active( xd, segment_id, SEG_LVL_EOB ) )
{
- seg_eob = xd->segment_feature_data[segment_id][SEG_LVL_EOB];
+ seg_eob = get_segdata( xd, segment_id, SEG_LVL_EOB );
}
b = xd->block + 24;
@@ -326,7 +326,7 @@ static void tokenize1st_order_b
if ( segfeature_active( xd, segment_id, SEG_LVL_EOB ) )
{
- seg_eob = xd->segment_feature_data[segment_id][SEG_LVL_EOB];
+ seg_eob = get_segdata( xd, segment_id, SEG_LVL_EOB );
}
b = xd->block;
@@ -487,7 +487,7 @@ void vp8_tokenize_mb(VP8_COMP *cpi, MACROBLOCKD *x, TOKENEXTRA **t)
int segment_id = x->mode_info_context->mbmi.segment_id;
if ( !segfeature_active( x, segment_id, SEG_LVL_EOB ) ||
- (x->segment_feature_data[segment_id][SEG_LVL_EOB] != 0) )
+ ( get_segdata( x, segment_id, SEG_LVL_EOB ) != 0) )
{
skip_inc = 1;
}