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