HiRISE
 Observation

Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
FELICS_Line_Cache Class Reference

A FELICS_Line_Cache extends a Line_Cache by adding management of FELICS compressed line data. More...

#include <FELICS_Line_Cache.hh>

Inheritance diagram for FELICS_Line_Cache:
Inheritance graph
[legend]
Collaboration diagram for FELICS_Line_Cache:
Collaboration graph
[legend]

Public Member Functions

 FELICS_Line_Cache (Image_Line &image_line, std::istream &stream)
 Constructs a FELICS_Line_Cache for an Image_Line bound to an istream. More...
 
virtual unsigned long long bytes_read () const
 Gets the total number of bytes read from the source stream. More...
 
virtual bool compressed_data () const
 Tests if the image data is compressed. More...
 
virtual unsigned long long compressed_bytes () const
 Gets the amount (bytes) of compressed data that has been processed. More...
 
virtual unsigned long long decompressed_bytes () const
 Gets the amount of decompressed data that has been generated. More...
 
virtual Line_Cachesource (std::istream &stream)
 Sets the data source stream. More...
 
virtual std::istream & source () const
 Gets the data source stream. More...
 
virtual bool refill (unsigned long max_amount=(unsigned long) -1)
 Refills the Line_Cache storage. More...
 
virtual void reset ()
 Resets the cache to its empty state and the line structure to match the current structure of the managed line. More...
 
- Public Member Functions inherited from Line_Cache
 Line_Cache (Image_Line &image_line, std::istream &stream)
 Constructs a Line_Cache for an Image_Line bound to an istream. More...
 
unsigned long long source_bytes () const
 Gets the amount (bytes) of source data that has been used. More...
 
unsigned int count () const
 Gets the current line count. More...
 
std::string bad_line_description () const
 Gets the description of the bad line cause. More...
 
bool synchronization_lost ()
 Check for lost line synchronization. More...
 
bool next_line ()
 Gets the next line of image data into the Image_Line being managed. More...
 
- Public Member Functions inherited from Image_Line
 Image_Line ()
 Constructs a default Image_Line. More...
 
 Image_Line (unsigned int bytes_per_pixel, unsigned int total_pixels, unsigned int total_lines=0, unsigned int channel_number=CCD_UNKNOWN, std::istream *stream=NULL)
 Constructs an Image_Line of a specified line length and pixel size. More...
 
 Image_Line (const Image_Line &component, bool duplicate=true)
 Copy constructor. More...
 
Image_Lineoperator= (const Image_Line &component)
 Assigns another Image_Line to this one. More...
 
virtual ~Image_Line ()
 Destructor. More...
 
std::string id () const
 Provides the class ID on a line followed by the base Data_Component::id. More...
 
const char * name () const
 Gets the NAME of this class. More...
 
u_int_32 sync () const
 Gets the extended Sync Element value. More...
 
Image_Linesync (u_int_32 value)
 Sets the extended Sync Element value. More...
 
u_int_32 channel () const
 Gets the Channel Element channel number. More...
 
Image_Linechannel (u_int_32 channel_number)
 Sets the Channel Element channel number. More...
 
u_int_32 expected_channel () const
 Gets the expected channel number for the line header. More...
 
Image_Lineexpected_channel (u_int_32 channel_number)
 Sets the expected channel number for the line header. More...
 
u_int_32 line_number () const
 Gets the Line_Number Element value. More...
 
Image_Lineline_number (u_int_32 line)
 Sets the Line_Number Element value. More...
 
bool bad_line () const
 Tests if the bad line flag is set. More...
 
Image_Linebad_line (bool state)
 Sets or clears the bad line flag. More...
 
std::string bad_line_description () const
 Gets the description of the bad line cause. More...
 
Pixel_type pixel (Index index) const
 Gets a pixel value. More...
 
Pixel_type operator[] (Index index) const
 Gets a pixel value. More...
 
void pixel (Index index, Pixel_type value)
 Sets a pixel value. More...
 
Pixel_type buffer_pixel (Index index) const
 Gets a Buffer_Pixels Element value. More...
 
void buffer_pixel (Index index, Pixel_type value)
 Sets a Buffer_Pixels Element value. More...
 
Pixel_type image_pixel (Index index) const
 Gets an Image_Pixels Element value. More...
 
