📄 block.c
字号:
t->pia[MB_16x16](t->ref[list_index][vec0.refno]->Y[index[y][x][0]] + ((t->mb.mb_y << 4) + (vec0.y >> 2) + index[y][x][3]) * t->edged_stride + (t->mb.mb_x << 4) + (vec0.x >> 2) + index[y][x][2],
t->ref[list_index][vec0.refno]->Y[index[y][x][1]] + ((t->mb.mb_y << 4) + (vec0.y >> 2) + index[y][x][5]) * t->edged_stride + (t->mb.mb_x << 4) + (vec0.x >> 2) + index[y][x][4],
t->edged_stride, t->edged_stride, ref, 16);
}
}
if(vec1.refno > -1)
{ //if bi-pred
x = (vec1.x & 3);
y = (vec1.y & 3);
list_index = 1;
if(vec0.refno > -1) //if biPred
pred_tmp = pred_16x16bi;
else
pred_tmp = ref;
if (index[y][x][0] == index[y][x][1])
{
tmp = t->ref[list_index][vec1.refno]->Y[index[y][x][0]] + ((t->mb.mb_y << 4) + (vec1.y >> 2)) * t->edged_stride +
((t->mb.mb_x << 4) + (vec1.x >> 2));
t->memcpy_stride_u(tmp, 16, 16, t->edged_stride, pred_tmp, 16);
}
else
{
t->pia[MB_16x16](t->ref[list_index][vec1.refno]->Y[index[y][x][0]] + ((t->mb.mb_y << 4) + (vec1.y >> 2) + index[y][x][3]) * t->edged_stride + (t->mb.mb_x << 4) + (vec1.x >> 2) + index[y][x][2],
t->ref[list_index][vec1.refno]->Y[index[y][x][1]] + ((t->mb.mb_y << 4) + (vec1.y >> 2) + index[y][x][5]) * t->edged_stride + (t->mb.mb_x << 4) + (vec1.x >> 2) + index[y][x][4],
t->edged_stride, t->edged_stride, pred_tmp, 16);
}
}
if(pred_tmp != ref)
{ //if biPred
t->pia[MB_16x16](pred_tmp,ref,16,16,ref,16);
}
break;
case MB_16x8:
vec0 = t->mb.vec[0][0];
vec1 = t->mb.vec[1][0];
pred_tmp = ref;
if(vec0.refno > -1)
{
list_index = 0;
x = (vec0.x & 3);
y = (vec0.y & 3);
if (index[y][x][0] == index[y][x][1])
{
tmp = t->ref[list_index][vec0.refno]->Y[index[y][x][0]] + ((t->mb.mb_y << 4) + (vec0.y >> 2)) * t->edged_stride +
((t->mb.mb_x << 4) + (vec0.x >> 2));
t->memcpy_stride_u(tmp, 16, 8, t->edged_stride, ref, 16);
}
else
{
t->pia[MB_16x8](t->ref[list_index][vec0.refno]->Y[index[y][x][0]] + ((t->mb.mb_y << 4) + (vec0.y >> 2) + index[y][x][3]) * t->edged_stride + (t->mb.mb_x << 4) + (vec0.x >> 2) + index[y][x][2],
t->ref[list_index][vec0.refno]->Y[index[y][x][1]] + ((t->mb.mb_y << 4) + (vec0.y >> 2) + index[y][x][5]) * t->edged_stride + (t->mb.mb_x << 4) + (vec0.x >> 2) + index[y][x][4],
t->edged_stride, t->edged_stride, ref, 16);
}
}
if(vec1.refno > -1)
{
x = (vec1.x & 3);
y = (vec1.y & 3);
list_index = 1;
if(vec0.refno > -1) //if biPred
pred_tmp = pred_16x16bi;
else
pred_tmp = ref;
if (index[y][x][0] == index[y][x][1])
{
tmp = t->ref[list_index][vec1.refno]->Y[index[y][x][0]] + ((t->mb.mb_y << 4) + (vec1.y >> 2)) * t->edged_stride +
((t->mb.mb_x << 4) + (vec1.x >> 2));
t->memcpy_stride_u(tmp, 16, 8, t->edged_stride, pred_tmp, 16);
}
else
{
t->pia[MB_16x8](t->ref[list_index][vec1.refno]->Y[index[y][x][0]] + ((t->mb.mb_y << 4) + (vec1.y >> 2) + index[y][x][3]) * t->edged_stride + (t->mb.mb_x << 4) + (vec1.x >> 2) + index[y][x][2],
t->ref[list_index][vec1.refno]->Y[index[y][x][1]] + ((t->mb.mb_y << 4) + (vec1.y >> 2) + index[y][x][5]) * t->edged_stride + (t->mb.mb_x << 4) + (vec1.x >> 2) + index[y][x][4],
t->edged_stride, t->edged_stride, pred_tmp, 16);
}
}
if(pred_tmp != ref)
{ //if biPred
t->pia[MB_16x8](pred_tmp,ref,16,16,ref,16);
}
//For second MB16x8
vec0 = t->mb.vec[0][8];
vec1 = t->mb.vec[1][8];
pred_tmp = ref + 16 * 8;
if(vec0.refno > -1)
{
x = (vec0.x & 3);
y = (vec0.y & 3);
list_index = 0;
if (index[y][x][0] == index[y][x][1])
{
tmp = t->ref[list_index][vec0.refno]->Y[index[y][x][0]] + ((t->mb.mb_y << 4) + (vec0.y >> 2) + 8) * t->edged_stride +
((t->mb.mb_x << 4) + (vec0.x >> 2));
t->memcpy_stride_u(tmp, 16, 8, t->edged_stride, pred_tmp, 16);
}
else
{
t->pia[MB_16x8](t->ref[list_index][vec0.refno]->Y[index[y][x][0]] + ((t->mb.mb_y << 4) + (vec0.y >> 2) + index[y][x][3] + 8) * t->edged_stride + (t->mb.mb_x << 4) + (vec0.x >> 2) + index[y][x][2],
t->ref[list_index][vec0.refno]->Y[index[y][x][1]] + ((t->mb.mb_y << 4) + (vec0.y >> 2) + index[y][x][5] + 8) * t->edged_stride + (t->mb.mb_x << 4) + (vec0.x >> 2) + index[y][x][4],
t->edged_stride, t->edged_stride, pred_tmp, 16);
}
}
if(vec1.refno > -1)
{
x = (vec1.x & 3);
y = (vec1.y & 3);
list_index = 1;
if(vec0.refno > -1) //if biPred
pred_tmp = pred_16x16bi + 16 * 8;
if (index[y][x][0] == index[y][x][1])
{
tmp = t->ref[list_index][vec1.refno]->Y[index[y][x][0]] + ((t->mb.mb_y << 4) + (vec1.y >> 2) + 8) * t->edged_stride +
((t->mb.mb_x << 4) + (vec1.x >> 2));
t->memcpy_stride_u(tmp, 16, 8, t->edged_stride,pred_tmp, 16);
}
else
{
t->pia[MB_16x8](t->ref[list_index][vec1.refno]->Y[index[y][x][0]] + ((t->mb.mb_y << 4) + (vec1.y >> 2) + index[y][x][3] + 8) * t->edged_stride + (t->mb.mb_x << 4) + (vec1.x >> 2) + index[y][x][2],
t->ref[list_index][vec1.refno]->Y[index[y][x][1]] + ((t->mb.mb_y << 4) + (vec1.y >> 2) + index[y][x][5] + 8) * t->edged_stride + (t->mb.mb_x << 4) + (vec1.x >> 2) + index[y][x][4],
t->edged_stride, t->edged_stride, pred_tmp, 16);
}
}
if(pred_tmp != ref + 16 * 8)
{ //if biPred
t->pia[MB_16x8](pred_tmp,ref + 16 * 8,16,16,ref + 16 * 8,16);
}
break;
case MB_8x16:
pred_tmp = ref;
vec0 = t->mb.vec[0][0];
vec1 = t->mb.vec[1][0];
if(vec0.refno > -1)
{
x = (vec0.x & 3);
y = (vec0.y & 3);
list_index = 0;
if (index[y][x][0] == index[y][x][1])
{
tmp = t->ref[list_index][vec0.refno]->Y[index[y][x][0]] + ((t->mb.mb_y << 4) + (vec0.y >> 2)) * t->edged_stride +
((t->mb.mb_x << 4) + (vec0.x >> 2));
t->memcpy_stride_u(tmp, 8, 16, t->edged_stride, ref, 16);
}
else
{
t->pia[MB_8x16](t->ref[list_index][vec0.refno]->Y[index[y][x][0]] + ((t->mb.mb_y << 4) + (vec0.y >> 2) + index[y][x][3]) * t->edged_stride + (t->mb.mb_x << 4) + (vec0.x >> 2) + index[y][x][2],
t->ref[list_index][vec0.refno]->Y[index[y][x][1]] + ((t->mb.mb_y << 4) + (vec0.y >> 2) + index[y][x][5]) * t->edged_stride + (t->mb.mb_x << 4) + (vec0.x >> 2) + index[y][x][4],
t->edged_stride, t->edged_stride, ref, 16);
}
}
if(vec1.refno > -1)
{
list_index = 1;
x = (vec1.x & 3);
y = (vec1.y & 3);
if(vec0.refno > -1) //if biPred
pred_tmp = pred_16x16bi;
if (index[y][x][0] == index[y][x][1])
{
tmp = t->ref[list_index][vec1.refno]->Y[index[y][x][0]] + ((t->mb.mb_y << 4) + (vec1.y >> 2)) * t->edged_stride +
((t->mb.mb_x << 4) + (vec1.x >> 2));
t->memcpy_stride_u(tmp, 8, 16, t->edged_stride, pred_tmp, 16);
}
else
{
t->pia[MB_8x16](t->ref[list_index][vec1.refno]->Y[index[y][x][0]] + ((t->mb.mb_y << 4) + (vec1.y >> 2) + index[y][x][3]) * t->edged_stride + (t->mb.mb_x << 4) + (vec1.x >> 2) + index[y][x][2],
t->ref[list_index][vec1.refno]->Y[index[y][x][1]] + ((t->mb.mb_y << 4) + (vec1.y >> 2) + index[y][x][5]) * t->edged_stride + (t->mb.mb_x << 4) + (vec1.x >> 2) + index[y][x][4],
t->edged_stride, t->edged_stride,pred_tmp, 16);
}
}
if(pred_tmp != ref)
{ //if biPred
t->pia[MB_8x16](pred_tmp,ref,16,16,ref,16);
}
//for second MB8x16
vec0 = t->mb.vec[0][2];
vec1 = t->mb.vec[1][2];
pred_tmp = ref + 8;
if(vec0.refno > -1)
{
x = (vec0.x & 3);
y = (vec0.y & 3);
list_index = 0;
if (index[y][x][0] == index[y][x][1])
{
tmp = t->ref[list_index][vec0.refno]->Y[index[y][x][0]] + ((t->mb.mb_y << 4) + (vec0.y >> 2)) * t->edged_stride +
((t->mb.mb_x << 4) + (vec0.x >> 2)) + 8;
t->memcpy_stride_u(tmp, 8, 16, t->edged_stride, pred_tmp, 16);
}
else
{
t->pia[MB_8x16](t->ref[list_index][vec0.refno]->Y[index[y][x][0]] + ((t->mb.mb_y << 4) + (vec0.y >> 2) + index[y][x][3]) * t->edged_stride + (t->mb.mb_x << 4) + (vec0.x >> 2) + index[y][x][2] + 8,
t->ref[list_index][vec0.refno]->Y[index[y][x][1]] + ((t->mb.mb_y << 4) + (vec0.y >> 2) + index[y][x][5]) * t->edged_stride + (t->mb.mb_x << 4) + (vec0.x >> 2) + index[y][x][4] + 8,
t->edged_stride, t->edged_stride, pred_tmp, 16);
}
}
if(vec1.refno > -1)
{
x = (vec1.x & 3);
y = (vec1.y & 3);
list_index = 1;
if(vec0.refno > -1) //if biPred
pred_tmp = pred_16x16bi + 8;
if (index[y][x][0] == index[y][x][1])
{
tmp = t->ref[list_index][vec1.refno]->Y[index[y][x][0]] + ((t->mb.mb_y << 4) + (vec1.y >> 2)) * t->edged_stride +
((t->mb.mb_x << 4) + (vec1.x >> 2)) + 8;
t->memcpy_stride_u(tmp, 8, 16, t->edged_stride, pred_tmp, 16);
}
else
{
t->pia[MB_8x16](t->ref[list_index][vec1.refno]->Y[index[y][x][0]] + ((t->mb.mb_y << 4) + (vec1.y >> 2) + index[y][x][3]) * t->edged_stride + (t->mb.mb_x << 4) + (vec1.x >> 2) + index[y][x][2] + 8,
t->ref[list_index][vec1.refno]->Y[index[y][x][1]] + ((t->mb.mb_y << 4) + (vec1.y >> 2) + index[y][x][5]) * t->edged_stride + (t->mb.mb_x << 4) + (vec1.x >> 2) + index[y][x][4] + 8,
t->edged_stride, t->edged_stride,pred_tmp, 16);
}
}
if(pred_tmp != ref + 8)
{ //if biPred
t->pia[MB_8x16](pred_tmp,ref + 8,16,16,ref + 8,16);
}
break;
case MB_8x8:
for(i = 0 ; i < 4 ; i ++)
{
int32_t offset1, offset2;
switch(t->mb.submb_part[luma_index[4 * i]])
{
case MB_8x8:
vec0 = t->mb.vec[0][luma_index[4 * i]];
vec1 = t->mb.vec[1][luma_index[4 * i]];
x = (vec0.x & 3);
y = (vec0.y & 3);
pred_tmp = ref + i / 2 * 16 * 8 + i % 2 * 8;
if(vec0.refno > -1)
{
list_index = 0;
if (index[y][x][0] == index[y][x][1])
{
offset1 = ((t->mb.mb_y << 4) + (vec0.y >> 2) + i / 2 * 8) * t->edged_stride + ((t->mb.mb_x << 4) + (vec0.x >> 2)) + i % 2 * 8;
tmp = t->ref[list_index][vec0.refno]->Y[index[y][x][0]] + offset1;
t->memcpy_stride_u(tmp, 8, 8, t->edged_stride, pred_tmp, 16);
}
else
{
offset1 = ((t->mb.mb_y << 4) + (vec0.y >> 2) + index[y][x][3] + i / 2 * 8) * t->edged_stride + (t->mb.mb_x << 4) + (vec0.x >> 2) + index[y][x][2] + i % 2 * 8;
offset2 = ((t->mb.mb_y << 4) + (vec0.y >> 2) + index[y][x][5] + i / 2 * 8) * t->edged_stride + (t->mb.mb_x << 4) + (vec0.x >> 2) + index[y][x][4] + i % 2 * 8;
t->pia[MB_8x8](t->ref[list_index][vec0.refno]->Y[index[y][x][0]] + offset1,
t->ref[list_index][vec0.refno]->Y[index[y][x][1]] + offset2,
t->edged_stride, t->edged_stride, pred_tmp,16);
}
}
x = (vec1.x & 3);
y = (vec1.y & 3);
if(vec1.refno > -1)
{
list_index = 1;
if(vec0.refno > -1)
pred_tmp = pred_16x16bi + i / 2 * 16 * 8 + i % 2 * 8;
if (index[y][x][0] == index[y][x][1])
{
offset1 = ((t->mb.mb_y << 4) + (vec1.y >> 2) + i / 2 * 8) * t->edged_stride + ((t->mb.mb_x << 4) + (vec1.x >> 2)) + i % 2 * 8;
tmp = t->ref[list_index][vec1.refno]->Y[index[y][x][0]] + offset1;
t->memcpy_stride_u(tmp, 8, 8, t->edged_stride, pred_tmp, 16);
}
else
{
offset1 = ((t->mb.mb_y << 4) + (vec1.y >> 2) + index[y][x][3] + i / 2 * 8) * t->edged_stride + (t->mb.mb_x << 4) + (vec1.x >> 2) + index[y][x][2] + i % 2 * 8;
offset2 = ((t->mb.mb_y << 4) + (vec1.y >> 2) + index[y][x][5] + i / 2 * 8) * t->edged_stride + (t->mb.mb_x << 4) + (vec1.x >> 2) + index[y][x][4] + i % 2 * 8;
t->pia[MB_8x8](t->ref[list_index][vec1.refno]->Y[index[y][x][0]] + offset1,
t->ref[list_index][vec1.refno]->Y[index[y][x][1]] + offset2,
t->edged_stride, t->edged_stride, pred_tmp, 16);
}
}
if(pred_tmp != ref + i / 2 * 16 * 8 + i % 2 * 8)
t->pia[MB_8x8](pred_tmp,ref + i / 2 * 16 * 8 + i % 2 * 8,16,16,ref + i / 2 * 16 * 8 + i % 2 * 8,16);
break;
default:
assert(0);
break;
}
}
break;
default: //only support MB16x16 B-frame
assert(0);
break;
}
}
void
T264dec_mb_decode_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -