Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Initially this:
- unique_ptr<BYTE[]> paddedInput(add_pad_border(pImg, nWidth, nHeight, nPatch));
- // and in the main loop several calls to
- inline void ExtractPatch(T const * const from, int const x, int const y, int const yStep, int const length, T * const to) {/* ... */}
- // like this:
- ExtractPatch(paddedInput.get(), x, y * extendedWidth, extendedWidth, patchLength, w1);
- ////////////////////////////// 10.7s
- // Then changed to:
- BYTE const * const paddedInput_ = add_pad_border(pImg, nWidth, nHeight, nPatch);
- vector<BYTE> paddedInput(paddedInput_, paddedInput_ + (nWidth + 2 * nPatch) * (nHeight + 2 * nPatch));
- delete [] paddedInput_;
- // With the same inline function called like this:
- ExtractPatch(&paddedInput[0], x, y * extendedWidth, extendedWidth, patchLength, w1);
- ////////////////////////////// 9.4s
- // Lastly with vector parameter
- inline void ExtractPatch(std::vector<T> const & from, int const x, int const y, int const yStep, int const length, T * const to) {/* ... */}
- // and calls like:
- ExtractPatch(paddedInput, wx - nPatch, windowRow , extendedWidth, patchLength, w2);
- ////////////////////////////// 14.9s
- // All in release mode with 8 cores fully utilized.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement