Newer
Older

Karsten Suehring
committed
for(int comp=0; comp<getNumberValidComponents( cs->area.chromaFormat ); comp++)
{
ComponentID compID = ComponentID( comp );
PelBuf p = M_BUFS( 0, PIC_RECONSTRUCTION ).get( compID );
Pel *piTxt = p.bufAt(0,0);
int xmargin = margin >> getComponentScaleX( compID, cs->area.chromaFormat );
int ymargin = margin >> getComponentScaleY( compID, cs->area.chromaFormat );
Pel* pi = piTxt;
// do left and right margins
if (cs->sps->getWrapAroundEnabledFlag())

Karsten Suehring
committed
{
int xoffset = cs->sps->getWrapAroundOffset() >> getComponentScaleX( compID, cs->area.chromaFormat );

Karsten Suehring
committed
{
pi[ -x - 1 ] = pi[ -x - 1 + xoffset ];
pi[ p.width + x ] = pi[ p.width + x - xoffset ];
}
pi += p.stride;

Karsten Suehring
committed
}
}
else
{
for (int y = 0; y < p.height; y++)
{
for (int x = 0; x < xmargin; x++ )
{
pi[ -xmargin + x ] = pi[0];
pi[ p.width + x ] = pi[p.width-1];
}
pi += p.stride;
}
}

Karsten Suehring
committed
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
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
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
// pi is now the (0,height) (bottom left of image within bigger picture
pi -= (p.stride + xmargin);
// pi is now the (-marginX, height-1)
for (int y = 0; y < ymargin; y++ )
{
::memcpy( pi + (y+1)*p.stride, pi, sizeof(Pel)*(p.width + (xmargin << 1)));
}
// pi is still (-marginX, height-1)
pi -= ((p.height-1) * p.stride);
// pi is now (-marginX, 0)
for (int y = 0; y < ymargin; y++ )
{
::memcpy( pi - (y+1)*p.stride, pi, sizeof(Pel)*(p.width + (xmargin<<1)) );
}
}
m_bIsBorderExtended = true;
}
PelBuf Picture::getBuf( const ComponentID compID, const PictureType &type )
{
return M_BUFS( type == PIC_ORIGINAL ? 0 : scheduler.getSplitPicId(), type ).getBuf( compID );
}
const CPelBuf Picture::getBuf( const ComponentID compID, const PictureType &type ) const
{
return M_BUFS( type == PIC_ORIGINAL ? 0 : scheduler.getSplitPicId(), type ).getBuf( compID );
}
PelBuf Picture::getBuf( const CompArea &blk, const PictureType &type )
{
if( !blk.valid() )
{
return PelBuf();
}
#if ENABLE_SPLIT_PARALLELISM
const int jId = type == PIC_ORIGINAL ? 0 : scheduler.getSplitPicId();
#endif
#if !KEEP_PRED_AND_RESI_SIGNALS
if( type == PIC_RESIDUAL || type == PIC_PREDICTION )
{
CompArea localBlk = blk;
localBlk.x &= ( cs->pcv->maxCUWidthMask >> getComponentScaleX( blk.compID, blk.chromaFormat ) );
localBlk.y &= ( cs->pcv->maxCUHeightMask >> getComponentScaleY( blk.compID, blk.chromaFormat ) );
return M_BUFS( jId, type ).getBuf( localBlk );
}
#endif
return M_BUFS( jId, type ).getBuf( blk );
}
const CPelBuf Picture::getBuf( const CompArea &blk, const PictureType &type ) const
{
if( !blk.valid() )
{
return PelBuf();
}
#if ENABLE_SPLIT_PARALLELISM
const int jId = type == PIC_ORIGINAL ? 0 : scheduler.getSplitPicId();
#endif
#if !KEEP_PRED_AND_RESI_SIGNALS
if( type == PIC_RESIDUAL || type == PIC_PREDICTION )
{
CompArea localBlk = blk;
localBlk.x &= ( cs->pcv->maxCUWidthMask >> getComponentScaleX( blk.compID, blk.chromaFormat ) );
localBlk.y &= ( cs->pcv->maxCUHeightMask >> getComponentScaleY( blk.compID, blk.chromaFormat ) );
return M_BUFS( jId, type ).getBuf( localBlk );
}
#endif
return M_BUFS( jId, type ).getBuf( blk );
}
PelUnitBuf Picture::getBuf( const UnitArea &unit, const PictureType &type )
{
if( chromaFormat == CHROMA_400 )
{
return PelUnitBuf( chromaFormat, getBuf( unit.Y(), type ) );
}
else
{
return PelUnitBuf( chromaFormat, getBuf( unit.Y(), type ), getBuf( unit.Cb(), type ), getBuf( unit.Cr(), type ) );
}
}
const CPelUnitBuf Picture::getBuf( const UnitArea &unit, const PictureType &type ) const
{
if( chromaFormat == CHROMA_400 )
{
return CPelUnitBuf( chromaFormat, getBuf( unit.Y(), type ) );
}
else
{
return CPelUnitBuf( chromaFormat, getBuf( unit.Y(), type ), getBuf( unit.Cb(), type ), getBuf( unit.Cr(), type ) );
}
}
Pel* Picture::getOrigin( const PictureType &type, const ComponentID compID ) const
{
#if ENABLE_SPLIT_PARALLELISM
const int jId = type == PIC_ORIGINAL ? 0 : scheduler.getSplitPicId();
#endif
return M_BUFS( jId, type ).getOrigin( compID );
}
void Picture::createSpliceIdx(int nums)
{
m_ctuNums = nums;
m_spliceIdx = new int[m_ctuNums];
memset(m_spliceIdx, 0, m_ctuNums * sizeof(int));
}
bool Picture::getSpliceFull()
{
int count = 0;
for (int i = 0; i < m_ctuNums; i++)
{
if (m_spliceIdx[i] != 0)
count++;
}
if (count < m_ctuNums * 0.25)
return false;
return true;
}
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
#if JVET_M0253_HASH_ME
void Picture::addPictureToHashMapForInter()
{
int picWidth = slices[0]->getSPS()->getPicWidthInLumaSamples();
int picHeight = slices[0]->getSPS()->getPicHeightInLumaSamples();
unsigned int* blockHashValues[2][2];
bool* bIsBlockSame[2][3];
for (int i = 0; i < 2; i++)
{
for (int j = 0; j < 2; j++)
{
blockHashValues[i][j] = new unsigned int[picWidth*picHeight];
}
for (int j = 0; j < 3; j++)
{
bIsBlockSame[i][j] = new bool[picWidth*picHeight];
}
}
m_hashMap.create();
m_hashMap.generateBlock2x2HashValue(getOrigBuf(), picWidth, picHeight, slices[0]->getSPS()->getBitDepths(), blockHashValues[0], bIsBlockSame[0]);//2x2
m_hashMap.generateBlockHashValue(picWidth, picHeight, 4, 4, blockHashValues[0], blockHashValues[1], bIsBlockSame[0], bIsBlockSame[1]);//4x4
m_hashMap.addToHashMapByRowWithPrecalData(blockHashValues[1], bIsBlockSame[1][2], picWidth, picHeight, 4, 4);
m_hashMap.generateRectangleHashValue(picWidth, picHeight, 8, 4, blockHashValues[1], blockHashValues[0], bIsBlockSame[1], bIsBlockSame[0]);//8x4
m_hashMap.addToHashMapByRowWithPrecalData(blockHashValues[0], bIsBlockSame[0][2], picWidth, picHeight, 8, 4);
m_hashMap.generateRectangleHashValue(picWidth, picHeight, 4, 8, blockHashValues[1], blockHashValues[0], bIsBlockSame[1], bIsBlockSame[0]);//4x8
m_hashMap.addToHashMapByRowWithPrecalData(blockHashValues[0], bIsBlockSame[0][2], picWidth, picHeight, 4, 8);
m_hashMap.generateBlockHashValue(picWidth, picHeight, 8, 8, blockHashValues[1], blockHashValues[0], bIsBlockSame[1], bIsBlockSame[0]);//8x8
m_hashMap.addToHashMapByRowWithPrecalData(blockHashValues[0], bIsBlockSame[0][2], picWidth, picHeight, 8, 8);
m_hashMap.generateBlockHashValue(picWidth, picHeight, 16, 16, blockHashValues[0], blockHashValues[1], bIsBlockSame[0], bIsBlockSame[1]);//16x16
m_hashMap.addToHashMapByRowWithPrecalData(blockHashValues[1], bIsBlockSame[1][2], picWidth, picHeight, 16, 16);
m_hashMap.generateBlockHashValue(picWidth, picHeight, 32, 32, blockHashValues[1], blockHashValues[0], bIsBlockSame[1], bIsBlockSame[0]);//32x32
m_hashMap.addToHashMapByRowWithPrecalData(blockHashValues[0], bIsBlockSame[0][2], picWidth, picHeight, 32, 32);
m_hashMap.generateBlockHashValue(picWidth, picHeight, 64, 64, blockHashValues[0], blockHashValues[1], bIsBlockSame[0], bIsBlockSame[1]);//64x64
m_hashMap.addToHashMapByRowWithPrecalData(blockHashValues[1], bIsBlockSame[1][2], picWidth, picHeight, 64, 64);
m_hashMap.setInitial();
for (int i = 0; i < 2; i++)
{
for (int j = 0; j < 2; j++)
{
delete[] blockHashValues[i][j];
}
for (int j = 0; j < 3; j++)
{
delete[] bIsBlockSame[i][j];
}
}
}
#endif