summaryrefslogtreecommitdiff
path: root/libavcodec/aacdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-01-10 02:50:54 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-01-10 03:50:41 +0100
commitdd3ca3ea15392da8636c06764e2da31e6ca700f0 (patch)
tree97d3fc3bdb9463a99728e14d3cd4a0062aa3af19 /libavcodec/aacdec.c
parent4805a33043e9356fc344aa53c7df747d41ce6b37 (diff)
parenta67b8c86d06eb5b78a0fe4cb9be4e93b29726db1 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: fate: Add tests for more AAC features. aacps: Add missing newline in error message. fate: Add tests for vc1/wmapro in ism. aacdec: Add a fate test for 5.1 channel SBR. aacdec: Turn off PS for multichannel files that use PCE based configs. cabac: remove put_cabac_u/ueg from cabac-test. swscale: RGB4444 and BGR444 input FATE: add test for xWMA demuxer. FATE: add test for SMJPEG demuxer and associated IMA ADPCM audio decoder. mpegaudiodec: optimized iMDCT transform mpegaudiodec: change imdct window arrangment for better pointer alignment mpegaudiodec: move imdct and windowing function to mpegaudiodsp mpegaudiodec: interleave iMDCT buffer to simplify future SIMD implementations swscale: convert yuy2/uyvy/nv12/nv21ToY/UV from inline asm to yasm. FATE: test to exercise WTV demuxer. mjpegdec: K&R formatting cosmetics swscale: K&R formatting cosmetics for code examples swscale: K&R reformatting cosmetics for header files FATE test: cvid-grayscale; ensures that the grayscale Cinepak variant is exercised. Conflicts: libavcodec/cabac.c libavcodec/mjpegdec.c libavcodec/mpegaudiodec.c libavcodec/mpegaudiodsp.c libavcodec/mpegaudiodsp.h libavcodec/mpegaudiodsp_template.c libavcodec/x86/Makefile libavcodec/x86/imdct36_sse.asm libavcodec/x86/mpegaudiodec_mmx.c libswscale/swscale-test.c libswscale/swscale.c libswscale/swscale_internal.h libswscale/x86/swscale_template.c tests/fate/demux.mak tests/fate/microsoft.mak tests/fate/video.mak tests/fate/wma.mak tests/ref/lavfi/pixfmts_scale Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/aacdec.c')
-rw-r--r--libavcodec/aacdec.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c
index c0798429af..b7f76a61da 100644
--- a/libavcodec/aacdec.c
+++ b/libavcodec/aacdec.c
@@ -163,6 +163,19 @@ static ChannelElement *get_che(AACContext *ac, int type, int elem_id)
}
}
+static int count_channels(enum ChannelPosition che_pos[4][MAX_ELEM_ID])
+{
+ int i, type, sum = 0;
+ for (i = 0; i < MAX_ELEM_ID; i++) {
+ for (type = 0; type < 4; type++) {
+ sum += (1 + (type == TYPE_CPE)) *
+ (che_pos[type][i] != AAC_CHANNEL_OFF &&
+ che_pos[type][i] != AAC_CHANNEL_CC);
+ }
+ }
+ return sum;
+}
+
/**
* Check for the channel element in the current channel position configuration.
* If it exists, make sure the appropriate element is allocated and map the
@@ -437,6 +450,12 @@ static int decode_ga_specific_config(AACContext *ac, AVCodecContext *avctx,
if ((ret = set_default_channel_config(avctx, new_che_pos, channel_config)))
return ret;
}
+
+ if (count_channels(new_che_pos) > 1) {
+ m4ac->ps = 0;
+ } else if (m4ac->sbr == 1 && m4ac->ps == -1)
+ m4ac->ps = 1;
+
if (ac && (ret = output_configure(ac, ac->che_pos, new_che_pos, channel_config, OC_GLOBAL_HDR)))
return ret;
@@ -495,8 +514,6 @@ static int decode_audio_specific_config(AACContext *ac,
av_log(avctx, AV_LOG_ERROR, "invalid sampling rate index %d\n", m4ac->sampling_index);
return -1;
}
- if (m4ac->sbr == 1 && m4ac->ps == -1)
- m4ac->ps = 1;
skip_bits_long(&gb, i);