View Full Version : Delta frame help
Dark Shikari
24th April 2007, 22:26
I'm considering trying to make an LZMA-based lossless codec, similar to Lagarith except it would be asymmetric; faster playback than encoding by about a factor of 8-10.
One possibility I've thought of is having it operate on delta frames instead of actual frames. What is a good way to generate clips of delta frames in order to test this idea? I can't find an AviSynth command to do it at first glance.
foxyshadis
24th April 2007, 23:01
You mean difference-to-last frames? mt_makediff(current,previous,chroma="process"), or for a full testing script:
previous=deleteframe(0)
trimmed=trim(0,-1)+mt_makediff(previous,last,chroma="process").trim(1,0)
last
#trimmed
Just comment or uncomment trimmed to test. (Put together that way just because the script parser doesn't like scripts ending with an assignment.)
You can customize the variations on the differencing with mt_lutxy, but makediff is simple and works, as long as you don't depend on least-cost codes being 0. The only sources that show real improvement with this are cartoony ones with lots of repeats. Live-action and rendered cg doesn't benefit at all. You might talk to akupenguin about creating a smarter context-coder like his unreleased ffv1 delta-frame code.
Dark Shikari
24th April 2007, 23:26
Thanks. I figured it might not be any better, as curiously enough 7zip does not get ANY compression boost on non-cartoon video with dictionaries larger than the frame size: basically ZERO improvement.
This implies that basically all the compression is being done on a frame-by-frame basis, so delta frames probably aren't needed. If I choose to go ahead and try this I could always add in a large-dictionary-size option for animations.
The testing I've done got me down to 30 seconds for encoding 50 frames of 1680x1050 video and 3 seconds for decoding, using 7zip. This is about 6 times faster encoding than the absolute-max settings and slightly faster decoding. I'm using 24 fast bytes, just 2 runs of the bt4 match finder, and 8/0/3 for the various bit settings listed in the documentation (forgot their names).
I'm guessing it would be almost a matter of copying and pasting the LZMA compression code into the code for Lagarith or some other popular frame-by-frame lossless codec, combined with a bit of modification. Maybe I could treat each frame as a block and pass it to the coder.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.