[FFmpeg-devel] [PATCH] opus_pvq_search.asm: Handle zero vector input differently.
Ivan Kalvachev
ikalvachev at gmail.com
Fri Aug 25 18:38:29 EEST 2017
Instead of returning all zeroes as result and Syy=1.0,
place all the K pulses in the first element y[0]
and return Syy=K*K.
This is how the original opus function handles the case.
This is how the existing pvq_search_c handles the case.
Also, according to Rostislav, the encoded all zeros vector
would be decoded as such y[0]=K vector, before dequantization.
So it is better to do that explicitly and calculate
the proper gain in the encoder.
--
I must point out that ppp_pvq_search_c() does generate
y[0]=-K vector, not +K.
This is because FFSIGN(0.0) returns -1.
I do consider this bug, however I'm not quite sure what
is the best way to handle it.
1. Fix localy
#undef FFSIGN
#define FFSIGN(a) ((a) >= 0 ? 1 : -1)
2. Use different name for that macro
#define OPUS_SIGN(a) ...
3. Fix by special case in ppp_pvq_search_c():
if( !(res > 0.0) ) { y[0]=K; for(i=1;i<N;i++) y[i]=0; return K*K; }
4. Fix FFSIGN globally.
That might have some side effects in addition of changing public API.
Best Regards
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-opus_pvq_search.asm-Handle-zero-vector-input-differe.patch
Type: text/x-patch
Size: 1789 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20170825/0a516f99/attachment.bin>
More information about the ffmpeg-devel
mailing list