void image_pixel (Index index, Pixel_type value)
 Sets an Image_Pixels Element value. More...
 
Pixel_type black_pixel (Index index) const
 Gets a Black_Pixels Element value. More...
 
void black_pixel (Index index, Pixel_type value)
 Sets a Black_Pixels Element value. More...
 
Pixel_type virtual_pixel (Index index) const
 Gets a Virtual_Pixels Element value. More...
 
void virtual_pixel (Index index, Pixel_type value)
 Sets a Virtual_Pixels Element value. More...
 
unsigned int pixel_count () const
 Gets the total number of pixels in the line. More...
 
Image_Linepixel_count (unsigned int total_pixels)
 Sets the total number of pixels in the line. More...
 
unsigned int pixel_bytes () const
 Gets the number of bytes per pixel. More...
 
Image_Linepixel_bytes (unsigned int bytes_per_pixel)
 Sets the number of bytes per pixel. More...
 
unsigned int total_lines () const
 Gets the total number of image lines in the channel data set. More...
 
Image_Linetotal_lines (unsigned int lines)
 Sets the total number of image lines in the channel data set. More...
 
void mirror ()
 Mirrors the order of all pixels. More...
 
Image_Linelookup (const LUT &lut)
 Applies a LUT mapping to all pixel values. More...
 
Image_Linepukool (Pixel_type *table)
 Applies a "reverse" table mapping to all pixel values. More...
 
std::istream & source () const
 Gets the istream being used as the source of line data. More...
 
Image_Linesource (std::istream &stream)
 Sets the input stream to be used as the source of line data. More...
 
bool next ()
 Gets the next image line. More...
 
unsigned int count () const
 Gets the current line count. More...
 
unsigned long long bytes_read () const
 Gets the number of bytes read from the data source. More...
 
unsigned long long source_bytes () const
 Gets the amount (bytes) of source data that has been used. More...
 
bool compressed_data () const
 Indicates if the source line data was FELICS compressed. More...
 
unsigned long long compressed_bytes () const
 Gets the amount (bytes) of compressed data that has been processed. More...
 
unsigned long long decompressed_bytes () const
 Gets the amount (bytes) of decompressed data that has been generated. More...
 
Line_Cachecache ()
 Gets the line's data management cache object. More...
 
bool synchronization_lost ()
 Check for lost line synchronization. More...
 
std::ostream & print (std::ostream &stream=std::cout, bool verbose=false) const
 Prints the component structure and contents. More...
 
unsigned int width () const
 Gets the print listing width. More...
 
Image_Linewidth (unsigned int groups)
 Sets the print listing width. More...
 
idaeim::PVL::AggregatePVL () const
 Produces a PVL rendition of the component. More...
 
idaeim::PVL::AggregatePVL_description () const
 Produces a PVL description of the observation image data layout for a PDS label. More...
 
bool is_valid () const
 Tests if the component data is valid. More...
 
- Public Member Functions inherited from Data_Component
 Data_Component (const char **names=NULL, unsigned int size=0, const Index *offsets=NULL, const Index indexed_arrays[][2]=NULL, Data_Order order=Data_Block::MSB)
 Constructs a Data_Component using component specifications. More...
 
 Data_Component (const Data_Component &component, bool data_duplicate=true)
 Copy constructor. More...
 
Data_Componentoperator= (const Data_Component &component)
 Assignment operator. More...
 
virtual ~Data_Component ()
 Destructor. More...
 
const char * name (Index element) const
 Gets the name of a component Element. More...
 
virtual u_int_32 get (Index element, Index index=0) const
 Gets a value from a data Element or array entry of the component. More...
 
virtual Data_Componentput (const u_int_32 value, Index element, Index index=0)
 Puts a value into a data Element or array entry of the component. More...
 
std::ostream & print_element (const Index element, int format=DECIMAL, std::ostream &stream=std::cout, int width=0) const
 Prints an Element description. More...
 
std::ostream & print_element (const Index element, std::ostream &stream) const
 Prints an Element description. More...
 
std::ostream & print_element_location (const Index element, std::ostream &stream=std::cout) const
 Prints the location of an Element in the component. More...
 
unsigned int element_location_print_width (Index element) const
 Gets the width of the Element location printing fields. More...
 
