[FFmpeg-devel] [RFC] *put_bits_* functions renamings

Michael Niedermayer michaelni
Tue Apr 14 15:26:43 CEST 2009


On Tue, Apr 14, 2009 at 03:06:34PM +0200, Stefano Sabatini wrote:
> On date Tuesday 2009-04-14 13:25:29 +0200, Michael Niedermayer encoded:
> > On Tue, Apr 14, 2009 at 11:33:39AM +0200, Diego Biurrun wrote:
> > > On Mon, Apr 13, 2009 at 11:56:20PM -0300, Ramiro Polla wrote:
> > > > 2009/4/12 M?ns Rullg?rd <mans at mansr.com>:
> > > > > Michael Niedermayer <michaelni at gmx.at> writes:
> > > > >> On Sat, Apr 11, 2009 at 12:52:35AM +0200, Stefano Sabatini wrote:
> > > > >>> On date Friday 2009-04-10 18:53:22 +0100, M?ns Rullg?rd encoded:
> > > > >>> > Michael Niedermayer <michaelni at gmx.at> writes:
> > > > >>> > > On Fri, Apr 10, 2009 at 05:22:23PM +0200, Stefano Sabatini wrote:
> > > > >>> > >> the new name is consistent with the name for which a function should
> > > > >>> > >> be prefixed (rather than suffixed) by a prefix telling the namespace
> > > > >>> > >> to which it applyies, it is also consistent with all the other
> > > > >>> > >> put_bits_* functions and more grep-friendly.
> > > > >>> > >
> > > > >>> > > iam rather used to flush_put_bits() so iam mildly against the rename
> > > > >>> > > that is unless several other devels want the rename
> > > > >>> >
> > > > >>> > All the other functions are put_bits_*, and we have get_bits_*. ?I'm
> > > > >>> > in favour of renaming it to keep things consistent.
> > > > >>>
> > > > >>> Actually this is my complete evil plan for the *put_bits* functions:
> > > > >>>
> > > > >>> init_put_bits ? ? ? ? ? ?-> ?put_bits_init
> > > > >>> put_bits_count ? ? ? ? ? -> ?put_bits_count
> > > > >>> flush_put_bits ? ? ? ? ? -> ?put_bits_flush
> > > > >>> align_put_bits ? ? ? ? ? -> ?put_bits_align
> > > > >>> ff_put_string ? ? ? ? ? ?-> ?put_bits_string (put_bits_put_string?)
> > > > >>> ff_copy_bits ? ? ? ? ? ? -> ?put_bits_copy
> > > > >>> put_bits ? ? ? ? ? ? ? ? -> ?put_bits
> > > > >>> pbBufPtr ? ? ? ? ? ? ? ? -> ?put_bits_get_buf_ptr (put_bits_buf_ptr?)
> > > > >>> skip_put_bits ? ? ? ? ? ?-> ?put_bits_skip
> > > > >>> skip_put_bytes ? ? ? ? ? -> ?put_bits_skip_bytes
> > > > >>> set_put_bits_buffer_size -> ?put_bits_set_buffer_size
> > > > >>> put_sbits ? ? ? ? ? ? ? ?-> ?put_bits_signed? (I still have to read the function...)
> > > > >>>
> > > > >>> So the idea basically is to prefix all the functions with "put_bits",
> > > > >>> and try to follow consistent naming rules, with eventual variations
> > > > >>> with respect to the above table to accomodate devels
> > > > >>> preferences/suggestions.
> > > > >>>
> > > > >>> Also I don't think it would make sense to rename just few functions,
> > > > >>> since the idea was to provide a consistent functions set.
> > > > >>
> > > > >> i prefer to keep the functions named as they are.
> > > > >
> > > > > I would like to see those names made more consistent. ?With the
> > > > > current names it's hard to find something if you don't know the exact
> > > > > name.
> > > > 
> > > > FWIW I'm also in favour of making the names more consistent.
> > > 
> > > I tend to agree, consistent naming should pay off in the long run.
> > 
> > The names are largely consistent, what has been suggested above is
> > to change XYZ to ZYX naming
> > making things consistent within the current system is something i have
> > no problem with, what is suggested above is something i do have a
> > problem with, people are used to the naming writing all names backward
> > just makes no sense
> 
> The idea was to provide a common prefix, having that means to easily
> detects that a function belongs to a given set of functions, and looks
> like a rule followed by most of the modules in FFmpeg:
> 

> avcodec_
> avformat_
> avdevice_
> avfilter_

i like to repeat that iam against this, and such changes are done
against my objection to them. And there is a threshold at which i will
use my power to stop it
For many functions a simple av_ prefix is much better. av_log() and
av_fast_realloc() are 2 but there are hundreads more.



> av_lfg_
> avpicture_
> av_base64_
> av_hwaccel_
> av_parser_
> av_tree_
> ff_timefilter_
> ...
> 
> > also
> > stefano removes the _NEEDED_ ff prefixes (yeah its consistent just
> >    wrong)
> 
> If it is needed then I suggest to prefix that to *all* the functions
> (ff_ in ff_put_string was originally put to prevent a namespace
> collision).

my decission is not to add ff_ to very commonly used
functions that as they are static inline dont need a prefix.


> 
> > the names become longer and they are names of commonly used functions
> 
> If you look at the above table most names length is kept the same.
> 
> > stefano makes them inconsistant with the rest of ffmpeg, s is commonly
> >    used as abbreviation for signed ...
> >
> > and fixing above the only thing left is the reversing of words
> 
> As already mentioned, we have two rules in conflict, one is the

we do not have 2 rules. You invented these rules.


> namespace prefixing rule and the other is to try to resemble the
> English language. What's the better?

Its better to leave the names as they are unless the developers who
actually use them, want them changed.

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Old school: Use the lowest level language in which you can solve the problem
            conveniently.
New school: Use the highest level language in which the latest supercomputer
            can solve the problem without the user falling asleep waiting.
-------------- 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/20090414/43adce92/attachment.pgp>



More information about the ffmpeg-devel mailing list