From 8875d0226f0d38a1e5ef946e56cd15810627f5ac Mon Sep 17 00:00:00 2001 From: Fox Caminiti Date: Wed, 3 Aug 2022 16:57:07 -0400 Subject: caching introduced --- main.h | 76 ++++++++++++++++++++++++++++++++---------------------------------- 1 file changed, 37 insertions(+), 39 deletions(-) (limited to 'main.h') diff --git a/main.h b/main.h index 691d915..0067c26 100644 --- a/main.h +++ b/main.h @@ -28,16 +28,14 @@ enum memory_table_list { // P = persistent data, but not file-based // B = cached data, often cleared - F_ProjectSettings, - // The majority bloat from these two are the properties. + P_AVInfo, + P_SourceBitmapTable, + F_Layers, F_Effects, F_Keyframes, F_Strings, - P_UIState, - P_AVInfo, - B_LayerBitmaps, B_LoadedBitmaps, }; @@ -47,6 +45,8 @@ struct memory_table { void *Address; uint64 CurrentPosition; uint64 Size; + uint32 NumberOfPointers; + uint32 PointerIndex; }; struct global_memory { @@ -55,12 +55,18 @@ struct global_memory { uint64 Size; }; -struct cached_bitmap_block; +struct source; + +struct cached_bitmap { + source *SourceOwner; // Which source it belongs to. Currently used to dereference the bitmap. + void *Data; // Unpacked data loaded from the source file. + uint32 Frame; // What frame it is. + uint32 Index; // Index in memory. +}; struct memory { memory_table Slot[16]; - cached_bitmap_block *CacheBlock[256]; - uint16 NumberOfCachedBlocks; + cached_bitmap Bitmap[4096]; }; struct property_channel; @@ -144,7 +150,7 @@ struct keyframe_block { struct property_channel { char *Name; keyframe_block *KeyframeBlock[MAX_KEYFRAME_BLOCKS]; - uint16 SortedIndex[MAX_KEYFRAMES_PER_BLOCK * MAX_KEYFRAME_BLOCKS]; + uint16 SortedIndex[MAX_KEYFRAME_BLOCKS * MAX_KEYFRAMES_PER_BLOCK]; uint16 NumberOfKeyframeBlocks; uint16 NumberOfSelectedKeyframes; uint16 NumberOfTotalKeyframes; @@ -175,27 +181,6 @@ struct property_header val MaxVal; }; -struct pixel_buffer {}; - -struct effect_header -{ - char *Name; - void (*func)(pixel_buffer *, memory *, property_channel []); - uint16 NumberOfProperties; - display_type DisplayType; - property_header PropertyHeader[MAX_PROPERTIES_PER_EFFECT]; -}; - -struct effect { - char *Name; - void (*func)(pixel_buffer *, memory *, property_channel []); - uint16 NumberOfProperties; - display_type DisplayType; - property_channel Property[MAX_PROPERTIES_PER_EFFECT]; - bool32 UIIsCollapsed = 0; - bool32 IsActive = 1; -}; - // Information about a particular file. @@ -216,7 +201,7 @@ struct source_info { // Video only real32 FPS; - void* AVCodecInfo; // Internal data for the video decoder library. + real32 AvgPTSPerFrame; // set by Libav }; struct source { @@ -227,12 +212,6 @@ struct source { // Bitmaps from files are loaded into these temporary cache blocks. -struct cached_bitmap_block { - source *SourceOwner; // Which source the data belongs to. - void *Data; // Unpacked data loaded from the source file. - uint32 StartFrame; - uint32 NumberOfCachedFrames; -}; struct layer_bitmap_info { // Image and video @@ -242,7 +221,7 @@ struct layer_bitmap_info { // Video only int32 FrameOffset; // the "true" position of video layers, separate from StartFrame int32 CurrentFrame = -1; // The last frame number rendered to the bitmap. - void *AVPacketInfo; // Internal data containing current frame info + void *AVInfo; // Internal data containing current frame info }; struct comp_buffer { @@ -253,6 +232,26 @@ struct comp_buffer { void *UnpackedBuffer; }; +struct effect_header +{ + char *Name; + void (*func)(source *, layer_bitmap_info *, memory *, property_channel []); + uint16 NumberOfProperties; + display_type DisplayType; + property_header PropertyHeader[MAX_PROPERTIES_PER_EFFECT]; +}; + +struct effect { + char *Name; + void (*func)(source *, layer_bitmap_info *, memory *, property_channel []); + uint16 NumberOfProperties; + display_type DisplayType; + property_channel Property[MAX_PROPERTIES_PER_EFFECT]; + bool32 UIIsCollapsed = 0; + bool32 IsActive = 1; +}; + + struct transform_info { real32 XAxisPX; @@ -366,7 +365,6 @@ enum transforms_hotkey_interact { struct main_sdl { - // pixel_buffer Buffer; SDL_Texture *Texture; SDL_Event Event; SDL_Window *Window; -- cgit v1.2.3