1
mirror of https://git.videolan.org/git/ffmpeg.git synced 2024-09-16 11:54:09 +02:00
Commit Graph

21 Commits

Author SHA1 Message Date
Mans Rullgard
783da0d696 g723.1: make autocorr_max() work on an arbitrary buffer
Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-08-13 01:03:25 +01:00
Mans Rullgard
3716105103 g723.1: do not needlessly use int64_t
Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-08-13 01:03:25 +01:00
Mans Rullgard
47c73a73b0 g723.1: use saturating addition functions
Use saturating addition functions instead of 64-bit intermediates
and separate clipping.  This is much faster when dedicated
instructions are available.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-08-13 01:03:25 +01:00
Mans Rullgard
4aca716a53 g723.1: optimise scale_vector()
Firstly, nothing in this function can overflow 32 bits so the use
of a 64-bit type is completely unnecessary.  Secondly, the scale
is either a power of two or 0x7fff.  Doing separate loops for these
cases avoids using multiplications.  Finally, since only the number
of bits, not the actual value, of the maximum value is needed, the
bitwise or of all the values serves the purpose while being faster.

It is worth noting that even if overflow could happen, it was not
handled correctly anyway.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-08-13 01:03:25 +01:00
Mans Rullgard
1eb1f6f281 g723.1: remove useless uses of MUL64()
The operands in both cases are 16-bit so cannot overflow a 32-bit
destination.  In gain_scale() the inputs are reduced to 14-bit,
so even the shift cannot overflow.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-08-13 01:03:25 +01:00
Mans Rullgard
5a43eba956 g723.1: remove unnecessary argument 'shift' from dot_product()
The 'shift' argument is always 1 so there is no need to pass it
explicitly in every call.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-08-13 01:03:25 +01:00
Mans Rullgard
8b0de73464 g723.1: deobfuscate "(x << 4) - x" to "15 * x"
The compiler performs this optimisation.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-08-13 01:03:25 +01:00
Mans Rullgard
05c36e0e5f g723.1: fix addition overflow
This addition must be done as 64-bit to avoid overflow and for
the subsequent clipping to be meaningful.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-08-10 12:18:38 +01:00
Mans Rullgard
52aa3015a3 g723.1: simplify and fix multiplication overflow
In 16-bit arithmetic, x * 0xffffc is simply x * -4 with extra overflows,
(and the constant was probably meant to be 0xfffc).  Combined with the
shift, this simplifies to -x >> 1.  Finally, clearing the low two bits
with a 32-bit mask and switching to a 32-bit type allows more efficient
code on 32-bit machines.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-08-10 12:18:38 +01:00
Mans Rullgard
e141cf2c57 g723.1: deobfuscate an expression
(x << 2) - x is just an optimisation of 3 * x the compiler is
perfectly capable of doing on its own.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-08-10 12:18:38 +01:00
Mans Rullgard
e2b7c5783d g723.1: remove unused #includes
Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-08-10 12:18:38 +01:00
Kostya Shishkov
e78e6c37ef g723_1: clip argument for 15-bit version of normalize_bits()
It expects maximum value to be 32767 but calculations in scale_vector()
which uses this function can give it ABS(-32768) which leads to wrong
result and thus clipping is needed.
2012-08-08 13:24:19 +02:00
Kostya Shishkov
f86b2f3661 g723_1: use all LPC vectors in formant postfilter
Due to some mistake LPC vector for the first subframe was used for all
subframes instead of their own LPC vectors.
2012-08-08 13:23:22 +02:00
Anton Khirnov
36ef5369ee Replace all CODEC_ID_* with AV_CODEC_ID_* 2012-08-07 16:00:24 +02:00
Kostya Shishkov
d3e0766fc0 g723_1: scale output as supposed for the case with postfilter disabled 2012-08-03 07:07:07 +02:00
Kostya Shishkov
94bfdfd6f0 g723_1: increase excitation storage by 4
Fixed codebook mode in 5300 rate may write up to SUBFRAME_LEN + 4 and
that is considered normal by the reference decoder. Without that additional
padding it might overwrite first elements of LPC history.
2012-08-03 07:07:07 +02:00
Kostya Shishkov
802bcdcb2f g723_1: fix upper bound parameter from inverse maximum autocorrelation 2012-08-03 07:07:07 +02:00
Kostya Shishkov
8ddadea171 g723_1: make scale_vector() behave like the reference 2012-08-03 07:07:07 +02:00
Kostya Shishkov
8772d2511a g723_1: fix off-by-one error in normalize_bits() 2012-08-03 07:07:07 +02:00
Kostya Shishkov
7f92db14f9 g723_1: save/restore excitation with offset to store LPC history
The same buffer with saved data is used later in LPC reconstruction, so
it should have some head space for LPC history.
2012-08-03 07:07:06 +02:00
Mohamed Naufal Basheer
55c3a4f617 G.723.1 demuxer and decoder
Signed-off-by: Kostya Shishkov <kostya.shishkov@gmail.com>
2012-07-22 07:58:54 +02:00