From ea953979fe78a5e5430958195ef5d4b6b2e3aff4 Mon Sep 17 00:00:00 2001 From: Pavel Krajcevski Date: Tue, 21 Jan 2014 15:04:39 -0500 Subject: [PATCH] Move bitstream to FasTC base lib --- BPTCEncoder/CMakeLists.txt | 1 - BPTCEncoder/src/CompressionMode.h | 6 +- BPTCEncoder/src/Compressor.cpp | 3 + Base/CMakeLists.txt | 1 + {BPTCEncoder/src => Base/include}/BitStream.h | 85 +++++++++++-------- 5 files changed, 58 insertions(+), 38 deletions(-) rename {BPTCEncoder/src => Base/include}/BitStream.h (54%) diff --git a/BPTCEncoder/CMakeLists.txt b/BPTCEncoder/CMakeLists.txt index 6581238..03c3758 100644 --- a/BPTCEncoder/CMakeLists.txt +++ b/BPTCEncoder/CMakeLists.txt @@ -106,7 +106,6 @@ SET( HEADERS config/BPTCConfig.h.in include/BPTCCompressor.h src/CompressionMode.h - src/BitStream.h src/RGBAEndpoints.h src/ParallelStage.h ) diff --git a/BPTCEncoder/src/CompressionMode.h b/BPTCEncoder/src/CompressionMode.h index 6eda945..e38a88e 100755 --- a/BPTCEncoder/src/CompressionMode.h +++ b/BPTCEncoder/src/CompressionMode.h @@ -78,7 +78,9 @@ #include "RGBAEndpoints.h" -class BitStream; +namespace FasTC { + class BitStream; +} // namespace FasTC namespace BPTCC { @@ -113,7 +115,7 @@ class CompressionMode { // This function compresses a group of clusters into the passed bitstream. The // size of the clusters array is determined by the BC7 compression mode. - double Compress(BitStream &stream, + double Compress(FasTC::BitStream &stream, const int shapeIdx, const RGBACluster *clusters); // This switch controls the quality of the simulated annealing optimizer. We diff --git a/BPTCEncoder/src/Compressor.cpp b/BPTCEncoder/src/Compressor.cpp index de3ec0d..f85f69c 100755 --- a/BPTCEncoder/src/Compressor.cpp +++ b/BPTCEncoder/src/Compressor.cpp @@ -79,7 +79,10 @@ #include "TexCompTypes.h" #include "BCLookupTables.h" #include "RGBAEndpoints.h" + #include "BitStream.h" +using FasTC::BitStream; +using FasTC::BitStreamReadOnly; #ifdef HAS_MSVC_ATOMICS # include "Windows.h" diff --git a/Base/CMakeLists.txt b/Base/CMakeLists.txt index bee31e9..4db3c82 100644 --- a/Base/CMakeLists.txt +++ b/Base/CMakeLists.txt @@ -58,6 +58,7 @@ SET( SOURCES ) SET( HEADERS + "include/BitStream.h" "include/TexCompTypes.h" "include/Image.h" "include/Color.h" diff --git a/BPTCEncoder/src/BitStream.h b/Base/include/BitStream.h similarity index 54% rename from BPTCEncoder/src/BitStream.h rename to Base/include/BitStream.h index 3f30d6d..8fb6f9a 100755 --- a/BPTCEncoder/src/BitStream.h +++ b/Base/include/BitStream.h @@ -1,30 +1,39 @@ /* FasTC - * Copyright (c) 2012 University of North Carolina at Chapel Hill. All rights reserved. + * Copyright (c) 2012 University of North Carolina at Chapel Hill. + * All rights reserved. * - * Permission to use, copy, modify, and distribute this software and its documentation for educational, - * research, and non-profit purposes, without fee, and without a written agreement is hereby granted, - * provided that the above copyright notice, this paragraph, and the following four paragraphs appear - * in all copies. + * Permission to use, copy, modify, and distribute this software and its + * documentation for educational, research, and non-profit purposes, without + * fee, and without a written agreement is hereby granted, provided that the + * above copyright notice, this paragraph, and the following four paragraphs + * appear in all copies. * - * Permission to incorporate this software into commercial products may be obtained by contacting the - * authors or the Office of Technology Development at the University of North Carolina at Chapel Hill . + * Permission to incorporate this software into commercial products may be + * obtained by contacting the authors or the Office of Technology Development + * at the University of North Carolina at Chapel Hill . * - * This software program and documentation are copyrighted by the University of North Carolina at Chapel Hill. - * The software program and documentation are supplied "as is," without any accompanying services from the - * University of North Carolina at Chapel Hill or the authors. The University of North Carolina at Chapel Hill - * and the authors do not warrant that the operation of the program will be uninterrupted or error-free. The - * end-user understands that the program was developed for research purposes and is advised not to rely - * exclusively on the program for any reason. + * This software program and documentation are copyrighted by the University of + * North Carolina at Chapel Hill. The software program and documentation are + * supplied "as is," without any accompanying services from the University of + * North Carolina at Chapel Hill or the authors. The University of North + * Carolina at Chapel Hill and the authors do not warrant that the operation of + * the program will be uninterrupted or error-free. The end-user understands + * that the program was developed for research purposes and is advised not to + * rely exclusively on the program for any reason. * - * IN NO EVENT SHALL THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL OR THE AUTHORS BE LIABLE TO ANY PARTY FOR - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE - * USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL OR THE - * AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IN NO EVENT SHALL THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL OR THE + * AUTHORS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, + * OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF + * THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF NORTH CAROLINA + * AT CHAPEL HILL OR THE AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. * - * THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL AND THE AUTHORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING, - * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AND ANY - * STATUTORY WARRANTY OF NON-INFRINGEMENT. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY - * OF NORTH CAROLINA AT CHAPEL HILL AND THE AUTHORS HAVE NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, + * THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL AND THE AUTHORS SPECIFICALLY + * DISCLAIM ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AND ANY + * STATUTORY WARRANTY OF NON-INFRINGEMENT. THE SOFTWARE PROVIDED HEREUNDER IS ON + * AN "AS IS" BASIS, AND THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL AND + * THE AUTHORS HAVE NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, * ENHANCEMENTS, OR MODIFICATIONS. * * Please send all BUG REPORTS to . @@ -46,25 +55,28 @@ // // This code has been modified significantly from the original. -//-------------------------------------------------------------------------------------- +//------------------------------------------------------------------------------ // Copyright 2011 Intel Corporation // All Rights Reserved // -// Permission is granted to use, copy, distribute and prepare derivative works of this -// software for any purpose and without fee, provided, that the above copyright notice -// and this statement appear in all copies. Intel makes no representations about the -// suitability of this software for any purpose. THIS SOFTWARE IS PROVIDED "AS IS." -// INTEL SPECIFICALLY DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, AND ALL LIABILITY, -// INCLUDING CONSEQUENTIAL AND OTHER INDIRECT DAMAGES, FOR THE USE OF THIS SOFTWARE, -// INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PROPRIETARY RIGHTS, AND INCLUDING THE -// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Intel does not -// assume any responsibility for any errors which may appear in this software nor any +// Permission is granted to use, copy, distribute and prepare derivative works +// of this software for any purpose and without fee, provided, that the above +// copyright notice and this statement appear in all copies. Intel makes no +// representations about the suitability of this software for any purpose. THIS +// SOFTWARE IS PROVIDED "AS IS." INTEL SPECIFICALLY DISCLAIMS ALL WARRANTIES, +// EXPRESS OR IMPLIED, AND ALL LIABILITY, INCLUDING CONSEQUENTIAL AND OTHER +// INDIRECT DAMAGES, FOR THE USE OF THIS SOFTWARE, INCLUDING LIABILITY FOR +// INFRINGEMENT OF ANY PROPRIETARY RIGHTS, AND INCLUDING THE WARRANTIES OF +// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Intel does not assume +// any responsibility for any errors which may appear in this software nor any // responsibility to update it. // -//-------------------------------------------------------------------------------------- +//------------------------------------------------------------------------------ -#ifndef __BITSTREAM_H__ -#define __BITSTREAM_H__ +#ifndef __BASE_INCLUDE_BITSTREAM_H__ +#define __BASE_INCLUDE_BITSTREAM_H__ + +namespace FasTC { class BitStream { public: @@ -158,4 +170,7 @@ class BitStreamReadOnly { const unsigned char *m_CurByte; int m_NextBit; }; -#endif //__BITSTREAM_H__ + +} // namespace FasTC + +#endif //__BASE_INCLUDE_BITSTREAM_H__