unsigned int name_field_width () const
 Gets the width of the Element name printing field. More...
 
Data_Componentname_field_width (unsigned int width)
 Sets the width of the Element name field for printing. More...
 
Data_Blockdata (void *const block)
 Overrides the base Data_Block::data to reset Local_Data. More...
 
Data_Blockattach (void *const block, unsigned int size)
 Attaches a new block of data to the component. More...
 
Data_Componentresize (unsigned int size)
 Resizes the block of local data storage. More...
 
unsigned char * data () const
 Gets a pointer to the current component storage. More...
 
unsigned int local_data ()
 Gets the size of the local data storage area. More...
 
u_int_16 internet_checksum () const
 Calculates the Internet Checksum as per RFC 1071. More...
 
- Public Member Functions inherited from Data_Block
 Data_Block ()
 
 Data_Block (void *const data, const Index *offsets, Index total_elements=0, const Index *array_counts=NULL, bool native_order=true)
 
 Data_Block (void *const data, const Value_List &offsets, const Value_List &array_counts, bool native_order=true)
 
 Data_Block (void *const data, const Value_List &offsets, bool native_order=true)
 
 Data_Block (void *const data, const Index *offsets, Index total_elements, const Index *array_counts, Data_Order data_order)
 
 Data_Block (void *const data, const Value_List &offsets, const Value_List &array_counts, Data_Order data_order)
 
 Data_Block (void *const data, const Index *offsets, Index total_elements, Data_Order data_order)
 
 Data_Block (void *const data, const Index *offsets, Data_Order data_order)
 
 Data_Block (void *const data, const Value_List &offsets, Data_Order data_order)
 
 Data_Block (void *const data, const Index *offsets, const Index indexed_counts[][2], Data_Order data_order)
 
 Data_Block (const Data_Block &data_block)
 
Data_Blockoperator= (const Data_Block &data_block)
 
virtual ~Data_Block ()
 
bool native () const
 
Data_Blocknative (bool native_order)
 
Data_Order data_order () const
 
Data_Blockdata_order (Data_Order order)
 
unsigned char * data () const
 
Index size () const
 
Value_List element_offsets_list () const
 
Indexelement_offsets ()
 
bool element_offsets (const Value_List &offsets)
 
bool element_offsets (const Index *offsets, Index total_elements=NO_INDEX)
 
bool element_sizes (const Value_List &sizes)
 
bool element_sizes (const Index *sizes, Index total_elements=NO_INDEX)
 
Index offset_of (Index element) const
 
bool offset_of (Index element, Index offset)
 
bool insert_element (Index offset, Index size, Index array_count=1)
 
Data_Blockdelete_element (Index element)
 
Data_Blockshift_offsets (int amount)
 
Index elements () const
 
Index size_of (Index element) const
 
bool size_of (Index element, Index size)
 
Index value_size_of (Index element) const
 
Data_Blockvalue_size_of (Index element, Index size)
 
Index index_of (Index offset) const
 
Value_List array_counts_list () const
 
Indexarray_counts ()
 
Data_Blockarray_counts (const Value_List &counts, Index begin=0)
 
Data_Blockarray_counts (const Index *counts, Index begin=0, Index end=NO_INDEX)
 
Data_Blockarray_indexed_counts (const Index indexed_counts[][2], Index total_counts=NO_INDEX)
 
Data_Blockarray_offset_counts (const Index offset_counts[][2], Index total_counts=NO_INDEX)
 
Index count_of (Index element) const
 
Data_Blockcount_of (Index element, Index count)
 
bool reset_counts (bool unconditional=true, Index begin=0, Index end=NO_INDEX)
 
const Data_Blockget (T &value, const Index element, const Index index=0) const
 
const Data_Blockget (T &value, const Index element, const Index index=0) const
 
get (const Index element, const Index index=0) const
 
get (const Index element, const Index index=0) const
 
Data_Blockput (T &value, const Index element, const Index index=0)
 
Data_Blockput (T &value, const Index element, const Index index=0)
 
const Data_Blockget (T *array, const Index element, Index count=0) const
 
const Data_Blockget (T *array, const Index element, Index count=0) const
 
Data_Blockput (T *array, const Index element, Index count=0)
 
Data_Blockput (T *array, const Index element, Index count=0)
 
std::istream & input (std::istream &stream)
 
std::ostream & output (std::ostream &stream) const
 
std::ostream & print (std::ostream &stream=std::cout) const
 
- Public Member Functions inherited from Cache
 Cache ()
 
 Cache (unsigned long capacity, unsigned long data_margin=0, Data_Test data_test=NULL)
 
 Cache (unsigned long capacity, std::istream &source, unsigned long data_margin=0, Data_Test data_test=NULL)
 
virtual ~Cache ()
 
Cachesource (std::istream &source)
 
std::istream & source () const
 
unsigned long long bytes_read () const
 
Cachedata_margin (unsigned long amount)
 
unsigned long data_margin () const
 
Cachedata_test (Data_Test tester, unsigned long data_amount)
 
Data_Test data_test () const
 
unsigned long data_test_amount () const
 
virtual void drain ()
 
virtual Cacheput (char *data, unsigned long amount)
 
virtual unsigned long get (char *data, unsigned long amount)
 
unsigned long capacity () const
 
Cachecapacity (unsigned long amount)
 
unsigned long amount_used () const
 
unsigned long amount_free () const
 
char * start () const
 
Cachenext (char *location)
 
char * next () const
 
unsigned long amount_consumed () const
 
long amount_remaining () const
 
char * last () const
 
Cachelast (char *location)
 
void state_report (std::ostream &stream) const
 
void state_report () const
 

Static Public Member Functions

static int decompress (char *compressed, unsigned int amount, char *decompressed, unsigned int width, unsigned int height)
 Decompresses FELICS compressed data. More...
 
static bool is_sync (void *data_at)
 Tests for a FELICS synchronization pattern. More...
 
- Static Public Member Functions inherited from Image_Line
static unsigned int calibration_lines ()
 Gets the number of image lines designated as calibration data. More...
 
static void calibration_lines (unsigned int lines)
 Sets the number of image lines designated as calibration data. More...
 
static bool is_sync (void *data_at)
 Tests if some data contains a line header sync pattern. More...
 
static Sync_Type next_sync (std::istream &stream)
 Searches an istream for an image data synchronization pattern. More...
 
- Static Public Member Functions inherited from Instrument
static unsigned int calibration_lines_minimum (unsigned int TDI, unsigned int binning)
 
static int focal_plane_x_offset (unsigned int CPMM, unsigned int binning=1)
 
- Static Public Member Functions inherited from Data_Block
static Data_Order native_order ()
 
static Value_Listsizes_to_offsets (Value_List &sizes)
 
static Indexsizes_to_offsets (Index *sizes, Index total_elements=NO_INDEX)
 
static Value_Listoffsets_to_sizes (Value_List &offsets)
 
static Indexoffsets_to_sizes (Index *offsets, Index total_elements=NO_INDEX)
 

Static Public Attributes

static const char *const ID
 Class identification name with source code version and date. More...
 
static const int SYNC_BYTES = 16
 The number of bytes in the FELICS sync pattern. More...
 
static const u_int_8 SYNC_PATTERN []
 The synchronization pattern that begins each compressed data block. More...
 
static const int SYNC_BYTE_FACTOR = 0x11
 The byte number multiplier factor used to create the FELICS synchronization pattern. More...
 
static const int MAX_LINES_PER_BLOCK = LINES_PER_FELICS_BLOCK
 The maximum number of image lines in a FELICS data block. More...
 
static const int MIN_GAP_BYTES = 4
 The minimum number of gap value bytes in a gap sequence. More...
 
- Static Public Attributes inherited from Line_Cache
static const char *const ID
 Class identification name with source code version and date. More...
 
- Static Public Attributes inherited from Image_Line
static const char *const ID
 Class identification name with source code version and date. More...
 
static const char *const NAME = "Image Line"
 The component name. More...
 
static const char * NAMES []
 The name of each Element. More...
 
static const unsigned int LINE_HEADER_BYTES = 6
 The number of bytes in the line header section. More...
 
static const unsigned int BUFFER_PIXELS_COUNT = 12
 The number of buffer pixels. More...
 
static const unsigned int BLACK_PIXELS_COUNT = 16
 The number of black pixels. More...
 
