asstorage.h File Reference

Go to the source code of this file.

Classes

struct  ASStorageSlot
struct  ASStorageBlock
struct  ASStorage

Defines

#define AS_STORAGE_PAGE_SIZE   4096
#define AS_STORAGE_SLOTS_BATCH   1024
#define AS_STORAGE_SLOT_ID_BITS   14
#define AS_STORAGE_MAX_SLOTS_CNT   (0x01<<AS_STORAGE_SLOT_ID_BITS)
#define AS_STORAGE_BLOCK_ID_BITS   (32-AS_STORAGE_SLOT_ID_BITS)
#define AS_STORAGE_MAX_BLOCK_CNT   (0x01<<AS_STORAGE_BLOCK_ID_BITS)
#define AS_STORAGE_DEF_BLOCK_SIZE   (1024*128)
#define AS_STORAGE_NOUSE_THRESHOLD   (1024*8)
#define ASStorageSlot_SIZE   16
#define ASStorageSlot_USABLE_SIZE(slot)   (((slot)->size+15)&0x8FFFFFF0)
#define ASStorageSlot_FULL_SIZE(slot)   (ASStorageSlot_USABLE_SIZE(slot)+ASStorageSlot_SIZE)
#define AS_STORAGE_GetNextSlot(slot)   ((slot)+1+(ASStorageSlot_USABLE_SIZE(slot)>>4))
#define RLE_ZERO_MASK   0x0080
#define RLE_ZERO_LENGTH   0x007F
#define RLE_ZERO_SIG   0x0000
#define RLE_NOZERO_SHORT_MASK   0x00C0
#define RLE_NOZERO_SHORT_LENGTH   0x003F
#define RLE_NOZERO_SHORT_SIG   0x00C0
#define RLE_NOZERO_LONG_MASK   0x00F0
#define RLE_NOZERO_LONG_LENGTH   0x000F
#define RLE_NOZERO_LONG1_SIG   0x00A0
#define RLE_NOZERO_LONG2_SIG   0x00B0
#define RLE_9BIT_SIG   0x0080
#define RLE_9BIT_NEG_SIG   0x0090
#define AS_STORAGE_DEFAULT_BMAP_THRESHOLD   0x7F
#define AS_STORAGE_DEFAULT_BMAP_VALUE   0xFF
#define ASStorage_ZlibCompress   (0x01<<0)
#define ASStorage_RLEDiffCompress   (0x01<<1)
#define ASStorage_CompressionType   (0x0F<<0)
#define ASStorage_Used   (0x01<<4)
#define ASStorage_NotTileable   (0x01<<5)
#define ASStorage_Reference   (0x01<<6)
#define ASStorage_Bitmap   (0x01<<7)
#define ASStorage_32Bit   (0x01<<8)
#define ASStorage_BitShiftFlagPos   9
#define ASStorage_BitShift   (0x03<<ASStorage_BitShiftFlagPos)
#define ASStorage_8BitShift   (0x01<<ASStorage_BitShiftFlagPos)
#define ASStorage_16BitShift   (0x01<<(ASStorage_BitShiftFlagPos+1))
#define ASStorage_24BitShift   (ASStorage_8BitShift|ASStorage_16BitShift)
#define ASStorage_Flags2ShiftIdx(f)   (((f)>>ASStorage_BitShiftFlagPos)&0x03)
#define ASStorage_Flags2Shift(f)   (ASStorage_Flags2ShiftIdx(f)*8)
#define ASStorage_Masked   (0x01<<11)
#define ASStorage_32BitRLE   (ASStorage_RLEDiffCompress|ASStorage_32Bit)
#define ASStorage_Data(s)   ((CARD8*)((s)+1))
#define ASStorage_MonoliticBlock   (0x01<<0)

Typedefs

typedef short ASStorageDiff
typedef void(*) compute_diff_func_type (ASStorageDiff *, CARD8 *, int)
typedef int(*) copy_data32_func_type (CARD8 *, CARD32 *, int)
typedef int(*) copy_data32_tinted_func_type (CARD8 *, CARD32 *, int, CARD32)
typedef CARD32 ASStorageID

Functions

ASStorageID store_data (ASStorage *storage, CARD8 *data, int size, ASFlagType flags, CARD8 bitmap_threshold)
ASStorageID store_data_tinted (ASStorage *storage, CARD8 *data, int size, ASFlagType flags, CARD16 tint)
int fetch_data (ASStorage *storage, ASStorageID id, CARD8 *buffer, int offset, int buf_size, CARD8 bitmap_value, int *original_size)
int fetch_data32 (ASStorage *storage, ASStorageID id, CARD32 *buffer, int offset, int buf_size, CARD8 bitmap_value, int *original_size)
int threshold_stored_data (ASStorage *storage, ASStorageID id, unsigned int *runs, int width, unsigned int threshold)
void forget_data (ASStorage *storage, ASStorageID id)
void print_storage (ASStorage *storage)
int print_storage_slot (ASStorage *storage, ASStorageID id)
Bool query_storage_slot (ASStorage *storage, ASStorageID id, ASStorageSlot *dst)
ASStorageID dup_data (ASStorage *storage, ASStorageID src_id)
void flush_default_asstorage ()
int set_asstorage_block_size (ASStorage *storage, int new_size)


Define Documentation

#define AS_STORAGE_BLOCK_ID_BITS   (32-AS_STORAGE_SLOT_ID_BITS)

Definition at line 15 of file asstorage.h.

#define AS_STORAGE_DEF_BLOCK_SIZE   (1024*128)

Definition at line 18 of file asstorage.h.

Referenced by create_asstorage(), and set_asstorage_block_size().

#define AS_STORAGE_DEFAULT_BMAP_THRESHOLD   0x7F

Definition at line 65 of file asstorage.h.

Referenced by store_data(), and store_data_tinted().

#define AS_STORAGE_DEFAULT_BMAP_VALUE   0xFF

Definition at line 66 of file asstorage.h.

Referenced by fetch_data_int().

#define AS_STORAGE_GetNextSlot ( slot   )     ((slot)+1+(ASStorageSlot_USABLE_SIZE(slot)>>4))

Definition at line 28 of file asstorage.h.

Referenced by defragment_storage_block(), join_storage_slots(), select_storage_slot(), and split_storage_slot().

#define AS_STORAGE_MAX_BLOCK_CNT   (0x01<<AS_STORAGE_BLOCK_ID_BITS)

Definition at line 16 of file asstorage.h.

#define AS_STORAGE_MAX_SLOTS_CNT   (0x01<<AS_STORAGE_SLOT_ID_BITS)

Definition at line 13 of file asstorage.h.

Referenced by add_storage_slots(), select_storage_block(), and split_storage_slot().

#define AS_STORAGE_NOUSE_THRESHOLD   (1024*8)

Definition at line 19 of file asstorage.h.

Referenced by select_storage_block().

#define AS_STORAGE_PAGE_SIZE   4096

Definition at line 5 of file asstorage.h.

Referenced by compress_stored_data(), and create_asstorage_block().

#define AS_STORAGE_SLOT_ID_BITS   14

Definition at line 12 of file asstorage.h.

#define AS_STORAGE_SLOTS_BATCH   1024

Definition at line 11 of file asstorage.h.

Referenced by add_storage_slots().

#define ASStorage_16BitShift   (0x01<<(ASStorage_BitShiftFlagPos+1))

Definition at line 88 of file asstorage.h.

Referenced by asimage_add_line_bgra().

#define ASStorage_24BitShift   (ASStorage_8BitShift|ASStorage_16BitShift)

Definition at line 92 of file asstorage.h.

Referenced by asimage_add_line_bgra().

#define ASStorage_32Bit   (0x01<<8)

Definition at line 82 of file asstorage.h.

Referenced by apply_asdraw_context(), asimage_add_line(), asimage_add_line_bgra(), compress_stored_data(), png2ASImage_int(), store_data(), store_data_tinted(), and xpm_file2ASImage().

#define ASStorage_32BitRLE   (ASStorage_RLEDiffCompress|ASStorage_32Bit)

Definition at line 100 of file asstorage.h.

Referenced by ico2ASImage(), and jpeg2ASImage().

