[Ffmpeg-devel] I / P block decision issues
Wed Nov 2 16:52:16 CET 2005
The decision on whether to encode a block as an I or P block seems a little
messed up in the function ff_estimate_p_frame_motion() of motion_est.c
1- there is the statement if(mb_type).. else
but FF_MB_DECISION_SIMPLE is defined in avcodec.h as 0
So it would seem that either the if statement should be changed or the
definitions should be changed so that they are all non-zero.
2- there are a lot of "FIXME" comments (almost the only comments in the code!)
The decision on whether to encode a single block as an inter or intra block
seems very complicated as is the scene change detection code. The code is too
convoluted and there are few comments so I can't work out what needs to be
done, but having done a profile of encoding in MPEG2 I found that 7% of the
encoding time is taken measuring the square of difference and then taking its
square root (sse16_mmx =4.5%, ff_sqrt = 2.6%).
This is used to measure the variance across a block which seems to be used for
scene change detection and rate control.
Is it not possible to have something simpler (and easier to understand)?
Perhaps make a block an I block if the SAD value is above a threshold and if
the number of I blocks exceeds a threshold make the whole frame an I frame and
skip the rest of the motion vector searching.
3- the SAD value of the best MV, which is stored in dmin doesn't seem to be
used for the fDCT and that the SAD is recalculated. Is that correct? It seems
wasteful if that is the case.
More information about the ffmpeg-devel