|
|
Observation
|
00001 /* HiRISE FELICS Line Cache 00002 00003 PIRL CVS ID: FELICS_Line_Cache.hh,v 1.13 2026/07/22 17:30:39 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 #include <cstddef> // for NULL, brought in for Cache.hh 00023 #include <iostream> 00024 #include <string> 00025 00026 // PIRL 00027 #include "Cache.hh" 00028 00029 // UA::HIRISE 00030 #include "Line_Cache.hh" 00031 00032 extern "C" { 00033 int 00034 decompress 00035 ( 00036 char *compressed, 00037 unsigned int amount, 00038 char *decompressed, 00039 unsigned int width, 00040 unsigned int height 00041 ); 00042 } 00043 00044 namespace UA 00045 { 00046 namespace HiRISE 00047 { 00048 // Forward references 00049 class Image_Line; 00050 00051 /******************************************************************************* 00052 FELICS_Line_Cache 00053 */ 00080 class FELICS_Line_Cache 00081 : public Line_Cache 00082 { 00083 public: 00084 /*============================================================================== 00085 Constants: 00086 */ 00088 static const char* const 00089 ID; 00090 00092 static const int 00093 SYNC_BYTES; 00094 00096 static const u_int_8 00097 SYNC_PATTERN[]; 00098 00104 static const int 00105 SYNC_BYTE_FACTOR; 00106 00108 static const int 00109 MAX_LINES_PER_BLOCK; 00110 00112 static const int 00113 MIN_GAP_BYTES; 00114 00115 /*============================================================================== 00116 Constructors 00117 */ 00123 explicit FELICS_Line_Cache (Image_Line& image_line, std::istream& stream); 00124 00125 private: 00126 FELICS_Line_Cache (); 00127 FELICS_Line_Cache (const FELICS_Line_Cache&); 00128 FELICS_Line_Cache& operator= (const FELICS_Line_Cache&); 00129 00130 public: 00131 /*============================================================================== 00132 Accessors 00133 */ 00139 virtual unsigned long long bytes_read () const; 00140 00145 virtual bool compressed_data () const 00146 {return true;} 00147 00155 virtual unsigned long long compressed_bytes () const 00156 {return Compressed_Bytes;} 00157 00165 virtual unsigned long long decompressed_bytes () const 00166 {return Decompressed_Bytes;} 00167 00178 virtual Line_Cache& source (std::istream& stream); 00179 00184 virtual std::istream& source () const; 00185 00186 /*============================================================================== 00187 Manipulators 00188 */ 00214 virtual bool refill (unsigned long max_amount = (unsigned long)-1); 00215 00216 /* Resets the cache to its empty state. 00217 00218 The local Cache and the parent Line_Cache are reset. The number of 00219 {@link compressed_bytes() compressed bytes} and {@link 00220 decompressed_bytes() decompressed bytes} processed are reset to zero. 00221 00222 @see Line_Cache::reset() 00223 */ 00224 virtual void reset (); 00225 00226 /*============================================================================== 00227 FELICS Algorithm 00228 */ 00248 static int 00249 decompress 00250 ( 00251 char *compressed, 00252 unsigned int amount, 00253 char *decompressed, 00254 unsigned int width, 00255 unsigned int height 00256 ); 00257 00258 /*============================================================================== 00259 Utility Functions 00260 */ 00270 static bool is_sync (void* data_at); 00271 00272 /*============================================================================== 00273 Cache Management 00274 */ 00275 private: 00276 00278 class PIRL::Cache 00279 Data_Cache; 00280 00282 long long 00283 Compressed_Bytes; 00284 00286 long long 00287 Decompressed_Bytes; 00288 00289 }; // class FELICS_Line_Cache 00290 00291 } // namespace HiRISE 00292 } // namespace UA 00293 #endif
1.7.2