[Ffmpeg-devel] MPEG4 ISO Compliance (known problems)

Rahul Kumar kr.rahul
Fri Apr 28 12:35:24 CEST 2006


Hi everyone,
  I have tried to compile the known deviations of MPEG-4 implemetation
vis-a-vis ISO specification. Hopefully this will be of help to
someone. Here is the list:

1) FFMPEG directly applies the equations of section 7.7.2.2 (of the
standard), for a interlaced direct-mode macro-block. However since
FFMPEG stores motion vectors as field motion vectors, (for field
macroblocks  mv=mv/2), this prodoces erroneous result. I think the
cleanest way to solve this problem would be to always store the motion
vectors as frame motion-vectos, irrespective of the block-type, and
perform adjustment for field-based macroblocks in mpeg_motion() or
qpel_motion().

2) Also note that FFMPEG doesn't set the correct field_select parameters
for direct-mode macroblocks. THIS HAS BEEN CORRECTED IN CURRENT VERSION.

3) FFMPEG doesn't implment the 16x8 QPEL filtering for field macroblocks.
Note the comments in qpel_motion
...............
        //damn interlaced mode
        //FIXME boundary mirroring is not exactly correct here
        qpix_op[1][dxy](dest_y  , ptr_y  , linesize);
        qpix_op[1][dxy](dest_y+8, ptr_y+8, linesize);
...........

As specied in the comments, boundary mirroring isn't exactly correct
in the above code.

4) AMV calculation for 1 Warp-point is not correct. Further in the
function mpeg4_decode_sprite_trajectory(), the reduction in number of
wart-points
(.........../* try to simplify the situation */..........) should not
be tried, if ISO compliance is desired.

5) FFMPEG doesn't detect stuffing bits at the end of each macroblock
before trying to re-sync. A simple piece of code given below can help:
            // skip any stuffing
            if(s->pict_type==I_TYPE)
            {
                // stuffing mb "000000001"
                while( show_bits(&s->gb, 9)==1)
                    get_bits(&s->gb, 9);
            }
            else
            {
                // no-skip, followed by stuffing mb "000000001"
                while( show_bits(&s->gb, 10)==1)
                    get_bits(&s->gb, 10);
            }
           if(mpeg4_is_resync(s)){
.............
.......
..
However this causes problems with DIVX streams!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


6) Mismatch control is not implemented in dct_unquantize_mpeg2_intra_c()

7) The function mpeg4_decode_block() always compares
"intra_dc_threshold" with the current qscale values, to ascertain
whether the macroblock has DC coeff. However, but for the first coded
Macro-block in a packet, it should use previous qscale value for this
comparison.

-regards,
kr_rahul at yahoo.com





More information about the ffmpeg-devel mailing list