@@ -261,26 +261,6 @@ void flipHorizontal(const Mat<ScalarT> &in, Mat<ScalarT>& out)
261261namespace libfreenect2
262262{
263263
264- /* *
265- * Load a buffer from data of a file.
266- * @param filename Name of the file to load.
267- * @param buffer Start of the buffer to load.
268- * @param n Size of the buffer to load.
269- * @return Whether loading succeeded.
270- */
271- bool loadBufferFromFile2 (const std::string& filename, unsigned char *buffer, size_t n)
272- {
273- bool success;
274- std::ifstream in (filename.c_str ());
275-
276- in.read (reinterpret_cast <char *>(buffer), n);
277- success = in.gcount () == n;
278-
279- in.close ();
280-
281- return success;
282- }
283-
284264inline int bfi (int width, int offset, int src2, int src3)
285265{
286266 int bitmask = (((1 << width)-1 ) << offset) & 0xffffffff ;
@@ -897,111 +877,18 @@ void CpuDepthPacketProcessor::loadP0TablesFromCommandResponse(unsigned char* buf
897877 impl_->fillTrigTable (impl_->p0_table2 , impl_->trig_table2 );
898878}
899879
900- /* *
901- * Load p0 tables.
902- * @param p0_filename Filename of the first p0 table.
903- * @param p1_filename Filename of the second p0 table.
904- * @param p2_filename Filename of the third p0 table.
905- */
906- void CpuDepthPacketProcessor::loadP0TablesFromFiles (const char * p0_filename, const char * p1_filename, const char * p2_filename)
907- {
908- Mat<uint16_t > p0_table0 (424 , 512 );
909- if (!loadBufferFromFile2 (p0_filename, p0_table0.buffer (), p0_table0.sizeInBytes ()))
910- {
911- LOG_ERROR << " Loading p0table 0 from '" << p0_filename << " ' failed!" ;
912- }
913-
914- Mat<uint16_t > p0_table1 (424 , 512 );
915- if (!loadBufferFromFile2 (p1_filename, p0_table1.buffer (), p0_table1.sizeInBytes ()))
916- {
917- LOG_ERROR << " Loading p0table 1 from '" << p1_filename << " ' failed!" ;
918- }
919-
920- Mat<uint16_t > p0_table2 (424 , 512 );
921- if (!loadBufferFromFile2 (p2_filename, p0_table2.buffer (), p0_table2.sizeInBytes ()))
922- {
923- LOG_ERROR << " Loading p0table 2 from '" << p2_filename << " ' failed!" ;
924- }
925-
926- if (impl_->flip_ptables )
927- {
928- flipHorizontal (p0_table0, impl_->p0_table0 );
929- flipHorizontal (p0_table1, impl_->p0_table1 );
930- flipHorizontal (p0_table2, impl_->p0_table2 );
931-
932- impl_->fillTrigTable (impl_->p0_table0 , impl_->trig_table0 );
933- impl_->fillTrigTable (impl_->p0_table1 , impl_->trig_table1 );
934- impl_->fillTrigTable (impl_->p0_table2 , impl_->trig_table2 );
935- }
936- else
937- {
938- impl_->fillTrigTable (p0_table0, impl_->trig_table0 );
939- impl_->fillTrigTable (p0_table1, impl_->trig_table1 );
940- impl_->fillTrigTable (p0_table2, impl_->trig_table2 );
941- }
942- }
943-
944- /* *
945- * Load the X table from the resources.
946- * @param filename Name of the file to load.
947- * @note Filename is not actually used!
948- */
949- void CpuDepthPacketProcessor::loadXTableFromFile (const char * filename)
880+ void CpuDepthPacketProcessor::loadXZTables (const float *xtable, const float *ztable)
950881{
951882 impl_->x_table .create (424 , 512 );
952- const unsigned char *data;
953- size_t length;
954-
955- if (loadResource (" xTable.bin" , &data, &length))
956- {
957- std::copy (data, data + length, impl_->x_table .buffer ());
958- }
959- else
960- {
961- LOG_ERROR << " Loading xtable from resource 'xTable.bin' failed!" ;
962- }
963- }
883+ std::copy (xtable, xtable + TABLE_SIZE, impl_->x_table .ptr (0 ,0 ));
964884
965- /* *
966- * Load the Z table from the resources.
967- * @param filename Name of the file to load.
968- * @note Filename is not actually used!
969- */
970- void CpuDepthPacketProcessor::loadZTableFromFile (const char * filename)
971- {
972885 impl_->z_table .create (424 , 512 );
973-
974- const unsigned char *data;
975- size_t length;
976-
977- if (loadResource (" zTable.bin" , &data, &length))
978- {
979- std::copy (data, data + length, impl_->z_table .buffer ());
980- }
981- else
982- {
983- LOG_ERROR << " Loading ztable from resource 'zTable.bin' failed!" ;
984- }
886+ std::copy (ztable, ztable + TABLE_SIZE, impl_->z_table .ptr (0 ,0 ));
985887}
986888
987- /* *
988- * Load the lookup table from 11 to 16 from the resources.
989- * @param filename Name of the file to load.
990- * @note Filename is not actually used!
991- */
992- void CpuDepthPacketProcessor::load11To16LutFromFile (const char * filename)
889+ void CpuDepthPacketProcessor::loadLookupTable (const short *lut)
993890{
994- const unsigned char *data;
995- size_t length;
996-
997- if (loadResource (" 11to16.bin" , &data, &length))
998- {
999- std::copy (data, data + length, reinterpret_cast <unsigned char *>(impl_->lut11to16 ));
1000- }
1001- else
1002- {
1003- LOG_ERROR << " Loading 11to16 lut from resource '11to16.bin' failed!" ;
1004- }
891+ std::copy (lut, lut + LUT_SIZE, impl_->lut11to16 );
1005892}
1006893
1007894/* *
0 commit comments