summaryrefslogtreecommitdiff
path: root/libavcodec/aacenc_pred.h
diff options
context:
space:
mode:
authorRostislav Pehlivanov <atomnuker@gmail.com>2015-08-21 19:38:05 +0100
committerRostislav Pehlivanov <atomnuker@gmail.com>2015-08-21 19:38:05 +0100
commit76b81b10d90732a6609522b7b152395ae2c049bb (patch)
tree9bcf7ab1758bd1e1d9d84dcebf3f218e20751ba6 /libavcodec/aacenc_pred.h
parenta1c487e9215c5685f0694ebde5bba07f4a07e95a (diff)
aacenc: implement the complete AAC-Main profile
This commit finalizes AAC-Main profile encoding support by implementing all mandatory and optional tools available in the specifications and current decoders. The AAC-Main profile reqires that prediction support be present (although decoders don't require it to be enabled) for an encoder to be deemed capable of AAC-Main encoding, as well as TNS, PNS and IS, all of which were implemented with previous commits or earlier of this year. Users are encouraged to test the new functionality using either -profile:a aac_main or -aac_pred 1, the former of which will enable the prediction option by default and the latter will change the profile to AAC-Main. No other options shall be changed by enabling either, it's currently up to the users to decide what's best. The current implementation works best using M/S and/or IS, so users are also welcome to enable both options and any other options (TNS, PNS) for maximum quality. Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
Diffstat (limited to 'libavcodec/aacenc_pred.h')
-rw-r--r--libavcodec/aacenc_pred.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/libavcodec/aacenc_pred.h b/libavcodec/aacenc_pred.h
new file mode 100644
index 0000000000..dc93c827fc
--- /dev/null
+++ b/libavcodec/aacenc_pred.h
@@ -0,0 +1,51 @@
+/*
+ * AAC encoder main-type prediction
+ * 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 main prediction
+ * @author Rostislav Pehlivanov ( atomnuker gmail com )
+ */
+
+#ifndef AVCODEC_AACENC_PRED_H
+#define AVCODEC_AACENC_PRED_H
+
+#include "aacenc.h"
+
+/* Every predictor group needs to get reset at least once in this many frames */
+#define PRED_RESET_FRAME_MIN 240
+
+/* Any frame with less than this amount of frames since last reset is ok */
+#define PRED_RESET_MIN 128
+
+/* Raise to filter any low frequency artifacts due to prediction */
+#define PRED_SFB_START 10
+
+/* Offset for the number of bits to encode normal coefficients */
+#define PRICE_OFFSET 440
+
+void apply_main_pred(AACEncContext *s, SingleChannelElement *sce);
+void update_main_pred(AACEncContext *s, SingleChannelElement *sce, ChannelElement *cpe);
+void adjust_common_prediction(AACEncContext *s, ChannelElement *cpe);
+void search_for_pred(AACEncContext *s, SingleChannelElement *sce);
+void encode_main_pred(AACEncContext *s, SingleChannelElement *sce);
+
+#endif /* AVCODEC_AACENC_PRED_H */