# [FFmpeg-devel] [PATCH] lavfi: phasescope filter

Stefano Sabatini stefasab at gmail.com
Sat Mar 30 01:23:10 CET 2013

```On date Thursday 2013-03-28 23:46:38 +0100, Stefano Sabatini encoded:
> On date Monday 2013-03-25 22:23:51 +0000, Paul B Mahol encoded:
> > +    for (i = 0; i < nb_samples; i++) {
> > +        int x, y;
>
> > +        for (chan = 0; chan < 2; chan++, ptr += 2) {
> > +            x = ((ptr[1] - (int)ptr[0]) / (float)UINT16_MAX + 1) * hw;
> > +            y = ((ptr[0] + (int)ptr[1]) / (float)UINT16_MAX + 1) * hh;
> > +            dst = &p->outpicref->data[0][y * linesize + x];
>
> Can you explain the mathematical principle, or provide a link for it?

well, not really needed, there is nothing to explain.

A small gallery:
ffplay -f lavfi "aevalsrc=cos(2*PI*t*200):cos(2*PI*t*201),asplit[out0],phasescope=s=300x300:r=30:dissolve=10,boxblur=2:2,negate[out1]"
ffplay -f lavfi "aevalsrc=cos(2*PI*t*200):sin(2*PI*t/10)*sin(2*PI*t*400+2*PI*sin(2*PI*t/20)),asplit[out0],phasescope=s=300x300:r=30:dissolve=10[out1]"
ffplay -f lavfi "aevalsrc=cos(2*PI*t*200):sin(2*PI*t/10)*sin(2*PI*t*400+2*PI*sin(2*PI*t/20) + 13*cos(2*PI*t/13)),asplit[out0],phasescope=s=300x300:r=30:dissolve=10[out1]"

What I can't understand:
ffplay -f lavfi "aevalsrc=cos(2*PI*t*200):cos(2*PI*t*200),asplit[out0],phasescope=s=300x300:r=30:dissolve=10[out1]"

In this case we have:
ptr[1] - ptr[0] = 0

and thus x = 0, so I'd expect a single vertical line. What am I
missing?

[...]
--
FFmpeg = Fantastic & Faithful Mega Ponderous Efficient Game
```