void
T264_intra_16x16_available(T264_t* t, int32_t preds[], int32_t* modes, uint8_t* top, uint8_t* left)
{
uint8_t* p;
int32_t i; if ((t->mb.mb_neighbour & (MB_LEFT | MB_TOP)) == (MB_LEFT | MB_TOP))
{
preds[0] = Intra_16x16_TOP;
preds[1] = Intra_16x16_LEFT;
preds[2] = Intra_16x16_DC;
preds[3] = Intra_16x16_PLANE;
*modes = 4; p = t->mb.dst_y - t->edged_stride;
for(i = -1 ; i < 16 ; i ++)
{
top[i] = p[i];
} p --; for(i = -1 ; i < 16 ; i ++)
{
left[i] = p[0];
p += t->edged_stride;
}
}
else if(t->mb.mb_neighbour & MB_LEFT)
{
preds[0] = Intra_16x16_LEFT;
preds[1] = Intra_16x16_DCLEFT;
*modes = 2; p = t->mb.dst_y - 1; for(i = 0 ; i < 16 ; i ++)
{
left[i] = p[0];
p += t->edged_stride;
}
}
else if(t->mb.mb_neighbour & MB_TOP)
{
preds[0] = Intra_16x16_TOP;
preds[1] = Intra_16x16_DCTOP;
*modes = 2; p = t->mb.dst_y - t->edged_stride;
for(i = 0 ; i < 16 ; i ++)
{
top[i] = p[i];
}
}
else
{
preds[0] = Intra_16x16_DC128;
*modes = 1;
}
}void
T264_intra_4x4_available(T264_t* t, int32_t idx, int32_t preds[], int32_t* modes, uint8_t* dst, uint8_t* left, uint8_t* top)
{
static const int32_t neighbour[] =
{
0, MB_LEFT, MB_LEFT, MB_LEFT,
MB_TOP| MB_TOPRIGHT, MB_LEFT| MB_TOP, MB_LEFT |MB_TOP| MB_TOPRIGHT, MB_LEFT| MB_TOP,
MB_TOP| MB_TOPRIGHT, MB_LEFT| MB_TOP| MB_TOPRIGHT, MB_LEFT |MB_TOP| MB_TOPRIGHT, MB_LEFT| MB_TOP,
MB_TOP| MB_TOPRIGHT, MB_LEFT| MB_TOP, MB_LEFT |MB_TOP| MB_TOPRIGHT, MB_LEFT| MB_TOP
};
static const int32_t fix[] =
{
~0, ~0, ~0, ~0,
~0, ~MB_TOPRIGHT, ~0, ~MB_TOPRIGHT,
~0, ~0, ~0, ~MB_TOPRIGHT,
~0, ~MB_TOPRIGHT, ~0, ~MB_TOPRIGHT
}; uint8_t* p;
int32_t i;
int32_t mb_neighbour = (t->mb.mb_neighbour| neighbour[idx]) & fix[idx]; if((idx & 3) == 3) //if is the right-most sub-block
if(t->mb.mb_x == t->mb_width - 1) //if is th last MB in horizontal
mb_neighbour &= ~MB_TOPRIGHT; //no top-right exist
if ((mb_neighbour & (MB_LEFT | MB_TOP)) == (MB_LEFT | MB_TOP))
{
preds[0] = Intra_4x4_TOP;
preds[1] = Intra_4x4_LEFT;
preds[2] = Intra_4x4_DC; preds[3] = Intra_4x4_DIAGONAL_DOWNLEFT;
preds[4] = Intra_4x4_DIAGONAL_DOWNRIGHT;
preds[5] = Intra_4x4_VERTICAL_RIGHT;
preds[6] = Intra_4x4_HORIZONTAL_DOWN;
preds[7] = Intra_4x4_VERTICAL_LEFT;
preds[8] = Intra_4x4_HORIZONTAL_UP;
*modes = 9; p = dst - t->edged_stride;
if (mb_neighbour & MB_TOPRIGHT)
{
for(i = -1 ; i < 8 ; i ++)
{
top[i] = p[i];
}
}
else
{
for(i = -1 ; i < 4 ; i ++)
{
top[i] = p[i];
} //to fill padded 4 positions
for( ; i < 8 ; ++ i)
top[i] = p[3];
} p --; for(i = -1 ; i < 4 ; i ++)
{
left[i] = p[0];
p += t->edged_stride;
}
}
else if(mb_neighbour & MB_LEFT)
{
preds[0] = Intra_4x4_LEFT;
preds[1] = Intra_4x4_DCLEFT; preds[2] = Intra_4x4_HORIZONTAL_UP;
*modes = 3; p = dst - 1; for(i = 0 ; i < 4 ; i ++)
{
left[i] = p[0];
p += t->edged_stride;
}
}
else if(mb_neighbour & MB_TOP)
{
preds[0] = Intra_4x4_TOP;
preds[1] = Intra_4x4_DCTOP;
preds[2] = Intra_4x4_DIAGONAL_DOWNLEFT;
preds[3] = Intra_4x4_VERTICAL_LEFT;
*modes = 4; p = dst - t->edged_stride;
if (mb_neighbour & MB_TOPRIGHT)
{
for(i = -1 ; i < 8 ; i ++)
{
top[i] = p[i];
}
}
else
{
for(i = -1 ; i < 4 ; i ++)
{
top[i] = p[i];
}
for( ; i < 8 ; ++ i)
top[i] = p[3];
}
}
else
{
preds[0] = Intra_4x4_DC128;
*modes = 1;
}
}
T264_intra_16x16_available(T264_t* t, int32_t preds[], int32_t* modes, uint8_t* top, uint8_t* left)
{
uint8_t* p;
int32_t i; if ((t->mb.mb_neighbour & (MB_LEFT | MB_TOP)) == (MB_LEFT | MB_TOP))
{
preds[0] = Intra_16x16_TOP;
preds[1] = Intra_16x16_LEFT;
preds[2] = Intra_16x16_DC;
preds[3] = Intra_16x16_PLANE;
*modes = 4; p = t->mb.dst_y - t->edged_stride;
for(i = -1 ; i < 16 ; i ++)
{
top[i] = p[i];
} p --; for(i = -1 ; i < 16 ; i ++)
{
left[i] = p[0];
p += t->edged_stride;
}
}
else if(t->mb.mb_neighbour & MB_LEFT)
{
preds[0] = Intra_16x16_LEFT;
preds[1] = Intra_16x16_DCLEFT;
*modes = 2; p = t->mb.dst_y - 1; for(i = 0 ; i < 16 ; i ++)
{
left[i] = p[0];
p += t->edged_stride;
}
}
else if(t->mb.mb_neighbour & MB_TOP)
{
preds[0] = Intra_16x16_TOP;
preds[1] = Intra_16x16_DCTOP;
*modes = 2; p = t->mb.dst_y - t->edged_stride;
for(i = 0 ; i < 16 ; i ++)
{
top[i] = p[i];
}
}
else
{
preds[0] = Intra_16x16_DC128;
*modes = 1;
}
}void
T264_intra_4x4_available(T264_t* t, int32_t idx, int32_t preds[], int32_t* modes, uint8_t* dst, uint8_t* left, uint8_t* top)
{
static const int32_t neighbour[] =
{
0, MB_LEFT, MB_LEFT, MB_LEFT,
MB_TOP| MB_TOPRIGHT, MB_LEFT| MB_TOP, MB_LEFT |MB_TOP| MB_TOPRIGHT, MB_LEFT| MB_TOP,
MB_TOP| MB_TOPRIGHT, MB_LEFT| MB_TOP| MB_TOPRIGHT, MB_LEFT |MB_TOP| MB_TOPRIGHT, MB_LEFT| MB_TOP,
MB_TOP| MB_TOPRIGHT, MB_LEFT| MB_TOP, MB_LEFT |MB_TOP| MB_TOPRIGHT, MB_LEFT| MB_TOP
};
static const int32_t fix[] =
{
~0, ~0, ~0, ~0,
~0, ~MB_TOPRIGHT, ~0, ~MB_TOPRIGHT,
~0, ~0, ~0, ~MB_TOPRIGHT,
~0, ~MB_TOPRIGHT, ~0, ~MB_TOPRIGHT
}; uint8_t* p;
int32_t i;
int32_t mb_neighbour = (t->mb.mb_neighbour| neighbour[idx]) & fix[idx]; if((idx & 3) == 3) //if is the right-most sub-block
if(t->mb.mb_x == t->mb_width - 1) //if is th last MB in horizontal
mb_neighbour &= ~MB_TOPRIGHT; //no top-right exist
if ((mb_neighbour & (MB_LEFT | MB_TOP)) == (MB_LEFT | MB_TOP))
{
preds[0] = Intra_4x4_TOP;
preds[1] = Intra_4x4_LEFT;
preds[2] = Intra_4x4_DC; preds[3] = Intra_4x4_DIAGONAL_DOWNLEFT;
preds[4] = Intra_4x4_DIAGONAL_DOWNRIGHT;
preds[5] = Intra_4x4_VERTICAL_RIGHT;
preds[6] = Intra_4x4_HORIZONTAL_DOWN;
preds[7] = Intra_4x4_VERTICAL_LEFT;
preds[8] = Intra_4x4_HORIZONTAL_UP;
*modes = 9; p = dst - t->edged_stride;
if (mb_neighbour & MB_TOPRIGHT)
{
for(i = -1 ; i < 8 ; i ++)
{
top[i] = p[i];
}
}
else
{
for(i = -1 ; i < 4 ; i ++)
{
top[i] = p[i];
} //to fill padded 4 positions
for( ; i < 8 ; ++ i)
top[i] = p[3];
} p --; for(i = -1 ; i < 4 ; i ++)
{
left[i] = p[0];
p += t->edged_stride;
}
}
else if(mb_neighbour & MB_LEFT)
{
preds[0] = Intra_4x4_LEFT;
preds[1] = Intra_4x4_DCLEFT; preds[2] = Intra_4x4_HORIZONTAL_UP;
*modes = 3; p = dst - 1; for(i = 0 ; i < 4 ; i ++)
{
left[i] = p[0];
p += t->edged_stride;
}
}
else if(mb_neighbour & MB_TOP)
{
preds[0] = Intra_4x4_TOP;
preds[1] = Intra_4x4_DCTOP;
preds[2] = Intra_4x4_DIAGONAL_DOWNLEFT;
preds[3] = Intra_4x4_VERTICAL_LEFT;
*modes = 4; p = dst - t->edged_stride;
if (mb_neighbour & MB_TOPRIGHT)
{
for(i = -1 ; i < 8 ; i ++)
{
top[i] = p[i];
}
}
else
{
for(i = -1 ; i < 4 ; i ++)
{
top[i] = p[i];
}
for( ; i < 8 ; ++ i)
top[i] = p[3];
}
}
else
{
preds[0] = Intra_4x4_DC128;
*modes = 1;
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货