On 11.03.2016, at 19:09, Lou Logan <l...@lrcd.com> wrote:
> On Thu, Mar 10, 2016, at 05:42 PM, Ganesh Ajjanagadde wrote:
>> ffmpeg | branch: master | Ganesh Ajjanagadde <gajja...@gmail.com> | Tue
>> Mar  8 22:08:29 2016 -0500| [66edd8656b851a0c85ba25ec293cc66192c363ae] |
>> committer: Ganesh Ajjanagadde
>> 
>> lavc/lpc: exploit even symmetry of window function
> 
> kamedo2 has a comment about this on Twitter, although I can't quite
> understand the translation:
> 
> <https://twitter.com/kamedo2/status/708313239482806272>

Not sure, but if I guess:
i <= len / 2 loop condition does one step too many if len is even.

It is also possible to build a cos table with only one sin and cos.
Depending on precision requirements only using
cos[n] = cos[n/2]*cos[(n+1)/2]-sin[n/2]*sin[(n+1)/2]
sin[n] = sin[n/2]*cos[(n+1)/2]+cos[n/2]*sin[(n+1)/2]

I don't know what the speed or the maximum error of that would be though. The 
number of operations and thus rounding errors that go into a single value is 
limited by O(log2(len)) though, so it's likely if you use double precision 
everywhere the result would not be (much) worse off than cosf.
The cos formula can for even n possibly optimize precision by doing 
2*cos[n/2]*cos[n/2]-1.
No guarentee I made no mistakes, but I think the idea is sound.
If it's worth the effort is a separate question though.
_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

Reply via email to