FFmpeg git repo
Go to file
Rostislav Pehlivanov c5d4f87e81 aaccoder: Implement Perceptual Noise Substitution for AAC
This commit implements the perceptual noise substitution AAC extension. This is a proof of concept
implementation, and as such, is not enabled by default. This is the fourth revision of this patch,
made after some problems were noted out. Any changes made since the previous revisions have been indicated.

In order to extend the encoder to use an additional codebook, the array holding each codebook has been
modified with two additional entries - 13 for the NOISE_BT codebook and 12 which has a placeholder function.
The cost system was modified to skip the 12th entry using an array to map the input and outputs it has. It
also does not accept using the 13th codebook for any band which is not marked as containing noise, thereby
restricting its ability to arbitrarily choose it for bands. The use of arrays allows the system to be easily
extended to allow for intensity stereo encoding, which uses additional codebooks.

The 12th entry in the codebook function array points to a function which stops the execution of the program
by calling an assert with an always 'false' argument. It was pointed out in an email discussion with
Claudio Freire that having a 'NULL' entry can result in unexpected behaviour and could be used as
a security hole. There is no danger of this function being called during encoding due to the codebook maps introduced.

Another change from version 1 of the patch is the addition of an argument to the encoder, '-aac_pns' to
enable and disable the PNS. This currently defaults to disable the PNS, as it is experimental.
The switch will be removed in the future, when the algorithm to select noise bands has been improved.
The current algorithm simply compares the energy to the threshold (multiplied by a constant) to determine
noise, however the FFPsyBand structure contains other useful figures to determine which bands carry noise more accurately.

Some of the sample files provided triggered an assertion when the parameter to tune the threshold was set to
a value of '2.2'. Claudio Freire reported the problem's source could be in the range of the scalefactor
indices for noise and advised to measure the minimal index and clip anything above the maximum allowed
value. This has been implemented and all the files which used to trigger the asserion now encode without error.

The third revision of the problem also removes unneded variabes and comparisons. All of them were
redundant and were of little use for when the PNS implementation would be extended.

The fourth revision moved the clipping of the noise scalefactors outside the second loop of the two-loop
algorithm in order to prevent their redundant calculations. Also, freq_mult has been changed to a float
variable due to the fact that rounding errors can prove to be a problem at low frequencies.
Considerations were taken whether the entire expression could be evaluated inside the expression
, but in the end it was decided that it would be for the best if just the type of the variable were
to change. Claudio Freire reported the two problems. There is no change of functionality
(except for low sampling frequencies) so the spectral demonstrations at the end of this commit's message were not updated.

Finally, the way energy values are converted to scalefactor indices has changed since the first commit,
as per the suggestion of Claudio Freire. This may still have some drawbacks, but unlike the first commit
it works without having redundant offsets and outputs what the decoder expects to have, in terms of the
ranges of the scalefactor indices.

Some spectral comparisons: https://trac.ffmpeg.org/attachment/wiki/Encode/AAC/Original.png (original),
https://trac.ffmpeg.org/attachment/wiki/Encode/AAC/PNS_NO.png (encoded without PNS),
https://trac.ffmpeg.org/attachment/wiki/Encode/AAC/PNS1.2.png (encoded with PNS, const = 1.2),
https://trac.ffmpeg.org/attachment/wiki/Encode/AAC/Difference1.png (spectral difference).
The constant is the value which multiplies the threshold when it gets compared to the energy, larger
values means more noise will be substituded by PNS values. Example when const = 2.2:
https://trac.ffmpeg.org/attachment/wiki/Encode/AAC/PNS_2.2.png

