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

Correct color for RGB14v3 messages #141

Closed
wants to merge 1 commit into from

Conversation

stijn-vranckx
Copy link

I compared the behavior with the original C++ code.
The context object is adapted there in the LASreadItemCompressed_POINT14_v3::read and LASreadItemCompressed_POINT14_v4::init methods.

The CompressionContext seems to be the work around here since we can not adapted the context value itself. But I think this should be static.

Also the C++ code contains the following:

inline void LASreadItemCompressed_RGB14_v3::read(U8* item, U32& context)
{
  // get last

  U16* last_item = contexts[current_context].last_item;

  // check for context switch

  if (current_context != context)
  {
    current_context = context; // all other items use context set by POINT14 reader
    if (contexts[current_context].unused)
    {
      createAndInitModelsAndDecompressors(current_context, (U8*)last_item);
      last_item = contexts[current_context].last_item;
    }
  }

having both lines in the if block.

I discovered the problem by unzipping a laz file with RGB14_v3 data with both LAStools and laszip4j and seeing different color values in the resulting las file.

@stijn-vranckx
Copy link
Author

stijn-vranckx commented Jul 31, 2024

The following zip contains a laz file that illustrates the problem. The resulting las file will be different when using LASTools and laszip4j.

500m_5460_59370_IM2023_subset.zip

@mreutegg
Copy link
Owner

I'm closing this PR in favor of #143.

@mreutegg mreutegg closed this Aug 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants