// $Id$ //************************************************************************** //* This file is property of and copyright by the ALICE HLT Project * //* ALICE Experiment at CERN, All rights reserved. * //* * //* Primary Authors: Matthias Richter * //* for The ALICE HLT Project. * //* * //* Permission to use, copy, modify and distribute this software and its * //* documentation strictly for non-commercial purposes is hereby granted * //* without fee, provided that the above copyright notice appears in all * //* copies and that both the copyright notice and this permission notice * //* appear in the supporting documentation. The authors make no claims * //* about the suitability of this software for any purpose. It is * //* provided "as is" without express or implied warranty. * //************************************************************************** /// @file AliHLTDataInflater.cxx /// @author Matthias Richter, Timm Steinbeck /// @date 2011-08-10 /// @brief Data inflater reading the bitstream from the AliHLTDataDeflater /// @note Code original from AliHLTTPCCompModelInflater #include "AliHLTDataInflater.h" #include "AliHLTErrorGuard.h" #include #include #include /** ROOT macro for the implementation of ROOT specific class methods */ ClassImp(AliHLTDataInflater) AliHLTDataInflater::AliHLTDataInflater() : AliHLTLogging() , fBitDataCurrentWord(0) , fBitDataCurrentPosInWord(0) , fBitDataCurrentInput(NULL) , fBitDataCurrentInputStart(NULL) , fBitDataCurrentInputEnd(NULL) { // see header file for class documentation // or // refer to README to build package // or // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt } AliHLTDataInflater::~AliHLTDataInflater() { // destructor Clear(); } int AliHLTDataInflater::InitBitDataInput(const AliHLTUInt8_t* input, UInt_t inputSize ) { // init inflater for reading fBitDataCurrentWord = 0; fBitDataCurrentPosInWord = 7; fBitDataCurrentInput = fBitDataCurrentInputStart = input; fBitDataCurrentInputEnd = input+inputSize; fBitDataCurrentWord = *fBitDataCurrentInput; return 0; } void AliHLTDataInflater::CloseBitDataInput() { // close inflater for reading fBitDataCurrentWord=0; fBitDataCurrentPosInWord=0; fBitDataCurrentInput=NULL; fBitDataCurrentInputStart=NULL; fBitDataCurrentInputEnd=NULL; } bool AliHLTDataInflater::InputBit( AliHLTUInt8_t & value ) { // see header file for class documenation if ( fBitDataCurrentInput>=fBitDataCurrentInputEnd ) return false; value = (fBitDataCurrentWord >> fBitDataCurrentPosInWord) & 1; if ( fBitDataCurrentPosInWord ) fBitDataCurrentPosInWord--; else { fBitDataCurrentInput++; if ( fBitDataCurrentInputfBitDataCurrentInputEnd ) return false; memcpy( data, fBitDataCurrentInput, byteCount ); fBitDataCurrentInput += byteCount; if ( fBitDataCurrentInput