[XviD-devel] motion_est.c splitted and cleaned - what do you think?

Radek Czyz syskin at ihug.com.au
Tue Sep 9 23:32:41 CEST 2003


Hi,
I sent this mail yesterday but it appears I have to be careful where I
sent it from - or it will be moved to /dev/null/ :)



Hey everyone :)

As you might know, src/motion/motion_est.c is currently the biggest
file among our sources. With over 120kb, it's twice as big as it's
closest 'competitor' mbcoding.c.

Obviously, it's difficult to read, understand, or find anything in
it...

This is my second (or even third?) attempt to split it to different
modules - but this time, I'm doing it "right", without unreasonable
fear of making shared functions non-static.

Please take a look at this:
http://homepages.ihug.com.au/~syskin/so_pretty.zip

Quick explantion what happened and what is there, in alphabetical
order ;) :
/motion/
  estimation.h: header files #included in all ME modules. deftypes,
                macros, constants. no code.

  estimation_bvop.c: motion estimation for b-vops. everything
                     in it :)

  estimation_common.c: functions shared among all ME modules:
                       diamonds, subpel refinement, picture
                       manipulation, tables etc.

  estimation_gmc.c: gruel's GME code

  estimation_pvop.c: ME for p-vops. Also SAD-based mode decision

  estimation_rd_based.c: everything R-D-based: mode decison
                         (including _Fast) and ME

  gmc.c, gmc.h: no change. As I understand it's Skal's interpolation
                code, shouldn't that be in image/ ? Next to
                interpolate8x8.c ?

  motion.h: Prototypes for all "external" functions declared in this
            directory - to be #included in encoder.c etc.

  motion_comp.c: almost no change - only one function moved here form
                 motion.h

  motion_inlines.h: now this is where it's a bit fishy. It's a small
                    file which contains small functions, all "static
                    __inline", shared among all modules. As it's
                    important to keem them "__inline" we can either
                    have this file, or copy-and-paste the same
                    functions to many files. I prefer the file, but
                    comments appreciated.

  sad.c, sad.h: no change

  vop_type_decision.c: P/B/I decision. Finally free, instead of being
                       squieezed between bvop ME and GME.

/prediction/mbprediction.c|h:
  get_pmv(), get_qpmv() and get_pmv_data() code removed from header.
  Last of them moved to estimation_pvop.c, the first two moved to
  mbprediction.c with prototypes in .h
  No more code in this header.

/utils/mbfunctions.h
  Hm, this one was weird. It used to contain prototypes of most motion
  functions, dunno why. I think it's better to keep them in motion.h
  (where most of them were repeated anyway). Or let's keep them here
  and get rid of motion.h.

More remarks:
- all non-static functions are named xvid_me_WhatFunctionDoes. This
  is to prevent any problems for you static linkers ;)

- I pasted legal headers to all files, but please check them. I just
  kept the 'original' legal info when I was in doubt - please check if
  you are not missing (or if you're there but see no reason for this).

- The code is not documented yet, but I'm going to do this (especially
  when given green light for the whole idea). As files are smaller and
  specialized, it's easy and will look much better than before.

OK the mail's been too long already,
Please comment,
Radek :)



More information about the XviD-devel mailing list