[Kst] extragear/graphics/kst/src/datasources/scuba2
Andrew Walker
arwalker at sumusltd.com
Tue Feb 6 23:33:45 CET 2007
SVN commit 630979 by arwalker:
support raw datamode
M +56 -52 scuba.cpp
M +2 -1 scuba.h
--- trunk/extragear/graphics/kst/src/datasources/scuba2/scuba.cpp #630978:630979
@@ -497,8 +497,10 @@
}
if (fieldIndex != -1) {
- QIODevice::Offset bufread = _frameIndex[s + n] - _frameIndex[s];
+ int iSamplesPerFrame = samplesPerFrame(field);
+ QIODevice::Offset bufread = _frameIndex[(s + n)/iSamplesPerFrame] - _frameIndex[s/iSamplesPerFrame];
+
if (bufread > 0) {
QStringList values;
QFile file(_filename);
@@ -526,7 +528,7 @@
for (i = 0; i < n; ++i) {
v[i] = KST::NOPOINT;
- file.at(_frameIndex[s + i]);
+ file.at(_frameIndex[(s + i)/iSamplesPerFrame]);
if (fieldIndex < numHousekeepingFields) {
if( readFullLine(file, str) != -1) {
@@ -540,14 +542,15 @@
}
} else {
switch (_datamode) {
- case 0:
- case 1:
- case 2:
- case 3:
+ case DataError:
+ case DataPreScaleFeedback:
+ case DataFiltered:
+ case DataRaw:
valueIndex = fieldIndex - numHousekeepingFields;
+ valueIndex += s + i - (((s + i)/iSamplesPerFrame) * iSamplesPerFrame );
break;
- case 4:
- case 5:
+ case Data18_14:
+ case Data24_8:
valueIndex = (fieldIndex - numHousekeepingFields) / 2;
break;
}
@@ -568,12 +571,12 @@
if (lineIndex < int(values.size())) {
lvalue = values[lineIndex].toInt(&ok, 10);
switch (_datamode) {
- case 0:
- case 1:
- case 2:
- case 3:
+ case DataError:
+ case DataPreScaleFeedback:
+ case DataFiltered:
+ case DataRaw:
break;
- case 4:
+ case Data18_14:
if (valueIndex % 2 == 0) {
lvalue >>= 14;
lvalue &= 0x3FFFF;
@@ -589,7 +592,7 @@
}
}
break;
- case 5:
+ case Data24_8:
if (valueIndex % 2 == 0) {
lvalue >>= 8;
lvalue &= 0xFFFFFF;
@@ -636,7 +639,7 @@
bool ScubaSource::isValidMatrix(const QString& matrix) const {
- return matrixList().contains(matrix);
+ return matrixList().contains(matrix);
}
@@ -659,7 +662,11 @@
//
// need to determine the number of samples per frame...
//
- rc = 1;
+ if (_datamode == 3) {
+ rc = _numCols * _numRows;
+ } else {
+ rc = 1;
+ }
}
return rc;
@@ -745,27 +752,26 @@
rc += housekeepingFields[i];
}
- if( datamode >= 0) {
+ if (datamode == DataRaw) {
+ rc += QString("Pixel(raw)");
+ } else if (datamode >= 0) {
for (i=0; i<num_rows; i++) {
for (j=0; j<num_cols; j++) {
switch (datamode) {
- case 0:
+ case DataError:
rc += QString("Error[%1,%2]").arg(i).arg(j);
break;
- case 1:
+ case DataPreScaleFeedback:
rc += QString("Pixel[%1,%2]").arg(i).arg(j);
break;
- case 2:
+ case DataFiltered:
rc += QString("Pixel(filtered)[%1,%2]").arg(i).arg(j);
break;
- case 3:
- rc += QString("Pixel(raw)[%1,%2]").arg(i).arg(j);
- break;
- case 4:
+ case Data18_14:
rc += QString("Pixel[%1,%2]").arg(i).arg(j);
rc += QString("Error[%1,%2]").arg(i).arg(j);
break;
- case 5:
+ case Data24_8:
rc += QString("Pixel[%1,%2]").arg(i).arg(j);
rc += QString("Error[%1,%2]").arg(i).arg(j);
break;
@@ -782,32 +788,30 @@
//
// include matrices if requested...
//
- if (cfg->_readMatrices) {
- for (i=0; i<numFrames; ++i) {
- switch (datamode) {
- case 0:
- rc += QString("FrameError[%1]").arg(i);
- break;
- case 1:
- rc += QString("FramePixel[%1]").arg(i);
- break;
- case 2:
- rc += QString("FramePixel(filtered)[%1]").arg(i);
- break;
- case 3:
- rc += QString("FramePixel(raw)[%1]").arg(i);
- break;
- case 4:
- rc += QString("FramePixel[%1]").arg(i);
- rc += QString("FrameError[%1]").arg(i);
- break;
- case 5:
- rc += QString("FramePixel[%1]").arg(i);
- rc += QString("FrameError[%1]").arg(i);
- break;
- default:
- break;
-
+ if (datamode != DataRaw) {
+ if (cfg->_readMatrices) {
+ for (i=0; i<numFrames; ++i) {
+ switch (datamode) {
+ case DataError:
+ rc += QString("FrameError[%1]").arg(i);
+ break;
+ case DataPreScaleFeedback:
+ rc += QString("FramePixel[%1]").arg(i);
+ break;
+ case DataFiltered:
+ rc += QString("FramePixel(filtered)[%1]").arg(i);
+ break;
+ case Data18_14:
+ rc += QString("FramePixel[%1]").arg(i);
+ rc += QString("FrameError[%1]").arg(i);
+ break;
+ case Data24_8:
+ rc += QString("FramePixel[%1]").arg(i);
+ rc += QString("FrameError[%1]").arg(i);
+ break;
+ default:
+ break;
+ }
}
*/
}
@@ -832,7 +836,7 @@
QStringList ScubaSource::matrixList() const {
if (_matrixList.isEmpty()) {
//
- // for scuba data sources, matrix fields start Frame
+ // for scuba data sources, matrix fields start with Frame
//
_matrixList = fieldList().grep(QRegExp("Frame*"));
}
--- trunk/extragear/graphics/kst/src/datasources/scuba2/scuba.h #630978:630979
@@ -22,7 +22,8 @@
#include <kstdatasource.h>
-enum DataFormat { FormatText, FormatBinary, FormatText2 };
+enum DataFormat { FormatText = 0, FormatBinary, FormatText2 };
+enum DataMode { DataError = 0, DataPreScaleFeedback, DataFiltered, DataRaw, Data18_14, Data24_8 };
class ScubaSource : public KstDataSource {
public:
More information about the Kst
mailing list