[MPlayer-dev-eng] Nut and B frames

Michael Niedermayer michaelni at gmx.at
Wed Apr 28 00:00:48 CEST 2004


Hi

On Tuesday 27 April 2004 19:44, D Richard Felker III wrote:
> On Tue, Apr 27, 2004 at 07:22:17PM +0200, Michael Niedermayer wrote:
[...]
> > anyway, theres yet another possibility, just additionally store reordered
> > pts if the stream contains b frames, that way we can
> > 1. enforce monotonicity
> > 2. support push style demuxers
> > 3. store frames in decoding order as required by the mpeg specs
>
> Is reordered pts the same thing as dts (decode timestamp)?
yes, i didnt name it dts, as dts could implicate some additional delay for 
decoding or whatever

>
> > how to store reordered pts?
> > possibility 1: index into array of previously decoded pts values
> > possibility 2: like pts
> > possibility 3: simply the difference to the pts
> > possibility 4: like 3 but exchange how pts and reordered pts are stored
>
> I don't like this proposal. 
neither do i :)

> It increases filesize, 
not necessarily, it depends upon how dts are stored
dts will normally be last_dts + 1

> and dts isn't a  
> useful quantitity to have (you only need decode _order_, not the
> timestamp, and order is implied by the order frames are stored in the
> file).
>
> IMO the decision is between choice #1 (storing frames in display order
s/display/decode/ ?!

> with non-monotone pts and having some half-working semi-monotonicity
> rules to ensure decent interleaving) or choice #3 (my new proposal
> with the zero-size packets for pts). Not sure which is better. Do you
> have any comments (good or bad) on #3?
i dont like #3, its the well known hack divx and xvid use to store b frames in 
avi, but thats not a good argument to reject it, but maybe i found a case 
which #3 cant handle (see end of mail)

btw, heres some more idiot proof code to calculate dts from pts
----
if(start, seeking, ...)
    for(i=0; i<decoder_delay; i++)
        pts_list[i]= -1;

min_pts= pts;
min_i=-1;
for(i=0; i<decoder_delay; i++){
    if(pts_list[i] < min_pts){
        min_pts= pts_list[i];
        min_i = i;
    }
}

dts= min_pts;
if(min_i>=0) pts_list[min_i]= pts;
----
type&pts: I0 P3 B1 B2 P4 P6 B5
list       -  0  3  3  3  4  6
dts        -  0  1  2  3  4  5

type&pts: I0 P3 P6 B1 B2 P9 B4 B5 ..
list      -- -0 30 36 36 36 96 96
dts        -  -  0  1  2  3  4  5

2 level bframe prediction I0->B2<-P4 I0->B1<-B2, ...
type&pts: I0 P4 B2 B1 B3 P8 B6 B5 B7 ...
list      -- -0 40 42 42 43 48 68 68
dts        -  -  0  1  2  3  4  5  6

and now with #3 
type&pts: I0 Px B1 B2 .3 P4 Px B5 .6

type&pts: I0 Px Px B1 B2 .3 Px B4 B5 .6 ..

type&pts: I0 Px B2 B1 B3 .4 Px B6 B5 B7 .8 ...
hmm wrong ...
rich, do u see a way this could be done with #3 ?

[...]

-- 
Michael
level[i]= get_vlc(); i+=get_vlc();		(violates patent EP0266049)
median(mv[y-1][x], mv[y][x-1], mv[y+1][x+1]);	(violates patent #5,905,535)
buf[i]= qp - buf[i-1];				(violates patent #?)
for more examples, see http://mplayerhq.hu/~michael/patent.html
stop it, see http://petition.eurolinux.org & http://petition.ffii.org/eubsa/en




More information about the MPlayer-dev-eng mailing list