MCPcopy Create free account
hub / github.com/PDAL/PDAL / processRecords

Method processRecords

plugins/e57/libE57Format/src/Encoder.cpp:398–467  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

396}
397
398uint64_t BitpackFloatEncoder::processRecords( size_t recordCount )
399{
400#ifdef E57_VERBOSE
401 std::cout << " BitpackFloatEncoder::processRecords() called, recordCount=" << recordCount
402 << std::endl; //???
403#endif
404
405 // Before we add any more, try to shift current contents of outBuffer_ down to beginning of
406 // buffer. This leaves outBufferEnd_ at a natural boundary.
407 outBufferShiftDown();
408
409 size_t typeSize = ( precision_ == PrecisionSingle ) ? sizeof( float ) : sizeof( double );
410
411#if VALIDATE_BASIC
412 // Verify that outBufferEnd_ is multiple of typeSize (so transfers of floats are aligned
413 // naturally in memory).
414 if ( outBufferEnd_ % typeSize )
415 {
416 throw E57_EXCEPTION2( ErrorInternal, "outBufferEnd=" + toString( outBufferEnd_ ) +
417 " typeSize=" + toString( typeSize ) );
418 }
419#endif
420
421 // Figure out how many records will fit in output.
422 size_t maxOutputRecords = ( outBuffer_.size() - outBufferEnd_ ) / typeSize;
423
424 // Can't process more records than will safely fit in output stream
425 if ( recordCount > maxOutputRecords )
426 {
427 recordCount = maxOutputRecords;
428 }
429
430 if ( precision_ == PrecisionSingle )
431 {
432 // Form the starting address for next available location in outBuffer
433 auto outp = reinterpret_cast<float *>( &outBuffer_[outBufferEnd_] );
434
435 // Copy floats from sourceBuffer_ to outBuffer_
436 for ( unsigned i = 0; i < recordCount; i++ )
437 {
438 outp[i] = sourceBuffer_->getNextFloat();
439#ifdef E57_VERBOSE
440 std::cout << "encoding float: " << outp[i] << std::endl;
441#endif
442 }
443 }
444 else
445 {
446 // Double precision
447 // Form the starting address for next available location in outBuffer
448 auto outp = reinterpret_cast<double *>( &outBuffer_[outBufferEnd_] );
449
450 // Copy doubles from sourceBuffer_ to outBuffer_
451 for ( unsigned i = 0; i < recordCount; i++ )
452 {
453 outp[i] = sourceBuffer_->getNextDouble();
454#ifdef E57_VERBOSE
455 std::cout << "encoding double: " << outp[i] << std::endl;

Callers 1

writeMethod · 0.80

Calls 9

binaryStringFunction · 0.85
hexStringFunction · 0.85
getNextFloatMethod · 0.80
getNextDoubleMethod · 0.80
getNextStringMethod · 0.80
getNextInt64Method · 0.80
toStringFunction · 0.70
sizeMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected