On Thu, Jan 14, 2016 at 01:41:51AM +0300, Andrey Turkin wrote: > 2016-01-13 22:32 GMT+03:00 Michael Niedermayer <mich...@niedermayer.cc>: > > > to calculate the phase > > > > the area that has alternating 0/1 values can be correlated with a > > sin() and a cos(), if you consider the 2 resulting values as x and y > > coordinates the angle they form from the origin is the phase. > > (this can be worded simpler using complex numbers) > > > > when above is done its essential that a whole multiple of cycles is > > used the important part is that the used sin(x) and cos(x) vectors are > > orthogonal, that is sum sin(x) * cos(x) over the x values considered is > > 0 cutting them off randomls would break that > > (its also possible to use windowing instead of a exact multiple of cycles) > > > > consider that the phase is 0 so our signal input is exactly > > cos(x) (if we define that as 0°), the dot product of that with cos(x) > > is "1" and sin(x) is 0 > > now if our input is shifted by 90deg that is it matches sin(x) > > then the dot product with a cos(x) vector is 0 and sin(x) is 1 > > ... > > (also i for simpliity normalized the values, sum of cos(x)*cos(x) for > > x from 0 to n would of course be larger than 1 for a larger n) > > > > That should work; I wonder about runtime cost though. sin/cos for a given > frequency can be precomputated; atan2 can be turned to table or something. > Still there'd be about 32 multiplications to get a phase (over 4 periods). > That's more than 25000 multiplications per second per teletext standard.
25000 operations per second is not much, copying the images takes orders of magnitude more [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The bravest are surely those who have the clearest vision of what is before them, glory and danger alike, and yet notwithstanding go out to meet it. -- Thucydides
signature.asc
Description: Digital signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel