[video output=day354 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Simple LZ Compression" vod_platform=youtube id=l8WUqmHD1PU annotator=Miblo] [0:21][Recap and set the stage for the day] [1:55][simple_compressor.cpp: Look through the code and note the relative simplicity of the decompressor] [8:48][simple_compressor.cpp: Introduce LZDecompress()] [10:59][Blackboard: What CopyDistance refers to] [13:15][simple_compressor.cpp: Simplify and empower LZDecompress()] [21:24][simple_compressor.cpp: Consider the respective trade-offs of LZDecompress() and RLEDecompress()] [23:35][simple_compressor.cpp: Introduce LZCompress(), in order first to do RLE with an LZ backend] [31:20][simple_compressor.cpp: Introduce a "test" command, which compresses and decompresses, and then tests that the output matches the original] [34:23][Step through LZCompress() and LZDecompress() and watch what they do] [37:01][Assess how effectively it compresses test1.hha and intro_art.hha] [39:01][simple_compressor.cpp: Enable LZCompress() to perform look-backs for actual LZ compression] [50:38][Run the compressor on test1.hha and assess its effectiveness] [52:24][simple_compressor.cpp: Make LZCompress() output runs under stricter conditions] [54:09][Consider the compressor's new effectiveness, run it on intro_art.hha and break briefly to get a drink] [56:55][Blackboard: Optimal Parse] [1:00:24][Blackboard: Parsing interleaved data] [1:04:28][Assess the compressor's effectiveness on intro_art.hha] [1:05:14][simple_compressor.cpp: Note some fun things we can do with this code to try and make it better] [1:09:18][simple_compressor.cpp: Introduce the ability to gather and output statistics] [1:12:39][simple_compressor.cpp: Define handlers for the compressors and decompressors] [1:20:33][Run the compressor on test1.hha, crash and step in to investigate what's happening] [1:21:39][simple_compressor.cpp: Fix up the documentation and typos] [1:22:37][simple_compressor.cpp: Output the supported compression algorithms and continue implementing statistic gathering] [1:25:11][simple_compressor.cpp: Introduce GetStatName(), PrintStats(), Percent() and Increment()] [1:34:03][simple_compressor.cpp: Enable RLECompress() to gather stats, and make it and LZCompress() flush the buffer if they are at the end] [1:37:47][Run the compressor and make RLECompress() encode runs more smartly] [1:43:15][simple_compressor.cpp: Call PrintStats()] [1:44:39][Run the compressor, crash and fix up Percent() and PrintStats()] [1:45:39][Run the RLE compressor on test1.hha and consult the statistics] [1:46:35][simple_compressor.cpp: Enable LZCompress() to gather statistics] [1:48:06][Run the LZ compressor on test1.hha and consult the statistics] [1:50:07][Q&A][:speech] [1:51:51][@Miblo][Amazing. I think I followed it, but definitely want to re-watch (during and after annotating)] [1:52:04][@garryjohanson][Forgive me if this information was somehow implicit in today's lecture and I missed it, but is compression ever used for locality wins?] [1:52:43][@graeme7][Do you know off-hand what kind of compression ratio and decompression speed are needed before it's faster to load compressed data and decompress, over loading decompressed data?] [1:54:01][@nxsy][inttypes.h and PRIu64 is probably what you are supposed to do for %llu for 64-bit printfs] [1:54:38][@ieee754][You still have to uncompress your images for display, right? So do you have plans for using block compression?] [1:55:16][@garryjohanson][Make data fit in cache] [1:57:08][@mtsmox][Why is 255 not a good look back limit for images? You wanted to elaborate on that] [1:57:47][Blackboard: Choosing your look back window for image compression] [1:59:22][@bluespide][Have you ever heard of random seed data compression?] [1:59:46][@kknewkles][Probably more of Jeff and Fabian's territory, but is there generally such a thing as a compressor that compresses a lot and fast? Would some RAD compressor leave 10% of initial size and be considerably faster than LZ? I guess BINK is hyperfast, isn't it like live decompression or something?] [2:00:59][@ieee754][I meant block compression that's GPU-supported (BC1-BC7). You upload the compressed image to the GPU, and hardware decodes it when sampled] [2:03:43][Close this off][:speech] [/video]