[FFmpeg-cvslog] aacenc: Adjust the initial offset for PNS values
Rostislav Pehlivanov
git at videolan.org
Tue Apr 14 03:48:50 CEST 2015
ffmpeg | branch: master | Rostislav Pehlivanov <atomnuker at gmail.com> | Tue Apr 14 00:33:51 2015 +0100| [013498ba15ae15e7cd0353dec97fe92ddc8dbdfc] | committer: Michael Niedermayer
aacenc: Adjust the initial offset for PNS values
This commit adjusts the intial offset for PNS values, introduced
with commit f7f71b5795d708763eb0c55fe5e2cb051b2b69f4 earlier. This
commit shifts the value in such a way that no further offsets are
required in the aaccoder.c file. Earlier version of the PNS patch had 2 offsets in both the aaccoder and aacenc.
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=013498ba15ae15e7cd0353dec97fe92ddc8dbdfc
---
libavcodec/aac.h | 1 +
libavcodec/aacenc.c | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/libavcodec/aac.h b/libavcodec/aac.h
index 2701386..23ec085 100644
--- a/libavcodec/aac.h
+++ b/libavcodec/aac.h
@@ -143,6 +143,7 @@ typedef struct PredictorState {
#define NOISE_PRE 256 ///< preamble for NOISE_BT, put in bitstream with the first noise band
#define NOISE_PRE_BITS 9 ///< length of preamble
+#define NOISE_OFFSET 90 ///< subtracted from global gain, used as offset for the preamble
/**
* Long Term Prediction
diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
index 5288afb..7f6f4b9 100644
--- a/libavcodec/aacenc.c
+++ b/libavcodec/aacenc.c
@@ -388,7 +388,7 @@ static void encode_band_info(AACEncContext *s, SingleChannelElement *sce)
static void encode_scale_factors(AVCodecContext *avctx, AACEncContext *s,
SingleChannelElement *sce)
{
- int diff, off_sf = sce->sf_idx[0], off_pns = sce->sf_idx[0];
+ int diff, off_sf = sce->sf_idx[0], off_pns = sce->sf_idx[0] - NOISE_OFFSET;
int noise_flag = 1;
int i, w;
More information about the ffmpeg-cvslog
mailing list