Add files via upload

This commit is contained in:
Akascape
2021-12-21 19:06:00 +05:30
committed by GitHub
parent 87898fe269
commit e8868946ba
13 changed files with 700 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
var randomness = 10;
var bias = (randomness/2);
function glitch_frame(frame)
{
// bail out if we have no motion vectors
let mvs = frame["mv"];
if ( !mvs )
return;
// bail out if we have no forward motion vectors
let fwd_mvs = mvs["forward"];
if ( !fwd_mvs )
return;
// clear horizontal element of all motion vectors
for ( let i = 0; i < fwd_mvs.length; i++ )
{
// loop through all rows
let row = fwd_mvs[i];
for ( let j = 0; j < row.length; j++ )
{
// loop through all macroblocks
let mv = row[j];
// THIS IS WHERE THE MAGIC HAPPENS
mv[0] = mv[0] + (Math.floor((Math.random() * randomness) -bias));
mv[1] = mv[1] + (Math.floor((Math.random() * randomness) -bias));
}
}
}