summaryrefslogtreecommitdiff
path: root/libavcodec/aacenc_pred.h
diff options
context:
space:
mode:
authorRostislav Pehlivanov <atomnuker@gmail.com>2015-08-29 06:34:08 +0100
committerRostislav Pehlivanov <atomnuker@gmail.com>2015-08-29 06:34:08 +0100
commit44ddee945a2e8cfc1b7074de6e35595ed41da4e4 (patch)
tree7c81a9f8243a3d2eb7a888c4ee995968f337de5e /libavcodec/aacenc_pred.h
parent949a4892fa1dd6da028229cb1674340542fc9bc4 (diff)
aacenc_pred: rework the way prediction is done
This commit completely alters the algorithm of prediction. The original commit which introduced prediction was completely incorrect to even remotely care about what the actual coefficients contain or whether any options were enabled. Not my actual fault. This commit treats prediction the way the decoder does and expects to do: like lossy encryption. Everything related to prediction now happens at the very end but just before quantization and encoding of coefficients. On the decoder side, prediction happens before anything has had a chance to even access the coefficients. Also the original implementation had problems because it actually touched the band_type of special bands which already had their scalefactor indices marked and it's a wonder the asserion wasn't triggered when transmitting those. Overall, this now drastically increases audio quality and you should think about enabling it if you don't plan on playing anything encoded on really old low power ultra-embedded devices since they might not support decoding of prediction or AAC-Main. Though the specifications were written ages ago and as times change so do the FLOPS. Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
Diffstat (limited to 'libavcodec/aacenc_pred.h')
-rw-r--r--libavcodec/aacenc_pred.h6
1 files changed, 1 insertions, 5 deletions
diff --git a/libavcodec/aacenc_pred.h b/libavcodec/aacenc_pred.h
index 0694c8a56c..999af869f5 100644
--- a/libavcodec/aacenc_pred.h
+++ b/libavcodec/aacenc_pred.h
@@ -34,16 +34,12 @@
#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
+#define PRED_RESET_MIN 64
/* 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 ff_aac_apply_main_pred(AACEncContext *s, SingleChannelElement *sce);
-void ff_aac_update_main_pred(AACEncContext *s, SingleChannelElement *sce, ChannelElement *cpe);
void ff_aac_adjust_common_prediction(AACEncContext *s, ChannelElement *cpe);
void ff_aac_search_for_pred(AACEncContext *s, SingleChannelElement *sce);
void ff_aac_encode_main_pred(AACEncContext *s, SingleChannelElement *sce);