| 187 | } |
| 188 | |
| 189 | void check_image_size(std::ifstream &fs, size_t raw_size) |
| 190 | { |
| 191 | const size_t current_position = fs.tellg(); |
| 192 | fs.seekg(0, std::ios_base::end); |
| 193 | const size_t end_position = fs.tellg(); |
| 194 | fs.seekg(current_position, std::ios_base::beg); |
| 195 | |
| 196 | if ((end_position - current_position) < raw_size) |
| 197 | { |
| 198 | throw std::runtime_error("Not enough data in file"); |
| 199 | } |
| 200 | } |
| 201 | |
| 202 | void read_image_buffer(std::ifstream &fs, RawTensor &raw) |
| 203 | { |