Mercurial > hg > orthanc
comparison Core/Images/PamReader.cpp @ 3837:963ea9fab402
merge
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 15 Apr 2020 17:28:27 +0200 |
parents | 219de90c1f43 |
children | 95083d2f6819 |
comparison
equal
deleted
inserted
replaced
3836:0c16051dfd56 | 3837:963ea9fab402 |
---|---|
198 { | 198 { |
199 throw OrthancException(ErrorCode_BadFileFormat); | 199 throw OrthancException(ErrorCode_BadFileFormat); |
200 } | 200 } |
201 | 201 |
202 size_t offset = content_.size() - pitch * height; | 202 size_t offset = content_.size() - pitch * height; |
203 AssignWritable(format, width, height, pitch, &content_[offset]); | 203 |
204 { | |
205 intptr_t bufferAddr = reinterpret_cast<intptr_t>(&content_[offset]); | |
206 if((bufferAddr % 8) == 0) | |
207 LOG(TRACE) << "PamReader::ParseContent() image address = " << bufferAddr; | |
208 else | |
209 LOG(TRACE) << "PamReader::ParseContent() image address = " << bufferAddr << " (not a multiple of 8!)"; | |
210 } | |
211 | |
212 // if we want to enforce alignment, we need to use a freshly allocated | |
213 // buffer, since we have no alignment guarantees on the original one | |
214 if (enforceAligned_) | |
215 { | |
216 if (alignedImageBuffer_ != NULL) | |
217 free(alignedImageBuffer_); | |
218 alignedImageBuffer_ = malloc(pitch * height); | |
219 memcpy(alignedImageBuffer_, &content_[offset], pitch* height); | |
220 content_ = ""; | |
221 AssignWritable(format, width, height, pitch, alignedImageBuffer_); | |
222 } | |
223 else | |
224 { | |
225 AssignWritable(format, width, height, pitch, &content_[offset]); | |
226 } | |
204 | 227 |
205 // Byte swapping if needed | 228 // Byte swapping if needed |
206 if (bytesPerChannel != 1 && | 229 if (bytesPerChannel != 1 && |
207 bytesPerChannel != 2) | 230 bytesPerChannel != 2) |
208 { | 231 { |
229 at abort | 252 at abort |
230 at alignfault | 253 at alignfault |
231 at SAFE_HEAP_LOAD_i32_2_2 (wasm-function[251132]:39) | 254 at SAFE_HEAP_LOAD_i32_2_2 (wasm-function[251132]:39) |
232 at __ZN7Orthanc9PamReader12ParseContentEv (wasm-function[11457]:8088) | 255 at __ZN7Orthanc9PamReader12ParseContentEv (wasm-function[11457]:8088) |
233 | 256 |
234 Web Assenmbly IS LITTLE ENDIAN! | 257 Web Assembly IS LITTLE ENDIAN! |
235 | 258 |
236 Perhaps in htobe16 ? | 259 Perhaps in htobe16 ? |
237 */ | 260 */ |
238 uint8_t* srcdst = reinterpret_cast<uint8_t*>(pixel); | 261 uint8_t* srcdst = reinterpret_cast<uint8_t*>(pixel); |
239 uint8_t tmp = srcdst[0]; | 262 uint8_t tmp = srcdst[0]; |