FFmpeg/libavcodec/aacenc_tns.h
Rostislav Pehlivanov a1c487e921 aacenc_tns: implement temporal noise shaping
This commit implements temporal noise shaping support in the
encoder, along with an -aac_tns option to toggle it on or off
(off by default for now). TNS will increase audio quality
and reduce quantization noise by applying a multitap FIR filter
across allowed coefficients and transmit side information to the
decoder so it could create an inverse filter.

Users are encouraged to test the new functionality by enabling
-aac_tns 1 during encoding.

No major bugs are observable at this time so after a while if no
new problems appear and if the current implementation is deemed
of high enough quality and stability it will be enabled by default,
possibly at the same time the encoder has its experimental flag
removed and becomes the standard aac encoder in ffmpeg.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2015-08-21 19:27:38 +01:00

46 lines
1.4 KiB
C

/*
* AAC encoder TNS
* 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 temporal noise shaping
* @author Rostislav Pehlivanov ( atomnuker gmail com )
*/
#ifndef AVCODEC_AACENC_TNS_H
#define AVCODEC_AACENC_TNS_H
#include "aac.h"
/** Frequency in Hz for lower limit of TNS **/
#define TNS_LOW_LIMIT 2150
/** LPC settings */
#define TNS_MIN_PRED_ORDER 0
#define MAX_LPC_PRECISION 4 /* 4 bits ltp coeff precision */
#define TNS_LPC_PASSES 2
#define MAX_LPC_SHIFT 4
void encode_tns_info(AACEncContext *s, SingleChannelElement *sce);
void search_for_tns(AACEncContext *s, SingleChannelElement *sce);
#endif /* AVCODEC_AACENC_TNS_H */