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

Method readHeaderFromFile

YUViewLib/src/statistics/StatisticsFileVTMBMS.cpp:416–554  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

414}
415
416void StatisticsFileVTMBMS::readHeaderFromFile(StatisticsData &statisticsData)
417{
418 try
419 {
420 if (!this->file.isOk())
421 return;
422
423 statisticsData.clear();
424
425 while (!this->file.atEnd())
426 {
427 // read one line
428 auto aLineByteArray = this->file.readLine();
429 QString aLine(aLineByteArray);
430
431 // if we found a non-header line, stop here
432 if (aLine[0] != '#')
433 return;
434
435 // extract statistics information from header lines
436 // match:
437 //# Sequence size: [832x 480]
438 QRegularExpression sequenceSizeRegex("# Sequence size: \\[([0-9]+)x *([0-9]+)\\]");
439
440 // match:
441 //# Block Statistic Type: MergeFlag; Flag
442 QRegularExpression availableStatisticsRegex(
443 "# Block Statistic Type: *([0-9a-zA-Z_]+); *([0-9a-zA-Z]+); *(.*)");
444
445 // get sequence size
446 auto sequenceSizeMatch = sequenceSizeRegex.match(aLine);
447 if (sequenceSizeMatch.hasMatch())
448 {
449 statisticsData.setFrameSize(
450 Size(sequenceSizeMatch.captured(1).toInt(), sequenceSizeMatch.captured(2).toInt()));
451 }
452
453 // get available statistics
454 auto availableStatisticsMatch = availableStatisticsRegex.match(aLine);
455 if (availableStatisticsMatch.hasMatch())
456 {
457 StatisticsType aType;
458 // Store initial state.
459 aType.setInitialState();
460
461 // set name
462 aType.typeName = availableStatisticsMatch.captured(1);
463
464 // with -1, an id will be automatically assigned
465 aType.typeID = -1;
466
467 // check if scalar or vector
468 auto statType = availableStatisticsMatch.captured(2);
469 if (statType.contains(
470 "AffineTFVectors")) // "Vector" is contained in this, need to check it first
471 {
472 auto scaleInfo = availableStatisticsMatch.captured(3);
473 QRegularExpression scaleInfoRegex("Scale: *([0-9]+)");

Callers 1

StatisticsFileVTMBMSMethod · 0.95

Calls 11

SizeClass · 0.85
ColorClass · 0.85
ColorMapperClass · 0.85
isOkMethod · 0.80
readLineMethod · 0.80
setInitialStateMethod · 0.80
containsMethod · 0.80
addStatTypeMethod · 0.80
clearMethod · 0.45
atEndMethod · 0.45
setFrameSizeMethod · 0.45

Tested by

no test coverage detected