| 6791 | } ChannelInfo; |
| 6792 | |
| 6793 | void ReadChannelInfo(std::vector<ChannelInfo> &channels, |
| 6794 | const std::vector<unsigned char> &data) { |
| 6795 | const char *p = reinterpret_cast<const char *>(&data.at(0)); |
| 6796 | |
| 6797 | for (;;) { |
| 6798 | if ((*p) == 0) { |
| 6799 | break; |
| 6800 | } |
| 6801 | ChannelInfo info; |
| 6802 | p = ReadString(info.name, p); |
| 6803 | |
| 6804 | memcpy(&info.pixelType, p, sizeof(int)); |
| 6805 | p += 4; |
| 6806 | info.pLinear = p[0]; // uchar |
| 6807 | p += 1 + 3; // reserved: uchar[3] |
| 6808 | memcpy(&info.xSampling, p, sizeof(int)); // int |
| 6809 | p += 4; |
| 6810 | memcpy(&info.ySampling, p, sizeof(int)); // int |
| 6811 | p += 4; |
| 6812 | |
| 6813 | if (IsBigEndian()) { |
| 6814 | swap4(reinterpret_cast<unsigned int*>(&info.pixelType)); |
| 6815 | swap4(reinterpret_cast<unsigned int*>(&info.xSampling)); |
| 6816 | swap4(reinterpret_cast<unsigned int*>(&info.ySampling)); |
| 6817 | } |
| 6818 | |
| 6819 | channels.push_back(info); |
| 6820 | } |
| 6821 | } |
| 6822 | |
| 6823 | void WriteChannelInfo(std::vector<unsigned char> &data, |
| 6824 | const std::vector<ChannelInfo> &channels) { |
no test coverage detected