[MPlayer-dev-eng] [PATCH] af_volnorm: make it work with float audio data
Giorgio Vazzana
mywing81 at gmail.com
Sat Dec 15 15:04:12 CET 2012
Hi,
MPlayer decodes some common audio formats in floatle, for example:
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 44100 Hz, 2 ch, floatle, 192.0 kbit/6.80% (ratio: 23999->352800)
Selected audio codec: [ffaac] afm: ffmpeg (FFmpeg AAC (MPEG-2/MPEG-4 Audio))
==========================================================================
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 44100 Hz, 2 ch, floatle, 0.0 kbit/0.00% (ratio: 0->352800)
Selected audio codec: [ffvorbis] afm: ffmpeg (FFmpeg Vorbis)
==========================================================================
but af_volnorm doesn't seem to work with float audio data.
The attached patch fixes this, assuming float samples are in the range
[-1.0f, 1.0f] (is there any codec that uses a different range?)
I have used it locally for about a month now, so I thought I'd send it upstream.
Other minor things I noticed looking at libaf/a_volnorm.c:
* the SIL_S16 and SIL_FLOAT constants should probably be lowered by a
factor of 5, from (MAX*0.01) to (MAX*0.002), to avoid the 'step'
effect that is present when a video starts with a very quiet audio
track
* there is a mixture of double constants and float variables,
converting all the constants to float might speed things up
* some formulae, for example the ones used to compute s->mul, can be simplified
* some code is duplicated, for example the part that computes the rms
value of a audio chunk; a macro could be used
* method*_int16 could use a lrintf() in the scale loop
Regards,
Giorgio Vazzana
-------------- next part --------------
A non-text attachment was scrubbed...
Name: af_volnorm_float.patch
Type: application/octet-stream
Size: 1113 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20121215/25b711d8/attachment.obj>
More information about the MPlayer-dev-eng
mailing list