From 398b37124e870b3be69a03e5d89c5887204d6990 Mon Sep 17 00:00:00 2001 From: Andree Buschmann Date: Mon, 22 Feb 2010 19:44:05 +0000 Subject: Remove all tabs within codec path. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24862 a1c6a512-1295-4272-9138-f99709370657 --- apps/codecs/demac/libdemac/predictor-arm.S | 2 +- apps/codecs/lib/ffmpeg_bswap.h | 36 +- apps/codecs/lib/fft-ffmpeg.c | 2 +- apps/codecs/lib/setjmp.h | 8 +- apps/codecs/lib/setjmp_arm.S | 128 +- apps/codecs/lib/setjmp_cf.S | 60 +- apps/codecs/lib/tlsf/src/tlsf.c | 160 +- apps/codecs/liba52/a52.h | 6 +- apps/codecs/liba52/a52_internal.h | 84 +- apps/codecs/liba52/bit_allocate.c | 242 +- apps/codecs/liba52/bitstream.c | 12 +- apps/codecs/liba52/bitstream.h | 16 +- apps/codecs/liba52/downmix.c | 674 ++--- apps/codecs/liba52/imdct.c | 172 +- apps/codecs/liba52/imdct_lookups.h | 2 +- apps/codecs/liba52/mm_accel.h | 8 +- apps/codecs/liba52/parse.c | 1200 ++++----- apps/codecs/libasap/acpu.c | 2270 ++++++++--------- apps/codecs/libasap/apokeysnd.c | 920 +++---- apps/codecs/libasap/asap.c | 3716 ++++++++++++++-------------- apps/codecs/libasap/asap.h | 204 +- apps/codecs/libasap/players.h | 2736 ++++++++++---------- apps/codecs/libfaad/hcr.c | 2 +- apps/codecs/libfaad/huffman.c | 6 +- apps/codecs/libfaad/sbr_dct.c | 26 +- apps/codecs/libfaad/sbr_dec.c | 2 +- apps/codecs/libfaad/sbr_hfadj.c | 2 +- apps/codecs/libfaad/sbr_hfgen.c | 36 +- apps/codecs/libfaad/sbr_qmf.c | 22 +- apps/codecs/libfaad/sbr_syntax.c | 10 +- apps/codecs/libffmpegFLAC/bitstream.h | 8 +- apps/codecs/libffmpegFLAC/golomb.h | 2 +- apps/codecs/libffmpegFLAC/main.c | 2 +- apps/codecs/libmad/bit.c | 40 +- apps/codecs/libmad/bit.h | 4 +- apps/codecs/libmad/decoder.c | 196 +- apps/codecs/libmad/decoder.h | 36 +- apps/codecs/libmad/fixed.c | 8 +- apps/codecs/libmad/fixed.h | 238 +- apps/codecs/libmad/frame.c | 62 +- apps/codecs/libmad/frame.h | 74 +- apps/codecs/libmad/global.h | 4 +- apps/codecs/libmad/huffman.c | 692 +++--- apps/codecs/libmad/layer12.c | 226 +- apps/codecs/libmad/layer3.c | 694 +++--- apps/codecs/libmad/mad.h | 566 ++--- apps/codecs/libmad/minimad.c | 18 +- apps/codecs/libmad/stream.c | 70 +- apps/codecs/libmad/stream.h | 98 +- apps/codecs/libmad/synth.c | 518 ++-- apps/codecs/libmad/synth.h | 16 +- apps/codecs/libmad/timer.c | 82 +- apps/codecs/libmad/timer.h | 64 +- apps/codecs/libmad/version.h | 26 +- apps/codecs/librm/rm.c | 4 +- apps/codecs/libspeex/_kiss_fft_guts.h | 42 +- apps/codecs/libspeex/cb_search.c | 24 +- apps/codecs/libspeex/kiss_fft.c | 6 +- apps/codecs/libspeex/kiss_fft.h | 8 +- apps/codecs/libspeex/lsp.c | 200 +- apps/codecs/libspeex/lsp.h | 12 +- apps/codecs/libspeex/ltp_bfin.h | 60 +- apps/codecs/libspeex/nb_celp.c | 6 +- apps/codecs/libspeex/oggframing.c | 62 +- apps/codecs/libspeex/quant_lsp_bfin.h | 66 +- apps/codecs/libspeex/sb_celp.c | 2 +- apps/codecs/libspeex/smallft.c | 12 +- apps/codecs/libspeex/speex/ogg.h | 14 +- apps/codecs/libspeex/vorbis_psy.c | 16 +- apps/codecs/libtremor/asm_arm.h | 82 +- apps/codecs/libtremor/backends.h | 10 +- apps/codecs/libtremor/codebook.c | 204 +- apps/codecs/libtremor/codebook.h | 18 +- apps/codecs/libtremor/floor0.c | 36 +- apps/codecs/libtremor/framing.c | 4 +- apps/codecs/libtremor/info.c | 64 +- apps/codecs/libtremor/ivorbiscodec.h | 4 +- apps/codecs/libtremor/ivorbisfile.h | 6 +- apps/codecs/libtremor/lsp_lookup.h | 100 +- apps/codecs/libtremor/misc.h | 32 +- apps/codecs/libtremor/sharedbook.c | 240 +- apps/codecs/libtremor/window.h | 4 +- apps/codecs/libwavpack/pack.c | 4 +- apps/codecs/libwma/asf.h | 16 +- 84 files changed, 8933 insertions(+), 8933 deletions(-) diff --git a/apps/codecs/demac/libdemac/predictor-arm.S b/apps/codecs/demac/libdemac/predictor-arm.S index 28808c8e96..1d5587661a 100644 --- a/apps/codecs/demac/libdemac/predictor-arm.S +++ b/apps/codecs/demac/libdemac/predictor-arm.S @@ -49,7 +49,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA #define XfilterB 20 /* int32_t XfilterB; */ #define YfilterA 24 /* int32_t YfilterA; */ - + #define YcoeffsA 28 /* int32_t YcoeffsA[4]; */ #define XcoeffsA 44 /* int32_t XcoeffsA[4]; */ #define YcoeffsB 60 /* int32_t YcoeffsB[5]; */ diff --git a/apps/codecs/lib/ffmpeg_bswap.h b/apps/codecs/lib/ffmpeg_bswap.h index b083d10ed0..24a2aab7ea 100644 --- a/apps/codecs/lib/ffmpeg_bswap.h +++ b/apps/codecs/lib/ffmpeg_bswap.h @@ -34,8 +34,8 @@ static inline uint64_t ByteSwap64(uint64_t x) #elif defined(ARCH_X86) static inline unsigned short ByteSwap16(unsigned short x) { - __asm("xchgb %b0,%h0" : - "=q" (x) : + __asm("xchgb %b0,%h0" : + "=q" (x) : "0" (x)); return x; } @@ -44,13 +44,13 @@ static inline unsigned short ByteSwap16(unsigned short x) static inline unsigned int ByteSwap32(unsigned int x) { #if __CPU__ > 386 - __asm("bswap %0": + __asm("bswap %0": "=r" (x) : #else - __asm("xchgb %b0,%h0\n" - " rorl $16,%0\n" - " xchgb %b0,%h0": - "=q" (x) : + __asm("xchgb %b0,%h0\n" + " rorl $16,%0\n" + " xchgb %b0,%h0": + "=q" (x) : #endif "0" (x)); return x; @@ -61,7 +61,7 @@ static inline unsigned long long int ByteSwap64(unsigned long long int x) { register union { __extension__ uint64_t __ll; uint32_t __l[2]; } __x; - asm("xchgl %0,%1": + asm("xchgl %0,%1": "=r"(__x.__l[0]),"=r"(__x.__l[1]): "0"(bswap_32((unsigned long)x)),"1"(bswap_32((unsigned long)(x>>32)))); return __x.__ll; @@ -71,17 +71,17 @@ static inline unsigned long long int ByteSwap64(unsigned long long int x) #elif defined(ARCH_SH4) static inline uint16_t ByteSwap16(uint16_t x) { - __asm__("swap.b %0,%0":"=r"(x):"0"(x)); - return x; + __asm__("swap.b %0,%0":"=r"(x):"0"(x)); + return x; } static inline uint32_t ByteSwap32(uint32_t x) { - __asm__( - "swap.b %0,%0\n" - "swap.w %0,%0\n" - "swap.b %0,%0\n" - :"=r"(x):"0"(x)); - return x; + __asm__( + "swap.b %0,%0\n" + "swap.w %0,%0\n" + "swap.b %0,%0\n" + :"=r"(x):"0"(x)); + return x; } #define bswap_16(x) ByteSwap16(x) @@ -124,9 +124,9 @@ static inline uint64_t ByteSwap64(uint64_t x) } #define bswap_64(x) ByteSwap64(x) -#endif /* !ARCH_X86 */ +#endif /* !ARCH_X86 */ -#endif /* !HAVE_BYTESWAP_H */ +#endif /* !HAVE_BYTESWAP_H */ // be2me ... BigEndian to MachineEndian // le2me ... LittleEndian to MachineEndian diff --git a/apps/codecs/lib/fft-ffmpeg.c b/apps/codecs/lib/fft-ffmpeg.c index 203a82e7d4..d18f0481c0 100644 --- a/apps/codecs/lib/fft-ffmpeg.c +++ b/apps/codecs/lib/fft-ffmpeg.c @@ -463,7 +463,7 @@ int main (void) //exec_time = (((double)end-(double)start)/CLOCKS_PER_SEC); for(j = 0; j < FFT_SIZE; j++) { - printf("%8.4f\n", sqrt(pow(fixtof32(z[j].re),2)+ pow(fixtof32(z[j].im), 2))); + printf("%8.4f\n", sqrt(pow(fixtof32(z[j].re),2)+ pow(fixtof32(z[j].im), 2))); //getchar(); } printf("muls = %d, adds = %d\n", muls, adds); diff --git a/apps/codecs/lib/setjmp.h b/apps/codecs/lib/setjmp.h index eed43c6f95..f7ff2ea58c 100644 --- a/apps/codecs/lib/setjmp.h +++ b/apps/codecs/lib/setjmp.h @@ -18,10 +18,10 @@ #ifdef CPU_COLDFIRE /* * onsstack,sigmask,sp,pc,psl,d2-d7,a2-a6, - * fp2-fp7 for 68881. + * fp2-fp7 for 68881. * All else recovered by under/over(flow) handling. */ -#define _JBLEN 34 +#define _JBLEN 34 #endif #ifdef CPU_MIPS @@ -48,9 +48,9 @@ #ifdef _JBLEN #ifdef _JBTYPE -typedef _JBTYPE jmp_buf[_JBLEN]; +typedef _JBTYPE jmp_buf[_JBLEN]; #else -typedef int jmp_buf[_JBLEN]; +typedef int jmp_buf[_JBLEN]; #endif #else typedef int jmp_buf; diff --git a/apps/codecs/lib/setjmp_arm.S b/apps/codecs/lib/setjmp_arm.S index 4bb2a46a7a..a4d5a016bd 100644 --- a/apps/codecs/lib/setjmp_arm.S +++ b/apps/codecs/lib/setjmp_arm.S @@ -27,10 +27,10 @@ in both interworked and non-interworked environments as well as with older processors which do not have the BX instruction we do the following: - Test the return address. - If the bottom bit is clear perform an "old style" function exit. - (We know that we are in ARM mode and returning to an ARM mode caller). - Otherwise use the BX instruction to perform the function exit. + Test the return address. + If the bottom bit is clear perform an "old style" function exit. + (We know that we are in ARM mode and returning to an ARM mode caller). + Otherwise use the BX instruction to perform the function exit. We know that we will never attempt to perform the BX instruction on an older processor, because that kind of processor will never be @@ -47,7 +47,7 @@ test the bottom bit, because this is part of the processor status. Instead we just do a normal return, since we know that we cannot be returning to a Thumb caller - the Thumb does not support APCS-26. - + Function entry is much simpler. If we are compiling for the Thumb we just switch into ARM mode and then drop through into the rest of the function. The function exit code will take care of the restore to @@ -56,18 +56,18 @@ For Thumb-2 do everything in Thumb mode. */ #ifdef __APCS_26__ -#define RET movs pc, lr +#define RET movs pc, lr #elif defined(__thumb2__) -#define RET bx lr +#define RET bx lr #else -#define RET tst lr, #1; \ - moveq pc, lr ; \ -.word 0xe12fff1e /* bx lr */ +#define RET tst lr, #1; \ + moveq pc, lr ; \ +.word 0xe12fff1e /* bx lr */ #endif #ifdef __thumb2__ .macro COND where when - i\where \when + i\where \when .endm #else .macro COND where when @@ -77,96 +77,96 @@ #if defined(__thumb2__) .syntax unified .macro MODE - .thumb - .thumb_func + .thumb + .thumb_func .endm .macro PROLOGUE name .endm #elif defined(__thumb__) -#define MODE .thumb_func +#define MODE .thumb_func .macro PROLOGUE name - .code 16 - bx pc - nop - .code 32 + .code 16 + bx pc + nop + .code 32 SYM (.arm_start_of.\name): .endm #else /* Arm */ -#define MODE .code 32 +#define MODE .code 32 .macro PROLOGUE name .endm #endif - + .macro FUNC_START name - .text - .align 2 - MODE - .globl SYM (\name) - TYPE (\name) + .text + .align 2 + MODE + .globl SYM (\name) + TYPE (\name) SYM (\name): - PROLOGUE \name + PROLOGUE \name .endm .macro FUNC_END name - RET - SIZE (\name) + RET + SIZE (\name) .endm - + /* -------------------------------------------------------------------- int setjmp (jmp_buf); -------------------------------------------------------------------- */ - - FUNC_START setjmp + + FUNC_START setjmp - /* Save all the callee-preserved registers into the jump buffer. */ + /* Save all the callee-preserved registers into the jump buffer. */ #ifdef __thumb2__ - stmea a1!, { v1-v7, fp, ip, lr } - str sp, [a1],#+4 + stmea a1!, { v1-v7, fp, ip, lr } + str sp, [a1],#+4 #else - stmea a1!, { v1-v7, fp, ip, sp, lr } + stmea a1!, { v1-v7, fp, ip, sp, lr } #endif - -#if 0 /* Simulator does not cope with FP instructions yet. */ + +#if 0 /* Simulator does not cope with FP instructions yet. */ #ifndef __SOFTFP__ - /* Save the floating point registers. */ - sfmea f4, 4, [a1] + /* Save the floating point registers. */ + sfmea f4, 4, [a1] #endif -#endif - /* When setting up the jump buffer return 0. */ - mov a1, #0 +#endif + /* When setting up the jump buffer return 0. */ + mov a1, #0 - FUNC_END setjmp - + FUNC_END setjmp + /* -------------------------------------------------------------------- - volatile void longjmp (jmp_buf, int); + volatile void longjmp (jmp_buf, int); -------------------------------------------------------------------- */ - - FUNC_START longjmp + + FUNC_START longjmp - /* If we have stack extension code it ought to be handled here. */ - - /* Restore the registers, retrieving the state when setjmp() was called. */ + /* If we have stack extension code it ought to be handled here. */ + + /* Restore the registers, retrieving the state when setjmp() was called. */ #ifdef __thumb2__ - ldmfd a1!, { v1-v7, fp, ip, lr } - ldr sp, [a1],#+4 + ldmfd a1!, { v1-v7, fp, ip, lr } + ldr sp, [a1],#+4 #else - ldmfd a1!, { v1-v7, fp, ip, sp, lr } + ldmfd a1!, { v1-v7, fp, ip, sp, lr } #endif - -#if 0 /* Simulator does not cope with FP instructions yet. */ + +#if 0 /* Simulator does not cope with FP instructions yet. */ #ifndef __SOFTFP__ - /* Restore floating point registers as well. */ - lfmfd f4, 4, [a1] + /* Restore floating point registers as well. */ + lfmfd f4, 4, [a1] #endif -#endif - /* Put the return value into the integer result register. - But if it is zero then return 1 instead. */ - movs a1, a2 +#endif + /* Put the return value into the integer result register. + But if it is zero then return 1 instead. */ + movs a1, a2 #ifdef __thumb2__ - it eq + it eq #endif - moveq a1, #1 + moveq a1, #1 - FUNC_END longjmp + FUNC_END longjmp diff --git a/apps/codecs/lib/setjmp_cf.S b/apps/codecs/lib/setjmp_cf.S index acc98c3f59..86eda8079c 100644 --- a/apps/codecs/lib/setjmp_cf.S +++ b/apps/codecs/lib/setjmp_cf.S @@ -34,46 +34,46 @@ .global SYM (longjmp) SYM (setjmp): - moveal sp@(4),a0 - movel sp@(0),a0@(12) - movel sp,a0@(8) - moveml d2-d7/a2-a6,a0@(20) - clrl d0 - rts + moveal sp@(4),a0 + movel sp@(0),a0@(12) + movel sp,a0@(8) + moveml d2-d7/a2-a6,a0@(20) + clrl d0 + rts SYM (longjmp): - moveal sp@(4),a0 - movel sp@(8),d0 - bne 1f - movel &1,d0 + moveal sp@(4),a0 + movel sp@(8),d0 + bne 1f + movel &1,d0 1: - moveml a0@(20),d2-d7/a2-a6 - moveal a0@(8),sp - movel a0@(12),sp@ - rts + moveml a0@(20),d2-d7/a2-a6 + moveal a0@(8),sp + movel a0@(12),sp@ + rts #ifdef M68881 .global SYM (setjmp_68881) .global SYM (longjmp_68881) SYM (setjmp_68881): - moveal sp@(4),a0 - movel sp@(0),a0@(12) - movel sp,a0@(8) - moveml d2-d7/a2-a6,a0@(20) - fmovemx fp2-fp7,a0@(64) - clrl d0 - rts + moveal sp@(4),a0 + movel sp@(0),a0@(12) + movel sp,a0@(8) + moveml d2-d7/a2-a6,a0@(20) + fmovemx fp2-fp7,a0@(64) + clrl d0 + rts SYM (longjmp_68881): - moveal sp@(4),a0 - fmovemx a0@(64),fp2-fp7 - movel sp@(8),d0 - bne 1f - movel &1,d0 + moveal sp@(4),a0 + fmovemx a0@(64),fp2-fp7 + movel sp@(8),d0 + bne 1f + movel &1,d0 1: - moveml a0@(20),d2-d7/a2-a6 - moveal a0@(8),sp - movel a0@(12),sp@ - rts + moveml a0@(20),d2-d7/a2-a6 + moveal a0@(8),sp + movel a0@(12),sp@ + rts #endif diff --git a/apps/codecs/lib/tlsf/src/tlsf.c b/apps/codecs/lib/tlsf/src/tlsf.c index 830184761a..6d15c3a3f6 100644 --- a/apps/codecs/lib/tlsf/src/tlsf.c +++ b/apps/codecs/lib/tlsf/src/tlsf.c @@ -56,19 +56,19 @@ #include #ifndef TLSF_USE_LOCKS -#define TLSF_USE_LOCKS (0) +#define TLSF_USE_LOCKS (0) #endif #ifndef TLSF_STATISTIC -#define TLSF_STATISTIC (0) +#define TLSF_STATISTIC (0) #endif #ifndef USE_MMAP -#define USE_MMAP (0) +#define USE_MMAP (0) #endif #ifndef USE_SBRK -#define USE_SBRK (0) +#define USE_SBRK (0) #endif @@ -82,18 +82,18 @@ #endif #if TLSF_STATISTIC -#define TLSF_ADD_SIZE(tlsf, b) do { \ - tlsf->used_size += (b->size & BLOCK_SIZE) + BHDR_OVERHEAD; \ - if (tlsf->used_size > tlsf->max_size) \ - tlsf->max_size = tlsf->used_size; \ - } while(0) - -#define TLSF_REMOVE_SIZE(tlsf, b) do { \ - tlsf->used_size -= (b->size & BLOCK_SIZE) + BHDR_OVERHEAD; \ - } while(0) +#define TLSF_ADD_SIZE(tlsf, b) do { \ + tlsf->used_size += (b->size & BLOCK_SIZE) + BHDR_OVERHEAD; \ + if (tlsf->used_size > tlsf->max_size) \ + tlsf->max_size = tlsf->used_size; \ + } while(0) + +#define TLSF_REMOVE_SIZE(tlsf, b) do { \ + tlsf->used_size -= (b->size & BLOCK_SIZE) + BHDR_OVERHEAD; \ + } while(0) #else -#define TLSF_ADD_SIZE(tlsf, b) do{}while(0) -#define TLSF_REMOVE_SIZE(tlsf, b) do{}while(0) +#define TLSF_ADD_SIZE(tlsf, b) do{}while(0) +#define TLSF_REMOVE_SIZE(tlsf, b) do{}while(0) #endif #if USE_MMAP || USE_SBRK @@ -125,37 +125,37 @@ /* Unlike the preview TLSF versions, now they are statics */ #define BLOCK_ALIGN (sizeof(void *) * 2) -#define MAX_FLI (30) -#define MAX_LOG2_SLI (5) -#define MAX_SLI (1 << MAX_LOG2_SLI) /* MAX_SLI = 2^MAX_LOG2_SLI */ +#define MAX_FLI (30) +#define MAX_LOG2_SLI (5) +#define MAX_SLI (1 << MAX_LOG2_SLI) /* MAX_SLI = 2^MAX_LOG2_SLI */ -#define FLI_OFFSET (6) /* tlsf structure just will manage blocks bigger */ +#define FLI_OFFSET (6) /* tlsf structure just will manage blocks bigger */ /* than 128 bytes */ -#define SMALL_BLOCK (128) -#define REAL_FLI (MAX_FLI - FLI_OFFSET) -#define MIN_BLOCK_SIZE (sizeof (free_ptr_t)) -#define BHDR_OVERHEAD (sizeof (bhdr_t) - MIN_BLOCK_SIZE) -#define TLSF_SIGNATURE (0x2A59FA59) +#define SMALL_BLOCK (128) +#define REAL_FLI (MAX_FLI - FLI_OFFSET) +#define MIN_BLOCK_SIZE (sizeof (free_ptr_t)) +#define BHDR_OVERHEAD (sizeof (bhdr_t) - MIN_BLOCK_SIZE) +#define TLSF_SIGNATURE (0x2A59FA59) -#define PTR_MASK (sizeof(void *) - 1) -#define BLOCK_SIZE (0xFFFFFFFF - PTR_MASK) +#define PTR_MASK (sizeof(void *) - 1) +#define BLOCK_SIZE (0xFFFFFFFF - PTR_MASK) #define GET_NEXT_BLOCK(_addr, _r) ((bhdr_t *) ((char *) (_addr) + (_r))) -#define MEM_ALIGN ((BLOCK_ALIGN) - 1) +#define MEM_ALIGN ((BLOCK_ALIGN) - 1) #define ROUNDUP_SIZE(_r) (((_r) + MEM_ALIGN) & ~MEM_ALIGN) #define ROUNDDOWN_SIZE(_r) ((_r) & ~MEM_ALIGN) #define ROUNDUP(_x, _v) ((((~(_x)) + 1) & ((_v)-1)) + (_x)) -#define BLOCK_STATE (0x1) -#define PREV_STATE (0x2) +#define BLOCK_STATE (0x1) +#define PREV_STATE (0x2) /* bit 0 of the block size */ -#define FREE_BLOCK (0x1) -#define USED_BLOCK (0x0) +#define FREE_BLOCK (0x1) +#define USED_BLOCK (0x0) /* bit 1 of the block size */ -#define PREV_FREE (0x2) -#define PREV_USED (0x0) +#define PREV_FREE (0x2) +#define PREV_USED (0x0) #define DEFAULT_AREA_SIZE (1024*10) @@ -352,46 +352,46 @@ static __inline__ bhdr_t *FIND_SUITABLE_BLOCK(tlsf_t * _tlsf, int *_fl, int *_sl } -#define EXTRACT_BLOCK_HDR(_b, _tlsf, _fl, _sl) do { \ - _tlsf -> matrix [_fl] [_sl] = _b -> ptr.free_ptr.next; \ - if (_tlsf -> matrix[_fl][_sl]) \ - _tlsf -> matrix[_fl][_sl] -> ptr.free_ptr.prev = NULL; \ - else { \ - clear_bit (_sl, &_tlsf -> sl_bitmap [_fl]); \ - if (!_tlsf -> sl_bitmap [_fl]) \ - clear_bit (_fl, &_tlsf -> fl_bitmap); \ - } \ - _b -> ptr.free_ptr.prev = NULL; \ - _b -> ptr.free_ptr.next = NULL; \ - }while(0) - - -#define EXTRACT_BLOCK(_b, _tlsf, _fl, _sl) do { \ - if (_b -> ptr.free_ptr.next) \ - _b -> ptr.free_ptr.next -> ptr.free_ptr.prev = _b -> ptr.free_ptr.prev; \ - if (_b -> ptr.free_ptr.prev) \ - _b -> ptr.free_ptr.prev -> ptr.free_ptr.next = _b -> ptr.free_ptr.next; \ - if (_tlsf -> matrix [_fl][_sl] == _b) { \ - _tlsf -> matrix [_fl][_sl] = _b -> ptr.free_ptr.next; \ - if (!_tlsf -> matrix [_fl][_sl]) { \ - clear_bit (_sl, &_tlsf -> sl_bitmap[_fl]); \ - if (!_tlsf -> sl_bitmap [_fl]) \ - clear_bit (_fl, &_tlsf -> fl_bitmap); \ - } \ - } \ - _b -> ptr.free_ptr.prev = NULL; \ - _b -> ptr.free_ptr.next = NULL; \ - } while(0) - -#define INSERT_BLOCK(_b, _tlsf, _fl, _sl) do { \ - _b -> ptr.free_ptr.prev = NULL; \ - _b -> ptr.free_ptr.next = _tlsf -> matrix [_fl][_sl]; \ - if (_tlsf -> matrix [_fl][_sl]) \ - _tlsf -> matrix [_fl][_sl] -> ptr.free_ptr.prev = _b; \ - _tlsf -> matrix [_fl][_sl] = _b; \ - set_bit (_sl, &_tlsf -> sl_bitmap [_fl]); \ - set_bit (_fl, &_tlsf -> fl_bitmap); \ - } while(0) +#define EXTRACT_BLOCK_HDR(_b, _tlsf, _fl, _sl) do { \ + _tlsf -> matrix [_fl] [_sl] = _b -> ptr.free_ptr.next; \ + if (_tlsf -> matrix[_fl][_sl]) \ + _tlsf -> matrix[_fl][_sl] -> ptr.free_ptr.prev = NULL; \ + else { \ + clear_bit (_sl, &_tlsf -> sl_bitmap [_fl]); \ + if (!_tlsf -> sl_bitmap [_fl]) \ + clear_bit (_fl, &_tlsf -> fl_bitmap); \ + } \ + _b -> ptr.free_ptr.prev = NULL; \ + _b -> ptr.free_ptr.next = NULL; \ + }while(0) + + +#define EXTRACT_BLOCK(_b, _tlsf, _fl, _sl) do { \ + if (_b -> ptr.free_ptr.next) \ + _b -> ptr.free_ptr.next -> ptr.free_ptr.prev = _b -> ptr.free_ptr.prev; \ + if (_b -> ptr.free_ptr.prev) \ + _b -> ptr.free_ptr.prev -> ptr.free_ptr.next = _b -> ptr.free_ptr.next; \ + if (_tlsf -> matrix [_fl][_sl] == _b) { \ + _tlsf -> matrix [_fl][_sl] = _b -> ptr.free_ptr.next; \ + if (!_tlsf -> matrix [_fl][_sl]) { \ + clear_bit (_sl, &_tlsf -> sl_bitmap[_fl]); \ + if (!_tlsf -> sl_bitmap [_fl]) \ + clear_bit (_fl, &_tlsf -> fl_bitmap); \ + } \ + } \ + _b -> ptr.free_ptr.prev = NULL; \ + _b -> ptr.free_ptr.next = NULL; \ + } while(0) + +#define INSERT_BLOCK(_b, _tlsf, _fl, _sl) do { \ + _b -> ptr.free_ptr.prev = NULL; \ + _b -> ptr.free_ptr.next = _tlsf -> matrix [_fl][_sl]; \ + if (_tlsf -> matrix [_fl][_sl]) \ + _tlsf -> matrix [_fl][_sl] -> ptr.free_ptr.prev = _b; \ + _tlsf -> matrix [_fl][_sl] = _b; \ + set_bit (_sl, &_tlsf -> sl_bitmap [_fl]); \ + set_bit (_fl, &_tlsf -> fl_bitmap); \ + } while(0) #if USE_SBRK || USE_MMAP static __inline__ void *get_new_area(size_t * size) @@ -656,9 +656,9 @@ void *tlsf_realloc(void *ptr, size_t size) void *ret; #if USE_MMAP || USE_SBRK - if (!mp) { - return tlsf_malloc(size); - } + if (!mp) { + return tlsf_malloc(size); + } #endif TLSF_ACQUIRE_LOCK(&((tlsf_t *)mp)->lock); @@ -813,7 +813,7 @@ void *realloc_ex(void *ptr, size_t new_size, void *mem_pool) new_size = (new_size < MIN_BLOCK_SIZE) ? MIN_BLOCK_SIZE : ROUNDUP_SIZE(new_size); tmp_size = (b->size & BLOCK_SIZE); if (new_size <= tmp_size) { - TLSF_REMOVE_SIZE(tlsf, b); + TLSF_REMOVE_SIZE(tlsf, b); if (next_b->size & FREE_BLOCK) { MAPPING_INSERT(next_b->size & BLOCK_SIZE, &fl, &sl); EXTRACT_BLOCK(next_b, tlsf, fl, sl); @@ -833,12 +833,12 @@ void *realloc_ex(void *ptr, size_t new_size, void *mem_pool) INSERT_BLOCK(tmp_b, tlsf, fl, sl); b->size = new_size | (b->size & PREV_STATE); } - TLSF_ADD_SIZE(tlsf, b); + TLSF_ADD_SIZE(tlsf, b); return (void *) b->ptr.buffer; } if ((next_b->size & FREE_BLOCK)) { if (new_size <= (tmp_size + (next_b->size & BLOCK_SIZE))) { - TLSF_REMOVE_SIZE(tlsf, b); + TLSF_REMOVE_SIZE(tlsf, b); MAPPING_INSERT(next_b->size & BLOCK_SIZE, &fl, &sl); EXTRACT_BLOCK(next_b, tlsf, fl, sl); b->size += (next_b->size & BLOCK_SIZE) + BHDR_OVERHEAD; @@ -856,7 +856,7 @@ void *realloc_ex(void *ptr, size_t new_size, void *mem_pool) INSERT_BLOCK(tmp_b, tlsf, fl, sl); b->size = new_size | (b->size & PREV_STATE); } - TLSF_ADD_SIZE(tlsf, b); + TLSF_ADD_SIZE(tlsf, b); return (void *) b->ptr.buffer; } } diff --git a/apps/codecs/liba52/a52.h b/apps/codecs/liba52/a52.h index aa4e7f6243..cae9ae6403 100644 --- a/apps/codecs/liba52/a52.h +++ b/apps/codecs/liba52/a52.h @@ -56,11 +56,11 @@ typedef struct a52_state_s a52_state_t; a52_state_t * a52_init (uint32_t mm_accel); sample_t * a52_samples (a52_state_t * state); int a52_syncinfo (uint8_t * buf, int * flags, - int * sample_rate, int * bit_rate); + int * sample_rate, int * bit_rate); int a52_frame (a52_state_t * state, uint8_t * buf, int * flags, - level_t * level, sample_t bias); + level_t * level, sample_t bias); void a52_dynrng (a52_state_t * state, - level_t (* call) (level_t, void *), void * data); + level_t (* call) (level_t, void *), void * data); int a52_block (a52_state_t * state); void a52_free (a52_state_t * state); diff --git a/apps/codecs/liba52/a52_internal.h b/apps/codecs/liba52/a52_internal.h index 1e3b4a7edf..48f23836f7 100644 --- a/apps/codecs/liba52/a52_internal.h +++ b/apps/codecs/liba52/a52_internal.h @@ -22,62 +22,62 @@ */ typedef struct { - uint8_t bai; /* fine SNR offset, fast gain */ - uint8_t deltbae; /* delta bit allocation exists */ - int8_t deltba[50]; /* per-band delta bit allocation */ + uint8_t bai; /* fine SNR offset, fast gain */ + uint8_t deltbae; /* delta bit allocation exists */ + int8_t deltba[50]; /* per-band delta bit allocation */ } ba_t; typedef struct { - uint8_t exp[256]; /* decoded channel exponents */ - int8_t bap[256]; /* derived channel bit allocation */ + uint8_t exp[256]; /* decoded channel exponents */ + int8_t bap[256]; /* derived channel bit allocation */ } expbap_t; struct a52_state_s { - uint8_t fscod; /* sample rate */ - uint8_t halfrate; /* halfrate factor */ - uint8_t acmod; /* coded channels */ - uint8_t lfeon; /* coded lfe channel */ - level_t clev; /* centre channel mix level */ - level_t slev; /* surround channels mix level */ - - int output; /* type of output */ - level_t level; /* output level */ - sample_t bias; /* output bias */ - - int dynrnge; /* apply dynamic range */ - level_t dynrng; /* dynamic range */ - void * dynrngdata; /* dynamic range callback funtion and data */ + uint8_t fscod; /* sample rate */ + uint8_t halfrate; /* halfrate factor */ + uint8_t acmod; /* coded channels */ + uint8_t lfeon; /* coded lfe channel */ + level_t clev; /* centre channel mix level */ + level_t slev; /* surround channels mix level */ + + int output; /* type of output */ + level_t level; /* output level */ + sample_t bias; /* output bias */ + + int dynrnge; /* apply dynamic range */ + level_t dynrng; /* dynamic range */ + void * dynrngdata; /* dynamic range callback funtion and data */ level_t (* dynrngcall) (level_t range, void * dynrngdata); - uint8_t chincpl; /* channel coupled */ - uint8_t phsflginu; /* phase flags in use (stereo only) */ - uint8_t cplstrtmant; /* coupling channel start mantissa */ - uint8_t cplendmant; /* coupling channel end mantissa */ - uint32_t cplbndstrc; /* coupling band structure */ - level_t cplco[5][18]; /* coupling coordinates */ + uint8_t chincpl; /* channel coupled */ + uint8_t phsflginu; /* phase flags in use (stereo only) */ + uint8_t cplstrtmant; /* coupling channel start mantissa */ + uint8_t cplendmant; /* coupling channel end mantissa */ + uint32_t cplbndstrc; /* coupling band structure */ + level_t cplco[5][18]; /* coupling coordinates */ /* derived information */ - uint8_t cplstrtbnd; /* coupling start band (for bit allocation) */ - uint8_t ncplbnd; /* number of coupling bands */ + uint8_t cplstrtbnd; /* coupling start band (for bit allocation) */ + uint8_t ncplbnd; /* number of coupling bands */ - uint8_t rematflg; /* stereo rematrixing */ + uint8_t rematflg; /* stereo rematrixing */ - uint8_t endmant[5]; /* channel end mantissa */ + uint8_t endmant[5]; /* channel end mantissa */ - uint16_t bai; /* bit allocation information */ + uint16_t bai; /* bit allocation information */ uint32_t * buffer_start; - uint16_t lfsr_state; /* dither state */ + uint16_t lfsr_state; /* dither state */ uint32_t bits_left; uint32_t current_word; - uint8_t csnroffst; /* coarse SNR offset */ - ba_t cplba; /* coupling bit allocation parameters */ - ba_t ba[5]; /* channel bit allocation parameters */ - ba_t lfeba; /* lfe bit allocation parameters */ + uint8_t csnroffst; /* coarse SNR offset */ + ba_t cplba; /* coupling bit allocation parameters */ + ba_t ba[5]; /* channel bit allocation parameters */ + ba_t lfeba; /* lfe bit allocation parameters */ - uint8_t cplfleak; /* coupling fast leak init */ - uint8_t cplsleak; /* coupling slow leak init */ + uint8_t cplfleak; /* coupling fast leak init */ + uint8_t cplsleak; /* coupling slow leak init */ expbap_t cpl_expbap; expbap_t fbw_expbap[5]; @@ -104,15 +104,15 @@ struct a52_state_s { #define DELTA_BIT_RESERVED (3) void a52_bit_allocate (a52_state_t * state, ba_t * ba, int bndstart, - int start, int end, int fastleak, int slowleak, - expbap_t * expbap); + int start, int end, int fastleak, int slowleak, + expbap_t * expbap); int a52_downmix_init (int input, int flags, level_t * level, - level_t clev, level_t slev); + level_t clev, level_t slev); int a52_downmix_coeff (level_t * coeff, int acmod, int output, level_t level, - level_t clev, level_t slev); + level_t clev, level_t slev); void a52_downmix (sample_t * samples, int acmod, int output, - level_t clev, level_t slev); + level_t clev, level_t slev); void a52_upmix (sample_t * samples, int acmod, int output); void a52_imdct_init (uint32_t mm_accel); diff --git a/apps/codecs/liba52/bit_allocate.c b/apps/codecs/liba52/bit_allocate.c index f72cd75f0a..3f68c92c0c 100644 --- a/apps/codecs/liba52/bit_allocate.c +++ b/apps/codecs/liba52/bit_allocate.c @@ -52,7 +52,7 @@ static int8_t baptab[305] IDATA_ATTR = { 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* 93 padding elems */ + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* 93 padding elems */ 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 14, 14, 14, 14, 14, 14, 14, 12, 12, 12, 12, 11, 11, 11, 11, 10, 10, 10, 10, 9, 9, 9, @@ -68,12 +68,12 @@ static int8_t baptab[305] IDATA_ATTR = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0 /* 148 padding elems */ + 0, 0, 0, 0 /* 148 padding elems */ }; static int bndtab[30] IDATA_ATTR = {21, 22, 23, 24, 25, 26, 27, 28, 31, 34, - 37, 40, 43, 46, 49, 55, 61, 67, 73, 79, - 85, 97, 109, 121, 133, 157, 181, 205, 229, 253}; + 37, 40, 43, 46, 49, 55, 61, 67, 73, 79, + 85, 97, 109, 121, 133, 157, 181, 205, 229, 253}; static int8_t latab[256] IDATA_ATTR = { -64, -63, -62, -61, -60, -59, -58, -57, -56, -55, -54, -53, @@ -100,35 +100,35 @@ static int8_t latab[256] IDATA_ATTR = { 0, 0, 0, 0 }; -#define UPDATE_LEAK() \ -do { \ - fastleak += fdecay; \ - if (fastleak > psd + fgain) \ - fastleak = psd + fgain; \ - slowleak += sdecay; \ - if (slowleak > psd + sgain) \ - slowleak = psd + sgain; \ +#define UPDATE_LEAK() \ +do { \ + fastleak += fdecay; \ + if (fastleak > psd + fgain) \ + fastleak = psd + fgain; \ + slowleak += sdecay; \ + if (slowleak > psd + sgain) \ + slowleak = psd + sgain; \ } while (0) -#define COMPUTE_MASK() \ -do { \ - if (psd > dbknee) \ - mask -= (psd - dbknee) >> 2; \ - if (mask > hth [i >> halfrate]) \ - mask = hth [i >> halfrate]; \ - mask -= snroffset + 128 * deltba[i]; \ - mask = (mask > 0) ? 0 : ((-mask) >> 5); \ - mask -= floor; \ +#define COMPUTE_MASK() \ +do { \ + if (psd > dbknee) \ + mask -= (psd - dbknee) >> 2; \ + if (mask > hth [i >> halfrate]) \ + mask = hth [i >> halfrate]; \ + mask -= snroffset + 128 * deltba[i]; \ + mask = (mask > 0) ? 0 : ((-mask) >> 5); \ + mask -= floor; \ } while (0) void a52_bit_allocate (a52_state_t * state, ba_t * ba, int bndstart, - int start, int end, int fastleak, int slowleak, - expbap_t * expbap) + int start, int end, int fastleak, int slowleak, + expbap_t * expbap) { static int slowgain[4] = {0x540, 0x4d8, 0x478, 0x410}; static int dbpbtab[4] = {0xc00, 0x500, 0x300, 0x100}; static int floortab[8] = {0x910, 0x950, 0x990, 0x9d0, - 0xa10, 0xa90, 0xb10, 0x1400}; + 0xa10, 0xa90, 0xb10, 0x1400}; int i, j; uint8_t * exp; @@ -140,18 +140,18 @@ void a52_bit_allocate (a52_state_t * state, ba_t * ba, int bndstart, int halfrate; halfrate = state->halfrate; - fdecay = (63 + 20 * ((state->bai >> 7) & 3)) >> halfrate; /* fdcycod */ - fgain = 128 + 128 * (ba->bai & 7); /* fgaincod */ - sdecay = (15 + 2 * (state->bai >> 9)) >> halfrate; /* sdcycod */ - sgain = slowgain[(state->bai >> 5) & 3]; /* sgaincod */ - dbknee = dbpbtab[(state->bai >> 3) & 3]; /* dbpbcod */ + fdecay = (63 + 20 * ((state->bai >> 7) & 3)) >> halfrate; /* fdcycod */ + fgain = 128 + 128 * (ba->bai & 7); /* fgaincod */ + sdecay = (15 + 2 * (state->bai >> 9)) >> halfrate; /* sdcycod */ + sgain = slowgain[(state->bai >> 5) & 3]; /* sgaincod */ + dbknee = dbpbtab[(state->bai >> 3) & 3]; /* dbpbcod */ hth = hthtab[state->fscod]; /* * if there is no delta bit allocation, make deltba point to an area * known to contain zeroes. baptab+156 here. */ deltba = (ba->deltbae == DELTA_BIT_NONE) ? baptab + 156 : ba->deltba; - floor = floortab[state->bai & 7]; /* floorcod */ + floor = floortab[state->bai & 7]; /* floorcod */ snroffset = 960 - 64 * state->csnroffst - 4 * (ba->bai >> 3) + floor; floor >>= 5; @@ -160,106 +160,106 @@ void a52_bit_allocate (a52_state_t * state, ba_t * ba, int bndstart, i = bndstart; j = start; - if (start == 0) { /* not the coupling channel */ - int lowcomp; + if (start == 0) { /* not the coupling channel */ + int lowcomp; - lowcomp = 0; - j = end - 1; - do { - if (i < j) { - if (exp[i+1] == exp[i] - 2) - lowcomp = 384; - else if (lowcomp && (exp[i+1] > exp[i])) - lowcomp -= 64; - } - psd = 128 * exp[i]; - mask = psd + fgain + lowcomp; - COMPUTE_MASK (); - bap[i] = (baptab+156)[mask + 4 * exp[i]]; - i++; - } while ((i < 3) || ((i < 7) && (exp[i] > exp[i-1]))); - fastleak = psd + fgain; - slowleak = psd + sgain; + lowcomp = 0; + j = end - 1; + do { + if (i < j) { + if (exp[i+1] == exp[i] - 2) + lowcomp = 384; + else if (lowcomp && (exp[i+1] > exp[i])) + lowcomp -= 64; + } + psd = 128 * exp[i]; + mask = psd + fgain + lowcomp; + COMPUTE_MASK (); + bap[i] = (baptab+156)[mask + 4 * exp[i]]; + i++; + } while ((i < 3) || ((i < 7) && (exp[i] > exp[i-1]))); + fastleak = psd + fgain; + slowleak = psd + sgain; - while (i < 7) { - if (i < j) { - if (exp[i+1] == exp[i] - 2) - lowcomp = 384; - else if (lowcomp && (exp[i+1] > exp[i])) - lowcomp -= 64; - } - psd = 128 * exp[i]; - UPDATE_LEAK (); - mask = ((fastleak + lowcomp < slowleak) ? - fastleak + lowcomp : slowleak); - COMPUTE_MASK (); - bap[i] = (baptab+156)[mask + 4 * exp[i]]; - i++; - } + while (i < 7) { + if (i < j) { + if (exp[i+1] == exp[i] - 2) + lowcomp = 384; + else if (lowcomp && (exp[i+1] > exp[i])) + lowcomp -= 64; + } + psd = 128 * exp[i]; + UPDATE_LEAK (); + mask = ((fastleak + lowcomp < slowleak) ? + fastleak + lowcomp : slowleak); + COMPUTE_MASK (); + bap[i] = (baptab+156)[mask + 4 * exp[i]]; + i++; + } - if (end == 7) /* lfe channel */ - return; + if (end == 7) /* lfe channel */ + return; - do { - if (exp[i+1] == exp[i] - 2) - lowcomp = 320; - else if (lowcomp && (exp[i+1] > exp[i])) - lowcomp -= 64; - psd = 128 * exp[i]; - UPDATE_LEAK (); - mask = ((fastleak + lowcomp < slowleak) ? - fastleak + lowcomp : slowleak); - COMPUTE_MASK (); - bap[i] = (baptab+156)[mask + 4 * exp[i]]; - i++; - } while (i < 20); + do { + if (exp[i+1] == exp[i] - 2) + lowcomp = 320; + else if (lowcomp && (exp[i+1] > exp[i])) + lowcomp -= 64; + psd = 128 * exp[i]; + UPDATE_LEAK (); + mask = ((fastleak + lowcomp < slowleak) ? + fastleak + lowcomp : slowleak); + COMPUTE_MASK (); + bap[i] = (baptab+156)[mask + 4 * exp[i]]; + i++; + } while (i < 20); - while (lowcomp > 128) { /* two iterations maximum */ - lowcomp -= 128; - psd = 128 * exp[i]; - UPDATE_LEAK (); - mask = ((fastleak + lowcomp < slowleak) ? - fastleak + lowcomp : slowleak); - COMPUTE_MASK (); - bap[i] = (baptab+156)[mask + 4 * exp[i]]; - i++; - } - j = i; + while (lowcomp > 128) { /* two iterations maximum */ + lowcomp -= 128; + psd = 128 * exp[i]; + UPDATE_LEAK (); + mask = ((fastleak + lowcomp < slowleak) ? + fastleak + lowcomp : slowleak); + COMPUTE_MASK (); + bap[i] = (baptab+156)[mask + 4 * exp[i]]; + i++; + } + j = i; } do { - int startband, endband; + int startband, endband; - startband = j; - endband = (bndtab[i-20] < end) ? bndtab[i-20] : end; - psd = 128 * exp[j++]; - while (j < endband) { - int next, delta; + startband = j; + endband = (bndtab[i-20] < end) ? bndtab[i-20] : end; + psd = 128 * exp[j++]; + while (j < endband) { + int next, delta; - next = 128 * exp[j++]; - delta = next - psd; - switch (delta >> 9) { - case -6: case -5: case -4: case -3: case -2: - psd = next; - break; - case -1: - psd = next + latab[(-delta) >> 1]; - break; - case 0: - psd += latab[delta >> 1]; - break; - } - } - /* minpsd = -289 */ - UPDATE_LEAK (); - mask = (fastleak < slowleak) ? fastleak : slowleak; - COMPUTE_MASK (); - i++; - j = startband; - do { - /* max(mask+4*exp)=147=-(minpsd+fgain-deltba-snroffset)>>5+4*exp */ - /* min(mask+4*exp)=-156=-(sgain-deltba-snroffset)>>5 */ - bap[j] = (baptab+156)[mask + 4 * exp[j]]; - } while (++j < endband); + next = 128 * exp[j++]; + delta = next - psd; + switch (delta >> 9) { + case -6: case -5: case -4: case -3: case -2: + psd = next; + break; + case -1: + psd = next + latab[(-delta) >> 1]; + break; + case 0: + psd += latab[delta >> 1]; + break; + } + } + /* minpsd = -289 */ + UPDATE_LEAK (); + mask = (fastleak < slowleak) ? fastleak : slowleak; + COMPUTE_MASK (); + i++; + j = startband; + do { + /* max(mask+4*exp)=147=-(minpsd+fgain-deltba-snroffset)>>5+4*exp */ + /* min(mask+4*exp)=-156=-(sgain-deltba-snroffset)>>5 */ + bap[j] = (baptab+156)[mask + 4 * exp[j]]; + } while (++j < endband); } while (j < end); } diff --git a/apps/codecs/liba52/bitstream.c b/apps/codecs/liba52/bitstream.c index 231654939a..f9f3ad76b0 100644 --- a/apps/codecs/liba52/bitstream.c +++ b/apps/codecs/liba52/bitstream.c @@ -40,7 +40,7 @@ void a52_bitstream_set_ptr (a52_state_t * state, uint8_t * buf) state->bits_left = 0; state->current_word = 0; bitstream_get (state, align * 8); - bitstream_get_2 (state, 0); /* pretend function is used - keep gcc happy */ + bitstream_get_2 (state, 0); /* pretend function is used - keep gcc happy */ } static inline void bitstream_fill_current (a52_state_t * state) @@ -66,12 +66,12 @@ uint32_t a52_bitstream_get_bh (a52_state_t * state, uint32_t num_bits) num_bits -= state->bits_left; result = ((state->current_word << (32 - state->bits_left)) >> - (32 - state->bits_left)); + (32 - state->bits_left)); bitstream_fill_current (state); if (num_bits != 0) - result = (result << num_bits) | (state->current_word >> (32 - num_bits)); + result = (result << num_bits) | (state->current_word >> (32 - num_bits)); state->bits_left = 32 - num_bits; @@ -84,13 +84,13 @@ int32_t a52_bitstream_get_bh_2 (a52_state_t * state, uint32_t num_bits) num_bits -= state->bits_left; result = ((((int32_t)state->current_word) << (32 - state->bits_left)) >> - (32 - state->bits_left)); + (32 - state->bits_left)); bitstream_fill_current(state); if (num_bits != 0) - result = (result << num_bits) | (state->current_word >> (32 - num_bits)); - + result = (result << num_bits) | (state->current_word >> (32 - num_bits)); + state->bits_left = 32 - num_bits; return result; diff --git a/apps/codecs/liba52/bitstream.h b/apps/codecs/liba52/bitstream.h index 88f8fc4660..c316a971b5 100644 --- a/apps/codecs/liba52/bitstream.h +++ b/apps/codecs/liba52/bitstream.h @@ -30,11 +30,11 @@ int32_t a52_bitstream_get_bh_2 (a52_state_t * state, uint32_t num_bits); static inline uint32_t bitstream_get (a52_state_t * state, uint32_t num_bits) { uint32_t result; - + if (num_bits < state->bits_left) { - result = (state->current_word << (32 - state->bits_left)) >> (32 - num_bits); - state->bits_left -= num_bits; - return result; + result = (state->current_word << (32 - state->bits_left)) >> (32 - num_bits); + state->bits_left -= num_bits; + return result; } return a52_bitstream_get_bh (state, num_bits); @@ -43,11 +43,11 @@ static inline uint32_t bitstream_get (a52_state_t * state, uint32_t num_bits) static inline int32_t bitstream_get_2 (a52_state_t * state, uint32_t num_bits) { int32_t result; - + if (num_bits < state->bits_left) { - result = (((int32_t)state->current_word) << (32 - state->bits_left)) >> (32 - num_bits); - state->bits_left -= num_bits; - return result; + result = (((int32_t)state->current_word) << (32 - state->bits_left)) >> (32 - num_bits); + state->bits_left -= num_bits; + return result; } return a52_bitstream_get_bh_2 (state, num_bits); diff --git a/apps/codecs/liba52/downmix.c b/apps/codecs/liba52/downmix.c index 2e8567bceb..b9506de8c1 100644 --- a/apps/codecs/liba52/downmix.c +++ b/apps/codecs/liba52/downmix.c @@ -32,135 +32,135 @@ #define CONVERT(acmod,output) (((output) << 3) + (acmod)) int a52_downmix_init (int input, int flags, level_t * level, - level_t clev, level_t slev) + level_t clev, level_t slev) { static uint8_t table[11][8] = { - {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_STEREO, - A52_STEREO, A52_STEREO, A52_STEREO, A52_STEREO}, - {A52_MONO, A52_MONO, A52_MONO, A52_MONO, - A52_MONO, A52_MONO, A52_MONO, A52_MONO}, - {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_STEREO, - A52_STEREO, A52_STEREO, A52_STEREO, A52_STEREO}, - {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_3F, - A52_STEREO, A52_3F, A52_STEREO, A52_3F}, - {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_STEREO, - A52_2F1R, A52_2F1R, A52_2F1R, A52_2F1R}, - {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_STEREO, - A52_2F1R, A52_3F1R, A52_2F1R, A52_3F1R}, - {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_3F, - A52_2F2R, A52_2F2R, A52_2F2R, A52_2F2R}, - {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_3F, - A52_2F2R, A52_3F2R, A52_2F2R, A52_3F2R}, - {A52_CHANNEL1, A52_MONO, A52_MONO, A52_MONO, - A52_MONO, A52_MONO, A52_MONO, A52_MONO}, - {A52_CHANNEL2, A52_MONO, A52_MONO, A52_MONO, - A52_MONO, A52_MONO, A52_MONO, A52_MONO}, - {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_DOLBY, - A52_DOLBY, A52_DOLBY, A52_DOLBY, A52_DOLBY} + {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_STEREO, + A52_STEREO, A52_STEREO, A52_STEREO, A52_STEREO}, + {A52_MONO, A52_MONO, A52_MONO, A52_MONO, + A52_MONO, A52_MONO, A52_MONO, A52_MONO}, + {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_STEREO, + A52_STEREO, A52_STEREO, A52_STEREO, A52_STEREO}, + {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_3F, + A52_STEREO, A52_3F, A52_STEREO, A52_3F}, + {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_STEREO, + A52_2F1R, A52_2F1R, A52_2F1R, A52_2F1R}, + {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_STEREO, + A52_2F1R, A52_3F1R, A52_2F1R, A52_3F1R}, + {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_3F, + A52_2F2R, A52_2F2R, A52_2F2R, A52_2F2R}, + {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_3F, + A52_2F2R, A52_3F2R, A52_2F2R, A52_3F2R}, + {A52_CHANNEL1, A52_MONO, A52_MONO, A52_MONO, + A52_MONO, A52_MONO, A52_MONO, A52_MONO}, + {A52_CHANNEL2, A52_MONO, A52_MONO, A52_MONO, + A52_MONO, A52_MONO, A52_MONO, A52_MONO}, + {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_DOLBY, + A52_DOLBY, A52_DOLBY, A52_DOLBY, A52_DOLBY} }; int output; output = flags & A52_CHANNEL_MASK; if (output > A52_DOLBY) - return -1; + return -1; output = table[output][input & 7]; if (output == A52_STEREO && - (input == A52_DOLBY || (input == A52_3F && clev == LEVEL (LEVEL_3DB)))) - output = A52_DOLBY; + (input == A52_DOLBY || (input == A52_3F && clev == LEVEL (LEVEL_3DB)))) + output = A52_DOLBY; if (flags & A52_ADJUST_LEVEL) { - level_t adjust; - - switch (CONVERT (input & 7, output)) { - - case CONVERT (A52_3F, A52_MONO): - adjust = DIV (LEVEL_3DB, LEVEL (1) + clev); - break; - - case CONVERT (A52_STEREO, A52_MONO): - case CONVERT (A52_2F2R, A52_2F1R): - case CONVERT (A52_3F2R, A52_3F1R): - level_3db: - adjust = LEVEL (LEVEL_3DB); - break; - - case CONVERT (A52_3F2R, A52_2F1R): - if (clev < LEVEL (LEVEL_PLUS3DB - 1)) - goto level_3db; - /* break thru */ - case CONVERT (A52_3F, A52_STEREO): - case CONVERT (A52_3F1R, A52_2F1R): - case CONVERT (A52_3F1R, A52_2F2R): - case CONVERT (A52_3F2R, A52_2F2R): - adjust = DIV (1, LEVEL (1) + clev); - break; - - case CONVERT (A52_2F1R, A52_MONO): - adjust = DIV (LEVEL_PLUS3DB, LEVEL (2) + slev); - break; - - case CONVERT (A52_2F1R, A52_STEREO): - case CONVERT (A52_3F1R, A52_3F): - adjust = DIV (1, LEVEL (1) + MUL_C (slev, LEVEL_3DB)); - break; - - case CONVERT (A52_3F1R, A52_MONO): - adjust = DIV (LEVEL_3DB, LEVEL (1) + clev + MUL_C (slev, 0.5)); - break; - - case CONVERT (A52_3F1R, A52_STEREO): - adjust = DIV (1, LEVEL (1) + clev + MUL_C (slev, LEVEL_3DB)); - break; - - case CONVERT (A52_2F2R, A52_MONO): - adjust = DIV (LEVEL_3DB, LEVEL (1) + slev); - break; - - case CONVERT (A52_2F2R, A52_STEREO): - case CONVERT (A52_3F2R, A52_3F): - adjust = DIV (1, LEVEL (1) + slev); - break; - - case CONVERT (A52_3F2R, A52_MONO): - adjust = DIV (LEVEL_3DB, LEVEL (1) + clev + slev); - break; - - case CONVERT (A52_3F2R, A52_STEREO): - adjust = DIV (1, LEVEL (1) + clev + slev); - break; - - case CONVERT (A52_MONO, A52_DOLBY): - adjust = LEVEL (LEVEL_PLUS3DB); - break; - - case CONVERT (A52_3F, A52_DOLBY): - case CONVERT (A52_2F1R, A52_DOLBY): - adjust = LEVEL (1 / (1 + LEVEL_3DB)); - break; - - case CONVERT (A52_3F1R, A52_DOLBY): - case CONVERT (A52_2F2R, A52_DOLBY): - adjust = LEVEL (1 / (1 + 2 * LEVEL_3DB)); - break; - - case CONVERT (A52_3F2R, A52_DOLBY): - adjust = LEVEL (1 / (1 + 3 * LEVEL_3DB)); - break; - - default: - return output; - } - - *level = MUL_L (*level, adjust); + level_t adjust; + + switch (CONVERT (input & 7, output)) { + + case CONVERT (A52_3F, A52_MONO): + adjust = DIV (LEVEL_3DB, LEVEL (1) + clev); + break; + + case CONVERT (A52_STEREO, A52_MONO): + case CONVERT (A52_2F2R, A52_2F1R): + case CONVERT (A52_3F2R, A52_3F1R): + level_3db: + adjust = LEVEL (LEVEL_3DB); + break; + + case CONVERT (A52_3F2R, A52_2F1R): + if (clev < LEVEL (LEVEL_PLUS3DB - 1)) + goto level_3db; + /* break thru */ + case CONVERT (A52_3F, A52_STEREO): + case CONVERT (A52_3F1R, A52_2F1R): + case CONVERT (A52_3F1R, A52_2F2R): + case CONVERT (A52_3F2R, A52_2F2R): + adjust = DIV (1, LEVEL (1) + clev); + break; + + case CONVERT (A52_2F1R, A52_MONO): + adjust = DIV (LEVEL_PLUS3DB, LEVEL (2) + slev); + break; + + case CONVERT (A52_2F1R, A52_STEREO): + case CONVERT (A52_3F1R, A52_3F): + adjust = DIV (1, LEVEL (1) + MUL_C (slev, LEVEL_3DB)); + break; + + case CONVERT (A52_3F1R, A52_MONO): + adjust = DIV (LEVEL_3DB, LEVEL (1) + clev + MUL_C (slev, 0.5)); + break; + + case CONVERT (A52_3F1R, A52_STEREO): + adjust = DIV (1, LEVEL (1) + clev + MUL_C (slev, LEVEL_3DB)); + break; + + case CONVERT (A52_2F2R, A52_MONO): + adjust = DIV (LEVEL_3DB, LEVEL (1) + slev); + break; + + case CONVERT (A52_2F2R, A52_STEREO): + case CONVERT (A52_3F2R, A52_3F): + adjust = DIV (1, LEVEL (1) + slev); + break; + + case CONVERT (A52_3F2R, A52_MONO): + adjust = DIV (LEVEL_3DB, LEVEL (1) + clev + slev); + break; + + case CONVERT (A52_3F2R, A52_STEREO): + adjust = DIV (1, LEVEL (1) + clev + slev); + break; + + case CONVERT (A52_MONO, A52_DOLBY): + adjust = LEVEL (LEVEL_PLUS3DB); + break; + + case CONVERT (A52_3F, A52_DOLBY): + case CONVERT (A52_2F1R, A52_DOLBY): + adjust = LEVEL (1 / (1 + LEVEL_3DB)); + break; + + case CONVERT (A52_3F1R, A52_DOLBY): + case CONVERT (A52_2F2R, A52_DOLBY): + adjust = LEVEL (1 / (1 + 2 * LEVEL_3DB)); + break; + + case CONVERT (A52_3F2R, A52_DOLBY): + adjust = LEVEL (1 / (1 + 3 * LEVEL_3DB)); + break; + + default: + return output; + } + + *level = MUL_L (*level, adjust); } return output; } int a52_downmix_coeff (level_t * coeff, int acmod, int output, level_t level, - level_t clev, level_t slev) + level_t clev, level_t slev) { level_t level_3db; @@ -177,156 +177,156 @@ int a52_downmix_coeff (level_t * coeff, int acmod, int output, level_t level, case CONVERT (A52_2F2R, A52_2F2R): case CONVERT (A52_3F2R, A52_3F2R): case CONVERT (A52_STEREO, A52_DOLBY): - coeff[0] = coeff[1] = coeff[2] = coeff[3] = coeff[4] = level; - return 0; + coeff[0] = coeff[1] = coeff[2] = coeff[3] = coeff[4] = level; + return 0; case CONVERT (A52_CHANNEL, A52_MONO): - coeff[0] = coeff[1] = MUL_C (level, LEVEL_6DB); - return 3; + coeff[0] = coeff[1] = MUL_C (level, LEVEL_6DB); + return 3; case CONVERT (A52_STEREO, A52_MONO): - coeff[0] = coeff[1] = level_3db; - return 3; + coeff[0] = coeff[1] = level_3db; + return 3; case CONVERT (A52_3F, A52_MONO): - coeff[0] = coeff[2] = level_3db; - coeff[1] = MUL_C (MUL_L (level_3db, clev), LEVEL_PLUS6DB); - return 7; + coeff[0] = coeff[2] = level_3db; + coeff[1] = MUL_C (MUL_L (level_3db, clev), LEVEL_PLUS6DB); + return 7; case CONVERT (A52_2F1R, A52_MONO): - coeff[0] = coeff[1] = level_3db; - coeff[2] = MUL_L (level_3db, slev); - return 7; + coeff[0] = coeff[1] = level_3db; + coeff[2] = MUL_L (level_3db, slev); + return 7; case CONVERT (A52_2F2R, A52_MONO): - coeff[0] = coeff[1] = level_3db; - coeff[2] = coeff[3] = MUL_L (level_3db, slev); - return 15; + coeff[0] = coeff[1] = level_3db; + coeff[2] = coeff[3] = MUL_L (level_3db, slev); + return 15; case CONVERT (A52_3F1R, A52_MONO): - coeff[0] = coeff[2] = level_3db; - coeff[1] = MUL_C (MUL_L (level_3db, clev), LEVEL_PLUS6DB); - coeff[3] = MUL_L (level_3db, slev); - return 15; + coeff[0] = coeff[2] = level_3db; + coeff[1] = MUL_C (MUL_L (level_3db, clev), LEVEL_PLUS6DB); + coeff[3] = MUL_L (level_3db, slev); + return 15; case CONVERT (A52_3F2R, A52_MONO): - coeff[0] = coeff[2] = level_3db; - coeff[1] = MUL_C (MUL_L (level_3db, clev), LEVEL_PLUS6DB); - coeff[3] = coeff[4] = MUL_L (level_3db, slev); - return 31; + coeff[0] = coeff[2] = level_3db; + coeff[1] = MUL_C (MUL_L (level_3db, clev), LEVEL_PLUS6DB); + coeff[3] = coeff[4] = MUL_L (level_3db, slev); + return 31; case CONVERT (A52_MONO, A52_DOLBY): - coeff[0] = level_3db; - return 0; + coeff[0] = level_3db; + return 0; case CONVERT (A52_3F, A52_DOLBY): - coeff[0] = coeff[2] = coeff[3] = coeff[4] = level; - coeff[1] = level_3db; - return 7; + coeff[0] = coeff[2] = coeff[3] = coeff[4] = level; + coeff[1] = level_3db; + return 7; case CONVERT (A52_3F, A52_STEREO): case CONVERT (A52_3F1R, A52_2F1R): case CONVERT (A52_3F2R, A52_2F2R): - coeff[0] = coeff[2] = coeff[3] = coeff[4] = level; - coeff[1] = MUL_L (level, clev); - return 7; + coeff[0] = coeff[2] = coeff[3] = coeff[4] = level; + coeff[1] = MUL_L (level, clev); + return 7; case CONVERT (A52_2F1R, A52_DOLBY): - coeff[0] = coeff[1] = level; - coeff[2] = level_3db; - return 7; + coeff[0] = coeff[1] = level; + coeff[2] = level_3db; + return 7; case CONVERT (A52_2F1R, A52_STEREO): - coeff[0] = coeff[1] = level; - coeff[2] = MUL_L (level_3db, slev); - return 7; + coeff[0] = coeff[1] = level; + coeff[2] = MUL_L (level_3db, slev); + return 7; case CONVERT (A52_3F1R, A52_DOLBY): - coeff[0] = coeff[2] = level; - coeff[1] = coeff[3] = level_3db; - return 15; + coeff[0] = coeff[2] = level; + coeff[1] = coeff[3] = level_3db; + return 15; case CONVERT (A52_3F1R, A52_STEREO): - coeff[0] = coeff[2] = level; - coeff[1] = MUL_L (level, clev); - coeff[3] = MUL_L (level_3db, slev); - return 15; + coeff[0] = coeff[2] = level; + coeff[1] = MUL_L (level, clev); + coeff[3] = MUL_L (level_3db, slev); + return 15; case CONVERT (A52_2F2R, A52_DOLBY): - coeff[0] = coeff[1] = level; - coeff[2] = coeff[3] = level_3db; - return 15; + coeff[0] = coeff[1] = level; + coeff[2] = coeff[3] = level_3db; + return 15; case CONVERT (A52_2F2R, A52_STEREO): - coeff[0] = coeff[1] = level; - coeff[2] = coeff[3] = MUL_L (level, slev); - return 15; + coeff[0] = coeff[1] = level; + coeff[2] = coeff[3] = MUL_L (level, slev); + return 15; case CONVERT (A52_3F2R, A52_DOLBY): - coeff[0] = coeff[2] = level; - coeff[1] = coeff[3] = coeff[4] = level_3db; - return 31; + coeff[0] = coeff[2] = level; + coeff[1] = coeff[3] = coeff[4] = level_3db; + return 31; case CONVERT (A52_3F2R, A52_2F1R): - coeff[0] = coeff[2] = level; - coeff[1] = MUL_L (level, clev); - coeff[3] = coeff[4] = level_3db; - return 31; + coeff[0] = coeff[2] = level; + coeff[1] = MUL_L (level, clev); + coeff[3] = coeff[4] = level_3db; + return 31; case CONVERT (A52_3F2R, A52_STEREO): - coeff[0] = coeff[2] = level; - coeff[1] = MUL_L (level, clev); - coeff[3] = coeff[4] = MUL_L (level, slev); - return 31; + coeff[0] = coeff[2] = level; + coeff[1] = MUL_L (level, clev); + coeff[3] = coeff[4] = MUL_L (level, slev); + return 31; case CONVERT (A52_3F1R, A52_3F): - coeff[0] = coeff[1] = coeff[2] = level; - coeff[3] = MUL_L (level_3db, slev); - return 13; + coeff[0] = coeff[1] = coeff[2] = level; + coeff[3] = MUL_L (level_3db, slev); + return 13; case CONVERT (A52_3F2R, A52_3F): - coeff[0] = coeff[1] = coeff[2] = level; - coeff[3] = coeff[4] = MUL_L (level, slev); - return 29; + coeff[0] = coeff[1] = coeff[2] = level; + coeff[3] = coeff[4] = MUL_L (level, slev); + return 29; case CONVERT (A52_2F2R, A52_2F1R): - coeff[0] = coeff[1] = level; - coeff[2] = coeff[3] = level_3db; - return 12; + coeff[0] = coeff[1] = level; + coeff[2] = coeff[3] = level_3db; + return 12; case CONVERT (A52_3F2R, A52_3F1R): - coeff[0] = coeff[1] = coeff[2] = level; - coeff[3] = coeff[4] = level_3db; - return 24; + coeff[0] = coeff[1] = coeff[2] = level; + coeff[3] = coeff[4] = level_3db; + return 24; case CONVERT (A52_2F1R, A52_2F2R): - coeff[0] = coeff[1] = level; - coeff[2] = level_3db; - return 0; + coeff[0] = coeff[1] = level; + coeff[2] = level_3db; + return 0; case CONVERT (A52_3F1R, A52_2F2R): - coeff[0] = coeff[2] = level; - coeff[1] = MUL_L (level, clev); - coeff[3] = level_3db; - return 7; + coeff[0] = coeff[2] = level; + coeff[1] = MUL_L (level, clev); + coeff[3] = level_3db; + return 7; case CONVERT (A52_3F1R, A52_3F2R): - coeff[0] = coeff[1] = coeff[2] = level; - coeff[3] = level_3db; - return 0; + coeff[0] = coeff[1] = coeff[2] = level; + coeff[3] = level_3db; + return 0; case CONVERT (A52_CHANNEL, A52_CHANNEL1): - coeff[0] = level; - coeff[1] = 0; - return 0; + coeff[0] = level; + coeff[1] = 0; + return 0; case CONVERT (A52_CHANNEL, A52_CHANNEL2): - coeff[0] = 0; - coeff[1] = level; - return 0; + coeff[0] = 0; + coeff[1] = level; + return 0; } - return -1; /* NOTREACHED */ + return -1; /* NOTREACHED */ } static void mix2to1 (sample_t * dest, sample_t * src) @@ -334,7 +334,7 @@ static void mix2to1 (sample_t * dest, sample_t * src) int i; for (i = 0; i < 256; i++) - dest[i] += BIAS (src[i]); + dest[i] += BIAS (src[i]); } static void mix3to1 (sample_t * samples) @@ -342,7 +342,7 @@ static void mix3to1 (sample_t * samples) int i; for (i = 0; i < 256; i++) - samples[i] += BIAS (samples[i + 256] + samples[i + 512]); + samples[i] += BIAS (samples[i + 256] + samples[i + 512]); } static void mix4to1 (sample_t * samples) @@ -350,8 +350,8 @@ static void mix4to1 (sample_t * samples) int i; for (i = 0; i < 256; i++) - samples[i] += BIAS (samples[i + 256] + samples[i + 512] + - samples[i + 768]); + samples[i] += BIAS (samples[i + 256] + samples[i + 512] + + samples[i + 768]); } static void mix5to1 (sample_t * samples) @@ -359,8 +359,8 @@ static void mix5to1 (sample_t * samples) int i; for (i = 0; i < 256; i++) - samples[i] += BIAS (samples[i + 256] + samples[i + 512] + - samples[i + 768] + samples[i + 1024]); + samples[i] += BIAS (samples[i + 256] + samples[i + 512] + + samples[i + 768] + samples[i + 1024]); } static void mix3to2 (sample_t * samples) @@ -369,9 +369,9 @@ static void mix3to2 (sample_t * samples) sample_t common; for (i = 0; i < 256; i++) { - common = BIAS (samples[i + 256]); - samples[i] += common; - samples[i + 256] = samples[i + 512] + common; + common = BIAS (samples[i + 256]); + samples[i] += common; + samples[i + 256] = samples[i + 512] + common; } } @@ -381,9 +381,9 @@ static void mix21to2 (sample_t * left, sample_t * right) sample_t common; for (i = 0; i < 256; i++) { - common = BIAS (right[i + 256]); - left[i] += common; - right[i] += common; + common = BIAS (right[i + 256]); + left[i] += common; + right[i] += common; } } @@ -393,9 +393,9 @@ static void mix21toS (sample_t * samples) sample_t surround; for (i = 0; i < 256; i++) { - surround = samples[i + 512]; - samples[i] += BIAS (-surround); - samples[i + 256] += BIAS (surround); + surround = samples[i + 512]; + samples[i] += BIAS (-surround); + samples[i + 256] += BIAS (surround); } } @@ -405,9 +405,9 @@ static void mix31to2 (sample_t * samples) sample_t common; for (i = 0; i < 256; i++) { - common = BIAS (samples[i + 256] + samples[i + 768]); - samples[i] += common; - samples[i + 256] = samples[i + 512] + common; + common = BIAS (samples[i + 256] + samples[i + 768]); + samples[i] += common; + samples[i + 256] = samples[i + 512] + common; } } @@ -417,10 +417,10 @@ static void mix31toS (sample_t * samples) sample_t common, surround; for (i = 0; i < 256; i++) { - common = BIAS (samples[i + 256]); - surround = samples[i + 768]; - samples[i] += common - surround; - samples[i + 256] = samples[i + 512] + common + surround; + common = BIAS (samples[i + 256]); + surround = samples[i + 768]; + samples[i] += common - surround; + samples[i + 256] = samples[i + 512] + common + surround; } } @@ -430,9 +430,9 @@ static void mix22toS (sample_t * samples) sample_t surround; for (i = 0; i < 256; i++) { - surround = samples[i + 512] + samples[i + 768]; - samples[i] += BIAS (-surround); - samples[i + 256] += BIAS (surround); + surround = samples[i + 512] + samples[i + 768]; + samples[i] += BIAS (-surround); + samples[i + 256] += BIAS (surround); } } @@ -442,9 +442,9 @@ static void mix32to2 (sample_t * samples) sample_t common; for (i = 0; i < 256; i++) { - common = BIAS (samples[i + 256]); - samples[i] += common + samples[i + 768]; - samples[i + 256] = common + samples[i + 512] + samples[i + 1024]; + common = BIAS (samples[i + 256]); + samples[i] += common + samples[i + 768]; + samples[i + 256] = common + samples[i + 512] + samples[i + 1024]; } } @@ -454,10 +454,10 @@ static void mix32toS (sample_t * samples) sample_t common, surround; for (i = 0; i < 256; i++) { - common = BIAS (samples[i + 256]); - surround = samples[i + 768] + samples[i + 1024]; - samples[i] += common - surround; - samples[i + 256] = samples[i + 512] + common + surround; + common = BIAS (samples[i + 256]); + surround = samples[i + 768] + samples[i + 1024]; + samples[i] += common - surround; + samples[i + 256] = samples[i + 512] + common + surround; } } @@ -466,7 +466,7 @@ static void move2to1 (sample_t * src, sample_t * dest) int i; for (i = 0; i < 256; i++) - dest[i] = BIAS (src[i] + src[i + 256]); + dest[i] = BIAS (src[i] + src[i + 256]); } static void zero (sample_t * samples) @@ -474,11 +474,11 @@ static void zero (sample_t * samples) int i; for (i = 0; i < 256; i++) - samples[i] = 0; + samples[i] = 0; } void a52_downmix (sample_t * samples, int acmod, int output, - level_t clev, level_t slev) + level_t clev, level_t slev) { /* avoid compiler warning */ (void)clev; @@ -486,138 +486,138 @@ void a52_downmix (sample_t * samples, int acmod, int output, switch (CONVERT (acmod, output & A52_CHANNEL_MASK)) { case CONVERT (A52_CHANNEL, A52_CHANNEL2): - memcpy (samples, samples + 256, 256 * sizeof (sample_t)); - break; + memcpy (samples, samples + 256, 256 * sizeof (sample_t)); + break; case CONVERT (A52_CHANNEL, A52_MONO): case CONVERT (A52_STEREO, A52_MONO): mix_2to1: - mix2to1 (samples, samples + 256); - break; + mix2to1 (samples, samples + 256); + break; case CONVERT (A52_2F1R, A52_MONO): - if (slev == 0) - goto mix_2to1; + if (slev == 0) + goto mix_2to1; case CONVERT (A52_3F, A52_MONO): mix_3to1: - mix3to1 (samples); - break; + mix3to1 (samples); + break; case CONVERT (A52_3F1R, A52_MONO): - if (slev == 0) - goto mix_3to1; + if (slev == 0) + goto mix_3to1; case CONVERT (A52_2F2R, A52_MONO): - if (slev == 0) - goto mix_2to1; - mix4to1 (samples); - break; + if (slev == 0) + goto mix_2to1; + mix4to1 (samples); + break; case CONVERT (A52_3F2R, A52_MONO): - if (slev == 0) - goto mix_3to1; - mix5to1 (samples); - break; + if (slev == 0) + goto mix_3to1; + mix5to1 (samples); + break; case CONVERT (A52_MONO, A52_DOLBY): - memcpy (samples + 256, samples, 256 * sizeof (sample_t)); - break; + memcpy (samples + 256, samples, 256 * sizeof (sample_t)); + break; case CONVERT (A52_3F, A52_STEREO): case CONVERT (A52_3F, A52_DOLBY): mix_3to2: - mix3to2 (samples); - break; + mix3to2 (samples); + break; case CONVERT (A52_2F1R, A52_STEREO): - if (slev == 0) - break; - mix21to2 (samples, samples + 256); - break; + if (slev == 0) + break; + mix21to2 (samples, samples + 256); + break; case CONVERT (A52_2F1R, A52_DOLBY): - mix21toS (samples); - break; + mix21toS (samples); + break; case CONVERT (A52_3F1R, A52_STEREO): - if (slev == 0) - goto mix_3to2; - mix31to2 (samples); - break; + if (slev == 0) + goto mix_3to2; + mix31to2 (samples); + break; case CONVERT (A52_3F1R, A52_DOLBY): - mix31toS (samples); - break; + mix31toS (samples); + break; case CONVERT (A52_2F2R, A52_STEREO): - if (slev == 0) - break; - mix2to1 (samples, samples + 512); - mix2to1 (samples + 256, samples + 768); - break; + if (slev == 0) + break; + mix2to1 (samples, samples + 512); + mix2to1 (samples + 256, samples + 768); + break; case CONVERT (A52_2F2R, A52_DOLBY): - mix22toS (samples); - break; + mix22toS (samples); + break; case CONVERT (A52_3F2R, A52_STEREO): - if (slev == 0) - goto mix_3to2; - mix32to2 (samples); - break; + if (slev == 0) + goto mix_3to2; + mix32to2 (samples); + break; case CONVERT (A52_3F2R, A52_DOLBY): - mix32toS (samples); - break; + mix32toS (samples); + break; case CONVERT (A52_3F1R, A52_3F): - if (slev == 0) - break; - mix21to2 (samples, samples + 512); - break; + if (slev == 0) + break; + mix21to2 (samples, samples + 512); + break; case CONVERT (A52_3F2R, A52_3F): - if (slev == 0) - break; - mix2to1 (samples, samples + 768); - mix2to1 (samples + 512, samples + 1024); - break; + if (slev == 0) + break; + mix2to1 (samples, samples + 768); + mix2to1 (samples + 512, samples + 1024); + break; case CONVERT (A52_3F1R, A52_2F1R): - mix3to2 (samples); - memcpy (samples + 512, samples + 768, 256 * sizeof (sample_t)); - break; + mix3to2 (samples); + memcpy (samples + 512, samples + 768, 256 * sizeof (sample_t)); + break; case CONVERT (A52_2F2R, A52_2F1R): - mix2to1 (samples + 512, samples + 768); - break; + mix2to1 (samples + 512, samples + 768); + break; case CONVERT (A52_3F2R, A52_2F1R): - mix3to2 (samples); - move2to1 (samples + 768, samples + 512); - break; + mix3to2 (samples); + move2to1 (samples + 768, samples + 512); + break; case CONVERT (A52_3F2R, A52_3F1R): - mix2to1 (samples + 768, samples + 1024); - break; + mix2to1 (samples + 768, samples + 1024); + break; case CONVERT (A52_2F1R, A52_2F2R): - memcpy (samples + 768, samples + 512, 256 * sizeof (sample_t)); - break; + memcpy (samples + 768, samples + 512, 256 * sizeof (sample_t)); + break; case CONVERT (A52_3F1R, A52_2F2R): - mix3to2 (samples); - memcpy (samples + 512, samples + 768, 256 * sizeof (sample_t)); - break; + mix3to2 (samples); + memcpy (samples + 512, samples + 768, 256 * sizeof (sample_t)); + break; case CONVERT (A52_3F2R, A52_2F2R): - mix3to2 (samples); - memcpy (samples + 512, samples + 768, 256 * sizeof (sample_t)); - memcpy (samples + 768, samples + 1024, 256 * sizeof (sample_t)); - break; + mix3to2 (samples); + memcpy (samples + 512, samples + 768, 256 * sizeof (sample_t)); + memcpy (samples + 768, samples + 1024, 256 * sizeof (sample_t)); + break; case CONVERT (A52_3F1R, A52_3F2R): - memcpy (samples + 1024, samples + 768, 256 * sizeof (sample_t)); - break; + memcpy (samples + 1024, samples + 768, 256 * sizeof (sample_t)); + break; } } @@ -626,63 +626,63 @@ void a52_upmix (sample_t * samples, int acmod, int output) switch (CONVERT (acmod, output & A52_CHANNEL_MASK)) { case CONVERT (A52_CHANNEL, A52_CHANNEL2): - memcpy (samples + 256, samples, 256 * sizeof (sample_t)); - break; + memcpy (samples + 256, samples, 256 * sizeof (sample_t)); + break; case CONVERT (A52_3F2R, A52_MONO): - zero (samples + 1024); + zero (samples + 1024); case CONVERT (A52_3F1R, A52_MONO): case CONVERT (A52_2F2R, A52_MONO): - zero (samples + 768); + zero (samples + 768); case CONVERT (A52_3F, A52_MONO): case CONVERT (A52_2F1R, A52_MONO): - zero (samples + 512); + zero (samples + 512); case CONVERT (A52_CHANNEL, A52_MONO): case CONVERT (A52_STEREO, A52_MONO): - zero (samples + 256); - break; + zero (samples + 256); + break; case CONVERT (A52_3F2R, A52_STEREO): case CONVERT (A52_3F2R, A52_DOLBY): - zero (samples + 1024); + zero (samples + 1024); case CONVERT (A52_3F1R, A52_STEREO): case CONVERT (A52_3F1R, A52_DOLBY): - zero (samples + 768); + zero (samples + 768); case CONVERT (A52_3F, A52_STEREO): case CONVERT (A52_3F, A52_DOLBY): mix_3to2: - memcpy (samples + 512, samples + 256, 256 * sizeof (sample_t)); - zero (samples + 256); - break; + memcpy (samples + 512, samples + 256, 256 * sizeof (sample_t)); + zero (samples + 256); + break; case CONVERT (A52_2F2R, A52_STEREO): case CONVERT (A52_2F2R, A52_DOLBY): - zero (samples + 768); + zero (samples + 768); case CONVERT (A52_2F1R, A52_STEREO): case CONVERT (A52_2F1R, A52_DOLBY): - zero (samples + 512); - break; + zero (samples + 512); + break; case CONVERT (A52_3F2R, A52_3F): - zero (samples + 1024); + zero (samples + 1024); case CONVERT (A52_3F1R, A52_3F): case CONVERT (A52_2F2R, A52_2F1R): - zero (samples + 768); - break; + zero (samples + 768); + break; case CONVERT (A52_3F2R, A52_3F1R): - zero (samples + 1024); - break; + zero (samples + 1024); + break; case CONVERT (A52_3F2R, A52_2F1R): - zero (samples + 1024); + zero (samples + 1024); case CONVERT (A52_3F1R, A52_2F1R): mix_31to21: - memcpy (samples + 768, samples + 512, 256 * sizeof (sample_t)); - goto mix_3to2; + memcpy (samples + 768, samples + 512, 256 * sizeof (sample_t)); + goto mix_3to2; case CONVERT (A52_3F2R, A52_2F2R): - memcpy (samples + 1024, samples + 768, 256 * sizeof (sample_t)); - goto mix_31to21; + memcpy (samples + 1024, samples + 768, 256 * sizeof (sample_t)); + goto mix_31to21; } } diff --git a/apps/codecs/liba52/imdct.c b/apps/codecs/liba52/imdct.c index 4483bd0667..9aaa9d85ad 100644 --- a/apps/codecs/liba52/imdct.c +++ b/apps/codecs/liba52/imdct.c @@ -114,73 +114,73 @@ static inline void ifft4 (complex_t * buf) */ /* basic radix-2 ifft butterfly */ -#define BUTTERFLY_0(t0,t1,W0,W1,d0,d1) do { \ - t0 = MUL (W1, d1) + MUL (W0, d0); \ - t1 = MUL (W0, d1) - MUL (W1, d0); \ +#define BUTTERFLY_0(t0,t1,W0,W1,d0,d1) do { \ + t0 = MUL (W1, d1) + MUL (W0, d0); \ + t1 = MUL (W0, d1) - MUL (W1, d0); \ } while (0) /* radix-2 ifft butterfly with bias */ -#define BUTTERFLY_B(t0,t1,W0,W1,d0,d1) do { \ - t0 = BIAS (MUL (d1, W1) + MUL (d0, W0)); \ - t1 = BIAS (MUL (d1, W0) - MUL (d0, W1)); \ +#define BUTTERFLY_B(t0,t1,W0,W1,d0,d1) do { \ + t0 = BIAS (MUL (d1, W1) + MUL (d0, W0)); \ + t1 = BIAS (MUL (d1, W0) - MUL (d0, W1)); \ } while (0) /* the basic split-radix ifft butterfly */ -#define BUTTERFLY(a0,a1,a2,a3,wr,wi) do { \ - BUTTERFLY_0 (tmp5, tmp6, wr, wi, a2.real, a2.imag); \ - BUTTERFLY_0 (tmp8, tmp7, wr, wi, a3.imag, a3.real); \ - tmp1 = tmp5 + tmp7; \ - tmp2 = tmp6 + tmp8; \ - tmp3 = tmp6 - tmp8; \ - tmp4 = tmp7 - tmp5; \ - a2.real = a0.real - tmp1; \ - a2.imag = a0.imag - tmp2; \ - a3.real = a1.real - tmp3; \ - a3.imag = a1.imag - tmp4; \ - a0.real += tmp1; \ - a0.imag += tmp2; \ - a1.real += tmp3; \ - a1.imag += tmp4; \ +#define BUTTERFLY(a0,a1,a2,a3,wr,wi) do { \ + BUTTERFLY_0 (tmp5, tmp6, wr, wi, a2.real, a2.imag); \ + BUTTERFLY_0 (tmp8, tmp7, wr, wi, a3.imag, a3.real); \ + tmp1 = tmp5 + tmp7; \ + tmp2 = tmp6 + tmp8; \ + tmp3 = tmp6 - tmp8; \ + tmp4 = tmp7 - tmp5; \ + a2.real = a0.real - tmp1; \ + a2.imag = a0.imag - tmp2; \ + a3.real = a1.real - tmp3; \ + a3.imag = a1.imag - tmp4; \ + a0.real += tmp1; \ + a0.imag += tmp2; \ + a1.real += tmp3; \ + a1.imag += tmp4; \ } while (0) /* split-radix ifft butterfly, specialized for wr=1 wi=0 */ -#define BUTTERFLY_ZERO(a0,a1,a2,a3) do { \ - tmp1 = a2.real + a3.real; \ - tmp2 = a2.imag + a3.imag; \ - tmp3 = a2.imag - a3.imag; \ - tmp4 = a3.real - a2.real; \ - a2.real = a0.real - tmp1; \ - a2.imag = a0.imag - tmp2; \ - a3.real = a1.real - tmp3; \ - a3.imag = a1.imag - tmp4; \ - a0.real += tmp1; \ - a0.imag += tmp2; \ - a1.real += tmp3; \ - a1.imag += tmp4; \ +#define BUTTERFLY_ZERO(a0,a1,a2,a3) do { \ + tmp1 = a2.real + a3.real; \ + tmp2 = a2.imag + a3.imag; \ + tmp3 = a2.imag - a3.imag; \ + tmp4 = a3.real - a2.real; \ + a2.real = a0.real - tmp1; \ + a2.imag = a0.imag - tmp2; \ + a3.real = a1.real - tmp3; \ + a3.imag = a1.imag - tmp4; \ + a0.real += tmp1; \ + a0.imag += tmp2; \ + a1.real += tmp3; \ + a1.imag += tmp4; \ } while (0) /* split-radix ifft butterfly, specialized for wr=wi */ /* -#define BUTTERFLY_HALF(a0,a1,a2,a3,w) do { \ - tmp5 = MUL (a2.real + a2.imag, w); \ - tmp6 = MUL (a2.imag - a2.real, w); \ - tmp7 = MUL (a3.real - a3.imag, w); \ - tmp8 = MUL (a3.imag + a3.real, w); \ - tmp1 = tmp5 + tmp7; \ - tmp2 = tmp6 + tmp8; \ - tmp3 = tmp6 - tmp8; \ - tmp4 = tmp7 - tmp5; \ - a2.real = a0.real - tmp1; \ - a2.imag = a0.imag - tmp2; \ - a3.real = a1.real - tmp3; \ - a3.imag = a1.imag - tmp4; \ - a0.real += tmp1; \ - a0.imag += tmp2; \ - a1.real += tmp3; \ - a1.imag += tmp4; \ +#define BUTTERFLY_HALF(a0,a1,a2,a3,w) do { \ + tmp5 = MUL (a2.real + a2.imag, w); \ + tmp6 = MUL (a2.imag - a2.real, w); \ + tmp7 = MUL (a3.real - a3.imag, w); \ + tmp8 = MUL (a3.imag + a3.real, w); \ + tmp1 = tmp5 + tmp7; \ + tmp2 = tmp6 + tmp8; \ + tmp3 = tmp6 - tmp8; \ + tmp4 = tmp7 - tmp5; \ + a2.real = a0.real - tmp1; \ + a2.imag = a0.imag - tmp2; \ + a3.real = a1.real - tmp3; \ + a3.imag = a1.imag - tmp4; \ + a0.real += tmp1; \ + a0.imag += tmp2; \ + a1.real += tmp3; \ + a1.imag += tmp4; \ } while (0) static inline void ifft8 (complex_t * buf) @@ -212,13 +212,13 @@ static void ifft_pass (complex_t * buf, const sample_t * weight, int n) i = n - 1; do { - BUTTERFLY (buf[0], buf1[0], buf2[0], buf3[0], - weight[0], weight[2*i-n]); - buf++; - buf1++; - buf2++; - buf3++; - weight++; + BUTTERFLY (buf[0], buf1[0], buf2[0], buf3[0], + weight[0], weight[2*i-n]); + buf++; + buf1++; + buf2++; + buf3++; + weight++; } while (--i); } @@ -264,7 +264,7 @@ void a52_imdct_512 (sample_t * data, sample_t * delay) sample_t t_r, t_i, a_r, a_i, b_r, b_i, w_1, w_2; const sample_t * window = a52_imdct_window; FFTComplex buf[128]; - + for (i = 0; i < 128; i++) { k = fftorder[i]; t_r = pre1[i].real; @@ -357,7 +357,7 @@ static double besselI0 (double x) int i = 100; do - bessel = bessel * x / (i * i) + 1; + bessel = bessel * x / (i * i) + 1; while (--i); return bessel; } @@ -376,13 +376,13 @@ void a52_imdct_init (uint32_t mm_accel) /* compute imdct window - kaiser-bessel derived window, alpha = 5.0 */ /* sum = 0; for (i = 0; i < 256; i++) { - sum += besselI0 (i * (256 - i) * (5 * M_PI / 256) * (5 * M_PI / 256)); - local_imdct_window[i] = sum; + sum += besselI0 (i * (256 - i) * (5 * M_PI / 256) * (5 * M_PI / 256)); + local_imdct_window[i] = sum; } sum++; */ /* for (i = 0; i < 256; i++) - a52_imdct_window[i] = SAMPLE (sqrt (local_imdct_window[i] / sum)); + a52_imdct_window[i] = SAMPLE (sqrt (local_imdct_window[i] / sum)); printf("static sample_t a52_imdct_window[256]={"); for (i=0;i<256;i++) { @@ -393,26 +393,26 @@ void a52_imdct_init (uint32_t mm_accel) */ /* for (i = 0; i < 3; i++) - roots16[i] = SAMPLE (cos ((M_PI / 8) * (i + 1))); + roots16[i] = SAMPLE (cos ((M_PI / 8) * (i + 1))); printf("static sample_t roots16[3]={%d,%d,%d};\n\n",roots16[0],roots16[1],roots16[2]); for (i = 0; i < 7; i++) - roots32[i] = SAMPLE (cos ((M_PI / 16) * (i + 1))); + roots32[i] = SAMPLE (cos ((M_PI / 16) * (i + 1))); printf("static sample_t roots32[7]={"); for (i=0;i<7;i++) { printf("%d%s",roots32[i],(i < 6 ? "," : "")); } printf("};\n"); for (i = 0; i < 15; i++) - roots64[i] = SAMPLE (cos ((M_PI / 32) * (i + 1))); + roots64[i] = SAMPLE (cos ((M_PI / 32) * (i + 1))); printf("static sample_t roots64[15]={"); for (i=0;i<15;i++) { printf("%d%s",roots64[i],(i < 14 ? "," : "")); } printf("};\n"); for (i = 0; i < 31; i++) - roots128[i] = SAMPLE (cos ((M_PI / 64) * (i + 1))); + roots128[i] = SAMPLE (cos ((M_PI / 64) * (i + 1))); printf("static sample_t roots128[31]={"); for (i=0;i<31;i++) { printf("%d%s",roots128[i],(i < 30 ? "," : "")); } @@ -420,15 +420,15 @@ void a52_imdct_init (uint32_t mm_accel) */ /* for (i = 0; i < 64; i++) { - k = fftorder[i] / 2 + 64; - pre1[i].real = SAMPLE (cos ((M_PI / 256) * (k - 0.25))); - pre1[i].imag = SAMPLE (sin ((M_PI / 256) * (k - 0.25))); + k = fftorder[i] / 2 + 64; + pre1[i].real = SAMPLE (cos ((M_PI / 256) * (k - 0.25))); + pre1[i].imag = SAMPLE (sin ((M_PI / 256) * (k - 0.25))); } for (i = 64; i < 128; i++) { - k = fftorder[i] / 2 + 64; - pre1[i].real = SAMPLE (-cos ((M_PI / 256) * (k - 0.25))); - pre1[i].imag = SAMPLE (-sin ((M_PI / 256) * (k - 0.25))); + k = fftorder[i] / 2 + 64; + pre1[i].real = SAMPLE (-cos ((M_PI / 256) * (k - 0.25))); + pre1[i].imag = SAMPLE (-sin ((M_PI / 256) * (k - 0.25))); } printf("static complex_t pre1[128]={"); @@ -437,8 +437,8 @@ void a52_imdct_init (uint32_t mm_accel) */ /* for (i = 0; i < 64; i++) { - post1[i].real = SAMPLE (cos ((M_PI / 256) * (i + 0.5))); - post1[i].imag = SAMPLE (sin ((M_PI / 256) * (i + 0.5))); + post1[i].real = SAMPLE (cos ((M_PI / 256) * (i + 0.5))); + post1[i].imag = SAMPLE (sin ((M_PI / 256) * (i + 0.5))); } printf("static complex_t post1[64]={"); @@ -448,9 +448,9 @@ void a52_imdct_init (uint32_t mm_accel) /* for (i = 0; i < 64; i++) { - k = fftorder[i] / 4; - pre2[i].real = SAMPLE (cos ((M_PI / 128) * (k - 0.25))); - pre2[i].imag = SAMPLE (sin ((M_PI / 128) * (k - 0.25))); + k = fftorder[i] / 4; + pre2[i].real = SAMPLE (cos ((M_PI / 128) * (k - 0.25))); + pre2[i].imag = SAMPLE (sin ((M_PI / 128) * (k - 0.25))); } printf("static complex_t pre2[64]={"); @@ -458,8 +458,8 @@ void a52_imdct_init (uint32_t mm_accel) printf("};\n"); for (i = 0; i < 32; i++) { - post2[i].real = SAMPLE (cos ((M_PI / 128) * (i + 0.5))); - post2[i].imag = SAMPLE (sin ((M_PI / 128) * (i + 0.5))); + post2[i].real = SAMPLE (cos ((M_PI / 128) * (i + 0.5))); + post2[i].imag = SAMPLE (sin ((M_PI / 128) * (i + 0.5))); } printf("static complex_t post2[32]={"); @@ -470,17 +470,17 @@ void a52_imdct_init (uint32_t mm_accel) #ifdef LIBA52_DJBFFT if (mm_accel & MM_ACCEL_DJBFFT) { #ifndef LIBA52_DOUBLE - ifft128 = (void (*) (complex_t *)) fftc4_un128; - ifft64 = (void (*) (complex_t *)) fftc4_un64; + ifft128 = (void (*) (complex_t *)) fftc4_un128; + ifft64 = (void (*) (complex_t *)) fftc4_un64; #else - ifft128 = (void (*) (complex_t *)) fftc8_un128; - ifft64 = (void (*) (complex_t *)) fftc8_un64; + ifft128 = (void (*) (complex_t *)) fftc8_un128; + ifft64 = (void (*) (complex_t *)) fftc8_un64; #endif } else #endif { - ifft128 = ifft128_c; - ifft64 = ifft64_c; + ifft128 = ifft128_c; + ifft64 = ifft64_c; } */ } diff --git a/apps/codecs/liba52/imdct_lookups.h b/apps/codecs/liba52/imdct_lookups.h index 88e0ec3fd8..769623ff53 100644 --- a/apps/codecs/liba52/imdct_lookups.h +++ b/apps/codecs/liba52/imdct_lookups.h @@ -1,5 +1,5 @@ static const sample_t a52_imdct_window[256]ICONST_ATTR={ - 146020,261886,393529,545197,719447,918478,1144416,1399394,1685589,2005234,2360623,2754115,3188134,3665170,4187773,4758556, 5380193,6055411,6786995,7577779,8430645,9348521,10334375,11391212,12522071,13730020,15018150,16389576,17847424,19394833,21034947,22770912, 24605865,26542938,28585242,30735872,32997891,35374332,37868188,40482408,43219889,46083473,49075937,52199993,55458273,58853331,62387636,66063559, 69883377,73849259,77963266,82227341,86643307,91212859,95937560,100818835,105857968,111056092,116414194,121933098,127613474,133455822,139460477,145627601, 151957182,158449029,165102772,171917855,178893540,186028900,193322822,200774000,208380940,216141958,224055176,232118527,240329753,248686407,257185854,265825270, 274601649,283511802,292552357,301719768,311010314,320420105,329945084,339581031,349323572,359168178,369110174,379144743,389266934,399471665,409753732,420107815, 430528483,441010205,451547355,462134219,472765003,483433845,494134818,504861939,515609181,526370480,537139740,547910849,558677680,569434108,580174011,590891284, 601579849,612233658,622846709,633413050,643926788,654382103,664773249,675094567,685340494,695505569,705584441,715571877,725462772,735252152,744935184,754507184, 763963620,773300119,782512477,791596659,800548807,809365245,818042484,826577226,834966364,843206992,851296404,859232096,867011771,874633340,882094922,889394844, 896531647,903504079,910311101,916951881,923425798,929732436,935871584,941843233,947647575,953284997,958756080,964061593,969202490,974179906,978995149,983649698, 988145195,992483442,996666390,1000696136,1004574919,1008305104,1011889185,1015329772,1018629583,1021791439,1024818257,1027713038,1030478862,1033118881,1035636308,1038034411, 1040316504,1042485942,1044546109,1046500412,1048352275,1050105129,1051762405,1053327531,1054803917,1056194958,1057504020,1058734435,1059889501,1060972468,1061986539,1062934861, 1063820523,1064646551,1065415903,1066131467,1066796055,1067412403,1067983168,1068510924,1068998160,1069447282,1069860607,1070240366,1070588702,1070907668,1071199230,1071465266, 1071707567,1071927836,1072127692,1072308670,1072472221,1072619716,1072752449,1072871635,1072978415,1073073858,1073158963,1073234663,1073301826,1073361257,1073413702,1073459852, 1073500344,1073535763,1073566646,1073593486,1073616731,1073636791,1073654036,1073668804,1073681398,1073692090,1073701126,1073708726,1073715084,1073720373,1073724748,1073728344, 1073731279,1073733657,1073735568,1073737090,1073738291,1073739229,1073739951,1073740500,1073740912,1073741214,1073741431,1073741582,1073741685,1073741751,1073741792,1073741814 + 146020,261886,393529,545197,719447,918478,1144416,1399394,1685589,2005234,2360623,2754115,3188134,3665170,4187773,4758556, 5380193,6055411,6786995,7577779,8430645,9348521,10334375,11391212,12522071,13730020,15018150,16389576,17847424,19394833,21034947,22770912, 24605865,26542938,28585242,30735872,32997891,35374332,37868188,40482408,43219889,46083473,49075937,52199993,55458273,58853331,62387636,66063559, 69883377,73849259,77963266,82227341,86643307,91212859,95937560,100818835,105857968,111056092,116414194,121933098,127613474,133455822,139460477,145627601, 151957182,158449029,165102772,171917855,178893540,186028900,193322822,200774000,208380940,216141958,224055176,232118527,240329753,248686407,257185854,265825270, 274601649,283511802,292552357,301719768,311010314,320420105,329945084,339581031,349323572,359168178,369110174,379144743,389266934,399471665,409753732,420107815, 430528483,441010205,451547355,462134219,472765003,483433845,494134818,504861939,515609181,526370480,537139740,547910849,558677680,569434108,580174011,590891284, 601579849,612233658,622846709,633413050,643926788,654382103,664773249,675094567,685340494,695505569,705584441,715571877,725462772,735252152,744935184,754507184, 763963620,773300119,782512477,791596659,800548807,809365245,818042484,826577226,834966364,843206992,851296404,859232096,867011771,874633340,882094922,889394844, 896531647,903504079,910311101,916951881,923425798,929732436,935871584,941843233,947647575,953284997,958756080,964061593,969202490,974179906,978995149,983649698, 988145195,992483442,996666390,1000696136,1004574919,1008305104,1011889185,1015329772,1018629583,1021791439,1024818257,1027713038,1030478862,1033118881,1035636308,1038034411, 1040316504,1042485942,1044546109,1046500412,1048352275,1050105129,1051762405,1053327531,1054803917,1056194958,1057504020,1058734435,1059889501,1060972468,1061986539,1062934861, 1063820523,1064646551,1065415903,1066131467,1066796055,1067412403,1067983168,1068510924,1068998160,1069447282,1069860607,1070240366,1070588702,1070907668,1071199230,1071465266, 1071707567,1071927836,1072127692,1072308670,1072472221,1072619716,1072752449,1072871635,1072978415,1073073858,1073158963,1073234663,1073301826,1073361257,1073413702,1073459852, 1073500344,1073535763,1073566646,1073593486,1073616731,1073636791,1073654036,1073668804,1073681398,1073692090,1073701126,1073708726,1073715084,1073720373,1073724748,1073728344, 1073731279,1073733657,1073735568,1073737090,1073738291,1073739229,1073739951,1073740500,1073740912,1073741214,1073741431,1073741582,1073741685,1073741751,1073741792,1073741814 }; static const sample_t roots16[3]ICONST_ATTR={992008094,759250124,410903206}; diff --git a/apps/codecs/liba52/mm_accel.h b/apps/codecs/liba52/mm_accel.h index f569787aec..8005930cc6 100644 --- a/apps/codecs/liba52/mm_accel.h +++ b/apps/codecs/liba52/mm_accel.h @@ -25,12 +25,12 @@ #define MM_ACCEL_H /* generic accelerations */ -#define MM_ACCEL_DJBFFT 0x00000001 +#define MM_ACCEL_DJBFFT 0x00000001 /* x86 accelerations */ -#define MM_ACCEL_X86_MMX 0x80000000 -#define MM_ACCEL_X86_3DNOW 0x40000000 -#define MM_ACCEL_X86_MMXEXT 0x20000000 +#define MM_ACCEL_X86_MMX 0x80000000 +#define MM_ACCEL_X86_3DNOW 0x40000000 +#define MM_ACCEL_X86_MMXEXT 0x20000000 uint32_t mm_accel (void); diff --git a/apps/codecs/liba52/parse.c b/apps/codecs/liba52/parse.c index f2b0ce4f6d..fd7e13006d 100644 --- a/apps/codecs/liba52/parse.c +++ b/apps/codecs/liba52/parse.c @@ -66,19 +66,19 @@ a52_state_t * a52_init (uint32_t mm_accel) simultenously. NOTE, you also need to remove comments in a52_free. state = (a52_state_t *) malloc (sizeof (a52_state_t)); if (state == NULL) - return NULL; + return NULL; state->samples = (sample_t *) memalign (16, 256 * 12 * sizeof (sample_t)); if (state->samples == NULL) { - free (state); - return NULL; + free (state); + return NULL; } */ state = &istate; state->samples = isamples; for (i = 0; i < 256 * 12; i++) - state->samples[i] = 0; + state->samples[i] = 0; state->downmixed = 1; @@ -95,57 +95,57 @@ sample_t * a52_samples (a52_state_t * state) } int a52_syncinfo (uint8_t * buf, int * flags, - int * sample_rate, int * bit_rate) + int * sample_rate, int * bit_rate) { static int rate[] = { 32, 40, 48, 56, 64, 80, 96, 112, - 128, 160, 192, 224, 256, 320, 384, 448, - 512, 576, 640}; + 128, 160, 192, 224, 256, 320, 384, 448, + 512, 576, 640}; static uint8_t lfeon[8] = {0x10, 0x10, 0x04, 0x04, 0x04, 0x01, 0x04, 0x01}; int frmsizecod; int bitrate; int half; int acmod; - if ((buf[0] != 0x0b) || (buf[1] != 0x77)) /* syncword */ - return 0; + if ((buf[0] != 0x0b) || (buf[1] != 0x77)) /* syncword */ + return 0; - if (buf[5] >= 0x60) /* bsid >= 12 */ - return 0; + if (buf[5] >= 0x60) /* bsid >= 12 */ + return 0; half = halfrate[buf[5] >> 3]; /* acmod, dsurmod and lfeon */ acmod = buf[6] >> 5; *flags = ((((buf[6] & 0xf8) == 0x50) ? A52_DOLBY : acmod) | - ((buf[6] & lfeon[acmod]) ? A52_LFE : 0)); + ((buf[6] & lfeon[acmod]) ? A52_LFE : 0)); frmsizecod = buf[4] & 63; if (frmsizecod >= 38) - return 0; + return 0; bitrate = rate [frmsizecod >> 1]; *bit_rate = (bitrate * 1000) >> half; switch (buf[4] & 0xc0) { case 0: - *sample_rate = 48000 >> half; - return 4 * bitrate; + *sample_rate = 48000 >> half; + return 4 * bitrate; case 0x40: - *sample_rate = 44100 >> half; - return 2 * (320 * bitrate / 147 + (frmsizecod & 1)); + *sample_rate = 44100 >> half; + return 2 * (320 * bitrate / 147 + (frmsizecod & 1)); case 0x80: - *sample_rate = 32000 >> half; - return 6 * bitrate; + *sample_rate = 32000 >> half; + return 6 * bitrate; default: - return 0; + return 0; } } int a52_frame (a52_state_t * state, uint8_t * buf, int * flags, - level_t * level, sample_t bias) + level_t * level, sample_t bias) { static level_t clev[4] = { LEVEL (LEVEL_3DB), LEVEL (LEVEL_45DB), - LEVEL (LEVEL_6DB), LEVEL (LEVEL_45DB) }; + LEVEL (LEVEL_6DB), LEVEL (LEVEL_45DB) }; static level_t slev[4] = { LEVEL (LEVEL_3DB), LEVEL (LEVEL_6DB), - 0, LEVEL (LEVEL_6DB) }; + 0, LEVEL (LEVEL_6DB) }; int chaninfo; int acmod; @@ -154,27 +154,27 @@ int a52_frame (a52_state_t * state, uint8_t * buf, int * flags, state->acmod = acmod = buf[6] >> 5; a52_bitstream_set_ptr (state, buf + 6); - bitstream_get (state, 3); /* skip acmod we already parsed */ + bitstream_get (state, 3); /* skip acmod we already parsed */ - if ((acmod == 2) && (bitstream_get (state, 2) == 2)) /* dsurmod */ - acmod = A52_DOLBY; + if ((acmod == 2) && (bitstream_get (state, 2) == 2)) /* dsurmod */ + acmod = A52_DOLBY; state->clev = state->slev = 0; if ((acmod & 1) && (acmod != 1)) - state->clev = clev[bitstream_get (state, 2)]; /* cmixlev */ + state->clev = clev[bitstream_get (state, 2)]; /* cmixlev */ if (acmod & 4) - state->slev = slev[bitstream_get (state, 2)]; /* surmixlev */ + state->slev = slev[bitstream_get (state, 2)]; /* surmixlev */ state->lfeon = bitstream_get (state, 1); state->output = a52_downmix_init (acmod, *flags, level, - state->clev, state->slev); + state->clev, state->slev); if (state->output < 0) - return 1; + return 1; if (state->lfeon && (*flags & A52_LFE)) - state->output |= A52_LFE; + state->output |= A52_LFE; *flags = state->output; /* the 2* compensates for differences in imdct */ state->dynrng = state->level = MUL_C (*level, 2); @@ -183,99 +183,99 @@ int a52_frame (a52_state_t * state, uint8_t * buf, int * flags, state->dynrngcall = NULL; state->cplba.deltbae = DELTA_BIT_NONE; state->ba[0].deltbae = state->ba[1].deltbae = state->ba[2].deltbae = - state->ba[3].deltbae = state->ba[4].deltbae = DELTA_BIT_NONE; + state->ba[3].deltbae = state->ba[4].deltbae = DELTA_BIT_NONE; chaninfo = !acmod; do { - bitstream_get (state, 5); /* dialnorm */ - if (bitstream_get (state, 1)) /* compre */ - bitstream_get (state, 8); /* compr */ - if (bitstream_get (state, 1)) /* langcode */ - bitstream_get (state, 8); /* langcod */ - if (bitstream_get (state, 1)) /* audprodie */ - bitstream_get (state, 7); /* mixlevel + roomtyp */ + bitstream_get (state, 5); /* dialnorm */ + if (bitstream_get (state, 1)) /* compre */ + bitstream_get (state, 8); /* compr */ + if (bitstream_get (state, 1)) /* langcode */ + bitstream_get (state, 8); /* langcod */ + if (bitstream_get (state, 1)) /* audprodie */ + bitstream_get (state, 7); /* mixlevel + roomtyp */ } while (chaninfo--); - bitstream_get (state, 2); /* copyrightb + origbs */ + bitstream_get (state, 2); /* copyrightb + origbs */ - if (bitstream_get (state, 1)) /* timecod1e */ - bitstream_get (state, 14); /* timecod1 */ - if (bitstream_get (state, 1)) /* timecod2e */ - bitstream_get (state, 14); /* timecod2 */ + if (bitstream_get (state, 1)) /* timecod1e */ + bitstream_get (state, 14); /* timecod1 */ + if (bitstream_get (state, 1)) /* timecod2e */ + bitstream_get (state, 14); /* timecod2 */ - if (bitstream_get (state, 1)) { /* addbsie */ - int addbsil; + if (bitstream_get (state, 1)) { /* addbsie */ + int addbsil; - addbsil = bitstream_get (state, 6); - do { - bitstream_get (state, 8); /* addbsi */ - } while (addbsil--); + addbsil = bitstream_get (state, 6); + do { + bitstream_get (state, 8); /* addbsi */ + } while (addbsil--); } return 0; } void a52_dynrng (a52_state_t * state, - level_t (* call) (level_t, void *), void * data) + level_t (* call) (level_t, void *), void * data) { state->dynrnge = 0; if (call) { - state->dynrnge = 1; - state->dynrngcall = call; - state->dynrngdata = data; + state->dynrnge = 1; + state->dynrngcall = call; + state->dynrngdata = data; } } static int parse_exponents (a52_state_t * state, int expstr, int ngrps, - uint8_t exponent, uint8_t * dest) + uint8_t exponent, uint8_t * dest) { int exps; while (ngrps--) { - exps = bitstream_get (state, 7); - - exponent += exp_1[exps]; - if (exponent > 24) - return 1; - - switch (expstr) { - case EXP_D45: - *(dest++) = exponent; - *(dest++) = exponent; - case EXP_D25: - *(dest++) = exponent; - case EXP_D15: - *(dest++) = exponent; - } - - exponent += exp_2[exps]; - if (exponent > 24) - return 1; - - switch (expstr) { - case EXP_D45: - *(dest++) = exponent; - *(dest++) = exponent; - case EXP_D25: - *(dest++) = exponent; - case EXP_D15: - *(dest++) = exponent; - } - - exponent += exp_3[exps]; - if (exponent > 24) - return 1; - - switch (expstr) { - case EXP_D45: - *(dest++) = exponent; - *(dest++) = exponent; - case EXP_D25: - *(dest++) = exponent; - case EXP_D15: - *(dest++) = exponent; - } - } + exps = bitstream_get (state, 7); + + exponent += exp_1[exps]; + if (exponent > 24) + return 1; + + switch (expstr) { + case EXP_D45: + *(dest++) = exponent; + *(dest++) = exponent; + case EXP_D25: + *(dest++) = exponent; + case EXP_D15: + *(dest++) = exponent; + } + + exponent += exp_2[exps]; + if (exponent > 24) + return 1; + + switch (expstr) { + case EXP_D45: + *(dest++) = exponent; + *(dest++) = exponent; + case EXP_D25: + *(dest++) = exponent; + case EXP_D15: + *(dest++) = exponent; + } + + exponent += exp_3[exps]; + if (exponent > 24) + return 1; + + switch (expstr) { + case EXP_D45: + *(dest++) = exponent; + *(dest++) = exponent; + case EXP_D25: + *(dest++) = exponent; + case EXP_D15: + *(dest++) = exponent; + } + } return 0; } @@ -289,16 +289,16 @@ static int parse_deltba (a52_state_t * state, int8_t * deltba) deltnseg = bitstream_get (state, 3); j = 0; do { - j += bitstream_get (state, 5); - deltlen = bitstream_get (state, 4); - delta = bitstream_get (state, 3); - delta -= (delta >= 4) ? 3 : 4; - if (!deltlen) - continue; - if (j + deltlen >= 50) - return 1; - while (deltlen--) - deltba[j++] = delta; + j += bitstream_get (state, 5); + deltlen = bitstream_get (state, 4); + delta = bitstream_get (state, 3); + delta -= (delta >= 4) ? 3 : 4; + if (!deltlen) + continue; + if (j + deltlen >= 50) + return 1; + while (deltlen--) + deltba[j++] = delta; } while (deltnseg--); return 0; @@ -309,12 +309,12 @@ static inline int zero_snr_offsets (int nfchans, a52_state_t * state) int i; if ((state->csnroffst) || - (state->chincpl && state->cplba.bai >> 3) || /* cplinu, fsnroffst */ - (state->lfeon && state->lfeba.bai >> 3)) /* fsnroffst */ - return 0; + (state->chincpl && state->cplba.bai >> 3) || /* cplinu, fsnroffst */ + (state->lfeon && state->lfeba.bai >> 3)) /* fsnroffst */ + return 0; for (i = 0; i < nfchans; i++) - if (state->ba[i].bai >> 3) /* fsnroffst */ - return 0; + if (state->ba[i].bai >> 3) /* fsnroffst */ + return 0; return 1; } @@ -323,7 +323,7 @@ static inline int16_t dither_gen (a52_state_t * state) int16_t nstate; nstate = dither_lut[state->lfsr_state >> 8] ^ (state->lfsr_state << 8); - + state->lfsr_state = (uint16_t) nstate; return (3 * nstate) >> 2; @@ -332,21 +332,21 @@ static inline int16_t dither_gen (a52_state_t * state) #ifndef LIBA52_FIXED #define COEFF(c,t,l,s,e) (c) = (t) * (s)[e] #else -#define COEFF(c,_t,_l,s,e) do { \ - quantizer_t t = (_t); \ - level_t l = (_l); \ - int shift = e - 5; \ - sample_t tmp = t * (l >> 16) + ((t * (l & 0xffff)) >> 16); \ - if (shift >= 0) \ - (c) = tmp >> shift; \ - else \ - (c) = tmp << -shift; \ +#define COEFF(c,_t,_l,s,e) do { \ + quantizer_t t = (_t); \ + level_t l = (_l); \ + int shift = e - 5; \ + sample_t tmp = t * (l >> 16) + ((t * (l & 0xffff)) >> 16); \ + if (shift >= 0) \ + (c) = tmp >> shift; \ + else \ + (c) = tmp << -shift; \ } while (0) #endif static void coeff_get (a52_state_t * state, sample_t * coeff, - expbap_t * expbap, quantizer_set_t * quant, - level_t level, int dither, int end) + expbap_t * expbap, quantizer_set_t * quant, + level_t level, int dither, int end) { int i; uint8_t * exp; @@ -356,96 +356,96 @@ static void coeff_get (a52_state_t * state, sample_t * coeff, sample_t factor[25]; for (i = 0; i <= 24; i++) - factor[i] = scale_factor[i] * level; + factor[i] = scale_factor[i] * level; #endif exp = expbap->exp; bap = expbap->bap; for (i = 0; i < end; i++) { - int bapi; - - bapi = bap[i]; - switch (bapi) { - case 0: - if (dither) { - COEFF (coeff[i], dither_gen (state), level, factor, exp[i]); - continue; - } else { - coeff[i] = 0; - continue; - } - - case -1: - if (quant->q1_ptr >= 0) { - COEFF (coeff[i], quant->q1[quant->q1_ptr--], level, - factor, exp[i]); - continue; - } else { - int code; - - code = bitstream_get (state, 5); - - quant->q1_ptr = 1; - quant->q1[0] = q_1_2[code]; - quant->q1[1] = q_1_1[code]; - COEFF (coeff[i], q_1_0[code], level, factor, exp[i]); - continue; - } - - case -2: - if (quant->q2_ptr >= 0) { - COEFF (coeff[i], quant->q2[quant->q2_ptr--], level, - factor, exp[i]); - continue; - } else { - int code; - - code = bitstream_get (state, 7); - - quant->q2_ptr = 1; - quant->q2[0] = q_2_2[code]; - quant->q2[1] = q_2_1[code]; - COEFF (coeff[i], q_2_0[code], level, factor, exp[i]); - continue; - } - - case 3: - COEFF (coeff[i], q_3[bitstream_get (state, 3)], level, - factor, exp[i]); - continue; - - case -3: - if (quant->q4_ptr == 0) { - quant->q4_ptr = -1; - COEFF (coeff[i], quant->q4, level, factor, exp[i]); - continue; - } else { - int code; - - code = bitstream_get (state, 7); - - quant->q4_ptr = 0; - quant->q4 = q_4_1[code]; - COEFF (coeff[i], q_4_0[code], level, factor, exp[i]); - continue; - } - - case 4: - COEFF (coeff[i], q_5[bitstream_get (state, 4)], level, - factor, exp[i]); - continue; - - default: - COEFF (coeff[i], bitstream_get_2 (state, bapi) << (16 - bapi), - level, factor, exp[i]); - } + int bapi; + + bapi = bap[i]; + switch (bapi) { + case 0: + if (dither) { + COEFF (coeff[i], dither_gen (state), level, factor, exp[i]); + continue; + } else { + coeff[i] = 0; + continue; + } + + case -1: + if (quant->q1_ptr >= 0) { + COEFF (coeff[i], quant->q1[quant->q1_ptr--], level, + factor, exp[i]); + continue; + } else { + int code; + + code = bitstream_get (state, 5); + + quant->q1_ptr = 1; + quant->q1[0] = q_1_2[code]; + quant->q1[1] = q_1_1[code]; + COEFF (coeff[i], q_1_0[code], level, factor, exp[i]); + continue; + } + + case -2: + if (quant->q2_ptr >= 0) { + COEFF (coeff[i], quant->q2[quant->q2_ptr--], level, + factor, exp[i]); + continue; + } else { + int code; + + code = bitstream_get (state, 7); + + quant->q2_ptr = 1; + quant->q2[0] = q_2_2[code]; + quant->q2[1] = q_2_1[code]; + COEFF (coeff[i], q_2_0[code], level, factor, exp[i]); + continue; + } + + case 3: + COEFF (coeff[i], q_3[bitstream_get (state, 3)], level, + factor, exp[i]); + continue; + + case -3: + if (quant->q4_ptr == 0) { + quant->q4_ptr = -1; + COEFF (coeff[i], quant->q4, level, factor, exp[i]); + continue; + } else { + int code; + + code = bitstream_get (state, 7); + + quant->q4_ptr = 0; + quant->q4 = q_4_1[code]; + COEFF (coeff[i], q_4_0[code], level, factor, exp[i]); + continue; + } + + case 4: + COEFF (coeff[i], q_5[bitstream_get (state, 4)], level, + factor, exp[i]); + continue; + + default: + COEFF (coeff[i], bitstream_get_2 (state, bapi) << (16 - bapi), + level, factor, exp[i]); + } } } static void coeff_get_coupling (a52_state_t * state, int nfchans, - level_t * coeff, sample_t (* samples)[256], - quantizer_set_t * quant, uint8_t dithflag[5]) + level_t * coeff, sample_t (* samples)[256], + quantizer_set_t * quant, uint8_t dithflag[5]) { int cplbndstrc, bnd, i, i_end, ch; uint8_t * exp; @@ -458,111 +458,111 @@ static void coeff_get_coupling (a52_state_t * state, int nfchans, cplbndstrc = state->cplbndstrc; i = state->cplstrtmant; while (i < state->cplendmant) { - i_end = i + 12; - while (cplbndstrc & 1) { - cplbndstrc >>= 1; - i_end += 12; - } - cplbndstrc >>= 1; - for (ch = 0; ch < nfchans; ch++) - cplco[ch] = MUL_L (state->cplco[ch][bnd], coeff[ch]); - bnd++; - - while (i < i_end) { - quantizer_t cplcoeff; - int bapi; - - bapi = bap[i]; - switch (bapi) { - case 0: - for (ch = 0; ch < nfchans; ch++) - if ((state->chincpl >> ch) & 1) { - if (dithflag[ch]) + i_end = i + 12; + while (cplbndstrc & 1) { + cplbndstrc >>= 1; + i_end += 12; + } + cplbndstrc >>= 1; + for (ch = 0; ch < nfchans; ch++) + cplco[ch] = MUL_L (state->cplco[ch][bnd], coeff[ch]); + bnd++; + + while (i < i_end) { + quantizer_t cplcoeff; + int bapi; + + bapi = bap[i]; + switch (bapi) { + case 0: + for (ch = 0; ch < nfchans; ch++) + if ((state->chincpl >> ch) & 1) { + if (dithflag[ch]) #ifndef LIBA52_FIXED - samples[ch][i] = (scale_factor[exp[i]] * - cplco[ch] * dither_gen (state)); + samples[ch][i] = (scale_factor[exp[i]] * + cplco[ch] * dither_gen (state)); #else - COEFF (samples[ch][i], dither_gen (state), - cplco[ch], scale_factor, exp[i]); + COEFF (samples[ch][i], dither_gen (state), + cplco[ch], scale_factor, exp[i]); #endif - else - samples[ch][i] = 0; - } - i++; - continue; - - case -1: - if (quant->q1_ptr >= 0) { - cplcoeff = quant->q1[quant->q1_ptr--]; - break; - } else { - int code; - - code = bitstream_get (state, 5); - - quant->q1_ptr = 1; - quant->q1[0] = q_1_2[code]; - quant->q1[1] = q_1_1[code]; - cplcoeff = q_1_0[code]; - break; - } - - case -2: - if (quant->q2_ptr >= 0) { - cplcoeff = quant->q2[quant->q2_ptr--]; - break; - } else { - int code; - - code = bitstream_get (state, 7); - - quant->q2_ptr = 1; - quant->q2[0] = q_2_2[code]; - quant->q2[1] = q_2_1[code]; - cplcoeff = q_2_0[code]; - break; - } - - case 3: - cplcoeff = q_3[bitstream_get (state, 3)]; - break; - - case -3: - if (quant->q4_ptr == 0) { - quant->q4_ptr = -1; - cplcoeff = quant->q4; - break; - } else { - int code; - - code = bitstream_get (state, 7); - - quant->q4_ptr = 0; - quant->q4 = q_4_1[code]; - cplcoeff = q_4_0[code]; - break; - } - - case 4: - cplcoeff = q_5[bitstream_get (state, 4)]; - break; - - default: - cplcoeff = bitstream_get_2 (state, bapi) << (16 - bapi); - } + else + samples[ch][i] = 0; + } + i++; + continue; + + case -1: + if (quant->q1_ptr >= 0) { + cplcoeff = quant->q1[quant->q1_ptr--]; + break; + } else { + int code; + + code = bitstream_get (state, 5); + + quant->q1_ptr = 1; + quant->q1[0] = q_1_2[code]; + quant->q1[1] = q_1_1[code]; + cplcoeff = q_1_0[code]; + break; + } + + case -2: + if (quant->q2_ptr >= 0) { + cplcoeff = quant->q2[quant->q2_ptr--]; + break; + } else { + int code; + + code = bitstream_get (state, 7); + + quant->q2_ptr = 1; + quant->q2[0] = q_2_2[code]; + quant->q2[1] = q_2_1[code]; + cplcoeff = q_2_0[code]; + break; + } + + case 3: + cplcoeff = q_3[bitstream_get (state, 3)]; + break; + + case -3: + if (quant->q4_ptr == 0) { + quant->q4_ptr = -1; + cplcoeff = quant->q4; + break; + } else { + int code; + + code = bitstream_get (state, 7); + + quant->q4_ptr = 0; + quant->q4 = q_4_1[code]; + cplcoeff = q_4_0[code]; + break; + } + + case 4: + cplcoeff = q_5[bitstream_get (state, 4)]; + break; + + default: + cplcoeff = bitstream_get_2 (state, bapi) << (16 - bapi); + } #ifndef LIBA52_FIXED - cplcoeff *= scale_factor[exp[i]]; + cplcoeff *= scale_factor[exp[i]]; #endif - for (ch = 0; ch < nfchans; ch++) - if ((state->chincpl >> ch) & 1) + for (ch = 0; ch < nfchans; ch++) + if ((state->chincpl >> ch) & 1) #ifndef LIBA52_FIXED - samples[ch][i] = cplcoeff * cplco[ch]; + samples[ch][i] = cplcoeff * cplco[ch]; #else - COEFF (samples[ch][i], cplcoeff, cplco[ch], - scale_factor, exp[i]); + COEFF (samples[ch][i], cplcoeff, cplco[ch], + scale_factor, exp[i]); #endif - i++; - } + i++; + } } } @@ -581,366 +581,366 @@ int a52_block (a52_state_t * state) nfchans = nfchans_tbl[state->acmod]; for (i = 0; i < nfchans; i++) - blksw[i] = bitstream_get (state, 1); + blksw[i] = bitstream_get (state, 1); for (i = 0; i < nfchans; i++) - dithflag[i] = bitstream_get (state, 1); + dithflag[i] = bitstream_get (state, 1); chaninfo = !state->acmod; do { - if (bitstream_get (state, 1)) { /* dynrnge */ - int dynrng; + if (bitstream_get (state, 1)) { /* dynrnge */ + int dynrng; - dynrng = bitstream_get_2 (state, 8); - if (state->dynrnge) { - level_t range; + dynrng = bitstream_get_2 (state, 8); + if (state->dynrnge) { + level_t range; #if !defined(LIBA52_FIXED) - range = ((((dynrng & 0x1f) | 0x20) << 13) * - scale_factor[3 - (dynrng >> 5)]); + range = ((((dynrng & 0x1f) | 0x20) << 13) * + scale_factor[3 - (dynrng >> 5)]); #else - range = ((dynrng & 0x1f) | 0x20) << (21 + (dynrng >> 5)); + range = ((dynrng & 0x1f) | 0x20) << (21 + (dynrng >> 5)); #endif - if (state->dynrngcall) - range = state->dynrngcall (range, state->dynrngdata); - state->dynrng = MUL_L (state->level, range); - } - } + if (state->dynrngcall) + range = state->dynrngcall (range, state->dynrngdata); + state->dynrng = MUL_L (state->level, range); + } + } } while (chaninfo--); - if (bitstream_get (state, 1)) { /* cplstre */ - state->chincpl = 0; - if (bitstream_get (state, 1)) { /* cplinu */ - static uint8_t bndtab[16] = {31, 35, 37, 39, 41, 42, 43, 44, - 45, 45, 46, 46, 47, 47, 48, 48}; - int cplbegf; - int cplendf; - int ncplsubnd; - - for (i = 0; i < nfchans; i++) - state->chincpl |= bitstream_get (state, 1) << i; - switch (state->acmod) { - case 0: case 1: - return 1; - case 2: - state->phsflginu = bitstream_get (state, 1); - } - cplbegf = bitstream_get (state, 4); - cplendf = bitstream_get (state, 4); - - if (cplendf + 3 - cplbegf < 0) - return 1; - state->ncplbnd = ncplsubnd = cplendf + 3 - cplbegf; - state->cplstrtbnd = bndtab[cplbegf]; - state->cplstrtmant = cplbegf * 12 + 37; - state->cplendmant = cplendf * 12 + 73; - - state->cplbndstrc = 0; - for (i = 0; i < ncplsubnd - 1; i++) - if (bitstream_get (state, 1)) { - state->cplbndstrc |= 1 << i; - state->ncplbnd--; - } - } - } - - if (state->chincpl) { /* cplinu */ - int j, cplcoe; - - cplcoe = 0; - for (i = 0; i < nfchans; i++) - if ((state->chincpl) >> i & 1) - if (bitstream_get (state, 1)) { /* cplcoe */ - int mstrcplco, cplcoexp, cplcomant; - - cplcoe = 1; - mstrcplco = 3 * bitstream_get (state, 2); - for (j = 0; j < state->ncplbnd; j++) { - cplcoexp = bitstream_get (state, 4); - cplcomant = bitstream_get (state, 4); - if (cplcoexp == 15) - cplcomant <<= 14; - else - cplcomant = (cplcomant | 0x10) << 13; + if (bitstream_get (state, 1)) { /* cplstre */ + state->chincpl = 0; + if (bitstream_get (state, 1)) { /* cplinu */ + static uint8_t bndtab[16] = {31, 35, 37, 39, 41, 42, 43, 44, + 45, 45, 46, 46, 47, 47, 48, 48}; + int cplbegf; + int cplendf; + int ncplsubnd; + + for (i = 0; i < nfchans; i++) + state->chincpl |= bitstream_get (state, 1) << i; + switch (state->acmod) { + case 0: case 1: + return 1; + case 2: + state->phsflginu = bitstream_get (state, 1); + } + cplbegf = bitstream_get (state, 4); + cplendf = bitstream_get (state, 4); + + if (cplendf + 3 - cplbegf < 0) + return 1; + state->ncplbnd = ncplsubnd = cplendf + 3 - cplbegf; + state->cplstrtbnd = bndtab[cplbegf]; + state->cplstrtmant = cplbegf * 12 + 37; + state->cplendmant = cplendf * 12 + 73; + + state->cplbndstrc = 0; + for (i = 0; i < ncplsubnd - 1; i++) + if (bitstream_get (state, 1)) { + state->cplbndstrc |= 1 << i; + state->ncplbnd--; + } + } + } + + if (state->chincpl) { /* cplinu */ + int j, cplcoe; + + cplcoe = 0; + for (i = 0; i < nfchans; i++) + if ((state->chincpl) >> i & 1) + if (bitstream_get (state, 1)) { /* cplcoe */ + int mstrcplco, cplcoexp, cplcomant; + + cplcoe = 1; + mstrcplco = 3 * bitstream_get (state, 2); + for (j = 0; j < state->ncplbnd; j++) { + cplcoexp = bitstream_get (state, 4); + cplcomant = bitstream_get (state, 4); + if (cplcoexp == 15) + cplcomant <<= 14; + else + cplcomant = (cplcomant | 0x10) << 13; #ifndef LIBA52_FIXED - state->cplco[i][j] = - cplcomant * scale_factor[cplcoexp + mstrcplco]; + state->cplco[i][j] = + cplcomant * scale_factor[cplcoexp + mstrcplco]; #else - state->cplco[i][j] = (cplcomant << 11) >> (cplcoexp + mstrcplco); + state->cplco[i][j] = (cplcomant << 11) >> (cplcoexp + mstrcplco); #endif - } - } - if ((state->acmod == 2) && state->phsflginu && cplcoe) - for (j = 0; j < state->ncplbnd; j++) - if (bitstream_get (state, 1)) /* phsflg */ - state->cplco[1][j] = -state->cplco[1][j]; + } + } + if ((state->acmod == 2) && state->phsflginu && cplcoe) + for (j = 0; j < state->ncplbnd; j++) + if (bitstream_get (state, 1)) /* phsflg */ + state->cplco[1][j] = -state->cplco[1][j]; } - if ((state->acmod == 2) && (bitstream_get (state, 1))) { /* rematstr */ - int end; + if ((state->acmod == 2) && (bitstream_get (state, 1))) { /* rematstr */ + int end; - state->rematflg = 0; - end = (state->chincpl) ? state->cplstrtmant : 253; /* cplinu */ - i = 0; - do - state->rematflg |= bitstream_get (state, 1) << i; - while (rematrix_band[i++] < end); + state->rematflg = 0; + end = (state->chincpl) ? state->cplstrtmant : 253; /* cplinu */ + i = 0; + do + state->rematflg |= bitstream_get (state, 1) << i; + while (rematrix_band[i++] < end); } cplexpstr = EXP_REUSE; lfeexpstr = EXP_REUSE; - if (state->chincpl) /* cplinu */ - cplexpstr = bitstream_get (state, 2); + if (state->chincpl) /* cplinu */ + cplexpstr = bitstream_get (state, 2); for (i = 0; i < nfchans; i++) - chexpstr[i] = bitstream_get (state, 2); + chexpstr[i] = bitstream_get (state, 2); if (state->lfeon) - lfeexpstr = bitstream_get (state, 1); + lfeexpstr = bitstream_get (state, 1); for (i = 0; i < nfchans; i++) - if (chexpstr[i] != EXP_REUSE) { - if ((state->chincpl >> i) & 1) - state->endmant[i] = state->cplstrtmant; - else { - int chbwcod; - - chbwcod = bitstream_get (state, 6); - if (chbwcod > 60) - return 1; - state->endmant[i] = chbwcod * 3 + 73; - } - } + if (chexpstr[i] != EXP_REUSE) { + if ((state->chincpl >> i) & 1) + state->endmant[i] = state->cplstrtmant; + else { + int chbwcod; + + chbwcod = bitstream_get (state, 6); + if (chbwcod > 60) + return 1; + state->endmant[i] = chbwcod * 3 + 73; + } + } do_bit_alloc = 0; if (cplexpstr != EXP_REUSE) { - int cplabsexp, ncplgrps; - - do_bit_alloc = 64; - ncplgrps = ((state->cplendmant - state->cplstrtmant) / - (3 << (cplexpstr - 1))); - cplabsexp = bitstream_get (state, 4) << 1; - if (parse_exponents (state, cplexpstr, ncplgrps, cplabsexp, - state->cpl_expbap.exp + state->cplstrtmant)) - return 1; + int cplabsexp, ncplgrps; + + do_bit_alloc = 64; + ncplgrps = ((state->cplendmant - state->cplstrtmant) / + (3 << (cplexpstr - 1))); + cplabsexp = bitstream_get (state, 4) << 1; + if (parse_exponents (state, cplexpstr, ncplgrps, cplabsexp, + state->cpl_expbap.exp + state->cplstrtmant)) + return 1; } for (i = 0; i < nfchans; i++) - if (chexpstr[i] != EXP_REUSE) { - int grp_size, nchgrps; - - do_bit_alloc |= 1 << i; - grp_size = 3 << (chexpstr[i] - 1); - nchgrps = (state->endmant[i] + grp_size - 4) / grp_size; - state->fbw_expbap[i].exp[0] = bitstream_get (state, 4); - if (parse_exponents (state, chexpstr[i], nchgrps, - state->fbw_expbap[i].exp[0], - state->fbw_expbap[i].exp + 1)) - return 1; - bitstream_get (state, 2); /* gainrng */ - } + if (chexpstr[i] != EXP_REUSE) { + int grp_size, nchgrps; + + do_bit_alloc |= 1 << i; + grp_size = 3 << (chexpstr[i] - 1); + nchgrps = (state->endmant[i] + grp_size - 4) / grp_size; + state->fbw_expbap[i].exp[0] = bitstream_get (state, 4); + if (parse_exponents (state, chexpstr[i], nchgrps, + state->fbw_expbap[i].exp[0], + state->fbw_expbap[i].exp + 1)) + return 1; + bitstream_get (state, 2); /* gainrng */ + } if (lfeexpstr != EXP_REUSE) { - do_bit_alloc |= 32; - state->lfe_expbap.exp[0] = bitstream_get (state, 4); - if (parse_exponents (state, lfeexpstr, 2, state->lfe_expbap.exp[0], - state->lfe_expbap.exp + 1)) - return 1; - } - - if (bitstream_get (state, 1)) { /* baie */ - do_bit_alloc = 127; - state->bai = bitstream_get (state, 11); - } - if (bitstream_get (state, 1)) { /* snroffste */ - do_bit_alloc = 127; - state->csnroffst = bitstream_get (state, 6); - if (state->chincpl) /* cplinu */ - state->cplba.bai = bitstream_get (state, 7); - for (i = 0; i < nfchans; i++) - state->ba[i].bai = bitstream_get (state, 7); - if (state->lfeon) - state->lfeba.bai = bitstream_get (state, 7); + do_bit_alloc |= 32; + state->lfe_expbap.exp[0] = bitstream_get (state, 4); + if (parse_exponents (state, lfeexpstr, 2, state->lfe_expbap.exp[0], + state->lfe_expbap.exp + 1)) + return 1; + } + + if (bitstream_get (state, 1)) { /* baie */ + do_bit_alloc = 127; + state->bai = bitstream_get (state, 11); + } + if (bitstream_get (state, 1)) { /* snroffste */ + do_bit_alloc = 127; + state->csnroffst = bitstream_get (state, 6); + if (state->chincpl) /* cplinu */ + state->cplba.bai = bitstream_get (state, 7); + for (i = 0; i < nfchans; i++) + state->ba[i].bai = bitstream_get (state, 7); + if (state->lfeon) + state->lfeba.bai = bitstream_get (state, 7); } if ((state->chincpl) && (bitstream_get (state, 1))) { /* cplleake */ - do_bit_alloc |= 64; - state->cplfleak = 9 - bitstream_get (state, 3); - state->cplsleak = 9 - bitstream_get (state, 3); - } - - if (bitstream_get (state, 1)) { /* deltbaie */ - do_bit_alloc = 127; - if (state->chincpl) /* cplinu */ - state->cplba.deltbae = bitstream_get (state, 2); - for (i = 0; i < nfchans; i++) - state->ba[i].deltbae = bitstream_get (state, 2); - if (state->chincpl && /* cplinu */ - (state->cplba.deltbae == DELTA_BIT_NEW) && - parse_deltba (state, state->cplba.deltba)) - return 1; - for (i = 0; i < nfchans; i++) - if ((state->ba[i].deltbae == DELTA_BIT_NEW) && - parse_deltba (state, state->ba[i].deltba)) - return 1; + do_bit_alloc |= 64; + state->cplfleak = 9 - bitstream_get (state, 3); + state->cplsleak = 9 - bitstream_get (state, 3); + } + + if (bitstream_get (state, 1)) { /* deltbaie */ + do_bit_alloc = 127; + if (state->chincpl) /* cplinu */ + state->cplba.deltbae = bitstream_get (state, 2); + for (i = 0; i < nfchans; i++) + state->ba[i].deltbae = bitstream_get (state, 2); + if (state->chincpl && /* cplinu */ + (state->cplba.deltbae == DELTA_BIT_NEW) && + parse_deltba (state, state->cplba.deltba)) + return 1; + for (i = 0; i < nfchans; i++) + if ((state->ba[i].deltbae == DELTA_BIT_NEW) && + parse_deltba (state, state->ba[i].deltba)) + return 1; } if (do_bit_alloc) { - if (zero_snr_offsets (nfchans, state)) { - memset (state->cpl_expbap.bap, 0, sizeof (state->cpl_expbap.bap)); - for (i = 0; i < nfchans; i++) - memset (state->fbw_expbap[i].bap, 0, - sizeof (state->fbw_expbap[i].bap)); - memset (state->lfe_expbap.bap, 0, sizeof (state->lfe_expbap.bap)); - } else { - if (state->chincpl && (do_bit_alloc & 64)) /* cplinu */ - a52_bit_allocate (state, &state->cplba, state->cplstrtbnd, - state->cplstrtmant, state->cplendmant, - state->cplfleak << 8, state->cplsleak << 8, - &state->cpl_expbap); - for (i = 0; i < nfchans; i++) - if (do_bit_alloc & (1 << i)) - a52_bit_allocate (state, state->ba + i, 0, 0, - state->endmant[i], 0, 0, - state->fbw_expbap +i); - if (state->lfeon && (do_bit_alloc & 32)) { - state->lfeba.deltbae = DELTA_BIT_NONE; - a52_bit_allocate (state, &state->lfeba, 0, 0, 7, 0, 0, - &state->lfe_expbap); - } - } - } - - if (bitstream_get (state, 1)) { /* skiple */ - i = bitstream_get (state, 9); /* skipl */ - while (i--) - bitstream_get (state, 8); + if (zero_snr_offsets (nfchans, state)) { + memset (state->cpl_expbap.bap, 0, sizeof (state->cpl_expbap.bap)); + for (i = 0; i < nfchans; i++) + memset (state->fbw_expbap[i].bap, 0, + sizeof (state->fbw_expbap[i].bap)); + memset (state->lfe_expbap.bap, 0, sizeof (state->lfe_expbap.bap)); + } else { + if (state->chincpl && (do_bit_alloc & 64)) /* cplinu */ + a52_bit_allocate (state, &state->cplba, state->cplstrtbnd, + state->cplstrtmant, state->cplendmant, + state->cplfleak << 8, state->cplsleak << 8, + &state->cpl_expbap); + for (i = 0; i < nfchans; i++) + if (do_bit_alloc & (1 << i)) + a52_bit_allocate (state, state->ba + i, 0, 0, + state->endmant[i], 0, 0, + state->fbw_expbap +i); + if (state->lfeon && (do_bit_alloc & 32)) { + state->lfeba.deltbae = DELTA_BIT_NONE; + a52_bit_allocate (state, &state->lfeba, 0, 0, 7, 0, 0, + &state->lfe_expbap); + } + } + } + + if (bitstream_get (state, 1)) { /* skiple */ + i = bitstream_get (state, 9); /* skipl */ + while (i--) + bitstream_get (state, 8); } samples = state->samples; if (state->output & A52_LFE) - samples += 256; /* shift for LFE channel */ + samples += 256; /* shift for LFE channel */ chanbias = a52_downmix_coeff (coeff, state->acmod, state->output, - state->dynrng, state->clev, state->slev); + state->dynrng, state->clev, state->slev); quant.q1_ptr = quant.q2_ptr = quant.q4_ptr = -1; done_cpl = 0; for (i = 0; i < nfchans; i++) { - int j; - - coeff_get (state, samples + 256 * i, state->fbw_expbap +i, &quant, - coeff[i], dithflag[i], state->endmant[i]); - - if ((state->chincpl >> i) & 1) { - if (!done_cpl) { - done_cpl = 1; - coeff_get_coupling (state, nfchans, coeff, - (sample_t (*)[256])samples, &quant, - dithflag); - } - j = state->cplendmant; - } else - j = state->endmant[i]; - do - (samples + 256 * i)[j] = 0; - while (++j < 256); + int j; + + coeff_get (state, samples + 256 * i, state->fbw_expbap +i, &quant, + coeff[i], dithflag[i], state->endmant[i]); + + if ((state->chincpl >> i) & 1) { + if (!done_cpl) { + done_cpl = 1; + coeff_get_coupling (state, nfchans, coeff, + (sample_t (*)[256])samples, &quant, + dithflag); + } + j = state->cplendmant; + } else + j = state->endmant[i]; + do + (samples + 256 * i)[j] = 0; + while (++j < 256); } if (state->acmod == 2) { - int j, end, band, rematflg; - - end = ((state->endmant[0] < state->endmant[1]) ? - state->endmant[0] : state->endmant[1]); - - i = 0; - j = 13; - rematflg = state->rematflg; - do { - if (! (rematflg & 1)) { - rematflg >>= 1; - j = rematrix_band[i++]; - continue; - } - rematflg >>= 1; - band = rematrix_band[i++]; - if (band > end) - band = end; - do { - sample_t tmp0, tmp1; - - tmp0 = samples[j]; - tmp1 = (samples+256)[j]; - samples[j] = tmp0 + tmp1; - (samples+256)[j] = tmp0 - tmp1; - } while (++j < band); - } while (j < end); + int j, end, band, rematflg; + + end = ((state->endmant[0] < state->endmant[1]) ? + state->endmant[0] : state->endmant[1]); + + i = 0; + j = 13; + rematflg = state->rematflg; + do { + if (! (rematflg & 1)) { + rematflg >>= 1; + j = rematrix_band[i++]; + continue; + } + rematflg >>= 1; + band = rematrix_band[i++]; + if (band > end) + band = end; + do { + sample_t tmp0, tmp1; + + tmp0 = samples[j]; + tmp1 = (samples+256)[j]; + samples[j] = tmp0 + tmp1; + (samples+256)[j] = tmp0 - tmp1; + } while (++j < band); + } while (j < end); } if (state->lfeon) { - if (state->output & A52_LFE) { - coeff_get (state, samples - 256, &state->lfe_expbap, &quant, - state->dynrng, 0, 7); - for (i = 7; i < 256; i++) - (samples-256)[i] = 0; - a52_imdct_512 (samples - 256, samples + 1536 - 256); - } else { - /* just skip the LFE coefficients */ - coeff_get (state, samples + 1280, &state->lfe_expbap, &quant, - 0, 0, 7); - } + if (state->output & A52_LFE) { + coeff_get (state, samples - 256, &state->lfe_expbap, &quant, + state->dynrng, 0, 7); + for (i = 7; i < 256; i++) + (samples-256)[i] = 0; + a52_imdct_512 (samples - 256, samples + 1536 - 256); + } else { + /* just skip the LFE coefficients */ + coeff_get (state, samples + 1280, &state->lfe_expbap, &quant, + 0, 0, 7); + } } i = 0; if (nfchans_tbl[state->output & A52_CHANNEL_MASK] < nfchans) - for (i = 1; i < nfchans; i++) - if (blksw[i] != blksw[0]) - break; + for (i = 1; i < nfchans; i++) + if (blksw[i] != blksw[0]) + break; if (i < nfchans) { - if (state->downmixed) { - state->downmixed = 0; - a52_upmix (samples + 1536, state->acmod, state->output); - } - - for (i = 0; i < nfchans; i++) { - sample_t bias; - - bias = 0; - if (!(chanbias & (1 << i))) - bias = state->bias; - - if (coeff[i]) { - if (blksw[i]) - a52_imdct_256 (samples + 256 * i, samples + 1536 + 256 * i); - else - a52_imdct_512 (samples + 256 * i, samples + 1536 + 256 * i); - } else { - int j; - - for (j = 0; j < 256; j++) - (samples + 256 * i)[j] = bias; - } - } - - a52_downmix (samples, state->acmod, state->output, - state->clev, state->slev); + if (state->downmixed) { + state->downmixed = 0; + a52_upmix (samples + 1536, state->acmod, state->output); + } + + for (i = 0; i < nfchans; i++) { + sample_t bias; + + bias = 0; + if (!(chanbias & (1 << i))) + bias = state->bias; + + if (coeff[i]) { + if (blksw[i]) + a52_imdct_256 (samples + 256 * i, samples + 1536 + 256 * i); + else + a52_imdct_512 (samples + 256 * i, samples + 1536 + 256 * i); + } else { + int j; + + for (j = 0; j < 256; j++) + (samples + 256 * i)[j] = bias; + } + } + + a52_downmix (samples, state->acmod, state->output, + state->clev, state->slev); } else { - nfchans = nfchans_tbl[state->output & A52_CHANNEL_MASK]; - - a52_downmix (samples, state->acmod, state->output, - state->clev, state->slev); - - if (!state->downmixed) { - state->downmixed = 1; - a52_downmix (samples + 1536, state->acmod, state->output, - state->clev, state->slev); - } - - if (blksw[0]) - for (i = 0; i < nfchans; i++) - a52_imdct_256 (samples + 256 * i, samples + 1536 + 256 * i); - else - for (i = 0; i < nfchans; i++) - a52_imdct_512 (samples + 256 * i, samples + 1536 + 256 * i); + nfchans = nfchans_tbl[state->output & A52_CHANNEL_MASK]; + + a52_downmix (samples, state->acmod, state->output, + state->clev, state->slev); + + if (!state->downmixed) { + state->downmixed = 1; + a52_downmix (samples + 1536, state->acmod, state->output, + state->clev, state->slev); + } + + if (blksw[0]) + for (i = 0; i < nfchans; i++) + a52_imdct_256 (samples + 256 * i, samples + 1536 + 256 * i); + else + for (i = 0; i < nfchans; i++) + a52_imdct_512 (samples + 256 * i, samples + 1536 + 256 * i); } return 0; diff --git a/apps/codecs/libasap/acpu.c b/apps/codecs/libasap/acpu.c index 7c3c8f6f28..c5bff47a5d 100644 --- a/apps/codecs/libasap/acpu.c +++ b/apps/codecs/libasap/acpu.c @@ -52,105 +52,105 @@ #include "asap_internal.h" CONST_ARRAY(int, opcode_cycles) -/* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ - 7, 6, 2, 8, 3, 3, 5, 5, 3, 2, 2, 2, 4, 4, 6, 6, /* 0x */ - 2, 5, 2, 8, 4, 4, 6, 6, 2, 4, 2, 7, 4, 4, 7, 7, /* 1x */ - 6, 6, 2, 8, 3, 3, 5, 5, 4, 2, 2, 2, 4, 4, 6, 6, /* 2x */ - 2, 5, 2, 8, 4, 4, 6, 6, 2, 4, 2, 7, 4, 4, 7, 7, /* 3x */ - 6, 6, 2, 8, 3, 3, 5, 5, 3, 2, 2, 2, 3, 4, 6, 6, /* 4x */ - 2, 5, 2, 8, 4, 4, 6, 6, 2, 4, 2, 7, 4, 4, 7, 7, /* 5x */ - 6, 6, 2, 8, 3, 3, 5, 5, 4, 2, 2, 2, 5, 4, 6, 6, /* 6x */ - 2, 5, 2, 8, 4, 4, 6, 6, 2, 4, 2, 7, 4, 4, 7, 7, /* 7x */ - 2, 6, 2, 6, 3, 3, 3, 3, 2, 2, 2, 2, 4, 4, 4, 4, /* 8x */ - 2, 6, 2, 6, 4, 4, 4, 4, 2, 5, 2, 5, 5, 5, 5, 5, /* 9x */ - 2, 6, 2, 6, 3, 3, 3, 3, 2, 2, 2, 2, 4, 4, 4, 4, /* Ax */ - 2, 5, 2, 5, 4, 4, 4, 4, 2, 4, 2, 4, 4, 4, 4, 4, /* Bx */ - 2, 6, 2, 8, 3, 3, 5, 5, 2, 2, 2, 2, 4, 4, 6, 6, /* Cx */ - 2, 5, 2, 8, 4, 4, 6, 6, 2, 4, 2, 7, 4, 4, 7, 7, /* Dx */ - 2, 6, 2, 8, 3, 3, 5, 5, 2, 2, 2, 2, 4, 4, 6, 6, /* Ex */ - 2, 5, 2, 8, 4, 4, 6, 6, 2, 4, 2, 7, 4, 4, 7, 7 /* Fx */ +/* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ + 7, 6, 2, 8, 3, 3, 5, 5, 3, 2, 2, 2, 4, 4, 6, 6, /* 0x */ + 2, 5, 2, 8, 4, 4, 6, 6, 2, 4, 2, 7, 4, 4, 7, 7, /* 1x */ + 6, 6, 2, 8, 3, 3, 5, 5, 4, 2, 2, 2, 4, 4, 6, 6, /* 2x */ + 2, 5, 2, 8, 4, 4, 6, 6, 2, 4, 2, 7, 4, 4, 7, 7, /* 3x */ + 6, 6, 2, 8, 3, 3, 5, 5, 3, 2, 2, 2, 3, 4, 6, 6, /* 4x */ + 2, 5, 2, 8, 4, 4, 6, 6, 2, 4, 2, 7, 4, 4, 7, 7, /* 5x */ + 6, 6, 2, 8, 3, 3, 5, 5, 4, 2, 2, 2, 5, 4, 6, 6, /* 6x */ + 2, 5, 2, 8, 4, 4, 6, 6, 2, 4, 2, 7, 4, 4, 7, 7, /* 7x */ + 2, 6, 2, 6, 3, 3, 3, 3, 2, 2, 2, 2, 4, 4, 4, 4, /* 8x */ + 2, 6, 2, 6, 4, 4, 4, 4, 2, 5, 2, 5, 5, 5, 5, 5, /* 9x */ + 2, 6, 2, 6, 3, 3, 3, 3, 2, 2, 2, 2, 4, 4, 4, 4, /* Ax */ + 2, 5, 2, 5, 4, 4, 4, 4, 2, 4, 2, 4, 4, 4, 4, 4, /* Bx */ + 2, 6, 2, 8, 3, 3, 5, 5, 2, 2, 2, 2, 4, 4, 6, 6, /* Cx */ + 2, 5, 2, 8, 4, 4, 6, 6, 2, 4, 2, 7, 4, 4, 7, 7, /* Dx */ + 2, 6, 2, 8, 3, 3, 5, 5, 2, 2, 2, 2, 4, 4, 6, 6, /* Ex */ + 2, 5, 2, 8, 4, 4, 6, 6, 2, 4, 2, 7, 4, 4, 7, 7 /* Fx */ END_CONST_ARRAY; #ifdef ACPU_NO_DECIMAL #define DO_ADC \ - { \ - /* binary mode */ \ - V(int, tmp) = a + data + c; \ - c = tmp >> 8; \ - vdi &= D_FLAG | I_FLAG; \ - if (((a ^ data) & 0x80) == 0 && ((data ^ tmp) & 0x80) != 0) \ - vdi += V_FLAG; \ - nz = a = tmp & 0xff; \ - } + { \ + /* binary mode */ \ + V(int, tmp) = a + data + c; \ + c = tmp >> 8; \ + vdi &= D_FLAG | I_FLAG; \ + if (((a ^ data) & 0x80) == 0 && ((data ^ tmp) & 0x80) != 0) \ + vdi += V_FLAG; \ + nz = a = tmp & 0xff; \ + } #define DO_SBC \ - { \ - /* binary mode */ \ - V(int, tmp) = a - data - 1 + c; \ - c = (tmp >= 0) ? 1 : 0; \ - vdi &= D_FLAG | I_FLAG; \ - if (((a ^ tmp) & 0x80) != 0 && ((a ^ data) & 0x80) != 0) \ - vdi += V_FLAG; \ - nz = a = tmp & 0xff; \ - } + { \ + /* binary mode */ \ + V(int, tmp) = a - data - 1 + c; \ + c = (tmp >= 0) ? 1 : 0; \ + vdi &= D_FLAG | I_FLAG; \ + if (((a ^ tmp) & 0x80) != 0 && ((a ^ data) & 0x80) != 0) \ + vdi += V_FLAG; \ + nz = a = tmp & 0xff; \ + } #else /* ACPU_NO_DECIMAL */ #define DO_ADC \ - if ((vdi & D_FLAG) == 0) { \ - /* binary mode */ \ - V(int, tmp) = a + data + c; \ - c = tmp >> 8; \ - vdi &= D_FLAG | I_FLAG; \ - if (((a ^ data) & 0x80) == 0 && ((data ^ tmp) & 0x80) != 0) \ - vdi += V_FLAG; \ - nz = a = tmp & 0xff; \ - } \ - else { \ - /* decimal mode */ \ - V(int, tmp) = (a & 0x0f) + (data & 0x0f) + c; \ - if (tmp >= 10) \ - tmp = (tmp - 10) | 0x10; \ - tmp += (a & 0xf0) + (data & 0xf0); \ - nz = ((tmp & 0x80) << 1) + ((a + data + c) & 0xff); \ - vdi &= D_FLAG | I_FLAG; \ - if (((a ^ data) & 0x80) == 0 && ((data ^ tmp) & 0x80) != 0) \ - vdi += V_FLAG; \ - if (tmp > 0x9f) \ - tmp += 0x60; \ - c = (tmp > 0xff) ? 1 : 0; \ - a = tmp & 0xff; \ - } + if ((vdi & D_FLAG) == 0) { \ + /* binary mode */ \ + V(int, tmp) = a + data + c; \ + c = tmp >> 8; \ + vdi &= D_FLAG | I_FLAG; \ + if (((a ^ data) & 0x80) == 0 && ((data ^ tmp) & 0x80) != 0) \ + vdi += V_FLAG; \ + nz = a = tmp & 0xff; \ + } \ + else { \ + /* decimal mode */ \ + V(int, tmp) = (a & 0x0f) + (data & 0x0f) + c; \ + if (tmp >= 10) \ + tmp = (tmp - 10) | 0x10; \ + tmp += (a & 0xf0) + (data & 0xf0); \ + nz = ((tmp & 0x80) << 1) + ((a + data + c) & 0xff); \ + vdi &= D_FLAG | I_FLAG; \ + if (((a ^ data) & 0x80) == 0 && ((data ^ tmp) & 0x80) != 0) \ + vdi += V_FLAG; \ + if (tmp > 0x9f) \ + tmp += 0x60; \ + c = (tmp > 0xff) ? 1 : 0; \ + a = tmp & 0xff; \ + } #define DO_SBC \ - if ((vdi & D_FLAG) == 0) { \ - /* binary mode */ \ - V(int, tmp) = a - data - 1 + c; \ - c = (tmp >= 0) ? 1 : 0; \ - vdi &= D_FLAG | I_FLAG; \ - if (((a ^ tmp) & 0x80) != 0 && ((a ^ data) & 0x80) != 0) \ - vdi += V_FLAG; \ - nz = a = tmp & 0xff; \ - } \ - else { \ - /* decimal mode */ \ - V(int, tmp) = a - data - 1 + c; \ - V(int, al) = (a & 0x0f) - (data & 0x0f) - 1 + c; \ - V(int, ah) = (a >> 4) - (data >> 4); \ - if ((al & 0x10) != 0) { \ - al -= 6; \ - ah--; \ - } \ - if ((ah & 0x10) != 0) \ - ah -= 6; \ - c = tmp >= 0 ? 1 : 0; \ - vdi &= D_FLAG | I_FLAG; \ - if (((a ^ tmp) & 0x80) != 0 && ((a ^ data) & 0x80) != 0) \ - vdi += V_FLAG; \ - nz = tmp & 0xff; \ - a = ((ah & 0xf) << 4) + (al & 0x0f); \ - } + if ((vdi & D_FLAG) == 0) { \ + /* binary mode */ \ + V(int, tmp) = a - data - 1 + c; \ + c = (tmp >= 0) ? 1 : 0; \ + vdi &= D_FLAG | I_FLAG; \ + if (((a ^ tmp) & 0x80) != 0 && ((a ^ data) & 0x80) != 0) \ + vdi += V_FLAG; \ + nz = a = tmp & 0xff; \ + } \ + else { \ + /* decimal mode */ \ + V(int, tmp) = a - data - 1 + c; \ + V(int, al) = (a & 0x0f) - (data & 0x0f) - 1 + c; \ + V(int, ah) = (a >> 4) - (data >> 4); \ + if ((al & 0x10) != 0) { \ + al -= 6; \ + ah--; \ + } \ + if ((ah & 0x10) != 0) \ + ah -= 6; \ + c = tmp >= 0 ? 1 : 0; \ + vdi &= D_FLAG | I_FLAG; \ + if (((a ^ tmp) & 0x80) != 0 && ((a ^ data) & 0x80) != 0) \ + vdi += V_FLAG; \ + nz = tmp & 0xff; \ + a = ((ah & 0xf) << 4) + (al & 0x0f); \ + } #endif /* ACPU_NO_DECIMAL */ @@ -239,1068 +239,1068 @@ END_CONST_ARRAY; #define INS_ZP INC_ZP; data = nz; DO_SBC #define BRANCH(cond) \ - if (cond) { \ - addr = SBYTE(PEEK); \ - pc++; \ - addr += pc; \ - if ((addr ^ pc) >> 8 != 0) \ - ast _ cycle++; \ - ast _ cycle++; \ - pc = addr; \ - break; \ - } \ - pc++; \ - break + if (cond) { \ + addr = SBYTE(PEEK); \ + pc++; \ + addr += pc; \ + if ((addr ^ pc) >> 8 != 0) \ + ast _ cycle++; \ + ast _ cycle++; \ + pc = addr; \ + break; \ + } \ + pc++; \ + break #define CHECK_IRQ \ - if ((vdi & I_FLAG) == 0 && ast _ irqst != 0xff) { \ - PHPC; \ - PHPB0; \ - vdi |= I_FLAG; \ - pc = dGetWord(0xfffe); \ - ast _ cycle += 7; \ - } + if ((vdi & I_FLAG) == 0 && ast _ irqst != 0xff) { \ + PHPC; \ + PHPB0; \ + vdi |= I_FLAG; \ + pc = dGetWord(0xfffe); \ + ast _ cycle += 7; \ + } /* Runs 6502 emulation for the specified number of Atari scanlines. Each scanline is 114 cycles of which 9 is taken by ANTIC for memory refresh. */ FUNC(void, Cpu_RunScanlines, (P(ASAP_State PTR, ast), P(int, scanlines))) { - /* copy registers from ASAP_State to local variables for improved performance */ - V(int, pc); - V(int, nz); - V(int, a); - V(int, x); - V(int, y); - V(int, c); - V(int, s); - V(int, vdi); - V(int, next_event_cycle); - V(int, cycle_limit); - pc = ast _ cpu_pc; - nz = ast _ cpu_nz; - a = ast _ cpu_a; - x = ast _ cpu_x; - y = ast _ cpu_y; - c = ast _ cpu_c; - s = ast _ cpu_s; - vdi = ast _ cpu_vdi; - ast _ next_scanline_cycle = 114; - next_event_cycle = 114; - cycle_limit = 114 * scanlines; - if (next_event_cycle > ast _ timer1_cycle) - next_event_cycle = ast _ timer1_cycle; - if (next_event_cycle > ast _ timer2_cycle) - next_event_cycle = ast _ timer2_cycle; - if (next_event_cycle > ast _ timer4_cycle) - next_event_cycle = ast _ timer4_cycle; - ast _ nearest_event_cycle = next_event_cycle; - for (;;) { - V(int, cycle); - V(int, addr); - V(int, data); - cycle = ast _ cycle; - if (cycle >= ast _ nearest_event_cycle) { - if (cycle >= ast _ next_scanline_cycle) { - if (++ast _ scanline_number == 312) - ast _ scanline_number = 0; - ast _ cycle = cycle += 9; - ast _ next_scanline_cycle += 114; - if (--scanlines <= 0) - break; - } - next_event_cycle = ast _ next_scanline_cycle; + /* copy registers from ASAP_State to local variables for improved performance */ + V(int, pc); + V(int, nz); + V(int, a); + V(int, x); + V(int, y); + V(int, c); + V(int, s); + V(int, vdi); + V(int, next_event_cycle); + V(int, cycle_limit); + pc = ast _ cpu_pc; + nz = ast _ cpu_nz; + a = ast _ cpu_a; + x = ast _ cpu_x; + y = ast _ cpu_y; + c = ast _ cpu_c; + s = ast _ cpu_s; + vdi = ast _ cpu_vdi; + ast _ next_scanline_cycle = 114; + next_event_cycle = 114; + cycle_limit = 114 * scanlines; + if (next_event_cycle > ast _ timer1_cycle) + next_event_cycle = ast _ timer1_cycle; + if (next_event_cycle > ast _ timer2_cycle) + next_event_cycle = ast _ timer2_cycle; + if (next_event_cycle > ast _ timer4_cycle) + next_event_cycle = ast _ timer4_cycle; + ast _ nearest_event_cycle = next_event_cycle; + for (;;) { + V(int, cycle); + V(int, addr); + V(int, data); + cycle = ast _ cycle; + if (cycle >= ast _ nearest_event_cycle) { + if (cycle >= ast _ next_scanline_cycle) { + if (++ast _ scanline_number == 312) + ast _ scanline_number = 0; + ast _ cycle = cycle += 9; + ast _ next_scanline_cycle += 114; + if (--scanlines <= 0) + break; + } + next_event_cycle = ast _ next_scanline_cycle; #define CHECK_TIMER_IRQ(ch) \ - if (cycle >= ast _ timer##ch##_cycle) { \ - ast _ irqst &= ~ch; \ - ast _ timer##ch##_cycle = NEVER; \ - } \ - else if (next_event_cycle > ast _ timer##ch##_cycle) \ - next_event_cycle = ast _ timer##ch##_cycle; - CHECK_TIMER_IRQ(1); - CHECK_TIMER_IRQ(2); - CHECK_TIMER_IRQ(4); - ast _ nearest_event_cycle = next_event_cycle; - CHECK_IRQ; - } + if (cycle >= ast _ timer##ch##_cycle) { \ + ast _ irqst &= ~ch; \ + ast _ timer##ch##_cycle = NEVER; \ + } \ + else if (next_event_cycle > ast _ timer##ch##_cycle) \ + next_event_cycle = ast _ timer##ch##_cycle; + CHECK_TIMER_IRQ(1); + CHECK_TIMER_IRQ(2); + CHECK_TIMER_IRQ(4); + ast _ nearest_event_cycle = next_event_cycle; + CHECK_IRQ; + } #ifdef ASAPSCAN - if (cpu_trace != 0) - trace_cpu(ast, pc, a, x, y, s, nz, vdi, c); + if (cpu_trace != 0) + trace_cpu(ast, pc, a, x, y, s, nz, vdi, c); #endif - data = FETCH; - ast _ cycle += opcode_cycles[data]; - switch (data) { - case 0x00: /* BRK */ - pc++; - PHPC; - PHPB1; - vdi |= I_FLAG; - pc = dGetWord(0xfffe); - break; - case 0x01: /* ORA (ab,x) */ - INDIRECT_X; - ORA; - break; - case 0x02: /* CIM [unofficial] */ - case 0x12: - case 0x22: - case 0x32: - case 0x42: - case 0x52: - case 0x62: - case 0x72: - case 0x92: - case 0xb2: - case 0xd2: - case 0xf2: - ast _ scanline_number = (ast _ scanline_number + scanlines - 1) % 312; - scanlines = 1; - ast _ cycle = cycle_limit; - break; + data = FETCH; + ast _ cycle += opcode_cycles[data]; + switch (data) { + case 0x00: /* BRK */ + pc++; + PHPC; + PHPB1; + vdi |= I_FLAG; + pc = dGetWord(0xfffe); + break; + case 0x01: /* ORA (ab,x) */ + INDIRECT_X; + ORA; + break; + case 0x02: /* CIM [unofficial] */ + case 0x12: + case 0x22: + case 0x32: + case 0x42: + case 0x52: + case 0x62: + case 0x72: + case 0x92: + case 0xb2: + case 0xd2: + case 0xf2: + ast _ scanline_number = (ast _ scanline_number + scanlines - 1) % 312; + scanlines = 1; + ast _ cycle = cycle_limit; + break; #ifndef ACPU_NO_UNOFFICIAL - case 0x03: /* ASO (ab,x) [unofficial] */ - INDIRECT_X; - ASO; - break; - case 0x04: /* NOP ab [unofficial] */ - case 0x44: - case 0x64: - case 0x14: /* NOP ab,x [unofficial] */ - case 0x34: - case 0x54: - case 0x74: - case 0xd4: - case 0xf4: - case 0x80: /* NOP #ab [unofficial] */ - case 0x82: - case 0x89: - case 0xc2: - case 0xe2: - pc++; - break; - case 0x07: /* ASO ab [unofficial] */ - ZPAGE; - ASO_ZP; - break; - case 0x0b: /* ANC #ab [unofficial] */ - case 0x2b: - nz = a &= FETCH; - c = nz >> 7; - break; - case 0x0c: /* NOP abcd [unofficial] */ - pc += 2; - break; - case 0x0f: /* ASO abcd [unofficial] */ - ABSOLUTE; - ASO; - break; - case 0x13: /* ASO (ab),y [unofficial] */ - INDIRECT_Y; - ASO; - break; - case 0x17: /* ASO ab,x [unofficial] */ - ZPAGE_X; - ASO_ZP; - break; - case 0x1b: /* ASO abcd,y [unofficial] */ - ABSOLUTE_Y; - ASO; - break; - case 0x1c: /* NOP abcd,x [unofficial] */ - case 0x3c: - case 0x5c: - case 0x7c: - case 0xdc: - case 0xfc: - if (FETCH + x >= 0x100) - ast _ cycle++; - pc++; - break; - case 0x1f: /* ASO abcd,x [unofficial] */ - ABSOLUTE_X; - ASO; - break; - case 0x23: /* RLA (ab,x) [unofficial] */ - INDIRECT_X; - RLA; - break; - case 0x27: /* RLA ab [unofficial] */ - ZPAGE; - RLA_ZP; - break; - case 0x2f: /* RLA abcd [unofficial] */ - ABSOLUTE; - RLA; - break; - case 0x33: /* RLA (ab),y [unofficial] */ - INDIRECT_Y; - RLA; - break; - case 0x37: /* RLA ab,x [unofficial] */ - ZPAGE_X; - RLA_ZP; - break; - case 0x3b: /* RLA abcd,y [unofficial] */ - ABSOLUTE_Y; - RLA; - break; - case 0x3f: /* RLA abcd,x [unofficial] */ - ABSOLUTE_X; - RLA; - break; - case 0x43: /* LSE (ab,x) [unofficial] */ - INDIRECT_X; - LSE; - break; - case 0x47: /* LSE ab [unofficial] */ - ZPAGE; - LSE_ZP; - break; - case 0x4b: /* ALR #ab [unofficial] */ - a &= FETCH; - c = a & 1; - nz = a >>= 1; - break; - case 0x4f: /* LSE abcd [unofficial] */ - ABSOLUTE; - LSE; - break; - case 0x53: /* LSE (ab),y [unofficial] */ - INDIRECT_Y; - LSE; - break; - case 0x57: /* LSE ab,x [unofficial] */ - ZPAGE_X; - LSE_ZP; - break; - case 0x5b: /* LSE abcd,y [unofficial] */ - ABSOLUTE_Y; - LSE; - break; - case 0x5f: /* LSE abcd,x [unofficial] */ - ABSOLUTE_X; - LSE; - break; - case 0x63: /* RRA (ab,x) [unofficial] */ - INDIRECT_X; - RRA; - break; - case 0x67: /* RRA ab [unofficial] */ - ZPAGE; - RRA_ZP; - break; - case 0x6b: /* ARR #ab [unofficial] */ - data = a & FETCH; - nz = a = (data >> 1) + (c << 7); - vdi = (vdi & (D_FLAG | I_FLAG)) + ((a ^ data) & V_FLAG); + case 0x03: /* ASO (ab,x) [unofficial] */ + INDIRECT_X; + ASO; + break; + case 0x04: /* NOP ab [unofficial] */ + case 0x44: + case 0x64: + case 0x14: /* NOP ab,x [unofficial] */ + case 0x34: + case 0x54: + case 0x74: + case 0xd4: + case 0xf4: + case 0x80: /* NOP #ab [unofficial] */ + case 0x82: + case 0x89: + case 0xc2: + case 0xe2: + pc++; + break; + case 0x07: /* ASO ab [unofficial] */ + ZPAGE; + ASO_ZP; + break; + case 0x0b: /* ANC #ab [unofficial] */ + case 0x2b: + nz = a &= FETCH; + c = nz >> 7; + break; + case 0x0c: /* NOP abcd [unofficial] */ + pc += 2; + break; + case 0x0f: /* ASO abcd [unofficial] */ + ABSOLUTE; + ASO; + break; + case 0x13: /* ASO (ab),y [unofficial] */ + INDIRECT_Y; + ASO; + break; + case 0x17: /* ASO ab,x [unofficial] */ + ZPAGE_X; + ASO_ZP; + break; + case 0x1b: /* ASO abcd,y [unofficial] */ + ABSOLUTE_Y; + ASO; + break; + case 0x1c: /* NOP abcd,x [unofficial] */ + case 0x3c: + case 0x5c: + case 0x7c: + case 0xdc: + case 0xfc: + if (FETCH + x >= 0x100) + ast _ cycle++; + pc++; + break; + case 0x1f: /* ASO abcd,x [unofficial] */ + ABSOLUTE_X; + ASO; + break; + case 0x23: /* RLA (ab,x) [unofficial] */ + INDIRECT_X; + RLA; + break; + case 0x27: /* RLA ab [unofficial] */ + ZPAGE; + RLA_ZP; + break; + case 0x2f: /* RLA abcd [unofficial] */ + ABSOLUTE; + RLA; + break; + case 0x33: /* RLA (ab),y [unofficial] */ + INDIRECT_Y; + RLA; + break; + case 0x37: /* RLA ab,x [unofficial] */ + ZPAGE_X; + RLA_ZP; + break; + case 0x3b: /* RLA abcd,y [unofficial] */ + ABSOLUTE_Y; + RLA; + break; + case 0x3f: /* RLA abcd,x [unofficial] */ + ABSOLUTE_X; + RLA; + break; + case 0x43: /* LSE (ab,x) [unofficial] */ + INDIRECT_X; + LSE; + break; + case 0x47: /* LSE ab [unofficial] */ + ZPAGE; + LSE_ZP; + break; + case 0x4b: /* ALR #ab [unofficial] */ + a &= FETCH; + c = a & 1; + nz = a >>= 1; + break; + case 0x4f: /* LSE abcd [unofficial] */ + ABSOLUTE; + LSE; + break; + case 0x53: /* LSE (ab),y [unofficial] */ + INDIRECT_Y; + LSE; + break; + case 0x57: /* LSE ab,x [unofficial] */ + ZPAGE_X; + LSE_ZP; + break; + case 0x5b: /* LSE abcd,y [unofficial] */ + ABSOLUTE_Y; + LSE; + break; + case 0x5f: /* LSE abcd,x [unofficial] */ + ABSOLUTE_X; + LSE; + break; + case 0x63: /* RRA (ab,x) [unofficial] */ + INDIRECT_X; + RRA; + break; + case 0x67: /* RRA ab [unofficial] */ + ZPAGE; + RRA_ZP; + break; + case 0x6b: /* ARR #ab [unofficial] */ + data = a & FETCH; + nz = a = (data >> 1) + (c << 7); + vdi = (vdi & (D_FLAG | I_FLAG)) + ((a ^ data) & V_FLAG); #ifdef ACPU_NO_DECIMAL - c = data >> 7; + c = data >> 7; #else - if ((vdi & D_FLAG) == 0) - c = data >> 7; - else { - if ((data & 0xf) >= 5) - a = (a & 0xf0) + ((a + 6) & 0xf); - if (data >= 0x50) { - a = (a + 0x60) & 0xff; - c = 1; - } - else - c = 0; - } + if ((vdi & D_FLAG) == 0) + c = data >> 7; + else { + if ((data & 0xf) >= 5) + a = (a & 0xf0) + ((a + 6) & 0xf); + if (data >= 0x50) { + a = (a + 0x60) & 0xff; + c = 1; + } + else + c = 0; + } #endif - break; - case 0x6f: /* RRA abcd [unofficial] */ - ABSOLUTE; - RRA; - break; - case 0x73: /* RRA (ab),y [unofficial] */ - INDIRECT_Y; - RRA; - break; - case 0x77: /* RRA ab,x [unofficial] */ - ZPAGE_X; - RRA_ZP; - break; - case 0x7b: /* RRA abcd,y [unofficial] */ - ABSOLUTE_Y; - RRA; - break; - case 0x7f: /* RRA abcd,x [unofficial] */ - ABSOLUTE_X; - RRA; - break; - case 0x83: /* SAX (ab,x) [unofficial] */ - INDIRECT_X; - SAX; - break; - case 0x87: /* SAX ab [unofficial] */ - ZPAGE; - SAX_ZP; - break; - case 0x8b: /* ANE #ab [unofficial] */ - data = FETCH; - a &= x; - nz = a & data; - a &= data | 0xef; - break; - case 0x8f: /* SAX abcd [unofficial] */ - ABSOLUTE; - SAX; - break; - case 0x93: /* SHA (ab),y [unofficial, unstable] */ - ZPAGE; - data = zGetByte(addr + 1); - addr = (dGetByte(addr) + (data << 8) + y) & 0xffff; - data = a & x & (data + 1); - PutByte(addr, data); - break; - case 0x97: /* SAX ab,y [unofficial] */ - ZPAGE_Y; - SAX_ZP; - break; - case 0x9b: /* SHS abcd,y [unofficial, unstable] */ - /* S seems to be stable, only memory values vary */ - addr = FETCH; - data = FETCH; - addr = (addr + (data << 8) + y) & 0xffff; - s = a & x; - data = s & (data + 1); - PutByte(addr, data); - break; - case 0x9c: /* SHY abcd,x [unofficial] */ - addr = FETCH; - data = FETCH; - addr = (addr + (data << 8) + x) & 0xffff; - data = y & (data + 1); - PutByte(addr, data); - break; - case 0x9e: /* SHX abcd,y [unofficial] */ - addr = FETCH; - data = FETCH; - addr = (addr + (data << 8) + y) & 0xffff; - data = x & (data + 1); - PutByte(addr, data); - break; - case 0x9f: /* SHA abcd,y [unofficial, unstable] */ - addr = FETCH; - data = FETCH; - addr = (addr + (data << 8) + y) & 0xffff; - data = a & x & (data + 1); - PutByte(addr, data); - break; - case 0xa3: /* LAX (ab,x) [unofficial] */ - INDIRECT_X; - LAX; - break; - case 0xa7: /* LAX ab [unofficial] */ - ZPAGE; - LAX_ZP; - break; - case 0xab: /* ANX #ab [unofficial] */ - nz = x = a &= FETCH; - break; - case 0xaf: /* LAX abcd [unofficial] */ - ABSOLUTE; - LAX; - break; - case 0xb3: /* LAX (ab),y [unofficial] */ - INDIRECT_Y; - NCYCLES_Y; - LAX; - break; - case 0xb7: /* LAX ab,y [unofficial] */ - ZPAGE_Y; - LAX_ZP; - break; - case 0xbb: /* LAS abcd,y [unofficial] */ - ABSOLUTE_Y; - NCYCLES_Y; - nz = x = a = s &= GetByte(addr); - break; - case 0xbf: /* LAX abcd,y [unofficial] */ - ABSOLUTE_Y; - NCYCLES_Y; - LAX; - break; - case 0xc3: /* DCM (ab,x) [unofficial] */ - INDIRECT_X; - DCM; - break; - case 0xc7: /* DCM ab [unofficial] */ - ZPAGE; - DCM_ZP; - break; - case 0xcb: /* SBX #ab [unofficial] */ - nz = FETCH; - x &= a; - c = (x >= nz) ? 1 : 0; - nz = x = (x - nz) & 0xff; - break; - case 0xcf: /* DCM abcd [unofficial] */ - ABSOLUTE; - DCM; - break; - case 0xd3: /* DCM (ab),y [unofficial] */ - INDIRECT_Y; - DCM; - break; - case 0xd7: /* DCM ab,x [unofficial] */ - ZPAGE_X; - DCM_ZP; - break; - case 0xdb: /* DCM abcd,y [unofficial] */ - ABSOLUTE_Y; - DCM; - break; - case 0xdf: /* DCM abcd,x [unofficial] */ - ABSOLUTE_X; - DCM; - break; - case 0xe3: /* INS (ab,x) [unofficial] */ - INDIRECT_X; - INS; - break; - case 0xe7: /* INS ab [unofficial] */ - ZPAGE; - INS_ZP; - break; - case 0xef: /* INS abcd [unofficial] */ - ABSOLUTE; - INS; - break; - case 0xf3: /* INS (ab),y [unofficial] */ - INDIRECT_Y; - INS; - break; - case 0xf7: /* INS ab,x [unofficial] */ - ZPAGE_X; - INS_ZP; - break; - case 0xfb: /* INS abcd,y [unofficial] */ - ABSOLUTE_Y; - INS; - break; - case 0xff: /* INS abcd,x [unofficial] */ - ABSOLUTE_X; - INS; - break; + break; + case 0x6f: /* RRA abcd [unofficial] */ + ABSOLUTE; + RRA; + break; + case 0x73: /* RRA (ab),y [unofficial] */ + INDIRECT_Y; + RRA; + break; + case 0x77: /* RRA ab,x [unofficial] */ + ZPAGE_X; + RRA_ZP; + break; + case 0x7b: /* RRA abcd,y [unofficial] */ + ABSOLUTE_Y; + RRA; + break; + case 0x7f: /* RRA abcd,x [unofficial] */ + ABSOLUTE_X; + RRA; + break; + case 0x83: /* SAX (ab,x) [unofficial] */ + INDIRECT_X; + SAX; + break; + case 0x87: /* SAX ab [unofficial] */ + ZPAGE; + SAX_ZP; + break; + case 0x8b: /* ANE #ab [unofficial] */ + data = FETCH; + a &= x; + nz = a & data; + a &= data | 0xef; + break; + case 0x8f: /* SAX abcd [unofficial] */ + ABSOLUTE; + SAX; + break; + case 0x93: /* SHA (ab),y [unofficial, unstable] */ + ZPAGE; + data = zGetByte(addr + 1); + addr = (dGetByte(addr) + (data << 8) + y) & 0xffff; + data = a & x & (data + 1); + PutByte(addr, data); + break; + case 0x97: /* SAX ab,y [unofficial] */ + ZPAGE_Y; + SAX_ZP; + break; + case 0x9b: /* SHS abcd,y [unofficial, unstable] */ + /* S seems to be stable, only memory values vary */ + addr = FETCH; + data = FETCH; + addr = (addr + (data << 8) + y) & 0xffff; + s = a & x; + data = s & (data + 1); + PutByte(addr, data); + break; + case 0x9c: /* SHY abcd,x [unofficial] */ + addr = FETCH; + data = FETCH; + addr = (addr + (data << 8) + x) & 0xffff; + data = y & (data + 1); + PutByte(addr, data); + break; + case 0x9e: /* SHX abcd,y [unofficial] */ + addr = FETCH; + data = FETCH; + addr = (addr + (data << 8) + y) & 0xffff; + data = x & (data + 1); + PutByte(addr, data); + break; + case 0x9f: /* SHA abcd,y [unofficial, unstable] */ + addr = FETCH; + data = FETCH; + addr = (addr + (data << 8) + y) & 0xffff; + data = a & x & (data + 1); + PutByte(addr, data); + break; + case 0xa3: /* LAX (ab,x) [unofficial] */ + INDIRECT_X; + LAX; + break; + case 0xa7: /* LAX ab [unofficial] */ + ZPAGE; + LAX_ZP; + break; + case 0xab: /* ANX #ab [unofficial] */ + nz = x = a &= FETCH; + break; + case 0xaf: /* LAX abcd [unofficial] */ + ABSOLUTE; + LAX; + break; + case 0xb3: /* LAX (ab),y [unofficial] */ + INDIRECT_Y; + NCYCLES_Y; + LAX; + break; + case 0xb7: /* LAX ab,y [unofficial] */ + ZPAGE_Y; + LAX_ZP; + break; + case 0xbb: /* LAS abcd,y [unofficial] */ + ABSOLUTE_Y; + NCYCLES_Y; + nz = x = a = s &= GetByte(addr); + break; + case 0xbf: /* LAX abcd,y [unofficial] */ + ABSOLUTE_Y; + NCYCLES_Y; + LAX; + break; + case 0xc3: /* DCM (ab,x) [unofficial] */ + INDIRECT_X; + DCM; + break; + case 0xc7: /* DCM ab [unofficial] */ + ZPAGE; + DCM_ZP; + break; + case 0xcb: /* SBX #ab [unofficial] */ + nz = FETCH; + x &= a; + c = (x >= nz) ? 1 : 0; + nz = x = (x - nz) & 0xff; + break; + case 0xcf: /* DCM abcd [unofficial] */ + ABSOLUTE; + DCM; + break; + case 0xd3: /* DCM (ab),y [unofficial] */ + INDIRECT_Y; + DCM; + break; + case 0xd7: /* DCM ab,x [unofficial] */ + ZPAGE_X; + DCM_ZP; + break; + case 0xdb: /* DCM abcd,y [unofficial] */ + ABSOLUTE_Y; + DCM; + break; + case 0xdf: /* DCM abcd,x [unofficial] */ + ABSOLUTE_X; + DCM; + break; + case 0xe3: /* INS (ab,x) [unofficial] */ + INDIRECT_X; + INS; + break; + case 0xe7: /* INS ab [unofficial] */ + ZPAGE; + INS_ZP; + break; + case 0xef: /* INS abcd [unofficial] */ + ABSOLUTE; + INS; + break; + case 0xf3: /* INS (ab),y [unofficial] */ + INDIRECT_Y; + INS; + break; + case 0xf7: /* INS ab,x [unofficial] */ + ZPAGE_X; + INS_ZP; + break; + case 0xfb: /* INS abcd,y [unofficial] */ + ABSOLUTE_Y; + INS; + break; + case 0xff: /* INS abcd,x [unofficial] */ + ABSOLUTE_X; + INS; + break; #endif /* ACPU_NO_UNOFFICIAL */ - case 0x05: /* ORA ab */ - ZPAGE; - ORA_ZP; - break; - case 0x06: /* ASL ab */ - ZPAGE; - ASL_ZP; - break; - case 0x08: /* PHP */ - PHPB1; - break; - case 0x09: /* ORA #ab */ - nz = a |= FETCH; - break; - case 0x0a: /* ASL */ - c = a >> 7; - nz = a = (a << 1) & 0xff; - break; - case 0x0d: /* ORA abcd */ - ABSOLUTE; - ORA; - break; - case 0x0e: /* ASL abcd */ - ABSOLUTE; - ASL; - break; - case 0x10: /* BPL */ - BRANCH(nz < 0x80); - case 0x11: /* ORA (ab),y */ - INDIRECT_Y; - NCYCLES_Y; - ORA; - break; - case 0x15: /* ORA ab,x */ - ZPAGE_X; - ORA_ZP; - break; - case 0x16: /* ASL ab,x */ - ZPAGE_X; - ASL_ZP; - break; - case 0x18: /* CLC */ - c = 0; - break; - case 0x19: /* ORA abcd,y */ - ABSOLUTE_Y; - NCYCLES_Y; - ORA; - break; - case 0x1d: /* ORA abcd,x */ - ABSOLUTE_X; - NCYCLES_X; - ORA; - break; - case 0x1e: /* ASL abcd,x */ - ABSOLUTE_X; - ASL; - break; - case 0x20: /* JSR abcd */ - addr = FETCH; - PHPC; - pc = addr + (PEEK << 8); - break; - case 0x21: /* AND (ab,x) */ - INDIRECT_X; - AND; - break; - case 0x24: /* BIT ab */ - ZPAGE; - nz = dGetByte(addr); - vdi = (vdi & (D_FLAG | I_FLAG)) + (nz & V_FLAG); - nz = ((nz & 0x80) << 1) + (nz & a); - break; - case 0x25: /* AND ab */ - ZPAGE; - AND_ZP; - break; - case 0x26: /* ROL ab */ - ZPAGE; - ROL_ZP; - break; - case 0x28: /* PLP */ - PLP; - CHECK_IRQ; - break; - case 0x29: /* AND #ab */ - nz = a &= FETCH; - break; - case 0x2a: /* ROL */ - a = (a << 1) + c; - c = a >> 8; - nz = a &= 0xff; - break; - case 0x2c: /* BIT abcd */ - ABSOLUTE; - nz = GetByte(addr); - vdi = (vdi & (D_FLAG | I_FLAG)) + (nz & V_FLAG); - nz = ((nz & 0x80) << 1) + (nz & a); - break; - case 0x2d: /* AND abcd */ - ABSOLUTE; - AND; - break; - case 0x2e: /* ROL abcd */ - ABSOLUTE; - ROL; - break; - case 0x30: /* BMI */ - BRANCH(nz >= 0x80); - case 0x31: /* AND (ab),y */ - INDIRECT_Y; - NCYCLES_Y; - AND; - break; - case 0x35: /* AND ab,x */ - ZPAGE_X; - AND_ZP; - break; - case 0x36: /* ROL ab,x */ - ZPAGE_X; - ROL_ZP; - break; - case 0x38: /* SEC */ - c = 1; - break; - case 0x39: /* AND abcd,y */ - ABSOLUTE_Y; - NCYCLES_Y; - AND; - break; - case 0x3d: /* AND abcd,x */ - ABSOLUTE_X; - NCYCLES_X; - AND; - break; - case 0x3e: /* ROL abcd,x */ - ABSOLUTE_X; - ROL; - break; - case 0x40: /* RTI */ - PLP; - PL(pc); - PL(addr); - pc += addr << 8; - CHECK_IRQ; - break; - case 0x41: /* EOR (ab,x) */ - INDIRECT_X; - EOR; - break; - case 0x45: /* EOR ab */ - ZPAGE; - EOR_ZP; - break; - case 0x46: /* LSR ab */ - ZPAGE; - LSR_ZP; - break; - case 0x48: /* PHA */ - PH(a); - break; - case 0x49: /* EOR #ab */ - nz = a ^= FETCH; - break; - case 0x4a: /* LSR */ - c = a & 1; - nz = a >>= 1; - break; - case 0x4c: /* JMP abcd */ - addr = FETCH; - pc = addr + (PEEK << 8); - break; - case 0x4d: /* EOR abcd */ - ABSOLUTE; - EOR; - break; - case 0x4e: /* LSR abcd */ - ABSOLUTE; - LSR; - break; - case 0x50: /* BVC */ - BRANCH((vdi & V_FLAG) == 0); - case 0x51: /* EOR (ab),y */ - INDIRECT_Y; - NCYCLES_Y; - EOR; - break; - case 0x55: /* EOR ab,x */ - ZPAGE_X; - EOR_ZP; - break; - case 0x56: /* LSR ab,x */ - ZPAGE_X; - LSR_ZP; - break; - case 0x58: /* CLI */ - vdi &= V_FLAG | D_FLAG; - CHECK_IRQ; - break; - case 0x59: /* EOR abcd,y */ - ABSOLUTE_Y; - NCYCLES_Y; - EOR; - break; - case 0x5d: /* EOR abcd,x */ - ABSOLUTE_X; - NCYCLES_X; - EOR; - break; - case 0x5e: /* LSR abcd,x */ - ABSOLUTE_X; - LSR; - break; - case 0x60: /* RTS */ - PL(pc); - PL(addr); - pc += (addr << 8) + 1; - break; - case 0x61: /* ADC (ab,x) */ - INDIRECT_X; - ADC; - break; - case 0x65: /* ADC ab */ - ZPAGE; - ADC_ZP; - break; - case 0x66: /* ROR ab */ - ZPAGE; - ROR_ZP; - break; - case 0x68: /* PLA */ - PL(a); - nz = a; - break; - case 0x69: /* ADC #ab */ - data = FETCH; - DO_ADC; - break; - case 0x6a: /* ROR */ - nz = (c << 7) + (a >> 1); - c = a & 1; - a = nz; - break; - case 0x6c: /* JMP (abcd) */ - ABSOLUTE; - if ((addr & 0xff) == 0xff) - pc = (dGetByte(addr - 0xff) << 8) + dGetByte(addr); - else - pc = dGetWord(addr); - break; - case 0x6d: /* ADC abcd */ - ABSOLUTE; - ADC; - break; - case 0x6e: /* ROR abcd */ - ABSOLUTE; - ROR; - break; - case 0x70: /* BVS */ - BRANCH((vdi & V_FLAG) != 0); - case 0x71: /* ADC (ab),y */ - INDIRECT_Y; - NCYCLES_Y; - ADC; - break; - case 0x75: /* ADC ab,x */ - ZPAGE_X; - ADC_ZP; - break; - case 0x76: /* ROR ab,x */ - ZPAGE_X; - ROR_ZP; - break; - case 0x78: /* SEI */ - vdi |= I_FLAG; - break; - case 0x79: /* ADC abcd,y */ - ABSOLUTE_Y; - NCYCLES_Y; - ADC; - break; - case 0x7d: /* ADC abcd,x */ - ABSOLUTE_X; - NCYCLES_X; - ADC; - break; - case 0x7e: /* ROR abcd,x */ - ABSOLUTE_X; - ROR; - break; - case 0x81: /* STA (ab,x) */ - INDIRECT_X; - STA; - break; - case 0x84: /* STY ab */ - ZPAGE; - STY_ZP; - break; - case 0x85: /* STA ab */ - ZPAGE; - STA_ZP; - break; - case 0x86: /* STX ab */ - ZPAGE; - STX_ZP; - break; - case 0x88: /* DEY */ - nz = y = (y - 1) & 0xff; - break; - case 0x8a: /* TXA */ - nz = a = x; - break; - case 0x8c: /* STY abcd */ - ABSOLUTE; - STY; - break; - case 0x8d: /* STA abcd */ - ABSOLUTE; - STA; - break; - case 0x8e: /* STX abcd */ - ABSOLUTE; - STX; - break; - case 0x90: /* BCC */ - BRANCH(c == 0); - case 0x91: /* STA (ab),y */ - INDIRECT_Y; - STA; - break; - case 0x94: /* STY ab,x */ - ZPAGE_X; - STY_ZP; - break; - case 0x95: /* STA ab,x */ - ZPAGE_X; - STA_ZP; - break; - case 0x96: /* STX ab,y */ - ZPAGE_Y; - STX_ZP; - break; - case 0x98: /* TYA */ - nz = a = y; - break; - case 0x99: /* STA abcd,y */ - ABSOLUTE_Y; - STA; - break; - case 0x9a: /* TXS */ - s = x; - break; - case 0x9d: /* STA abcd,x */ - ABSOLUTE_X; - STA; - break; - case 0xa0: /* LDY #ab */ - nz = y = FETCH; - break; - case 0xa1: /* LDA (ab,x) */ - INDIRECT_X; - LDA; - break; - case 0xa2: /* LDX #ab */ - nz = x = FETCH; - break; - case 0xa4: /* LDY ab */ - ZPAGE; - LDY_ZP; - break; - case 0xa5: /* LDA ab */ - ZPAGE; - LDA_ZP; - break; - case 0xa6: /* LDX ab */ - ZPAGE; - LDX_ZP; - break; - case 0xa8: /* TAY */ - nz = y = a; - break; - case 0xa9: /* LDA #ab */ - nz = a = FETCH; - break; - case 0xaa: /* TAX */ - nz = x = a; - break; - case 0xac: /* LDY abcd */ - ABSOLUTE; - LDY; - break; - case 0xad: /* LDA abcd */ - ABSOLUTE; - LDA; - break; - case 0xae: /* LDX abcd */ - ABSOLUTE; - LDX; - break; - case 0xb0: /* BCS */ - BRANCH(c != 0); - case 0xb1: /* LDA (ab),y */ - INDIRECT_Y; - NCYCLES_Y; - LDA; - break; - case 0xb4: /* LDY ab,x */ - ZPAGE_X; - LDY_ZP; - break; - case 0xb5: /* LDA ab,x */ - ZPAGE_X; - LDA_ZP; - break; - case 0xb6: /* LDX ab,y */ - ZPAGE_Y; - LDX_ZP; - break; - case 0xb8: /* CLV */ - vdi &= D_FLAG | I_FLAG; - break; - case 0xb9: /* LDA abcd,y */ - ABSOLUTE_Y; - NCYCLES_Y; - LDA; - break; - case 0xba: /* TSX */ - nz = x = s; - break; - case 0xbc: /* LDY abcd,x */ - ABSOLUTE_X; - NCYCLES_X; - LDY; - break; - case 0xbd: /* LDA abcd,x */ - ABSOLUTE_X; - NCYCLES_X; - LDA; - break; - case 0xbe: /* LDX abcd,y */ - ABSOLUTE_Y; - NCYCLES_Y; - LDX; - break; - case 0xc0: /* CPY #ab */ - nz = FETCH; - c = (y >= nz) ? 1 : 0; - nz = (y - nz) & 0xff; - break; - case 0xc1: /* CMP (ab,x) */ - INDIRECT_X; - CMP; - break; - case 0xc4: /* CPY ab */ - ZPAGE; - CPY_ZP; - break; - case 0xc5: /* CMP ab */ - ZPAGE; - CMP_ZP; - break; - case 0xc6: /* DEC ab */ - ZPAGE; - DEC_ZP; - break; - case 0xc8: /* INY */ - nz = y = (y + 1) & 0xff; - break; - case 0xc9: /* CMP #ab */ - nz = FETCH; - c = (a >= nz) ? 1 : 0; - nz = (a - nz) & 0xff; - break; - case 0xca: /* DEX */ - nz = x = (x - 1) & 0xff; - break; - case 0xcc: /* CPY abcd */ - ABSOLUTE; - CPY; - break; - case 0xcd: /* CMP abcd */ - ABSOLUTE; - CMP; - break; - case 0xce: /* DEC abcd */ - ABSOLUTE; - DEC; - break; - case 0xd0: /* BNE */ - BRANCH((nz & 0xff) != 0); - case 0xd1: /* CMP (ab),y */ - INDIRECT_Y; - NCYCLES_Y; - CMP; - break; - case 0xd5: /* CMP ab,x */ - ZPAGE_X; - CMP_ZP; - break; - case 0xd6: /* DEC ab,x */ - ZPAGE_X; - DEC_ZP; - break; - case 0xd8: /* CLD */ - vdi &= V_FLAG | I_FLAG; - break; - case 0xd9: /* CMP abcd,y */ - ABSOLUTE_Y; - NCYCLES_Y; - CMP; - break; - case 0xdd: /* CMP abcd,x */ - ABSOLUTE_X; - NCYCLES_X; - CMP; - break; - case 0xde: /* DEC abcd,x */ - ABSOLUTE_X; - DEC; - break; - case 0xe0: /* CPX #ab */ - nz = FETCH; - c = (x >= nz) ? 1 : 0; - nz = (x - nz) & 0xff; - break; - case 0xe1: /* SBC (ab,x) */ - INDIRECT_X; - SBC; - break; - case 0xe4: /* CPX ab */ - ZPAGE; - CPX_ZP; - break; - case 0xe5: /* SBC ab */ - ZPAGE; - SBC_ZP; - break; - case 0xe6: /* INC ab */ - ZPAGE; - INC_ZP; - break; - case 0xe8: /* INX */ - nz = x = (x + 1) & 0xff; - break; - case 0xe9: /* SBC #ab */ - case 0xeb: /* SBC #ab [unofficial] */ - data = FETCH; - DO_SBC; - break; - case 0xea: /* NOP */ - case 0x1a: /* NOP [unofficial] */ - case 0x3a: - case 0x5a: - case 0x7a: - case 0xda: - case 0xfa: - break; - case 0xec: /* CPX abcd */ - ABSOLUTE; - CPX; - break; - case 0xed: /* SBC abcd */ - ABSOLUTE; - SBC; - break; - case 0xee: /* INC abcd */ - ABSOLUTE; - INC; - break; - case 0xf0: /* BEQ */ - BRANCH((nz & 0xff) == 0); - case 0xf1: /* SBC (ab),y */ - INDIRECT_Y; - NCYCLES_Y; - SBC; - break; - case 0xf5: /* SBC ab,x */ - ZPAGE_X; - SBC_ZP; - break; - case 0xf6: /* INC ab,x */ - ZPAGE_X; - INC_ZP; - break; - case 0xf8: /* SED */ - vdi |= D_FLAG; - break; - case 0xf9: /* SBC abcd,y */ - ABSOLUTE_Y; - NCYCLES_Y; - SBC; - break; - case 0xfd: /* SBC abcd,x */ - ABSOLUTE_X; - NCYCLES_X; - SBC; - break; - case 0xfe: /* INC abcd,x */ - ABSOLUTE_X; - INC; - break; - } - } - ast _ cpu_pc = pc; - ast _ cpu_nz = nz; - ast _ cpu_a = a; - ast _ cpu_x = x; - ast _ cpu_y = y; - ast _ cpu_c = c; - ast _ cpu_s = s; - ast _ cpu_vdi = vdi; - ast _ cycle -= cycle_limit; - if (ast _ timer1_cycle != NEVER) - ast _ timer1_cycle -= cycle_limit; - if (ast _ timer2_cycle != NEVER) - ast _ timer2_cycle -= cycle_limit; - if (ast _ timer4_cycle != NEVER) - ast _ timer4_cycle -= cycle_limit; + case 0x05: /* ORA ab */ + ZPAGE; + ORA_ZP; + break; + case 0x06: /* ASL ab */ + ZPAGE; + ASL_ZP; + break; + case 0x08: /* PHP */ + PHPB1; + break; + case 0x09: /* ORA #ab */ + nz = a |= FETCH; + break; + case 0x0a: /* ASL */ + c = a >> 7; + nz = a = (a << 1) & 0xff; + break; + case 0x0d: /* ORA abcd */ + ABSOLUTE; + ORA; + break; + case 0x0e: /* ASL abcd */ + ABSOLUTE; + ASL; + break; + case 0x10: /* BPL */ + BRANCH(nz < 0x80); + case 0x11: /* ORA (ab),y */ + INDIRECT_Y; + NCYCLES_Y; + ORA; + break; + case 0x15: /* ORA ab,x */ + ZPAGE_X; + ORA_ZP; + break; + case 0x16: /* ASL ab,x */ + ZPAGE_X; + ASL_ZP; + break; + case 0x18: /* CLC */ + c = 0; + break; + case 0x19: /* ORA abcd,y */ + ABSOLUTE_Y; + NCYCLES_Y; + ORA; + break; + case 0x1d: /* ORA abcd,x */ + ABSOLUTE_X; + NCYCLES_X; + ORA; + break; + case 0x1e: /* ASL abcd,x */ + ABSOLUTE_X; + ASL; + break; + case 0x20: /* JSR abcd */ + addr = FETCH; + PHPC; + pc = addr + (PEEK << 8); + break; + case 0x21: /* AND (ab,x) */ + INDIRECT_X; + AND; + break; + case 0x24: /* BIT ab */ + ZPAGE; + nz = dGetByte(addr); + vdi = (vdi & (D_FLAG | I_FLAG)) + (nz & V_FLAG); + nz = ((nz & 0x80) << 1) + (nz & a); + break; + case 0x25: /* AND ab */ + ZPAGE; + AND_ZP; + break; + case 0x26: /* ROL ab */ + ZPAGE; + ROL_ZP; + break; + case 0x28: /* PLP */ + PLP; + CHECK_IRQ; + break; + case 0x29: /* AND #ab */ + nz = a &= FETCH; + break; + case 0x2a: /* ROL */ + a = (a << 1) + c; + c = a >> 8; + nz = a &= 0xff; + break; + case 0x2c: /* BIT abcd */ + ABSOLUTE; + nz = GetByte(addr); + vdi = (vdi & (D_FLAG | I_FLAG)) + (nz & V_FLAG); + nz = ((nz & 0x80) << 1) + (nz & a); + break; + case 0x2d: /* AND abcd */ + ABSOLUTE; + AND; + break; + case 0x2e: /* ROL abcd */ + ABSOLUTE; + ROL; + break; + case 0x30: /* BMI */ + BRANCH(nz >= 0x80); + case 0x31: /* AND (ab),y */ + INDIRECT_Y; + NCYCLES_Y; + AND; + break; + case 0x35: /* AND ab,x */ + ZPAGE_X; + AND_ZP; + break; + case 0x36: /* ROL ab,x */ + ZPAGE_X; + ROL_ZP; + break; + case 0x38: /* SEC */ + c = 1; + break; + case 0x39: /* AND abcd,y */ + ABSOLUTE_Y; + NCYCLES_Y; + AND; + break; + case 0x3d: /* AND abcd,x */ + ABSOLUTE_X; + NCYCLES_X; + AND; + break; + case 0x3e: /* ROL abcd,x */ + ABSOLUTE_X; + ROL; + break; + case 0x40: /* RTI */ + PLP; + PL(pc); + PL(addr); + pc += addr << 8; + CHECK_IRQ; + break; + case 0x41: /* EOR (ab,x) */ + INDIRECT_X; + EOR; + break; + case 0x45: /* EOR ab */ + ZPAGE; + EOR_ZP; + break; + case 0x46: /* LSR ab */ + ZPAGE; + LSR_ZP; + break; + case 0x48: /* PHA */ + PH(a); + break; + case 0x49: /* EOR #ab */ + nz = a ^= FETCH; + break; + case 0x4a: /* LSR */ + c = a & 1; + nz = a >>= 1; + break; + case 0x4c: /* JMP abcd */ + addr = FETCH; + pc = addr + (PEEK << 8); + break; + case 0x4d: /* EOR abcd */ + ABSOLUTE; + EOR; + break; + case 0x4e: /* LSR abcd */ + ABSOLUTE; + LSR; + break; + case 0x50: /* BVC */ + BRANCH((vdi & V_FLAG) == 0); + case 0x51: /* EOR (ab),y */ + INDIRECT_Y; + NCYCLES_Y; + EOR; + break; + case 0x55: /* EOR ab,x */ + ZPAGE_X; + EOR_ZP; + break; + case 0x56: /* LSR ab,x */ + ZPAGE_X; + LSR_ZP; + break; + case 0x58: /* CLI */ + vdi &= V_FLAG | D_FLAG; + CHECK_IRQ; + break; + case 0x59: /* EOR abcd,y */ + ABSOLUTE_Y; + NCYCLES_Y; + EOR; + break; + case 0x5d: /* EOR abcd,x */ + ABSOLUTE_X; + NCYCLES_X; + EOR; + break; + case 0x5e: /* LSR abcd,x */ + ABSOLUTE_X; + LSR; + break; + case 0x60: /* RTS */ + PL(pc); + PL(addr); + pc += (addr << 8) + 1; + break; + case 0x61: /* ADC (ab,x) */ + INDIRECT_X; + ADC; + break; + case 0x65: /* ADC ab */ + ZPAGE; + ADC_ZP; + break; + case 0x66: /* ROR ab */ + ZPAGE; + ROR_ZP; + break; + case 0x68: /* PLA */ + PL(a); + nz = a; + break; + case 0x69: /* ADC #ab */ + data = FETCH; + DO_ADC; + break; + case 0x6a: /* ROR */ + nz = (c << 7) + (a >> 1); + c = a & 1; + a = nz; + break; + case 0x6c: /* JMP (abcd) */ + ABSOLUTE; + if ((addr & 0xff) == 0xff) + pc = (dGetByte(addr - 0xff) << 8) + dGetByte(addr); + else + pc = dGetWord(addr); + break; + case 0x6d: /* ADC abcd */ + ABSOLUTE; + ADC; + break; + case 0x6e: /* ROR abcd */ + ABSOLUTE; + ROR; + break; + case 0x70: /* BVS */ + BRANCH((vdi & V_FLAG) != 0); + case 0x71: /* ADC (ab),y */ + INDIRECT_Y; + NCYCLES_Y; + ADC; + break; + case 0x75: /* ADC ab,x */ + ZPAGE_X; + ADC_ZP; + break; + case 0x76: /* ROR ab,x */ + ZPAGE_X; + ROR_ZP; + break; + case 0x78: /* SEI */ + vdi |= I_FLAG; + break; + case 0x79: /* ADC abcd,y */ + ABSOLUTE_Y; + NCYCLES_Y; + ADC; + break; + case 0x7d: /* ADC abcd,x */ + ABSOLUTE_X; + NCYCLES_X; + ADC; + break; + case 0x7e: /* ROR abcd,x */ + ABSOLUTE_X; + ROR; + break; + case 0x81: /* STA (ab,x) */ + INDIRECT_X; + STA; + break; + case 0x84: /* STY ab */ + ZPAGE; + STY_ZP; + break; + case 0x85: /* STA ab */ + ZPAGE; + STA_ZP; + break; + case 0x86: /* STX ab */ + ZPAGE; + STX_ZP; + break; + case 0x88: /* DEY */ + nz = y = (y - 1) & 0xff; + break; + case 0x8a: /* TXA */ + nz = a = x; + break; + case 0x8c: /* STY abcd */ + ABSOLUTE; + STY; + break; + case 0x8d: /* STA abcd */ + ABSOLUTE; + STA; + break; + case 0x8e: /* STX abcd */ + ABSOLUTE; + STX; + break; + case 0x90: /* BCC */ + BRANCH(c == 0); + case 0x91: /* STA (ab),y */ + INDIRECT_Y; + STA; + break; + case 0x94: /* STY ab,x */ + ZPAGE_X; + STY_ZP; + break; + case 0x95: /* STA ab,x */ + ZPAGE_X; + STA_ZP; + break; + case 0x96: /* STX ab,y */ + ZPAGE_Y; + STX_ZP; + break; + case 0x98: /* TYA */ + nz = a = y; + break; + case 0x99: /* STA abcd,y */ + ABSOLUTE_Y; + STA; + break; + case 0x9a: /* TXS */ + s = x; + break; + case 0x9d: /* STA abcd,x */ + ABSOLUTE_X; + STA; + break; + case 0xa0: /* LDY #ab */ + nz = y = FETCH; + break; + case 0xa1: /* LDA (ab,x) */ + INDIRECT_X; + LDA; + break; + case 0xa2: /* LDX #ab */ + nz = x = FETCH; + break; + case 0xa4: /* LDY ab */ + ZPAGE; + LDY_ZP; + break; + case 0xa5: /* LDA ab */ + ZPAGE; + LDA_ZP; + break; + case 0xa6: /* LDX ab */ + ZPAGE; + LDX_ZP; + break; + case 0xa8: /* TAY */ + nz = y = a; + break; + case 0xa9: /* LDA #ab */ + nz = a = FETCH; + break; + case 0xaa: /* TAX */ + nz = x = a; + break; + case 0xac: /* LDY abcd */ + ABSOLUTE; + LDY; + break; + case 0xad: /* LDA abcd */ + ABSOLUTE; + LDA; + break; + case 0xae: /* LDX abcd */ + ABSOLUTE; + LDX; + break; + case 0xb0: /* BCS */ + BRANCH(c != 0); + case 0xb1: /* LDA (ab),y */ + INDIRECT_Y; + NCYCLES_Y; + LDA; + break; + case 0xb4: /* LDY ab,x */ + ZPAGE_X; + LDY_ZP; + break; + case 0xb5: /* LDA ab,x */ + ZPAGE_X; + LDA_ZP; + break; + case 0xb6: /* LDX ab,y */ + ZPAGE_Y; + LDX_ZP; + break; + case 0xb8: /* CLV */ + vdi &= D_FLAG | I_FLAG; + break; + case 0xb9: /* LDA abcd,y */ + ABSOLUTE_Y; + NCYCLES_Y; + LDA; + break; + case 0xba: /* TSX */ + nz = x = s; + break; + case 0xbc: /* LDY abcd,x */ + ABSOLUTE_X; + NCYCLES_X; + LDY; + break; + case 0xbd: /* LDA abcd,x */ + ABSOLUTE_X; + NCYCLES_X; + LDA; + break; + case 0xbe: /* LDX abcd,y */ + ABSOLUTE_Y; + NCYCLES_Y; + LDX; + break; + case 0xc0: /* CPY #ab */ + nz = FETCH; + c = (y >= nz) ? 1 : 0; + nz = (y - nz) & 0xff; + break; + case 0xc1: /* CMP (ab,x) */ + INDIRECT_X; + CMP; + break; + case 0xc4: /* CPY ab */ + ZPAGE; + CPY_ZP; + break; + case 0xc5: /* CMP ab */ + ZPAGE; + CMP_ZP; + break; + case 0xc6: /* DEC ab */ + ZPAGE; + DEC_ZP; + break; + case 0xc8: /* INY */ + nz = y = (y + 1) & 0xff; + break; + case 0xc9: /* CMP #ab */ + nz = FETCH; + c = (a >= nz) ? 1 : 0; + nz = (a - nz) & 0xff; + break; + case 0xca: /* DEX */ + nz = x = (x - 1) & 0xff; + break; + case 0xcc: /* CPY abcd */ + ABSOLUTE; + CPY; + break; + case 0xcd: /* CMP abcd */ + ABSOLUTE; + CMP; + break; + case 0xce: /* DEC abcd */ + ABSOLUTE; + DEC; + break; + case 0xd0: /* BNE */ + BRANCH((nz & 0xff) != 0); + case 0xd1: /* CMP (ab),y */ + INDIRECT_Y; + NCYCLES_Y; + CMP; + break; + case 0xd5: /* CMP ab,x */ + ZPAGE_X; + CMP_ZP; + break; + case 0xd6: /* DEC ab,x */ + ZPAGE_X; + DEC_ZP; + break; + case 0xd8: /* CLD */ + vdi &= V_FLAG | I_FLAG; + break; + case 0xd9: /* CMP abcd,y */ + ABSOLUTE_Y; + NCYCLES_Y; + CMP; + break; + case 0xdd: /* CMP abcd,x */ + ABSOLUTE_X; + NCYCLES_X; + CMP; + break; + case 0xde: /* DEC abcd,x */ + ABSOLUTE_X; + DEC; + break; + case 0xe0: /* CPX #ab */ + nz = FETCH; + c = (x >= nz) ? 1 : 0; + nz = (x - nz) & 0xff; + break; + case 0xe1: /* SBC (ab,x) */ + INDIRECT_X; + SBC; + break; + case 0xe4: /* CPX ab */ + ZPAGE; + CPX_ZP; + break; + case 0xe5: /* SBC ab */ + ZPAGE; + SBC_ZP; + break; + case 0xe6: /* INC ab */ + ZPAGE; + INC_ZP; + break; + case 0xe8: /* INX */ + nz = x = (x + 1) & 0xff; + break; + case 0xe9: /* SBC #ab */ + case 0xeb: /* SBC #ab [unofficial] */ + data = FETCH; + DO_SBC; + break; + case 0xea: /* NOP */ + case 0x1a: /* NOP [unofficial] */ + case 0x3a: + case 0x5a: + case 0x7a: + case 0xda: + case 0xfa: + break; + case 0xec: /* CPX abcd */ + ABSOLUTE; + CPX; + break; + case 0xed: /* SBC abcd */ + ABSOLUTE; + SBC; + break; + case 0xee: /* INC abcd */ + ABSOLUTE; + INC; + break; + case 0xf0: /* BEQ */ + BRANCH((nz & 0xff) == 0); + case 0xf1: /* SBC (ab),y */ + INDIRECT_Y; + NCYCLES_Y; + SBC; + break; + case 0xf5: /* SBC ab,x */ + ZPAGE_X; + SBC_ZP; + break; + case 0xf6: /* INC ab,x */ + ZPAGE_X; + INC_ZP; + break; + case 0xf8: /* SED */ + vdi |= D_FLAG; + break; + case 0xf9: /* SBC abcd,y */ + ABSOLUTE_Y; + NCYCLES_Y; + SBC; + break; + case 0xfd: /* SBC abcd,x */ + ABSOLUTE_X; + NCYCLES_X; + SBC; + break; + case 0xfe: /* INC abcd,x */ + ABSOLUTE_X; + INC; + break; + } + } + ast _ cpu_pc = pc; + ast _ cpu_nz = nz; + ast _ cpu_a = a; + ast _ cpu_x = x; + ast _ cpu_y = y; + ast _ cpu_c = c; + ast _ cpu_s = s; + ast _ cpu_vdi = vdi; + ast _ cycle -= cycle_limit; + if (ast _ timer1_cycle != NEVER) + ast _ timer1_cycle -= cycle_limit; + if (ast _ timer2_cycle != NEVER) + ast _ timer2_cycle -= cycle_limit; + if (ast _ timer4_cycle != NEVER) + ast _ timer4_cycle -= cycle_limit; } diff --git a/apps/codecs/libasap/apokeysnd.c b/apps/codecs/libasap/apokeysnd.c index a461fa96da..ead611be5f 100644 --- a/apps/codecs/libasap/apokeysnd.c +++ b/apps/codecs/libasap/apokeysnd.c @@ -30,178 +30,178 @@ #define MUTE_USER 4 CONST_ARRAY(byte, poly4_lookup) - 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1 + 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1 END_CONST_ARRAY; CONST_ARRAY(byte, poly5_lookup) - 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, - 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1 + 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, + 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1 END_CONST_ARRAY; PRIVATE FUNC(void, PokeySound_InitializeChip, (P(PokeyState PTR, pst))) { - pst _ audctl = 0; - pst _ init = FALSE; - pst _ poly_index = 15 * 31 * 131071; - pst _ div_cycles = 28; - pst _ mute1 = MUTE_FREQUENCY | MUTE_USER; - pst _ mute2 = MUTE_FREQUENCY | MUTE_USER; - pst _ mute3 = MUTE_FREQUENCY | MUTE_USER; - pst _ mute4 = MUTE_FREQUENCY | MUTE_USER; - pst _ audf1 = 0; - pst _ audf2 = 0; - pst _ audf3 = 0; - pst _ audf4 = 0; - pst _ audc1 = 0; - pst _ audc2 = 0; - pst _ audc3 = 0; - pst _ audc4 = 0; - pst _ tick_cycle1 = NEVER; - pst _ tick_cycle2 = NEVER; - pst _ tick_cycle3 = NEVER; - pst _ tick_cycle4 = NEVER; - pst _ period_cycles1 = 28; - pst _ period_cycles2 = 28; - pst _ period_cycles3 = 28; - pst _ period_cycles4 = 28; - pst _ reload_cycles1 = 28; - pst _ reload_cycles3 = 28; - pst _ out1 = 0; - pst _ out2 = 0; - pst _ out3 = 0; - pst _ out4 = 0; - pst _ delta1 = 0; - pst _ delta2 = 0; - pst _ delta3 = 0; - pst _ delta4 = 0; - pst _ skctl = 3; - ZERO_ARRAY(pst _ delta_buffer); + pst _ audctl = 0; + pst _ init = FALSE; + pst _ poly_index = 15 * 31 * 131071; + pst _ div_cycles = 28; + pst _ mute1 = MUTE_FREQUENCY | MUTE_USER; + pst _ mute2 = MUTE_FREQUENCY | MUTE_USER; + pst _ mute3 = MUTE_FREQUENCY | MUTE_USER; + pst _ mute4 = MUTE_FREQUENCY | MUTE_USER; + pst _ audf1 = 0; + pst _ audf2 = 0; + pst _ audf3 = 0; + pst _ audf4 = 0; + pst _ audc1 = 0; + pst _ audc2 = 0; + pst _ audc3 = 0; + pst _ audc4 = 0; + pst _ tick_cycle1 = NEVER; + pst _ tick_cycle2 = NEVER; + pst _ tick_cycle3 = NEVER; + pst _ tick_cycle4 = NEVER; + pst _ period_cycles1 = 28; + pst _ period_cycles2 = 28; + pst _ period_cycles3 = 28; + pst _ period_cycles4 = 28; + pst _ reload_cycles1 = 28; + pst _ reload_cycles3 = 28; + pst _ out1 = 0; + pst _ out2 = 0; + pst _ out3 = 0; + pst _ out4 = 0; + pst _ delta1 = 0; + pst _ delta2 = 0; + pst _ delta3 = 0; + pst _ delta4 = 0; + pst _ skctl = 3; + ZERO_ARRAY(pst _ delta_buffer); } FUNC(void, PokeySound_Initialize, (P(ASAP_State PTR, ast))) { - V(int, i); - V(int, reg); - reg = 0x1ff; - for (i = 0; i < 511; i++) { - reg = ((((reg >> 5) ^ reg) & 1) << 8) + (reg >> 1); - ast _ poly9_lookup[i] = TO_BYTE(reg); - } - reg = 0x1ffff; - for (i = 0; i < 16385; i++) { - reg = ((((reg >> 5) ^ reg) & 0xff) << 9) + (reg >> 8); - ast _ poly17_lookup[i] = TO_BYTE(reg >> 1); - } - ast _ sample_offset = 0; - ast _ sample_index = 0; - ast _ samples = 0; - ast _ iir_acc_left = 0; - ast _ iir_acc_right = 0; - PokeySound_InitializeChip(ADDRESSOF ast _ base_pokey); - PokeySound_InitializeChip(ADDRESSOF ast _ extra_pokey); + V(int, i); + V(int, reg); + reg = 0x1ff; + for (i = 0; i < 511; i++) { + reg = ((((reg >> 5) ^ reg) & 1) << 8) + (reg >> 1); + ast _ poly9_lookup[i] = TO_BYTE(reg); + } + reg = 0x1ffff; + for (i = 0; i < 16385; i++) { + reg = ((((reg >> 5) ^ reg) & 0xff) << 9) + (reg >> 8); + ast _ poly17_lookup[i] = TO_BYTE(reg >> 1); + } + ast _ sample_offset = 0; + ast _ sample_index = 0; + ast _ samples = 0; + ast _ iir_acc_left = 0; + ast _ iir_acc_right = 0; + PokeySound_InitializeChip(ADDRESSOF ast _ base_pokey); + PokeySound_InitializeChip(ADDRESSOF ast _ extra_pokey); } #define DO_TICK(ch) \ - if (pst _ init) { \ - switch (pst _ audc##ch >> 4) { \ - case 10: \ - case 14: \ - pst _ out##ch ^= 1; \ - pst _ delta_buffer[CYCLE_TO_SAMPLE(cycle)] += pst _ delta##ch = -pst _ delta##ch; \ - break; \ - default: \ - break; \ - } \ - } \ - else { \ - V(int, poly) = cycle + pst _ poly_index - (ch - 1); \ - V(int, newout) = pst _ out##ch; \ - switch (pst _ audc##ch >> 4) { \ - case 0: \ - if (poly5_lookup[poly % 31] != 0) { \ - if ((pst _ audctl & 0x80) != 0) \ - newout = ast _ poly9_lookup[poly % 511] & 1; \ - else { \ - poly %= 131071; \ - newout = (ast _ poly17_lookup[poly >> 3] >> (poly & 7)) & 1; \ - } \ - } \ - break; \ - case 2: \ - case 6: \ - newout ^= poly5_lookup[poly % 31]; \ - break; \ - case 4: \ - if (poly5_lookup[poly % 31] != 0) \ - newout = poly4_lookup[poly % 15]; \ - break; \ - case 8: \ - if ((pst _ audctl & 0x80) != 0) \ - newout = ast _ poly9_lookup[poly % 511] & 1; \ - else { \ - poly %= 131071; \ - newout = (ast _ poly17_lookup[poly >> 3] >> (poly & 7)) & 1; \ - } \ - break; \ - case 10: \ - case 14: \ - newout ^= 1; \ - break; \ - case 12: \ - newout = poly4_lookup[poly % 15]; \ - break; \ - default: \ - break; \ - } \ - if (newout != pst _ out##ch) { \ - pst _ out##ch = newout; \ - pst _ delta_buffer[CYCLE_TO_SAMPLE(cycle)] += pst _ delta##ch = -pst _ delta##ch; \ - } \ - } + if (pst _ init) { \ + switch (pst _ audc##ch >> 4) { \ + case 10: \ + case 14: \ + pst _ out##ch ^= 1; \ + pst _ delta_buffer[CYCLE_TO_SAMPLE(cycle)] += pst _ delta##ch = -pst _ delta##ch; \ + break; \ + default: \ + break; \ + } \ + } \ + else { \ + V(int, poly) = cycle + pst _ poly_index - (ch - 1); \ + V(int, newout) = pst _ out##ch; \ + switch (pst _ audc##ch >> 4) { \ + case 0: \ + if (poly5_lookup[poly % 31] != 0) { \ + if ((pst _ audctl & 0x80) != 0) \ + newout = ast _ poly9_lookup[poly % 511] & 1; \ + else { \ + poly %= 131071; \ + newout = (ast _ poly17_lookup[poly >> 3] >> (poly & 7)) & 1; \ + } \ + } \ + break; \ + case 2: \ + case 6: \ + newout ^= poly5_lookup[poly % 31]; \ + break; \ + case 4: \ + if (poly5_lookup[poly % 31] != 0) \ + newout = poly4_lookup[poly % 15]; \ + break; \ + case 8: \ + if ((pst _ audctl & 0x80) != 0) \ + newout = ast _ poly9_lookup[poly % 511] & 1; \ + else { \ + poly %= 131071; \ + newout = (ast _ poly17_lookup[poly >> 3] >> (poly & 7)) & 1; \ + } \ + break; \ + case 10: \ + case 14: \ + newout ^= 1; \ + break; \ + case 12: \ + newout = poly4_lookup[poly % 15]; \ + break; \ + default: \ + break; \ + } \ + if (newout != pst _ out##ch) { \ + pst _ out##ch = newout; \ + pst _ delta_buffer[CYCLE_TO_SAMPLE(cycle)] += pst _ delta##ch = -pst _ delta##ch; \ + } \ + } /* Fills delta_buffer up to current_cycle basing on current AUDF/AUDC/AUDCTL values. */ PRIVATE FUNC(void, PokeySound_GenerateUntilCycle, (P(ASAP_State PTR, ast), P(PokeyState PTR, pst), P(int, current_cycle))) { - for (;;) { - V(int, cycle) = current_cycle; - if (cycle > pst _ tick_cycle1) - cycle = pst _ tick_cycle1; - if (cycle > pst _ tick_cycle2) - cycle = pst _ tick_cycle2; - if (cycle > pst _ tick_cycle3) - cycle = pst _ tick_cycle3; - if (cycle > pst _ tick_cycle4) - cycle = pst _ tick_cycle4; - if (cycle == current_cycle) - break; - if (cycle == pst _ tick_cycle3) { - pst _ tick_cycle3 += pst _ period_cycles3; - if ((pst _ audctl & 4) != 0 && pst _ delta1 > 0 && pst _ mute1 == 0) - pst _ delta_buffer[CYCLE_TO_SAMPLE(cycle)] += pst _ delta1 = -pst _ delta1; - DO_TICK(3); - } - if (cycle == pst _ tick_cycle4) { - pst _ tick_cycle4 += pst _ period_cycles4; - if ((pst _ audctl & 8) != 0) - pst _ tick_cycle3 = cycle + pst _ reload_cycles3; - if ((pst _ audctl & 2) != 0 && pst _ delta2 > 0 && pst _ mute2 == 0) - pst _ delta_buffer[CYCLE_TO_SAMPLE(cycle)] += pst _ delta2 = -pst _ delta2; - DO_TICK(4); - } - if (cycle == pst _ tick_cycle1) { - pst _ tick_cycle1 += pst _ period_cycles1; - if ((pst _ skctl & 0x88) == 8) /* two-tone, sending 1 (i.e. timer1) */ - pst _ tick_cycle2 = cycle + pst _ period_cycles2; - DO_TICK(1); - } - if (cycle == pst _ tick_cycle2) { - pst _ tick_cycle2 += pst _ period_cycles2; - if ((pst _ audctl & 0x10) != 0) - pst _ tick_cycle1 = cycle + pst _ reload_cycles1; - else if ((pst _ skctl & 8) != 0) /* two-tone */ - pst _ tick_cycle1 = cycle + pst _ period_cycles1; - DO_TICK(2); - } - } + for (;;) { + V(int, cycle) = current_cycle; + if (cycle > pst _ tick_cycle1) + cycle = pst _ tick_cycle1; + if (cycle > pst _ tick_cycle2) + cycle = pst _ tick_cycle2; + if (cycle > pst _ tick_cycle3) + cycle = pst _ tick_cycle3; + if (cycle > pst _ tick_cycle4) + cycle = pst _ tick_cycle4; + if (cycle == current_cycle) + break; + if (cycle == pst _ tick_cycle3) { + pst _ tick_cycle3 += pst _ period_cycles3; + if ((pst _ audctl & 4) != 0 && pst _ delta1 > 0 && pst _ mute1 == 0) + pst _ delta_buffer[CYCLE_TO_SAMPLE(cycle)] += pst _ delta1 = -pst _ delta1; + DO_TICK(3); + } + if (cycle == pst _ tick_cycle4) { + pst _ tick_cycle4 += pst _ period_cycles4; + if ((pst _ audctl & 8) != 0) + pst _ tick_cycle3 = cycle + pst _ reload_cycles3; + if ((pst _ audctl & 2) != 0 && pst _ delta2 > 0 && pst _ mute2 == 0) + pst _ delta_buffer[CYCLE_TO_SAMPLE(cycle)] += pst _ delta2 = -pst _ delta2; + DO_TICK(4); + } + if (cycle == pst _ tick_cycle1) { + pst _ tick_cycle1 += pst _ period_cycles1; + if ((pst _ skctl & 0x88) == 8) /* two-tone, sending 1 (i.e. timer1) */ + pst _ tick_cycle2 = cycle + pst _ period_cycles2; + DO_TICK(1); + } + if (cycle == pst _ tick_cycle2) { + pst _ tick_cycle2 += pst _ period_cycles2; + if ((pst _ audctl & 0x10) != 0) + pst _ tick_cycle1 = cycle + pst _ reload_cycles1; + else if ((pst _ skctl & 8) != 0) /* two-tone */ + pst _ tick_cycle1 = cycle + pst _ period_cycles1; + DO_TICK(2); + } + } } #ifdef APOKEYSND @@ -209,351 +209,351 @@ PRIVATE FUNC(void, PokeySound_GenerateUntilCycle, (P(ASAP_State PTR, ast), P(Pok #define CURRENT_CYCLE 0 #define CURRENT_SAMPLE 0 #define DO_STORE(reg) \ - if (data == pst _ reg) \ - break; \ - pst _ reg = data; + if (data == pst _ reg) \ + break; \ + pst _ reg = data; #else #define CURRENT_CYCLE ast _ cycle #define CURRENT_SAMPLE CYCLE_TO_SAMPLE(ast _ cycle) #define DO_STORE(reg) \ - if (data == pst _ reg) \ - break; \ - PokeySound_GenerateUntilCycle(ast, pst, ast _ cycle); \ - pst _ reg = data; + if (data == pst _ reg) \ + break; \ + PokeySound_GenerateUntilCycle(ast, pst, ast _ cycle); \ + pst _ reg = data; #endif /* APOKEYSND */ #define MUTE_CHANNEL(ch, cond, mask) \ - if (cond) { \ - pst _ mute##ch |= mask; \ - pst _ tick_cycle##ch = NEVER; \ - } \ - else { \ - pst _ mute##ch &= ~mask; \ - if (pst _ tick_cycle##ch == NEVER && pst _ mute##ch == 0) \ - pst _ tick_cycle##ch = CURRENT_CYCLE; \ - } + if (cond) { \ + pst _ mute##ch |= mask; \ + pst _ tick_cycle##ch = NEVER; \ + } \ + else { \ + pst _ mute##ch &= ~mask; \ + if (pst _ tick_cycle##ch == NEVER && pst _ mute##ch == 0) \ + pst _ tick_cycle##ch = CURRENT_CYCLE; \ + } #define DO_ULTRASOUND(ch) \ - MUTE_CHANNEL(ch, pst _ period_cycles##ch <= ULTRASOUND_CYCLES && (pst _ audc##ch >> 4 == 10 || pst _ audc##ch >> 4 == 14), MUTE_FREQUENCY) + MUTE_CHANNEL(ch, pst _ period_cycles##ch <= ULTRASOUND_CYCLES && (pst _ audc##ch >> 4 == 10 || pst _ audc##ch >> 4 == 14), MUTE_FREQUENCY) #define DO_AUDC(ch) \ - DO_STORE(audc##ch); \ - if ((data & 0x10) != 0) { \ - data = (data & 0xf) << DELTA_SHIFT_POKEY; \ - if ((pst _ mute##ch & MUTE_USER) == 0) \ - pst _ delta_buffer[CURRENT_SAMPLE] \ - += pst _ delta##ch > 0 ? data - pst _ delta##ch : data; \ - pst _ delta##ch = data; \ - } \ - else { \ - data = (data & 0xf) << DELTA_SHIFT_POKEY; \ - DO_ULTRASOUND(ch); \ - if (pst _ delta##ch > 0) { \ - if ((pst _ mute##ch & MUTE_USER) == 0) \ - pst _ delta_buffer[CURRENT_SAMPLE] \ - += data - pst _ delta##ch; \ - pst _ delta##ch = data; \ - } \ - else \ - pst _ delta##ch = -data; \ - } \ - break; + DO_STORE(audc##ch); \ + if ((data & 0x10) != 0) { \ + data = (data & 0xf) << DELTA_SHIFT_POKEY; \ + if ((pst _ mute##ch & MUTE_USER) == 0) \ + pst _ delta_buffer[CURRENT_SAMPLE] \ + += pst _ delta##ch > 0 ? data - pst _ delta##ch : data; \ + pst _ delta##ch = data; \ + } \ + else { \ + data = (data & 0xf) << DELTA_SHIFT_POKEY; \ + DO_ULTRASOUND(ch); \ + if (pst _ delta##ch > 0) { \ + if ((pst _ mute##ch & MUTE_USER) == 0) \ + pst _ delta_buffer[CURRENT_SAMPLE] \ + += data - pst _ delta##ch; \ + pst _ delta##ch = data; \ + } \ + else \ + pst _ delta##ch = -data; \ + } \ + break; #define DO_INIT(ch, cond) \ - MUTE_CHANNEL(ch, pst _ init && cond, MUTE_INIT) + MUTE_CHANNEL(ch, pst _ init && cond, MUTE_INIT) FUNC(void, PokeySound_PutByte, (P(ASAP_State PTR, ast), P(int, addr), P(int, data))) { - V(PokeyState PTR, pst) = (addr & ast _ extra_pokey_mask) != 0 - ? ADDRESSOF ast _ extra_pokey : ADDRESSOF ast _ base_pokey; - switch (addr & 0xf) { - case 0x00: - DO_STORE(audf1); - switch (pst _ audctl & 0x50) { - case 0x00: - pst _ period_cycles1 = pst _ div_cycles * (data + 1); - break; - case 0x10: - pst _ period_cycles2 = pst _ div_cycles * (data + 256 * pst _ audf2 + 1); - pst _ reload_cycles1 = pst _ div_cycles * (data + 1); - DO_ULTRASOUND(2); - break; - case 0x40: - pst _ period_cycles1 = data + 4; - break; - case 0x50: - pst _ period_cycles2 = data + 256 * pst _ audf2 + 7; - pst _ reload_cycles1 = data + 4; - DO_ULTRASOUND(2); - break; - } - DO_ULTRASOUND(1); - break; - case 0x01: - DO_AUDC(1) - case 0x02: - DO_STORE(audf2); - switch (pst _ audctl & 0x50) { - case 0x00: - case 0x40: - pst _ period_cycles2 = pst _ div_cycles * (data + 1); - break; - case 0x10: - pst _ period_cycles2 = pst _ div_cycles * (pst _ audf1 + 256 * data + 1); - break; - case 0x50: - pst _ period_cycles2 = pst _ audf1 + 256 * data + 7; - break; - } - DO_ULTRASOUND(2); - break; - case 0x03: - DO_AUDC(2) - case 0x04: - DO_STORE(audf3); - switch (pst _ audctl & 0x28) { - case 0x00: - pst _ period_cycles3 = pst _ div_cycles * (data + 1); - break; - case 0x08: - pst _ period_cycles4 = pst _ div_cycles * (data + 256 * pst _ audf4 + 1); - pst _ reload_cycles3 = pst _ div_cycles * (data + 1); - DO_ULTRASOUND(4); - break; - case 0x20: - pst _ period_cycles3 = data + 4; - break; - case 0x28: - pst _ period_cycles4 = data + 256 * pst _ audf4 + 7; - pst _ reload_cycles3 = data + 4; - DO_ULTRASOUND(4); - break; - } - DO_ULTRASOUND(3); - break; - case 0x05: - DO_AUDC(3) - case 0x06: - DO_STORE(audf4); - switch (pst _ audctl & 0x28) { - case 0x00: - case 0x20: - pst _ period_cycles4 = pst _ div_cycles * (data + 1); - break; - case 0x08: - pst _ period_cycles4 = pst _ div_cycles * (pst _ audf3 + 256 * data + 1); - break; - case 0x28: - pst _ period_cycles4 = pst _ audf3 + 256 * data + 7; - break; - } - DO_ULTRASOUND(4); - break; - case 0x07: - DO_AUDC(4) - case 0x08: - DO_STORE(audctl); - pst _ div_cycles = ((data & 1) != 0) ? 114 : 28; - /* TODO: tick_cycles */ - switch (data & 0x50) { - case 0x00: - pst _ period_cycles1 = pst _ div_cycles * (pst _ audf1 + 1); - pst _ period_cycles2 = pst _ div_cycles * (pst _ audf2 + 1); - break; - case 0x10: - pst _ period_cycles1 = pst _ div_cycles * 256; - pst _ period_cycles2 = pst _ div_cycles * (pst _ audf1 + 256 * pst _ audf2 + 1); - pst _ reload_cycles1 = pst _ div_cycles * (pst _ audf1 + 1); - break; - case 0x40: - pst _ period_cycles1 = pst _ audf1 + 4; - pst _ period_cycles2 = pst _ div_cycles * (pst _ audf2 + 1); - break; - case 0x50: - pst _ period_cycles1 = 256; - pst _ period_cycles2 = pst _ audf1 + 256 * pst _ audf2 + 7; - pst _ reload_cycles1 = pst _ audf1 + 4; - break; - } - DO_ULTRASOUND(1); - DO_ULTRASOUND(2); - switch (data & 0x28) { - case 0x00: - pst _ period_cycles3 = pst _ div_cycles * (pst _ audf3 + 1); - pst _ period_cycles4 = pst _ div_cycles * (pst _ audf4 + 1); - break; - case 0x08: - pst _ period_cycles3 = pst _ div_cycles * 256; - pst _ period_cycles4 = pst _ div_cycles * (pst _ audf3 + 256 * pst _ audf4 + 1); - pst _ reload_cycles3 = pst _ div_cycles * (pst _ audf3 + 1); - break; - case 0x20: - pst _ period_cycles3 = pst _ audf3 + 4; - pst _ period_cycles4 = pst _ div_cycles * (pst _ audf4 + 1); - break; - case 0x28: - pst _ period_cycles3 = 256; - pst _ period_cycles4 = pst _ audf3 + 256 * pst _ audf4 + 7; - pst _ reload_cycles3 = pst _ audf3 + 4; - break; - } - DO_ULTRASOUND(3); - DO_ULTRASOUND(4); - DO_INIT(1, (data & 0x40) == 0); - DO_INIT(2, (data & 0x50) != 0x50); - DO_INIT(3, (data & 0x20) == 0); - DO_INIT(4, (data & 0x28) != 0x28); - break; - case 0x09: - /* TODO: STIMER */ - break; - case 0x0f: - DO_STORE(skctl); - pst _ init = ((data & 3) == 0); - DO_INIT(1, (pst _ audctl & 0x40) == 0); - DO_INIT(2, (pst _ audctl & 0x50) != 0x50); - DO_INIT(3, (pst _ audctl & 0x20) == 0); - DO_INIT(4, (pst _ audctl & 0x28) != 0x28); - break; - default: - break; - } + V(PokeyState PTR, pst) = (addr & ast _ extra_pokey_mask) != 0 + ? ADDRESSOF ast _ extra_pokey : ADDRESSOF ast _ base_pokey; + switch (addr & 0xf) { + case 0x00: + DO_STORE(audf1); + switch (pst _ audctl & 0x50) { + case 0x00: + pst _ period_cycles1 = pst _ div_cycles * (data + 1); + break; + case 0x10: + pst _ period_cycles2 = pst _ div_cycles * (data + 256 * pst _ audf2 + 1); + pst _ reload_cycles1 = pst _ div_cycles * (data + 1); + DO_ULTRASOUND(2); + break; + case 0x40: + pst _ period_cycles1 = data + 4; + break; + case 0x50: + pst _ period_cycles2 = data + 256 * pst _ audf2 + 7; + pst _ reload_cycles1 = data + 4; + DO_ULTRASOUND(2); + break; + } + DO_ULTRASOUND(1); + break; + case 0x01: + DO_AUDC(1) + case 0x02: + DO_STORE(audf2); + switch (pst _ audctl & 0x50) { + case 0x00: + case 0x40: + pst _ period_cycles2 = pst _ div_cycles * (data + 1); + break; + case 0x10: + pst _ period_cycles2 = pst _ div_cycles * (pst _ audf1 + 256 * data + 1); + break; + case 0x50: + pst _ period_cycles2 = pst _ audf1 + 256 * data + 7; + break; + } + DO_ULTRASOUND(2); + break; + case 0x03: + DO_AUDC(2) + case 0x04: + DO_STORE(audf3); + switch (pst _ audctl & 0x28) { + case 0x00: + pst _ period_cycles3 = pst _ div_cycles * (data + 1); + break; + case 0x08: + pst _ period_cycles4 = pst _ div_cycles * (data + 256 * pst _ audf4 + 1); + pst _ reload_cycles3 = pst _ div_cycles * (data + 1); + DO_ULTRASOUND(4); + break; + case 0x20: + pst _ period_cycles3 = data + 4; + break; + case 0x28: + pst _ period_cycles4 = data + 256 * pst _ audf4 + 7; + pst _ reload_cycles3 = data + 4; + DO_ULTRASOUND(4); + break; + } + DO_ULTRASOUND(3); + break; + case 0x05: + DO_AUDC(3) + case 0x06: + DO_STORE(audf4); + switch (pst _ audctl & 0x28) { + case 0x00: + case 0x20: + pst _ period_cycles4 = pst _ div_cycles * (data + 1); + break; + case 0x08: + pst _ period_cycles4 = pst _ div_cycles * (pst _ audf3 + 256 * data + 1); + break; + case 0x28: + pst _ period_cycles4 = pst _ audf3 + 256 * data + 7; + break; + } + DO_ULTRASOUND(4); + break; + case 0x07: + DO_AUDC(4) + case 0x08: + DO_STORE(audctl); + pst _ div_cycles = ((data & 1) != 0) ? 114 : 28; + /* TODO: tick_cycles */ + switch (data & 0x50) { + case 0x00: + pst _ period_cycles1 = pst _ div_cycles * (pst _ audf1 + 1); + pst _ period_cycles2 = pst _ div_cycles * (pst _ audf2 + 1); + break; + case 0x10: + pst _ period_cycles1 = pst _ div_cycles * 256; + pst _ period_cycles2 = pst _ div_cycles * (pst _ audf1 + 256 * pst _ audf2 + 1); + pst _ reload_cycles1 = pst _ div_cycles * (pst _ audf1 + 1); + break; + case 0x40: + pst _ period_cycles1 = pst _ audf1 + 4; + pst _ period_cycles2 = pst _ div_cycles * (pst _ audf2 + 1); + break; + case 0x50: + pst _ period_cycles1 = 256; + pst _ period_cycles2 = pst _ audf1 + 256 * pst _ audf2 + 7; + pst _ reload_cycles1 = pst _ audf1 + 4; + break; + } + DO_ULTRASOUND(1); + DO_ULTRASOUND(2); + switch (data & 0x28) { + case 0x00: + pst _ period_cycles3 = pst _ div_cycles * (pst _ audf3 + 1); + pst _ period_cycles4 = pst _ div_cycles * (pst _ audf4 + 1); + break; + case 0x08: + pst _ period_cycles3 = pst _ div_cycles * 256; + pst _ period_cycles4 = pst _ div_cycles * (pst _ audf3 + 256 * pst _ audf4 + 1); + pst _ reload_cycles3 = pst _ div_cycles * (pst _ audf3 + 1); + break; + case 0x20: + pst _ period_cycles3 = pst _ audf3 + 4; + pst _ period_cycles4 = pst _ div_cycles * (pst _ audf4 + 1); + break; + case 0x28: + pst _ period_cycles3 = 256; + pst _ period_cycles4 = pst _ audf3 + 256 * pst _ audf4 + 7; + pst _ reload_cycles3 = pst _ audf3 + 4; + break; + } + DO_ULTRASOUND(3); + DO_ULTRASOUND(4); + DO_INIT(1, (data & 0x40) == 0); + DO_INIT(2, (data & 0x50) != 0x50); + DO_INIT(3, (data & 0x20) == 0); + DO_INIT(4, (data & 0x28) != 0x28); + break; + case 0x09: + /* TODO: STIMER */ + break; + case 0x0f: + DO_STORE(skctl); + pst _ init = ((data & 3) == 0); + DO_INIT(1, (pst _ audctl & 0x40) == 0); + DO_INIT(2, (pst _ audctl & 0x50) != 0x50); + DO_INIT(3, (pst _ audctl & 0x20) == 0); + DO_INIT(4, (pst _ audctl & 0x28) != 0x28); + break; + default: + break; + } } FUNC(int, PokeySound_GetRandom, (P(ASAP_State PTR, ast), P(int, addr), P(int, cycle))) { - V(PokeyState PTR, pst) = (addr & ast _ extra_pokey_mask) != 0 - ? ADDRESSOF ast _ extra_pokey : ADDRESSOF ast _ base_pokey; - V(int, i); - if (pst _ init) - return 0xff; - i = cycle + pst _ poly_index; - if ((pst _ audctl & 0x80) != 0) - return ast _ poly9_lookup[i % 511]; - else { - V(int, j); - i %= 131071; - j = i >> 3; - i &= 7; - return ((ast _ poly17_lookup[j] >> i) + (ast _ poly17_lookup[j + 1] << (8 - i))) & 0xff; - } + V(PokeyState PTR, pst) = (addr & ast _ extra_pokey_mask) != 0 + ? ADDRESSOF ast _ extra_pokey : ADDRESSOF ast _ base_pokey; + V(int, i); + if (pst _ init) + return 0xff; + i = cycle + pst _ poly_index; + if ((pst _ audctl & 0x80) != 0) + return ast _ poly9_lookup[i % 511]; + else { + V(int, j); + i %= 131071; + j = i >> 3; + i &= 7; + return ((ast _ poly17_lookup[j] >> i) + (ast _ poly17_lookup[j + 1] << (8 - i))) & 0xff; + } } PRIVATE FUNC(void, end_frame, (P(ASAP_State PTR, ast), P(PokeyState PTR, pst), P(int, cycle_limit))) { - V(int, m); - PokeySound_GenerateUntilCycle(ast, pst, cycle_limit); - pst _ poly_index += cycle_limit; - m = ((pst _ audctl & 0x80) != 0) ? 15 * 31 * 511 : 15 * 31 * 131071; - if (pst _ poly_index >= 2 * m) - pst _ poly_index -= m; - if (pst _ tick_cycle1 != NEVER) - pst _ tick_cycle1 -= cycle_limit; - if (pst _ tick_cycle2 != NEVER) - pst _ tick_cycle2 -= cycle_limit; - if (pst _ tick_cycle3 != NEVER) - pst _ tick_cycle3 -= cycle_limit; - if (pst _ tick_cycle4 != NEVER) - pst _ tick_cycle4 -= cycle_limit; + V(int, m); + PokeySound_GenerateUntilCycle(ast, pst, cycle_limit); + pst _ poly_index += cycle_limit; + m = ((pst _ audctl & 0x80) != 0) ? 15 * 31 * 511 : 15 * 31 * 131071; + if (pst _ poly_index >= 2 * m) + pst _ poly_index -= m; + if (pst _ tick_cycle1 != NEVER) + pst _ tick_cycle1 -= cycle_limit; + if (pst _ tick_cycle2 != NEVER) + pst _ tick_cycle2 -= cycle_limit; + if (pst _ tick_cycle3 != NEVER) + pst _ tick_cycle3 -= cycle_limit; + if (pst _ tick_cycle4 != NEVER) + pst _ tick_cycle4 -= cycle_limit; } FUNC(void, PokeySound_StartFrame, (P(ASAP_State PTR, ast))) { - ZERO_ARRAY(ast _ base_pokey.delta_buffer); - if (ast _ extra_pokey_mask != 0) - ZERO_ARRAY(ast _ extra_pokey.delta_buffer); + ZERO_ARRAY(ast _ base_pokey.delta_buffer); + if (ast _ extra_pokey_mask != 0) + ZERO_ARRAY(ast _ extra_pokey.delta_buffer); } FUNC(void, PokeySound_EndFrame, (P(ASAP_State PTR, ast), P(int, current_cycle))) { - end_frame(ast, ADDRESSOF ast _ base_pokey, current_cycle); - if (ast _ extra_pokey_mask != 0) - end_frame(ast, ADDRESSOF ast _ extra_pokey, current_cycle); - ast _ sample_offset += current_cycle * ASAP_SAMPLE_RATE; - ast _ sample_index = 0; - ast _ samples = TO_INT(ast _ sample_offset / ASAP_MAIN_CLOCK); - ast _ sample_offset %= ASAP_MAIN_CLOCK; + end_frame(ast, ADDRESSOF ast _ base_pokey, current_cycle); + if (ast _ extra_pokey_mask != 0) + end_frame(ast, ADDRESSOF ast _ extra_pokey, current_cycle); + ast _ sample_offset += current_cycle * ASAP_SAMPLE_RATE; + ast _ sample_index = 0; + ast _ samples = TO_INT(ast _ sample_offset / ASAP_MAIN_CLOCK); + ast _ sample_offset %= ASAP_MAIN_CLOCK; } /* Fills buffer with samples from delta_buffer. */ FUNC(int, PokeySound_Generate, (P(ASAP_State PTR, ast), P(BYTEARRAY, buffer), P(int, buffer_offset), P(int, blocks), P(ASAP_SampleFormat, format))) { - V(int, i) = ast _ sample_index; - V(int, samples) = ast _ samples; - V(int, acc_left) = ast _ iir_acc_left; - V(int, acc_right) = ast _ iir_acc_right; - if (blocks < samples - i) - samples = i + blocks; - else - blocks = samples - i; - for (; i < samples; i++) { + V(int, i) = ast _ sample_index; + V(int, samples) = ast _ samples; + V(int, acc_left) = ast _ iir_acc_left; + V(int, acc_right) = ast _ iir_acc_right; + if (blocks < samples - i) + samples = i + blocks; + else + blocks = samples - i; + for (; i < samples; i++) { #ifdef ACTIONSCRIPT - acc_left += ast _ base_pokey.delta_buffer[i] - (acc_left * 3 >> 10); - var sample : Number = acc_left / 33553408; - buffer.writeFloat(sample); - if (ast.extra_pokey_mask != 0) { - acc_right += ast _ extra_pokey.delta_buffer[i] - (acc_right * 3 >> 10); - sample = acc_right / 33553408; - } - buffer.writeFloat(sample); + acc_left += ast _ base_pokey.delta_buffer[i] - (acc_left * 3 >> 10); + var sample : Number = acc_left / 33553408; + buffer.writeFloat(sample); + if (ast.extra_pokey_mask != 0) { + acc_right += ast _ extra_pokey.delta_buffer[i] - (acc_right * 3 >> 10); + sample = acc_right / 33553408; + } + buffer.writeFloat(sample); #else - V(int, sample); - acc_left += ast _ base_pokey.delta_buffer[i] - (acc_left * 3 >> 10); - sample = acc_left >> 10; + V(int, sample); + acc_left += ast _ base_pokey.delta_buffer[i] - (acc_left * 3 >> 10); + sample = acc_left >> 10; #define STORE_SAMPLE \ - if (sample < -32767) \ - sample = -32767; \ - else if (sample > 32767) \ - sample = 32767; \ - switch (format) { \ - case ASAP_FORMAT_U8: \ - buffer[buffer_offset++] = CAST(byte) ((sample >> 8) + 128); \ - break; \ - case ASAP_FORMAT_S16_LE: \ - buffer[buffer_offset++] = TO_BYTE(sample); \ - buffer[buffer_offset++] = TO_BYTE(sample >> 8); \ - break; \ - case ASAP_FORMAT_S16_BE: \ - buffer[buffer_offset++] = TO_BYTE(sample >> 8); \ - buffer[buffer_offset++] = TO_BYTE(sample); \ - break; \ - } - STORE_SAMPLE; - if (ast _ extra_pokey_mask != 0) { - acc_right += ast _ extra_pokey.delta_buffer[i] - (acc_right * 3 >> 10); - sample = acc_right >> 10; - STORE_SAMPLE; - } + if (sample < -32767) \ + sample = -32767; \ + else if (sample > 32767) \ + sample = 32767; \ + switch (format) { \ + case ASAP_FORMAT_U8: \ + buffer[buffer_offset++] = CAST(byte) ((sample >> 8) + 128); \ + break; \ + case ASAP_FORMAT_S16_LE: \ + buffer[buffer_offset++] = TO_BYTE(sample); \ + buffer[buffer_offset++] = TO_BYTE(sample >> 8); \ + break; \ + case ASAP_FORMAT_S16_BE: \ + buffer[buffer_offset++] = TO_BYTE(sample >> 8); \ + buffer[buffer_offset++] = TO_BYTE(sample); \ + break; \ + } + STORE_SAMPLE; + if (ast _ extra_pokey_mask != 0) { + acc_right += ast _ extra_pokey.delta_buffer[i] - (acc_right * 3 >> 10); + sample = acc_right >> 10; + STORE_SAMPLE; + } #endif /* ACTIONSCRIPT */ - } - if (i == ast _ samples) { - acc_left += ast _ base_pokey.delta_buffer[i]; - acc_right += ast _ extra_pokey.delta_buffer[i]; - } - ast _ sample_index = i; - ast _ iir_acc_left = acc_left; - ast _ iir_acc_right = acc_right; + } + if (i == ast _ samples) { + acc_left += ast _ base_pokey.delta_buffer[i]; + acc_right += ast _ extra_pokey.delta_buffer[i]; + } + ast _ sample_index = i; + ast _ iir_acc_left = acc_left; + ast _ iir_acc_right = acc_right; #ifdef APOKEYSND - return buffer_offset; + return buffer_offset; #else - return blocks; + return blocks; #endif } FUNC(abool, PokeySound_IsSilent, (P(CONST PokeyState PTR, pst))) { - return ((pst _ audc1 | pst _ audc2 | pst _ audc3 | pst _ audc4) & 0xf) == 0; + return ((pst _ audc1 | pst _ audc2 | pst _ audc3 | pst _ audc4) & 0xf) == 0; } FUNC(void, PokeySound_Mute, (P(CONST ASAP_State PTR, ast), P(PokeyState PTR, pst), P(int, mask))) { - MUTE_CHANNEL(1, (mask & 1) != 0, MUTE_USER); - MUTE_CHANNEL(2, (mask & 2) != 0, MUTE_USER); - MUTE_CHANNEL(3, (mask & 4) != 0, MUTE_USER); - MUTE_CHANNEL(4, (mask & 8) != 0, MUTE_USER); + MUTE_CHANNEL(1, (mask & 1) != 0, MUTE_USER); + MUTE_CHANNEL(2, (mask & 2) != 0, MUTE_USER); + MUTE_CHANNEL(3, (mask & 4) != 0, MUTE_USER); + MUTE_CHANNEL(4, (mask & 8) != 0, MUTE_USER); } #ifdef APOKEYSND @@ -562,37 +562,37 @@ static ASAP_State asap; __declspec(dllexport) void APokeySound_Initialize(abool stereo) { - asap.extra_pokey_mask = stereo ? 0x10 : 0; - PokeySound_Initialize(&asap); - PokeySound_Mute(&asap, &asap.base_pokey, 0); - PokeySound_Mute(&asap, &asap.extra_pokey, 0); - PokeySound_StartFrame(&asap); + asap.extra_pokey_mask = stereo ? 0x10 : 0; + PokeySound_Initialize(&asap); + PokeySound_Mute(&asap, &asap.base_pokey, 0); + PokeySound_Mute(&asap, &asap.extra_pokey, 0); + PokeySound_StartFrame(&asap); } __declspec(dllexport) void APokeySound_PutByte(int addr, int data) { - PokeySound_PutByte(&asap, addr, data); + PokeySound_PutByte(&asap, addr, data); } __declspec(dllexport) int APokeySound_GetRandom(int addr, int cycle) { - return PokeySound_GetRandom(&asap, addr, cycle); + return PokeySound_GetRandom(&asap, addr, cycle); } __declspec(dllexport) int APokeySound_Generate(int cycles, byte buffer[], ASAP_SampleFormat format) { - int len; - PokeySound_EndFrame(&asap, cycles); - len = PokeySound_Generate(&asap, buffer, 0, asap.samples, format); - PokeySound_StartFrame(&asap); - return len; + int len; + PokeySound_EndFrame(&asap, cycles); + len = PokeySound_Generate(&asap, buffer, 0, asap.samples, format); + PokeySound_StartFrame(&asap); + return len; } __declspec(dllexport) void APokeySound_About(const char **name, const char **author, const char **description) { - *name = "Another POKEY sound emulator, v" ASAP_VERSION; - *author = "Piotr Fusik, (C) " ASAP_YEARS; - *description = "Part of ASAP, http://asap.sourceforge.net"; + *name = "Another POKEY sound emulator, v" ASAP_VERSION; + *author = "Piotr Fusik, (C) " ASAP_YEARS; + *description = "Part of ASAP, http://asap.sourceforge.net"; } #endif /* APOKEYSND */ diff --git a/apps/codecs/libasap/asap.c b/apps/codecs/libasap/asap.c index 87b537ef63..c79682c38b 100644 --- a/apps/codecs/libasap/asap.c +++ b/apps/codecs/libasap/asap.c @@ -25,78 +25,78 @@ FUNC(int, ASAP_GetByte, (P(ASAP_State PTR, ast), P(int, addr))) { - switch (addr & 0xff0f) { - case 0xd20a: - return PokeySound_GetRandom(ast, addr, ast _ cycle); - case 0xd20e: - if ((addr & ast _ extra_pokey_mask) != 0) { - /* interrupts in the extra POKEY not emulated at the moment */ - return 0xff; - } - return ast _ irqst; - case 0xd20f: - /* just because some SAP files rely on this */ - return 0xff; - case 0xd40b: - return ast _ scanline_number >> 1; - default: - return dGetByte(addr); - } + switch (addr & 0xff0f) { + case 0xd20a: + return PokeySound_GetRandom(ast, addr, ast _ cycle); + case 0xd20e: + if ((addr & ast _ extra_pokey_mask) != 0) { + /* interrupts in the extra POKEY not emulated at the moment */ + return 0xff; + } + return ast _ irqst; + case 0xd20f: + /* just because some SAP files rely on this */ + return 0xff; + case 0xd40b: + return ast _ scanline_number >> 1; + default: + return dGetByte(addr); + } } FUNC(void, ASAP_PutByte, (P(ASAP_State PTR, ast), P(int, addr), P(int, data))) { - if ((addr >> 8) == 0xd2) { - if ((addr & (ast _ extra_pokey_mask + 0xf)) == 0xe) { - ast _ irqst |= data ^ 0xff; + if ((addr >> 8) == 0xd2) { + if ((addr & (ast _ extra_pokey_mask + 0xf)) == 0xe) { + ast _ irqst |= data ^ 0xff; #define SET_TIMER_IRQ(ch) \ - if ((data & ast _ irqst & ch) != 0) { \ - if (ast _ timer##ch##_cycle == NEVER) { \ - V(int, t) = ast _ base_pokey.tick_cycle##ch; \ - while (t < ast _ cycle) \ - t += ast _ base_pokey.period_cycles##ch; \ - ast _ timer##ch##_cycle = t; \ - if (ast _ nearest_event_cycle > t) \ - ast _ nearest_event_cycle = t; \ - } \ - } \ - else \ - ast _ timer##ch##_cycle = NEVER; - SET_TIMER_IRQ(1); - SET_TIMER_IRQ(2); - SET_TIMER_IRQ(4); - } - else - PokeySound_PutByte(ast, addr, data); - } - else if ((addr & 0xff0f) == 0xd40a) { - if (ast _ cycle <= ast _ next_scanline_cycle - 8) - ast _ cycle = ast _ next_scanline_cycle - 8; - else - ast _ cycle = ast _ next_scanline_cycle + 106; - } - else if ((addr & 0xff00) == ast _ module_info.covox_addr) { - V(PokeyState PTR, pst); - addr &= 3; - if (addr == 0 || addr == 3) - pst = ADDRESSOF ast _ base_pokey; - else - pst = ADDRESSOF ast _ extra_pokey; - pst _ delta_buffer[CYCLE_TO_SAMPLE(ast _ cycle)] += (data - UBYTE(ast _ covox[addr])) << DELTA_SHIFT_COVOX; - ast _ covox[addr] = CAST(byte) (data); - } - else if ((addr & 0xff1f) == 0xd01f) { - V(int, sample) = CYCLE_TO_SAMPLE(ast _ cycle); - V(int, delta); - data &= 8; - /* NOT data - ast _ consol; reverse to the POKEY sound */ - delta = (ast _ consol - data) << DELTA_SHIFT_GTIA; - ast _ consol = data; - ast _ base_pokey.delta_buffer[sample] += delta; - ast _ extra_pokey.delta_buffer[sample] += delta; - } - else - dPutByte(addr, data); + if ((data & ast _ irqst & ch) != 0) { \ + if (ast _ timer##ch##_cycle == NEVER) { \ + V(int, t) = ast _ base_pokey.tick_cycle##ch; \ + while (t < ast _ cycle) \ + t += ast _ base_pokey.period_cycles##ch; \ + ast _ timer##ch##_cycle = t; \ + if (ast _ nearest_event_cycle > t) \ + ast _ nearest_event_cycle = t; \ + } \ + } \ + else \ + ast _ timer##ch##_cycle = NEVER; + SET_TIMER_IRQ(1); + SET_TIMER_IRQ(2); + SET_TIMER_IRQ(4); + } + else + PokeySound_PutByte(ast, addr, data); + } + else if ((addr & 0xff0f) == 0xd40a) { + if (ast _ cycle <= ast _ next_scanline_cycle - 8) + ast _ cycle = ast _ next_scanline_cycle - 8; + else + ast _ cycle = ast _ next_scanline_cycle + 106; + } + else if ((addr & 0xff00) == ast _ module_info.covox_addr) { + V(PokeyState PTR, pst); + addr &= 3; + if (addr == 0 || addr == 3) + pst = ADDRESSOF ast _ base_pokey; + else + pst = ADDRESSOF ast _ extra_pokey; + pst _ delta_buffer[CYCLE_TO_SAMPLE(ast _ cycle)] += (data - UBYTE(ast _ covox[addr])) << DELTA_SHIFT_COVOX; + ast _ covox[addr] = CAST(byte) (data); + } + else if ((addr & 0xff1f) == 0xd01f) { + V(int, sample) = CYCLE_TO_SAMPLE(ast _ cycle); + V(int, delta); + data &= 8; + /* NOT data - ast _ consol; reverse to the POKEY sound */ + delta = (ast _ consol - data) << DELTA_SHIFT_GTIA; + ast _ consol = data; + ast _ base_pokey.delta_buffer[sample] += delta; + ast _ extra_pokey.delta_buffer[sample] += delta; + } + else + dPutByte(addr, data); } #define UWORD(array, index) (UBYTE(array[index]) + (UBYTE(array[(index) + 1]) << 8)) @@ -110,61 +110,61 @@ FUNC(void, ASAP_PutByte, (P(ASAP_State PTR, ast), P(int, addr), P(int, data))) #define CMR_BASS_TABLE_OFFSET 0x70f CONST_ARRAY(byte, cmr_bass_table) - 0x5C, 0x56, 0x50, 0x4D, 0x47, 0x44, 0x41, 0x3E, - 0x38, 0x35, CAST(byte) (0x88), 0x7F, 0x79, 0x73, 0x6C, 0x67, - 0x60, 0x5A, 0x55, 0x51, 0x4C, 0x48, 0x43, 0x3F, - 0x3D, 0x39, 0x34, 0x33, 0x30, 0x2D, 0x2A, 0x28, - 0x25, 0x24, 0x21, 0x1F, 0x1E + 0x5C, 0x56, 0x50, 0x4D, 0x47, 0x44, 0x41, 0x3E, + 0x38, 0x35, CAST(byte) (0x88), 0x7F, 0x79, 0x73, 0x6C, 0x67, + 0x60, 0x5A, 0x55, 0x51, 0x4C, 0x48, 0x43, 0x3F, + 0x3D, 0x39, 0x34, 0x33, 0x30, 0x2D, 0x2A, 0x28, + 0x25, 0x24, 0x21, 0x1F, 0x1E END_CONST_ARRAY; CONST_ARRAY(int, perframe2fastplay) - 312, 312 / 2, 312 / 3, 312 / 4 + 312, 312 / 2, 312 / 3, 312 / 4 END_CONST_ARRAY; /* Loads native module (anything except SAP) and 6502 player routine. */ PRIVATE FUNC(abool, load_native, ( - P(ASAP_State PTR, ast), P(ASAP_ModuleInfo PTR, module_info), - P(CONST BYTEARRAY, module), P(int, module_len), P(RESOURCE, player))) + P(ASAP_State PTR, ast), P(ASAP_ModuleInfo PTR, module_info), + P(CONST BYTEARRAY, module), P(int, module_len), P(RESOURCE, player))) { - V(int, player_last_byte); - V(int, music_last_byte); - V(int, block_len); - if ((UBYTE(module[0]) != 0xff || UBYTE(module[1]) != 0xff) - && (module[0] != 0 || module[1] != 0)) /* some CMC and clones start with zeros */ - return FALSE; - module_info _ player = UWORD(player, 2); - player_last_byte = UWORD(player, 4); - module_info _ music = UWORD(module, 2); - if (module_info _ music <= player_last_byte) - return FALSE; - music_last_byte = UWORD(module, 4); - if (module_info _ music <= 0xd7ff && music_last_byte >= 0xd000) - return FALSE; - block_len = music_last_byte + 1 - module_info _ music; - if (6 + block_len != module_len) { - V(int, info_addr); - V(int, info_len); - if (module_info _ type != ASAP_TYPE_RMT || 11 + block_len > module_len) - return FALSE; - /* allow optional info for Raster Music Tracker */ - info_addr = UWORD(module, 6 + block_len); - if (info_addr != module_info _ music + block_len) - return FALSE; - info_len = UWORD(module, 8 + block_len) + 1 - info_addr; - if (10 + block_len + info_len != module_len) - return FALSE; - } - if (ast != NULL) { - COPY_ARRAY(ast _ memory, module_info _ music, module, 6, block_len); - COPY_ARRAY(ast _ memory, module_info _ player, player, 6, player_last_byte + 1 - module_info _ player); - } - return TRUE; + V(int, player_last_byte); + V(int, music_last_byte); + V(int, block_len); + if ((UBYTE(module[0]) != 0xff || UBYTE(module[1]) != 0xff) + && (module[0] != 0 || module[1] != 0)) /* some CMC and clones start with zeros */ + return FALSE; + module_info _ player = UWORD(player, 2); + player_last_byte = UWORD(player, 4); + module_info _ music = UWORD(module, 2); + if (module_info _ music <= player_last_byte) + return FALSE; + music_last_byte = UWORD(module, 4); + if (module_info _ music <= 0xd7ff && music_last_byte >= 0xd000) + return FALSE; + block_len = music_last_byte + 1 - module_info _ music; + if (6 + block_len != module_len) { + V(int, info_addr); + V(int, info_len); + if (module_info _ type != ASAP_TYPE_RMT || 11 + block_len > module_len) + return FALSE; + /* allow optional info for Raster Music Tracker */ + info_addr = UWORD(module, 6 + block_len); + if (info_addr != module_info _ music + block_len) + return FALSE; + info_len = UWORD(module, 8 + block_len) + 1 - info_addr; + if (10 + block_len + info_len != module_len) + return FALSE; + } + if (ast != NULL) { + COPY_ARRAY(ast _ memory, module_info _ music, module, 6, block_len); + COPY_ARRAY(ast _ memory, module_info _ player, player, 6, player_last_byte + 1 - module_info _ player); + } + return TRUE; } PRIVATE FUNC(void, set_song_duration, (P(ASAP_ModuleInfo PTR, module_info), P(int, player_calls))) { - module_info _ durations[module_info _ songs] = TO_INT(player_calls * module_info _ fastplay * 114000.0 / 1773447); - module_info _ songs++; + module_info _ durations[module_info _ songs] = TO_INT(player_calls * module_info _ fastplay * 114000.0 / 1773447); + module_info _ songs++; } #define SEEN_THIS_CALL 1 @@ -173,901 +173,901 @@ PRIVATE FUNC(void, set_song_duration, (P(ASAP_ModuleInfo PTR, module_info), P(in PRIVATE FUNC(void, parse_cmc_song, (P(ASAP_ModuleInfo PTR, module_info), P(CONST BYTEARRAY, module), P(int, pos))) { - V(int, tempo) = UBYTE(module[0x19]); - V(int, player_calls) = 0; - V(int, rep_start_pos) = 0; - V(int, rep_end_pos) = 0; - V(int, rep_times) = 0; - NEW_ARRAY(byte, seen, 0x55); - INIT_ARRAY(seen); - while (pos >= 0 && pos < 0x55) { - V(int, p1); - V(int, p2); - V(int, p3); - if (pos == rep_end_pos && rep_times > 0) { - for (p1 = 0; p1 < 0x55; p1++) - if (seen[p1] == SEEN_THIS_CALL || seen[p1] == SEEN_REPEAT) - seen[p1] = 0; - rep_times--; - pos = rep_start_pos; - } - if (seen[pos] != 0) { - if (seen[pos] != SEEN_THIS_CALL) - module_info _ loops[module_info _ songs] = TRUE; - break; - } - seen[pos] = SEEN_THIS_CALL; - p1 = UBYTE(module[0x206 + pos]); - p2 = UBYTE(module[0x25b + pos]); - p3 = UBYTE(module[0x2b0 + pos]); - if (p1 == 0xfe || p2 == 0xfe || p3 == 0xfe) { - pos++; - continue; - } - p1 >>= 4; - if (p1 == 8) - break; - if (p1 == 9) { - pos = p2; - continue; - } - if (p1 == 0xa) { - pos -= p2; - continue; - } - if (p1 == 0xb) { - pos += p2; - continue; - } - if (p1 == 0xc) { - tempo = p2; - pos++; - continue; - } - if (p1 == 0xd) { - pos++; - rep_start_pos = pos; - rep_end_pos = pos + p2; - rep_times = p3 - 1; - continue; - } - if (p1 == 0xe) { - module_info _ loops[module_info _ songs] = TRUE; - break; - } - p2 = rep_times > 0 ? SEEN_REPEAT : SEEN_BEFORE; - for (p1 = 0; p1 < 0x55; p1++) - if (seen[p1] == SEEN_THIS_CALL) - seen[p1] = CAST(byte) p2; - player_calls += tempo * (module_info _ type == ASAP_TYPE_CM3 ? 48 : 64); - pos++; - } - set_song_duration(module_info, player_calls); + V(int, tempo) = UBYTE(module[0x19]); + V(int, player_calls) = 0; + V(int, rep_start_pos) = 0; + V(int, rep_end_pos) = 0; + V(int, rep_times) = 0; + NEW_ARRAY(byte, seen, 0x55); + INIT_ARRAY(seen); + while (pos >= 0 && pos < 0x55) { + V(int, p1); + V(int, p2); + V(int, p3); + if (pos == rep_end_pos && rep_times > 0) { + for (p1 = 0; p1 < 0x55; p1++) + if (seen[p1] == SEEN_THIS_CALL || seen[p1] == SEEN_REPEAT) + seen[p1] = 0; + rep_times--; + pos = rep_start_pos; + } + if (seen[pos] != 0) { + if (seen[pos] != SEEN_THIS_CALL) + module_info _ loops[module_info _ songs] = TRUE; + break; + } + seen[pos] = SEEN_THIS_CALL; + p1 = UBYTE(module[0x206 + pos]); + p2 = UBYTE(module[0x25b + pos]); + p3 = UBYTE(module[0x2b0 + pos]); + if (p1 == 0xfe || p2 == 0xfe || p3 == 0xfe) { + pos++; + continue; + } + p1 >>= 4; + if (p1 == 8) + break; + if (p1 == 9) { + pos = p2; + continue; + } + if (p1 == 0xa) { + pos -= p2; + continue; + } + if (p1 == 0xb) { + pos += p2; + continue; + } + if (p1 == 0xc) { + tempo = p2; + pos++; + continue; + } + if (p1 == 0xd) { + pos++; + rep_start_pos = pos; + rep_end_pos = pos + p2; + rep_times = p3 - 1; + continue; + } + if (p1 == 0xe) { + module_info _ loops[module_info _ songs] = TRUE; + break; + } + p2 = rep_times > 0 ? SEEN_REPEAT : SEEN_BEFORE; + for (p1 = 0; p1 < 0x55; p1++) + if (seen[p1] == SEEN_THIS_CALL) + seen[p1] = CAST(byte) p2; + player_calls += tempo * (module_info _ type == ASAP_TYPE_CM3 ? 48 : 64); + pos++; + } + set_song_duration(module_info, player_calls); } PRIVATE FUNC(abool, parse_cmc, ( - P(ASAP_State PTR, ast), P(ASAP_ModuleInfo PTR, module_info), - P(CONST BYTEARRAY, module), P(int, module_len), P(int, type), P(RESOURCE, player))) + P(ASAP_State PTR, ast), P(ASAP_ModuleInfo PTR, module_info), + P(CONST BYTEARRAY, module), P(int, module_len), P(int, type), P(RESOURCE, player))) { - V(int, last_pos); - V(int, pos); - if (module_len < 0x306) - return FALSE; - module_info _ type = type; - if (!load_native(ast, module_info, module, module_len, player)) - return FALSE; - if (ast != NULL && type == ASAP_TYPE_CMR) - COPY_ARRAY(ast _ memory, 0x500 + CMR_BASS_TABLE_OFFSET, cmr_bass_table, 0, sizeof(cmr_bass_table)); - last_pos = 0x54; - while (--last_pos >= 0) { - if (UBYTE(module[0x206 + last_pos]) < 0xb0 - || UBYTE(module[0x25b + last_pos]) < 0x40 - || UBYTE(module[0x2b0 + last_pos]) < 0x40) - break; - if (module_info _ channels == 2) { - if (UBYTE(module[0x306 + last_pos]) < 0xb0 - || UBYTE(module[0x35b + last_pos]) < 0x40 - || UBYTE(module[0x3b0 + last_pos]) < 0x40) - break; - } - } - module_info _ songs = 0; - parse_cmc_song(module_info, module, 0); - for (pos = 0; pos < last_pos && module_info _ songs < ASAP_SONGS_MAX; pos++) - if (UBYTE(module[0x206 + pos]) == 0x8f || UBYTE(module[0x206 + pos]) == 0xef) - parse_cmc_song(module_info, module, pos + 1); - return TRUE; + V(int, last_pos); + V(int, pos); + if (module_len < 0x306) + return FALSE; + module_info _ type = type; + if (!load_native(ast, module_info, module, module_len, player)) + return FALSE; + if (ast != NULL && type == ASAP_TYPE_CMR) + COPY_ARRAY(ast _ memory, 0x500 + CMR_BASS_TABLE_OFFSET, cmr_bass_table, 0, sizeof(cmr_bass_table)); + last_pos = 0x54; + while (--last_pos >= 0) { + if (UBYTE(module[0x206 + last_pos]) < 0xb0 + || UBYTE(module[0x25b + last_pos]) < 0x40 + || UBYTE(module[0x2b0 + last_pos]) < 0x40) + break; + if (module_info _ channels == 2) { + if (UBYTE(module[0x306 + last_pos]) < 0xb0 + || UBYTE(module[0x35b + last_pos]) < 0x40 + || UBYTE(module[0x3b0 + last_pos]) < 0x40) + break; + } + } + module_info _ songs = 0; + parse_cmc_song(module_info, module, 0); + for (pos = 0; pos < last_pos && module_info _ songs < ASAP_SONGS_MAX; pos++) + if (UBYTE(module[0x206 + pos]) == 0x8f || UBYTE(module[0x206 + pos]) == 0xef) + parse_cmc_song(module_info, module, pos + 1); + return TRUE; } PRIVATE FUNC(abool, is_dlt_track_empty, (P(CONST BYTEARRAY, module), P(int, pos))) { - return UBYTE(module[0x2006 + pos]) >= 0x43 - && UBYTE(module[0x2106 + pos]) >= 0x40 - && UBYTE(module[0x2206 + pos]) >= 0x40 - && UBYTE(module[0x2306 + pos]) >= 0x40; + return UBYTE(module[0x2006 + pos]) >= 0x43 + && UBYTE(module[0x2106 + pos]) >= 0x40 + && UBYTE(module[0x2206 + pos]) >= 0x40 + && UBYTE(module[0x2306 + pos]) >= 0x40; } PRIVATE FUNC(abool, is_dlt_pattern_end, (P(CONST BYTEARRAY, module), P(int, pos), P(int, i))) { - V(int, ch); - for (ch = 0; ch < 4; ch++) { - V(int, pattern) = UBYTE(module[0x2006 + (ch << 8) + pos]); - if (pattern < 64) { - V(int, offset) = 6 + (pattern << 7) + (i << 1); - if ((module[offset] & 0x80) == 0 && (module[offset + 1] & 0x80) != 0) - return TRUE; - } - } - return FALSE; + V(int, ch); + for (ch = 0; ch < 4; ch++) { + V(int, pattern) = UBYTE(module[0x2006 + (ch << 8) + pos]); + if (pattern < 64) { + V(int, offset) = 6 + (pattern << 7) + (i << 1); + if ((module[offset] & 0x80) == 0 && (module[offset + 1] & 0x80) != 0) + return TRUE; + } + } + return FALSE; } PRIVATE FUNC(void, parse_dlt_song, ( - P(ASAP_ModuleInfo PTR, module_info), P(CONST BYTEARRAY, module), - P(BOOLARRAY, seen), P(int, pos))) + P(ASAP_ModuleInfo PTR, module_info), P(CONST BYTEARRAY, module), + P(BOOLARRAY, seen), P(int, pos))) { - V(int, player_calls) = 0; - V(abool, loop) = FALSE; - V(int, tempo) = 6; - while (pos < 128 && !seen[pos] && is_dlt_track_empty(module, pos)) - seen[pos++] = TRUE; - module_info _ song_pos[module_info _ songs] = CAST(byte) pos; - while (pos < 128) { - V(int, p1); - if (seen[pos]) { - loop = TRUE; - break; - } - seen[pos] = TRUE; - p1 = module[0x2006 + pos]; - if (p1 == 0x40 || is_dlt_track_empty(module, pos)) - break; - if (p1 == 0x41) - pos = UBYTE(module[0x2086 + pos]); - else if (p1 == 0x42) - tempo = UBYTE(module[0x2086 + pos++]); - else { - V(int, i); - for (i = 0; i < 64 && !is_dlt_pattern_end(module, pos, i); i++) - player_calls += tempo; - pos++; - } - } - if (player_calls > 0) { - module_info _ loops[module_info _ songs] = loop; - set_song_duration(module_info, player_calls); - } + V(int, player_calls) = 0; + V(abool, loop) = FALSE; + V(int, tempo) = 6; + while (pos < 128 && !seen[pos] && is_dlt_track_empty(module, pos)) + seen[pos++] = TRUE; + module_info _ song_pos[module_info _ songs] = CAST(byte) pos; + while (pos < 128) { + V(int, p1); + if (seen[pos]) { + loop = TRUE; + break; + } + seen[pos] = TRUE; + p1 = module[0x2006 + pos]; + if (p1 == 0x40 || is_dlt_track_empty(module, pos)) + break; + if (p1 == 0x41) + pos = UBYTE(module[0x2086 + pos]); + else if (p1 == 0x42) + tempo = UBYTE(module[0x2086 + pos++]); + else { + V(int, i); + for (i = 0; i < 64 && !is_dlt_pattern_end(module, pos, i); i++) + player_calls += tempo; + pos++; + } + } + if (player_calls > 0) { + module_info _ loops[module_info _ songs] = loop; + set_song_duration(module_info, player_calls); + } } PRIVATE FUNC(abool, parse_dlt, ( - P(ASAP_State PTR, ast), P(ASAP_ModuleInfo PTR, module_info), - P(CONST BYTEARRAY, module), P(int, module_len))) + P(ASAP_State PTR, ast), P(ASAP_ModuleInfo PTR, module_info), + P(CONST BYTEARRAY, module), P(int, module_len))) { - V(int, pos); - NEW_ARRAY(abool, seen, 128); - if (module_len == 0x2c06) { - if (ast != NULL) - ast _ memory[0x4c00] = 0; - } - else if (module_len != 0x2c07) - return FALSE; - module_info _ type = ASAP_TYPE_DLT; - if (!load_native(ast, module_info, module, module_len, GET_RESOURCE(dlt, obx)) - || module_info _ music != 0x2000) { - return FALSE; - } - INIT_ARRAY(seen); - module_info _ songs = 0; - for (pos = 0; pos < 128 && module_info _ songs < ASAP_SONGS_MAX; pos++) { - if (!seen[pos]) - parse_dlt_song(module_info, module, seen, pos); - } - return module_info _ songs > 0; + V(int, pos); + NEW_ARRAY(abool, seen, 128); + if (module_len == 0x2c06) { + if (ast != NULL) + ast _ memory[0x4c00] = 0; + } + else if (module_len != 0x2c07) + return FALSE; + module_info _ type = ASAP_TYPE_DLT; + if (!load_native(ast, module_info, module, module_len, GET_RESOURCE(dlt, obx)) + || module_info _ music != 0x2000) { + return FALSE; + } + INIT_ARRAY(seen); + module_info _ songs = 0; + for (pos = 0; pos < 128 && module_info _ songs < ASAP_SONGS_MAX; pos++) { + if (!seen[pos]) + parse_dlt_song(module_info, module, seen, pos); + } + return module_info _ songs > 0; } PRIVATE FUNC(void, parse_mpt_song, ( - P(ASAP_ModuleInfo PTR, module_info), P(CONST BYTEARRAY, module), - P(BOOLARRAY, global_seen), P(int, song_len), P(int, pos))) + P(ASAP_ModuleInfo PTR, module_info), P(CONST BYTEARRAY, module), + P(BOOLARRAY, global_seen), P(int, song_len), P(int, pos))) { - V(int, addr_to_offset) = UWORD(module, 2) - 6; - V(int, tempo) = UBYTE(module[0x1cf]); - V(int, player_calls) = 0; - NEW_ARRAY(byte, seen, 256); - NEW_ARRAY(int, pattern_offset, 4); - NEW_ARRAY(int, blank_rows, 4); - NEW_ARRAY(int, blank_rows_counter, 4); - INIT_ARRAY(seen); - INIT_ARRAY(blank_rows); - while (pos < song_len) { - V(int, i); - V(int, ch); - V(int, pattern_rows); - if (seen[pos] != 0) { - if (seen[pos] != SEEN_THIS_CALL) - module_info _ loops[module_info _ songs] = TRUE; - break; - } - seen[pos] = SEEN_THIS_CALL; - global_seen[pos] = TRUE; - i = UBYTE(module[0x1d0 + pos * 2]); - if (i == 0xff) { - pos = UBYTE(module[0x1d1 + pos * 2]); - continue; - } - for (ch = 3; ch >= 0; ch--) { - i = UBYTE(module[0x1c6 + ch]) + (UBYTE(module[0x1ca + ch]) << 8) - addr_to_offset; - i = UBYTE(module[i + pos * 2]); - if (i >= 0x40) - break; - i <<= 1; - i = UWORD(module, 0x46 + i); - pattern_offset[ch] = i == 0 ? 0 : i - addr_to_offset; - blank_rows_counter[ch] = 0; - } - if (ch >= 0) - break; - for (i = 0; i < song_len; i++) - if (seen[i] == SEEN_THIS_CALL) - seen[i] = SEEN_BEFORE; - for (pattern_rows = UBYTE(module[0x1ce]); --pattern_rows >= 0; ) { - for (ch = 3; ch >= 0; ch--) { - if (pattern_offset[ch] == 0 || --blank_rows_counter[ch] >= 0) - continue; - for (;;) { - i = UBYTE(module[pattern_offset[ch]++]); - if (i < 0x40 || i == 0xfe) - break; - if (i < 0x80) - continue; - if (i < 0xc0) { - blank_rows[ch] = i - 0x80; - continue; - } - if (i < 0xd0) - continue; - if (i < 0xe0) { - tempo = i - 0xcf; - continue; - } - pattern_rows = 0; - } - blank_rows_counter[ch] = blank_rows[ch]; - } - player_calls += tempo; - } - pos++; - } - if (player_calls > 0) - set_song_duration(module_info, player_calls); + V(int, addr_to_offset) = UWORD(module, 2) - 6; + V(int, tempo) = UBYTE(module[0x1cf]); + V(int, player_calls) = 0; + NEW_ARRAY(byte, seen, 256); + NEW_ARRAY(int, pattern_offset, 4); + NEW_ARRAY(int, blank_rows, 4); + NEW_ARRAY(int, blank_rows_counter, 4); + INIT_ARRAY(seen); + INIT_ARRAY(blank_rows); + while (pos < song_len) { + V(int, i); + V(int, ch); + V(int, pattern_rows); + if (seen[pos] != 0) { + if (seen[pos] != SEEN_THIS_CALL) + module_info _ loops[module_info _ songs] = TRUE; + break; + } + seen[pos] = SEEN_THIS_CALL; + global_seen[pos] = TRUE; + i = UBYTE(module[0x1d0 + pos * 2]); + if (i == 0xff) { + pos = UBYTE(module[0x1d1 + pos * 2]); + continue; + } + for (ch = 3; ch >= 0; ch--) { + i = UBYTE(module[0x1c6 + ch]) + (UBYTE(module[0x1ca + ch]) << 8) - addr_to_offset; + i = UBYTE(module[i + pos * 2]); + if (i >= 0x40) + break; + i <<= 1; + i = UWORD(module, 0x46 + i); + pattern_offset[ch] = i == 0 ? 0 : i - addr_to_offset; + blank_rows_counter[ch] = 0; + } + if (ch >= 0) + break; + for (i = 0; i < song_len; i++) + if (seen[i] == SEEN_THIS_CALL) + seen[i] = SEEN_BEFORE; + for (pattern_rows = UBYTE(module[0x1ce]); --pattern_rows >= 0; ) { + for (ch = 3; ch >= 0; ch--) { + if (pattern_offset[ch] == 0 || --blank_rows_counter[ch] >= 0) + continue; + for (;;) { + i = UBYTE(module[pattern_offset[ch]++]); + if (i < 0x40 || i == 0xfe) + break; + if (i < 0x80) + continue; + if (i < 0xc0) { + blank_rows[ch] = i - 0x80; + continue; + } + if (i < 0xd0) + continue; + if (i < 0xe0) { + tempo = i - 0xcf; + continue; + } + pattern_rows = 0; + } + blank_rows_counter[ch] = blank_rows[ch]; + } + player_calls += tempo; + } + pos++; + } + if (player_calls > 0) + set_song_duration(module_info, player_calls); } PRIVATE FUNC(abool, parse_mpt, ( - P(ASAP_State PTR, ast), P(ASAP_ModuleInfo PTR, module_info), - P(CONST BYTEARRAY, module), P(int, module_len))) + P(ASAP_State PTR, ast), P(ASAP_ModuleInfo PTR, module_info), + P(CONST BYTEARRAY, module), P(int, module_len))) { - V(int, track0_addr); - V(int, pos); - V(int, song_len); - /* seen[i] == TRUE if the track position i has been processed */ - NEW_ARRAY(abool, global_seen, 256); - if (module_len < 0x1d0) - return FALSE; - module_info _ type = ASAP_TYPE_MPT; - if (!load_native(ast, module_info, module, module_len, GET_RESOURCE(mpt, obx))) - return FALSE; - track0_addr = UWORD(module, 2) + 0x1ca; - if (UBYTE(module[0x1c6]) + (UBYTE(module[0x1ca]) << 8) != track0_addr) - return FALSE; - /* Calculate the length of the first track. Address of the second track minus - address of the first track equals the length of the first track in bytes. - Divide by two to get number of track positions. */ - song_len = (UBYTE(module[0x1c7]) + (UBYTE(module[0x1cb]) << 8) - track0_addr) >> 1; - if (song_len > 0xfe) - return FALSE; - INIT_ARRAY(global_seen); - module_info _ songs = 0; - for (pos = 0; pos < song_len && module_info _ songs < ASAP_SONGS_MAX; pos++) { - if (!global_seen[pos]) { - module_info _ song_pos[module_info _ songs] = CAST(byte) pos; - parse_mpt_song(module_info, module, global_seen, song_len, pos); - } - } - return module_info _ songs > 0; + V(int, track0_addr); + V(int, pos); + V(int, song_len); + /* seen[i] == TRUE if the track position i has been processed */ + NEW_ARRAY(abool, global_seen, 256); + if (module_len < 0x1d0) + return FALSE; + module_info _ type = ASAP_TYPE_MPT; + if (!load_native(ast, module_info, module, module_len, GET_RESOURCE(mpt, obx))) + return FALSE; + track0_addr = UWORD(module, 2) + 0x1ca; + if (UBYTE(module[0x1c6]) + (UBYTE(module[0x1ca]) << 8) != track0_addr) + return FALSE; + /* Calculate the length of the first track. Address of the second track minus + address of the first track equals the length of the first track in bytes. + Divide by two to get number of track positions. */ + song_len = (UBYTE(module[0x1c7]) + (UBYTE(module[0x1cb]) << 8) - track0_addr) >> 1; + if (song_len > 0xfe) + return FALSE; + INIT_ARRAY(global_seen); + module_info _ songs = 0; + for (pos = 0; pos < song_len && module_info _ songs < ASAP_SONGS_MAX; pos++) { + if (!global_seen[pos]) { + module_info _ song_pos[module_info _ songs] = CAST(byte) pos; + parse_mpt_song(module_info, module, global_seen, song_len, pos); + } + } + return module_info _ songs > 0; } CONST_ARRAY(byte, rmt_volume_silent) - 16, 8, 4, 3, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1 + 16, 8, 4, 3, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1 END_CONST_ARRAY; PRIVATE FUNC(int, rmt_instrument_frames, ( - P(CONST BYTEARRAY, module), P(int, instrument), - P(int, volume), P(int, volume_frame), P(abool, extra_pokey))) + P(CONST BYTEARRAY, module), P(int, instrument), + P(int, volume), P(int, volume_frame), P(abool, extra_pokey))) { - V(int, addr_to_offset) = UWORD(module, 2) - 6; - V(int, per_frame) = module[0xc]; - V(int, player_call); - V(int, player_calls); - V(int, index); - V(int, index_end); - V(int, index_loop); - V(int, volume_slide_depth); - V(int, volume_min); - V(int, volume_slide); - V(abool, silent_loop); - instrument = UWORD(module, 0xe) - addr_to_offset + (instrument << 1); - if (module[instrument + 1] == 0) - return 0; - instrument = UWORD(module, instrument) - addr_to_offset; - player_calls = player_call = volume_frame * per_frame; - index = UBYTE(module[instrument]) + 1 + player_call * 3; - index_end = UBYTE(module[instrument + 2]) + 3; - index_loop = UBYTE(module[instrument + 3]); - if (index_loop >= index_end) - return 0; /* error */ - volume_slide_depth = UBYTE(module[instrument + 6]); - volume_min = UBYTE(module[instrument + 7]); - if (index >= index_end) - index = (index - index_end) % (index_end - index_loop) + index_loop; - else { - do { - V(int, vol) = module[instrument + index]; - if (extra_pokey) - vol >>= 4; - if ((vol & 0xf) >= rmt_volume_silent[volume]) - player_calls = player_call + 1; - player_call++; - index += 3; - } while (index < index_end); - } - if (volume_slide_depth == 0) - return player_calls / per_frame; - volume_slide = 128; - silent_loop = FALSE; - for (;;) { - V(int, vol); - if (index >= index_end) { - if (silent_loop) - break; - silent_loop = TRUE; - index = index_loop; - } - vol = module[instrument + index]; - if (extra_pokey) - vol >>= 4; - if ((vol & 0xf) >= rmt_volume_silent[volume]) { - player_calls = player_call + 1; - silent_loop = FALSE; - } - player_call++; - index += 3; - volume_slide -= volume_slide_depth; - if (volume_slide < 0) { - volume_slide += 256; - if (--volume <= volume_min) - break; - } - } - return player_calls / per_frame; + V(int, addr_to_offset) = UWORD(module, 2) - 6; + V(int, per_frame) = module[0xc]; + V(int, player_call); + V(int, player_calls); + V(int, index); + V(int, index_end); + V(int, index_loop); + V(int, volume_slide_depth); + V(int, volume_min); + V(int, volume_slide); + V(abool, silent_loop); + instrument = UWORD(module, 0xe) - addr_to_offset + (instrument << 1); + if (module[instrument + 1] == 0) + return 0; + instrument = UWORD(module, instrument) - addr_to_offset; + player_calls = player_call = volume_frame * per_frame; + index = UBYTE(module[instrument]) + 1 + player_call * 3; + index_end = UBYTE(module[instrument + 2]) + 3; + index_loop = UBYTE(module[instrument + 3]); + if (index_loop >= index_end) + return 0; /* error */ + volume_slide_depth = UBYTE(module[instrument + 6]); + volume_min = UBYTE(module[instrument + 7]); + if (index >= index_end) + index = (index - index_end) % (index_end - index_loop) + index_loop; + else { + do { + V(int, vol) = module[instrument + index]; + if (extra_pokey) + vol >>= 4; + if ((vol & 0xf) >= rmt_volume_silent[volume]) + player_calls = player_call + 1; + player_call++; + index += 3; + } while (index < index_end); + } + if (volume_slide_depth == 0) + return player_calls / per_frame; + volume_slide = 128; + silent_loop = FALSE; + for (;;) { + V(int, vol); + if (index >= index_end) { + if (silent_loop) + break; + silent_loop = TRUE; + index = index_loop; + } + vol = module[instrument + index]; + if (extra_pokey) + vol >>= 4; + if ((vol & 0xf) >= rmt_volume_silent[volume]) { + player_calls = player_call + 1; + silent_loop = FALSE; + } + player_call++; + index += 3; + volume_slide -= volume_slide_depth; + if (volume_slide < 0) { + volume_slide += 256; + if (--volume <= volume_min) + break; + } + } + return player_calls / per_frame; } PRIVATE FUNC(void, parse_rmt_song, ( - P(ASAP_ModuleInfo PTR, module_info), P(CONST BYTEARRAY, module), - P(BOOLARRAY, global_seen), P(int, song_len), P(int, pos_shift), P(int, pos))) + P(ASAP_ModuleInfo PTR, module_info), P(CONST BYTEARRAY, module), + P(BOOLARRAY, global_seen), P(int, song_len), P(int, pos_shift), P(int, pos))) { - V(int, ch); - V(int, addr_to_offset) = UWORD(module, 2) - 6; - V(int, tempo) = UBYTE(module[0xb]); - V(int, frames) = 0; - V(int, song_offset) = UWORD(module, 0x14) - addr_to_offset; - V(int, pattern_lo_offset) = UWORD(module, 0x10) - addr_to_offset; - V(int, pattern_hi_offset) = UWORD(module, 0x12) - addr_to_offset; - V(int, instrument_frames); - NEW_ARRAY(byte, seen, 256); - NEW_ARRAY(int, pattern_begin, 8); - NEW_ARRAY(int, pattern_offset, 8); - NEW_ARRAY(int, blank_rows, 8); - NEW_ARRAY(int, instrument_no, 8); - NEW_ARRAY(int, instrument_frame, 8); - NEW_ARRAY(int, volume_value, 8); - NEW_ARRAY(int, volume_frame, 8); - INIT_ARRAY(seen); - INIT_ARRAY(instrument_no); - INIT_ARRAY(instrument_frame); - INIT_ARRAY(volume_value); - INIT_ARRAY(volume_frame); - while (pos < song_len) { - V(int, i); - V(int, pattern_rows); - if (seen[pos] != 0) { - if (seen[pos] != SEEN_THIS_CALL) - module_info _ loops[module_info _ songs] = TRUE; - break; - } - seen[pos] = SEEN_THIS_CALL; - global_seen[pos] = TRUE; - if (UBYTE(module[song_offset + (pos << pos_shift)]) == 0xfe) { - pos = UBYTE(module[song_offset + (pos << pos_shift) + 1]); - continue; - } - for (ch = 0; ch < 1 << pos_shift; ch++) { - i = UBYTE(module[song_offset + (pos << pos_shift) + ch]); - if (i == 0xff) - blank_rows[ch] = 256; - else { - pattern_offset[ch] = pattern_begin[ch] = UBYTE(module[pattern_lo_offset + i]) - + (UBYTE(module[pattern_hi_offset + i]) << 8) - addr_to_offset; - blank_rows[ch] = 0; - } - } - for (i = 0; i < song_len; i++) - if (seen[i] == SEEN_THIS_CALL) - seen[i] = SEEN_BEFORE; - for (pattern_rows = UBYTE(module[0xa]); --pattern_rows >= 0; ) { - for (ch = 0; ch < 1 << pos_shift; ch++) { - if (--blank_rows[ch] > 0) - continue; - for (;;) { - i = UBYTE(module[pattern_offset[ch]++]); - if ((i & 0x3f) < 62) { - i += UBYTE(module[pattern_offset[ch]++]) << 8; - if ((i & 0x3f) != 61) { - instrument_no[ch] = i >> 10; - instrument_frame[ch] = frames; - } - volume_value[ch] = (i >> 6) & 0xf; - volume_frame[ch] = frames; - break; - } - if (i == 62) { - blank_rows[ch] = UBYTE(module[pattern_offset[ch]++]); - break; - } - if ((i & 0x3f) == 62) { - blank_rows[ch] = i >> 6; - break; - } - if ((i & 0xbf) == 63) { - tempo = UBYTE(module[pattern_offset[ch]++]); - continue; - } - if (i == 0xbf) { - pattern_offset[ch] = pattern_begin[ch] + UBYTE(module[pattern_offset[ch]]); - continue; - } - /* assert(i == 0xff); */ - pattern_rows = -1; - break; - } - if (pattern_rows < 0) - break; - } - if (pattern_rows >= 0) - frames += tempo; - } - pos++; - } - instrument_frames = 0; - for (ch = 0; ch < 1 << pos_shift; ch++) { - V(int, frame) = instrument_frame[ch]; - frame += rmt_instrument_frames(module, instrument_no[ch], volume_value[ch], volume_frame[ch] - frame, ch >= 4); - if (instrument_frames < frame) - instrument_frames = frame; - } - if (frames > instrument_frames) { - if (frames - instrument_frames > 100) - module_info _ loops[module_info _ songs] = FALSE; - frames = instrument_frames; - } - if (frames > 0) - set_song_duration(module_info, frames); + V(int, ch); + V(int, addr_to_offset) = UWORD(module, 2) - 6; + V(int, tempo) = UBYTE(module[0xb]); + V(int, frames) = 0; + V(int, song_offset) = UWORD(module, 0x14) - addr_to_offset; + V(int, pattern_lo_offset) = UWORD(module, 0x10) - addr_to_offset; + V(int, pattern_hi_offset) = UWORD(module, 0x12) - addr_to_offset; + V(int, instrument_frames); + NEW_ARRAY(byte, seen, 256); + NEW_ARRAY(int, pattern_begin, 8); + NEW_ARRAY(int, pattern_offset, 8); + NEW_ARRAY(int, blank_rows, 8); + NEW_ARRAY(int, instrument_no, 8); + NEW_ARRAY(int, instrument_frame, 8); + NEW_ARRAY(int, volume_value, 8); + NEW_ARRAY(int, volume_frame, 8); + INIT_ARRAY(seen); + INIT_ARRAY(instrument_no); + INIT_ARRAY(instrument_frame); + INIT_ARRAY(volume_value); + INIT_ARRAY(volume_frame); + while (pos < song_len) { + V(int, i); + V(int, pattern_rows); + if (seen[pos] != 0) { + if (seen[pos] != SEEN_THIS_CALL) + module_info _ loops[module_info _ songs] = TRUE; + break; + } + seen[pos] = SEEN_THIS_CALL; + global_seen[pos] = TRUE; + if (UBYTE(module[song_offset + (pos << pos_shift)]) == 0xfe) { + pos = UBYTE(module[song_offset + (pos << pos_shift) + 1]); + continue; + } + for (ch = 0; ch < 1 << pos_shift; ch++) { + i = UBYTE(module[song_offset + (pos << pos_shift) + ch]); + if (i == 0xff) + blank_rows[ch] = 256; + else { + pattern_offset[ch] = pattern_begin[ch] = UBYTE(module[pattern_lo_offset + i]) + + (UBYTE(module[pattern_hi_offset + i]) << 8) - addr_to_offset; + blank_rows[ch] = 0; + } + } + for (i = 0; i < song_len; i++) + if (seen[i] == SEEN_THIS_CALL) + seen[i] = SEEN_BEFORE; + for (pattern_rows = UBYTE(module[0xa]); --pattern_rows >= 0; ) { + for (ch = 0; ch < 1 << pos_shift; ch++) { + if (--blank_rows[ch] > 0) + continue; + for (;;) { + i = UBYTE(module[pattern_offset[ch]++]); + if ((i & 0x3f) < 62) { + i += UBYTE(module[pattern_offset[ch]++]) << 8; + if ((i & 0x3f) != 61) { + instrument_no[ch] = i >> 10; + instrument_frame[ch] = frames; + } + volume_value[ch] = (i >> 6) & 0xf; + volume_frame[ch] = frames; + break; + } + if (i == 62) { + blank_rows[ch] = UBYTE(module[pattern_offset[ch]++]); + break; + } + if ((i & 0x3f) == 62) { + blank_rows[ch] = i >> 6; + break; + } + if ((i & 0xbf) == 63) { + tempo = UBYTE(module[pattern_offset[ch]++]); + continue; + } + if (i == 0xbf) { + pattern_offset[ch] = pattern_begin[ch] + UBYTE(module[pattern_offset[ch]]); + continue; + } + /* assert(i == 0xff); */ + pattern_rows = -1; + break; + } + if (pattern_rows < 0) + break; + } + if (pattern_rows >= 0) + frames += tempo; + } + pos++; + } + instrument_frames = 0; + for (ch = 0; ch < 1 << pos_shift; ch++) { + V(int, frame) = instrument_frame[ch]; + frame += rmt_instrument_frames(module, instrument_no[ch], volume_value[ch], volume_frame[ch] - frame, ch >= 4); + if (instrument_frames < frame) + instrument_frames = frame; + } + if (frames > instrument_frames) { + if (frames - instrument_frames > 100) + module_info _ loops[module_info _ songs] = FALSE; + frames = instrument_frames; + } + if (frames > 0) + set_song_duration(module_info, frames); } PRIVATE FUNC(abool, parse_rmt, ( - P(ASAP_State PTR, ast), P(ASAP_ModuleInfo PTR, module_info), - P(CONST BYTEARRAY, module), P(int, module_len))) + P(ASAP_State PTR, ast), P(ASAP_ModuleInfo PTR, module_info), + P(CONST BYTEARRAY, module), P(int, module_len))) { - V(int, per_frame); - V(int, pos_shift); - V(int, song_len); - V(int, pos); - NEW_ARRAY(abool, global_seen, 256); - if (module_len < 0x30 || module[6] != CHARCODE('R') || module[7] != CHARCODE('M') - || module[8] != CHARCODE('T') || module[0xd] != 1) - return FALSE; - switch (CAST(char) module[9]) { - case CHARCODE('4'): - pos_shift = 2; - break; - case CHARCODE('8'): - module_info _ channels = 2; - pos_shift = 3; - break; - default: - return FALSE; - } - per_frame = module[0xc]; - if (per_frame < 1 || per_frame > 4) - return FALSE; - module_info _ type = ASAP_TYPE_RMT; - if (!load_native(ast, module_info, module, module_len, - module_info _ channels == 2 ? GET_RESOURCE(rmt8, obx) : GET_RESOURCE(rmt4, obx))) - return FALSE; - song_len = UWORD(module, 4) + 1 - UWORD(module, 0x14); - if (pos_shift == 3 && (song_len & 4) != 0 - && UBYTE(module[6 + UWORD(module, 4) - UWORD(module, 2) - 3]) == 0xfe) - song_len += 4; - song_len >>= pos_shift; - if (song_len >= 0x100) - return FALSE; - INIT_ARRAY(global_seen); - module_info _ songs = 0; - for (pos = 0; pos < song_len && module_info _ songs < ASAP_SONGS_MAX; pos++) { - if (!global_seen[pos]) { - module_info _ song_pos[module_info _ songs] = CAST(byte) pos; - parse_rmt_song(module_info, module, global_seen, song_len, pos_shift, pos); - } - } - /* must set fastplay after song durations calculations, so they assume 312 */ - module_info _ fastplay = perframe2fastplay[per_frame - 1]; - module_info _ player = 0x600; - return module_info _ songs > 0; + V(int, per_frame); + V(int, pos_shift); + V(int, song_len); + V(int, pos); + NEW_ARRAY(abool, global_seen, 256); + if (module_len < 0x30 || module[6] != CHARCODE('R') || module[7] != CHARCODE('M') + || module[8] != CHARCODE('T') || module[0xd] != 1) + return FALSE; + switch (CAST(char) module[9]) { + case CHARCODE('4'): + pos_shift = 2; + break; + case CHARCODE('8'): + module_info _ channels = 2; + pos_shift = 3; + break; + default: + return FALSE; + } + per_frame = module[0xc]; + if (per_frame < 1 || per_frame > 4) + return FALSE; + module_info _ type = ASAP_TYPE_RMT; + if (!load_native(ast, module_info, module, module_len, + module_info _ channels == 2 ? GET_RESOURCE(rmt8, obx) : GET_RESOURCE(rmt4, obx))) + return FALSE; + song_len = UWORD(module, 4) + 1 - UWORD(module, 0x14); + if (pos_shift == 3 && (song_len & 4) != 0 + && UBYTE(module[6 + UWORD(module, 4) - UWORD(module, 2) - 3]) == 0xfe) + song_len += 4; + song_len >>= pos_shift; + if (song_len >= 0x100) + return FALSE; + INIT_ARRAY(global_seen); + module_info _ songs = 0; + for (pos = 0; pos < song_len && module_info _ songs < ASAP_SONGS_MAX; pos++) { + if (!global_seen[pos]) { + module_info _ song_pos[module_info _ songs] = CAST(byte) pos; + parse_rmt_song(module_info, module, global_seen, song_len, pos_shift, pos); + } + } + /* must set fastplay after song durations calculations, so they assume 312 */ + module_info _ fastplay = perframe2fastplay[per_frame - 1]; + module_info _ player = 0x600; + return module_info _ songs > 0; } PRIVATE FUNC(void, parse_tmc_song, ( - P(ASAP_ModuleInfo PTR, module_info), P(CONST BYTEARRAY, module), P(int, pos))) + P(ASAP_ModuleInfo PTR, module_info), P(CONST BYTEARRAY, module), P(int, pos))) { - V(int, addr_to_offset) = UWORD(module, 2) - 6; - V(int, tempo) = UBYTE(module[0x24]) + 1; - V(int, frames) = 0; - NEW_ARRAY(int, pattern_offset, 8); - NEW_ARRAY(int, blank_rows, 8); - while (UBYTE(module[0x1a6 + 15 + pos]) < 0x80) { - V(int, ch); - V(int, pattern_rows); - for (ch = 7; ch >= 0; ch--) { - V(int, pat) = UBYTE(module[0x1a6 + 15 + pos - 2 * ch]); - pattern_offset[ch] = UBYTE(module[0xa6 + pat]) + (UBYTE(module[0x126 + pat]) << 8) - addr_to_offset; - blank_rows[ch] = 0; - } - for (pattern_rows = 64; --pattern_rows >= 0; ) { - for (ch = 7; ch >= 0; ch--) { - if (--blank_rows[ch] >= 0) - continue; - for (;;) { - V(int, i) = UBYTE(module[pattern_offset[ch]++]); - if (i < 0x40) { - pattern_offset[ch]++; - break; - } - if (i == 0x40) { - i = UBYTE(module[pattern_offset[ch]++]); - if ((i & 0x7f) == 0) - pattern_rows = 0; - else - tempo = (i & 0x7f) + 1; - if (i >= 0x80) - pattern_offset[ch]++; - break; - } - if (i < 0x80) { - i = module[pattern_offset[ch]++] & 0x7f; - if (i == 0) - pattern_rows = 0; - else - tempo = i + 1; - pattern_offset[ch]++; - break; - } - if (i < 0xc0) - continue; - blank_rows[ch] = i - 0xbf; - break; - } - } - frames += tempo; - } - pos += 16; - } - if (UBYTE(module[0x1a6 + 14 + pos]) < 0x80) - module_info _ loops[module_info _ songs] = TRUE; - set_song_duration(module_info, frames); + V(int, addr_to_offset) = UWORD(module, 2) - 6; + V(int, tempo) = UBYTE(module[0x24]) + 1; + V(int, frames) = 0; + NEW_ARRAY(int, pattern_offset, 8); + NEW_ARRAY(int, blank_rows, 8); + while (UBYTE(module[0x1a6 + 15 + pos]) < 0x80) { + V(int, ch); + V(int, pattern_rows); + for (ch = 7; ch >= 0; ch--) { + V(int, pat) = UBYTE(module[0x1a6 + 15 + pos - 2 * ch]); + pattern_offset[ch] = UBYTE(module[0xa6 + pat]) + (UBYTE(module[0x126 + pat]) << 8) - addr_to_offset; + blank_rows[ch] = 0; + } + for (pattern_rows = 64; --pattern_rows >= 0; ) { + for (ch = 7; ch >= 0; ch--) { + if (--blank_rows[ch] >= 0) + continue; + for (;;) { + V(int, i) = UBYTE(module[pattern_offset[ch]++]); + if (i < 0x40) { + pattern_offset[ch]++; + break; + } + if (i == 0x40) { + i = UBYTE(module[pattern_offset[ch]++]); + if ((i & 0x7f) == 0) + pattern_rows = 0; + else + tempo = (i & 0x7f) + 1; + if (i >= 0x80) + pattern_offset[ch]++; + break; + } + if (i < 0x80) { + i = module[pattern_offset[ch]++] & 0x7f; + if (i == 0) + pattern_rows = 0; + else + tempo = i + 1; + pattern_offset[ch]++; + break; + } + if (i < 0xc0) + continue; + blank_rows[ch] = i - 0xbf; + break; + } + } + frames += tempo; + } + pos += 16; + } + if (UBYTE(module[0x1a6 + 14 + pos]) < 0x80) + module_info _ loops[module_info _ songs] = TRUE; + set_song_duration(module_info, frames); } PRIVATE FUNC(abool, parse_tmc, ( - P(ASAP_State PTR, ast), P(ASAP_ModuleInfo PTR, module_info), - P(CONST BYTEARRAY, module), P(int, module_len))) + P(ASAP_State PTR, ast), P(ASAP_ModuleInfo PTR, module_info), + P(CONST BYTEARRAY, module), P(int, module_len))) { - V(int, i); - V(int, last_pos); - if (module_len < 0x1d0) - return FALSE; - module_info _ type = ASAP_TYPE_TMC; - if (!load_native(ast, module_info, module, module_len, GET_RESOURCE(tmc, obx))) - return FALSE; - module_info _ channels = 2; - i = 0; - /* find first instrument */ - while (module[0x66 + i] == 0) { - if (++i >= 64) - return FALSE; /* no instrument */ - } - last_pos = (UBYTE(module[0x66 + i]) << 8) + UBYTE(module[0x26 + i]) - - UWORD(module, 2) - 0x1b0; - if (0x1b5 + last_pos >= module_len) - return FALSE; - /* skip trailing jumps */ - do { - if (last_pos <= 0) - return FALSE; /* no pattern to play */ - last_pos -= 16; - } while (UBYTE(module[0x1b5 + last_pos]) >= 0x80); - module_info _ songs = 0; - parse_tmc_song(module_info, module, 0); - for (i = 0; i < last_pos && module_info _ songs < ASAP_SONGS_MAX; i += 16) - if (UBYTE(module[0x1b5 + i]) >= 0x80) - parse_tmc_song(module_info, module, i + 16); - /* must set fastplay after song durations calculations, so they assume 312 */ - i = module[0x25]; - if (i < 1 || i > 4) - return FALSE; - if (ast != NULL) - ast _ tmc_per_frame = module[0x25]; - module_info _ fastplay = perframe2fastplay[i - 1]; - return TRUE; + V(int, i); + V(int, last_pos); + if (module_len < 0x1d0) + return FALSE; + module_info _ type = ASAP_TYPE_TMC; + if (!load_native(ast, module_info, module, module_len, GET_RESOURCE(tmc, obx))) + return FALSE; + module_info _ channels = 2; + i = 0; + /* find first instrument */ + while (module[0x66 + i] == 0) { + if (++i >= 64) + return FALSE; /* no instrument */ + } + last_pos = (UBYTE(module[0x66 + i]) << 8) + UBYTE(module[0x26 + i]) + - UWORD(module, 2) - 0x1b0; + if (0x1b5 + last_pos >= module_len) + return FALSE; + /* skip trailing jumps */ + do { + if (last_pos <= 0) + return FALSE; /* no pattern to play */ + last_pos -= 16; + } while (UBYTE(module[0x1b5 + last_pos]) >= 0x80); + module_info _ songs = 0; + parse_tmc_song(module_info, module, 0); + for (i = 0; i < last_pos && module_info _ songs < ASAP_SONGS_MAX; i += 16) + if (UBYTE(module[0x1b5 + i]) >= 0x80) + parse_tmc_song(module_info, module, i + 16); + /* must set fastplay after song durations calculations, so they assume 312 */ + i = module[0x25]; + if (i < 1 || i > 4) + return FALSE; + if (ast != NULL) + ast _ tmc_per_frame = module[0x25]; + module_info _ fastplay = perframe2fastplay[i - 1]; + return TRUE; } PRIVATE FUNC(void, parse_tm2_song, ( - P(ASAP_ModuleInfo PTR, module_info), P(CONST BYTEARRAY, module), P(int, pos))) + P(ASAP_ModuleInfo PTR, module_info), P(CONST BYTEARRAY, module), P(int, pos))) { - V(int, addr_to_offset) = UWORD(module, 2) - 6; - V(int, tempo) = UBYTE(module[0x24]) + 1; - V(int, player_calls) = 0; - NEW_ARRAY(int, pattern_offset, 8); - NEW_ARRAY(int, blank_rows, 8); - for (;;) { - V(int, ch); - V(int, pattern_rows) = UBYTE(module[0x386 + 16 + pos]); - if (pattern_rows == 0) - break; - if (pattern_rows >= 0x80) { - module_info _ loops[module_info _ songs] = TRUE; - break; - } - for (ch = 7; ch >= 0; ch--) { - V(int, pat) = UBYTE(module[0x386 + 15 + pos - 2 * ch]); - pattern_offset[ch] = UBYTE(module[0x106 + pat]) + (UBYTE(module[0x206 + pat]) << 8) - addr_to_offset; - blank_rows[ch] = 0; - } - while (--pattern_rows >= 0) { - for (ch = 7; ch >= 0; ch--) { - if (--blank_rows[ch] >= 0) - continue; - for (;;) { - V(int, i) = UBYTE(module[pattern_offset[ch]++]); - if (i == 0) { - pattern_offset[ch]++; - break; - } - if (i < 0x40) { - if (UBYTE(module[pattern_offset[ch]++]) >= 0x80) - pattern_offset[ch]++; - break; - } - if (i < 0x80) { - pattern_offset[ch]++; - break; - } - if (i == 0x80) { - blank_rows[ch] = UBYTE(module[pattern_offset[ch]++]); - break; - } - if (i < 0xc0) - break; - if (i < 0xd0) { - tempo = i - 0xbf; - continue; - } - if (i < 0xe0) { - pattern_offset[ch]++; - break; - } - if (i < 0xf0) { - pattern_offset[ch] += 2; - break; - } - if (i < 0xff) { - blank_rows[ch] = i - 0xf0; - break; - } - blank_rows[ch] = 64; - break; - } - } - player_calls += tempo; - } - pos += 17; - } - set_song_duration(module_info, player_calls); + V(int, addr_to_offset) = UWORD(module, 2) - 6; + V(int, tempo) = UBYTE(module[0x24]) + 1; + V(int, player_calls) = 0; + NEW_ARRAY(int, pattern_offset, 8); + NEW_ARRAY(int, blank_rows, 8); + for (;;) { + V(int, ch); + V(int, pattern_rows) = UBYTE(module[0x386 + 16 + pos]); + if (pattern_rows == 0) + break; + if (pattern_rows >= 0x80) { + module_info _ loops[module_info _ songs] = TRUE; + break; + } + for (ch = 7; ch >= 0; ch--) { + V(int, pat) = UBYTE(module[0x386 + 15 + pos - 2 * ch]); + pattern_offset[ch] = UBYTE(module[0x106 + pat]) + (UBYTE(module[0x206 + pat]) << 8) - addr_to_offset; + blank_rows[ch] = 0; + } + while (--pattern_rows >= 0) { + for (ch = 7; ch >= 0; ch--) { + if (--blank_rows[ch] >= 0) + continue; + for (;;) { + V(int, i) = UBYTE(module[pattern_offset[ch]++]); + if (i == 0) { + pattern_offset[ch]++; + break; + } + if (i < 0x40) { + if (UBYTE(module[pattern_offset[ch]++]) >= 0x80) + pattern_offset[ch]++; + break; + } + if (i < 0x80) { + pattern_offset[ch]++; + break; + } + if (i == 0x80) { + blank_rows[ch] = UBYTE(module[pattern_offset[ch]++]); + break; + } + if (i < 0xc0) + break; + if (i < 0xd0) { + tempo = i - 0xbf; + continue; + } + if (i < 0xe0) { + pattern_offset[ch]++; + break; + } + if (i < 0xf0) { + pattern_offset[ch] += 2; + break; + } + if (i < 0xff) { + blank_rows[ch] = i - 0xf0; + break; + } + blank_rows[ch] = 64; + break; + } + } + player_calls += tempo; + } + pos += 17; + } + set_song_duration(module_info, player_calls); } PRIVATE FUNC(abool, parse_tm2, ( - P(ASAP_State PTR, ast), P(ASAP_ModuleInfo PTR, module_info), - P(CONST BYTEARRAY, module), P(int, module_len))) + P(ASAP_State PTR, ast), P(ASAP_ModuleInfo PTR, module_info), + P(CONST BYTEARRAY, module), P(int, module_len))) { - V(int, i); - V(int, last_pos); - V(int, c); - if (module_len < 0x3a4) - return FALSE; - module_info _ type = ASAP_TYPE_TM2; - if (!load_native(ast, module_info, module, module_len, GET_RESOURCE(tm2, obx))) - return FALSE; - i = module[0x25]; - if (i < 1 || i > 4) - return FALSE; - module_info _ fastplay = perframe2fastplay[i - 1]; - module_info _ player = 0x500; - if (module[0x1f] != 0) - module_info _ channels = 2; - last_pos = 0xffff; - for (i = 0; i < 0x80; i++) { - V(int, instr_addr) = UBYTE(module[0x86 + i]) + (UBYTE(module[0x306 + i]) << 8); - if (instr_addr != 0 && instr_addr < last_pos) - last_pos = instr_addr; - } - for (i = 0; i < 0x100; i++) { - V(int, pattern_addr) = UBYTE(module[0x106 + i]) + (UBYTE(module[0x206 + i]) << 8); - if (pattern_addr != 0 && pattern_addr < last_pos) - last_pos = pattern_addr; - } - last_pos -= UWORD(module, 2) + 0x380; - if (0x386 + last_pos >= module_len) - return FALSE; - /* skip trailing stop/jump commands */ - do { - if (last_pos <= 0) - return FALSE; - last_pos -= 17; - c = UBYTE(module[0x386 + 16 + last_pos]); - } while (c == 0 || c >= 0x80); - module_info _ songs = 0; - parse_tm2_song(module_info, module, 0); - for (i = 0; i < last_pos && module_info _ songs < ASAP_SONGS_MAX; i += 17) { - c = UBYTE(module[0x386 + 16 + i]); - if (c == 0 || c >= 0x80) - parse_tm2_song(module_info, module, i + 17); - } - return TRUE; + V(int, i); + V(int, last_pos); + V(int, c); + if (module_len < 0x3a4) + return FALSE; + module_info _ type = ASAP_TYPE_TM2; + if (!load_native(ast, module_info, module, module_len, GET_RESOURCE(tm2, obx))) + return FALSE; + i = module[0x25]; + if (i < 1 || i > 4) + return FALSE; + module_info _ fastplay = perframe2fastplay[i - 1]; + module_info _ player = 0x500; + if (module[0x1f] != 0) + module_info _ channels = 2; + last_pos = 0xffff; + for (i = 0; i < 0x80; i++) { + V(int, instr_addr) = UBYTE(module[0x86 + i]) + (UBYTE(module[0x306 + i]) << 8); + if (instr_addr != 0 && instr_addr < last_pos) + last_pos = instr_addr; + } + for (i = 0; i < 0x100; i++) { + V(int, pattern_addr) = UBYTE(module[0x106 + i]) + (UBYTE(module[0x206 + i]) << 8); + if (pattern_addr != 0 && pattern_addr < last_pos) + last_pos = pattern_addr; + } + last_pos -= UWORD(module, 2) + 0x380; + if (0x386 + last_pos >= module_len) + return FALSE; + /* skip trailing stop/jump commands */ + do { + if (last_pos <= 0) + return FALSE; + last_pos -= 17; + c = UBYTE(module[0x386 + 16 + last_pos]); + } while (c == 0 || c >= 0x80); + module_info _ songs = 0; + parse_tm2_song(module_info, module, 0); + for (i = 0; i < last_pos && module_info _ songs < ASAP_SONGS_MAX; i += 17) { + c = UBYTE(module[0x386 + 16 + i]); + if (c == 0 || c >= 0x80) + parse_tm2_song(module_info, module, i + 17); + } + return TRUE; } #endif /* ASAP_ONLY_SAP */ PRIVATE FUNC(abool, has_string_at, (P(CONST BYTEARRAY, module), P(int, module_index), P(STRING, s))) { - V(int, i); - V(int, n) = strlen(s); - for (i = 0; i < n; i++) - if (module[module_index + i] != CHARCODEAT(s, i)) - return FALSE; - return TRUE; + V(int, i); + V(int, n) = strlen(s); + for (i = 0; i < n; i++) + if (module[module_index + i] != CHARCODEAT(s, i)) + return FALSE; + return TRUE; } PRIVATE FUNC(STRING, parse_text, (P(OUT_STRING, dest), P(CONST BYTEARRAY, module), P(int, module_index))) { - V(int, i); - if (module[module_index] != CHARCODE('"')) - return NULL; - if (has_string_at(module, module_index + 1, "\"")) - return dest; - for (i = 0; ; i++) { - V(int, c) = module[module_index + 1 + i]; - if (c == CHARCODE('"')) - break; - if (c < 32 || c >= 127) - return NULL; - } - BYTES_TO_STRING(dest, module, module_index + 1, i); - return dest; + V(int, i); + if (module[module_index] != CHARCODE('"')) + return NULL; + if (has_string_at(module, module_index + 1, "\"")) + return dest; + for (i = 0; ; i++) { + V(int, c) = module[module_index + 1 + i]; + if (c == CHARCODE('"')) + break; + if (c < 32 || c >= 127) + return NULL; + } + BYTES_TO_STRING(dest, module, module_index + 1, i); + return dest; } PRIVATE FUNC(int, parse_dec, (P(CONST BYTEARRAY, module), P(int, module_index), P(int, maxval))) { - V(int, r); - if (module[module_index] == 0xd) - return -1; - for (r = 0;;) { - V(int, c) = module[module_index++]; - if (c == 0xd) - break; - if (c < CHARCODE('0') || c > CHARCODE('9')) - return -1; - r = 10 * r + c - 48; - if (r > maxval) - return -1; - } - return r; + V(int, r); + if (module[module_index] == 0xd) + return -1; + for (r = 0;;) { + V(int, c) = module[module_index++]; + if (c == 0xd) + break; + if (c < CHARCODE('0') || c > CHARCODE('9')) + return -1; + r = 10 * r + c - 48; + if (r > maxval) + return -1; + } + return r; } PRIVATE FUNC(int, parse_hex, (P(CONST BYTEARRAY, module), P(int, module_index))) { - V(int, r); - if (module[module_index] == 0xd) - return -1; - for (r = 0;;) { - V(int, c) = module[module_index++]; - if (c == 0xd) - break; - if (r > 0xfff) - return -1; - r <<= 4; - if (c >= CHARCODE('0') && c <= CHARCODE('9')) - r += c - CHARCODE('0'); - else if (c >= CHARCODE('A') && c <= CHARCODE('F')) - r += c - CHARCODE('A') + 10; - else if (c >= CHARCODE('a') && c <= CHARCODE('f')) - r += c - CHARCODE('a') + 10; - else - return -1; - } - return r; + V(int, r); + if (module[module_index] == 0xd) + return -1; + for (r = 0;;) { + V(int, c) = module[module_index++]; + if (c == 0xd) + break; + if (r > 0xfff) + return -1; + r <<= 4; + if (c >= CHARCODE('0') && c <= CHARCODE('9')) + r += c - CHARCODE('0'); + else if (c >= CHARCODE('A') && c <= CHARCODE('F')) + r += c - CHARCODE('A') + 10; + else if (c >= CHARCODE('a') && c <= CHARCODE('f')) + r += c - CHARCODE('a') + 10; + else + return -1; + } + return r; } FUNC(int, ASAP_ParseDuration, (P(STRING, s))) { - V(int, i) = 0; - V(int, r); - V(int, d); - V(int, n) = strlen(s); + V(int, i) = 0; + V(int, r); + V(int, d); + V(int, n) = strlen(s); #define PARSE_DIGIT(maxdig, retifnot) \ - if (i >= n) \ - return retifnot; \ - d = CHARCODEAT(s, i) - 48; \ - if (d < 0 || d > maxdig) \ - return -1; \ - i++; - - PARSE_DIGIT(9, -1); - r = d; - if (i < n) { - d = CHARCODEAT(s, i) - 48; - if (d >= 0 && d <= 9) { - i++; - r = 10 * r + d; - } - if (i < n && CHARAT(s, i) == ':') { - i++; - PARSE_DIGIT(5, -1); - r = (6 * r + d) * 10; - PARSE_DIGIT(9, -1); - r += d; - } - } - r *= 1000; - if (i >= n) - return r; - if (CHARAT(s, i) != '.') - return -1; - i++; - PARSE_DIGIT(9, -1); - r += 100 * d; - PARSE_DIGIT(9, r); - r += 10 * d; - PARSE_DIGIT(9, r); - r += d; - return r; + if (i >= n) \ + return retifnot; \ + d = CHARCODEAT(s, i) - 48; \ + if (d < 0 || d > maxdig) \ + return -1; \ + i++; + + PARSE_DIGIT(9, -1); + r = d; + if (i < n) { + d = CHARCODEAT(s, i) - 48; + if (d >= 0 && d <= 9) { + i++; + r = 10 * r + d; + } + if (i < n && CHARAT(s, i) == ':') { + i++; + PARSE_DIGIT(5, -1); + r = (6 * r + d) * 10; + PARSE_DIGIT(9, -1); + r += d; + } + } + r *= 1000; + if (i >= n) + return r; + if (CHARAT(s, i) != '.') + return -1; + i++; + PARSE_DIGIT(9, -1); + r += 100 * d; + PARSE_DIGIT(9, r); + r += 10 * d; + PARSE_DIGIT(9, r); + r += d; + return r; } PRIVATE FUNC(abool, parse_sap_header, ( - P(ASAP_ModuleInfo PTR, module_info), P(CONST BYTEARRAY, module), P(int, module_len))) + P(ASAP_ModuleInfo PTR, module_info), P(CONST BYTEARRAY, module), P(int, module_len))) { - V(int, module_index); - V(int, type) = 0; - V(int, duration_index) = 0; - if (!has_string_at(module, 0, "SAP\r\n")) - return FALSE; - module_index = 5; - while (UBYTE(module[module_index]) != 0xff) { - if (module_index + 8 >= module_len) - return FALSE; + V(int, module_index); + V(int, type) = 0; + V(int, duration_index) = 0; + if (!has_string_at(module, 0, "SAP\r\n")) + return FALSE; + module_index = 5; + while (UBYTE(module[module_index]) != 0xff) { + if (module_index + 8 >= module_len) + return FALSE; #define TAG_IS(s) has_string_at(module, module_index, s) #ifdef C #define SET_TEXT(v, i) if (parse_text(v, module, module_index + i) == NULL) return FALSE @@ -1076,287 +1076,287 @@ PRIVATE FUNC(abool, parse_sap_header, ( #endif #define SET_DEC(v, i, min, max) v = parse_dec(module, module_index + i, max); if (v < min) return FALSE #define SET_HEX(v, i) v = parse_hex(module, module_index + i) - if (TAG_IS("AUTHOR ")) { - SET_TEXT(module_info _ author, 7); - } - else if (TAG_IS("NAME ")) { - SET_TEXT(module_info _ name, 5); - } - else if (TAG_IS("DATE ")) { - SET_TEXT(module_info _ date, 5); - } - else if (TAG_IS("SONGS ")) { - SET_DEC(module_info _ songs, 6, 1, ASAP_SONGS_MAX); - } - else if (TAG_IS("DEFSONG ")) { - SET_DEC(module_info _ default_song, 8, 0, ASAP_SONGS_MAX - 1); - } - else if (TAG_IS("STEREO\r")) - module_info _ channels = 2; - else if (TAG_IS("TIME ")) { - V(int, i); + if (TAG_IS("AUTHOR ")) { + SET_TEXT(module_info _ author, 7); + } + else if (TAG_IS("NAME ")) { + SET_TEXT(module_info _ name, 5); + } + else if (TAG_IS("DATE ")) { + SET_TEXT(module_info _ date, 5); + } + else if (TAG_IS("SONGS ")) { + SET_DEC(module_info _ songs, 6, 1, ASAP_SONGS_MAX); + } + else if (TAG_IS("DEFSONG ")) { + SET_DEC(module_info _ default_song, 8, 0, ASAP_SONGS_MAX - 1); + } + else if (TAG_IS("STEREO\r")) + module_info _ channels = 2; + else if (TAG_IS("TIME ")) { + V(int, i); #ifdef C - char s[ASAP_DURATION_CHARS]; + char s[ASAP_DURATION_CHARS]; #else - V(STRING, s); + V(STRING, s); #endif - module_index += 5; - for (i = 0; module[module_index + i] != 0xd; i++); - if (i > 5 && has_string_at(module, module_index + i - 5, " LOOP")) { - module_info _ loops[duration_index] = TRUE; - i -= 5; - } + module_index += 5; + for (i = 0; module[module_index + i] != 0xd; i++); + if (i > 5 && has_string_at(module, module_index + i - 5, " LOOP")) { + module_info _ loops[duration_index] = TRUE; + i -= 5; + } #ifdef C - if (i >= ASAP_DURATION_CHARS) - return FALSE; + if (i >= ASAP_DURATION_CHARS) + return FALSE; #endif - BYTES_TO_STRING(s, module, module_index, i); - i = ASAP_ParseDuration(s); - if (i < 0 || duration_index >= ASAP_SONGS_MAX) - return FALSE; - module_info _ durations[duration_index++] = i; - } - else if (TAG_IS("TYPE ")) - type = module[module_index + 5]; - else if (TAG_IS("FASTPLAY ")) { - SET_DEC(module_info _ fastplay, 9, 1, 312); - } - else if (TAG_IS("MUSIC ")) { - SET_HEX(module_info _ music, 6); - } - else if (TAG_IS("INIT ")) { - SET_HEX(module_info _ init, 5); - } - else if (TAG_IS("PLAYER ")) { - SET_HEX(module_info _ player, 7); - } - else if (TAG_IS("COVOX ")) { - SET_HEX(module_info _ covox_addr, 6); - if (module_info _ covox_addr != 0xd600) - return FALSE; - module_info _ channels = 2; - } - - while (module[module_index++] != 0x0d) { - if (module_index >= module_len) - return FALSE; - } - if (module[module_index++] != 0x0a) - return FALSE; - } - if (module_info _ default_song >= module_info _ songs) - return FALSE; - switch (type) { - case CHARCODE('B'): - if (module_info _ player < 0 || module_info _ init < 0) - return FALSE; - module_info _ type = ASAP_TYPE_SAP_B; - break; - case CHARCODE('C'): - if (module_info _ player < 0 || module_info _ music < 0) - return FALSE; - module_info _ type = ASAP_TYPE_SAP_C; - break; - case CHARCODE('D'): - if (module_info _ init < 0) - return FALSE; - module_info _ type = ASAP_TYPE_SAP_D; - break; - case CHARCODE('S'): - if (module_info _ init < 0) - return FALSE; - module_info _ type = ASAP_TYPE_SAP_S; - module_info _ fastplay = 78; - break; - default: - return FALSE; - } - if (UBYTE(module[module_index + 1]) != 0xff) - return FALSE; - module_info _ header_len = module_index; - return TRUE; + BYTES_TO_STRING(s, module, module_index, i); + i = ASAP_ParseDuration(s); + if (i < 0 || duration_index >= ASAP_SONGS_MAX) + return FALSE; + module_info _ durations[duration_index++] = i; + } + else if (TAG_IS("TYPE ")) + type = module[module_index + 5]; + else if (TAG_IS("FASTPLAY ")) { + SET_DEC(module_info _ fastplay, 9, 1, 312); + } + else if (TAG_IS("MUSIC ")) { + SET_HEX(module_info _ music, 6); + } + else if (TAG_IS("INIT ")) { + SET_HEX(module_info _ init, 5); + } + else if (TAG_IS("PLAYER ")) { + SET_HEX(module_info _ player, 7); + } + else if (TAG_IS("COVOX ")) { + SET_HEX(module_info _ covox_addr, 6); + if (module_info _ covox_addr != 0xd600) + return FALSE; + module_info _ channels = 2; + } + + while (module[module_index++] != 0x0d) { + if (module_index >= module_len) + return FALSE; + } + if (module[module_index++] != 0x0a) + return FALSE; + } + if (module_info _ default_song >= module_info _ songs) + return FALSE; + switch (type) { + case CHARCODE('B'): + if (module_info _ player < 0 || module_info _ init < 0) + return FALSE; + module_info _ type = ASAP_TYPE_SAP_B; + break; + case CHARCODE('C'): + if (module_info _ player < 0 || module_info _ music < 0) + return FALSE; + module_info _ type = ASAP_TYPE_SAP_C; + break; + case CHARCODE('D'): + if (module_info _ init < 0) + return FALSE; + module_info _ type = ASAP_TYPE_SAP_D; + break; + case CHARCODE('S'): + if (module_info _ init < 0) + return FALSE; + module_info _ type = ASAP_TYPE_SAP_S; + module_info _ fastplay = 78; + break; + default: + return FALSE; + } + if (UBYTE(module[module_index + 1]) != 0xff) + return FALSE; + module_info _ header_len = module_index; + return TRUE; } PRIVATE FUNC(abool, parse_sap, ( - P(ASAP_State PTR, ast), P(ASAP_ModuleInfo PTR, module_info), - P(CONST BYTEARRAY, module), P(int, module_len))) + P(ASAP_State PTR, ast), P(ASAP_ModuleInfo PTR, module_info), + P(CONST BYTEARRAY, module), P(int, module_len))) { - V(int, module_index); - if (!parse_sap_header(module_info, module, module_len)) - return FALSE; - if (ast == NULL) - return TRUE; - ZERO_ARRAY(ast _ memory); - module_index = module_info _ header_len + 2; - while (module_index + 5 <= module_len) { - V(int, start_addr) = UWORD(module, module_index); - V(int, block_len) = UWORD(module, module_index + 2) + 1 - start_addr; - if (block_len <= 0 || module_index + block_len > module_len) - return FALSE; - module_index += 4; - COPY_ARRAY(ast _ memory, start_addr, module, module_index, block_len); - module_index += block_len; - if (module_index == module_len) - return TRUE; - if (module_index + 7 <= module_len - && UBYTE(module[module_index]) == 0xff && UBYTE(module[module_index + 1]) == 0xff) - module_index += 2; - } - return FALSE; + V(int, module_index); + if (!parse_sap_header(module_info, module, module_len)) + return FALSE; + if (ast == NULL) + return TRUE; + ZERO_ARRAY(ast _ memory); + module_index = module_info _ header_len + 2; + while (module_index + 5 <= module_len) { + V(int, start_addr) = UWORD(module, module_index); + V(int, block_len) = UWORD(module, module_index + 2) + 1 - start_addr; + if (block_len <= 0 || module_index + block_len > module_len) + return FALSE; + module_index += 4; + COPY_ARRAY(ast _ memory, start_addr, module, module_index, block_len); + module_index += block_len; + if (module_index == module_len) + return TRUE; + if (module_index + 7 <= module_len + && UBYTE(module[module_index]) == 0xff && UBYTE(module[module_index + 1]) == 0xff) + module_index += 2; + } + return FALSE; } #define ASAP_EXT(c1, c2, c3) ((CHARCODE(c1) + (CHARCODE(c2) << 8) + (CHARCODE(c3) << 16)) | 0x202020) PRIVATE FUNC(int, get_packed_ext, (P(STRING, filename))) { - V(int, i) = strlen(filename); - V(int, ext) = 0; - while (--i > 0) { - V(char, c) = CHARAT(filename, i); - if (c <= ' ' || c > 'z') - return 0; - if (c == '.') - return ext | 0x202020; - ext = (ext << 8) + CHARCODE(c); - } - return 0; + V(int, i) = strlen(filename); + V(int, ext) = 0; + while (--i > 0) { + V(char, c) = CHARAT(filename, i); + if (c <= ' ' || c > 'z') + return 0; + if (c == '.') + return ext | 0x202020; + ext = (ext << 8) + CHARCODE(c); + } + return 0; } PRIVATE FUNC(abool, is_our_ext, (P(int, ext))) { - switch (ext) { - case ASAP_EXT('S', 'A', 'P'): + switch (ext) { + case ASAP_EXT('S', 'A', 'P'): #ifndef ASAP_ONLY_SAP - case ASAP_EXT('C', 'M', 'C'): - case ASAP_EXT('C', 'M', '3'): - case ASAP_EXT('C', 'M', 'R'): - case ASAP_EXT('C', 'M', 'S'): - case ASAP_EXT('D', 'M', 'C'): - case ASAP_EXT('D', 'L', 'T'): - case ASAP_EXT('M', 'P', 'T'): - case ASAP_EXT('M', 'P', 'D'): - case ASAP_EXT('R', 'M', 'T'): - case ASAP_EXT('T', 'M', 'C'): - case ASAP_EXT('T', 'M', '8'): - case ASAP_EXT('T', 'M', '2'): + case ASAP_EXT('C', 'M', 'C'): + case ASAP_EXT('C', 'M', '3'): + case ASAP_EXT('C', 'M', 'R'): + case ASAP_EXT('C', 'M', 'S'): + case ASAP_EXT('D', 'M', 'C'): + case ASAP_EXT('D', 'L', 'T'): + case ASAP_EXT('M', 'P', 'T'): + case ASAP_EXT('M', 'P', 'D'): + case ASAP_EXT('R', 'M', 'T'): + case ASAP_EXT('T', 'M', 'C'): + case ASAP_EXT('T', 'M', '8'): + case ASAP_EXT('T', 'M', '2'): #endif - return TRUE; - default: - return FALSE; - } + return TRUE; + default: + return FALSE; + } } FUNC(abool, ASAP_IsOurFile, (P(STRING, filename))) { - V(int, ext) = get_packed_ext(filename); - return is_our_ext(ext); + V(int, ext) = get_packed_ext(filename); + return is_our_ext(ext); } FUNC(abool, ASAP_IsOurExt, (P(STRING, ext))) { - return strlen(ext) == 3 - && is_our_ext(ASAP_EXT(CHARAT(ext, 0), CHARAT(ext, 1), CHARAT(ext, 2))); + return strlen(ext) == 3 + && is_our_ext(ASAP_EXT(CHARAT(ext, 0), CHARAT(ext, 1), CHARAT(ext, 2))); } PRIVATE FUNC(abool, parse_file, ( - P(ASAP_State PTR, ast), P(ASAP_ModuleInfo PTR, module_info), - P(STRING, filename), P(CONST BYTEARRAY, module), P(int, module_len))) + P(ASAP_State PTR, ast), P(ASAP_ModuleInfo PTR, module_info), + P(STRING, filename), P(CONST BYTEARRAY, module), P(int, module_len))) { - V(int, i); - V(int, len) = strlen(filename); - V(int, basename) = 0; - V(int, ext) = -1; - for (i = 0; i < len; i++) { - V(char, c) = CHARAT(filename, i); - if (c == '/' || c == '\\') { - basename = i + 1; - ext = -1; - } - else if (c == '.') - ext = i; - } - if (ext < 0) - return FALSE; - EMPTY_STRING(module_info _ author); - SUBSTRING(module_info _ name, filename, basename, ext - basename); - EMPTY_STRING(module_info _ date); - module_info _ channels = 1; - module_info _ songs = 1; - module_info _ default_song = 0; - for (i = 0; i < ASAP_SONGS_MAX; i++) { - module_info _ durations[i] = -1; - module_info _ loops[i] = FALSE; - } - module_info _ fastplay = 312; - module_info _ music = -1; - module_info _ init = -1; - module_info _ player = -1; - module_info _ covox_addr = -1; - switch (get_packed_ext(filename)) { - case ASAP_EXT('S', 'A', 'P'): - return parse_sap(ast, module_info, module, module_len); + V(int, i); + V(int, len) = strlen(filename); + V(int, basename) = 0; + V(int, ext) = -1; + for (i = 0; i < len; i++) { + V(char, c) = CHARAT(filename, i); + if (c == '/' || c == '\\') { + basename = i + 1; + ext = -1; + } + else if (c == '.') + ext = i; + } + if (ext < 0) + return FALSE; + EMPTY_STRING(module_info _ author); + SUBSTRING(module_info _ name, filename, basename, ext - basename); + EMPTY_STRING(module_info _ date); + module_info _ channels = 1; + module_info _ songs = 1; + module_info _ default_song = 0; + for (i = 0; i < ASAP_SONGS_MAX; i++) { + module_info _ durations[i] = -1; + module_info _ loops[i] = FALSE; + } + module_info _ fastplay = 312; + module_info _ music = -1; + module_info _ init = -1; + module_info _ player = -1; + module_info _ covox_addr = -1; + switch (get_packed_ext(filename)) { + case ASAP_EXT('S', 'A', 'P'): + return parse_sap(ast, module_info, module, module_len); #ifndef ASAP_ONLY_SAP - case ASAP_EXT('C', 'M', 'C'): - return parse_cmc(ast, module_info, module, module_len, ASAP_TYPE_CMC, GET_RESOURCE(cmc, obx)); - case ASAP_EXT('C', 'M', '3'): - return parse_cmc(ast, module_info, module, module_len, ASAP_TYPE_CM3, GET_RESOURCE(cm3, obx)); - case ASAP_EXT('C', 'M', 'R'): - return parse_cmc(ast, module_info, module, module_len, ASAP_TYPE_CMR, GET_RESOURCE(cmc, obx)); - case ASAP_EXT('C', 'M', 'S'): - module_info _ channels = 2; - return parse_cmc(ast, module_info, module, module_len, ASAP_TYPE_CMS, GET_RESOURCE(cms, obx)); - case ASAP_EXT('D', 'M', 'C'): - module_info _ fastplay = 156; - return parse_cmc(ast, module_info, module, module_len, ASAP_TYPE_CMC, GET_RESOURCE(cmc, obx)); - case ASAP_EXT('D', 'L', 'T'): - return parse_dlt(ast, module_info, module, module_len); - case ASAP_EXT('M', 'P', 'T'): - return parse_mpt(ast, module_info, module, module_len); - case ASAP_EXT('M', 'P', 'D'): - module_info _ fastplay = 156; - return parse_mpt(ast, module_info, module, module_len); - case ASAP_EXT('R', 'M', 'T'): - return parse_rmt(ast, module_info, module, module_len); - case ASAP_EXT('T', 'M', 'C'): - case ASAP_EXT('T', 'M', '8'): - return parse_tmc(ast, module_info, module, module_len); - case ASAP_EXT('T', 'M', '2'): - return parse_tm2(ast, module_info, module, module_len); + case ASAP_EXT('C', 'M', 'C'): + return parse_cmc(ast, module_info, module, module_len, ASAP_TYPE_CMC, GET_RESOURCE(cmc, obx)); + case ASAP_EXT('C', 'M', '3'): + return parse_cmc(ast, module_info, module, module_len, ASAP_TYPE_CM3, GET_RESOURCE(cm3, obx)); + case ASAP_EXT('C', 'M', 'R'): + return parse_cmc(ast, module_info, module, module_len, ASAP_TYPE_CMR, GET_RESOURCE(cmc, obx)); + case ASAP_EXT('C', 'M', 'S'): + module_info _ channels = 2; + return parse_cmc(ast, module_info, module, module_len, ASAP_TYPE_CMS, GET_RESOURCE(cms, obx)); + case ASAP_EXT('D', 'M', 'C'): + module_info _ fastplay = 156; + return parse_cmc(ast, module_info, module, module_len, ASAP_TYPE_CMC, GET_RESOURCE(cmc, obx)); + case ASAP_EXT('D', 'L', 'T'): + return parse_dlt(ast, module_info, module, module_len); + case ASAP_EXT('M', 'P', 'T'): + return parse_mpt(ast, module_info, module, module_len); + case ASAP_EXT('M', 'P', 'D'): + module_info _ fastplay = 156; + return parse_mpt(ast, module_info, module, module_len); + case ASAP_EXT('R', 'M', 'T'): + return parse_rmt(ast, module_info, module, module_len); + case ASAP_EXT('T', 'M', 'C'): + case ASAP_EXT('T', 'M', '8'): + return parse_tmc(ast, module_info, module, module_len); + case ASAP_EXT('T', 'M', '2'): + return parse_tm2(ast, module_info, module, module_len); #endif - default: - return FALSE; - } + default: + return FALSE; + } } FUNC(abool, ASAP_GetModuleInfo, ( - P(ASAP_ModuleInfo PTR, module_info), P(STRING, filename), - P(CONST BYTEARRAY, module), P(int, module_len))) + P(ASAP_ModuleInfo PTR, module_info), P(STRING, filename), + P(CONST BYTEARRAY, module), P(int, module_len))) { - return parse_file(NULL, module_info, filename, module, module_len); + return parse_file(NULL, module_info, filename, module, module_len); } FUNC(abool, ASAP_Load, ( - P(ASAP_State PTR, ast), P(STRING, filename), - P(CONST BYTEARRAY, module), P(int, module_len))) + P(ASAP_State PTR, ast), P(STRING, filename), + P(CONST BYTEARRAY, module), P(int, module_len))) { - ast _ silence_cycles = 0; - return parse_file(ast, ADDRESSOF ast _ module_info, filename, module, module_len); + ast _ silence_cycles = 0; + return parse_file(ast, ADDRESSOF ast _ module_info, filename, module, module_len); } FUNC(void, ASAP_DetectSilence, (P(ASAP_State PTR, ast), P(int, seconds))) { - ast _ silence_cycles = seconds * ASAP_MAIN_CLOCK; + ast _ silence_cycles = seconds * ASAP_MAIN_CLOCK; } PRIVATE FUNC(void, call_6502, (P(ASAP_State PTR, ast), P(int, addr), P(int, max_scanlines))) { - ast _ cpu_pc = addr; - /* put a CIM at 0xd20a and a return address on stack */ - dPutByte(0xd20a, 0xd2); - dPutByte(0x01fe, 0x09); - dPutByte(0x01ff, 0xd2); - ast _ cpu_s = 0xfd; - Cpu_RunScanlines(ast, max_scanlines); + ast _ cpu_pc = addr; + /* put a CIM at 0xd20a and a return address on stack */ + dPutByte(0xd20a, 0xd2); + dPutByte(0x01fe, 0x09); + dPutByte(0x01ff, 0xd2); + ast _ cpu_s = 0xfd; + Cpu_RunScanlines(ast, max_scanlines); } /* 50 Atari frames for the initialization routine - some SAPs are self-extracting. */ @@ -1364,843 +1364,843 @@ PRIVATE FUNC(void, call_6502, (P(ASAP_State PTR, ast), P(int, addr), P(int, max_ PRIVATE FUNC(void, call_6502_init, (P(ASAP_State PTR, ast), P(int, addr), P(int, a), P(int, x), P(int, y))) { - ast _ cpu_a = a & 0xff; - ast _ cpu_x = x & 0xff; - ast _ cpu_y = y & 0xff; - call_6502(ast, addr, SCANLINES_FOR_INIT); + ast _ cpu_a = a & 0xff; + ast _ cpu_x = x & 0xff; + ast _ cpu_y = y & 0xff; + call_6502(ast, addr, SCANLINES_FOR_INIT); } FUNC(void, ASAP_PlaySong, (P(ASAP_State PTR, ast), P(int, song), P(int, duration))) { - ast _ current_song = song; - ast _ current_duration = duration; - ast _ blocks_played = 0; - ast _ silence_cycles_counter = ast _ silence_cycles; - ast _ extra_pokey_mask = ast _ module_info.channels > 1 ? 0x10 : 0; - ast _ consol = 8; - ast _ covox[0] = CAST(byte) 0x80; - ast _ covox[1] = CAST(byte) 0x80; - ast _ covox[2] = CAST(byte) 0x80; - ast _ covox[3] = CAST(byte) 0x80; - PokeySound_Initialize(ast); - ast _ cycle = 0; - ast _ cpu_nz = 0; - ast _ cpu_c = 0; - ast _ cpu_vdi = 0; - ast _ scanline_number = 0; - ast _ next_scanline_cycle = 0; - ast _ timer1_cycle = NEVER; - ast _ timer2_cycle = NEVER; - ast _ timer4_cycle = NEVER; - ast _ irqst = 0xff; - switch (ast _ module_info.type) { - case ASAP_TYPE_SAP_B: - call_6502_init(ast, ast _ module_info.init, song, 0, 0); - break; - case ASAP_TYPE_SAP_C: + ast _ current_song = song; + ast _ current_duration = duration; + ast _ blocks_played = 0; + ast _ silence_cycles_counter = ast _ silence_cycles; + ast _ extra_pokey_mask = ast _ module_info.channels > 1 ? 0x10 : 0; + ast _ consol = 8; + ast _ covox[0] = CAST(byte) 0x80; + ast _ covox[1] = CAST(byte) 0x80; + ast _ covox[2] = CAST(byte) 0x80; + ast _ covox[3] = CAST(byte) 0x80; + PokeySound_Initialize(ast); + ast _ cycle = 0; + ast _ cpu_nz = 0; + ast _ cpu_c = 0; + ast _ cpu_vdi = 0; + ast _ scanline_number = 0; + ast _ next_scanline_cycle = 0; + ast _ timer1_cycle = NEVER; + ast _ timer2_cycle = NEVER; + ast _ timer4_cycle = NEVER; + ast _ irqst = 0xff; + switch (ast _ module_info.type) { + case ASAP_TYPE_SAP_B: + call_6502_init(ast, ast _ module_info.init, song, 0, 0); + break; + case ASAP_TYPE_SAP_C: #ifndef ASAP_ONLY_SAP - case ASAP_TYPE_CMC: - case ASAP_TYPE_CM3: - case ASAP_TYPE_CMR: - case ASAP_TYPE_CMS: + case ASAP_TYPE_CMC: + case ASAP_TYPE_CM3: + case ASAP_TYPE_CMR: + case ASAP_TYPE_CMS: #endif - call_6502_init(ast, ast _ module_info.player + 3, 0x70, ast _ module_info.music, ast _ module_info.music >> 8); - call_6502_init(ast, ast _ module_info.player + 3, 0x00, song, 0); - break; - case ASAP_TYPE_SAP_D: - case ASAP_TYPE_SAP_S: - ast _ cpu_a = song; - ast _ cpu_x = 0x00; - ast _ cpu_y = 0x00; - ast _ cpu_s = 0xff; - ast _ cpu_pc = ast _ module_info.init; - break; + call_6502_init(ast, ast _ module_info.player + 3, 0x70, ast _ module_info.music, ast _ module_info.music >> 8); + call_6502_init(ast, ast _ module_info.player + 3, 0x00, song, 0); + break; + case ASAP_TYPE_SAP_D: + case ASAP_TYPE_SAP_S: + ast _ cpu_a = song; + ast _ cpu_x = 0x00; + ast _ cpu_y = 0x00; + ast _ cpu_s = 0xff; + ast _ cpu_pc = ast _ module_info.init; + break; #ifndef ASAP_ONLY_SAP - case ASAP_TYPE_DLT: - call_6502_init(ast, ast _ module_info.player + 0x100, 0x00, 0x00, ast _ module_info.song_pos[song]); - break; - case ASAP_TYPE_MPT: - call_6502_init(ast, ast _ module_info.player, 0x00, ast _ module_info.music >> 8, ast _ module_info.music); - call_6502_init(ast, ast _ module_info.player, 0x02, ast _ module_info.song_pos[song], 0); - break; - case ASAP_TYPE_RMT: - call_6502_init(ast, ast _ module_info.player, ast _ module_info.song_pos[song], ast _ module_info.music, ast _ module_info.music >> 8); - break; - case ASAP_TYPE_TMC: - case ASAP_TYPE_TM2: - call_6502_init(ast, ast _ module_info.player, 0x70, ast _ module_info.music >> 8, ast _ module_info.music); - call_6502_init(ast, ast _ module_info.player, 0x00, song, 0); - ast _ tmc_per_frame_counter = 1; - break; + case ASAP_TYPE_DLT: + call_6502_init(ast, ast _ module_info.player + 0x100, 0x00, 0x00, ast _ module_info.song_pos[song]); + break; + case ASAP_TYPE_MPT: + call_6502_init(ast, ast _ module_info.player, 0x00, ast _ module_info.music >> 8, ast _ module_info.music); + call_6502_init(ast, ast _ module_info.player, 0x02, ast _ module_info.song_pos[song], 0); + break; + case ASAP_TYPE_RMT: + call_6502_init(ast, ast _ module_info.player, ast _ module_info.song_pos[song], ast _ module_info.music, ast _ module_info.music >> 8); + break; + case ASAP_TYPE_TMC: + case ASAP_TYPE_TM2: + call_6502_init(ast, ast _ module_info.player, 0x70, ast _ module_info.music >> 8, ast _ module_info.music); + call_6502_init(ast, ast _ module_info.player, 0x00, song, 0); + ast _ tmc_per_frame_counter = 1; + break; #endif - } - ASAP_MutePokeyChannels(ast, 0); + } + ASAP_MutePokeyChannels(ast, 0); } FUNC(void, ASAP_MutePokeyChannels, (P(ASAP_State PTR, ast), P(int, mask))) { - PokeySound_Mute(ast, ADDRESSOF ast _ base_pokey, mask); - PokeySound_Mute(ast, ADDRESSOF ast _ extra_pokey, mask >> 4); + PokeySound_Mute(ast, ADDRESSOF ast _ base_pokey, mask); + PokeySound_Mute(ast, ADDRESSOF ast _ extra_pokey, mask >> 4); } FUNC(abool, call_6502_player, (P(ASAP_State PTR, ast))) { - V(int, player) = ast _ module_info.player; - PokeySound_StartFrame(ast); - switch (ast _ module_info.type) { - case ASAP_TYPE_SAP_B: - call_6502(ast, player, ast _ module_info.fastplay); - break; - case ASAP_TYPE_SAP_C: + V(int, player) = ast _ module_info.player; + PokeySound_StartFrame(ast); + switch (ast _ module_info.type) { + case ASAP_TYPE_SAP_B: + call_6502(ast, player, ast _ module_info.fastplay); + break; + case ASAP_TYPE_SAP_C: #ifndef ASAP_ONLY_SAP - case ASAP_TYPE_CMC: - case ASAP_TYPE_CM3: - case ASAP_TYPE_CMR: - case ASAP_TYPE_CMS: + case ASAP_TYPE_CMC: + case ASAP_TYPE_CM3: + case ASAP_TYPE_CMR: + case ASAP_TYPE_CMS: #endif - call_6502(ast, player + 6, ast _ module_info.fastplay); - break; - case ASAP_TYPE_SAP_D: - if (player >= 0) { - V(int, s)= ast _ cpu_s; + call_6502(ast, player + 6, ast _ module_info.fastplay); + break; + case ASAP_TYPE_SAP_D: + if (player >= 0) { + V(int, s)= ast _ cpu_s; #define PUSH_ON_6502_STACK(x) dPutByte(0x100 + s, x); s = (s - 1) & 0xff #define RETURN_FROM_PLAYER_ADDR 0xd200 - /* save 6502 state on 6502 stack */ - PUSH_ON_6502_STACK(ast _ cpu_pc >> 8); - PUSH_ON_6502_STACK(ast _ cpu_pc & 0xff); - PUSH_ON_6502_STACK(((ast _ cpu_nz | (ast _ cpu_nz >> 1)) & 0x80) + ast _ cpu_vdi + \ - ((ast _ cpu_nz & 0xff) == 0 ? Z_FLAG : 0) + ast _ cpu_c + 0x20); - PUSH_ON_6502_STACK(ast _ cpu_a); - PUSH_ON_6502_STACK(ast _ cpu_x); - PUSH_ON_6502_STACK(ast _ cpu_y); - /* RTS will jump to 6502 code that restores the state */ - PUSH_ON_6502_STACK((RETURN_FROM_PLAYER_ADDR - 1) >> 8); - PUSH_ON_6502_STACK((RETURN_FROM_PLAYER_ADDR - 1) & 0xff); - ast _ cpu_s = s; - dPutByte(RETURN_FROM_PLAYER_ADDR, 0x68); /* PLA */ - dPutByte(RETURN_FROM_PLAYER_ADDR + 1, 0xa8); /* TAY */ - dPutByte(RETURN_FROM_PLAYER_ADDR + 2, 0x68); /* PLA */ - dPutByte(RETURN_FROM_PLAYER_ADDR + 3, 0xaa); /* TAX */ - dPutByte(RETURN_FROM_PLAYER_ADDR + 4, 0x68); /* PLA */ - dPutByte(RETURN_FROM_PLAYER_ADDR + 5, 0x40); /* RTI */ - ast _ cpu_pc = player; - } - Cpu_RunScanlines(ast, ast _ module_info.fastplay); - break; - case ASAP_TYPE_SAP_S: - Cpu_RunScanlines(ast, ast _ module_info.fastplay); - { - V(int, i) = dGetByte(0x45) - 1; - dPutByte(0x45, i); - if (i == 0) - dPutByte(0xb07b, dGetByte(0xb07b) + 1); - } - break; + /* save 6502 state on 6502 stack */ + PUSH_ON_6502_STACK(ast _ cpu_pc >> 8); + PUSH_ON_6502_STACK(ast _ cpu_pc & 0xff); + PUSH_ON_6502_STACK(((ast _ cpu_nz | (ast _ cpu_nz >> 1)) & 0x80) + ast _ cpu_vdi + \ + ((ast _ cpu_nz & 0xff) == 0 ? Z_FLAG : 0) + ast _ cpu_c + 0x20); + PUSH_ON_6502_STACK(ast _ cpu_a); + PUSH_ON_6502_STACK(ast _ cpu_x); + PUSH_ON_6502_STACK(ast _ cpu_y); + /* RTS will jump to 6502 code that restores the state */ + PUSH_ON_6502_STACK((RETURN_FROM_PLAYER_ADDR - 1) >> 8); + PUSH_ON_6502_STACK((RETURN_FROM_PLAYER_ADDR - 1) & 0xff); + ast _ cpu_s = s; + dPutByte(RETURN_FROM_PLAYER_ADDR, 0x68); /* PLA */ + dPutByte(RETURN_FROM_PLAYER_ADDR + 1, 0xa8); /* TAY */ + dPutByte(RETURN_FROM_PLAYER_ADDR + 2, 0x68); /* PLA */ + dPutByte(RETURN_FROM_PLAYER_ADDR + 3, 0xaa); /* TAX */ + dPutByte(RETURN_FROM_PLAYER_ADDR + 4, 0x68); /* PLA */ + dPutByte(RETURN_FROM_PLAYER_ADDR + 5, 0x40); /* RTI */ + ast _ cpu_pc = player; + } + Cpu_RunScanlines(ast, ast _ module_info.fastplay); + break; + case ASAP_TYPE_SAP_S: + Cpu_RunScanlines(ast, ast _ module_info.fastplay); + { + V(int, i) = dGetByte(0x45) - 1; + dPutByte(0x45, i); + if (i == 0) + dPutByte(0xb07b, dGetByte(0xb07b) + 1); + } + break; #ifndef ASAP_ONLY_SAP - case ASAP_TYPE_DLT: - call_6502(ast, player + 0x103, ast _ module_info.fastplay); - break; - case ASAP_TYPE_MPT: - case ASAP_TYPE_RMT: - case ASAP_TYPE_TM2: - call_6502(ast, player + 3, ast _ module_info.fastplay); - break; - case ASAP_TYPE_TMC: - if (--ast _ tmc_per_frame_counter <= 0) { - ast _ tmc_per_frame_counter = ast _ tmc_per_frame; - call_6502(ast, player + 3, ast _ module_info.fastplay); - } - else - call_6502(ast, player + 6, ast _ module_info.fastplay); - break; + case ASAP_TYPE_DLT: + call_6502(ast, player + 0x103, ast _ module_info.fastplay); + break; + case ASAP_TYPE_MPT: + case ASAP_TYPE_RMT: + case ASAP_TYPE_TM2: + call_6502(ast, player + 3, ast _ module_info.fastplay); + break; + case ASAP_TYPE_TMC: + if (--ast _ tmc_per_frame_counter <= 0) { + ast _ tmc_per_frame_counter = ast _ tmc_per_frame; + call_6502(ast, player + 3, ast _ module_info.fastplay); + } + else + call_6502(ast, player + 6, ast _ module_info.fastplay); + break; #endif - } - PokeySound_EndFrame(ast, ast _ module_info.fastplay * 114); - if (ast _ silence_cycles > 0) { - if (PokeySound_IsSilent(ADDRESSOF ast _ base_pokey) - && PokeySound_IsSilent(ADDRESSOF ast _ extra_pokey)) { - ast _ silence_cycles_counter -= ast _ module_info.fastplay * 114; - if (ast _ silence_cycles_counter <= 0) - return FALSE; - } - else - ast _ silence_cycles_counter = ast _ silence_cycles; - } - return TRUE; + } + PokeySound_EndFrame(ast, ast _ module_info.fastplay * 114); + if (ast _ silence_cycles > 0) { + if (PokeySound_IsSilent(ADDRESSOF ast _ base_pokey) + && PokeySound_IsSilent(ADDRESSOF ast _ extra_pokey)) { + ast _ silence_cycles_counter -= ast _ module_info.fastplay * 114; + if (ast _ silence_cycles_counter <= 0) + return FALSE; + } + else + ast _ silence_cycles_counter = ast _ silence_cycles; + } + return TRUE; } FUNC(int, ASAP_GetPosition, (P(CONST ASAP_State PTR, ast))) { - return ast _ blocks_played * 10 / (ASAP_SAMPLE_RATE / 100); + return ast _ blocks_played * 10 / (ASAP_SAMPLE_RATE / 100); } FUNC(int, milliseconds_to_blocks, (P(int, milliseconds))) { - return milliseconds * (ASAP_SAMPLE_RATE / 100) / 10; + return milliseconds * (ASAP_SAMPLE_RATE / 100) / 10; } #ifndef ACTIONSCRIPT FUNC(void, ASAP_Seek, (P(ASAP_State PTR, ast), P(int, position))) { - V(int, block) = milliseconds_to_blocks(position); - if (block < ast _ blocks_played) - ASAP_PlaySong(ast, ast _ current_song, ast _ current_duration); - while (ast _ blocks_played + ast _ samples - ast _ sample_index < block) { - ast _ blocks_played += ast _ samples - ast _ sample_index; - call_6502_player(ast); - } - ast _ sample_index += block - ast _ blocks_played; - ast _ blocks_played = block; + V(int, block) = milliseconds_to_blocks(position); + if (block < ast _ blocks_played) + ASAP_PlaySong(ast, ast _ current_song, ast _ current_duration); + while (ast _ blocks_played + ast _ samples - ast _ sample_index < block) { + ast _ blocks_played += ast _ samples - ast _ sample_index; + call_6502_player(ast); + } + ast _ sample_index += block - ast _ blocks_played; + ast _ blocks_played = block; } PRIVATE FUNC(void, serialize_int, (P(BYTEARRAY, buffer), P(int, offset), P(int, value))) { - buffer[offset] = TO_BYTE(value); - buffer[offset + 1] = TO_BYTE(value >> 8); - buffer[offset + 2] = TO_BYTE(value >> 16); - buffer[offset + 3] = TO_BYTE(value >> 24); + buffer[offset] = TO_BYTE(value); + buffer[offset + 1] = TO_BYTE(value >> 8); + buffer[offset + 2] = TO_BYTE(value >> 16); + buffer[offset + 3] = TO_BYTE(value >> 24); } FUNC(void, ASAP_GetWavHeaderForPart, ( - P(CONST ASAP_State PTR, ast), P(BYTEARRAY, buffer), - P(ASAP_SampleFormat, format), P(int, blocks))) + P(CONST ASAP_State PTR, ast), P(BYTEARRAY, buffer), + P(ASAP_SampleFormat, format), P(int, blocks))) { - V(int, use_16bit) = format != ASAP_FORMAT_U8 ? 1 : 0; - V(int, block_size) = ast _ module_info.channels << use_16bit; - V(int, bytes_per_second) = ASAP_SAMPLE_RATE * block_size; - V(int, remaining_blocks) = milliseconds_to_blocks(ast _ current_duration) - ast _ blocks_played; - V(int, n_bytes); - if (blocks > remaining_blocks) - blocks = remaining_blocks; - n_bytes = blocks * block_size; - buffer[0] = CAST(byte) CHARCODE('R'); - buffer[1] = CAST(byte) CHARCODE('I'); - buffer[2] = CAST(byte) CHARCODE('F'); - buffer[3] = CAST(byte) CHARCODE('F'); - serialize_int(buffer, 4, n_bytes + 36); - buffer[8] = CAST(byte) CHARCODE('W'); - buffer[9] = CAST(byte) CHARCODE('A'); - buffer[10] = CAST(byte) CHARCODE('V'); - buffer[11] = CAST(byte) CHARCODE('E'); - buffer[12] = CAST(byte) CHARCODE('f'); - buffer[13] = CAST(byte) CHARCODE('m'); - buffer[14] = CAST(byte) CHARCODE('t'); - buffer[15] = CAST(byte) CHARCODE(' '); - buffer[16] = 16; - buffer[17] = 0; - buffer[18] = 0; - buffer[19] = 0; - buffer[20] = 1; - buffer[21] = 0; - buffer[22] = CAST(byte) ast _ module_info.channels; - buffer[23] = 0; - serialize_int(buffer, 24, ASAP_SAMPLE_RATE); - serialize_int(buffer, 28, bytes_per_second); - buffer[32] = CAST(byte) block_size; - buffer[33] = 0; - buffer[34] = CAST(byte) (8 << use_16bit); - buffer[35] = 0; - buffer[36] = CAST(byte) CHARCODE('d'); - buffer[37] = CAST(byte) CHARCODE('a'); - buffer[38] = CAST(byte) CHARCODE('t'); - buffer[39] = CAST(byte) CHARCODE('a'); - serialize_int(buffer, 40, n_bytes); + V(int, use_16bit) = format != ASAP_FORMAT_U8 ? 1 : 0; + V(int, block_size) = ast _ module_info.channels << use_16bit; + V(int, bytes_per_second) = ASAP_SAMPLE_RATE * block_size; + V(int, remaining_blocks) = milliseconds_to_blocks(ast _ current_duration) - ast _ blocks_played; + V(int, n_bytes); + if (blocks > remaining_blocks) + blocks = remaining_blocks; + n_bytes = blocks * block_size; + buffer[0] = CAST(byte) CHARCODE('R'); + buffer[1] = CAST(byte) CHARCODE('I'); + buffer[2] = CAST(byte) CHARCODE('F'); + buffer[3] = CAST(byte) CHARCODE('F'); + serialize_int(buffer, 4, n_bytes + 36); + buffer[8] = CAST(byte) CHARCODE('W'); + buffer[9] = CAST(byte) CHARCODE('A'); + buffer[10] = CAST(byte) CHARCODE('V'); + buffer[11] = CAST(byte) CHARCODE('E'); + buffer[12] = CAST(byte) CHARCODE('f'); + buffer[13] = CAST(byte) CHARCODE('m'); + buffer[14] = CAST(byte) CHARCODE('t'); + buffer[15] = CAST(byte) CHARCODE(' '); + buffer[16] = 16; + buffer[17] = 0; + buffer[18] = 0; + buffer[19] = 0; + buffer[20] = 1; + buffer[21] = 0; + buffer[22] = CAST(byte) ast _ module_info.channels; + buffer[23] = 0; + serialize_int(buffer, 24, ASAP_SAMPLE_RATE); + serialize_int(buffer, 28, bytes_per_second); + buffer[32] = CAST(byte) block_size; + buffer[33] = 0; + buffer[34] = CAST(byte) (8 << use_16bit); + buffer[35] = 0; + buffer[36] = CAST(byte) CHARCODE('d'); + buffer[37] = CAST(byte) CHARCODE('a'); + buffer[38] = CAST(byte) CHARCODE('t'); + buffer[39] = CAST(byte) CHARCODE('a'); + serialize_int(buffer, 40, n_bytes); } FUNC(void, ASAP_GetWavHeader, ( - P(CONST ASAP_State PTR, ast), P(BYTEARRAY, buffer), P(ASAP_SampleFormat, format))) + P(CONST ASAP_State PTR, ast), P(BYTEARRAY, buffer), P(ASAP_SampleFormat, format))) { - V(int, remaining_blocks) = milliseconds_to_blocks(ast _ current_duration) - ast _ blocks_played; - ASAP_GetWavHeaderForPart(ast, buffer, format, remaining_blocks); + V(int, remaining_blocks) = milliseconds_to_blocks(ast _ current_duration) - ast _ blocks_played; + ASAP_GetWavHeaderForPart(ast, buffer, format, remaining_blocks); } #endif /* ACTIONSCRIPT */ PRIVATE FUNC(int, ASAP_GenerateAt, (P(ASAP_State PTR, ast), P(VOIDPTR, buffer), P(int, buffer_offset), P(int, buffer_len), P(ASAP_SampleFormat, format))) { - V(int, block_shift); - V(int, buffer_blocks); - V(int, block); - if (ast _ silence_cycles > 0 && ast _ silence_cycles_counter <= 0) - return 0; + V(int, block_shift); + V(int, buffer_blocks); + V(int, block); + if (ast _ silence_cycles > 0 && ast _ silence_cycles_counter <= 0) + return 0; #ifdef ACTIONSCRIPT - block_shift = 0; + block_shift = 0; #else - block_shift = (ast _ module_info.channels - 1) + (format != ASAP_FORMAT_U8 ? 1 : 0); + block_shift = (ast _ module_info.channels - 1) + (format != ASAP_FORMAT_U8 ? 1 : 0); #endif - buffer_blocks = buffer_len >> block_shift; - if (ast _ current_duration > 0) { - V(int, total_blocks) = milliseconds_to_blocks(ast _ current_duration); - if (buffer_blocks > total_blocks - ast _ blocks_played) - buffer_blocks = total_blocks - ast _ blocks_played; - } - block = 0; - do { - V(int, blocks) = PokeySound_Generate(ast, CAST(BYTEARRAY) buffer, - buffer_offset + (block << block_shift), buffer_blocks - block, format); - ast _ blocks_played += blocks; - block += blocks; - } while (block < buffer_blocks && call_6502_player(ast)); - return block << block_shift; + buffer_blocks = buffer_len >> block_shift; + if (ast _ current_duration > 0) { + V(int, total_blocks) = milliseconds_to_blocks(ast _ current_duration); + if (buffer_blocks > total_blocks - ast _ blocks_played) + buffer_blocks = total_blocks - ast _ blocks_played; + } + block = 0; + do { + V(int, blocks) = PokeySound_Generate(ast, CAST(BYTEARRAY) buffer, + buffer_offset + (block << block_shift), buffer_blocks - block, format); + ast _ blocks_played += blocks; + block += blocks; + } while (block < buffer_blocks && call_6502_player(ast)); + return block << block_shift; } FUNC(int, ASAP_Generate, (P(ASAP_State PTR, ast), P(VOIDPTR, buffer), P(int, buffer_len), P(ASAP_SampleFormat, format))) { - return ASAP_GenerateAt(ast, buffer, 0, buffer_len, format); + return ASAP_GenerateAt(ast, buffer, 0, buffer_len, format); } #if defined(C) && !defined(ASAP_ONLY_SAP) abool ASAP_ChangeExt(char *filename, const char *ext) { - char *dest = NULL; - while (*filename != '\0') { - if (*filename == '/' || *filename == '\\') - dest = NULL; - else if (*filename == '.') - dest = filename + 1; - filename++; - } - if (dest == NULL) - return FALSE; - strcpy(dest, ext); - return TRUE; + char *dest = NULL; + while (*filename != '\0') { + if (*filename == '/' || *filename == '\\') + dest = NULL; + else if (*filename == '.') + dest = filename + 1; + filename++; + } + if (dest == NULL) + return FALSE; + strcpy(dest, ext); + return TRUE; } abool ASAP_CanSetModuleInfo(const char *filename) { - int ext = get_packed_ext(filename); - return ext == ASAP_EXT('S', 'A', 'P'); + int ext = get_packed_ext(filename); + return ext == ASAP_EXT('S', 'A', 'P'); } static byte *put_string(byte *dest, const char *str) { - while (*str != '\0') - *dest++ = *str++; - return dest; + while (*str != '\0') + *dest++ = *str++; + return dest; } static byte *put_dec(byte *dest, int value) { - if (value >= 10) { - dest = put_dec(dest, value / 10); - value %= 10; - } - *dest++ = '0' + value; - return dest; + if (value >= 10) { + dest = put_dec(dest, value / 10); + value %= 10; + } + *dest++ = '0' + value; + return dest; } static byte *put_text_tag(byte *dest, const char *tag, const char *value) { - dest = put_string(dest, tag); - *dest++ = '"'; - if (*value == '\0') - value = ""; - while (*value != '\0') { - if (*value < ' ' || *value > 'z' || *value == '"' || *value == '`') - return NULL; - *dest++ = *value++; - } - *dest++ = '"'; - *dest++ = '\r'; - *dest++ = '\n'; - return dest; + dest = put_string(dest, tag); + *dest++ = '"'; + if (*value == '\0') + value = ""; + while (*value != '\0') { + if (*value < ' ' || *value > 'z' || *value == '"' || *value == '`') + return NULL; + *dest++ = *value++; + } + *dest++ = '"'; + *dest++ = '\r'; + *dest++ = '\n'; + return dest; } static byte *put_dec_tag(byte *dest, const char *tag, int value) { - dest = put_string(dest, tag); - dest = put_dec(dest, value); - *dest++ = '\r'; - *dest++ = '\n'; - return dest; + dest = put_string(dest, tag); + dest = put_dec(dest, value); + *dest++ = '\r'; + *dest++ = '\n'; + return dest; } static byte *put_hex_tag(byte *dest, const char *tag, int value) { - int i; - if (value < 0) - return dest; - dest = put_string(dest, tag); - for (i = 12; i >= 0; i -= 4) { - int digit = (value >> i) & 0xf; - *dest++ = (byte) (digit + (digit < 10 ? '0' : 'A' - 10)); - } - *dest++ = '\r'; - *dest++ = '\n'; - return dest; + int i; + if (value < 0) + return dest; + dest = put_string(dest, tag); + for (i = 12; i >= 0; i -= 4) { + int digit = (value >> i) & 0xf; + *dest++ = (byte) (digit + (digit < 10 ? '0' : 'A' - 10)); + } + *dest++ = '\r'; + *dest++ = '\n'; + return dest; } static byte *start_sap_header(byte *dest, const ASAP_ModuleInfo *module_info) { - dest = put_string(dest, "SAP\r\n"); - dest = put_text_tag(dest, "AUTHOR ", module_info->author); - if (dest == NULL) - return NULL; - dest = put_text_tag(dest, "NAME ", module_info->name); - if (dest == NULL) - return NULL; - dest = put_text_tag(dest, "DATE ", module_info->date); - if (dest == NULL) - return NULL; - if (module_info->songs > 1) { - dest = put_dec_tag(dest, "SONGS ", module_info->songs); - if (module_info->default_song > 0) - dest = put_dec_tag(dest, "DEFSONG ", module_info->default_song); - } - if (module_info->channels > 1) - dest = put_string(dest, "STEREO\r\n"); - return dest; + dest = put_string(dest, "SAP\r\n"); + dest = put_text_tag(dest, "AUTHOR ", module_info->author); + if (dest == NULL) + return NULL; + dest = put_text_tag(dest, "NAME ", module_info->name); + if (dest == NULL) + return NULL; + dest = put_text_tag(dest, "DATE ", module_info->date); + if (dest == NULL) + return NULL; + if (module_info->songs > 1) { + dest = put_dec_tag(dest, "SONGS ", module_info->songs); + if (module_info->default_song > 0) + dest = put_dec_tag(dest, "DEFSONG ", module_info->default_song); + } + if (module_info->channels > 1) + dest = put_string(dest, "STEREO\r\n"); + return dest; } static char *two_digits(char *s, int x) { - s[0] = '0' + x / 10; - s[1] = '0' + x % 10; - return s + 2; + s[0] = '0' + x / 10; + s[1] = '0' + x % 10; + return s + 2; } void ASAP_DurationToString(char *s, int duration) { - if (duration >= 0 && duration < 100 * 60 * 1000) { - int seconds = duration / 1000; - s = two_digits(s, seconds / 60); - *s++ = ':'; - s = two_digits(s, seconds % 60); - duration %= 1000; - if (duration != 0) { - *s++ = '.'; - s = two_digits(s, duration / 10); - duration %= 10; - if (duration != 0) - *s++ = '0' + duration; - } - } - *s = '\0'; + if (duration >= 0 && duration < 100 * 60 * 1000) { + int seconds = duration / 1000; + s = two_digits(s, seconds / 60); + *s++ = ':'; + s = two_digits(s, seconds % 60); + duration %= 1000; + if (duration != 0) { + *s++ = '.'; + s = two_digits(s, duration / 10); + duration %= 10; + if (duration != 0) + *s++ = '0' + duration; + } + } + *s = '\0'; } static byte *put_durations(byte *dest, const ASAP_ModuleInfo *module_info) { - int song; - for (song = 0; song < module_info->songs; song++) { - if (module_info->durations[song] < 0) - break; - dest = put_string(dest, "TIME "); - ASAP_DurationToString((char *) dest, module_info->durations[song]); - while (*dest != '\0') - dest++; - if (module_info->loops[song]) - dest = put_string(dest, " LOOP"); - *dest++ = '\r'; - *dest++ = '\n'; - } - return dest; + int song; + for (song = 0; song < module_info->songs; song++) { + if (module_info->durations[song] < 0) + break; + dest = put_string(dest, "TIME "); + ASAP_DurationToString((char *) dest, module_info->durations[song]); + while (*dest != '\0') + dest++; + if (module_info->loops[song]) + dest = put_string(dest, " LOOP"); + *dest++ = '\r'; + *dest++ = '\n'; + } + return dest; } static byte *put_sap_header(byte *dest, const ASAP_ModuleInfo *module_info, char type, int music, int init, int player) { - dest = start_sap_header(dest, module_info); - if (dest == NULL) - return NULL; - dest = put_string(dest, "TYPE "); - *dest++ = type; - *dest++ = '\r'; - *dest++ = '\n'; - if (module_info->fastplay != 312) - dest = put_dec_tag(dest, "FASTPLAY ", module_info->fastplay); - dest = put_hex_tag(dest, "MUSIC ", music); - dest = put_hex_tag(dest, "INIT ", init); - dest = put_hex_tag(dest, "PLAYER ", player); - dest = put_durations(dest, module_info); - return dest; + dest = start_sap_header(dest, module_info); + if (dest == NULL) + return NULL; + dest = put_string(dest, "TYPE "); + *dest++ = type; + *dest++ = '\r'; + *dest++ = '\n'; + if (module_info->fastplay != 312) + dest = put_dec_tag(dest, "FASTPLAY ", module_info->fastplay); + dest = put_hex_tag(dest, "MUSIC ", music); + dest = put_hex_tag(dest, "INIT ", init); + dest = put_hex_tag(dest, "PLAYER ", player); + dest = put_durations(dest, module_info); + return dest; } int ASAP_SetModuleInfo(const ASAP_ModuleInfo *module_info, const BYTEARRAY module, int module_len, BYTEARRAY out_module) { - byte *dest; - int i; - if (memcmp(module, "SAP\r\n", 5) != 0) - return -1; - dest = start_sap_header(out_module, module_info); - if (dest == NULL) - return -1; - i = 5; - while (i < module_len && module[i] != 0xff) { - if (memcmp(module + i, "AUTHOR ", 7) == 0 - || memcmp(module + i, "NAME ", 5) == 0 - || memcmp(module + i, "DATE ", 5) == 0 - || memcmp(module + i, "SONGS ", 6) == 0 - || memcmp(module + i, "DEFSONG ", 8) == 0 - || memcmp(module + i, "STEREO\r", 7) == 0 - || memcmp(module + i, "TIME ", 5) == 0) { - while (i < module_len && module[i++] != 0x0a); - } - else { - int b; - do { - b = module[i++]; - *dest++ = b; - } while (i < module_len && b != 0x0a); - } - } - dest = put_durations(dest, module_info); - module_len -= i; - memcpy(dest, module + i, module_len); - dest += module_len; - return dest - out_module; + byte *dest; + int i; + if (memcmp(module, "SAP\r\n", 5) != 0) + return -1; + dest = start_sap_header(out_module, module_info); + if (dest == NULL) + return -1; + i = 5; + while (i < module_len && module[i] != 0xff) { + if (memcmp(module + i, "AUTHOR ", 7) == 0 + || memcmp(module + i, "NAME ", 5) == 0 + || memcmp(module + i, "DATE ", 5) == 0 + || memcmp(module + i, "SONGS ", 6) == 0 + || memcmp(module + i, "DEFSONG ", 8) == 0 + || memcmp(module + i, "STEREO\r", 7) == 0 + || memcmp(module + i, "TIME ", 5) == 0) { + while (i < module_len && module[i++] != 0x0a); + } + else { + int b; + do { + b = module[i++]; + *dest++ = b; + } while (i < module_len && b != 0x0a); + } + } + dest = put_durations(dest, module_info); + module_len -= i; + memcpy(dest, module + i, module_len); + dest += module_len; + return dest - out_module; } #define RMT_INIT 0x0c80 #define TM2_INIT 0x1080 const char *ASAP_CanConvert( - const char *filename, const ASAP_ModuleInfo *module_info, - const BYTEARRAY module, int module_len) + const char *filename, const ASAP_ModuleInfo *module_info, + const BYTEARRAY module, int module_len) { (void) filename; - switch (module_info->type) { - case ASAP_TYPE_SAP_B: - if ((module_info->init == 0x3fb || module_info->init == 0x3f9) && module_info->player == 0x503) - return "dlt"; - if (module_info->init == 0x4f3 || module_info->init == 0xf4f3 || module_info->init == 0x4ef) - return module_info->fastplay == 156 ? "mpd" : "mpt"; - if (module_info->init == RMT_INIT) - return "rmt"; - if ((module_info->init == 0x4f5 || module_info->init == 0xf4f5 || module_info->init == 0x4f2) - || ((module_info->init == 0x4e7 || module_info->init == 0xf4e7 || module_info->init == 0x4e4) && module_info->fastplay == 156) - || ((module_info->init == 0x4e5 || module_info->init == 0xf4e5 || module_info->init == 0x4e2) && (module_info->fastplay == 104 || module_info->fastplay == 78))) - return "tmc"; - if (module_info->init == TM2_INIT) - return "tm2"; - break; - case ASAP_TYPE_SAP_C: - if (module_info->player == 0x500 || module_info->player == 0xf500) { - if (module_info->fastplay == 156) - return "dmc"; - if (module_info->channels > 1) - return "cms"; - if (module[module_len - 170] == 0x1e) - return "cmr"; - if (module[module_len - 909] == 0x30) - return "cm3"; - return "cmc"; - } - break; - case ASAP_TYPE_CMC: - case ASAP_TYPE_CM3: - case ASAP_TYPE_CMR: - case ASAP_TYPE_CMS: - case ASAP_TYPE_DLT: - case ASAP_TYPE_MPT: - case ASAP_TYPE_RMT: - case ASAP_TYPE_TMC: - case ASAP_TYPE_TM2: - return "sap"; - default: - break; - } - return NULL; + switch (module_info->type) { + case ASAP_TYPE_SAP_B: + if ((module_info->init == 0x3fb || module_info->init == 0x3f9) && module_info->player == 0x503) + return "dlt"; + if (module_info->init == 0x4f3 || module_info->init == 0xf4f3 || module_info->init == 0x4ef) + return module_info->fastplay == 156 ? "mpd" : "mpt"; + if (module_info->init == RMT_INIT) + return "rmt"; + if ((module_info->init == 0x4f5 || module_info->init == 0xf4f5 || module_info->init == 0x4f2) + || ((module_info->init == 0x4e7 || module_info->init == 0xf4e7 || module_info->init == 0x4e4) && module_info->fastplay == 156) + || ((module_info->init == 0x4e5 || module_info->init == 0xf4e5 || module_info->init == 0x4e2) && (module_info->fastplay == 104 || module_info->fastplay == 78))) + return "tmc"; + if (module_info->init == TM2_INIT) + return "tm2"; + break; + case ASAP_TYPE_SAP_C: + if (module_info->player == 0x500 || module_info->player == 0xf500) { + if (module_info->fastplay == 156) + return "dmc"; + if (module_info->channels > 1) + return "cms"; + if (module[module_len - 170] == 0x1e) + return "cmr"; + if (module[module_len - 909] == 0x30) + return "cm3"; + return "cmc"; + } + break; + case ASAP_TYPE_CMC: + case ASAP_TYPE_CM3: + case ASAP_TYPE_CMR: + case ASAP_TYPE_CMS: + case ASAP_TYPE_DLT: + case ASAP_TYPE_MPT: + case ASAP_TYPE_RMT: + case ASAP_TYPE_TMC: + case ASAP_TYPE_TM2: + return "sap"; + default: + break; + } + return NULL; } int ASAP_Convert( - const char *filename, const ASAP_ModuleInfo *module_info, - const BYTEARRAY module, int module_len, BYTEARRAY out_module) + const char *filename, const ASAP_ModuleInfo *module_info, + const BYTEARRAY module, int module_len, BYTEARRAY out_module) { (void) filename; - int out_len; - byte *dest; - int addr; - int player; - static const int tmc_player[4] = { 3, -9, -10, -10 }; - static const int tmc_init[4] = { -14, -16, -17, -17 }; - switch (module_info->type) { - case ASAP_TYPE_SAP_B: - case ASAP_TYPE_SAP_C: - out_len = UWORD(module, module_info->header_len + 4) - UWORD(module, module_info->header_len + 2) + 7; - if (out_len < 7 || module_info->header_len + out_len >= module_len) - return -1; - memcpy(out_module, module + module_info->header_len, out_len); - return out_len; - case ASAP_TYPE_CMC: - case ASAP_TYPE_CM3: - case ASAP_TYPE_CMR: - case ASAP_TYPE_CMS: - dest = put_sap_header(out_module, module_info, 'C', module_info->music, -1, module_info->player); - if (dest == NULL) - return -1; - memcpy(dest, module, module_len); - dest[0] = 0xff; /* some modules start with zeros */ - dest[1] = 0xff; - dest += module_len; - if (module_info->type == ASAP_TYPE_CM3) { - memcpy(dest, cm3_obx + 2, sizeof(cm3_obx) - 2); - dest += sizeof(cm3_obx) - 2; - } - else if (module_info->type == ASAP_TYPE_CMS) { - memcpy(dest, cms_obx + 2, sizeof(cms_obx) - 2); - dest += sizeof(cms_obx) - 2; - } - else { - memcpy(dest, cmc_obx + 2, sizeof(cmc_obx) - 2); - if (module_info->type == ASAP_TYPE_CMR) - memcpy(dest + 4 + CMR_BASS_TABLE_OFFSET, cmr_bass_table, sizeof(cmr_bass_table)); - dest += sizeof(cmc_obx) - 2; - } - return dest - out_module; - case ASAP_TYPE_DLT: - if (module_info->songs != 1) { - addr = module_info->player - 7 - module_info->songs; - dest = put_sap_header(out_module, module_info, 'B', -1, module_info->player - 7, module_info->player + 0x103); - } - else { - addr = module_info->player - 5; - dest = put_sap_header(out_module, module_info, 'B', -1, addr, module_info->player + 0x103); - } - if (dest == NULL) - return -1; - memcpy(dest, module, module_len); - if (module_len == 0x2c06) { - dest[4] = 0; - dest[5] = 0x4c; - dest[0x2c06] = 0; - } - dest += 0x2c07; - *dest++ = (byte) addr; - *dest++ = (byte) (addr >> 8); - *dest++ = dlt_obx[4]; - *dest++ = dlt_obx[5]; - if (module_info->songs != 1) { - memcpy(dest, module_info->song_pos, module_info->songs); - dest += module_info->songs; - *dest++ = 0xaa; /* tax */ - *dest++ = 0xbc; /* ldy song2pos,x */ - *dest++ = (byte) addr; - *dest++ = (byte) (addr >> 8); - } - else { - *dest++ = 0xa0; /* ldy #0 */ - *dest++ = 0; - } - *dest++ = 0x4c; /* jmp init */ - *dest++ = (byte) module_info->player; - *dest++ = (byte) ((module_info->player >> 8) + 1); - memcpy(dest, dlt_obx + 6, sizeof(dlt_obx) - 6); - dest += sizeof(dlt_obx) - 6; - return dest - out_module; - case ASAP_TYPE_MPT: - if (module_info->songs != 1) { - addr = module_info->player - 17 - module_info->songs; - dest = put_sap_header(out_module, module_info, 'B', -1, module_info->player - 17, module_info->player + 3); - } - else { - addr = module_info->player - 13; - dest = put_sap_header(out_module, module_info, 'B', -1, addr, module_info->player + 3); - } - if (dest == NULL) - return -1; - memcpy(dest, module, module_len); - dest += module_len; - *dest++ = (byte) addr; - *dest++ = (byte) (addr >> 8); - *dest++ = mpt_obx[4]; - *dest++ = mpt_obx[5]; - if (module_info->songs != 1) { - memcpy(dest, module_info->song_pos, module_info->songs); - dest += module_info->songs; - *dest++ = 0x48; /* pha */ - } - *dest++ = 0xa0; /* ldy #music; - *dest++ = 0xa2; /* ldx #>music */ - *dest++ = (byte) (module_info->music >> 8); - *dest++ = 0xa9; /* lda #0 */ - *dest++ = 0; - *dest++ = 0x20; /* jsr player */ - *dest++ = (byte) module_info->player; - *dest++ = (byte) (module_info->player >> 8); - if (module_info->songs != 1) { - *dest++ = 0x68; /* pla */ - *dest++ = 0xa8; /* tay */ - *dest++ = 0xbe; /* ldx song2pos,y */ - *dest++ = (byte) addr; - *dest++ = (byte) (addr >> 8); - } - else { - *dest++ = 0xa2; /* ldx #0 */ - *dest++ = 0; - } - *dest++ = 0xa9; /* lda #2 */ - *dest++ = 2; - memcpy(dest, mpt_obx + 6, sizeof(mpt_obx) - 6); - dest += sizeof(mpt_obx) - 6; - return dest - out_module; - case ASAP_TYPE_RMT: - dest = put_sap_header(out_module, module_info, 'B', -1, RMT_INIT, module_info->player + 3); - if (dest == NULL) - return -1; - memcpy(dest, module, module_len); - dest += module_len; - *dest++ = (byte) RMT_INIT; - *dest++ = (byte) (RMT_INIT >> 8); - if (module_info->songs != 1) { - addr = RMT_INIT + 10 + module_info->songs; - *dest++ = (byte) addr; - *dest++ = (byte) (addr >> 8); - *dest++ = 0xa8; /* tay */ - *dest++ = 0xb9; /* lda song2pos,y */ - *dest++ = (byte) (RMT_INIT + 11); - *dest++ = (byte) ((RMT_INIT + 11) >> 8); - } - else { - *dest++ = (byte) (RMT_INIT + 8); - *dest++ = (byte) ((RMT_INIT + 8) >> 8); - *dest++ = 0xa9; /* lda #0 */ - *dest++ = 0; - } - *dest++ = 0xa2; /* ldx #music; - *dest++ = 0xa0; /* ldy #>music */ - *dest++ = (byte) (module_info->music >> 8); - *dest++ = 0x4c; /* jmp player */ - *dest++ = (byte) module_info->player; - *dest++ = (byte) (module_info->player >> 8); - if (module_info->songs != 1) { - memcpy(dest, module_info->song_pos, module_info->songs); - dest += module_info->songs; - } - if (module_info->channels == 1) { - memcpy(dest, rmt4_obx + 2, sizeof(rmt4_obx) - 2); - dest += sizeof(rmt4_obx) - 2; - } - else { - memcpy(dest, rmt8_obx + 2, sizeof(rmt8_obx) - 2); - dest += sizeof(rmt8_obx) - 2; - } - return dest - out_module; - case ASAP_TYPE_TMC: - player = module_info->player + tmc_player[module[0x25] - 1]; - addr = player + tmc_init[module[0x25] - 1]; - if (module_info->songs != 1) - addr -= 3; - dest = put_sap_header(out_module, module_info, 'B', -1, addr, player); - if (dest == NULL) - return -1; - memcpy(dest, module, module_len); - dest += module_len; - *dest++ = (byte) addr; - *dest++ = (byte) (addr >> 8); - *dest++ = tmc_obx[4]; - *dest++ = tmc_obx[5]; - if (module_info->songs != 1) - *dest++ = 0x48; /* pha */ - *dest++ = 0xa0; /* ldy #music; - *dest++ = 0xa2; /* ldx #>music */ - *dest++ = (byte) (module_info->music >> 8); - *dest++ = 0xa9; /* lda #$70 */ - *dest++ = 0x70; - *dest++ = 0x20; /* jsr player */ - *dest++ = (byte) module_info->player; - *dest++ = (byte) (module_info->player >> 8); - if (module_info->songs != 1) { - *dest++ = 0x68; /* pla */ - *dest++ = 0xaa; /* tax */ - *dest++ = 0xa9; /* lda #0 */ - *dest++ = 0; - } - else { - *dest++ = 0xa9; /* lda #$60 */ - *dest++ = 0x60; - } - switch (module[0x25]) { - case 2: - *dest++ = 0x06; /* asl 0 */ - *dest++ = 0; - *dest++ = 0x4c; /* jmp player */ - *dest++ = (byte) module_info->player; - *dest++ = (byte) (module_info->player >> 8); - *dest++ = 0xa5; /* lda 0 */ - *dest++ = 0; - *dest++ = 0xe6; /* inc 0 */ - *dest++ = 0; - *dest++ = 0x4a; /* lsr @ */ - *dest++ = 0x90; /* bcc player+3 */ - *dest++ = 5; - *dest++ = 0xb0; /* bcs player+6 */ - *dest++ = 6; - break; - case 3: - case 4: - *dest++ = 0xa0; /* ldy #1 */ - *dest++ = 1; - *dest++ = 0x84; /* sty 0 */ - *dest++ = 0; - *dest++ = 0xd0; /* bne player */ - *dest++ = 10; - *dest++ = 0xc6; /* dec 0 */ - *dest++ = 0; - *dest++ = 0xd0; /* bne player+6 */ - *dest++ = 12; - *dest++ = 0xa0; /* ldy #3 */ - *dest++ = module[0x25]; - *dest++ = 0x84; /* sty 0 */ - *dest++ = 0; - *dest++ = 0xd0; /* bne player+3 */ - *dest++ = 3; - break; - default: - break; - } - memcpy(dest, tmc_obx + 6, sizeof(tmc_obx) - 6); - dest += sizeof(tmc_obx) - 6; - return dest - out_module; - case ASAP_TYPE_TM2: - dest = put_sap_header(out_module, module_info, 'B', -1, TM2_INIT, module_info->player + 3); - if (dest == NULL) - return -1; - memcpy(dest, module, module_len); - dest += module_len; - *dest++ = (byte) TM2_INIT; - *dest++ = (byte) (TM2_INIT >> 8); - if (module_info->songs != 1) { - *dest++ = (byte) (TM2_INIT + 16); - *dest++ = (byte) ((TM2_INIT + 16) >> 8); - *dest++ = 0x48; /* pha */ - } - else { - *dest++ = (byte) (TM2_INIT + 14); - *dest++ = (byte) ((TM2_INIT + 14) >> 8); - } - *dest++ = 0xa0; /* ldy #music; - *dest++ = 0xa2; /* ldx #>music */ - *dest++ = (byte) (module_info->music >> 8); - *dest++ = 0xa9; /* lda #$70 */ - *dest++ = 0x70; - *dest++ = 0x20; /* jsr player */ - *dest++ = (byte) module_info->player; - *dest++ = (byte) (module_info->player >> 8); - if (module_info->songs != 1) { - *dest++ = 0x68; /* pla */ - *dest++ = 0xaa; /* tax */ - *dest++ = 0xa9; /* lda #0 */ - *dest++ = 0; - } - else { - *dest++ = 0xa9; /* lda #0 */ - *dest++ = 0; - *dest++ = 0xaa; /* tax */ - } - *dest++ = 0x4c; /* jmp player */ - *dest++ = (byte) module_info->player; - *dest++ = (byte) (module_info->player >> 8); - memcpy(dest, tm2_obx + 2, sizeof(tm2_obx) - 2); - dest += sizeof(tm2_obx) - 2; - return dest - out_module; - default: - return -1; - } + int out_len; + byte *dest; + int addr; + int player; + static const int tmc_player[4] = { 3, -9, -10, -10 }; + static const int tmc_init[4] = { -14, -16, -17, -17 }; + switch (module_info->type) { + case ASAP_TYPE_SAP_B: + case ASAP_TYPE_SAP_C: + out_len = UWORD(module, module_info->header_len + 4) - UWORD(module, module_info->header_len + 2) + 7; + if (out_len < 7 || module_info->header_len + out_len >= module_len) + return -1; + memcpy(out_module, module + module_info->header_len, out_len); + return out_len; + case ASAP_TYPE_CMC: + case ASAP_TYPE_CM3: + case ASAP_TYPE_CMR: + case ASAP_TYPE_CMS: + dest = put_sap_header(out_module, module_info, 'C', module_info->music, -1, module_info->player); + if (dest == NULL) + return -1; + memcpy(dest, module, module_len); + dest[0] = 0xff; /* some modules start with zeros */ + dest[1] = 0xff; + dest += module_len; + if (module_info->type == ASAP_TYPE_CM3) { + memcpy(dest, cm3_obx + 2, sizeof(cm3_obx) - 2); + dest += sizeof(cm3_obx) - 2; + } + else if (module_info->type == ASAP_TYPE_CMS) { + memcpy(dest, cms_obx + 2, sizeof(cms_obx) - 2); + dest += sizeof(cms_obx) - 2; + } + else { + memcpy(dest, cmc_obx + 2, sizeof(cmc_obx) - 2); + if (module_info->type == ASAP_TYPE_CMR) + memcpy(dest + 4 + CMR_BASS_TABLE_OFFSET, cmr_bass_table, sizeof(cmr_bass_table)); + dest += sizeof(cmc_obx) - 2; + } + return dest - out_module; + case ASAP_TYPE_DLT: + if (module_info->songs != 1) { + addr = module_info->player - 7 - module_info->songs; + dest = put_sap_header(out_module, module_info, 'B', -1, module_info->player - 7, module_info->player + 0x103); + } + else { + addr = module_info->player - 5; + dest = put_sap_header(out_module, module_info, 'B', -1, addr, module_info->player + 0x103); + } + if (dest == NULL) + return -1; + memcpy(dest, module, module_len); + if (module_len == 0x2c06) { + dest[4] = 0; + dest[5] = 0x4c; + dest[0x2c06] = 0; + } + dest += 0x2c07; + *dest++ = (byte) addr; + *dest++ = (byte) (addr >> 8); + *dest++ = dlt_obx[4]; + *dest++ = dlt_obx[5]; + if (module_info->songs != 1) { + memcpy(dest, module_info->song_pos, module_info->songs); + dest += module_info->songs; + *dest++ = 0xaa; /* tax */ + *dest++ = 0xbc; /* ldy song2pos,x */ + *dest++ = (byte) addr; + *dest++ = (byte) (addr >> 8); + } + else { + *dest++ = 0xa0; /* ldy #0 */ + *dest++ = 0; + } + *dest++ = 0x4c; /* jmp init */ + *dest++ = (byte) module_info->player; + *dest++ = (byte) ((module_info->player >> 8) + 1); + memcpy(dest, dlt_obx + 6, sizeof(dlt_obx) - 6); + dest += sizeof(dlt_obx) - 6; + return dest - out_module; + case ASAP_TYPE_MPT: + if (module_info->songs != 1) { + addr = module_info->player - 17 - module_info->songs; + dest = put_sap_header(out_module, module_info, 'B', -1, module_info->player - 17, module_info->player + 3); + } + else { + addr = module_info->player - 13; + dest = put_sap_header(out_module, module_info, 'B', -1, addr, module_info->player + 3); + } + if (dest == NULL) + return -1; + memcpy(dest, module, module_len); + dest += module_len; + *dest++ = (byte) addr; + *dest++ = (byte) (addr >> 8); + *dest++ = mpt_obx[4]; + *dest++ = mpt_obx[5]; + if (module_info->songs != 1) { + memcpy(dest, module_info->song_pos, module_info->songs); + dest += module_info->songs; + *dest++ = 0x48; /* pha */ + } + *dest++ = 0xa0; /* ldy #music; + *dest++ = 0xa2; /* ldx #>music */ + *dest++ = (byte) (module_info->music >> 8); + *dest++ = 0xa9; /* lda #0 */ + *dest++ = 0; + *dest++ = 0x20; /* jsr player */ + *dest++ = (byte) module_info->player; + *dest++ = (byte) (module_info->player >> 8); + if (module_info->songs != 1) { + *dest++ = 0x68; /* pla */ + *dest++ = 0xa8; /* tay */ + *dest++ = 0xbe; /* ldx song2pos,y */ + *dest++ = (byte) addr; + *dest++ = (byte) (addr >> 8); + } + else { + *dest++ = 0xa2; /* ldx #0 */ + *dest++ = 0; + } + *dest++ = 0xa9; /* lda #2 */ + *dest++ = 2; + memcpy(dest, mpt_obx + 6, sizeof(mpt_obx) - 6); + dest += sizeof(mpt_obx) - 6; + return dest - out_module; + case ASAP_TYPE_RMT: + dest = put_sap_header(out_module, module_info, 'B', -1, RMT_INIT, module_info->player + 3); + if (dest == NULL) + return -1; + memcpy(dest, module, module_len); + dest += module_len; + *dest++ = (byte) RMT_INIT; + *dest++ = (byte) (RMT_INIT >> 8); + if (module_info->songs != 1) { + addr = RMT_INIT + 10 + module_info->songs; + *dest++ = (byte) addr; + *dest++ = (byte) (addr >> 8); + *dest++ = 0xa8; /* tay */ + *dest++ = 0xb9; /* lda song2pos,y */ + *dest++ = (byte) (RMT_INIT + 11); + *dest++ = (byte) ((RMT_INIT + 11) >> 8); + } + else { + *dest++ = (byte) (RMT_INIT + 8); + *dest++ = (byte) ((RMT_INIT + 8) >> 8); + *dest++ = 0xa9; /* lda #0 */ + *dest++ = 0; + } + *dest++ = 0xa2; /* ldx #music; + *dest++ = 0xa0; /* ldy #>music */ + *dest++ = (byte) (module_info->music >> 8); + *dest++ = 0x4c; /* jmp player */ + *dest++ = (byte) module_info->player; + *dest++ = (byte) (module_info->player >> 8); + if (module_info->songs != 1) { + memcpy(dest, module_info->song_pos, module_info->songs); + dest += module_info->songs; + } + if (module_info->channels == 1) { + memcpy(dest, rmt4_obx + 2, sizeof(rmt4_obx) - 2); + dest += sizeof(rmt4_obx) - 2; + } + else { + memcpy(dest, rmt8_obx + 2, sizeof(rmt8_obx) - 2); + dest += sizeof(rmt8_obx) - 2; + } + return dest - out_module; + case ASAP_TYPE_TMC: + player = module_info->player + tmc_player[module[0x25] - 1]; + addr = player + tmc_init[module[0x25] - 1]; + if (module_info->songs != 1) + addr -= 3; + dest = put_sap_header(out_module, module_info, 'B', -1, addr, player); + if (dest == NULL) + return -1; + memcpy(dest, module, module_len); + dest += module_len; + *dest++ = (byte) addr; + *dest++ = (byte) (addr >> 8); + *dest++ = tmc_obx[4]; + *dest++ = tmc_obx[5]; + if (module_info->songs != 1) + *dest++ = 0x48; /* pha */ + *dest++ = 0xa0; /* ldy #music; + *dest++ = 0xa2; /* ldx #>music */ + *dest++ = (byte) (module_info->music >> 8); + *dest++ = 0xa9; /* lda #$70 */ + *dest++ = 0x70; + *dest++ = 0x20; /* jsr player */ + *dest++ = (byte) module_info->player; + *dest++ = (byte) (module_info->player >> 8); + if (module_info->songs != 1) { + *dest++ = 0x68; /* pla */ + *dest++ = 0xaa; /* tax */ + *dest++ = 0xa9; /* lda #0 */ + *dest++ = 0; + } + else { + *dest++ = 0xa9; /* lda #$60 */ + *dest++ = 0x60; + } + switch (module[0x25]) { + case 2: + *dest++ = 0x06; /* asl 0 */ + *dest++ = 0; + *dest++ = 0x4c; /* jmp player */ + *dest++ = (byte) module_info->player; + *dest++ = (byte) (module_info->player >> 8); + *dest++ = 0xa5; /* lda 0 */ + *dest++ = 0; + *dest++ = 0xe6; /* inc 0 */ + *dest++ = 0; + *dest++ = 0x4a; /* lsr @ */ + *dest++ = 0x90; /* bcc player+3 */ + *dest++ = 5; + *dest++ = 0xb0; /* bcs player+6 */ + *dest++ = 6; + break; + case 3: + case 4: + *dest++ = 0xa0; /* ldy #1 */ + *dest++ = 1; + *dest++ = 0x84; /* sty 0 */ + *dest++ = 0; + *dest++ = 0xd0; /* bne player */ + *dest++ = 10; + *dest++ = 0xc6; /* dec 0 */ + *dest++ = 0; + *dest++ = 0xd0; /* bne player+6 */ + *dest++ = 12; + *dest++ = 0xa0; /* ldy #3 */ + *dest++ = module[0x25]; + *dest++ = 0x84; /* sty 0 */ + *dest++ = 0; + *dest++ = 0xd0; /* bne player+3 */ + *dest++ = 3; + break; + default: + break; + } + memcpy(dest, tmc_obx + 6, sizeof(tmc_obx) - 6); + dest += sizeof(tmc_obx) - 6; + return dest - out_module; + case ASAP_TYPE_TM2: + dest = put_sap_header(out_module, module_info, 'B', -1, TM2_INIT, module_info->player + 3); + if (dest == NULL) + return -1; + memcpy(dest, module, module_len); + dest += module_len; + *dest++ = (byte) TM2_INIT; + *dest++ = (byte) (TM2_INIT >> 8); + if (module_info->songs != 1) { + *dest++ = (byte) (TM2_INIT + 16); + *dest++ = (byte) ((TM2_INIT + 16) >> 8); + *dest++ = 0x48; /* pha */ + } + else { + *dest++ = (byte) (TM2_INIT + 14); + *dest++ = (byte) ((TM2_INIT + 14) >> 8); + } + *dest++ = 0xa0; /* ldy #music; + *dest++ = 0xa2; /* ldx #>music */ + *dest++ = (byte) (module_info->music >> 8); + *dest++ = 0xa9; /* lda #$70 */ + *dest++ = 0x70; + *dest++ = 0x20; /* jsr player */ + *dest++ = (byte) module_info->player; + *dest++ = (byte) (module_info->player >> 8); + if (module_info->songs != 1) { + *dest++ = 0x68; /* pla */ + *dest++ = 0xaa; /* tax */ + *dest++ = 0xa9; /* lda #0 */ + *dest++ = 0; + } + else { + *dest++ = 0xa9; /* lda #0 */ + *dest++ = 0; + *dest++ = 0xaa; /* tax */ + } + *dest++ = 0x4c; /* jmp player */ + *dest++ = (byte) module_info->player; + *dest++ = (byte) (module_info->player >> 8); + memcpy(dest, tm2_obx + 2, sizeof(tm2_obx) - 2); + dest += sizeof(tm2_obx) - 2; + return dest - out_module; + default: + return -1; + } } #endif /* defined(C) && !defined(ASAP_ONLY_SAP) */ diff --git a/apps/codecs/libasap/asap.h b/apps/codecs/libasap/asap.h index 02f6e680f2..b43b3ce0c2 100644 --- a/apps/codecs/libasap/asap.h +++ b/apps/codecs/libasap/asap.h @@ -37,19 +37,19 @@ extern "C" { /* Short credits of the ASAP engine. */ #define ASAP_YEARS "2005-2010" #define ASAP_CREDITS \ - "Another Slight Atari Player (C) 2005-2010 Piotr Fusik\n" \ - "CMC, MPT, TMC, TM2 players (C) 1994-2005 Marcin Lewandowski\n" \ - "RMT player (C) 2002-2005 Radek Sterba\n" \ - "DLT player (C) 2009 Marek Konopka\n" \ - "CMS player (C) 1999 David Spilka\n" + "Another Slight Atari Player (C) 2005-2010 Piotr Fusik\n" \ + "CMC, MPT, TMC, TM2 players (C) 1994-2005 Marcin Lewandowski\n" \ + "RMT player (C) 2002-2005 Radek Sterba\n" \ + "DLT player (C) 2009 Marek Konopka\n" \ + "CMS player (C) 1999 David Spilka\n" /* Short GPL notice. Display after the credits. */ #define ASAP_COPYRIGHT \ - "This program is free software; you can redistribute it and/or modify\n" \ - "it under the terms of the GNU General Public License as published\n" \ - "by the Free Software Foundation; either version 2 of the License,\n" \ - "or (at your option) any later version." + "This program is free software; you can redistribute it and/or modify\n" \ + "it under the terms of the GNU General Public License as published\n" \ + "by the Free Software Foundation; either version 2 of the License,\n" \ + "or (at your option) any later version." /* Maximum length of AUTHOR, NAME and DATE tags including the terminator. */ #define ASAP_INFO_CHARS 128 @@ -72,9 +72,9 @@ extern "C" { /* Output formats. */ typedef enum { - ASAP_FORMAT_U8 = 8, /* unsigned char */ - ASAP_FORMAT_S16_LE = 16, /* signed short, little-endian */ - ASAP_FORMAT_S16_BE = -16 /* signed short, big-endian */ + ASAP_FORMAT_U8 = 8, /* unsigned char */ + ASAP_FORMAT_S16_LE = 16, /* signed short, little-endian */ + ASAP_FORMAT_S16_BE = -16 /* signed short, big-endian */ } ASAP_SampleFormat; /* Useful type definitions. */ @@ -89,106 +89,106 @@ typedef unsigned char byte; /* Information about a music file. */ typedef struct { - char author[ASAP_INFO_CHARS]; /* author's name */ - char name[ASAP_INFO_CHARS]; /* title */ - char date[ASAP_INFO_CHARS]; /* creation date */ - int channels; /* 1 for mono or 2 for stereo */ - int songs; /* number of subsongs */ - int default_song; /* 0-based index of the "main" subsong */ - int durations[ASAP_SONGS_MAX]; /* lengths of songs, in milliseconds, -1 = indeterminate */ - abool loops[ASAP_SONGS_MAX]; /* whether songs repeat or not */ - /* the following technical information should not be used outside ASAP. */ - int type; - int fastplay; - int music; - int init; - int player; - int covox_addr; - int header_len; - byte song_pos[ASAP_SONGS_MAX]; + char author[ASAP_INFO_CHARS]; /* author's name */ + char name[ASAP_INFO_CHARS]; /* title */ + char date[ASAP_INFO_CHARS]; /* creation date */ + int channels; /* 1 for mono or 2 for stereo */ + int songs; /* number of subsongs */ + int default_song; /* 0-based index of the "main" subsong */ + int durations[ASAP_SONGS_MAX]; /* lengths of songs, in milliseconds, -1 = indeterminate */ + abool loops[ASAP_SONGS_MAX]; /* whether songs repeat or not */ + /* the following technical information should not be used outside ASAP. */ + int type; + int fastplay; + int music; + int init; + int player; + int covox_addr; + int header_len; + byte song_pos[ASAP_SONGS_MAX]; } ASAP_ModuleInfo; /* POKEY state. Not for use outside the ASAP engine. */ typedef struct { - int audctl; - abool init; - int poly_index; - int div_cycles; - int mute1; - int mute2; - int mute3; - int mute4; - int audf1; - int audf2; - int audf3; - int audf4; - int audc1; - int audc2; - int audc3; - int audc4; - int tick_cycle1; - int tick_cycle2; - int tick_cycle3; - int tick_cycle4; - int period_cycles1; - int period_cycles2; - int period_cycles3; - int period_cycles4; - int reload_cycles1; - int reload_cycles3; - int out1; - int out2; - int out3; - int out4; - int delta1; - int delta2; - int delta3; - int delta4; - int skctl; - int delta_buffer[888]; + int audctl; + abool init; + int poly_index; + int div_cycles; + int mute1; + int mute2; + int mute3; + int mute4; + int audf1; + int audf2; + int audf3; + int audf4; + int audc1; + int audc2; + int audc3; + int audc4; + int tick_cycle1; + int tick_cycle2; + int tick_cycle3; + int tick_cycle4; + int period_cycles1; + int period_cycles2; + int period_cycles3; + int period_cycles4; + int reload_cycles1; + int reload_cycles3; + int out1; + int out2; + int out3; + int out4; + int delta1; + int delta2; + int delta3; + int delta4; + int skctl; + int delta_buffer[888]; } PokeyState; /* Player state. Only module_info is meant to be read outside the ASAP engine. */ typedef struct { - int cycle; - int cpu_pc; - int cpu_a; - int cpu_x; - int cpu_y; - int cpu_s; - int cpu_nz; - int cpu_c; - int cpu_vdi; - int scanline_number; - int nearest_event_cycle; - int next_scanline_cycle; - int timer1_cycle; - int timer2_cycle; - int timer4_cycle; - int irqst; - int extra_pokey_mask; - int consol; - byte covox[4]; - PokeyState base_pokey; - PokeyState extra_pokey; - int sample_offset; - int sample_index; - int samples; - int iir_acc_left; - int iir_acc_right; - ASAP_ModuleInfo module_info; - int tmc_per_frame; - int tmc_per_frame_counter; - int current_song; - int current_duration; - int blocks_played; - int silence_cycles; - int silence_cycles_counter; - byte poly9_lookup[511]; - byte poly17_lookup[16385]; - byte memory[65536]; + int cycle; + int cpu_pc; + int cpu_a; + int cpu_x; + int cpu_y; + int cpu_s; + int cpu_nz; + int cpu_c; + int cpu_vdi; + int scanline_number; + int nearest_event_cycle; + int next_scanline_cycle; + int timer1_cycle; + int timer2_cycle; + int timer4_cycle; + int irqst; + int extra_pokey_mask; + int consol; + byte covox[4]; + PokeyState base_pokey; + PokeyState extra_pokey; + int sample_offset; + int sample_index; + int samples; + int iir_acc_left; + int iir_acc_right; + ASAP_ModuleInfo module_info; + int tmc_per_frame; + int tmc_per_frame_counter; + int current_song; + int current_duration; + int blocks_played; + int silence_cycles; + int silence_cycles_counter; + byte poly9_lookup[511]; + byte poly17_lookup[16385]; + byte memory[65536]; } ASAP_State; /* Parses the string in the "mm:ss.xxx" format diff --git a/apps/codecs/libasap/players.h b/apps/codecs/libasap/players.h index 893de67821..fb90b0c76a 100644 --- a/apps/codecs/libasap/players.h +++ b/apps/codecs/libasap/players.h @@ -1,1386 +1,1386 @@ CONST_ARRAY(byte, cmc_obx) - 255,255,0,5,220,12,76,15,11,76,120,5,76,203,7,0, - 0,0,0,0,0,0,0,0,160,227,237,227,160,240,236,225, - 249,229,242,160,246,160,178,174,177,160,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255, - 255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,128,128,128,128,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,141,110, - 5,142,111,5,140,112,5,41,112,74,74,74,170,189,145,11, - 141,169,5,189,146,11,141,170,5,169,3,141,15,210,216,165, - 254,72,165,255,72,172,112,5,174,111,5,173,110,5,32,178, - 5,104,133,255,104,133,254,96,173,118,5,133,254,173,119,5, - 133,255,160,0,138,240,28,177,254,201,143,240,4,201,239,208, - 12,202,208,9,200,192,84,176,9,152,170,16,6,200,192,84, - 144,229,96,142,104,5,32,123,6,169,0,162,9,157,69,5, - 202,16,250,141,103,5,169,1,141,113,5,169,255,141,106,5, - 173,114,5,133,254,173,115,5,133,255,160,19,177,254,170,173, - 118,5,133,254,173,119,5,133,255,172,104,5,177,254,201,207, - 208,13,152,24,105,85,168,177,254,48,15,170,76,52,6,201, - 143,240,7,201,239,240,3,136,16,226,142,108,5,142,109,5, - 96,41,15,240,245,142,218,10,142,240,10,142,255,10,140,219, - 10,140,241,10,140,0,11,96,142,114,5,134,254,140,115,5, - 132,255,24,138,105,20,141,116,5,152,105,0,141,117,5,142, - 118,5,200,200,140,119,5,160,19,177,254,141,108,5,141,109, - 5,162,8,169,0,141,113,5,157,0,210,224,3,176,8,157, - 9,5,169,255,157,57,5,202,16,233,169,128,162,3,157,75, - 5,202,16,250,96,169,1,141,113,5,169,0,240,238,41,3, - 201,3,240,240,224,64,176,236,192,26,176,232,170,169,128,157, - 75,5,169,0,157,57,5,157,60,5,157,63,5,173,111,5, - 157,12,5,173,112,5,10,10,10,133,254,24,173,114,5,105, - 48,72,173,115,5,105,1,168,104,24,101,254,157,97,5,152, - 105,0,157,100,5,24,173,114,5,105,148,133,254,173,115,5, - 105,0,133,255,173,112,5,10,109,112,5,10,168,177,254,157, - 79,5,200,177,254,157,82,5,41,7,141,110,5,200,177,254, - 157,85,5,200,177,254,157,88,5,200,177,254,157,91,5,200, - 177,254,157,94,5,160,0,173,110,5,201,3,208,2,160,2, - 201,7,208,2,160,4,185,175,11,133,254,185,176,11,133,255, - 189,85,5,74,74,74,74,24,109,111,5,141,111,5,141,194, - 7,168,173,110,5,201,7,208,15,152,10,168,177,254,157,45, - 5,200,140,111,5,76,131,7,177,254,157,45,5,189,85,5, - 41,15,24,109,111,5,141,111,5,172,111,5,173,110,5,201, - 5,8,177,254,40,240,8,221,45,5,208,3,56,233,1,157, - 48,5,189,79,5,72,41,3,168,185,181,11,157,54,5,104, - 74,74,74,74,160,62,201,15,240,16,160,55,201,14,240,10, - 160,48,201,13,240,4,24,105,0,168,185,185,11,157,51,5, - 96,216,165,252,72,165,253,72,165,254,72,165,255,72,173,113, - 5,208,3,76,2,11,173,78,5,240,3,76,107,9,173,108, - 5,205,109,5,240,3,76,88,9,173,103,5,240,3,76,220, - 8,162,2,188,75,5,48,3,157,75,5,157,69,5,202,16, - 242,173,118,5,133,252,173,119,5,133,253,172,104,5,132,254, - 204,106,5,208,25,173,107,5,240,20,173,104,5,172,105,5, - 140,104,5,206,107,5,208,232,141,104,5,168,16,226,162,0, - 177,252,201,254,208,14,172,104,5,200,196,254,240,67,140,104, - 5,76,26,8,157,66,5,24,152,105,85,168,232,224,3,144, - 223,172,104,5,177,252,16,122,201,255,240,118,74,74,74,41, - 14,170,189,161,11,141,126,8,189,162,11,141,127,8,173,67, - 5,133,255,32,147,8,140,104,5,192,85,176,4,196,254,208, - 143,164,254,140,104,5,76,2,11,32,148,6,160,255,96,48, - 251,168,96,48,247,56,152,229,255,168,96,48,239,24,152,101, - 255,168,96,48,231,141,108,5,141,109,5,200,96,48,221,173, - 68,5,48,216,141,107,5,200,140,105,5,24,152,101,255,141, - 106,5,96,136,48,10,177,252,201,143,240,4,201,239,208,243, - 200,96,162,2,189,72,5,240,5,222,72,5,16,99,189,75, - 5,208,94,188,66,5,192,64,176,87,173,116,5,133,252,173, - 117,5,133,253,177,252,133,254,24,152,105,64,168,177,252,133, - 255,37,254,201,255,240,58,188,69,5,177,254,41,192,208,12, - 177,254,41,63,157,15,5,254,69,5,16,235,201,64,208,19, - 177,254,41,63,141,111,5,189,15,5,141,112,5,32,188,6, - 76,72,9,201,128,208,10,177,254,41,63,157,72,5,254,69, - 5,202,16,144,174,103,5,232,138,41,63,141,103,5,206,109, - 5,208,14,173,108,5,141,109,5,173,103,5,208,3,238,104, - 5,172,48,5,173,82,5,41,7,201,5,240,4,201,6,208, - 1,136,140,39,5,160,0,201,5,240,4,201,6,208,2,160, - 2,201,7,208,2,160,40,140,44,5,162,2,189,82,5,41, - 224,157,40,5,189,97,5,133,252,189,100,5,133,253,189,57, - 5,201,255,240,54,201,15,208,32,189,63,5,240,45,222,63, - 5,189,63,5,208,37,188,9,5,240,1,136,152,157,9,5, - 189,88,5,157,63,5,76,229,9,189,57,5,74,168,177,252, - 144,4,74,74,74,74,41,15,157,9,5,188,45,5,189,82, - 5,41,7,201,1,208,31,136,152,200,221,48,5,8,169,1, - 40,208,2,10,10,61,60,5,240,12,188,48,5,192,255,208, - 5,169,0,157,9,5,152,157,36,5,169,1,141,110,5,189, - 57,5,201,15,240,56,41,7,168,185,205,12,133,254,189,57, - 5,41,8,8,138,40,24,240,2,105,3,168,185,91,5,37, - 254,240,27,189,51,5,157,36,5,142,110,5,202,16,8,141, - 39,5,169,0,141,44,5,232,189,54,5,157,40,5,189,57, - 5,41,15,201,15,240,16,254,57,5,189,57,5,201,15,208, - 6,189,88,5,157,63,5,189,75,5,16,10,189,9,5,208, - 5,169,64,157,75,5,254,60,5,160,0,189,82,5,74,74, - 74,74,144,1,136,74,144,1,200,24,152,125,45,5,157,45, - 5,189,48,5,201,255,208,2,160,0,24,152,125,48,5,157, - 48,5,202,48,3,76,150,9,173,40,5,141,43,5,173,82, - 5,41,7,170,160,3,173,110,5,240,3,188,213,12,152,72, - 185,185,12,8,41,127,170,152,41,3,10,168,189,36,5,153, - 0,210,200,189,9,5,224,3,208,3,173,9,5,29,40,5, - 40,16,2,169,0,153,0,210,104,168,136,41,3,208,207,160, - 8,173,44,5,153,0,210,24,104,133,255,104,133,254,104,133, - 253,104,133,252,96,104,170,240,78,201,2,240,6,104,104,202, - 208,251,96,165,20,197,20,240,252,173,36,2,201,134,208,7, - 173,37,2,201,11,240,230,173,36,2,141,143,11,173,37,2, - 141,144,11,169,134,141,36,2,169,11,141,37,2,104,104,240, - 3,56,233,1,141,93,11,104,168,104,170,169,112,32,120,5, - 169,0,162,0,76,120,5,165,20,197,20,240,252,173,36,2, - 201,134,208,174,173,37,2,201,11,208,167,173,143,11,141,36, - 2,173,144,11,141,37,2,169,64,76,120,5,32,203,7,144, - 3,32,117,11,76,255,255,178,5,221,5,168,6,59,6,123, - 6,148,6,159,6,82,6,147,8,153,8,157,8,165,8,173, - 8,183,8,205,8,185,11,250,11,59,12,128,160,32,64,255, - 241,228,215,203,192,181,170,161,152,143,135,127,120,114,107,101, - 95,90,85,80,75,71,67,63,60,56,53,50,47,44,42,39, - 37,35,33,31,29,28,26,24,23,22,20,19,18,17,16,15, - 14,13,12,11,10,9,8,7,6,5,4,3,2,1,0,0, - 0,0,0,0,242,233,218,206,191,182,170,161,152,143,137,128, - 122,113,107,101,95,0,86,80,103,96,90,85,81,76,72,67, - 63,61,57,52,51,57,45,42,40,37,36,33,31,30,0,0, - 15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0, - 0,56,11,140,10,0,10,106,9,232,8,106,8,239,7,128, - 7,8,7,174,6,70,6,230,5,149,5,65,5,246,4,176, - 4,110,4,48,4,246,3,187,3,132,3,82,3,34,3,244, - 2,200,2,160,2,122,2,85,2,52,2,20,2,245,1,216, - 1,189,1,164,1,141,1,119,1,96,1,78,1,56,1,39, - 1,21,1,6,1,247,0,232,0,219,0,207,0,195,0,184, - 0,172,0,162,0,154,0,144,0,136,0,127,0,120,0,112, - 0,106,0,100,0,94,0,87,0,82,0,50,0,10,0,0, - 1,2,131,0,1,2,3,1,0,2,131,1,0,2,3,1, - 2,128,3,128,64,32,16,8,4,2,1,3,3,3,3,7, - 11,15,19 + 255,255,0,5,220,12,76,15,11,76,120,5,76,203,7,0, + 0,0,0,0,0,0,0,0,160,227,237,227,160,240,236,225, + 249,229,242,160,246,160,178,174,177,160,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255, + 255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,128,128,128,128,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,141,110, + 5,142,111,5,140,112,5,41,112,74,74,74,170,189,145,11, + 141,169,5,189,146,11,141,170,5,169,3,141,15,210,216,165, + 254,72,165,255,72,172,112,5,174,111,5,173,110,5,32,178, + 5,104,133,255,104,133,254,96,173,118,5,133,254,173,119,5, + 133,255,160,0,138,240,28,177,254,201,143,240,4,201,239,208, + 12,202,208,9,200,192,84,176,9,152,170,16,6,200,192,84, + 144,229,96,142,104,5,32,123,6,169,0,162,9,157,69,5, + 202,16,250,141,103,5,169,1,141,113,5,169,255,141,106,5, + 173,114,5,133,254,173,115,5,133,255,160,19,177,254,170,173, + 118,5,133,254,173,119,5,133,255,172,104,5,177,254,201,207, + 208,13,152,24,105,85,168,177,254,48,15,170,76,52,6,201, + 143,240,7,201,239,240,3,136,16,226,142,108,5,142,109,5, + 96,41,15,240,245,142,218,10,142,240,10,142,255,10,140,219, + 10,140,241,10,140,0,11,96,142,114,5,134,254,140,115,5, + 132,255,24,138,105,20,141,116,5,152,105,0,141,117,5,142, + 118,5,200,200,140,119,5,160,19,177,254,141,108,5,141,109, + 5,162,8,169,0,141,113,5,157,0,210,224,3,176,8,157, + 9,5,169,255,157,57,5,202,16,233,169,128,162,3,157,75, + 5,202,16,250,96,169,1,141,113,5,169,0,240,238,41,3, + 201,3,240,240,224,64,176,236,192,26,176,232,170,169,128,157, + 75,5,169,0,157,57,5,157,60,5,157,63,5,173,111,5, + 157,12,5,173,112,5,10,10,10,133,254,24,173,114,5,105, + 48,72,173,115,5,105,1,168,104,24,101,254,157,97,5,152, + 105,0,157,100,5,24,173,114,5,105,148,133,254,173,115,5, + 105,0,133,255,173,112,5,10,109,112,5,10,168,177,254,157, + 79,5,200,177,254,157,82,5,41,7,141,110,5,200,177,254, + 157,85,5,200,177,254,157,88,5,200,177,254,157,91,5,200, + 177,254,157,94,5,160,0,173,110,5,201,3,208,2,160,2, + 201,7,208,2,160,4,185,175,11,133,254,185,176,11,133,255, + 189,85,5,74,74,74,74,24,109,111,5,141,111,5,141,194, + 7,168,173,110,5,201,7,208,15,152,10,168,177,254,157,45, + 5,200,140,111,5,76,131,7,177,254,157,45,5,189,85,5, + 41,15,24,109,111,5,141,111,5,172,111,5,173,110,5,201, + 5,8,177,254,40,240,8,221,45,5,208,3,56,233,1,157, + 48,5,189,79,5,72,41,3,168,185,181,11,157,54,5,104, + 74,74,74,74,160,62,201,15,240,16,160,55,201,14,240,10, + 160,48,201,13,240,4,24,105,0,168,185,185,11,157,51,5, + 96,216,165,252,72,165,253,72,165,254,72,165,255,72,173,113, + 5,208,3,76,2,11,173,78,5,240,3,76,107,9,173,108, + 5,205,109,5,240,3,76,88,9,173,103,5,240,3,76,220, + 8,162,2,188,75,5,48,3,157,75,5,157,69,5,202,16, + 242,173,118,5,133,252,173,119,5,133,253,172,104,5,132,254, + 204,106,5,208,25,173,107,5,240,20,173,104,5,172,105,5, + 140,104,5,206,107,5,208,232,141,104,5,168,16,226,162,0, + 177,252,201,254,208,14,172,104,5,200,196,254,240,67,140,104, + 5,76,26,8,157,66,5,24,152,105,85,168,232,224,3,144, + 223,172,104,5,177,252,16,122,201,255,240,118,74,74,74,41, + 14,170,189,161,11,141,126,8,189,162,11,141,127,8,173,67, + 5,133,255,32,147,8,140,104,5,192,85,176,4,196,254,208, + 143,164,254,140,104,5,76,2,11,32,148,6,160,255,96,48, + 251,168,96,48,247,56,152,229,255,168,96,48,239,24,152,101, + 255,168,96,48,231,141,108,5,141,109,5,200,96,48,221,173, + 68,5,48,216,141,107,5,200,140,105,5,24,152,101,255,141, + 106,5,96,136,48,10,177,252,201,143,240,4,201,239,208,243, + 200,96,162,2,189,72,5,240,5,222,72,5,16,99,189,75, + 5,208,94,188,66,5,192,64,176,87,173,116,5,133,252,173, + 117,5,133,253,177,252,133,254,24,152,105,64,168,177,252,133, + 255,37,254,201,255,240,58,188,69,5,177,254,41,192,208,12, + 177,254,41,63,157,15,5,254,69,5,16,235,201,64,208,19, + 177,254,41,63,141,111,5,189,15,5,141,112,5,32,188,6, + 76,72,9,201,128,208,10,177,254,41,63,157,72,5,254,69, + 5,202,16,144,174,103,5,232,138,41,63,141,103,5,206,109, + 5,208,14,173,108,5,141,109,5,173,103,5,208,3,238,104, + 5,172,48,5,173,82,5,41,7,201,5,240,4,201,6,208, + 1,136,140,39,5,160,0,201,5,240,4,201,6,208,2,160, + 2,201,7,208,2,160,40,140,44,5,162,2,189,82,5,41, + 224,157,40,5,189,97,5,133,252,189,100,5,133,253,189,57, + 5,201,255,240,54,201,15,208,32,189,63,5,240,45,222,63, + 5,189,63,5,208,37,188,9,5,240,1,136,152,157,9,5, + 189,88,5,157,63,5,76,229,9,189,57,5,74,168,177,252, + 144,4,74,74,74,74,41,15,157,9,5,188,45,5,189,82, + 5,41,7,201,1,208,31,136,152,200,221,48,5,8,169,1, + 40,208,2,10,10,61,60,5,240,12,188,48,5,192,255,208, + 5,169,0,157,9,5,152,157,36,5,169,1,141,110,5,189, + 57,5,201,15,240,56,41,7,168,185,205,12,133,254,189,57, + 5,41,8,8,138,40,24,240,2,105,3,168,185,91,5,37, + 254,240,27,189,51,5,157,36,5,142,110,5,202,16,8,141, + 39,5,169,0,141,44,5,232,189,54,5,157,40,5,189,57, + 5,41,15,201,15,240,16,254,57,5,189,57,5,201,15,208, + 6,189,88,5,157,63,5,189,75,5,16,10,189,9,5,208, + 5,169,64,157,75,5,254,60,5,160,0,189,82,5,74,74, + 74,74,144,1,136,74,144,1,200,24,152,125,45,5,157,45, + 5,189,48,5,201,255,208,2,160,0,24,152,125,48,5,157, + 48,5,202,48,3,76,150,9,173,40,5,141,43,5,173,82, + 5,41,7,170,160,3,173,110,5,240,3,188,213,12,152,72, + 185,185,12,8,41,127,170,152,41,3,10,168,189,36,5,153, + 0,210,200,189,9,5,224,3,208,3,173,9,5,29,40,5, + 40,16,2,169,0,153,0,210,104,168,136,41,3,208,207,160, + 8,173,44,5,153,0,210,24,104,133,255,104,133,254,104,133, + 253,104,133,252,96,104,170,240,78,201,2,240,6,104,104,202, + 208,251,96,165,20,197,20,240,252,173,36,2,201,134,208,7, + 173,37,2,201,11,240,230,173,36,2,141,143,11,173,37,2, + 141,144,11,169,134,141,36,2,169,11,141,37,2,104,104,240, + 3,56,233,1,141,93,11,104,168,104,170,169,112,32,120,5, + 169,0,162,0,76,120,5,165,20,197,20,240,252,173,36,2, + 201,134,208,174,173,37,2,201,11,208,167,173,143,11,141,36, + 2,173,144,11,141,37,2,169,64,76,120,5,32,203,7,144, + 3,32,117,11,76,255,255,178,5,221,5,168,6,59,6,123, + 6,148,6,159,6,82,6,147,8,153,8,157,8,165,8,173, + 8,183,8,205,8,185,11,250,11,59,12,128,160,32,64,255, + 241,228,215,203,192,181,170,161,152,143,135,127,120,114,107,101, + 95,90,85,80,75,71,67,63,60,56,53,50,47,44,42,39, + 37,35,33,31,29,28,26,24,23,22,20,19,18,17,16,15, + 14,13,12,11,10,9,8,7,6,5,4,3,2,1,0,0, + 0,0,0,0,242,233,218,206,191,182,170,161,152,143,137,128, + 122,113,107,101,95,0,86,80,103,96,90,85,81,76,72,67, + 63,61,57,52,51,57,45,42,40,37,36,33,31,30,0,0, + 15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0, + 0,56,11,140,10,0,10,106,9,232,8,106,8,239,7,128, + 7,8,7,174,6,70,6,230,5,149,5,65,5,246,4,176, + 4,110,4,48,4,246,3,187,3,132,3,82,3,34,3,244, + 2,200,2,160,2,122,2,85,2,52,2,20,2,245,1,216, + 1,189,1,164,1,141,1,119,1,96,1,78,1,56,1,39, + 1,21,1,6,1,247,0,232,0,219,0,207,0,195,0,184, + 0,172,0,162,0,154,0,144,0,136,0,127,0,120,0,112, + 0,106,0,100,0,94,0,87,0,82,0,50,0,10,0,0, + 1,2,131,0,1,2,3,1,0,2,131,1,0,2,3,1, + 2,128,3,128,64,32,16,8,4,2,1,3,3,3,3,7, + 11,15,19 END_CONST_ARRAY; CONST_ARRAY(byte, cm3_obx) - 255,255,0,5,223,12,76,18,11,76,120,5,76,203,7,0, - 0,0,0,0,0,0,0,0,160,227,237,227,160,240,236,225, - 249,229,242,160,246,160,178,174,177,160,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255, - 255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,128,128,128,128,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,141,110, - 5,142,111,5,140,112,5,41,112,74,74,74,170,189,148,11, - 141,169,5,189,149,11,141,170,5,169,3,141,15,210,216,165, - 254,72,165,255,72,172,112,5,174,111,5,173,110,5,32,178, - 5,104,133,255,104,133,254,96,173,118,5,133,254,173,119,5, - 133,255,160,0,138,240,28,177,254,201,143,240,4,201,239,208, - 12,202,208,9,200,192,84,176,9,152,170,16,6,200,192,84, - 144,229,96,142,104,5,32,123,6,169,0,162,9,157,69,5, - 202,16,250,141,103,5,169,1,141,113,5,169,255,141,106,5, - 173,114,5,133,254,173,115,5,133,255,160,19,177,254,170,173, - 118,5,133,254,173,119,5,133,255,172,104,5,177,254,201,207, - 208,13,152,24,105,85,168,177,254,48,15,170,76,52,6,201, - 143,240,7,201,239,240,3,136,16,226,142,108,5,142,109,5, - 96,41,15,240,245,142,221,10,142,243,10,142,2,11,140,222, - 10,140,244,10,140,3,11,96,142,114,5,134,254,140,115,5, - 132,255,24,138,105,20,141,116,5,152,105,0,141,117,5,142, - 118,5,200,200,140,119,5,160,19,177,254,141,108,5,141,109, - 5,162,8,169,0,141,113,5,157,0,210,224,3,176,8,157, - 9,5,169,255,157,57,5,202,16,233,169,128,162,3,157,75, - 5,202,16,250,96,169,1,141,113,5,169,0,240,238,41,3, - 201,3,240,240,224,64,176,236,192,26,176,232,170,169,128,157, - 75,5,169,0,157,57,5,157,60,5,157,63,5,173,111,5, - 157,12,5,173,112,5,10,10,10,133,254,24,173,114,5,105, - 48,72,173,115,5,105,1,168,104,24,101,254,157,97,5,152, - 105,0,157,100,5,24,173,114,5,105,148,133,254,173,115,5, - 105,0,133,255,173,112,5,10,109,112,5,10,168,177,254,157, - 79,5,200,177,254,157,82,5,41,7,141,110,5,200,177,254, - 157,85,5,200,177,254,157,88,5,200,177,254,157,91,5,200, - 177,254,157,94,5,160,0,173,110,5,201,3,208,2,160,2, - 201,7,208,2,160,4,185,178,11,133,254,185,179,11,133,255, - 189,85,5,74,74,74,74,24,109,111,5,141,111,5,141,194, - 7,168,173,110,5,201,7,208,15,152,10,168,177,254,157,45, - 5,200,140,111,5,76,131,7,177,254,157,45,5,189,85,5, - 41,15,24,109,111,5,141,111,5,172,111,5,173,110,5,201, - 5,8,177,254,40,240,8,221,45,5,208,3,56,233,1,157, - 48,5,189,79,5,72,41,3,168,185,184,11,157,54,5,104, - 74,74,74,74,160,62,201,15,240,16,160,55,201,14,240,10, - 160,48,201,13,240,4,24,105,0,168,185,188,11,157,51,5, - 96,216,165,252,72,165,253,72,165,254,72,165,255,72,173,113, - 5,208,3,76,5,11,173,78,5,240,3,76,110,9,173,108, - 5,205,109,5,240,3,76,91,9,173,103,5,240,3,76,220, - 8,162,2,188,75,5,48,3,157,75,5,157,69,5,202,16, - 242,173,118,5,133,252,173,119,5,133,253,172,104,5,132,254, - 204,106,5,208,25,173,107,5,240,20,173,104,5,172,105,5, - 140,104,5,206,107,5,208,232,141,104,5,168,16,226,162,0, - 177,252,201,254,208,14,172,104,5,200,196,254,240,67,140,104, - 5,76,26,8,157,66,5,24,152,105,85,168,232,224,3,144, - 223,172,104,5,177,252,16,122,201,255,240,118,74,74,74,41, - 14,170,189,164,11,141,126,8,189,165,11,141,127,8,173,67, - 5,133,255,32,147,8,140,104,5,192,85,176,4,196,254,208, - 143,164,254,140,104,5,76,5,11,32,148,6,160,255,96,48, - 251,168,96,48,247,56,152,229,255,168,96,48,239,24,152,101, - 255,168,96,48,231,141,108,5,141,109,5,200,96,48,221,173, - 68,5,48,216,141,107,5,200,140,105,5,24,152,101,255,141, - 106,5,96,136,48,10,177,252,201,143,240,4,201,239,208,243, - 200,96,162,2,189,72,5,240,5,222,72,5,16,99,189,75, - 5,208,94,188,66,5,192,64,176,87,173,116,5,133,252,173, - 117,5,133,253,177,252,133,254,24,152,105,64,168,177,252,133, - 255,37,254,201,255,240,58,188,69,5,177,254,41,192,208,12, - 177,254,41,63,157,15,5,254,69,5,16,235,201,64,208,19, - 177,254,41,63,141,111,5,189,15,5,141,112,5,32,188,6, - 76,72,9,201,128,208,10,177,254,41,63,157,72,5,254,69, - 5,202,16,144,174,103,5,232,224,48,144,2,162,0,142,103, - 5,206,109,5,208,14,173,108,5,141,109,5,173,103,5,208, - 3,238,104,5,172,48,5,173,82,5,41,7,201,5,240,4, - 201,6,208,1,136,140,39,5,160,0,201,5,240,4,201,6, - 208,2,160,2,201,7,208,2,160,40,140,44,5,162,2,189, - 82,5,41,224,157,40,5,189,97,5,133,252,189,100,5,133, - 253,189,57,5,201,255,240,54,201,15,208,32,189,63,5,240, - 45,222,63,5,189,63,5,208,37,188,9,5,240,1,136,152, - 157,9,5,189,88,5,157,63,5,76,232,9,189,57,5,74, - 168,177,252,144,4,74,74,74,74,41,15,157,9,5,188,45, - 5,189,82,5,41,7,201,1,208,31,136,152,200,221,48,5, - 8,169,1,40,208,2,10,10,61,60,5,240,12,188,48,5, - 192,255,208,5,169,0,157,9,5,152,157,36,5,169,1,141, - 110,5,189,57,5,201,15,240,56,41,7,168,185,208,12,133, - 254,189,57,5,41,8,8,138,40,24,240,2,105,3,168,185, - 91,5,37,254,240,27,189,51,5,157,36,5,142,110,5,202, - 16,8,141,39,5,169,0,141,44,5,232,189,54,5,157,40, - 5,189,57,5,41,15,201,15,240,16,254,57,5,189,57,5, - 201,15,208,6,189,88,5,157,63,5,189,75,5,16,10,189, - 9,5,208,5,169,64,157,75,5,254,60,5,160,0,189,82, - 5,74,74,74,74,144,1,136,74,144,1,200,24,152,125,45, - 5,157,45,5,189,48,5,201,255,208,2,160,0,24,152,125, - 48,5,157,48,5,202,48,3,76,153,9,173,40,5,141,43, - 5,173,82,5,41,7,170,160,3,173,110,5,240,3,188,216, - 12,152,72,185,188,12,8,41,127,170,152,41,3,10,168,189, - 36,5,153,0,210,200,189,9,5,224,3,208,3,173,9,5, - 29,40,5,40,16,2,169,0,153,0,210,104,168,136,41,3, - 208,207,160,8,173,44,5,153,0,210,24,104,133,255,104,133, - 254,104,133,253,104,133,252,96,104,170,240,78,201,2,240,6, - 104,104,202,208,251,96,165,20,197,20,240,252,173,36,2,201, - 137,208,7,173,37,2,201,11,240,230,173,36,2,141,146,11, - 173,37,2,141,147,11,169,137,141,36,2,169,11,141,37,2, - 104,104,240,3,56,233,1,141,96,11,104,168,104,170,169,112, - 32,120,5,169,0,162,0,76,120,5,165,20,197,20,240,252, - 173,36,2,201,137,208,174,173,37,2,201,11,208,167,173,146, - 11,141,36,2,173,147,11,141,37,2,169,64,76,120,5,32, - 203,7,144,3,32,120,11,76,255,255,178,5,221,5,168,6, - 59,6,123,6,148,6,159,6,82,6,147,8,153,8,157,8, - 165,8,173,8,183,8,205,8,188,11,253,11,62,12,128,160, - 32,64,255,241,228,215,203,192,181,170,161,152,143,135,127,120, - 114,107,101,95,90,85,80,75,71,67,63,60,56,53,50,47, - 44,42,39,37,35,33,31,29,28,26,24,23,22,20,19,18, - 17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2, - 1,0,0,0,0,0,0,242,233,218,206,191,182,170,161,152, - 143,137,128,122,113,107,101,95,0,86,80,103,96,90,85,81, - 76,72,67,63,61,57,52,51,57,45,42,40,37,36,33,31, - 30,0,0,15,14,13,12,11,10,9,8,7,6,5,4,3, - 2,1,0,0,56,11,140,10,0,10,106,9,232,8,106,8, - 239,7,128,7,8,7,174,6,70,6,230,5,149,5,65,5, - 246,4,176,4,110,4,48,4,246,3,187,3,132,3,82,3, - 34,3,244,2,200,2,160,2,122,2,85,2,52,2,20,2, - 245,1,216,1,189,1,164,1,141,1,119,1,96,1,78,1, - 56,1,39,1,21,1,6,1,247,0,232,0,219,0,207,0, - 195,0,184,0,172,0,162,0,154,0,144,0,136,0,127,0, - 120,0,112,0,106,0,100,0,94,0,87,0,82,0,50,0, - 10,0,0,1,2,131,0,1,2,3,1,0,2,131,1,0, - 2,3,1,2,128,3,128,64,32,16,8,4,2,1,3,3, - 3,3,7,11,15,19 + 255,255,0,5,223,12,76,18,11,76,120,5,76,203,7,0, + 0,0,0,0,0,0,0,0,160,227,237,227,160,240,236,225, + 249,229,242,160,246,160,178,174,177,160,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255, + 255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,128,128,128,128,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,141,110, + 5,142,111,5,140,112,5,41,112,74,74,74,170,189,148,11, + 141,169,5,189,149,11,141,170,5,169,3,141,15,210,216,165, + 254,72,165,255,72,172,112,5,174,111,5,173,110,5,32,178, + 5,104,133,255,104,133,254,96,173,118,5,133,254,173,119,5, + 133,255,160,0,138,240,28,177,254,201,143,240,4,201,239,208, + 12,202,208,9,200,192,84,176,9,152,170,16,6,200,192,84, + 144,229,96,142,104,5,32,123,6,169,0,162,9,157,69,5, + 202,16,250,141,103,5,169,1,141,113,5,169,255,141,106,5, + 173,114,5,133,254,173,115,5,133,255,160,19,177,254,170,173, + 118,5,133,254,173,119,5,133,255,172,104,5,177,254,201,207, + 208,13,152,24,105,85,168,177,254,48,15,170,76,52,6,201, + 143,240,7,201,239,240,3,136,16,226,142,108,5,142,109,5, + 96,41,15,240,245,142,221,10,142,243,10,142,2,11,140,222, + 10,140,244,10,140,3,11,96,142,114,5,134,254,140,115,5, + 132,255,24,138,105,20,141,116,5,152,105,0,141,117,5,142, + 118,5,200,200,140,119,5,160,19,177,254,141,108,5,141,109, + 5,162,8,169,0,141,113,5,157,0,210,224,3,176,8,157, + 9,5,169,255,157,57,5,202,16,233,169,128,162,3,157,75, + 5,202,16,250,96,169,1,141,113,5,169,0,240,238,41,3, + 201,3,240,240,224,64,176,236,192,26,176,232,170,169,128,157, + 75,5,169,0,157,57,5,157,60,5,157,63,5,173,111,5, + 157,12,5,173,112,5,10,10,10,133,254,24,173,114,5,105, + 48,72,173,115,5,105,1,168,104,24,101,254,157,97,5,152, + 105,0,157,100,5,24,173,114,5,105,148,133,254,173,115,5, + 105,0,133,255,173,112,5,10,109,112,5,10,168,177,254,157, + 79,5,200,177,254,157,82,5,41,7,141,110,5,200,177,254, + 157,85,5,200,177,254,157,88,5,200,177,254,157,91,5,200, + 177,254,157,94,5,160,0,173,110,5,201,3,208,2,160,2, + 201,7,208,2,160,4,185,178,11,133,254,185,179,11,133,255, + 189,85,5,74,74,74,74,24,109,111,5,141,111,5,141,194, + 7,168,173,110,5,201,7,208,15,152,10,168,177,254,157,45, + 5,200,140,111,5,76,131,7,177,254,157,45,5,189,85,5, + 41,15,24,109,111,5,141,111,5,172,111,5,173,110,5,201, + 5,8,177,254,40,240,8,221,45,5,208,3,56,233,1,157, + 48,5,189,79,5,72,41,3,168,185,184,11,157,54,5,104, + 74,74,74,74,160,62,201,15,240,16,160,55,201,14,240,10, + 160,48,201,13,240,4,24,105,0,168,185,188,11,157,51,5, + 96,216,165,252,72,165,253,72,165,254,72,165,255,72,173,113, + 5,208,3,76,5,11,173,78,5,240,3,76,110,9,173,108, + 5,205,109,5,240,3,76,91,9,173,103,5,240,3,76,220, + 8,162,2,188,75,5,48,3,157,75,5,157,69,5,202,16, + 242,173,118,5,133,252,173,119,5,133,253,172,104,5,132,254, + 204,106,5,208,25,173,107,5,240,20,173,104,5,172,105,5, + 140,104,5,206,107,5,208,232,141,104,5,168,16,226,162,0, + 177,252,201,254,208,14,172,104,5,200,196,254,240,67,140,104, + 5,76,26,8,157,66,5,24,152,105,85,168,232,224,3,144, + 223,172,104,5,177,252,16,122,201,255,240,118,74,74,74,41, + 14,170,189,164,11,141,126,8,189,165,11,141,127,8,173,67, + 5,133,255,32,147,8,140,104,5,192,85,176,4,196,254,208, + 143,164,254,140,104,5,76,5,11,32,148,6,160,255,96,48, + 251,168,96,48,247,56,152,229,255,168,96,48,239,24,152,101, + 255,168,96,48,231,141,108,5,141,109,5,200,96,48,221,173, + 68,5,48,216,141,107,5,200,140,105,5,24,152,101,255,141, + 106,5,96,136,48,10,177,252,201,143,240,4,201,239,208,243, + 200,96,162,2,189,72,5,240,5,222,72,5,16,99,189,75, + 5,208,94,188,66,5,192,64,176,87,173,116,5,133,252,173, + 117,5,133,253,177,252,133,254,24,152,105,64,168,177,252,133, + 255,37,254,201,255,240,58,188,69,5,177,254,41,192,208,12, + 177,254,41,63,157,15,5,254,69,5,16,235,201,64,208,19, + 177,254,41,63,141,111,5,189,15,5,141,112,5,32,188,6, + 76,72,9,201,128,208,10,177,254,41,63,157,72,5,254,69, + 5,202,16,144,174,103,5,232,224,48,144,2,162,0,142,103, + 5,206,109,5,208,14,173,108,5,141,109,5,173,103,5,208, + 3,238,104,5,172,48,5,173,82,5,41,7,201,5,240,4, + 201,6,208,1,136,140,39,5,160,0,201,5,240,4,201,6, + 208,2,160,2,201,7,208,2,160,40,140,44,5,162,2,189, + 82,5,41,224,157,40,5,189,97,5,133,252,189,100,5,133, + 253,189,57,5,201,255,240,54,201,15,208,32,189,63,5,240, + 45,222,63,5,189,63,5,208,37,188,9,5,240,1,136,152, + 157,9,5,189,88,5,157,63,5,76,232,9,189,57,5,74, + 168,177,252,144,4,74,74,74,74,41,15,157,9,5,188,45, + 5,189,82,5,41,7,201,1,208,31,136,152,200,221,48,5, + 8,169,1,40,208,2,10,10,61,60,5,240,12,188,48,5, + 192,255,208,5,169,0,157,9,5,152,157,36,5,169,1,141, + 110,5,189,57,5,201,15,240,56,41,7,168,185,208,12,133, + 254,189,57,5,41,8,8,138,40,24,240,2,105,3,168,185, + 91,5,37,254,240,27,189,51,5,157,36,5,142,110,5,202, + 16,8,141,39,5,169,0,141,44,5,232,189,54,5,157,40, + 5,189,57,5,41,15,201,15,240,16,254,57,5,189,57,5, + 201,15,208,6,189,88,5,157,63,5,189,75,5,16,10,189, + 9,5,208,5,169,64,157,75,5,254,60,5,160,0,189,82, + 5,74,74,74,74,144,1,136,74,144,1,200,24,152,125,45, + 5,157,45,5,189,48,5,201,255,208,2,160,0,24,152,125, + 48,5,157,48,5,202,48,3,76,153,9,173,40,5,141,43, + 5,173,82,5,41,7,170,160,3,173,110,5,240,3,188,216, + 12,152,72,185,188,12,8,41,127,170,152,41,3,10,168,189, + 36,5,153,0,210,200,189,9,5,224,3,208,3,173,9,5, + 29,40,5,40,16,2,169,0,153,0,210,104,168,136,41,3, + 208,207,160,8,173,44,5,153,0,210,24,104,133,255,104,133, + 254,104,133,253,104,133,252,96,104,170,240,78,201,2,240,6, + 104,104,202,208,251,96,165,20,197,20,240,252,173,36,2,201, + 137,208,7,173,37,2,201,11,240,230,173,36,2,141,146,11, + 173,37,2,141,147,11,169,137,141,36,2,169,11,141,37,2, + 104,104,240,3,56,233,1,141,96,11,104,168,104,170,169,112, + 32,120,5,169,0,162,0,76,120,5,165,20,197,20,240,252, + 173,36,2,201,137,208,174,173,37,2,201,11,208,167,173,146, + 11,141,36,2,173,147,11,141,37,2,169,64,76,120,5,32, + 203,7,144,3,32,120,11,76,255,255,178,5,221,5,168,6, + 59,6,123,6,148,6,159,6,82,6,147,8,153,8,157,8, + 165,8,173,8,183,8,205,8,188,11,253,11,62,12,128,160, + 32,64,255,241,228,215,203,192,181,170,161,152,143,135,127,120, + 114,107,101,95,90,85,80,75,71,67,63,60,56,53,50,47, + 44,42,39,37,35,33,31,29,28,26,24,23,22,20,19,18, + 17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2, + 1,0,0,0,0,0,0,242,233,218,206,191,182,170,161,152, + 143,137,128,122,113,107,101,95,0,86,80,103,96,90,85,81, + 76,72,67,63,61,57,52,51,57,45,42,40,37,36,33,31, + 30,0,0,15,14,13,12,11,10,9,8,7,6,5,4,3, + 2,1,0,0,56,11,140,10,0,10,106,9,232,8,106,8, + 239,7,128,7,8,7,174,6,70,6,230,5,149,5,65,5, + 246,4,176,4,110,4,48,4,246,3,187,3,132,3,82,3, + 34,3,244,2,200,2,160,2,122,2,85,2,52,2,20,2, + 245,1,216,1,189,1,164,1,141,1,119,1,96,1,78,1, + 56,1,39,1,21,1,6,1,247,0,232,0,219,0,207,0, + 195,0,184,0,172,0,162,0,154,0,144,0,136,0,127,0, + 120,0,112,0,106,0,100,0,94,0,87,0,82,0,50,0, + 10,0,0,1,2,131,0,1,2,3,1,0,2,131,1,0, + 2,3,1,2,128,3,128,64,32,16,8,4,2,1,3,3, + 3,3,7,11,15,19 END_CONST_ARRAY; CONST_ARRAY(byte, cms_obx) - 255,255,0,5,186,15,234,234,234,76,21,8,76,92,15,35, - 5,169,5,173,5,184,5,0,0,0,0,0,0,0,0,0, - 0,0,0,128,128,128,128,128,128,0,0,0,0,0,0,255, - 255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,130,0,0,6,6,0, - 128,20,128,128,0,0,0,0,0,0,0,0,0,0,0,15, - 15,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0, - 1,2,131,0,1,2,3,1,0,2,131,1,0,2,3,1, - 2,128,3,128,64,32,16,8,4,2,1,75,8,118,8,133, - 9,19,9,80,9,110,9,124,9,26,9,128,160,32,64,255, - 241,228,215,203,192,181,170,161,152,143,135,127,120,114,107,101, - 95,90,85,80,75,71,67,63,60,56,53,50,47,44,42,39, - 37,35,33,31,29,28,26,24,23,22,20,19,18,17,16,15, - 14,13,12,11,10,9,8,7,6,5,4,3,2,1,0,0, - 0,0,0,0,242,233,218,206,191,182,170,161,152,143,137,128, - 122,113,107,101,95,0,86,80,103,96,90,85,81,76,72,67, - 63,61,57,52,51,57,45,42,40,37,36,33,31,30,0,0, - 15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0, - 0,56,11,140,10,0,10,106,9,232,8,106,8,239,7,128, - 7,8,7,174,6,70,6,230,5,149,5,65,5,246,4,176, - 4,110,4,48,4,246,3,187,3,132,3,82,3,34,3,244, - 2,200,2,160,2,122,2,85,2,52,2,20,2,245,1,216, - 1,189,1,164,1,141,1,119,1,96,1,78,1,56,1,39, - 1,21,1,6,1,247,0,232,0,219,0,207,0,195,0,184, - 0,172,0,162,0,154,0,144,0,136,0,127,0,120,0,112, - 0,106,0,100,0,94,0,87,0,82,0,50,0,10,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0, - 0,0,0,1,1,1,1,1,1,1,1,2,2,2,2,0, - 0,0,0,1,1,1,1,2,2,2,2,2,3,3,3,0, - 0,1,1,1,2,2,2,2,2,3,3,3,3,4,4,0, - 0,1,1,1,2,2,2,3,3,3,4,4,4,5,5,0, - 0,1,1,2,2,2,3,3,4,4,4,5,5,6,6,0, - 0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,0, - 1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,0, - 1,1,2,2,3,4,4,5,5,6,7,7,8,8,9,0, - 1,1,2,3,3,4,5,5,6,7,7,8,9,9,10,0, - 1,1,2,3,4,4,5,6,7,7,8,9,10,10,11,0, - 1,2,2,3,4,5,6,7,8,9,9,10,11,11,12,0, - 1,2,3,4,5,5,6,7,8,9,10,10,11,12,13,0, - 1,2,3,4,5,6,7,7,8,9,10,11,12,13,14,0, - 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,6, - 12,12,12,18,12,28,12,38,12,50,12,79,12,233,5,42, - 6,107,6,161,11,196,11,185,11,0,0,0,0,0,0,0, - 0,0,0,3,3,3,3,7,11,15,19,141,143,5,142,144, - 5,140,145,5,41,112,74,74,74,170,169,3,141,15,210,189, - 213,5,141,73,8,189,214,5,141,74,8,169,3,141,31,210, - 169,1,141,146,5,172,145,5,174,144,5,173,143,5,76,72, - 8,173,147,5,133,252,173,148,5,133,253,160,0,138,240,28, - 177,252,201,143,240,4,201,239,208,12,202,208,9,200,192,84, - 176,9,152,170,16,6,200,192,84,144,229,96,142,149,5,169, - 0,162,5,157,17,5,157,23,5,157,29,5,202,16,244,141, - 150,5,141,157,5,160,255,140,159,5,173,153,5,133,252,173, - 154,5,133,253,160,19,177,252,170,173,147,5,133,252,173,148, - 5,133,253,172,149,5,152,72,169,15,141,169,5,141,170,5, - 177,252,201,135,208,35,152,72,24,105,85,168,177,252,16,2, - 169,15,41,15,141,169,5,152,24,105,85,168,177,252,16,3, - 173,169,5,41,15,141,170,5,104,76,243,8,177,252,201,143, - 240,7,201,239,240,3,136,16,199,104,168,177,252,201,207,208, - 13,152,24,105,85,168,177,252,48,15,170,76,19,9,201,143, - 240,7,201,239,240,3,136,16,226,142,151,5,142,152,5,96, - 142,153,5,134,252,140,154,5,132,253,24,138,105,20,141,155, - 5,152,105,0,141,156,5,24,138,105,0,141,147,5,152,105, - 2,141,148,5,160,19,177,252,141,151,5,141,152,5,162,3, - 142,31,210,142,15,210,169,0,141,146,5,160,8,169,0,153, - 0,210,153,16,210,192,6,176,8,153,35,5,169,255,153,41, - 5,136,16,233,169,128,162,5,157,29,5,202,16,250,141,157, - 5,96,169,0,240,240,141,157,5,240,11,173,143,5,41,7, - 170,169,128,157,29,5,172,145,5,173,144,5,141,143,5,140, - 145,5,169,0,157,83,5,157,41,5,157,77,5,152,10,10, - 10,133,254,24,173,153,5,105,48,72,173,154,5,105,1,168, - 104,24,101,254,157,101,5,152,105,0,157,71,5,24,173,153, - 5,105,148,133,252,173,154,5,105,0,133,253,173,145,5,10, - 109,145,5,10,168,140,145,5,200,200,200,200,200,177,252,157, - 113,5,136,177,252,157,107,5,136,177,252,157,119,5,136,136, - 177,252,157,59,5,160,0,41,7,201,3,208,2,160,2,201, - 7,208,2,160,4,185,247,7,133,254,185,248,7,133,255,172, - 145,5,200,200,177,252,74,74,74,74,24,109,143,5,141,143, - 5,141,159,10,168,189,59,5,41,7,201,7,208,15,152,10, - 168,177,254,157,125,5,200,140,143,5,76,92,10,177,254,157, - 125,5,172,145,5,200,200,177,252,41,15,24,109,143,5,141, - 143,5,172,143,5,189,59,5,41,7,201,5,8,177,254,40, - 240,8,221,125,5,208,3,56,233,1,157,89,5,172,145,5, - 177,252,72,41,3,168,185,229,5,157,131,5,104,74,74,74, - 74,160,62,201,15,240,16,160,55,201,14,240,10,160,48,201, - 13,240,4,24,105,50,168,185,233,5,157,137,5,96,216,165, - 252,72,165,253,72,165,254,72,165,255,72,173,146,5,208,3, - 76,47,15,173,157,5,240,3,76,225,12,173,152,5,205,151, - 5,176,3,76,206,12,173,150,5,240,3,76,158,11,162,5, - 169,0,188,29,5,48,3,157,29,5,157,17,5,202,16,242, - 173,147,5,133,252,173,148,5,133,253,172,149,5,140,161,5, - 204,159,5,208,25,173,160,5,240,20,173,149,5,172,158,5, - 140,149,5,206,160,5,208,232,141,149,5,168,16,226,162,0, - 177,252,201,254,240,28,157,53,5,230,253,177,252,198,253,201, - 254,240,15,157,56,5,24,152,105,85,168,232,224,3,144,224, - 176,34,172,149,5,200,204,161,5,240,80,140,149,5,76,250, - 10,104,41,14,170,189,253,7,141,135,11,189,254,7,141,136, - 11,76,129,11,172,149,5,177,252,16,57,201,255,240,53,74, - 74,74,72,41,1,240,218,104,41,14,170,189,233,7,141,135, - 11,189,234,7,141,136,11,173,54,5,133,254,32,134,11,140, - 149,5,192,85,176,5,204,161,5,208,179,172,161,5,140,149, - 5,76,47,15,76,94,12,165,254,48,18,41,15,141,169,5, - 173,55,5,16,3,173,169,5,41,15,141,170,5,200,96,165, - 254,48,250,41,1,141,184,5,200,96,173,179,5,48,20,206, - 180,5,208,51,169,50,141,180,5,206,179,5,208,41,206,179, - 5,200,96,165,254,48,214,141,180,5,238,180,5,165,254,48, - 204,141,180,5,238,180,5,173,55,5,141,179,5,16,5,169, - 0,141,179,5,238,179,5,104,104,76,225,12,32,110,9,160, - 255,96,165,254,48,249,168,96,165,254,48,243,56,152,229,254, - 168,96,165,254,48,233,24,152,101,254,168,96,165,254,48,223, - 141,151,5,141,152,5,200,96,165,254,48,211,173,55,5,48, - 206,200,140,158,5,24,152,101,254,141,159,5,173,55,5,141, - 160,5,192,84,96,136,48,10,177,252,201,143,240,4,201,239, - 208,243,200,96,162,5,189,23,5,240,5,222,23,5,16,87, - 189,29,5,208,82,188,53,5,201,64,176,75,173,155,5,133, - 252,173,156,5,133,253,177,252,133,254,24,152,105,64,168,177, - 252,133,255,188,17,5,177,254,41,192,208,12,177,254,41,63, - 157,47,5,254,17,5,16,235,201,64,208,13,177,254,41,63, - 188,47,5,32,150,9,76,190,12,201,128,208,10,177,254,41, - 63,157,23,5,254,17,5,202,16,156,174,150,5,232,138,41, - 63,141,150,5,206,152,5,208,14,173,151,5,141,152,5,173, - 150,5,208,3,238,149,5,172,89,5,173,59,5,41,7,201, - 5,240,4,201,6,208,1,136,140,162,5,160,0,201,5,240, - 4,201,6,208,2,160,2,201,7,208,2,160,40,140,164,5, - 172,92,5,173,62,5,41,7,201,5,240,4,201,6,208,1, - 136,140,163,5,160,0,201,5,240,4,201,6,208,2,160,2, - 201,7,208,2,160,40,140,165,5,162,5,189,59,5,41,224, - 157,65,5,189,101,5,133,252,189,71,5,133,253,189,41,5, - 201,255,240,55,201,15,208,33,189,77,5,240,46,222,77,5, - 189,77,5,208,38,188,35,5,240,1,136,152,157,35,5,189, - 119,5,157,77,5,136,76,133,13,189,41,5,74,168,177,252, - 144,4,74,74,74,74,41,15,157,35,5,188,125,5,189,59, - 5,41,7,201,1,208,31,136,152,200,221,89,5,8,169,1, - 40,208,2,10,10,61,83,5,240,12,188,89,5,192,255,208, - 5,169,0,157,35,5,152,157,95,5,169,1,141,168,5,189, - 41,5,201,15,240,76,41,7,168,185,205,5,133,254,189,41, - 5,41,8,8,138,40,24,240,2,105,6,168,185,107,5,37, - 254,240,47,189,137,5,157,95,5,142,168,5,202,224,2,240, - 15,224,255,208,22,141,162,5,169,0,141,164,5,76,5,14, - 173,140,5,141,163,5,169,0,141,165,5,232,189,131,5,157, - 65,5,189,41,5,41,15,201,15,240,18,254,41,5,189,41, - 5,41,15,201,15,208,6,189,119,5,157,77,5,189,29,5, - 16,10,189,35,5,208,5,169,64,157,29,5,254,83,5,160, - 0,189,59,5,74,74,74,74,144,1,136,74,144,1,200,24, - 152,125,125,5,157,125,5,189,89,5,201,255,208,2,160,0, - 24,152,125,89,5,157,89,5,202,48,3,76,53,13,32,123, - 15,173,65,5,141,166,5,173,68,5,141,167,5,173,59,5, - 41,7,32,181,15,152,72,185,185,5,8,41,127,170,152,41, - 3,10,168,224,3,208,3,76,196,14,189,173,5,208,39,189, - 95,5,153,0,210,189,35,5,29,65,5,40,16,2,169,0, - 153,1,210,104,168,136,41,3,240,3,76,127,14,173,164,5, - 141,8,210,76,228,14,40,76,173,14,173,173,5,208,23,173, - 162,5,153,0,210,173,35,5,13,166,5,40,16,2,169,0, - 153,1,210,76,173,14,40,76,173,14,173,62,5,41,7,32, - 181,15,152,72,185,185,5,8,41,127,170,152,41,3,10,168, - 224,3,208,3,76,60,15,189,176,5,208,30,189,98,5,153, - 16,210,189,38,5,29,68,5,40,16,2,169,0,153,17,210, - 104,168,136,41,3,240,7,76,236,14,40,76,26,15,173,165, - 5,141,24,210,24,104,133,255,104,133,254,104,133,253,104,133, - 252,96,173,176,5,208,23,173,163,5,153,16,210,173,38,5, - 13,167,5,40,16,2,169,0,153,17,210,76,26,15,40,76, - 26,15,32,168,10,176,25,173,184,5,240,20,173,157,5,141, - 183,5,169,1,141,157,5,32,168,10,173,183,5,141,157,5, - 96,173,169,5,10,10,10,10,141,171,5,173,170,5,10,10, - 10,10,141,172,5,162,2,134,200,173,171,5,29,35,5,170, - 189,233,6,166,200,157,35,5,173,172,5,29,38,5,170,189, - 233,6,166,200,157,38,5,202,16,221,96,168,185,13,8,168, - 96 + 255,255,0,5,186,15,234,234,234,76,21,8,76,92,15,35, + 5,169,5,173,5,184,5,0,0,0,0,0,0,0,0,0, + 0,0,0,128,128,128,128,128,128,0,0,0,0,0,0,255, + 255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,130,0,0,6,6,0, + 128,20,128,128,0,0,0,0,0,0,0,0,0,0,0,15, + 15,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0, + 1,2,131,0,1,2,3,1,0,2,131,1,0,2,3,1, + 2,128,3,128,64,32,16,8,4,2,1,75,8,118,8,133, + 9,19,9,80,9,110,9,124,9,26,9,128,160,32,64,255, + 241,228,215,203,192,181,170,161,152,143,135,127,120,114,107,101, + 95,90,85,80,75,71,67,63,60,56,53,50,47,44,42,39, + 37,35,33,31,29,28,26,24,23,22,20,19,18,17,16,15, + 14,13,12,11,10,9,8,7,6,5,4,3,2,1,0,0, + 0,0,0,0,242,233,218,206,191,182,170,161,152,143,137,128, + 122,113,107,101,95,0,86,80,103,96,90,85,81,76,72,67, + 63,61,57,52,51,57,45,42,40,37,36,33,31,30,0,0, + 15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0, + 0,56,11,140,10,0,10,106,9,232,8,106,8,239,7,128, + 7,8,7,174,6,70,6,230,5,149,5,65,5,246,4,176, + 4,110,4,48,4,246,3,187,3,132,3,82,3,34,3,244, + 2,200,2,160,2,122,2,85,2,52,2,20,2,245,1,216, + 1,189,1,164,1,141,1,119,1,96,1,78,1,56,1,39, + 1,21,1,6,1,247,0,232,0,219,0,207,0,195,0,184, + 0,172,0,162,0,154,0,144,0,136,0,127,0,120,0,112, + 0,106,0,100,0,94,0,87,0,82,0,50,0,10,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0, + 0,0,0,1,1,1,1,1,1,1,1,2,2,2,2,0, + 0,0,0,1,1,1,1,2,2,2,2,2,3,3,3,0, + 0,1,1,1,2,2,2,2,2,3,3,3,3,4,4,0, + 0,1,1,1,2,2,2,3,3,3,4,4,4,5,5,0, + 0,1,1,2,2,2,3,3,4,4,4,5,5,6,6,0, + 0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,0, + 1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,0, + 1,1,2,2,3,4,4,5,5,6,7,7,8,8,9,0, + 1,1,2,3,3,4,5,5,6,7,7,8,9,9,10,0, + 1,1,2,3,4,4,5,6,7,7,8,9,10,10,11,0, + 1,2,2,3,4,5,6,7,8,9,9,10,11,11,12,0, + 1,2,3,4,5,5,6,7,8,9,10,10,11,12,13,0, + 1,2,3,4,5,6,7,7,8,9,10,11,12,13,14,0, + 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,6, + 12,12,12,18,12,28,12,38,12,50,12,79,12,233,5,42, + 6,107,6,161,11,196,11,185,11,0,0,0,0,0,0,0, + 0,0,0,3,3,3,3,7,11,15,19,141,143,5,142,144, + 5,140,145,5,41,112,74,74,74,170,169,3,141,15,210,189, + 213,5,141,73,8,189,214,5,141,74,8,169,3,141,31,210, + 169,1,141,146,5,172,145,5,174,144,5,173,143,5,76,72, + 8,173,147,5,133,252,173,148,5,133,253,160,0,138,240,28, + 177,252,201,143,240,4,201,239,208,12,202,208,9,200,192,84, + 176,9,152,170,16,6,200,192,84,144,229,96,142,149,5,169, + 0,162,5,157,17,5,157,23,5,157,29,5,202,16,244,141, + 150,5,141,157,5,160,255,140,159,5,173,153,5,133,252,173, + 154,5,133,253,160,19,177,252,170,173,147,5,133,252,173,148, + 5,133,253,172,149,5,152,72,169,15,141,169,5,141,170,5, + 177,252,201,135,208,35,152,72,24,105,85,168,177,252,16,2, + 169,15,41,15,141,169,5,152,24,105,85,168,177,252,16,3, + 173,169,5,41,15,141,170,5,104,76,243,8,177,252,201,143, + 240,7,201,239,240,3,136,16,199,104,168,177,252,201,207,208, + 13,152,24,105,85,168,177,252,48,15,170,76,19,9,201,143, + 240,7,201,239,240,3,136,16,226,142,151,5,142,152,5,96, + 142,153,5,134,252,140,154,5,132,253,24,138,105,20,141,155, + 5,152,105,0,141,156,5,24,138,105,0,141,147,5,152,105, + 2,141,148,5,160,19,177,252,141,151,5,141,152,5,162,3, + 142,31,210,142,15,210,169,0,141,146,5,160,8,169,0,153, + 0,210,153,16,210,192,6,176,8,153,35,5,169,255,153,41, + 5,136,16,233,169,128,162,5,157,29,5,202,16,250,141,157, + 5,96,169,0,240,240,141,157,5,240,11,173,143,5,41,7, + 170,169,128,157,29,5,172,145,5,173,144,5,141,143,5,140, + 145,5,169,0,157,83,5,157,41,5,157,77,5,152,10,10, + 10,133,254,24,173,153,5,105,48,72,173,154,5,105,1,168, + 104,24,101,254,157,101,5,152,105,0,157,71,5,24,173,153, + 5,105,148,133,252,173,154,5,105,0,133,253,173,145,5,10, + 109,145,5,10,168,140,145,5,200,200,200,200,200,177,252,157, + 113,5,136,177,252,157,107,5,136,177,252,157,119,5,136,136, + 177,252,157,59,5,160,0,41,7,201,3,208,2,160,2,201, + 7,208,2,160,4,185,247,7,133,254,185,248,7,133,255,172, + 145,5,200,200,177,252,74,74,74,74,24,109,143,5,141,143, + 5,141,159,10,168,189,59,5,41,7,201,7,208,15,152,10, + 168,177,254,157,125,5,200,140,143,5,76,92,10,177,254,157, + 125,5,172,145,5,200,200,177,252,41,15,24,109,143,5,141, + 143,5,172,143,5,189,59,5,41,7,201,5,8,177,254,40, + 240,8,221,125,5,208,3,56,233,1,157,89,5,172,145,5, + 177,252,72,41,3,168,185,229,5,157,131,5,104,74,74,74, + 74,160,62,201,15,240,16,160,55,201,14,240,10,160,48,201, + 13,240,4,24,105,50,168,185,233,5,157,137,5,96,216,165, + 252,72,165,253,72,165,254,72,165,255,72,173,146,5,208,3, + 76,47,15,173,157,5,240,3,76,225,12,173,152,5,205,151, + 5,176,3,76,206,12,173,150,5,240,3,76,158,11,162,5, + 169,0,188,29,5,48,3,157,29,5,157,17,5,202,16,242, + 173,147,5,133,252,173,148,5,133,253,172,149,5,140,161,5, + 204,159,5,208,25,173,160,5,240,20,173,149,5,172,158,5, + 140,149,5,206,160,5,208,232,141,149,5,168,16,226,162,0, + 177,252,201,254,240,28,157,53,5,230,253,177,252,198,253,201, + 254,240,15,157,56,5,24,152,105,85,168,232,224,3,144,224, + 176,34,172,149,5,200,204,161,5,240,80,140,149,5,76,250, + 10,104,41,14,170,189,253,7,141,135,11,189,254,7,141,136, + 11,76,129,11,172,149,5,177,252,16,57,201,255,240,53,74, + 74,74,72,41,1,240,218,104,41,14,170,189,233,7,141,135, + 11,189,234,7,141,136,11,173,54,5,133,254,32,134,11,140, + 149,5,192,85,176,5,204,161,5,208,179,172,161,5,140,149, + 5,76,47,15,76,94,12,165,254,48,18,41,15,141,169,5, + 173,55,5,16,3,173,169,5,41,15,141,170,5,200,96,165, + 254,48,250,41,1,141,184,5,200,96,173,179,5,48,20,206, + 180,5,208,51,169,50,141,180,5,206,179,5,208,41,206,179, + 5,200,96,165,254,48,214,141,180,5,238,180,5,165,254,48, + 204,141,180,5,238,180,5,173,55,5,141,179,5,16,5,169, + 0,141,179,5,238,179,5,104,104,76,225,12,32,110,9,160, + 255,96,165,254,48,249,168,96,165,254,48,243,56,152,229,254, + 168,96,165,254,48,233,24,152,101,254,168,96,165,254,48,223, + 141,151,5,141,152,5,200,96,165,254,48,211,173,55,5,48, + 206,200,140,158,5,24,152,101,254,141,159,5,173,55,5,141, + 160,5,192,84,96,136,48,10,177,252,201,143,240,4,201,239, + 208,243,200,96,162,5,189,23,5,240,5,222,23,5,16,87, + 189,29,5,208,82,188,53,5,201,64,176,75,173,155,5,133, + 252,173,156,5,133,253,177,252,133,254,24,152,105,64,168,177, + 252,133,255,188,17,5,177,254,41,192,208,12,177,254,41,63, + 157,47,5,254,17,5,16,235,201,64,208,13,177,254,41,63, + 188,47,5,32,150,9,76,190,12,201,128,208,10,177,254,41, + 63,157,23,5,254,17,5,202,16,156,174,150,5,232,138,41, + 63,141,150,5,206,152,5,208,14,173,151,5,141,152,5,173, + 150,5,208,3,238,149,5,172,89,5,173,59,5,41,7,201, + 5,240,4,201,6,208,1,136,140,162,5,160,0,201,5,240, + 4,201,6,208,2,160,2,201,7,208,2,160,40,140,164,5, + 172,92,5,173,62,5,41,7,201,5,240,4,201,6,208,1, + 136,140,163,5,160,0,201,5,240,4,201,6,208,2,160,2, + 201,7,208,2,160,40,140,165,5,162,5,189,59,5,41,224, + 157,65,5,189,101,5,133,252,189,71,5,133,253,189,41,5, + 201,255,240,55,201,15,208,33,189,77,5,240,46,222,77,5, + 189,77,5,208,38,188,35,5,240,1,136,152,157,35,5,189, + 119,5,157,77,5,136,76,133,13,189,41,5,74,168,177,252, + 144,4,74,74,74,74,41,15,157,35,5,188,125,5,189,59, + 5,41,7,201,1,208,31,136,152,200,221,89,5,8,169,1, + 40,208,2,10,10,61,83,5,240,12,188,89,5,192,255,208, + 5,169,0,157,35,5,152,157,95,5,169,1,141,168,5,189, + 41,5,201,15,240,76,41,7,168,185,205,5,133,254,189,41, + 5,41,8,8,138,40,24,240,2,105,6,168,185,107,5,37, + 254,240,47,189,137,5,157,95,5,142,168,5,202,224,2,240, + 15,224,255,208,22,141,162,5,169,0,141,164,5,76,5,14, + 173,140,5,141,163,5,169,0,141,165,5,232,189,131,5,157, + 65,5,189,41,5,41,15,201,15,240,18,254,41,5,189,41, + 5,41,15,201,15,208,6,189,119,5,157,77,5,189,29,5, + 16,10,189,35,5,208,5,169,64,157,29,5,254,83,5,160, + 0,189,59,5,74,74,74,74,144,1,136,74,144,1,200,24, + 152,125,125,5,157,125,5,189,89,5,201,255,208,2,160,0, + 24,152,125,89,5,157,89,5,202,48,3,76,53,13,32,123, + 15,173,65,5,141,166,5,173,68,5,141,167,5,173,59,5, + 41,7,32,181,15,152,72,185,185,5,8,41,127,170,152,41, + 3,10,168,224,3,208,3,76,196,14,189,173,5,208,39,189, + 95,5,153,0,210,189,35,5,29,65,5,40,16,2,169,0, + 153,1,210,104,168,136,41,3,240,3,76,127,14,173,164,5, + 141,8,210,76,228,14,40,76,173,14,173,173,5,208,23,173, + 162,5,153,0,210,173,35,5,13,166,5,40,16,2,169,0, + 153,1,210,76,173,14,40,76,173,14,173,62,5,41,7,32, + 181,15,152,72,185,185,5,8,41,127,170,152,41,3,10,168, + 224,3,208,3,76,60,15,189,176,5,208,30,189,98,5,153, + 16,210,189,38,5,29,68,5,40,16,2,169,0,153,17,210, + 104,168,136,41,3,240,7,76,236,14,40,76,26,15,173,165, + 5,141,24,210,24,104,133,255,104,133,254,104,133,253,104,133, + 252,96,173,176,5,208,23,173,163,5,153,16,210,173,38,5, + 13,167,5,40,16,2,169,0,153,17,210,76,26,15,40,76, + 26,15,32,168,10,176,25,173,184,5,240,20,173,157,5,141, + 183,5,169,1,141,157,5,32,168,10,173,183,5,141,157,5, + 96,173,169,5,10,10,10,10,141,171,5,173,170,5,10,10, + 10,10,141,172,5,162,2,134,200,173,171,5,29,35,5,170, + 189,233,6,166,200,157,35,5,173,172,5,29,38,5,170,189, + 233,6,166,200,157,38,5,202,16,221,96,168,185,13,8,168, + 96 END_CONST_ARRAY; CONST_ARRAY(byte, dlt_obx) - 255,255,0,4,70,12,255,241,228,215,203,192,181,170,161,152, - 143,135,127,121,114,107,101,95,90,85,80,75,71,67,63,60, - 56,53,50,47,44,42,39,37,35,33,31,29,28,26,24,23, - 22,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6, - 5,4,255,241,228,215,242,233,218,206,191,182,170,161,152,143, - 137,128,122,113,107,101,95,92,86,80,103,96,90,85,81,76, - 72,67,63,61,57,52,51,48,45,42,40,37,36,33,31,30, - 28,27,25,0,22,21,0,10,9,8,7,6,5,4,3,2, - 1,0,242,233,218,206,242,233,218,206,191,182,170,161,152,143, - 137,128,122,113,107,101,95,92,86,80,103,96,90,85,81,76, - 72,67,63,61,57,52,51,48,45,42,40,37,36,33,31,30, - 28,27,25,0,22,21,0,10,9,8,7,6,5,4,3,2, - 1,0,242,233,218,206,255,241,228,216,202,192,181,171,162,153, - 142,135,127,120,115,108,102,97,90,85,81,75,72,67,63,60, - 57,52,51,48,45,42,40,37,36,33,31,30,28,27,25,23, - 22,21,19,18,17,16,15,14,13,12,11,10,9,8,7,6, - 5,4,3,2,1,255,76,9,5,76,200,5,76,183,5,136, - 140,54,3,169,126,141,53,3,162,6,142,51,3,162,1,142, - 52,3,32,51,5,32,95,5,32,163,5,32,139,5,169,1, - 141,50,3,169,3,141,15,210,96,162,0,160,32,142,48,3, - 140,49,3,160,0,173,48,3,153,0,2,173,49,3,153,64, - 2,173,48,3,24,105,128,141,48,3,144,3,238,49,3,200, - 192,64,208,225,96,162,0,160,68,142,48,3,140,49,3,160, - 0,173,48,3,153,128,2,173,49,3,153,160,2,173,48,3, - 24,105,64,141,48,3,144,3,238,49,3,200,192,32,208,225, - 96,173,0,76,41,1,74,106,106,168,162,0,185,128,4,157, - 64,4,200,232,224,64,208,244,96,160,3,169,0,153,40,3, - 153,32,3,153,36,3,153,44,3,136,16,241,96,169,0,141, - 50,3,160,7,169,0,153,0,210,136,16,250,96,96,173,50, - 3,240,250,173,40,3,13,41,3,13,42,3,13,43,3,141, - 8,210,174,36,3,172,32,3,142,0,210,140,1,210,174,37, - 3,172,33,3,142,2,210,140,3,210,174,38,3,172,34,3, - 142,4,210,140,5,210,174,39,3,172,35,3,142,6,210,140, - 7,210,206,52,3,208,74,173,51,3,141,52,3,238,53,3, - 238,53,3,16,28,238,54,3,169,0,141,53,3,32,199,6, - 173,4,3,13,5,3,13,6,3,13,7,3,208,3,76,183, - 5,173,4,3,240,3,32,97,7,173,5,3,240,3,32,192, - 7,173,6,3,240,3,32,31,8,173,7,3,240,3,32,126, - 8,173,4,3,240,8,173,44,3,240,3,32,221,8,173,5, - 3,240,8,173,45,3,240,3,32,206,9,173,6,3,240,8, - 173,46,3,240,3,32,191,10,173,7,3,240,8,173,47,3, - 240,3,32,131,11,96,192,67,144,14,169,0,141,4,3,141, - 32,3,141,40,3,76,230,6,192,66,208,15,189,128,64,141, - 51,3,141,52,3,238,54,3,76,199,6,192,65,208,9,189, - 128,64,141,54,3,76,199,6,104,104,76,183,5,174,54,3, - 188,0,64,192,64,176,191,189,128,64,141,24,3,185,0,2, - 133,224,185,64,2,133,225,169,1,141,4,3,188,0,65,192, - 64,176,78,189,128,65,141,25,3,185,0,2,133,226,185,64, - 2,133,227,169,1,141,5,3,188,0,66,192,64,176,63,189, - 128,66,141,26,3,185,0,2,133,228,185,64,2,133,229,169, - 1,141,6,3,188,0,67,192,64,176,48,189,128,67,141,27, - 3,185,0,2,133,230,185,64,2,133,231,169,1,141,7,3, - 96,169,0,141,5,3,141,33,3,141,41,3,240,186,169,0, - 141,6,3,141,34,3,141,42,3,240,201,169,0,141,7,3, - 141,35,3,141,43,3,96,172,53,3,177,224,48,11,200,177, - 224,48,1,96,104,104,76,31,6,24,109,24,3,41,127,141, - 8,3,169,15,141,0,3,141,44,3,200,177,224,170,189,160, - 2,133,233,133,241,133,249,189,128,2,133,232,73,16,133,240, - 73,48,133,248,160,49,177,232,141,12,3,160,51,177,232,41, - 127,141,16,3,169,0,141,20,3,141,28,3,160,48,177,232, - 41,213,141,40,3,96,172,53,3,177,226,48,11,200,177,226, - 48,1,96,104,104,76,31,6,24,109,25,3,41,127,141,9, - 3,169,15,141,1,3,141,45,3,200,177,226,170,189,160,2, - 133,235,133,243,133,251,189,128,2,133,234,73,16,133,242,73, - 48,133,250,160,49,177,234,141,13,3,160,51,177,234,41,127, - 141,17,3,169,0,141,21,3,141,29,3,160,48,177,234,41, - 131,141,41,3,96,172,53,3,177,228,48,11,200,177,228,48, - 1,96,104,104,76,31,6,24,109,26,3,41,127,141,10,3, - 169,15,141,2,3,141,46,3,200,177,228,170,189,160,2,133, - 237,133,245,133,253,189,128,2,133,236,73,16,133,244,73,48, - 133,252,160,49,177,236,141,14,3,160,51,177,236,41,127,141, - 18,3,169,0,141,22,3,141,30,3,160,48,177,236,41,169, - 141,42,3,96,172,53,3,177,230,48,11,200,177,230,48,1, - 96,104,104,76,31,6,24,109,27,3,41,127,141,11,3,169, - 15,141,3,3,141,47,3,200,177,230,170,189,160,2,133,239, - 133,247,133,255,189,128,2,133,238,73,16,133,246,73,48,133, - 254,160,49,177,238,141,15,3,160,51,177,238,41,127,141,19, - 3,169,0,141,23,3,141,31,3,160,48,177,238,41,129,141, - 43,3,96,172,0,3,48,70,177,232,141,32,3,177,240,208, - 9,32,108,9,206,0,3,76,79,9,201,1,240,39,201,3, - 208,16,173,8,3,24,113,248,170,173,28,3,141,55,3,76, - 24,9,173,28,3,24,113,248,141,55,3,174,8,3,32,150, - 9,206,0,3,96,177,248,141,36,3,206,0,3,96,32,108, - 9,160,49,177,232,240,30,206,12,3,240,3,76,79,9,173, - 32,3,41,15,240,11,206,32,3,177,232,141,12,3,76,79, - 9,141,44,3,96,173,28,3,24,160,50,113,232,141,28,3, - 206,16,3,208,12,238,20,3,160,51,177,232,41,127,141,16, - 3,96,173,20,3,41,3,24,105,52,168,177,232,170,160,51, - 177,232,48,14,138,109,8,3,170,173,28,3,141,55,3,76, - 150,9,138,109,28,3,141,55,3,174,8,3,189,0,4,24, - 109,55,3,141,36,3,173,40,3,41,4,208,1,96,172,0, - 3,177,240,208,21,138,24,160,0,113,248,170,189,0,4,24, - 109,55,3,24,105,255,141,38,3,96,173,36,3,24,105,255, - 141,38,3,96,172,1,3,48,70,177,234,141,33,3,177,242, - 208,9,32,93,10,206,1,3,76,64,10,201,1,240,39,201, - 3,208,16,173,9,3,24,113,250,170,173,29,3,141,55,3, - 76,9,10,173,29,3,24,113,250,141,55,3,174,9,3,32, - 135,10,206,1,3,96,177,250,141,37,3,206,1,3,96,32, - 93,10,160,49,177,234,240,30,206,13,3,240,3,76,64,10, - 173,33,3,41,15,240,11,206,33,3,177,234,141,13,3,76, - 64,10,141,45,3,96,173,29,3,24,160,50,113,234,141,29, - 3,206,17,3,208,12,238,21,3,160,51,177,234,41,127,141, - 17,3,96,173,21,3,41,3,24,105,52,168,177,234,170,160, - 51,177,234,48,14,138,109,9,3,170,173,29,3,141,55,3, - 76,135,10,138,109,29,3,141,55,3,174,9,3,189,0,4, - 24,109,55,3,141,37,3,173,41,3,41,2,208,1,96,172, - 1,3,177,242,208,21,138,24,160,0,113,250,170,189,0,4, - 24,109,55,3,24,105,255,141,39,3,96,173,37,3,24,105, - 255,141,39,3,96,172,2,3,48,70,177,236,141,34,3,177, - 244,208,9,32,78,11,206,2,3,76,49,11,201,1,240,39, - 201,3,208,16,173,10,3,24,113,252,170,173,30,3,141,55, - 3,76,250,10,173,30,3,24,113,252,141,55,3,174,10,3, - 32,120,11,206,2,3,96,177,252,141,38,3,206,2,3,96, - 32,78,11,160,49,177,236,240,30,206,14,3,240,3,76,49, - 11,173,34,3,41,15,240,11,206,34,3,177,236,141,14,3, - 76,49,11,141,46,3,96,173,30,3,24,160,50,113,236,141, - 30,3,206,18,3,208,12,238,22,3,160,51,177,236,41,127, - 141,18,3,96,173,22,3,41,3,24,105,52,168,177,236,170, - 160,51,177,236,48,14,138,109,10,3,170,173,30,3,141,55, - 3,76,120,11,138,109,30,3,141,55,3,174,10,3,189,0, - 4,24,109,55,3,141,38,3,96,172,3,3,48,70,177,238, - 141,35,3,177,246,208,9,32,18,12,206,3,3,76,245,11, - 201,1,240,39,201,3,208,16,173,11,3,24,113,254,170,173, - 31,3,141,55,3,76,190,11,173,31,3,24,113,254,141,55, - 3,174,11,3,32,60,12,206,3,3,96,177,254,141,39,3, - 206,3,3,96,32,18,12,160,49,177,238,240,30,206,15,3, - 240,3,76,245,11,173,35,3,41,15,240,11,206,35,3,177, - 238,141,15,3,76,245,11,141,47,3,96,173,31,3,24,160, - 50,113,238,141,31,3,206,19,3,208,12,238,23,3,160,51, - 177,238,41,127,141,19,3,96,173,23,3,41,3,24,105,52, - 168,177,238,170,160,51,177,238,48,14,138,109,11,3,170,173, - 31,3,141,55,3,76,60,12,138,109,31,3,141,55,3,174, - 11,3,189,0,4,24,109,55,3,141,39,3,96 + 255,255,0,4,70,12,255,241,228,215,203,192,181,170,161,152, + 143,135,127,121,114,107,101,95,90,85,80,75,71,67,63,60, + 56,53,50,47,44,42,39,37,35,33,31,29,28,26,24,23, + 22,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6, + 5,4,255,241,228,215,242,233,218,206,191,182,170,161,152,143, + 137,128,122,113,107,101,95,92,86,80,103,96,90,85,81,76, + 72,67,63,61,57,52,51,48,45,42,40,37,36,33,31,30, + 28,27,25,0,22,21,0,10,9,8,7,6,5,4,3,2, + 1,0,242,233,218,206,242,233,218,206,191,182,170,161,152,143, + 137,128,122,113,107,101,95,92,86,80,103,96,90,85,81,76, + 72,67,63,61,57,52,51,48,45,42,40,37,36,33,31,30, + 28,27,25,0,22,21,0,10,9,8,7,6,5,4,3,2, + 1,0,242,233,218,206,255,241,228,216,202,192,181,171,162,153, + 142,135,127,120,115,108,102,97,90,85,81,75,72,67,63,60, + 57,52,51,48,45,42,40,37,36,33,31,30,28,27,25,23, + 22,21,19,18,17,16,15,14,13,12,11,10,9,8,7,6, + 5,4,3,2,1,255,76,9,5,76,200,5,76,183,5,136, + 140,54,3,169,126,141,53,3,162,6,142,51,3,162,1,142, + 52,3,32,51,5,32,95,5,32,163,5,32,139,5,169,1, + 141,50,3,169,3,141,15,210,96,162,0,160,32,142,48,3, + 140,49,3,160,0,173,48,3,153,0,2,173,49,3,153,64, + 2,173,48,3,24,105,128,141,48,3,144,3,238,49,3,200, + 192,64,208,225,96,162,0,160,68,142,48,3,140,49,3,160, + 0,173,48,3,153,128,2,173,49,3,153,160,2,173,48,3, + 24,105,64,141,48,3,144,3,238,49,3,200,192,32,208,225, + 96,173,0,76,41,1,74,106,106,168,162,0,185,128,4,157, + 64,4,200,232,224,64,208,244,96,160,3,169,0,153,40,3, + 153,32,3,153,36,3,153,44,3,136,16,241,96,169,0,141, + 50,3,160,7,169,0,153,0,210,136,16,250,96,96,173,50, + 3,240,250,173,40,3,13,41,3,13,42,3,13,43,3,141, + 8,210,174,36,3,172,32,3,142,0,210,140,1,210,174,37, + 3,172,33,3,142,2,210,140,3,210,174,38,3,172,34,3, + 142,4,210,140,5,210,174,39,3,172,35,3,142,6,210,140, + 7,210,206,52,3,208,74,173,51,3,141,52,3,238,53,3, + 238,53,3,16,28,238,54,3,169,0,141,53,3,32,199,6, + 173,4,3,13,5,3,13,6,3,13,7,3,208,3,76,183, + 5,173,4,3,240,3,32,97,7,173,5,3,240,3,32,192, + 7,173,6,3,240,3,32,31,8,173,7,3,240,3,32,126, + 8,173,4,3,240,8,173,44,3,240,3,32,221,8,173,5, + 3,240,8,173,45,3,240,3,32,206,9,173,6,3,240,8, + 173,46,3,240,3,32,191,10,173,7,3,240,8,173,47,3, + 240,3,32,131,11,96,192,67,144,14,169,0,141,4,3,141, + 32,3,141,40,3,76,230,6,192,66,208,15,189,128,64,141, + 51,3,141,52,3,238,54,3,76,199,6,192,65,208,9,189, + 128,64,141,54,3,76,199,6,104,104,76,183,5,174,54,3, + 188,0,64,192,64,176,191,189,128,64,141,24,3,185,0,2, + 133,224,185,64,2,133,225,169,1,141,4,3,188,0,65,192, + 64,176,78,189,128,65,141,25,3,185,0,2,133,226,185,64, + 2,133,227,169,1,141,5,3,188,0,66,192,64,176,63,189, + 128,66,141,26,3,185,0,2,133,228,185,64,2,133,229,169, + 1,141,6,3,188,0,67,192,64,176,48,189,128,67,141,27, + 3,185,0,2,133,230,185,64,2,133,231,169,1,141,7,3, + 96,169,0,141,5,3,141,33,3,141,41,3,240,186,169,0, + 141,6,3,141,34,3,141,42,3,240,201,169,0,141,7,3, + 141,35,3,141,43,3,96,172,53,3,177,224,48,11,200,177, + 224,48,1,96,104,104,76,31,6,24,109,24,3,41,127,141, + 8,3,169,15,141,0,3,141,44,3,200,177,224,170,189,160, + 2,133,233,133,241,133,249,189,128,2,133,232,73,16,133,240, + 73,48,133,248,160,49,177,232,141,12,3,160,51,177,232,41, + 127,141,16,3,169,0,141,20,3,141,28,3,160,48,177,232, + 41,213,141,40,3,96,172,53,3,177,226,48,11,200,177,226, + 48,1,96,104,104,76,31,6,24,109,25,3,41,127,141,9, + 3,169,15,141,1,3,141,45,3,200,177,226,170,189,160,2, + 133,235,133,243,133,251,189,128,2,133,234,73,16,133,242,73, + 48,133,250,160,49,177,234,141,13,3,160,51,177,234,41,127, + 141,17,3,169,0,141,21,3,141,29,3,160,48,177,234,41, + 131,141,41,3,96,172,53,3,177,228,48,11,200,177,228,48, + 1,96,104,104,76,31,6,24,109,26,3,41,127,141,10,3, + 169,15,141,2,3,141,46,3,200,177,228,170,189,160,2,133, + 237,133,245,133,253,189,128,2,133,236,73,16,133,244,73,48, + 133,252,160,49,177,236,141,14,3,160,51,177,236,41,127,141, + 18,3,169,0,141,22,3,141,30,3,160,48,177,236,41,169, + 141,42,3,96,172,53,3,177,230,48,11,200,177,230,48,1, + 96,104,104,76,31,6,24,109,27,3,41,127,141,11,3,169, + 15,141,3,3,141,47,3,200,177,230,170,189,160,2,133,239, + 133,247,133,255,189,128,2,133,238,73,16,133,246,73,48,133, + 254,160,49,177,238,141,15,3,160,51,177,238,41,127,141,19, + 3,169,0,141,23,3,141,31,3,160,48,177,238,41,129,141, + 43,3,96,172,0,3,48,70,177,232,141,32,3,177,240,208, + 9,32,108,9,206,0,3,76,79,9,201,1,240,39,201,3, + 208,16,173,8,3,24,113,248,170,173,28,3,141,55,3,76, + 24,9,173,28,3,24,113,248,141,55,3,174,8,3,32,150, + 9,206,0,3,96,177,248,141,36,3,206,0,3,96,32,108, + 9,160,49,177,232,240,30,206,12,3,240,3,76,79,9,173, + 32,3,41,15,240,11,206,32,3,177,232,141,12,3,76,79, + 9,141,44,3,96,173,28,3,24,160,50,113,232,141,28,3, + 206,16,3,208,12,238,20,3,160,51,177,232,41,127,141,16, + 3,96,173,20,3,41,3,24,105,52,168,177,232,170,160,51, + 177,232,48,14,138,109,8,3,170,173,28,3,141,55,3,76, + 150,9,138,109,28,3,141,55,3,174,8,3,189,0,4,24, + 109,55,3,141,36,3,173,40,3,41,4,208,1,96,172,0, + 3,177,240,208,21,138,24,160,0,113,248,170,189,0,4,24, + 109,55,3,24,105,255,141,38,3,96,173,36,3,24,105,255, + 141,38,3,96,172,1,3,48,70,177,234,141,33,3,177,242, + 208,9,32,93,10,206,1,3,76,64,10,201,1,240,39,201, + 3,208,16,173,9,3,24,113,250,170,173,29,3,141,55,3, + 76,9,10,173,29,3,24,113,250,141,55,3,174,9,3,32, + 135,10,206,1,3,96,177,250,141,37,3,206,1,3,96,32, + 93,10,160,49,177,234,240,30,206,13,3,240,3,76,64,10, + 173,33,3,41,15,240,11,206,33,3,177,234,141,13,3,76, + 64,10,141,45,3,96,173,29,3,24,160,50,113,234,141,29, + 3,206,17,3,208,12,238,21,3,160,51,177,234,41,127,141, + 17,3,96,173,21,3,41,3,24,105,52,168,177,234,170,160, + 51,177,234,48,14,138,109,9,3,170,173,29,3,141,55,3, + 76,135,10,138,109,29,3,141,55,3,174,9,3,189,0,4, + 24,109,55,3,141,37,3,173,41,3,41,2,208,1,96,172, + 1,3,177,242,208,21,138,24,160,0,113,250,170,189,0,4, + 24,109,55,3,24,105,255,141,39,3,96,173,37,3,24,105, + 255,141,39,3,96,172,2,3,48,70,177,236,141,34,3,177, + 244,208,9,32,78,11,206,2,3,76,49,11,201,1,240,39, + 201,3,208,16,173,10,3,24,113,252,170,173,30,3,141,55, + 3,76,250,10,173,30,3,24,113,252,141,55,3,174,10,3, + 32,120,11,206,2,3,96,177,252,141,38,3,206,2,3,96, + 32,78,11,160,49,177,236,240,30,206,14,3,240,3,76,49, + 11,173,34,3,41,15,240,11,206,34,3,177,236,141,14,3, + 76,49,11,141,46,3,96,173,30,3,24,160,50,113,236,141, + 30,3,206,18,3,208,12,238,22,3,160,51,177,236,41,127, + 141,18,3,96,173,22,3,41,3,24,105,52,168,177,236,170, + 160,51,177,236,48,14,138,109,10,3,170,173,30,3,141,55, + 3,76,120,11,138,109,30,3,141,55,3,174,10,3,189,0, + 4,24,109,55,3,141,38,3,96,172,3,3,48,70,177,238, + 141,35,3,177,246,208,9,32,18,12,206,3,3,76,245,11, + 201,1,240,39,201,3,208,16,173,11,3,24,113,254,170,173, + 31,3,141,55,3,76,190,11,173,31,3,24,113,254,141,55, + 3,174,11,3,32,60,12,206,3,3,96,177,254,141,39,3, + 206,3,3,96,32,18,12,160,49,177,238,240,30,206,15,3, + 240,3,76,245,11,173,35,3,41,15,240,11,206,35,3,177, + 238,141,15,3,76,245,11,141,47,3,96,173,31,3,24,160, + 50,113,238,141,31,3,206,19,3,208,12,238,23,3,160,51, + 177,238,41,127,141,19,3,96,173,23,3,41,3,24,105,52, + 168,177,238,170,160,51,177,238,48,14,138,109,11,3,170,173, + 31,3,141,55,3,76,60,12,138,109,31,3,141,55,3,174, + 11,3,189,0,4,24,109,55,3,141,39,3,96 END_CONST_ARRAY; CONST_ARRAY(byte, mpt_obx) - 255,255,0,5,178,13,76,205,11,173,46,7,208,1,96,169, - 0,141,28,14,238,29,14,173,23,14,205,187,13,144,80,206, - 21,14,240,3,76,197,5,162,0,142,23,14,169,0,157,237, - 13,157,245,13,189,179,13,133,236,189,183,13,133,237,172,22, - 14,177,236,200,201,255,240,7,201,254,208,15,76,42,12,177, - 236,48,249,10,168,140,22,14,76,59,5,157,233,13,177,236, - 157,213,13,232,224,4,208,196,200,140,22,14,76,197,5,206, - 21,14,16,87,173,188,13,141,21,14,162,3,222,245,13,16, - 68,189,233,13,10,168,185,255,255,133,236,200,185,255,255,133, - 237,5,236,240,48,189,237,13,141,31,14,32,62,7,172,31, - 14,200,152,157,237,13,189,241,13,157,245,13,224,2,208,21, - 189,197,13,73,15,10,10,10,10,105,69,141,161,13,169,10, - 105,0,141,162,13,202,16,180,238,23,14,162,1,173,27,14, - 201,2,240,2,162,3,173,27,14,201,2,208,5,236,25,14, - 240,3,76,118,6,181,240,61,114,6,240,18,160,40,177,236, - 24,125,225,13,32,117,9,56,125,1,14,157,203,13,202,16, - 213,169,3,141,15,210,165,241,41,16,240,15,172,226,13,185, - 198,9,141,201,13,185,5,10,141,202,13,173,201,13,141,0, - 210,173,202,13,141,2,210,173,203,13,141,4,210,173,204,13, - 141,6,210,173,193,13,162,255,172,27,14,192,1,208,5,174, - 25,14,240,3,141,1,210,173,194,13,224,1,240,3,141,3, - 210,192,2,240,20,173,195,13,224,2,240,3,141,5,210,173, - 196,13,224,3,240,3,141,7,210,165,240,5,241,5,242,5, - 243,13,28,14,141,8,210,96,4,2,0,0,189,217,13,133, - 236,189,221,13,133,237,5,236,208,8,157,193,13,149,240,76, - 248,5,180,244,192,32,240,66,177,236,56,253,197,13,44,58, - 7,240,2,41,240,157,193,13,200,177,236,141,30,14,200,148, - 244,41,7,240,60,168,185,126,9,141,203,6,185,133,9,141, - 204,6,173,30,14,74,74,74,74,74,9,40,168,177,236,24, - 32,255,255,169,0,149,240,76,248,5,189,9,14,240,18,222, - 13,14,208,13,157,13,14,189,193,13,41,15,240,3,222,193, - 13,160,35,177,236,149,240,189,17,14,24,105,37,168,41,3, - 157,17,14,136,177,236,125,209,13,157,225,13,32,119,9,157, - 201,13,189,5,14,240,6,222,5,14,76,223,5,189,189,13, - 141,30,7,16,254,76,194,8,0,76,229,8,0,76,251,8, - 0,76,21,9,0,76,37,9,0,76,56,9,0,76,66,9, - 16,76,72,9,169,0,157,197,13,172,31,14,136,200,177,236, - 201,254,208,4,140,31,14,96,201,224,144,8,173,187,13,141, - 23,14,208,233,201,208,144,10,41,15,141,188,13,141,21,14, - 16,219,201,192,144,9,41,15,73,15,157,197,13,16,206,201, - 128,144,7,41,63,157,241,13,16,195,201,64,144,27,200,140, - 31,14,41,31,157,229,13,10,168,185,255,255,157,217,13,200, - 185,255,255,157,221,13,76,62,7,140,31,14,141,30,14,24, - 125,213,13,157,209,13,173,27,14,240,66,201,2,240,58,189, - 229,13,201,31,208,55,173,30,14,56,233,1,41,15,168,177, - 254,133,253,152,9,16,168,177,254,133,248,160,1,5,253,208, - 2,160,0,140,26,14,169,0,133,252,157,217,13,157,221,13, - 138,10,141,24,14,142,25,14,96,224,2,176,99,189,217,13, - 133,238,189,221,13,133,239,5,238,240,74,160,32,177,238,41, - 15,157,249,13,177,238,41,112,74,74,157,189,13,200,177,238, - 10,10,72,41,63,157,5,14,104,41,192,157,205,13,200,177, - 238,157,9,14,157,13,14,169,0,149,244,157,17,14,157,253, - 13,157,1,14,189,209,13,157,225,13,32,117,9,157,201,13, - 236,25,14,240,1,96,160,255,140,25,14,200,140,26,14,96, - 224,2,208,51,172,211,13,185,69,11,141,121,13,185,129,11, - 141,127,13,169,0,133,249,133,250,173,231,13,41,15,168,177, - 254,133,251,152,9,16,168,177,254,141,137,13,5,251,208,6, - 141,121,13,141,127,13,96,173,232,13,41,15,168,177,254,133, - 253,152,9,16,168,177,254,5,253,240,15,177,254,56,229,253, - 133,248,169,0,133,252,169,141,208,2,169,173,141,97,13,141, - 56,13,169,24,141,7,210,96,173,29,14,41,7,74,74,144, - 18,208,24,189,249,13,24,157,1,14,125,201,13,157,201,13, - 76,223,5,169,0,157,1,14,76,223,5,189,201,13,56,253, - 249,13,157,201,13,56,169,0,253,249,13,157,1,14,76,223, - 5,189,253,13,24,157,1,14,125,201,13,157,201,13,24,189, - 253,13,125,249,13,157,253,13,76,223,5,189,225,13,56,253, - 253,13,157,225,13,32,117,9,76,5,9,169,0,56,253,253, - 13,157,1,14,189,201,13,56,253,253,13,76,5,9,189,225, - 13,24,125,253,13,76,28,9,32,85,9,76,208,8,32,85, - 9,24,125,225,13,32,155,9,76,223,5,188,253,13,189,249, - 13,48,2,200,200,136,152,157,253,13,221,249,13,208,8,189, - 249,13,73,255,157,249,13,189,253,13,96,41,63,29,205,13, - 168,185,255,255,96,148,145,152,165,173,180,192,9,9,9,9, - 9,9,9,64,0,32,0,125,201,13,157,201,13,96,125,209, - 13,157,225,13,32,117,9,157,201,13,96,157,201,13,189,141, - 9,16,12,157,201,13,169,128,208,5,157,201,13,169,1,13, - 28,14,141,28,14,96,45,10,210,157,201,13,96,242,51,150, - 226,56,140,0,106,232,106,239,128,8,174,70,230,149,65,246, - 176,110,48,246,187,132,82,34,244,200,160,122,85,52,20,245, - 216,189,164,141,119,96,78,56,39,21,6,247,232,219,207,195, - 184,172,162,154,144,136,127,120,112,106,100,94,13,13,12,11, - 11,10,10,9,8,8,7,7,7,6,6,5,5,5,4,4, - 4,4,3,3,3,3,3,2,2,2,2,2,2,2,1,1, - 1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,24,24,24,24,24, - 24,24,24,24,24,24,24,24,24,24,24,22,22,23,23,23, - 23,24,24,24,24,24,25,25,25,25,26,21,21,22,22,22, - 23,23,24,24,24,25,25,26,26,26,27,20,21,21,22,22, - 23,23,24,24,24,25,25,26,26,27,27,20,20,21,21,22, - 22,23,23,24,25,25,26,26,27,27,28,19,20,20,21,22, - 22,23,23,24,25,25,26,26,27,28,28,19,19,20,21,21, - 22,23,23,24,25,25,26,27,27,28,29,18,19,20,20,21, - 22,23,23,24,25,25,26,27,28,28,29,18,19,19,20,21, - 22,22,23,24,25,26,26,27,28,29,29,18,18,19,20,21, - 22,22,23,24,25,26,26,27,28,29,30,17,18,19,20,21, - 22,22,23,24,25,26,26,27,28,29,30,17,18,19,20,21, - 21,22,23,24,25,26,27,27,28,29,30,17,18,19,20,20, - 21,22,23,24,25,26,27,28,28,29,30,17,18,19,19,20, - 21,22,23,24,25,26,27,28,29,29,30,17,18,18,19,20, - 21,22,23,24,25,26,27,28,29,30,30,16,17,18,19,20, - 21,22,23,24,25,26,27,28,29,30,31,32,34,36,38,41, - 43,46,48,51,55,58,61,65,69,73,77,82,87,92,97,103, - 110,116,123,130,138,146,155,164,174,184,195,207,220,233,246,5, - 21,37,55,73,93,113,135,159,184,210,237,11,42,75,110,147, - 186,227,15,62,112,164,219,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1, - 1,1,1,1,1,1,1,2,2,2,2,2,2,2,3,3, - 3,3,3,229,42,64,89,100,238,8,166,11,12,12,12,12, - 12,13,13,142,50,7,140,54,7,41,7,168,185,189,11,141, - 227,11,185,197,11,141,228,11,76,255,255,173,54,7,174,50, - 7,141,148,7,141,155,7,142,149,7,142,156,7,24,105,64, - 141,129,5,141,135,5,144,1,232,142,130,5,142,136,5,24, - 105,128,141,124,9,144,1,232,142,125,9,232,141,31,12,142, - 32,12,162,9,189,255,255,157,179,13,202,16,247,206,188,13, - 169,0,141,46,7,162,98,157,189,13,202,16,250,162,8,157, - 0,210,202,16,250,96,32,42,12,173,50,7,10,141,22,14, - 173,187,13,141,23,14,169,1,141,21,14,141,46,7,96,173, - 54,7,133,254,173,50,7,133,255,96,173,54,7,41,3,170, - 173,50,7,32,198,7,173,26,14,240,238,14,54,7,32,190, - 12,169,1,141,27,14,173,26,14,240,222,201,1,208,5,160, - 0,238,26,14,177,252,174,24,14,74,74,74,74,9,16,141, - 10,212,141,10,212,157,1,210,177,252,9,16,141,10,212,141, - 10,212,157,1,210,200,208,206,230,253,165,253,197,248,208,198, - 140,26,14,96,144,21,169,234,141,153,12,141,154,12,141,155, - 12,141,166,12,141,167,12,141,168,12,96,169,141,141,153,12, - 141,166,12,169,10,141,154,12,141,167,12,169,212,141,155,12, - 141,168,12,96,169,0,141,26,14,173,50,7,74,32,190,12, - 169,1,141,27,14,32,128,12,173,27,14,208,248,96,169,2, - 141,27,14,141,25,14,169,24,141,7,210,169,17,133,250,169, - 13,133,251,169,173,141,97,13,141,56,13,160,0,140,121,13, - 140,127,13,174,11,212,177,252,74,74,74,74,9,16,141,7, - 210,32,117,13,236,11,212,240,251,141,5,210,174,11,212,177, - 252,230,252,208,16,230,253,198,248,208,10,169,173,141,97,13, - 141,56,13,169,8,9,16,141,7,210,32,117,13,236,11,212, - 240,251,141,5,210,173,27,14,208,185,96,24,165,249,105,0, - 133,249,165,250,105,0,133,250,144,15,230,251,165,251,201,0, - 208,7,140,121,13,140,127,13,96,177,250,36,249,48,4,74, - 74,74,74,41,15,168,185,69,10,160,0,96,160,0,140,27, - 14,140,26,14,136,140,25,14,96 + 255,255,0,5,178,13,76,205,11,173,46,7,208,1,96,169, + 0,141,28,14,238,29,14,173,23,14,205,187,13,144,80,206, + 21,14,240,3,76,197,5,162,0,142,23,14,169,0,157,237, + 13,157,245,13,189,179,13,133,236,189,183,13,133,237,172,22, + 14,177,236,200,201,255,240,7,201,254,208,15,76,42,12,177, + 236,48,249,10,168,140,22,14,76,59,5,157,233,13,177,236, + 157,213,13,232,224,4,208,196,200,140,22,14,76,197,5,206, + 21,14,16,87,173,188,13,141,21,14,162,3,222,245,13,16, + 68,189,233,13,10,168,185,255,255,133,236,200,185,255,255,133, + 237,5,236,240,48,189,237,13,141,31,14,32,62,7,172,31, + 14,200,152,157,237,13,189,241,13,157,245,13,224,2,208,21, + 189,197,13,73,15,10,10,10,10,105,69,141,161,13,169,10, + 105,0,141,162,13,202,16,180,238,23,14,162,1,173,27,14, + 201,2,240,2,162,3,173,27,14,201,2,208,5,236,25,14, + 240,3,76,118,6,181,240,61,114,6,240,18,160,40,177,236, + 24,125,225,13,32,117,9,56,125,1,14,157,203,13,202,16, + 213,169,3,141,15,210,165,241,41,16,240,15,172,226,13,185, + 198,9,141,201,13,185,5,10,141,202,13,173,201,13,141,0, + 210,173,202,13,141,2,210,173,203,13,141,4,210,173,204,13, + 141,6,210,173,193,13,162,255,172,27,14,192,1,208,5,174, + 25,14,240,3,141,1,210,173,194,13,224,1,240,3,141,3, + 210,192,2,240,20,173,195,13,224,2,240,3,141,5,210,173, + 196,13,224,3,240,3,141,7,210,165,240,5,241,5,242,5, + 243,13,28,14,141,8,210,96,4,2,0,0,189,217,13,133, + 236,189,221,13,133,237,5,236,208,8,157,193,13,149,240,76, + 248,5,180,244,192,32,240,66,177,236,56,253,197,13,44,58, + 7,240,2,41,240,157,193,13,200,177,236,141,30,14,200,148, + 244,41,7,240,60,168,185,126,9,141,203,6,185,133,9,141, + 204,6,173,30,14,74,74,74,74,74,9,40,168,177,236,24, + 32,255,255,169,0,149,240,76,248,5,189,9,14,240,18,222, + 13,14,208,13,157,13,14,189,193,13,41,15,240,3,222,193, + 13,160,35,177,236,149,240,189,17,14,24,105,37,168,41,3, + 157,17,14,136,177,236,125,209,13,157,225,13,32,119,9,157, + 201,13,189,5,14,240,6,222,5,14,76,223,5,189,189,13, + 141,30,7,16,254,76,194,8,0,76,229,8,0,76,251,8, + 0,76,21,9,0,76,37,9,0,76,56,9,0,76,66,9, + 16,76,72,9,169,0,157,197,13,172,31,14,136,200,177,236, + 201,254,208,4,140,31,14,96,201,224,144,8,173,187,13,141, + 23,14,208,233,201,208,144,10,41,15,141,188,13,141,21,14, + 16,219,201,192,144,9,41,15,73,15,157,197,13,16,206,201, + 128,144,7,41,63,157,241,13,16,195,201,64,144,27,200,140, + 31,14,41,31,157,229,13,10,168,185,255,255,157,217,13,200, + 185,255,255,157,221,13,76,62,7,140,31,14,141,30,14,24, + 125,213,13,157,209,13,173,27,14,240,66,201,2,240,58,189, + 229,13,201,31,208,55,173,30,14,56,233,1,41,15,168,177, + 254,133,253,152,9,16,168,177,254,133,248,160,1,5,253,208, + 2,160,0,140,26,14,169,0,133,252,157,217,13,157,221,13, + 138,10,141,24,14,142,25,14,96,224,2,176,99,189,217,13, + 133,238,189,221,13,133,239,5,238,240,74,160,32,177,238,41, + 15,157,249,13,177,238,41,112,74,74,157,189,13,200,177,238, + 10,10,72,41,63,157,5,14,104,41,192,157,205,13,200,177, + 238,157,9,14,157,13,14,169,0,149,244,157,17,14,157,253, + 13,157,1,14,189,209,13,157,225,13,32,117,9,157,201,13, + 236,25,14,240,1,96,160,255,140,25,14,200,140,26,14,96, + 224,2,208,51,172,211,13,185,69,11,141,121,13,185,129,11, + 141,127,13,169,0,133,249,133,250,173,231,13,41,15,168,177, + 254,133,251,152,9,16,168,177,254,141,137,13,5,251,208,6, + 141,121,13,141,127,13,96,173,232,13,41,15,168,177,254,133, + 253,152,9,16,168,177,254,5,253,240,15,177,254,56,229,253, + 133,248,169,0,133,252,169,141,208,2,169,173,141,97,13,141, + 56,13,169,24,141,7,210,96,173,29,14,41,7,74,74,144, + 18,208,24,189,249,13,24,157,1,14,125,201,13,157,201,13, + 76,223,5,169,0,157,1,14,76,223,5,189,201,13,56,253, + 249,13,157,201,13,56,169,0,253,249,13,157,1,14,76,223, + 5,189,253,13,24,157,1,14,125,201,13,157,201,13,24,189, + 253,13,125,249,13,157,253,13,76,223,5,189,225,13,56,253, + 253,13,157,225,13,32,117,9,76,5,9,169,0,56,253,253, + 13,157,1,14,189,201,13,56,253,253,13,76,5,9,189,225, + 13,24,125,253,13,76,28,9,32,85,9,76,208,8,32,85, + 9,24,125,225,13,32,155,9,76,223,5,188,253,13,189,249, + 13,48,2,200,200,136,152,157,253,13,221,249,13,208,8,189, + 249,13,73,255,157,249,13,189,253,13,96,41,63,29,205,13, + 168,185,255,255,96,148,145,152,165,173,180,192,9,9,9,9, + 9,9,9,64,0,32,0,125,201,13,157,201,13,96,125,209, + 13,157,225,13,32,117,9,157,201,13,96,157,201,13,189,141, + 9,16,12,157,201,13,169,128,208,5,157,201,13,169,1,13, + 28,14,141,28,14,96,45,10,210,157,201,13,96,242,51,150, + 226,56,140,0,106,232,106,239,128,8,174,70,230,149,65,246, + 176,110,48,246,187,132,82,34,244,200,160,122,85,52,20,245, + 216,189,164,141,119,96,78,56,39,21,6,247,232,219,207,195, + 184,172,162,154,144,136,127,120,112,106,100,94,13,13,12,11, + 11,10,10,9,8,8,7,7,7,6,6,5,5,5,4,4, + 4,4,3,3,3,3,3,2,2,2,2,2,2,2,1,1, + 1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,24,24,24,24,24, + 24,24,24,24,24,24,24,24,24,24,24,22,22,23,23,23, + 23,24,24,24,24,24,25,25,25,25,26,21,21,22,22,22, + 23,23,24,24,24,25,25,26,26,26,27,20,21,21,22,22, + 23,23,24,24,24,25,25,26,26,27,27,20,20,21,21,22, + 22,23,23,24,25,25,26,26,27,27,28,19,20,20,21,22, + 22,23,23,24,25,25,26,26,27,28,28,19,19,20,21,21, + 22,23,23,24,25,25,26,27,27,28,29,18,19,20,20,21, + 22,23,23,24,25,25,26,27,28,28,29,18,19,19,20,21, + 22,22,23,24,25,26,26,27,28,29,29,18,18,19,20,21, + 22,22,23,24,25,26,26,27,28,29,30,17,18,19,20,21, + 22,22,23,24,25,26,26,27,28,29,30,17,18,19,20,21, + 21,22,23,24,25,26,27,27,28,29,30,17,18,19,20,20, + 21,22,23,24,25,26,27,28,28,29,30,17,18,19,19,20, + 21,22,23,24,25,26,27,28,29,29,30,17,18,18,19,20, + 21,22,23,24,25,26,27,28,29,30,30,16,17,18,19,20, + 21,22,23,24,25,26,27,28,29,30,31,32,34,36,38,41, + 43,46,48,51,55,58,61,65,69,73,77,82,87,92,97,103, + 110,116,123,130,138,146,155,164,174,184,195,207,220,233,246,5, + 21,37,55,73,93,113,135,159,184,210,237,11,42,75,110,147, + 186,227,15,62,112,164,219,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1, + 1,1,1,1,1,1,1,2,2,2,2,2,2,2,3,3, + 3,3,3,229,42,64,89,100,238,8,166,11,12,12,12,12, + 12,13,13,142,50,7,140,54,7,41,7,168,185,189,11,141, + 227,11,185,197,11,141,228,11,76,255,255,173,54,7,174,50, + 7,141,148,7,141,155,7,142,149,7,142,156,7,24,105,64, + 141,129,5,141,135,5,144,1,232,142,130,5,142,136,5,24, + 105,128,141,124,9,144,1,232,142,125,9,232,141,31,12,142, + 32,12,162,9,189,255,255,157,179,13,202,16,247,206,188,13, + 169,0,141,46,7,162,98,157,189,13,202,16,250,162,8,157, + 0,210,202,16,250,96,32,42,12,173,50,7,10,141,22,14, + 173,187,13,141,23,14,169,1,141,21,14,141,46,7,96,173, + 54,7,133,254,173,50,7,133,255,96,173,54,7,41,3,170, + 173,50,7,32,198,7,173,26,14,240,238,14,54,7,32,190, + 12,169,1,141,27,14,173,26,14,240,222,201,1,208,5,160, + 0,238,26,14,177,252,174,24,14,74,74,74,74,9,16,141, + 10,212,141,10,212,157,1,210,177,252,9,16,141,10,212,141, + 10,212,157,1,210,200,208,206,230,253,165,253,197,248,208,198, + 140,26,14,96,144,21,169,234,141,153,12,141,154,12,141,155, + 12,141,166,12,141,167,12,141,168,12,96,169,141,141,153,12, + 141,166,12,169,10,141,154,12,141,167,12,169,212,141,155,12, + 141,168,12,96,169,0,141,26,14,173,50,7,74,32,190,12, + 169,1,141,27,14,32,128,12,173,27,14,208,248,96,169,2, + 141,27,14,141,25,14,169,24,141,7,210,169,17,133,250,169, + 13,133,251,169,173,141,97,13,141,56,13,160,0,140,121,13, + 140,127,13,174,11,212,177,252,74,74,74,74,9,16,141,7, + 210,32,117,13,236,11,212,240,251,141,5,210,174,11,212,177, + 252,230,252,208,16,230,253,198,248,208,10,169,173,141,97,13, + 141,56,13,169,8,9,16,141,7,210,32,117,13,236,11,212, + 240,251,141,5,210,173,27,14,208,185,96,24,165,249,105,0, + 133,249,165,250,105,0,133,250,144,15,230,251,165,251,201,0, + 208,7,140,121,13,140,127,13,96,177,250,36,249,48,4,74, + 74,74,74,41,15,168,185,69,10,160,0,96,160,0,140,27, + 14,140,26,14,136,140,25,14,96 END_CONST_ARRAY; CONST_ARRAY(byte, rmt4_obx) - 255,255,144,3,96,11,128,0,128,32,128,64,0,192,128,128, - 128,160,0,192,64,192,0,1,5,11,21,0,1,255,255,1, - 1,0,255,255,0,1,1,1,0,255,255,255,255,0,1,1, - 0,0,0,0,0,0,242,51,150,226,56,140,0,106,232,106, - 239,128,8,174,70,230,149,65,246,176,110,48,246,187,132,82, - 34,244,200,160,122,85,52,20,245,216,189,164,141,119,96,78, - 56,39,21,6,247,232,219,207,195,184,172,162,154,144,136,127, - 120,112,106,100,94,0,191,182,170,161,152,143,137,128,242,230, - 218,206,191,182,170,161,152,143,137,128,122,113,107,101,95,92, - 86,80,77,71,68,62,60,56,53,50,47,45,42,40,37,35, - 33,31,29,28,26,24,23,22,20,19,18,17,16,15,14,13, - 12,11,10,9,8,7,255,241,228,216,202,192,181,171,162,153, - 142,135,127,121,115,112,102,97,90,85,82,75,72,67,63,60, - 57,55,51,48,45,42,40,37,36,33,31,30,28,27,25,23, - 22,21,19,18,17,16,15,14,13,12,11,10,9,8,7,6, - 5,4,3,2,1,0,243,230,217,204,193,181,173,162,153,144, - 136,128,121,114,108,102,96,91,85,81,76,72,68,64,60,57, - 53,50,47,45,42,40,37,35,33,31,29,28,26,24,23,22, - 20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5, - 4,3,2,1,0,0,13,13,12,11,11,10,10,9,8,8, - 7,7,7,6,6,5,5,5,4,4,4,4,3,3,3,3, - 3,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1, - 1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1, - 1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,1, - 1,1,2,2,2,2,0,0,0,1,1,1,1,1,2,2, - 2,2,2,3,3,3,0,0,1,1,1,1,2,2,2,2, - 3,3,3,3,4,4,0,0,1,1,1,2,2,2,3,3, - 3,4,4,4,5,5,0,0,1,1,2,2,2,3,3,4, - 4,4,5,5,6,6,0,0,1,1,2,2,3,3,4,4, - 5,5,6,6,7,7,0,1,1,2,2,3,3,4,4,5, - 5,6,6,7,7,8,0,1,1,2,2,3,4,4,5,5, - 6,7,7,8,8,9,0,1,1,2,3,3,4,5,5,6, - 7,7,8,9,9,10,0,1,1,2,3,4,4,5,6,7, - 7,8,9,10,10,11,0,1,2,2,3,4,5,6,6,7, - 8,9,10,10,11,12,0,1,2,3,3,4,5,6,7,8, - 9,10,10,11,12,13,0,1,2,3,4,5,6,7,7,8, - 9,10,11,12,13,14,0,1,2,3,4,5,6,7,8,9, - 10,11,12,13,14,15,76,15,6,76,252,7,76,33,8,76, - 88,6,76,43,11,134,211,132,212,72,160,168,169,0,153,127, - 2,136,208,250,160,4,177,211,141,21,8,200,177,211,141,36, - 3,200,177,211,141,5,8,141,38,3,160,8,177,211,153,195, - 0,200,192,16,208,246,104,72,10,10,24,101,209,133,209,104, - 8,41,192,10,42,42,40,101,210,133,210,32,110,6,169,0, - 141,8,210,160,3,140,15,210,160,8,153,0,210,136,16,250, - 173,5,8,96,162,0,142,39,3,138,168,177,209,201,254,176, - 45,168,177,205,157,128,2,177,207,157,132,2,169,0,157,136, - 2,169,1,157,140,2,169,128,157,180,2,232,224,4,208,217, - 165,209,24,105,4,133,209,144,27,230,210,76,190,6,240,4, - 169,0,240,223,160,2,177,209,170,200,177,209,133,210,134,209, - 162,0,240,181,173,36,3,141,22,7,162,255,232,222,140,2, - 208,69,189,128,2,133,211,189,132,2,133,212,188,136,2,254, - 136,2,177,211,133,217,41,63,201,61,240,17,176,56,157,144, - 2,157,16,3,200,177,211,74,41,126,157,180,2,169,1,157, - 140,2,188,136,2,254,136,2,177,211,74,102,217,74,102,217, - 165,217,41,240,157,148,2,224,3,208,177,169,255,141,36,3, - 141,37,3,76,101,7,201,63,240,27,165,217,41,192,240,9, - 10,42,42,157,140,2,76,17,7,200,177,211,157,140,2,254, - 136,2,76,17,7,165,217,48,12,200,177,211,141,22,7,254, - 136,2,76,214,6,201,255,240,9,200,177,211,157,136,2,76, - 214,6,76,110,6,76,33,8,202,48,250,188,180,2,48,248, - 177,203,157,184,2,133,215,200,177,203,157,188,2,133,216,169, - 1,157,20,3,168,177,215,157,4,3,200,177,215,157,196,2, - 200,177,215,157,200,2,200,177,215,157,240,2,41,63,157,8, - 3,177,215,41,64,157,244,2,200,177,215,157,32,3,200,177, - 215,157,208,2,200,177,215,157,216,2,200,177,215,157,220,2, - 200,177,215,168,185,160,3,157,224,2,157,228,2,185,161,3, - 157,232,2,160,10,177,215,157,236,2,169,128,157,212,2,157, - 180,2,10,157,204,2,157,156,2,168,177,215,157,0,3,105, - 0,157,192,2,169,12,157,252,2,168,177,215,157,248,2,76, - 98,7,32,43,11,206,38,3,208,29,169,255,141,38,3,206, - 37,3,208,19,238,39,3,173,39,3,201,255,240,3,76,190, - 6,76,110,6,76,95,10,169,4,133,214,162,3,189,188,2, - 240,242,133,212,189,184,2,133,211,188,192,2,177,211,133,217, - 200,177,211,133,218,200,177,211,133,219,200,152,221,196,2,144, - 10,240,8,169,128,157,204,2,189,200,2,157,192,2,165,217, - 41,15,29,148,2,168,185,0,5,133,220,165,218,41,14,168, - 185,144,3,133,213,165,220,25,145,3,157,28,3,189,220,2, - 240,40,201,1,208,33,189,156,2,24,125,236,2,24,188,224, - 2,121,165,3,157,156,2,200,152,221,232,2,208,3,189,228, - 2,157,224,2,76,164,8,222,220,2,188,0,3,192,13,144, - 60,189,8,3,16,49,152,221,252,2,208,8,189,4,3,157, - 252,2,208,3,254,252,2,189,184,2,133,215,189,188,2,133, - 216,188,252,2,177,215,188,244,2,240,4,24,125,248,2,157, - 248,2,189,240,2,41,63,56,233,1,157,8,3,189,204,2, - 16,31,189,148,2,240,26,221,216,2,240,21,144,19,168,189, - 212,2,24,125,208,2,157,212,2,144,6,152,233,16,157,148, - 2,169,0,133,221,165,218,157,12,3,41,112,74,74,141,28, - 9,144,254,76,210,9,234,76,60,9,234,76,65,9,234,76, - 75,9,234,76,87,9,234,76,102,9,234,76,169,9,234,76, - 184,9,165,219,76,21,10,165,219,133,221,189,144,2,76,216, - 9,189,144,2,24,101,219,157,144,2,76,216,9,189,156,2, - 24,101,219,157,156,2,189,144,2,76,216,9,189,240,2,16, - 12,188,144,2,177,213,24,125,248,2,76,135,9,189,144,2, - 24,125,248,2,201,61,144,2,169,63,168,177,213,157,160,2, - 164,219,208,3,157,164,2,152,74,74,74,74,157,168,2,157, - 172,2,165,219,41,15,157,176,2,189,144,2,76,216,9,165, - 219,24,125,20,3,157,20,3,189,144,2,76,216,9,165,219, - 201,128,240,6,157,144,2,76,216,9,189,28,3,9,240,157, - 28,3,189,144,2,76,216,9,189,144,2,24,101,219,188,240, - 2,48,31,24,125,248,2,201,61,144,7,169,0,157,28,3, - 169,63,157,16,3,168,177,213,24,125,156,2,24,101,221,76, - 21,10,201,61,144,7,169,0,157,28,3,169,63,168,189,156, - 2,24,125,248,2,24,113,213,24,101,221,157,24,3,189,172, - 2,240,50,222,172,2,208,45,189,168,2,157,172,2,189,164, - 2,221,160,2,240,31,176,13,125,176,2,176,18,221,160,2, - 176,13,76,76,10,253,176,2,144,5,221,160,2,176,3,189, - 160,2,157,164,2,165,218,41,1,240,10,189,164,2,24,125, - 156,2,157,24,3,202,48,3,76,39,8,173,32,3,13,33, - 3,13,34,3,13,35,3,170,142,44,11,173,12,3,16,33, - 173,28,3,41,15,240,26,173,24,3,24,109,20,3,141,26, - 3,173,30,3,41,16,208,5,169,0,141,30,3,138,9,4, - 170,173,13,3,16,33,173,29,3,41,15,240,26,173,25,3, - 24,109,21,3,141,27,3,173,31,3,41,16,208,5,169,0, - 141,31,3,138,9,2,170,236,44,11,208,94,173,13,3,41, - 14,201,6,208,38,173,29,3,41,15,240,31,172,17,3,185, - 192,3,141,24,3,185,192,4,141,25,3,173,28,3,41,16, - 208,5,169,0,141,28,3,138,9,80,170,173,15,3,41,14, - 201,6,208,38,173,31,3,41,15,240,31,172,19,3,185,192, - 3,141,26,3,185,192,4,141,27,3,173,30,3,41,16,208, - 5,169,0,141,30,3,138,9,40,170,142,44,11,173,38,3, - 96,160,255,173,24,3,174,28,3,141,0,210,142,1,210,173, - 25,3,174,29,3,141,2,210,142,3,210,173,26,3,174,30, - 3,141,4,210,142,5,210,173,27,3,174,31,3,141,6,210, - 142,7,210,140,8,210,96 + 255,255,144,3,96,11,128,0,128,32,128,64,0,192,128,128, + 128,160,0,192,64,192,0,1,5,11,21,0,1,255,255,1, + 1,0,255,255,0,1,1,1,0,255,255,255,255,0,1,1, + 0,0,0,0,0,0,242,51,150,226,56,140,0,106,232,106, + 239,128,8,174,70,230,149,65,246,176,110,48,246,187,132,82, + 34,244,200,160,122,85,52,20,245,216,189,164,141,119,96,78, + 56,39,21,6,247,232,219,207,195,184,172,162,154,144,136,127, + 120,112,106,100,94,0,191,182,170,161,152,143,137,128,242,230, + 218,206,191,182,170,161,152,143,137,128,122,113,107,101,95,92, + 86,80,77,71,68,62,60,56,53,50,47,45,42,40,37,35, + 33,31,29,28,26,24,23,22,20,19,18,17,16,15,14,13, + 12,11,10,9,8,7,255,241,228,216,202,192,181,171,162,153, + 142,135,127,121,115,112,102,97,90,85,82,75,72,67,63,60, + 57,55,51,48,45,42,40,37,36,33,31,30,28,27,25,23, + 22,21,19,18,17,16,15,14,13,12,11,10,9,8,7,6, + 5,4,3,2,1,0,243,230,217,204,193,181,173,162,153,144, + 136,128,121,114,108,102,96,91,85,81,76,72,68,64,60,57, + 53,50,47,45,42,40,37,35,33,31,29,28,26,24,23,22, + 20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5, + 4,3,2,1,0,0,13,13,12,11,11,10,10,9,8,8, + 7,7,7,6,6,5,5,5,4,4,4,4,3,3,3,3, + 3,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1, + 1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1, + 1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,1, + 1,1,2,2,2,2,0,0,0,1,1,1,1,1,2,2, + 2,2,2,3,3,3,0,0,1,1,1,1,2,2,2,2, + 3,3,3,3,4,4,0,0,1,1,1,2,2,2,3,3, + 3,4,4,4,5,5,0,0,1,1,2,2,2,3,3,4, + 4,4,5,5,6,6,0,0,1,1,2,2,3,3,4,4, + 5,5,6,6,7,7,0,1,1,2,2,3,3,4,4,5, + 5,6,6,7,7,8,0,1,1,2,2,3,4,4,5,5, + 6,7,7,8,8,9,0,1,1,2,3,3,4,5,5,6, + 7,7,8,9,9,10,0,1,1,2,3,4,4,5,6,7, + 7,8,9,10,10,11,0,1,2,2,3,4,5,6,6,7, + 8,9,10,10,11,12,0,1,2,3,3,4,5,6,7,8, + 9,10,10,11,12,13,0,1,2,3,4,5,6,7,7,8, + 9,10,11,12,13,14,0,1,2,3,4,5,6,7,8,9, + 10,11,12,13,14,15,76,15,6,76,252,7,76,33,8,76, + 88,6,76,43,11,134,211,132,212,72,160,168,169,0,153,127, + 2,136,208,250,160,4,177,211,141,21,8,200,177,211,141,36, + 3,200,177,211,141,5,8,141,38,3,160,8,177,211,153,195, + 0,200,192,16,208,246,104,72,10,10,24,101,209,133,209,104, + 8,41,192,10,42,42,40,101,210,133,210,32,110,6,169,0, + 141,8,210,160,3,140,15,210,160,8,153,0,210,136,16,250, + 173,5,8,96,162,0,142,39,3,138,168,177,209,201,254,176, + 45,168,177,205,157,128,2,177,207,157,132,2,169,0,157,136, + 2,169,1,157,140,2,169,128,157,180,2,232,224,4,208,217, + 165,209,24,105,4,133,209,144,27,230,210,76,190,6,240,4, + 169,0,240,223,160,2,177,209,170,200,177,209,133,210,134,209, + 162,0,240,181,173,36,3,141,22,7,162,255,232,222,140,2, + 208,69,189,128,2,133,211,189,132,2,133,212,188,136,2,254, + 136,2,177,211,133,217,41,63,201,61,240,17,176,56,157,144, + 2,157,16,3,200,177,211,74,41,126,157,180,2,169,1,157, + 140,2,188,136,2,254,136,2,177,211,74,102,217,74,102,217, + 165,217,41,240,157,148,2,224,3,208,177,169,255,141,36,3, + 141,37,3,76,101,7,201,63,240,27,165,217,41,192,240,9, + 10,42,42,157,140,2,76,17,7,200,177,211,157,140,2,254, + 136,2,76,17,7,165,217,48,12,200,177,211,141,22,7,254, + 136,2,76,214,6,201,255,240,9,200,177,211,157,136,2,76, + 214,6,76,110,6,76,33,8,202,48,250,188,180,2,48,248, + 177,203,157,184,2,133,215,200,177,203,157,188,2,133,216,169, + 1,157,20,3,168,177,215,157,4,3,200,177,215,157,196,2, + 200,177,215,157,200,2,200,177,215,157,240,2,41,63,157,8, + 3,177,215,41,64,157,244,2,200,177,215,157,32,3,200,177, + 215,157,208,2,200,177,215,157,216,2,200,177,215,157,220,2, + 200,177,215,168,185,160,3,157,224,2,157,228,2,185,161,3, + 157,232,2,160,10,177,215,157,236,2,169,128,157,212,2,157, + 180,2,10,157,204,2,157,156,2,168,177,215,157,0,3,105, + 0,157,192,2,169,12,157,252,2,168,177,215,157,248,2,76, + 98,7,32,43,11,206,38,3,208,29,169,255,141,38,3,206, + 37,3,208,19,238,39,3,173,39,3,201,255,240,3,76,190, + 6,76,110,6,76,95,10,169,4,133,214,162,3,189,188,2, + 240,242,133,212,189,184,2,133,211,188,192,2,177,211,133,217, + 200,177,211,133,218,200,177,211,133,219,200,152,221,196,2,144, + 10,240,8,169,128,157,204,2,189,200,2,157,192,2,165,217, + 41,15,29,148,2,168,185,0,5,133,220,165,218,41,14,168, + 185,144,3,133,213,165,220,25,145,3,157,28,3,189,220,2, + 240,40,201,1,208,33,189,156,2,24,125,236,2,24,188,224, + 2,121,165,3,157,156,2,200,152,221,232,2,208,3,189,228, + 2,157,224,2,76,164,8,222,220,2,188,0,3,192,13,144, + 60,189,8,3,16,49,152,221,252,2,208,8,189,4,3,157, + 252,2,208,3,254,252,2,189,184,2,133,215,189,188,2,133, + 216,188,252,2,177,215,188,244,2,240,4,24,125,248,2,157, + 248,2,189,240,2,41,63,56,233,1,157,8,3,189,204,2, + 16,31,189,148,2,240,26,221,216,2,240,21,144,19,168,189, + 212,2,24,125,208,2,157,212,2,144,6,152,233,16,157,148, + 2,169,0,133,221,165,218,157,12,3,41,112,74,74,141,28, + 9,144,254,76,210,9,234,76,60,9,234,76,65,9,234,76, + 75,9,234,76,87,9,234,76,102,9,234,76,169,9,234,76, + 184,9,165,219,76,21,10,165,219,133,221,189,144,2,76,216, + 9,189,144,2,24,101,219,157,144,2,76,216,9,189,156,2, + 24,101,219,157,156,2,189,144,2,76,216,9,189,240,2,16, + 12,188,144,2,177,213,24,125,248,2,76,135,9,189,144,2, + 24,125,248,2,201,61,144,2,169,63,168,177,213,157,160,2, + 164,219,208,3,157,164,2,152,74,74,74,74,157,168,2,157, + 172,2,165,219,41,15,157,176,2,189,144,2,76,216,9,165, + 219,24,125,20,3,157,20,3,189,144,2,76,216,9,165,219, + 201,128,240,6,157,144,2,76,216,9,189,28,3,9,240,157, + 28,3,189,144,2,76,216,9,189,144,2,24,101,219,188,240, + 2,48,31,24,125,248,2,201,61,144,7,169,0,157,28,3, + 169,63,157,16,3,168,177,213,24,125,156,2,24,101,221,76, + 21,10,201,61,144,7,169,0,157,28,3,169,63,168,189,156, + 2,24,125,248,2,24,113,213,24,101,221,157,24,3,189,172, + 2,240,50,222,172,2,208,45,189,168,2,157,172,2,189,164, + 2,221,160,2,240,31,176,13,125,176,2,176,18,221,160,2, + 176,13,76,76,10,253,176,2,144,5,221,160,2,176,3,189, + 160,2,157,164,2,165,218,41,1,240,10,189,164,2,24,125, + 156,2,157,24,3,202,48,3,76,39,8,173,32,3,13,33, + 3,13,34,3,13,35,3,170,142,44,11,173,12,3,16,33, + 173,28,3,41,15,240,26,173,24,3,24,109,20,3,141,26, + 3,173,30,3,41,16,208,5,169,0,141,30,3,138,9,4, + 170,173,13,3,16,33,173,29,3,41,15,240,26,173,25,3, + 24,109,21,3,141,27,3,173,31,3,41,16,208,5,169,0, + 141,31,3,138,9,2,170,236,44,11,208,94,173,13,3,41, + 14,201,6,208,38,173,29,3,41,15,240,31,172,17,3,185, + 192,3,141,24,3,185,192,4,141,25,3,173,28,3,41,16, + 208,5,169,0,141,28,3,138,9,80,170,173,15,3,41,14, + 201,6,208,38,173,31,3,41,15,240,31,172,19,3,185,192, + 3,141,26,3,185,192,4,141,27,3,173,30,3,41,16,208, + 5,169,0,141,30,3,138,9,40,170,142,44,11,173,38,3, + 96,160,255,173,24,3,174,28,3,141,0,210,142,1,210,173, + 25,3,174,29,3,141,2,210,142,3,210,173,26,3,174,30, + 3,141,4,210,142,5,210,173,27,3,174,31,3,141,6,210, + 142,7,210,140,8,210,96 END_CONST_ARRAY; CONST_ARRAY(byte, rmt8_obx) - 255,255,144,3,108,12,128,0,128,32,128,64,0,192,128,128, - 128,160,0,192,64,192,0,1,5,11,21,0,1,255,255,1, - 1,0,255,255,0,1,1,1,0,255,255,255,255,0,1,1, - 0,0,0,0,0,0,242,51,150,226,56,140,0,106,232,106, - 239,128,8,174,70,230,149,65,246,176,110,48,246,187,132,82, - 34,244,200,160,122,85,52,20,245,216,189,164,141,119,96,78, - 56,39,21,6,247,232,219,207,195,184,172,162,154,144,136,127, - 120,112,106,100,94,0,191,182,170,161,152,143,137,128,242,230, - 218,206,191,182,170,161,152,143,137,128,122,113,107,101,95,92, - 86,80,77,71,68,62,60,56,53,50,47,45,42,40,37,35, - 33,31,29,28,26,24,23,22,20,19,18,17,16,15,14,13, - 12,11,10,9,8,7,255,241,228,216,202,192,181,171,162,153, - 142,135,127,121,115,112,102,97,90,85,82,75,72,67,63,60, - 57,55,51,48,45,42,40,37,36,33,31,30,28,27,25,23, - 22,21,19,18,17,16,15,14,13,12,11,10,9,8,7,6, - 5,4,3,2,1,0,243,230,217,204,193,181,173,162,153,144, - 136,128,121,114,108,102,96,91,85,81,76,72,68,64,60,57, - 53,50,47,45,42,40,37,35,33,31,29,28,26,24,23,22, - 20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5, - 4,3,2,1,0,0,13,13,12,11,11,10,10,9,8,8, - 7,7,7,6,6,5,5,5,4,4,4,4,3,3,3,3, - 3,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1, - 1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1, - 1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,1, - 1,1,2,2,2,2,0,0,0,1,1,1,1,1,2,2, - 2,2,2,3,3,3,0,0,1,1,1,1,2,2,2,2, - 3,3,3,3,4,4,0,0,1,1,1,2,2,2,3,3, - 3,4,4,4,5,5,0,0,1,1,2,2,2,3,3,4, - 4,4,5,5,6,6,0,0,1,1,2,2,3,3,4,4, - 5,5,6,6,7,7,0,1,1,2,2,3,3,4,4,5, - 5,6,6,7,7,8,0,1,1,2,2,3,4,4,5,5, - 6,7,7,8,8,9,0,1,1,2,3,3,4,5,5,6, - 7,7,8,9,9,10,0,1,1,2,3,4,4,5,6,7, - 7,8,9,10,10,11,0,1,2,2,3,4,5,6,6,7, - 8,9,10,10,11,12,0,1,2,3,3,4,5,6,7,8, - 9,10,10,11,12,13,0,1,2,3,4,5,6,7,7,8, - 9,10,11,12,13,14,0,1,2,3,4,5,6,7,8,9, - 10,11,12,13,14,15,76,15,6,76,9,8,76,46,8,76, - 92,6,76,2,12,134,211,132,212,72,160,0,152,153,0,2, - 153,76,2,200,208,247,160,4,177,211,141,34,8,200,177,211, - 141,72,3,200,177,211,141,18,8,141,74,3,160,8,177,211, - 153,195,0,200,192,16,208,246,104,72,10,10,10,24,101,209, - 133,209,104,8,41,224,10,42,42,42,40,101,210,133,210,32, - 123,6,169,0,141,8,210,141,24,210,160,3,140,15,210,140, - 31,210,160,8,153,0,210,153,16,210,136,16,247,173,18,8, - 96,162,0,142,75,3,138,168,177,209,201,254,176,45,168,177, - 205,157,0,2,177,207,157,8,2,169,0,157,16,2,169,1, - 157,24,2,169,128,157,104,2,232,224,8,208,217,165,209,24, - 105,8,133,209,144,27,230,210,76,203,6,240,4,169,0,240, - 223,160,2,177,209,170,200,177,209,133,210,134,209,162,0,240, - 181,173,72,3,141,35,7,162,255,232,222,24,2,208,69,189, - 0,2,133,211,189,8,2,133,212,188,16,2,254,16,2,177, - 211,133,217,41,63,201,61,240,17,176,56,157,32,2,157,32, - 3,200,177,211,74,41,126,157,104,2,169,1,157,24,2,188, - 16,2,254,16,2,177,211,74,102,217,74,102,217,165,217,41, - 240,157,40,2,224,7,208,177,169,255,141,72,3,141,73,3, - 76,114,7,201,63,240,27,165,217,41,192,240,9,10,42,42, - 157,24,2,76,30,7,200,177,211,157,24,2,254,16,2,76, - 30,7,165,217,48,12,200,177,211,141,35,7,254,16,2,76, - 227,6,201,255,240,9,200,177,211,157,16,2,76,227,6,76, - 123,6,76,46,8,202,48,250,188,104,2,48,248,177,203,157, - 112,2,133,215,200,177,203,157,120,2,133,216,169,1,157,40, - 3,168,177,215,157,8,3,200,177,215,157,136,2,200,177,215, - 157,144,2,200,177,215,157,224,2,41,63,157,16,3,177,215, - 41,64,157,232,2,200,177,215,157,64,3,200,177,215,157,160, - 2,200,177,215,157,176,2,200,177,215,157,184,2,200,177,215, - 168,185,160,3,157,192,2,157,200,2,185,161,3,157,208,2, - 160,10,177,215,157,216,2,169,128,157,168,2,157,104,2,10, - 157,152,2,157,56,2,168,177,215,157,0,3,105,0,157,128, - 2,169,12,157,248,2,168,177,215,157,240,2,76,111,7,32, - 2,12,206,74,3,208,29,169,255,141,74,3,206,73,3,208, - 19,238,75,3,173,75,3,201,255,240,3,76,203,6,76,123, - 6,76,116,10,169,4,133,214,162,7,189,120,2,240,242,133, - 212,189,112,2,133,211,188,128,2,177,211,133,217,200,177,211, - 133,218,200,177,211,133,219,200,152,221,136,2,144,10,240,8, - 169,128,157,152,2,189,144,2,157,128,2,165,217,224,4,144, - 4,74,74,74,74,41,15,29,40,2,168,185,0,5,133,220, - 165,218,41,14,168,185,144,3,133,213,165,220,25,145,3,157, - 56,3,189,184,2,240,40,201,1,208,33,189,56,2,24,125, - 216,2,24,188,192,2,121,165,3,157,56,2,200,152,221,208, - 2,208,3,189,200,2,157,192,2,76,185,8,222,184,2,188, - 0,3,192,13,144,60,189,16,3,16,49,152,221,248,2,208, - 8,189,8,3,157,248,2,208,3,254,248,2,189,112,2,133, - 215,189,120,2,133,216,188,248,2,177,215,188,232,2,240,4, - 24,125,240,2,157,240,2,189,224,2,41,63,56,233,1,157, - 16,3,189,152,2,16,31,189,40,2,240,26,221,176,2,240, - 21,144,19,168,189,168,2,24,125,160,2,157,168,2,144,6, - 152,233,16,157,40,2,169,0,133,221,165,218,157,24,3,41, - 112,74,74,141,49,9,144,254,76,231,9,234,76,81,9,234, - 76,86,9,234,76,96,9,234,76,108,9,234,76,123,9,234, - 76,190,9,234,76,205,9,165,219,76,42,10,165,219,133,221, - 189,32,2,76,237,9,189,32,2,24,101,219,157,32,2,76, - 237,9,189,56,2,24,101,219,157,56,2,189,32,2,76,237, - 9,189,224,2,16,12,188,32,2,177,213,24,125,240,2,76, - 156,9,189,32,2,24,125,240,2,201,61,144,2,169,63,168, - 177,213,157,64,2,164,219,208,3,157,72,2,152,74,74,74, - 74,157,80,2,157,88,2,165,219,41,15,157,96,2,189,32, - 2,76,237,9,165,219,24,125,40,3,157,40,3,189,32,2, - 76,237,9,165,219,201,128,240,6,157,32,2,76,237,9,189, - 56,3,9,240,157,56,3,189,32,2,76,237,9,189,32,2, - 24,101,219,188,224,2,48,31,24,125,240,2,201,61,144,7, - 169,0,157,56,3,169,63,157,32,3,168,177,213,24,125,56, - 2,24,101,221,76,42,10,201,61,144,7,169,0,157,56,3, - 169,63,168,189,56,2,24,125,240,2,24,113,213,24,101,221, - 157,48,3,189,88,2,240,50,222,88,2,208,45,189,80,2, - 157,88,2,189,72,2,221,64,2,240,31,176,13,125,96,2, - 176,18,221,64,2,176,13,76,97,10,253,96,2,144,5,221, - 64,2,176,3,189,64,2,157,72,2,165,218,41,1,240,10, - 189,72,2,24,125,56,2,157,48,3,202,48,3,76,52,8, - 173,64,3,13,65,3,13,66,3,13,67,3,170,142,101,12, - 173,24,3,16,33,173,56,3,41,15,240,26,173,48,3,24, - 109,40,3,141,50,3,173,58,3,41,16,208,5,169,0,141, - 58,3,138,9,4,170,173,25,3,16,33,173,57,3,41,15, - 240,26,173,49,3,24,109,41,3,141,51,3,173,59,3,41, - 16,208,5,169,0,141,59,3,138,9,2,170,236,101,12,208, - 94,173,25,3,41,14,201,6,208,38,173,57,3,41,15,240, - 31,172,33,3,185,192,3,141,48,3,185,192,4,141,49,3, - 173,56,3,41,16,208,5,169,0,141,56,3,138,9,80,170, - 173,27,3,41,14,201,6,208,38,173,59,3,41,15,240,31, - 172,35,3,185,192,3,141,50,3,185,192,4,141,51,3,173, - 58,3,41,16,208,5,169,0,141,58,3,138,9,40,170,142, - 101,12,173,68,3,13,69,3,13,70,3,13,71,3,170,142, - 3,12,173,28,3,16,33,173,60,3,41,15,240,26,173,52, - 3,24,109,44,3,141,54,3,173,62,3,41,16,208,5,169, - 0,141,62,3,138,9,4,170,173,29,3,16,33,173,61,3, - 41,15,240,26,173,53,3,24,109,45,3,141,55,3,173,63, - 3,41,16,208,5,169,0,141,63,3,138,9,2,170,236,3, - 12,208,94,173,29,3,41,14,201,6,208,38,173,61,3,41, - 15,240,31,172,37,3,185,192,3,141,52,3,185,192,4,141, - 53,3,173,60,3,41,16,208,5,169,0,141,60,3,138,9, - 80,170,173,31,3,41,14,201,6,208,38,173,63,3,41,15, - 240,31,172,39,3,185,192,3,141,54,3,185,192,4,141,55, - 3,173,62,3,41,16,208,5,169,0,141,62,3,138,9,40, - 170,142,3,12,173,74,3,96,160,255,173,52,3,174,48,3, - 141,16,210,142,0,210,173,60,3,174,56,3,141,17,210,142, - 1,210,173,53,3,174,49,3,141,18,210,142,2,210,173,61, - 3,174,57,3,141,19,210,142,3,210,173,54,3,174,50,3, - 141,20,210,142,4,210,173,62,3,174,58,3,141,21,210,142, - 5,210,173,55,3,174,51,3,141,22,210,142,6,210,173,63, - 3,174,59,3,141,23,210,142,7,210,169,255,140,24,210,141, - 8,210,96 + 255,255,144,3,108,12,128,0,128,32,128,64,0,192,128,128, + 128,160,0,192,64,192,0,1,5,11,21,0,1,255,255,1, + 1,0,255,255,0,1,1,1,0,255,255,255,255,0,1,1, + 0,0,0,0,0,0,242,51,150,226,56,140,0,106,232,106, + 239,128,8,174,70,230,149,65,246,176,110,48,246,187,132,82, + 34,244,200,160,122,85,52,20,245,216,189,164,141,119,96,78, + 56,39,21,6,247,232,219,207,195,184,172,162,154,144,136,127, + 120,112,106,100,94,0,191,182,170,161,152,143,137,128,242,230, + 218,206,191,182,170,161,152,143,137,128,122,113,107,101,95,92, + 86,80,77,71,68,62,60,56,53,50,47,45,42,40,37,35, + 33,31,29,28,26,24,23,22,20,19,18,17,16,15,14,13, + 12,11,10,9,8,7,255,241,228,216,202,192,181,171,162,153, + 142,135,127,121,115,112,102,97,90,85,82,75,72,67,63,60, + 57,55,51,48,45,42,40,37,36,33,31,30,28,27,25,23, + 22,21,19,18,17,16,15,14,13,12,11,10,9,8,7,6, + 5,4,3,2,1,0,243,230,217,204,193,181,173,162,153,144, + 136,128,121,114,108,102,96,91,85,81,76,72,68,64,60,57, + 53,50,47,45,42,40,37,35,33,31,29,28,26,24,23,22, + 20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5, + 4,3,2,1,0,0,13,13,12,11,11,10,10,9,8,8, + 7,7,7,6,6,5,5,5,4,4,4,4,3,3,3,3, + 3,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1, + 1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1, + 1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,1, + 1,1,2,2,2,2,0,0,0,1,1,1,1,1,2,2, + 2,2,2,3,3,3,0,0,1,1,1,1,2,2,2,2, + 3,3,3,3,4,4,0,0,1,1,1,2,2,2,3,3, + 3,4,4,4,5,5,0,0,1,1,2,2,2,3,3,4, + 4,4,5,5,6,6,0,0,1,1,2,2,3,3,4,4, + 5,5,6,6,7,7,0,1,1,2,2,3,3,4,4,5, + 5,6,6,7,7,8,0,1,1,2,2,3,4,4,5,5, + 6,7,7,8,8,9,0,1,1,2,3,3,4,5,5,6, + 7,7,8,9,9,10,0,1,1,2,3,4,4,5,6,7, + 7,8,9,10,10,11,0,1,2,2,3,4,5,6,6,7, + 8,9,10,10,11,12,0,1,2,3,3,4,5,6,7,8, + 9,10,10,11,12,13,0,1,2,3,4,5,6,7,7,8, + 9,10,11,12,13,14,0,1,2,3,4,5,6,7,8,9, + 10,11,12,13,14,15,76,15,6,76,9,8,76,46,8,76, + 92,6,76,2,12,134,211,132,212,72,160,0,152,153,0,2, + 153,76,2,200,208,247,160,4,177,211,141,34,8,200,177,211, + 141,72,3,200,177,211,141,18,8,141,74,3,160,8,177,211, + 153,195,0,200,192,16,208,246,104,72,10,10,10,24,101,209, + 133,209,104,8,41,224,10,42,42,42,40,101,210,133,210,32, + 123,6,169,0,141,8,210,141,24,210,160,3,140,15,210,140, + 31,210,160,8,153,0,210,153,16,210,136,16,247,173,18,8, + 96,162,0,142,75,3,138,168,177,209,201,254,176,45,168,177, + 205,157,0,2,177,207,157,8,2,169,0,157,16,2,169,1, + 157,24,2,169,128,157,104,2,232,224,8,208,217,165,209,24, + 105,8,133,209,144,27,230,210,76,203,6,240,4,169,0,240, + 223,160,2,177,209,170,200,177,209,133,210,134,209,162,0,240, + 181,173,72,3,141,35,7,162,255,232,222,24,2,208,69,189, + 0,2,133,211,189,8,2,133,212,188,16,2,254,16,2,177, + 211,133,217,41,63,201,61,240,17,176,56,157,32,2,157,32, + 3,200,177,211,74,41,126,157,104,2,169,1,157,24,2,188, + 16,2,254,16,2,177,211,74,102,217,74,102,217,165,217,41, + 240,157,40,2,224,7,208,177,169,255,141,72,3,141,73,3, + 76,114,7,201,63,240,27,165,217,41,192,240,9,10,42,42, + 157,24,2,76,30,7,200,177,211,157,24,2,254,16,2,76, + 30,7,165,217,48,12,200,177,211,141,35,7,254,16,2,76, + 227,6,201,255,240,9,200,177,211,157,16,2,76,227,6,76, + 123,6,76,46,8,202,48,250,188,104,2,48,248,177,203,157, + 112,2,133,215,200,177,203,157,120,2,133,216,169,1,157,40, + 3,168,177,215,157,8,3,200,177,215,157,136,2,200,177,215, + 157,144,2,200,177,215,157,224,2,41,63,157,16,3,177,215, + 41,64,157,232,2,200,177,215,157,64,3,200,177,215,157,160, + 2,200,177,215,157,176,2,200,177,215,157,184,2,200,177,215, + 168,185,160,3,157,192,2,157,200,2,185,161,3,157,208,2, + 160,10,177,215,157,216,2,169,128,157,168,2,157,104,2,10, + 157,152,2,157,56,2,168,177,215,157,0,3,105,0,157,128, + 2,169,12,157,248,2,168,177,215,157,240,2,76,111,7,32, + 2,12,206,74,3,208,29,169,255,141,74,3,206,73,3,208, + 19,238,75,3,173,75,3,201,255,240,3,76,203,6,76,123, + 6,76,116,10,169,4,133,214,162,7,189,120,2,240,242,133, + 212,189,112,2,133,211,188,128,2,177,211,133,217,200,177,211, + 133,218,200,177,211,133,219,200,152,221,136,2,144,10,240,8, + 169,128,157,152,2,189,144,2,157,128,2,165,217,224,4,144, + 4,74,74,74,74,41,15,29,40,2,168,185,0,5,133,220, + 165,218,41,14,168,185,144,3,133,213,165,220,25,145,3,157, + 56,3,189,184,2,240,40,201,1,208,33,189,56,2,24,125, + 216,2,24,188,192,2,121,165,3,157,56,2,200,152,221,208, + 2,208,3,189,200,2,157,192,2,76,185,8,222,184,2,188, + 0,3,192,13,144,60,189,16,3,16,49,152,221,248,2,208, + 8,189,8,3,157,248,2,208,3,254,248,2,189,112,2,133, + 215,189,120,2,133,216,188,248,2,177,215,188,232,2,240,4, + 24,125,240,2,157,240,2,189,224,2,41,63,56,233,1,157, + 16,3,189,152,2,16,31,189,40,2,240,26,221,176,2,240, + 21,144,19,168,189,168,2,24,125,160,2,157,168,2,144,6, + 152,233,16,157,40,2,169,0,133,221,165,218,157,24,3,41, + 112,74,74,141,49,9,144,254,76,231,9,234,76,81,9,234, + 76,86,9,234,76,96,9,234,76,108,9,234,76,123,9,234, + 76,190,9,234,76,205,9,165,219,76,42,10,165,219,133,221, + 189,32,2,76,237,9,189,32,2,24,101,219,157,32,2,76, + 237,9,189,56,2,24,101,219,157,56,2,189,32,2,76,237, + 9,189,224,2,16,12,188,32,2,177,213,24,125,240,2,76, + 156,9,189,32,2,24,125,240,2,201,61,144,2,169,63,168, + 177,213,157,64,2,164,219,208,3,157,72,2,152,74,74,74, + 74,157,80,2,157,88,2,165,219,41,15,157,96,2,189,32, + 2,76,237,9,165,219,24,125,40,3,157,40,3,189,32,2, + 76,237,9,165,219,201,128,240,6,157,32,2,76,237,9,189, + 56,3,9,240,157,56,3,189,32,2,76,237,9,189,32,2, + 24,101,219,188,224,2,48,31,24,125,240,2,201,61,144,7, + 169,0,157,56,3,169,63,157,32,3,168,177,213,24,125,56, + 2,24,101,221,76,42,10,201,61,144,7,169,0,157,56,3, + 169,63,168,189,56,2,24,125,240,2,24,113,213,24,101,221, + 157,48,3,189,88,2,240,50,222,88,2,208,45,189,80,2, + 157,88,2,189,72,2,221,64,2,240,31,176,13,125,96,2, + 176,18,221,64,2,176,13,76,97,10,253,96,2,144,5,221, + 64,2,176,3,189,64,2,157,72,2,165,218,41,1,240,10, + 189,72,2,24,125,56,2,157,48,3,202,48,3,76,52,8, + 173,64,3,13,65,3,13,66,3,13,67,3,170,142,101,12, + 173,24,3,16,33,173,56,3,41,15,240,26,173,48,3,24, + 109,40,3,141,50,3,173,58,3,41,16,208,5,169,0,141, + 58,3,138,9,4,170,173,25,3,16,33,173,57,3,41,15, + 240,26,173,49,3,24,109,41,3,141,51,3,173,59,3,41, + 16,208,5,169,0,141,59,3,138,9,2,170,236,101,12,208, + 94,173,25,3,41,14,201,6,208,38,173,57,3,41,15,240, + 31,172,33,3,185,192,3,141,48,3,185,192,4,141,49,3, + 173,56,3,41,16,208,5,169,0,141,56,3,138,9,80,170, + 173,27,3,41,14,201,6,208,38,173,59,3,41,15,240,31, + 172,35,3,185,192,3,141,50,3,185,192,4,141,51,3,173, + 58,3,41,16,208,5,169,0,141,58,3,138,9,40,170,142, + 101,12,173,68,3,13,69,3,13,70,3,13,71,3,170,142, + 3,12,173,28,3,16,33,173,60,3,41,15,240,26,173,52, + 3,24,109,44,3,141,54,3,173,62,3,41,16,208,5,169, + 0,141,62,3,138,9,4,170,173,29,3,16,33,173,61,3, + 41,15,240,26,173,53,3,24,109,45,3,141,55,3,173,63, + 3,41,16,208,5,169,0,141,63,3,138,9,2,170,236,3, + 12,208,94,173,29,3,41,14,201,6,208,38,173,61,3,41, + 15,240,31,172,37,3,185,192,3,141,52,3,185,192,4,141, + 53,3,173,60,3,41,16,208,5,169,0,141,60,3,138,9, + 80,170,173,31,3,41,14,201,6,208,38,173,63,3,41,15, + 240,31,172,39,3,185,192,3,141,54,3,185,192,4,141,55, + 3,173,62,3,41,16,208,5,169,0,141,62,3,138,9,40, + 170,142,3,12,173,74,3,96,160,255,173,52,3,174,48,3, + 141,16,210,142,0,210,173,60,3,174,56,3,141,17,210,142, + 1,210,173,53,3,174,49,3,141,18,210,142,2,210,173,61, + 3,174,57,3,141,19,210,142,3,210,173,54,3,174,50,3, + 141,20,210,142,4,210,173,62,3,174,58,3,141,21,210,142, + 5,210,173,55,3,174,51,3,141,22,210,142,6,210,173,63, + 3,174,59,3,141,23,210,142,7,210,169,255,140,24,210,141, + 8,210,96 END_CONST_ARRAY; CONST_ARRAY(byte, tmc_obx) - 255,255,0,5,104,15,76,206,13,76,208,8,76,239,9,15, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1, - 1,1,0,0,0,0,1,1,1,1,1,1,1,1,2,2, - 2,2,0,0,0,1,1,1,1,1,2,2,2,2,2,3, - 3,3,0,0,1,1,1,1,2,2,2,2,3,3,3,3, - 4,4,0,0,1,1,1,2,2,2,3,3,3,4,4,4, - 5,5,0,0,1,1,2,2,2,3,3,4,4,4,5,5, - 6,6,0,0,1,1,2,2,3,3,4,4,5,5,6,6, - 7,7,0,1,1,2,2,3,3,4,4,5,5,6,6,7, - 7,8,0,1,1,2,2,3,4,4,5,5,6,7,7,8, - 8,9,0,1,1,2,3,3,4,5,5,6,7,7,8,9, - 9,10,0,1,1,2,3,4,4,5,6,7,7,8,9,10, - 10,11,0,1,2,2,3,4,5,6,6,7,8,9,10,10, - 11,12,0,1,2,3,3,4,5,6,7,8,9,10,10,11, - 12,13,0,1,2,3,4,5,6,7,7,8,9,10,11,12, - 13,14,0,1,2,3,4,5,6,7,8,9,10,11,12,13, - 14,15,0,241,228,215,203,192,181,170,161,152,143,135,127,120, - 114,107,101,95,90,85,80,75,71,67,63,60,56,53,50,47, - 44,42,39,37,35,33,31,29,28,26,24,23,22,20,19,18, - 17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2, - 1,0,0,242,230,218,206,191,182,170,161,152,143,137,128,122, - 113,107,101,95,92,86,80,77,71,68,62,60,56,53,50,47, - 45,42,40,37,35,33,31,29,28,26,24,23,22,20,19,18, - 17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2, - 1,0,0,255,241,228,216,202,192,181,171,162,153,142,135,127, - 121,115,112,102,97,90,85,82,75,72,67,63,60,57,55,51, - 48,45,42,40,37,36,33,31,30,28,27,25,23,22,21,19, - 18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3, - 2,1,0,243,230,217,204,193,181,173,162,153,144,136,128,121, - 114,108,102,96,91,85,81,76,72,68,64,60,57,53,50,47, - 45,42,40,37,35,33,31,29,28,26,24,23,22,20,19,18, - 17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2, - 1,0,0,242,51,150,226,56,140,0,106,232,106,239,128,8, - 174,70,230,149,65,246,176,110,48,246,187,132,82,34,244,200, - 160,122,85,52,20,245,216,189,164,141,119,96,78,56,39,21, - 6,247,232,219,207,195,184,172,162,154,144,136,127,120,112,106, - 100,94,0,13,13,12,11,11,10,10,9,8,8,7,7,7, - 6,6,5,5,5,4,4,4,4,3,3,3,3,3,2,2, - 2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1, - 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,5, - 6,7,0,1,2,3,4,2,0,0,4,2,0,0,0,16, - 0,8,0,16,0,8,173,183,8,240,94,173,182,8,201,64, - 144,90,206,181,8,240,3,76,239,9,162,7,169,0,157,196, - 7,157,204,7,202,16,247,141,182,8,170,160,15,177,254,16, - 32,136,177,254,16,3,76,95,14,134,252,10,10,38,252,10, - 38,252,10,38,252,105,0,133,254,165,252,105,0,133,255,144, - 218,157,212,7,136,177,254,157,220,7,232,136,16,207,24,165, - 254,105,16,133,254,144,2,230,255,76,239,9,206,181,8,16, - 248,238,182,8,173,180,8,141,181,8,162,7,222,204,7,48, - 3,76,233,9,188,212,7,185,255,255,133,252,185,255,255,133, - 253,188,196,7,177,252,208,6,32,109,13,76,230,9,201,64, - 176,18,125,220,7,157,228,7,32,109,13,188,42,5,32,188, - 14,76,230,9,208,34,200,254,196,7,177,252,16,7,133,251, - 32,109,13,165,251,41,127,208,7,169,64,141,182,8,208,76, - 141,180,8,141,181,8,208,68,201,128,176,43,41,63,125,220, - 7,157,228,7,200,254,196,7,177,252,41,127,208,7,169,64, - 141,182,8,208,6,141,180,8,141,181,8,32,109,13,188,42, - 5,32,188,14,76,230,9,201,192,176,12,41,63,157,42,5, - 200,254,196,7,76,94,9,41,63,157,204,7,254,196,7,202, - 48,3,76,70,9,162,7,189,188,7,240,33,32,46,11,189, - 50,5,61,192,8,240,22,160,71,177,252,24,125,34,5,157, - 36,5,168,185,60,6,56,125,100,8,157,246,7,202,16,215, - 14,9,5,14,9,5,14,9,5,14,9,5,232,134,252,134, - 253,162,7,138,168,185,252,7,208,12,188,184,8,185,4,8, - 208,4,138,168,169,0,133,250,152,157,26,5,185,244,7,157, - 18,5,185,50,5,133,251,5,253,133,253,165,251,61,192,8, - 240,6,185,246,7,157,20,5,165,251,61,200,8,240,18,185, - 34,5,41,63,168,200,132,252,185,123,7,157,18,5,76,137, - 10,164,252,240,10,185,59,7,157,18,5,169,0,133,252,165, - 250,13,9,5,168,185,60,5,188,26,5,25,236,7,157,10, - 5,224,4,208,9,165,253,141,59,5,169,0,133,253,202,16, - 130,78,9,5,78,9,5,78,9,5,78,9,5,165,253,162, - 3,142,31,210,142,15,210,174,22,5,172,18,5,142,16,210, - 140,0,210,174,14,5,172,10,5,142,17,210,140,1,210,174, - 23,5,172,19,5,142,18,210,140,2,210,174,15,5,172,11, - 5,142,19,210,140,3,210,174,24,5,172,20,5,142,20,210, - 140,4,210,174,16,5,172,12,5,142,21,210,140,5,210,174, - 25,5,172,21,5,142,22,210,140,6,210,174,17,5,172,13, - 5,142,23,210,140,7,210,141,58,5,174,59,5,142,24,210, - 141,8,210,96,189,28,8,133,252,189,36,8,133,253,188,44, - 8,192,63,240,123,254,44,8,254,44,8,254,44,8,177,252, - 41,240,157,236,7,177,252,41,15,56,253,12,8,16,2,169, - 0,157,252,7,200,177,252,41,15,56,253,20,8,16,2,169, - 0,157,4,8,177,252,41,240,240,116,16,11,160,73,177,252, - 188,44,8,136,136,16,2,169,0,157,50,5,177,252,41,112, - 240,99,74,74,141,154,11,169,0,157,100,8,200,177,252,144, - 254,234,234,234,234,76,56,13,234,76,53,13,234,76,60,13, - 234,76,74,13,234,76,84,13,234,76,95,13,234,76,81,13, - 189,52,8,240,18,222,68,8,208,13,157,68,8,189,252,7, - 41,15,240,3,222,252,7,189,60,8,240,18,222,76,8,208, - 13,157,76,8,189,4,8,41,15,240,3,222,4,8,160,72, - 177,252,157,50,5,189,148,8,24,105,63,168,177,252,125,228, - 7,157,34,5,168,185,60,6,157,244,7,222,164,8,16,51, - 189,156,8,157,164,8,189,172,8,240,24,24,125,148,8,157, - 148,8,240,7,221,140,8,208,26,169,254,24,105,1,157,172, - 8,208,16,254,148,8,189,140,8,221,148,8,176,5,169,0, - 157,148,8,189,116,8,240,4,222,116,8,96,189,108,8,133, - 250,189,92,8,133,251,32,105,12,222,132,8,16,16,165,250, - 157,108,8,165,251,157,92,8,189,124,8,157,132,8,96,189, - 84,8,141,112,12,16,254,76,167,12,234,76,144,12,234,76, - 174,12,234,76,180,12,234,76,190,12,234,76,210,12,234,76, - 226,12,234,76,244,12,165,250,230,250,41,3,74,144,15,208, - 71,165,251,157,100,8,24,125,244,7,157,244,7,96,169,0, - 157,100,8,96,32,29,13,76,157,12,32,29,13,24,125,34, - 5,76,84,13,165,250,157,100,8,24,125,244,7,157,244,7, - 165,250,24,101,251,133,250,96,189,34,5,56,229,250,157,34, - 5,168,185,60,6,76,199,12,189,244,7,56,229,251,157,244, - 7,56,169,0,229,251,157,100,8,96,189,132,8,208,174,165, - 251,16,16,189,4,8,240,165,189,252,7,201,15,240,158,254, - 252,7,96,189,252,7,240,149,189,4,8,201,15,240,142,254, - 4,8,96,164,250,165,251,48,2,200,200,136,152,133,250,197, - 251,208,6,165,251,73,255,133,251,152,96,125,244,7,157,244, - 7,96,188,228,7,121,60,6,157,244,7,152,157,34,5,96, - 45,10,210,157,244,7,96,125,228,7,157,34,5,168,185,60, - 6,157,244,7,96,157,34,5,168,189,244,7,121,60,6,157, - 244,7,96,200,254,196,7,177,252,74,74,74,74,157,12,8, - 177,252,41,15,157,20,8,96,32,95,14,160,15,169,0,133, - 254,169,0,133,255,138,240,46,177,254,16,1,202,24,165,254, - 105,16,133,254,144,239,230,255,176,235,32,95,14,169,0,133, - 252,138,10,10,38,252,10,38,252,10,38,252,105,0,133,254, - 165,252,105,0,133,255,169,64,141,182,8,169,1,141,181,8, - 141,183,8,96,201,16,144,176,201,32,144,206,201,48,176,3, - 76,174,14,201,64,176,9,138,41,15,240,3,141,180,8,96, - 201,80,144,113,201,96,176,6,169,0,141,183,8,96,201,112, - 144,248,169,1,141,181,8,169,64,141,182,8,132,252,134,253, - 160,30,177,252,141,180,8,165,252,24,105,32,141,194,14,144, - 1,232,142,195,14,24,105,64,141,202,14,144,1,232,142,203, - 14,24,105,64,141,82,9,144,1,232,142,83,9,24,105,128, - 141,87,9,144,1,232,142,88,9,24,105,128,133,254,141,16, - 9,141,136,13,141,183,13,144,1,232,134,255,142,22,9,142, - 140,13,142,189,13,160,7,169,0,141,183,8,153,0,210,153, - 16,210,153,10,5,153,252,7,153,4,8,153,50,5,153,188, - 7,136,16,232,141,8,210,141,24,210,141,58,5,141,59,5, - 96,157,252,7,157,4,8,157,50,5,189,228,7,157,34,5, - 96,152,73,240,74,74,74,74,157,12,8,152,41,15,73,15, - 157,20,8,96,41,7,133,252,138,166,252,41,63,240,226,157, - 228,7,169,0,157,188,7,185,255,255,157,28,8,133,252,185, - 255,255,157,36,8,133,253,5,252,240,182,160,74,177,252,157, - 52,8,157,68,8,200,177,252,157,60,8,157,76,8,200,177, - 252,41,112,74,74,157,84,8,177,252,41,15,157,92,8,177, - 252,16,11,189,92,8,73,255,24,105,1,157,92,8,200,177, - 252,157,116,8,200,177,252,41,63,157,124,8,157,132,8,200, - 177,252,41,128,240,2,169,1,157,172,8,177,252,41,112,74, - 74,74,74,157,140,8,208,3,157,172,8,177,252,41,15,157, - 156,8,157,164,8,136,177,252,41,192,24,125,228,7,157,228, - 7,157,34,5,168,185,60,6,157,244,7,169,0,157,44,8, - 157,100,8,157,108,8,157,148,8,169,1,157,188,7,96 + 255,255,0,5,104,15,76,206,13,76,208,8,76,239,9,15, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1, + 1,1,0,0,0,0,1,1,1,1,1,1,1,1,2,2, + 2,2,0,0,0,1,1,1,1,1,2,2,2,2,2,3, + 3,3,0,0,1,1,1,1,2,2,2,2,3,3,3,3, + 4,4,0,0,1,1,1,2,2,2,3,3,3,4,4,4, + 5,5,0,0,1,1,2,2,2,3,3,4,4,4,5,5, + 6,6,0,0,1,1,2,2,3,3,4,4,5,5,6,6, + 7,7,0,1,1,2,2,3,3,4,4,5,5,6,6,7, + 7,8,0,1,1,2,2,3,4,4,5,5,6,7,7,8, + 8,9,0,1,1,2,3,3,4,5,5,6,7,7,8,9, + 9,10,0,1,1,2,3,4,4,5,6,7,7,8,9,10, + 10,11,0,1,2,2,3,4,5,6,6,7,8,9,10,10, + 11,12,0,1,2,3,3,4,5,6,7,8,9,10,10,11, + 12,13,0,1,2,3,4,5,6,7,7,8,9,10,11,12, + 13,14,0,1,2,3,4,5,6,7,8,9,10,11,12,13, + 14,15,0,241,228,215,203,192,181,170,161,152,143,135,127,120, + 114,107,101,95,90,85,80,75,71,67,63,60,56,53,50,47, + 44,42,39,37,35,33,31,29,28,26,24,23,22,20,19,18, + 17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2, + 1,0,0,242,230,218,206,191,182,170,161,152,143,137,128,122, + 113,107,101,95,92,86,80,77,71,68,62,60,56,53,50,47, + 45,42,40,37,35,33,31,29,28,26,24,23,22,20,19,18, + 17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2, + 1,0,0,255,241,228,216,202,192,181,171,162,153,142,135,127, + 121,115,112,102,97,90,85,82,75,72,67,63,60,57,55,51, + 48,45,42,40,37,36,33,31,30,28,27,25,23,22,21,19, + 18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3, + 2,1,0,243,230,217,204,193,181,173,162,153,144,136,128,121, + 114,108,102,96,91,85,81,76,72,68,64,60,57,53,50,47, + 45,42,40,37,35,33,31,29,28,26,24,23,22,20,19,18, + 17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2, + 1,0,0,242,51,150,226,56,140,0,106,232,106,239,128,8, + 174,70,230,149,65,246,176,110,48,246,187,132,82,34,244,200, + 160,122,85,52,20,245,216,189,164,141,119,96,78,56,39,21, + 6,247,232,219,207,195,184,172,162,154,144,136,127,120,112,106, + 100,94,0,13,13,12,11,11,10,10,9,8,8,7,7,7, + 6,6,5,5,5,4,4,4,4,3,3,3,3,3,2,2, + 2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1, + 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,5, + 6,7,0,1,2,3,4,2,0,0,4,2,0,0,0,16, + 0,8,0,16,0,8,173,183,8,240,94,173,182,8,201,64, + 144,90,206,181,8,240,3,76,239,9,162,7,169,0,157,196, + 7,157,204,7,202,16,247,141,182,8,170,160,15,177,254,16, + 32,136,177,254,16,3,76,95,14,134,252,10,10,38,252,10, + 38,252,10,38,252,105,0,133,254,165,252,105,0,133,255,144, + 218,157,212,7,136,177,254,157,220,7,232,136,16,207,24,165, + 254,105,16,133,254,144,2,230,255,76,239,9,206,181,8,16, + 248,238,182,8,173,180,8,141,181,8,162,7,222,204,7,48, + 3,76,233,9,188,212,7,185,255,255,133,252,185,255,255,133, + 253,188,196,7,177,252,208,6,32,109,13,76,230,9,201,64, + 176,18,125,220,7,157,228,7,32,109,13,188,42,5,32,188, + 14,76,230,9,208,34,200,254,196,7,177,252,16,7,133,251, + 32,109,13,165,251,41,127,208,7,169,64,141,182,8,208,76, + 141,180,8,141,181,8,208,68,201,128,176,43,41,63,125,220, + 7,157,228,7,200,254,196,7,177,252,41,127,208,7,169,64, + 141,182,8,208,6,141,180,8,141,181,8,32,109,13,188,42, + 5,32,188,14,76,230,9,201,192,176,12,41,63,157,42,5, + 200,254,196,7,76,94,9,41,63,157,204,7,254,196,7,202, + 48,3,76,70,9,162,7,189,188,7,240,33,32,46,11,189, + 50,5,61,192,8,240,22,160,71,177,252,24,125,34,5,157, + 36,5,168,185,60,6,56,125,100,8,157,246,7,202,16,215, + 14,9,5,14,9,5,14,9,5,14,9,5,232,134,252,134, + 253,162,7,138,168,185,252,7,208,12,188,184,8,185,4,8, + 208,4,138,168,169,0,133,250,152,157,26,5,185,244,7,157, + 18,5,185,50,5,133,251,5,253,133,253,165,251,61,192,8, + 240,6,185,246,7,157,20,5,165,251,61,200,8,240,18,185, + 34,5,41,63,168,200,132,252,185,123,7,157,18,5,76,137, + 10,164,252,240,10,185,59,7,157,18,5,169,0,133,252,165, + 250,13,9,5,168,185,60,5,188,26,5,25,236,7,157,10, + 5,224,4,208,9,165,253,141,59,5,169,0,133,253,202,16, + 130,78,9,5,78,9,5,78,9,5,78,9,5,165,253,162, + 3,142,31,210,142,15,210,174,22,5,172,18,5,142,16,210, + 140,0,210,174,14,5,172,10,5,142,17,210,140,1,210,174, + 23,5,172,19,5,142,18,210,140,2,210,174,15,5,172,11, + 5,142,19,210,140,3,210,174,24,5,172,20,5,142,20,210, + 140,4,210,174,16,5,172,12,5,142,21,210,140,5,210,174, + 25,5,172,21,5,142,22,210,140,6,210,174,17,5,172,13, + 5,142,23,210,140,7,210,141,58,5,174,59,5,142,24,210, + 141,8,210,96,189,28,8,133,252,189,36,8,133,253,188,44, + 8,192,63,240,123,254,44,8,254,44,8,254,44,8,177,252, + 41,240,157,236,7,177,252,41,15,56,253,12,8,16,2,169, + 0,157,252,7,200,177,252,41,15,56,253,20,8,16,2,169, + 0,157,4,8,177,252,41,240,240,116,16,11,160,73,177,252, + 188,44,8,136,136,16,2,169,0,157,50,5,177,252,41,112, + 240,99,74,74,141,154,11,169,0,157,100,8,200,177,252,144, + 254,234,234,234,234,76,56,13,234,76,53,13,234,76,60,13, + 234,76,74,13,234,76,84,13,234,76,95,13,234,76,81,13, + 189,52,8,240,18,222,68,8,208,13,157,68,8,189,252,7, + 41,15,240,3,222,252,7,189,60,8,240,18,222,76,8,208, + 13,157,76,8,189,4,8,41,15,240,3,222,4,8,160,72, + 177,252,157,50,5,189,148,8,24,105,63,168,177,252,125,228, + 7,157,34,5,168,185,60,6,157,244,7,222,164,8,16,51, + 189,156,8,157,164,8,189,172,8,240,24,24,125,148,8,157, + 148,8,240,7,221,140,8,208,26,169,254,24,105,1,157,172, + 8,208,16,254,148,8,189,140,8,221,148,8,176,5,169,0, + 157,148,8,189,116,8,240,4,222,116,8,96,189,108,8,133, + 250,189,92,8,133,251,32,105,12,222,132,8,16,16,165,250, + 157,108,8,165,251,157,92,8,189,124,8,157,132,8,96,189, + 84,8,141,112,12,16,254,76,167,12,234,76,144,12,234,76, + 174,12,234,76,180,12,234,76,190,12,234,76,210,12,234,76, + 226,12,234,76,244,12,165,250,230,250,41,3,74,144,15,208, + 71,165,251,157,100,8,24,125,244,7,157,244,7,96,169,0, + 157,100,8,96,32,29,13,76,157,12,32,29,13,24,125,34, + 5,76,84,13,165,250,157,100,8,24,125,244,7,157,244,7, + 165,250,24,101,251,133,250,96,189,34,5,56,229,250,157,34, + 5,168,185,60,6,76,199,12,189,244,7,56,229,251,157,244, + 7,56,169,0,229,251,157,100,8,96,189,132,8,208,174,165, + 251,16,16,189,4,8,240,165,189,252,7,201,15,240,158,254, + 252,7,96,189,252,7,240,149,189,4,8,201,15,240,142,254, + 4,8,96,164,250,165,251,48,2,200,200,136,152,133,250,197, + 251,208,6,165,251,73,255,133,251,152,96,125,244,7,157,244, + 7,96,188,228,7,121,60,6,157,244,7,152,157,34,5,96, + 45,10,210,157,244,7,96,125,228,7,157,34,5,168,185,60, + 6,157,244,7,96,157,34,5,168,189,244,7,121,60,6,157, + 244,7,96,200,254,196,7,177,252,74,74,74,74,157,12,8, + 177,252,41,15,157,20,8,96,32,95,14,160,15,169,0,133, + 254,169,0,133,255,138,240,46,177,254,16,1,202,24,165,254, + 105,16,133,254,144,239,230,255,176,235,32,95,14,169,0,133, + 252,138,10,10,38,252,10,38,252,10,38,252,105,0,133,254, + 165,252,105,0,133,255,169,64,141,182,8,169,1,141,181,8, + 141,183,8,96,201,16,144,176,201,32,144,206,201,48,176,3, + 76,174,14,201,64,176,9,138,41,15,240,3,141,180,8,96, + 201,80,144,113,201,96,176,6,169,0,141,183,8,96,201,112, + 144,248,169,1,141,181,8,169,64,141,182,8,132,252,134,253, + 160,30,177,252,141,180,8,165,252,24,105,32,141,194,14,144, + 1,232,142,195,14,24,105,64,141,202,14,144,1,232,142,203, + 14,24,105,64,141,82,9,144,1,232,142,83,9,24,105,128, + 141,87,9,144,1,232,142,88,9,24,105,128,133,254,141,16, + 9,141,136,13,141,183,13,144,1,232,134,255,142,22,9,142, + 140,13,142,189,13,160,7,169,0,141,183,8,153,0,210,153, + 16,210,153,10,5,153,252,7,153,4,8,153,50,5,153,188, + 7,136,16,232,141,8,210,141,24,210,141,58,5,141,59,5, + 96,157,252,7,157,4,8,157,50,5,189,228,7,157,34,5, + 96,152,73,240,74,74,74,74,157,12,8,152,41,15,73,15, + 157,20,8,96,41,7,133,252,138,166,252,41,63,240,226,157, + 228,7,169,0,157,188,7,185,255,255,157,28,8,133,252,185, + 255,255,157,36,8,133,253,5,252,240,182,160,74,177,252,157, + 52,8,157,68,8,200,177,252,157,60,8,157,76,8,200,177, + 252,41,112,74,74,157,84,8,177,252,41,15,157,92,8,177, + 252,16,11,189,92,8,73,255,24,105,1,157,92,8,200,177, + 252,157,116,8,200,177,252,41,63,157,124,8,157,132,8,200, + 177,252,41,128,240,2,169,1,157,172,8,177,252,41,112,74, + 74,74,74,157,140,8,208,3,157,172,8,177,252,41,15,157, + 156,8,157,164,8,136,177,252,41,192,24,125,228,7,157,228, + 7,157,34,5,168,185,60,6,157,244,7,169,0,157,44,8, + 157,100,8,157,108,8,157,148,8,169,1,157,188,7,96 END_CONST_ARRAY; CONST_ARRAY(byte, tm2_obx) - 255,255,0,2,107,16,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1, - 1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,1, - 1,1,2,2,2,2,0,0,0,1,1,1,1,1,2,2, - 2,2,2,3,3,3,0,0,1,1,1,1,2,2,2,2, - 3,3,3,3,4,4,0,0,1,1,1,2,2,2,3,3, - 3,4,4,4,5,5,0,0,1,1,2,2,2,3,3,4, - 4,4,5,5,6,6,0,0,1,1,2,2,3,3,4,4, - 5,5,6,6,7,7,0,1,1,2,2,3,3,4,4,5, - 5,6,6,7,7,8,0,1,1,2,2,3,4,4,5,5, - 6,7,7,8,8,9,0,1,1,2,3,3,4,5,5,6, - 7,7,8,9,9,10,0,1,1,2,3,4,4,5,6,7, - 7,8,9,10,10,11,0,1,2,2,3,4,5,6,6,7, - 8,9,10,10,11,12,0,1,2,3,3,4,5,6,7,8, - 9,10,10,11,12,13,0,1,2,3,4,5,6,7,7,8, - 9,10,11,12,13,14,0,1,2,3,4,5,6,7,8,9, - 10,11,12,13,14,15,0,241,228,215,203,192,181,170,161,152, - 143,135,127,120,114,107,101,95,90,85,80,75,71,67,63,60, - 56,53,50,47,44,42,39,37,35,33,31,29,28,26,24,23, - 22,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6, - 5,4,3,2,1,0,0,242,233,218,206,191,182,170,161,152, - 143,137,128,122,113,107,101,95,92,86,80,77,71,68,62,60, - 56,53,50,47,45,42,40,37,35,33,31,29,28,26,24,23, - 22,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6, - 5,4,3,2,1,0,0,255,241,228,216,202,192,181,171,162, - 153,142,135,127,121,115,112,102,97,90,85,82,75,72,67,63, - 60,57,55,51,48,45,42,40,37,36,33,31,30,28,27,25, - 23,22,21,19,18,17,16,15,14,13,12,11,10,9,8,7, - 6,5,4,3,2,1,0,243,230,217,204,193,181,173,162,153, - 144,136,128,121,114,108,102,96,91,85,81,76,72,68,64,60, - 57,53,50,47,45,42,40,37,35,33,31,29,28,26,24,23, - 22,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6, - 5,4,3,2,1,0,226,56,140,0,106,232,106,239,128,8, - 174,70,230,149,65,246,176,110,48,246,187,132,82,34,244,200, - 160,122,85,52,20,245,216,189,164,141,119,96,78,56,39,21, - 6,247,232,219,207,195,184,172,162,154,144,136,127,120,112,106, - 100,94,87,82,50,10,0,242,51,150,226,56,140,0,106,232, - 106,239,128,8,174,70,230,149,65,246,176,110,48,246,187,132, - 82,34,244,200,160,122,85,52,20,245,216,189,164,141,119,96, - 78,56,39,21,6,247,232,219,207,195,184,172,162,154,144,136, - 127,120,112,106,100,94,11,11,10,10,9,8,8,7,7,7, - 6,6,5,5,5,4,4,4,4,3,3,3,3,3,2,2, - 2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1, - 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,13,13,12,11,11,10,10,9,8, - 8,7,7,7,6,6,5,5,5,4,4,4,4,3,3,3, - 3,3,2,2,2,2,2,2,2,1,1,1,1,1,1,1, - 1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,76,228,13,76,227,6,76,159,8,1, - 16,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,5, - 6,7,0,1,2,3,4,2,0,0,4,2,0,0,0,16, - 0,8,0,16,0,8,133,211,129,169,133,211,129,169,136,177, - 250,141,23,5,162,0,134,252,10,38,252,10,38,252,10,38, - 252,10,38,252,109,23,5,144,2,230,252,24,105,0,133,250, - 165,252,105,0,133,251,76,7,7,32,181,9,173,22,5,240, - 5,206,28,5,48,3,76,162,8,206,29,5,208,82,162,0, - 238,23,5,173,25,5,133,250,173,26,5,133,251,160,16,177, - 250,48,171,208,3,76,44,15,141,29,5,136,177,250,136,132, - 252,168,185,255,255,157,80,5,185,255,255,157,88,5,169,0, - 157,112,5,157,96,5,164,252,177,250,157,104,5,232,136,16, - 219,169,17,24,101,250,141,25,5,169,0,101,251,141,26,5, - 173,27,5,141,28,5,162,7,222,112,5,48,6,202,16,248, - 76,162,8,189,80,5,133,250,189,88,5,133,251,188,96,5, - 177,250,208,28,200,177,250,157,208,5,41,240,157,216,5,177, - 250,10,10,10,10,157,224,5,200,152,157,96,5,76,87,7, - 201,64,176,79,125,104,5,157,152,5,200,177,250,16,37,41, - 127,133,252,200,177,250,157,208,5,41,240,157,216,5,177,250, - 10,10,10,10,157,224,5,200,152,157,96,5,164,252,32,156, - 15,76,87,7,168,254,96,5,254,96,5,189,208,5,41,240, - 157,216,5,189,208,5,10,10,10,10,157,224,5,32,156,15, - 76,87,7,201,128,176,37,41,63,24,125,104,5,157,152,5, - 200,177,250,157,208,5,41,240,157,216,5,177,250,10,10,10, - 10,157,224,5,200,152,157,96,5,76,87,7,208,14,200,177, - 250,157,112,5,200,152,157,96,5,76,87,7,201,192,176,15, - 41,63,24,125,104,5,157,152,5,254,96,5,76,87,7,201, - 208,176,15,200,254,96,5,41,15,141,27,5,141,28,5,76, - 106,7,201,224,176,22,177,250,133,252,200,177,250,133,253,200, - 152,157,96,5,165,252,32,14,14,76,87,7,201,240,176,46, - 177,250,133,252,200,177,250,133,253,165,252,32,14,14,188,96, - 5,200,200,177,250,157,208,5,41,240,157,216,5,177,250,10, - 10,10,10,157,224,5,200,152,157,96,5,76,87,7,201,255, - 176,11,233,239,157,112,5,254,96,5,76,87,7,169,64,157, - 112,5,76,87,7,32,181,9,162,7,189,120,5,240,115,76, - 217,10,189,14,5,240,14,169,0,157,32,5,157,40,5,202, - 16,232,76,31,9,164,253,185,0,3,24,101,252,157,56,5, - 152,157,160,5,189,176,5,61,168,6,240,40,165,253,41,127, - 168,185,0,4,24,101,252,157,55,5,185,128,4,105,0,157, - 56,5,169,0,157,31,5,188,152,6,153,39,5,202,202,16, - 169,76,31,9,189,176,5,61,160,6,240,22,189,104,6,24, - 101,253,157,162,5,168,185,0,3,24,101,252,56,101,254,157, - 58,5,202,16,133,232,134,252,162,3,173,9,5,240,6,41, - 64,208,60,162,7,138,168,185,32,5,208,12,188,152,6,185, - 40,5,208,4,138,168,169,0,25,168,5,157,48,5,185,56, - 5,157,72,5,185,160,5,157,64,5,185,176,5,5,252,133, - 252,224,4,208,3,141,31,5,202,16,202,141,30,5,96,189, - 32,5,29,168,5,157,48,5,189,44,5,29,172,5,157,52, - 5,189,56,5,157,72,5,189,60,5,157,76,5,189,160,5, - 157,64,5,189,164,5,157,68,5,202,16,211,173,176,5,13, - 177,5,13,178,5,13,179,5,141,30,5,173,180,5,13,181, - 5,13,182,5,13,183,5,141,31,5,96,173,9,5,208,3, - 76,144,10,48,3,76,72,10,173,13,5,170,74,74,41,1, - 168,185,30,5,141,56,210,138,41,4,168,185,56,5,141,48, - 210,189,32,5,141,49,210,185,57,5,141,50,210,189,33,5, - 141,51,210,185,58,5,141,52,210,189,34,5,141,53,210,185, - 59,5,141,54,210,189,35,5,141,55,210,173,12,5,170,74, - 74,41,1,168,185,30,5,141,40,210,138,41,4,168,185,56, - 5,141,32,210,189,32,5,141,33,210,185,57,5,141,34,210, - 189,33,5,141,35,210,185,58,5,141,36,210,189,34,5,141, - 37,210,185,59,5,141,38,210,189,35,5,141,39,210,173,11, - 5,170,74,74,41,1,168,185,30,5,141,24,210,138,172,9, - 5,16,2,41,4,168,185,56,5,141,16,210,189,32,5,141, - 17,210,185,57,5,141,18,210,189,33,5,141,19,210,185,58, - 5,141,20,210,189,34,5,141,21,210,185,59,5,141,22,210, - 189,35,5,141,23,210,173,10,5,170,74,74,41,1,168,185, - 30,5,141,8,210,138,172,9,5,16,2,41,4,168,185,56, - 5,141,0,210,189,32,5,141,1,210,185,57,5,141,2,210, - 189,33,5,141,3,210,185,58,5,141,4,210,189,34,5,141, - 5,210,185,59,5,141,6,210,189,35,5,141,7,210,96,189, - 128,5,133,250,189,136,5,133,251,189,128,6,133,252,189,136, - 6,133,253,189,144,6,133,254,189,184,5,221,192,5,144,12, - 157,8,6,189,200,5,157,184,5,76,11,11,189,8,6,240, - 48,189,232,5,240,19,222,248,5,208,14,157,248,5,189,216, - 5,240,6,56,233,16,157,216,5,189,240,5,240,19,222,0, - 6,208,14,157,0,6,189,224,5,240,6,56,233,16,157,224, - 5,188,72,6,177,250,24,125,152,5,24,101,253,133,253,222, - 88,6,16,57,189,80,6,157,88,6,189,96,6,240,30,24, - 125,72,6,157,72,6,240,13,221,64,6,144,32,169,255,157, - 96,6,76,135,11,169,1,157,96,6,76,135,11,254,72,6, - 189,64,6,221,72,6,176,5,169,0,157,72,6,169,19,24, - 101,250,133,250,144,2,230,251,188,184,5,177,250,41,240,157, - 168,5,177,250,41,15,29,216,5,168,185,0,2,5,255,168, - 185,0,2,157,32,5,188,184,5,200,177,250,41,15,29,224, - 5,168,185,0,2,5,255,168,185,0,2,157,40,5,189,40, - 6,208,39,189,16,6,141,212,11,16,254,76,209,12,234,76, - 108,12,234,76,167,12,234,76,212,12,234,76,1,13,234,76, - 33,13,234,76,65,13,234,76,73,13,222,40,6,188,184,5, - 200,177,250,41,112,74,74,74,141,34,12,177,250,48,6,189, - 112,6,76,18,12,189,120,6,61,176,6,157,176,5,200,200, - 152,157,184,5,136,177,250,144,254,144,22,144,12,144,34,144, - 24,144,46,144,36,144,50,144,52,125,128,6,157,128,6,177, - 250,24,101,252,133,252,76,172,8,125,136,6,157,136,6,177, - 250,24,101,253,133,253,76,172,8,125,144,6,157,144,6,177, - 250,24,101,254,133,254,76,172,8,133,252,169,0,133,253,76, - 172,8,189,32,6,41,3,74,144,10,208,25,189,24,6,24, - 101,252,133,252,222,56,6,16,78,254,32,6,189,48,6,157, - 56,6,76,247,11,165,252,253,24,6,133,252,222,56,6,16, - 54,254,32,6,189,48,6,157,56,6,76,247,11,188,32,6, - 189,24,6,48,2,200,200,136,152,24,101,252,133,252,222,56, - 6,16,20,152,157,32,6,221,24,6,208,5,73,255,157,24, - 6,189,48,6,157,56,6,76,247,11,188,32,6,189,24,6, - 48,2,200,200,136,152,24,101,253,133,253,222,56,6,16,231, - 152,157,32,6,221,24,6,208,216,73,255,157,24,6,189,48, - 6,157,56,6,76,247,11,189,32,6,24,101,252,133,252,222, - 56,6,16,195,189,24,6,24,125,32,6,157,32,6,189,48, - 6,157,56,6,76,247,11,165,253,56,253,32,6,133,253,222, - 56,6,16,163,189,24,6,24,125,32,6,157,32,6,189,48, - 6,157,56,6,76,247,11,189,24,6,24,101,252,133,252,76, - 247,11,160,16,169,0,133,250,169,0,133,251,169,0,141,23, - 5,138,240,63,177,250,240,2,16,1,202,169,17,24,101,250, - 133,250,144,2,230,251,238,23,5,208,230,162,0,169,0,133, - 252,138,141,23,5,10,38,252,10,38,252,10,38,252,10,38, - 252,109,23,5,144,2,230,252,24,105,0,133,250,165,252,105, - 0,133,251,32,44,15,165,250,141,25,5,165,251,141,26,5, - 162,7,169,255,157,208,5,169,240,157,216,5,157,224,5,202, - 16,240,169,3,141,15,210,141,31,210,141,47,210,141,63,210, - 206,23,5,232,142,28,5,232,142,29,5,142,22,5,96,138, - 41,15,141,27,5,96,142,22,5,96,201,16,176,3,76,76, - 13,201,32,144,136,201,48,176,3,76,133,15,201,64,144,223, - 201,80,176,3,76,44,15,201,96,144,219,201,112,144,3,76, - 180,14,132,253,41,15,10,141,23,14,165,253,144,254,144,30, - 144,56,144,89,144,96,144,26,144,28,144,30,144,32,144,34, - 144,36,144,13,144,11,144,9,144,7,144,5,144,3,141,24, - 5,96,157,104,6,96,157,112,6,96,157,120,6,96,157,144, - 6,96,157,128,6,96,157,136,6,96,41,112,74,74,157,16, - 6,41,48,208,3,157,32,6,165,253,48,6,41,15,157,24, - 6,96,41,15,73,255,24,105,1,157,24,6,96,41,63,157, - 48,6,157,56,6,96,41,128,10,42,157,96,6,165,253,41, - 112,74,74,74,74,157,64,6,208,3,157,96,6,165,253,41, - 15,157,80,6,157,88,6,189,72,6,221,64,6,144,143,189, - 64,6,240,2,233,1,157,72,6,96,132,250,134,251,160,25, - 177,250,200,141,9,5,177,250,200,141,10,5,177,250,200,141, - 11,5,177,250,200,141,12,5,177,250,200,141,13,5,177,250, - 141,27,5,165,250,73,128,48,1,232,141,172,15,142,173,15, - 73,128,48,1,232,141,29,7,142,30,7,232,141,35,7,142, - 36,7,232,141,162,15,142,163,15,73,128,48,1,232,141,25, - 5,141,215,6,141,79,13,141,148,13,142,26,5,142,221,6, - 142,83,13,142,154,13,169,240,133,255,169,0,141,22,5,141, - 24,5,162,7,169,0,141,22,5,157,120,5,157,176,5,157, - 32,5,157,40,5,157,48,5,157,48,210,157,32,210,157,16, - 210,157,0,210,202,16,226,141,24,210,141,8,210,141,56,210, - 141,40,210,141,30,5,141,31,5,96,157,32,5,157,40,5, - 157,48,5,157,176,5,96,152,157,208,5,41,240,157,216,5, - 189,208,5,10,10,10,10,157,224,5,96,41,7,133,250,138, - 166,250,41,63,240,225,157,152,5,152,48,238,189,208,5,32, - 117,15,169,0,157,120,5,185,255,255,240,190,157,136,5,133, - 251,185,255,255,157,128,5,133,250,152,157,144,5,160,8,177, - 250,200,157,192,5,177,250,200,157,200,5,177,250,200,157,104, - 6,177,250,200,157,112,6,177,250,200,157,120,6,177,250,200, - 157,232,5,157,248,5,177,250,200,157,240,5,157,0,6,177, - 250,41,112,74,74,157,16,6,177,250,200,48,8,41,15,157, - 24,6,76,9,16,41,15,73,255,24,105,1,157,24,6,177, - 250,200,157,40,6,177,250,200,41,63,157,48,6,157,56,6, - 177,250,41,128,10,42,157,96,6,177,250,41,112,74,74,74, - 74,157,64,6,208,3,157,96,6,177,250,136,41,15,157,80, - 6,157,88,6,177,250,41,192,29,152,5,157,152,5,168,185, - 0,3,157,56,5,169,0,157,184,5,157,32,6,157,8,6, - 157,72,6,157,128,6,157,136,6,157,144,6,169,1,157,120, - 5,96 + 255,255,0,2,107,16,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1, + 1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,1, + 1,1,2,2,2,2,0,0,0,1,1,1,1,1,2,2, + 2,2,2,3,3,3,0,0,1,1,1,1,2,2,2,2, + 3,3,3,3,4,4,0,0,1,1,1,2,2,2,3,3, + 3,4,4,4,5,5,0,0,1,1,2,2,2,3,3,4, + 4,4,5,5,6,6,0,0,1,1,2,2,3,3,4,4, + 5,5,6,6,7,7,0,1,1,2,2,3,3,4,4,5, + 5,6,6,7,7,8,0,1,1,2,2,3,4,4,5,5, + 6,7,7,8,8,9,0,1,1,2,3,3,4,5,5,6, + 7,7,8,9,9,10,0,1,1,2,3,4,4,5,6,7, + 7,8,9,10,10,11,0,1,2,2,3,4,5,6,6,7, + 8,9,10,10,11,12,0,1,2,3,3,4,5,6,7,8, + 9,10,10,11,12,13,0,1,2,3,4,5,6,7,7,8, + 9,10,11,12,13,14,0,1,2,3,4,5,6,7,8,9, + 10,11,12,13,14,15,0,241,228,215,203,192,181,170,161,152, + 143,135,127,120,114,107,101,95,90,85,80,75,71,67,63,60, + 56,53,50,47,44,42,39,37,35,33,31,29,28,26,24,23, + 22,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6, + 5,4,3,2,1,0,0,242,233,218,206,191,182,170,161,152, + 143,137,128,122,113,107,101,95,92,86,80,77,71,68,62,60, + 56,53,50,47,45,42,40,37,35,33,31,29,28,26,24,23, + 22,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6, + 5,4,3,2,1,0,0,255,241,228,216,202,192,181,171,162, + 153,142,135,127,121,115,112,102,97,90,85,82,75,72,67,63, + 60,57,55,51,48,45,42,40,37,36,33,31,30,28,27,25, + 23,22,21,19,18,17,16,15,14,13,12,11,10,9,8,7, + 6,5,4,3,2,1,0,243,230,217,204,193,181,173,162,153, + 144,136,128,121,114,108,102,96,91,85,81,76,72,68,64,60, + 57,53,50,47,45,42,40,37,35,33,31,29,28,26,24,23, + 22,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6, + 5,4,3,2,1,0,226,56,140,0,106,232,106,239,128,8, + 174,70,230,149,65,246,176,110,48,246,187,132,82,34,244,200, + 160,122,85,52,20,245,216,189,164,141,119,96,78,56,39,21, + 6,247,232,219,207,195,184,172,162,154,144,136,127,120,112,106, + 100,94,87,82,50,10,0,242,51,150,226,56,140,0,106,232, + 106,239,128,8,174,70,230,149,65,246,176,110,48,246,187,132, + 82,34,244,200,160,122,85,52,20,245,216,189,164,141,119,96, + 78,56,39,21,6,247,232,219,207,195,184,172,162,154,144,136, + 127,120,112,106,100,94,11,11,10,10,9,8,8,7,7,7, + 6,6,5,5,5,4,4,4,4,3,3,3,3,3,2,2, + 2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1, + 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,13,13,12,11,11,10,10,9,8, + 8,7,7,7,6,6,5,5,5,4,4,4,4,3,3,3, + 3,3,2,2,2,2,2,2,2,1,1,1,1,1,1,1, + 1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,76,228,13,76,227,6,76,159,8,1, + 16,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,5, + 6,7,0,1,2,3,4,2,0,0,4,2,0,0,0,16, + 0,8,0,16,0,8,133,211,129,169,133,211,129,169,136,177, + 250,141,23,5,162,0,134,252,10,38,252,10,38,252,10,38, + 252,10,38,252,109,23,5,144,2,230,252,24,105,0,133,250, + 165,252,105,0,133,251,76,7,7,32,181,9,173,22,5,240, + 5,206,28,5,48,3,76,162,8,206,29,5,208,82,162,0, + 238,23,5,173,25,5,133,250,173,26,5,133,251,160,16,177, + 250,48,171,208,3,76,44,15,141,29,5,136,177,250,136,132, + 252,168,185,255,255,157,80,5,185,255,255,157,88,5,169,0, + 157,112,5,157,96,5,164,252,177,250,157,104,5,232,136,16, + 219,169,17,24,101,250,141,25,5,169,0,101,251,141,26,5, + 173,27,5,141,28,5,162,7,222,112,5,48,6,202,16,248, + 76,162,8,189,80,5,133,250,189,88,5,133,251,188,96,5, + 177,250,208,28,200,177,250,157,208,5,41,240,157,216,5,177, + 250,10,10,10,10,157,224,5,200,152,157,96,5,76,87,7, + 201,64,176,79,125,104,5,157,152,5,200,177,250,16,37,41, + 127,133,252,200,177,250,157,208,5,41,240,157,216,5,177,250, + 10,10,10,10,157,224,5,200,152,157,96,5,164,252,32,156, + 15,76,87,7,168,254,96,5,254,96,5,189,208,5,41,240, + 157,216,5,189,208,5,10,10,10,10,157,224,5,32,156,15, + 76,87,7,201,128,176,37,41,63,24,125,104,5,157,152,5, + 200,177,250,157,208,5,41,240,157,216,5,177,250,10,10,10, + 10,157,224,5,200,152,157,96,5,76,87,7,208,14,200,177, + 250,157,112,5,200,152,157,96,5,76,87,7,201,192,176,15, + 41,63,24,125,104,5,157,152,5,254,96,5,76,87,7,201, + 208,176,15,200,254,96,5,41,15,141,27,5,141,28,5,76, + 106,7,201,224,176,22,177,250,133,252,200,177,250,133,253,200, + 152,157,96,5,165,252,32,14,14,76,87,7,201,240,176,46, + 177,250,133,252,200,177,250,133,253,165,252,32,14,14,188,96, + 5,200,200,177,250,157,208,5,41,240,157,216,5,177,250,10, + 10,10,10,157,224,5,200,152,157,96,5,76,87,7,201,255, + 176,11,233,239,157,112,5,254,96,5,76,87,7,169,64,157, + 112,5,76,87,7,32,181,9,162,7,189,120,5,240,115,76, + 217,10,189,14,5,240,14,169,0,157,32,5,157,40,5,202, + 16,232,76,31,9,164,253,185,0,3,24,101,252,157,56,5, + 152,157,160,5,189,176,5,61,168,6,240,40,165,253,41,127, + 168,185,0,4,24,101,252,157,55,5,185,128,4,105,0,157, + 56,5,169,0,157,31,5,188,152,6,153,39,5,202,202,16, + 169,76,31,9,189,176,5,61,160,6,240,22,189,104,6,24, + 101,253,157,162,5,168,185,0,3,24,101,252,56,101,254,157, + 58,5,202,16,133,232,134,252,162,3,173,9,5,240,6,41, + 64,208,60,162,7,138,168,185,32,5,208,12,188,152,6,185, + 40,5,208,4,138,168,169,0,25,168,5,157,48,5,185,56, + 5,157,72,5,185,160,5,157,64,5,185,176,5,5,252,133, + 252,224,4,208,3,141,31,5,202,16,202,141,30,5,96,189, + 32,5,29,168,5,157,48,5,189,44,5,29,172,5,157,52, + 5,189,56,5,157,72,5,189,60,5,157,76,5,189,160,5, + 157,64,5,189,164,5,157,68,5,202,16,211,173,176,5,13, + 177,5,13,178,5,13,179,5,141,30,5,173,180,5,13,181, + 5,13,182,5,13,183,5,141,31,5,96,173,9,5,208,3, + 76,144,10,48,3,76,72,10,173,13,5,170,74,74,41,1, + 168,185,30,5,141,56,210,138,41,4,168,185,56,5,141,48, + 210,189,32,5,141,49,210,185,57,5,141,50,210,189,33,5, + 141,51,210,185,58,5,141,52,210,189,34,5,141,53,210,185, + 59,5,141,54,210,189,35,5,141,55,210,173,12,5,170,74, + 74,41,1,168,185,30,5,141,40,210,138,41,4,168,185,56, + 5,141,32,210,189,32,5,141,33,210,185,57,5,141,34,210, + 189,33,5,141,35,210,185,58,5,141,36,210,189,34,5,141, + 37,210,185,59,5,141,38,210,189,35,5,141,39,210,173,11, + 5,170,74,74,41,1,168,185,30,5,141,24,210,138,172,9, + 5,16,2,41,4,168,185,56,5,141,16,210,189,32,5,141, + 17,210,185,57,5,141,18,210,189,33,5,141,19,210,185,58, + 5,141,20,210,189,34,5,141,21,210,185,59,5,141,22,210, + 189,35,5,141,23,210,173,10,5,170,74,74,41,1,168,185, + 30,5,141,8,210,138,172,9,5,16,2,41,4,168,185,56, + 5,141,0,210,189,32,5,141,1,210,185,57,5,141,2,210, + 189,33,5,141,3,210,185,58,5,141,4,210,189,34,5,141, + 5,210,185,59,5,141,6,210,189,35,5,141,7,210,96,189, + 128,5,133,250,189,136,5,133,251,189,128,6,133,252,189,136, + 6,133,253,189,144,6,133,254,189,184,5,221,192,5,144,12, + 157,8,6,189,200,5,157,184,5,76,11,11,189,8,6,240, + 48,189,232,5,240,19,222,248,5,208,14,157,248,5,189,216, + 5,240,6,56,233,16,157,216,5,189,240,5,240,19,222,0, + 6,208,14,157,0,6,189,224,5,240,6,56,233,16,157,224, + 5,188,72,6,177,250,24,125,152,5,24,101,253,133,253,222, + 88,6,16,57,189,80,6,157,88,6,189,96,6,240,30,24, + 125,72,6,157,72,6,240,13,221,64,6,144,32,169,255,157, + 96,6,76,135,11,169,1,157,96,6,76,135,11,254,72,6, + 189,64,6,221,72,6,176,5,169,0,157,72,6,169,19,24, + 101,250,133,250,144,2,230,251,188,184,5,177,250,41,240,157, + 168,5,177,250,41,15,29,216,5,168,185,0,2,5,255,168, + 185,0,2,157,32,5,188,184,5,200,177,250,41,15,29,224, + 5,168,185,0,2,5,255,168,185,0,2,157,40,5,189,40, + 6,208,39,189,16,6,141,212,11,16,254,76,209,12,234,76, + 108,12,234,76,167,12,234,76,212,12,234,76,1,13,234,76, + 33,13,234,76,65,13,234,76,73,13,222,40,6,188,184,5, + 200,177,250,41,112,74,74,74,141,34,12,177,250,48,6,189, + 112,6,76,18,12,189,120,6,61,176,6,157,176,5,200,200, + 152,157,184,5,136,177,250,144,254,144,22,144,12,144,34,144, + 24,144,46,144,36,144,50,144,52,125,128,6,157,128,6,177, + 250,24,101,252,133,252,76,172,8,125,136,6,157,136,6,177, + 250,24,101,253,133,253,76,172,8,125,144,6,157,144,6,177, + 250,24,101,254,133,254,76,172,8,133,252,169,0,133,253,76, + 172,8,189,32,6,41,3,74,144,10,208,25,189,24,6,24, + 101,252,133,252,222,56,6,16,78,254,32,6,189,48,6,157, + 56,6,76,247,11,165,252,253,24,6,133,252,222,56,6,16, + 54,254,32,6,189,48,6,157,56,6,76,247,11,188,32,6, + 189,24,6,48,2,200,200,136,152,24,101,252,133,252,222,56, + 6,16,20,152,157,32,6,221,24,6,208,5,73,255,157,24, + 6,189,48,6,157,56,6,76,247,11,188,32,6,189,24,6, + 48,2,200,200,136,152,24,101,253,133,253,222,56,6,16,231, + 152,157,32,6,221,24,6,208,216,73,255,157,24,6,189,48, + 6,157,56,6,76,247,11,189,32,6,24,101,252,133,252,222, + 56,6,16,195,189,24,6,24,125,32,6,157,32,6,189,48, + 6,157,56,6,76,247,11,165,253,56,253,32,6,133,253,222, + 56,6,16,163,189,24,6,24,125,32,6,157,32,6,189,48, + 6,157,56,6,76,247,11,189,24,6,24,101,252,133,252,76, + 247,11,160,16,169,0,133,250,169,0,133,251,169,0,141,23, + 5,138,240,63,177,250,240,2,16,1,202,169,17,24,101,250, + 133,250,144,2,230,251,238,23,5,208,230,162,0,169,0,133, + 252,138,141,23,5,10,38,252,10,38,252,10,38,252,10,38, + 252,109,23,5,144,2,230,252,24,105,0,133,250,165,252,105, + 0,133,251,32,44,15,165,250,141,25,5,165,251,141,26,5, + 162,7,169,255,157,208,5,169,240,157,216,5,157,224,5,202, + 16,240,169,3,141,15,210,141,31,210,141,47,210,141,63,210, + 206,23,5,232,142,28,5,232,142,29,5,142,22,5,96,138, + 41,15,141,27,5,96,142,22,5,96,201,16,176,3,76,76, + 13,201,32,144,136,201,48,176,3,76,133,15,201,64,144,223, + 201,80,176,3,76,44,15,201,96,144,219,201,112,144,3,76, + 180,14,132,253,41,15,10,141,23,14,165,253,144,254,144,30, + 144,56,144,89,144,96,144,26,144,28,144,30,144,32,144,34, + 144,36,144,13,144,11,144,9,144,7,144,5,144,3,141,24, + 5,96,157,104,6,96,157,112,6,96,157,120,6,96,157,144, + 6,96,157,128,6,96,157,136,6,96,41,112,74,74,157,16, + 6,41,48,208,3,157,32,6,165,253,48,6,41,15,157,24, + 6,96,41,15,73,255,24,105,1,157,24,6,96,41,63,157, + 48,6,157,56,6,96,41,128,10,42,157,96,6,165,253,41, + 112,74,74,74,74,157,64,6,208,3,157,96,6,165,253,41, + 15,157,80,6,157,88,6,189,72,6,221,64,6,144,143,189, + 64,6,240,2,233,1,157,72,6,96,132,250,134,251,160,25, + 177,250,200,141,9,5,177,250,200,141,10,5,177,250,200,141, + 11,5,177,250,200,141,12,5,177,250,200,141,13,5,177,250, + 141,27,5,165,250,73,128,48,1,232,141,172,15,142,173,15, + 73,128,48,1,232,141,29,7,142,30,7,232,141,35,7,142, + 36,7,232,141,162,15,142,163,15,73,128,48,1,232,141,25, + 5,141,215,6,141,79,13,141,148,13,142,26,5,142,221,6, + 142,83,13,142,154,13,169,240,133,255,169,0,141,22,5,141, + 24,5,162,7,169,0,141,22,5,157,120,5,157,176,5,157, + 32,5,157,40,5,157,48,5,157,48,210,157,32,210,157,16, + 210,157,0,210,202,16,226,141,24,210,141,8,210,141,56,210, + 141,40,210,141,30,5,141,31,5,96,157,32,5,157,40,5, + 157,48,5,157,176,5,96,152,157,208,5,41,240,157,216,5, + 189,208,5,10,10,10,10,157,224,5,96,41,7,133,250,138, + 166,250,41,63,240,225,157,152,5,152,48,238,189,208,5,32, + 117,15,169,0,157,120,5,185,255,255,240,190,157,136,5,133, + 251,185,255,255,157,128,5,133,250,152,157,144,5,160,8,177, + 250,200,157,192,5,177,250,200,157,200,5,177,250,200,157,104, + 6,177,250,200,157,112,6,177,250,200,157,120,6,177,250,200, + 157,232,5,157,248,5,177,250,200,157,240,5,157,0,6,177, + 250,41,112,74,74,157,16,6,177,250,200,48,8,41,15,157, + 24,6,76,9,16,41,15,73,255,24,105,1,157,24,6,177, + 250,200,157,40,6,177,250,200,41,63,157,48,6,157,56,6, + 177,250,41,128,10,42,157,96,6,177,250,41,112,74,74,74, + 74,157,64,6,208,3,157,96,6,177,250,136,41,15,157,80, + 6,157,88,6,177,250,41,192,29,152,5,157,152,5,168,185, + 0,3,157,56,5,169,0,157,184,5,157,32,6,157,8,6, + 157,72,6,157,128,6,157,136,6,157,144,6,169,1,157,120, + 5,96 END_CONST_ARRAY; diff --git a/apps/codecs/libfaad/hcr.c b/apps/codecs/libfaad/hcr.c index f2766c38e1..f968ea7bec 100644 --- a/apps/codecs/libfaad/hcr.c +++ b/apps/codecs/libfaad/hcr.c @@ -78,7 +78,7 @@ typedef struct { uint8_t cb; uint8_t decoded; - uint16_t sp_offset; + uint16_t sp_offset; bits_t bits; } codeword_t; diff --git a/apps/codecs/libfaad/huffman.c b/apps/codecs/libfaad/huffman.c index 8b9e27b553..c142ad7ac7 100644 --- a/apps/codecs/libfaad/huffman.c +++ b/apps/codecs/libfaad/huffman.c @@ -124,7 +124,7 @@ static INLINE int16_t huffman_getescape(bitfile *ld, int16_t sp) { uint8_t neg, i; int16_t j; - int16_t off; + int16_t off; if (sp < 0) { @@ -500,14 +500,14 @@ int8_t huffman_spectral_data_2(uint8_t cb, bits_t *ld, int16_t *sp) break; } - /* decode sign bits */ + /* decode sign bits */ if (unsigned_cb[cb]) { for(i = 0; i < ((cb < FIRST_PAIR_HCB) ? QUAD_LEN : PAIR_LEN); i++) { if(sp[i]) { - uint8_t b; + uint8_t b; if ( get1bit_hcr(ld, &b) ) return -1; if (b != 0) { sp[i] = -sp[i]; diff --git a/apps/codecs/libfaad/sbr_dct.c b/apps/codecs/libfaad/sbr_dct.c index dbfbb8945c..c916a82a61 100644 --- a/apps/codecs/libfaad/sbr_dct.c +++ b/apps/codecs/libfaad/sbr_dct.c @@ -1489,7 +1489,7 @@ static void fft_dif(real_t * Real, real_t * Imag) // First 2 stages of 32 point FFT decimation in frequency // 4*16*2=64*2=128 multiplications // 6*16*2=96*2=192 additions - // Stage 1 of 32 point FFT decimation in frequency + // Stage 1 of 32 point FFT decimation in frequency for (i = 0; i < 16; i++) { point1_real = Real[i]; @@ -1519,7 +1519,7 @@ static void fft_dif(real_t * Real, real_t * Imag) w_real = w_array_real[w_index]; w_imag = w_array_imag[w_index]; - i = j; + i = j; point1_real = Real[i]; point1_imag = Imag[i]; i2 = i+8; @@ -1818,9 +1818,9 @@ void dct4_kernel(real_t * in_real, real_t * in_imag, real_t * out_real, real_t * // 3*32=96 additions for (i = 0; i < 32; i++) { - real_t x_re, x_im, tmp; - x_re = in_real[i]; - x_im = in_imag[i]; + real_t x_re, x_im, tmp; + x_re = in_real[i]; + x_im = in_imag[i]; tmp = MUL_C(x_re + x_im, dct4_64_tab[i]); in_real[i] = MUL_C(x_im, dct4_64_tab[i + 64]) + tmp; in_imag[i] = MUL_C(x_re, dct4_64_tab[i + 32]) + tmp; @@ -1834,10 +1834,10 @@ void dct4_kernel(real_t * in_real, real_t * in_imag, real_t * out_real, real_t * // 3*31+2=95 additions for (i = 0; i < 16; i++) { - real_t x_re, x_im, tmp; - i_rev = bit_rev_tab[i]; - x_re = in_real[i_rev]; - x_im = in_imag[i_rev]; + real_t x_re, x_im, tmp; + i_rev = bit_rev_tab[i]; + x_re = in_real[i_rev]; + x_im = in_imag[i_rev]; tmp = MUL_C(x_re + x_im, dct4_64_tab[i + 3*32]); out_real[i] = MUL_C(x_im, dct4_64_tab[i + 5*32]) + tmp; @@ -1848,10 +1848,10 @@ void dct4_kernel(real_t * in_real, real_t * in_imag, real_t * out_real, real_t * out_real[16] = MUL_C(in_real[1] + in_imag[1], dct4_64_tab[16 + 3*32]); for (i = 17; i < 32; i++) { - real_t x_re, x_im, tmp; - i_rev = bit_rev_tab[i]; - x_re = in_real[i_rev]; - x_im = in_imag[i_rev]; + real_t x_re, x_im, tmp; + i_rev = bit_rev_tab[i]; + x_re = in_real[i_rev]; + x_im = in_imag[i_rev]; tmp = MUL_C(x_re + x_im, dct4_64_tab[i + 3*32]); out_real[i] = MUL_C(x_im, dct4_64_tab[i + 5*32]) + tmp; out_imag[i] = MUL_C(x_re, dct4_64_tab[i + 4*32]) + tmp; diff --git a/apps/codecs/libfaad/sbr_dec.c b/apps/codecs/libfaad/sbr_dec.c index c18ea454d5..97f1d9b647 100644 --- a/apps/codecs/libfaad/sbr_dec.c +++ b/apps/codecs/libfaad/sbr_dec.c @@ -50,7 +50,7 @@ static void sbr_save_matrix(sbr_info *sbr, uint8_t ch); sbr_info *sbrDecodeInit(uint16_t framelength, uint8_t id_aac, uint32_t sample_rate, uint8_t downSampledSBR #ifdef DRM - , uint8_t IsDRM + , uint8_t IsDRM #endif ) { diff --git a/apps/codecs/libfaad/sbr_hfadj.c b/apps/codecs/libfaad/sbr_hfadj.c index 374d16f443..453180d544 100644 --- a/apps/codecs/libfaad/sbr_hfadj.c +++ b/apps/codecs/libfaad/sbr_hfadj.c @@ -1561,7 +1561,7 @@ static void hf_assembly(sbr_info *sbr, sbr_hfadj_info *adj, #ifndef SBR_LOW_POWER if (h_SL != 0) { - uint8_t ri = sbr->GQ_ringbuf_index[ch]; + uint8_t ri = sbr->GQ_ringbuf_index[ch]; for (n = 0; n <= 4; n++) { real_t curr_h_smooth = h_smooth[n]; diff --git a/apps/codecs/libfaad/sbr_hfgen.c b/apps/codecs/libfaad/sbr_hfgen.c index f77bbd052f..63a2fce855 100644 --- a/apps/codecs/libfaad/sbr_hfgen.c +++ b/apps/codecs/libfaad/sbr_hfgen.c @@ -128,20 +128,20 @@ void hf_generation(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64], a1_i = MUL_C(IM(alpha_1[p]), bw2); #endif - temp2_r = QMF_RE(Xlow[first - 2 + offset][p]); - temp3_r = QMF_RE(Xlow[first - 1 + offset][p]); + temp2_r = QMF_RE(Xlow[first - 2 + offset][p]); + temp3_r = QMF_RE(Xlow[first - 1 + offset][p]); #ifndef SBR_LOW_POWER - temp2_i = QMF_IM(Xlow[first - 2 + offset][p]); - temp3_i = QMF_IM(Xlow[first - 1 + offset][p]); + temp2_i = QMF_IM(Xlow[first - 2 + offset][p]); + temp3_i = QMF_IM(Xlow[first - 1 + offset][p]); #endif - for (l = first; l < last; l++) + for (l = first; l < last; l++) { - temp1_r = temp2_r; - temp2_r = temp3_r; - temp3_r = QMF_RE(Xlow[l + offset][p]); + temp1_r = temp2_r; + temp2_r = temp3_r; + temp3_r = QMF_RE(Xlow[l + offset][p]); #ifndef SBR_LOW_POWER - temp1_i = temp2_i; - temp2_i = temp3_i; + temp1_i = temp2_i; + temp2_i = temp3_i; temp3_i = QMF_IM(Xlow[l + offset][p]); #endif @@ -303,10 +303,10 @@ static void auto_correlation(sbr_info *sbr, acorr_coef *ac, qmf_t buffer[MAX_NTS for (j = offset; j < len + offset; j++) { - temp1_r = temp2_r; // temp1_r = (QMF_RE(buffer[offset-2][bd] + (1<<(exp-1))) >> exp; - temp1_i = temp2_i; // temp1_i = (QMF_IM(buffer[offset-2][bd] + (1<<(exp-1))) >> exp; - temp2_r = temp3_r; // temp2_r = (QMF_RE(buffer[offset-1][bd] + (1<<(exp-1))) >> exp; - temp2_i = temp3_i; // temp2_i = (QMF_IM(buffer[offset-1][bd] + (1<<(exp-1))) >> exp; + temp1_r = temp2_r; // temp1_r = (QMF_RE(buffer[offset-2][bd] + (1<<(exp-1))) >> exp; + temp1_i = temp2_i; // temp1_i = (QMF_IM(buffer[offset-2][bd] + (1<<(exp-1))) >> exp; + temp2_r = temp3_r; // temp2_r = (QMF_RE(buffer[offset-1][bd] + (1<<(exp-1))) >> exp; + temp2_i = temp3_i; // temp2_i = (QMF_IM(buffer[offset-1][bd] + (1<<(exp-1))) >> exp; temp3_r = (QMF_RE(buffer[j][bd]) + pow2_to_exp) >> exp; temp3_i = (QMF_IM(buffer[j][bd]) + pow2_to_exp) >> exp; r01r += MUL_R(temp3_r, temp2_r) + MUL_R(temp3_i, temp2_i); @@ -352,10 +352,10 @@ static void auto_correlation(sbr_info *sbr, acorr_coef *ac, qmf_t buffer[MAX_NTS for (j = offset; j < len + offset; j++) { - temp1_r = temp2_r; // temp1_r = QMF_RE(buffer[j-2][bd]; - temp1_i = temp2_i; // temp1_i = QMF_IM(buffer[j-2][bd]; - temp2_r = temp3_r; // temp2_r = QMF_RE(buffer[j-1][bd]; - temp2_i = temp3_i; // temp2_i = QMF_IM(buffer[j-1][bd]; + temp1_r = temp2_r; // temp1_r = QMF_RE(buffer[j-2][bd]; + temp1_i = temp2_i; // temp1_i = QMF_IM(buffer[j-2][bd]; + temp2_r = temp3_r; // temp2_r = QMF_RE(buffer[j-1][bd]; + temp2_i = temp3_i; // temp2_i = QMF_IM(buffer[j-1][bd]; temp3_r = QMF_RE(buffer[j][bd]); temp3_i = QMF_IM(buffer[j][bd]); r01r += temp3_r * temp2_r + temp3_i * temp2_i; diff --git a/apps/codecs/libfaad/sbr_qmf.c b/apps/codecs/libfaad/sbr_qmf.c index 540332bdcb..5486cd283d 100644 --- a/apps/codecs/libfaad/sbr_qmf.c +++ b/apps/codecs/libfaad/sbr_qmf.c @@ -42,12 +42,12 @@ qmfa_info *qmfa_init(uint8_t channels) { qmfa_info *qmfa = (qmfa_info*)faad_malloc(sizeof(qmfa_info)); - /* x is implemented as double ringbuffer */ + /* x is implemented as double ringbuffer */ qmfa->x = (real_t*)faad_malloc(2 * channels * 10 * sizeof(real_t)); memset(qmfa->x, 0, 2 * channels * 10 * sizeof(real_t)); - /* ringbuffer index */ - qmfa->x_index = 0; + /* ringbuffer index */ + qmfa->x_index = 0; qmfa->channels = channels; @@ -81,7 +81,7 @@ void sbr_qmf_analysis_32(sbr_info *sbr, qmfa_info *qmfa, const real_t *input, int16_t n; /* shift input buffer x */ - /* input buffer is not shifted anymore, x is implemented as double ringbuffer */ + /* input buffer is not shifted anymore, x is implemented as double ringbuffer */ //memmove(qmfa->x + 32, qmfa->x, (320-32)*sizeof(real_t)); /* add new samples to input buffer x */ @@ -104,10 +104,10 @@ void sbr_qmf_analysis_32(sbr_info *sbr, qmfa_info *qmfa, const real_t *input, MUL_F(qmfa->x[qmfa->x_index + n + 256], qmf_c[2*(n + 256)]); } - /* update ringbuffer index */ - qmfa->x_index -= 32; - if (qmfa->x_index < 0) - qmfa->x_index = (320-32); + /* update ringbuffer index */ + qmfa->x_index -= 32; + if (qmfa->x_index < 0) + qmfa->x_index = (320-32); /* calculate 32 subband samples by introducing X */ #ifdef SBR_LOW_POWER @@ -224,7 +224,7 @@ qmfs_info *qmfs_init(uint8_t channels) { qmfs_info *qmfs = (qmfs_info*)faad_malloc(sizeof(qmfs_info)); - /* v is a double ringbuffer */ + /* v is a double ringbuffer */ qmfs->v = (real_t*)faad_malloc(2 * channels * 20 * sizeof(real_t)); memset(qmfs->v, 0, 2 * channels * 20 * sizeof(real_t)); @@ -483,8 +483,8 @@ void sbr_qmf_synthesis_64(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][6 for (l = 0; l < sbr->numTimeSlotsRate; l++) { /* shift buffer v */ - /* buffer is not shifted, we use double ringbuffer */ - //memmove(qmfs->v + 128, qmfs->v, (1280-128)*sizeof(real_t)); + /* buffer is not shifted, we use double ringbuffer */ + //memmove(qmfs->v + 128, qmfs->v, (1280-128)*sizeof(real_t)); /* calculate 128 samples */ #ifndef FIXED_POINT diff --git a/apps/codecs/libfaad/sbr_syntax.c b/apps/codecs/libfaad/sbr_syntax.c index 267e954a2e..eff26e9f46 100644 --- a/apps/codecs/libfaad/sbr_syntax.c +++ b/apps/codecs/libfaad/sbr_syntax.c @@ -337,16 +337,16 @@ static uint8_t sbr_data(bitfile *ld, sbr_info *sbr) switch (sbr->id_aac) { case ID_SCE: - if ((result = sbr_single_channel_element(ld, sbr)) > 0) - return result; + if ((result = sbr_single_channel_element(ld, sbr)) > 0) + return result; break; case ID_CPE: - if ((result = sbr_channel_pair_element(ld, sbr)) > 0) - return result; + if ((result = sbr_channel_pair_element(ld, sbr)) > 0) + return result; break; } - return 0; + return 0; } /* table 5 */ diff --git a/apps/codecs/libffmpegFLAC/bitstream.h b/apps/codecs/libffmpegFLAC/bitstream.h index 19f2b6e01c..9a8c548d95 100644 --- a/apps/codecs/libffmpegFLAC/bitstream.h +++ b/apps/codecs/libffmpegFLAC/bitstream.h @@ -100,7 +100,7 @@ typedef struct RL_VLC_ELEM { # ifdef __GNUC__ static inline uint32_t unaligned32(const void *v) { struct Unaligned { - uint32_t i; + uint32_t i; } __attribute__((packed)); return ((const struct Unaligned *) v)->i; @@ -165,10 +165,10 @@ for examples see get_bits, show_bits, skip_bits, get_vlc static inline int unaligned32_be(const void *v) { #ifdef CONFIG_ALIGN - const uint8_t *p=v; - return (((p[0]<<8) | p[1])<<16) | (p[2]<<8) | (p[3]); + const uint8_t *p=v; + return (((p[0]<<8) | p[1])<<16) | (p[2]<<8) | (p[3]); #else - return betoh32( unaligned32(v)); //original + return betoh32( unaligned32(v)); //original #endif } diff --git a/apps/codecs/libffmpegFLAC/golomb.h b/apps/codecs/libffmpegFLAC/golomb.h index 4f99671338..197b78ee1c 100644 --- a/apps/codecs/libffmpegFLAC/golomb.h +++ b/apps/codecs/libffmpegFLAC/golomb.h @@ -93,7 +93,7 @@ static inline int get_sr_golomb_flac(GetBitContext *gb, int k, int limit, int es #define get_ur_golomb_shorten(gb, k) get_ur_golomb_jpegls(gb, k, INT_MAX, 0) /* static inline unsigned int get_ur_golomb_shorten(GetBitContext *gb, int k){ - return get_ur_golomb_jpegls(gb, k, INT_MAX, 0); + return get_ur_golomb_jpegls(gb, k, INT_MAX, 0); } */ diff --git a/apps/codecs/libffmpegFLAC/main.c b/apps/codecs/libffmpegFLAC/main.c index 058c581aea..5d232a8896 100644 --- a/apps/codecs/libffmpegFLAC/main.c +++ b/apps/codecs/libffmpegFLAC/main.c @@ -221,7 +221,7 @@ static bool flac_init(int fd, FLACContext* fc) offset_lo=betoh32(*(p++)); if ((seekpoint_hi != 0xffffffff) && (seekpoint_lo != 0xffffffff)) { - fprintf(stderr,"Seekpoint: %u, Offset=%u\n",seekpoint_lo,offset_lo); + fprintf(stderr,"Seekpoint: %u, Offset=%u\n",seekpoint_lo,offset_lo); } } lseek(fd, blocklength, SEEK_CUR); diff --git a/apps/codecs/libmad/bit.c b/apps/codecs/libmad/bit.c index f132347c25..f3cca84b2b 100644 --- a/apps/codecs/libmad/bit.c +++ b/apps/codecs/libmad/bit.c @@ -87,8 +87,8 @@ unsigned short const crc_table[256] = { #endif /* - * NAME: bit->init() - * DESCRIPTION: initialize bit pointer struct + * NAME: bit->init() + * DESCRIPTION: initialize bit pointer struct */ void mad_bit_init(struct mad_bitptr *bitptr, unsigned char const *byte) { @@ -97,11 +97,11 @@ void mad_bit_init(struct mad_bitptr *bitptr, unsigned char const *byte) } /* - * NAME: bit->length() - * DESCRIPTION: return number of bits between start and end points + * NAME: bit->length() + * DESCRIPTION: return number of bits between start and end points */ unsigned int mad_bit_length(struct mad_bitptr const *begin, - struct mad_bitptr const *end) + struct mad_bitptr const *end) { return end->readbit - begin->readbit; } @@ -111,8 +111,8 @@ unsigned char mad_bit_bitsleft(struct mad_bitptr const *bitptr) return 8 - (bitptr->readbit & 7); } /* - * NAME: bit->nextbyte() - * DESCRIPTION: return pointer to next unprocessed byte + * NAME: bit->nextbyte() + * DESCRIPTION: return pointer to next unprocessed byte */ unsigned char const *mad_bit_nextbyte(struct mad_bitptr const *bitptr) { @@ -120,8 +120,8 @@ unsigned char const *mad_bit_nextbyte(struct mad_bitptr const *bitptr) } /* - * NAME: bit->skip() - * DESCRIPTION: advance bit pointer + * NAME: bit->skip() + * DESCRIPTION: advance bit pointer */ void mad_bit_skip(struct mad_bitptr *bitptr, unsigned int len) { @@ -129,8 +129,8 @@ void mad_bit_skip(struct mad_bitptr *bitptr, unsigned int len) } /* - * NAME: bit->read() - * DESCRIPTION: read an arbitrary number of bits and return their UIMSBF value + * NAME: bit->read() + * DESCRIPTION: read an arbitrary number of bits and return their UIMSBF value */ uint32_t mad_bit_read(struct mad_bitptr *bitptr, unsigned int len) ICODE_ATTR; @@ -154,11 +154,11 @@ uint32_t mad_bit_read(struct mad_bitptr *bitptr, unsigned int len) # if 0 /* - * NAME: bit->write() - * DESCRIPTION: write an arbitrary number of bits + * NAME: bit->write() + * DESCRIPTION: write an arbitrary number of bits */ void mad_bit_write(struct mad_bitptr *bitptr, unsigned int len, - uint32_t value) + uint32_t value) { unsigned char *ptr; @@ -169,11 +169,11 @@ void mad_bit_write(struct mad_bitptr *bitptr, unsigned int len, # endif /* - * NAME: bit->crc() - * DESCRIPTION: compute CRC-check word + * NAME: bit->crc() + * DESCRIPTION: compute CRC-check word */ unsigned short mad_bit_crc(struct mad_bitptr bitptr, unsigned int len, - unsigned short init) + unsigned short init) { register unsigned int crc; @@ -190,11 +190,11 @@ unsigned short mad_bit_crc(struct mad_bitptr bitptr, unsigned int len, switch (len / 8) { case 3: crc = (crc << 8) ^ - crc_table[((crc >> 8) ^ mad_bit_read(&bitptr, 8)) & 0xff]; + crc_table[((crc >> 8) ^ mad_bit_read(&bitptr, 8)) & 0xff]; case 2: crc = (crc << 8) ^ - crc_table[((crc >> 8) ^ mad_bit_read(&bitptr, 8)) & 0xff]; + crc_table[((crc >> 8) ^ mad_bit_read(&bitptr, 8)) & 0xff]; case 1: crc = (crc << 8) ^ - crc_table[((crc >> 8) ^ mad_bit_read(&bitptr, 8)) & 0xff]; + crc_table[((crc >> 8) ^ mad_bit_read(&bitptr, 8)) & 0xff]; len %= 8; diff --git a/apps/codecs/libmad/bit.h b/apps/codecs/libmad/bit.h index 615cabee89..ad13373eee 100644 --- a/apps/codecs/libmad/bit.h +++ b/apps/codecs/libmad/bit.h @@ -29,10 +29,10 @@ struct mad_bitptr { void mad_bit_init(struct mad_bitptr *, unsigned char const *); -# define mad_bit_finish(bitptr) /* nothing */ +# define mad_bit_finish(bitptr) /* nothing */ unsigned int mad_bit_length(struct mad_bitptr const *, - struct mad_bitptr const *); + struct mad_bitptr const *); unsigned char mad_bit_bitsleft(struct mad_bitptr const *bitptr); unsigned char const *mad_bit_nextbyte(struct mad_bitptr const *); diff --git a/apps/codecs/libmad/decoder.c b/apps/codecs/libmad/decoder.c index fcbabce923..dfa45aaa34 100644 --- a/apps/codecs/libmad/decoder.c +++ b/apps/codecs/libmad/decoder.c @@ -51,25 +51,25 @@ # include "decoder.h" /* - * NAME: decoder->init() - * DESCRIPTION: initialize a decoder object with callback routines + * NAME: decoder->init() + * DESCRIPTION: initialize a decoder object with callback routines */ void mad_decoder_init(struct mad_decoder *decoder, void *data, - enum mad_flow (*input_func)(void *, - struct mad_stream *), - enum mad_flow (*header_func)(void *, - struct mad_header const *), - enum mad_flow (*filter_func)(void *, - struct mad_stream const *, - struct mad_frame *), - enum mad_flow (*output_func)(void *, - struct mad_header const *, - struct mad_pcm *), - enum mad_flow (*error_func)(void *, - struct mad_stream *, - struct mad_frame *), - enum mad_flow (*message_func)(void *, - void *, unsigned int *)) + enum mad_flow (*input_func)(void *, + struct mad_stream *), + enum mad_flow (*header_func)(void *, + struct mad_header const *), + enum mad_flow (*filter_func)(void *, + struct mad_stream const *, + struct mad_frame *), + enum mad_flow (*output_func)(void *, + struct mad_header const *, + struct mad_pcm *), + enum mad_flow (*error_func)(void *, + struct mad_stream *, + struct mad_frame *), + enum mad_flow (*message_func)(void *, + void *, unsigned int *)) { decoder->mode = -1; @@ -237,9 +237,9 @@ enum mad_flow receive(int fd, void **message, unsigned int *size) if (*size > 0) { if (*message == 0) { - *message = malloc(*size); - if (*message == 0) - return MAD_FLOW_BREAK; + *message = malloc(*size); + if (*message == 0) + return MAD_FLOW_BREAK; } result = receive_io_blocking(fd, *message, *size); @@ -278,8 +278,8 @@ enum mad_flow check_message(struct mad_decoder *decoder) result = decoder->message_func(decoder->cb_data, message, &size); if (result == MAD_FLOW_IGNORE || - result == MAD_FLOW_BREAK) - size = 0; + result == MAD_FLOW_BREAK) + size = 0; } if (send(decoder->async.out, message, size) != MAD_FLOW_CONTINUE) @@ -295,7 +295,7 @@ enum mad_flow check_message(struct mad_decoder *decoder) static enum mad_flow error_default(void *data, struct mad_stream *stream, - struct mad_frame *frame) + struct mad_frame *frame) { int *bad_last_frame = data; @@ -361,92 +361,92 @@ int run_sync(struct mad_decoder *decoder) while (1) { # if defined(USE_ASYNC) if (decoder->mode == MAD_DECODER_MODE_ASYNC) { - switch (check_message(decoder)) { - case MAD_FLOW_IGNORE: - case MAD_FLOW_CONTINUE: - break; - case MAD_FLOW_BREAK: - goto fail; - case MAD_FLOW_STOP: - goto done; - } + switch (check_message(decoder)) { + case MAD_FLOW_IGNORE: + case MAD_FLOW_CONTINUE: + break; + case MAD_FLOW_BREAK: + goto fail; + case MAD_FLOW_STOP: + goto done; + } } # endif if (decoder->header_func) { - if (mad_header_decode(&frame->header, stream) == -1) { - if (!MAD_RECOVERABLE(stream->error)) - break; - - switch (error_func(error_data, stream, frame)) { - case MAD_FLOW_STOP: - goto done; - case MAD_FLOW_BREAK: - goto fail; - case MAD_FLOW_IGNORE: - case MAD_FLOW_CONTINUE: - default: - continue; - } - } - - switch (decoder->header_func(decoder->cb_data, &frame->header)) { - case MAD_FLOW_STOP: - goto done; - case MAD_FLOW_BREAK: - goto fail; - case MAD_FLOW_IGNORE: - continue; - case MAD_FLOW_CONTINUE: - break; - } + if (mad_header_decode(&frame->header, stream) == -1) { + if (!MAD_RECOVERABLE(stream->error)) + break; + + switch (error_func(error_data, stream, frame)) { + case MAD_FLOW_STOP: + goto done; + case MAD_FLOW_BREAK: + goto fail; + case MAD_FLOW_IGNORE: + case MAD_FLOW_CONTINUE: + default: + continue; + } + } + + switch (decoder->header_func(decoder->cb_data, &frame->header)) { + case MAD_FLOW_STOP: + goto done; + case MAD_FLOW_BREAK: + goto fail; + case MAD_FLOW_IGNORE: + continue; + case MAD_FLOW_CONTINUE: + break; + } } if (mad_frame_decode(frame, stream) == -1) { - if (!MAD_RECOVERABLE(stream->error)) - break; - - switch (error_func(error_data, stream, frame)) { - case MAD_FLOW_STOP: - goto done; - case MAD_FLOW_BREAK: - goto fail; - case MAD_FLOW_IGNORE: - break; - case MAD_FLOW_CONTINUE: - default: - continue; - } + if (!MAD_RECOVERABLE(stream->error)) + break; + + switch (error_func(error_data, stream, frame)) { + case MAD_FLOW_STOP: + goto done; + case MAD_FLOW_BREAK: + goto fail; + case MAD_FLOW_IGNORE: + break; + case MAD_FLOW_CONTINUE: + default: + continue; + } } else - bad_last_frame = 0; + bad_last_frame = 0; if (decoder->filter_func) { - switch (decoder->filter_func(decoder->cb_data, stream, frame)) { - case MAD_FLOW_STOP: - goto done; - case MAD_FLOW_BREAK: - goto fail; - case MAD_FLOW_IGNORE: - continue; - case MAD_FLOW_CONTINUE: - break; - } + switch (decoder->filter_func(decoder->cb_data, stream, frame)) { + case MAD_FLOW_STOP: + goto done; + case MAD_FLOW_BREAK: + goto fail; + case MAD_FLOW_IGNORE: + continue; + case MAD_FLOW_CONTINUE: + break; + } } mad_synth_frame(synth, frame); if (decoder->output_func) { - switch (decoder->output_func(decoder->cb_data, - &frame->header, &synth->pcm)) { - case MAD_FLOW_STOP: - goto done; - case MAD_FLOW_BREAK: - goto fail; - case MAD_FLOW_IGNORE: - case MAD_FLOW_CONTINUE: - break; - } + switch (decoder->output_func(decoder->cb_data, + &frame->header, &synth->pcm)) { + case MAD_FLOW_STOP: + goto done; + case MAD_FLOW_BREAK: + goto fail; + case MAD_FLOW_IGNORE: + case MAD_FLOW_CONTINUE: + break; + } } } } @@ -528,8 +528,8 @@ int run_async(struct mad_decoder *decoder) # endif /* - * NAME: decoder->run() - * DESCRIPTION: run the decoder thread either synchronously or asynchronously + * NAME: decoder->run() + * DESCRIPTION: run the decoder thread either synchronously or asynchronously */ int mad_decoder_run(struct mad_decoder *decoder, enum mad_decoder_mode mode) { @@ -564,11 +564,11 @@ int mad_decoder_run(struct mad_decoder *decoder, enum mad_decoder_mode mode) } /* - * NAME: decoder->message() - * DESCRIPTION: send a message to and receive a reply from the decoder process + * NAME: decoder->message() + * DESCRIPTION: send a message to and receive a reply from the decoder process */ int mad_decoder_message(struct mad_decoder *decoder, - void *message, unsigned int *len) + void *message, unsigned int *len) { # if defined(USE_ASYNC) if (decoder->mode != MAD_DECODER_MODE_ASYNC || diff --git a/apps/codecs/libmad/decoder.h b/apps/codecs/libmad/decoder.h index 714e72c602..1f022154f2 100644 --- a/apps/codecs/libmad/decoder.h +++ b/apps/codecs/libmad/decoder.h @@ -32,10 +32,10 @@ enum mad_decoder_mode { }; enum mad_flow { - MAD_FLOW_CONTINUE = 0x0000, /* continue normally */ - MAD_FLOW_STOP = 0x0010, /* stop decoding normally */ - MAD_FLOW_BREAK = 0x0011, /* stop decoding and signal an error */ - MAD_FLOW_IGNORE = 0x0020 /* ignore the current frame */ + MAD_FLOW_CONTINUE = 0x0000, /* continue normally */ + MAD_FLOW_STOP = 0x0010, /* stop decoding normally */ + MAD_FLOW_BREAK = 0x0011, /* stop decoding and signal an error */ + MAD_FLOW_IGNORE = 0x0020 /* ignore the current frame */ }; struct mad_decoder { @@ -60,26 +60,26 @@ struct mad_decoder { enum mad_flow (*input_func)(void *, struct mad_stream *); enum mad_flow (*header_func)(void *, struct mad_header const *); enum mad_flow (*filter_func)(void *, - struct mad_stream const *, struct mad_frame *); + struct mad_stream const *, struct mad_frame *); enum mad_flow (*output_func)(void *, - struct mad_header const *, struct mad_pcm *); + struct mad_header const *, struct mad_pcm *); enum mad_flow (*error_func)(void *, struct mad_stream *, struct mad_frame *); enum mad_flow (*message_func)(void *, void *, unsigned int *); }; void mad_decoder_init(struct mad_decoder *, void *, - enum mad_flow (*)(void *, struct mad_stream *), - enum mad_flow (*)(void *, struct mad_header const *), - enum mad_flow (*)(void *, - struct mad_stream const *, - struct mad_frame *), - enum mad_flow (*)(void *, - struct mad_header const *, - struct mad_pcm *), - enum mad_flow (*)(void *, - struct mad_stream *, - struct mad_frame *), - enum mad_flow (*)(void *, void *, unsigned int *)); + enum mad_flow (*)(void *, struct mad_stream *), + enum mad_flow (*)(void *, struct mad_header const *), + enum mad_flow (*)(void *, + struct mad_stream const *, + struct mad_frame *), + enum mad_flow (*)(void *, + struct mad_header const *, + struct mad_pcm *), + enum mad_flow (*)(void *, + struct mad_stream *, + struct mad_frame *), + enum mad_flow (*)(void *, void *, unsigned int *)); int mad_decoder_finish(struct mad_decoder *); # define mad_decoder_options(decoder, opts) \ diff --git a/apps/codecs/libmad/fixed.c b/apps/codecs/libmad/fixed.c index d30f7a1219..f2f0a3ce4a 100644 --- a/apps/codecs/libmad/fixed.c +++ b/apps/codecs/libmad/fixed.c @@ -28,8 +28,8 @@ # include "fixed.h" /* - * NAME: fixed->abs() - * DESCRIPTION: return absolute value of a fixed-point number + * NAME: fixed->abs() + * DESCRIPTION: return absolute value of a fixed-point number */ mad_fixed_t mad_f_abs(mad_fixed_t x) { @@ -37,8 +37,8 @@ mad_fixed_t mad_f_abs(mad_fixed_t x) } /* - * NAME: fixed->div() - * DESCRIPTION: perform division using fixed-point math + * NAME: fixed->div() + * DESCRIPTION: perform division using fixed-point math */ mad_fixed_t mad_f_div(mad_fixed_t x, mad_fixed_t y) { diff --git a/apps/codecs/libmad/fixed.h b/apps/codecs/libmad/fixed.h index 7e580c4e8f..84bb5954e3 100644 --- a/apps/codecs/libmad/fixed.h +++ b/apps/codecs/libmad/fixed.h @@ -64,50 +64,50 @@ typedef mad_fixed_t mad_sample_t; * supported, and must be done with care. */ -# define MAD_F_FRACBITS 28 +# define MAD_F_FRACBITS 28 # if MAD_F_FRACBITS == 28 -# define MAD_F(x) ((mad_fixed_t) (x##L)) +# define MAD_F(x) ((mad_fixed_t) (x##L)) # else # if MAD_F_FRACBITS < 28 # warning "MAD_F_FRACBITS < 28" -# define MAD_F(x) ((mad_fixed_t) \ - (((x##L) + \ - (1L << (28 - MAD_F_FRACBITS - 1))) >> \ - (28 - MAD_F_FRACBITS))) +# define MAD_F(x) ((mad_fixed_t) \ + (((x##L) + \ + (1L << (28 - MAD_F_FRACBITS - 1))) >> \ + (28 - MAD_F_FRACBITS))) # elif MAD_F_FRACBITS > 28 # error "MAD_F_FRACBITS > 28 not currently supported" -# define MAD_F(x) ((mad_fixed_t) \ - ((x##L) << (MAD_F_FRACBITS - 28))) +# define MAD_F(x) ((mad_fixed_t) \ + ((x##L) << (MAD_F_FRACBITS - 28))) # endif # endif -# define MAD_F_MIN ((mad_fixed_t) -0x80000000L) -# define MAD_F_MAX ((mad_fixed_t) +0x7fffffffL) +# define MAD_F_MIN ((mad_fixed_t) -0x80000000L) +# define MAD_F_MAX ((mad_fixed_t) +0x7fffffffL) -# define MAD_F_ONE MAD_F(0x10000000) +# define MAD_F_ONE MAD_F(0x10000000) -# define mad_f_tofixed(x) ((mad_fixed_t) \ - ((x) * (double) (1L << MAD_F_FRACBITS) + 0.5)) -# define mad_f_todouble(x) ((double) \ - ((x) / (double) (1L << MAD_F_FRACBITS))) +# define mad_f_tofixed(x) ((mad_fixed_t) \ + ((x) * (double) (1L << MAD_F_FRACBITS) + 0.5)) +# define mad_f_todouble(x) ((double) \ + ((x) / (double) (1L << MAD_F_FRACBITS))) -# define mad_f_intpart(x) ((x) >> MAD_F_FRACBITS) -# define mad_f_fracpart(x) ((x) & ((1L << MAD_F_FRACBITS) - 1)) - /* (x should be positive) */ +# define mad_f_intpart(x) ((x) >> MAD_F_FRACBITS) +# define mad_f_fracpart(x) ((x) & ((1L << MAD_F_FRACBITS) - 1)) + /* (x should be positive) */ -# define mad_f_fromint(x) ((x) << MAD_F_FRACBITS) +# define mad_f_fromint(x) ((x) << MAD_F_FRACBITS) -# define mad_f_add(x, y) ((x) + (y)) -# define mad_f_sub(x, y) ((x) - (y)) +# define mad_f_add(x, y) ((x) + (y)) +# define mad_f_sub(x, y) ((x) - (y)) # if defined(FPM_FLOAT) # error "FPM_FLOAT not yet supported" # undef MAD_F -# define MAD_F(x) mad_f_todouble(x) +# define MAD_F(x) mad_f_todouble(x) -# define mad_f_mul(x, y) ((x) * (y)) +# define mad_f_mul(x, y) ((x) * (y)) # define mad_f_scale64 # undef ASO_ZEROCHECK @@ -154,7 +154,7 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) } # pragma warning(pop) -# define mad_f_mul mad_f_mul_inline +# define mad_f_mul mad_f_mul_inline # define mad_f_scale64 # else /* @@ -163,9 +163,9 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) */ # define MAD_F_MLX(hi, lo, x, y) \ asm ("imull %3" \ - : "=a" (lo), "=d" (hi) \ - : "%a" (x), "rm" (y) \ - : "cc") + : "=a" (lo), "=d" (hi) \ + : "%a" (x), "rm" (y) \ + : "cc") # if defined(OPT_ACCURACY) /* @@ -176,10 +176,10 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) mad_fixed64lo_t __lo; \ MAD_F_MLX(__hi, __lo, (x), (y)); \ asm ("addl %2,%0\n\t" \ - "adcl %3,%1" \ - : "=rm" (lo), "=rm" (hi) \ - : "r" (__lo), "r" (__hi), "0" (lo), "1" (hi) \ - : "cc"); \ + "adcl %3,%1" \ + : "=rm" (lo), "=rm" (hi) \ + : "r" (__lo), "r" (__hi), "0" (lo), "1" (hi) \ + : "cc"); \ }) # endif /* OPT_ACCURACY */ @@ -192,15 +192,15 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) mad_fixed64lo_t __lo_; \ mad_fixed_t __result; \ asm ("addl %4,%2\n\t" \ - "adcl %5,%3" \ - : "=rm" (__lo_), "=rm" (__hi_) \ - : "0" (lo), "1" (hi), \ - "ir" (1L << (MAD_F_SCALEBITS - 1)), "ir" (0) \ - : "cc"); \ + "adcl %5,%3" \ + : "=rm" (__lo_), "=rm" (__hi_) \ + : "0" (lo), "1" (hi), \ + "ir" (1L << (MAD_F_SCALEBITS - 1)), "ir" (0) \ + : "cc"); \ asm ("shrdl %3,%2,%1" \ - : "=rm" (__result) \ - : "0" (__lo_), "r" (__hi_), "I" (MAD_F_SCALEBITS) \ - : "cc"); \ + : "=rm" (__result) \ + : "0" (__lo_), "r" (__hi_), "I" (MAD_F_SCALEBITS) \ + : "cc"); \ __result; \ }) # elif defined(OPT_INTEL) @@ -210,21 +210,21 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) # define mad_f_scale64(hi, lo) \ ({ mad_fixed_t __result; \ asm ("shrl %3,%1\n\t" \ - "shll %4,%2\n\t" \ - "orl %2,%1" \ - : "=rm" (__result) \ - : "0" (lo), "r" (hi), \ - "I" (MAD_F_SCALEBITS), "I" (32 - MAD_F_SCALEBITS) \ - : "cc"); \ + "shll %4,%2\n\t" \ + "orl %2,%1" \ + : "=rm" (__result) \ + : "0" (lo), "r" (hi), \ + "I" (MAD_F_SCALEBITS), "I" (32 - MAD_F_SCALEBITS) \ + : "cc"); \ __result; \ }) # else # define mad_f_scale64(hi, lo) \ ({ mad_fixed_t __result; \ asm ("shrdl %3,%2,%1" \ - : "=rm" (__result) \ - : "0" (lo), "r" (hi), "I" (MAD_F_SCALEBITS) \ - : "cc"); \ + : "=rm" (__result) \ + : "0" (lo), "r" (hi), "I" (MAD_F_SCALEBITS) \ + : "cc"); \ __result; \ }) # endif /* OPT_ACCURACY */ @@ -249,42 +249,42 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) ({ mad_fixed64hi_t __hi; \ mad_fixed64lo_t __lo; \ mad_fixed_t __result; \ - asm ("smull %0, %1, %3, %4\n\t" \ - "movs %0, %0, lsr %5\n\t" \ - "adc %2, %0, %1, lsl %6" \ - : "=&r" (__lo), "=&r" (__hi), "=r" (__result) \ - : "%r" (x), "r" (y), \ - "M" (MAD_F_SCALEBITS), "M" (32 - MAD_F_SCALEBITS) \ - : "cc"); \ + asm ("smull %0, %1, %3, %4\n\t" \ + "movs %0, %0, lsr %5\n\t" \ + "adc %2, %0, %1, lsl %6" \ + : "=&r" (__lo), "=&r" (__hi), "=r" (__result) \ + : "%r" (x), "r" (y), \ + "M" (MAD_F_SCALEBITS), "M" (32 - MAD_F_SCALEBITS) \ + : "cc"); \ __result; \ }) # endif # define MAD_F_MLX(hi, lo, x, y) \ - asm ("smull %0, %1, %2, %3" \ - : "=&r" (lo), "=&r" (hi) \ - : "%r" (x), "r" (y)) + asm ("smull %0, %1, %2, %3" \ + : "=&r" (lo), "=&r" (hi) \ + : "%r" (x), "r" (y)) # define MAD_F_MLA(hi, lo, x, y) \ - asm ("smlal %0, %1, %2, %3" \ - : "+r" (lo), "+r" (hi) \ - : "%r" (x), "r" (y)) + asm ("smlal %0, %1, %2, %3" \ + : "+r" (lo), "+r" (hi) \ + : "%r" (x), "r" (y)) # define MAD_F_MLN(hi, lo) \ - asm ("rsbs %0, %2, #0\n\t" \ - "rsc %1, %3, #0" \ - : "=r" (lo), "=r" (hi) \ - : "0" (lo), "1" (hi) \ - : "cc") + asm ("rsbs %0, %2, #0\n\t" \ + "rsc %1, %3, #0" \ + : "=r" (lo), "=r" (hi) \ + : "0" (lo), "1" (hi) \ + : "cc") # define mad_f_scale64(hi, lo) \ ({ mad_fixed_t __result; \ - asm ("movs %0, %1, lsr %3\n\t" \ - "adc %0, %0, %2, lsl %4" \ - : "=&r" (__result) \ - : "r" (lo), "r" (hi), \ - "M" (MAD_F_SCALEBITS), "M" (32 - MAD_F_SCALEBITS) \ - : "cc"); \ + asm ("movs %0, %1, lsr %3\n\t" \ + "adc %0, %0, %2, lsl %4" \ + : "=&r" (__result) \ + : "r" (lo), "r" (hi), \ + "M" (MAD_F_SCALEBITS), "M" (32 - MAD_F_SCALEBITS) \ + : "cc"); \ __result; \ }) @@ -299,28 +299,28 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) * significant bit depends on OPT_ACCURACY via mad_f_scale64(). */ # define MAD_F_MLX(hi, lo, x, y) \ - asm ("mult %2,%3" \ - : "=l" (lo), "=h" (hi) \ - : "%r" (x), "r" (y)) + asm ("mult %2,%3" \ + : "=l" (lo), "=h" (hi) \ + : "%r" (x), "r" (y)) # if defined(HAVE_MADD_ASM) # define MAD_F_MLA(hi, lo, x, y) \ - asm ("madd %2,%3" \ - : "+l" (lo), "+h" (hi) \ - : "%r" (x), "r" (y)) + asm ("madd %2,%3" \ + : "+l" (lo), "+h" (hi) \ + : "%r" (x), "r" (y)) # elif defined(HAVE_MADD16_ASM) /* * This loses significant accuracy due to the 16-bit integer limit in the * multiply/accumulate instruction. */ # define MAD_F_ML0(hi, lo, x, y) \ - asm ("mult %2,%3" \ - : "=l" (lo), "=h" (hi) \ - : "%r" ((x) >> 12), "r" ((y) >> 16)) + asm ("mult %2,%3" \ + : "=l" (lo), "=h" (hi) \ + : "%r" ((x) >> 12), "r" ((y) >> 16)) # define MAD_F_MLA(hi, lo, x, y) \ - asm ("madd16 %2,%3" \ - : "+l" (lo), "+h" (hi) \ - : "%r" ((x) >> 12), "r" ((y) >> 16)) + asm ("madd16 %2,%3" \ + : "+l" (lo), "+h" (hi) \ + : "%r" ((x) >> 12), "r" ((y) >> 16)) # define MAD_F_MLZ(hi, lo) ((mad_fixed_t) (lo)) # endif @@ -340,9 +340,9 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) */ # define MAD_F_MLX(hi, lo, x, y) \ asm ("smul %2, %3, %0\n\t" \ - "rd %%y, %1" \ - : "=r" (lo), "=r" (hi) \ - : "%r" (x), "rI" (y)) + "rd %%y, %1" \ + : "=r" (lo), "=r" (hi) \ + : "%r" (x), "rI" (y)) /* --- PowerPC ------------------------------------------------------------- */ @@ -355,11 +355,11 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) # define MAD_F_MLX(hi, lo, x, y) \ do { \ asm ("mullw %0,%1,%2" \ - : "=r" (lo) \ - : "%r" (x), "r" (y)); \ + : "=r" (lo) \ + : "%r" (x), "r" (y)); \ asm ("mulhw %0,%1,%2" \ - : "=r" (hi) \ - : "%r" (x), "r" (y)); \ + : "=r" (hi) \ + : "%r" (x), "r" (y)); \ } \ while (0) @@ -372,11 +372,11 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) mad_fixed64lo_t __lo; \ MAD_F_MLX(__hi, __lo, (x), (y)); \ asm ("addc %0,%2,%3\n\t" \ - "adde %1,%4,%5" \ - : "=r" (lo), "=r" (hi) \ - : "%r" (lo), "r" (__lo), \ - "%r" (hi), "r" (__hi) \ - : "xer"); \ + "adde %1,%4,%5" \ + : "=r" (lo), "=r" (hi) \ + : "%r" (lo), "r" (__lo), \ + "%r" (hi), "r" (__hi) \ + : "xer"); \ }) # endif @@ -387,28 +387,28 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) # define mad_f_scale64(hi, lo) \ ({ mad_fixed_t __result, __round; \ asm ("rotrwi %0,%1,%2" \ - : "=r" (__result) \ - : "r" (lo), "i" (MAD_F_SCALEBITS)); \ + : "=r" (__result) \ + : "r" (lo), "i" (MAD_F_SCALEBITS)); \ asm ("extrwi %0,%1,1,0" \ - : "=r" (__round) \ - : "r" (__result)); \ + : "=r" (__round) \ + : "r" (__result)); \ asm ("insrwi %0,%1,%2,0" \ - : "+r" (__result) \ - : "r" (hi), "i" (MAD_F_SCALEBITS)); \ + : "+r" (__result) \ + : "r" (hi), "i" (MAD_F_SCALEBITS)); \ asm ("add %0,%1,%2" \ - : "=r" (__result) \ - : "%r" (__result), "r" (__round)); \ + : "=r" (__result) \ + : "%r" (__result), "r" (__round)); \ __result; \ }) # else # define mad_f_scale64(hi, lo) \ ({ mad_fixed_t __result; \ asm ("rotrwi %0,%1,%2" \ - : "=r" (__result) \ - : "r" (lo), "i" (MAD_F_SCALEBITS)); \ + : "=r" (__result) \ + : "r" (lo), "i" (MAD_F_SCALEBITS)); \ asm ("insrwi %0,%1,%2,0" \ - : "+r" (__result) \ - : "r" (hi), "i" (MAD_F_SCALEBITS)); \ + : "+r" (__result) \ + : "r" (hi), "i" (MAD_F_SCALEBITS)); \ __result; \ }) # endif @@ -452,10 +452,10 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) * Pre-rounding is required to stay within the limits of compliance. */ # if defined(OPT_SPEED) -# define mad_f_mul(x, y) (((x) >> 12) * ((y) >> 16)) +# define mad_f_mul(x, y) (((x) >> 12) * ((y) >> 16)) # else -# define mad_f_mul(x, y) ((((x) + (1L << 11)) >> 12) * \ - (((y) + (1L << 15)) >> 16)) +# define mad_f_mul(x, y) ((((x) + (1L << 11)) >> 12) * \ + (((y) + (1L << 15)) >> 16)) # endif /* ------------------------------------------------------------------------- */ @@ -476,22 +476,22 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) # endif # if !defined(MAD_F_MLA) -# define MAD_F_ML0(hi, lo, x, y) ((lo) = mad_f_mul((x), (y))) -# define MAD_F_MLA(hi, lo, x, y) ((lo) += mad_f_mul((x), (y))) -# define MAD_F_MLN(hi, lo) ((lo) = -(lo)) -# define MAD_F_MLZ(hi, lo) ((void) (hi), (mad_fixed_t) (lo)) +# define MAD_F_ML0(hi, lo, x, y) ((lo) = mad_f_mul((x), (y))) +# define MAD_F_MLA(hi, lo, x, y) ((lo) += mad_f_mul((x), (y))) +# define MAD_F_MLN(hi, lo) ((lo) = -(lo)) +# define MAD_F_MLZ(hi, lo) ((void) (hi), (mad_fixed_t) (lo)) # endif # if !defined(MAD_F_ML0) -# define MAD_F_ML0(hi, lo, x, y) MAD_F_MLX((hi), (lo), (x), (y)) +# define MAD_F_ML0(hi, lo, x, y) MAD_F_MLX((hi), (lo), (x), (y)) # endif # if !defined(MAD_F_MLN) -# define MAD_F_MLN(hi, lo) ((hi) = ((lo) = -(lo)) ? ~(hi) : -(hi)) +# define MAD_F_MLN(hi, lo) ((hi) = ((lo) = -(lo)) ? ~(hi) : -(hi)) # endif # if !defined(MAD_F_MLZ) -# define MAD_F_MLZ(hi, lo) mad_f_scale64((hi), (lo)) +# define MAD_F_MLZ(hi, lo) mad_f_scale64((hi), (lo)) # endif # if !defined(mad_f_scale64) @@ -499,7 +499,7 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) # define mad_f_scale64(hi, lo) \ ((((mad_fixed_t) \ (((hi) << (32 - (MAD_F_SCALEBITS - 1))) | \ - ((lo) >> (MAD_F_SCALEBITS - 1)))) + 1) >> 1) + ((lo) >> (MAD_F_SCALEBITS - 1)))) + 1) >> 1) # else # define mad_f_scale64(hi, lo) \ ((mad_fixed_t) \ diff --git a/apps/codecs/libmad/frame.c b/apps/codecs/libmad/frame.c index 3fb971d3e1..85c2a201f7 100644 --- a/apps/codecs/libmad/frame.c +++ b/apps/codecs/libmad/frame.c @@ -61,8 +61,8 @@ int (*const decoder_table[3])(struct mad_stream *, struct mad_frame *) = { }; /* - * NAME: header->init() - * DESCRIPTION: initialize header struct + * NAME: header->init() + * DESCRIPTION: initialize header struct */ void mad_header_init(struct mad_header *header) { @@ -84,8 +84,8 @@ void mad_header_init(struct mad_header *header) } /* - * NAME: frame->init() - * DESCRIPTION: initialize frame struct + * NAME: frame->init() + * DESCRIPTION: initialize frame struct */ void mad_frame_init(struct mad_frame *frame) { @@ -98,8 +98,8 @@ void mad_frame_init(struct mad_frame *frame) } /* - * NAME: frame->finish() - * DESCRIPTION: deallocate any dynamic memory associated with frame + * NAME: frame->finish() + * DESCRIPTION: deallocate any dynamic memory associated with frame */ void mad_frame_finish(struct mad_frame *frame) { @@ -112,8 +112,8 @@ void mad_frame_finish(struct mad_frame *frame) } /* - * NAME: decode_header() - * DESCRIPTION: read header data and following CRC word + * NAME: decode_header() + * DESCRIPTION: read header data and following CRC word */ static int decode_header(struct mad_header *header, struct mad_stream *stream) @@ -231,8 +231,8 @@ int decode_header(struct mad_header *header, struct mad_stream *stream) } /* - * NAME: free_bitrate() - * DESCRIPTION: attempt to discover the bitstream's free bitrate + * NAME: free_bitrate() + * DESCRIPTION: attempt to discover the bitstream's free bitrate */ static int free_bitrate(struct mad_stream *stream, struct mad_header const *header) @@ -246,7 +246,7 @@ int free_bitrate(struct mad_stream *stream, struct mad_header const *header) pad_slot = (header->flags & MAD_FLAG_PADDING) ? 1 : 0; slots_per_frame = (header->layer == MAD_LAYER_III && - (header->flags & MAD_FLAG_LSF_EXT)) ? 72 : 144; + (header->flags & MAD_FLAG_LSF_EXT)) ? 72 : 144; while (mad_stream_sync(stream) == 0) { struct mad_stream peek_stream; @@ -256,8 +256,8 @@ int free_bitrate(struct mad_stream *stream, struct mad_header const *header) peek_header = *header; if (decode_header(&peek_header, &peek_stream) == 0 && - peek_header.layer == header->layer && - peek_header.samplerate == header->samplerate) { + peek_header.layer == header->layer && + peek_header.samplerate == header->samplerate) { unsigned int N; ptr = mad_bit_nextbyte(&stream->ptr); @@ -265,16 +265,16 @@ int free_bitrate(struct mad_stream *stream, struct mad_header const *header) N = ptr - stream->this_frame; if (header->layer == MAD_LAYER_I) { - rate = (unsigned long) header->samplerate * - (N - 4 * pad_slot + 4) / 48 / 1000; + rate = (unsigned long) header->samplerate * + (N - 4 * pad_slot + 4) / 48 / 1000; } else { - rate = (unsigned long) header->samplerate * - (N - pad_slot + 1) / slots_per_frame / 1000; + rate = (unsigned long) header->samplerate * + (N - pad_slot + 1) / slots_per_frame / 1000; } if (rate >= 8) - break; + break; } mad_bit_skip(&stream->ptr, 8); @@ -293,8 +293,8 @@ int free_bitrate(struct mad_stream *stream, struct mad_header const *header) } /* - * NAME: header->decode() - * DESCRIPTION: read the next frame header from the stream + * NAME: header->decode() + * DESCRIPTION: read the next frame header from the stream */ int mad_header_decode(struct mad_header *header, struct mad_stream *stream) { @@ -351,7 +351,7 @@ int mad_header_decode(struct mad_header *header, struct mad_stream *stream) if (mad_stream_sync(stream) == -1) { if (end - stream->next_frame >= MAD_BUFFER_GUARD) - stream->next_frame = end - MAD_BUFFER_GUARD; + stream->next_frame = end - MAD_BUFFER_GUARD; stream->error = MAD_ERROR_BUFLEN; goto fail; @@ -371,13 +371,13 @@ int mad_header_decode(struct mad_header *header, struct mad_stream *stream) /* calculate frame duration */ mad_timer_set(&header->duration, 0, - 32 * MAD_NSBSAMPLES(header), header->samplerate); + 32 * MAD_NSBSAMPLES(header), header->samplerate); /* calculate free bit rate */ if (header->bitrate == 0) { if ((stream->freerate == 0 || !stream->sync || - (header->layer == MAD_LAYER_III && stream->freerate > 640000)) && - free_bitrate(stream, header) == -1) + (header->layer == MAD_LAYER_III && stream->freerate > 640000)) && + free_bitrate(stream, header) == -1) goto fail; header->bitrate = stream->freerate; @@ -393,7 +393,7 @@ int mad_header_decode(struct mad_header *header, struct mad_stream *stream) unsigned int slots_per_frame; slots_per_frame = (header->layer == MAD_LAYER_III && - (header->flags & MAD_FLAG_LSF_EXT)) ? 72 : 144; + (header->flags & MAD_FLAG_LSF_EXT)) ? 72 : 144; N = (slots_per_frame * header->bitrate / header->samplerate) + pad_slot; } @@ -431,8 +431,8 @@ int mad_header_decode(struct mad_header *header, struct mad_stream *stream) } /* - * NAME: frame->decode() - * DESCRIPTION: decode a single frame from a bitstream + * NAME: frame->decode() + * DESCRIPTION: decode a single frame from a bitstream */ int mad_frame_decode(struct mad_frame *frame, struct mad_stream *stream) { @@ -479,8 +479,8 @@ int mad_frame_decode(struct mad_frame *frame, struct mad_stream *stream) } /* - * NAME: frame->mute() - * DESCRIPTION: zero all subband values so the frame becomes silent + * NAME: frame->mute() + * DESCRIPTION: zero all subband values so the frame becomes silent */ void mad_frame_mute(struct mad_frame *frame) { @@ -496,8 +496,8 @@ void mad_frame_mute(struct mad_frame *frame) if (frame->overlap) { for (s = 0; s < 18; ++s) { for (sb = 0; sb < 32; ++sb) { - (*frame->overlap)[0][sb][s] = - (*frame->overlap)[1][sb][s] = 0; + (*frame->overlap)[0][sb][s] = + (*frame->overlap)[1][sb][s] = 0; } } } diff --git a/apps/codecs/libmad/frame.h b/apps/codecs/libmad/frame.h index d2d6dca3ef..4d23107d76 100644 --- a/apps/codecs/libmad/frame.h +++ b/apps/codecs/libmad/frame.h @@ -27,41 +27,41 @@ # include "stream.h" enum mad_layer { - MAD_LAYER_I = 1, /* Layer I */ - MAD_LAYER_II = 2, /* Layer II */ - MAD_LAYER_III = 3 /* Layer III */ + MAD_LAYER_I = 1, /* Layer I */ + MAD_LAYER_II = 2, /* Layer II */ + MAD_LAYER_III = 3 /* Layer III */ }; enum mad_mode { - MAD_MODE_SINGLE_CHANNEL = 0, /* single channel */ - MAD_MODE_DUAL_CHANNEL = 1, /* dual channel */ - MAD_MODE_JOINT_STEREO = 2, /* joint (MS/intensity) stereo */ - MAD_MODE_STEREO = 3 /* normal LR stereo */ + MAD_MODE_SINGLE_CHANNEL = 0, /* single channel */ + MAD_MODE_DUAL_CHANNEL = 1, /* dual channel */ + MAD_MODE_JOINT_STEREO = 2, /* joint (MS/intensity) stereo */ + MAD_MODE_STEREO = 3 /* normal LR stereo */ }; enum mad_emphasis { - MAD_EMPHASIS_NONE = 0, /* no emphasis */ - MAD_EMPHASIS_50_15_US = 1, /* 50/15 microseconds emphasis */ - MAD_EMPHASIS_CCITT_J_17 = 3, /* CCITT J.17 emphasis */ - MAD_EMPHASIS_RESERVED = 2 /* unknown emphasis */ + MAD_EMPHASIS_NONE = 0, /* no emphasis */ + MAD_EMPHASIS_50_15_US = 1, /* 50/15 microseconds emphasis */ + MAD_EMPHASIS_CCITT_J_17 = 3, /* CCITT J.17 emphasis */ + MAD_EMPHASIS_RESERVED = 2 /* unknown emphasis */ }; struct mad_header { - enum mad_layer layer; /* audio layer (1, 2, or 3) */ - enum mad_mode mode; /* channel mode (see above) */ - int mode_extension; /* additional mode info */ - enum mad_emphasis emphasis; /* de-emphasis to use (see above) */ + enum mad_layer layer; /* audio layer (1, 2, or 3) */ + enum mad_mode mode; /* channel mode (see above) */ + int mode_extension; /* additional mode info */ + enum mad_emphasis emphasis; /* de-emphasis to use (see above) */ - unsigned long bitrate; /* stream bitrate (bps) */ - unsigned int samplerate; /* sampling frequency (Hz) */ + unsigned long bitrate; /* stream bitrate (bps) */ + unsigned int samplerate; /* sampling frequency (Hz) */ - unsigned short crc_check; /* frame CRC accumulator */ - unsigned short crc_target; /* final target CRC checksum */ + unsigned short crc_check; /* frame CRC accumulator */ + unsigned short crc_target; /* final target CRC checksum */ - int flags; /* flags (see below) */ - int private_bits; /* private bits (see below) */ + int flags; /* flags (see below) */ + int private_bits; /* private bits (see below) */ - mad_timer_t duration; /* audio playing time of frame */ + mad_timer_t duration; /* audio playing time of frame */ }; struct mad_frame { @@ -76,33 +76,33 @@ struct mad_frame { mad_fixed_t (*overlap)[2][32][18]; /* Layer III block overlap data */ }; -# define MAD_NCHANNELS(header) ((header)->mode ? 2 : 1) +# define MAD_NCHANNELS(header) ((header)->mode ? 2 : 1) # define MAD_NSBSAMPLES(header) \ ((header)->layer == MAD_LAYER_I ? 12 : \ (((header)->layer == MAD_LAYER_III && \ ((header)->flags & MAD_FLAG_LSF_EXT)) ? 18 : 36)) enum { - MAD_FLAG_NPRIVATE_III = 0x0007, /* number of Layer III private bits */ - MAD_FLAG_INCOMPLETE = 0x0008, /* header but not data is decoded */ + MAD_FLAG_NPRIVATE_III = 0x0007, /* number of Layer III private bits */ + MAD_FLAG_INCOMPLETE = 0x0008, /* header but not data is decoded */ - MAD_FLAG_PROTECTION = 0x0010, /* frame has CRC protection */ - MAD_FLAG_COPYRIGHT = 0x0020, /* frame is copyright */ - MAD_FLAG_ORIGINAL = 0x0040, /* frame is original (else copy) */ - MAD_FLAG_PADDING = 0x0080, /* frame has additional slot */ + MAD_FLAG_PROTECTION = 0x0010, /* frame has CRC protection */ + MAD_FLAG_COPYRIGHT = 0x0020, /* frame is copyright */ + MAD_FLAG_ORIGINAL = 0x0040, /* frame is original (else copy) */ + MAD_FLAG_PADDING = 0x0080, /* frame has additional slot */ - MAD_FLAG_I_STEREO = 0x0100, /* uses intensity joint stereo */ - MAD_FLAG_MS_STEREO = 0x0200, /* uses middle/side joint stereo */ - MAD_FLAG_FREEFORMAT = 0x0400, /* uses free format bitrate */ + MAD_FLAG_I_STEREO = 0x0100, /* uses intensity joint stereo */ + MAD_FLAG_MS_STEREO = 0x0200, /* uses middle/side joint stereo */ + MAD_FLAG_FREEFORMAT = 0x0400, /* uses free format bitrate */ - MAD_FLAG_LSF_EXT = 0x1000, /* lower sampling freq. extension */ - MAD_FLAG_MC_EXT = 0x2000, /* multichannel audio extension */ - MAD_FLAG_MPEG_2_5_EXT = 0x4000 /* MPEG 2.5 (unofficial) extension */ + MAD_FLAG_LSF_EXT = 0x1000, /* lower sampling freq. extension */ + MAD_FLAG_MC_EXT = 0x2000, /* multichannel audio extension */ + MAD_FLAG_MPEG_2_5_EXT = 0x4000 /* MPEG 2.5 (unofficial) extension */ }; enum { - MAD_PRIVATE_HEADER = 0x0100, /* header private bit */ - MAD_PRIVATE_III = 0x001f /* Layer III private bits (up to 5) */ + MAD_PRIVATE_HEADER = 0x0100, /* header private bit */ + MAD_PRIVATE_III = 0x001f /* Layer III private bits (up to 5) */ }; void mad_header_init(struct mad_header *); diff --git a/apps/codecs/libmad/global.h b/apps/codecs/libmad/global.h index 22e8546fa6..96bd3eb71e 100644 --- a/apps/codecs/libmad/global.h +++ b/apps/codecs/libmad/global.h @@ -64,9 +64,9 @@ # if !defined(HAVE_ASSERT_H) # if defined(NDEBUG) -# define assert(x) /* nothing */ +# define assert(x) /* nothing */ # else -# define assert(x) do { if (!(x)) abort(); } while (0) +# define assert(x) do { if (!(x)) abort(); } while (0) # endif # endif diff --git a/apps/codecs/libmad/huffman.c b/apps/codecs/libmad/huffman.c index 43216d3680..db788e71b4 100644 --- a/apps/codecs/libmad/huffman.c +++ b/apps/codecs/libmad/huffman.c @@ -36,15 +36,15 @@ # if defined(__GNUC__) || \ (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901) -# define PTR(offs, bits) { .ptr = { 0, bits, offs } } -# define V(v, w, x, y, hlen) { .value = { 1, hlen, v, w, x, y } } +# define PTR(offs, bits) { .ptr = { 0, bits, offs } } +# define V(v, w, x, y, hlen) { .value = { 1, hlen, v, w, x, y } } # else -# define PTR(offs, bits) { { 0, bits, offs } } +# define PTR(offs, bits) { { 0, bits, offs } } # if defined(WORDS_BIGENDIAN) -# define V(v, w, x, y, hlen) { { 1, hlen, (v << 11) | (w << 10) | \ +# define V(v, w, x, y, hlen) { { 1, hlen, (v << 11) | (w << 10) | \ (x << 9) | (y << 8) } } # else -# define V(v, w, x, y, hlen) { { 1, hlen, (v << 0) | (w << 1) | \ +# define V(v, w, x, y, hlen) { { 1, hlen, (v << 0) | (w << 1) | \ (x << 2) | (y << 3) } } # endif # endif @@ -69,23 +69,23 @@ union huffquad const hufftabA[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(0, 0, 0, 0, 1), /* 0000 ... */ - /* 00 */ V(1, 0, 1, 1, 2), /* 16 */ + /* 00 */ V(1, 0, 1, 1, 2), /* 16 */ /* 01 */ V(1, 1, 1, 1, 2), /* 10 */ V(1, 1, 0, 1, 2), /* 11 */ V(1, 1, 1, 0, 2), /* 0001 ... */ - /* 00 */ V(0, 1, 1, 1, 2), /* 20 */ + /* 00 */ V(0, 1, 1, 1, 2), /* 20 */ /* 01 */ V(0, 1, 0, 1, 2), /* 10 */ V(1, 0, 0, 1, 1), /* 11 */ V(1, 0, 0, 1, 1), /* 0010 ... */ - /* 0 */ V(0, 1, 1, 0, 1), /* 24 */ + /* 0 */ V(0, 1, 1, 0, 1), /* 24 */ /* 1 */ V(0, 0, 1, 1, 1), /* 0011 ... */ - /* 0 */ V(1, 0, 1, 0, 1), /* 26 */ + /* 0 */ V(1, 0, 1, 0, 1), /* 26 */ /* 1 */ V(1, 1, 0, 0, 1) }; @@ -114,14 +114,14 @@ union huffquad const hufftabB[] ICONST_ATTR_MPA_HUFFMAN = { # if defined(__GNUC__) || \ (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901) -# define PTR(offs, bits) { .ptr = { 0, bits, offs } } -# define V(x, y, hlen) { .value = { 1, hlen, x, y } } +# define PTR(offs, bits) { .ptr = { 0, bits, offs } } +# define V(x, y, hlen) { .value = { 1, hlen, x, y } } # else -# define PTR(offs, bits) { { 0, bits, offs } } +# define PTR(offs, bits) { { 0, bits, offs } } # if defined(WORDS_BIGENDIAN) -# define V(x, y, hlen) { { 1, hlen, (x << 8) | (y << 4) } } +# define V(x, y, hlen) { { 1, hlen, (x << 8) | (y << 4) } } # else -# define V(x, y, hlen) { { 1, hlen, (x << 0) | (y << 4) } } +# define V(x, y, hlen) { { 1, hlen, (x << 0) | (y << 4) } } # endif # endif @@ -154,7 +154,7 @@ union huffpair const hufftab2[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(0, 0, 1), /* 000 ... */ - /* 000 */ V(2, 2, 3), /* 8 */ + /* 000 */ V(2, 2, 3), /* 8 */ /* 001 */ V(0, 2, 3), /* 010 */ V(1, 2, 2), /* 011 */ V(1, 2, 2), @@ -176,7 +176,7 @@ union huffpair const hufftab3[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(0, 0, 2), /* 000 ... */ - /* 000 */ V(2, 2, 3), /* 8 */ + /* 000 */ V(2, 2, 3), /* 8 */ /* 001 */ V(0, 2, 3), /* 010 */ V(1, 2, 2), /* 011 */ V(1, 2, 2), @@ -198,7 +198,7 @@ union huffpair const hufftab5[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(0, 0, 1), /* 000 ... */ - /* 0000 */ PTR(24, 1), /* 8 */ + /* 0000 */ PTR(24, 1), /* 8 */ /* 0001 */ V(3, 2, 4), /* 0010 */ V(3, 1, 3), /* 0011 */ V(3, 1, 3), @@ -216,7 +216,7 @@ union huffpair const hufftab5[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(2, 0, 3), /* 000 0000 ... */ - /* 0 */ V(3, 3, 1), /* 24 */ + /* 0 */ V(3, 3, 1), /* 24 */ /* 1 */ V(2, 3, 1) }; @@ -240,7 +240,7 @@ union huffpair const hufftab6[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(0, 0, 3), /* 0000 ... */ - /* 000 */ V(3, 3, 3), /* 16 */ + /* 000 */ V(3, 3, 3), /* 16 */ /* 001 */ V(0, 3, 3), /* 010 */ V(2, 3, 2), /* 011 */ V(2, 3, 2), @@ -250,11 +250,11 @@ union huffpair const hufftab6[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(3, 0, 2), /* 0001 ... */ - /* 0 */ V(1, 3, 1), /* 24 */ + /* 0 */ V(1, 3, 1), /* 24 */ /* 1 */ V(3, 1, 1), /* 0010 ... */ - /* 0 */ V(2, 2, 1), /* 26 */ + /* 0 */ V(2, 2, 1), /* 26 */ /* 1 */ V(0, 2, 1) }; @@ -278,7 +278,7 @@ union huffpair const hufftab7[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(0, 0, 1), /* 0000 ... */ - /* 0000 */ PTR(52, 2), /* 16 */ + /* 0000 */ PTR(52, 2), /* 16 */ /* 0001 */ PTR(56, 1), /* 0010 */ PTR(58, 1), /* 0011 */ V(1, 5, 4), @@ -296,7 +296,7 @@ union huffpair const hufftab7[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(4, 0, 3), /* 0001 ... */ - /* 0000 */ V(0, 4, 4), /* 32 */ + /* 0000 */ V(0, 4, 4), /* 32 */ /* 0001 */ V(2, 3, 4), /* 0010 */ V(3, 2, 4), /* 0011 */ V(0, 3, 4), @@ -314,31 +314,31 @@ union huffpair const hufftab7[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(1, 2, 2), /* 0010 ... */ - /* 00 */ V(2, 1, 1), /* 48 */ + /* 00 */ V(2, 1, 1), /* 48 */ /* 01 */ V(2, 1, 1), /* 10 */ V(0, 2, 2), /* 11 */ V(2, 0, 2), /* 0000 0000 ... */ - /* 00 */ V(5, 5, 2), /* 52 */ + /* 00 */ V(5, 5, 2), /* 52 */ /* 01 */ V(4, 5, 2), /* 10 */ V(5, 4, 2), /* 11 */ V(5, 3, 2), /* 0000 0001 ... */ - /* 0 */ V(3, 5, 1), /* 56 */ + /* 0 */ V(3, 5, 1), /* 56 */ /* 1 */ V(4, 4, 1), /* 0000 0010 ... */ - /* 0 */ V(2, 5, 1), /* 58 */ + /* 0 */ V(2, 5, 1), /* 58 */ /* 1 */ V(5, 2, 1), /* 0000 0101 ... */ - /* 0 */ V(0, 5, 1), /* 60 */ + /* 0 */ V(0, 5, 1), /* 60 */ /* 1 */ V(3, 4, 1), /* 0000 0111 ... */ - /* 0 */ V(4, 3, 1), /* 62 */ + /* 0 */ V(4, 3, 1), /* 62 */ /* 1 */ V(3, 3, 1) }; @@ -365,7 +365,7 @@ union huffpair const hufftab8[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(0, 0, 2), /* 0000 ... */ - /* 0000 */ PTR(36, 3), /* 16 */ + /* 0000 */ PTR(36, 3), /* 16 */ /* 0001 */ PTR(44, 2), /* 0010 */ PTR(48, 1), /* 0011 */ V(1, 5, 4), @@ -383,13 +383,13 @@ union huffpair const hufftab8[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(3, 2, 4), /* 0001 ... */ - /* 00 */ PTR(54, 2), /* 32 */ + /* 00 */ PTR(54, 2), /* 32 */ /* 01 */ V(2, 2, 2), /* 10 */ V(0, 2, 2), /* 11 */ V(2, 0, 2), /* 0000 0000 ... */ - /* 000 */ V(5, 5, 3), /* 36 */ + /* 000 */ V(5, 5, 3), /* 36 */ /* 001 */ V(5, 4, 3), /* 010 */ V(4, 5, 2), /* 011 */ V(4, 5, 2), @@ -399,25 +399,25 @@ union huffpair const hufftab8[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(5, 3, 1), /* 0000 0001 ... */ - /* 00 */ V(3, 5, 2), /* 44 */ + /* 00 */ V(3, 5, 2), /* 44 */ /* 01 */ V(4, 4, 2), /* 10 */ V(2, 5, 1), /* 11 */ V(2, 5, 1), /* 0000 0010 ... */ - /* 0 */ V(5, 2, 1), /* 48 */ + /* 0 */ V(5, 2, 1), /* 48 */ /* 1 */ V(0, 5, 1), /* 0000 0101 ... */ - /* 0 */ V(3, 4, 1), /* 50 */ + /* 0 */ V(3, 4, 1), /* 50 */ /* 1 */ V(4, 3, 1), /* 0000 0110 ... */ - /* 0 */ V(5, 0, 1), /* 52 */ + /* 0 */ V(5, 0, 1), /* 52 */ /* 1 */ V(3, 3, 1), /* 0001 00 ... */ - /* 00 */ V(1, 3, 2), /* 54 */ + /* 00 */ V(1, 3, 2), /* 54 */ /* 01 */ V(3, 1, 2), /* 10 */ V(0, 3, 2), /* 11 */ V(3, 0, 2), @@ -443,7 +443,7 @@ union huffpair const hufftab8[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(0, 0, 2), /* 0000 ... */ - /* 0000 */ PTR(48, 3), /* 16 */ + /* 0000 */ PTR(48, 3), /* 16 */ /* 0001 */ PTR(56, 2), /* 0010 */ PTR(60, 1), /* 0011 */ V(1, 5, 4), @@ -461,7 +461,7 @@ union huffpair const hufftab8[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(3, 2, 4), /* 0001 ... */ - /* 0000 */ V(1, 3, 4), /* 32 */ + /* 0000 */ V(1, 3, 4), /* 32 */ /* 0001 */ V(3, 1, 4), /* 0010 */ V(0, 3, 4), /* 0011 */ V(3, 0, 4), @@ -479,7 +479,7 @@ union huffpair const hufftab8[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(2, 0, 2), /* 0000 0000 ... */ - /* 000 */ V(5, 5, 3), /* 48 */ + /* 000 */ V(5, 5, 3), /* 48 */ /* 001 */ V(5, 4, 3), /* 010 */ V(4, 5, 2), /* 011 */ V(4, 5, 2), @@ -489,21 +489,21 @@ union huffpair const hufftab8[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(5, 3, 1), /* 0000 0001 ... */ - /* 00 */ V(3, 5, 2), /* 56 */ + /* 00 */ V(3, 5, 2), /* 56 */ /* 01 */ V(4, 4, 2), /* 10 */ V(2, 5, 1), /* 11 */ V(2, 5, 1), /* 0000 0010 ... */ - /* 0 */ V(5, 2, 1), /* 60 */ + /* 0 */ V(5, 2, 1), /* 60 */ /* 1 */ V(0, 5, 1), /* 0000 0101 ... */ - /* 0 */ V(3, 4, 1), /* 62 */ + /* 0 */ V(3, 4, 1), /* 62 */ /* 1 */ V(4, 3, 1), /* 0000 0110 ... */ - /* 0 */ V(5, 0, 1), /* 64 */ + /* 0 */ V(5, 0, 1), /* 64 */ /* 1 */ V(3, 3, 1) }; # endif @@ -528,7 +528,7 @@ union huffpair const hufftab9[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(0, 0, 3), /* 0000 ... */ - /* 0000 */ PTR(50, 1), /* 16 */ + /* 0000 */ PTR(50, 1), /* 16 */ /* 0001 */ V(3, 5, 4), /* 0010 */ V(5, 3, 4), /* 0011 */ PTR(52, 1), @@ -546,7 +546,7 @@ union huffpair const hufftab9[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(0, 4, 4), /* 0001 ... */ - /* 000 */ V(2, 4, 3), /* 32 */ + /* 000 */ V(2, 4, 3), /* 32 */ /* 001 */ V(4, 2, 3), /* 010 */ V(3, 3, 3), /* 011 */ V(4, 0, 3), @@ -556,27 +556,27 @@ union huffpair const hufftab9[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(4, 1, 2), /* 0010 ... */ - /* 00 */ V(2, 3, 2), /* 40 */ + /* 00 */ V(2, 3, 2), /* 40 */ /* 01 */ V(3, 2, 2), /* 10 */ V(1, 3, 1), /* 11 */ V(1, 3, 1), /* 0011 ... */ - /* 00 */ V(3, 1, 1), /* 44 */ + /* 00 */ V(3, 1, 1), /* 44 */ /* 01 */ V(3, 1, 1), /* 10 */ V(0, 3, 2), /* 11 */ V(3, 0, 2), /* 0100 ... */ - /* 0 */ V(2, 2, 1), /* 48 */ + /* 0 */ V(2, 2, 1), /* 48 */ /* 1 */ V(0, 2, 1), /* 0000 0000 ... */ - /* 0 */ V(5, 5, 1), /* 50 */ + /* 0 */ V(5, 5, 1), /* 50 */ /* 1 */ V(4, 5, 1), /* 0000 0011 ... */ - /* 0 */ V(5, 4, 1), /* 52 */ + /* 0 */ V(5, 4, 1), /* 52 */ /* 1 */ V(0, 5, 1) }; @@ -600,7 +600,7 @@ union huffpair const hufftab10[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(0, 0, 1), /* 0000 ... */ - /* 0000 */ PTR(52, 3), /* 16 */ + /* 0000 */ PTR(52, 3), /* 16 */ /* 0001 */ PTR(60, 2), /* 0010 */ PTR(64, 3), /* 0011 */ PTR(72, 1), @@ -618,7 +618,7 @@ union huffpair const hufftab10[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ PTR(96, 1), /* 0001 ... */ - /* 0000 */ PTR(98, 1), /* 32 */ + /* 0000 */ PTR(98, 1), /* 32 */ /* 0001 */ PTR(100, 1), /* 0010 */ V(1, 4, 4), /* 0011 */ V(4, 1, 4), @@ -636,13 +636,13 @@ union huffpair const hufftab10[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(2, 2, 3), /* 0010 ... */ - /* 00 */ V(1, 2, 2), /* 48 */ + /* 00 */ V(1, 2, 2), /* 48 */ /* 01 */ V(2, 1, 2), /* 10 */ V(0, 2, 2), /* 11 */ V(2, 0, 2), /* 0000 0000 ... */ - /* 000 */ V(7, 7, 3), /* 52 */ + /* 000 */ V(7, 7, 3), /* 52 */ /* 001 */ V(6, 7, 3), /* 010 */ V(7, 6, 3), /* 011 */ V(5, 7, 3), @@ -652,13 +652,13 @@ union huffpair const hufftab10[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(4, 7, 2), /* 0000 0001 ... */ - /* 00 */ V(7, 4, 2), /* 60 */ + /* 00 */ V(7, 4, 2), /* 60 */ /* 01 */ V(5, 6, 2), /* 10 */ V(6, 5, 2), /* 11 */ V(3, 7, 2), /* 0000 0010 ... */ - /* 000 */ V(7, 3, 2), /* 64 */ + /* 000 */ V(7, 3, 2), /* 64 */ /* 001 */ V(7, 3, 2), /* 010 */ V(4, 6, 2), /* 011 */ V(4, 6, 2), @@ -668,53 +668,53 @@ union huffpair const hufftab10[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(6, 3, 2), /* 0000 0011 ... */ - /* 0 */ V(2, 7, 1), /* 72 */ + /* 0 */ V(2, 7, 1), /* 72 */ /* 1 */ V(7, 2, 1), /* 0000 0100 ... */ - /* 00 */ V(6, 4, 2), /* 74 */ + /* 00 */ V(6, 4, 2), /* 74 */ /* 01 */ V(0, 7, 2), /* 10 */ V(7, 0, 1), /* 11 */ V(7, 0, 1), /* 0000 0101 ... */ - /* 00 */ V(6, 2, 1), /* 78 */ + /* 00 */ V(6, 2, 1), /* 78 */ /* 01 */ V(6, 2, 1), /* 10 */ V(4, 5, 2), /* 11 */ V(3, 5, 2), /* 0000 0110 ... */ - /* 00 */ V(0, 6, 1), /* 82 */ + /* 00 */ V(0, 6, 1), /* 82 */ /* 01 */ V(0, 6, 1), /* 10 */ V(5, 3, 2), /* 11 */ V(4, 4, 2), /* 0000 1001 ... */ - /* 0 */ V(3, 6, 1), /* 86 */ + /* 0 */ V(3, 6, 1), /* 86 */ /* 1 */ V(2, 6, 1), /* 0000 1010 ... */ - /* 00 */ V(2, 5, 2), /* 88 */ + /* 00 */ V(2, 5, 2), /* 88 */ /* 01 */ V(5, 2, 2), /* 10 */ V(1, 5, 1), /* 11 */ V(1, 5, 1), /* 0000 1011 ... */ - /* 00 */ V(5, 1, 1), /* 92 */ + /* 00 */ V(5, 1, 1), /* 92 */ /* 01 */ V(5, 1, 1), /* 10 */ V(3, 4, 2), /* 11 */ V(4, 3, 2), /* 0000 1111 ... */ - /* 0 */ V(0, 5, 1), /* 96 */ + /* 0 */ V(0, 5, 1), /* 96 */ /* 1 */ V(5, 0, 1), /* 0001 0000 ... */ - /* 0 */ V(2, 4, 1), /* 98 */ + /* 0 */ V(2, 4, 1), /* 98 */ /* 1 */ V(4, 2, 1), /* 0001 0001 ... */ - /* 0 */ V(3, 3, 1), /* 100 */ + /* 0 */ V(3, 3, 1), /* 100 */ /* 1 */ V(0, 4, 1) }; @@ -738,7 +738,7 @@ union huffpair const hufftab11[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(0, 0, 2), /* 0000 ... */ - /* 0000 */ PTR(74, 2), /* 16 */ + /* 0000 */ PTR(74, 2), /* 16 */ /* 0001 */ PTR(78, 3), /* 0010 */ PTR(86, 2), /* 0011 */ PTR(90, 1), @@ -756,7 +756,7 @@ union huffpair const hufftab11[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ PTR(98, 1), /* 0001 ... */ - /* 0000 */ PTR(100, 1), /* 32 */ + /* 0000 */ PTR(100, 1), /* 32 */ /* 0001 */ V(1, 5, 4), /* 0010 */ V(6, 2, 3), /* 0011 */ V(6, 2, 3), @@ -774,7 +774,7 @@ union huffpair const hufftab11[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(4, 2, 4), /* 0010 ... */ - /* 0000 */ V(1, 4, 4), /* 48 */ + /* 0000 */ V(1, 4, 4), /* 48 */ /* 0001 */ V(4, 1, 4), /* 0010 */ V(0, 4, 4), /* 0011 */ V(4, 0, 4), @@ -792,7 +792,7 @@ union huffpair const hufftab11[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(3, 1, 2), /* 0011 ... */ - /* 000 */ V(0, 3, 3), /* 64 */ + /* 000 */ V(0, 3, 3), /* 64 */ /* 001 */ V(3, 0, 3), /* 010 */ V(2, 2, 2), /* 011 */ V(2, 2, 2), @@ -802,17 +802,17 @@ union huffpair const hufftab11[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(2, 1, 1), /* 0101 ... */ - /* 0 */ V(0, 2, 1), /* 72 */ + /* 0 */ V(0, 2, 1), /* 72 */ /* 1 */ V(2, 0, 1), /* 0000 0000 ... */ - /* 00 */ V(7, 7, 2), /* 74 */ + /* 00 */ V(7, 7, 2), /* 74 */ /* 01 */ V(6, 7, 2), /* 10 */ V(7, 6, 2), /* 11 */ V(7, 5, 2), /* 0000 0001 ... */ - /* 000 */ V(6, 6, 2), /* 78 */ + /* 000 */ V(6, 6, 2), /* 78 */ /* 001 */ V(6, 6, 2), /* 010 */ V(4, 7, 2), /* 011 */ V(4, 7, 2), @@ -822,35 +822,35 @@ union huffpair const hufftab11[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(5, 5, 3), /* 0000 0010 ... */ - /* 00 */ V(5, 6, 2), /* 86 */ + /* 00 */ V(5, 6, 2), /* 86 */ /* 01 */ V(6, 5, 2), /* 10 */ V(3, 7, 1), /* 11 */ V(3, 7, 1), /* 0000 0011 ... */ - /* 0 */ V(7, 3, 1), /* 90 */ + /* 0 */ V(7, 3, 1), /* 90 */ /* 1 */ V(4, 6, 1), /* 0000 0100 ... */ - /* 00 */ V(4, 5, 2), /* 92 */ + /* 00 */ V(4, 5, 2), /* 92 */ /* 01 */ V(5, 4, 2), /* 10 */ V(3, 5, 2), /* 11 */ V(5, 3, 2), /* 0000 0111 ... */ - /* 0 */ V(6, 4, 1), /* 96 */ + /* 0 */ V(6, 4, 1), /* 96 */ /* 1 */ V(0, 7, 1), /* 0000 1111 ... */ - /* 0 */ V(4, 4, 1), /* 98 */ + /* 0 */ V(4, 4, 1), /* 98 */ /* 1 */ V(2, 5, 1), /* 0001 0000 ... */ - /* 0 */ V(5, 2, 1), /* 100 */ + /* 0 */ V(5, 2, 1), /* 100 */ /* 1 */ V(0, 5, 1), /* 0001 1101 ... */ - /* 0 */ V(4, 3, 1), /* 102 */ + /* 0 */ V(4, 3, 1), /* 102 */ /* 1 */ V(3, 3, 1) }; @@ -874,7 +874,7 @@ union huffpair const hufftab12[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(1, 0, 3), /* 0000 ... */ - /* 0000 */ PTR(80, 2), /* 16 */ + /* 0000 */ PTR(80, 2), /* 16 */ /* 0001 */ PTR(84, 1), /* 0010 */ PTR(86, 1), /* 0011 */ PTR(88, 1), @@ -892,7 +892,7 @@ union huffpair const hufftab12[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(6, 3, 4), /* 0001 ... */ - /* 0000 */ V(4, 5, 4), /* 32 */ + /* 0000 */ V(4, 5, 4), /* 32 */ /* 0001 */ V(5, 4, 4), /* 0010 */ V(4, 4, 4), /* 0011 */ PTR(94, 1), @@ -910,7 +910,7 @@ union huffpair const hufftab12[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(5, 2, 4), /* 0010 ... */ - /* 0000 */ V(1, 5, 3), /* 48 */ + /* 0000 */ V(1, 5, 3), /* 48 */ /* 0001 */ V(1, 5, 3), /* 0010 */ V(5, 1, 3), /* 0011 */ V(5, 1, 3), @@ -928,13 +928,13 @@ union huffpair const hufftab12[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(1, 4, 3), /* 0011 ... */ - /* 00 */ V(3, 3, 2), /* 64 */ + /* 00 */ V(3, 3, 2), /* 64 */ /* 01 */ V(4, 1, 2), /* 10 */ V(2, 3, 2), /* 11 */ V(3, 2, 2), /* 0100 ... */ - /* 000 */ V(4, 0, 3), /* 68 */ + /* 000 */ V(4, 0, 3), /* 68 */ /* 001 */ V(0, 3, 3), /* 010 */ V(3, 0, 2), /* 011 */ V(3, 0, 2), @@ -944,41 +944,41 @@ union huffpair const hufftab12[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(1, 3, 1), /* 0101 ... */ - /* 0 */ V(3, 1, 1), /* 76 */ + /* 0 */ V(3, 1, 1), /* 76 */ /* 1 */ V(2, 2, 1), /* 1000 ... */ - /* 0 */ V(0, 2, 1), /* 78 */ + /* 0 */ V(0, 2, 1), /* 78 */ /* 1 */ V(2, 0, 1), /* 0000 0000 ... */ - /* 00 */ V(7, 7, 2), /* 80 */ + /* 00 */ V(7, 7, 2), /* 80 */ /* 01 */ V(6, 7, 2), /* 10 */ V(7, 6, 1), /* 11 */ V(7, 6, 1), /* 0000 0001 ... */ - /* 0 */ V(5, 7, 1), /* 84 */ + /* 0 */ V(5, 7, 1), /* 84 */ /* 1 */ V(7, 5, 1), /* 0000 0010 ... */ - /* 0 */ V(6, 6, 1), /* 86 */ + /* 0 */ V(6, 6, 1), /* 86 */ /* 1 */ V(4, 7, 1), /* 0000 0011 ... */ - /* 0 */ V(7, 4, 1), /* 88 */ + /* 0 */ V(7, 4, 1), /* 88 */ /* 1 */ V(6, 5, 1), /* 0000 0110 ... */ - /* 0 */ V(7, 3, 1), /* 90 */ + /* 0 */ V(7, 3, 1), /* 90 */ /* 1 */ V(5, 5, 1), /* 0000 1101 ... */ - /* 0 */ V(0, 7, 1), /* 92 */ + /* 0 */ V(0, 7, 1), /* 92 */ /* 1 */ V(7, 0, 1), /* 0001 0011 ... */ - /* 0 */ V(0, 6, 1), /* 94 */ + /* 0 */ V(0, 6, 1), /* 94 */ /* 1 */ V(0, 5, 1) }; @@ -1002,7 +1002,7 @@ union huffpair const hufftab13[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(0, 0, 1), /* 0000 ... */ - /* 0000 */ PTR(68, 4), /* 16 */ + /* 0000 */ PTR(68, 4), /* 16 */ /* 0001 */ PTR(84, 4), /* 0010 */ PTR(100, 4), /* 0011 */ PTR(116, 4), @@ -1020,7 +1020,7 @@ union huffpair const hufftab13[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ PTR(226, 1), /* 0001 ... */ - /* 0000 */ PTR(228, 2), /* 32 */ + /* 0000 */ PTR(228, 2), /* 32 */ /* 0001 */ PTR(232, 2), /* 0010 */ PTR(236, 2), /* 0011 */ PTR(240, 2), @@ -1038,7 +1038,7 @@ union huffpair const hufftab13[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(1, 4, 4), /* 0010 ... */ - /* 0000 */ V(4, 1, 3), /* 48 */ + /* 0000 */ V(4, 1, 3), /* 48 */ /* 0001 */ V(4, 1, 3), /* 0010 */ V(0, 4, 4), /* 0011 */ V(4, 0, 4), @@ -1056,13 +1056,13 @@ union huffpair const hufftab13[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(2, 2, 3), /* 0011 ... */ - /* 00 */ V(1, 2, 2), /* 64 */ + /* 00 */ V(1, 2, 2), /* 64 */ /* 01 */ V(2, 1, 2), /* 10 */ V(0, 2, 2), /* 11 */ V(2, 0, 2), /* 0000 0000 ... */ - /* 0000 */ PTR(262, 4), /* 68 */ + /* 0000 */ PTR(262, 4), /* 68 */ /* 0001 */ PTR(278, 4), /* 0010 */ PTR(294, 4), /* 0011 */ PTR(310, 3), @@ -1080,7 +1080,7 @@ union huffpair const hufftab13[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(15, 1, 4), /* 0000 0001 ... */ - /* 0000 */ V(15, 0, 4), /* 84 */ + /* 0000 */ V(15, 0, 4), /* 84 */ /* 0001 */ PTR(360, 1), /* 0010 */ PTR(362, 1), /* 0011 */ PTR(364, 1), @@ -1098,7 +1098,7 @@ union huffpair const hufftab13[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(3, 13, 4), /* 0000 0010 ... */ - /* 0000 */ PTR(380, 1), /* 100 */ + /* 0000 */ PTR(380, 1), /* 100 */ /* 0001 */ V(2, 13, 4), /* 0010 */ V(13, 2, 4), /* 0011 */ V(1, 13, 4), @@ -1116,7 +1116,7 @@ union huffpair const hufftab13[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(10, 8, 4), /* 0000 0011 ... */ - /* 0000 */ V(4, 12, 4), /* 116 */ + /* 0000 */ V(4, 12, 4), /* 116 */ /* 0001 */ V(12, 4, 4), /* 0010 */ V(6, 11, 4), /* 0011 */ V(11, 6, 4), @@ -1134,7 +1134,7 @@ union huffpair const hufftab13[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(1, 12, 3), /* 0000 0100 ... */ - /* 0000 */ V(12, 1, 3), /* 132 */ + /* 0000 */ V(12, 1, 3), /* 132 */ /* 0001 */ V(12, 1, 3), /* 0010 */ V(9, 8, 4), /* 0011 */ V(0, 12, 4), @@ -1152,7 +1152,7 @@ union huffpair const hufftab13[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(5, 10, 4), /* 0000 0101 ... */ - /* 0000 */ V(2, 11, 3), /* 148 */ + /* 0000 */ V(2, 11, 3), /* 148 */ /* 0001 */ V(2, 11, 3), /* 0010 */ V(10, 5, 4), /* 0011 */ V(6, 9, 4), @@ -1170,7 +1170,7 @@ union huffpair const hufftab13[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(11, 2, 2), /* 0000 0110 ... */ - /* 000 */ V(1, 11, 2), /* 164 */ + /* 000 */ V(1, 11, 2), /* 164 */ /* 001 */ V(1, 11, 2), /* 010 */ V(11, 1, 2), /* 011 */ V(11, 1, 2), @@ -1180,7 +1180,7 @@ union huffpair const hufftab13[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(4, 10, 3), /* 0000 0111 ... */ - /* 000 */ V(3, 10, 3), /* 172 */ + /* 000 */ V(3, 10, 3), /* 172 */ /* 001 */ V(10, 3, 3), /* 010 */ V(5, 9, 3), /* 011 */ V(9, 5, 3), @@ -1190,7 +1190,7 @@ union huffpair const hufftab13[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(10, 2, 2), /* 0000 1000 ... */ - /* 000 */ V(1, 10, 2), /* 180 */ + /* 000 */ V(1, 10, 2), /* 180 */ /* 001 */ V(1, 10, 2), /* 010 */ V(10, 1, 2), /* 011 */ V(10, 1, 2), @@ -1200,7 +1200,7 @@ union huffpair const hufftab13[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(10, 0, 2), /* 0000 1001 ... */ - /* 000 */ V(8, 6, 3), /* 188 */ + /* 000 */ V(8, 6, 3), /* 188 */ /* 001 */ V(4, 9, 3), /* 010 */ V(9, 3, 2), /* 011 */ V(9, 3, 2), @@ -1210,7 +1210,7 @@ union huffpair const hufftab13[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(6, 7, 3), /* 0000 1010 ... */ - /* 000 */ V(2, 9, 2), /* 196 */ + /* 000 */ V(2, 9, 2), /* 196 */ /* 001 */ V(2, 9, 2), /* 010 */ V(9, 2, 2), /* 011 */ V(9, 2, 2), @@ -1220,7 +1220,7 @@ union huffpair const hufftab13[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(3, 8, 2), /* 0000 1011 ... */ - /* 000 */ V(8, 3, 2), /* 204 */ + /* 000 */ V(8, 3, 2), /* 204 */ /* 001 */ V(8, 3, 2), /* 010 */ V(6, 6, 3), /* 011 */ V(4, 7, 3), @@ -1230,17 +1230,17 @@ union huffpair const hufftab13[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(7, 3, 3), /* 0000 1100 ... */ - /* 0 */ V(1, 9, 1), /* 212 */ + /* 0 */ V(1, 9, 1), /* 212 */ /* 1 */ V(9, 1, 1), /* 0000 1101 ... */ - /* 00 */ V(0, 9, 2), /* 214 */ + /* 00 */ V(0, 9, 2), /* 214 */ /* 01 */ V(9, 0, 2), /* 10 */ V(4, 8, 2), /* 11 */ V(8, 4, 2), /* 0000 1110 ... */ - /* 000 */ V(7, 2, 2), /* 218 */ + /* 000 */ V(7, 2, 2), /* 218 */ /* 001 */ V(7, 2, 2), /* 010 */ V(4, 6, 3), /* 011 */ V(6, 4, 3), @@ -1250,69 +1250,69 @@ union huffpair const hufftab13[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(2, 8, 1), /* 0000 1111 ... */ - /* 0 */ V(8, 2, 1), /* 226 */ + /* 0 */ V(8, 2, 1), /* 226 */ /* 1 */ V(1, 8, 1), /* 0001 0000 ... */ - /* 00 */ V(3, 7, 2), /* 228 */ + /* 00 */ V(3, 7, 2), /* 228 */ /* 01 */ V(2, 7, 2), /* 10 */ V(1, 7, 1), /* 11 */ V(1, 7, 1), /* 0001 0001 ... */ - /* 00 */ V(7, 1, 1), /* 232 */ + /* 00 */ V(7, 1, 1), /* 232 */ /* 01 */ V(7, 1, 1), /* 10 */ V(5, 5, 2), /* 11 */ V(0, 7, 2), /* 0001 0010 ... */ - /* 00 */ V(7, 0, 2), /* 236 */ + /* 00 */ V(7, 0, 2), /* 236 */ /* 01 */ V(3, 6, 2), /* 10 */ V(6, 3, 2), /* 11 */ V(4, 5, 2), /* 0001 0011 ... */ - /* 00 */ V(5, 4, 2), /* 240 */ + /* 00 */ V(5, 4, 2), /* 240 */ /* 01 */ V(2, 6, 2), /* 10 */ V(6, 2, 2), /* 11 */ V(3, 5, 2), /* 0001 0101 ... */ - /* 0 */ V(0, 8, 1), /* 244 */ + /* 0 */ V(0, 8, 1), /* 244 */ /* 1 */ V(8, 0, 1), /* 0001 0110 ... */ - /* 0 */ V(1, 6, 1), /* 246 */ + /* 0 */ V(1, 6, 1), /* 246 */ /* 1 */ V(6, 1, 1), /* 0001 0111 ... */ - /* 0 */ V(0, 6, 1), /* 248 */ + /* 0 */ V(0, 6, 1), /* 248 */ /* 1 */ V(6, 0, 1), /* 0001 1000 ... */ - /* 00 */ V(5, 3, 2), /* 250 */ + /* 00 */ V(5, 3, 2), /* 250 */ /* 01 */ V(4, 4, 2), /* 10 */ V(2, 5, 1), /* 11 */ V(2, 5, 1), /* 0001 1001 ... */ - /* 0 */ V(5, 2, 1), /* 254 */ + /* 0 */ V(5, 2, 1), /* 254 */ /* 1 */ V(0, 5, 1), /* 0001 1100 ... */ - /* 0 */ V(3, 4, 1), /* 256 */ + /* 0 */ V(3, 4, 1), /* 256 */ /* 1 */ V(4, 3, 1), /* 0001 1101 ... */ - /* 0 */ V(5, 0, 1), /* 258 */ + /* 0 */ V(5, 0, 1), /* 258 */ /* 1 */ V(2, 4, 1), /* 0001 1110 ... */ - /* 0 */ V(4, 2, 1), /* 260 */ + /* 0 */ V(4, 2, 1), /* 260 */ /* 1 */ V(3, 3, 1), /* 0000 0000 0000 ... */ - /* 0000 */ PTR(388, 3), /* 262 */ + /* 0000 */ PTR(388, 3), /* 262 */ /* 0001 */ V(15, 15, 4), /* 0010 */ V(14, 15, 4), /* 0011 */ V(13, 15, 4), @@ -1330,7 +1330,7 @@ union huffpair const hufftab13[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(13, 13, 3), /* 0000 0000 0001 ... */ - /* 0000 */ V(15, 10, 4), /* 278 */ + /* 0000 */ V(15, 10, 4), /* 278 */ /* 0001 */ V(12, 13, 4), /* 0010 */ V(11, 14, 3), /* 0011 */ V(11, 14, 3), @@ -1348,7 +1348,7 @@ union huffpair const hufftab13[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(13, 11, 3), /* 0000 0000 0010 ... */ - /* 0000 */ V(8, 15, 3), /* 294 */ + /* 0000 */ V(8, 15, 3), /* 294 */ /* 0001 */ V(8, 15, 3), /* 0010 */ V(15, 8, 3), /* 0011 */ V(15, 8, 3), @@ -1366,7 +1366,7 @@ union huffpair const hufftab13[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(15, 7, 2), /* 0000 0000 0011 ... */ - /* 000 */ V(13, 10, 2), /* 310 */ + /* 000 */ V(13, 10, 2), /* 310 */ /* 001 */ V(13, 10, 2), /* 010 */ V(10, 13, 3), /* 011 */ V(11, 12, 3), @@ -1376,19 +1376,19 @@ union huffpair const hufftab13[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(6, 15, 2), /* 0000 0000 0100 ... */ - /* 00 */ V(14, 8, 2), /* 318 */ + /* 00 */ V(14, 8, 2), /* 318 */ /* 01 */ V(5, 15, 2), /* 10 */ V(9, 13, 2), /* 11 */ V(13, 9, 2), /* 0000 0000 0101 ... */ - /* 00 */ V(15, 5, 2), /* 322 */ + /* 00 */ V(15, 5, 2), /* 322 */ /* 01 */ V(14, 7, 2), /* 10 */ V(10, 12, 2), /* 11 */ V(11, 11, 2), /* 0000 0000 0110 ... */ - /* 000 */ V(4, 15, 2), /* 326 */ + /* 000 */ V(4, 15, 2), /* 326 */ /* 001 */ V(4, 15, 2), /* 010 */ V(15, 4, 2), /* 011 */ V(15, 4, 2), @@ -1398,103 +1398,103 @@ union huffpair const hufftab13[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(15, 3, 2), /* 0000 0000 0111 ... */ - /* 00 */ V(3, 15, 1), /* 334 */ + /* 00 */ V(3, 15, 1), /* 334 */ /* 01 */ V(3, 15, 1), /* 10 */ V(8, 13, 2), /* 11 */ V(13, 8, 2), /* 0000 0000 1000 ... */ - /* 0 */ V(2, 15, 1), /* 338 */ + /* 0 */ V(2, 15, 1), /* 338 */ /* 1 */ V(15, 2, 1), /* 0000 0000 1001 ... */ - /* 00 */ V(6, 14, 2), /* 340 */ + /* 00 */ V(6, 14, 2), /* 340 */ /* 01 */ V(9, 12, 2), /* 10 */ V(0, 15, 1), /* 11 */ V(0, 15, 1), /* 0000 0000 1010 ... */ - /* 00 */ V(12, 9, 2), /* 344 */ + /* 00 */ V(12, 9, 2), /* 344 */ /* 01 */ V(5, 14, 2), /* 10 */ V(10, 11, 1), /* 11 */ V(10, 11, 1), /* 0000 0000 1011 ... */ - /* 00 */ V(7, 13, 2), /* 348 */ + /* 00 */ V(7, 13, 2), /* 348 */ /* 01 */ V(13, 7, 2), /* 10 */ V(4, 14, 1), /* 11 */ V(4, 14, 1), /* 0000 0000 1100 ... */ - /* 00 */ V(12, 8, 2), /* 352 */ + /* 00 */ V(12, 8, 2), /* 352 */ /* 01 */ V(13, 6, 2), /* 10 */ V(3, 14, 1), /* 11 */ V(3, 14, 1), /* 0000 0000 1101 ... */ - /* 00 */ V(11, 9, 1), /* 356 */ + /* 00 */ V(11, 9, 1), /* 356 */ /* 01 */ V(11, 9, 1), /* 10 */ V(9, 11, 2), /* 11 */ V(10, 10, 2), /* 0000 0001 0001 ... */ - /* 0 */ V(11, 10, 1), /* 360 */ + /* 0 */ V(11, 10, 1), /* 360 */ /* 1 */ V(14, 5, 1), /* 0000 0001 0010 ... */ - /* 0 */ V(14, 4, 1), /* 362 */ + /* 0 */ V(14, 4, 1), /* 362 */ /* 1 */ V(8, 12, 1), /* 0000 0001 0011 ... */ - /* 0 */ V(6, 13, 1), /* 364 */ + /* 0 */ V(6, 13, 1), /* 364 */ /* 1 */ V(14, 3, 1), /* 0000 0001 0101 ... */ - /* 0 */ V(2, 14, 1), /* 366 */ + /* 0 */ V(2, 14, 1), /* 366 */ /* 1 */ V(0, 14, 1), /* 0000 0001 1000 ... */ - /* 0 */ V(14, 0, 1), /* 368 */ + /* 0 */ V(14, 0, 1), /* 368 */ /* 1 */ V(5, 13, 1), /* 0000 0001 1001 ... */ - /* 0 */ V(13, 5, 1), /* 370 */ + /* 0 */ V(13, 5, 1), /* 370 */ /* 1 */ V(7, 12, 1), /* 0000 0001 1010 ... */ - /* 0 */ V(12, 7, 1), /* 372 */ + /* 0 */ V(12, 7, 1), /* 372 */ /* 1 */ V(4, 13, 1), /* 0000 0001 1011 ... */ - /* 0 */ V(8, 11, 1), /* 374 */ + /* 0 */ V(8, 11, 1), /* 374 */ /* 1 */ V(11, 8, 1), /* 0000 0001 1100 ... */ - /* 0 */ V(13, 4, 1), /* 376 */ + /* 0 */ V(13, 4, 1), /* 376 */ /* 1 */ V(9, 10, 1), /* 0000 0001 1101 ... */ - /* 0 */ V(10, 9, 1), /* 378 */ + /* 0 */ V(10, 9, 1), /* 378 */ /* 1 */ V(6, 12, 1), /* 0000 0010 0000 ... */ - /* 0 */ V(13, 3, 1), /* 380 */ + /* 0 */ V(13, 3, 1), /* 380 */ /* 1 */ V(7, 11, 1), /* 0000 0010 0101 ... */ - /* 0 */ V(5, 12, 1), /* 382 */ + /* 0 */ V(5, 12, 1), /* 382 */ /* 1 */ V(12, 5, 1), /* 0000 0010 0110 ... */ - /* 0 */ V(9, 9, 1), /* 384 */ + /* 0 */ V(9, 9, 1), /* 384 */ /* 1 */ V(7, 10, 1), /* 0000 0010 1000 ... */ - /* 0 */ V(10, 7, 1), /* 386 */ + /* 0 */ V(10, 7, 1), /* 386 */ /* 1 */ V(9, 7, 1), /* 0000 0000 0000 0000 ... */ - /* 000 */ V(15, 14, 3), /* 388 */ + /* 000 */ V(15, 14, 3), /* 388 */ /* 001 */ V(15, 12, 3), /* 010 */ V(15, 13, 2), /* 011 */ V(15, 13, 2), @@ -1504,7 +1504,7 @@ union huffpair const hufftab13[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(14, 13, 1), /* 0000 0000 0000 1011 ... */ - /* 0 */ V(10, 15, 1), /* 396 */ + /* 0 */ V(10, 15, 1), /* 396 */ /* 1 */ V(14, 9, 1) }; @@ -1528,7 +1528,7 @@ union huffpair const hufftab15[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(0, 0, 3), /* 0000 ... */ - /* 0000 */ PTR(120, 4), /* 16 */ + /* 0000 */ PTR(120, 4), /* 16 */ /* 0001 */ PTR(136, 4), /* 0010 */ PTR(152, 4), /* 0011 */ PTR(168, 4), @@ -1546,7 +1546,7 @@ union huffpair const hufftab15[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ PTR(284, 2), /* 0001 ... */ - /* 0000 */ PTR(288, 2), /* 32 */ + /* 0000 */ PTR(288, 2), /* 32 */ /* 0001 */ PTR(292, 2), /* 0010 */ PTR(296, 2), /* 0011 */ PTR(300, 2), @@ -1564,7 +1564,7 @@ union huffpair const hufftab15[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ PTR(338, 1), /* 0010 ... */ - /* 0000 */ PTR(340, 1), /* 48 */ + /* 0000 */ PTR(340, 1), /* 48 */ /* 0001 */ PTR(342, 1), /* 0010 */ V(9, 1, 4), /* 0011 */ PTR(344, 1), @@ -1582,7 +1582,7 @@ union huffpair const hufftab15[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ PTR(360, 1), /* 0011 ... */ - /* 0000 */ V(2, 7, 4), /* 64 */ + /* 0000 */ V(2, 7, 4), /* 64 */ /* 0001 */ V(7, 2, 4), /* 0010 */ V(6, 4, 4), /* 0011 */ V(1, 7, 4), @@ -1600,7 +1600,7 @@ union huffpair const hufftab15[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(3, 5, 4), /* 0100 ... */ - /* 0000 */ V(6, 1, 3), /* 80 */ + /* 0000 */ V(6, 1, 3), /* 80 */ /* 0001 */ V(6, 1, 3), /* 0010 */ V(5, 3, 4), /* 0011 */ V(4, 4, 4), @@ -1618,7 +1618,7 @@ union huffpair const hufftab15[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(3, 4, 3), /* 0101 ... */ - /* 000 */ V(4, 3, 3), /* 96 */ + /* 000 */ V(4, 3, 3), /* 96 */ /* 001 */ V(2, 4, 3), /* 010 */ V(4, 2, 3), /* 011 */ V(3, 3, 3), @@ -1628,7 +1628,7 @@ union huffpair const hufftab15[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(0, 4, 3), /* 0110 ... */ - /* 000 */ V(2, 3, 2), /* 104 */ + /* 000 */ V(2, 3, 2), /* 104 */ /* 001 */ V(2, 3, 2), /* 010 */ V(3, 2, 2), /* 011 */ V(3, 2, 2), @@ -1638,21 +1638,21 @@ union huffpair const hufftab15[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(1, 3, 2), /* 0111 ... */ - /* 00 */ V(3, 1, 2), /* 112 */ + /* 00 */ V(3, 1, 2), /* 112 */ /* 01 */ V(3, 0, 2), /* 10 */ V(2, 2, 1), /* 11 */ V(2, 2, 1), /* 1000 ... */ - /* 0 */ V(1, 2, 1), /* 116 */ + /* 0 */ V(1, 2, 1), /* 116 */ /* 1 */ V(2, 1, 1), /* 1001 ... */ - /* 0 */ V(0, 2, 1), /* 118 */ + /* 0 */ V(0, 2, 1), /* 118 */ /* 1 */ V(2, 0, 1), /* 0000 0000 ... */ - /* 0000 */ PTR(366, 1), /* 120 */ + /* 0000 */ PTR(366, 1), /* 120 */ /* 0001 */ PTR(368, 1), /* 0010 */ V(14, 14, 4), /* 0011 */ PTR(370, 1), @@ -1670,7 +1670,7 @@ union huffpair const hufftab15[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(9, 15, 4), /* 0000 0001 ... */ - /* 0000 */ V(15, 9, 4), /* 136 */ + /* 0000 */ V(15, 9, 4), /* 136 */ /* 0001 */ V(14, 10, 4), /* 0010 */ V(11, 13, 4), /* 0011 */ V(13, 11, 4), @@ -1688,7 +1688,7 @@ union huffpair const hufftab15[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ PTR(378, 1), /* 0000 0010 ... */ - /* 0000 */ V(12, 11, 3), /* 152 */ + /* 0000 */ V(12, 11, 3), /* 152 */ /* 0001 */ V(12, 11, 3), /* 0010 */ V(15, 6, 3), /* 0011 */ V(15, 6, 3), @@ -1706,7 +1706,7 @@ union huffpair const hufftab15[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(10, 12, 3), /* 0000 0011 ... */ - /* 0000 */ V(12, 10, 3), /* 168 */ + /* 0000 */ V(12, 10, 3), /* 168 */ /* 0001 */ V(12, 10, 3), /* 0010 */ V(11, 11, 3), /* 0011 */ V(11, 11, 3), @@ -1724,7 +1724,7 @@ union huffpair const hufftab15[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(13, 8, 3), /* 0000 0100 ... */ - /* 0000 */ V(14, 6, 3), /* 184 */ + /* 0000 */ V(14, 6, 3), /* 184 */ /* 0001 */ V(14, 6, 3), /* 0010 */ V(2, 15, 3), /* 0011 */ V(2, 15, 3), @@ -1742,7 +1742,7 @@ union huffpair const hufftab15[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(12, 9, 3), /* 0000 0101 ... */ - /* 000 */ V(5, 14, 3), /* 200 */ + /* 000 */ V(5, 14, 3), /* 200 */ /* 001 */ V(10, 11, 3), /* 010 */ V(11, 10, 3), /* 011 */ V(14, 5, 3), @@ -1752,7 +1752,7 @@ union huffpair const hufftab15[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(14, 4, 3), /* 0000 0110 ... */ - /* 000 */ V(8, 12, 3), /* 208 */ + /* 000 */ V(8, 12, 3), /* 208 */ /* 001 */ V(12, 8, 3), /* 010 */ V(3, 14, 3), /* 011 */ V(6, 13, 3), @@ -1762,7 +1762,7 @@ union huffpair const hufftab15[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(11, 9, 3), /* 0000 0111 ... */ - /* 0000 */ V(2, 14, 3), /* 216 */ + /* 0000 */ V(2, 14, 3), /* 216 */ /* 0001 */ V(2, 14, 3), /* 0010 */ V(10, 10, 3), /* 0011 */ V(10, 10, 3), @@ -1780,7 +1780,7 @@ union huffpair const hufftab15[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(13, 5, 3), /* 0000 1000 ... */ - /* 000 */ V(7, 12, 3), /* 232 */ + /* 000 */ V(7, 12, 3), /* 232 */ /* 001 */ V(12, 7, 3), /* 010 */ V(4, 13, 3), /* 011 */ V(8, 11, 3), @@ -1790,7 +1790,7 @@ union huffpair const hufftab15[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(9, 10, 3), /* 0000 1001 ... */ - /* 000 */ V(10, 9, 3), /* 240 */ + /* 000 */ V(10, 9, 3), /* 240 */ /* 001 */ V(6, 12, 3), /* 010 */ V(12, 6, 3), /* 011 */ V(3, 13, 3), @@ -1800,7 +1800,7 @@ union huffpair const hufftab15[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(13, 2, 2), /* 0000 1010 ... */ - /* 000 */ V(2, 13, 3), /* 248 */ + /* 000 */ V(2, 13, 3), /* 248 */ /* 001 */ V(0, 13, 3), /* 010 */ V(1, 13, 2), /* 011 */ V(1, 13, 2), @@ -1810,7 +1810,7 @@ union huffpair const hufftab15[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(11, 7, 2), /* 0000 1011 ... */ - /* 000 */ V(13, 1, 2), /* 256 */ + /* 000 */ V(13, 1, 2), /* 256 */ /* 001 */ V(13, 1, 2), /* 010 */ V(5, 12, 3), /* 011 */ V(13, 0, 3), @@ -1820,13 +1820,13 @@ union huffpair const hufftab15[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(8, 10, 2), /* 0000 1100 ... */ - /* 00 */ V(10, 8, 2), /* 264 */ + /* 00 */ V(10, 8, 2), /* 264 */ /* 01 */ V(4, 12, 2), /* 10 */ V(12, 4, 2), /* 11 */ V(6, 11, 2), /* 0000 1101 ... */ - /* 000 */ V(11, 6, 2), /* 268 */ + /* 000 */ V(11, 6, 2), /* 268 */ /* 001 */ V(11, 6, 2), /* 010 */ V(9, 9, 3), /* 011 */ V(0, 12, 3), @@ -1836,7 +1836,7 @@ union huffpair const hufftab15[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(12, 3, 2), /* 0000 1110 ... */ - /* 000 */ V(7, 10, 2), /* 276 */ + /* 000 */ V(7, 10, 2), /* 276 */ /* 001 */ V(7, 10, 2), /* 010 */ V(10, 7, 2), /* 011 */ V(10, 7, 2), @@ -1846,173 +1846,173 @@ union huffpair const hufftab15[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(0, 11, 3), /* 0000 1111 ... */ - /* 00 */ V(12, 2, 1), /* 284 */ + /* 00 */ V(12, 2, 1), /* 284 */ /* 01 */ V(12, 2, 1), /* 10 */ V(2, 12, 2), /* 11 */ V(5, 11, 2), /* 0001 0000 ... */ - /* 00 */ V(11, 5, 2), /* 288 */ + /* 00 */ V(11, 5, 2), /* 288 */ /* 01 */ V(1, 12, 2), /* 10 */ V(8, 9, 2), /* 11 */ V(9, 8, 2), /* 0001 0001 ... */ - /* 00 */ V(12, 1, 2), /* 292 */ + /* 00 */ V(12, 1, 2), /* 292 */ /* 01 */ V(4, 11, 2), /* 10 */ V(11, 4, 2), /* 11 */ V(6, 10, 2), /* 0001 0010 ... */ - /* 00 */ V(3, 11, 2), /* 296 */ + /* 00 */ V(3, 11, 2), /* 296 */ /* 01 */ V(7, 9, 2), /* 10 */ V(11, 3, 1), /* 11 */ V(11, 3, 1), /* 0001 0011 ... */ - /* 00 */ V(9, 7, 2), /* 300 */ + /* 00 */ V(9, 7, 2), /* 300 */ /* 01 */ V(8, 8, 2), /* 10 */ V(2, 11, 2), /* 11 */ V(5, 10, 2), /* 0001 0100 ... */ - /* 00 */ V(11, 2, 1), /* 304 */ + /* 00 */ V(11, 2, 1), /* 304 */ /* 01 */ V(11, 2, 1), /* 10 */ V(10, 5, 2), /* 11 */ V(1, 11, 2), /* 0001 0101 ... */ - /* 00 */ V(11, 1, 1), /* 308 */ + /* 00 */ V(11, 1, 1), /* 308 */ /* 01 */ V(11, 1, 1), /* 10 */ V(11, 0, 2), /* 11 */ V(6, 9, 2), /* 0001 0110 ... */ - /* 00 */ V(9, 6, 2), /* 312 */ + /* 00 */ V(9, 6, 2), /* 312 */ /* 01 */ V(4, 10, 2), /* 10 */ V(10, 4, 2), /* 11 */ V(7, 8, 2), /* 0001 0111 ... */ - /* 00 */ V(8, 7, 2), /* 316 */ + /* 00 */ V(8, 7, 2), /* 316 */ /* 01 */ V(3, 10, 2), /* 10 */ V(10, 3, 1), /* 11 */ V(10, 3, 1), /* 0001 1000 ... */ - /* 0 */ V(5, 9, 1), /* 320 */ + /* 0 */ V(5, 9, 1), /* 320 */ /* 1 */ V(9, 5, 1), /* 0001 1001 ... */ - /* 0 */ V(2, 10, 1), /* 322 */ + /* 0 */ V(2, 10, 1), /* 322 */ /* 1 */ V(10, 2, 1), /* 0001 1010 ... */ - /* 0 */ V(1, 10, 1), /* 324 */ + /* 0 */ V(1, 10, 1), /* 324 */ /* 1 */ V(10, 1, 1), /* 0001 1011 ... */ - /* 00 */ V(0, 10, 2), /* 326 */ + /* 00 */ V(0, 10, 2), /* 326 */ /* 01 */ V(10, 0, 2), /* 10 */ V(6, 8, 1), /* 11 */ V(6, 8, 1), /* 0001 1100 ... */ - /* 0 */ V(8, 6, 1), /* 330 */ + /* 0 */ V(8, 6, 1), /* 330 */ /* 1 */ V(4, 9, 1), /* 0001 1101 ... */ - /* 0 */ V(9, 4, 1), /* 332 */ + /* 0 */ V(9, 4, 1), /* 332 */ /* 1 */ V(3, 9, 1), /* 0001 1110 ... */ - /* 00 */ V(9, 3, 1), /* 334 */ + /* 00 */ V(9, 3, 1), /* 334 */ /* 01 */ V(9, 3, 1), /* 10 */ V(7, 7, 2), /* 11 */ V(0, 9, 2), /* 0001 1111 ... */ - /* 0 */ V(5, 8, 1), /* 338 */ + /* 0 */ V(5, 8, 1), /* 338 */ /* 1 */ V(8, 5, 1), /* 0010 0000 ... */ - /* 0 */ V(2, 9, 1), /* 340 */ + /* 0 */ V(2, 9, 1), /* 340 */ /* 1 */ V(6, 7, 1), /* 0010 0001 ... */ - /* 0 */ V(7, 6, 1), /* 342 */ + /* 0 */ V(7, 6, 1), /* 342 */ /* 1 */ V(9, 2, 1), /* 0010 0011 ... */ - /* 0 */ V(1, 9, 1), /* 344 */ + /* 0 */ V(1, 9, 1), /* 344 */ /* 1 */ V(9, 0, 1), /* 0010 0100 ... */ - /* 0 */ V(4, 8, 1), /* 346 */ + /* 0 */ V(4, 8, 1), /* 346 */ /* 1 */ V(8, 4, 1), /* 0010 0101 ... */ - /* 0 */ V(5, 7, 1), /* 348 */ + /* 0 */ V(5, 7, 1), /* 348 */ /* 1 */ V(7, 5, 1), /* 0010 0110 ... */ - /* 0 */ V(3, 8, 1), /* 350 */ + /* 0 */ V(3, 8, 1), /* 350 */ /* 1 */ V(8, 3, 1), /* 0010 0111 ... */ - /* 0 */ V(6, 6, 1), /* 352 */ + /* 0 */ V(6, 6, 1), /* 352 */ /* 1 */ V(4, 7, 1), /* 0010 1100 ... */ - /* 0 */ V(7, 4, 1), /* 354 */ + /* 0 */ V(7, 4, 1), /* 354 */ /* 1 */ V(0, 8, 1), /* 0010 1101 ... */ - /* 0 */ V(8, 0, 1), /* 356 */ + /* 0 */ V(8, 0, 1), /* 356 */ /* 1 */ V(5, 6, 1), /* 0010 1110 ... */ - /* 0 */ V(6, 5, 1), /* 358 */ + /* 0 */ V(6, 5, 1), /* 358 */ /* 1 */ V(3, 7, 1), /* 0010 1111 ... */ - /* 0 */ V(7, 3, 1), /* 360 */ + /* 0 */ V(7, 3, 1), /* 360 */ /* 1 */ V(4, 6, 1), /* 0011 0110 ... */ - /* 0 */ V(0, 7, 1), /* 362 */ + /* 0 */ V(0, 7, 1), /* 362 */ /* 1 */ V(7, 0, 1), /* 0011 1110 ... */ - /* 0 */ V(0, 6, 1), /* 364 */ + /* 0 */ V(0, 6, 1), /* 364 */ /* 1 */ V(6, 0, 1), /* 0000 0000 0000 ... */ - /* 0 */ V(15, 15, 1), /* 366 */ + /* 0 */ V(15, 15, 1), /* 366 */ /* 1 */ V(14, 15, 1), /* 0000 0000 0001 ... */ - /* 0 */ V(15, 14, 1), /* 368 */ + /* 0 */ V(15, 14, 1), /* 368 */ /* 1 */ V(13, 15, 1), /* 0000 0000 0011 ... */ - /* 0 */ V(15, 13, 1), /* 370 */ + /* 0 */ V(15, 13, 1), /* 370 */ /* 1 */ V(12, 15, 1), /* 0000 0000 0100 ... */ - /* 0 */ V(15, 12, 1), /* 372 */ + /* 0 */ V(15, 12, 1), /* 372 */ /* 1 */ V(13, 14, 1), /* 0000 0000 0101 ... */ - /* 0 */ V(14, 13, 1), /* 374 */ + /* 0 */ V(14, 13, 1), /* 374 */ /* 1 */ V(11, 15, 1), /* 0000 0000 0111 ... */ - /* 0 */ V(12, 14, 1), /* 376 */ + /* 0 */ V(12, 14, 1), /* 376 */ /* 1 */ V(14, 12, 1), /* 0000 0001 1111 ... */ - /* 0 */ V(10, 14, 1), /* 378 */ + /* 0 */ V(10, 14, 1), /* 378 */ /* 1 */ V(0, 15, 1) }; @@ -2036,7 +2036,7 @@ union huffpair const hufftab16[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(0, 0, 1), /* 0000 ... */ - /* 0000 */ PTR(68, 3), /* 16 */ + /* 0000 */ PTR(68, 3), /* 16 */ /* 0001 */ PTR(76, 3), /* 0010 */ PTR(84, 2), /* 0011 */ V(15, 15, 4), @@ -2054,7 +2054,7 @@ union huffpair const hufftab16[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ PTR(176, 4), /* 0001 ... */ - /* 0000 */ PTR(192, 4), /* 32 */ + /* 0000 */ PTR(192, 4), /* 32 */ /* 0001 */ PTR(208, 3), /* 0010 */ PTR(216, 3), /* 0011 */ PTR(224, 3), @@ -2072,7 +2072,7 @@ union huffpair const hufftab16[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ PTR(284, 1), /* 0010 ... */ - /* 0000 */ PTR(286, 1), /* 48 */ + /* 0000 */ PTR(286, 1), /* 48 */ /* 0001 */ PTR(288, 1), /* 0010 */ PTR(290, 1), /* 0011 */ V(1, 4, 4), @@ -2090,13 +2090,13 @@ union huffpair const hufftab16[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(2, 2, 3), /* 0011 ... */ - /* 00 */ V(1, 2, 2), /* 64 */ + /* 00 */ V(1, 2, 2), /* 64 */ /* 01 */ V(2, 1, 2), /* 10 */ V(0, 2, 2), /* 11 */ V(2, 0, 2), /* 0000 0000 ... */ - /* 000 */ V(14, 15, 3), /* 68 */ + /* 000 */ V(14, 15, 3), /* 68 */ /* 001 */ V(15, 14, 3), /* 010 */ V(13, 15, 3), /* 011 */ V(15, 13, 3), @@ -2106,7 +2106,7 @@ union huffpair const hufftab16[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(15, 11, 3), /* 0000 0001 ... */ - /* 000 */ V(10, 15, 2), /* 76 */ + /* 000 */ V(10, 15, 2), /* 76 */ /* 001 */ V(10, 15, 2), /* 010 */ V(15, 10, 3), /* 011 */ V(9, 15, 3), @@ -2116,23 +2116,23 @@ union huffpair const hufftab16[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(8, 15, 2), /* 0000 0010 ... */ - /* 00 */ V(7, 15, 2), /* 84 */ + /* 00 */ V(7, 15, 2), /* 84 */ /* 01 */ V(15, 7, 2), /* 10 */ V(6, 15, 2), /* 11 */ V(15, 6, 2), /* 0000 0100 ... */ - /* 00 */ V(5, 15, 2), /* 88 */ + /* 00 */ V(5, 15, 2), /* 88 */ /* 01 */ V(15, 5, 2), /* 10 */ V(4, 15, 1), /* 11 */ V(4, 15, 1), /* 0000 0101 ... */ - /* 0 */ V(15, 4, 1), /* 92 */ + /* 0 */ V(15, 4, 1), /* 92 */ /* 1 */ V(15, 3, 1), /* 0000 0110 ... */ - /* 0000 */ V(15, 0, 1), /* 94 */ + /* 0000 */ V(15, 0, 1), /* 94 */ /* 0001 */ V(15, 0, 1), /* 0010 */ V(15, 0, 1), /* 0011 */ V(15, 0, 1), @@ -2150,11 +2150,11 @@ union huffpair const hufftab16[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ PTR(326, 3), /* 0000 1000 ... */ - /* 0 */ V(2, 15, 1), /* 110 */ + /* 0 */ V(2, 15, 1), /* 110 */ /* 1 */ V(0, 15, 1), /* 0000 1011 ... */ - /* 0000 */ PTR(334, 2), /* 112 */ + /* 0000 */ PTR(334, 2), /* 112 */ /* 0001 */ PTR(338, 2), /* 0010 */ PTR(342, 2), /* 0011 */ PTR(346, 1), @@ -2172,7 +2172,7 @@ union huffpair const hufftab16[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ PTR(380, 1), /* 0000 1100 ... */ - /* 0000 */ PTR(382, 1), /* 128 */ + /* 0000 */ PTR(382, 1), /* 128 */ /* 0001 */ PTR(384, 1), /* 0010 */ PTR(386, 1), /* 0011 */ V(0, 13, 4), @@ -2190,7 +2190,7 @@ union huffpair const hufftab16[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(1, 14, 4), /* 0000 1101 ... */ - /* 0000 */ V(13, 3, 4), /* 144 */ + /* 0000 */ V(13, 3, 4), /* 144 */ /* 0001 */ V(2, 13, 4), /* 0010 */ V(13, 2, 4), /* 0011 */ V(13, 1, 4), @@ -2208,7 +2208,7 @@ union huffpair const hufftab16[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(11, 5, 4), /* 0000 1110 ... */ - /* 0000 */ V(12, 1, 4), /* 160 */ + /* 0000 */ V(12, 1, 4), /* 160 */ /* 0001 */ V(0, 12, 4), /* 0010 */ V(4, 11, 4), /* 0011 */ V(11, 4, 4), @@ -2226,7 +2226,7 @@ union huffpair const hufftab16[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(1, 11, 3), /* 0000 1111 ... */ - /* 0000 */ V(11, 1, 3), /* 176 */ + /* 0000 */ V(11, 1, 3), /* 176 */ /* 0001 */ V(11, 1, 3), /* 0010 */ V(0, 11, 4), /* 0011 */ V(11, 0, 4), @@ -2244,7 +2244,7 @@ union huffpair const hufftab16[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(2, 10, 3), /* 0001 0000 ... */ - /* 0000 */ V(9, 5, 4), /* 192 */ + /* 0000 */ V(9, 5, 4), /* 192 */ /* 0001 */ V(6, 8, 4), /* 0010 */ V(10, 1, 3), /* 0011 */ V(10, 1, 3), @@ -2262,7 +2262,7 @@ union huffpair const hufftab16[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(10, 2, 2), /* 0001 0001 ... */ - /* 000 */ V(1, 10, 2), /* 208 */ + /* 000 */ V(1, 10, 2), /* 208 */ /* 001 */ V(1, 10, 2), /* 010 */ V(0, 10, 3), /* 011 */ V(10, 0, 3), @@ -2272,7 +2272,7 @@ union huffpair const hufftab16[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(8, 5, 3), /* 0001 0010 ... */ - /* 000 */ V(2, 9, 2), /* 216 */ + /* 000 */ V(2, 9, 2), /* 216 */ /* 001 */ V(2, 9, 2), /* 010 */ V(9, 2, 2), /* 011 */ V(9, 2, 2), @@ -2282,7 +2282,7 @@ union huffpair const hufftab16[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(1, 9, 2), /* 0001 0011 ... */ - /* 000 */ V(9, 1, 2), /* 224 */ + /* 000 */ V(9, 1, 2), /* 224 */ /* 001 */ V(9, 1, 2), /* 010 */ V(9, 0, 3), /* 011 */ V(4, 8, 3), @@ -2292,7 +2292,7 @@ union huffpair const hufftab16[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(8, 3, 3), /* 0001 0100 ... */ - /* 000 */ V(6, 6, 3), /* 232 */ + /* 000 */ V(6, 6, 3), /* 232 */ /* 001 */ V(2, 8, 3), /* 010 */ V(8, 2, 2), /* 011 */ V(8, 2, 2), @@ -2302,7 +2302,7 @@ union huffpair const hufftab16[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(1, 8, 2), /* 0001 0101 ... */ - /* 000 */ V(8, 1, 2), /* 240 */ + /* 000 */ V(8, 1, 2), /* 240 */ /* 001 */ V(8, 1, 2), /* 010 */ V(8, 0, 2), /* 011 */ V(8, 0, 2), @@ -2312,7 +2312,7 @@ union huffpair const hufftab16[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(3, 7, 2), /* 0001 0110 ... */ - /* 000 */ V(7, 3, 2), /* 248 */ + /* 000 */ V(7, 3, 2), /* 248 */ /* 001 */ V(7, 3, 2), /* 010 */ V(6, 5, 3), /* 011 */ V(4, 6, 3), @@ -2322,7 +2322,7 @@ union huffpair const hufftab16[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(7, 2, 2), /* 0001 0111 ... */ - /* 000 */ V(6, 4, 3), /* 256 */ + /* 000 */ V(6, 4, 3), /* 256 */ /* 001 */ V(5, 5, 3), /* 010 */ V(0, 7, 2), /* 011 */ V(0, 7, 2), @@ -2332,59 +2332,59 @@ union huffpair const hufftab16[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(1, 7, 1), /* 0001 1000 ... */ - /* 00 */ V(7, 1, 1), /* 264 */ + /* 00 */ V(7, 1, 1), /* 264 */ /* 01 */ V(7, 1, 1), /* 10 */ V(7, 0, 2), /* 11 */ V(3, 6, 2), /* 0001 1001 ... */ - /* 00 */ V(6, 3, 2), /* 268 */ + /* 00 */ V(6, 3, 2), /* 268 */ /* 01 */ V(4, 5, 2), /* 10 */ V(5, 4, 2), /* 11 */ V(2, 6, 2), /* 0001 1010 ... */ - /* 0 */ V(6, 2, 1), /* 272 */ + /* 0 */ V(6, 2, 1), /* 272 */ /* 1 */ V(1, 6, 1), /* 0001 1011 ... */ - /* 00 */ V(6, 1, 1), /* 274 */ + /* 00 */ V(6, 1, 1), /* 274 */ /* 01 */ V(6, 1, 1), /* 10 */ V(0, 6, 2), /* 11 */ V(6, 0, 2), /* 0001 1100 ... */ - /* 00 */ V(5, 3, 1), /* 278 */ + /* 00 */ V(5, 3, 1), /* 278 */ /* 01 */ V(5, 3, 1), /* 10 */ V(3, 5, 2), /* 11 */ V(4, 4, 2), /* 0001 1101 ... */ - /* 0 */ V(2, 5, 1), /* 282 */ + /* 0 */ V(2, 5, 1), /* 282 */ /* 1 */ V(5, 2, 1), /* 0001 1111 ... */ - /* 0 */ V(1, 5, 1), /* 284 */ + /* 0 */ V(1, 5, 1), /* 284 */ /* 1 */ V(0, 5, 1), /* 0010 0000 ... */ - /* 0 */ V(3, 4, 1), /* 286 */ + /* 0 */ V(3, 4, 1), /* 286 */ /* 1 */ V(4, 3, 1), /* 0010 0001 ... */ - /* 0 */ V(5, 0, 1), /* 288 */ + /* 0 */ V(5, 0, 1), /* 288 */ /* 1 */ V(2, 4, 1), /* 0010 0010 ... */ - /* 0 */ V(4, 2, 1), /* 290 */ + /* 0 */ V(4, 2, 1), /* 290 */ /* 1 */ V(3, 3, 1), /* 0010 0101 ... */ - /* 0 */ V(0, 4, 1), /* 292 */ + /* 0 */ V(0, 4, 1), /* 292 */ /* 1 */ V(4, 0, 1), /* 0000 0110 1100 ... */ - /* 0000 */ V(12, 14, 4), /* 294 */ + /* 0000 */ V(12, 14, 4), /* 294 */ /* 0001 */ PTR(400, 1), /* 0010 */ V(13, 14, 3), /* 0011 */ V(13, 14, 3), @@ -2402,7 +2402,7 @@ union huffpair const hufftab16[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(14, 11, 3), /* 0000 0110 1101 ... */ - /* 000 */ V(11, 14, 2), /* 310 */ + /* 000 */ V(11, 14, 2), /* 310 */ /* 001 */ V(11, 14, 2), /* 010 */ V(12, 13, 2), /* 011 */ V(12, 13, 2), @@ -2412,7 +2412,7 @@ union huffpair const hufftab16[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(10, 14, 2), /* 0000 0110 1110 ... */ - /* 000 */ V(12, 12, 2), /* 318 */ + /* 000 */ V(12, 12, 2), /* 318 */ /* 001 */ V(12, 12, 2), /* 010 */ V(10, 13, 3), /* 011 */ V(13, 10, 3), @@ -2422,7 +2422,7 @@ union huffpair const hufftab16[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(12, 10, 2), /* 0000 0110 1111 ... */ - /* 000 */ V(12, 9, 3), /* 326 */ + /* 000 */ V(12, 9, 3), /* 326 */ /* 001 */ V(7, 13, 3), /* 010 */ V(5, 14, 2), /* 011 */ V(5, 14, 2), @@ -2432,121 +2432,121 @@ union huffpair const hufftab16[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(11, 13, 1), /* 0000 1011 0000 ... */ - /* 00 */ V(9, 14, 1), /* 334 */ + /* 00 */ V(9, 14, 1), /* 334 */ /* 01 */ V(9, 14, 1), /* 10 */ V(11, 12, 2), /* 11 */ V(12, 11, 2), /* 0000 1011 0001 ... */ - /* 00 */ V(8, 14, 2), /* 338 */ + /* 00 */ V(8, 14, 2), /* 338 */ /* 01 */ V(14, 8, 2), /* 10 */ V(9, 13, 2), /* 11 */ V(14, 7, 2), /* 0000 1011 0010 ... */ - /* 00 */ V(11, 11, 2), /* 342 */ + /* 00 */ V(11, 11, 2), /* 342 */ /* 01 */ V(8, 13, 2), /* 10 */ V(13, 8, 2), /* 11 */ V(6, 14, 2), /* 0000 1011 0011 ... */ - /* 0 */ V(14, 6, 1), /* 346 */ + /* 0 */ V(14, 6, 1), /* 346 */ /* 1 */ V(9, 12, 1), /* 0000 1011 0100 ... */ - /* 00 */ V(10, 11, 2), /* 348 */ + /* 00 */ V(10, 11, 2), /* 348 */ /* 01 */ V(11, 10, 2), /* 10 */ V(14, 5, 2), /* 11 */ V(13, 7, 2), /* 0000 1011 0101 ... */ - /* 00 */ V(4, 14, 1), /* 352 */ + /* 00 */ V(4, 14, 1), /* 352 */ /* 01 */ V(4, 14, 1), /* 10 */ V(14, 4, 2), /* 11 */ V(8, 12, 2), /* 0000 1011 0110 ... */ - /* 0 */ V(12, 8, 1), /* 356 */ + /* 0 */ V(12, 8, 1), /* 356 */ /* 1 */ V(3, 14, 1), /* 0000 1011 0111 ... */ - /* 00 */ V(6, 13, 1), /* 358 */ + /* 00 */ V(6, 13, 1), /* 358 */ /* 01 */ V(6, 13, 1), /* 10 */ V(13, 6, 2), /* 11 */ V(9, 11, 2), /* 0000 1011 1000 ... */ - /* 00 */ V(11, 9, 2), /* 362 */ + /* 00 */ V(11, 9, 2), /* 362 */ /* 01 */ V(10, 10, 2), /* 10 */ V(14, 1, 1), /* 11 */ V(14, 1, 1), /* 0000 1011 1001 ... */ - /* 00 */ V(13, 4, 1), /* 366 */ + /* 00 */ V(13, 4, 1), /* 366 */ /* 01 */ V(13, 4, 1), /* 10 */ V(11, 8, 2), /* 11 */ V(10, 9, 2), /* 0000 1011 1010 ... */ - /* 00 */ V(7, 11, 1), /* 370 */ + /* 00 */ V(7, 11, 1), /* 370 */ /* 01 */ V(7, 11, 1), /* 10 */ V(11, 7, 2), /* 11 */ V(13, 0, 2), /* 0000 1011 1100 ... */ - /* 0 */ V(0, 14, 1), /* 374 */ + /* 0 */ V(0, 14, 1), /* 374 */ /* 1 */ V(14, 0, 1), /* 0000 1011 1101 ... */ - /* 0 */ V(5, 13, 1), /* 376 */ + /* 0 */ V(5, 13, 1), /* 376 */ /* 1 */ V(13, 5, 1), /* 0000 1011 1110 ... */ - /* 0 */ V(7, 12, 1), /* 378 */ + /* 0 */ V(7, 12, 1), /* 378 */ /* 1 */ V(12, 7, 1), /* 0000 1011 1111 ... */ - /* 0 */ V(4, 13, 1), /* 380 */ + /* 0 */ V(4, 13, 1), /* 380 */ /* 1 */ V(8, 11, 1), /* 0000 1100 0000 ... */ - /* 0 */ V(9, 10, 1), /* 382 */ + /* 0 */ V(9, 10, 1), /* 382 */ /* 1 */ V(6, 12, 1), /* 0000 1100 0001 ... */ - /* 0 */ V(12, 6, 1), /* 384 */ + /* 0 */ V(12, 6, 1), /* 384 */ /* 1 */ V(3, 13, 1), /* 0000 1100 0010 ... */ - /* 0 */ V(5, 12, 1), /* 386 */ + /* 0 */ V(5, 12, 1), /* 386 */ /* 1 */ V(12, 5, 1), /* 0000 1100 0100 ... */ - /* 0 */ V(8, 10, 1), /* 388 */ + /* 0 */ V(8, 10, 1), /* 388 */ /* 1 */ V(10, 8, 1), /* 0000 1100 0101 ... */ - /* 0 */ V(9, 9, 1), /* 390 */ + /* 0 */ V(9, 9, 1), /* 390 */ /* 1 */ V(4, 12, 1), /* 0000 1100 0110 ... */ - /* 0 */ V(11, 6, 1), /* 392 */ + /* 0 */ V(11, 6, 1), /* 392 */ /* 1 */ V(7, 10, 1), /* 0000 1100 1000 ... */ - /* 0 */ V(5, 11, 1), /* 394 */ + /* 0 */ V(5, 11, 1), /* 394 */ /* 1 */ V(8, 9, 1), /* 0000 1100 1011 ... */ - /* 0 */ V(9, 8, 1), /* 396 */ + /* 0 */ V(9, 8, 1), /* 396 */ /* 1 */ V(7, 9, 1), /* 0000 1101 0101 ... */ - /* 0 */ V(9, 7, 1), /* 398 */ + /* 0 */ V(9, 7, 1), /* 398 */ /* 1 */ V(8, 8, 1), /* 0000 0110 1100 0001 ... */ - /* 0 */ V(14, 12, 1), /* 400 */ + /* 0 */ V(14, 12, 1), /* 400 */ /* 1 */ V(13, 13, 1) }; @@ -2570,7 +2570,7 @@ union huffpair const hufftab24[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(0, 0, 4), /* 0000 ... */ - /* 0000 */ V(14, 15, 4), /* 16 */ + /* 0000 */ V(14, 15, 4), /* 16 */ /* 0001 */ V(15, 14, 4), /* 0010 */ V(13, 15, 4), /* 0011 */ V(15, 13, 4), @@ -2588,7 +2588,7 @@ union huffpair const hufftab24[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(15, 8, 3), /* 0001 ... */ - /* 0000 */ V(8, 15, 4), /* 32 */ + /* 0000 */ V(8, 15, 4), /* 32 */ /* 0001 */ V(7, 15, 4), /* 0010 */ V(15, 7, 3), /* 0011 */ V(15, 7, 3), @@ -2606,7 +2606,7 @@ union huffpair const hufftab24[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(15, 4, 3), /* 0010 ... */ - /* 0000 */ V(3, 15, 3), /* 48 */ + /* 0000 */ V(3, 15, 3), /* 48 */ /* 0001 */ V(3, 15, 3), /* 0010 */ V(15, 3, 3), /* 0011 */ V(15, 3, 3), @@ -2624,7 +2624,7 @@ union huffpair const hufftab24[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ PTR(196, 3), /* 0100 ... */ - /* 0000 */ PTR(204, 4), /* 64 */ + /* 0000 */ PTR(204, 4), /* 64 */ /* 0001 */ PTR(220, 3), /* 0010 */ PTR(228, 3), /* 0011 */ PTR(236, 3), @@ -2642,7 +2642,7 @@ union huffpair const hufftab24[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ PTR(292, 2), /* 0101 ... */ - /* 0000 */ PTR(296, 2), /* 80 */ + /* 0000 */ PTR(296, 2), /* 80 */ /* 0001 */ PTR(300, 3), /* 0010 */ PTR(308, 2), /* 0011 */ PTR(312, 3), @@ -2660,7 +2660,7 @@ union huffpair const hufftab24[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ PTR(348, 1), /* 0110 ... */ - /* 0000 */ PTR(350, 1), /* 96 */ + /* 0000 */ PTR(350, 1), /* 96 */ /* 0001 */ PTR(352, 1), /* 0010 */ PTR(354, 1), /* 0011 */ PTR(356, 1), @@ -2678,7 +2678,7 @@ union huffpair const hufftab24[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(7, 2, 4), /* 0111 ... */ - /* 0000 */ V(4, 6, 4), /* 112 */ + /* 0000 */ V(4, 6, 4), /* 112 */ /* 0001 */ V(6, 4, 4), /* 0010 */ V(5, 5, 4), /* 0011 */ V(7, 1, 4), @@ -2696,7 +2696,7 @@ union huffpair const hufftab24[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(4, 4, 4), /* 1000 ... */ - /* 0000 */ V(2, 5, 4), /* 128 */ + /* 0000 */ V(2, 5, 4), /* 128 */ /* 0001 */ V(5, 2, 4), /* 0010 */ V(1, 5, 4), /* 0011 */ PTR(384, 1), @@ -2714,7 +2714,7 @@ union huffpair const hufftab24[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(1, 4, 3), /* 1001 ... */ - /* 0000 */ V(4, 1, 3), /* 144 */ + /* 0000 */ V(4, 1, 3), /* 144 */ /* 0001 */ V(4, 1, 3), /* 0010 */ V(0, 4, 4), /* 0011 */ V(4, 0, 4), @@ -2732,7 +2732,7 @@ union huffpair const hufftab24[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(3, 1, 2), /* 1010 ... */ - /* 000 */ V(0, 3, 3), /* 160 */ + /* 000 */ V(0, 3, 3), /* 160 */ /* 001 */ V(3, 0, 3), /* 010 */ V(2, 2, 2), /* 011 */ V(2, 2, 2), @@ -2742,13 +2742,13 @@ union huffpair const hufftab24[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(1, 2, 1), /* 1011 ... */ - /* 00 */ V(2, 1, 1), /* 168 */ + /* 00 */ V(2, 1, 1), /* 168 */ /* 01 */ V(2, 1, 1), /* 10 */ V(0, 2, 2), /* 11 */ V(2, 0, 2), /* 0010 1100 ... */ - /* 000 */ V(0, 15, 1), /* 172 */ + /* 000 */ V(0, 15, 1), /* 172 */ /* 001 */ V(0, 15, 1), /* 010 */ V(0, 15, 1), /* 011 */ V(0, 15, 1), @@ -2758,7 +2758,7 @@ union huffpair const hufftab24[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(12, 14, 3), /* 0010 1101 ... */ - /* 000 */ V(14, 12, 3), /* 180 */ + /* 000 */ V(14, 12, 3), /* 180 */ /* 001 */ V(13, 13, 3), /* 010 */ V(11, 14, 3), /* 011 */ V(14, 11, 3), @@ -2768,7 +2768,7 @@ union huffpair const hufftab24[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(14, 10, 3), /* 0010 1110 ... */ - /* 000 */ V(11, 13, 3), /* 188 */ + /* 000 */ V(11, 13, 3), /* 188 */ /* 001 */ V(13, 11, 3), /* 010 */ V(12, 12, 3), /* 011 */ V(9, 14, 3), @@ -2778,7 +2778,7 @@ union huffpair const hufftab24[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(11, 12, 3), /* 0010 1111 ... */ - /* 000 */ V(12, 11, 3), /* 196 */ + /* 000 */ V(12, 11, 3), /* 196 */ /* 001 */ V(8, 14, 3), /* 010 */ V(14, 8, 3), /* 011 */ V(9, 13, 3), @@ -2788,7 +2788,7 @@ union huffpair const hufftab24[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(10, 12, 3), /* 0100 0000 ... */ - /* 0000 */ V(12, 10, 3), /* 204 */ + /* 0000 */ V(12, 10, 3), /* 204 */ /* 0001 */ V(12, 10, 3), /* 0010 */ V(11, 11, 3), /* 0011 */ V(11, 11, 3), @@ -2806,7 +2806,7 @@ union huffpair const hufftab24[] ICONST_ATTR_MPA_HUFFMAN = { /* 1111 */ V(14, 6, 2), /* 0100 0001 ... */ - /* 000 */ V(6, 14, 3), /* 220 */ + /* 000 */ V(6, 14, 3), /* 220 */ /* 001 */ V(9, 12, 3), /* 010 */ V(12, 9, 2), /* 011 */ V(12, 9, 2), @@ -2816,7 +2816,7 @@ union huffpair const hufftab24[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(11, 10, 2), /* 0100 0010 ... */ - /* 000 */ V(14, 5, 2), /* 228 */ + /* 000 */ V(14, 5, 2), /* 228 */ /* 001 */ V(14, 5, 2), /* 010 */ V(10, 11, 3), /* 011 */ V(7, 13, 3), @@ -2826,7 +2826,7 @@ union huffpair const hufftab24[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(14, 4, 2), /* 0100 0011 ... */ - /* 000 */ V(8, 12, 2), /* 236 */ + /* 000 */ V(8, 12, 2), /* 236 */ /* 001 */ V(8, 12, 2), /* 010 */ V(12, 8, 2), /* 011 */ V(12, 8, 2), @@ -2836,61 +2836,61 @@ union huffpair const hufftab24[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(3, 14, 2), /* 0100 0100 ... */ - /* 00 */ V(6, 13, 2), /* 244 */ + /* 00 */ V(6, 13, 2), /* 244 */ /* 01 */ V(13, 6, 2), /* 10 */ V(14, 3, 2), /* 11 */ V(9, 11, 2), /* 0100 0101 ... */ - /* 00 */ V(11, 9, 2), /* 248 */ + /* 00 */ V(11, 9, 2), /* 248 */ /* 01 */ V(10, 10, 2), /* 10 */ V(14, 2, 2), /* 11 */ V(1, 14, 2), /* 0100 0110 ... */ - /* 00 */ V(14, 1, 2), /* 252 */ + /* 00 */ V(14, 1, 2), /* 252 */ /* 01 */ V(5, 13, 2), /* 10 */ V(13, 5, 2), /* 11 */ V(7, 12, 2), /* 0100 0111 ... */ - /* 00 */ V(12, 7, 2), /* 256 */ + /* 00 */ V(12, 7, 2), /* 256 */ /* 01 */ V(4, 13, 2), /* 10 */ V(8, 11, 2), /* 11 */ V(11, 8, 2), /* 0100 1000 ... */ - /* 00 */ V(13, 4, 2), /* 260 */ + /* 00 */ V(13, 4, 2), /* 260 */ /* 01 */ V(9, 10, 2), /* 10 */ V(10, 9, 2), /* 11 */ V(6, 12, 2), /* 0100 1001 ... */ - /* 00 */ V(12, 6, 2), /* 264 */ + /* 00 */ V(12, 6, 2), /* 264 */ /* 01 */ V(3, 13, 2), /* 10 */ V(13, 3, 2), /* 11 */ V(2, 13, 2), /* 0100 1010 ... */ - /* 00 */ V(13, 2, 2), /* 268 */ + /* 00 */ V(13, 2, 2), /* 268 */ /* 01 */ V(1, 13, 2), /* 10 */ V(7, 11, 2), /* 11 */ V(11, 7, 2), /* 0100 1011 ... */ - /* 00 */ V(13, 1, 2), /* 272 */ + /* 00 */ V(13, 1, 2), /* 272 */ /* 01 */ V(5, 12, 2), /* 10 */ V(12, 5, 2), /* 11 */ V(8, 10, 2), /* 0100 1100 ... */ - /* 00 */ V(10, 8, 2), /* 276 */ + /* 00 */ V(10, 8, 2), /* 276 */ /* 01 */ V(9, 9, 2), /* 10 */ V(4, 12, 2), /* 11 */ V(12, 4, 2), /* 0100 1101 ... */ - /* 000 */ V(6, 11, 2), /* 280 */ + /* 000 */ V(6, 11, 2), /* 280 */ /* 001 */ V(6, 11, 2), /* 010 */ V(11, 6, 2), /* 011 */ V(11, 6, 2), @@ -2900,25 +2900,25 @@ union huffpair const hufftab24[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(3, 12, 2), /* 0100 1110 ... */ - /* 00 */ V(12, 3, 2), /* 288 */ + /* 00 */ V(12, 3, 2), /* 288 */ /* 01 */ V(7, 10, 2), /* 10 */ V(10, 7, 2), /* 11 */ V(2, 12, 2), /* 0100 1111 ... */ - /* 00 */ V(12, 2, 2), /* 292 */ + /* 00 */ V(12, 2, 2), /* 292 */ /* 01 */ V(5, 11, 2), /* 10 */ V(11, 5, 2), /* 11 */ V(1, 12, 2), /* 0101 0000 ... */ - /* 00 */ V(8, 9, 2), /* 296 */ + /* 00 */ V(8, 9, 2), /* 296 */ /* 01 */ V(9, 8, 2), /* 10 */ V(12, 1, 2), /* 11 */ V(4, 11, 2), /* 0101 0001 ... */ - /* 000 */ V(12, 0, 3), /* 300 */ + /* 000 */ V(12, 0, 3), /* 300 */ /* 001 */ V(0, 11, 3), /* 010 */ V(3, 11, 2), /* 011 */ V(3, 11, 2), @@ -2928,13 +2928,13 @@ union huffpair const hufftab24[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(1, 10, 2), /* 0101 0010 ... */ - /* 00 */ V(11, 4, 1), /* 308 */ + /* 00 */ V(11, 4, 1), /* 308 */ /* 01 */ V(11, 4, 1), /* 10 */ V(6, 10, 2), /* 11 */ V(10, 6, 2), /* 0101 0011 ... */ - /* 000 */ V(7, 9, 2), /* 312 */ + /* 000 */ V(7, 9, 2), /* 312 */ /* 001 */ V(7, 9, 2), /* 010 */ V(9, 7, 2), /* 011 */ V(9, 7, 2), @@ -2944,125 +2944,125 @@ union huffpair const hufftab24[] ICONST_ATTR_MPA_HUFFMAN = { /* 111 */ V(9, 0, 2), /* 0101 0100 ... */ - /* 0 */ V(11, 3, 1), /* 320 */ + /* 0 */ V(11, 3, 1), /* 320 */ /* 1 */ V(8, 8, 1), /* 0101 0101 ... */ - /* 00 */ V(2, 11, 2), /* 322 */ + /* 00 */ V(2, 11, 2), /* 322 */ /* 01 */ V(5, 10, 2), /* 10 */ V(11, 2, 1), /* 11 */ V(11, 2, 1), /* 0101 0110 ... */ - /* 00 */ V(10, 5, 2), /* 326 */ + /* 00 */ V(10, 5, 2), /* 326 */ /* 01 */ V(1, 11, 2), /* 10 */ V(11, 1, 2), /* 11 */ V(6, 9, 2), /* 0101 0111 ... */ - /* 0 */ V(9, 6, 1), /* 330 */ + /* 0 */ V(9, 6, 1), /* 330 */ /* 1 */ V(10, 4, 1), /* 0101 1000 ... */ - /* 00 */ V(4, 10, 2), /* 332 */ + /* 00 */ V(4, 10, 2), /* 332 */ /* 01 */ V(7, 8, 2), /* 10 */ V(8, 7, 1), /* 11 */ V(8, 7, 1), /* 0101 1001 ... */ - /* 0 */ V(3, 10, 1), /* 336 */ + /* 0 */ V(3, 10, 1), /* 336 */ /* 1 */ V(10, 3, 1), /* 0101 1010 ... */ - /* 0 */ V(5, 9, 1), /* 338 */ + /* 0 */ V(5, 9, 1), /* 338 */ /* 1 */ V(9, 5, 1), /* 0101 1011 ... */ - /* 0 */ V(2, 10, 1), /* 340 */ + /* 0 */ V(2, 10, 1), /* 340 */ /* 1 */ V(10, 2, 1), /* 0101 1100 ... */ - /* 0 */ V(10, 1, 1), /* 342 */ + /* 0 */ V(10, 1, 1), /* 342 */ /* 1 */ V(6, 8, 1), /* 0101 1101 ... */ - /* 0 */ V(8, 6, 1), /* 344 */ + /* 0 */ V(8, 6, 1), /* 344 */ /* 1 */ V(7, 7, 1), /* 0101 1110 ... */ - /* 0 */ V(4, 9, 1), /* 346 */ + /* 0 */ V(4, 9, 1), /* 346 */ /* 1 */ V(9, 4, 1), /* 0101 1111 ... */ - /* 0 */ V(3, 9, 1), /* 348 */ + /* 0 */ V(3, 9, 1), /* 348 */ /* 1 */ V(9, 3, 1), /* 0110 0000 ... */ - /* 0 */ V(5, 8, 1), /* 350 */ + /* 0 */ V(5, 8, 1), /* 350 */ /* 1 */ V(8, 5, 1), /* 0110 0001 ... */ - /* 0 */ V(2, 9, 1), /* 352 */ + /* 0 */ V(2, 9, 1), /* 352 */ /* 1 */ V(6, 7, 1), /* 0110 0010 ... */ - /* 0 */ V(7, 6, 1), /* 354 */ + /* 0 */ V(7, 6, 1), /* 354 */ /* 1 */ V(9, 2, 1), /* 0110 0011 ... */ - /* 0 */ V(1, 9, 1), /* 356 */ + /* 0 */ V(1, 9, 1), /* 356 */ /* 1 */ V(9, 1, 1), /* 0110 0100 ... */ - /* 0 */ V(4, 8, 1), /* 358 */ + /* 0 */ V(4, 8, 1), /* 358 */ /* 1 */ V(8, 4, 1), /* 0110 0101 ... */ - /* 0 */ V(5, 7, 1), /* 360 */ + /* 0 */ V(5, 7, 1), /* 360 */ /* 1 */ V(7, 5, 1), /* 0110 0110 ... */ - /* 0 */ V(3, 8, 1), /* 362 */ + /* 0 */ V(3, 8, 1), /* 362 */ /* 1 */ V(8, 3, 1), /* 0110 0111 ... */ - /* 0 */ V(6, 6, 1), /* 364 */ + /* 0 */ V(6, 6, 1), /* 364 */ /* 1 */ V(2, 8, 1), /* 0110 1000 ... */ - /* 0 */ V(8, 2, 1), /* 366 */ + /* 0 */ V(8, 2, 1), /* 366 */ /* 1 */ V(1, 8, 1), /* 0110 1001 ... */ - /* 0 */ V(4, 7, 1), /* 368 */ + /* 0 */ V(4, 7, 1), /* 368 */ /* 1 */ V(7, 4, 1), /* 0110 1010 ... */ - /* 00 */ V(8, 1, 1), /* 370 */ + /* 00 */ V(8, 1, 1), /* 370 */ /* 01 */ V(8, 1, 1), /* 10 */ V(0, 8, 2), /* 11 */ V(8, 0, 2), /* 0110 1011 ... */ - /* 0 */ V(5, 6, 1), /* 374 */ + /* 0 */ V(5, 6, 1), /* 374 */ /* 1 */ V(6, 5, 1), /* 0110 1100 ... */ - /* 00 */ V(1, 7, 1), /* 376 */ + /* 00 */ V(1, 7, 1), /* 376 */ /* 01 */ V(1, 7, 1), /* 10 */ V(0, 7, 2), /* 11 */ V(7, 0, 2), /* 0110 1110 ... */ - /* 0 */ V(3, 7, 1), /* 380 */ + /* 0 */ V(3, 7, 1), /* 380 */ /* 1 */ V(2, 7, 1), /* 0111 1100 ... */ - /* 0 */ V(0, 6, 1), /* 382 */ + /* 0 */ V(0, 6, 1), /* 382 */ /* 1 */ V(6, 0, 1), /* 1000 0011 ... */ - /* 0 */ V(0, 5, 1), /* 384 */ + /* 0 */ V(0, 5, 1), /* 384 */ /* 1 */ V(5, 0, 1) }; diff --git a/apps/codecs/libmad/layer12.c b/apps/codecs/libmad/layer12.c index ccac392b42..d294266e69 100644 --- a/apps/codecs/libmad/layer12.c +++ b/apps/codecs/libmad/layer12.c @@ -69,8 +69,8 @@ mad_fixed_t const linear_table[14] ICONST_ATTR = { }; /* - * NAME: I_sample() - * DESCRIPTION: decode one requantized Layer I sample from a bitstream + * NAME: I_sample() + * DESCRIPTION: decode one requantized Layer I sample from a bitstream */ static inline mad_fixed_t I_sample(struct mad_bitptr *ptr, unsigned int nb) @@ -99,8 +99,8 @@ mad_fixed_t I_sample(struct mad_bitptr *ptr, unsigned int nb) } /* - * NAME: layer->I() - * DESCRIPTION: decode a single Layer I frame + * NAME: layer->I() + * DESCRIPTION: decode a single Layer I frame */ int mad_layer_I(struct mad_stream *stream, struct mad_frame *frame) { @@ -121,10 +121,10 @@ int mad_layer_I(struct mad_stream *stream, struct mad_frame *frame) if (header->flags & MAD_FLAG_PROTECTION) { header->crc_check = mad_bit_crc(stream->ptr, 4 * (bound * nch + (32 - bound)), - header->crc_check); + header->crc_check); if (header->crc_check != header->crc_target && - !(frame->options & MAD_OPTION_IGNORECRC)) { + !(frame->options & MAD_OPTION_IGNORECRC)) { stream->error = MAD_ERROR_BADCRC; return -1; } @@ -137,8 +137,8 @@ int mad_layer_I(struct mad_stream *stream, struct mad_frame *frame) nb = mad_bit_read(&stream->ptr, 4); if (nb == 15) { - stream->error = MAD_ERROR_BADBITALLOC; - return -1; + stream->error = MAD_ERROR_BADBITALLOC; + return -1; } allocation[ch][sb] = nb ? nb + 1 : 0; @@ -162,18 +162,18 @@ int mad_layer_I(struct mad_stream *stream, struct mad_frame *frame) for (sb = 0; sb < 32; ++sb) { for (ch = 0; ch < nch; ++ch) { if (allocation[ch][sb]) { - scalefactor[ch][sb] = mad_bit_read(&stream->ptr, 6); + scalefactor[ch][sb] = mad_bit_read(&stream->ptr, 6); # if defined(OPT_STRICT) - /* - * Scalefactor index 63 does not appear in Table B.1 of - * ISO/IEC 11172-3. Nonetheless, other implementations accept it, - * so we only reject it if OPT_STRICT is defined. - */ - if (scalefactor[ch][sb] == 63) { - stream->error = MAD_ERROR_BADSCALEFACTOR; - return -1; - } + /* + * Scalefactor index 63 does not appear in Table B.1 of + * ISO/IEC 11172-3. Nonetheless, other implementations accept it, + * so we only reject it if OPT_STRICT is defined. + */ + if (scalefactor[ch][sb] == 63) { + stream->error = MAD_ERROR_BADSCALEFACTOR; + return -1; + } # endif } } @@ -184,27 +184,27 @@ int mad_layer_I(struct mad_stream *stream, struct mad_frame *frame) for (s = 0; s < 12; ++s) { for (sb = 0; sb < bound; ++sb) { for (ch = 0; ch < nch; ++ch) { - nb = allocation[ch][sb]; - (*frame->sbsample)[ch][s][sb] = nb ? - mad_f_mul(I_sample(&stream->ptr, nb), - sf_table[scalefactor[ch][sb]]) : 0; + nb = allocation[ch][sb]; + (*frame->sbsample)[ch][s][sb] = nb ? + mad_f_mul(I_sample(&stream->ptr, nb), + sf_table[scalefactor[ch][sb]]) : 0; } } for (sb = bound; sb < 32; ++sb) { if ((nb = allocation[0][sb])) { - mad_fixed_t sample; + mad_fixed_t sample; - sample = I_sample(&stream->ptr, nb); + sample = I_sample(&stream->ptr, nb); - for (ch = 0; ch < nch; ++ch) { - (*frame->sbsample)[ch][s][sb] = - mad_f_mul(sample, sf_table[scalefactor[ch][sb]]); - } + for (ch = 0; ch < nch; ++ch) { + (*frame->sbsample)[ch][s][sb] = + mad_f_mul(sample, sf_table[scalefactor[ch][sb]]); + } } else { - for (ch = 0; ch < nch; ++ch) - (*frame->sbsample)[ch][s][sb] = 0; + for (ch = 0; ch < nch; ++ch) + (*frame->sbsample)[ch][s][sb] = 0; } } } @@ -221,18 +221,18 @@ struct { unsigned char const offsets[30]; } const sbquant_table[5] = { /* ISO/IEC 11172-3 Table B.2a */ - { 27, { 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 3, 3, 3, /* 0 */ - 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0 } }, + { 27, { 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 3, 3, 3, /* 0 */ + 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0 } }, /* ISO/IEC 11172-3 Table B.2b */ - { 30, { 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 3, 3, 3, /* 1 */ - 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0 } }, + { 30, { 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 3, 3, 3, /* 1 */ + 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0 } }, /* ISO/IEC 11172-3 Table B.2c */ - { 8, { 5, 5, 2, 2, 2, 2, 2, 2 } }, /* 2 */ + { 8, { 5, 5, 2, 2, 2, 2, 2, 2 } }, /* 2 */ /* ISO/IEC 11172-3 Table B.2d */ - { 12, { 5, 5, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 } }, /* 3 */ + { 12, { 5, 5, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 } }, /* 3 */ /* ISO/IEC 13818-3 Table B.1 */ - { 30, { 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, /* 4 */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } } + { 30, { 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, /* 4 */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } } }; /* bit allocation table */ @@ -275,13 +275,13 @@ struct quantclass { }; /* - * NAME: II_samples() - * DESCRIPTION: decode three requantized Layer II samples from a bitstream + * NAME: II_samples() + * DESCRIPTION: decode three requantized Layer II samples from a bitstream */ static void II_samples(struct mad_bitptr *ptr, - struct quantclass const *quantclass, - mad_fixed_t output[3]) + struct quantclass const *quantclass, + mad_fixed_t output[3]) { unsigned int nb, s, sample[3]; @@ -326,8 +326,8 @@ void II_samples(struct mad_bitptr *ptr, } /* - * NAME: layer->II() - * DESCRIPTION: decode a single Layer II frame + * NAME: layer->II() + * DESCRIPTION: decode a single Layer II frame */ int mad_layer_II(struct mad_stream *stream, struct mad_frame *frame) { @@ -358,19 +358,19 @@ int mad_layer_II(struct mad_stream *stream, struct mad_frame *frame) * restriction. We enforce it if OPT_STRICT is defined. */ if (bitrate_per_channel <= 28000 || bitrate_per_channel == 40000) { - stream->error = MAD_ERROR_BADMODE; - return -1; + stream->error = MAD_ERROR_BADMODE; + return -1; } # endif } else { /* nch == 1 */ if (bitrate_per_channel > 192000) { - /* - * ISO/IEC 11172-3 does not allow single channel mode for 224, 256, - * 320, or 384 kbps bitrates in Layer II. - */ - stream->error = MAD_ERROR_BADMODE; - return -1; + /* + * ISO/IEC 11172-3 does not allow single channel mode for 224, 256, + * 320, or 384 kbps bitrates in Layer II. + */ + stream->error = MAD_ERROR_BADMODE; + return -1; } } @@ -419,7 +419,7 @@ int mad_layer_II(struct mad_stream *stream, struct mad_frame *frame) for (sb = 0; sb < sblimit; ++sb) { for (ch = 0; ch < nch; ++ch) { if (allocation[ch][sb]) - scfsi[ch][sb] = mad_bit_read(&stream->ptr, 2); + scfsi[ch][sb] = mad_bit_read(&stream->ptr, 2); } } @@ -428,10 +428,10 @@ int mad_layer_II(struct mad_stream *stream, struct mad_frame *frame) if (header->flags & MAD_FLAG_PROTECTION) { header->crc_check = mad_bit_crc(start, mad_bit_length(&start, &stream->ptr), - header->crc_check); + header->crc_check); if (header->crc_check != header->crc_target && - !(frame->options & MAD_OPTION_IGNORECRC)) { + !(frame->options & MAD_OPTION_IGNORECRC)) { stream->error = MAD_ERROR_BADCRC; return -1; } @@ -442,39 +442,39 @@ int mad_layer_II(struct mad_stream *stream, struct mad_frame *frame) for (sb = 0; sb < sblimit; ++sb) { for (ch = 0; ch < nch; ++ch) { if (allocation[ch][sb]) { - scalefactor[ch][sb][0] = mad_bit_read(&stream->ptr, 6); - - switch (scfsi[ch][sb]) { - case 2: - scalefactor[ch][sb][2] = - scalefactor[ch][sb][1] = - scalefactor[ch][sb][0]; - break; - - case 0: - scalefactor[ch][sb][1] = mad_bit_read(&stream->ptr, 6); - /* fall through */ - - case 1: - case 3: - scalefactor[ch][sb][2] = mad_bit_read(&stream->ptr, 6); - } + scalefactor[ch][sb][0] = mad_bit_read(&stream->ptr, 6); + + switch (scfsi[ch][sb]) { + case 2: + scalefactor[ch][sb][2] = + scalefactor[ch][sb][1] = + scalefactor[ch][sb][0]; + break; + + case 0: + scalefactor[ch][sb][1] = mad_bit_read(&stream->ptr, 6); + /* fall through */ + + case 1: + case 3: + scalefactor[ch][sb][2] = mad_bit_read(&stream->ptr, 6); + } - if (scfsi[ch][sb] & 1) - scalefactor[ch][sb][1] = scalefactor[ch][sb][scfsi[ch][sb] - 1]; + if (scfsi[ch][sb] & 1) + scalefactor[ch][sb][1] = scalefactor[ch][sb][scfsi[ch][sb] - 1]; # if defined(OPT_STRICT) - /* - * Scalefactor index 63 does not appear in Table B.1 of - * ISO/IEC 11172-3. Nonetheless, other implementations accept it, - * so we only reject it if OPT_STRICT is defined. - */ - if (scalefactor[ch][sb][0] == 63 || - scalefactor[ch][sb][1] == 63 || - scalefactor[ch][sb][2] == 63) { - stream->error = MAD_ERROR_BADSCALEFACTOR; - return -1; - } + /* + * Scalefactor index 63 does not appear in Table B.1 of + * ISO/IEC 11172-3. Nonetheless, other implementations accept it, + * so we only reject it if OPT_STRICT is defined. + */ + if (scalefactor[ch][sb][0] == 63 || + scalefactor[ch][sb][1] == 63 || + scalefactor[ch][sb][2] == 63) { + stream->error = MAD_ERROR_BADSCALEFACTOR; + return -1; + } # endif } } @@ -485,50 +485,50 @@ int mad_layer_II(struct mad_stream *stream, struct mad_frame *frame) for (gr = 0; gr < 12; ++gr) { for (sb = 0; sb < bound; ++sb) { for (ch = 0; ch < nch; ++ch) { - if ((index = allocation[ch][sb])) { + if ((index = allocation[ch][sb])) { int off = bitalloc_table[offsets[sb]].offset; - index = offset_table[off][index - 1]; - - II_samples(&stream->ptr, &qc_table[index], samples); - - for (s = 0; s < 3; ++s) { - (*frame->sbsample)[ch][3 * gr + s][sb] = - mad_f_mul(samples[s], sf_table[scalefactor[ch][sb][gr / 4]]); - } - } - else { - for (s = 0; s < 3; ++s) - (*frame->sbsample)[ch][3 * gr + s][sb] = 0; - } + index = offset_table[off][index - 1]; + + II_samples(&stream->ptr, &qc_table[index], samples); + + for (s = 0; s < 3; ++s) { + (*frame->sbsample)[ch][3 * gr + s][sb] = + mad_f_mul(samples[s], sf_table[scalefactor[ch][sb][gr / 4]]); + } + } + else { + for (s = 0; s < 3; ++s) + (*frame->sbsample)[ch][3 * gr + s][sb] = 0; + } } } for (sb = bound; sb < sblimit; ++sb) { if ((index = allocation[0][sb])) { int off = bitalloc_table[offsets[sb]].offset; - index = offset_table[off][index - 1]; + index = offset_table[off][index - 1]; - II_samples(&stream->ptr, &qc_table[index], samples); + II_samples(&stream->ptr, &qc_table[index], samples); - for (ch = 0; ch < nch; ++ch) { - for (s = 0; s < 3; ++s) { - (*frame->sbsample)[ch][3 * gr + s][sb] = - mad_f_mul(samples[s], sf_table[scalefactor[ch][sb][gr / 4]]); - } - } + for (ch = 0; ch < nch; ++ch) { + for (s = 0; s < 3; ++s) { + (*frame->sbsample)[ch][3 * gr + s][sb] = + mad_f_mul(samples[s], sf_table[scalefactor[ch][sb][gr / 4]]); + } + } } else { - for (ch = 0; ch < nch; ++ch) { - for (s = 0; s < 3; ++s) - (*frame->sbsample)[ch][3 * gr + s][sb] = 0; - } + for (ch = 0; ch < nch; ++ch) { + for (s = 0; s < 3; ++s) + (*frame->sbsample)[ch][3 * gr + s][sb] = 0; + } } } for (ch = 0; ch < nch; ++ch) { for (s = 0; s < 3; ++s) { - for (sb = sblimit; sb < 32; ++sb) - (*frame->sbsample)[ch][3 * gr + s][sb] = 0; + for (sb = sblimit; sb < 32; ++sb) + (*frame->sbsample)[ch][3 * gr + s][sb] = 0; } } } diff --git a/apps/codecs/libmad/layer3.c b/apps/codecs/libmad/layer3.c index 0a53086d78..2dcdeb96d4 100644 --- a/apps/codecs/libmad/layer3.c +++ b/apps/codecs/libmad/layer3.c @@ -57,7 +57,7 @@ enum { count1table_select = 0x01, scalefac_scale = 0x02, - preflag = 0x04, + preflag = 0x04, mixed_block_flag = 0x08 }; @@ -88,7 +88,7 @@ struct sideinfo { unsigned char region1_count; /* from main_data */ - unsigned char scalefac[39]; /* scalefac_l and/or scalefac_s */ + unsigned char scalefac[39]; /* scalefac_l and/or scalefac_s */ } ch[2]; } gr[2]; }; @@ -502,14 +502,14 @@ mad_fixed_t const is_lsf_table[2][15] = { }; /* - * NAME: III_sideinfo() - * DESCRIPTION: decode frame side information from a bitstream + * NAME: III_sideinfo() + * DESCRIPTION: decode frame side information from a bitstream */ static enum mad_error III_sideinfo(struct mad_bitptr *ptr, unsigned int nch, - int lsf, struct sideinfo *si, - unsigned int *data_bitlen, - unsigned int *priv_bitlen) + int lsf, struct sideinfo *si, + unsigned int *data_bitlen, + unsigned int *priv_bitlen) { unsigned int ngr, gr, ch, i; enum mad_error result = MAD_ERROR_NONE; @@ -542,46 +542,46 @@ enum mad_error III_sideinfo(struct mad_bitptr *ptr, unsigned int nch, *data_bitlen += channel->part2_3_length; if (channel->big_values > 288 && result == 0) - result = MAD_ERROR_BADBIGVALUES; + result = MAD_ERROR_BADBIGVALUES; channel->flags = 0; /* window_switching_flag */ if (mad_bit_read(ptr, 1)) { - channel->block_type = mad_bit_read(ptr, 2); + channel->block_type = mad_bit_read(ptr, 2); - if (channel->block_type == 0 && result == 0) - result = MAD_ERROR_BADBLOCKTYPE; + if (channel->block_type == 0 && result == 0) + result = MAD_ERROR_BADBLOCKTYPE; - if (!lsf && channel->block_type == 2 && si->scfsi[ch] && result == 0) - result = MAD_ERROR_BADSCFSI; + if (!lsf && channel->block_type == 2 && si->scfsi[ch] && result == 0) + result = MAD_ERROR_BADSCFSI; - channel->region0_count = 7; - channel->region1_count = 36; + channel->region0_count = 7; + channel->region1_count = 36; - if (mad_bit_read(ptr, 1)) - channel->flags |= mixed_block_flag; - else if (channel->block_type == 2) - channel->region0_count = 8; + if (mad_bit_read(ptr, 1)) + channel->flags |= mixed_block_flag; + else if (channel->block_type == 2) + channel->region0_count = 8; - for (i = 0; i < 2; ++i) - channel->table_select[i] = mad_bit_read(ptr, 5); + for (i = 0; i < 2; ++i) + channel->table_select[i] = mad_bit_read(ptr, 5); # if defined(DEBUG) - channel->table_select[2] = 4; /* not used */ + channel->table_select[2] = 4; /* not used */ # endif - for (i = 0; i < 3; ++i) - channel->subblock_gain[i] = mad_bit_read(ptr, 3); + for (i = 0; i < 3; ++i) + channel->subblock_gain[i] = mad_bit_read(ptr, 3); } else { - channel->block_type = 0; + channel->block_type = 0; - for (i = 0; i < 3; ++i) - channel->table_select[i] = mad_bit_read(ptr, 5); + for (i = 0; i < 3; ++i) + channel->table_select[i] = mad_bit_read(ptr, 5); - channel->region0_count = mad_bit_read(ptr, 4); - channel->region1_count = mad_bit_read(ptr, 3); + channel->region0_count = mad_bit_read(ptr, 4); + channel->region1_count = mad_bit_read(ptr, 3); } /* [preflag,] scalefac_scale, count1table_select */ @@ -593,13 +593,13 @@ enum mad_error III_sideinfo(struct mad_bitptr *ptr, unsigned int nch, } /* - * NAME: III_scalefactors_lsf() - * DESCRIPTION: decode channel scalefactors for LSF from a bitstream + * NAME: III_scalefactors_lsf() + * DESCRIPTION: decode channel scalefactors for LSF from a bitstream */ static unsigned int III_scalefactors_lsf(struct mad_bitptr *ptr, - struct channel *channel, - struct channel *gr1ch, int mode_extension) + struct channel *channel, + struct channel *gr1ch, int mode_extension) { struct mad_bitptr start; unsigned int scalefac_compress, index, slen[4], part, n, i; @@ -646,7 +646,7 @@ unsigned int III_scalefactors_lsf(struct mad_bitptr *ptr, n = 0; for (part = 0; part < 4; ++part) { for (i = 0; i < nsfb[part]; ++i) - channel->scalefac[n++] = mad_bit_read(ptr, slen[part]); + channel->scalefac[n++] = mad_bit_read(ptr, slen[part]); } while (n < 39) @@ -691,10 +691,10 @@ unsigned int III_scalefactors_lsf(struct mad_bitptr *ptr, max = (1 << slen[part]) - 1; for (i = 0; i < nsfb[part]; ++i) { - is_pos = mad_bit_read(ptr, slen[part]); + is_pos = mad_bit_read(ptr, slen[part]); - channel->scalefac[n] = is_pos; - gr1ch->scalefac[n++] = (is_pos == max); + channel->scalefac[n] = is_pos; + gr1ch->scalefac[n++] = (is_pos == max); } } @@ -708,12 +708,12 @@ unsigned int III_scalefactors_lsf(struct mad_bitptr *ptr, } /* - * NAME: III_scalefactors() - * DESCRIPTION: decode channel scalefactors of one granule from a bitstream + * NAME: III_scalefactors() + * DESCRIPTION: decode channel scalefactors of one granule from a bitstream */ static unsigned int III_scalefactors(struct mad_bitptr *ptr, struct channel *channel, - struct channel const *gr0ch, unsigned int scfsi) + struct channel const *gr0ch, unsigned int scfsi) { struct mad_bitptr start; unsigned int slen1, slen2, sfbi; @@ -743,38 +743,38 @@ unsigned int III_scalefactors(struct mad_bitptr *ptr, struct channel *channel, else { /* channel->block_type != 2 */ if (scfsi & 0x8) { for (sfbi = 0; sfbi < 6; ++sfbi) - channel->scalefac[sfbi] = gr0ch->scalefac[sfbi]; + channel->scalefac[sfbi] = gr0ch->scalefac[sfbi]; } else { for (sfbi = 0; sfbi < 6; ++sfbi) - channel->scalefac[sfbi] = mad_bit_read(ptr, slen1); + channel->scalefac[sfbi] = mad_bit_read(ptr, slen1); } if (scfsi & 0x4) { for (sfbi = 6; sfbi < 11; ++sfbi) - channel->scalefac[sfbi] = gr0ch->scalefac[sfbi]; + channel->scalefac[sfbi] = gr0ch->scalefac[sfbi]; } else { for (sfbi = 6; sfbi < 11; ++sfbi) - channel->scalefac[sfbi] = mad_bit_read(ptr, slen1); + channel->scalefac[sfbi] = mad_bit_read(ptr, slen1); } if (scfsi & 0x2) { for (sfbi = 11; sfbi < 16; ++sfbi) - channel->scalefac[sfbi] = gr0ch->scalefac[sfbi]; + channel->scalefac[sfbi] = gr0ch->scalefac[sfbi]; } else { for (sfbi = 11; sfbi < 16; ++sfbi) - channel->scalefac[sfbi] = mad_bit_read(ptr, slen2); + channel->scalefac[sfbi] = mad_bit_read(ptr, slen2); } if (scfsi & 0x1) { for (sfbi = 16; sfbi < 21; ++sfbi) - channel->scalefac[sfbi] = gr0ch->scalefac[sfbi]; + channel->scalefac[sfbi] = gr0ch->scalefac[sfbi]; } else { for (sfbi = 16; sfbi < 21; ++sfbi) - channel->scalefac[sfbi] = mad_bit_read(ptr, slen2); + channel->scalefac[sfbi] = mad_bit_read(ptr, slen2); } channel->scalefac[21] = 0; @@ -806,12 +806,12 @@ unsigned int III_scalefactors(struct mad_bitptr *ptr, struct channel *channel, */ /* - * NAME: III_exponents() - * DESCRIPTION: calculate scalefactor exponents + * NAME: III_exponents() + * DESCRIPTION: calculate scalefactor exponents */ static void III_exponents(struct channel const *channel, - unsigned char const *sfbwidth, signed int exponents[39]) + unsigned char const *sfbwidth, signed int exponents[39]) { signed int gain; unsigned int scalefac_multiplier, sfbi; @@ -833,11 +833,11 @@ void III_exponents(struct channel const *channel, /* long block subbands 0-1 */ while (l < 36) { - exponents[sfbi] = gain - - (signed int) ((channel->scalefac[sfbi] + (pretab[sfbi] & premask)) << - scalefac_multiplier); + exponents[sfbi] = gain - + (signed int) ((channel->scalefac[sfbi] + (pretab[sfbi] & premask)) << + scalefac_multiplier); - l += sfbwidth[sfbi++]; + l += sfbwidth[sfbi++]; } } @@ -849,11 +849,11 @@ void III_exponents(struct channel const *channel, while (l < 576) { exponents[sfbi + 0] = gain0 - - (signed int) (channel->scalefac[sfbi + 0] << scalefac_multiplier); + (signed int) (channel->scalefac[sfbi + 0] << scalefac_multiplier); exponents[sfbi + 1] = gain1 - - (signed int) (channel->scalefac[sfbi + 1] << scalefac_multiplier); + (signed int) (channel->scalefac[sfbi + 1] << scalefac_multiplier); exponents[sfbi + 2] = gain2 - - (signed int) (channel->scalefac[sfbi + 2] << scalefac_multiplier); + (signed int) (channel->scalefac[sfbi + 2] << scalefac_multiplier); unsigned int w = sfbwidth[sfbi]; l += 3 * w; sfbi += 3; @@ -862,23 +862,23 @@ void III_exponents(struct channel const *channel, else { /* channel->block_type != 2 */ if (channel->flags & preflag) { for (sfbi = 0; sfbi < 22; ++sfbi) { - exponents[sfbi] = gain - - (signed int) ((channel->scalefac[sfbi] + pretab[sfbi]) << - scalefac_multiplier); + exponents[sfbi] = gain - + (signed int) ((channel->scalefac[sfbi] + pretab[sfbi]) << + scalefac_multiplier); } } else { for (sfbi = 0; sfbi < 22; ++sfbi) { - exponents[sfbi] = gain - - (signed int) (channel->scalefac[sfbi] << scalefac_multiplier); + exponents[sfbi] = gain - + (signed int) (channel->scalefac[sfbi] << scalefac_multiplier); } } } } /* - * NAME: III_requantize() - * DESCRIPTION: requantize one (positive) value + * NAME: III_requantize() + * DESCRIPTION: requantize one (positive) value */ static mad_fixed_t III_requantize(unsigned int value, signed int exp) @@ -910,7 +910,7 @@ mad_fixed_t III_requantize(unsigned int value, signed int exp) /* overflow */ # if defined(DEBUG) fprintf(stderr, "requantize overflow (%f * 2^%d)\n", - mad_f_todouble(requantized), exp); + mad_f_todouble(requantized), exp); # endif requantized = MAD_F_MAX; } @@ -932,21 +932,21 @@ mad_fixed_t III_requantize(unsigned int value, signed int exp) res; \ }) #else -# define MASK(cache, sz, bits) \ +# define MASK(cache, sz, bits) \ (((cache) >> ((sz) - (bits))) & ((1 << (bits)) - 1)) #endif # define MASK1BIT(cache, sz) \ ((cache) & (1 << ((sz) - 1))) /* - * NAME: III_huffdecode() - * DESCRIPTION: decode Huffman code words of one channel of one granule + * NAME: III_huffdecode() + * DESCRIPTION: decode Huffman code words of one channel of one granule */ static enum mad_error III_huffdecode(struct mad_bitptr *ptr, mad_fixed_t xrarr[576], - struct channel *channel, - unsigned char const *sfbwidth, - unsigned int part2_length) + struct channel *channel, + unsigned char const *sfbwidth, + unsigned int part2_length) { unsigned int bits; signed int exponents[39], exp; @@ -999,23 +999,23 @@ enum mad_error III_huffdecode(struct mad_bitptr *ptr, mad_fixed_t xrarr[576], else if(region == 0) rcount = channel->region1_count + 1; - else + else rcount = 0; /* all remaining */ - entry = &mad_huff_pair_table[channel->table_select[++region]]; - table = entry->table; - linbits = entry->linbits; - startbits = entry->startbits; + entry = &mad_huff_pair_table[channel->table_select[++region]]; + table = entry->table; + linbits = entry->linbits; + startbits = entry->startbits; - if(table == 0) - return MAD_ERROR_BADHUFFTABLE; + if(table == 0) + return MAD_ERROR_BADHUFFTABLE; } if(exp != *expptr) { - exp = *expptr; + exp = *expptr; /* clear cache */ - memset(reqcache, 0, sizeof(reqcache)); + memset(reqcache, 0, sizeof(reqcache)); } ++expptr; @@ -1052,10 +1052,10 @@ enum mad_error III_huffdecode(struct mad_bitptr *ptr, mad_fixed_t xrarr[576], cachesz -= pair->value.hlen; - /* x (0..14) */ - value = pair->value.x; - if(value == 0) - xr[0] = 0; + /* x (0..14) */ + value = pair->value.x; + if(value == 0) + xr[0] = 0; else { if(value == 15) @@ -1071,24 +1071,24 @@ enum mad_error III_huffdecode(struct mad_bitptr *ptr, mad_fixed_t xrarr[576], cachesz += bits; } - requantized = III_requantize(15+MASK(bitcache, cachesz, linbits), exp); - cachesz -= linbits; + requantized = III_requantize(15+MASK(bitcache, cachesz, linbits), exp); + cachesz -= linbits; } else { - if(reqcache[value]) - requantized = reqcache[value]; - else - requantized = reqcache[value] = III_requantize(value, exp); + if(reqcache[value]) + requantized = reqcache[value]; + else + requantized = reqcache[value] = III_requantize(value, exp); } xr[0] = MASK1BIT(bitcache, cachesz--) ? -requantized : requantized; } - /* y (0..14) */ - value = pair->value.y; - if(value == 0) - xr[1] = 0; + /* y (0..14) */ + value = pair->value.y; + if(value == 0) + xr[1] = 0; else { if(value == 15) @@ -1109,12 +1109,12 @@ enum mad_error III_huffdecode(struct mad_bitptr *ptr, mad_fixed_t xrarr[576], } else { - if(reqcache[value]) - requantized = reqcache[value]; - else - requantized = reqcache[value] = III_requantize(value, exp); + if(reqcache[value]) + requantized = reqcache[value]; + else + requantized = reqcache[value] = III_requantize(value, exp); } - xr[1] = MASK1BIT(bitcache, cachesz--) ? -requantized : requantized; + xr[1] = MASK1BIT(bitcache, cachesz--) ? -requantized : requantized; } } } @@ -1162,32 +1162,32 @@ enum mad_error III_huffdecode(struct mad_bitptr *ptr, mad_fixed_t xrarr[576], cachesz -= pair->value.hlen; - /* x (0..1) */ - value = pair->value.x; - if(value == 0) - xr[0] = 0; - else + /* x (0..1) */ + value = pair->value.x; + if(value == 0) + xr[0] = 0; + else { - if(reqcache[value]) - requantized = reqcache[value]; - else - requantized = reqcache[value] = III_requantize(value, exp); + if(reqcache[value]) + requantized = reqcache[value]; + else + requantized = reqcache[value] = III_requantize(value, exp); - xr[0] = MASK1BIT(bitcache, cachesz--) ? -requantized : requantized; + xr[0] = MASK1BIT(bitcache, cachesz--) ? -requantized : requantized; } - /* y (0..1) */ - value = pair->value.y; - if(value == 0) - xr[1] = 0; - else + /* y (0..1) */ + value = pair->value.y; + if(value == 0) + xr[1] = 0; + else { - if(reqcache[value]) - requantized = reqcache[value]; - else - requantized = reqcache[value] = III_requantize(value, exp); + if(reqcache[value]) + requantized = reqcache[value]; + else + requantized = reqcache[value] = III_requantize(value, exp); - xr[1] = MASK1BIT(bitcache, cachesz--) ? -requantized : requantized; + xr[1] = MASK1BIT(bitcache, cachesz--) ? -requantized : requantized; } } } @@ -1218,9 +1218,9 @@ enum mad_error III_huffdecode(struct mad_bitptr *ptr, mad_fixed_t xrarr[576], if(cachesz < 0) return MAD_ERROR_BADHUFFDATA; /* cache underrun */ - bits = MAXLSHIFT - cachesz; + bits = MAXLSHIFT - cachesz; bitcache = (bitcache << bits) | mad_bit_read(&peek, bits); - cachesz += bits; + cachesz += bits; bits_left -= bits; } @@ -1228,53 +1228,53 @@ enum mad_error III_huffdecode(struct mad_bitptr *ptr, mad_fixed_t xrarr[576], /* quad tables guaranteed to have at most one extra lookup */ if (!quad->final) { - cachesz -= 4; + cachesz -= 4; - quad = &table[quad->ptr.offset + - MASK(bitcache, cachesz, quad->ptr.bits)]; + quad = &table[quad->ptr.offset + + MASK(bitcache, cachesz, quad->ptr.bits)]; } cachesz -= quad->value.hlen; if (xr == sfbound) { - sfbound += *sfbwidth++; + sfbound += *sfbwidth++; - if (exp != *expptr) { - exp = *expptr; - requantized = III_requantize(1, exp); - } + if (exp != *expptr) { + exp = *expptr; + requantized = III_requantize(1, exp); + } - ++expptr; + ++expptr; } /* v (0..1) */ xr[0] = quad->value.v ? - (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0; + (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0; /* w (0..1) */ xr[1] = quad->value.w ? - (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0; + (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0; xr += 2; if (xr == sfbound) { - sfbound += *sfbwidth++; + sfbound += *sfbwidth++; - if (exp != *expptr) { - exp = *expptr; - requantized = III_requantize(1, exp); - } + if (exp != *expptr) { + exp = *expptr; + requantized = III_requantize(1, exp); + } - ++expptr; + ++expptr; } /* x (0..1) */ xr[0] = quad->value.x ? - (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0; + (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0; /* y (0..1) */ xr[1] = quad->value.y ? - (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0; + (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0; xr += 2; } @@ -1282,7 +1282,7 @@ enum mad_error III_huffdecode(struct mad_bitptr *ptr, mad_fixed_t xrarr[576], if(bits_left + cachesz < 0) { /* technically the bitstream is misformatted, but apparently - some encoders are just a bit sloppy with stuffing bits */ + some encoders are just a bit sloppy with stuffing bits */ xr -= 4; } } @@ -1297,12 +1297,12 @@ enum mad_error III_huffdecode(struct mad_bitptr *ptr, mad_fixed_t xrarr[576], # undef MASK1BIT /* - * NAME: III_reorder() - * DESCRIPTION: reorder frequency lines of a short block into subband order + * NAME: III_reorder() + * DESCRIPTION: reorder frequency lines of a short block into subband order */ static void III_reorder(mad_fixed_t xr[576], struct channel const *channel, - unsigned char const sfbwidth[39]) + unsigned char const sfbwidth[39]) { mad_fixed_t tmp[32][3][6]; unsigned int sb, l, f, w, sbw[3], sw[3]; @@ -1345,14 +1345,14 @@ void III_reorder(mad_fixed_t xr[576], struct channel const *channel, } /* - * NAME: III_stereo() - * DESCRIPTION: perform joint stereo processing on a granule + * NAME: III_stereo() + * DESCRIPTION: perform joint stereo processing on a granule */ static enum mad_error III_stereo(mad_fixed_t xr[2][576], - struct granule const *granule, - struct mad_header *header, - unsigned char const *sfbwidth) + struct granule const *granule, + struct mad_header *header, + unsigned char const *sfbwidth) { short modes[39]; unsigned int sfbi, l, n, i; @@ -1385,55 +1385,55 @@ enum mad_error III_stereo(mad_fixed_t xr[2][576], sfbi = l = 0; if (right_ch->flags & mixed_block_flag) { - while (l < 36) { - n = sfbwidth[sfbi++]; + while (l < 36) { + n = sfbwidth[sfbi++]; - for (i = 0; i < n; ++i) { - if (right_xr[i]) { - lower = sfbi; - break; - } - } + for (i = 0; i < n; ++i) { + if (right_xr[i]) { + lower = sfbi; + break; + } + } - right_xr += n; - l += n; - } + right_xr += n; + l += n; + } - start = sfbi; + start = sfbi; } w = 0; while (l < 576) { - n = sfbwidth[sfbi++]; - - for (i = 0; i < n; ++i) { - if (right_xr[i]) { - max = bound[w] = sfbi; - break; - } - } - - right_xr += n; - l += n; - w = (w + 1) % 3; + n = sfbwidth[sfbi++]; + + for (i = 0; i < n; ++i) { + if (right_xr[i]) { + max = bound[w] = sfbi; + break; + } + } + + right_xr += n; + l += n; + w = (w + 1) % 3; } if (max) - lower = start; + lower = start; /* long blocks */ for (i = 0; i < lower; ++i) - modes[i] = header->mode_extension & ~I_STEREO; + modes[i] = header->mode_extension & ~I_STEREO; /* short blocks */ w = 0; for (i = start; i < max; ++i) { - if (i < bound[w]) - modes[i] = header->mode_extension & ~I_STEREO; + if (i < bound[w]) + modes[i] = header->mode_extension & ~I_STEREO; - w = (w + 1) % 3; + w = (w + 1) % 3; } } else { /* right_ch->block_type != 2 */ @@ -1441,20 +1441,20 @@ enum mad_error III_stereo(mad_fixed_t xr[2][576], bound = 0; for (sfbi = l = 0; l < 576; l += n) { - n = sfbwidth[sfbi++]; + n = sfbwidth[sfbi++]; - for (i = 0; i < n; ++i) { - if (right_xr[i]) { - bound = sfbi; - break; - } - } + for (i = 0; i < n; ++i) { + if (right_xr[i]) { + bound = sfbi; + break; + } + } - right_xr += n; + right_xr += n; } for (i = 0; i < bound; ++i) - modes[i] = header->mode_extension & ~I_STEREO; + modes[i] = header->mode_extension & ~I_STEREO; } /* now do the actual processing */ @@ -1467,62 +1467,62 @@ enum mad_error III_stereo(mad_fixed_t xr[2][576], lsf_scale = is_lsf_table[right_ch->scalefac_compress & 0x1]; for (sfbi = l = 0; l < 576; ++sfbi, l += n) { - n = sfbwidth[sfbi]; + n = sfbwidth[sfbi]; - if (!(modes[sfbi] & I_STEREO)) - continue; + if (!(modes[sfbi] & I_STEREO)) + continue; - if (illegal_pos[sfbi]) { - modes[sfbi] &= ~I_STEREO; - continue; - } + if (illegal_pos[sfbi]) { + modes[sfbi] &= ~I_STEREO; + continue; + } - is_pos = right_ch->scalefac[sfbi]; + is_pos = right_ch->scalefac[sfbi]; - for (i = 0; i < n; ++i) { - register mad_fixed_t left; + for (i = 0; i < n; ++i) { + register mad_fixed_t left; - left = xr[0][l + i]; + left = xr[0][l + i]; - if (is_pos == 0) - xr[1][l + i] = left; - else { - register mad_fixed_t opposite; + if (is_pos == 0) + xr[1][l + i] = left; + else { + register mad_fixed_t opposite; - opposite = mad_f_mul(left, lsf_scale[(is_pos - 1) / 2]); + opposite = mad_f_mul(left, lsf_scale[(is_pos - 1) / 2]); - if (is_pos & 1) { - xr[0][l + i] = opposite; - xr[1][l + i] = left; - } - else - xr[1][l + i] = opposite; - } - } + if (is_pos & 1) { + xr[0][l + i] = opposite; + xr[1][l + i] = left; + } + else + xr[1][l + i] = opposite; + } + } } } else { /* !(header->flags & MAD_FLAG_LSF_EXT) */ for (sfbi = l = 0; l < 576; ++sfbi, l += n) { - n = sfbwidth[sfbi]; + n = sfbwidth[sfbi]; - if (!(modes[sfbi] & I_STEREO)) - continue; + if (!(modes[sfbi] & I_STEREO)) + continue; - is_pos = right_ch->scalefac[sfbi]; + is_pos = right_ch->scalefac[sfbi]; - if (is_pos >= 7) { /* illegal intensity position */ - modes[sfbi] &= ~I_STEREO; - continue; - } + if (is_pos >= 7) { /* illegal intensity position */ + modes[sfbi] &= ~I_STEREO; + continue; + } - for (i = 0; i < n; ++i) { - register mad_fixed_t left; + for (i = 0; i < n; ++i) { + register mad_fixed_t left; - left = xr[0][l + i]; + left = xr[0][l + i]; - xr[0][l + i] = mad_f_mul(left, is_table[ is_pos]); - xr[1][l + i] = mad_f_mul(left, is_table[6 - is_pos]); - } + xr[0][l + i] = mad_f_mul(left, is_table[ is_pos]); + xr[1][l + i] = mad_f_mul(left, is_table[6 - is_pos]); + } } } } @@ -1540,16 +1540,16 @@ enum mad_error III_stereo(mad_fixed_t xr[2][576], n = sfbwidth[sfbi]; if (modes[sfbi] != MS_STEREO) - continue; + continue; for (i = 0; i < n; ++i) { - register mad_fixed_t m, s; + register mad_fixed_t m, s; - m = xr[0][l + i]; - s = xr[1][l + i]; + m = xr[0][l + i]; + s = xr[1][l + i]; - xr[0][l + i] = mad_f_mul(m + s, invsqrt2); /* l = (m + s) / sqrt(2) */ - xr[1][l + i] = mad_f_mul(m - s, invsqrt2); /* r = (m - s) / sqrt(2) */ + xr[0][l + i] = mad_f_mul(m + s, invsqrt2); /* l = (m + s) / sqrt(2) */ + xr[1][l + i] = mad_f_mul(m - s, invsqrt2); /* r = (m - s) / sqrt(2) */ } } } @@ -1561,8 +1561,8 @@ enum mad_error III_stereo(mad_fixed_t xr[2][576], void III_aliasreduce(mad_fixed_t xr[576], int lines); #else /* - * NAME: III_aliasreduce() - * DESCRIPTION: perform frequency line alias reduction + * NAME: III_aliasreduce() + * DESCRIPTION: perform frequency line alias reduction */ static void III_aliasreduce(mad_fixed_t xr[576], int lines) @@ -1598,15 +1598,15 @@ void III_aliasreduce(mad_fixed_t xr[576], int lines) xr[-1 - i] = a; xr[ i] = b; # else - MAD_F_ML0(hi, lo, a, cs[i]); - MAD_F_MLA(hi, lo, -b, ca[i]); + MAD_F_ML0(hi, lo, a, cs[i]); + MAD_F_MLA(hi, lo, -b, ca[i]); - xr[-1 - i] = MAD_F_MLZ(hi, lo); + xr[-1 - i] = MAD_F_MLZ(hi, lo); - MAD_F_ML0(hi, lo, b, cs[i]); - MAD_F_MLA(hi, lo, a, ca[i]); + MAD_F_ML0(hi, lo, b, cs[i]); + MAD_F_MLA(hi, lo, a, ca[i]); - xr[ i] = MAD_F_MLZ(hi, lo); + xr[ i] = MAD_F_MLZ(hi, lo); # endif # if defined(ASO_ZEROCHECK) } @@ -1774,8 +1774,8 @@ void dctIV(mad_fixed_t const y[18], mad_fixed_t X[18]) } /* - * NAME: imdct36 - * DESCRIPTION: perform X[18]->x[36] IMDCT using Szu-Wei Lee's fast algorithm + * NAME: imdct36 + * DESCRIPTION: perform X[18]->x[36] IMDCT using Szu-Wei Lee's fast algorithm */ static inline void imdct36(mad_fixed_t const x[18], mad_fixed_t y[36]) @@ -1807,8 +1807,8 @@ void imdct36(mad_fixed_t const x[18], mad_fixed_t y[36]) } # else /* - * NAME: imdct36 - * DESCRIPTION: perform X[18]->x[36] IMDCT + * NAME: imdct36 + * DESCRIPTION: perform X[18]->x[36] IMDCT */ # if defined(CPU_COLDFIRE) @@ -2737,12 +2737,12 @@ void imdct36(mad_fixed_t const X[18], mad_fixed_t x[36]) # endif /* - * NAME: III_imdct_l() - * DESCRIPTION: perform IMDCT and windowing for long blocks + * NAME: III_imdct_l() + * DESCRIPTION: perform IMDCT and windowing for long blocks */ static void III_imdct_l(mad_fixed_t const X[18], mad_fixed_t z[36], - unsigned int block_type) + unsigned int block_type) { unsigned int i; @@ -2762,10 +2762,10 @@ void III_imdct_l(mad_fixed_t const X[18], mad_fixed_t z[36], tmp2 = window_l[1]; for (i = 0; i < 34; i += 2) { - z[i + 0] = mad_f_mul(z[i + 0], tmp1); - tmp1 = window_l[i + 2]; - z[i + 1] = mad_f_mul(z[i + 1], tmp2); - tmp2 = window_l[i + 3]; + z[i + 0] = mad_f_mul(z[i + 0], tmp1); + tmp1 = window_l[i + 2]; + z[i + 1] = mad_f_mul(z[i + 1], tmp2); + tmp2 = window_l[i + 3]; } z[34] = mad_f_mul(z[34], tmp1); @@ -2779,9 +2779,9 @@ void III_imdct_l(mad_fixed_t const X[18], mad_fixed_t z[36], tmp2 = window_l[0]; for (i = 0; i < 35; ++i) { - z[i] = mad_f_mul(tmp1, tmp2); - tmp1 = z[i + 1]; - tmp2 = window_l[i + 1]; + z[i] = mad_f_mul(tmp1, tmp2); + tmp1 = z[i + 1]; + tmp2 = window_l[i + 1]; } z[35] = mad_f_mul(tmp1, tmp2); @@ -2824,8 +2824,8 @@ void III_imdct_l(mad_fixed_t const X[18], mad_fixed_t z[36], # endif /* ASO_IMDCT */ /* - * NAME: III_imdct_s() - * DESCRIPTION: perform IMDCT and windowing for short blocks + * NAME: III_imdct_s() + * DESCRIPTION: perform IMDCT and windowing for short blocks */ # if defined(CPU_COLDFIRE) @@ -2911,16 +2911,16 @@ void III_imdct_s(mad_fixed_t const X[18], mad_fixed_t z[36]) #ifdef CPU_ARM void III_overlap(mad_fixed_t const output[36], mad_fixed_t overlap[18], - mad_fixed_t sample[18][32], unsigned int sb); + mad_fixed_t sample[18][32], unsigned int sb); #else /* - * NAME: III_overlap() - * DESCRIPTION: perform overlap-add of windowed IMDCT outputs + * NAME: III_overlap() + * DESCRIPTION: perform overlap-add of windowed IMDCT outputs */ static void III_overlap(mad_fixed_t const output[36], mad_fixed_t overlap[18], - mad_fixed_t sample[18][32], unsigned int sb) + mad_fixed_t sample[18][32], unsigned int sb) { unsigned int i; @@ -2964,12 +2964,12 @@ void III_overlap(mad_fixed_t const output[36], mad_fixed_t overlap[18], #endif /* - * NAME: III_overlap_z() - * DESCRIPTION: perform "overlap-add" of zero IMDCT outputs + * NAME: III_overlap_z() + * DESCRIPTION: perform "overlap-add" of zero IMDCT outputs */ static inline void III_overlap_z(mad_fixed_t overlap[18], - mad_fixed_t sample[18][32], unsigned int sb) + mad_fixed_t sample[18][32], unsigned int sb) { unsigned int i; @@ -3004,8 +3004,8 @@ void III_overlap_z(mad_fixed_t overlap[18], } /* - * NAME: III_freqinver() - * DESCRIPTION: perform subband frequency inversion for odd sample lines + * NAME: III_freqinver() + * DESCRIPTION: perform subband frequency inversion for odd sample lines */ static void III_freqinver(mad_fixed_t sample[18][32], unsigned int sb) @@ -3038,12 +3038,12 @@ void III_freqinver(mad_fixed_t sample[18][32], unsigned int sb) } /* - * NAME: III_decode() - * DESCRIPTION: decode frame main_data + * NAME: III_decode() + * DESCRIPTION: decode frame main_data */ static enum mad_error III_decode(struct mad_bitptr *ptr, struct mad_frame *frame, - struct sideinfo *si, unsigned int nch) + struct sideinfo *si, unsigned int nch) { struct mad_header *header = &frame->header; unsigned int sfreqi, ngr, gr; @@ -3081,23 +3081,23 @@ enum mad_error III_decode(struct mad_bitptr *ptr, struct mad_frame *frame, sfbwidth[ch] = sfbwidth_table[sfreqi].l; if (channel->block_type == 2) { - sfbwidth[ch] = (channel->flags & mixed_block_flag) ? - sfbwidth_table[sfreqi].m : sfbwidth_table[sfreqi].s; + sfbwidth[ch] = (channel->flags & mixed_block_flag) ? + sfbwidth_table[sfreqi].m : sfbwidth_table[sfreqi].s; } if (header->flags & MAD_FLAG_LSF_EXT) { - part2_length = III_scalefactors_lsf(ptr, channel, - ch == 0 ? 0 : &si->gr[1].ch[1], - header->mode_extension); + part2_length = III_scalefactors_lsf(ptr, channel, + ch == 0 ? 0 : &si->gr[1].ch[1], + header->mode_extension); } else { - part2_length = III_scalefactors(ptr, channel, &si->gr[0].ch[ch], - gr == 0 ? 0 : si->scfsi[ch]); + part2_length = III_scalefactors(ptr, channel, &si->gr[0].ch[ch], + gr == 0 ? 0 : si->scfsi[ch]); } error = III_huffdecode(ptr, xr[ch], channel, sfbwidth[ch], part2_length); if (error) - return error; + return error; } /* joint stereo processing */ @@ -3105,7 +3105,7 @@ enum mad_error III_decode(struct mad_bitptr *ptr, struct mad_frame *frame, if (header->mode == MAD_MODE_JOINT_STEREO && header->mode_extension) { error = III_stereo(xr, granule, header, sfbwidth[0]); if (error) - return error; + return error; } /* reordering, alias reduction, IMDCT, overlap-add, frequency inversion */ @@ -3117,46 +3117,46 @@ enum mad_error III_decode(struct mad_bitptr *ptr, struct mad_frame *frame, mad_fixed_t output[36]; if (channel->block_type == 2) { - III_reorder(xr[ch], channel, sfbwidth[ch]); + III_reorder(xr[ch], channel, sfbwidth[ch]); # if !defined(OPT_STRICT) - /* - * According to ISO/IEC 11172-3, "Alias reduction is not applied for - * granules with block_type == 2 (short block)." However, other - * sources suggest alias reduction should indeed be performed on the - * lower two subbands of mixed blocks. Most other implementations do - * this, so by default we will too. - */ - if (channel->flags & mixed_block_flag) - III_aliasreduce(xr[ch], 36); + /* + * According to ISO/IEC 11172-3, "Alias reduction is not applied for + * granules with block_type == 2 (short block)." However, other + * sources suggest alias reduction should indeed be performed on the + * lower two subbands of mixed blocks. Most other implementations do + * this, so by default we will too. + */ + if (channel->flags & mixed_block_flag) + III_aliasreduce(xr[ch], 36); # endif } else - III_aliasreduce(xr[ch], 576); + III_aliasreduce(xr[ch], 576); l = 0; /* subbands 0-1 */ if (channel->block_type != 2 || (channel->flags & mixed_block_flag)) { - unsigned int block_type; + unsigned int block_type; - block_type = channel->block_type; - if (channel->flags & mixed_block_flag) - block_type = 0; + block_type = channel->block_type; + if (channel->flags & mixed_block_flag) + block_type = 0; - /* long blocks */ - for (sb = 0; sb < 2; ++sb, l += 18) { - III_imdct_l(&xr[ch][l], output, block_type); - III_overlap(output, (*frame->overlap)[ch][sb], sample, sb); - } + /* long blocks */ + for (sb = 0; sb < 2; ++sb, l += 18) { + III_imdct_l(&xr[ch][l], output, block_type); + III_overlap(output, (*frame->overlap)[ch][sb], sample, sb); + } } else { - /* short blocks */ - for (sb = 0; sb < 2; ++sb, l += 18) { - III_imdct_s(&xr[ch][l], output); - III_overlap(output, (*frame->overlap)[ch][sb], sample, sb); - } + /* short blocks */ + for (sb = 0; sb < 2; ++sb, l += 18) { + III_imdct_s(&xr[ch][l], output); + III_overlap(output, (*frame->overlap)[ch][sb], sample, sb); + } } III_freqinver(sample, 1); @@ -3166,7 +3166,7 @@ enum mad_error III_decode(struct mad_bitptr *ptr, struct mad_frame *frame, /* i = 576; while (i > 36 && xr[ch][i - 1] == 0) - --i; + --i; */ { @@ -3181,33 +3181,33 @@ enum mad_error III_decode(struct mad_bitptr *ptr, struct mad_frame *frame, sblimit = 32 - (576 - i) / 18; if (channel->block_type != 2) { - /* long blocks */ - for (sb = 2; sb < sblimit; ++sb, l += 18) { - III_imdct_l(&xr[ch][l], output, channel->block_type); - III_overlap(output, (*frame->overlap)[ch][sb], sample, sb); - - if (sb & 1) - III_freqinver(sample, sb); - } + /* long blocks */ + for (sb = 2; sb < sblimit; ++sb, l += 18) { + III_imdct_l(&xr[ch][l], output, channel->block_type); + III_overlap(output, (*frame->overlap)[ch][sb], sample, sb); + + if (sb & 1) + III_freqinver(sample, sb); + } } else { - /* short blocks */ - for (sb = 2; sb < sblimit; ++sb, l += 18) { - III_imdct_s(&xr[ch][l], output); - III_overlap(output, (*frame->overlap)[ch][sb], sample, sb); - - if (sb & 1) - III_freqinver(sample, sb); - } + /* short blocks */ + for (sb = 2; sb < sblimit; ++sb, l += 18) { + III_imdct_s(&xr[ch][l], output); + III_overlap(output, (*frame->overlap)[ch][sb], sample, sb); + + if (sb & 1) + III_freqinver(sample, sb); + } } /* remaining (zero) subbands */ for (sb = sblimit; sb < 32; ++sb) { - III_overlap_z((*frame->overlap)[ch][sb], sample, sb); + III_overlap_z((*frame->overlap)[ch][sb], sample, sb); - if (sb & 1) - III_freqinver(sample, sb); + if (sb & 1) + III_freqinver(sample, sb); } } } @@ -3216,8 +3216,8 @@ enum mad_error III_decode(struct mad_bitptr *ptr, struct mad_frame *frame, } /* - * NAME: layer->III() - * DESCRIPTION: decode a single Layer III frame + * NAME: layer->III() + * DESCRIPTION: decode a single Layer III frame */ int mad_layer_III(struct mad_stream *stream, struct mad_frame *frame) { @@ -3268,7 +3268,7 @@ int mad_layer_III(struct mad_stream *stream, struct mad_frame *frame) mad_bit_crc(stream->ptr, si_len * CHAR_BIT, header->crc_check); if (header->crc_check != header->crc_target && - !(frame->options & MAD_OPTION_IGNORECRC)) { + !(frame->options & MAD_OPTION_IGNORECRC)) { stream->error = MAD_ERROR_BADCRC; result = -1; } @@ -3277,7 +3277,7 @@ int mad_layer_III(struct mad_stream *stream, struct mad_frame *frame) /* decode frame side information */ error = III_sideinfo(&stream->ptr, nch, header->flags & MAD_FLAG_LSF_EXT, - &si, &data_bitlen, &priv_bitlen); + &si, &data_bitlen, &priv_bitlen); if (error && result == 0) { stream->error = error; result = -1; @@ -3297,10 +3297,10 @@ int mad_layer_III(struct mad_stream *stream, struct mad_frame *frame) header = mad_bit_read(&peek, 32); if ((header & 0xffe60000L) /* syncword | layer */ == 0xffe20000L) { if (!(header & 0x00010000L)) /* protection_bit */ - mad_bit_skip(&peek, 16); /* crc_check */ + mad_bit_skip(&peek, 16); /* crc_check */ next_md_begin = - mad_bit_read(&peek, (header & 0x00080000L) /* ID */ ? 9 : 8); + mad_bit_read(&peek, (header & 0x00080000L) /* ID */ ? 9 : 8); } mad_bit_finish(&peek); @@ -3326,22 +3326,22 @@ int mad_layer_III(struct mad_stream *stream, struct mad_frame *frame) else { if (si.main_data_begin > stream->md_len) { if (result == 0) { - stream->error = MAD_ERROR_BADDATAPTR; - result = -1; + stream->error = MAD_ERROR_BADDATAPTR; + result = -1; } } else { mad_bit_init(&ptr, - *stream->main_data + stream->md_len - si.main_data_begin); + *stream->main_data + stream->md_len - si.main_data_begin); if (md_len > si.main_data_begin) { - assert(stream->md_len + md_len - - si.main_data_begin <= MAD_BUFFER_MDLEN); + assert(stream->md_len + md_len - + si.main_data_begin <= MAD_BUFFER_MDLEN); - memcpy(*stream->main_data + stream->md_len, - mad_bit_nextbyte(&stream->ptr), - frame_used = md_len - si.main_data_begin); - stream->md_len += frame_used; + memcpy(*stream->main_data + stream->md_len, + mad_bit_nextbyte(&stream->ptr), + frame_used = md_len - si.main_data_begin); + stream->md_len += frame_used; } } } @@ -3365,17 +3365,17 @@ int mad_layer_III(struct mad_stream *stream, struct mad_frame *frame) # if 0 && defined(DEBUG) fprintf(stderr, - "main_data_begin:%u, md_len:%u, frame_free:%u, " - "data_bitlen:%u, anc_bitlen: %u\n", - si.main_data_begin, md_len, frame_free, - data_bitlen, stream->anc_bitlen); + "main_data_begin:%u, md_len:%u, frame_free:%u, " + "data_bitlen:%u, anc_bitlen: %u\n", + si.main_data_begin, md_len, frame_free, + data_bitlen, stream->anc_bitlen); # endif /* preload main_data buffer with up to 511 bytes for next frame(s) */ if (frame_free >= next_md_begin) { memcpy(*stream->main_data, - stream->next_frame - next_md_begin, next_md_begin); + stream->next_frame - next_md_begin, next_md_begin); stream->md_len = next_md_begin; } else { @@ -3384,19 +3384,19 @@ int mad_layer_III(struct mad_stream *stream, struct mad_frame *frame) extra = si.main_data_begin - md_len; if (extra + frame_free > next_md_begin) - extra = next_md_begin - frame_free; + extra = next_md_begin - frame_free; if (extra < stream->md_len) { - memmove(*stream->main_data, - *stream->main_data + stream->md_len - extra, extra); - stream->md_len = extra; + memmove(*stream->main_data, + *stream->main_data + stream->md_len - extra, extra); + stream->md_len = extra; } } else stream->md_len = 0; memcpy(*stream->main_data + stream->md_len, - stream->next_frame - frame_free, frame_free); + stream->next_frame - frame_free, frame_free); stream->md_len += frame_free; } diff --git a/apps/codecs/libmad/mad.h b/apps/codecs/libmad/mad.h index 52a74d122c..6e75e3bf09 100644 --- a/apps/codecs/libmad/mad.h +++ b/apps/codecs/libmad/mad.h @@ -27,28 +27,28 @@ extern "C" { # endif # define FPM_DEFAULT - + /* Id: version.h,v 1.26 2004/01/23 09:41:33 rob Exp */ # ifndef LIBMAD_VERSION_H # define LIBMAD_VERSION_H -# define MAD_VERSION_MAJOR 0 -# define MAD_VERSION_MINOR 15 -# define MAD_VERSION_PATCH 1 -# define MAD_VERSION_EXTRA " (beta)" +# define MAD_VERSION_MAJOR 0 +# define MAD_VERSION_MINOR 15 +# define MAD_VERSION_PATCH 1 +# define MAD_VERSION_EXTRA " (beta)" -# define MAD_VERSION_STRINGIZE(str) #str -# define MAD_VERSION_STRING(num) MAD_VERSION_STRINGIZE(num) +# define MAD_VERSION_STRINGIZE(str) #str +# define MAD_VERSION_STRING(num) MAD_VERSION_STRINGIZE(num) -# define MAD_VERSION MAD_VERSION_STRING(MAD_VERSION_MAJOR) "." \ - MAD_VERSION_STRING(MAD_VERSION_MINOR) "." \ - MAD_VERSION_STRING(MAD_VERSION_PATCH) \ - MAD_VERSION_EXTRA +# define MAD_VERSION MAD_VERSION_STRING(MAD_VERSION_MAJOR) "." \ + MAD_VERSION_STRING(MAD_VERSION_MINOR) "." \ + MAD_VERSION_STRING(MAD_VERSION_PATCH) \ + MAD_VERSION_EXTRA -# define MAD_PUBLISHYEAR "2000-2004" -# define MAD_AUTHOR "Underbit Technologies, Inc." -# define MAD_EMAIL "info@underbit.com" +# define MAD_PUBLISHYEAR "2000-2004" +# define MAD_AUTHOR "Underbit Technologies, Inc." +# define MAD_EMAIL "info@underbit.com" extern char const mad_version[]; extern char const mad_copyright[]; @@ -102,50 +102,50 @@ typedef mad_fixed_t mad_sample_t; * supported, and must be done with care. */ -# define MAD_F_FRACBITS 28 +# define MAD_F_FRACBITS 28 # if MAD_F_FRACBITS == 28 -# define MAD_F(x) ((mad_fixed_t) (x##L)) +# define MAD_F(x) ((mad_fixed_t) (x##L)) # else # if MAD_F_FRACBITS < 28 # warning "MAD_F_FRACBITS < 28" -# define MAD_F(x) ((mad_fixed_t) \ - (((x##L) + \ - (1L << (28 - MAD_F_FRACBITS - 1))) >> \ - (28 - MAD_F_FRACBITS))) +# define MAD_F(x) ((mad_fixed_t) \ + (((x##L) + \ + (1L << (28 - MAD_F_FRACBITS - 1))) >> \ + (28 - MAD_F_FRACBITS))) # elif MAD_F_FRACBITS > 28 # error "MAD_F_FRACBITS > 28 not currently supported" -# define MAD_F(x) ((mad_fixed_t) \ - ((x##L) << (MAD_F_FRACBITS - 28))) +# define MAD_F(x) ((mad_fixed_t) \ + ((x##L) << (MAD_F_FRACBITS - 28))) # endif # endif -# define MAD_F_MIN ((mad_fixed_t) -0x80000000L) -# define MAD_F_MAX ((mad_fixed_t) +0x7fffffffL) +# define MAD_F_MIN ((mad_fixed_t) -0x80000000L) +# define MAD_F_MAX ((mad_fixed_t) +0x7fffffffL) -# define MAD_F_ONE MAD_F(0x10000000) +# define MAD_F_ONE MAD_F(0x10000000) -# define mad_f_tofixed(x) ((mad_fixed_t) \ - ((x) * (double) (1L << MAD_F_FRACBITS) + 0.5)) -# define mad_f_todouble(x) ((double) \ - ((x) / (double) (1L << MAD_F_FRACBITS))) +# define mad_f_tofixed(x) ((mad_fixed_t) \ + ((x) * (double) (1L << MAD_F_FRACBITS) + 0.5)) +# define mad_f_todouble(x) ((double) \ + ((x) / (double) (1L << MAD_F_FRACBITS))) -# define mad_f_intpart(x) ((x) >> MAD_F_FRACBITS) -# define mad_f_fracpart(x) ((x) & ((1L << MAD_F_FRACBITS) - 1)) - /* (x should be positive) */ +# define mad_f_intpart(x) ((x) >> MAD_F_FRACBITS) +# define mad_f_fracpart(x) ((x) & ((1L << MAD_F_FRACBITS) - 1)) + /* (x should be positive) */ -# define mad_f_fromint(x) ((x) << MAD_F_FRACBITS) +# define mad_f_fromint(x) ((x) << MAD_F_FRACBITS) -# define mad_f_add(x, y) ((x) + (y)) -# define mad_f_sub(x, y) ((x) - (y)) +# define mad_f_add(x, y) ((x) + (y)) +# define mad_f_sub(x, y) ((x) - (y)) # if defined(FPM_FLOAT) # error "FPM_FLOAT not yet supported" # undef MAD_F -# define MAD_F(x) mad_f_todouble(x) +# define MAD_F(x) mad_f_todouble(x) -# define mad_f_mul(x, y) ((x) * (y)) +# define mad_f_mul(x, y) ((x) * (y)) # define mad_f_scale64 # undef ASO_ZEROCHECK @@ -192,7 +192,7 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) } # pragma warning(pop) -# define mad_f_mul mad_f_mul_inline +# define mad_f_mul mad_f_mul_inline # define mad_f_scale64 # else /* @@ -201,9 +201,9 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) */ # define MAD_F_MLX(hi, lo, x, y) \ asm ("imull %3" \ - : "=a" (lo), "=d" (hi) \ - : "%a" (x), "rm" (y) \ - : "cc") + : "=a" (lo), "=d" (hi) \ + : "%a" (x), "rm" (y) \ + : "cc") # if defined(OPT_ACCURACY) /* @@ -214,10 +214,10 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) mad_fixed64lo_t __lo; \ MAD_F_MLX(__hi, __lo, (x), (y)); \ asm ("addl %2,%0\n\t" \ - "adcl %3,%1" \ - : "=rm" (lo), "=rm" (hi) \ - : "r" (__lo), "r" (__hi), "0" (lo), "1" (hi) \ - : "cc"); \ + "adcl %3,%1" \ + : "=rm" (lo), "=rm" (hi) \ + : "r" (__lo), "r" (__hi), "0" (lo), "1" (hi) \ + : "cc"); \ }) # endif /* OPT_ACCURACY */ @@ -230,15 +230,15 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) mad_fixed64lo_t __lo_; \ mad_fixed_t __result; \ asm ("addl %4,%2\n\t" \ - "adcl %5,%3" \ - : "=rm" (__lo_), "=rm" (__hi_) \ - : "0" (lo), "1" (hi), \ - "ir" (1L << (MAD_F_SCALEBITS - 1)), "ir" (0) \ - : "cc"); \ + "adcl %5,%3" \ + : "=rm" (__lo_), "=rm" (__hi_) \ + : "0" (lo), "1" (hi), \ + "ir" (1L << (MAD_F_SCALEBITS - 1)), "ir" (0) \ + : "cc"); \ asm ("shrdl %3,%2,%1" \ - : "=rm" (__result) \ - : "0" (__lo_), "r" (__hi_), "I" (MAD_F_SCALEBITS) \ - : "cc"); \ + : "=rm" (__result) \ + : "0" (__lo_), "r" (__hi_), "I" (MAD_F_SCALEBITS) \ + : "cc"); \ __result; \ }) # elif defined(OPT_INTEL) @@ -248,21 +248,21 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) # define mad_f_scale64(hi, lo) \ ({ mad_fixed_t __result; \ asm ("shrl %3,%1\n\t" \ - "shll %4,%2\n\t" \ - "orl %2,%1" \ - : "=rm" (__result) \ - : "0" (lo), "r" (hi), \ - "I" (MAD_F_SCALEBITS), "I" (32 - MAD_F_SCALEBITS) \ - : "cc"); \ + "shll %4,%2\n\t" \ + "orl %2,%1" \ + : "=rm" (__result) \ + : "0" (lo), "r" (hi), \ + "I" (MAD_F_SCALEBITS), "I" (32 - MAD_F_SCALEBITS) \ + : "cc"); \ __result; \ }) # else # define mad_f_scale64(hi, lo) \ ({ mad_fixed_t __result; \ asm ("shrdl %3,%2,%1" \ - : "=rm" (__result) \ - : "0" (lo), "r" (hi), "I" (MAD_F_SCALEBITS) \ - : "cc"); \ + : "=rm" (__result) \ + : "0" (lo), "r" (hi), "I" (MAD_F_SCALEBITS) \ + : "cc"); \ __result; \ }) # endif /* OPT_ACCURACY */ @@ -287,42 +287,42 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) ({ mad_fixed64hi_t __hi; \ mad_fixed64lo_t __lo; \ mad_fixed_t __result; \ - asm ("smull %0, %1, %3, %4\n\t" \ - "movs %0, %0, lsr %5\n\t" \ - "adc %2, %0, %1, lsl %6" \ - : "=&r" (__lo), "=&r" (__hi), "=r" (__result) \ - : "%r" (x), "r" (y), \ - "M" (MAD_F_SCALEBITS), "M" (32 - MAD_F_SCALEBITS) \ - : "cc"); \ + asm ("smull %0, %1, %3, %4\n\t" \ + "movs %0, %0, lsr %5\n\t" \ + "adc %2, %0, %1, lsl %6" \ + : "=&r" (__lo), "=&r" (__hi), "=r" (__result) \ + : "%r" (x), "r" (y), \ + "M" (MAD_F_SCALEBITS), "M" (32 - MAD_F_SCALEBITS) \ + : "cc"); \ __result; \ }) # endif # define MAD_F_MLX(hi, lo, x, y) \ - asm ("smull %0, %1, %2, %3" \ - : "=&r" (lo), "=&r" (hi) \ - : "%r" (x), "r" (y)) + asm ("smull %0, %1, %2, %3" \ + : "=&r" (lo), "=&r" (hi) \ + : "%r" (x), "r" (y)) # define MAD_F_MLA(hi, lo, x, y) \ - asm ("smlal %0, %1, %2, %3" \ - : "+r" (lo), "+r" (hi) \ - : "%r" (x), "r" (y)) + asm ("smlal %0, %1, %2, %3" \ + : "+r" (lo), "+r" (hi) \ + : "%r" (x), "r" (y)) # define MAD_F_MLN(hi, lo) \ - asm ("rsbs %0, %2, #0\n\t" \ - "rsc %1, %3, #0" \ - : "=r" (lo), "=r" (hi) \ - : "0" (lo), "1" (hi) \ - : "cc") + asm ("rsbs %0, %2, #0\n\t" \ + "rsc %1, %3, #0" \ + : "=r" (lo), "=r" (hi) \ + : "0" (lo), "1" (hi) \ + : "cc") # define mad_f_scale64(hi, lo) \ ({ mad_fixed_t __result; \ - asm ("movs %0, %1, lsr %3\n\t" \ - "adc %0, %0, %2, lsl %4" \ - : "=&r" (__result) \ - : "r" (lo), "r" (hi), \ - "M" (MAD_F_SCALEBITS), "M" (32 - MAD_F_SCALEBITS) \ - : "cc"); \ + asm ("movs %0, %1, lsr %3\n\t" \ + "adc %0, %0, %2, lsl %4" \ + : "=&r" (__result) \ + : "r" (lo), "r" (hi), \ + "M" (MAD_F_SCALEBITS), "M" (32 - MAD_F_SCALEBITS) \ + : "cc"); \ __result; \ }) @@ -337,28 +337,28 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) * significant bit depends on OPT_ACCURACY via mad_f_scale64(). */ # define MAD_F_MLX(hi, lo, x, y) \ - asm ("mult %2,%3" \ - : "=l" (lo), "=h" (hi) \ - : "%r" (x), "r" (y)) + asm ("mult %2,%3" \ + : "=l" (lo), "=h" (hi) \ + : "%r" (x), "r" (y)) # if defined(HAVE_MADD_ASM) # define MAD_F_MLA(hi, lo, x, y) \ - asm ("madd %2,%3" \ - : "+l" (lo), "+h" (hi) \ - : "%r" (x), "r" (y)) + asm ("madd %2,%3" \ + : "+l" (lo), "+h" (hi) \ + : "%r" (x), "r" (y)) # elif defined(HAVE_MADD16_ASM) /* * This loses significant accuracy due to the 16-bit integer limit in the * multiply/accumulate instruction. */ # define MAD_F_ML0(hi, lo, x, y) \ - asm ("mult %2,%3" \ - : "=l" (lo), "=h" (hi) \ - : "%r" ((x) >> 12), "r" ((y) >> 16)) + asm ("mult %2,%3" \ + : "=l" (lo), "=h" (hi) \ + : "%r" ((x) >> 12), "r" ((y) >> 16)) # define MAD_F_MLA(hi, lo, x, y) \ - asm ("madd16 %2,%3" \ - : "+l" (lo), "+h" (hi) \ - : "%r" ((x) >> 12), "r" ((y) >> 16)) + asm ("madd16 %2,%3" \ + : "+l" (lo), "+h" (hi) \ + : "%r" ((x) >> 12), "r" ((y) >> 16)) # define MAD_F_MLZ(hi, lo) ((mad_fixed_t) (lo)) # endif @@ -378,9 +378,9 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) */ # define MAD_F_MLX(hi, lo, x, y) \ asm ("smul %2, %3, %0\n\t" \ - "rd %%y, %1" \ - : "=r" (lo), "=r" (hi) \ - : "%r" (x), "rI" (y)) + "rd %%y, %1" \ + : "=r" (lo), "=r" (hi) \ + : "%r" (x), "rI" (y)) /* --- PowerPC ------------------------------------------------------------- */ @@ -393,11 +393,11 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) # define MAD_F_MLX(hi, lo, x, y) \ do { \ asm ("mullw %0,%1,%2" \ - : "=r" (lo) \ - : "%r" (x), "r" (y)); \ + : "=r" (lo) \ + : "%r" (x), "r" (y)); \ asm ("mulhw %0,%1,%2" \ - : "=r" (hi) \ - : "%r" (x), "r" (y)); \ + : "=r" (hi) \ + : "%r" (x), "r" (y)); \ } \ while (0) @@ -410,11 +410,11 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) mad_fixed64lo_t __lo; \ MAD_F_MLX(__hi, __lo, (x), (y)); \ asm ("addc %0,%2,%3\n\t" \ - "adde %1,%4,%5" \ - : "=r" (lo), "=r" (hi) \ - : "%r" (lo), "r" (__lo), \ - "%r" (hi), "r" (__hi) \ - : "xer"); \ + "adde %1,%4,%5" \ + : "=r" (lo), "=r" (hi) \ + : "%r" (lo), "r" (__lo), \ + "%r" (hi), "r" (__hi) \ + : "xer"); \ }) # endif @@ -425,28 +425,28 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) # define mad_f_scale64(hi, lo) \ ({ mad_fixed_t __result, __round; \ asm ("rotrwi %0,%1,%2" \ - : "=r" (__result) \ - : "r" (lo), "i" (MAD_F_SCALEBITS)); \ + : "=r" (__result) \ + : "r" (lo), "i" (MAD_F_SCALEBITS)); \ asm ("extrwi %0,%1,1,0" \ - : "=r" (__round) \ - : "r" (__result)); \ + : "=r" (__round) \ + : "r" (__result)); \ asm ("insrwi %0,%1,%2,0" \ - : "+r" (__result) \ - : "r" (hi), "i" (MAD_F_SCALEBITS)); \ + : "+r" (__result) \ + : "r" (hi), "i" (MAD_F_SCALEBITS)); \ asm ("add %0,%1,%2" \ - : "=r" (__result) \ - : "%r" (__result), "r" (__round)); \ + : "=r" (__result) \ + : "%r" (__result), "r" (__round)); \ __result; \ }) # else # define mad_f_scale64(hi, lo) \ ({ mad_fixed_t __result; \ asm ("rotrwi %0,%1,%2" \ - : "=r" (__result) \ - : "r" (lo), "i" (MAD_F_SCALEBITS)); \ + : "=r" (__result) \ + : "r" (lo), "i" (MAD_F_SCALEBITS)); \ asm ("insrwi %0,%1,%2,0" \ - : "+r" (__result) \ - : "r" (hi), "i" (MAD_F_SCALEBITS)); \ + : "+r" (__result) \ + : "r" (hi), "i" (MAD_F_SCALEBITS)); \ __result; \ }) # endif @@ -467,10 +467,10 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) * Pre-rounding is required to stay within the limits of compliance. */ # if defined(OPT_SPEED) -# define mad_f_mul(x, y) (((x) >> 12) * ((y) >> 16)) +# define mad_f_mul(x, y) (((x) >> 12) * ((y) >> 16)) # else -# define mad_f_mul(x, y) ((((x) + (1L << 11)) >> 12) * \ - (((y) + (1L << 15)) >> 16)) +# define mad_f_mul(x, y) ((((x) + (1L << 11)) >> 12) * \ + (((y) + (1L << 15)) >> 16)) # endif /* ------------------------------------------------------------------------- */ @@ -491,22 +491,22 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) # endif # if !defined(MAD_F_MLA) -# define MAD_F_ML0(hi, lo, x, y) ((lo) = mad_f_mul((x), (y))) -# define MAD_F_MLA(hi, lo, x, y) ((lo) += mad_f_mul((x), (y))) -# define MAD_F_MLN(hi, lo) ((lo) = -(lo)) -# define MAD_F_MLZ(hi, lo) ((void) (hi), (mad_fixed_t) (lo)) +# define MAD_F_ML0(hi, lo, x, y) ((lo) = mad_f_mul((x), (y))) +# define MAD_F_MLA(hi, lo, x, y) ((lo) += mad_f_mul((x), (y))) +# define MAD_F_MLN(hi, lo) ((lo) = -(lo)) +# define MAD_F_MLZ(hi, lo) ((void) (hi), (mad_fixed_t) (lo)) # endif # if !defined(MAD_F_ML0) -# define MAD_F_ML0(hi, lo, x, y) MAD_F_MLX((hi), (lo), (x), (y)) +# define MAD_F_ML0(hi, lo, x, y) MAD_F_MLX((hi), (lo), (x), (y)) # endif # if !defined(MAD_F_MLN) -# define MAD_F_MLN(hi, lo) ((hi) = ((lo) = -(lo)) ? ~(hi) : -(hi)) +# define MAD_F_MLN(hi, lo) ((hi) = ((lo) = -(lo)) ? ~(hi) : -(hi)) # endif # if !defined(MAD_F_MLZ) -# define MAD_F_MLZ(hi, lo) mad_f_scale64((hi), (lo)) +# define MAD_F_MLZ(hi, lo) mad_f_scale64((hi), (lo)) # endif # if !defined(mad_f_scale64) @@ -514,7 +514,7 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) # define mad_f_scale64(hi, lo) \ ((((mad_fixed_t) \ (((hi) << (32 - (MAD_F_SCALEBITS - 1))) | \ - ((lo) >> (MAD_F_SCALEBITS - 1)))) + 1) >> 1) + ((lo) >> (MAD_F_SCALEBITS - 1)))) + 1) >> 1) # else # define mad_f_scale64(hi, lo) \ ((mad_fixed_t) \ @@ -544,10 +544,10 @@ struct mad_bitptr { void mad_bit_init(struct mad_bitptr *, unsigned char const *); -# define mad_bit_finish(bitptr) /* nothing */ +# define mad_bit_finish(bitptr) /* nothing */ unsigned int mad_bit_length(struct mad_bitptr const *, - struct mad_bitptr const *); + struct mad_bitptr const *); # define mad_bit_bitsleft(bitptr) ((bitptr)->left) unsigned char const *mad_bit_nextbyte(struct mad_bitptr const *); @@ -566,67 +566,67 @@ unsigned short mad_bit_crc(struct mad_bitptr, unsigned int, unsigned short); # define LIBMAD_TIMER_H typedef struct { - signed long seconds; /* whole seconds */ - unsigned long fraction; /* 1/MAD_TIMER_RESOLUTION seconds */ + signed long seconds; /* whole seconds */ + unsigned long fraction; /* 1/MAD_TIMER_RESOLUTION seconds */ } mad_timer_t; extern mad_timer_t const mad_timer_zero; -# define MAD_TIMER_RESOLUTION 352800000UL +# define MAD_TIMER_RESOLUTION 352800000UL enum mad_units { - MAD_UNITS_HOURS = -2, - MAD_UNITS_MINUTES = -1, - MAD_UNITS_SECONDS = 0, + MAD_UNITS_HOURS = -2, + MAD_UNITS_MINUTES = -1, + MAD_UNITS_SECONDS = 0, /* metric units */ - MAD_UNITS_DECISECONDS = 10, + MAD_UNITS_DECISECONDS = 10, MAD_UNITS_CENTISECONDS = 100, MAD_UNITS_MILLISECONDS = 1000, /* audio sample units */ - MAD_UNITS_8000_HZ = 8000, - MAD_UNITS_11025_HZ = 11025, - MAD_UNITS_12000_HZ = 12000, + MAD_UNITS_8000_HZ = 8000, + MAD_UNITS_11025_HZ = 11025, + MAD_UNITS_12000_HZ = 12000, - MAD_UNITS_16000_HZ = 16000, - MAD_UNITS_22050_HZ = 22050, - MAD_UNITS_24000_HZ = 24000, + MAD_UNITS_16000_HZ = 16000, + MAD_UNITS_22050_HZ = 22050, + MAD_UNITS_24000_HZ = 24000, - MAD_UNITS_32000_HZ = 32000, - MAD_UNITS_44100_HZ = 44100, - MAD_UNITS_48000_HZ = 48000, + MAD_UNITS_32000_HZ = 32000, + MAD_UNITS_44100_HZ = 44100, + MAD_UNITS_48000_HZ = 48000, /* video frame/field units */ - MAD_UNITS_24_FPS = 24, - MAD_UNITS_25_FPS = 25, - MAD_UNITS_30_FPS = 30, - MAD_UNITS_48_FPS = 48, - MAD_UNITS_50_FPS = 50, - MAD_UNITS_60_FPS = 60, + MAD_UNITS_24_FPS = 24, + MAD_UNITS_25_FPS = 25, + MAD_UNITS_30_FPS = 30, + MAD_UNITS_48_FPS = 48, + MAD_UNITS_50_FPS = 50, + MAD_UNITS_60_FPS = 60, /* CD audio frames */ - MAD_UNITS_75_FPS = 75, + MAD_UNITS_75_FPS = 75, /* video drop-frame units */ - MAD_UNITS_23_976_FPS = -24, - MAD_UNITS_24_975_FPS = -25, - MAD_UNITS_29_97_FPS = -30, - MAD_UNITS_47_952_FPS = -48, - MAD_UNITS_49_95_FPS = -50, - MAD_UNITS_59_94_FPS = -60 + MAD_UNITS_23_976_FPS = -24, + MAD_UNITS_24_975_FPS = -25, + MAD_UNITS_29_97_FPS = -30, + MAD_UNITS_47_952_FPS = -48, + MAD_UNITS_49_95_FPS = -50, + MAD_UNITS_59_94_FPS = -60 }; -# define mad_timer_reset(timer) ((void) (*(timer) = mad_timer_zero)) +# define mad_timer_reset(timer) ((void) (*(timer) = mad_timer_zero)) int mad_timer_compare(mad_timer_t, mad_timer_t); -# define mad_timer_sign(timer) mad_timer_compare((timer), mad_timer_zero) +# define mad_timer_sign(timer) mad_timer_compare((timer), mad_timer_zero) void mad_timer_negate(mad_timer_t *); mad_timer_t mad_timer_abs(mad_timer_t); @@ -638,7 +638,7 @@ void mad_timer_multiply(mad_timer_t *, signed long); signed long mad_timer_count(mad_timer_t, enum mad_units); unsigned long mad_timer_fraction(mad_timer_t, unsigned long); void mad_timer_string(mad_timer_t, char *, char const *, - enum mad_units, enum mad_units, unsigned long); + enum mad_units, enum mad_units, unsigned long); # endif @@ -648,70 +648,70 @@ void mad_timer_string(mad_timer_t, char *, char const *, # define LIBMAD_STREAM_H -# define MAD_BUFFER_GUARD 8 -# define MAD_BUFFER_MDLEN (511 + 2048 + MAD_BUFFER_GUARD) +# define MAD_BUFFER_GUARD 8 +# define MAD_BUFFER_MDLEN (511 + 2048 + MAD_BUFFER_GUARD) enum mad_error { - MAD_ERROR_NONE = 0x0000, /* no error */ - - MAD_ERROR_BUFLEN = 0x0001, /* input buffer too small (or EOF) */ - MAD_ERROR_BUFPTR = 0x0002, /* invalid (null) buffer pointer */ - - MAD_ERROR_NOMEM = 0x0031, /* not enough memory */ - - MAD_ERROR_LOSTSYNC = 0x0101, /* lost synchronization */ - MAD_ERROR_BADLAYER = 0x0102, /* reserved header layer value */ - MAD_ERROR_BADBITRATE = 0x0103, /* forbidden bitrate value */ - MAD_ERROR_BADSAMPLERATE = 0x0104, /* reserved sample frequency value */ - MAD_ERROR_BADEMPHASIS = 0x0105, /* reserved emphasis value */ - - MAD_ERROR_BADCRC = 0x0201, /* CRC check failed */ - MAD_ERROR_BADBITALLOC = 0x0211, /* forbidden bit allocation value */ - MAD_ERROR_BADSCALEFACTOR = 0x0221, /* bad scalefactor index */ - MAD_ERROR_BADMODE = 0x0222, /* bad bitrate/mode combination */ - MAD_ERROR_BADFRAMELEN = 0x0231, /* bad frame length */ - MAD_ERROR_BADBIGVALUES = 0x0232, /* bad big_values count */ - MAD_ERROR_BADBLOCKTYPE = 0x0233, /* reserved block_type */ - MAD_ERROR_BADSCFSI = 0x0234, /* bad scalefactor selection info */ - MAD_ERROR_BADDATAPTR = 0x0235, /* bad main_data_begin pointer */ - MAD_ERROR_BADPART3LEN = 0x0236, /* bad audio data length */ - MAD_ERROR_BADHUFFTABLE = 0x0237, /* bad Huffman table select */ - MAD_ERROR_BADHUFFDATA = 0x0238, /* Huffman data overrun */ - MAD_ERROR_BADSTEREO = 0x0239 /* incompatible block_type for JS */ + MAD_ERROR_NONE = 0x0000, /* no error */ + + MAD_ERROR_BUFLEN = 0x0001, /* input buffer too small (or EOF) */ + MAD_ERROR_BUFPTR = 0x0002, /* invalid (null) buffer pointer */ + + MAD_ERROR_NOMEM = 0x0031, /* not enough memory */ + + MAD_ERROR_LOSTSYNC = 0x0101, /* lost synchronization */ + MAD_ERROR_BADLAYER = 0x0102, /* reserved header layer value */ + MAD_ERROR_BADBITRATE = 0x0103, /* forbidden bitrate value */ + MAD_ERROR_BADSAMPLERATE = 0x0104, /* reserved sample frequency value */ + MAD_ERROR_BADEMPHASIS = 0x0105, /* reserved emphasis value */ + + MAD_ERROR_BADCRC = 0x0201, /* CRC check failed */ + MAD_ERROR_BADBITALLOC = 0x0211, /* forbidden bit allocation value */ + MAD_ERROR_BADSCALEFACTOR = 0x0221, /* bad scalefactor index */ + MAD_ERROR_BADMODE = 0x0222, /* bad bitrate/mode combination */ + MAD_ERROR_BADFRAMELEN = 0x0231, /* bad frame length */ + MAD_ERROR_BADBIGVALUES = 0x0232, /* bad big_values count */ + MAD_ERROR_BADBLOCKTYPE = 0x0233, /* reserved block_type */ + MAD_ERROR_BADSCFSI = 0x0234, /* bad scalefactor selection info */ + MAD_ERROR_BADDATAPTR = 0x0235, /* bad main_data_begin pointer */ + MAD_ERROR_BADPART3LEN = 0x0236, /* bad audio data length */ + MAD_ERROR_BADHUFFTABLE = 0x0237, /* bad Huffman table select */ + MAD_ERROR_BADHUFFDATA = 0x0238, /* Huffman data overrun */ + MAD_ERROR_BADSTEREO = 0x0239 /* incompatible block_type for JS */ }; -# define MAD_RECOVERABLE(error) ((error) & 0xff00) +# define MAD_RECOVERABLE(error) ((error) & 0xff00) struct mad_stream { - unsigned char const *buffer; /* input bitstream buffer */ - unsigned char const *bufend; /* end of buffer */ - unsigned long skiplen; /* bytes to skip before next frame */ + unsigned char const *buffer; /* input bitstream buffer */ + unsigned char const *bufend; /* end of buffer */ + unsigned long skiplen; /* bytes to skip before next frame */ - int sync; /* stream sync found */ - unsigned long freerate; /* free bitrate (fixed) */ + int sync; /* stream sync found */ + unsigned long freerate; /* free bitrate (fixed) */ - unsigned char const *this_frame; /* start of current frame */ - unsigned char const *next_frame; /* start of next frame */ - struct mad_bitptr ptr; /* current processing bit pointer */ + unsigned char const *this_frame; /* start of current frame */ + unsigned char const *next_frame; /* start of next frame */ + struct mad_bitptr ptr; /* current processing bit pointer */ - struct mad_bitptr anc_ptr; /* ancillary bits pointer */ - unsigned int anc_bitlen; /* number of ancillary bits */ + struct mad_bitptr anc_ptr; /* ancillary bits pointer */ + unsigned int anc_bitlen; /* number of ancillary bits */ unsigned char (*main_data)[MAD_BUFFER_MDLEN]; - /* Layer III main_data() */ - unsigned int md_len; /* bytes in main_data */ + /* Layer III main_data() */ + unsigned int md_len; /* bytes in main_data */ - int options; /* decoding options (see below) */ - enum mad_error error; /* error code (see above) */ + int options; /* decoding options (see below) */ + enum mad_error error; /* error code (see above) */ }; enum { - MAD_OPTION_IGNORECRC = 0x0001, /* ignore CRC errors */ - MAD_OPTION_HALFSAMPLERATE = 0x0002 /* generate PCM at 1/2 sample rate */ + MAD_OPTION_IGNORECRC = 0x0001, /* ignore CRC errors */ + MAD_OPTION_HALFSAMPLERATE = 0x0002 /* generate PCM at 1/2 sample rate */ # if 0 /* not yet implemented */ - MAD_OPTION_LEFTCHANNEL = 0x0010, /* decode left channel only */ - MAD_OPTION_RIGHTCHANNEL = 0x0020, /* decode right channel only */ - MAD_OPTION_SINGLECHANNEL = 0x0030 /* combine channels */ + MAD_OPTION_LEFTCHANNEL = 0x0010, /* decode left channel only */ + MAD_OPTION_RIGHTCHANNEL = 0x0020, /* decode right channel only */ + MAD_OPTION_SINGLECHANNEL = 0x0030 /* combine channels */ # endif }; @@ -722,7 +722,7 @@ void mad_stream_finish(struct mad_stream *); ((void) ((stream)->options = (opts))) void mad_stream_buffer(struct mad_stream *, - unsigned char const *, unsigned long); + unsigned char const *, unsigned long); void mad_stream_skip(struct mad_stream *, unsigned long); int mad_stream_sync(struct mad_stream *); @@ -738,82 +738,82 @@ char const *mad_stream_errorstr(struct mad_stream const *); enum mad_layer { - MAD_LAYER_I = 1, /* Layer I */ - MAD_LAYER_II = 2, /* Layer II */ - MAD_LAYER_III = 3 /* Layer III */ + MAD_LAYER_I = 1, /* Layer I */ + MAD_LAYER_II = 2, /* Layer II */ + MAD_LAYER_III = 3 /* Layer III */ }; enum mad_mode { - MAD_MODE_SINGLE_CHANNEL = 0, /* single channel */ - MAD_MODE_DUAL_CHANNEL = 1, /* dual channel */ - MAD_MODE_JOINT_STEREO = 2, /* joint (MS/intensity) stereo */ - MAD_MODE_STEREO = 3 /* normal LR stereo */ + MAD_MODE_SINGLE_CHANNEL = 0, /* single channel */ + MAD_MODE_DUAL_CHANNEL = 1, /* dual channel */ + MAD_MODE_JOINT_STEREO = 2, /* joint (MS/intensity) stereo */ + MAD_MODE_STEREO = 3 /* normal LR stereo */ }; enum mad_emphasis { - MAD_EMPHASIS_NONE = 0, /* no emphasis */ - MAD_EMPHASIS_50_15_US = 1, /* 50/15 microseconds emphasis */ - MAD_EMPHASIS_CCITT_J_17 = 3, /* CCITT J.17 emphasis */ - MAD_EMPHASIS_RESERVED = 2 /* unknown emphasis */ + MAD_EMPHASIS_NONE = 0, /* no emphasis */ + MAD_EMPHASIS_50_15_US = 1, /* 50/15 microseconds emphasis */ + MAD_EMPHASIS_CCITT_J_17 = 3, /* CCITT J.17 emphasis */ + MAD_EMPHASIS_RESERVED = 2 /* unknown emphasis */ }; struct mad_header { - enum mad_layer layer; /* audio layer (1, 2, or 3) */ - enum mad_mode mode; /* channel mode (see above) */ - int mode_extension; /* additional mode info */ - enum mad_emphasis emphasis; /* de-emphasis to use (see above) */ + enum mad_layer layer; /* audio layer (1, 2, or 3) */ + enum mad_mode mode; /* channel mode (see above) */ + int mode_extension; /* additional mode info */ + enum mad_emphasis emphasis; /* de-emphasis to use (see above) */ - unsigned long bitrate; /* stream bitrate (bps) */ - unsigned int samplerate; /* sampling frequency (Hz) */ + unsigned long bitrate; /* stream bitrate (bps) */ + unsigned int samplerate; /* sampling frequency (Hz) */ - unsigned short crc_check; /* frame CRC accumulator */ - unsigned short crc_target; /* final target CRC checksum */ + unsigned short crc_check; /* frame CRC accumulator */ + unsigned short crc_target; /* final target CRC checksum */ - int flags; /* flags (see below) */ - int private_bits; /* private bits (see below) */ + int flags; /* flags (see below) */ + int private_bits; /* private bits (see below) */ - mad_timer_t duration; /* audio playing time of frame */ + mad_timer_t duration; /* audio playing time of frame */ }; struct mad_frame { - struct mad_header header; /* MPEG audio header */ - int options; /* decoding options (from stream) */ + struct mad_header header; /* MPEG audio header */ + int options; /* decoding options (from stream) */ - mad_fixed_t (*sbsample)[2][36][32]; /* synthesis subband filter samples */ + mad_fixed_t (*sbsample)[2][36][32]; /* synthesis subband filter samples */ mad_fixed_t (*sbsample_prev)[2][36][32]; /* synthesis subband filter samples from previous frame only needed when synthesis is on cop */ - mad_fixed_t (*overlap)[2][32][18]; /* Layer III block overlap data */ + mad_fixed_t (*overlap)[2][32][18]; /* Layer III block overlap data */ }; -# define MAD_NCHANNELS(header) ((header)->mode ? 2 : 1) +# define MAD_NCHANNELS(header) ((header)->mode ? 2 : 1) # define MAD_NSBSAMPLES(header) \ ((header)->layer == MAD_LAYER_I ? 12 : \ (((header)->layer == MAD_LAYER_III && \ ((header)->flags & MAD_FLAG_LSF_EXT)) ? 18 : 36)) enum { - MAD_FLAG_NPRIVATE_III = 0x0007, /* number of Layer III private bits */ - MAD_FLAG_INCOMPLETE = 0x0008, /* header but not data is decoded */ + MAD_FLAG_NPRIVATE_III = 0x0007, /* number of Layer III private bits */ + MAD_FLAG_INCOMPLETE = 0x0008, /* header but not data is decoded */ - MAD_FLAG_PROTECTION = 0x0010, /* frame has CRC protection */ - MAD_FLAG_COPYRIGHT = 0x0020, /* frame is copyright */ - MAD_FLAG_ORIGINAL = 0x0040, /* frame is original (else copy) */ - MAD_FLAG_PADDING = 0x0080, /* frame has additional slot */ + MAD_FLAG_PROTECTION = 0x0010, /* frame has CRC protection */ + MAD_FLAG_COPYRIGHT = 0x0020, /* frame is copyright */ + MAD_FLAG_ORIGINAL = 0x0040, /* frame is original (else copy) */ + MAD_FLAG_PADDING = 0x0080, /* frame has additional slot */ - MAD_FLAG_I_STEREO = 0x0100, /* uses intensity joint stereo */ - MAD_FLAG_MS_STEREO = 0x0200, /* uses middle/side joint stereo */ - MAD_FLAG_FREEFORMAT = 0x0400, /* uses free format bitrate */ + MAD_FLAG_I_STEREO = 0x0100, /* uses intensity joint stereo */ + MAD_FLAG_MS_STEREO = 0x0200, /* uses middle/side joint stereo */ + MAD_FLAG_FREEFORMAT = 0x0400, /* uses free format bitrate */ - MAD_FLAG_LSF_EXT = 0x1000, /* lower sampling freq. extension */ - MAD_FLAG_MC_EXT = 0x2000, /* multichannel audio extension */ - MAD_FLAG_MPEG_2_5_EXT = 0x4000 /* MPEG 2.5 (unofficial) extension */ + MAD_FLAG_LSF_EXT = 0x1000, /* lower sampling freq. extension */ + MAD_FLAG_MC_EXT = 0x2000, /* multichannel audio extension */ + MAD_FLAG_MPEG_2_5_EXT = 0x4000 /* MPEG 2.5 (unofficial) extension */ }; enum { - MAD_PRIVATE_HEADER = 0x0100, /* header private bit */ - MAD_PRIVATE_III = 0x001f /* Layer III private bits (up to 5) */ + MAD_PRIVATE_HEADER = 0x0100, /* header private bit */ + MAD_PRIVATE_III = 0x001f /* Layer III private bits (up to 5) */ }; void mad_header_init(struct mad_header *); @@ -838,19 +838,19 @@ void mad_frame_mute(struct mad_frame *); struct mad_pcm { - unsigned int samplerate; /* sampling frequency (Hz) */ - unsigned short channels; /* number of channels */ - unsigned short length; /* number of samples per channel */ - mad_fixed_t samples[2][1152]; /* PCM output samples [ch][sample] */ + unsigned int samplerate; /* sampling frequency (Hz) */ + unsigned short channels; /* number of channels */ + unsigned short length; /* number of samples per channel */ + mad_fixed_t samples[2][1152]; /* PCM output samples [ch][sample] */ }; struct mad_synth { - mad_fixed_t filter[2][2][2][16][8]; /* polyphase filterbank outputs */ - /* [ch][eo][peo][s][v] */ + mad_fixed_t filter[2][2][2][16][8]; /* polyphase filterbank outputs */ + /* [ch][eo][peo][s][v] */ - unsigned int phase; /* current processing phase */ + unsigned int phase; /* current processing phase */ - struct mad_pcm pcm; /* PCM output */ + struct mad_pcm pcm; /* PCM output */ }; /* single channel PCM selector */ @@ -892,10 +892,10 @@ enum mad_decoder_mode { }; enum mad_flow { - MAD_FLOW_CONTINUE = 0x0000, /* continue normally */ - MAD_FLOW_STOP = 0x0010, /* stop decoding normally */ - MAD_FLOW_BREAK = 0x0011, /* stop decoding and signal an error */ - MAD_FLOW_IGNORE = 0x0020 /* ignore the current frame */ + MAD_FLOW_CONTINUE = 0x0000, /* continue normally */ + MAD_FLOW_STOP = 0x0010, /* stop decoding normally */ + MAD_FLOW_BREAK = 0x0011, /* stop decoding and signal an error */ + MAD_FLOW_IGNORE = 0x0020 /* ignore the current frame */ }; struct mad_decoder { @@ -920,26 +920,26 @@ struct mad_decoder { enum mad_flow (*input_func)(void *, struct mad_stream *); enum mad_flow (*header_func)(void *, struct mad_header const *); enum mad_flow (*filter_func)(void *, - struct mad_stream const *, struct mad_frame *); + struct mad_stream const *, struct mad_frame *); enum mad_flow (*output_func)(void *, - struct mad_header const *, struct mad_pcm *); + struct mad_header const *, struct mad_pcm *); enum mad_flow (*error_func)(void *, struct mad_stream *, struct mad_frame *); enum mad_flow (*message_func)(void *, void *, unsigned int *); }; void mad_decoder_init(struct mad_decoder *, void *, - enum mad_flow (*)(void *, struct mad_stream *), - enum mad_flow (*)(void *, struct mad_header const *), - enum mad_flow (*)(void *, - struct mad_stream const *, - struct mad_frame *), - enum mad_flow (*)(void *, - struct mad_header const *, - struct mad_pcm *), - enum mad_flow (*)(void *, - struct mad_stream *, - struct mad_frame *), - enum mad_flow (*)(void *, void *, unsigned int *)); + enum mad_flow (*)(void *, struct mad_stream *), + enum mad_flow (*)(void *, struct mad_header const *), + enum mad_flow (*)(void *, + struct mad_stream const *, + struct mad_frame *), + enum mad_flow (*)(void *, + struct mad_header const *, + struct mad_pcm *), + enum mad_flow (*)(void *, + struct mad_stream *, + struct mad_frame *), + enum mad_flow (*)(void *, void *, unsigned int *)); int mad_decoder_finish(struct mad_decoder *); # define mad_decoder_options(decoder, opts) \ diff --git a/apps/codecs/libmad/minimad.c b/apps/codecs/libmad/minimad.c index e32e0d6a38..6b443cf859 100644 --- a/apps/codecs/libmad/minimad.c +++ b/apps/codecs/libmad/minimad.c @@ -82,7 +82,7 @@ struct buffer { static enum mad_flow input(void *data, - struct mad_stream *stream) + struct mad_stream *stream) { struct buffer *buffer = data; @@ -128,8 +128,8 @@ signed int scale(mad_fixed_t sample) static enum mad_flow output(void *data, - struct mad_header const *header, - struct mad_pcm *pcm) + struct mad_header const *header, + struct mad_pcm *pcm) { unsigned int nchannels, nsamples; mad_fixed_t const *left_ch, *right_ch; @@ -169,14 +169,14 @@ enum mad_flow output(void *data, static enum mad_flow error(void *data, - struct mad_stream *stream, - struct mad_frame *frame) + struct mad_stream *stream, + struct mad_frame *frame) { struct buffer *buffer = data; fprintf(stderr, "decoding error 0x%04x (%s) at byte offset %u\n", - stream->error, mad_stream_errorstr(stream), - stream->this_frame - buffer->start); + stream->error, mad_stream_errorstr(stream), + stream->this_frame - buffer->start); /* return MAD_FLOW_BREAK here to stop decoding (and propagate an error) */ @@ -207,8 +207,8 @@ int decode(unsigned char const *start, unsigned long length) /* configure input, output, and error functions */ mad_decoder_init(&decoder, &buffer, - input, 0 /* header */, 0 /* filter */, output, - error, 0 /* message */); + input, 0 /* header */, 0 /* filter */, output, + error, 0 /* message */); /* start decoding */ diff --git a/apps/codecs/libmad/stream.c b/apps/codecs/libmad/stream.c index 69c963bb0d..2936736f76 100644 --- a/apps/codecs/libmad/stream.c +++ b/apps/codecs/libmad/stream.c @@ -29,8 +29,8 @@ # include "stream.h" /* - * NAME: stream->init() - * DESCRIPTION: initialize stream struct + * NAME: stream->init() + * DESCRIPTION: initialize stream struct */ void mad_stream_init(struct mad_stream *stream) { @@ -56,8 +56,8 @@ void mad_stream_init(struct mad_stream *stream) } /* - * NAME: stream->finish() - * DESCRIPTION: deallocate any dynamic memory associated with stream + * NAME: stream->finish() + * DESCRIPTION: deallocate any dynamic memory associated with stream */ void mad_stream_finish(struct mad_stream *stream) { @@ -71,11 +71,11 @@ void mad_stream_finish(struct mad_stream *stream) } /* - * NAME: stream->buffer() - * DESCRIPTION: set stream buffer pointers + * NAME: stream->buffer() + * DESCRIPTION: set stream buffer pointers */ void mad_stream_buffer(struct mad_stream *stream, - unsigned char const *buffer, unsigned long length) + unsigned char const *buffer, unsigned long length) { stream->buffer = buffer; stream->bufend = buffer + length; @@ -89,8 +89,8 @@ void mad_stream_buffer(struct mad_stream *stream, } /* - * NAME: stream->skip() - * DESCRIPTION: arrange to skip bytes before the next frame + * NAME: stream->skip() + * DESCRIPTION: arrange to skip bytes before the next frame */ void mad_stream_skip(struct mad_stream *stream, unsigned long length) { @@ -98,8 +98,8 @@ void mad_stream_skip(struct mad_stream *stream, unsigned long length) } /* - * NAME: stream->sync() - * DESCRIPTION: locate the next stream sync word + * NAME: stream->sync() + * DESCRIPTION: locate the next stream sync word */ int mad_stream_sync(struct mad_stream *stream) { @@ -109,7 +109,7 @@ int mad_stream_sync(struct mad_stream *stream) end = stream->bufend; while (ptr < end - 1 && - !(ptr[0] == 0xff && (ptr[1] & 0xe0) == 0xe0)) + !(ptr[0] == 0xff && (ptr[1] & 0xe0) == 0xe0)) ++ptr; if (end - ptr < MAD_BUFFER_GUARD) @@ -121,38 +121,38 @@ int mad_stream_sync(struct mad_stream *stream) } /* - * NAME: stream->errorstr() - * DESCRIPTION: return a string description of the current error condition + * NAME: stream->errorstr() + * DESCRIPTION: return a string description of the current error condition */ char const *mad_stream_errorstr(struct mad_stream const *stream) { switch (stream->error) { - case MAD_ERROR_NONE: return "no error"; + case MAD_ERROR_NONE: return "no error"; - case MAD_ERROR_BUFLEN: return "input buffer too small (or EOF)"; - case MAD_ERROR_BUFPTR: return "invalid (null) buffer pointer"; + case MAD_ERROR_BUFLEN: return "input buffer too small (or EOF)"; + case MAD_ERROR_BUFPTR: return "invalid (null) buffer pointer"; - case MAD_ERROR_NOMEM: return "not enough memory"; + case MAD_ERROR_NOMEM: return "not enough memory"; - case MAD_ERROR_LOSTSYNC: return "lost synchronization"; - case MAD_ERROR_BADLAYER: return "reserved header layer value"; - case MAD_ERROR_BADBITRATE: return "forbidden bitrate value"; - case MAD_ERROR_BADSAMPLERATE: return "reserved sample frequency value"; - case MAD_ERROR_BADEMPHASIS: return "reserved emphasis value"; + case MAD_ERROR_LOSTSYNC: return "lost synchronization"; + case MAD_ERROR_BADLAYER: return "reserved header layer value"; + case MAD_ERROR_BADBITRATE: return "forbidden bitrate value"; + case MAD_ERROR_BADSAMPLERATE: return "reserved sample frequency value"; + case MAD_ERROR_BADEMPHASIS: return "reserved emphasis value"; - case MAD_ERROR_BADCRC: return "CRC check failed"; - case MAD_ERROR_BADBITALLOC: return "forbidden bit allocation value"; + case MAD_ERROR_BADCRC: return "CRC check failed"; + case MAD_ERROR_BADBITALLOC: return "forbidden bit allocation value"; case MAD_ERROR_BADSCALEFACTOR: return "bad scalefactor index"; - case MAD_ERROR_BADMODE: return "bad bitrate/mode combination"; - case MAD_ERROR_BADFRAMELEN: return "bad frame length"; - case MAD_ERROR_BADBIGVALUES: return "bad big_values count"; - case MAD_ERROR_BADBLOCKTYPE: return "reserved block_type"; - case MAD_ERROR_BADSCFSI: return "bad scalefactor selection info"; - case MAD_ERROR_BADDATAPTR: return "bad main_data_begin pointer"; - case MAD_ERROR_BADPART3LEN: return "bad audio data length"; - case MAD_ERROR_BADHUFFTABLE: return "bad Huffman table select"; - case MAD_ERROR_BADHUFFDATA: return "Huffman data overrun"; - case MAD_ERROR_BADSTEREO: return "incompatible block_type for JS"; + case MAD_ERROR_BADMODE: return "bad bitrate/mode combination"; + case MAD_ERROR_BADFRAMELEN: return "bad frame length"; + case MAD_ERROR_BADBIGVALUES: return "bad big_values count"; + case MAD_ERROR_BADBLOCKTYPE: return "reserved block_type"; + case MAD_ERROR_BADSCFSI: return "bad scalefactor selection info"; + case MAD_ERROR_BADDATAPTR: return "bad main_data_begin pointer"; + case MAD_ERROR_BADPART3LEN: return "bad audio data length"; + case MAD_ERROR_BADHUFFTABLE: return "bad Huffman table select"; + case MAD_ERROR_BADHUFFDATA: return "Huffman data overrun"; + case MAD_ERROR_BADSTEREO: return "incompatible block_type for JS"; } return 0; diff --git a/apps/codecs/libmad/stream.h b/apps/codecs/libmad/stream.h index 5fca48fdb8..c89c40e088 100644 --- a/apps/codecs/libmad/stream.h +++ b/apps/codecs/libmad/stream.h @@ -24,70 +24,70 @@ # include "bit.h" -# define MAD_BUFFER_GUARD 8 -# define MAD_BUFFER_MDLEN (511 + 2048 + MAD_BUFFER_GUARD) +# define MAD_BUFFER_GUARD 8 +# define MAD_BUFFER_MDLEN (511 + 2048 + MAD_BUFFER_GUARD) enum mad_error { - MAD_ERROR_NONE = 0x0000, /* no error */ - - MAD_ERROR_BUFLEN = 0x0001, /* input buffer too small (or EOF) */ - MAD_ERROR_BUFPTR = 0x0002, /* invalid (null) buffer pointer */ - - MAD_ERROR_NOMEM = 0x0031, /* not enough memory */ - - MAD_ERROR_LOSTSYNC = 0x0101, /* lost synchronization */ - MAD_ERROR_BADLAYER = 0x0102, /* reserved header layer value */ - MAD_ERROR_BADBITRATE = 0x0103, /* forbidden bitrate value */ - MAD_ERROR_BADSAMPLERATE = 0x0104, /* reserved sample frequency value */ - MAD_ERROR_BADEMPHASIS = 0x0105, /* reserved emphasis value */ - - MAD_ERROR_BADCRC = 0x0201, /* CRC check failed */ - MAD_ERROR_BADBITALLOC = 0x0211, /* forbidden bit allocation value */ - MAD_ERROR_BADSCALEFACTOR = 0x0221, /* bad scalefactor index */ - MAD_ERROR_BADMODE = 0x0222, /* bad bitrate/mode combination */ - MAD_ERROR_BADFRAMELEN = 0x0231, /* bad frame length */ - MAD_ERROR_BADBIGVALUES = 0x0232, /* bad big_values count */ - MAD_ERROR_BADBLOCKTYPE = 0x0233, /* reserved block_type */ - MAD_ERROR_BADSCFSI = 0x0234, /* bad scalefactor selection info */ - MAD_ERROR_BADDATAPTR = 0x0235, /* bad main_data_begin pointer */ - MAD_ERROR_BADPART3LEN = 0x0236, /* bad audio data length */ - MAD_ERROR_BADHUFFTABLE = 0x0237, /* bad Huffman table select */ - MAD_ERROR_BADHUFFDATA = 0x0238, /* Huffman data overrun */ - MAD_ERROR_BADSTEREO = 0x0239 /* incompatible block_type for JS */ + MAD_ERROR_NONE = 0x0000, /* no error */ + + MAD_ERROR_BUFLEN = 0x0001, /* input buffer too small (or EOF) */ + MAD_ERROR_BUFPTR = 0x0002, /* invalid (null) buffer pointer */ + + MAD_ERROR_NOMEM = 0x0031, /* not enough memory */ + + MAD_ERROR_LOSTSYNC = 0x0101, /* lost synchronization */ + MAD_ERROR_BADLAYER = 0x0102, /* reserved header layer value */ + MAD_ERROR_BADBITRATE = 0x0103, /* forbidden bitrate value */ + MAD_ERROR_BADSAMPLERATE = 0x0104, /* reserved sample frequency value */ + MAD_ERROR_BADEMPHASIS = 0x0105, /* reserved emphasis value */ + + MAD_ERROR_BADCRC = 0x0201, /* CRC check failed */ + MAD_ERROR_BADBITALLOC = 0x0211, /* forbidden bit allocation value */ + MAD_ERROR_BADSCALEFACTOR = 0x0221, /* bad scalefactor index */ + MAD_ERROR_BADMODE = 0x0222, /* bad bitrate/mode combination */ + MAD_ERROR_BADFRAMELEN = 0x0231, /* bad frame length */ + MAD_ERROR_BADBIGVALUES = 0x0232, /* bad big_values count */ + MAD_ERROR_BADBLOCKTYPE = 0x0233, /* reserved block_type */ + MAD_ERROR_BADSCFSI = 0x0234, /* bad scalefactor selection info */ + MAD_ERROR_BADDATAPTR = 0x0235, /* bad main_data_begin pointer */ + MAD_ERROR_BADPART3LEN = 0x0236, /* bad audio data length */ + MAD_ERROR_BADHUFFTABLE = 0x0237, /* bad Huffman table select */ + MAD_ERROR_BADHUFFDATA = 0x0238, /* Huffman data overrun */ + MAD_ERROR_BADSTEREO = 0x0239 /* incompatible block_type for JS */ }; -# define MAD_RECOVERABLE(error) ((error) & 0xff00) +# define MAD_RECOVERABLE(error) ((error) & 0xff00) struct mad_stream { - unsigned char const *buffer; /* input bitstream buffer */ - unsigned char const *bufend; /* end of buffer */ - unsigned long skiplen; /* bytes to skip before next frame */ + unsigned char const *buffer; /* input bitstream buffer */ + unsigned char const *bufend; /* end of buffer */ + unsigned long skiplen; /* bytes to skip before next frame */ - int sync; /* stream sync found */ - unsigned long freerate; /* free bitrate (fixed) */ + int sync; /* stream sync found */ + unsigned long freerate; /* free bitrate (fixed) */ - unsigned char const *this_frame; /* start of current frame */ - unsigned char const *next_frame; /* start of next frame */ - struct mad_bitptr ptr; /* current processing bit pointer */ + unsigned char const *this_frame; /* start of current frame */ + unsigned char const *next_frame; /* start of next frame */ + struct mad_bitptr ptr; /* current processing bit pointer */ - struct mad_bitptr anc_ptr; /* ancillary bits pointer */ - unsigned int anc_bitlen; /* number of ancillary bits */ + struct mad_bitptr anc_ptr; /* ancillary bits pointer */ + unsigned int anc_bitlen; /* number of ancillary bits */ unsigned char (*main_data)[MAD_BUFFER_MDLEN]; - /* Layer III main_data() */ - unsigned int md_len; /* bytes in main_data */ + /* Layer III main_data() */ + unsigned int md_len; /* bytes in main_data */ - int options; /* decoding options (see below) */ - enum mad_error error; /* error code (see above) */ + int options; /* decoding options (see below) */ + enum mad_error error; /* error code (see above) */ }; enum { - MAD_OPTION_IGNORECRC = 0x0001, /* ignore CRC errors */ - MAD_OPTION_HALFSAMPLERATE = 0x0002 /* generate PCM at 1/2 sample rate */ + MAD_OPTION_IGNORECRC = 0x0001, /* ignore CRC errors */ + MAD_OPTION_HALFSAMPLERATE = 0x0002 /* generate PCM at 1/2 sample rate */ # if 0 /* not yet implemented */ - MAD_OPTION_LEFTCHANNEL = 0x0010, /* decode left channel only */ - MAD_OPTION_RIGHTCHANNEL = 0x0020, /* decode right channel only */ - MAD_OPTION_SINGLECHANNEL = 0x0030 /* combine channels */ + MAD_OPTION_LEFTCHANNEL = 0x0010, /* decode left channel only */ + MAD_OPTION_RIGHTCHANNEL = 0x0020, /* decode right channel only */ + MAD_OPTION_SINGLECHANNEL = 0x0030 /* combine channels */ # endif }; @@ -98,7 +98,7 @@ void mad_stream_finish(struct mad_stream *); ((void) ((stream)->options = (opts))) void mad_stream_buffer(struct mad_stream *, - unsigned char const *, unsigned long); + unsigned char const *, unsigned long); void mad_stream_skip(struct mad_stream *, unsigned long); int mad_stream_sync(struct mad_stream *); diff --git a/apps/codecs/libmad/synth.c b/apps/codecs/libmad/synth.c index bc7ac742fe..9b320b594d 100644 --- a/apps/codecs/libmad/synth.c +++ b/apps/codecs/libmad/synth.c @@ -30,8 +30,8 @@ # include "synth.h" /* - * NAME: synth->init() - * DESCRIPTION: initialize synth struct + * NAME: synth->init() + * DESCRIPTION: initialize synth struct */ void mad_synth_init(struct mad_synth *synth) { @@ -50,8 +50,8 @@ void mad_synth_init(struct mad_synth *synth) } /* - * NAME: synth->mute() - * DESCRIPTION: zero all polyphase filterbank values, resetting synthesis + * NAME: synth->mute() + * DESCRIPTION: zero all polyphase filterbank values, resetting synthesis */ void mad_synth_mute(struct mad_synth *synth) { @@ -60,8 +60,8 @@ void mad_synth_mute(struct mad_synth *synth) for (ch = 0; ch < 2; ++ch) { for (s = 0; s < 16; ++s) { for (v = 0; v < 8; ++v) { - synth->filter[ch][0][0][s][v] = synth->filter[ch][0][1][s][v] = - synth->filter[ch][1][0][s][v] = synth->filter[ch][1][1][s][v] = 0; + synth->filter[ch][0][0][s][v] = synth->filter[ch][0][1][s][v] = + synth->filter[ch][1][0][s][v] = synth->filter[ch][1][1][s][v] = 0; } } } @@ -142,12 +142,12 @@ void dct32(mad_fixed_t const in[32], unsigned int slot, # endif /* - * NAME: dct32() - * DESCRIPTION: perform fast in[32]->out[32] DCT + * NAME: dct32() + * DESCRIPTION: perform fast in[32]->out[32] DCT */ static void dct32(mad_fixed_t const in[32], unsigned int slot, - mad_fixed_t lo[16][8], mad_fixed_t hi[16][8]) + mad_fixed_t lo[16][8], mad_fixed_t hi[16][8]) { mad_fixed_t t0, t1, t2, t3, t4, t5, t6, t7; mad_fixed_t t8, t9, t10, t11, t12, t13, t14, t15; @@ -176,69 +176,69 @@ void dct32(mad_fixed_t const in[32], unsigned int slot, /* costab[i] = cos(PI / (2 * 32) * i) */ # if defined(OPT_DCTO) -# define costab1 MAD_F(0x7fd8878e) -# define costab2 MAD_F(0x7f62368f) -# define costab3 MAD_F(0x7e9d55fc) -# define costab4 MAD_F(0x7d8a5f40) -# define costab5 MAD_F(0x7c29fbee) -# define costab6 MAD_F(0x7a7d055b) -# define costab7 MAD_F(0x78848414) -# define costab8 MAD_F(0x7641af3d) -# define costab9 MAD_F(0x73b5ebd1) -# define costab10 MAD_F(0x70e2cbc6) -# define costab11 MAD_F(0x6dca0d14) -# define costab12 MAD_F(0x6a5d98a4) -# define costab13 MAD_F(0x66cf8120) -# define costab14 MAD_F(0x62f201ac) -# define costab15 MAD_F(0x5ed77c8a) -# define costab16 MAD_F(0x5a82799a) -# define costab17 MAD_F(0x55f5a4d2) -# define costab18 MAD_F(0x5133cc94) -# define costab19 MAD_F(0x4c3fdff4) -# define costab20 MAD_F(0x471cece7) -# define costab21 MAD_F(0x41ce1e65) -# define costab22 MAD_F(0x3c56ba70) -# define costab23 MAD_F(0x36ba2014) -# define costab24 MAD_F(0x30fbc54d) -# define costab25 MAD_F(0x2b1f34eb) -# define costab26 MAD_F(0x25280c5e) -# define costab27 MAD_F(0x1f19f97b) -# define costab28 MAD_F(0x18f8b83c) -# define costab29 MAD_F(0x12c8106f) -# define costab30 MAD_F(0x0c8bd35e) -# define costab31 MAD_F(0x0647d97c) +# define costab1 MAD_F(0x7fd8878e) +# define costab2 MAD_F(0x7f62368f) +# define costab3 MAD_F(0x7e9d55fc) +# define costab4 MAD_F(0x7d8a5f40) +# define costab5 MAD_F(0x7c29fbee) +# define costab6 MAD_F(0x7a7d055b) +# define costab7 MAD_F(0x78848414) +# define costab8 MAD_F(0x7641af3d) +# define costab9 MAD_F(0x73b5ebd1) +# define costab10 MAD_F(0x70e2cbc6) +# define costab11 MAD_F(0x6dca0d14) +# define costab12 MAD_F(0x6a5d98a4) +# define costab13 MAD_F(0x66cf8120) +# define costab14 MAD_F(0x62f201ac) +# define costab15 MAD_F(0x5ed77c8a) +# define costab16 MAD_F(0x5a82799a) +# define costab17 MAD_F(0x55f5a4d2) +# define costab18 MAD_F(0x5133cc94) +# define costab19 MAD_F(0x4c3fdff4) +# define costab20 MAD_F(0x471cece7) +# define costab21 MAD_F(0x41ce1e65) +# define costab22 MAD_F(0x3c56ba70) +# define costab23 MAD_F(0x36ba2014) +# define costab24 MAD_F(0x30fbc54d) +# define costab25 MAD_F(0x2b1f34eb) +# define costab26 MAD_F(0x25280c5e) +# define costab27 MAD_F(0x1f19f97b) +# define costab28 MAD_F(0x18f8b83c) +# define costab29 MAD_F(0x12c8106f) +# define costab30 MAD_F(0x0c8bd35e) +# define costab31 MAD_F(0x0647d97c) # else -# define costab1 MAD_F(0x0ffb10f2) /* 0.998795456 */ -# define costab2 MAD_F(0x0fec46d2) /* 0.995184727 */ -# define costab3 MAD_F(0x0fd3aac0) /* 0.989176510 */ -# define costab4 MAD_F(0x0fb14be8) /* 0.980785280 */ -# define costab5 MAD_F(0x0f853f7e) /* 0.970031253 */ -# define costab6 MAD_F(0x0f4fa0ab) /* 0.956940336 */ -# define costab7 MAD_F(0x0f109082) /* 0.941544065 */ -# define costab8 MAD_F(0x0ec835e8) /* 0.923879533 */ -# define costab9 MAD_F(0x0e76bd7a) /* 0.903989293 */ -# define costab10 MAD_F(0x0e1c5979) /* 0.881921264 */ -# define costab11 MAD_F(0x0db941a3) /* 0.857728610 */ -# define costab12 MAD_F(0x0d4db315) /* 0.831469612 */ -# define costab13 MAD_F(0x0cd9f024) /* 0.803207531 */ -# define costab14 MAD_F(0x0c5e4036) /* 0.773010453 */ -# define costab15 MAD_F(0x0bdaef91) /* 0.740951125 */ -# define costab16 MAD_F(0x0b504f33) /* 0.707106781 */ -# define costab17 MAD_F(0x0abeb49a) /* 0.671558955 */ -# define costab18 MAD_F(0x0a267993) /* 0.634393284 */ -# define costab19 MAD_F(0x0987fbfe) /* 0.595699304 */ -# define costab20 MAD_F(0x08e39d9d) /* 0.555570233 */ -# define costab21 MAD_F(0x0839c3cd) /* 0.514102744 */ -# define costab22 MAD_F(0x078ad74e) /* 0.471396737 */ -# define costab23 MAD_F(0x06d74402) /* 0.427555093 */ -# define costab24 MAD_F(0x061f78aa) /* 0.382683432 */ -# define costab25 MAD_F(0x0563e69d) /* 0.336889853 */ -# define costab26 MAD_F(0x04a5018c) /* 0.290284677 */ -# define costab27 MAD_F(0x03e33f2f) /* 0.242980180 */ -# define costab28 MAD_F(0x031f1708) /* 0.195090322 */ -# define costab29 MAD_F(0x0259020e) /* 0.146730474 */ -# define costab30 MAD_F(0x01917a5c) /* 0.098017140 */ -# define costab31 MAD_F(0x00c8fb30) /* 0.049067674 */ +# define costab1 MAD_F(0x0ffb10f2) /* 0.998795456 */ +# define costab2 MAD_F(0x0fec46d2) /* 0.995184727 */ +# define costab3 MAD_F(0x0fd3aac0) /* 0.989176510 */ +# define costab4 MAD_F(0x0fb14be8) /* 0.980785280 */ +# define costab5 MAD_F(0x0f853f7e) /* 0.970031253 */ +# define costab6 MAD_F(0x0f4fa0ab) /* 0.956940336 */ +# define costab7 MAD_F(0x0f109082) /* 0.941544065 */ +# define costab8 MAD_F(0x0ec835e8) /* 0.923879533 */ +# define costab9 MAD_F(0x0e76bd7a) /* 0.903989293 */ +# define costab10 MAD_F(0x0e1c5979) /* 0.881921264 */ +# define costab11 MAD_F(0x0db941a3) /* 0.857728610 */ +# define costab12 MAD_F(0x0d4db315) /* 0.831469612 */ +# define costab13 MAD_F(0x0cd9f024) /* 0.803207531 */ +# define costab14 MAD_F(0x0c5e4036) /* 0.773010453 */ +# define costab15 MAD_F(0x0bdaef91) /* 0.740951125 */ +# define costab16 MAD_F(0x0b504f33) /* 0.707106781 */ +# define costab17 MAD_F(0x0abeb49a) /* 0.671558955 */ +# define costab18 MAD_F(0x0a267993) /* 0.634393284 */ +# define costab19 MAD_F(0x0987fbfe) /* 0.595699304 */ +# define costab20 MAD_F(0x08e39d9d) /* 0.555570233 */ +# define costab21 MAD_F(0x0839c3cd) /* 0.514102744 */ +# define costab22 MAD_F(0x078ad74e) /* 0.471396737 */ +# define costab23 MAD_F(0x06d74402) /* 0.427555093 */ +# define costab24 MAD_F(0x061f78aa) /* 0.382683432 */ +# define costab25 MAD_F(0x0563e69d) /* 0.336889853 */ +# define costab26 MAD_F(0x04a5018c) /* 0.290284677 */ +# define costab27 MAD_F(0x03e33f2f) /* 0.242980180 */ +# define costab28 MAD_F(0x031f1708) /* 0.195090322 */ +# define costab29 MAD_F(0x0259020e) /* 0.146730474 */ +# define costab30 MAD_F(0x01917a5c) /* 0.098017140 */ +# define costab31 MAD_F(0x00c8fb30) /* 0.049067674 */ # endif t0 = in[0] + in[31]; t16 = MUL(in[0] - in[31], costab1); @@ -395,7 +395,7 @@ void dct32(mad_fixed_t const in[32], unsigned int slot, /* 8 */ hi[ 7][slot] = SHIFT(t143); /* 24 */ lo[ 8][slot] = - SHIFT((MUL(t141 - t142, costab16) * 2) - t143); + SHIFT((MUL(t141 - t142, costab16) * 2) - t143); t144 = MUL(t73 - t74, costab8); t145 = MUL(t75 - t76, costab24); @@ -435,7 +435,7 @@ void dct32(mad_fixed_t const in[32], unsigned int slot, /* 20 */ lo[ 4][slot] = SHIFT(t160); /* 28 */ lo[12][slot] = - SHIFT((((MUL(t157 - t158, costab16) * 2) - t159) * 2) - t160); + SHIFT((((MUL(t157 - t158, costab16) * 2) - t159) * 2) - t160); t161 = MUL(t94 - t95, costab8); t162 = MUL(t96 - t97, costab24); @@ -473,8 +473,8 @@ void dct32(mad_fixed_t const in[32], unsigned int slot, /* 26 */ lo[10][slot] = SHIFT(t170); /* 30 */ lo[14][slot] = - SHIFT((((((MUL(t166 - t167, costab16) * 2) - - t168) * 2) - t169) * 2) - t170); + SHIFT((((((MUL(t166 - t167, costab16) * 2) - + t168) * 2) - t169) * 2) - t170); t171 = MUL(t106 - t107, costab8); t172 = MUL(t108 - t109, costab24); @@ -521,12 +521,12 @@ void dct32(mad_fixed_t const in[32], unsigned int slot, /* 27 */ lo[11][slot] = SHIFT(t165); t176 = (((((MUL(t161 - t162, costab16) * 2) - - t163) * 2) - t164) * 2) - t165; + t163) * 2) - t164) * 2) - t165; /* 29 */ lo[13][slot] = SHIFT(t176); /* 31 */ lo[15][slot] = - SHIFT((((((((MUL(t171 - t172, costab16) * 2) - - t173) * 2) - t174) * 2) - t175) * 2) - t176); + SHIFT((((((((MUL(t171 - t172, costab16) * 2) - + t173) * 2) - t174) * 2) - t175) * 2) - t176); /* * Totals: @@ -548,24 +548,24 @@ void dct32(mad_fixed_t const in[32], unsigned int slot, # if MAD_F_FRACBITS != 28 # error "MAD_F_FRACBITS must be 28 to use OPT_SSO" # endif -# define ML0(hi, lo, x, y) ((lo) = (x) * (y)) -# define MLA(hi, lo, x, y) ((lo) += (x) * (y)) -# define MLN(hi, lo) ((lo) = -(lo)) -# define MLZ(hi, lo) ((void) (hi), (mad_fixed_t) (lo)) -# define SHIFT(x) ((x) >> 2) -# define PRESHIFT(x) ((MAD_F(x) + (1L << 13)) >> 14) +# define ML0(hi, lo, x, y) ((lo) = (x) * (y)) +# define MLA(hi, lo, x, y) ((lo) += (x) * (y)) +# define MLN(hi, lo) ((lo) = -(lo)) +# define MLZ(hi, lo) ((void) (hi), (mad_fixed_t) (lo)) +# define SHIFT(x) ((x) >> 2) +# define PRESHIFT(x) ((MAD_F(x) + (1L << 13)) >> 14) # else -# define ML0(hi, lo, x, y) MAD_F_ML0((hi), (lo), (x), (y)) -# define MLA(hi, lo, x, y) MAD_F_MLA((hi), (lo), (x), (y)) -# define MLN(hi, lo) MAD_F_MLN((hi), (lo)) -# define MLZ(hi, lo) MAD_F_MLZ((hi), (lo)) -# define SHIFT(x) (x) +# define ML0(hi, lo, x, y) MAD_F_ML0((hi), (lo), (x), (y)) +# define MLA(hi, lo, x, y) MAD_F_MLA((hi), (lo), (x), (y)) +# define MLN(hi, lo) MAD_F_MLN((hi), (lo)) +# define MLZ(hi, lo) MAD_F_MLZ((hi), (lo)) +# define SHIFT(x) (x) # if defined(MAD_F_SCALEBITS) # undef MAD_F_SCALEBITS -# define MAD_F_SCALEBITS (MAD_F_FRACBITS - 12) -# define PRESHIFT(x) (MAD_F(x) >> 12) +# define MAD_F_SCALEBITS (MAD_F_FRACBITS - 12) +# define PRESHIFT(x) (MAD_F(x) >> 12) # else -# define PRESHIFT(x) MAD_F(x) +# define PRESHIFT(x) MAD_F(x) # endif # endif @@ -576,18 +576,18 @@ mad_fixed_t const D[17][32] ICONST_ATTR = { # if defined(ASO_SYNTH) void synth_full(struct mad_synth *, struct mad_frame const *, - unsigned int, unsigned int); + unsigned int, unsigned int); # else /* - * NAME: synth->full() - * DESCRIPTION: perform full frequency PCM synthesis + * NAME: synth->full() + * DESCRIPTION: perform full frequency PCM synthesis */ /* optimised version of synth_full */ # ifdef FPM_COLDFIRE_EMAC static void synth_full(struct mad_synth *synth, struct mad_frame const *frame, - unsigned int nch, unsigned int ns) + unsigned int nch, unsigned int ns) { int sb; unsigned int phase, ch, s, p; @@ -606,7 +606,7 @@ void synth_full(struct mad_synth *synth, struct mad_frame const *frame, for (s = 0; s < ns; ++s) { dct32((*sbsample)[s], phase >> 1, - (*filter)[0][phase & 1], (*filter)[1][phase & 1]); + (*filter)[0][phase & 1], (*filter)[1][phase & 1]); p = (phase - 1) & 0xf; @@ -649,11 +649,11 @@ void synth_full(struct mad_synth *synth, struct mad_frame const *frame, pcm += 16; for (sb = 15; sb; sb--, fo++) { - ++fe; - ++D0ptr; - ++D1ptr; + ++fe; + ++D0ptr; + ++D1ptr; - /* D[32 - sb][i] == -D[sb][31 - i] */ + /* D[32 - sb][i] == -D[sb][31 - i] */ asm volatile ( "movem.l (%0), %%d0-%%d7\n\t" "move.l 4(%2), %%a5\n\t" @@ -697,8 +697,8 @@ void synth_full(struct mad_synth *synth, struct mad_frame const *frame, "movclr.l %%acc0, %0\n\t" "movclr.l %%acc1, %1\n\t" : "=d" (hi0), "=d" (hi1) ); - pcm[-sb] = hi0 << 3; - pcm[ sb] = hi1 << 3; + pcm[-sb] = hi0 << 3; + pcm[ sb] = hi1 << 3; } ++D0ptr; @@ -750,11 +750,11 @@ void synth_full(struct mad_synth *synth, struct mad_frame const *frame, pcm += 16; for (sb = 15; sb; sb--, fo++) { - ++fe; - ++D0ptr; - ++D1ptr; + ++fe; + ++D0ptr; + ++D1ptr; - /* D[32 - sb][i] == -D[sb][31 - i] */ + /* D[32 - sb][i] == -D[sb][31 - i] */ asm volatile ( "movem.l (%0), %%d0-%%d7\n\t" "move.l (%2), %%a5\n\t" @@ -798,8 +798,8 @@ void synth_full(struct mad_synth *synth, struct mad_frame const *frame, "movclr.l %%acc0, %0\n\t" "movclr.l %%acc1, %1\n\t" : "=d" (hi0), "=d" (hi1) ); - pcm[-sb] = hi0 << 3; - pcm[ sb] = hi1 << 3; + pcm[-sb] = hi0 << 3; + pcm[ sb] = hi1 << 3; } ++D0ptr; @@ -1045,10 +1045,10 @@ void synth_full2(mad_fixed_t *pcm, mad_fixed_t (*fo)[8], mad_fixed_t (*fe)[8], static void synth_full(struct mad_synth *synth, struct mad_frame const *frame, - unsigned int nch, unsigned int ns) ICODE_ATTR_MPA_SYNTH; + unsigned int nch, unsigned int ns) ICODE_ATTR_MPA_SYNTH; static void synth_full(struct mad_synth *synth, struct mad_frame const *frame, - unsigned int nch, unsigned int ns) + unsigned int nch, unsigned int ns) { int p; unsigned int phase, ch, s; @@ -1068,7 +1068,7 @@ void synth_full(struct mad_synth *synth, struct mad_frame const *frame, for (s = 0; s < ns; ++s) { dct32((*sbsample)[s], phase >> 1, - (*filter)[0][phase & 1], (*filter)[1][phase & 1]); + (*filter)[0][phase & 1], (*filter)[1][phase & 1]); p = (phase - 1) & 0xf; @@ -1189,7 +1189,7 @@ void synth_full(struct mad_synth *synth, struct mad_frame const *frame, static void synth_full(struct mad_synth *synth, struct mad_frame const *frame, - unsigned int nch, unsigned int ns) + unsigned int nch, unsigned int ns) { int p, sb; unsigned int phase, ch, s; @@ -1209,7 +1209,7 @@ void synth_full(struct mad_synth *synth, struct mad_frame const *frame, for (s = 0; s < ns; ++s) { dct32((*sbsample)[s], phase >> 1, - (*filter)[0][phase & 1], (*filter)[1][phase & 1]); + (*filter)[0][phase & 1], (*filter)[1][phase & 1]); p = (phase - 1) & 0xf; @@ -1246,49 +1246,49 @@ void synth_full(struct mad_synth *synth, struct mad_frame const *frame, for (sb = 15; sb; sb--, fo++) { - ++fe; - ++D0ptr; - ++D1ptr; - - /* D[32 - sb][i] == -D[sb][31 - i] */ - ptr = *D0ptr; - ML0(hi, lo, (*fo)[0], ptr[ 1]); - MLA(hi, lo, (*fo)[1], ptr[15]); - MLA(hi, lo, (*fo)[2], ptr[13]); - MLA(hi, lo, (*fo)[3], ptr[11]); - MLA(hi, lo, (*fo)[4], ptr[ 9]); - MLA(hi, lo, (*fo)[5], ptr[ 7]); - MLA(hi, lo, (*fo)[6], ptr[ 5]); - MLA(hi, lo, (*fo)[7], ptr[ 3]); - MLN(hi, lo); - MLA(hi, lo, (*fe)[7], ptr[ 2]); - MLA(hi, lo, (*fe)[6], ptr[ 4]); - MLA(hi, lo, (*fe)[5], ptr[ 6]); - MLA(hi, lo, (*fe)[4], ptr[ 8]); - MLA(hi, lo, (*fe)[3], ptr[10]); - MLA(hi, lo, (*fe)[2], ptr[12]); - MLA(hi, lo, (*fe)[1], ptr[14]); - MLA(hi, lo, (*fe)[0], ptr[ 0]); - pcm[-sb] = SHIFT(MLZ(hi, lo)); - - ptr = *D1ptr; - ML0(hi, lo, (*fe)[0], ptr[31 - 16]); - MLA(hi, lo, (*fe)[1], ptr[31 - 14]); - MLA(hi, lo, (*fe)[2], ptr[31 - 12]); - MLA(hi, lo, (*fe)[3], ptr[31 - 10]); - MLA(hi, lo, (*fe)[4], ptr[31 - 8]); - MLA(hi, lo, (*fe)[5], ptr[31 - 6]); - MLA(hi, lo, (*fe)[6], ptr[31 - 4]); - MLA(hi, lo, (*fe)[7], ptr[31 - 2]); + ++fe; + ++D0ptr; + ++D1ptr; + + /* D[32 - sb][i] == -D[sb][31 - i] */ + ptr = *D0ptr; + ML0(hi, lo, (*fo)[0], ptr[ 1]); + MLA(hi, lo, (*fo)[1], ptr[15]); + MLA(hi, lo, (*fo)[2], ptr[13]); + MLA(hi, lo, (*fo)[3], ptr[11]); + MLA(hi, lo, (*fo)[4], ptr[ 9]); + MLA(hi, lo, (*fo)[5], ptr[ 7]); + MLA(hi, lo, (*fo)[6], ptr[ 5]); + MLA(hi, lo, (*fo)[7], ptr[ 3]); + MLN(hi, lo); + MLA(hi, lo, (*fe)[7], ptr[ 2]); + MLA(hi, lo, (*fe)[6], ptr[ 4]); + MLA(hi, lo, (*fe)[5], ptr[ 6]); + MLA(hi, lo, (*fe)[4], ptr[ 8]); + MLA(hi, lo, (*fe)[3], ptr[10]); + MLA(hi, lo, (*fe)[2], ptr[12]); + MLA(hi, lo, (*fe)[1], ptr[14]); + MLA(hi, lo, (*fe)[0], ptr[ 0]); + pcm[-sb] = SHIFT(MLZ(hi, lo)); + + ptr = *D1ptr; + ML0(hi, lo, (*fe)[0], ptr[31 - 16]); + MLA(hi, lo, (*fe)[1], ptr[31 - 14]); + MLA(hi, lo, (*fe)[2], ptr[31 - 12]); + MLA(hi, lo, (*fe)[3], ptr[31 - 10]); + MLA(hi, lo, (*fe)[4], ptr[31 - 8]); + MLA(hi, lo, (*fe)[5], ptr[31 - 6]); + MLA(hi, lo, (*fe)[6], ptr[31 - 4]); + MLA(hi, lo, (*fe)[7], ptr[31 - 2]); MLA(hi, lo, (*fo)[7], ptr[31 - 3]); - MLA(hi, lo, (*fo)[6], ptr[31 - 5]); - MLA(hi, lo, (*fo)[5], ptr[31 - 7]); - MLA(hi, lo, (*fo)[4], ptr[31 - 9]); - MLA(hi, lo, (*fo)[3], ptr[31 - 11]); - MLA(hi, lo, (*fo)[2], ptr[31 - 13]); - MLA(hi, lo, (*fo)[1], ptr[31 - 15]); - MLA(hi, lo, (*fo)[0], ptr[31 - 1]); - pcm[sb] = SHIFT(MLZ(hi, lo)); + MLA(hi, lo, (*fo)[6], ptr[31 - 5]); + MLA(hi, lo, (*fo)[5], ptr[31 - 7]); + MLA(hi, lo, (*fo)[4], ptr[31 - 9]); + MLA(hi, lo, (*fo)[3], ptr[31 - 11]); + MLA(hi, lo, (*fo)[2], ptr[31 - 13]); + MLA(hi, lo, (*fo)[1], ptr[31 - 15]); + MLA(hi, lo, (*fo)[0], ptr[31 - 1]); + pcm[sb] = SHIFT(MLZ(hi, lo)); } ptr = *(D0ptr + 1); @@ -1327,49 +1327,49 @@ void synth_full(struct mad_synth *synth, struct mad_frame const *frame, for (sb = 15; sb; sb--, fo++) { - ++fe; - ++D0ptr; - ++D1ptr; - - /* D[32 - sb][i] == -D[sb][31 - i] */ - ptr = *D0ptr; - ML0(hi, lo, (*fo)[0], ptr[ 0]); - MLA(hi, lo, (*fo)[1], ptr[14]); - MLA(hi, lo, (*fo)[2], ptr[12]); - MLA(hi, lo, (*fo)[3], ptr[10]); - MLA(hi, lo, (*fo)[4], ptr[ 8]); - MLA(hi, lo, (*fo)[5], ptr[ 6]); - MLA(hi, lo, (*fo)[6], ptr[ 4]); - MLA(hi, lo, (*fo)[7], ptr[ 2]); - MLN(hi, lo); - MLA(hi, lo, (*fe)[7], ptr[ 3]); - MLA(hi, lo, (*fe)[6], ptr[ 5]); - MLA(hi, lo, (*fe)[5], ptr[ 7]); - MLA(hi, lo, (*fe)[4], ptr[ 9]); - MLA(hi, lo, (*fe)[3], ptr[11]); - MLA(hi, lo, (*fe)[2], ptr[13]); - MLA(hi, lo, (*fe)[1], ptr[15]); - MLA(hi, lo, (*fe)[0], ptr[ 1]); - pcm[-sb] = SHIFT(MLZ(hi, lo)); - - ptr = *D1ptr; - ML0(hi, lo, (*fe)[0], ptr[31 - 1]); - MLA(hi, lo, (*fe)[1], ptr[31 - 15]); - MLA(hi, lo, (*fe)[2], ptr[31 - 13]); - MLA(hi, lo, (*fe)[3], ptr[31 - 11]); - MLA(hi, lo, (*fe)[4], ptr[31 - 9]); - MLA(hi, lo, (*fe)[5], ptr[31 - 7]); - MLA(hi, lo, (*fe)[6], ptr[31 - 5]); - MLA(hi, lo, (*fe)[7], ptr[31 - 3]); - MLA(hi, lo, (*fo)[7], ptr[31 - 2]); - MLA(hi, lo, (*fo)[6], ptr[31 - 4]); - MLA(hi, lo, (*fo)[5], ptr[31 - 6]); - MLA(hi, lo, (*fo)[4], ptr[31 - 8]); - MLA(hi, lo, (*fo)[3], ptr[31 - 10]); - MLA(hi, lo, (*fo)[2], ptr[31 - 12]); - MLA(hi, lo, (*fo)[1], ptr[31 - 14]); - MLA(hi, lo, (*fo)[0], ptr[31 - 16]); - pcm[sb] = SHIFT(MLZ(hi, lo)); + ++fe; + ++D0ptr; + ++D1ptr; + + /* D[32 - sb][i] == -D[sb][31 - i] */ + ptr = *D0ptr; + ML0(hi, lo, (*fo)[0], ptr[ 0]); + MLA(hi, lo, (*fo)[1], ptr[14]); + MLA(hi, lo, (*fo)[2], ptr[12]); + MLA(hi, lo, (*fo)[3], ptr[10]); + MLA(hi, lo, (*fo)[4], ptr[ 8]); + MLA(hi, lo, (*fo)[5], ptr[ 6]); + MLA(hi, lo, (*fo)[6], ptr[ 4]); + MLA(hi, lo, (*fo)[7], ptr[ 2]); + MLN(hi, lo); + MLA(hi, lo, (*fe)[7], ptr[ 3]); + MLA(hi, lo, (*fe)[6], ptr[ 5]); + MLA(hi, lo, (*fe)[5], ptr[ 7]); + MLA(hi, lo, (*fe)[4], ptr[ 9]); + MLA(hi, lo, (*fe)[3], ptr[11]); + MLA(hi, lo, (*fe)[2], ptr[13]); + MLA(hi, lo, (*fe)[1], ptr[15]); + MLA(hi, lo, (*fe)[0], ptr[ 1]); + pcm[-sb] = SHIFT(MLZ(hi, lo)); + + ptr = *D1ptr; + ML0(hi, lo, (*fe)[0], ptr[31 - 1]); + MLA(hi, lo, (*fe)[1], ptr[31 - 15]); + MLA(hi, lo, (*fe)[2], ptr[31 - 13]); + MLA(hi, lo, (*fe)[3], ptr[31 - 11]); + MLA(hi, lo, (*fe)[4], ptr[31 - 9]); + MLA(hi, lo, (*fe)[5], ptr[31 - 7]); + MLA(hi, lo, (*fe)[6], ptr[31 - 5]); + MLA(hi, lo, (*fe)[7], ptr[31 - 3]); + MLA(hi, lo, (*fo)[7], ptr[31 - 2]); + MLA(hi, lo, (*fo)[6], ptr[31 - 4]); + MLA(hi, lo, (*fo)[5], ptr[31 - 6]); + MLA(hi, lo, (*fo)[4], ptr[31 - 8]); + MLA(hi, lo, (*fo)[3], ptr[31 - 10]); + MLA(hi, lo, (*fo)[2], ptr[31 - 12]); + MLA(hi, lo, (*fo)[1], ptr[31 - 14]); + MLA(hi, lo, (*fo)[0], ptr[31 - 16]); + pcm[sb] = SHIFT(MLZ(hi, lo)); } ptr = *(D0ptr + 1); @@ -1394,12 +1394,12 @@ void synth_full(struct mad_synth *synth, struct mad_frame const *frame, # endif /* - * NAME: synth->half() - * DESCRIPTION: perform half frequency PCM synthesis + * NAME: synth->half() + * DESCRIPTION: perform half frequency PCM synthesis */ static void synth_half(struct mad_synth *synth, struct mad_frame const *frame, - unsigned int nch, unsigned int ns) + unsigned int nch, unsigned int ns) { unsigned int phase, ch, s, sb, pe, po; mad_fixed_t *pcm1, *pcm2, (*filter)[2][2][16][8]; @@ -1417,7 +1417,7 @@ void synth_half(struct mad_synth *synth, struct mad_frame const *frame, for (s = 0; s < ns; ++s) { dct32((*sbsample)[s], phase >> 1, - (*filter)[0][phase & 1], (*filter)[1][phase & 1]); + (*filter)[0][phase & 1], (*filter)[1][phase & 1]); pe = phase & ~1; po = ((phase - 1) & 0xf) | 1; @@ -1456,59 +1456,59 @@ void synth_half(struct mad_synth *synth, struct mad_frame const *frame, pcm2 = pcm1 + 14; for (sb = 1; sb < 16; ++sb) { - ++fe; - ++Dptr; - - /* D[32 - sb][i] == -D[sb][31 - i] */ - - if (!(sb & 1)) { - ptr = *Dptr + po; - ML0(hi, lo, (*fo)[0], ptr[ 0]); - MLA(hi, lo, (*fo)[1], ptr[14]); - MLA(hi, lo, (*fo)[2], ptr[12]); - MLA(hi, lo, (*fo)[3], ptr[10]); - MLA(hi, lo, (*fo)[4], ptr[ 8]); - MLA(hi, lo, (*fo)[5], ptr[ 6]); - MLA(hi, lo, (*fo)[6], ptr[ 4]); - MLA(hi, lo, (*fo)[7], ptr[ 2]); - MLN(hi, lo); - - ptr = *Dptr + pe; - MLA(hi, lo, (*fe)[7], ptr[ 2]); - MLA(hi, lo, (*fe)[6], ptr[ 4]); - MLA(hi, lo, (*fe)[5], ptr[ 6]); - MLA(hi, lo, (*fe)[4], ptr[ 8]); - MLA(hi, lo, (*fe)[3], ptr[10]); - MLA(hi, lo, (*fe)[2], ptr[12]); - MLA(hi, lo, (*fe)[1], ptr[14]); - MLA(hi, lo, (*fe)[0], ptr[ 0]); - - *pcm1++ = SHIFT(MLZ(hi, lo)); - - ptr = *Dptr - po; - ML0(hi, lo, (*fo)[7], ptr[31 - 2]); - MLA(hi, lo, (*fo)[6], ptr[31 - 4]); - MLA(hi, lo, (*fo)[5], ptr[31 - 6]); - MLA(hi, lo, (*fo)[4], ptr[31 - 8]); - MLA(hi, lo, (*fo)[3], ptr[31 - 10]); - MLA(hi, lo, (*fo)[2], ptr[31 - 12]); - MLA(hi, lo, (*fo)[1], ptr[31 - 14]); - MLA(hi, lo, (*fo)[0], ptr[31 - 16]); - - ptr = *Dptr - pe; - MLA(hi, lo, (*fe)[0], ptr[31 - 16]); - MLA(hi, lo, (*fe)[1], ptr[31 - 14]); - MLA(hi, lo, (*fe)[2], ptr[31 - 12]); - MLA(hi, lo, (*fe)[3], ptr[31 - 10]); - MLA(hi, lo, (*fe)[4], ptr[31 - 8]); - MLA(hi, lo, (*fe)[5], ptr[31 - 6]); - MLA(hi, lo, (*fe)[6], ptr[31 - 4]); - MLA(hi, lo, (*fe)[7], ptr[31 - 2]); - - *pcm2-- = SHIFT(MLZ(hi, lo)); - } - - ++fo; + ++fe; + ++Dptr; + + /* D[32 - sb][i] == -D[sb][31 - i] */ + + if (!(sb & 1)) { + ptr = *Dptr + po; + ML0(hi, lo, (*fo)[0], ptr[ 0]); + MLA(hi, lo, (*fo)[1], ptr[14]); + MLA(hi, lo, (*fo)[2], ptr[12]); + MLA(hi, lo, (*fo)[3], ptr[10]); + MLA(hi, lo, (*fo)[4], ptr[ 8]); + MLA(hi, lo, (*fo)[5], ptr[ 6]); + MLA(hi, lo, (*fo)[6], ptr[ 4]); + MLA(hi, lo, (*fo)[7], ptr[ 2]); + MLN(hi, lo); + + ptr = *Dptr + pe; + MLA(hi, lo, (*fe)[7], ptr[ 2]); + MLA(hi, lo, (*fe)[6], ptr[ 4]); + MLA(hi, lo, (*fe)[5], ptr[ 6]); + MLA(hi, lo, (*fe)[4], ptr[ 8]); + MLA(hi, lo, (*fe)[3], ptr[10]); + MLA(hi, lo, (*fe)[2], ptr[12]); + MLA(hi, lo, (*fe)[1], ptr[14]); + MLA(hi, lo, (*fe)[0], ptr[ 0]); + + *pcm1++ = SHIFT(MLZ(hi, lo)); + + ptr = *Dptr - po; + ML0(hi, lo, (*fo)[7], ptr[31 - 2]); + MLA(hi, lo, (*fo)[6], ptr[31 - 4]); + MLA(hi, lo, (*fo)[5], ptr[31 - 6]); + MLA(hi, lo, (*fo)[4], ptr[31 - 8]); + MLA(hi, lo, (*fo)[3], ptr[31 - 10]); + MLA(hi, lo, (*fo)[2], ptr[31 - 12]); + MLA(hi, lo, (*fo)[1], ptr[31 - 14]); + MLA(hi, lo, (*fo)[0], ptr[31 - 16]); + + ptr = *Dptr - pe; + MLA(hi, lo, (*fe)[0], ptr[31 - 16]); + MLA(hi, lo, (*fe)[1], ptr[31 - 14]); + MLA(hi, lo, (*fe)[2], ptr[31 - 12]); + MLA(hi, lo, (*fe)[3], ptr[31 - 10]); + MLA(hi, lo, (*fe)[4], ptr[31 - 8]); + MLA(hi, lo, (*fe)[5], ptr[31 - 6]); + MLA(hi, lo, (*fe)[6], ptr[31 - 4]); + MLA(hi, lo, (*fe)[7], ptr[31 - 2]); + + *pcm2-- = SHIFT(MLZ(hi, lo)); + } + + ++fo; } ++Dptr; @@ -1532,14 +1532,14 @@ void synth_half(struct mad_synth *synth, struct mad_frame const *frame, } /* - * NAME: synth->frame() - * DESCRIPTION: perform PCM synthesis of frame subband samples + * NAME: synth->frame() + * DESCRIPTION: perform PCM synthesis of frame subband samples */ void mad_synth_frame(struct mad_synth *synth, struct mad_frame const *frame) { unsigned int nch, ns; void (*synth_frame)(struct mad_synth *, struct mad_frame const *, - unsigned int, unsigned int); + unsigned int, unsigned int); nch = MAD_NCHANNELS(&frame->header); ns = MAD_NSBSAMPLES(&frame->header); diff --git a/apps/codecs/libmad/synth.h b/apps/codecs/libmad/synth.h index d284d01556..74975b9ad8 100644 --- a/apps/codecs/libmad/synth.h +++ b/apps/codecs/libmad/synth.h @@ -26,19 +26,19 @@ # include "frame.h" struct mad_pcm { - unsigned int samplerate; /* sampling frequency (Hz) */ - unsigned short channels; /* number of channels */ - unsigned short length; /* number of samples per channel */ - mad_fixed_t samples[2][1152]; /* PCM output samples [ch][sample] */ + unsigned int samplerate; /* sampling frequency (Hz) */ + unsigned short channels; /* number of channels */ + unsigned short length; /* number of samples per channel */ + mad_fixed_t samples[2][1152]; /* PCM output samples [ch][sample] */ }; struct mad_synth { - mad_fixed_t filter[2][2][2][16][8]; /* polyphase filterbank outputs */ - /* [ch][eo][peo][s][v] */ + mad_fixed_t filter[2][2][2][16][8]; /* polyphase filterbank outputs */ + /* [ch][eo][peo][s][v] */ - unsigned int phase; /* current processing phase */ + unsigned int phase; /* current processing phase */ - struct mad_pcm pcm; /* PCM output */ + struct mad_pcm pcm; /* PCM output */ }; /* single channel PCM selector */ diff --git a/apps/codecs/libmad/timer.c b/apps/codecs/libmad/timer.c index a24595dde3..33ea4a6fbc 100644 --- a/apps/codecs/libmad/timer.c +++ b/apps/codecs/libmad/timer.c @@ -36,8 +36,8 @@ mad_timer_t const mad_timer_zero = { 0, 0 }; /* - * NAME: timer->compare() - * DESCRIPTION: indicate relative order of two timers + * NAME: timer->compare() + * DESCRIPTION: indicate relative order of two timers */ int mad_timer_compare(mad_timer_t timer1, mad_timer_t timer2) { @@ -59,8 +59,8 @@ int mad_timer_compare(mad_timer_t timer1, mad_timer_t timer2) } /* - * NAME: timer->negate() - * DESCRIPTION: invert the sign of a timer + * NAME: timer->negate() + * DESCRIPTION: invert the sign of a timer */ void mad_timer_negate(mad_timer_t *timer) { @@ -73,8 +73,8 @@ void mad_timer_negate(mad_timer_t *timer) } /* - * NAME: timer->abs() - * DESCRIPTION: return the absolute value of a timer + * NAME: timer->abs() + * DESCRIPTION: return the absolute value of a timer */ mad_timer_t mad_timer_abs(mad_timer_t timer) { @@ -85,8 +85,8 @@ mad_timer_t mad_timer_abs(mad_timer_t timer) } /* - * NAME: reduce_timer() - * DESCRIPTION: carry timer fraction into seconds + * NAME: reduce_timer() + * DESCRIPTION: carry timer fraction into seconds */ static void reduce_timer(mad_timer_t *timer) @@ -96,8 +96,8 @@ void reduce_timer(mad_timer_t *timer) } /* - * NAME: gcd() - * DESCRIPTION: compute greatest common denominator + * NAME: gcd() + * DESCRIPTION: compute greatest common denominator */ static unsigned long gcd(unsigned long num1, unsigned long num2) @@ -114,8 +114,8 @@ unsigned long gcd(unsigned long num1, unsigned long num2) } /* - * NAME: reduce_rational() - * DESCRIPTION: convert rational expression to lowest terms + * NAME: reduce_rational() + * DESCRIPTION: convert rational expression to lowest terms */ static void reduce_rational(unsigned long *numer, unsigned long *denom) @@ -131,12 +131,12 @@ void reduce_rational(unsigned long *numer, unsigned long *denom) } /* - * NAME: scale_rational() - * DESCRIPTION: solve numer/denom == ?/scale avoiding overflowing + * NAME: scale_rational() + * DESCRIPTION: solve numer/denom == ?/scale avoiding overflowing */ static unsigned long scale_rational(unsigned long numer, unsigned long denom, - unsigned long scale) + unsigned long scale) { reduce_rational(&numer, &denom); reduce_rational(&scale, &denom); @@ -152,11 +152,11 @@ unsigned long scale_rational(unsigned long numer, unsigned long denom, } /* - * NAME: timer->set() - * DESCRIPTION: set timer to specific (positive) value + * NAME: timer->set() + * DESCRIPTION: set timer to specific (positive) value */ void mad_timer_set(mad_timer_t *timer, unsigned long seconds, - unsigned long numer, unsigned long denom) + unsigned long numer, unsigned long denom) { timer->seconds = seconds; if (numer >= denom && denom > 0) { @@ -224,8 +224,8 @@ void mad_timer_set(mad_timer_t *timer, unsigned long seconds, } /* - * NAME: timer->add() - * DESCRIPTION: add one timer to another + * NAME: timer->add() + * DESCRIPTION: add one timer to another */ void mad_timer_add(mad_timer_t *timer, mad_timer_t incr) { @@ -237,8 +237,8 @@ void mad_timer_add(mad_timer_t *timer, mad_timer_t incr) } /* - * NAME: timer->multiply() - * DESCRIPTION: multiply a timer by a scalar value + * NAME: timer->multiply() + * DESCRIPTION: multiply a timer by a scalar value */ void mad_timer_multiply(mad_timer_t *timer, signed long scalar) { @@ -264,8 +264,8 @@ void mad_timer_multiply(mad_timer_t *timer, signed long scalar) } /* - * NAME: timer->count() - * DESCRIPTION: return timer value in selected units + * NAME: timer->count() + * DESCRIPTION: return timer value in selected units */ signed long mad_timer_count(mad_timer_t timer, enum mad_units units) { @@ -302,7 +302,7 @@ signed long mad_timer_count(mad_timer_t timer, enum mad_units units) case MAD_UNITS_75_FPS: return timer.seconds * (signed long) units + (signed long) scale_rational(timer.fraction, MAD_TIMER_RESOLUTION, - units); + units); case MAD_UNITS_23_976_FPS: case MAD_UNITS_24_975_FPS: @@ -318,8 +318,8 @@ signed long mad_timer_count(mad_timer_t timer, enum mad_units units) } /* - * NAME: timer->fraction() - * DESCRIPTION: return fractional part of timer in arbitrary terms + * NAME: timer->fraction() + * DESCRIPTION: return fractional part of timer in arbitrary terms */ unsigned long mad_timer_fraction(mad_timer_t timer, unsigned long denom) { @@ -339,12 +339,12 @@ unsigned long mad_timer_fraction(mad_timer_t timer, unsigned long denom) } /* - * NAME: timer->string() - * DESCRIPTION: write a string representation of a timer using a template + * NAME: timer->string() + * DESCRIPTION: write a string representation of a timer using a template */ void mad_timer_string(mad_timer_t timer, - char *dest, char const *format, enum mad_units units, - enum mad_units fracunits, unsigned long subparts) + char *dest, char const *format, enum mad_units units, + enum mad_units fracunits, unsigned long subparts) { unsigned long hours, minutes, seconds, sub; unsigned int frac; @@ -413,7 +413,7 @@ void mad_timer_string(mad_timer_t timer, m = frame % cycle; frame += (10 - 1) * 2 * d; if (m > 2) - frame += 2 * ((m - 2) / (cycle / 10)); + frame += 2 * ((m - 2) / (cycle / 10)); frac = frame % -fracunits; seconds = frame / -fracunits; @@ -427,25 +427,25 @@ void mad_timer_string(mad_timer_t timer, hours = minutes / 60; // sprintf(dest, format, -// hours, -// (unsigned int) (minutes % 60), -// (unsigned int) (seconds % 60), -// frac, sub); +// hours, +// (unsigned int) (minutes % 60), +// (unsigned int) (seconds % 60), +// frac, sub); break; case MAD_UNITS_MINUTES: minutes = seconds / 60; // sprintf(dest, format, -// minutes, -// (unsigned int) (seconds % 60), -// frac, sub); +// minutes, +// (unsigned int) (seconds % 60), +// frac, sub); break; case MAD_UNITS_SECONDS: // sprintf(dest, format, -// seconds, -// frac, sub); +// seconds, +// frac, sub); break; case MAD_UNITS_23_976_FPS: diff --git a/apps/codecs/libmad/timer.h b/apps/codecs/libmad/timer.h index 4f2be57b46..23fdccf929 100644 --- a/apps/codecs/libmad/timer.h +++ b/apps/codecs/libmad/timer.h @@ -23,67 +23,67 @@ # define LIBMAD_TIMER_H typedef struct { - signed long seconds; /* whole seconds */ - unsigned long fraction; /* 1/MAD_TIMER_RESOLUTION seconds */ + signed long seconds; /* whole seconds */ + unsigned long fraction; /* 1/MAD_TIMER_RESOLUTION seconds */ } mad_timer_t; extern mad_timer_t const mad_timer_zero; -# define MAD_TIMER_RESOLUTION 352800000UL +# define MAD_TIMER_RESOLUTION 352800000UL enum mad_units { - MAD_UNITS_HOURS = -2, - MAD_UNITS_MINUTES = -1, - MAD_UNITS_SECONDS = 0, + MAD_UNITS_HOURS = -2, + MAD_UNITS_MINUTES = -1, + MAD_UNITS_SECONDS = 0, /* metric units */ - MAD_UNITS_DECISECONDS = 10, + MAD_UNITS_DECISECONDS = 10, MAD_UNITS_CENTISECONDS = 100, MAD_UNITS_MILLISECONDS = 1000, /* audio sample units */ - MAD_UNITS_8000_HZ = 8000, - MAD_UNITS_11025_HZ = 11025, - MAD_UNITS_12000_HZ = 12000, + MAD_UNITS_8000_HZ = 8000, + MAD_UNITS_11025_HZ = 11025, + MAD_UNITS_12000_HZ = 12000, - MAD_UNITS_16000_HZ = 16000, - MAD_UNITS_22050_HZ = 22050, - MAD_UNITS_24000_HZ = 24000, + MAD_UNITS_16000_HZ = 16000, + MAD_UNITS_22050_HZ = 22050, + MAD_UNITS_24000_HZ = 24000, - MAD_UNITS_32000_HZ = 32000, - MAD_UNITS_44100_HZ = 44100, - MAD_UNITS_48000_HZ = 48000, + MAD_UNITS_32000_HZ = 32000, + MAD_UNITS_44100_HZ = 44100, + MAD_UNITS_48000_HZ = 48000, /* video frame/field units */ - MAD_UNITS_24_FPS = 24, - MAD_UNITS_25_FPS = 25, - MAD_UNITS_30_FPS = 30, - MAD_UNITS_48_FPS = 48, - MAD_UNITS_50_FPS = 50, - MAD_UNITS_60_FPS = 60, + MAD_UNITS_24_FPS = 24, + MAD_UNITS_25_FPS = 25, + MAD_UNITS_30_FPS = 30, + MAD_UNITS_48_FPS = 48, + MAD_UNITS_50_FPS = 50, + MAD_UNITS_60_FPS = 60, /* CD audio frames */ - MAD_UNITS_75_FPS = 75, + MAD_UNITS_75_FPS = 75, /* video drop-frame units */ - MAD_UNITS_23_976_FPS = -24, - MAD_UNITS_24_975_FPS = -25, - MAD_UNITS_29_97_FPS = -30, - MAD_UNITS_47_952_FPS = -48, - MAD_UNITS_49_95_FPS = -50, - MAD_UNITS_59_94_FPS = -60 + MAD_UNITS_23_976_FPS = -24, + MAD_UNITS_24_975_FPS = -25, + MAD_UNITS_29_97_FPS = -30, + MAD_UNITS_47_952_FPS = -48, + MAD_UNITS_49_95_FPS = -50, + MAD_UNITS_59_94_FPS = -60 }; -# define mad_timer_reset(timer) ((void) (*(timer) = mad_timer_zero)) +# define mad_timer_reset(timer) ((void) (*(timer) = mad_timer_zero)) int mad_timer_compare(mad_timer_t, mad_timer_t); -# define mad_timer_sign(timer) mad_timer_compare((timer), mad_timer_zero) +# define mad_timer_sign(timer) mad_timer_compare((timer), mad_timer_zero) void mad_timer_negate(mad_timer_t *); mad_timer_t mad_timer_abs(mad_timer_t); @@ -95,6 +95,6 @@ void mad_timer_multiply(mad_timer_t *, signed long); signed long mad_timer_count(mad_timer_t, enum mad_units); unsigned long mad_timer_fraction(mad_timer_t, unsigned long); void mad_timer_string(mad_timer_t, char *, char const *, - enum mad_units, enum mad_units, unsigned long); + enum mad_units, enum mad_units, unsigned long); # endif diff --git a/apps/codecs/libmad/version.h b/apps/codecs/libmad/version.h index d40e42538a..3a98543de3 100644 --- a/apps/codecs/libmad/version.h +++ b/apps/codecs/libmad/version.h @@ -22,22 +22,22 @@ # ifndef LIBMAD_VERSION_H # define LIBMAD_VERSION_H -# define MAD_VERSION_MAJOR 0 -# define MAD_VERSION_MINOR 15 -# define MAD_VERSION_PATCH 1 -# define MAD_VERSION_EXTRA " (beta)" +# define MAD_VERSION_MAJOR 0 +# define MAD_VERSION_MINOR 15 +# define MAD_VERSION_PATCH 1 +# define MAD_VERSION_EXTRA " (beta)" -# define MAD_VERSION_STRINGIZE(str) #str -# define MAD_VERSION_STRING(num) MAD_VERSION_STRINGIZE(num) +# define MAD_VERSION_STRINGIZE(str) #str +# define MAD_VERSION_STRING(num) MAD_VERSION_STRINGIZE(num) -# define MAD_VERSION MAD_VERSION_STRING(MAD_VERSION_MAJOR) "." \ - MAD_VERSION_STRING(MAD_VERSION_MINOR) "." \ - MAD_VERSION_STRING(MAD_VERSION_PATCH) \ - MAD_VERSION_EXTRA +# define MAD_VERSION MAD_VERSION_STRING(MAD_VERSION_MAJOR) "." \ + MAD_VERSION_STRING(MAD_VERSION_MINOR) "." \ + MAD_VERSION_STRING(MAD_VERSION_PATCH) \ + MAD_VERSION_EXTRA -# define MAD_PUBLISHYEAR "2000-2004" -# define MAD_AUTHOR "Underbit Technologies, Inc." -# define MAD_EMAIL "info@underbit.com" +# define MAD_PUBLISHYEAR "2000-2004" +# define MAD_AUTHOR "Underbit Technologies, Inc." +# define MAD_EMAIL "info@underbit.com" extern char const mad_version[]; extern char const mad_copyright[]; diff --git a/apps/codecs/librm/rm.c b/apps/codecs/librm/rm.c index d721ceb81f..a179688e7a 100644 --- a/apps/codecs/librm/rm.c +++ b/apps/codecs/librm/rm.c @@ -430,7 +430,7 @@ int real_parse_header(int fd, RMContext *rmctx) read_uint32be(fd,&next_data_off); skipped += 4; if (!rmctx->nb_packets && (rmctx->flags & 4)) - rmctx->nb_packets = 3600 * 25; + rmctx->nb_packets = 3600 * 25; /*** * nb_packets correction : @@ -444,7 +444,7 @@ int real_parse_header(int fd, RMContext *rmctx) DEBUGF(" data_nb_packets = %d\n",rmctx->nb_packets); DEBUGF(" next DATA offset = %d\n",next_data_off); - header_end = 1; + header_end = 1; break; } if(header_end) break; diff --git a/apps/codecs/libspeex/_kiss_fft_guts.h b/apps/codecs/libspeex/_kiss_fft_guts.h index e9bb018c4b..12c055040f 100644 --- a/apps/codecs/libspeex/_kiss_fft_guts.h +++ b/apps/codecs/libspeex/_kiss_fft_guts.h @@ -60,8 +60,8 @@ struct kiss_fft_state{ #if defined(CHECK_OVERFLOW) # define CHECK_OVERFLOW_OP(a,op,b) \ - if ( (SAMPPROD)(a) op (SAMPPROD)(b) > SAMP_MAX || (SAMPPROD)(a) op (SAMPPROD)(b) < SAMP_MIN ) { \ - fprintf(stderr,"WARNING:overflow @ " __FILE__ "(%d): (%d " #op" %d) = %ld\n",__LINE__,(a),(b),(SAMPPROD)(a) op (SAMPPROD)(b) ); } + if ( (SAMPPROD)(a) op (SAMPPROD)(b) > SAMP_MAX || (SAMPPROD)(a) op (SAMPPROD)(b) < SAMP_MIN ) { \ + fprintf(stderr,"WARNING:overflow @ " __FILE__ "(%d): (%d " #op" %d) = %ld\n",__LINE__,(a),(b),(SAMPPROD)(a) op (SAMPPROD)(b) ); } #endif @@ -79,11 +79,11 @@ struct kiss_fft_state{ (m).i = PSHR32( smul((a).r,(b).i) + smul((a).i,(b).r),17 ); }while(0) # define DIVSCALAR(x,k) \ - (x) = sround( smul( x, SAMP_MAX/k ) ) + (x) = sround( smul( x, SAMP_MAX/k ) ) # define C_FIXDIV(c,div) \ - do { DIVSCALAR( (c).r , div); \ - DIVSCALAR( (c).i , div); }while (0) + do { DIVSCALAR( (c).r , div); \ + DIVSCALAR( (c).i , div); }while (0) # define C_MULBYSCALAR( c, s ) \ do{ (c).r = sround( smul( (c).r , s ) ) ;\ @@ -110,28 +110,28 @@ struct kiss_fft_state{ #define C_ADD( res, a,b)\ do { \ - CHECK_OVERFLOW_OP((a).r,+,(b).r)\ - CHECK_OVERFLOW_OP((a).i,+,(b).i)\ - (res).r=(a).r+(b).r; (res).i=(a).i+(b).i; \ + CHECK_OVERFLOW_OP((a).r,+,(b).r)\ + CHECK_OVERFLOW_OP((a).i,+,(b).i)\ + (res).r=(a).r+(b).r; (res).i=(a).i+(b).i; \ }while(0) #define C_SUB( res, a,b)\ do { \ - CHECK_OVERFLOW_OP((a).r,-,(b).r)\ - CHECK_OVERFLOW_OP((a).i,-,(b).i)\ - (res).r=(a).r-(b).r; (res).i=(a).i-(b).i; \ + CHECK_OVERFLOW_OP((a).r,-,(b).r)\ + CHECK_OVERFLOW_OP((a).i,-,(b).i)\ + (res).r=(a).r-(b).r; (res).i=(a).i-(b).i; \ }while(0) #define C_ADDTO( res , a)\ do { \ - CHECK_OVERFLOW_OP((res).r,+,(a).r)\ - CHECK_OVERFLOW_OP((res).i,+,(a).i)\ - (res).r += (a).r; (res).i += (a).i;\ + CHECK_OVERFLOW_OP((res).r,+,(a).r)\ + CHECK_OVERFLOW_OP((res).i,+,(a).i)\ + (res).r += (a).r; (res).i += (a).i;\ }while(0) #define C_SUBFROM( res , a)\ do {\ - CHECK_OVERFLOW_OP((res).r,-,(a).r)\ - CHECK_OVERFLOW_OP((res).i,-,(a).i)\ - (res).r -= (a).r; (res).i -= (a).i; \ + CHECK_OVERFLOW_OP((res).r,-,(a).r)\ + CHECK_OVERFLOW_OP((res).i,-,(a).i)\ + (res).r -= (a).r; (res).i -= (a).i; \ }while(0) @@ -150,10 +150,10 @@ struct kiss_fft_state{ #endif #define kf_cexp(x,phase) \ - do{ \ - (x)->r = KISS_FFT_COS(phase);\ - (x)->i = KISS_FFT_SIN(phase);\ - }while(0) + do{ \ + (x)->r = KISS_FFT_COS(phase);\ + (x)->i = KISS_FFT_SIN(phase);\ + }while(0) #define kf_cexp2(x,phase) \ do{ \ (x)->r = spx_cos_norm((phase));\ diff --git a/apps/codecs/libspeex/cb_search.c b/apps/codecs/libspeex/cb_search.c index 8a190e535d..f9ff0a6784 100644 --- a/apps/codecs/libspeex/cb_search.c +++ b/apps/codecs/libspeex/cb_search.c @@ -99,10 +99,10 @@ static inline void target_update(spx_word16_t *t, spx_word16_t g, spx_word16_t * static void split_cb_search_shape_sign_N1( -spx_word16_t target[], /* target vector */ -spx_coef_t ak[], /* LPCs for this subframe */ -spx_coef_t awk1[], /* Weighted LPCs for this subframe */ -spx_coef_t awk2[], /* Weighted LPCs for this subframe */ +spx_word16_t target[], /* target vector */ +spx_coef_t ak[], /* LPCs for this subframe */ +spx_coef_t awk1[], /* Weighted LPCs for this subframe */ +spx_coef_t awk2[], /* Weighted LPCs for this subframe */ const void *par, /* Codebook/search parameters*/ int p, /* number of LPC coeffs */ int nsf, /* number of samples in subframe */ @@ -241,10 +241,10 @@ int update_target void split_cb_search_shape_sign( -spx_word16_t target[], /* target vector */ -spx_coef_t ak[], /* LPCs for this subframe */ -spx_coef_t awk1[], /* Weighted LPCs for this subframe */ -spx_coef_t awk2[], /* Weighted LPCs for this subframe */ +spx_word16_t target[], /* target vector */ +spx_coef_t ak[], /* LPCs for this subframe */ +spx_coef_t awk1[], /* Weighted LPCs for this subframe */ +spx_coef_t awk2[], /* Weighted LPCs for this subframe */ const void *par, /* Codebook/search parameters*/ int p, /* number of LPC coeffs */ int nsf, /* number of samples in subframe */ @@ -576,10 +576,10 @@ spx_int32_t *seed #ifndef SPEEX_DISABLE_ENCODER void noise_codebook_quant( -spx_word16_t target[], /* target vector */ -spx_coef_t ak[], /* LPCs for this subframe */ -spx_coef_t awk1[], /* Weighted LPCs for this subframe */ -spx_coef_t awk2[], /* Weighted LPCs for this subframe */ +spx_word16_t target[], /* target vector */ +spx_coef_t ak[], /* LPCs for this subframe */ +spx_coef_t awk1[], /* Weighted LPCs for this subframe */ +spx_coef_t awk2[], /* Weighted LPCs for this subframe */ const void *par, /* Codebook/search parameters*/ int p, /* number of LPC coeffs */ int nsf, /* number of samples in subframe */ diff --git a/apps/codecs/libspeex/kiss_fft.c b/apps/codecs/libspeex/kiss_fft.c index bff826d754..5b699a362f 100644 --- a/apps/codecs/libspeex/kiss_fft.c +++ b/apps/codecs/libspeex/kiss_fft.c @@ -184,7 +184,7 @@ static void kf_bfly3( do{ if (!st->inverse) { C_FIXDIV(*Fout,3); C_FIXDIV(Fout[m],3); C_FIXDIV(Fout[m2],3); - } + } C_MUL(scratch[1],Fout[m] , *tw1); C_MUL(scratch[2],Fout[m2] , *tw2); @@ -237,7 +237,7 @@ static void kf_bfly5( for ( u=0; uinverse) { C_FIXDIV( *Fout0,5); C_FIXDIV( *Fout1,5); C_FIXDIV( *Fout2,5); C_FIXDIV( *Fout3,5); C_FIXDIV( *Fout4,5); - } + } scratch[0] = *Fout0; C_MUL(scratch[1] ,*Fout1, tw[u*fstride]); @@ -299,7 +299,7 @@ static void kf_bfly_generic( scratchbuf[q1] = Fout[ k ]; if (!st->inverse) { C_FIXDIV(scratchbuf[q1],p); - } + } k += m; } diff --git a/apps/codecs/libspeex/kiss_fft.h b/apps/codecs/libspeex/kiss_fft.h index fa3f2c6042..43319b1ba8 100644 --- a/apps/codecs/libspeex/kiss_fft.h +++ b/apps/codecs/libspeex/kiss_fft.h @@ -26,13 +26,13 @@ extern "C" { # include # define kiss_fft_scalar __m128 #define KISS_FFT_MALLOC(nbytes) memalign(16,nbytes) -#else +#else #define KISS_FFT_MALLOC speex_alloc -#endif +#endif #ifdef FIXED_POINT -#include "arch.h" +#include "arch.h" # define kiss_fft_scalar spx_int16_t #else # ifndef kiss_fft_scalar @@ -99,7 +99,7 @@ void kiss_fft_stride(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout your compiler output to call this before you exit. */ void kiss_fft_cleanup(void); - + #ifdef __cplusplus } diff --git a/apps/codecs/libspeex/lsp.c b/apps/codecs/libspeex/lsp.c index edf480e8bc..8408d782aa 100644 --- a/apps/codecs/libspeex/lsp.c +++ b/apps/codecs/libspeex/lsp.c @@ -1,8 +1,8 @@ /*---------------------------------------------------------------------------*\ Original copyright - FILE........: lsp.c - AUTHOR......: David Rowe - DATE CREATED: 24/2/93 + FILE........: lsp.c + AUTHOR......: David Rowe + DATE CREATED: 24/2/93 Heavily modified by Jean-Marc Valin (c) 2002-2006 (fixed-point, optimizations, additional functions, ...) @@ -219,31 +219,31 @@ static float cheb_poly_eva(spx_word32_t *coef, spx_word16_t x, int m, char *stac int lpc_to_lsp (spx_coef_t *a,int lpcrdr,spx_lsp_t *freq,int nb,spx_word16_t delta, char *stack) -/* float *a lpc coefficients */ -/* int lpcrdr order of LPC coefficients (10) */ -/* float *freq LSP frequencies in the x domain */ -/* int nb number of sub-intervals (4) */ -/* float delta grid spacing interval (0.02) */ +/* float *a lpc coefficients */ +/* int lpcrdr order of LPC coefficients (10) */ +/* float *freq LSP frequencies in the x domain */ +/* int nb number of sub-intervals (4) */ +/* float delta grid spacing interval (0.02) */ { spx_word16_t temp_xr,xl,xr,xm=0; spx_word32_t psuml,psumr,psumm,temp_psumr/*,temp_qsumr*/; int i,j,m,flag,k; - VARDECL(spx_word32_t *Q); /* ptrs for memory allocation */ + VARDECL(spx_word32_t *Q); /* ptrs for memory allocation */ VARDECL(spx_word32_t *P); - VARDECL(spx_word16_t *Q16); /* ptrs for memory allocation */ + VARDECL(spx_word16_t *Q16); /* ptrs for memory allocation */ VARDECL(spx_word16_t *P16); - spx_word32_t *px; /* ptrs of respective P'(z) & Q'(z) */ + spx_word32_t *px; /* ptrs of respective P'(z) & Q'(z) */ spx_word32_t *qx; spx_word32_t *p; spx_word32_t *q; - spx_word16_t *pt; /* ptr used for cheb_poly_eval() - whether P' or Q' */ - int roots=0; /* DR 8/2/94: number of roots found */ - flag = 1; /* program is searching for a root when, - 1 else has found one */ - m = lpcrdr/2; /* order of P'(z) & Q'(z) polynomials */ + spx_word16_t *pt; /* ptr used for cheb_poly_eval() + whether P' or Q' */ + int roots=0; /* DR 8/2/94: number of roots found */ + flag = 1; /* program is searching for a root when, + 1 else has found one */ + m = lpcrdr/2; /* order of P'(z) & Q'(z) polynomials */ /* Allocate memory space for polynomials */ ALLOC(Q, (m+1), spx_word32_t); @@ -252,7 +252,7 @@ int lpc_to_lsp (spx_coef_t *a,int lpcrdr,spx_lsp_t *freq,int nb,spx_word16_t del /* determine P'(z)'s and Q'(z)'s coefficients where P'(z) = P(z)/(1 + z^(-1)) and Q'(z) = Q(z)/(1-z^(-1)) */ - px = P; /* initialise ptrs */ + px = P; /* initialise ptrs */ qx = Q; p = px; q = qx; @@ -297,7 +297,7 @@ int lpc_to_lsp (spx_coef_t *a,int lpcrdr,spx_lsp_t *freq,int nb,spx_word16_t del } #endif - px = P; /* re-initialise ptrs */ + px = P; /* re-initialise ptrs */ qx = Q; /* now that we have computed P and Q convert to 16 bits to @@ -313,20 +313,20 @@ int lpc_to_lsp (spx_coef_t *a,int lpcrdr,spx_lsp_t *freq,int nb,spx_word16_t del } /* Search for a zero in P'(z) polynomial first and then alternate to Q'(z). - Keep alternating between the two polynomials as each zero is found */ + Keep alternating between the two polynomials as each zero is found */ - xr = 0; /* initialise xr to zero */ - xl = FREQ_SCALE; /* start at point xl = 1 */ + xr = 0; /* initialise xr to zero */ + xl = FREQ_SCALE; /* start at point xl = 1 */ for(j=0;j= -FREQ_SCALE)){ + if(j&1) /* determines whether P' or Q' is eval. */ + pt = Q16; + else + pt = P16; + + psuml = cheb_poly_eva(pt,xl,m,stack); /* evals poly. at xl */ + flag = 1; + while(flag && (xr >= -FREQ_SCALE)){ spx_word16_t dd; /* Modified by JMV to provide smaller steps around x=+-1 */ #ifdef FIXED_POINT @@ -338,10 +338,10 @@ int lpc_to_lsp (spx_coef_t *a,int lpcrdr,spx_lsp_t *freq,int nb,spx_word16_t del if (fabs(psuml)<.2) dd *= .5; #endif - xr = SUB16(xl, dd); /* interval spacing */ - psumr = cheb_poly_eva(pt,xr,m,stack);/* poly(xl-delta_x) */ - temp_psumr = psumr; - temp_xr = xr; + xr = SUB16(xl, dd); /* interval spacing */ + psumr = cheb_poly_eva(pt,xr,m,stack);/* poly(xl-delta_x) */ + temp_psumr = psumr; + temp_xr = xr; /* if no sign change increment xr and re-evaluate poly(xr). Repeat til sign change. @@ -350,41 +350,41 @@ int lpc_to_lsp (spx_coef_t *a,int lpcrdr,spx_lsp_t *freq,int nb,spx_word16_t del interval the zero lies in. If there is no sign change between poly(xm) and poly(xl) set interval between xm and xr else set interval between xl and xr and repeat till - root is located within the specified limits */ + root is located within the specified limits */ - if(SIGN_CHANGE(psumr,psuml)) + if(SIGN_CHANGE(psumr,psuml)) { - roots++; + roots++; - psumm=psuml; - for(k=0;k<=nb;k++){ + psumm=psuml; + for(k=0;k<=nb;k++){ #ifdef FIXED_POINT - xm = ADD16(PSHR16(xl,1),PSHR16(xr,1)); /* bisect the interval */ + xm = ADD16(PSHR16(xl,1),PSHR16(xr,1)); /* bisect the interval */ #else - xm = .5*(xl+xr); /* bisect the interval */ + xm = .5*(xl+xr); /* bisect the interval */ #endif - psumm=cheb_poly_eva(pt,xm,m,stack); - /*if(psumm*psuml>0.)*/ - if(!SIGN_CHANGE(psumm,psuml)) + psumm=cheb_poly_eva(pt,xm,m,stack); + /*if(psumm*psuml>0.)*/ + if(!SIGN_CHANGE(psumm,psuml)) { - psuml=psumm; - xl=xm; - } else { - psumr=psumm; - xr=xm; - } - } - - /* once zero is found, reset initial interval to xr */ - freq[j] = X2ANGLE(xm); - xl = xm; - flag = 0; /* reset flag for next search */ - } - else{ - psuml=temp_psumr; - xl=temp_xr; - } - } + psuml=psumm; + xl=xm; + } else { + psumr=psumm; + xr=xm; + } + } + + /* once zero is found, reset initial interval to xr */ + freq[j] = X2ANGLE(xm); + xl = xm; + flag = 0; /* reset flag for next search */ + } + else{ + psuml=temp_psumr; + xl=temp_xr; + } + } } return(roots); } @@ -393,10 +393,10 @@ int lpc_to_lsp (spx_coef_t *a,int lpcrdr,spx_lsp_t *freq,int nb,spx_word16_t del /*---------------------------------------------------------------------------*\ - FUNCTION....: lsp_to_lpc() + FUNCTION....: lsp_to_lpc() - AUTHOR......: David Rowe - DATE CREATED: 24/2/93 + AUTHOR......: David Rowe + DATE CREATED: 24/2/93 Converts LSP coefficients to LPC coefficients. @@ -405,9 +405,9 @@ int lpc_to_lsp (spx_coef_t *a,int lpcrdr,spx_lsp_t *freq,int nb,spx_word16_t del #ifdef FIXED_POINT void lsp_to_lpc(spx_lsp_t *freq,spx_coef_t *ak,int lpcrdr, char *stack) -/* float *freq array of LSP frequencies in the x domain */ -/* float *ak array of LPC coefficients */ -/* int lpcrdr order of LPC coefficients */ +/* float *freq array of LSP frequencies in the x domain */ +/* float *ak array of LPC coefficients */ +/* int lpcrdr order of LPC coefficients */ { (void)stack; int i,j; @@ -488,10 +488,10 @@ void lsp_to_lpc(spx_lsp_t *freq,spx_coef_t *ak,int lpcrdr, char *stack) for(i=1;i0) - ak[j-1] = (xout1 + xout2)*0.5f; - *(n4+1) = xin1; - *(n4+2) = xin2; - - xin1 = 0.0; - xin2 = 0.0; + for(i=0;i0) + ak[j-1] = (xout1 + xout2)*0.5f; + *(n4+1) = xin1; + *(n4+2) = xin2; + + xin1 = 0.0; + xin2 = 0.0; } } diff --git a/apps/codecs/libspeex/lsp.h b/apps/codecs/libspeex/lsp.h index 648652fb9e..2841e4b747 100644 --- a/apps/codecs/libspeex/lsp.h +++ b/apps/codecs/libspeex/lsp.h @@ -1,10 +1,10 @@ /*---------------------------------------------------------------------------*\ Original Copyright - FILE........: AK2LSPD.H - TYPE........: Turbo C header file - COMPANY.....: Voicetronix - AUTHOR......: James Whitehall - DATE CREATED: 21/11/95 + FILE........: AK2LSPD.H + TYPE........: Turbo C header file + COMPANY.....: Voicetronix + AUTHOR......: James Whitehall + DATE CREATED: 21/11/95 Modified by Jean-Marc Valin @@ -61,4 +61,4 @@ void lsp_enforce_margin(spx_lsp_t *lsp, int len, spx_word16_t margin); void lsp_interpolate(spx_lsp_t *old_lsp, spx_lsp_t *new_lsp, spx_lsp_t *interp_lsp, int len, int subframe, int nb_subframes); -#endif /* __AK2LSPD__ */ +#endif /* __AK2LSPD__ */ diff --git a/apps/codecs/libspeex/ltp_bfin.h b/apps/codecs/libspeex/ltp_bfin.h index b530f85986..8d7225b017 100644 --- a/apps/codecs/libspeex/ltp_bfin.h +++ b/apps/codecs/libspeex/ltp_bfin.h @@ -220,7 +220,7 @@ void open_loop_nbest_pitch(spx_word16_t *sw, int start, int end, int len, int *p normalize16(energy, ener16, 180, end-start+1); if (N == 1) { - /* optimised asm to handle N==1 case */ + /* optimised asm to handle N==1 case */ __asm__ __volatile__ ( " I0 = %1;\n\t" /* I0: corr16[] */ @@ -253,35 +253,35 @@ void open_loop_nbest_pitch(spx_word16_t *sw, int start, int end, int len, int *p } else { - for (i=start;i<=end;i++) - { - spx_word16_t tmp = MULT16_16_16(corr16[i-start],corr16[i-start]); - /* Instead of dividing the tmp by the energy, we multiply on the other side */ - if (MULT16_16(tmp,best_ener[N-1])>MULT16_16(best_score[N-1],ADD16(1,ener16[i-start]))) - { - /* We can safely put it last and then check */ - best_score[N-1]=tmp; - best_ener[N-1]=ener16[i-start]+1; - pitch[N-1]=i; - /* Check if it comes in front of others */ - for (j=0;jMULT16_16(best_score[j],ADD16(1,ener16[i-start]))) - { - for (k=N-1;k>j;k--) - { - best_score[k]=best_score[k-1]; - best_ener[k]=best_ener[k-1]; - pitch[k]=pitch[k-1]; - } - best_score[j]=tmp; - best_ener[j]=ener16[i-start]+1; - pitch[j]=i; - break; - } - } - } - } + for (i=start;i<=end;i++) + { + spx_word16_t tmp = MULT16_16_16(corr16[i-start],corr16[i-start]); + /* Instead of dividing the tmp by the energy, we multiply on the other side */ + if (MULT16_16(tmp,best_ener[N-1])>MULT16_16(best_score[N-1],ADD16(1,ener16[i-start]))) + { + /* We can safely put it last and then check */ + best_score[N-1]=tmp; + best_ener[N-1]=ener16[i-start]+1; + pitch[N-1]=i; + /* Check if it comes in front of others */ + for (j=0;jMULT16_16(best_score[j],ADD16(1,ener16[i-start]))) + { + for (k=N-1;k>j;k--) + { + best_score[k]=best_score[k-1]; + best_ener[k]=best_ener[k-1]; + pitch[k]=pitch[k-1]; + } + best_score[j]=tmp; + best_ener[j]=ener16[i-start]+1; + pitch[j]=i; + break; + } + } + } + } } } diff --git a/apps/codecs/libspeex/nb_celp.c b/apps/codecs/libspeex/nb_celp.c index 31eaa06b6b..90a5d1e991 100644 --- a/apps/codecs/libspeex/nb_celp.c +++ b/apps/codecs/libspeex/nb_celp.c @@ -1019,7 +1019,7 @@ void nb_decoder_destroy(void *state) */ } -#define median3(a, b, c) ((a) < (b) ? ((b) < (c) ? (b) : ((a) < (c) ? (c) : (a))) : ((c) < (b) ? (b) : ((c) < (a) ? (c) : (a)))) +#define median3(a, b, c) ((a) < (b) ? ((b) < (c) ? (b) : ((a) < (c) ? (c) : (a))) : ((c) < (b) ? (b) : ((c) < (a) ? (c) : (a)))) #ifdef FIXED_POINT const spx_word16_t attenuation[10] = {32767, 31483, 27923, 22861, 17278, 12055, 7764, 4616, 2533, 1283}; @@ -1353,10 +1353,10 @@ int nb_decode(void *state, SpeexBits *bits, void *vout) */ pit_min = ol_pitch-margin+1; if (pit_min < st->min_pitch) - pit_min = st->min_pitch; + pit_min = st->min_pitch; pit_max = ol_pitch+margin; if (pit_max > st->max_pitch) - pit_max = st->max_pitch; + pit_max = st->max_pitch; } else { pit_min = pit_max = ol_pitch; } diff --git a/apps/codecs/libspeex/oggframing.c b/apps/codecs/libspeex/oggframing.c index 6a0ee21412..42d29502a8 100644 --- a/apps/codecs/libspeex/oggframing.c +++ b/apps/codecs/libspeex/oggframing.c @@ -58,16 +58,16 @@ spx_ogg_int64_t spx_ogg_page_granulepos(spx_ogg_page *og){ int spx_ogg_page_serialno(spx_ogg_page *og){ return(og->header[14] | - (og->header[15]<<8) | - (og->header[16]<<16) | - (og->header[17]<<24)); + (og->header[15]<<8) | + (og->header[16]<<16) | + (og->header[17]<<24)); } long spx_ogg_page_pageno(spx_ogg_page *og){ return(og->header[18] | - (og->header[19]<<8) | - (og->header[20]<<16) | - (og->header[21]<<24)); + (og->header[19]<<8) | + (og->header[20]<<16) | + (og->header[21]<<24)); } @@ -109,9 +109,9 @@ static spx_ogg_uint32_t _spx_ogg_crc_entry(unsigned long index){ for (i=0; i<8; i++) if (r & 0x80000000UL) r = (r << 1) ^ 0x04c11db7; /* The same as the ethernet generator - polynomial, although we use an - unreflected alg and an init/final - of 0, not 0xffffffff */ + polynomial, although we use an + unreflected alg and an init/final + of 0, not 0xffffffff */ else r<<=1; return (r & 0xffffffffUL); @@ -280,7 +280,7 @@ int spx_ogg_stream_packetin(spx_ogg_stream_state *os,spx_ogg_packet *op){ os->body_fill-=os->body_returned; if(os->body_fill) memmove(os->body_data,os->body_data+os->body_returned, - os->body_fill); + os->body_fill); os->body_returned=0; } @@ -350,8 +350,8 @@ int spx_ogg_stream_flush(spx_ogg_stream_state *os,spx_ogg_page *og){ granule_pos=0; for(vals=0;valslacing_vals[vals]&0x0ff)<255){ - vals++; - break; + vals++; + break; } } }else{ @@ -396,10 +396,10 @@ int spx_ogg_stream_flush(spx_ogg_stream_state *os,spx_ogg_page *og){ /* 32 bits of page counter (we have both counter and page header because this val can roll over) */ if(os->pageno==-1)os->pageno=0; /* because someone called - stream_reset; this would be a - strange thing to do in an - encode stream, but it has - plausible uses */ + stream_reset; this would be a + strange thing to do in an + encode stream, but it has + plausible uses */ { long pageno=os->pageno++; for(i=18;i<22;i++){ @@ -595,7 +595,7 @@ long spx_ogg_sync_pageseek(spx_ogg_sync_state *oy,spx_ogg_page *og){ /* Compare */ if(memcmp(chksum,page+22,4)){ /* D'oh. Mismatch! Corrupt page (or miscapture and not a page - at all) */ + at all) */ /* replace the computed checksum with the one actually read in */ memcpy(page+22,chksum,4); @@ -703,17 +703,17 @@ int spx_ogg_stream_pagein(spx_ogg_stream_state *os, spx_ogg_page *og){ if(br){ os->body_fill-=br; if(os->body_fill) - memmove(os->body_data,os->body_data+br,os->body_fill); + memmove(os->body_data,os->body_data+br,os->body_fill); os->body_returned=0; } if(lr){ /* segment table */ if(os->lacing_fill-lr){ - memmove(os->lacing_vals,os->lacing_vals+lr, - (os->lacing_fill-lr)*sizeof(*os->lacing_vals)); - memmove(os->granule_vals,os->granule_vals+lr, - (os->lacing_fill-lr)*sizeof(*os->granule_vals)); + memmove(os->lacing_vals,os->lacing_vals+lr, + (os->lacing_fill-lr)*sizeof(*os->lacing_vals)); + memmove(os->granule_vals,os->granule_vals+lr, + (os->lacing_fill-lr)*sizeof(*os->granule_vals)); } os->lacing_fill-=lr; os->lacing_packet-=lr; @@ -750,13 +750,13 @@ int spx_ogg_stream_pagein(spx_ogg_stream_state *os, spx_ogg_page *og){ os->lacing_vals[os->lacing_fill-1]==0x400){ bos=0; for(;segptrgranule_vals[os->lacing_fill]=-1; if(bos){ - os->lacing_vals[os->lacing_fill]|=0x100; - bos=0; + os->lacing_vals[os->lacing_fill]|=0x100; + bos=0; } if(val<255)saved=os->lacing_fill; diff --git a/apps/codecs/libspeex/quant_lsp_bfin.h b/apps/codecs/libspeex/quant_lsp_bfin.h index c884078e6b..917047bb56 100644 --- a/apps/codecs/libspeex/quant_lsp_bfin.h +++ b/apps/codecs/libspeex/quant_lsp_bfin.h @@ -55,9 +55,9 @@ static int lsp_quant( __asm__ __volatile__ ( -" %0 = 1 (X);\n\t" /* %0: best_dist */ -" %0 <<= 30;\n\t" -" %1 = 0 (X);\n\t" /* %1: best_i */ +" %0 = 1 (X);\n\t" /* %0: best_dist */ +" %0 <<= 30;\n\t" +" %1 = 0 (X);\n\t" /* %1: best_i */ " P2 = %3\n\t" /* P2: ptr to cdbk */ " R5 = 0;\n\t" /* R5: best cb entry */ @@ -68,18 +68,18 @@ static int lsp_quant( " B0 = %2;\n\t" " R2.L = W [I0++];\n\t" -" LSETUP (lq1, lq2) LC0 = %4;\n\t" -"lq1: R3 = 0;\n\t" /* R3: dist */ -" LSETUP (lq3, lq4) LC1 = %5;\n\t" +" LSETUP (lq1, lq2) LC0 = %4;\n\t" +"lq1: R3 = 0;\n\t" /* R3: dist */ +" LSETUP (lq3, lq4) LC1 = %5;\n\t" "lq3: R1 = B [P2++] (X);\n\t" -" R1 <<= 5;\n\t" -" R0.L = R2.L - R1.L || R2.L = W [I0++];\n\t" -" R0 = R0.L*R0.L;\n\t" -"lq4: R3 = R3 + R0;\n\t" - -" cc =R3<%0;\n\t" -" if cc %0=R3;\n\t" -" if cc %1=R5;\n\t" +" R1 <<= 5;\n\t" +" R0.L = R2.L - R1.L || R2.L = W [I0++];\n\t" +" R0 = R0.L*R0.L;\n\t" +"lq4: R3 = R3 + R0;\n\t" + +" cc =R3<%0;\n\t" +" if cc %0=R3;\n\t" +" if cc %1=R5;\n\t" "lq2: R5 += 1;\n\t" " L0 = 0;\n\t" : "=&d" (best_dist), "=&d" (best_id) @@ -117,9 +117,9 @@ static int lsp_weight_quant( __asm__ __volatile__ ( -" %0 = 1 (X);\n\t" /* %0: best_dist */ -" %0 <<= 30;\n\t" -" %1 = 0 (X);\n\t" /* %1: best_i */ +" %0 = 1 (X);\n\t" /* %0: best_dist */ +" %0 <<= 30;\n\t" +" %1 = 0 (X);\n\t" /* %1: best_i */ " P2 = %4\n\t" /* P2: ptr to cdbk */ " R5 = 0;\n\t" /* R5: best cb entry */ @@ -128,26 +128,26 @@ static int lsp_weight_quant( " L0 = R0;\n\t" " L1 = R0;\n\t" " I0 = %2;\n\t" /* %2: &x[0] */ -" I1 = %3;\n\t" /* %3: &weight[0] */ +" I1 = %3;\n\t" /* %3: &weight[0] */ " B0 = %2;\n\t" -" B1 = %3;\n\t" +" B1 = %3;\n\t" -" LSETUP (lwq1, lwq2) LC0 = %5;\n\t" -"lwq1: R3 = 0 (X);\n\t" /* R3: dist */ -" LSETUP (lwq3, lwq4) LC1 = %6;\n\t" -"lwq3: R0.L = W [I0++] || R2.L = W [I1++];\n\t" +" LSETUP (lwq1, lwq2) LC0 = %5;\n\t" +"lwq1: R3 = 0 (X);\n\t" /* R3: dist */ +" LSETUP (lwq3, lwq4) LC1 = %6;\n\t" +"lwq3: R0.L = W [I0++] || R2.L = W [I1++];\n\t" " R1 = B [P2++] (X);\n\t" -" R1 <<= 5;\n\t" -" R0.L = R0.L - R1.L;\n\t" +" R1 <<= 5;\n\t" +" R0.L = R0.L - R1.L;\n\t" " R0 = R0.L*R0.L;\n\t" -" A1 = R2.L*R0.L (M,IS);\n\t" -" A1 = A1 >>> 16;\n\t" -" R1 = (A1 += R2.L*R0.H) (IS);\n\t" -"lwq4: R3 = R3 + R1;\n\t" - -" cc =R3<%0;\n\t" -" if cc %0=R3;\n\t" -" if cc %1=R5;\n\t" +" A1 = R2.L*R0.L (M,IS);\n\t" +" A1 = A1 >>> 16;\n\t" +" R1 = (A1 += R2.L*R0.H) (IS);\n\t" +"lwq4: R3 = R3 + R1;\n\t" + +" cc =R3<%0;\n\t" +" if cc %0=R3;\n\t" +" if cc %1=R5;\n\t" "lwq2: R5 += 1;\n\t" " L0 = 0;\n\t" " L1 = 0;\n\t" diff --git a/apps/codecs/libspeex/sb_celp.c b/apps/codecs/libspeex/sb_celp.c index 51f255661f..b28744812f 100644 --- a/apps/codecs/libspeex/sb_celp.c +++ b/apps/codecs/libspeex/sb_celp.c @@ -459,7 +459,7 @@ int sb_encode(void *state, void *vin, SpeexBits *bits) spx_int32_t modeid; modeid = mode->nb_modes-1; st->relative_quality+=1.0*(ratio+2); - if (st->relative_quality<-1) + if (st->relative_quality<-1) st->relative_quality=-1; while (modeid) { diff --git a/apps/codecs/libspeex/smallft.c b/apps/codecs/libspeex/smallft.c index 6ff46a8445..6e3a927b5f 100644 --- a/apps/codecs/libspeex/smallft.c +++ b/apps/codecs/libspeex/smallft.c @@ -96,10 +96,10 @@ static void drfti1(int n, float *wa, int *ifac){ argld=(float)ld*argh; fi=0.f; for (ii=2;iin/2; float *work=alloca(n*sizeof(*work)); bark_noise_hybridmp(n,p->bark,logfreq,logmask, - 140.,-1); + 140.,-1); for(i=0;ibark,work,logmask,0., - p->vi->noisewindowfixed); + p->vi->noisewindowfixed); for(i=0;ivi->noisewindowlominvi->noisewindowlo);lo++); + toBARK(rate/(2*n)*lo)<(bark-p->vi->noisewindowlo);lo++); for(;hi<=n && (hivi->noisewindowhimin || - toBARK(rate/(2*n)*hi)<(bark+p->vi->noisewindowhi));hi++); + toBARK(rate/(2*n)*hi)<(bark+p->vi->noisewindowhi));hi++); p->bark[i]=((lo-1)<<16)+(hi-1); diff --git a/apps/codecs/libtremor/asm_arm.h b/apps/codecs/libtremor/asm_arm.h index 577dc91566..8da7ed75cc 100644 --- a/apps/codecs/libtremor/asm_arm.h +++ b/apps/codecs/libtremor/asm_arm.h @@ -34,55 +34,55 @@ static inline ogg_int32_t MULT31(ogg_int32_t x, ogg_int32_t y) { static inline ogg_int32_t MULT31_SHIFT15(ogg_int32_t x, ogg_int32_t y) { int lo,hi; - asm volatile("smull %0, %1, %2, %3\n\t" - "movs %0, %0, lsr #15\n\t" - "adc %1, %0, %1, lsl #17\n\t" + asm volatile("smull %0, %1, %2, %3\n\t" + "movs %0, %0, lsr #15\n\t" + "adc %1, %0, %1, lsl #17\n\t" : "=&r"(lo),"=&r"(hi) : "%r"(x),"r"(y) - : "cc"); + : "cc"); return(hi); } #define XPROD32(a, b, t, v, x, y) \ { \ long l; \ - asm( "smull %0, %1, %4, %6\n\t" \ - "rsb %3, %4, #0\n\t" \ - "smlal %0, %1, %5, %7\n\t" \ - "smull %0, %2, %5, %6\n\t" \ - "smlal %0, %2, %3, %7" \ - : "=&r" (l), "=&r" (x), "=&r" (y), "=r" ((a)) \ - : "3" ((a)), "r" ((b)), "r" ((t)), "r" ((v)) ); \ + asm( "smull %0, %1, %4, %6\n\t" \ + "rsb %3, %4, #0\n\t" \ + "smlal %0, %1, %5, %7\n\t" \ + "smull %0, %2, %5, %6\n\t" \ + "smlal %0, %2, %3, %7" \ + : "=&r" (l), "=&r" (x), "=&r" (y), "=r" ((a)) \ + : "3" ((a)), "r" ((b)), "r" ((t)), "r" ((v)) ); \ } static inline void XPROD31(ogg_int32_t a, ogg_int32_t b, - ogg_int32_t t, ogg_int32_t v, - ogg_int32_t *x, ogg_int32_t *y) + ogg_int32_t t, ogg_int32_t v, + ogg_int32_t *x, ogg_int32_t *y) { int x1, y1, l; - asm( "smull %0, %1, %4, %6\n\t" - "rsb %3, %4, #0\n\t" - "smlal %0, %1, %5, %7\n\t" - "smull %0, %2, %5, %6\n\t" - "smlal %0, %2, %3, %7" - : "=&r" (l), "=&r" (x1), "=&r" (y1), "=r" (a) - : "3" (a), "r" (b), "r" (t), "r" (v) ); + asm( "smull %0, %1, %4, %6\n\t" + "rsb %3, %4, #0\n\t" + "smlal %0, %1, %5, %7\n\t" + "smull %0, %2, %5, %6\n\t" + "smlal %0, %2, %3, %7" + : "=&r" (l), "=&r" (x1), "=&r" (y1), "=r" (a) + : "3" (a), "r" (b), "r" (t), "r" (v) ); *x = x1 << 1; *y = y1 << 1; } static inline void XNPROD31(ogg_int32_t a, ogg_int32_t b, - ogg_int32_t t, ogg_int32_t v, - ogg_int32_t *x, ogg_int32_t *y) + ogg_int32_t t, ogg_int32_t v, + ogg_int32_t *x, ogg_int32_t *y) { int x1, y1, l; - asm( "smull %0, %1, %3, %5\n\t" - "rsb %2, %4, #0\n\t" - "smlal %0, %1, %2, %6\n\t" - "smull %0, %2, %4, %5\n\t" - "smlal %0, %2, %3, %6" - : "=&r" (l), "=&r" (x1), "=&r" (y1) - : "r" (a), "r" (b), "r" (t), "r" (v) ); + asm( "smull %0, %1, %3, %5\n\t" + "rsb %2, %4, #0\n\t" + "smlal %0, %1, %2, %6\n\t" + "smull %0, %2, %4, %5\n\t" + "smlal %0, %2, %3, %6" + : "=&r" (l), "=&r" (x1), "=&r" (y1) + : "r" (a), "r" (b), "r" (t), "r" (v) ); *x = x1 << 1; *y = y1 << 1; } @@ -216,14 +216,14 @@ static inline void vect_copy(ogg_int32_t *x, const ogg_int32_t *y, int n) static inline ogg_int32_t CLIP_TO_15(ogg_int32_t x) { int tmp; - asm volatile("subs %1, %0, #32768\n\t" - "movpl %0, #0x7f00\n\t" - "orrpl %0, %0, #0xff\n" - "adds %1, %0, #32768\n\t" - "movmi %0, #0x8000" - : "+r"(x),"=r"(tmp) - : - : "cc"); + asm volatile("subs %1, %0, #32768\n\t" + "movpl %0, #0x7f00\n\t" + "orrpl %0, %0, #0xff\n" + "adds %1, %0, #32768\n\t" + "movmi %0, #0x8000" + : "+r"(x),"=r"(tmp) + : + : "cc"); return(x); } @@ -233,9 +233,9 @@ static inline ogg_int32_t CLIP_TO_15(ogg_int32_t x) { #define _V_LSP_MATH_ASM static inline void lsp_loop_asm(ogg_uint32_t *qip,ogg_uint32_t *pip, - ogg_int32_t *qexpp, - ogg_int32_t *ilsp,ogg_int32_t wi, - ogg_int32_t m){ + ogg_int32_t *qexpp, + ogg_int32_t *ilsp,ogg_int32_t wi, + ogg_int32_t m){ ogg_uint32_t qi=*qip,pi=*pip; ogg_int32_t qexp=*qexpp; @@ -291,7 +291,7 @@ static inline void lsp_loop_asm(ogg_uint32_t *qip,ogg_uint32_t *pip, //qexp+=shift; //} - + /* normalize to max 16 sig figs */ "2:" "mov r2,#0;" diff --git a/apps/codecs/libtremor/backends.h b/apps/codecs/libtremor/backends.h index 50c1c45cfd..677bc8fdc2 100644 --- a/apps/codecs/libtremor/backends.h +++ b/apps/codecs/libtremor/backends.h @@ -34,12 +34,12 @@ typedef struct{ vorbis_info_floor *(*unpack)(vorbis_info *,oggpack_buffer *); vorbis_look_floor *(*look) (vorbis_dsp_state *,vorbis_info_mode *, - vorbis_info_floor *); + vorbis_info_floor *); void (*free_info) (vorbis_info_floor *); void (*free_look) (vorbis_look_floor *); void *(*inverse1) (struct vorbis_block *,vorbis_look_floor *); int (*inverse2) (struct vorbis_block *,vorbis_look_floor *, - void *buffer,ogg_int32_t *); + void *buffer,ogg_int32_t *); } vorbis_func_floor; typedef struct{ @@ -77,11 +77,11 @@ typedef struct{ typedef struct{ vorbis_info_residue *(*unpack)(vorbis_info *,oggpack_buffer *); vorbis_look_residue *(*look) (vorbis_dsp_state *,vorbis_info_mode *, - vorbis_info_residue *); + vorbis_info_residue *); void (*free_info) (vorbis_info_residue *); void (*free_look) (vorbis_look_residue *); int (*inverse) (struct vorbis_block *,vorbis_look_residue *, - ogg_int32_t **,int *,int); + ogg_int32_t **,int *,int); } vorbis_func_residue; typedef struct vorbis_info_residue0{ @@ -101,7 +101,7 @@ typedef struct vorbis_info_residue0{ typedef struct{ vorbis_info_mapping *(*unpack)(vorbis_info *,oggpack_buffer *); vorbis_look_mapping *(*look) (vorbis_dsp_state *,vorbis_info_mode *, - vorbis_info_mapping *); + vorbis_info_mapping *); void (*free_info) (vorbis_info_mapping *); void (*free_look) (vorbis_look_mapping *); int (*inverse) (struct vorbis_block *vb,vorbis_look_mapping *); diff --git a/apps/codecs/libtremor/codebook.c b/apps/codecs/libtremor/codebook.c index c6027480a7..6ed6a08672 100644 --- a/apps/codecs/libtremor/codebook.c +++ b/apps/codecs/libtremor/codebook.c @@ -49,19 +49,19 @@ int vorbis_staticbook_unpack(oggpack_buffer *opb,static_codebook *s){ /* yes, unused entries */ for(i=0;ientries;i++){ - if(oggpack_read(opb,1)){ - long num=oggpack_read(opb,5); - if(num==-1)goto _eofout; - s->lengthlist[i]=num+1; - }else - s->lengthlist[i]=0; + if(oggpack_read(opb,1)){ + long num=oggpack_read(opb,5); + if(num==-1)goto _eofout; + s->lengthlist[i]=num+1; + }else + s->lengthlist[i]=0; } }else{ /* all entries used; no tagging */ for(i=0;ientries;i++){ - long num=oggpack_read(opb,5); - if(num==-1)goto _eofout; - s->lengthlist[i]=num+1; + long num=oggpack_read(opb,5); + if(num==-1)goto _eofout; + s->lengthlist[i]=num+1; } } @@ -73,11 +73,11 @@ int vorbis_staticbook_unpack(oggpack_buffer *opb,static_codebook *s){ s->lengthlist=(long *)_ogg_malloc(sizeof(*s->lengthlist)*s->entries); for(i=0;ientries;){ - long num=oggpack_read(opb,_ilog(s->entries-i)); - if(num==-1)goto _eofout; - for(j=0;jentries;j++,i++) - s->lengthlist[i]=length; - length++; + long num=oggpack_read(opb,_ilog(s->entries-i)); + if(num==-1)goto _eofout; + for(j=0;jentries;j++,i++) + s->lengthlist[i]=length; + length++; } } break; @@ -104,17 +104,17 @@ int vorbis_staticbook_unpack(oggpack_buffer *opb,static_codebook *s){ int quantvals=0; switch(s->maptype){ case 1: - quantvals=_book_maptype1_quantvals(s); - break; + quantvals=_book_maptype1_quantvals(s); + break; case 2: - quantvals=s->entries*s->dim; - break; + quantvals=s->entries*s->dim; + break; } /* quantized values */ s->quantlist=(long *)_ogg_malloc(sizeof(*s->quantlist)*quantvals); for(i=0;iquantlist[i]=oggpack_read(opb,s->q_quant); + s->quantlist[i]=oggpack_read(opb,s->q_quant); if(quantvals&&s->quantlist[quantvals-1]==-1)goto _eofout; } @@ -216,7 +216,7 @@ static inline ogg_uint32_t bitreverse(register ogg_uint32_t x) } STIN long decode_packed_entry_number(codebook *book, - oggpack_buffer *b){ + oggpack_buffer *b){ int read=book->dec_maxlength; long lo,hi; long lok = oggpack_look(b,book->dec_firsttablen); @@ -284,25 +284,25 @@ static long decode_packed_block(codebook *book, oggpack_buffer *b, ptr = (ogg_uint32_t *)(adr&~3); bitend = ((adr&3)+b->headend)*8; while (bufptrdec_maxlength)) { - if (bit-cachesize+32>=bitend) - break; - bit-=cachesize; - cache=letoh32(ptr[bit>>5]) >> (bit&31); - if (bit&31) - cache|=letoh32(ptr[(bit>>5)+1]) << (32-(bit&31)); - cachesize=32; - bit+=32; - } - - entry=book->dec_firsttable[cache&((1<dec_firsttablen)-1)]; - if(UNLIKELY(entry&0x80000000UL)){ - lo=(entry>>15)&0x7fff; - hi=book->used_entries-(entry&0x7fff); - { - ogg_uint32_t testword=bitreverse((ogg_uint32_t)cache); - + long entry, lo, hi; + if (UNLIKELY(cachesizedec_maxlength)) { + if (bit-cachesize+32>=bitend) + break; + bit-=cachesize; + cache=letoh32(ptr[bit>>5]) >> (bit&31); + if (bit&31) + cache|=letoh32(ptr[(bit>>5)+1]) << (32-(bit&31)); + cachesize=32; + bit+=32; + } + + entry=book->dec_firsttable[cache&((1<dec_firsttablen)-1)]; + if(UNLIKELY(entry&0x80000000UL)){ + lo=(entry>>15)&0x7fff; + hi=book->used_entries-(entry&0x7fff); + { + ogg_uint32_t testword=bitreverse((ogg_uint32_t)cache); + while(LIKELY(hi-lo>1)){ long p=(hi-lo)>>1; if (book->codelist[lo+p]>testword) @@ -312,15 +312,15 @@ static long decode_packed_block(codebook *book, oggpack_buffer *b, } entry=lo; } - }else - entry--; - - *bufptr++=entry; - { - int l=book->dec_codelengths[entry]; - cachesize-=l; - cache>>=l; - } + }else + entry--; + + *bufptr++=entry; + { + int l=book->dec_codelengths[entry]; + cachesize-=l; + cache>>=l; + } } adr=(unsigned long)b->headptr; @@ -366,7 +366,7 @@ long vorbis_book_decode(codebook *book, oggpack_buffer *b){ /* returns 0 on OK or -1 on eof *************************************/ long vorbis_book_decodevs_add(codebook *book,ogg_int32_t *a, - oggpack_buffer *b,int n,int point){ + oggpack_buffer *b,int n,int point){ if(book->used_entries>0){ int step=n/book->dim; long *entry = (long *)alloca(sizeof(*entry)*step); @@ -376,29 +376,29 @@ long vorbis_book_decodevs_add(codebook *book,ogg_int32_t *a, if(shift>=0){ for (i = 0; i < step; i++) { - entry[i]=decode_packed_entry_number(book,b); - if(entry[i]==-1)return(-1); - t[i] = book->valuelist+entry[i]*book->dim; + entry[i]=decode_packed_entry_number(book,b); + if(entry[i]==-1)return(-1); + t[i] = book->valuelist+entry[i]*book->dim; } for(i=0,o=0;idim;i++,o+=step) - for (j=0;j>shift; + for (j=0;j>shift; }else{ for (i = 0; i < step; i++) { - entry[i]=decode_packed_entry_number(book,b); - if(entry[i]==-1)return(-1); - t[i] = book->valuelist+entry[i]*book->dim; + entry[i]=decode_packed_entry_number(book,b); + if(entry[i]==-1)return(-1); + t[i] = book->valuelist+entry[i]*book->dim; } for(i=0,o=0;idim;i++,o+=step) - for (j=0;jused_entries>0){ int i,j,entry; ogg_int32_t *t; @@ -406,20 +406,20 @@ long vorbis_book_decodev_add(codebook *book,ogg_int32_t *a, if(shift>=0){ for(i=0;ivaluelist+entry*book->dim; - for (j=0;jdim;) - a[i++]+=t[j++]>>shift; + entry = decode_packed_entry_number(book,b); + if(entry==-1)return(-1); + t = book->valuelist+entry*book->dim; + for (j=0;jdim;) + a[i++]+=t[j++]>>shift; } }else{ shift = -shift; for(i=0;ivaluelist+entry*book->dim; - for (j=0;jdim;) - a[i++]+=t[j++]<valuelist+entry*book->dim; + for (j=0;jdim;) + a[i++]+=t[j++]<used_entries>0){ int i,j,entry; ogg_int32_t *t; @@ -436,22 +436,22 @@ long vorbis_book_decodev_set(codebook *book,ogg_int32_t *a, if(shift>=0){ for(i=0;ivaluelist+entry*book->dim; - for (j=0;jdim;){ - a[i++]=t[j++]>>shift; - } + entry = decode_packed_entry_number(book,b); + if(entry==-1)return(-1); + t = book->valuelist+entry*book->dim; + for (j=0;jdim;){ + a[i++]=t[j++]>>shift; + } } }else{ shift = -shift; for(i=0;ivaluelist+entry*book->dim; - for (j=0;jdim;){ - a[i++]=t[j++]<valuelist+entry*book->dim; + for (j=0;jdim;){ + a[i++]=t[j++]<dim;){ - a[i++]=0; + a[i++]=0; } } } @@ -516,8 +516,8 @@ static long vorbis_book_decodevv_add_2ch_even(codebook *book,ogg_int32_t **a, } long vorbis_book_decodevv_add(codebook *book,ogg_int32_t **a, - long offset,int ch, - oggpack_buffer *b,int n,int point){ + long offset,int ch, + oggpack_buffer *b,int n,int point){ if(LIKELY(book->used_entries>0)){ long i,j,k,chunk,read; int chptr=0; @@ -535,14 +535,14 @@ long vorbis_book_decodevv_add(codebook *book,ogg_int32_t **a, chunk=((offset+n-i)*ch+book->dim-1)/book->dim; read = decode_packed_block(book,b,entries,chunk); for(k=0;kvaluelist+entries[k]*book->dim; - for (j=0;jdim;j++){ - a[chptr++][i]+=t[j]>>shift; - if(chptr==ch){ - chptr=0; - i++; - } - } + const ogg_int32_t *t = book->valuelist+entries[k]*book->dim; + for (j=0;jdim;j++){ + a[chptr++][i]+=t[j]>>shift; + if(chptr==ch){ + chptr=0; + i++; + } + } } if (readdim-1)/book->dim; read = decode_packed_block(book,b,entries,chunk); for(k=0;kvaluelist+entries[k]*book->dim; - for (j=0;jdim;j++){ - a[chptr++][i]+=t[j]<valuelist+entries[k]*book->dim; + for (j=0;jdim;j++){ + a[chptr++][i]+=t[j]<>COS_LOOKUP_I_SHIFT; int d=a&COS_LOOKUP_I_MASK; return COS_LOOKUP_I[i]- ((d*(COS_LOOKUP_I[i]-COS_LOOKUP_I[i+1]))>> - COS_LOOKUP_I_SHIFT); + COS_LOOKUP_I_SHIFT); } /* interpolated lookup based cos function */ @@ -181,7 +181,7 @@ static void vorbis_lsp_to_curve(ogg_int32_t *curve,int *map,int n,int ln, qi=((qi*qi)>>16); if(m&1){ - qexp= qexp*2-28*((m+1)>>1)+m; + qexp= qexp*2-28*((m+1)>>1)+m; pi*=(1<<14)-((wi*wi)>>14); qi+=pi>>14; }else{ @@ -205,15 +205,15 @@ static void vorbis_lsp_to_curve(ogg_int32_t *curve,int *map,int n,int ln, for(j=3;j>25])) - if(!(shift=MLOOP_2[(pi|qi)>>19])) - shift=MLOOP_3[(pi|qi)>>16]; + if(!(shift=MLOOP_2[(pi|qi)>>19])) + shift=MLOOP_3[(pi|qi)>>16]; qi=(qi>>shift)*labs(ilsp[j-1]-wi); pi=(pi>>shift)*labs(ilsp[j]-wi); qexp+=shift; } if(!(shift=MLOOP_1[(pi|qi)>>25])) if(!(shift=MLOOP_2[(pi|qi)>>19])) - shift=MLOOP_3[(pi|qi)>>16]; + shift=MLOOP_3[(pi|qi)>>16]; /* pi,qi normalized collectively, both tracked using qexp */ @@ -225,8 +225,8 @@ static void vorbis_lsp_to_curve(ogg_int32_t *curve,int *map,int n,int ln, qexp+=shift; if(!(shift=MLOOP_1[(pi|qi)>>25])) - if(!(shift=MLOOP_2[(pi|qi)>>19])) - shift=MLOOP_3[(pi|qi)>>16]; + if(!(shift=MLOOP_2[(pi|qi)>>19])) + shift=MLOOP_3[(pi|qi)>>16]; pi>>=shift; qi>>=shift; @@ -243,7 +243,7 @@ static void vorbis_lsp_to_curve(ogg_int32_t *curve,int *map,int n,int ln, /* even order filter; still symmetric */ /* p*=p(1-w), q*=q(1+w), let normalization drift because it isn't - worth tracking step by step */ + worth tracking step by step */ pi>>=shift; qi>>=shift; @@ -268,15 +268,15 @@ static void vorbis_lsp_to_curve(ogg_int32_t *curve,int *map,int n,int ln, qi>>=1; qexp++; }else while(qi && !(qi&0x8000)){ /* checks for 0.0xxxxxxxxxxxxxxx or less*/ - qi<<=1; qexp--; + qi<<=1; qexp--; } #endif amp=vorbis_fromdBlook_i(ampi* /* n.4 */ - vorbis_invsqlook_i(qi,qexp)- - /* m.8, m+n<=8 */ - ampoffseti); /* 8.12[0] */ + vorbis_invsqlook_i(qi,qexp)- + /* m.8, m+n<=8 */ + ampoffseti); /* 8.12[0] */ #ifdef _LOW_ACCURACY_ amp>>=9; @@ -366,7 +366,7 @@ static vorbis_look_floor *floor0_look (vorbis_dsp_state *vd,vorbis_info_mode *mi for(j=0;jn;j++){ int val=(look->ln* - ((toBARK(info->rate/2*j/look->n)<<11)/toBARK(info->rate/2)))>>11; + ((toBARK(info->rate/2*j/look->n)<<11)/toBARK(info->rate/2)))>>11; if(val>=look->ln)val=look->ln-1; /* guard against the approximation */ look->linearmap[j]=val; @@ -398,10 +398,10 @@ static void *floor0_inverse1(vorbis_block *vb,vorbis_look_floor *i){ ogg_int32_t *lsp=(ogg_int32_t *)_vorbis_block_alloc(vb,sizeof(*lsp)*(look->m+1)); for(j=0;jm;j+=b->dim) - if(vorbis_book_decodev_set(b,lsp+j,&vb->opb,b->dim,-24)==-1)goto eop; + if(vorbis_book_decodev_set(b,lsp+j,&vb->opb,b->dim,-24)==-1)goto eop; for(j=0;jm;){ - for(k=0;kdim;k++,j++)lsp[j]+=last; - last=lsp[j-1]; + for(k=0;kdim;k++,j++)lsp[j]+=last; + last=lsp[j-1]; } lsp[look->m]=amp; @@ -413,7 +413,7 @@ static void *floor0_inverse1(vorbis_block *vb,vorbis_look_floor *i){ } static int floor0_inverse2(vorbis_block *vb,vorbis_look_floor *i, - void *memo,ogg_int32_t *out){ + void *memo,ogg_int32_t *out){ vorbis_look_floor0 *look=(vorbis_look_floor0 *)i; vorbis_info_floor0 *info=look->vi; (void)vb; @@ -424,7 +424,7 @@ static int floor0_inverse2(vorbis_block *vb,vorbis_look_floor *i, /* take the coefficients back to a spectral envelope curve */ vorbis_lsp_to_curve(out,look->linearmap,look->n,look->ln, - lsp,look->m,amp,info->ampdB,look->lsp_look); + lsp,look->m,amp,info->ampdB,look->lsp_look); return(1); } memset(out,0,sizeof(*out)*look->n); diff --git a/apps/codecs/libtremor/framing.c b/apps/codecs/libtremor/framing.c index ec1e4c34c2..0b08167da8 100644 --- a/apps/codecs/libtremor/framing.c +++ b/apps/codecs/libtremor/framing.c @@ -1003,11 +1003,11 @@ STATICIRAM_NOT_MDCT int _packetout(ogg_stream_state *os,ogg_packet *op,int adv){ /* split the body contents off */ if(op){ op->packet=ogg_buffer_split(&os->body_tail,&os->body_head, - os->body_fill&FINMASK); + os->body_fill&FINMASK); op->bytes=os->body_fill&FINMASK; }else{ os->body_tail=ogg_buffer_pretruncate(os->body_tail, - os->body_fill&FINMASK); + os->body_fill&FINMASK); if(os->body_tail==0)os->body_head=0; } diff --git a/apps/codecs/libtremor/info.c b/apps/codecs/libtremor/info.c index afa9497cf0..935fa03269 100644 --- a/apps/codecs/libtremor/info.c +++ b/apps/codecs/libtremor/info.c @@ -47,7 +47,7 @@ void vorbis_comment_clear(vorbis_comment *vc){ for(i=0;icomments;i++) if(vc->user_comments[i])_ogg_free(vc->user_comments[i]); if(vc->user_comments)_ogg_free(vc->user_comments); - if(vc->comment_lengths)_ogg_free(vc->comment_lengths); + if(vc->comment_lengths)_ogg_free(vc->comment_lengths); if(vc->vendor)_ogg_free(vc->vendor); memset(vc,0,sizeof(*vc)); } @@ -77,26 +77,26 @@ void vorbis_info_clear(vorbis_info *vi){ for(i=0;imaps;i++) /* unpack does the range checking */ if(ci->map_param[i]) - _mapping_P[ci->map_type[i]]->free_info(ci->map_param[i]); + _mapping_P[ci->map_type[i]]->free_info(ci->map_param[i]); for(i=0;ifloors;i++) /* unpack does the range checking */ if(ci->floor_param[i]) - _floor_P[ci->floor_type[i]]->free_info(ci->floor_param[i]); + _floor_P[ci->floor_type[i]]->free_info(ci->floor_param[i]); for(i=0;iresidues;i++) /* unpack does the range checking */ if(ci->residue_param[i]) - _residue_P[ci->residue_type[i]]->free_info(ci->residue_param[i]); + _residue_P[ci->residue_type[i]]->free_info(ci->residue_param[i]); for(i=0;ibooks;i++){ if(ci->book_param[i]){ - /* knows if the book was not alloced */ - vorbis_staticbook_destroy(ci->book_param[i]); + /* knows if the book was not alloced */ + vorbis_staticbook_destroy(ci->book_param[i]); } if(ci->fullbooks) - vorbis_book_clear(ci->fullbooks+i); + vorbis_book_clear(ci->fullbooks+i); } if(ci->fullbooks) - _ogg_free(ci->fullbooks); + _ogg_free(ci->fullbooks); _ogg_free(ci); } @@ -278,42 +278,42 @@ int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc,ogg_packet *op) memset(buffer,0,6); _v_readstring(&opb,buffer,6); if(memcmp(buffer,"vorbis",6)){ - /* not a vorbis header */ - return(OV_ENOTVORBIS); + /* not a vorbis header */ + return(OV_ENOTVORBIS); } switch(packtype){ case 0x01: /* least significant *bit* is read first */ - if(!op->b_o_s){ - /* Not the initial packet */ - return(OV_EBADHEADER); - } - if(vi->rate!=0){ - /* previously initialized info header */ - return(OV_EBADHEADER); - } + if(!op->b_o_s){ + /* Not the initial packet */ + return(OV_EBADHEADER); + } + if(vi->rate!=0){ + /* previously initialized info header */ + return(OV_EBADHEADER); + } - return(_vorbis_unpack_info(vi,&opb)); + return(_vorbis_unpack_info(vi,&opb)); case 0x03: /* least significant *bit* is read first */ - if(vi->rate==0){ - /* um... we didn't get the initial header */ - return(OV_EBADHEADER); - } + if(vi->rate==0){ + /* um... we didn't get the initial header */ + return(OV_EBADHEADER); + } - return(_vorbis_unpack_comment(vc,&opb)); + return(_vorbis_unpack_comment(vc,&opb)); case 0x05: /* least significant *bit* is read first */ - if(vi->rate==0 || vc->vendor==NULL){ - /* um... we didn;t get the initial header or comments yet */ - return(OV_EBADHEADER); - } + if(vi->rate==0 || vc->vendor==NULL){ + /* um... we didn;t get the initial header or comments yet */ + return(OV_EBADHEADER); + } - return(_vorbis_unpack_books(vi,&opb)); + return(_vorbis_unpack_books(vi,&opb)); default: - /* Not a valid vorbis header type */ - return(OV_EBADHEADER); - break; + /* Not a valid vorbis header type */ + return(OV_EBADHEADER); + break; } } } diff --git a/apps/codecs/libtremor/ivorbiscodec.h b/apps/codecs/libtremor/ivorbiscodec.h index f17c57a86d..0f3c940216 100644 --- a/apps/codecs/libtremor/ivorbiscodec.h +++ b/apps/codecs/libtremor/ivorbiscodec.h @@ -157,7 +157,7 @@ extern int vorbis_info_blocksize(vorbis_info *vi,int zo); extern void vorbis_comment_init(vorbis_comment *vc); extern void vorbis_comment_add(vorbis_comment *vc, char *comment); extern void vorbis_comment_add_tag(vorbis_comment *vc, - char *tag, char *contents); + char *tag, char *contents); extern void vorbis_comment_clear(vorbis_comment *vc); extern int vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb); @@ -167,7 +167,7 @@ extern void vorbis_dsp_clear(vorbis_dsp_state *v); /* Vorbis PRIMITIVES: synthesis layer *******************************/ extern int vorbis_synthesis_idheader(ogg_packet *op); extern int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc, - ogg_packet *op); + ogg_packet *op); extern int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi); extern int vorbis_synthesis_restart(vorbis_dsp_state *v); diff --git a/apps/codecs/libtremor/ivorbisfile.h b/apps/codecs/libtremor/ivorbisfile.h index 9ff446ab10..4aa82cf9a0 100644 --- a/apps/codecs/libtremor/ivorbisfile.h +++ b/apps/codecs/libtremor/ivorbisfile.h @@ -89,11 +89,11 @@ typedef struct OggVorbis_File { extern int ov_clear(OggVorbis_File *vf); //extern int ov_open(FILE *f,OggVorbis_File *vf,char *initial,long ibytes); extern int ov_open_callbacks(void *datasource, OggVorbis_File *vf, - char *initial, long ibytes, ov_callbacks callbacks); + char *initial, long ibytes, ov_callbacks callbacks); //extern int ov_test(FILE *f,OggVorbis_File *vf,char *initial,long ibytes); extern int ov_test_callbacks(void *datasource, OggVorbis_File *vf, - char *initial, long ibytes, ov_callbacks callbacks); + char *initial, long ibytes, ov_callbacks callbacks); extern int ov_test_open(OggVorbis_File *vf); extern long ov_bitrate(OggVorbis_File *vf,int i); @@ -120,7 +120,7 @@ extern vorbis_info *ov_info(OggVorbis_File *vf,int link); extern vorbis_comment *ov_comment(OggVorbis_File *vf,int link); extern long ov_read(OggVorbis_File *vf,char *buffer,int length, - int *bitstream); + int *bitstream); extern long ov_read_fixed(OggVorbis_File *vf,ogg_int32_t ***pcm_channels, int length,int *bitstream); diff --git a/apps/codecs/libtremor/lsp_lookup.h b/apps/codecs/libtremor/lsp_lookup.h index cced7c9282..42940bd39b 100644 --- a/apps/codecs/libtremor/lsp_lookup.h +++ b/apps/codecs/libtremor/lsp_lookup.h @@ -51,23 +51,23 @@ static const ogg_int32_t FROMdB2_LOOKUP[FROMdB2_LOOKUP_SZ] ={ #define INVSQ_LOOKUP_I_SHIFT 10 #define INVSQ_LOOKUP_I_MASK 1023 static const long INVSQ_LOOKUP_I[64+1] ={ - 92682, 91966, 91267, 90583, - 89915, 89261, 88621, 87995, - 87381, 86781, 86192, 85616, - 85051, 84497, 83953, 83420, - 82897, 82384, 81880, 81385, - 80899, 80422, 79953, 79492, - 79039, 78594, 78156, 77726, - 77302, 76885, 76475, 76072, - 75674, 75283, 74898, 74519, - 74146, 73778, 73415, 73058, - 72706, 72359, 72016, 71679, - 71347, 71019, 70695, 70376, - 70061, 69750, 69444, 69141, - 68842, 68548, 68256, 67969, - 67685, 67405, 67128, 66855, - 66585, 66318, 66054, 65794, - 65536, + 92682, 91966, 91267, 90583, + 89915, 89261, 88621, 87995, + 87381, 86781, 86192, 85616, + 85051, 84497, 83953, 83420, + 82897, 82384, 81880, 81385, + 80899, 80422, 79953, 79492, + 79039, 78594, 78156, 77726, + 77302, 76885, 76475, 76072, + 75674, 75283, 74898, 74519, + 74146, 73778, 73415, 73058, + 72706, 72359, 72016, 71679, + 71347, 71019, 70695, 70376, + 70061, 69750, 69444, 69141, + 68842, 68548, 68256, 67969, + 67685, 67405, 67128, 66855, + 66585, 66318, 66054, 65794, + 65536, }; static const long INVSQ_LOOKUP_IDel[64] ={ @@ -93,39 +93,39 @@ static const long INVSQ_LOOKUP_IDel[64] ={ #define COS_LOOKUP_I_MASK 511 #define COS_LOOKUP_I_SZ 128 static const ogg_int32_t COS_LOOKUP_I[COS_LOOKUP_I_SZ+1] ={ - 16384, 16379, 16364, 16340, - 16305, 16261, 16207, 16143, - 16069, 15986, 15893, 15791, - 15679, 15557, 15426, 15286, - 15137, 14978, 14811, 14635, - 14449, 14256, 14053, 13842, - 13623, 13395, 13160, 12916, - 12665, 12406, 12140, 11866, - 11585, 11297, 11003, 10702, - 10394, 10080, 9760, 9434, - 9102, 8765, 8423, 8076, - 7723, 7366, 7005, 6639, - 6270, 5897, 5520, 5139, - 4756, 4370, 3981, 3590, - 3196, 2801, 2404, 2006, - 1606, 1205, 804, 402, - 0, -401, -803, -1204, - -1605, -2005, -2403, -2800, - -3195, -3589, -3980, -4369, - -4755, -5138, -5519, -5896, - -6269, -6638, -7004, -7365, - -7722, -8075, -8422, -8764, - -9101, -9433, -9759, -10079, - -10393, -10701, -11002, -11296, - -11584, -11865, -12139, -12405, - -12664, -12915, -13159, -13394, - -13622, -13841, -14052, -14255, - -14448, -14634, -14810, -14977, - -15136, -15285, -15425, -15556, - -15678, -15790, -15892, -15985, - -16068, -16142, -16206, -16260, - -16304, -16339, -16363, -16378, - -16383, + 16384, 16379, 16364, 16340, + 16305, 16261, 16207, 16143, + 16069, 15986, 15893, 15791, + 15679, 15557, 15426, 15286, + 15137, 14978, 14811, 14635, + 14449, 14256, 14053, 13842, + 13623, 13395, 13160, 12916, + 12665, 12406, 12140, 11866, + 11585, 11297, 11003, 10702, + 10394, 10080, 9760, 9434, + 9102, 8765, 8423, 8076, + 7723, 7366, 7005, 6639, + 6270, 5897, 5520, 5139, + 4756, 4370, 3981, 3590, + 3196, 2801, 2404, 2006, + 1606, 1205, 804, 402, + 0, -401, -803, -1204, + -1605, -2005, -2403, -2800, + -3195, -3589, -3980, -4369, + -4755, -5138, -5519, -5896, + -6269, -6638, -7004, -7365, + -7722, -8075, -8422, -8764, + -9101, -9433, -9759, -10079, + -10393, -10701, -11002, -11296, + -11584, -11865, -12139, -12405, + -12664, -12915, -13159, -13394, + -13622, -13841, -14052, -14255, + -14448, -14634, -14810, -14977, + -15136, -15285, -15425, -15556, + -15678, -15790, -15892, -15985, + -16068, -16142, -16206, -16260, + -16304, -16339, -16363, -16378, + -16383, }; #endif diff --git a/apps/codecs/libtremor/misc.h b/apps/codecs/libtremor/misc.h index 59ce6dbb74..6e22f20008 100644 --- a/apps/codecs/libtremor/misc.h +++ b/apps/codecs/libtremor/misc.h @@ -119,33 +119,33 @@ static inline ogg_int32_t MULT31_SHIFT15(ogg_int32_t x, ogg_int32_t y) { /* replaced XPROD32 with a macro to avoid memory reference _x, _y are the results (must be l-values) */ -#define XPROD32(_a, _b, _t, _v, _x, _y) \ - { (_x)=MULT32(_a,_t)+MULT32(_b,_v); \ +#define XPROD32(_a, _b, _t, _v, _x, _y) \ + { (_x)=MULT32(_a,_t)+MULT32(_b,_v); \ (_y)=MULT32(_b,_t)-MULT32(_a,_v); } #ifdef __i386__ -#define XPROD31(_a, _b, _t, _v, _x, _y) \ - { *(_x)=MULT31(_a,_t)+MULT31(_b,_v); \ +#define XPROD31(_a, _b, _t, _v, _x, _y) \ + { *(_x)=MULT31(_a,_t)+MULT31(_b,_v); \ *(_y)=MULT31(_b,_t)-MULT31(_a,_v); } -#define XNPROD31(_a, _b, _t, _v, _x, _y) \ - { *(_x)=MULT31(_a,_t)-MULT31(_b,_v); \ +#define XNPROD31(_a, _b, _t, _v, _x, _y) \ + { *(_x)=MULT31(_a,_t)-MULT31(_b,_v); \ *(_y)=MULT31(_b,_t)+MULT31(_a,_v); } #else static inline void XPROD31(ogg_int32_t a, ogg_int32_t b, - ogg_int32_t t, ogg_int32_t v, - ogg_int32_t *x, ogg_int32_t *y) + ogg_int32_t t, ogg_int32_t v, + ogg_int32_t *x, ogg_int32_t *y) { *x = MULT31(a, t) + MULT31(b, v); *y = MULT31(b, t) - MULT31(a, v); } static inline void XNPROD31(ogg_int32_t a, ogg_int32_t b, - ogg_int32_t t, ogg_int32_t v, - ogg_int32_t *x, ogg_int32_t *y) + ogg_int32_t t, ogg_int32_t v, + ogg_int32_t *x, ogg_int32_t *y) { *x = MULT31(a, t) - MULT31(b, v); *y = MULT31(b, t) + MULT31(a, v); @@ -217,8 +217,8 @@ static inline ogg_int32_t CLIP_TO_15(ogg_int32_t x) { #endif static inline ogg_int32_t VFLOAT_MULT(ogg_int32_t a,ogg_int32_t ap, - ogg_int32_t b,ogg_int32_t bp, - ogg_int32_t *p){ + ogg_int32_t b,ogg_int32_t bp, + ogg_int32_t *p){ if(a && b){ #ifndef _LOW_ACCURACY_ *p=ap+bp+32; @@ -232,16 +232,16 @@ static inline ogg_int32_t VFLOAT_MULT(ogg_int32_t a,ogg_int32_t ap, } static inline ogg_int32_t VFLOAT_MULTI(ogg_int32_t a,ogg_int32_t ap, - ogg_int32_t i, - ogg_int32_t *p){ + ogg_int32_t i, + ogg_int32_t *p){ int ip=_ilog(abs(i))-31; return VFLOAT_MULT(a,ap,i<<-ip,ip,p); } static inline ogg_int32_t VFLOAT_ADD(ogg_int32_t a,ogg_int32_t ap, - ogg_int32_t b,ogg_int32_t bp, - ogg_int32_t *p){ + ogg_int32_t b,ogg_int32_t bp, + ogg_int32_t *p){ if(!a){ *p=bp; diff --git a/apps/codecs/libtremor/sharedbook.c b/apps/codecs/libtremor/sharedbook.c index 853d1f5d61..10fae80c84 100644 --- a/apps/codecs/libtremor/sharedbook.c +++ b/apps/codecs/libtremor/sharedbook.c @@ -80,45 +80,45 @@ static ogg_uint32_t *_make_words(long *l,long n,long sparsecount){ ogg_uint32_t entry=marker[length]; /* when we claim a node for an entry, we also claim the nodes - below it (pruning off the imagined tree that may have dangled - from it) as well as blocking the use of any nodes directly - above for leaves */ + below it (pruning off the imagined tree that may have dangled + from it) as well as blocking the use of any nodes directly + above for leaves */ /* update ourself */ if(length<32 && (entry>>length)){ - /* error condition; the lengths must specify an overpopulated tree */ - _ogg_free(r); - return(NULL); + /* error condition; the lengths must specify an overpopulated tree */ + _ogg_free(r); + return(NULL); } r[count++]=entry; /* Look to see if the next shorter marker points to the node - above. if so, update it and repeat. */ + above. if so, update it and repeat. */ { - for(j=length;j>0;j--){ - - if(marker[j]&1){ - /* have to jump branches */ - if(j==1) - marker[1]++; - else - marker[j]=marker[j-1]<<1; - break; /* invariant says next upper marker would already - have been moved if it was on the same path */ - } - marker[j]++; - } + for(j=length;j>0;j--){ + + if(marker[j]&1){ + /* have to jump branches */ + if(j==1) + marker[1]++; + else + marker[j]=marker[j-1]<<1; + break; /* invariant says next upper marker would already + have been moved if it was on the same path */ + } + marker[j]++; + } } /* prune the tree; the implicit invariant says all the longer - markers were dangling from our just-taken node. Dangle them - from our *new* node. */ + markers were dangling from our just-taken node. Dangle them + from our *new* node. */ for(j=length+1;j<33;j++) - if((marker[j]>>1) == entry){ - entry=marker[j]; - marker[j]=marker[j-1]<<1; - }else - break; + if((marker[j]>>1) == entry){ + entry=marker[j]; + marker[j]=marker[j-1]<<1; + }else + break; }else if(sparsecount==0)count++; } @@ -134,7 +134,7 @@ static ogg_uint32_t *_make_words(long *l,long n,long sparsecount){ if(sparsecount){ if(l[i]) - r[count++]=temp; + r[count++]=temp; }else r[count++]=temp; } @@ -162,9 +162,9 @@ long _book_maptype1_quantvals(const static_codebook *b){ return(vals); }else{ if(acc>b->entries){ - vals--; + vals--; }else{ - vals++; + vals++; } } } @@ -197,85 +197,85 @@ static ogg_int32_t *_book_unquantize(const static_codebook *b,int n, switch(b->maptype){ case 1: /* most of the time, entries%dimensions == 0, but we need to be - well defined. We define that the possible vales at each - scalar is values == entries/dim. If entries%dim != 0, we'll - have 'too few' values (values*dimentries;j++){ - if((sparsemap && b->lengthlist[j]) || !sparsemap){ - ogg_int32_t last=0; - int lastpoint=0; - int indexdiv=1; - for(k=0;kdim;k++){ - int index= (j/indexdiv)%quantvals; - int point=0; - int val=VFLOAT_MULTI(delta,delpoint, - abs(b->quantlist[index]),&point); - - val=VFLOAT_ADD(mindel,minpoint,val,point,&point); - val=VFLOAT_ADD(last,lastpoint,val,point,&point); - - if(b->q_sequencep){ - last=val; - lastpoint=point; - } - - if(sparsemap){ - r[sparsemap[count]*b->dim+k]=val; - rp[sparsemap[count]*b->dim+k]=point; - }else{ - r[count*b->dim+k]=val; - rp[count*b->dim+k]=point; - } - if(*maxpointlengthlist[j]) || !sparsemap){ + ogg_int32_t last=0; + int lastpoint=0; + int indexdiv=1; + for(k=0;kdim;k++){ + int index= (j/indexdiv)%quantvals; + int point=0; + int val=VFLOAT_MULTI(delta,delpoint, + abs(b->quantlist[index]),&point); + + val=VFLOAT_ADD(mindel,minpoint,val,point,&point); + val=VFLOAT_ADD(last,lastpoint,val,point,&point); + + if(b->q_sequencep){ + last=val; + lastpoint=point; + } + + if(sparsemap){ + r[sparsemap[count]*b->dim+k]=val; + rp[sparsemap[count]*b->dim+k]=point; + }else{ + r[count*b->dim+k]=val; + rp[count*b->dim+k]=point; + } + if(*maxpointentries;j++){ - if((sparsemap && b->lengthlist[j]) || !sparsemap){ - ogg_int32_t last=0; - int lastpoint=0; - - for(k=0;kdim;k++){ - int point=0; - int val=VFLOAT_MULTI(delta,delpoint, - abs(b->quantlist[j*b->dim+k]),&point); - - val=VFLOAT_ADD(mindel,minpoint,val,point,&point); - val=VFLOAT_ADD(last,lastpoint,val,point,&point); - - if(b->q_sequencep){ - last=val; - lastpoint=point; - } - - if(sparsemap){ - r[sparsemap[count]*b->dim+k]=val; - rp[sparsemap[count]*b->dim+k]=point; - }else{ - r[count*b->dim+k]=val; - rp[count*b->dim+k]=point; - } - if(*maxpointlengthlist[j]) || !sparsemap){ + ogg_int32_t last=0; + int lastpoint=0; + + for(k=0;kdim;k++){ + int point=0; + int val=VFLOAT_MULTI(delta,delpoint, + abs(b->quantlist[j*b->dim+k]),&point); + + val=VFLOAT_ADD(mindel,minpoint,val,point,&point); + val=VFLOAT_ADD(last,lastpoint,val,point,&point); + + if(b->q_sequencep){ + last=val; + lastpoint=point; + } + + if(sparsemap){ + r[sparsemap[count]*b->dim+k]=val; + rp[sparsemap[count]*b->dim+k]=point; + }else{ + r[count*b->dim+k]=val; + rp[count*b->dim+k]=point; + } + if(*maxpointdim;j++) if(rp[j]<*maxpoint) - r[j]>>=*maxpoint-rp[j]; - + r[j]>>=*maxpoint-rp[j]; + _ogg_free(rp); return(r); } @@ -383,12 +383,12 @@ int vorbis_book_init_decode(codebook *c,const static_codebook *s){ for(n=0,i=0;ientries;i++) if(s->lengthlist[i]>0) - c->dec_index[sortindex[n++]]=i; + c->dec_index[sortindex[n++]]=i; c->dec_codelengths=(char *)_ogg_malloc(n*sizeof(*c->dec_codelengths)); for(n=0,i=0;ientries;i++) if(s->lengthlist[i]>0) - c->dec_codelengths[sortindex[n++]]=s->lengthlist[i]; + c->dec_codelengths[sortindex[n++]]=s->lengthlist[i]; _ogg_free(sortindex); c->dec_firsttablen=_ilog(c->used_entries)-4; /* this is magic */ @@ -401,11 +401,11 @@ int vorbis_book_init_decode(codebook *c,const static_codebook *s){ for(i=0;idec_maxlengthdec_codelengths[i]) - c->dec_maxlength=c->dec_codelengths[i]; + c->dec_maxlength=c->dec_codelengths[i]; if(c->dec_codelengths[i]<=c->dec_firsttablen){ - ogg_uint32_t orig=bitreverse(c->codelist[i]); - for(j=0;j<(1<<(c->dec_firsttablen-c->dec_codelengths[i]));j++) - c->dec_firsttable[orig|(j<dec_codelengths[i])]=i+1; + ogg_uint32_t orig=bitreverse(c->codelist[i]); + for(j=0;j<(1<<(c->dec_firsttablen-c->dec_codelengths[i]));j++) + c->dec_firsttable[orig|(j<dec_codelengths[i])]=i+1; } } @@ -416,24 +416,24 @@ int vorbis_book_init_decode(codebook *c,const static_codebook *s){ long lo=0,hi=0; for(i=0;idec_firsttablen); - if(c->dec_firsttable[bitreverse(word)]==0){ - while((lo+1)codelist[lo+1]<=word)lo++; - while( hi=(c->codelist[hi]&mask))hi++; - - /* we only actually have 15 bits per hint to play with here. - In order to overflow gracefully (nothing breaks, efficiency - just drops), encode as the difference from the extremes. */ - { - unsigned long loval=lo; - unsigned long hival=n-hi; - - if(loval>0x7fff)loval=0x7fff; - if(hival>0x7fff)hival=0x7fff; - c->dec_firsttable[bitreverse(word)]= - 0x80000000UL | (loval<<15) | hival; - } - } + ogg_uint32_t word=i<<(32-c->dec_firsttablen); + if(c->dec_firsttable[bitreverse(word)]==0){ + while((lo+1)codelist[lo+1]<=word)lo++; + while( hi=(c->codelist[hi]&mask))hi++; + + /* we only actually have 15 bits per hint to play with here. + In order to overflow gracefully (nothing breaks, efficiency + just drops), encode as the difference from the extremes. */ + { + unsigned long loval=lo; + unsigned long hival=n-hi; + + if(loval>0x7fff)loval=0x7fff; + if(hival>0x7fff)hival=0x7fff; + c->dec_firsttable[bitreverse(word)]= + 0x80000000UL | (loval<<15) | hival; + } + } } } } diff --git a/apps/codecs/libtremor/window.h b/apps/codecs/libtremor/window.h index 27647fe62e..f11742e1dd 100644 --- a/apps/codecs/libtremor/window.h +++ b/apps/codecs/libtremor/window.h @@ -20,8 +20,8 @@ extern const void *_vorbis_window(int type,int left); extern void _vorbis_apply_window(ogg_int32_t *d,const void *window[2], - long *blocksizes, - int lW,int W,int nW); + long *blocksizes, + int lW,int W,int nW); #endif diff --git a/apps/codecs/libwavpack/pack.c b/apps/codecs/libwavpack/pack.c index 9ccfa07261..a46d05fe14 100644 --- a/apps/codecs/libwavpack/pack.c +++ b/apps/codecs/libwavpack/pack.c @@ -409,13 +409,13 @@ static void decorr_stereo_pass_17 (struct decorr_pass *dpp, int32_t *bptr, int32 int32_t sam; while (bptr < eptr) { - sam = 2 * dpp->samples_A [0] - dpp->samples_A [1]; + sam = 2 * dpp->samples_A [0] - dpp->samples_A [1]; dpp->samples_A [1] = dpp->samples_A [0]; dpp->samples_A [0] = bptr [0]; bptr [0] -= apply_weight_i (dpp->weight_A, sam); update_weight (dpp->weight_A, 2, sam, bptr [0]); bptr++; - sam = 2 * dpp->samples_B [0] - dpp->samples_B [1]; + sam = 2 * dpp->samples_B [0] - dpp->samples_B [1]; dpp->samples_B [1] = dpp->samples_B [0]; dpp->samples_B [0] = bptr [0]; bptr [0] -= apply_weight_i (dpp->weight_B, sam); diff --git a/apps/codecs/libwma/asf.h b/apps/codecs/libwma/asf.h index 8cae8fae1d..3f7cc2e557 100644 --- a/apps/codecs/libwma/asf.h +++ b/apps/codecs/libwma/asf.h @@ -10,14 +10,14 @@ struct asf_waveformatex_s { uint32_t packet_size; int audiostream; - uint16_t codec_id; - uint16_t channels; - uint32_t rate; - uint32_t bitrate; - uint16_t blockalign; - uint16_t bitspersample; - uint16_t datalen; - uint8_t data[6]; + uint16_t codec_id; + uint16_t channels; + uint32_t rate; + uint32_t bitrate; + uint16_t blockalign; + uint16_t bitspersample; + uint16_t datalen; + uint8_t data[6]; }; typedef struct asf_waveformatex_s asf_waveformatex_t; -- cgit v1.2.3