comparison ac3_parser.c @ 6116:4f8fcb40bf2c libavcodec

remove unneeded variables from AC3HeaderInfo
author jbr
date Sat, 05 Jan 2008 17:04:57 +0000
parents 7d9dddd54817
children 01b1342e717b
comparison
equal deleted inserted replaced
6115:98be2e14e5d6 6116:4f8fcb40bf2c
35 35
36 36
37 int ff_ac3_parse_header(const uint8_t buf[7], AC3HeaderInfo *hdr) 37 int ff_ac3_parse_header(const uint8_t buf[7], AC3HeaderInfo *hdr)
38 { 38 {
39 GetBitContext gbc; 39 GetBitContext gbc;
40 int frame_size_code;
40 41
41 memset(hdr, 0, sizeof(*hdr)); 42 memset(hdr, 0, sizeof(*hdr));
42 43
43 init_get_bits(&gbc, buf, 54); 44 init_get_bits(&gbc, buf, 54);
44 45
54 hdr->crc1 = get_bits(&gbc, 16); 55 hdr->crc1 = get_bits(&gbc, 16);
55 hdr->sr_code = get_bits(&gbc, 2); 56 hdr->sr_code = get_bits(&gbc, 2);
56 if(hdr->sr_code == 3) 57 if(hdr->sr_code == 3)
57 return AC3_PARSE_ERROR_SAMPLE_RATE; 58 return AC3_PARSE_ERROR_SAMPLE_RATE;
58 59
59 hdr->frame_size_code = get_bits(&gbc, 6); 60 frame_size_code = get_bits(&gbc, 6);
60 if(hdr->frame_size_code > 37) 61 if(frame_size_code > 37)
61 return AC3_PARSE_ERROR_FRAME_SIZE; 62 return AC3_PARSE_ERROR_FRAME_SIZE;
62 63
63 skip_bits(&gbc, 5); // skip bsid, already got it 64 skip_bits(&gbc, 5); // skip bsid, already got it
64 65
65 hdr->bitstream_mode = get_bits(&gbc, 3); 66 skip_bits(&gbc, 3); // skip bitstream mode
66 hdr->channel_mode = get_bits(&gbc, 3); 67 hdr->channel_mode = get_bits(&gbc, 3);
67 if((hdr->channel_mode & 1) && hdr->channel_mode != AC3_CHMODE_MONO) { 68 if((hdr->channel_mode & 1) && hdr->channel_mode != AC3_CHMODE_MONO) {
68 hdr->center_mix_level = get_bits(&gbc, 2); 69 skip_bits(&gbc, 2); // skip center mix level
69 } 70 }
70 if(hdr->channel_mode & 4) { 71 if(hdr->channel_mode & 4) {
71 hdr->surround_mix_level = get_bits(&gbc, 2); 72 skip_bits(&gbc, 2); // skip surround mix level
72 } 73 }
73 if(hdr->channel_mode == AC3_CHMODE_STEREO) { 74 if(hdr->channel_mode == AC3_CHMODE_STEREO) {
74 hdr->dolby_surround_mode = get_bits(&gbc, 2); 75 skip_bits(&gbc, 2); // skip dolby surround mode
75 } 76 }
76 hdr->lfe_on = get_bits1(&gbc); 77 hdr->lfe_on = get_bits1(&gbc);
77 78
78 hdr->sr_shift = FFMAX(hdr->bitstream_id, 8) - 8; 79 hdr->sr_shift = FFMAX(hdr->bitstream_id, 8) - 8;
79 hdr->sample_rate = ff_ac3_sample_rate_tab[hdr->sr_code] >> hdr->sr_shift; 80 hdr->sample_rate = ff_ac3_sample_rate_tab[hdr->sr_code] >> hdr->sr_shift;
80 hdr->bit_rate = (ff_ac3_bitrate_tab[hdr->frame_size_code>>1] * 1000) >> hdr->sr_shift; 81 hdr->bit_rate = (ff_ac3_bitrate_tab[frame_size_code>>1] * 1000) >> hdr->sr_shift;
81 hdr->channels = ff_ac3_channels_tab[hdr->channel_mode] + hdr->lfe_on; 82 hdr->channels = ff_ac3_channels_tab[hdr->channel_mode] + hdr->lfe_on;
82 hdr->frame_size = ff_ac3_frame_size_tab[hdr->frame_size_code][hdr->sr_code] * 2; 83 hdr->frame_size = ff_ac3_frame_size_tab[frame_size_code][hdr->sr_code] * 2;
83 84
84 return 0; 85 return 0;
85 } 86 }
86 87
87 static int ac3_sync(const uint8_t *buf, int *channels, int *sample_rate, 88 static int ac3_sync(const uint8_t *buf, int *channels, int *sample_rate,