#define ASStorage_8BitShift   (0x01<<ASStorage_BitShiftFlagPos)

Definition at line 85 of file asstorage.h.

Referenced by asimage_add_line_bgra().

#define ASStorage_Bitmap   (0x01<<7)

Definition at line 81 of file asstorage.h.

Referenced by compress_stored_data(), decompress_stored_data(), gif2ASImage(), ico2ASImage(), png2ASImage_int(), store_data(), store_data_tinted(), tiff2ASImage(), and xpm_file2ASImage().

#define ASStorage_BitShift   (0x03<<ASStorage_BitShiftFlagPos)

Definition at line 84 of file asstorage.h.

Referenced by compress_stored_data().

#define ASStorage_BitShiftFlagPos   9

Definition at line 83 of file asstorage.h.

#define ASStorage_CompressionType   (0x0F<<0)

Definition at line 77 of file asstorage.h.

Referenced by convert_slot_to_ref(), store_data(), and store_data_tinted().

#define ASStorage_Data ( s   )     ((CARD8*)((s)+1))

Definition at line 123 of file asstorage.h.

Referenced by convert_slot_to_ref(), dup_data(), fetch_data_int(), forget_data(), print_storage_slot(), query_storage_slot(), and store_data_in_block().

#define ASStorage_Flags2Shift (  )     (ASStorage_Flags2ShiftIdx(f)*8)

Definition at line 94 of file asstorage.h.

Referenced by compress_stored_data().

#define ASStorage_Flags2ShiftIdx (  )     (((f)>>ASStorage_BitShiftFlagPos)&0x03)

Definition at line 93 of file asstorage.h.

Referenced by compress_stored_data().

#define ASStorage_Masked   (0x01<<11)

Definition at line 95 of file asstorage.h.

Referenced by asimage_add_line_bgra(), and compress_stored_data().

#define ASStorage_MonoliticBlock   (0x01<<0)

Definition at line 139 of file asstorage.h.

#define ASStorage_NotTileable   (0x01<<5)

Definition at line 79 of file asstorage.h.

Referenced by fetch_data_int().

#define ASStorage_Reference   (0x01<<6)

Definition at line 80 of file asstorage.h.

Referenced by convert_slot_to_ref(), dup_data(), fetch_data_int(), forget_data(), print_storage_slot(), query_storage_slot(), store_data(), and store_data_tinted().

#define ASStorage_RLEDiffCompress   (0x01<<1)

Definition at line 75 of file asstorage.h.

Referenced by apply_asdraw_context(), asimage_add_line(), asimage_add_line_bgra(), compress_stored_data(), decompress_stored_data(), gif2ASImage(), jpeg2ASImage(), png2ASImage_int(), tiff2ASImage(), and xpm_file2ASImage().

#define ASStorage_Used   (0x01<<4)

Definition at line 78 of file asstorage.h.

Referenced by store_data_in_block().

#define ASStorage_ZlibCompress   (0x01<<0)

Definition at line 74 of file asstorage.h.

#define ASStorageSlot_FULL_SIZE ( slot   )     (ASStorageSlot_USABLE_SIZE(slot)+ASStorageSlot_SIZE)

Definition at line 26 of file asstorage.h.

Referenced by defragment_storage_block(), join_storage_slots(), select_storage_slot(), split_storage_slot(), and store_data_in_block().

#define ASStorageSlot_SIZE   16

Definition at line 24 of file asstorage.h.

Referenced by compress_stored_data(), create_asstorage_block(), defragment_storage_block(), print_storage_slot(), select_storage_block(), select_storage_slot(), store_compressed_data(), and store_data_in_block().

#define ASStorageSlot_USABLE_SIZE ( slot   )     (((slot)->size+15)&0x8FFFFFF0)

Definition at line 25 of file asstorage.h.

Referenced by free_storage_slot(), join_storage_slots(), select_storage_slot(), split_storage_slot(), and store_data_in_block().

#define RLE_9BIT_NEG_SIG   0x0090

Definition at line 62 of file asstorage.h.

Referenced by rlediff_compress(), and rlediff_decompress().

#define RLE_9BIT_SIG   0x0080