static const unsigned int MAX_VIRTUAL_PIXELS_COUNT = MAX_VIRTUAL_PIXELS
 The maximum number of allowable virtual pixels. More...
 
static const unsigned int MAX_PIXELS_PER_LINE
 The maximum number of pixels allowed. More...
 
static const unsigned int DEFAULT_CALIBRATION_LINES = CALIBRATION_LINES
 The default number of calibration lines at the beginning of the observation channel data. More...
 
static const Index MAX_COMPONENT_BYTES
 Total maximum number of bytes in the Data_Block. More...
 
static const Index OFFSETS_TEMPLATE []
 Data_Block data storage address offset template for each Element. More...
 
static const Index ARRAY_COUNTS_TEMPLATE [][2]
 Data_Block array element value counts each keyed to an Element Index. More...
 
static const u_int_32 SYNC = 0xFF00E000
 Expected Sync Element value after extension. More...
 
static const u_int_8 SYNC_3 = 0xFF
 Expected Sync Element MSB (byte 3) value. More...
 
static const u_int_8 SYNC_2 = 0x00
 Expected Sync Element MSB+1 (byte 2) value. More...
 
static const u_int_8 SYNC_1_BIT_MASK = 0xE0
 Bit mask for the Sync Element extension field of the Channel Element. More...
 
static const u_int_8 CHANNEL_BIT_MASK = 0x1F
 Bit mask for channel number field of the Channel Element. More...
 
static const u_int_32 LINE_NUMBER_MASK = 0x007FFFFF
 Bit mask for the line number field of the Line_Number Element. More...
 
static const char * Sync_Type_Names []
 Sync_Type names. More...
 
static const unsigned int DEFAULT_WIDTH = LINE_PRINT_GROUPS_WIDTH
 The default width, in pixel groups, of a print listing. More...
 
static unsigned int Calibration_Lines = CALIBRATION_LINES
 Number of image lines at the beginning of the image data to be designated as calibration data. More...
 
- Static Public Attributes inherited from Data_Component
static const char *const ID
 Class identification name with source code version and date. More...
 
static const int DECIMAL = 0
 Format specifier. More...
 
static const int HEX = -1
 
static const int BOOLEAN = -2
 
static const char PATHNAME_DELIMITER = FILESYSTEM_PATHNAME_DELIMITER
 Host filesystem pathname delimiter. More...
 
static const int UTC_SECONDS_PRECISION = SECONDS_PRECISION
 UTC seconds precision (digits after the decimal point). More...
 
static const char SUBSECONDS_DELIMITER = ':'
 Delimits subseconds from seconds in clock count representations. More...
 
static const char *const SPICE_METAKERNEL_VARIABLE
 The name of the environment variable for the SPICE metakernel pathname. More...
 
static const char *const DEFAULT_SPICE_METAKERNEL
 The default SPICE metakernal pathname. More...
 
static const int MRO_CLOCK_ID = MRO_CLOCK_NAIF_ID
 The ID used by NAIF for specifying the MRO clock to CSPICE routines. More...
 
static const char *const INVALID_UTC_TIME = DEFAULT_INVALID_UTC_TIME
 
- Static Public Attributes inherited from Instrument
static const char *const ID
 
static const unsigned int CCDS
 
static const unsigned int CCD_UNKNOWN
 
static const char *const CCD_NAMES []
 
static const char *const CCD_FILTER_NAMES []
 
static const unsigned int CCD_BY_CPMM []
 
static const unsigned int CPMM_BY_CCD []
 
static const char *const WAVELENGTH_UNITS
 
static const unsigned int CCD_CENTER_WAVELENGTHS []
 
static const unsigned int CCD_BANDWIDTHS []
 
static const double CCD_FOCAL_PLANE_X_OFFSETS_MM []
 
static const double CCD_FOCAL_PLANE_Y_OFFSETS_MM []
 
static const double CCD_PIXEL_SIZE_MM
 
static const unsigned int CCD_CHANNELS
 
static const unsigned int CCD_CHANNEL_UNKNOWN
 
static const unsigned int CCD_IMAGE_SENSORS
 
static const unsigned int MAX_BYTES_PER_PIXEL
 
static const unsigned int MAX_PIXEL_VALUES []
 
static const unsigned int MAX_IMAGE_LINES
 
