Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 0d98f20f authored by Georgios Kopanas's avatar Georgios Kopanas
Browse files

Disable blacklisted cameras from preprocessing

Fix bubblesort compile bug
parent 5d73dd8a
No related branches found
No related tags found
No related merge requests found
......@@ -77,7 +77,9 @@ namespace sibr {
int h = 600;
for (int idx = 0; idx < cameras()->inputCameras().size(); idx++) {
const sibr::InputCamera::Ptr cam = cameras()->inputCameras()[idx];
if (!cam->isActive()) {
continue;
}
std::string image_path = myArgs.dataset_path.get() + "/pbnrScene/images/";
makeDirectory(image_path);
......@@ -576,6 +578,9 @@ namespace sibr {
for (int cam_idx = 0; cam_idx < num_views; cam_idx++) {
const sibr::InputCamera::Ptr cam = cameras()->inputCameras()[cam_idx];
if (!cam->isActive()) {
continue;
}
torch::Tensor tarCam_renderedTensor;
get3DPositionAndDepthMap(*cam, cam->w() * scale, cam->h() * scale, tarCam_renderedTensor);
......@@ -643,7 +648,7 @@ namespace sibr {
int cam_choice = -1;
for (int cam_idx = 0; cam_idx < num_views; cam_idx++) {
if (std::find(best_cams.begin(), best_cams.end(), cam_idx) != best_cams.end() ||
cam_idx == skip_id) {
cam_idx == skip_id || !cameras()->inputCameras()[cam_idx]->isActive()) {
continue;
}
torch::Tensor tmp_selection = torch::cat(torch::TensorList({ cam_selection, viewScoreMasks.index({ cam_idx }) }), 2);
......@@ -668,7 +673,7 @@ namespace sibr {
float vis_max = 0.0;
for (int cam_idx = 0; cam_idx < num_views; cam_idx++) {
if (std::find(best_cams.begin(), best_cams.end(), cam_idx) != best_cams.end() ||
cam_idx == skip_id) {
cam_idx == skip_id || !cameras()->inputCameras()[cam_idx]->isActive()) {
continue;
}
torch::Tensor visibility_score = torch::sum(viewScoreMasks.index({ cam_idx })).cpu();
......
......@@ -14,6 +14,27 @@ __device__ inline float NdcToPix(float i, int S) {
const int32_t kMaxPointsPerPixel = 101;
const int32_t kMaxPointPerPixelLocal = 101;
__device__ inline void BubbleSort2(int32_t* arr, const float* points, int n) {
bool already_sorted;
// Bubble sort. We only use it for tiny thread-local arrays (n < 8); in this
// regime we care more about warp divergence than computational complexity.
for (int i = 0; i < n - 1; ++i) {
already_sorted=true;
for (int j = 0; j < n - i - 1; ++j) {
float p_j0_z = points[arr[j]*3 + 2];
float p_j1_z = points[arr[j+1]*3 + 2];
if (p_j1_z < p_j0_z) {
already_sorted = false;
int32_t temp = arr[j];
arr[j] = arr[j + 1];
arr[j + 1] = temp;
}
}
if (already_sorted)
break;
}
}
template <typename T>
__device__ inline void BubbleSort(T* arr, int n) {
bool already_sorted;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment