-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #121 from rapidsai/branch-21.10
- Loading branch information
Showing
62 changed files
with
2,438 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
21.08.01 | ||
21.10.00 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright (c) 2021, NVIDIA CORPORATION. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
// | ||
#ifndef CUCIM_UTIL_PLATFORM_H | ||
#define CUCIM_UTIL_PLATFORM_H | ||
|
||
#include "cucim/macros/api_header.h" | ||
|
||
/** | ||
* @brief Platform-specific macros and functions. | ||
*/ | ||
namespace cucim::util | ||
{ | ||
|
||
EXPORT_VISIBLE bool is_in_wsl(); | ||
|
||
} // namespace cucim::util | ||
|
||
#endif // CUCIM_UTIL_PLATFORM_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
21.08.01 | ||
21.10.00 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/* | ||
* Apache License, Version 2.0 | ||
* Copyright 2021 NVIDIA Corporation | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/** | ||
* Code below is using libdeflate library which is under MIT license | ||
* Please see LICENSE-3rdparty.md for the detail. | ||
*/ | ||
|
||
#include "raw.h" | ||
|
||
#include <cstring> | ||
#include <stdexcept> | ||
#include <unistd.h> | ||
|
||
|
||
namespace cuslide::raw | ||
{ | ||
|
||
bool decode_raw(int fd, | ||
unsigned char* raw_buf, | ||
uint64_t offset, | ||
uint64_t size, | ||
uint8_t** dest, | ||
uint64_t dest_nbytes, | ||
const cucim::io::Device& out_device) | ||
{ | ||
(void)out_device; | ||
|
||
if (dest == nullptr) | ||
{ | ||
throw std::runtime_error("'dest' shouldn't be nullptr in decode_raw()"); | ||
} | ||
|
||
// Allocate memory only when dest is not null | ||
if (*dest == nullptr) | ||
{ | ||
if ((*dest = (unsigned char*)malloc(dest_nbytes)) == nullptr) | ||
{ | ||
throw std::runtime_error("Unable to allocate uncompressed image buffer"); | ||
} | ||
} | ||
|
||
if (raw_buf == nullptr) | ||
{ | ||
if ((raw_buf = (unsigned char*)malloc(size)) == nullptr) | ||
{ | ||
throw std::runtime_error("Unable to allocate buffer for raw data!"); | ||
} | ||
|
||
if (pread(fd, raw_buf, size, offset) < 1) | ||
{ | ||
throw std::runtime_error("Unable to read file for raw data!"); | ||
} | ||
} | ||
else | ||
{ | ||
fd = -1; | ||
raw_buf += offset; | ||
} | ||
|
||
memcpy(*dest, raw_buf, dest_nbytes); | ||
|
||
if (fd != -1) | ||
{ | ||
free(raw_buf); | ||
} | ||
|
||
return true; | ||
} | ||
|
||
} // namespace cuslide::raw |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Apache License, Version 2.0 | ||
* Copyright 2021 NVIDIA Corporation | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
#ifndef CUSLIDE_RAW_H | ||
#define CUSLIDE_RAW_H | ||
|
||
#include <cucim/io/device.h> | ||
|
||
namespace cuslide::raw | ||
{ | ||
|
||
bool decode_raw(int fd, | ||
unsigned char* raw_buf, | ||
uint64_t offset, | ||
uint64_t size, | ||
uint8_t** dest, | ||
uint64_t dest_nbytes, | ||
const cucim::io::Device& out_device); | ||
} | ||
#endif // CUSLIDE_RAW_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.