summaryrefslogtreecommitdiff
path: root/libavcodec/aacenc_is.h
diff options
context:
space:
mode:
authorRostislav Pehlivanov <atomnuker@gmail.com>2015-08-21 19:13:26 +0100
committerRostislav Pehlivanov <atomnuker@gmail.com>2015-08-21 19:13:26 +0100
commitd1ca7142ac93e713dce5654476b7b91b00ebbef2 (patch)
tree67bca8615f5b20f6c32c2cd3bd994c709a20c23d /libavcodec/aacenc_is.h
parent860dbe0275e57cbf4228f3f653f872ff66ca596b (diff)
aaccoder: move the Intensity Stereo implementation out
This commit moves the intensity stereo implementation out from aaccoder and into a separate file. This was possible using the previous commits. This commit also drastically improves the IS implementation by making it phase invariant e.g. it will always choose the best possible phase regardless of whether M/S coding is on or most of the coefficients have identical phases. This also increases the quality and reduces any distortions introduced by enablind intensity stereo. Users are encouraged to test it out using the -aac_is 1 parameter as it has always been. Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
Diffstat (limited to 'libavcodec/aacenc_is.h')
-rw-r--r--libavcodec/aacenc_is.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/libavcodec/aacenc_is.h b/libavcodec/aacenc_is.h
new file mode 100644
index 0000000000..abb9b32daf
--- /dev/null
+++ b/libavcodec/aacenc_is.h
@@ -0,0 +1,47 @@
+/*
+ * AAC encoder intensity stereo
+ * Copyright (C) 2015 Rostislav Pehlivanov
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @file
+ * AAC encoder Intensity Stereo
+ * @author Rostislav Pehlivanov ( atomnuker gmail com )
+ */
+
+#ifndef AVCODEC_AACENC_INTENSITY_STEREO_H
+#define AVCODEC_AACENC_INTENSITY_STEREO_H
+
+/** Frequency in Hz for lower limit of intensity stereo **/
+#define INT_STEREO_LOW_LIMIT 6100
+
+struct is_error {
+ int pass; /* 1 if dist2 <= dist1 */
+ int phase; /* -1 or +1 */
+ float error; /* fabs(dist1 - dist2) */
+ float dist1; /* From original coeffs */
+ float dist2; /* From IS'd coeffs */
+};
+
+struct is_error calc_is_encoding_err(AACEncContext *s, ChannelElement *cpe,
+ int start, int g, int w, float ener0,
+ float ener1, float ener01, int phase);
+void search_for_is(AACEncContext *s, AVCodecContext *avctx, ChannelElement *cpe);
+
+#endif /* AVCODEC_AACENC_INTENSITY_STEREO_H */