Commit a127c940 authored by Jim Bankoski's avatar Jim Bankoski
Browse files

vpnext use segref segmentation filter

Goes through set of ref frames used by each macroblock and
sets seg_lvl_ref_frame flags accordingly..

http://www.corp.google.com/~jimbankoski/no_crawl/segref.html

Change-Id: Iab7f1effd75a839b34eb310d7168692c8f105411
parent 1a9fd54e
......@@ -1992,7 +1992,31 @@ static void decide_kf_ymode_entropy(VP8_COMP *cpi)
}
#endif
static segment_reference_frames(VP8_COMP *cpi)
{
VP8_COMMON *oci = &cpi->common;
MODE_INFO *mi = oci->mi;
int ref[MAX_MB_SEGMENTS]={0};
int i,j;
int mb_index=0;
MACROBLOCKD *const xd = & cpi->mb.e_mbd;
for (i = 0; i < oci->mb_rows; i++)
{
for (j = 0; j < oci->mb_cols; j++, mb_index++)
{
ref[mi[mb_index].mbmi.segment_id]|=(1<<mi[mb_index].mbmi.ref_frame);
}
mb_index++;
}
for (i = 0; i < MAX_MB_SEGMENTS; i++)
{
enable_segfeature(xd,i,SEG_LVL_REF_FRAME);
set_segdata( xd,i, SEG_LVL_REF_FRAME, ref[i]);
}
}
void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest, unsigned long *size)
{
int i, j;
......@@ -2066,6 +2090,8 @@ void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest, unsigned long *size)
vp8_write_bit(bc, (xd->update_mb_segmentation_data) ? 1 : 0);
segment_reference_frames(cpi);
if (xd->update_mb_segmentation_data)
{
signed char Data;
......
......@@ -541,6 +541,20 @@ static void init_seg_features(VP8_COMP *cpi)
// All other frames if segmentation has been enabled
else if ( xd->segmentation_enabled )
{
int i;
// clears prior frame seg lev refs
for (i = 0; i < MAX_MB_SEGMENTS; i++)
{
// only do it if the force drop the background stuff is off
if(!segfeature_active(xd, i, SEG_LVL_MODE))
{
disable_segfeature(xd,i,SEG_LVL_REF_FRAME);
set_segdata( xd,i, SEG_LVL_REF_FRAME, 0xffffff);
}
}
// First normal frame in a valid gf or alt ref group
if ( cpi->common.frames_since_golden == 0 )
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment