![]() |
Observation
|
00001 /* HiRISE FELICS Line Cache 00002 00003 PIRL CVS ID: FELICS_Line_Cache.hh,v 1.12 2024/02/29 02:50:07 guym Exp 00004 00005 Copyright (C) 2004-2020 Arizona Board of Regents on behalf of the Lunar and 00006 Planetary Laboratory at the University of Arizona. 00007 00008 Licensed under the Apache License, Version 2.0 (the "License"); you may not use 00009 this file except in compliance with the License. You may obtain a copy of the 00010 License at 00011 00012 http://www.apache.org/licenses/LICENSE-2.0 00013 00014 Unless required by applicable law or agreed to in writing, software distributed 00015 under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 00016 CONDITIONS OF ANY KIND, either express or implied. See the License for the 00017 specific language governing permissions and limitations under the License. 00018 */ 00019 #ifndef _HiRISE_FELICS_Line_Cache_ 00020 #define _HiRISE_FELICS_Line_Cache_ 00021 00022 // UA::HiRISE 00023 #include "Cache.hh" 00024 #include "Line_Cache.hh" 00025 00026 00027 #include <iostream> 00028 #include <string> 00029 00030 extern "C" { 00031 int 00032 decompress 00033 ( 00034 char *compressed, 00035 unsigned int amount, 00036 char *decompressed, 00037 unsigned int width, 00038 unsigned int height 00039 ); 00040 } 00041 00042 namespace UA 00043 { 00044 namespace HiRISE 00045 { 00046 // Forward references 00047 class Image_Line; 00048 00049 /******************************************************************************* 00050 FELICS_Line_Cache 00051 */ 00078 class FELICS_Line_Cache 00079 : public Line_Cache 00080 { 00081 public: 00082 /*============================================================================== 00083 Constants: 00084 */ 00086 static const char* const 00087 ID; 00088 00090 static const int 00091 SYNC_BYTES; 00092 00094 static const u_int_8 00095 SYNC_PATTERN[]; 00096 00102 static const int 00103 SYNC_BYTE_FACTOR; 00104 00106 static const int 00107 MAX_LINES_PER_BLOCK; 00108 00110 static const int 00111 MIN_GAP_BYTES; 00112 00113 /*============================================================================== 00114 Constructors 00115 */ 00121 explicit FELICS_Line_Cache (Image_Line& image_line, std::istream& stream); 00122 00123 private: 00124 FELICS_Line_Cache (); 00125 FELICS_Line_Cache (const FELICS_Line_Cache&); 00126 FELICS_Line_Cache& operator= (const FELICS_Line_Cache&); 00127 00128 public: 00129 /*============================================================================== 00130 Accessors 00131 */ 00137 virtual unsigned long long bytes_read () const; 00138 00143 virtual bool compressed_data () const 00144 {return true;} 00145 00153 virtual unsigned long long compressed_bytes () const 00154 {return Compressed_Bytes;} 00155 00163 virtual unsigned long long decompressed_bytes () const 00164 {return Decompressed_Bytes;} 00165 00176 virtual Line_Cache& source (std::istream& stream); 00177 00182 virtual std::istream& source () const; 00183 00184 /*============================================================================== 00185 Manipulators 00186 */ 00212 virtual bool refill (unsigned long max_amount = (unsigned long)-1); 00213 00214 /* Resets the cache to its empty state. 00215 00216 The local Cache and the parent Line_Cache are reset. The number of 00217 {@link compressed_bytes() compressed bytes} and {@link 00218 decompressed_bytes() decompressed bytes} processed are reset to zero. 00219 00220 @see Line_Cache::reset() 00221 */ 00222 virtual void reset (); 00223 00224 /*============================================================================== 00225 FELICS Algorithm 00226 */ 00246 static int 00247 decompress 00248 ( 00249 char *compressed, 00250 unsigned int amount, 00251 char *decompressed, 00252 unsigned int width, 00253 unsigned int height 00254 ); 00255 00256 /*============================================================================== 00257 Utility Functions 00258 */ 00268 static bool is_sync (void* data_at); 00269 00270 /*============================================================================== 00271 Cache Management 00272 */ 00273 private: 00274 00276 class PIRL::Cache 00277 Data_Cache; 00278 00280 long long 00281 Compressed_Bytes; 00282 00284 long long 00285 Decompressed_Bytes; 00286 00287 }; // class FELICS_Line_Cache 00288 00289 } // namespace HiRISE 00290 } // namespace UA 00291 #endif