diff options
author | Claudio Freire <klaussfreire@gmail.com> | 2015-07-20 22:53:24 -0300 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2015-07-27 19:13:48 +0200 |
commit | 59216e0525a58714be4207be6ae8744750e62867 (patch) | |
tree | 8c5b41b3471b08e17396c159001da6deff7ce347 /libavcodec/aac.h | |
parent | c8c86b8f9b8c166633a7324c8646f38866801b88 (diff) | |
download | ffmpeg-59216e0525a58714be4207be6ae8744750e62867.tar.gz |
AAC Encoder: clipping avoidance
Avoid clipping due to quantization noise to produce audible
artifacts, by detecting near-clipping signals and both attenuating
them a little and encoding escape-encoded bands (usually the
loudest) rounding towards zero instead of nearest, which tends to
decrease overall energy and thus clipping.
Currently fate tests measure numerical error so this change makes
tests using asynth (which are near clipping) report higher error
not less, because of window attenuation. Yet, they sound better,
not worse (albeit subtle, other samples aren't subtle at all).
Only measuring psychoacoustically weighted error would make for
a representative test, so that will be left for a future patch.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/aac.h')
-rw-r--r-- | libavcodec/aac.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/aac.h b/libavcodec/aac.h index d62455d1ec..3e3e479986 100644 --- a/libavcodec/aac.h +++ b/libavcodec/aac.h @@ -50,6 +50,8 @@ #define TNS_MAX_ORDER 20 #define MAX_LTP_LONG_SFB 40 +#define CLIP_AVOIDANCE_FACTOR 0.95f + enum RawDataBlockType { TYPE_SCE, TYPE_CPE, @@ -180,6 +182,8 @@ typedef struct IndividualChannelStream { int predictor_initialized; int predictor_reset_group; uint8_t prediction_used[41]; + uint8_t window_clipping[8]; ///< set if a certain window is near clipping + float clip_avoidance_factor; ///< set if any window is near clipping to the necessary atennuation factor to avoid it } IndividualChannelStream; /** |