[FFmpeg-devel] [PATCH] DNxHD/VC-3 encoder
Michael Niedermayer
michaelni
Fri Sep 7 20:05:28 CEST 2007
Hi
On Fri, Sep 07, 2007 at 09:17:49AM -0600, Loren Merritt wrote:
> On Fri, 7 Sep 2007, Michael Niedermayer wrote:
>
> > when people start using qsort you know theres something wrong in their
> > encoder (or at least not optimal)
> >
> > so, lets first check if i understand the constraints
> > * its possible to change qscale per macroblock and it doesnt cost anything
> > * theres a fixed number of bits available for each frame (pre mpeg1 design)
> >
> > in that case the optimal solution (though not fastest) is to do a
> > binary search over lambda (using the number of bits and the ones available
> > to find the best lambda which results in a frame which is not too large)
> >
> > then for each such lambda, find the best qscale for each MB, again by
> > binary search minimizing SSD + bits*lambda (that way we know the best
> > qscales and how many bits the frame would need)
>
> Your algorithm produces the same decisions as the one with qsort. I don't
> know which is faster.
>
> Consider the list of possible block encodings sorted by
> delta_ssd/delta_bits. Optimizing for qps at any given lambda will produce
> some prefix of that list. i.e. for any lambda, there is some
> position in the list such that all preceding entries have ssd/bits
> better than lambda, and all following entries have ssd/bits worse
> than lambda. So instead of evaluating bits(lambda) as a black box and
> searching for a specified values of bits, construct the function
> lambda(bits) and evaluate it at the specified value of bits.
yes, but as far as i can see thats not what the current code does, it just
tries qscale and qscale+1 if it would try all qscale then yes they would
be identical
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Its not that you shouldnt use gotos but rather that you should write
readable code and code with gotos often but not always is less readable
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070907/a33776b0/attachment.pgp>
More information about the ffmpeg-devel
mailing list