summaryrefslogtreecommitdiff
path: root/libavcodec/aacenc.h
diff options
context:
space:
mode:
authorRostislav Pehlivanov <atomnuker@gmail.com>2015-07-02 19:13:07 +0100
committerMichael Niedermayer <michaelni@gmx.at>2015-07-05 16:59:26 +0200
commite8576dc8dfc9a3434c7585c451a87db86ca0d9ba (patch)
tree249a184b52305a9a4b23a388e4c6b2e84ce06f98 /libavcodec/aacenc.h
parent0b233900fa3691c85b5a91e1daa20d6d49524c32 (diff)
aacenc: implement Intensity Stereo encoding support
This commit implements intensity stereo coding support to the native aac encoder. This is a way to increase the efficiency of the encoder by zeroing the right channel's spectral coefficients (in a channel pair) and rederiving them in the decoder using information from the scalefactor indices of special band types. This commit confomrs to the official ISO 13818-7 specifications, although due to their ambiguity certain deviations have been taken to ensure maximum sound quality. This commit has been extensively tested and has shown to not result in audiable audio artifacts unless in extreme cases. This commit also adds an option, aac_is, which has the value of 0 by default. Intensity Stereo is part of the scalable aac profile and is thus non-default. The way IS coding works is that it rederives the right channel's spectral coefficients from the left channel via the scalefactor index values left in the right channel. Since an entire band's spectral coefficients do not need to be coded, the encoder's efficiency jumps up and it unzeroes some high frequency values which it previously did not have enough bits to encode. That way less information is lost than the information lost by rederiving the spectral coefficients with some error. This is why the filesize of files encoded with IS do not decrease significantly. Users wishing that IS coding should reduce filesize are expected to reduce their encoding bitrates appropriately. This is V2 of the commit. The old version did not mark ms_mask as 0 since M/S and IS coding are incompactible, which resulted in distortions with M/S coding enabled. This version also improves phase detection by measuring it for every spectral coefficient in the band and using a simple majority rule to determine whether the coefficients are in or out of phase. Also, the energy values per spectral coefficient were changed as to reflect the official specifications. Reviewed-by: Claudio Freire <klaussfreire@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/aacenc.h')
-rw-r--r--libavcodec/aacenc.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavcodec/aacenc.h b/libavcodec/aacenc.h
index 8ba58174a4..966c70889e 100644
--- a/libavcodec/aacenc.h
+++ b/libavcodec/aacenc.h
@@ -43,6 +43,7 @@ typedef struct AACEncOptions {
int stereo_mode;
int aac_coder;
int pns;
+ int intensity_stereo;
} AACEncOptions;
struct AACEncContext;
@@ -57,6 +58,7 @@ typedef struct AACCoefficientsEncoder {
void (*set_special_band_scalefactors)(struct AACEncContext *s, SingleChannelElement *sce);
void (*search_for_pns)(struct AACEncContext *s, AVCodecContext *avctx, SingleChannelElement *sce, const float lambda);
void (*search_for_ms)(struct AACEncContext *s, ChannelElement *cpe, const float lambda);
+ void (*search_for_is)(struct AACEncContext *s, AVCodecContext *avctx, ChannelElement *cpe, const float lambda);
} AACCoefficientsEncoder;
extern AACCoefficientsEncoder ff_aac_coders[];