Newer
Older

Karsten Suehring
committed
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
static const int g_zScanToY[1 << ( g_maxRtGridSize << 1 )] =
{
0, 0, 1, 1, 0, 0, 1, 1,
2, 2, 3, 3, 2, 2, 3, 3,
0, 0, 1, 1, 0, 0, 1, 1,
2, 2, 3, 3, 2, 2, 3, 3,
4, 4, 5, 5, 4, 4, 5, 5,
6, 6, 7, 7, 6, 5, 7, 7,
4, 4, 5, 5, 4, 4, 5, 5,
6, 6, 7, 7, 6, 5, 7, 7,
};
static const int g_rsScanToZ[1 << ( g_maxRtGridSize << 1 )] =
{
0, 1, 4, 5, 16, 17, 20, 21,
2, 3, 6, 7, 18, 19, 22, 23,
8, 9, 12, 13, 24, 25, 28, 29,
10, 11, 14, 15, 26, 27, 30, 31,
32, 33, 36, 37, 48, 49, 52, 53,
34, 35, 38, 39, 50, 51, 54, 55,
40, 41, 44, 45, 56, 57, 60, 61,
42, 43, 46, 47, 58, 59, 62, 63,
};
Partitioning PartitionerImpl::getMaxTuTiling( const UnitArea &cuArea, const CodingStructure &cs )
{
static_assert( MAX_LOG2_DIFF_CU_TR_SIZE <= g_maxRtGridSize, "Z-scan tables are only provided for MAX_LOG2_DIFF_CU_TR_SIZE for up to 3 (8x8 tiling)!" );
const CompArea area = cuArea.Y().valid() ? cuArea.Y() : cuArea.Cb();
#if MAX_TB_SIZE_SIGNALLING
const int maxTrSize = cs.sps->getMaxTbSize() >> ( isLuma( area.compID ) ? 0 : 1 );
#else
const int maxTrSize = MAX_TB_SIZEY >> ( isLuma( area.compID ) ? 0 : 1 );
#endif

Karsten Suehring
committed
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
const int numTilesH = std::max<int>( 1, area.width / maxTrSize );
const int numTilesV = std::max<int>( 1, area.height / maxTrSize );
const int numTiles = numTilesH * numTilesV;
CHECK( numTiles > MAX_CU_TILING_PARTITIONS, "CU partitioning requires more partitions than available" );
Partitioning ret;
ret.resize( numTiles, cuArea );
for( int i = 0; i < numTiles; i++ )
{
const int rsy = i / numTilesH;
const int rsx = i % numTilesH;
const int x = g_zScanToX[g_rsScanToZ[( rsy << g_maxRtGridSize ) + rsx]];
const int y = g_zScanToY[g_rsScanToZ[( rsy << g_maxRtGridSize ) + rsx]];
UnitArea& tile = ret[i];
for( CompArea &comp : tile.blocks )
{
if( !comp.valid() ) continue;
comp.width /= numTilesH;
comp.height /= numTilesV;
comp.x += comp.width * x;
comp.y += comp.height * y;
}
}
return ret;
}
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
Partitioning PartitionerImpl::getSbtTuTiling( const UnitArea& cuArea, const CodingStructure &cs, const PartSplit splitType )
{
Partitioning ret;
int numTiles = 2;
int widthFactor, heightFactor, xOffsetFactor, yOffsetFactor; // y = (x * factor) >> 2;
assert( splitType >= SBT_VER_HALF_POS0_SPLIT && splitType <= SBT_HOR_QUAD_POS1_SPLIT );
ret.resize( numTiles, cuArea );
for( int i = 0; i < numTiles; i++ )
{
if( splitType >= SBT_VER_QUAD_POS0_SPLIT )
{
if( splitType == SBT_HOR_QUAD_POS0_SPLIT || splitType == SBT_HOR_QUAD_POS1_SPLIT )
{
widthFactor = 4;
xOffsetFactor = 0;
heightFactor = ( ( i == 0 && splitType == SBT_HOR_QUAD_POS0_SPLIT ) || ( i == 1 && splitType == SBT_HOR_QUAD_POS1_SPLIT ) ) ? 1 : 3;
yOffsetFactor = ( i == 0 ) ? 0 : ( splitType == SBT_HOR_QUAD_POS0_SPLIT ? 1 : 3 );
}
else
{
widthFactor = ( ( i == 0 && splitType == SBT_VER_QUAD_POS0_SPLIT ) || ( i == 1 && splitType == SBT_VER_QUAD_POS1_SPLIT ) ) ? 1 : 3;
xOffsetFactor = ( i == 0 ) ? 0 : ( splitType == SBT_VER_QUAD_POS0_SPLIT ? 1 : 3 );
heightFactor = 4;
yOffsetFactor = 0;
}
}
else
{
if( splitType == SBT_HOR_HALF_POS0_SPLIT || splitType == SBT_HOR_HALF_POS1_SPLIT )
{
widthFactor = 4;
xOffsetFactor = 0;
heightFactor = 2;
yOffsetFactor = ( i == 0 ) ? 0 : 2;
}
else
{
widthFactor = 2;
xOffsetFactor = ( i == 0 ) ? 0 : 2;
heightFactor = 4;
yOffsetFactor = 0;
}
}
UnitArea& tile = ret[i];
for( CompArea &comp : tile.blocks )
{
if( !comp.valid() ) continue;
comp.x += ( comp.width * xOffsetFactor ) >> 2;
comp.y += ( comp.height * yOffsetFactor ) >> 2;
comp.width = ( comp.width * widthFactor ) >> 2;
comp.height = ( comp.height * heightFactor ) >> 2;
}
}
return ret;
}