File indexing completed on 2025-08-06 08:17:18
0001
0002
0003
0004
0005
0006 #ifndef MVTXDECODER_PIXELDATA_H
0007 #define MVTXDECODER_PIXELDATA_H
0008
0009 #include "DecodingStat.h"
0010 #include <cstdint>
0011 #include <vector>
0012
0013 namespace mvtx
0014 {
0015
0016 class PixelData
0017 {
0018
0019 public:
0020 PixelData(uint16_t r = 0, uint16_t c = 0) : mRow(r), mCol(c) {}
0021 uint16_t getRow() const { return mRow; }
0022 uint16_t getCol() const { return mCol; }
0023
0024 private:
0025 uint16_t mRow = 0;
0026 uint16_t mCol = 0;
0027
0028
0029 };
0030
0031
0032
0033 class ChipPixelData
0034 {
0035
0036 public:
0037
0038 static constexpr size_t MAXDATAERRBYTES = 16, MAXDATAERRBYTES_AFTER = 2;
0039 ChipPixelData() = default;
0040 ~ChipPixelData() = default;
0041 uint16_t getChipID() const { return mChipID; }
0042 const std::vector<PixelData>& getData() const { return mPixels; }
0043 std::vector<PixelData>& getData() { return (std::vector<PixelData>&)mPixels; }
0044
0045
0046 void setChipID(uint16_t id) { mChipID = id; }
0047
0048
0049 void setError(ChipStat::DecErrors i) { mErrors |= 0x1 << i; }
0050 void addErrorInfo(uint64_t b) { mErrorInfo |= b; }
0051 void setErrorFlags(uint32_t f) { mErrors |= f; }
0052 bool isErrorSet(ChipStat::DecErrors i) const { return mErrors & (0x1 << i); }
0053 bool isErrorSet() const { return mErrors != 0; }
0054 auto getErrorFlags() const { return mErrors; }
0055 auto getErrorInfo() const { return mErrorInfo; }
0056 auto getNBytesInRawBuff() const { return int(mErrorInfo >> 32) & 0xff; }
0057 void setNBytesInRawBuff(int n) { mErrorInfo |= (uint64_t(n & 0xff)) << 32; }
0058 auto& getRawErrBuff() { return mRawBuff; }
0059 auto& getRawErrBuff() const { return mRawBuff; }
0060 std::string getErrorDetails(int pos) const;
0061
0062 void resetChipID()
0063 {
0064 mChipID = -1;
0065 }
0066
0067 void clear()
0068 {
0069 resetChipID();
0070 mPixels.clear();
0071 mErrors = 0;
0072 mErrorInfo = 0;
0073 }
0074
0075 void swap(ChipPixelData& other)
0076 {
0077 std::swap(mChipID, other.mChipID);
0078 std::swap(mErrors, other.mErrors);
0079 mPixels.swap(other.mPixels);
0080 }
0081
0082 void print() const;
0083
0084 private:
0085 uint16_t mChipID = 0;
0086 uint32_t mErrors = 0;
0087 uint64_t mErrorInfo = 0;
0088 std::array<uint8_t, MAXDATAERRBYTES> mRawBuff{};
0089 std::vector<PixelData> mPixels;
0090
0091
0092 };
0093 }
0094
0095 #endif