Definition at line 60 of file asstorage.h.

Referenced by rlediff_compress().

#define RLE_NOZERO_LONG1_SIG   0x00A0

Definition at line 57 of file asstorage.h.

Referenced by rlediff_compress(), and rlediff_decompress().

#define RLE_NOZERO_LONG2_SIG   0x00B0

Definition at line 58 of file asstorage.h.

Referenced by rlediff_compress(), and rlediff_decompress().

#define RLE_NOZERO_LONG_LENGTH   0x000F

Definition at line 56 of file asstorage.h.

Referenced by rlediff_decompress().

#define RLE_NOZERO_LONG_MASK   0x00F0

Definition at line 55 of file asstorage.h.

Referenced by rlediff_decompress().

#define RLE_NOZERO_SHORT_LENGTH   0x003F

Definition at line 52 of file asstorage.h.

Referenced by rlediff_decompress().

#define RLE_NOZERO_SHORT_MASK   0x00C0

Definition at line 51 of file asstorage.h.

Referenced by rlediff_decompress().

#define RLE_NOZERO_SHORT_SIG   0x00C0

Definition at line 53 of file asstorage.h.

Referenced by rlediff_compress(), and rlediff_decompress().

#define RLE_ZERO_LENGTH   0x007F

Definition at line 48 of file asstorage.h.

#define RLE_ZERO_MASK   0x0080

Definition at line 47 of file asstorage.h.

Referenced by rlediff_decompress().

#define RLE_ZERO_SIG   0x0000

Definition at line 49 of file asstorage.h.

Referenced by rlediff_compress().


Typedef Documentation

typedef short ASStorageDiff

Definition at line 129 of file asstorage.h.

typedef CARD32 ASStorageID

Definition at line 169 of file asstorage.h.

typedef void(*) compute_diff_func_type(ASStorageDiff *, CARD8 *, int)

Definition at line 132 of file asstorage.h.

typedef int(*) copy_data32_func_type(CARD8 *, CARD32 *, int)

Definition at line 133 of file asstorage.h.

typedef int(*) copy_data32_tinted_func_type(CARD8 *, CARD32 *, int, CARD32)

Definition at line 134 of file asstorage.h.


Function Documentation

ASStorageID dup_data ( ASStorage storage,
ASStorageID  src_id 
)

Definition at line 2062 of file asstorage.c.

References ASStorage_Data, ASStorage_Reference, convert_slot_to_ref(), find_storage_block(), find_storage_slot(), ASStorageSlot::flags, get_default_asstorage, get_flags, ASStorageSlot::index, LOCAL_DEBUG_OUT, NULL, ASStorageSlot::ref_count, show_error, StorageID2SlotIdx, and store_data().

Referenced by asimage_dup_line(), clone_asimage(), copy_asimage_channel(), copy_asimage_lines(), jpeg2ASImage(), png2ASImage_int(), and tiff2ASImage().

int fetch_data ( ASStorage storage,
ASStorageID  id,
CARD8 *  buffer,
int  offset,
int  buf_size,
CARD8  bitmap_value,
int *  original_size 
)

Definition at line 1862 of file asstorage.c.

References buf, card8_card8_cpy(), fetch_data_int(), get_default_asstorage, and NULL.

int fetch_data32 ( ASStorage storage,
ASStorageID  id,
CARD32 *  buffer,
int  offset,
int  buf_size,
CARD8  bitmap_value,
int *  original_size 
)

Definition at line 1882 of file asstorage.c.

References buf, card8_card32_cpy(), fetch_data_int(), get_default_asstorage, and NULL.

Referenced by asimage_decode_line(), and decode_asscanline_native().

void flush_default_asstorage (  ) 

Definition at line 1794 of file asstorage.c.

References _as_default_storage, destroy_asstorage(), and NULL.

void forget_data ( ASStorage storage,
ASStorageID  id 
)

Definition at line 2028 of file asstorage.c.

References ASStorage_Data, ASStorage_Reference, find_storage_block(), find_storage_slot(), ASStorageSlot::flags, forget_data(), free_storage_block(), free_storage_slot(), get_default_asstorage, get_flags, is_block_empty(), LOCAL_DEBUG_OUT, NULL, ASStorageSlot::ref_count, show_error, and StorageID2BlockIdx.

Referenced by apply_asdraw_context(), asimage_add_line(), asimage_add_line_bgra(), asimage_add_line_mono(), asimage_dup_line(), asimage_erase_line(), asimage_init(), copy_asimage_channel(), copy_asimage_lines(), forget_data(), and move_asimage_channel().

void print_storage ( ASStorage storage  ) 

Definition at line 2008 of file asstorage.c.

References ASStorage::blocks, ASStorage::blocks_count, fprintf(), get_default_asstorage, i, ASStorageBlock::last_used, NULL, ASStorageBlock::size, and ASStorageBlock::slots_count.

int print_storage_slot ( ASStorage storage,
ASStorageID  id 
)

Definition at line 1970 of file asstorage.c.

References ASStorage_Data, ASStorage_Reference, ASStorageSlot_SIZE, find_storage_block(), find_storage_slot(), ASStorageSlot::flags, fprintf(), get_default_asstorage, get_flags, i, ASStorageSlot::index, int, NULL, print_storage_slot(), ASStorageSlot::ref_count, show_error, ASStorageSlot::size, and ASStorageSlot::uncompressed_size.

Referenced by asimage_print_line(), and print_storage_slot().

Bool query_storage_slot ( ASStorage storage,
ASStorageID  id,
ASStorageSlot dst 
)

Definition at line 1939 of file asstorage.c.

References ASStorage_Data, ASStorage_Reference, False, find_storage_block(), find_storage_slot(), ASStorageSlot::flags, get_default_asstorage, get_flags, LOCAL_DEBUG_OUT, NULL, query_storage_slot(), show_error, and True.

Referenced by print_asimage_func(), and query_storage_slot().

int set_asstorage_block_size ( ASStorage storage,
int  new_size 
)

Definition at line 1740 of file asstorage.c.

References AS_STORAGE_DEF_BLOCK_SIZE, ASStorage::default_block_size, get_default_asstorage, and NULL.

Referenced by convert_argb2ASImage(), gif2ASImage(), jpeg2ASImage(), png2ASImage_int(), tga2ASImage(), tiff2ASImage(), and xpm_file2ASImage().

ASStorageID store_data ( ASStorage storage,
CARD8 *  data,
int  size,
ASFlagType  flags,
CARD8  bitmap_threshold 
)

Definition at line 1801 of file asstorage.c.

References AS_STORAGE_DEFAULT_BMAP_THRESHOLD, ASStorage_32Bit, ASStorage_Bitmap, ASStorage_CompressionType, ASStorage_Reference, buffer, compress_stored_data(), get_default_asstorage, get_flags, LOCAL_DEBUG_CALLER_OUT, NULL, and store_compressed_data().

Referenced by apply_asdraw_context(), asimage_add_line(), asimage_add_line_bgra(), asimage_add_line_mono(), dup_data(), gif2ASImage(), ico2ASImage(), jpeg2ASImage(), png2ASImage_int(), tiff2ASImage(), and xpm_file2ASImage().

ASStorageID store_data_tinted ( ASStorage storage,
CARD8 *  data,
int  size,
ASFlagType  flags,
CARD16  tint 
)

Definition at line 1830 of file asstorage.c.

References AS_STORAGE_DEFAULT_BMAP_THRESHOLD, ASStorage_32Bit, ASStorage_Bitmap, ASStorage_CompressionType, ASStorage_Reference, buffer, compress_stored_data(), get_default_asstorage, get_flags, LOCAL_DEBUG_CALLER_OUT, NULL, and store_compressed_data().

int threshold_stored_data ( ASStorage storage,
ASStorageID  id,
unsigned int *  runs,
int  width,
unsigned int  threshold 
)

Definition at line 1903 of file asstorage.c.

References buf, card8_threshold(), fetch_data_int(), fprintf(), get_default_asstorage, and NULL.

Referenced by get_asimage_channel_rects().


Generated on Tue Jul 5 15:57:50 2011 for ROOT_528-00b_version by  doxygen 1.5.1