[MPlayer-dev-eng] NUT backptr proposal
Michael Niedermayer
michaelni at gmx.at
Thu Dec 29 15:24:05 CET 2005
Hi
On Thu, Dec 29, 2005 at 11:07:08AM +0200, Oded Shimon wrote:
> On Thu, Dec 29, 2005 at 03:44:37AM -0500, Rich Felker wrote:
> > beyond: the index..
> >
> > naturally an index that simply points to each syncpoint can be used;
> > however that increases the required media-seek operations to 2 per
> > seek instead of just 1. storing back_ptr values in the index seems
> > desirable if it can be done without severe overhead costs. oded will
> > hopefully be sending a proposal based on some of our ideas for the
> > index to go with per-stream back_ptr.
>
> Now it's my turn.
> I feel it is easiest to describe this complicated index with code:
>
> for (i = 0; i < ss; i++) s[i].repeat = 1;
> get_v(syncpoints);
> get_v(M);
> for(i = 0; i < syncpoints; i++) {
> int j, flag = 0;
> for (j = 0; j < ss; j++) if (!--s[j].repeat) flag = 1;
> if (!flag) continue;
> get_v(pts);
> for (j = 0; j < ss; j++) {
> if (!s[j].repeat) {
> get_v(back_ptr);
> if (back_ptr < M) {
> int k;
> for (k = 0; k < back_ptr; k++) {
> s[j].back_ptr[i+k] = { pts, s[j].back_ptr[i-1] };
> }
> s[j].repeat = back_ptr;
> } else {
> back_ptr -= M;
> back_ptr *= 8;
> if (i) back_ptr + =s[j].back_ptr[i-1]
> s[j].back_ptr[i] = { pts, back_ptr };
> }
> }
> }
> }
>
> This code assumes a very very stupid way of storing the index... Basically
> stores EVERY syncpoint for every stream, instead of just the repeated ones.
hmm, trying to win that obfuscated code contest? ;)
if we do choose something like that why not:
n= get_v();
for(i = 0; i < n; i++) {
syncpoint[i].pts = syncpoint[i-1].pts + get_v() + 1;
syncpoint[i].pos_div8= syncpoint[i-1].pos_div8 + get_v() + 1;
}
for(i=0; i<stream_count; i++){
s=0;
for(j=0; j<n; j++){
s+= get_v() + 1;
repeat= get_v() + 1;
while(repeat--){
stream[i].entry[j ].pts = syncpoint[s].pts;
stream[i].entry[j++].pos_div8= syncpoint[s].pos_div8;
}
}
}
[...]
--
Michael
More information about the MPlayer-dev-eng
mailing list