diff options
author | XhmikosR <xhmikosr@users.sourceforge.net> | 2010-04-09 18:12:59 +0400 |
---|---|---|
committer | XhmikosR <xhmikosr@users.sourceforge.net> | 2010-04-09 18:12:59 +0400 |
commit | efbc9d9043ff8ff92716ddd00a5f61412d535593 (patch) | |
tree | 8f3e621f756cf1f5b4d64d97964c7e7abd8aaf08 /src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3_parser.c | |
parent | df6b139a6d9027156f614b68687e039e3a5854db (diff) |
revert r1783
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@1785 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3_parser.c')
-rw-r--r-- | src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3_parser.c | 62 |
1 files changed, 22 insertions, 40 deletions
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3_parser.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3_parser.c index edef35a54..6331b64da 100644 --- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3_parser.c +++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3_parser.c @@ -29,8 +29,7 @@ #define AC3_HEADER_SIZE 7
-static const uint8_t eac3_blocks[4] =
-{
+static const uint8_t eac3_blocks[4] = {
1, 2, 3, 6
};
@@ -56,8 +55,7 @@ int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr) hdr->center_mix_level = 1; // -4.5dB
hdr->surround_mix_level = 1; // -6.0dB
- if(hdr->bitstream_id <= 10)
- {
+ if(hdr->bitstream_id <= 10) {
/* Normal AC-3 */
hdr->crc1 = get_bits(gbc, 16);
hdr->sr_code = get_bits(gbc, 2);
@@ -73,12 +71,9 @@ int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr) skip_bits(gbc, 3); // skip bitstream mode
hdr->channel_mode = get_bits(gbc, 3);
- if(hdr->channel_mode == AC3_CHMODE_STEREO)
- {
+ if(hdr->channel_mode == AC3_CHMODE_STEREO) {
skip_bits(gbc, 2); // skip dsurmod
- }
- else
- {
+ } else {
if((hdr->channel_mode & 1) && hdr->channel_mode != AC3_CHMODE_MONO)
hdr->center_mix_level = get_bits(gbc, 2);
if(hdr->channel_mode & 4)
@@ -93,9 +88,7 @@ int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr) hdr->frame_size = ff_ac3_frame_size_tab[frame_size_code][hdr->sr_code] * 2;
hdr->frame_type = EAC3_FRAME_TYPE_AC3_CONVERT; //EAC3_FRAME_TYPE_INDEPENDENT;
hdr->substreamid = 0;
- }
- else
- {
+ } else {
/* Enhanced AC-3 */
hdr->crc1 = 0;
hdr->frame_type = get_bits(gbc, 2);
@@ -109,16 +102,13 @@ int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr) return AAC_AC3_PARSE_ERROR_FRAME_SIZE;
hdr->sr_code = get_bits(gbc, 2);
- if(hdr->sr_code == 3)
- {
+ if (hdr->sr_code == 3) {
int sr_code2 = get_bits(gbc, 2);
if(sr_code2 == 3)
return AAC_AC3_PARSE_ERROR_SAMPLE_RATE;
hdr->sample_rate = ff_ac3_sample_rate_tab[sr_code2] / 2;
hdr->sr_shift = 1;
- }
- else
- {
+ } else {
hdr->num_blocks = eac3_blocks[get_bits(gbc, 2)];
hdr->sample_rate = ff_ac3_sample_rate_tab[hdr->sr_code];
hdr->sr_shift = 0;
@@ -128,41 +118,35 @@ int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr) hdr->lfe_on = get_bits1(gbc);
hdr->bit_rate = (uint32_t)(8.0 * hdr->frame_size * hdr->sample_rate /
- (hdr->num_blocks * 256.0));
+ (hdr->num_blocks * 256.0));
hdr->channels = ff_ac3_channels_tab[hdr->channel_mode] + hdr->lfe_on;
}
hdr->channel_layout = ff_ac3_channel_layout_tab[hdr->channel_mode];
- if(hdr->lfe_on)
+ if (hdr->lfe_on)
hdr->channel_layout |= CH_LOW_FREQUENCY;
return 0;
}
-int ff_ac3_parse_header_full(GetBitContext *gbc, AC3HeaderInfo *hdr)
-{
+int ff_ac3_parse_header_full(GetBitContext *gbc, AC3HeaderInfo *hdr){
int ret, i;
ret = ff_ac3_parse_header(gbc, hdr);
- if(!ret)
- {
- if(hdr->bitstream_id > 10)
- {
+ if(!ret){
+ if(hdr->bitstream_id>10){
/* Enhanced AC-3 */
skip_bits(gbc, 5); // skip bitstream id
/* skip dialog normalization and compression gain */
- for(i = 0; i < (hdr->channel_mode ? 1 : 2); i++)
- {
+ for (i = 0; i < (hdr->channel_mode ? 1 : 2); i++) {
skip_bits(gbc, 5); // skip dialog normalization
- if(get_bits1(gbc))
- {
+ if (get_bits1(gbc)) {
skip_bits(gbc, 8); //skip Compression gain word
}
}
/* dependent stream channel map */
- if(hdr->frame_type == EAC3_FRAME_TYPE_DEPENDENT && get_bits1(gbc))
- {
- hdr->channel_map = get_bits(gbc, 16); //custom channel map
- return 0;
+ if (hdr->frame_type == EAC3_FRAME_TYPE_DEPENDENT && get_bits1(gbc)) {
+ hdr->channel_map = get_bits(gbc, 16); //custom channel map
+ return 0;
}
}
//default channel map based on acmod and lfeon
@@ -174,18 +158,17 @@ int ff_ac3_parse_header_full(GetBitContext *gbc, AC3HeaderInfo *hdr) }
static int ac3_sync(uint64_t state, AACAC3ParseContext *hdr_info,
- int *need_next_header, int *new_frame_start)
+ int *need_next_header, int *new_frame_start)
{
int err;
- union
- {
+ union {
uint64_t u64;
uint8_t u8[8];
} tmp = { be2me_64(state) };
AC3HeaderInfo hdr;
GetBitContext gbc;
- init_get_bits(&gbc, tmp.u8 + 8 - AC3_HEADER_SIZE, 54);
+ init_get_bits(&gbc, tmp.u8+8-AC3_HEADER_SIZE, 54);
err = ff_ac3_parse_header(&gbc, &hdr);
if(err < 0)
@@ -196,7 +179,7 @@ static int ac3_sync(uint64_t state, AACAC3ParseContext *hdr_info, hdr_info->channels = hdr.channels;
hdr_info->channel_layout = hdr.channel_layout;
hdr_info->samples = hdr.num_blocks * 256;
- if(hdr.bitstream_id > 10)
+ if(hdr.bitstream_id>10)
hdr_info->codec_id = CODEC_ID_EAC3;
else
hdr_info->codec_id = CODEC_ID_AC3;
@@ -215,8 +198,7 @@ static av_cold int ac3_parse_init(AVCodecParserContext *s1) }
-AVCodecParser ac3_parser =
-{
+AVCodecParser ac3_parser = {
{ CODEC_ID_AC3, CODEC_ID_EAC3 },
sizeof(AACAC3ParseContext),
ac3_parse_init,
|