MCPcopy Create free account
hub / github.com/IENT/YUView / loadStatisticData

Method loadStatisticData

YUViewLib/src/statistics/StatisticsFileVTMBMS.cpp:185–414  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

183}
184
185void 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}

Callers

nothing calls this directly

Calls 14

isOkMethod · 0.80
setFrameIndexMethod · 0.80
getQFileMethod · 0.80
readLineMethod · 0.80
addLineMethod · 0.80
addBlockVectorMethod · 0.80
addBlockAffineTFMethod · 0.80
addBlockValueMethod · 0.80
addPolygonVectorMethod · 0.80
addPolygonValueMethod · 0.80
hasDataForTypeIDMethod · 0.80
seekMethod · 0.45

Tested by

no test coverage detected