static const unsigned int TOTAL_TDI_STAGES
 
static const unsigned int TDI_STAGES []
 
static const unsigned int TOTAL_BINNING_FACTORS
 
static const unsigned int BINNING_FACTORS []
 
static const unsigned int CCD_BINNED_PIXELS []
 
static const unsigned int STORED_LUTS
 
static const unsigned int STIMULATOR_LEDS
 
static const char *const STIMULATOR_LED_NAMES []
 
static const double EXPOSURE_SETUP_MICROS
 
static const unsigned int DELTA_LINE_TIME_MAX
 
static const double DELTA_LINE_TIME_TICK_NANOS
 
static const double LINE_TIME_PRE_OFFSET
 
static const unsigned int TRIM_ADDITION_LINES
 
static const unsigned int REVERSE_READOUT_LINES
 
static const unsigned int MASKED_LINES
 
static const unsigned int DLL_LOCKED
 
static const unsigned int DLL_NOT_LOCKED
 
static const unsigned int SPACECRAFT_EPOCH
 
static const double MRO_CLOCK_SUBTICK_MICROS
 
static const double HIRISE_CLOCK_SUBTICK_MICROS
 
static const int SPACECRAFT_NAIF_ID
 
static const unsigned int SSR_BYTE_BOUNDARY
 
static const int UNKNOWN_NUMBER
 
static const int NOT_APPLICABLE_NUMBER
 
static const char *const UNKNOWN_STRING
 
static const char *const NOT_APPLICABLE_STRING
 
- Static Public Attributes inherited from Data_Block
static const char *const ID
 
static const Index NO_INDEX
 
- Static Public Attributes inherited from Cache
static const char *const ID
 

Additional Inherited Members

- Public Types inherited from Image_Line
enum  Elements {
  Sync ,
  Channel ,
  Line_Number ,
  Buffer_Pixels ,
  Image_Pixels ,
  Black_Pixels ,
  Virtual_Pixels ,
  Total_Elements
}
 An Element refers to a data containing constituent of a component. More...
 
enum  Sync_Type {
  No_Sync_Type ,
  Line_Header_Sync_Type ,
  FELICS_Sync_Type
}
 Possible types of sync patterns. More...
 
- Public Types inherited from Data_Block
enum  Data_Order
 
enum  Array_Index_Counts
 
enum  Array_Offset_Counts
 
typedef unsigned int Index
 
typedef std::vector< IndexValue_List
 
typedef void(* Copier) (unsigned char *destination, int destination_amount, const unsigned char *source, int source_amount)
 
- Public Types inherited from Cache
typedef bool(* Data_Test) (const void *)
 
- Public Attributes inherited from Data_Block
 MSB
 
 LSB
 
 ELEMENT_INDEX
 
 INDEX_COUNT
 
 ELEMENT_OFFSET
 
 OFFSET_COUNT
 
Copier Get
 
Copier Put
 
- Protected Member Functions inherited from Line_Cache
unsigned long long offset (char *location) const
 Gets the source offset location of a cache location. More...
 
- Protected Member Functions inherited from Data_Block
void limits_checker (const Index element, const Index index, bool getter, bool array) const
 
- Static Protected Member Functions inherited from Data_Block
static void get_forwards (unsigned char *host, int host_amount, const unsigned char *data, int data_amount)
 
static void get_backwards (unsigned char *host, int host_amount, const unsigned char *data, int data_amount)
 
static void put_forwards (unsigned char *data, int data_amount, const unsigned char *host, int host_amount)
 
static void put_backwards (unsigned char *data, int data_amount, const unsigned char *host, int host_amount)
 
- Protected Attributes inherited from Line_Cache
Image_LineLine
 Image_Line being managed. More...
 
unsigned long long Data_Bytes
 The number of source data bytes used for line data. More...
 
unsigned int Line_Count
 The count of lines logically found so far. More...
 
unsigned int Next_Line_Number
 The number of the next line available in the cache. More...
 
bool Synchronization_Lost
 Has line synchronization been lost? More...
 
std::ostringstream Bad_Line_Description
 Message describing the reason for a repaired line. More...
 
std::string Next_Bad_Line_Description
 Message intended for the next line to be assembled. More...
 
