[XviD-devel] Min. FrameSize II
Edouard Gomez
xvid-devel@xvid.org
Sun, 15 Sep 2002 14:23:19 +0200
Dirk Knop (dknop@gwdg.de) wrote:
> do you have some more ideas? :) I "just" need a formula to better (at
> least) approximate the min. size value...
Yes i had the idea to calculate that min size value with the help of
block informations stored during first pass.
First pass is supposed to give us a good approximation of how image
will be encoded. So i thought we would be able to compute kind of
minimal frame size from these informations.
Axioms :
1 - A skipped block during first pass is still a skipped block during 2nd pass
So it will output same bits.
2 - A predicted block during 1st pass could be coded as I or P again,
depending on block history. I mean if block history makes
predictions getting harder from frame to frame because of error
accumulation then, a 1st pass predicted block could be turned into
I Block. So mblock can use less bits if it is still predicted
because of the higher quantizer used during 2nd pass *or* get
bigger if it becomes a kblock.
3 - A kblock will always be a kblock and so, get smaller because
higher quantizer will produce more zeros.
4 - A low (1 or 2) quantizer is used during first pass.
So 2nd passframe size can be computed with a formula that will look
like :
2pass_texture_size =
ublocks*ublock_size + \
mblock*heuristicP(quant2, quant1, mblock, ublock, kblock, frame size pass1) +
kblocks*heuristicI(quant2, quant1, mblock, ublock, kblock, frame size pass1);
and
texture_min_size = (ublocks+kblocks+mblocks)*ublock_size;
heuristicP/I are some heuristic functions that according to all
parameters could be able to approximate a typical k/mblock size for
this frame. For this we could need some more infos from core.
Calculating this for each possible quantizer could give us a good
approximation of the right quantizer to use.
Ok now the problem of my pseudo formulas :
- they do not take care of MVs
- they do not take care of posible headers
That's why i'm talking of texture sizes.
Hope my ideas can help you.
--
Edouard Gomez