#include "config.h"
#include <sys/time.h>
#include <time.h>
#include <unistd.h>
#include <stdlib.h>
#include <memory.h>
#include <zlib.h>
#include "afterbase.h"
#include "asstorage.h"
Go to the source code of this file.
Classes | |
struct | ASStorageDstBuffer |
Defines | |
#define | DO_CLOCKING |
#define | get_default_asstorage() (_as_default_storage?_as_default_storage:(_as_default_storage=create_asstorage())) |
#define | StorageID2BlockIdx(id) (((((CARD32)(id))>>14)&0x0003FFFF)-1) |
#define | StorageID2SlotIdx(id) ((((CARD32)(id))&0x00003FFF)-1) |
Typedefs | |
typedef void(*) | data_cpy_func_type (ASStorageDstBuffer *, void *, size_t) |
Functions | |
static ASStorageID | make_asstorage_id (int block_id, int slot_id) |
static int | rlediff_compress_bitmap8 (CARD8 *buffer, CARD8 *data, int size, CARD32 bitmap_threshold) |
static int | rlediff_compress_bitmap32 (CARD8 *buffer, CARD8 *data, int size, CARD32 bitmap_threshold) |
static void | compute_diff8 (register ASStorageDiff *diff, register CARD8 *data, int size) |
static void | compute_diff32 (register ASStorageDiff *diff, CARD8 *data, int size) |
static void | compute_diff32_8bitshift (register ASStorageDiff *diff, CARD8 *data, int size) |
static void | compute_diff32_16bitshift (register ASStorageDiff *diff, CARD8 *data, int size) |
static void | compute_diff32_masked (register ASStorageDiff *diff, CARD8 *data, int size) |
static void | compute_diff32_8bitshift_masked (register ASStorageDiff *diff, CARD8 *data, int size) |
static void | compute_diff32_16bitshift_masked (register ASStorageDiff *diff, CARD8 *data, int size) |
static void | compute_diff32_24bitshift_masked (register ASStorageDiff *diff, CARD8 *data, int size) |
static int | rlediff_compress (CARD8 *buffer, ASStorageDiff *diff, int size) |
static int | rlediff_decompress_bitmap (CARD8 *buffer, CARD8 *data, int size, CARD8 bitmap_value) |
static int | rlediff_decompress (CARD8 *buffer, CARD8 *data, int size) |
static int | copy_data_tinted (CARD8 *buffer, CARD32 *data32, int size, CARD32 tint) |
static int | copy_data_tinted_8bitshift (CARD8 *buffer, CARD32 *data32, int size, CARD32 tint) |
static int | copy_data_tinted_16bitshift (CARD8 *buffer, CARD32 *data32, int size, CARD32 tint) |
static int | copy_data_tinted_masked (CARD8 *buffer, CARD32 *data32, int size, CARD32 tint) |
static int | copy_data_tinted_8bitshift_masked (CARD8 *buffer, CARD32 *data32, int size, CARD32 tint) |
static int | copy_data_tinted_16bitshift_masked (CARD8 *buffer, CARD32 *data32, int size, CARD32 tint) |
static int | copy_data_tinted_24bitshift_masked (CARD8 *buffer, CARD32 *data32, int size, CARD32 tint) |
static int | copy_data32 (CARD8 *buffer, CARD32 *data32, int size) |
static int | copy_data32_8bitshift (CARD8 *buffer, CARD32 *data32, int size) |
static int | copy_data32_16bitshift (CARD8 *buffer, CARD32 *data32, int size) |
static int | copy_data32_masked (CARD8 *buffer, CARD32 *data32, int size) |
static int | copy_data32_8bitshift_masked (CARD8 *buffer, CARD32 *data32, int size) |
static int | copy_data32_16bitshift_masked (CARD8 *buffer, CARD32 *data32, int size) |
static int | copy_data32_24bitshift_masked (CARD8 *buffer, CARD32 *data32, int size) |
static CARD8 * | compress_stored_data (ASStorage *storage, CARD8 *data, int size, ASFlagType *flags, int *compressed_size, CARD32 bitmap_threshold) |
static CARD8 * | decompress_stored_data (ASStorage *storage, CARD8 *data, int size, int uncompressed_size, ASFlagType flags, CARD8 bitmap_value) |
static void | add_storage_slots (ASStorageBlock *block) |
static ASStorageBlock * | create_asstorage_block (int useable_size) |
static void | destroy_asstorage_block (ASStorageBlock *block) |
static int | select_storage_block (ASStorage *storage, int compressed_size, ASFlagType flags, int block_id_start) |
static void | destroy_storage_slot (ASStorageBlock *block, int index) |
static void | join_storage_slots (ASStorageBlock *block, ASStorageSlot *from_slot, ASStorageSlot *to_slot) |
static void | defragment_storage_block (ASStorageBlock *block) |
static ASStorageSlot * | select_storage_slot (ASStorageBlock *block, int size) |
static Bool | split_storage_slot (ASStorageBlock *block, ASStorageSlot *slot, int to_size) |
static int | store_data_in_block (ASStorageBlock *block, CARD8 *data, int size, int compressed_size, int ref_count, ASFlagType flags) |
static ASStorageID | store_compressed_data (ASStorage *storage, CARD8 *data, int size, int compressed_size, int ref_count, ASFlagType flags) |
static ASStorageBlock * | find_storage_block (ASStorage *storage, ASStorageID id) |
static ASStorageSlot * | find_storage_slot (ASStorageBlock *block, ASStorageID id) |
static void | free_storage_slot (ASStorageBlock *block, ASStorageSlot *slot) |
static Bool | is_block_empty (ASStorageBlock *block) |
static void | free_storage_block (ASStorage *storage, int block_idx) |
static ASStorageSlot * | convert_slot_to_ref (ASStorage *storage, ASStorageID id) |
static void | card8_card8_cpy (ASStorageDstBuffer *dst, void *src, size_t size) |
static void | card8_card32_cpy (ASStorageDstBuffer *dst, void *src, size_t size) |
static void | card8_threshold (ASStorageDstBuffer *dst, void *src, size_t size) |
static int | fetch_data_int (ASStorage *storage, ASStorageID id, ASStorageDstBuffer *buffer, int offset, int buf_size, CARD8 bitmap_value, data_cpy_func_type cpy_func, int *original_size) |
ASStorage * | create_asstorage () |
int | set_asstorage_block_size (ASStorage *storage, int new_size) |
void | destroy_asstorage (ASStorage **pstorage) |
void | flush_default_asstorage () |
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) |
Bool | query_storage_slot (ASStorage *storage, ASStorageID id, ASStorageSlot *dst) |
int | print_storage_slot (ASStorage *storage, ASStorageID id) |
void | print_storage (ASStorage *storage) |
void | forget_data (ASStorage *storage, ASStorageID id) |
ASStorageID | dup_data (ASStorage *storage, ASStorageID id) |
Variables | |
ASStorage * | _as_default_storage = NULL |
static size_t | UsedMemory = 0 |
static size_t | UncompressedSize = 0 |
static size_t | CompressedSize = 0 |
#define DO_CLOCKING |
Definition at line 28 of file asstorage.c.
#define get_default_asstorage | ( | ) | (_as_default_storage?_as_default_storage:(_as_default_storage=create_asstorage())) |
Definition at line 72 of file asstorage.c.
Referenced by dup_data(), fetch_data(), fetch_data32(), forget_data(), print_storage(), print_storage_slot(), query_storage_slot(), set_asstorage_block_size(), store_data(), store_data_tinted(), and threshold_stored_data().
Definition at line 79 of file asstorage.c.
Referenced by convert_slot_to_ref(), find_storage_block(), and forget_data().
Definition at line 80 of file asstorage.c.
Referenced by convert_slot_to_ref(), dup_data(), and find_storage_slot().
typedef void(*) data_cpy_func_type(ASStorageDstBuffer *, void *, size_t) |
Definition at line 1586 of file asstorage.c.
static void add_storage_slots | ( | ASStorageBlock * | block | ) | [static] |
Definition at line 907 of file asstorage.c.
References AS_STORAGE_MAX_SLOTS_CNT, AS_STORAGE_SLOTS_BATCH, i, int, LOCAL_DEBUG_OUT, NULL, realloc(), show_debug, size, ASStorageBlock::slots, ASStorageBlock::slots_count, and UsedMemory.
Referenced by create_asstorage_block(), defragment_storage_block(), and split_storage_slot().
static void card8_card32_cpy | ( | ASStorageDstBuffer * | dst, | |
void * | src, | |||
size_t | size | |||
) | [static] |
static void card8_card8_cpy | ( | ASStorageDstBuffer * | dst, | |
void * | src, | |||
size_t | size | |||
) | [static] |
static void card8_threshold | ( | ASStorageDstBuffer * | dst, | |
void * | src, | |||
size_t | size | |||
) | [static] |
Definition at line 1606 of file asstorage.c.
References fprintf(), i, and start.
Referenced by threshold_stored_data().
static CARD8* compress_stored_data | ( | ASStorage * | storage, | |
CARD8 * | data, | |||
int | size, | |||
ASFlagType * | flags, | |||
int * | compressed_size, | |||
CARD32 | bitmap_threshold | |||
) | [static] |
Definition at line 713 of file asstorage.c.
References AS_STORAGE_PAGE_SIZE, ASStorage_32Bit, ASStorage_Bitmap, ASStorage_BitShift, ASStorage_Flags2Shift, ASStorage_Flags2ShiftIdx, ASStorage_Masked, ASStorage_RLEDiffCompress, ASStorageSlot_SIZE, buffer, clear_flags, ASStorage::comp_buf, ASStorage::comp_buf_size, CompressedSize, compute_diff32(), compute_diff32_16bitshift(), compute_diff32_16bitshift_masked(), compute_diff32_24bitshift_masked(), compute_diff32_8bitshift(), compute_diff32_8bitshift_masked(), compute_diff32_masked(), compute_diff8(), copy_data32(), copy_data32_16bitshift(), copy_data32_16bitshift_masked(), copy_data32_24bitshift_masked(), copy_data32_8bitshift(), copy_data32_8bitshift_masked(), copy_data32_masked(), copy_data_tinted(), copy_data_tinted_16bitshift(), copy_data_tinted_16bitshift_masked(), copy_data_tinted_24bitshift_masked(), copy_data_tinted_8bitshift(), copy_data_tinted_8bitshift_masked(), copy_data_tinted_masked(), ASStorage::diff_buf, get_flags, i, LOCAL_DEBUG_OUT, realloc(), rlediff_compress(), rlediff_compress_bitmap32(), rlediff_compress_bitmap8(), set_flags, show_debug, size_t, and UncompressedSize.
Referenced by store_data(), and store_data_tinted().
static void compute_diff32 | ( | register ASStorageDiff * | diff, | |
CARD8 * | data, | |||
int | size | |||
) | [static] |
static void compute_diff32_16bitshift | ( | register ASStorageDiff * | diff, | |
CARD8 * | data, | |||
int | size | |||
) | [static] |
static void compute_diff32_16bitshift_masked | ( | register ASStorageDiff * | diff, | |
CARD8 * | data, | |||
int | size | |||
) | [static] |
static void compute_diff32_24bitshift_masked | ( | register ASStorageDiff * | diff, | |
CARD8 * | data, | |||
int | size | |||
) | [static] |
static void compute_diff32_8bitshift | ( | register ASStorageDiff * | diff, | |
CARD8 * | data, | |||
int | size | |||
) | [static] |
static void compute_diff32_8bitshift_masked | ( | register ASStorageDiff * | diff, | |
CARD8 * | data, | |||
int | size | |||
) | [static] |
static void compute_diff32_masked | ( | register ASStorageDiff * | diff, | |
CARD8 * | data, | |||
int | size | |||
) | [static] |
static void compute_diff8 | ( | register ASStorageDiff * | diff, | |
register CARD8 * | data, | |||
int | size | |||
) | [static] |
static ASStorageSlot* convert_slot_to_ref | ( | ASStorage * | storage, | |
ASStorageID | id | |||
) | [static] |
Definition at line 1484 of file asstorage.c.
References a, ASStorage_CompressionType, ASStorage_Data, ASStorage_Reference, clear_flags, ASStorage::comp_buf, find_storage_block(), ASStorageSlot::flags, fprintf(), ASStorageSlot::index, LOCAL_DEBUG_OUT, make_asstorage_id(), NULL, ASStorageSlot::ref_count, set_flags, show_error, ASStorageSlot::size, ASStorageBlock::slots, split_storage_slot(), StorageID2BlockIdx, StorageID2SlotIdx, store_compressed_data(), store_data_in_block(), ASStorageBlock::total_free, and ASStorageSlot::uncompressed_size.
Referenced by dup_data().
static int copy_data32 | ( | CARD8 * | buffer, | |
CARD32 * | data32, | |||
int | size | |||
) | [static] |
static int copy_data32_16bitshift | ( | CARD8 * | buffer, | |
CARD32 * | data32, | |||
int | size | |||
) | [static] |
static int copy_data32_16bitshift_masked | ( | CARD8 * | buffer, | |
CARD32 * | data32, | |||
int | size | |||
) | [static] |
static int copy_data32_24bitshift_masked | ( | CARD8 * | buffer, | |
CARD32 * | data32, | |||
int | size | |||
) | [static] |
static int copy_data32_8bitshift | ( | CARD8 * | buffer, | |
CARD32 * | data32, | |||
int | size | |||
) | [static] |
static int copy_data32_8bitshift_masked | ( | CARD8 * | buffer, | |
CARD32 * | data32, | |||
int | size | |||
) | [static] |
static int copy_data32_masked | ( | CARD8 * | buffer, | |
CARD32 * | data32, | |||
int | size | |||
) | [static] |
static int copy_data_tinted | ( | CARD8 * | buffer, | |
CARD32 * | data32, | |||
int | size, | |||
CARD32 | tint | |||
) | [static] |
static int copy_data_tinted_16bitshift | ( | CARD8 * | buffer, | |
CARD32 * | data32, | |||
int | size, | |||
CARD32 | tint | |||
) | [static] |
static int copy_data_tinted_16bitshift_masked | ( | CARD8 * | buffer, | |
CARD32 * | data32, | |||
int | size, | |||
CARD32 | tint | |||
) | [static] |
static int copy_data_tinted_24bitshift_masked | ( | CARD8 * | buffer, | |
CARD32 * | data32, | |||
int | size, | |||
CARD32 | tint | |||
) | [static] |
static int copy_data_tinted_8bitshift | ( | CARD8 * | buffer, | |
CARD32 * | data32, | |||
int | size, | |||
CARD32 | tint | |||
) | [static] |
static int copy_data_tinted_8bitshift_masked | ( | CARD8 * | buffer, | |
CARD32 * | data32, | |||
int | size, | |||
CARD32 | tint | |||
) | [static] |
static int copy_data_tinted_masked | ( | CARD8 * | buffer, | |
CARD32 * | data32, | |||
int | size, | |||
CARD32 | tint | |||
) | [static] |
ASStorage* create_asstorage | ( | ) |
Definition at line 1726 of file asstorage.c.
References AS_STORAGE_DEF_BLOCK_SIZE, calloc(), ASStorage::default_block_size, and UsedMemory.
static ASStorageBlock* create_asstorage_block | ( | int | useable_size | ) | [static] |
Definition at line 940 of file asstorage.c.
References add_storage_slots(), AS_STORAGE_PAGE_SIZE, ASStorageSlot_SIZE, calloc(), ASStorageBlock::end, ASStorageBlock::first_free, ASStorageSlot::flags, free(), ASStorageSlot::index, ASStorageBlock::last_used, LOCAL_DEBUG_OUT, NULL, ptr, ASStorageSlot::ref_count, show_debug, ASStorageBlock::size, ASStorageSlot::size, ASStorageBlock::slots, ASStorageBlock::slots_count, sprintf(), ASStorageBlock::start, ASStorageBlock::total_free, ASStorageSlot::uncompressed_size, and UsedMemory.
static CARD8* decompress_stored_data | ( | ASStorage * | storage, | |
CARD8 * | data, | |||
int | size, | |||
int | uncompressed_size, | |||
ASFlagType | flags, | |||
CARD8 | bitmap_value | |||
) | [static] |
Definition at line 887 of file asstorage.c.
References ASStorage_Bitmap, ASStorage_RLEDiffCompress, buffer, ASStorage::comp_buf, get_flags, LOCAL_DEBUG_OUT, rlediff_decompress(), and rlediff_decompress_bitmap().
Referenced by fetch_data_int().
static void defragment_storage_block | ( | ASStorageBlock * | block | ) | [inline, static] |
Definition at line 1098 of file asstorage.c.
References add_storage_slots(), AS_STORAGE_GetNextSlot, ASStorageSlot_FULL_SIZE, ASStorageSlot_SIZE, ASStorageBlock::end, ASStorageBlock::first_free, ASStorageSlot::flags, flags, i, ASStorageSlot::index, ASStorageBlock::last_used, LOCAL_DEBUG_OUT, long, NULL, ASStorageSlot::ref_count, ASStorageSlot::size, size, ASStorageBlock::slots, ASStorageBlock::slots_count, ASStorageBlock::start, ASStorageBlock::total_free, ASStorageSlot::uncompressed_size, and ASStorageBlock::unused_count.
Referenced by select_storage_slot().
void destroy_asstorage | ( | ASStorage ** | pstorage | ) |
Definition at line 1758 of file asstorage.c.
References ASStorage::blocks, ASStorage::blocks_count, ASStorage::comp_buf, destroy_asstorage_block(), ASStorage::diff_buf, free(), i, NULL, and UsedMemory.
Referenced by flush_default_asstorage().
static void destroy_asstorage_block | ( | ASStorageBlock * | block | ) | [static] |
Definition at line 994 of file asstorage.c.
References free(), ASStorageBlock::size, ASStorageBlock::slots, ASStorageBlock::slots_count, sprintf(), and UsedMemory.
Referenced by destroy_asstorage(), and free_storage_block().
static void destroy_storage_slot | ( | ASStorageBlock * | block, | |
int | index | |||
) | [inline, static] |
Definition at line 1058 of file asstorage.c.
References i, ASStorageBlock::last_used, NULL, ASStorageBlock::slots, and ASStorageBlock::unused_count.
Referenced by join_storage_slots().
ASStorageID dup_data | ( | ASStorage * | storage, | |
ASStorageID | 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().
static int fetch_data_int | ( | ASStorage * | storage, | |
ASStorageID | id, | |||
ASStorageDstBuffer * | buffer, | |||
int | offset, | |||
int | buf_size, | |||
CARD8 | bitmap_value, | |||
data_cpy_func_type | cpy_func, | |||
int * | original_size | |||
) | [static] |
Definition at line 1664 of file asstorage.c.
References AS_STORAGE_DEFAULT_BMAP_VALUE, ASStorage_Data, ASStorage_NotTileable, ASStorage_Reference, buffer, decompress_stored_data(), find_storage_block(), find_storage_slot(), ASStorageSlot::flags, get_flags, ASStorageSlot::index, LOCAL_DEBUG_OUT, ASStorageSlot::size, and ASStorageSlot::uncompressed_size.
Referenced by fetch_data(), fetch_data32(), and threshold_stored_data().
static ASStorageBlock* find_storage_block | ( | ASStorage * | storage, | |
ASStorageID | id | |||
) | [inline, static] |
Definition at line 1431 of file asstorage.c.
References ASStorage::blocks, NULL, and StorageID2BlockIdx.
Referenced by convert_slot_to_ref(), dup_data(), fetch_data_int(), forget_data(), print_storage_slot(), and query_storage_slot().
static ASStorageSlot* find_storage_slot | ( | ASStorageBlock * | block, | |
ASStorageID | id | |||
) | [inline, static] |
Definition at line 1440 of file asstorage.c.
References ASStorageSlot::flags, NULL, ASStorageBlock::slots, and StorageID2SlotIdx.
Referenced by dup_data(), fetch_data_int(), forget_data(), print_storage_slot(), and query_storage_slot().
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().
static void free_storage_block | ( | ASStorage * | storage, | |
int | block_idx | |||
) | [static] |
Definition at line 1476 of file asstorage.c.
References ASStorage::blocks, destroy_asstorage_block(), and NULL.
Referenced by forget_data().
static void free_storage_slot | ( | ASStorageBlock * | block, | |
ASStorageSlot * | slot | |||
) | [inline, static] |
Definition at line 1455 of file asstorage.c.
References ASStorageSlot_USABLE_SIZE, ASStorageSlot::flags, and ASStorageBlock::total_free.
Referenced by forget_data().
static Bool is_block_empty | ( | ASStorageBlock * | block | ) | [static] |
Definition at line 1462 of file asstorage.c.
References False, flags, i, ASStorageBlock::last_used, ASStorageBlock::slots, and True.
Referenced by forget_data().
static void join_storage_slots | ( | ASStorageBlock * | block, | |
ASStorageSlot * | from_slot, | |||
ASStorageSlot * | to_slot | |||
) | [inline, static] |
Definition at line 1081 of file asstorage.c.
References AS_STORAGE_GetNextSlot, ASStorageSlot_FULL_SIZE, ASStorageSlot_USABLE_SIZE, destroy_storage_slot(), LOCAL_DEBUG_OUT, s, and ASStorageSlot::size.
Referenced by select_storage_slot().
static ASStorageID make_asstorage_id | ( | int | block_id, | |
int | slot_id | |||
) | [inline, static] |
Definition at line 86 of file asstorage.c.
References x01.
Referenced by convert_slot_to_ref(), and store_compressed_data().
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().
static int rlediff_compress | ( | CARD8 * | buffer, | |
ASStorageDiff * | diff, | |||
int | size | |||
) | [static] |
Definition at line 253 of file asstorage.c.
References d, fprintf(), i, k, RLE_9BIT_NEG_SIG, RLE_9BIT_SIG, RLE_NOZERO_LONG1_SIG, RLE_NOZERO_LONG2_SIG, RLE_NOZERO_SHORT_SIG, RLE_ZERO_SIG, and x20.
Referenced by compress_stored_data().
static int rlediff_compress_bitmap32 | ( | CARD8 * | buffer, | |
CARD8 * | data, | |||
int | size, | |||
CARD32 | bitmap_threshold | |||
) | [static] |
static int rlediff_compress_bitmap8 | ( | CARD8 * | buffer, | |
CARD8 * | data, | |||
int | size, | |||
CARD32 | bitmap_threshold | |||
) | [static] |
static int rlediff_decompress | ( | CARD8 * | buffer, | |
CARD8 * | data, | |||
int | size | |||
) | [static] |
Definition at line 499 of file asstorage.c.
References c, fprintf(), int, LOCAL_DEBUG_OUT, RLE_9BIT_NEG_SIG, RLE_NOZERO_LONG1_SIG, RLE_NOZERO_LONG2_SIG, RLE_NOZERO_LONG_LENGTH, RLE_NOZERO_LONG_MASK, RLE_NOZERO_SHORT_LENGTH, RLE_NOZERO_SHORT_MASK, RLE_NOZERO_SHORT_SIG, RLE_ZERO_MASK, RootCsg::sign(), x01, and x07.
Referenced by decompress_stored_data().
static int rlediff_decompress_bitmap | ( | CARD8 * | buffer, | |
CARD8 * | data, | |||
int | size, | |||
CARD8 | bitmap_value | |||
) | [static] |
Definition at line 479 of file asstorage.c.
References int, and LOCAL_DEBUG_OUT.
Referenced by decompress_stored_data().
static int select_storage_block | ( | ASStorage * | storage, | |
int | compressed_size, | |||
ASFlagType | flags, | |||
int | block_id_start | |||
) | [static] |
Definition at line 1015 of file asstorage.c.
References AS_STORAGE_MAX_SLOTS_CNT, AS_STORAGE_NOUSE_THRESHOLD, ASStorageSlot_SIZE, ASStorage::blocks, ASStorage::blocks_count, and i.
Referenced by store_compressed_data().
static ASStorageSlot* select_storage_slot | ( | ASStorageBlock * | block, | |
int | size | |||
) | [static] |
Definition at line 1202 of file asstorage.c.
References AS_STORAGE_GetNextSlot, ASStorageSlot_FULL_SIZE, ASStorageSlot_SIZE, ASStorageSlot_USABLE_SIZE, defragment_storage_block(), ASStorageBlock::end, ASStorageBlock::first_free, ASStorageSlot::flags, i, join_storage_slots(), ASStorageBlock::last_used, LOCAL_DEBUG_OUT, ASStorageBlock::long_searches, NULL, ASStorageSlot::size, ASStorageBlock::slots, ASStorageBlock::slots_count, and ASStorageBlock::start.
Referenced by store_data_in_block().
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().
static Bool split_storage_slot | ( | ASStorageBlock * | block, | |
ASStorageSlot * | slot, | |||
int | to_size | |||
) | [inline, static] |
Definition at line 1267 of file asstorage.c.
References add_storage_slots(), AS_STORAGE_GetNextSlot, AS_STORAGE_MAX_SLOTS_CNT, ASStorageSlot_FULL_SIZE, ASStorageSlot_USABLE_SIZE, ASStorageBlock::end, False, ASStorageSlot::flags, i, ASStorageSlot::index, ASStorageBlock::last_used, LOCAL_DEBUG_OUT, NULL, ASStorageSlot::ref_count, show_warning, ASStorageSlot::size, ASStorageBlock::slots, ASStorageBlock::slots_count, True, ASStorageSlot::uncompressed_size, and ASStorageBlock::unused_count.
Referenced by convert_slot_to_ref(), and store_data_in_block().
static ASStorageID store_compressed_data | ( | ASStorage * | storage, | |
CARD8 * | data, | |||
int | size, | |||
int | compressed_size, | |||
int | ref_count, | |||
ASFlagType | flags | |||
) | [static] |
Definition at line 1398 of file asstorage.c.
References ASStorageSlot_SIZE, ASStorage::blocks, LOCAL_DEBUG_OUT, make_asstorage_id(), select_storage_block(), show_error, store_data_in_block(), and ASStorageBlock::total_free.
Referenced by convert_slot_to_ref(), store_data(), and store_data_tinted().
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().
static int store_data_in_block | ( | ASStorageBlock * | block, | |
CARD8 * | data, | |||
int | size, | |||
int | compressed_size, | |||
int | ref_count, | |||
ASFlagType | flags | |||
) | [static] |
Definition at line 1335 of file asstorage.c.
References ASStorage_Data, ASStorage_Used, ASStorageSlot_FULL_SIZE, ASStorageSlot_SIZE, ASStorageSlot_USABLE_SIZE, ASStorageBlock::end, False, ASStorageBlock::first_free, ASStorageSlot::flags, i, ASStorageSlot::index, ASStorageBlock::last_used, LOCAL_DEBUG_OUT, NULL, ASStorageSlot::ref_count, select_storage_slot(), short, show_error, ASStorageBlock::size, ASStorageSlot::size, ASStorageBlock::slots, ASStorageBlock::slots_count, split_storage_slot(), start, ASStorageBlock::start, ASStorageBlock::total_free, True, ASStorageSlot::uncompressed_size, and ASStorageBlock::unused_count.
Referenced by convert_slot_to_ref(), and store_compressed_data().
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().
ASStorage* _as_default_storage = NULL |
size_t CompressedSize = 0 [static] |
size_t UncompressedSize = 0 [static] |
size_t UsedMemory = 0 [static] |
Definition at line 82 of file asstorage.c.
Referenced by add_storage_slots(), create_asstorage(), create_asstorage_block(), destroy_asstorage(), and destroy_asstorage_block().