- Protected Attributes inherited from Image_Line
unsigned int Pixels_per_Line
 Total pixels in a line. More...
 
unsigned int Bytes_per_Pixel
 Bytes per pixel. More...
 
unsigned int Total_Lines
 Total number of lines expected. More...
 
unsigned int Channel_Number
 Expected channel number. More...
 
Line_CacheData_Cache
 Line data cache. More...
 
unsigned int Width
 Width of listing (pixel groups). More...
 

Detailed Description

A FELICS_Line_Cache extends a Line_Cache by adding management of FELICS compressed line data.

A locally managed Cache is used to obtain data from a source stream that is expected to contain FELICS compressed image data. The FELICS compressed data is the source stream is organized as a sequence of blocks delimited by a syncronization pattern unique to the FELICS data stream. Each block contains compressed data for up to 20 image lines. When the parent Line_Cache requests a refill the next available FELICS data block is found and its contents are decompressed into the storage of the Line_Cache. Sequences of bytes with gap values are excluded from the FELICS data blocks to be decompressed.

As with a Line_Cache, reading data from the source stream stops at an effective end-of-file, which is a real EOF (no more data available) or the presence of a Science Channel Header {synchronization pattern} in the stream. Bradford Castalia, Christian Schaller, Robert King 1.11 Line_Cache Cache

Constructor & Destructor Documentation

◆ FELICS_Line_Cache()

FELICS_Line_Cache ( Image_Line image_line,
std::istream &  stream 
)
explicit

Constructs a FELICS_Line_Cache for an Image_Line bound to an istream.

Cache storage sufficient to hold at least twice the amount needed for 20 decompressed maximum size lines is allocated.

References Cache::data_margin(), and FELICS_Line_Cache::SYNC_BYTES.

Member Function Documentation

◆ bytes_read()

unsigned long long bytes_read ( ) const
virtual

Gets the total number of bytes read from the source stream.

Returns
The number of bytes read from the source.
See also
Cache::bytes_read()

Reimplemented from Line_Cache.

References Cache::bytes_read().

◆ compressed_data()

virtual bool compressed_data ( ) const
inlinevirtual

Tests if the image data is compressed.

Returns
Always returns true.

Reimplemented from Line_Cache.

◆ compressed_bytes()

virtual unsigned long long compressed_bytes ( ) const
inlinevirtual

Gets the amount (bytes) of compressed data that has been processed.

Returns
The number of bytes of compressed data that have been processed since the last cache reset.
See also
reset()
source(std::istream&)

Reimplemented from Line_Cache.

◆ decompressed_bytes()

virtual unsigned long long decompressed_bytes ( ) const
inlinevirtual

Gets the amount of decompressed data that has been generated.

Returns
The number of bytes of decompressed data that have been generated since the last reset.
See also
reset()
source(std::istream&)

Reimplemented from Line_Cache.

Referenced by FELICS_Line_Cache::decompress(), and FELICS_Line_Cache::refill().

◆ source() [1/2]

Line_Cache & source ( std::istream &  stream)
virtual

Sets the data source stream.

The data source is set through the parent Line_Cache, which resets it. The local Cache is also reset.

Parameters
streamThe istream to be used as the source of data.
Returns
This FELICS_Line_Cache, as a Line_Cache.
See also
Line_Cache::source(std::istream&)
reset()

Reimplemented from Line_Cache.

References Cache::reset(), and Line_Cache::source().

◆ source() [2/2]

std::istream & source ( ) const
virtual

Gets the data source stream.

Returns
The istream used to refill the cache storage.

Reimplemented from Line_Cache.

References Cache::source().

◆ refill()

bool refill ( unsigned long  max_amount = (unsigned long)-1)
virtual

Refills the Line_Cache storage.

A SYNC_PATTERN is found starting at the next user data location in the local Cache, which will be refilled as needed. Then the next SYNC_PATTERN, or start of a sequence of gap values, is found. This data range constitutes a FELICS data block.

The amount of free space in the parent Line_Cache storage area is increased, if needed, by first draining it and then increasing its capacity if required. Then the compressed data is decompressed into the parent Line_Cache storage area at the end of its current user data.

The accumulators of compressed and decompressed data processed are updated and the next user data location in the local Cache is updated to the end of the FELICS data block.

