[FFmpeg-devel] [PATCH 3/3] aaccoder: Improve IS phase rejection
Rostislav Pehlivanov
atomnuker at gmail.com
Fri Jul 17 23:20:15 CEST 2015
This commit adds a slightly more robust way of determining whether the phases
match or are too different for IS to be used.
---
libavcodec/aaccoder.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c
index 17b14d6..bd232f6 100644
--- a/libavcodec/aaccoder.c
+++ b/libavcodec/aaccoder.c
@@ -56,6 +56,9 @@
/** Frequency in Hz for lower limit of intensity stereo **/
#define INT_STEREO_LOW_LIMIT 6100
+/** If less than this fraction of coeff phases agree disable IS for that band **/
+#define IS_PHASE_DIFF_LIM 0.11
+
/** Total number of usable codebooks **/
#define CB_TOT 12
@@ -1218,9 +1221,9 @@ static void search_for_is(AACEncContext *s, AVCodecContext *avctx, ChannelElemen
ener01 += (coef0 + coef1)*(coef0 + coef1);
}
}
- if (!phase) { /* Too much phase difference between channels */
+ if (fabs(phase)/(sce0->ics.group_len[w]*sce0->ics.swb_sizes[g]) < IS_PHASE_DIFF_LIM) {
start += sce0->ics.swb_sizes[g];
- continue;
+ continue; /* Too much phase difference */
}
phase = av_clip(phase, -1, 1);
for (w2 = 0; w2 < sce0->ics.group_len[w]; w2++) {
--
2.4.3.573.g4eafbef
More information about the ffmpeg-devel
mailing list