Mercurial > libavcodec.hg
comparison ac3dec.c @ 5499:838ba4dafaae libavcodec
cosmetics: blank lines, remove some comments
author | jbr |
---|---|
date | Sun, 05 Aug 2007 21:48:46 +0000 |
parents | 9971ba9c30a3 |
children | b499866a3397 |
comparison
equal
deleted
inserted
replaced
5498:9971ba9c30a3 | 5499:838ba4dafaae |
---|---|
127 #define AC3_OUTPUT_LFEON 8 | 127 #define AC3_OUTPUT_LFEON 8 |
128 | 128 |
129 typedef struct { | 129 typedef struct { |
130 int acmod; | 130 int acmod; |
131 int dsurmod; | 131 int dsurmod; |
132 | |
133 int blksw[AC3_MAX_CHANNELS]; | 132 int blksw[AC3_MAX_CHANNELS]; |
134 int dithflag[AC3_MAX_CHANNELS]; | 133 int dithflag[AC3_MAX_CHANNELS]; |
135 int dither_all; | 134 int dither_all; |
136 int cplinu; | 135 int cplinu; |
137 int chincpl[AC3_MAX_CHANNELS]; | 136 int chincpl[AC3_MAX_CHANNELS]; |
197 GetBitContext gb; | 196 GetBitContext gb; |
198 AVRandomState dith_state; //for dither generation | 197 AVRandomState dith_state; //for dither generation |
199 AVCodecContext *avctx; ///< parent context | 198 AVCodecContext *avctx; ///< parent context |
200 } AC3DecodeContext; | 199 } AC3DecodeContext; |
201 | 200 |
202 /*********** BEGIN INIT HELPER FUNCTIONS ***********/ | |
203 /** | 201 /** |
204 * Generate a Kaiser-Bessel Derived Window. | 202 * Generate a Kaiser-Bessel Derived Window. |
205 */ | 203 */ |
206 static void ac3_window_init(float *window) | 204 static void ac3_window_init(float *window) |
207 { | 205 { |
316 ctx->mul_bias = 32767.0f; | 314 ctx->mul_bias = 32767.0f; |
317 } | 315 } |
318 | 316 |
319 return 0; | 317 return 0; |
320 } | 318 } |
321 /*********** END INIT FUNCTIONS ***********/ | |
322 | 319 |
323 /** | 320 /** |
324 * Parses the 'sync info' and 'bit stream info' from the AC-3 bitstream. | 321 * Parses the 'sync info' and 'bit stream info' from the AC-3 bitstream. |
325 * GetBitContext within AC3DecodeContext must point to | 322 * GetBitContext within AC3DecodeContext must point to |
326 * start of the synchronized ac3 bitstream. | 323 * start of the synchronized ac3 bitstream. |
503 exps = ctx->dexps[ch_index]; | 500 exps = ctx->dexps[ch_index]; |
504 bap = ctx->bap[ch_index]; | 501 bap = ctx->bap[ch_index]; |
505 coeffs = ctx->transform_coeffs[ch_index]; | 502 coeffs = ctx->transform_coeffs[ch_index]; |
506 start = ctx->startmant[ch_index]; | 503 start = ctx->startmant[ch_index]; |
507 end = ctx->endmant[ch_index]; | 504 end = ctx->endmant[ch_index]; |
508 | |
509 | 505 |
510 for (i = start; i < end; i++) { | 506 for (i = start; i < end; i++) { |
511 tbap = bap[i]; | 507 tbap = bap[i]; |
512 switch (tbap) { | 508 switch (tbap) { |
513 case 0: | 509 case 0: |
953 av_log(ctx->avctx, AV_LOG_ERROR, "delta bit allocation strategy reserved\n"); | 949 av_log(ctx->avctx, AV_LOG_ERROR, "delta bit allocation strategy reserved\n"); |
954 return -1; | 950 return -1; |
955 } | 951 } |
956 bit_alloc_stages[ch] = FFMAX(bit_alloc_stages[ch], 2); | 952 bit_alloc_stages[ch] = FFMAX(bit_alloc_stages[ch], 2); |
957 } | 953 } |
958 | |
959 for (ch = !ctx->cplinu; ch <= nfchans; ch++) { | 954 for (ch = !ctx->cplinu; ch <= nfchans; ch++) { |
960 if (ctx->deltbae[ch] == DBA_NEW) {/*channel delta offset, len and bit allocation */ | 955 if (ctx->deltbae[ch] == DBA_NEW) {/*channel delta offset, len and bit allocation */ |
961 ctx->deltnseg[ch] = get_bits(gb, 3); | 956 ctx->deltnseg[ch] = get_bits(gb, 3); |
962 for (seg = 0; seg <= ctx->deltnseg[ch]; seg++) { | 957 for (seg = 0; seg <= ctx->deltnseg[ch]; seg++) { |
963 ctx->deltoffst[ch][seg] = get_bits(gb, 5); | 958 ctx->deltoffst[ch][seg] = get_bits(gb, 5); |
1002 if (get_bits1(gb)) { /* unused dummy data */ | 997 if (get_bits1(gb)) { /* unused dummy data */ |
1003 int skipl = get_bits(gb, 9); | 998 int skipl = get_bits(gb, 9); |
1004 while(skipl--) | 999 while(skipl--) |
1005 skip_bits(gb, 8); | 1000 skip_bits(gb, 8); |
1006 } | 1001 } |
1002 | |
1007 /* unpack the transform coefficients | 1003 /* unpack the transform coefficients |
1008 * * this also uncouples channels if coupling is in use. | 1004 * * this also uncouples channels if coupling is in use. |
1009 */ | 1005 */ |
1010 if (get_transform_coeffs(ctx)) { | 1006 if (get_transform_coeffs(ctx)) { |
1011 av_log(ctx->avctx, AV_LOG_ERROR, "Error in routine get_transform_coeffs\n"); | 1007 av_log(ctx->avctx, AV_LOG_ERROR, "Error in routine get_transform_coeffs\n"); |
1093 av_log(avctx, AV_LOG_ERROR, "Cannot downmix AC3 from %d to %d channels.\n", | 1089 av_log(avctx, AV_LOG_ERROR, "Cannot downmix AC3 from %d to %d channels.\n", |
1094 ctx->out_channels, avctx->channels); | 1090 ctx->out_channels, avctx->channels); |
1095 return -1; | 1091 return -1; |
1096 } | 1092 } |
1097 ctx->out_channels = avctx->channels; | 1093 ctx->out_channels = avctx->channels; |
1098 | |
1099 //av_log(avctx, AV_LOG_INFO, "channels = %d \t bit rate = %d \t sampling rate = %d \n", avctx->channels, avctx->bit_rate * 1000, avctx->sample_rate); | |
1100 | 1094 |
1101 //Parse the Audio Blocks. | 1095 //Parse the Audio Blocks. |
1102 for (blk = 0; blk < NB_BLOCKS; blk++) { | 1096 for (blk = 0; blk < NB_BLOCKS; blk++) { |
1103 if (ac3_parse_audio_block(ctx, blk)) { | 1097 if (ac3_parse_audio_block(ctx, blk)) { |
1104 av_log(avctx, AV_LOG_ERROR, "error parsing the audio block\n"); | 1098 av_log(avctx, AV_LOG_ERROR, "error parsing the audio block\n"); |
1131 .priv_data_size = sizeof (AC3DecodeContext), | 1125 .priv_data_size = sizeof (AC3DecodeContext), |
1132 .init = ac3_decode_init, | 1126 .init = ac3_decode_init, |
1133 .close = ac3_decode_end, | 1127 .close = ac3_decode_end, |
1134 .decode = ac3_decode_frame, | 1128 .decode = ac3_decode_frame, |
1135 }; | 1129 }; |
1136 |