mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-26 19:01:44 +02:00
44ddee945a
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>
48 lines
1.6 KiB
C
48 lines
1.6 KiB
C
/*
|
|
* 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 64
|
|
|
|
/* Raise to filter any low frequency artifacts due to prediction */
|
|
#define PRED_SFB_START 10
|
|
|
|
void ff_aac_apply_main_pred(AACEncContext *s, SingleChannelElement *sce);
|
|
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);
|
|
|
|
#endif /* AVCODEC_AACENC_PRED_H */
|