Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // start times of each frame, in ms
- double *framestart;
- // end times of each frame, in ms
- // these are equal to the start time of the next frame, except the last frame, which we BS
- double *frameend;
- // length of one CFR frame, in ms
- double cfrlength;
- // number of frames total
- int nframes;
- // for each output frame, what input frame it corresponds to
- int *remaps;
- // this is strictly concept code
- ...
- for (int i = 0, int outpos = 0; i < nframes; i++)
- {
- // start of the space we have to insert frame into
- double cfrstart = cfrlength * outpos;
- // total length of the window we have to insert a frame into (can be negative, this is ok)
- double diff = frameend[i] - cfrstart;
- // try to insert one copy of frame at low threshold (so likely to succeed)
- if (diff >= th1)
- {
- diff -= cfrlength; // consumed an entire frame's worth of space
- remaps[outpos] = i; // show this frame
- outpos++;
- }
- else
- { // record that we dropped a frame
- ndrop++;
- }
- // try to insert as many as needed copies of this frame at high threshold (so less likely to succeed)
- while (diff >= th2)
- {
- diff -= cfrlength;
- remaps[outpos] = i;
- outpos++;
- // record that we duped a frame
- ndup++;
- }
- }
- // the most important significant thing that is missing is a special case for frames before frame 0 of the vfr stream,
- // which can be filled with blank if there's enough space
Add Comment
Please, Sign In to add comment