Parameters
max_amountThe maximum amount of data to obtain. This is ignored.
Returns
false if no more data is available before the effective end-of-file of the source stream; true otherwise. N.B.: If the cache storage is full no data will be read but the return value will still be true.
See also
decompress(char*, unsigned int, char*, unsigned int, unsigned int)

Reimplemented from Line_Cache.

References Cache::amount_consumed(), Cache::amount_free(), Cache::amount_remaining(), Cache::capacity(), FELICS_Line_Cache::decompress(), FELICS_Line_Cache::decompressed_bytes(), Cache::drain(), FELICS_CACHE_CAPACITY, FELICS_Line_Cache::ID, Cache::last(), FELICS_Line_Cache::MAX_LINES_PER_BLOCK, Cache::next(), Cache::refill(), Data_Block::size(), Cache::state_report(), and FELICS_Line_Cache::SYNC_BYTES.

◆ reset()

void reset ( )
virtual

Resets the cache to its empty state and the line structure to match the current structure of the managed line.

The structure of the reserved line is reset to match the structure of the managed line, the line counters are reset to zero, and the cache storage is reset to its empty state.

Reimplemented from Line_Cache.

References Cache::reset(), and Line_Cache::reset().

◆ decompress()

int decompress ( char *  compressed,
unsigned int  amount,
char *  decompressed,
unsigned int  width,
unsigned int  height 
)
static

Decompresses FELICS compressed data.

The implemented algorithm is described in: "Fast and Efficient Lossless Image Compression", Paul G. Howard and Jeffrey Scott Vitter, Proceedings of the IEEE Computer Society/NASA/CESDIS Data Compression Conference, Snowbird, Utah, March 30 - April 1, 1993 and "Data Compression", David Solomon, Springer-Verlag, NY, 2000.

Parameters
compressedAddress of the FELICS encoded compressed data.
amountAmount, in bytes, of compressed data.
decompressedAddress of the storage area to receive the decompressed data. This storage area must be large enough to contain width * height bytes of data.
widthLine width of the decompressed image data, in single byte columns.
heightRow height of the decompressed image data.
Returns
The number of data bytes written to the decompressed storage area. This will never be greater than width * height.

References FELICS_Line_Cache::decompressed_bytes(), and Image_Line::width().

Referenced by FELICS_Line_Cache::refill().

◆ is_sync()

bool is_sync ( void *  data_at)
static

Tests for a FELICS synchronization pattern.

Beginning at the argument address, SYNC_BYTES of data are tested for the FELICS SYNC_PATTERN.

Parameters
data_atAddress the data to be tested.
Returns
true If the data contains a FELICS synchronization pattern; false otherwise.

References Data_Component::data(), FELICS_Line_Cache::SYNC_BYTES, and FELICS_Line_Cache::SYNC_PATTERN.

Referenced by Image_Line::next_sync().

Member Data Documentation

◆ ID

const char *const ID
static
Initial value:
=
"UA::HiRISE::FELICS_Line_Cache (1.16 2020/02/14 01:17:18)"

Class identification name with source code version and date.

Referenced by main(), and FELICS_Line_Cache::refill().

◆ SYNC_BYTES

const int SYNC_BYTES = 16
static

◆ SYNC_PATTERN

const u_int_8 SYNC_PATTERN
static
Initial value:
=
{0x00,0x11,0x22,0x33,0x44,0x55,0x66,0x77,
0x88,0x99,0xAA,0xBB,0xCC,0xDD,0xEE,0xFF}

The synchronization pattern that begins each compressed data block.

Referenced by FELICS_Line_Cache::is_sync().

◆ SYNC_BYTE_FACTOR

const int SYNC_BYTE_FACTOR = 0x11
static

The byte number multiplier factor used to create the FELICS synchronization pattern.

See also
SYNC_BYTES

◆ MAX_LINES_PER_BLOCK

const int MAX_LINES_PER_BLOCK = LINES_PER_FELICS_BLOCK
static

The maximum number of image lines in a FELICS data block.

Referenced by FELICS_Line_Cache::refill().

◆ MIN_GAP_BYTES

const int MIN_GAP_BYTES = 4
static

The minimum number of gap value bytes in a gap sequence.


The documentation for this class was generated from the following files: