OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
Usds.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h>
Include dependency graph for Usds.c:

Go to the source code of this file.

Macros

#define MIN(x, y)   ((x)<(y)? (x): (y))
 
#define MAXLINE   80
 
#define INBLK_size   1024
 
#define TYP   0
 
#define EXT2   1
 
#define ZERO   2
 
#define ID_DECODE   3
 
#define MAX_BLKREF   128
 
#define MAX_REFPAC   128
 
#define MAX_ZBLKS   64
 
#define J_MAX   16
 
#define PIXREF_DEFAULT   256
 
#define N_DEFAULT   8
 
#define J_DEFAULT   16
 

Functions

int get_ref ()
 
int un_z ()
 
int check_end (int id, int end_fill)
 
int get_input (int *max_data, int32_t inBytes, uint8_t *encryptData)
 
int get_EP_IN (FILE *file_ptr, int pixels)
 
void un_K ()
 
void un_ext2 ()
 
void un_FS (int flag)
 
void un_DEF ()
 
void data_output (uint16_t *decryptData, int *decryptPtr)
 
void flush_buffer (uint16_t *decryptData, int32_t *decryptPtr)
 
void check_ref_per_sample (int blkref_flag, int pixref_flag)
 
void open_files (int argc, char *argv[])
 
void set_flags (int argc, char *argv[], int *pixref_flag, int *blkref_flag)
 
void initialize (int pixref_flag, int blkref_flag)
 
void do_uncoding (int32_t inBytes, uint8_t *encryptData, uint16_t *decryptData)
 
int usds (int argc, argv, int32_t inBytes, uint8_t *encryptData, uint16_t *decryptData)
 
int get_id3 ()
 
int get_id4 ()
 
void unmap_NN (int start, int pixels)
 
void unmap_EP (int start, int pixels)
 
void unmap_TWOD (int start, int pixels)
 
void unmap_MS (int start, int pixels)
 
int findid (int max_data)
 
void help ()
 
void set_flags (int argc, argv, int *pixref_flag, int *blkref_flag)
 
void open_files (int argc, argv)
 

Variables

int SIGN_EXT_OUTPUT =1
 
unsigned IN_array [INBLK_size+1]
 
unsigned XP_IN [INBLK_size+1]
 
char Buffer_in [INBLK_size *2+2]
 
char Buffer_in2 [10000]
 
char * Binptr
 
unsigned SIG [2048+1]
 
unsigned short OUT [4096+1]
 
char Buffer_out [10240]
 
char * Bptr
 
char * Bend
 
int N
 
int NN
 
int J
 
int XP
 
int MASK_SIGN
 
int MASK_IN
 
int MASKN_neg
 
unsigned short MASKNOT [17]
 
int NEG_data
 
int IDbits
 
int REF
 
int REF2REF
 
int REFREF_flag
 
int TRUEREF
 
int SCANLINE
 
int BYTE_pixel
 
int IN_INDEX =0
 
int NEXT_BIT =15
 
int BYPASS_flag
 
int NN_mode
 
int EP_mode
 
int TWOD_mode
 
int TWOD_line_mode
 
int MS_mode
 
int BYPASS_mode
 
int ENT_CODING
 
int BlkPac
 
int PixRef
 
int BlkRef
 
int RefPac
 
int PACKET_flag
 
int EXT2_flag
 
int EXT2_bit
 
int ZOP_flag
 
int ZBLKS
 
int ZFLAG
 
int LAST_word
 
int XMAX
 
int XMAX_MS
 
int XMAXneg
 
FILE * In_ptr
 
FILE * Ep_ptr
 
FILE * Out_ptr
 
FILE * Twod_ptr
 
FILE * Ms_ptr
 
char In_file [MAXLINE]
 
unsigned REFERENCE
 
int K_bits
 
int Kfactor
 
long BLKCNT
 
int FS_id
 
int Low_id
 
int D_id
 
int MS [] ={0,1,3,6,10,15,21,28}
 
int M []
 
char copyright [] = "@(#) (C) Copyright 1993,1994 University of New Mexico. All Rights Reserved."
 

Macro Definition Documentation

◆ EXT2

#define EXT2   1

Definition at line 33 of file Usds.c.

◆ ID_DECODE

#define ID_DECODE   3

Definition at line 35 of file Usds.c.

◆ INBLK_size

#define INBLK_size   1024

Definition at line 31 of file Usds.c.

◆ J_DEFAULT

#define J_DEFAULT   16

Definition at line 42 of file Usds.c.

◆ J_MAX

#define J_MAX   16

Definition at line 39 of file Usds.c.

◆ MAX_BLKREF

#define MAX_BLKREF   128

Definition at line 36 of file Usds.c.

◆ MAX_REFPAC

#define MAX_REFPAC   128

Definition at line 37 of file Usds.c.

◆ MAX_ZBLKS

#define MAX_ZBLKS   64

Definition at line 38 of file Usds.c.

◆ MAXLINE

#define MAXLINE   80

Definition at line 30 of file Usds.c.

◆ MIN

#define MIN (   x,
 
)    ((x)<(y)? (x): (y))

Definition at line 28 of file Usds.c.

◆ N_DEFAULT

#define N_DEFAULT   8

Definition at line 41 of file Usds.c.

◆ PIXREF_DEFAULT

#define PIXREF_DEFAULT   256

Definition at line 40 of file Usds.c.

◆ TYP

#define TYP   0

Definition at line 32 of file Usds.c.

◆ ZERO

#define ZERO   2

Definition at line 34 of file Usds.c.

Function Documentation

◆ check_end()

int check_end ( int  id,
int  end_fill 
)

if (blks_togo > 1)

force this never to happen to use with

Definition at line 885 of file Usds.c.

◆ check_ref_per_sample()

void check_ref_per_sample ( int  blkref_flag,
int  pixref_flag 
)

Definition at line 1451 of file Usds.c.

◆ data_output()

void data_output ( uint16_t *  decryptData,
int *  decryptPtr 
)

Definition at line 986 of file Usds.c.

◆ do_uncoding()

void do_uncoding ( int32_t  inBytes,
uint8_t *  encryptData,
uint16_t *  decryptData 
)

Definition at line 175 of file Usds.c.

◆ findid()

int findid ( int  max_data)

Definition at line 758 of file Usds.c.

◆ flush_buffer()

void flush_buffer ( uint16_t *  decryptData,
int32_t *  decryptPtr 
)

Definition at line 1082 of file Usds.c.

◆ get_EP_IN()

int get_EP_IN ( FILE *  file_ptr,
int  pixels 
)

Definition at line 938 of file Usds.c.

◆ get_id3()

int get_id3 ( )

Definition at line 303 of file Usds.c.

◆ get_id4()

int get_id4 ( )

Definition at line 348 of file Usds.c.

◆ get_input()

int get_input ( int *  max_data,
int32_t  inBytes,
uint8_t *  encryptData 
)

Definition at line 797 of file Usds.c.

◆ get_ref()

int get_ref ( )

Definition at line 264 of file Usds.c.

◆ help()

void help ( )

Definition at line 1098 of file Usds.c.

◆ initialize()

void initialize ( int  pixref_flag,
int  blkref_flag 
)

Definition at line 1371 of file Usds.c.

◆ open_files() [1/2]

void open_files ( int  argc,
argv   
)

Definition at line 1321 of file Usds.c.

◆ open_files() [2/2]

void open_files ( int  argc,
char *  argv[] 
)

◆ set_flags() [1/2]

void set_flags ( int  argc,
argv  ,
int*  pixref_flag,
int *  blkref_flag 
)

Definition at line 1162 of file Usds.c.

◆ set_flags() [2/2]

void set_flags ( int  argc,
char *  argv[],
int *  pixref_flag,
int *  blkref_flag 
)

◆ un_DEF()

void un_DEF ( )

Definition at line 596 of file Usds.c.

◆ un_ext2()

void un_ext2 ( )

Definition at line 457 of file Usds.c.

◆ un_FS()

void un_FS ( int  flag)

Definition at line 480 of file Usds.c.

◆ un_K()

void un_K ( )

Definition at line 533 of file Usds.c.

◆ un_z()

int un_z ( )

Definition at line 392 of file Usds.c.

◆ unmap_EP()

void unmap_EP ( int  start,
int  pixels 
)

Definition at line 656 of file Usds.c.

◆ unmap_MS()

void unmap_MS ( int  start,
int  pixels 
)

Definition at line 719 of file Usds.c.

◆ unmap_NN()

void unmap_NN ( int  start,
int  pixels 
)

Definition at line 632 of file Usds.c.

◆ unmap_TWOD()

void unmap_TWOD ( int  start,
int  pixels 
)

Definition at line 680 of file Usds.c.

◆ usds()

int usds ( int  argc,
argv  ,
int32_t  inBytes,
uint8_t *  encryptData,
uint16_t *  decryptData 
)

Definition at line 154 of file Usds.c.

Variable Documentation

◆ Bend

char* Bend

Definition at line 58 of file Usds.c.

◆ Binptr

char* Binptr

Definition at line 53 of file Usds.c.

◆ BLKCNT

long BLKCNT

Definition at line 104 of file Usds.c.

◆ BlkPac

int BlkPac

Definition at line 86 of file Usds.c.

◆ BlkRef

int BlkRef

Definition at line 88 of file Usds.c.

◆ Bptr

char* Bptr

Definition at line 57 of file Usds.c.

◆ Buffer_in

char Buffer_in[INBLK_size *2+2]

Definition at line 51 of file Usds.c.

◆ Buffer_in2

char Buffer_in2[10000]

Definition at line 52 of file Usds.c.

◆ Buffer_out

char Buffer_out[10240]

Definition at line 56 of file Usds.c.

◆ BYPASS_flag

int BYPASS_flag

Definition at line 78 of file Usds.c.

◆ BYPASS_mode

int BYPASS_mode

Definition at line 84 of file Usds.c.

◆ BYTE_pixel

int BYTE_pixel

Definition at line 75 of file Usds.c.

◆ copyright

char copyright[] = "@(#) (C) Copyright 1993,1994 University of New Mexico. All Rights Reserved."

Definition at line 109 of file Usds.c.

◆ D_id

int D_id

Definition at line 105 of file Usds.c.

◆ ENT_CODING

int ENT_CODING

Definition at line 85 of file Usds.c.

◆ EP_mode

int EP_mode

Definition at line 80 of file Usds.c.

◆ Ep_ptr

FILE * Ep_ptr

Definition at line 100 of file Usds.c.

◆ EXT2_bit

int EXT2_bit

Definition at line 92 of file Usds.c.

◆ EXT2_flag

int EXT2_flag

Definition at line 91 of file Usds.c.

◆ FS_id

int FS_id

Definition at line 105 of file Usds.c.

◆ IDbits

int IDbits

Definition at line 69 of file Usds.c.

◆ IN_array

unsigned IN_array[INBLK_size+1]

Definition at line 49 of file Usds.c.

◆ In_file

char In_file[MAXLINE]

Definition at line 101 of file Usds.c.

◆ IN_INDEX

int IN_INDEX =0

Definition at line 76 of file Usds.c.

◆ In_ptr

FILE* In_ptr

Definition at line 100 of file Usds.c.

◆ J

int J

Definition at line 62 of file Usds.c.

◆ K_bits

int K_bits

Definition at line 103 of file Usds.c.

◆ Kfactor

int Kfactor

Definition at line 103 of file Usds.c.

◆ LAST_word

int LAST_word

Definition at line 96 of file Usds.c.

◆ Low_id

int Low_id

Definition at line 105 of file Usds.c.

◆ M

int M[]
Initial value:
={ 0, 1,1, 2,2,2, 3,3,3,3, 4,4,4,4,4, 5,5,5,5,5,5, 6,6,6,6,6,6,6,
7,7,7,7,7,7,7,7}

Definition at line 107 of file Usds.c.

◆ MASK_IN

int MASK_IN

Definition at line 65 of file Usds.c.

◆ MASK_SIGN

int MASK_SIGN

Definition at line 64 of file Usds.c.

◆ MASKN_neg

int MASKN_neg

Definition at line 66 of file Usds.c.

◆ MASKNOT

unsigned short MASKNOT[17]

Definition at line 67 of file Usds.c.

◆ MS

int MS[] ={0,1,3,6,10,15,21,28}

Definition at line 106 of file Usds.c.

◆ MS_mode

int MS_mode

Definition at line 83 of file Usds.c.

◆ Ms_ptr

FILE * Ms_ptr

Definition at line 100 of file Usds.c.

◆ N

int N

Definition at line 60 of file Usds.c.

◆ NEG_data

int NEG_data

Definition at line 68 of file Usds.c.

◆ NEXT_BIT

int NEXT_BIT =15

Definition at line 77 of file Usds.c.

◆ NN

int NN

Definition at line 61 of file Usds.c.

◆ NN_mode

int NN_mode

Definition at line 79 of file Usds.c.

◆ OUT

unsigned short OUT[4096+1]

Definition at line 55 of file Usds.c.

◆ Out_ptr

FILE * Out_ptr

Definition at line 100 of file Usds.c.

◆ PACKET_flag

int PACKET_flag

Definition at line 90 of file Usds.c.

◆ PixRef

int PixRef

Definition at line 87 of file Usds.c.

◆ REF

int REF

Definition at line 70 of file Usds.c.

◆ REF2REF

int REF2REF

Definition at line 71 of file Usds.c.

◆ REFERENCE

unsigned REFERENCE

Definition at line 102 of file Usds.c.

◆ RefPac

int RefPac

Definition at line 89 of file Usds.c.

◆ REFREF_flag

int REFREF_flag

Definition at line 72 of file Usds.c.

◆ SCANLINE

int SCANLINE

Definition at line 74 of file Usds.c.

◆ SIG

unsigned SIG[2048+1]

Definition at line 54 of file Usds.c.

◆ SIGN_EXT_OUTPUT

int SIGN_EXT_OUTPUT =1

Definition at line 47 of file Usds.c.

◆ TRUEREF

int TRUEREF

Definition at line 73 of file Usds.c.

◆ TWOD_line_mode

int TWOD_line_mode

Definition at line 82 of file Usds.c.

◆ TWOD_mode

int TWOD_mode

Definition at line 81 of file Usds.c.

◆ Twod_ptr

FILE * Twod_ptr

Definition at line 100 of file Usds.c.

◆ XMAX

int XMAX

Definition at line 97 of file Usds.c.

◆ XMAX_MS

int XMAX_MS

Definition at line 98 of file Usds.c.

◆ XMAXneg

int XMAXneg

Definition at line 99 of file Usds.c.

◆ XP

int XP

Definition at line 63 of file Usds.c.

◆ XP_IN

unsigned XP_IN[INBLK_size+1]

Definition at line 50 of file Usds.c.

◆ ZBLKS

int ZBLKS

Definition at line 94 of file Usds.c.

◆ ZFLAG

int ZFLAG

Definition at line 95 of file Usds.c.

◆ ZOP_flag

int ZOP_flag

Definition at line 93 of file Usds.c.