| 183 | } |
| 184 | |
| 185 | void StatisticsFileVTMBMS::loadStatisticData(StatisticsData &statisticsData, int poc, int typeID) |
| 186 | { |
| 187 | if (!this->file.isOk()) |
| 188 | return; |
| 189 | |
| 190 | try |
| 191 | { |
| 192 | statisticsData.setFrameIndex(poc); |
| 193 | |
| 194 | std::unique_lock<std::mutex> lock(statisticsData.accessMutex); |
| 195 | |
| 196 | if (this->pocStartList.count(poc) == 0) |
| 197 | { |
| 198 | // There are no statistics in the file for the given frame and index. |
| 199 | statisticsData[typeID] = {}; |
| 200 | return; |
| 201 | } |
| 202 | |
| 203 | auto startPos = this->pocStartList[poc]; |
| 204 | |
| 205 | QTextStream in(this->file.getQFile()); |
| 206 | in.seek(startPos); |
| 207 | |
| 208 | QRegularExpression pocRegex("BlockStat: POC ([0-9]+)"); |
| 209 | |
| 210 | // prepare regex for selected type |
| 211 | auto &statTypes = statisticsData.getStatisticsTypes(); |
| 212 | auto statIt = std::find_if(statTypes.begin(), statTypes.end(), [typeID](StatisticsType &t) { |
| 213 | return t.typeID == typeID; |
| 214 | }); |
| 215 | Q_ASSERT_X(statIt != statTypes.end(), Q_FUNC_INFO, "Stat type not found."); |
| 216 | QRegularExpression typeRegex(" " + statIt->typeName + "="); // for catching lines of the type |
| 217 | |
| 218 | // for extracting scalar value statistics, need to match: |
| 219 | // BlockStat: POC 1 @( 112, 88) [ 8x 8] PredMode=0 |
| 220 | QRegularExpression scalarRegex( |
| 221 | "POC ([0-9]+) @\\( *([0-9]+), *([0-9]+)\\) *\\[ *([0-9]+)x *([0-9]+)\\] *\\w+=([0-9\\-]+)"); |
| 222 | // for extracting vector value statistics, need to match: |
| 223 | // BlockStat: POC 1 @( 120, 80) [ 8x 8] MVL0={ -24, -2} |
| 224 | QRegularExpression vectorRegex("POC ([0-9]+) @\\( *([0-9]+), *([0-9]+)\\) *\\[ *([0-9]+)x " |
| 225 | "*([0-9]+)\\] *\\w+={ *([0-9\\-]+), *([0-9\\-]+)}"); |
| 226 | // for extracting affine transform value statistics, need to match: |
| 227 | // BlockStat: POC 2 @( 192, 96) [64x32] AffineMVL0={-324,-116,-276,-116,-324, -92} |
| 228 | QRegularExpression affineTFRegex( |
| 229 | "POC ([0-9]+) @\\( *([0-9]+), *([0-9]+)\\) *\\[ *([0-9]+)x *([0-9]+)\\] *\\w+={ " |
| 230 | "*([0-9\\-]+), *([0-9\\-]+), *([0-9\\-]+), *([0-9\\-]+), *([0-9\\-]+), *([0-9\\-]+)}"); |
| 231 | // for extracting scalar polygon statistics, need to match: |
| 232 | // BlockStat: POC 2 @[(505, 384)--(511, 384)--(511, 415)--] GeoPUInterIntraFlag=0 |
| 233 | // BlockStat: POC 2 @[(416, 448)--(447, 448)--(447, 478)--(416, 463)--] GeoPUInterIntraFlag=0 |
| 234 | // will capture 3-5 points. other polygons are not supported |
| 235 | QRegularExpression scalarPolygonRegex( |
| 236 | "POC ([0-9]+) @\\[((?:\\( *[0-9]+, *[0-9]+\\)--){3,5})\\] *\\w+=([0-9\\-]+)"); |
| 237 | // for extracting vector polygon statistics: |
| 238 | QRegularExpression vectorPolygonRegex( |
| 239 | "POC ([0-9]+) @\\[((?:\\( *[0-9]+, *[0-9]+\\)--){3,5})\\] *\\w+={ *([0-9\\-]+), " |
| 240 | "*([0-9\\-]+)}"); |
| 241 | // for extracting the partitioning line, we extract |
| 242 | // BlockStat: POC 2 @( 192, 96) [64x32] Line={0,0,31,31} |
nothing calls this directly
no test coverage detected