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

Jason Garrett-Glaser darkshikari
Tue Oct 26 08:01:02 CEST 2010


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.

Precision: Based on the length of the video, calculate the optimal
precision for the initial context table.  For long videos, this will
of course be the maximum precision.  For really short videos, this
might be no context table at all.

Dark Shikari



More information about the ffmpeg-devel mailing list