Reviewed-by: Claudio Freire <klaussfreire@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-15 19:59:44 +02:00
compat avisynth: drop support of AviSynth 2.5 2015-03-25 20:37:26 +01:00
doc avisynth: Bump minimum required version to interface version 6 2015-04-14 13:53:04 +02:00
libavcodec aaccoder: Implement Perceptual Noise Substitution for AAC 2015-04-15 19:59:44 +02:00
libavdevice Merge commit '4f373a5111f900af54301907132942f95276285c' 2015-04-11 02:19:32 +02:00
libavfilter avfilter/drawtext: fix frame mem leak 2015-04-14 12:04:52 +02:00
libavformat avformat/mp3dec: offset seek index to end of vbr headers 2015-04-15 13:25:08 +02:00
libavresample Merge commit '12655c48049f9a52e5504bde90fe738862b0ff08' 2015-02-22 00:06:23 +01:00
libavutil libavutil/softfloat: Change order of fields in SoftFloat structure. 2015-04-15 18:53:55 +02:00
libpostproc postproc: Removed unecessary if/else branch when getting QP. 2015-03-28 01:49:12 +01:00
libswresample swresample/swresample-test: Randomly wipe out channel counts 2015-04-12 22:21:53 +02:00
libswscale swscale/output: Fix undefined shifts 2015-03-25 18:31:25 +01:00
presets
tests fate: add tta encoder test 2015-04-13 11:33:02 +02:00
tools tools/sidxindex: Use av_*malloc_array() 2015-04-01 17:43:25 +02:00
.gitattributes Treat all '*.pnm' files as non-text file 2014-11-28 17:52:43 -05:00
.gitignore doc/examples: add directory listing example 2015-03-28 03:13:44 +01:00
COPYING.GPLv2
COPYING.GPLv3
COPYING.LGPLv2.1
COPYING.LGPLv3
CREDITS
Changelog avfilter: add chorus filter 2015-04-11 20:39:43 +00:00
INSTALL.md
LICENSE.md LICENSE.md: Formatting updates 2015-02-12 01:53:56 +01:00
MAINTAINERS MAINTAINERS: Add Lou Logan as server admin as he is root too 2015-04-06 20:24:05 +02:00
Makefile configure, mips: remove MIPS32R2, merging it with MIPSFPU 2015-03-06 14:01:31 +01:00
README.md README: add ffserver 2015-02-12 11:59:22 +01:00
RELEASE RELEASE: update to 2.6.git 2015-03-08 18:59:57 -03:00
arch.mak configure, mips: remove MIPS32R2, merging it with MIPSFPU 2015-03-06 14:01:31 +01:00
cmdutils.c cmdutils: fix "Commmand" typo 2015-04-03 10:43:21 -08:00
cmdutils.h opts: add list device sources/sinks options 2014-10-25 20:20:31 +02:00
cmdutils_common_opts.h opts: add list device sources/sinks options 2014-10-25 20:20:31 +02:00
cmdutils_opencl.c
common.mak x86: Makefile: fix DBG parameter evaluation 2015-03-11 01:54:07 +01:00
configure configure: add missing h263p decoder dependencies 2015-04-12 15:48:55 -03:00
ffmpeg.c Merge commit '3892bdab9b652eb003ab95e167f1765e0b0ea035' 2015-04-04 00:38:02 +02:00
ffmpeg.h ffmpeg: last frame duplication heuristic 2015-04-03 19:09:31 +02:00
ffmpeg_dxva2.c ffmpeg_dxva2: add hevc support 2015-01-27 12:37:34 +01:00
ffmpeg_filter.c ffmpeg: fix accurate seeking with -copyts 2014-11-24 17:31:26 +01:00
ffmpeg_opt.c Merge commit '3892bdab9b652eb003ab95e167f1765e0b0ea035' 2015-04-04 00:38:02 +02:00
ffmpeg_vda.c vda: Cast to not discard constant qualifier and silence compiler warning 2015-04-09 01:23:33 +02:00
ffmpeg_vdpau.c Merge commit '1f9237f2ac46dfbed1bfa1f4f0f1314c2a1d62ec' 2014-12-27 13:26:38 +01:00
ffplay.c Merge commit 'd450cb07d91ef39ad1d39bd7ca0cfce4bd7b13e7' 2015-03-22 03:51:49 +01:00
ffprobe.c Merge commit '7b9cb7b36543c2a0e46d99b0e41824b9e7dd0c8f' 2015-03-08 23:58:18 +01:00
ffserver.c ffserver: remove stale debug stanza 2015-03-08 18:24:56 -03:00
ffserver_config.c ffserver_config: reflow add_codec() 2014-12-09 01:03:01 -03:00
ffserver_config.h ffserver: dont leak child arguments 2014-11-26 23:32:33 +01:00
library.mak x86/doc/Makefile: DBG=1 to preprocess external asm 2015-02-17 13:08:04 +01:00
version.sh

README.md

FFmpeg README

FFmpeg is a collection of libraries and tools to process multimedia content such as audio, video, subtitles and related metadata.

Libraries

  • libavcodec provides implementation of a wider range of codecs.
  • libavformat implements streaming protocols, container formats and basic I/O access.
  • libavutil includes hashers, decompressors and miscellaneous utility functions.
  • libavfilter provides a mean to alter decoded Audio and Video through chain of filters.
  • libavdevice provides an abstraction to access capture and playback devices.
  • libswresample implements audio mixing and resampling routines.
  • libswscale implements color conversion and scaling routines.

Tools

  • ffmpeg is a command line toolbox to manipulate, convert and stream multimedia content.
  • ffplay is a minimalistic multimedia player.
  • ffprobe is a simple analysis tool to inspect multimedia content.
  • ffserver is a multimedia streaming server for live broadcasts.
  • Additional small tools such as aviocat, ismindex and qt-faststart.

Documentation

The offline documentation is available in the doc/ directory.

The online documentation is available in the main website and in the wiki.

Examples

Coding examples are available in the doc/examples directory.

License

FFmpeg codebase is mainly LGPL-licensed with optional components licensed under GPL. Please refer to the LICENSE file for detailed information.