[FFmpeg-devel] [PATCH] FFV1 2pass initial range coder states

Jason Garrett-Glaser darkshikari
Tue Oct 26 13:33:00 CEST 2010


On Tue, Oct 26, 2010 at 4:26 AM, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Mon, Oct 25, 2010 at 11:01:02PM -0700, Jason Garrett-Glaser wrote:
>> On Mon, Oct 25, 2010 at 8:10 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
>> > On Mon, Oct 25, 2010 at 07:32:10PM -0700, Jason Garrett-Glaser wrote:
>> >> On Mon, Oct 25, 2010 at 7:19 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
>> >> > Hi
>> >> >
>> >> > patch below uses 2 pass to find approximatly good initial states (not global
>> >> > optimal, that can be done too and i might try)
>> >> >
>> >> > foreman with very small gops like 1 gop == 1 frame gains about 11% in terms
>> >> > of compression.
>> >> >
>> >> > I will apply this (+ any cleanups/bugfixes i stumble accross) soon
>> >>
>> >> Er... why does this help? ?It writes EVERY SINGLE CONTEXT as an
>> >> initial state, which should have an equivalent cost to adapting from
>> >> the 50/50 state over the course of the video.
>> >>
>> >> Or does this help because at the start of each gop, the contexts are
>> >> reset, forcing us to re-adapt each time?
>> >
>> > i suspect so. Also having slices in ver2 multiplies the initial state issue
>> >
>> >
>> >> Couldn't the same kind of
>> >> benefit be had via some other method, like decoding the first frame of
>> >> the video to infer the contexts used for other gops?
>> >
>> > That seems harder and i dont think this could reach the same benefit
>> >
>> >
>> >>
>> >> And for that matter, could the initial states be compressed,
>> >
>> > they are, better ideas are welcome
>> >
>> >
>> >> or lower
>> >> precision,
>> >
>> > will try
>> >
>> >
>> >> or interpolated from fewer values?
>> >
>> > I tried replicating initial values from a smaller context set (no LL/TT based
>> > contexts) and this didnt work very well
>> >
>> > either way storing all the states costs ~120kb this is negligible for a full
>> > length movie. So its just short clips that would benefit.
>>
>> Compression: golomb codes based on the delta from the previous
>> context, or the arithcoding equivalent.
>
> you arent reading the patch you comment about ;)
> thats what iam doing already ...

But you're not doing the second part (the variable precision)! ;)

Though, since you're golomb-coding, the bit cost probably isn't linear
with increasing precision, so it might be best to just RD the
precision to use for the tables (not as in encode the video multiple
times but just write each table and calculate the rate of each one,
and estimate the loss over the video).

Dark Shikari



More information about the ffmpeg-devel mailing list