Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow file_io to read large point clouds depending on PCL config #4331

Merged
merged 2 commits into from
Aug 18, 2020
Merged

Conversation

mudskipper75
Copy link
Contributor

Changed unsigned int point_index to std::size_t point_index to enable pcl::PCLPointCloud2 types with more than 2^28 points to be read and saved in ASCII format. Issues still persist with reading and saving in binary format and conversion to pcl::PointCloud types. Related to issue #4326

Changed unsigned int point_index to std::size_t point_index to enable pcl::PCLPointCloud2 types with more than 2^28 points to be read and saved in ASCII format. Issues still persist with reading and saving in binary format and conversion to  pcl::PointCloud<T> types. Related to issue #4326
io/include/pcl/io/file_io.h Outdated Show resolved Hide resolved
@kunaltyagi kunaltyagi changed the title Update file_io.h Allow io to read large point clouds depending on PCL config Aug 18, 2020
@kunaltyagi kunaltyagi added changelog: enhancement Meta-information for changelog generation module: io needs: more work Specify why not closed/merged yet labels Aug 18, 2020
@SergioRAgostinho
Copy link
Member

This is a complicated one, because we have not extended and tested pcl::index support in io. So even if @mudskipper75 configures pcl::index_t to be an unsigned 64 bit integer, there's no guarantee the rest of the library will compile.

@@ -234,7 +234,7 @@ namespace pcl
template <typename Type> inline
std::enable_if_t<std::is_floating_point<Type>::value>
copyValueString (const pcl::PCLPointCloud2 &cloud,
const unsigned int point_index,
const pcl::index_t point_index,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume implicit conversion will happen here with no issues API wise. There will be ABI breakage. Since there's no ABI guarantees for between minor versions I would say let's go with it and not care about deprecation.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replacing unsigned int with uindex_t will make sure no ABI issues, but it's technically index_t. I'll mark it as ABI break here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was uindex_t actually introduced? Indices should always(?) be nonnegative anyway. When should index_t be used and when uindex_t? I did not find any information on this in the documentation.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's an alias to an unsigned representation of whatever index_t is, even if index_t is unsigned. It's a helper type for assisting in the widespread migration to index_t.

Always use index_t. Use uindex_t only you need a guaranteed unsigned type with the same bit length of index_t.

Copy link
Member

@kunaltyagi kunaltyagi Aug 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indices should always(?) be nonnegative anyway

Yes, but 2 counterpoints:

  1. the behaviour till 1.11 was to use int much more than uint for indices
  2. openmp pragma needs the index to be signed, which means this should be an opt-in for the extreme case scenario where casting to signed will overflow

Maybe a PR with these 2 reasons in documentation would be nice 😆

Why was uindex_t actually introduced?

Some places, the value has to be unsigned, such as size, but they are still used for accessing index. In those places, we need to signal to the user via the API that this is 100% not negative (not that indices can be negative), and any negative value will blast (such as conversion warning due to lower API).

We are actually thinking of introducing sindex_t to compliment uindex_t for the explicit reason and make index_t explicitly ambiguous in it's signed needs for places which are ok with both signed and unsigned values.

Sorry. I'm a bit busy reviewing loads of code now and was tardy with my code before.

@SergioRAgostinho
Copy link
Member

I'm ok for merge if CI goes green.

@kunaltyagi kunaltyagi added the changelog: ABI break Meta-information for changelog generation label Aug 18, 2020
Copy link
Member

@kunaltyagi kunaltyagi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI go brrrr

@kunaltyagi kunaltyagi added kind: todo Type of issue and removed needs: more work Specify why not closed/merged yet labels Aug 18, 2020
@kunaltyagi kunaltyagi added this to the pcl-1.12.0 milestone Aug 18, 2020
@kunaltyagi kunaltyagi changed the title Allow io to read large point clouds depending on PCL config Allow file_io to read large point clouds depending on PCL config Aug 18, 2020
@SergioRAgostinho SergioRAgostinho merged commit 60a50bc into PointCloudLibrary:master Aug 18, 2020
kunaltyagi added a commit to kunaltyagi/pcl that referenced this pull request Sep 12, 2020
…point_field_types

* origin/new_point_field_types: (211 commits)
  [CI] Make windows build on c:\ drive to fix out-of-disk-space errors (PointCloudLibrary#4382)
  Replace '.points.' with just '.' (PointCloudLibrary#4217)
  [Surface/Poisson4] Always update counter and prevent overflow access in poisson4 octree (PointCloudLibrary#4316)
  [surface/3rdParty] Add stdlib header for malloc in poisson (bugfix for gcc-5) (PointCloudLibrary#4376)
  [Misc] Deprecate unused ease-of-internal-use headers (PointCloudLibrary#4367)
  Use nth_element in median filter nth_element is faster than partial_sort, and should be used for median finding
  enable CUDA on 16.04 CI
  Optimize includes As recommended by include-what-you-use
  Update gpu_install.rst
  Fix getColor()
  Variable needs to be expanded.
  Optimize includes As recommended by include-what-you-use
  [gpu] Add square distances to ApproxNearestSearch (PointCloudLibrary#4340)
  [common] Allow conversion of PointCloud with more than 32-bit size rows/columns (PointCloudLibrary#4343)
  Change the macro to detect and remove deprecations before release
  update docstring
  clang format approx_nsearch.cu
  another indentation fix
  fix indentation and getBitsNum function
  Allow file_io to read large point clouds depending on PCL config (PointCloudLibrary#4331)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: ABI break Meta-information for changelog generation changelog: enhancement Meta-information for changelog generation kind: todo Type of issue module: io
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants