3 * Copyright (C) 2000-2001 Michel Lespinasse <walken@zoy.org>
4 * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
6 * This file is part of a52dec, a free ATSC A-52 stream decoder.
7 * See http://liba52.sourceforge.net/ for updates.
9 * Modified for use with MPlayer, changes contained in liba52_changes.diff.
10 * detailed CVS changelog at http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/
13 * a52dec is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
18 * a52dec is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
35 #include "a52_internal.h"
36 #include "bitstream.h"
41 /* some systems have memalign() but no declaration for it */
42 void * memalign (size_t align
, size_t size
);
54 static uint8_t halfrate
[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3};
56 sample_t
* a52_init (uint32_t mm_accel
)
61 samples
= memalign (16, 256 * 12 * sizeof (sample_t
));
62 #if defined(__MINGW32__) && defined(HAVE_SSE)
65 sample_t
* samplestmp
=malloc(256 * 12 * sizeof (sample_t
));
72 if(((int)samples
%16) && (mm_accel
&MM_ACCEL_X86_SSE
)){
73 mm_accel
&=~MM_ACCEL_X86_SSE
;
74 printf("liba52: unable to get 16 byte aligned memory disabling usage of SSE instructions\n");
80 imdct_init (mm_accel
);
81 downmix_accel_init(mm_accel
);
83 for (i
= 0; i
< 256 * 12; i
++)
89 int a52_syncinfo (uint8_t * buf
, int * flags
,
90 int * sample_rate
, int * bit_rate
)
92 static int rate
[] = { 32, 40, 48, 56, 64, 80, 96, 112,
93 128, 160, 192, 224, 256, 320, 384, 448,
95 static uint8_t lfeon
[8] = {0x10, 0x10, 0x04, 0x04, 0x04, 0x01, 0x04, 0x01};
101 if ((buf
[0] != 0x0b) || (buf
[1] != 0x77)) /* syncword */
104 if (buf
[5] >= 0x60) /* bsid >= 12 */
106 half
= halfrate
[buf
[5] >> 3];
108 /* acmod, dsurmod and lfeon */
110 *flags
= ((((buf
[6] & 0xf8) == 0x50) ? A52_DOLBY
: acmod
) |
111 ((buf
[6] & lfeon
[acmod
]) ? A52_LFE
: 0));
113 frmsizecod
= buf
[4] & 63;
114 if (frmsizecod
>= 38)
116 bitrate
= rate
[frmsizecod
>> 1];
117 *bit_rate
= (bitrate
* 1000) >> half
;
119 switch (buf
[4] & 0xc0) {
121 *sample_rate
= 48000 >> half
;
124 *sample_rate
= 44100 >> half
;
125 return 2 * (320 * bitrate
/ 147 + (frmsizecod
& 1));
127 *sample_rate
= 32000 >> half
;
134 int a52_frame (a52_state_t
* state
, uint8_t * buf
, int * flags
,
135 sample_t
* level
, sample_t bias
)
137 static sample_t clev
[4] = {LEVEL_3DB
, LEVEL_45DB
, LEVEL_6DB
, LEVEL_45DB
};
138 static sample_t slev
[4] = {LEVEL_3DB
, LEVEL_6DB
, 0, LEVEL_6DB
};
142 state
->fscod
= buf
[4] >> 6;
143 state
->halfrate
= halfrate
[buf
[5] >> 3];
144 state
->acmod
= acmod
= buf
[6] >> 5;
146 bitstream_set_ptr (buf
+ 6);
147 bitstream_skip (3); /* skip acmod we already parsed */
149 if ((acmod
== 2) && (bitstream_get (2) == 2)) /* dsurmod */
152 if ((acmod
& 1) && (acmod
!= 1))
153 state
->clev
= clev
[bitstream_get (2)]; /* cmixlev */
156 state
->slev
= slev
[bitstream_get (2)]; /* surmixlev */
158 state
->lfeon
= bitstream_get (1);
160 state
->output
= downmix_init (acmod
, *flags
, level
,
161 state
->clev
, state
->slev
);
162 if (state
->output
< 0)
164 if (state
->lfeon
&& (*flags
& A52_LFE
))
165 state
->output
|= A52_LFE
;
166 *flags
= state
->output
;
167 /* the 2* compensates for differences in imdct */
168 state
->dynrng
= state
->level
= 2 * *level
;
171 state
->dynrngcall
= NULL
;
175 bitstream_skip (5); /* dialnorm */
176 if (bitstream_get (1)) /* compre */
177 bitstream_skip (8); /* compr */
178 if (bitstream_get (1)) /* langcode */
179 bitstream_skip (8); /* langcod */
180 if (bitstream_get (1)) /* audprodie */
181 bitstream_skip (7); /* mixlevel + roomtyp */
182 } while (chaninfo
--);
184 bitstream_skip (2); /* copyrightb + origbs */
186 if (bitstream_get (1)) /* timecod1e */
187 bitstream_skip (14); /* timecod1 */
188 if (bitstream_get (1)) /* timecod2e */
189 bitstream_skip (14); /* timecod2 */
191 if (bitstream_get (1)) { /* addbsie */
194 addbsil
= bitstream_get (6);
196 bitstream_skip (8); /* addbsi */
203 void a52_dynrng (a52_state_t
* state
,
204 sample_t (* call
) (sample_t
, void *), void * data
)
209 state
->dynrngcall
= call
;
210 state
->dynrngdata
= data
;
214 static int parse_exponents (int expstr
, int ngrps
, uint8_t exponent
,
220 exps
= bitstream_get (7);
222 exponent
+= exp_1
[exps
];
228 *(dest
++) = exponent
;
229 *(dest
++) = exponent
;
231 *(dest
++) = exponent
;
233 *(dest
++) = exponent
;
236 exponent
+= exp_2
[exps
];
242 *(dest
++) = exponent
;
243 *(dest
++) = exponent
;
245 *(dest
++) = exponent
;
247 *(dest
++) = exponent
;
250 exponent
+= exp_3
[exps
];
256 *(dest
++) = exponent
;
257 *(dest
++) = exponent
;
259 *(dest
++) = exponent
;
261 *(dest
++) = exponent
;
268 static int parse_deltba (int8_t * deltba
)
270 int deltnseg
, deltlen
, delta
, j
;
272 memset (deltba
, 0, 50);
274 deltnseg
= bitstream_get (3);
277 j
+= bitstream_get (5);
278 deltlen
= bitstream_get (4);
279 delta
= bitstream_get (3);
280 delta
-= (delta
>= 4) ? 3 : 4;
283 if (j
+ deltlen
>= 50)
287 } while (deltnseg
--);
292 static inline int zero_snr_offsets (int nfchans
, a52_state_t
* state
)
296 if ((state
->csnroffst
) || (state
->cplinu
&& state
->cplba
.fsnroffst
) ||
297 (state
->lfeon
&& state
->lfeba
.fsnroffst
))
299 for (i
= 0; i
< nfchans
; i
++)
300 if (state
->ba
[i
].fsnroffst
)
305 static inline int16_t dither_gen (void)
307 static uint16_t lfsr_state
= 1;
310 state
= dither_lut
[lfsr_state
>> 8] ^ (lfsr_state
<< 8);
312 lfsr_state
= (uint16_t) state
;
317 static void coeff_get (sample_t
* coeff
, uint8_t * exp
, int8_t * bap
,
318 quantizer_t
* quantizer
, sample_t level
,
324 for (i
= 0; i
<= 24; i
++)
325 factor
[i
] = scale_factor
[i
] * level
;
327 for (i
= 0; i
< end
; i
++) {
334 coeff
[i
] = dither_gen() * LEVEL_3DB
* factor
[exp
[i
]];
342 if (quantizer
->q1_ptr
>= 0) {
343 coeff
[i
] = quantizer
->q1
[quantizer
->q1_ptr
--] * factor
[exp
[i
]];
348 code
= bitstream_get (5);
350 quantizer
->q1_ptr
= 1;
351 quantizer
->q1
[0] = q_1_2
[code
];
352 quantizer
->q1
[1] = q_1_1
[code
];
353 coeff
[i
] = q_1_0
[code
] * factor
[exp
[i
]];
358 if (quantizer
->q2_ptr
>= 0) {
359 coeff
[i
] = quantizer
->q2
[quantizer
->q2_ptr
--] * factor
[exp
[i
]];
364 code
= bitstream_get (7);
366 quantizer
->q2_ptr
= 1;
367 quantizer
->q2
[0] = q_2_2
[code
];
368 quantizer
->q2
[1] = q_2_1
[code
];
369 coeff
[i
] = q_2_0
[code
] * factor
[exp
[i
]];
374 coeff
[i
] = q_3
[bitstream_get (3)] * factor
[exp
[i
]];
378 if (quantizer
->q4_ptr
== 0) {
379 quantizer
->q4_ptr
= -1;
380 coeff
[i
] = quantizer
->q4
* factor
[exp
[i
]];
385 code
= bitstream_get (7);
387 quantizer
->q4_ptr
= 0;
388 quantizer
->q4
= q_4_1
[code
];
389 coeff
[i
] = q_4_0
[code
] * factor
[exp
[i
]];
394 coeff
[i
] = q_5
[bitstream_get (4)] * factor
[exp
[i
]];
398 coeff
[i
] = ((bitstream_get_2 (bapi
) << (16 - bapi
)) *
404 static void coeff_get_coupling (a52_state_t
* state
, int nfchans
,
405 sample_t
* coeff
, sample_t (* samples
)[256],
406 quantizer_t
* quantizer
, uint8_t dithflag
[5])
408 int sub_bnd
, bnd
, i
, i_end
, ch
;
413 bap
= state
->cpl_bap
;
414 exp
= state
->cpl_exp
;
416 i
= state
->cplstrtmant
;
417 while (i
< state
->cplendmant
) {
419 while (state
->cplbndstrc
[sub_bnd
++])
421 for (ch
= 0; ch
< nfchans
; ch
++)
422 cplco
[ch
] = state
->cplco
[ch
][bnd
] * coeff
[ch
];
432 cplcoeff
= LEVEL_3DB
* scale_factor
[exp
[i
]];
433 for (ch
= 0; ch
< nfchans
; ch
++)
434 if (state
->chincpl
[ch
]) {
436 samples
[ch
][i
] = (cplcoeff
* cplco
[ch
] *
445 if (quantizer
->q1_ptr
>= 0) {
446 cplcoeff
= quantizer
->q1
[quantizer
->q1_ptr
--];
451 code
= bitstream_get (5);
453 quantizer
->q1_ptr
= 1;
454 quantizer
->q1
[0] = q_1_2
[code
];
455 quantizer
->q1
[1] = q_1_1
[code
];
456 cplcoeff
= q_1_0
[code
];
461 if (quantizer
->q2_ptr
>= 0) {
462 cplcoeff
= quantizer
->q2
[quantizer
->q2_ptr
--];
467 code
= bitstream_get (7);
469 quantizer
->q2_ptr
= 1;
470 quantizer
->q2
[0] = q_2_2
[code
];
471 quantizer
->q2
[1] = q_2_1
[code
];
472 cplcoeff
= q_2_0
[code
];
477 cplcoeff
= q_3
[bitstream_get (3)];
481 if (quantizer
->q4_ptr
== 0) {
482 quantizer
->q4_ptr
= -1;
483 cplcoeff
= quantizer
->q4
;
488 code
= bitstream_get (7);
490 quantizer
->q4_ptr
= 0;
491 quantizer
->q4
= q_4_1
[code
];
492 cplcoeff
= q_4_0
[code
];
497 cplcoeff
= q_5
[bitstream_get (4)];
501 cplcoeff
= bitstream_get_2 (bapi
) << (16 - bapi
);
504 cplcoeff
*= scale_factor
[exp
[i
]];
505 for (ch
= 0; ch
< nfchans
; ch
++)
506 if (state
->chincpl
[ch
])
507 samples
[ch
][i
] = cplcoeff
* cplco
[ch
];
513 int a52_block (a52_state_t
* state
, sample_t
* samples
)
515 static const uint8_t nfchans_tbl
[] = {2, 1, 2, 3, 3, 4, 4, 5, 1, 1, 2};
516 static int rematrix_band
[4] = {25, 37, 61, 253};
517 int i
, nfchans
, chaninfo
;
518 uint8_t cplexpstr
, chexpstr
[5], lfeexpstr
, do_bit_alloc
, done_cpl
;
519 uint8_t blksw
[5], dithflag
[5];
522 quantizer_t quantizer
;
524 nfchans
= nfchans_tbl
[state
->acmod
];
526 for (i
= 0; i
< nfchans
; i
++)
527 blksw
[i
] = bitstream_get (1);
529 for (i
= 0; i
< nfchans
; i
++)
530 dithflag
[i
] = bitstream_get (1);
532 chaninfo
= !(state
->acmod
);
534 if (bitstream_get (1)) { /* dynrnge */
537 dynrng
= bitstream_get_2 (8);
538 if (state
->dynrnge
) {
541 range
= ((((dynrng
& 0x1f) | 0x20) << 13) *
542 scale_factor
[3 - (dynrng
>> 5)]);
543 if (state
->dynrngcall
)
544 range
= state
->dynrngcall (range
, state
->dynrngdata
);
545 state
->dynrng
= state
->level
* range
;
548 } while (chaninfo
--);
550 if (bitstream_get (1)) { /* cplstre */
551 state
->cplinu
= bitstream_get (1);
553 static int bndtab
[16] = {31, 35, 37, 39, 41, 42, 43, 44,
554 45, 45, 46, 46, 47, 47, 48, 48};
559 for (i
= 0; i
< nfchans
; i
++)
560 state
->chincpl
[i
] = bitstream_get (1);
561 switch (state
->acmod
) {
565 state
->phsflginu
= bitstream_get (1);
567 cplbegf
= bitstream_get (4);
568 cplendf
= bitstream_get (4);
570 if (cplendf
+ 3 - cplbegf
< 0)
572 state
->ncplbnd
= ncplsubnd
= cplendf
+ 3 - cplbegf
;
573 state
->cplstrtbnd
= bndtab
[cplbegf
];
574 state
->cplstrtmant
= cplbegf
* 12 + 37;
575 state
->cplendmant
= cplendf
* 12 + 73;
577 for (i
= 0; i
< ncplsubnd
- 1; i
++) {
578 state
->cplbndstrc
[i
] = bitstream_get (1);
579 state
->ncplbnd
-= state
->cplbndstrc
[i
];
581 state
->cplbndstrc
[i
] = 0; /* last value is a sentinel */
589 for (i
= 0; i
< nfchans
; i
++)
590 if (state
->chincpl
[i
])
591 if (bitstream_get (1)) { /* cplcoe */
592 int mstrcplco
, cplcoexp
, cplcomant
;
595 mstrcplco
= 3 * bitstream_get (2);
596 for (j
= 0; j
< state
->ncplbnd
; j
++) {
597 cplcoexp
= bitstream_get (4);
598 cplcomant
= bitstream_get (4);
602 cplcomant
= (cplcomant
| 0x10) << 13;
604 cplcomant
* scale_factor
[cplcoexp
+ mstrcplco
];
607 if ((state
->acmod
== 2) && state
->phsflginu
&& cplcoe
)
608 for (j
= 0; j
< state
->ncplbnd
; j
++)
609 if (bitstream_get (1)) /* phsflg */
610 state
->cplco
[1][j
] = -state
->cplco
[1][j
];
613 if ((state
->acmod
== 2) && (bitstream_get (1))) { /* rematstr */
616 end
= (state
->cplinu
) ? state
->cplstrtmant
: 253;
619 state
->rematflg
[i
] = bitstream_get (1);
620 while (rematrix_band
[i
++] < end
);
623 cplexpstr
= EXP_REUSE
;
624 lfeexpstr
= EXP_REUSE
;
626 cplexpstr
= bitstream_get (2);
627 for (i
= 0; i
< nfchans
; i
++)
628 chexpstr
[i
] = bitstream_get (2);
630 lfeexpstr
= bitstream_get (1);
632 for (i
= 0; i
< nfchans
; i
++)
633 if (chexpstr
[i
] != EXP_REUSE
) {
634 if (state
->cplinu
&& state
->chincpl
[i
])
635 state
->endmant
[i
] = state
->cplstrtmant
;
639 chbwcod
= bitstream_get (6);
642 state
->endmant
[i
] = chbwcod
* 3 + 73;
648 if (cplexpstr
!= EXP_REUSE
) {
649 int cplabsexp
, ncplgrps
;
652 ncplgrps
= ((state
->cplendmant
- state
->cplstrtmant
) /
653 (3 << (cplexpstr
- 1)));
654 cplabsexp
= bitstream_get (4) << 1;
655 if (parse_exponents (cplexpstr
, ncplgrps
, cplabsexp
,
656 state
->cpl_exp
+ state
->cplstrtmant
))
659 for (i
= 0; i
< nfchans
; i
++)
660 if (chexpstr
[i
] != EXP_REUSE
) {
661 int grp_size
, nchgrps
;
663 do_bit_alloc
|= 1 << i
;
664 grp_size
= 3 << (chexpstr
[i
] - 1);
665 nchgrps
= (state
->endmant
[i
] + grp_size
- 4) / grp_size
;
666 state
->fbw_exp
[i
][0] = bitstream_get (4);
667 if (parse_exponents (chexpstr
[i
], nchgrps
, state
->fbw_exp
[i
][0],
668 state
->fbw_exp
[i
] + 1))
670 bitstream_skip (2); /* gainrng */
672 if (lfeexpstr
!= EXP_REUSE
) {
674 state
->lfe_exp
[0] = bitstream_get (4);
675 if (parse_exponents (lfeexpstr
, 2, state
->lfe_exp
[0],
680 if (bitstream_get (1)) { /* baie */
682 state
->sdcycod
= bitstream_get (2);
683 state
->fdcycod
= bitstream_get (2);
684 state
->sgaincod
= bitstream_get (2);
685 state
->dbpbcod
= bitstream_get (2);
686 state
->floorcod
= bitstream_get (3);
688 if (bitstream_get (1)) { /* snroffste */
690 state
->csnroffst
= bitstream_get (6);
692 state
->cplba
.fsnroffst
= bitstream_get (4);
693 state
->cplba
.fgaincod
= bitstream_get (3);
695 for (i
= 0; i
< nfchans
; i
++) {
696 state
->ba
[i
].fsnroffst
= bitstream_get (4);
697 state
->ba
[i
].fgaincod
= bitstream_get (3);
700 state
->lfeba
.fsnroffst
= bitstream_get (4);
701 state
->lfeba
.fgaincod
= bitstream_get (3);
704 if ((state
->cplinu
) && (bitstream_get (1))) { /* cplleake */
706 state
->cplfleak
= 2304 - (bitstream_get (3) << 8);
707 state
->cplsleak
= 2304 - (bitstream_get (3) << 8);
710 if (bitstream_get (1)) { /* deltbaie */
713 state
->cplba
.deltbae
= bitstream_get (2);
714 for (i
= 0; i
< nfchans
; i
++)
715 state
->ba
[i
].deltbae
= bitstream_get (2);
716 if (state
->cplinu
&& (state
->cplba
.deltbae
== DELTA_BIT_NEW
) &&
717 parse_deltba (state
->cplba
.deltba
))
719 for (i
= 0; i
< nfchans
; i
++)
720 if ((state
->ba
[i
].deltbae
== DELTA_BIT_NEW
) &&
721 parse_deltba (state
->ba
[i
].deltba
))
726 if (zero_snr_offsets (nfchans
, state
)) {
727 memset (state
->cpl_bap
, 0, sizeof (state
->cpl_bap
));
728 memset (state
->fbw_bap
, 0, sizeof (state
->fbw_bap
));
729 memset (state
->lfe_bap
, 0, sizeof (state
->lfe_bap
));
731 if (state
->cplinu
&& (do_bit_alloc
& 64))
732 bit_allocate (state
, &state
->cplba
, state
->cplstrtbnd
,
733 state
->cplstrtmant
, state
->cplendmant
,
734 state
->cplfleak
, state
->cplsleak
,
735 state
->cpl_exp
, state
->cpl_bap
);
736 for (i
= 0; i
< nfchans
; i
++)
737 if (do_bit_alloc
& (1 << i
))
738 bit_allocate (state
, state
->ba
+ i
, 0, 0,
739 state
->endmant
[i
], 0, 0, state
->fbw_exp
[i
],
741 if (state
->lfeon
&& (do_bit_alloc
& 32)) {
742 state
->lfeba
.deltbae
= DELTA_BIT_NONE
;
743 bit_allocate (state
, &state
->lfeba
, 0, 0, 7, 0, 0,
744 state
->lfe_exp
, state
->lfe_bap
);
749 if (bitstream_get (1)) { /* skiple */
750 i
= bitstream_get (9); /* skipl */
755 if (state
->output
& A52_LFE
)
756 samples
+= 256; /* shift for LFE channel */
758 chanbias
= downmix_coeff (coeff
, state
->acmod
, state
->output
,
759 state
->dynrng
, state
->clev
, state
->slev
);
761 quantizer
.q1_ptr
= quantizer
.q2_ptr
= quantizer
.q4_ptr
= -1;
764 for (i
= 0; i
< nfchans
; i
++) {
767 coeff_get (samples
+ 256 * i
, state
->fbw_exp
[i
], state
->fbw_bap
[i
],
768 &quantizer
, coeff
[i
], dithflag
[i
], state
->endmant
[i
]);
770 if (state
->cplinu
&& state
->chincpl
[i
]) {
773 coeff_get_coupling (state
, nfchans
, coeff
,
774 (sample_t (*)[256])samples
, &quantizer
,
777 j
= state
->cplendmant
;
779 j
= state
->endmant
[i
];
781 (samples
+ 256 * i
)[j
] = 0;
785 if (state
->acmod
== 2) {
788 end
= ((state
->endmant
[0] < state
->endmant
[1]) ?
789 state
->endmant
[0] : state
->endmant
[1]);
794 if (!state
->rematflg
[i
]) {
795 j
= rematrix_band
[i
++];
798 band
= rematrix_band
[i
++];
805 tmp1
= (samples
+256)[j
];
806 samples
[j
] = tmp0
+ tmp1
;
807 (samples
+256)[j
] = tmp0
- tmp1
;
808 } while (++j
< band
);
813 if (state
->output
& A52_LFE
) {
814 coeff_get (samples
- 256, state
->lfe_exp
, state
->lfe_bap
,
815 &quantizer
, state
->dynrng
, 0, 7);
816 for (i
= 7; i
< 256; i
++)
817 (samples
-256)[i
] = 0;
818 imdct_512 (samples
- 256, samples
+ 1536 - 256, state
->bias
);
820 /* just skip the LFE coefficients */
821 coeff_get (samples
+ 1280, state
->lfe_exp
, state
->lfe_bap
,
822 &quantizer
, 0, 0, 7);
827 if (nfchans_tbl
[state
->output
& A52_CHANNEL_MASK
] < nfchans
)
828 for (i
= 1; i
< nfchans
; i
++)
829 if (blksw
[i
] != blksw
[0])
833 if (samples
[2 * 1536 - 1] == (sample_t
)0x776b6e21) {
834 samples
[2 * 1536 - 1] = 0;
835 upmix (samples
+ 1536, state
->acmod
, state
->output
);
838 for (i
= 0; i
< nfchans
; i
++) {
842 if (!(chanbias
& (1 << i
)))
847 imdct_256 (samples
+ 256 * i
, samples
+ 1536 + 256 * i
,
850 imdct_512 (samples
+ 256 * i
, samples
+ 1536 + 256 * i
,
855 for (j
= 0; j
< 256; j
++)
856 (samples
+ 256 * i
)[j
] = bias
;
860 downmix (samples
, state
->acmod
, state
->output
, state
->bias
,
861 state
->clev
, state
->slev
);
863 nfchans
= nfchans_tbl
[state
->output
& A52_CHANNEL_MASK
];
865 downmix (samples
, state
->acmod
, state
->output
, 0,
866 state
->clev
, state
->slev
);
868 if (samples
[2 * 1536 - 1] != (sample_t
)0x776b6e21) {
869 downmix (samples
+ 1536, state
->acmod
, state
->output
, 0,
870 state
->clev
, state
->slev
);
871 samples
[2 * 1536 - 1] = (sample_t
)0x776b6e21;
875 for (i
= 0; i
< nfchans
; i
++)
876 imdct_256 (samples
+ 256 * i
, samples
+ 1536 + 256 * i
,
879 for (i
= 0; i
< nfchans
; i
++)
880 imdct_512 (samples
+ 256 * i
, samples
+ 1536 + 256 * i
,