mirror of
https://github.com/smallmain/cocos-enhance-kit.git
synced 2025-10-29 12:25:24 +00:00
补充某些必要的文件
This commit is contained in:
476
cocos2d-x/external/sources/pvmp3dec/src/asm/pvmp3_dct_16_gcc.s
vendored
Normal file
476
cocos2d-x/external/sources/pvmp3dec/src/asm/pvmp3_dct_16_gcc.s
vendored
Normal file
@@ -0,0 +1,476 @@
|
||||
@ ------------------------------------------------------------------
|
||||
@ Copyright (C) 1998-2009 PacketVideo
|
||||
@
|
||||
@ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ you may not use this file except in compliance with the License.
|
||||
@ You may obtain a copy of the License at
|
||||
@
|
||||
@ http://www.apache.org/licenses/LICENSE-2.0
|
||||
@
|
||||
@ Unless required by applicable law or agreed to in writing, software
|
||||
@ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
@ express or implied.
|
||||
@ See the License for the specific language governing permissions
|
||||
@ and limitations under the License.
|
||||
@ -------------------------------------------------------------------
|
||||
|
||||
@
|
||||
@
|
||||
@ Filename: pvmp3_dct_16_gcc.s
|
||||
@
|
||||
@
|
||||
@------------------------------------------------------------------------------
|
||||
@ REVISION HISTORY
|
||||
@
|
||||
@
|
||||
@ Who: Date: MM/DD/YYYY
|
||||
@ Description:
|
||||
@
|
||||
@------------------------------------------------------------------------------
|
||||
|
||||
.arm
|
||||
|
||||
.align 4
|
||||
|
||||
.text
|
||||
|
||||
.extern pvmp3_dct_16
|
||||
.extern pvmp3_merge_in_place_N32
|
||||
.extern pvmp3_split
|
||||
|
||||
|
||||
|
||||
@------------------------------------------------------------------------------
|
||||
|
||||
.global pvmp3_dct_16
|
||||
|
||||
pvmp3_dct_16:
|
||||
stmfd sp!,{r0,r1,r4-r11,lr}
|
||||
ldr r1,[r0]
|
||||
ldr r3,[r0,#0x3c]
|
||||
ldr r12,constant1
|
||||
sub r2,r1,r3
|
||||
smull lr,r2,r12,r2
|
||||
sub sp,sp,#0x1c
|
||||
str r2,[sp,#0x14]
|
||||
ldr r2,[r0,#0x1c]
|
||||
ldr r12,[r0,#0x20]
|
||||
add r1,r1,r3
|
||||
sub r3,r2,r12
|
||||
ldr lr,constant2
|
||||
mov r3,r3,lsl #3
|
||||
smull r4,r3,lr,r3
|
||||
ldr r6,constant5
|
||||
str r3,[sp]
|
||||
add r3,r2,r12
|
||||
sub r2,r1,r3
|
||||
ldr r12,constant3
|
||||
add r3,r1,r3
|
||||
smull lr,r2,r12,r2
|
||||
ldr r12,[r0,#0x38]
|
||||
ldr r1,[r0,#4]
|
||||
ldr lr,constant4
|
||||
sub r4,r1,r12
|
||||
add r1,r1,r12
|
||||
ldr r12,[r0,#0x18]
|
||||
smull r4,r5,lr,r4
|
||||
ldr lr,[r0,#0x24]
|
||||
ldr r10,constant10
|
||||
sub r4,r12,lr
|
||||
mov r4,r4,lsl #1
|
||||
smull r7,r4,r6,r4
|
||||
add r12,r12,lr
|
||||
add r7,r1,r12
|
||||
sub r12,r1,r12
|
||||
ldr r1,constant6
|
||||
str r4,[sp,#4]
|
||||
smull r12,r4,r1,r12
|
||||
ldr r1,[r0,#8]
|
||||
ldr r12,[r0,#0x34]
|
||||
ldr r6,constant7
|
||||
sub lr,r1,r12
|
||||
smull r8,lr,r6,lr
|
||||
add r1,r1,r12
|
||||
str lr,[sp,#0x10]
|
||||
ldr r12,[r0,#0x14]
|
||||
ldr lr,[r0,#0x28]
|
||||
ldr r8,constant8
|
||||
sub r6,r12,lr
|
||||
mov r6,r6,lsl #1
|
||||
smull r9,r6,r8,r6
|
||||
add r12,r12,lr
|
||||
ldr r9,constant9
|
||||
add r8,r1,r12
|
||||
sub r12,r1,r12
|
||||
smull r12,lr,r9,r12
|
||||
ldr r12,[r0,#0x30]
|
||||
ldr r1,[r0,#0xc]
|
||||
sub r9,r1,r12
|
||||
smull r11,r9,r10,r9
|
||||
add r12,r1,r12
|
||||
str r9,[sp,#0xc]
|
||||
ldr r9,[r0,#0x10]
|
||||
ldr r10,constant11
|
||||
str r9,[sp,#0x18]
|
||||
ldr r1,[r0,#0x2c]
|
||||
sub r9,r9,r1
|
||||
smull r11,r9,r10,r9
|
||||
ldr r10,constant12
|
||||
str r9,[sp,#8]
|
||||
ldr r9,[sp,#0x18]
|
||||
ldr r11,constant14
|
||||
add r9,r9,r1
|
||||
add r1,r12,r9
|
||||
sub r12,r12,r9
|
||||
mov r12,r12,lsl #2
|
||||
smull r9,r12,r10,r12
|
||||
ldr r10,constant13
|
||||
add r9,r3,r1
|
||||
sub r1,r3,r1
|
||||
smull r1,r3,r10,r1
|
||||
sub r1,r7,r8
|
||||
mov r1,r1,lsl #1
|
||||
smull r1,r10,r11,r1
|
||||
add r1,r7,r8
|
||||
add r8,r9,r1
|
||||
sub r7,r9,r1
|
||||
mov r8,r8,asr #1
|
||||
ldr r1,constant15
|
||||
str r8,[r0]
|
||||
smull r7,r8,r1,r7
|
||||
sub r7,r3,r10
|
||||
str r8,[r0,#0x20]
|
||||
mov r7,r7,lsl #1
|
||||
smull r8,r7,r1,r7
|
||||
add r3,r3,r10
|
||||
add r3,r3,r7
|
||||
str r3,[r0,#0x10]
|
||||
sub r3,r2,r12
|
||||
str r7,[r0,#0x30]
|
||||
add r2,r2,r12
|
||||
ldr r7,constant13
|
||||
sub r12,r4,lr
|
||||
mov r3,r3,lsl #1
|
||||
smull r8,r3,r7,r3
|
||||
add lr,r4,lr
|
||||
sub r4,r2,lr
|
||||
mov r12,r12,lsl #2
|
||||
smull r7,r12,r11,r12
|
||||
add lr,lr,r2
|
||||
sub r2,r3,r12
|
||||
mov r2,r2,lsl #1
|
||||
smull r7,r2,r1,r2
|
||||
mov r4,r4,lsl #1
|
||||
add r12,r12,r2
|
||||
add r3,r12,r3
|
||||
smull r7,r4,r1,r4
|
||||
add r12,r3,lr
|
||||
add r3,r3,r4
|
||||
str r3,[r0,#0x18]
|
||||
add r3,r2,r4
|
||||
str r2,[r0,#0x38]
|
||||
str r3,[r0,#0x28]
|
||||
str r12,[r0,#8]
|
||||
ldr r2,[sp,#0x14]
|
||||
ldr r3,[sp,#0]
|
||||
ldr lr,[sp,#4]
|
||||
sub r2,r2,r3
|
||||
ldr r3,constant3
|
||||
mov r2,r2,lsl #1
|
||||
smull r12,r2,r3,r2
|
||||
ldr r3,[sp,#0x14]
|
||||
ldr r12,[sp,#0]
|
||||
ldr r4,constant6
|
||||
add r12,r3,r12
|
||||
ldr r3,[sp,#4]
|
||||
sub lr,r5,lr
|
||||
mov lr,lr,lsl #1
|
||||
add r3,r5,r3
|
||||
smull r5,lr,r4,lr
|
||||
ldr r4,[sp,#0x10]
|
||||
ldr r5,[sp,#0x10]
|
||||
add r4,r4,r6
|
||||
sub r5,r5,r6
|
||||
ldr r6,constant9
|
||||
mov r5,r5,lsl #1
|
||||
smull r7,r5,r6,r5
|
||||
ldr r6,[sp,#8]
|
||||
ldr r9,[sp,#0xc]
|
||||
ldr r10,constant12
|
||||
sub r6,r9,r6
|
||||
mov r6,r6,lsl #3
|
||||
smull r7,r6,r10,r6
|
||||
ldr r8,[sp,#0x20]
|
||||
ldr r7,[sp,#8]
|
||||
cmp r8,#0
|
||||
add r7,r9,r7
|
||||
|
||||
bne no_flag_proc
|
||||
rsb r12,r12,#0
|
||||
rsb r2,r2,#0
|
||||
rsb r3,r3,#0
|
||||
rsb lr,lr,#0
|
||||
rsb r4,r4,#0
|
||||
rsb r5,r5,#0
|
||||
rsb r7,r7,#0
|
||||
rsb r6,r6,#0
|
||||
no_flag_proc:
|
||||
|
||||
sub r8,r2,r6
|
||||
add r2,r6,r2
|
||||
sub r6,r12,r7
|
||||
ldr r9,constant13
|
||||
add r12,r12,r7
|
||||
sub r7,r3,r4
|
||||
mov r6,r6,lsl #1
|
||||
mov r8,r8,lsl #1
|
||||
smull r10,r8,r9,r8
|
||||
add r3,r3,r4
|
||||
smull r10,r6,r9,r6
|
||||
sub r4,lr,r5
|
||||
mov r7,r7,lsl #2
|
||||
smull r9,r7,r11,r7
|
||||
add lr,lr,r5
|
||||
sub r5,r6,r7
|
||||
add r6,r6,r7
|
||||
sub r7,r12,r3
|
||||
add r3,r12,r3
|
||||
sub r12,r2,lr
|
||||
mov r4,r4,lsl #2
|
||||
smull r9,r4,r11,r4
|
||||
add lr,r2,lr
|
||||
sub r2,r8,r4
|
||||
mov r2,r2,lsl #1
|
||||
mov r5,r5,lsl #1
|
||||
mov r12,r12,lsl #1
|
||||
mov r7,r7,lsl #1
|
||||
smull r9,r5,r1,r5
|
||||
smull r9,r2,r1,r2
|
||||
add r6,r6,r5
|
||||
smull r9,r7,r1,r7
|
||||
smull r9,r12,r1,r12
|
||||
add r1,r4,r2
|
||||
add r1,r1,r8
|
||||
add lr,lr,r1
|
||||
add r3,r3,lr
|
||||
str r3,[r0,#4]
|
||||
add r3,r6,lr
|
||||
str r3,[r0,#0xc]
|
||||
add r1,r1,r12
|
||||
add r3,r6,r1
|
||||
add r1,r7,r1
|
||||
str r1,[r0,#0x1c]
|
||||
str r3,[r0,#0x14]
|
||||
add r1,r12,r2
|
||||
add r3,r7,r1
|
||||
add r1,r5,r1
|
||||
str r1,[r0,#0x2c]
|
||||
str r3,[r0,#0x24]!
|
||||
add r1,r5,r2
|
||||
str r1,[r0,#0x10]
|
||||
str r2,[r0,#0x18]
|
||||
add sp,sp,#0x24
|
||||
ldmfd sp!,{r4-r11,pc}
|
||||
|
||||
|
||||
|
||||
@------------------------------------------------------------------------------
|
||||
|
||||
.global pvmp3_merge_in_place_N32
|
||||
|
||||
|
||||
|
||||
pvmp3_merge_in_place_N32:
|
||||
stmfd sp!,{r4,lr}
|
||||
ldr r1,[r0,#0x1c]
|
||||
ldr r2,[r0,#0x38]
|
||||
str r1,[r0,#0x38]
|
||||
ldr r1,[r0,#0x18]
|
||||
ldr r3,[r0,#0x30]
|
||||
str r1,[r0,#0x30]
|
||||
ldr r12,[r0,#0x14]
|
||||
ldr r1,[r0,#0x28]
|
||||
str r12,[r0,#0x28]
|
||||
ldr r12,[r0,#0x10]
|
||||
ldr lr,[r0,#0x20]
|
||||
str r12,[r0,#0x20]
|
||||
ldr r12,[r0,#0xc]
|
||||
str r12,[r0,#0x18]
|
||||
ldr r12,[r0,#8]
|
||||
str r12,[r0,#0x10]
|
||||
ldr r12,[r0,#4]
|
||||
str r12,[r0,#8]
|
||||
ldr r4,[r0,#0x40]
|
||||
ldr r12,[r0,#0x44]
|
||||
add r4,r4,r12
|
||||
str r4,[r0,#4]
|
||||
str lr,[r0,#0x40]
|
||||
ldr lr,[r0,#0x48]
|
||||
add r12,lr,r12
|
||||
str r12,[r0,#0xc]
|
||||
ldr r12,[r0,#0x4c]
|
||||
add lr,r12,lr
|
||||
str lr,[r0,#0x14]
|
||||
ldr lr,[r0,#0x24]
|
||||
str lr,[r0,#0x48]
|
||||
ldr lr,[r0,#0x50]
|
||||
add r12,lr,r12
|
||||
str r12,[r0,#0x1c]
|
||||
ldr r12,[r0,#0x54]
|
||||
str r1,[r0,#0x50]
|
||||
add lr,r12,lr
|
||||
str lr,[r0,#0x24]
|
||||
ldr r1,[r0,#0x58]
|
||||
ldr r4,[r0,#0x2c]
|
||||
ldr lr,[r0,#0x34]
|
||||
add r12,r1,r12
|
||||
str r12,[r0,#0x2c]
|
||||
ldr r12,[r0,#0x5c]
|
||||
add r1,r12,r1
|
||||
str r1,[r0,#0x34]
|
||||
str r4,[r0,#0x58]
|
||||
ldr r1,[r0,#0x60]
|
||||
ldr r4,[r0,#0x3c]
|
||||
add r12,r1,r12
|
||||
str r12,[r0,#0x3c]
|
||||
ldr r12,[r0,#0x64]
|
||||
add r1,r12,r1
|
||||
str r1,[r0,#0x44]
|
||||
ldr r1,[r0,#0x68]
|
||||
add r12,r1,r12
|
||||
str r12,[r0,#0x4c]
|
||||
ldr r12,[r0,#0x6c]
|
||||
add r1,r12,r1
|
||||
str r1,[r0,#0x54]
|
||||
ldr r1,[r0,#0x70]
|
||||
str r3,[r0,#0x60]
|
||||
add r12,r1,r12
|
||||
str r12,[r0,#0x5c]
|
||||
ldr r3,[r0,#0x74]
|
||||
add r1,r3,r1
|
||||
str r1,[r0,#0x64]
|
||||
str lr,[r0,#0x68]
|
||||
ldr r1,[r0,#0x78]
|
||||
str r2,[r0,#0x70]
|
||||
add r3,r1,r3
|
||||
str r3,[r0,#0x6c]
|
||||
ldr r2,[r0,#0x7c]
|
||||
add r1,r1,r2
|
||||
str r1,[r0,#0x74]
|
||||
str r4,[r0,#0x78]
|
||||
ldmfd sp!,{r4,pc}
|
||||
|
||||
|
||||
@------------------------------------------------------------------------------
|
||||
|
||||
.global pvmp3_split
|
||||
|
||||
|
||||
pvmp3_split:
|
||||
stmfd sp!,{r4,r5,lr}
|
||||
adr r1,constant16
|
||||
ldr r2,[r1]
|
||||
add r2,r1
|
||||
sub r1,r0,#4
|
||||
mov r3,#3
|
||||
loop1:
|
||||
ldr r12,[r0]
|
||||
ldr lr,[r1]
|
||||
ldr r4,[r2],#-4
|
||||
add r5,lr,r12
|
||||
sub r12,lr,r12
|
||||
smull r12,lr,r4,r12
|
||||
str r5,[r1],#-4
|
||||
mov r12,r12,lsr #27
|
||||
add r12,r12,lr,lsl #5
|
||||
str r12,[r0],#4
|
||||
ldr r12,[r0]
|
||||
ldr lr,[r1]
|
||||
ldr r4,[r2],#-4
|
||||
add r5,lr,r12
|
||||
sub r12,lr,r12
|
||||
smull r12,lr,r4,r12
|
||||
str r5,[r1],#-4
|
||||
mov r12,r12,lsr #27
|
||||
add r12,r12,lr,lsl #5
|
||||
str r12,[r0],#4
|
||||
subs r3,r3,#1
|
||||
bne loop1
|
||||
mov r3,#5
|
||||
loop2:
|
||||
ldr r12,[r0]
|
||||
ldr lr,[r1]
|
||||
ldr r4,[r2],#-4
|
||||
add r5,lr,r12
|
||||
sub r12,lr,r12
|
||||
mov r12,r12,lsl #1
|
||||
smull lr,r12,r4,r12
|
||||
str r5,[r1],#-4
|
||||
str r12,[r0],#4
|
||||
ldr r12,[r0]
|
||||
ldr lr,[r1]
|
||||
ldr r4,[r2],#-4
|
||||
add r5,lr,r12
|
||||
sub r12,lr,r12
|
||||
mov r12,r12,lsl #1
|
||||
smull lr,r12,r4,r12
|
||||
str r5,[r1],#-4
|
||||
str r12,[r0],#4
|
||||
subs r3,r3,#1
|
||||
bne loop2
|
||||
ldmfd sp!,{r4,r5,pc}
|
||||
constant1:
|
||||
.word 0x404f4680
|
||||
constant2:
|
||||
.word 0x519e4e00
|
||||
constant3:
|
||||
.word 0x4140fb80
|
||||
constant4:
|
||||
.word 0x42e13c00
|
||||
constant5:
|
||||
.word 0x6e3c9300
|
||||
constant6:
|
||||
.word 0x4cf8de80
|
||||
constant7:
|
||||
.word 0x48919f80
|
||||
constant8:
|
||||
.word 0x43e22480
|
||||
constant9:
|
||||
.word 0x73326b80
|
||||
constant10:
|
||||
.word 0x52cb0e80
|
||||
constant11:
|
||||
.word 0x64e24000
|
||||
constant12:
|
||||
.word 0x52036780
|
||||
constant13:
|
||||
.word 0x4545ea00
|
||||
constant14:
|
||||
.word 0x539eba80
|
||||
constant15:
|
||||
.word 0x5a827980
|
||||
constant16:
|
||||
.word (CosTable_dct32 + 60)-constant16
|
||||
|
||||
|
||||
|
||||
CosTable_dct32:
|
||||
.word 0x4013c280
|
||||
.word 0x40b34580
|
||||
.word 0x41fa2d80
|
||||
.word 0x43f93400
|
||||
.word 0x46cc1c00
|
||||
.word 0x4a9d9d00
|
||||
.word 0x4fae3700
|
||||
.word 0x56601e80
|
||||
.word 0x5f4cf700
|
||||
.word 0x6b6fcf00
|
||||
.word 0x07c7d1d8
|
||||
.word 0x095b0350
|
||||
.word 0x0bdf91b0
|
||||
.word 0x107655e0
|
||||
.word 0x1b42c840
|
||||
.word 0x51852300
|
||||
|
||||
|
||||
193
cocos2d-x/external/sources/pvmp3dec/src/asm/pvmp3_dct_9_gcc.s
vendored
Normal file
193
cocos2d-x/external/sources/pvmp3dec/src/asm/pvmp3_dct_9_gcc.s
vendored
Normal file
@@ -0,0 +1,193 @@
|
||||
@ ------------------------------------------------------------------
|
||||
@ Copyright (C) 1998-2009 PacketVideo
|
||||
@
|
||||
@ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ you may not use this file except in compliance with the License.
|
||||
@ You may obtain a copy of the License at
|
||||
@
|
||||
@ http://www.apache.org/licenses/LICENSE-2.0
|
||||
@
|
||||
@ Unless required by applicable law or agreed to in writing, software
|
||||
@ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
@ express or implied.
|
||||
@ See the License for the specific language governing permissions
|
||||
@ and limitations under the License.
|
||||
@ -------------------------------------------------------------------
|
||||
|
||||
@
|
||||
@
|
||||
@ Filename: pvmp3_dct_9_gcc.s
|
||||
@
|
||||
@------------------------------------------------------------------------------
|
||||
@ REVISION HISTORY
|
||||
@
|
||||
@
|
||||
@ Who: Date: MM/DD/YYYY
|
||||
@ Description:
|
||||
@
|
||||
@------------------------------------------------------------------------------
|
||||
|
||||
.arm
|
||||
|
||||
.align 4
|
||||
|
||||
.text
|
||||
|
||||
|
||||
@------------------------------------------------------------------------------
|
||||
|
||||
.global pvmp3_dct_9
|
||||
|
||||
pvmp3_dct_9:
|
||||
stmfd sp!,{r4-r11,lr}
|
||||
ldr r2, [r0, #0x20]
|
||||
ldr r3, [r0, #0]
|
||||
ldr r12,[r0, #4]
|
||||
add r1,r2,r3
|
||||
sub lr,r2,r3
|
||||
ldr r3,[r0, #0x1c]
|
||||
ldr r4,[r0, #0x18]
|
||||
add r2,r3,r12
|
||||
ldr r5,[r0,#8]
|
||||
sub r3,r3,r12
|
||||
add r12,r4,r5
|
||||
sub r4,r4,r5
|
||||
ldr r5,[r0, #0x14]
|
||||
ldr r7,[r0, #0xc]
|
||||
ldr r9,[r0, #0x10]
|
||||
add r6,r5,r7
|
||||
sub r5,r5,r7
|
||||
add r7,r1,r12
|
||||
add r8,r9,r2
|
||||
add r7,r7,r6
|
||||
add r10,r7,r8
|
||||
rsb r7,r8,r7,asr #1
|
||||
str r7,[r0, #0x18]
|
||||
rsb r2,r9,r2,asr #1
|
||||
str r10,[r0,#0]
|
||||
ldr r11,cos_2pi_9
|
||||
rsb r7,r2,#0
|
||||
|
||||
ldr r10,cos_4pi_9
|
||||
mov r9,r1,lsl #1
|
||||
mov r8,r7
|
||||
|
||||
@ vec[4] = fxp_mac32_Q32( vec[4], tmp0<<1, cos_2pi_9)@
|
||||
|
||||
smlal r1,r8,r11,r9
|
||||
ldr r11,cos_pi_9
|
||||
mov r1,r9 @@@@@@ !!!!!!
|
||||
|
||||
@ vec[8] = fxp_mac32_Q32( vec[8], tmp0<<1, cos_4pi_9)@
|
||||
|
||||
smlal r1,r7,r10,r9
|
||||
|
||||
mov r1,r12,lsl #1
|
||||
|
||||
|
||||
@ vec[2] = fxp_mac32_Q32( vec[2], tmp0<<1, cos_pi_9)@
|
||||
|
||||
smlal r9,r2,r11,r9
|
||||
rsb r9,r10,#0
|
||||
ldr r11,cos_5pi_9
|
||||
|
||||
smlal r12,r2,r9,r1
|
||||
|
||||
|
||||
|
||||
@ vec[2] = fxp_mac32_Q32( vec[2], tmp2<<1, cos_5pi_9)@
|
||||
|
||||
ldr r9,cos_2pi_9
|
||||
mov r12,r1 @@@@@@ !!!!!!
|
||||
smlal r12,r8,r11,r1
|
||||
|
||||
|
||||
@ vec[8] = fxp_mac32_Q32( vec[8], tmp2<<1, cos_2pi_9)@
|
||||
|
||||
smlal r1,r7,r9,r1
|
||||
mov r1,r6,lsl #1
|
||||
smlal r12,r7,r11,r1
|
||||
and r6,r10,r11,asr #14
|
||||
smlal r12,r8,r6,r1
|
||||
ldr r10,cos_11pi_18
|
||||
add r12,r11,r6
|
||||
smlal r1,r2,r12,r1
|
||||
ldr r9,cos_8pi_9
|
||||
str r2,[r0,#8]
|
||||
mov r1,r5,lsl #1
|
||||
|
||||
@ vec[8] = fxp_mac32_Q32( vec[8], tmp3<<1, cos_8pi_9)@
|
||||
|
||||
smull r2,r6,r9,r1
|
||||
str r7,[r0,#0x20]
|
||||
mov r2,r4,lsl #1
|
||||
ldr r7,cos_13pi_18
|
||||
smlal r12,r6,r10,r2
|
||||
|
||||
mov r3,r3,lsl #1
|
||||
|
||||
@ vec[5] = fxp_mac32_Q32( vec[5], tmp8<<1, cos_13pi_18)@
|
||||
|
||||
smlal r12,r6,r7,r3
|
||||
add r4,r5,r4
|
||||
mov r12,lr,lsl #1
|
||||
sub lr,r4,lr
|
||||
ldr r7,cos_17pi_18
|
||||
str r8,[r0, #0x10]
|
||||
ldr r4,cos_pi_6
|
||||
|
||||
mov lr,lr,lsl #1
|
||||
|
||||
@ vec[1] = fxp_mac32_Q32( vec[1], tmp8<<1, cos_17pi_18)@
|
||||
|
||||
smlal r8,r6,r7,r12
|
||||
|
||||
@ vec[3] = fxp_mul32_Q32((tmp5 + tmp6 - tmp8)<<1, cos_pi_6)@
|
||||
|
||||
smull r5,lr,r4,lr
|
||||
str r6,[r0, #4]
|
||||
str lr,[r0, #0xc]
|
||||
|
||||
|
||||
@ vec[5] = fxp_mul32_Q32(tmp5<<1, cos_17pi_18)@
|
||||
smull r5,lr,r7,r1
|
||||
rsb r6,r9,#0
|
||||
@ vec[5] = fxp_mac32_Q32( vec[5], tmp6<<1, cos_7pi_18)@
|
||||
smlal r5,lr,r6,r2
|
||||
@ vec[5] = fxp_mac32_Q32( vec[5], tmp7<<1, cos_pi_6)@
|
||||
smlal r5,lr,r4,r3
|
||||
@ vec[5] = fxp_mac32_Q32( vec[5], tmp8<<1, cos_13pi_18)@
|
||||
smlal r5,lr,r10,r12
|
||||
str lr,[r0, #0x14]
|
||||
rsb lr,r10,#0
|
||||
|
||||
@ vec[7] = fxp_mul32_Q32(tmp5<<1, cos_5pi_18)@
|
||||
smull r5,r1,lr,r1
|
||||
@ vec[7] = fxp_mac32_Q32( vec[7], tmp6<<1, cos_17pi_18)@
|
||||
smlal r2,r1,r7,r2
|
||||
@ vec[7] = fxp_mac32_Q32( vec[7], tmp7<<1, cos_pi_6)@
|
||||
smlal r3,r1,r4,r3
|
||||
@ vec[7] = fxp_mac32_Q32( vec[7], tmp8<<1, cos_11pi_18)@
|
||||
smlal r12,r1,r9,r12
|
||||
str r1,[r0, #0x1c]
|
||||
ldmfd sp!,{r4-r11,pc}
|
||||
cos_2pi_9:
|
||||
.word 0x620dbe80
|
||||
cos_4pi_9:
|
||||
.word 0x163a1a80
|
||||
cos_pi_9:
|
||||
.word 0x7847d900
|
||||
cos_5pi_9:
|
||||
.word 0x87b82700
|
||||
cos_8pi_9:
|
||||
.word 0xd438af00
|
||||
cos_11pi_18:
|
||||
.word 0xadb92280
|
||||
cos_13pi_18:
|
||||
.word 0x91261480
|
||||
cos_17pi_18:
|
||||
.word 0x81f1d200
|
||||
cos_pi_6:
|
||||
.word 0x6ed9eb80
|
||||
|
||||
357
cocos2d-x/external/sources/pvmp3dec/src/asm/pvmp3_mdct_18_gcc.s
vendored
Normal file
357
cocos2d-x/external/sources/pvmp3dec/src/asm/pvmp3_mdct_18_gcc.s
vendored
Normal file
@@ -0,0 +1,357 @@
|
||||
@ ------------------------------------------------------------------
|
||||
@ Copyright (C) 1998-2009 PacketVideo
|
||||
@
|
||||
@ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ you may not use this file except in compliance with the License.
|
||||
@ You may obtain a copy of the License at
|
||||
@
|
||||
@ http://www.apache.org/licenses/LICENSE-2.0
|
||||
@
|
||||
@ Unless required by applicable law or agreed to in writing, software
|
||||
@ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
@ express or implied.
|
||||
@ See the License for the specific language governing permissions
|
||||
@ and limitations under the License.
|
||||
@ -------------------------------------------------------------------
|
||||
|
||||
@
|
||||
@
|
||||
@ Filename: pvmp3_dct_18_gcc.s
|
||||
@
|
||||
@------------------------------------------------------------------------------
|
||||
@ REVISION HISTORY
|
||||
@
|
||||
@
|
||||
@ Who: Date: MM/DD/YYYY
|
||||
@ Description:
|
||||
@
|
||||
@------------------------------------------------------------------------------
|
||||
|
||||
.arm
|
||||
|
||||
.align 4
|
||||
|
||||
.text
|
||||
|
||||
.extern pvmp3_dct_9
|
||||
|
||||
@------------------------------------------------------------------------------
|
||||
|
||||
.global pvmp3_mdct_18
|
||||
|
||||
pvmp3_mdct_18:
|
||||
stmfd sp!,{r4-r11,lr}
|
||||
mov r7,r2
|
||||
adr r2,constdata$1
|
||||
mov r6,r1
|
||||
add r3,r2,#0x24
|
||||
add r12,r3,#0x44
|
||||
add r1,r0,#0x44
|
||||
mov r5,r0
|
||||
|
||||
@ for ( i=9@ i!=0@ i--)
|
||||
@ {
|
||||
|
||||
mov r4,#9
|
||||
Loop_1:
|
||||
|
||||
@ tmp = *(pt_vec)
|
||||
@ tmp1 = *(pt_vec_o)
|
||||
|
||||
ldr lr,[r0] @@ tmp == lr
|
||||
ldr r8,[r3],#4 @@ tmp1 == r8
|
||||
|
||||
@ tmp = fxp_mul32_Q32( tmp<<1, *(pt_cos++ ))
|
||||
@ tmp1 = fxp_mul32_Q27( tmp1, *(pt_cos_x--))
|
||||
|
||||
mov lr,lr,lsl #1
|
||||
smull r10,lr,r8,lr
|
||||
ldr r8,[r12],#-4
|
||||
ldr r9,[r1]
|
||||
subs r4,r4,#1
|
||||
smull r9,r10,r8,r9
|
||||
mov r8,r9,lsr #27
|
||||
add r8,r8,r10,lsl #5
|
||||
|
||||
@ *(pt_vec++) = tmp + tmp1
|
||||
@ *(pt_vec_o--) = fxp_mul32_Q28( (tmp - tmp1), *(pt_cos_split++))
|
||||
|
||||
add r9,lr,r8
|
||||
sub r8,lr,r8
|
||||
ldr lr,[r2],#4
|
||||
str r9,[r0],#4
|
||||
smull r8,r9,lr,r8
|
||||
mov lr,r8,lsr #28
|
||||
add lr,lr,r9,lsl #4
|
||||
str lr,[r1],#-4
|
||||
bne Loop_1
|
||||
|
||||
@ }
|
||||
|
||||
mov r0,r5 @@ r0 = vec
|
||||
bl pvmp3_dct_9
|
||||
add r0,r5,#0x24 @@ r0 = &vec[9]
|
||||
bl pvmp3_dct_9
|
||||
|
||||
ldr r0,[r5,#0x20]
|
||||
ldr r2,[r5,#0x40]
|
||||
str r0,[r5,#0x40]
|
||||
ldr r0,[r5,#0x1c]
|
||||
ldr r3,[r5,#0x38]
|
||||
str r0,[r5,#0x38]
|
||||
ldr r1,[r5,#0x18]
|
||||
ldr r0,[r5,#0x30]
|
||||
str r1,[r5,#0x30]
|
||||
ldr r12,[r5,#0x14]
|
||||
ldr r1,[r5,#0x28]
|
||||
str r12,[r5,#0x28]
|
||||
ldr r12,[r5,#0x10]
|
||||
str r12,[r5,#0x20]
|
||||
ldr r12,[r5,#0xc]
|
||||
str r12,[r5,#0x18]
|
||||
ldr r12,[r5,#8]
|
||||
str r12,[r5,#0x10]
|
||||
ldr r12,[r5,#4]
|
||||
str r12,[r5,#8]
|
||||
ldr r12,[r5,#0x24]
|
||||
sub r12,r12,r1
|
||||
str r12,[r5,#4]
|
||||
ldr r12,[r5,#0x2c]
|
||||
sub r1,r12,r1
|
||||
str r1,[r5,#0xc]
|
||||
sub r1,r12,r0
|
||||
str r1,[r5,#0x14]
|
||||
ldr r1,[r5,#0x34]
|
||||
sub r0,r1,r0
|
||||
str r0,[r5,#0x1c]
|
||||
sub r0,r1,r3
|
||||
str r0,[r5,#0x24]
|
||||
ldr r1,[r5,#0x3c]
|
||||
sub r3,r1,r3
|
||||
sub r1,r1,r2
|
||||
str r1,[r5,#0x34]
|
||||
str r3,[r5,#0x2c]
|
||||
ldr r1,[r5,#0x44]
|
||||
sub r1,r1,r2
|
||||
str r1,[r5,#0x3c]
|
||||
ldr r12,[r5,#0]
|
||||
|
||||
Loop_2:
|
||||
add r1,r5,r4,lsl #2
|
||||
ldr r2,[r1,#0x28]
|
||||
ldr r3,[r6,r4,lsl #2]
|
||||
add r0,r0,r2
|
||||
str r0,[r1,#0x28]
|
||||
ldr lr,[r7,r4,lsl #2]
|
||||
ldr r1,[r1,#4]
|
||||
smlal r0,r3,lr,r0
|
||||
mov r0,r2
|
||||
add r2,r12,r1
|
||||
rsb r2,r2,#0
|
||||
str r3,[r5,r4,lsl #2]
|
||||
str r2,[r6,r4,lsl #2]
|
||||
add r4,r4,#1
|
||||
cmp r4,#6
|
||||
mov r12,r1
|
||||
|
||||
blt Loop_2
|
||||
|
||||
ldr r1,[r5,#0x40]
|
||||
ldr r2,[r6,#0x18]
|
||||
add r3,r0,r1
|
||||
str r3,[r5,#0x40]
|
||||
ldr lr,[r7,r4,lsl #2]
|
||||
mov r3,r3,lsl #1
|
||||
ldr r0,[r5,#0x1c]
|
||||
smlal r3,r2,lr,r3
|
||||
add r3,r12,r0
|
||||
str r2,[r5,#0x18]
|
||||
ldr r2,[r6,#0x1c]
|
||||
rsb r3,r3,#0
|
||||
str r3,[r6,#0x18]
|
||||
ldr r3,[r5,#0x20]
|
||||
add r0,r3,r0
|
||||
rsb r0,r0,#0
|
||||
str r0,[r6,#0x1c]
|
||||
ldr r3,[r5,#0x44]
|
||||
ldr r0,[r6,#0x20]
|
||||
add r3,r3,r1
|
||||
mov r1,r2
|
||||
ldr r10,[r7,#0x1c]
|
||||
mov r2,r3,lsl #1
|
||||
smlal r12,r1,r10,r2
|
||||
str r1,[r5,#0x1c]
|
||||
ldr r1,[r5,#0x20]
|
||||
ldr r3,[r5,#0x24]
|
||||
add r1,r1,r3
|
||||
rsb r1,r1,#0
|
||||
str r1,[r6,#0x20]
|
||||
ldr r1,[r5,#0x44]
|
||||
ldr r3,[r7,#0x20]
|
||||
mov r1,r1,lsl #1
|
||||
smlal r12,r0,r3,r1
|
||||
ldr lr,[r7,#0x24]
|
||||
ldr r3,[r6,#0x24]
|
||||
str r0,[r5,#0x20]
|
||||
smlal r1,r3,lr,r1
|
||||
ldr r0,[r6,#0x40]
|
||||
ldr r12,[r6,#0x44]
|
||||
str r3,[r5,#0x24]
|
||||
ldr r1,[r5,#0x28]
|
||||
ldr r3,[r7,#0x44]
|
||||
mov r1,r1,lsl #1
|
||||
smlal r1,r12,r3,r1
|
||||
ldr r1,[r5,#0x40]
|
||||
str r12,[r5,#0x44]
|
||||
rsb r8,r1,#0
|
||||
str r8,[r5,#0x28]
|
||||
ldr r1,[r5,#0x2c]
|
||||
ldr r3,[r7,#0x40]
|
||||
mov r1,r1,lsl #1
|
||||
smlal r1,r0,r3,r1
|
||||
str r0,[r5,#0x40]
|
||||
ldr r0,[r5,#0x3c]
|
||||
ldr r1,[r6,#0x38]
|
||||
ldr r3,[r6,#0x3c]
|
||||
rsb r9,r0,#0
|
||||
str r9,[r5,#0x2c]
|
||||
ldr r0,[r5,#0x30]
|
||||
ldr r12,[r7,#0x3c]
|
||||
mov r0,r0,lsl #1
|
||||
smlal r0,r3,r12,r0
|
||||
str r3,[r5,#0x3c]
|
||||
ldr r0,[r5,#0x38]
|
||||
rsb r0,r0,#0
|
||||
str r0,[r5,#0x30]
|
||||
ldr r3,[r5,#0x34]
|
||||
ldr r12,[r7,#0x38]
|
||||
mov r3,r3,lsl #1
|
||||
smlal r3,r1,r12,r3
|
||||
mov r0,r0,lsl #1
|
||||
str r1,[r5,#0x38]
|
||||
ldr r4,[r7,#0x34]
|
||||
ldr r1,[r6,#0x34]
|
||||
ldr r3,[r6,#0x30]
|
||||
smlal r0,r1,r4,r0
|
||||
ldr r12,[r6,#0x2c]
|
||||
ldr lr,[r6,#0x28]
|
||||
str r1,[r5,#0x34]
|
||||
ldr r1,[r7,#0x30]
|
||||
mov r0,r9,lsl #1
|
||||
smlal r0,r3,r1,r0
|
||||
mov r0,r8,lsl #1
|
||||
ldr r1,[r7,#0x2c]
|
||||
str r3,[r5,#0x30]
|
||||
smlal r0,r12,r1,r0
|
||||
ldr r0,[r7,#0x28]
|
||||
str r12,[r5,#0x2c]
|
||||
smlal r2,lr,r0,r2
|
||||
str lr,[r5,#0x28]
|
||||
ldr r1,[r6,#4]
|
||||
ldr r12,[r7,#0x48]
|
||||
mov r2,r1,lsl #1
|
||||
ldr r1,[r6,#0x20]
|
||||
ldr r0,[r6,#0]
|
||||
mov r1,r1,lsl #1
|
||||
smull r4,lr,r12,r1
|
||||
ldr r3,[r6,#0x1c]
|
||||
str lr,[r6,#0]
|
||||
ldr r12,[r7,#0x4c]
|
||||
mov r3,r3,lsl #1
|
||||
smull r4,lr,r12,r3
|
||||
mov r0,r0,lsl #1
|
||||
ldr r12,[r7,#0x64]
|
||||
str lr,[r6,#4]
|
||||
smull r4,lr,r12,r2
|
||||
ldr r12,[r7,#0x68]
|
||||
str lr,[r6,#0x1c]
|
||||
smull r4,lr,r12,r0
|
||||
ldr r12,[r7,#0x6c]
|
||||
str lr,[r6,#0x20]
|
||||
smull lr,r0,r12,r0
|
||||
ldr r12,[r7,#0x70]
|
||||
str r0,[r6,#0x24]
|
||||
smull r0,r2,r12,r2
|
||||
ldr r0,[r7,#0x88]
|
||||
str r2,[r6,#0x28]
|
||||
smull r3,r2,r0,r3
|
||||
ldr r0,[r7,#0x8c]
|
||||
str r2,[r6,#0x40]
|
||||
smull r2,r1,r0,r1
|
||||
str r1,[r6,#0x44]
|
||||
ldr r0,[r6,#0x18]
|
||||
ldr lr,[r7,#0x50]
|
||||
mov r1,r0,lsl #1
|
||||
ldr r0,[r6,#0x14]
|
||||
smull r5,r4,lr,r1
|
||||
mov r3,r0,lsl #1
|
||||
ldr r0,[r6,#0x10]
|
||||
mov r12,r0,lsl #1
|
||||
ldr r0,[r6,#0xc]
|
||||
mov r2,r0,lsl #1
|
||||
ldr r0,[r6,#8]
|
||||
str r4,[r6,#8]
|
||||
ldr lr,[r7,#0x54]
|
||||
mov r0,r0,lsl #1
|
||||
smull r5,r4,lr,r3
|
||||
ldr lr,[r7,#0x58]
|
||||
str r4,[r6,#0xc]
|
||||
smull r5,r4,lr,r12
|
||||
ldr lr,[r7,#0x5c]
|
||||
str r4,[r6,#0x10]
|
||||
smull r5,r4,lr,r2
|
||||
ldr lr,[r7,#0x60]
|
||||
str r4,[r6,#0x14]
|
||||
smull r5,r4,lr,r0
|
||||
ldr lr,[r7,#0x74]
|
||||
str r4,[r6,#0x18]
|
||||
smull r4,r0,lr,r0
|
||||
ldr lr,[r7,#0x78]
|
||||
str r0,[r6,#0x2c]
|
||||
smull r0,r2,lr,r2
|
||||
ldr r0,[r7,#0x7c]
|
||||
str r2,[r6,#0x30]
|
||||
smull r12,r2,r0,r12
|
||||
ldr r0,[r7,#0x80]
|
||||
str r2,[r6,#0x34]
|
||||
smull r3,r2,r0,r3
|
||||
ldr r0,[r7,#0x84]
|
||||
str r2,[r6,#0x38]
|
||||
smull r2,r1,r0,r1
|
||||
str r1,[r6,#0x3c]
|
||||
ldmfd sp!,{r4-r11,pc}
|
||||
|
||||
@------------------------------------------------------------------------------
|
||||
|
||||
constdata$1:
|
||||
cosTerms_dct18:
|
||||
.word 0x0807d2b0
|
||||
.word 0x08483ee0
|
||||
.word 0x08d3b7d0
|
||||
.word 0x09c42570
|
||||
.word 0x0b504f30
|
||||
.word 0x0df29440
|
||||
.word 0x12edfb20
|
||||
.word 0x1ee8dd40
|
||||
.word 0x5bca2a00
|
||||
cosTerms_1_ov_cos_phi:
|
||||
.word 0x400f9c00
|
||||
.word 0x408d6080
|
||||
.word 0x418dcb80
|
||||
.word 0x431b1a00
|
||||
.word 0x4545ea00
|
||||
.word 0x48270680
|
||||
.word 0x4be25480
|
||||
.word 0x50ab9480
|
||||
.word 0x56ce4d80
|
||||
.word 0x05ebb630
|
||||
.word 0x06921a98
|
||||
.word 0x0771d3a8
|
||||
.word 0x08a9a830
|
||||
.word 0x0a73d750
|
||||
.word 0x0d4d5260
|
||||
.word 0x127b1ca0
|
||||
.word 0x1ea52b40
|
||||
.word 0x5bb3cc80
|
||||
|
||||
233
cocos2d-x/external/sources/pvmp3dec/src/asm/pvmp3_polyphase_filter_window_gcc.s
vendored
Normal file
233
cocos2d-x/external/sources/pvmp3dec/src/asm/pvmp3_polyphase_filter_window_gcc.s
vendored
Normal file
@@ -0,0 +1,233 @@
|
||||
@ ------------------------------------------------------------------
|
||||
@ Copyright (C) 1998-2009 PacketVideo
|
||||
@
|
||||
@ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ you may not use this file except in compliance with the License.
|
||||
@ You may obtain a copy of the License at
|
||||
@
|
||||
@ http://www.apache.org/licenses/LICENSE-2.0
|
||||
@
|
||||
@ Unless required by applicable law or agreed to in writing, software
|
||||
@ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
@ express or implied.
|
||||
@ See the License for the specific language governing permissions
|
||||
@ and limitations under the License.
|
||||
@ -------------------------------------------------------------------
|
||||
|
||||
@
|
||||
@
|
||||
@ Filename: pvmp3_polyphase_filter_window.s
|
||||
@
|
||||
@------------------------------------------------------------------------------
|
||||
@ REVISION HISTORY
|
||||
@
|
||||
@
|
||||
@ Who: Date: MM/DD/YYYY
|
||||
@ Description:
|
||||
@
|
||||
@------------------------------------------------------------------------------
|
||||
|
||||
.arm
|
||||
|
||||
.align 4
|
||||
|
||||
.text
|
||||
|
||||
.extern pqmfSynthWin
|
||||
.hidden pqmfSynthWin
|
||||
|
||||
|
||||
|
||||
@------------------------------------------------------------------------------
|
||||
|
||||
.global pvmp3_polyphase_filter_window
|
||||
|
||||
pvmp3_polyphase_filter_window:
|
||||
stmfd sp!,{r0-r2,r4-r11,lr}
|
||||
|
||||
sub sp,sp,#4
|
||||
adr r2,PolyPh_filter_coeff
|
||||
ldr r1,[r2]
|
||||
add r1,r2
|
||||
ldr r2,[sp,#0xc]
|
||||
|
||||
sub r2,r2,#1
|
||||
mov r10,#1
|
||||
str r2,[sp]
|
||||
|
||||
@ Accumulators r9, r11::> Initialization
|
||||
|
||||
Loop_j:
|
||||
mov r9, #0x20
|
||||
mov r11, #0x20
|
||||
mov r4, #0x10
|
||||
Loop_i:
|
||||
add r2,r4,r10
|
||||
add r3,r0,r2,lsl #2
|
||||
sub r2,r4,r10
|
||||
ldr r5,[r3]
|
||||
ldr lr,[r1]
|
||||
add r12,r0,r2,lsl #2
|
||||
ldr r6,[r12,#0x780]
|
||||
smlal r2,r9,lr,r5
|
||||
smlal r2,r11,lr,r6
|
||||
ldr r2,[r1,#4]
|
||||
ldr r7,[r12,#0x80]
|
||||
smlal r5,r11,r2,r5
|
||||
smull r6,r5,r2,r6
|
||||
sub r9,r9,r5
|
||||
ldr r5,[r1,#8]
|
||||
ldr r8,[r3,#0x700]
|
||||
add r4,r4,#0x200
|
||||
smlal r6,r9,r5,r7
|
||||
smull r6,r2,r5,r8
|
||||
ldr r5,[r1,#0xc]
|
||||
sub r11,r11,r2
|
||||
smlal r8,r9,r5,r8
|
||||
smlal r7,r11,r5,r7
|
||||
ldr r5,[r3,#0x100]
|
||||
ldr r2,[r1,#0x10]
|
||||
ldr r6,[r12,#0x680]
|
||||
smlal lr,r9,r2,r5
|
||||
smlal lr,r11,r2,r6
|
||||
ldr r2,[r1,#0x14]
|
||||
ldr r7,[r12,#0x180]
|
||||
smlal r5,r11,r2,r5
|
||||
smull r6,r5,r2,r6
|
||||
ldr r6,[r1,#0x18]
|
||||
ldr r8,[r3,#0x600]
|
||||
sub r9,r9,r5
|
||||
smlal r5,r9,r6,r7
|
||||
smull r2,r5,r6,r8
|
||||
ldr r6,[r1,#0x1c]
|
||||
sub r11,r11,r5
|
||||
smlal r8,r9,r6,r8
|
||||
ldr r2,[r1,#0x20]
|
||||
ldr r5,[r3,#0x200]
|
||||
smlal r7,r11,r6,r7
|
||||
ldr r6,[r12,#0x580]
|
||||
smlal lr,r9,r2,r5
|
||||
smlal lr,r11,r2,r6
|
||||
ldr r2,[r1,#0x24]
|
||||
ldr r7,[r12,#0x280]
|
||||
smlal r5,r11,r2,r5
|
||||
smull r6,r5,r2,r6
|
||||
ldr r6,[r1,#0x28]
|
||||
ldr r8,[r3,#0x500]
|
||||
sub r9,r9,r5
|
||||
smlal r5,r9,r6,r7
|
||||
smull r2,r5,r6,r8
|
||||
ldr r6,[r1,#0x2c]
|
||||
sub r11,r11,r5
|
||||
|
||||
smlal r8,r9,r6,r8
|
||||
smlal r7,r11,r6,r7
|
||||
ldr r5,[r3,#0x300]
|
||||
ldr r8,[r1,#0x30]
|
||||
ldr r6,[r12,#0x480]
|
||||
smlal r7,r9,r8,r5
|
||||
smlal r7,r11,r8,r6
|
||||
ldr r8,[r1,#0x34]
|
||||
ldr r12,[r12,#0x380]
|
||||
smlal r5,r11,r8,r5
|
||||
smull r6,r5,r8,r6
|
||||
ldr r6,[r1,#0x38]
|
||||
|
||||
|
||||
ldr r3,[r3,#0x400]
|
||||
sub r9,r9,r5
|
||||
smlal r7,r9,r6,r12
|
||||
smull r8,r7,r6,r3
|
||||
cmp r4,#0x210
|
||||
sub r11,r11,r7
|
||||
|
||||
ldr r2,[r1,#0x3c]
|
||||
add r1,r1,#0x40
|
||||
smlal r3,r9,r2,r3
|
||||
smlal r12,r11,r2,r12
|
||||
|
||||
blt Loop_i
|
||||
|
||||
mov r3,r9, asr #6
|
||||
mov r4,r3, asr #15
|
||||
teq r4,r3, asr #31
|
||||
ldr r12,LOW_16BITS
|
||||
ldr r2,[sp]
|
||||
eorne r3,r12,r3,asr #31
|
||||
ldr r4,[sp,#8]
|
||||
mov r2,r10,lsl r2
|
||||
add r4,r4,r2,lsl #1
|
||||
strh r3,[r4]
|
||||
|
||||
mov r3,r11,asr #6
|
||||
mov r4,r3,asr #15
|
||||
teq r4,r3,asr #31
|
||||
eorne r3,r12,r3,asr #31
|
||||
ldr r12,[sp,#0xc]
|
||||
ldr r11,[sp,#8]
|
||||
rsb r2,r2,r12,lsl #5
|
||||
add r2,r11,r2,lsl #1
|
||||
strh r3,[r2]
|
||||
|
||||
add r10,r10,#1
|
||||
cmp r10,#0x10
|
||||
blt Loop_j
|
||||
|
||||
@ Accumulators r4, r5 Initialization
|
||||
|
||||
mov r4,#0x20
|
||||
mov r5,#0x20
|
||||
mov r3,#0x10
|
||||
PolyPh_filter_loop2:
|
||||
add r2,r0,r3,lsl #2
|
||||
ldr r12,[r2]
|
||||
ldr r8,[r1]
|
||||
ldr r6,[r2,#0x80]
|
||||
smlal r12,r4,r8,r12
|
||||
ldr r12,[r1,#4]
|
||||
ldr r7,[r2,#0x40]
|
||||
smlal r6,r4,r12,r6
|
||||
|
||||
ldr r12,[r1,#8]
|
||||
ldr r6,[r2,#0x180]
|
||||
smlal r7,r5,r12,r7
|
||||
ldr r12,[r2,#0x100]
|
||||
ldr r7,[r1,#0xc]
|
||||
ldr r2,[r2,#0x140]
|
||||
smlal r12,r4,r7,r12
|
||||
ldr r12,[r1,#0x10]
|
||||
add r3,r3,#0x80
|
||||
smlal r6,r4,r12,r6
|
||||
ldr r6,[r1,#0x14]
|
||||
cmp r3,#0x210
|
||||
smlal r2,r5,r6,r2
|
||||
add r1,r1,#0x18
|
||||
|
||||
blt PolyPh_filter_loop2
|
||||
mov r0,r4,asr #6
|
||||
mov r2,r0,asr #15
|
||||
teq r2,r0,asr #31
|
||||
ldrne r12,LOW_16BITS
|
||||
ldr r1,[sp,#8]
|
||||
eorne r0,r12,r0,asr #31
|
||||
strh r0,[r1,#0]
|
||||
mov r0,r5,asr #6
|
||||
mov r2,r0,asr #15
|
||||
teq r2,r0,asr #31
|
||||
ldrne r12,LOW_16BITS
|
||||
ldr r2,[sp]
|
||||
mov r1,#0x10
|
||||
eorne r0,r12,r0,asr #31
|
||||
ldr r12,[sp,#8]
|
||||
mov r1,r1,lsl r2
|
||||
add r1,r12,r1,lsl #1
|
||||
strh r0,[r1]
|
||||
add sp,sp,#0x10
|
||||
ldmfd sp!,{r4-r11,pc}
|
||||
|
||||
PolyPh_filter_coeff:
|
||||
.word pqmfSynthWin-PolyPh_filter_coeff
|
||||
LOW_16BITS:
|
||||
.word 0x00007fff
|
||||
|
||||
81
cocos2d-x/external/sources/pvmp3dec/src/mp3_mem_funcs.h
vendored
Normal file
81
cocos2d-x/external/sources/pvmp3dec/src/mp3_mem_funcs.h
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: mp3_mem_funcs.h
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
|
||||
Description:
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef MP3_MEM_FUNCS_H
|
||||
#define MP3_MEM_FUNCS_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "pvmp3_audio_type_defs.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES AND SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#define pv_memset(to, c, n) memset(to, c, n)
|
||||
|
||||
|
||||
#define pv_memcpy(to, from, n) memcpy(to, from, n)
|
||||
#define pv_memmove(to, from, n) memmove(to, from, n)
|
||||
#define pv_memcmp(p, q, n) memcmp(p, q, n)
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#endif
|
||||
115
cocos2d-x/external/sources/pvmp3dec/src/pv_mp3_huffman.h
vendored
Normal file
115
cocos2d-x/external/sources/pvmp3dec/src/pv_mp3_huffman.h
vendored
Normal file
@@ -0,0 +1,115 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: pv_mp3_huffman.h
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
Description:
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
|
||||
[1] ISO MPEG Audio Subgroup Software Simulation Group (1996)
|
||||
ISO 13818-3 MPEG-2 Audio Decoder - Lower Sampling Frequency Extension
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef PV_MP3_HUFFMAN_H
|
||||
#define PV_MP3_HUFFMAN_H
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "pvmp3_audio_type_defs.h"
|
||||
#include "s_mp3bits.h"
|
||||
#include "s_tmp3dec_file.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES AND SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
int32 pvmp3_huffman_parsing(int32 is[SUBBANDS_NUMBER*FILTERBANK_BANDS],
|
||||
granuleInfo *grInfo,
|
||||
tmp3dec_file *pVars,
|
||||
int32 part2_start,
|
||||
mp3Header *info);
|
||||
|
||||
|
||||
void pvmp3_huffman_quad_decoding(struct huffcodetab *h,
|
||||
int32 *is,
|
||||
tmp3Bits *pMainData);
|
||||
|
||||
void pvmp3_huffman_pair_decoding(struct huffcodetab *h,
|
||||
int32 *is,
|
||||
tmp3Bits *pMainData);
|
||||
|
||||
|
||||
void pvmp3_huffman_pair_decoding_linbits(struct huffcodetab *h,
|
||||
int32 *is,
|
||||
tmp3Bits *pMainData);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
84
cocos2d-x/external/sources/pvmp3dec/src/pv_mp3dec_fxd_op.h
vendored
Normal file
84
cocos2d-x/external/sources/pvmp3dec/src/pv_mp3dec_fxd_op.h
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: pv_mp3dec_fxd_op.h
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
|
||||
Description:
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file select the associated fixed point functions with the OS/ARCH.
|
||||
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef PV_MP3DEC_FXD_OP_H
|
||||
#define PV_MP3DEC_FXD_OP_H
|
||||
|
||||
#include "pvmp3_audio_type_defs.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
|
||||
#if (defined(PV_ARM_V5)||defined(PV_ARM_V4))
|
||||
|
||||
#include "pv_mp3dec_fxd_op_arm.h"
|
||||
|
||||
#elif (defined(PV_ARM_GCC_V5)||defined(PV_ARM_GCC_V4))
|
||||
|
||||
#include "pv_mp3dec_fxd_op_arm_gcc.h"
|
||||
|
||||
#elif (defined(PV_ARM_MSC_EVC_V5)||defined(PV_ARM_MSC_EVC_V4))
|
||||
|
||||
#include "pv_mp3dec_fxd_op_msc_evc.h"
|
||||
|
||||
#else
|
||||
|
||||
#ifndef C_EQUIVALENT
|
||||
#define C_EQUIVALENT
|
||||
#endif
|
||||
|
||||
#include "pv_mp3dec_fxd_op_c_equivalent.h"
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif /* PV_MP3DEC_FXD_OP_H */
|
||||
203
cocos2d-x/external/sources/pvmp3dec/src/pv_mp3dec_fxd_op_arm.h
vendored
Normal file
203
cocos2d-x/external/sources/pvmp3dec/src/pv_mp3dec_fxd_op_arm.h
vendored
Normal file
@@ -0,0 +1,203 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Pathname: ./cpp/include/pv_mp3dec_fxd_op_arm.h
|
||||
|
||||
Date: 08/20/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
Description:
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file select the associated fixed point functions with the OS/ARCH.
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef PV_MP3DEC_FXD_OP_ARM
|
||||
#define PV_MP3DEC_FXD_OP_ARM
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include "pvmp3_audio_type_defs.h"
|
||||
|
||||
|
||||
#if (defined(PV_ARM_V5)||defined(PV_ARM_V4))
|
||||
|
||||
|
||||
__inline Int32 fxp_mul32_Q30(const Int32 L_var1, const Int32 L_var2)
|
||||
{
|
||||
|
||||
Int32 result64_hi;
|
||||
Int32 result64_lo;
|
||||
__asm
|
||||
{
|
||||
smull result64_lo, result64_hi, L_var2, L_var1
|
||||
mov result64_lo, result64_lo, lsr #30
|
||||
add result64_hi, result64_lo, result64_hi, asl #2
|
||||
}
|
||||
return (result64_hi);
|
||||
}
|
||||
|
||||
__inline Int32 fxp_mac32_Q30(const Int32 L_var1, const Int32 L_var2, Int32 L_add)
|
||||
{
|
||||
Int32 result64_hi;
|
||||
Int32 result64_lo;
|
||||
__asm
|
||||
{
|
||||
smull result64_lo, result64_hi, L_var2, L_var1
|
||||
add L_add, L_add, result64_hi, asl #2
|
||||
add L_add, L_add, result64_lo, lsr #30
|
||||
}
|
||||
return (L_add);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define Qfmt_31(a) (Int32)(a*0x7FFFFFFF + (a>=0?0.5F:-0.5F))
|
||||
|
||||
|
||||
|
||||
__inline Int32 fxp_mul32_Q32(Int32 L_var1, const Int32 L_var2)
|
||||
{
|
||||
Int32 result64_hi;
|
||||
__asm
|
||||
{
|
||||
smull L_var1, result64_hi, L_var2, L_var1
|
||||
}
|
||||
return (result64_hi);
|
||||
}
|
||||
|
||||
__inline Int32 fxp_mul32_Q28(const Int32 L_var1, const Int32 L_var2)
|
||||
{
|
||||
|
||||
Int32 result64_hi;
|
||||
Int32 result64_lo;
|
||||
__asm
|
||||
{
|
||||
smull result64_lo, result64_hi, L_var2, L_var1
|
||||
mov result64_lo, result64_lo, lsr #28
|
||||
add result64_hi, result64_lo, result64_hi, asl #4
|
||||
}
|
||||
return (result64_hi);
|
||||
}
|
||||
|
||||
|
||||
__inline Int32 fxp_mul32_Q27(const Int32 L_var1, const Int32 L_var2)
|
||||
{
|
||||
|
||||
Int32 result64_hi;
|
||||
Int32 result64_lo;
|
||||
__asm
|
||||
{
|
||||
smull result64_lo, result64_hi, L_var2, L_var1
|
||||
mov result64_lo, result64_lo, lsr #27
|
||||
add result64_hi, result64_lo, result64_hi, asl #5
|
||||
}
|
||||
return (result64_hi);
|
||||
}
|
||||
|
||||
|
||||
__inline Int32 fxp_mul32_Q26(Int32 L_var1, Int32 L_var2)
|
||||
{
|
||||
|
||||
Int32 result64_hi;
|
||||
Int32 result64_lo;
|
||||
__asm
|
||||
{
|
||||
smull result64_lo, result64_hi, L_var2, L_var1
|
||||
mov result64_lo, result64_lo, lsr #26
|
||||
add result64_hi, result64_lo, result64_hi, asl #6
|
||||
}
|
||||
return (result64_hi);
|
||||
}
|
||||
|
||||
|
||||
|
||||
__inline Int32 fxp_mac32_Q32(Int32 L_add, Int32 L_var1, const Int32 L_var2)
|
||||
{
|
||||
__asm
|
||||
{
|
||||
smlal L_var1, L_add, L_var2, L_var1
|
||||
}
|
||||
return L_add;
|
||||
}
|
||||
|
||||
|
||||
__inline Int32 fxp_msb32_Q32(Int32 L_sub, Int32 L_var1, Int32 L_var2)
|
||||
{
|
||||
|
||||
__asm
|
||||
{
|
||||
smull L_var2, L_var1, L_var2, L_var1
|
||||
sub L_sub, L_sub, L_var1
|
||||
}
|
||||
return L_sub;
|
||||
}
|
||||
|
||||
|
||||
__inline Int32 fxp_mul32_Q29(const Int32 L_var1, const Int32 L_var2)
|
||||
{
|
||||
Int32 result64_hi;
|
||||
Int32 result64_lo;
|
||||
__asm
|
||||
{
|
||||
smull result64_lo, result64_hi, L_var2, L_var1
|
||||
mov result64_lo, result64_lo, lsr #29
|
||||
add result64_hi, result64_lo, result64_hi, asl #3
|
||||
}
|
||||
return (result64_hi);
|
||||
}
|
||||
|
||||
|
||||
__inline int32 pv_abs(int32 a)
|
||||
{
|
||||
Int32 b;
|
||||
/*
|
||||
b = a - (a<0);
|
||||
a = b ^ sign(b)
|
||||
*/
|
||||
__asm
|
||||
{
|
||||
sub b, a, a, lsr #31
|
||||
eor a, b, b, asr #31
|
||||
}
|
||||
return (a);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* PV_MP3DEC_FXD_OP_ARM */
|
||||
|
||||
252
cocos2d-x/external/sources/pvmp3dec/src/pv_mp3dec_fxd_op_arm_gcc.h
vendored
Normal file
252
cocos2d-x/external/sources/pvmp3dec/src/pv_mp3dec_fxd_op_arm_gcc.h
vendored
Normal file
@@ -0,0 +1,252 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Pathname: ./cpp/include/pv_mp3dec_fxd_op_arm_gcc.h
|
||||
|
||||
Date: 08/20/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
Description:
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file select the associated fixed point functions with the OS/ARCH.
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef PV_MP3DEC_FXD_OP_ARM_GCC_H
|
||||
#define PV_MP3DEC_FXD_OP_ARM_GCC_H
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include "pvmp3_audio_type_defs.h"
|
||||
|
||||
|
||||
#if (defined(PV_ARM_GCC_V5)||defined(PV_ARM_GCC_V4))
|
||||
|
||||
#define Qfmt_31(a) (int32)(a*0x7FFFFFFF + (a>=0?0.5F:-0.5F))
|
||||
|
||||
#define Qfmt15(x) (Int16)(x*((int32)1<<15) + (x>=0?0.5F:-0.5F))
|
||||
|
||||
static inline int32 fxp_mul32_Q30(const int32 a, const int32 b)
|
||||
{
|
||||
int32 result64_hi;
|
||||
int32 result64_lo;
|
||||
register int32 ra = (int32)a;
|
||||
register int32 rb = (int32)b;
|
||||
asm volatile("smull %1, %0, %2, %3\n\t"
|
||||
"mov %1, %1, lsr #30\n\t"
|
||||
"add %0, %1, %0, asl #2"
|
||||
: "=&r*i"(result64_hi),
|
||||
"=&r*i"(result64_lo)
|
||||
: "r"(ra),
|
||||
"r"(rb));
|
||||
return (result64_hi);
|
||||
}
|
||||
|
||||
|
||||
static inline int32 fxp_mac32_Q30(const int32 a, const int32 b, int32 L_add)
|
||||
{
|
||||
int32 result64_hi;
|
||||
int32 result64_lo;
|
||||
register int32 ra = (int32)a;
|
||||
register int32 rb = (int32)b;
|
||||
register int32 rc = (int32)L_add;
|
||||
|
||||
asm volatile("smull %1, %0, %2, %3\n\t"
|
||||
"add %4, %4, %0, asl #2\n\t"
|
||||
"add %0, %4, %1, lsr #30"
|
||||
: "=&r*i"(result64_hi),
|
||||
"=&r*i"(result64_lo)
|
||||
: "r"(ra),
|
||||
"r"(rb),
|
||||
"r"(rc));
|
||||
|
||||
return (result64_hi);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static inline int32 fxp_mul32_Q32(const int32 a, const int32 b)
|
||||
{
|
||||
int32 result64_hi;
|
||||
int32 result64_lo;
|
||||
register int32 ra = (int32)a;
|
||||
register int32 rb = (int32)b;
|
||||
asm volatile(
|
||||
"smull %1, %0, %2, %3"
|
||||
: "=&r*i"(result64_hi),
|
||||
"=&r*i"(result64_lo)
|
||||
: "r"(ra),
|
||||
"r"(rb));
|
||||
|
||||
return (result64_hi);
|
||||
}
|
||||
|
||||
|
||||
static inline int32 fxp_mul32_Q29(const int32 a, const int32 b)
|
||||
{
|
||||
int32 result64_hi;
|
||||
int32 result64_lo;
|
||||
register int32 ra = (int32)a;
|
||||
register int32 rb = (int32)b;
|
||||
asm volatile("smull %1, %0, %2, %3\n\t"
|
||||
"mov %1, %1, lsr #29\n\t"
|
||||
"add %0, %1, %0, asl #3"
|
||||
: "=&r*i"(result64_hi),
|
||||
"=&r*i"(result64_lo)
|
||||
: "r"(ra),
|
||||
"r"(rb));
|
||||
return (result64_hi);
|
||||
|
||||
}
|
||||
|
||||
static inline int32 fxp_mul32_Q28(const int32 a, const int32 b)
|
||||
{
|
||||
|
||||
int32 result64_hi;
|
||||
int32 result64_lo;
|
||||
register int32 ra = (int32)a;
|
||||
register int32 rb = (int32)b;
|
||||
asm volatile("smull %1, %0, %2, %3\n\t"
|
||||
"mov %1, %1, lsr #28\n\t"
|
||||
"add %0, %1, %0, asl #4"
|
||||
: "=&r*i"(result64_hi),
|
||||
"=&r*i"(result64_lo)
|
||||
: "r"(ra),
|
||||
"r"(rb));
|
||||
return (result64_hi);
|
||||
|
||||
}
|
||||
|
||||
|
||||
static inline int32 fxp_mul32_Q27(const int32 a, const int32 b)
|
||||
{
|
||||
int32 result64_hi;
|
||||
int32 result64_lo;
|
||||
register int32 ra = (int32)a;
|
||||
register int32 rb = (int32)b;
|
||||
asm volatile("smull %1, %0, %2, %3\n\t"
|
||||
"mov %1, %1, lsr #27\n\t"
|
||||
"add %0, %1, %0, asl #5"
|
||||
: "=&r*i"(result64_hi),
|
||||
"=&r*i"(result64_lo)
|
||||
: "r"(ra),
|
||||
"r"(rb));
|
||||
return (result64_hi);
|
||||
|
||||
}
|
||||
|
||||
|
||||
static inline int32 fxp_mul32_Q26(const int32 a, const int32 b)
|
||||
{
|
||||
int32 result64_hi;
|
||||
int32 result64_lo;
|
||||
register int32 ra = (int32)a;
|
||||
register int32 rb = (int32)b;
|
||||
asm volatile("smull %1, %0, %2, %3\n\t"
|
||||
"mov %1, %1, lsr #26\n\t"
|
||||
"add %0, %1, %0, asl #6"
|
||||
: "=&r*i"(result64_hi),
|
||||
"=&r*i"(result64_lo)
|
||||
: "r"(ra),
|
||||
"r"(rb));
|
||||
return (result64_hi);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
static inline int32 fxp_mac32_Q32(int32 L_add, const int32 a, const int32 b)
|
||||
{
|
||||
|
||||
int32 result64_hi;
|
||||
int32 result64_lo;
|
||||
register int32 ra = (int32)a;
|
||||
register int32 rb = (int32)b;
|
||||
register int32 rc = (int32)L_add;
|
||||
|
||||
asm volatile("smull %1, %0, %2, %3\n\t"
|
||||
"add %0, %0, %4"
|
||||
: "=&r*i"(result64_hi),
|
||||
"=&r*i"(result64_lo)
|
||||
: "r"(ra),
|
||||
"r"(rb),
|
||||
"r"(rc));
|
||||
|
||||
return (result64_hi);
|
||||
}
|
||||
|
||||
static inline int32 fxp_msb32_Q32(int32 L_sub, const int32 a, const int32 b)
|
||||
{
|
||||
int32 result64_hi;
|
||||
int32 result64_lo;
|
||||
register int32 ra = (int32)a;
|
||||
register int32 rb = (int32)b;
|
||||
register int32 rc = (int32)L_sub;
|
||||
|
||||
asm volatile("smull %1, %0, %2, %3\n\t"
|
||||
"sub %0, %4, %0"
|
||||
: "=&r*i"(result64_hi),
|
||||
"=&r*i"(result64_lo)
|
||||
: "r"(ra),
|
||||
"r"(rb),
|
||||
"r"(rc));
|
||||
|
||||
|
||||
return (result64_hi);
|
||||
}
|
||||
|
||||
|
||||
__inline int32 pv_abs(int32 x)
|
||||
{
|
||||
register int32 z;
|
||||
register int32 y;
|
||||
register int32 ra = x;
|
||||
asm volatile(
|
||||
"sub %0, %2, %2, lsr #31\n\t"
|
||||
"eor %1, %0, %0, asr #31"
|
||||
: "=&r*i"(z),
|
||||
"=&r*i"(y)
|
||||
: "r"(ra));
|
||||
|
||||
return (y);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* PV_MP3DEC_FXD_OP_ARM_GCC_H */
|
||||
|
||||
123
cocos2d-x/external/sources/pvmp3dec/src/pv_mp3dec_fxd_op_c_equivalent.h
vendored
Normal file
123
cocos2d-x/external/sources/pvmp3dec/src/pv_mp3dec_fxd_op_c_equivalent.h
vendored
Normal file
@@ -0,0 +1,123 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Pathname: ./cpp/include/pv_mp3dec_fxd_op_c_equivalent.h
|
||||
|
||||
Date: 12/06/2005
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
Description:
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef PV_MP3DEC_FXD_OP_C_EQUIVALENT
|
||||
#define PV_MP3DEC_FXD_OP_C_EQUIVALENT
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include "pvmp3_audio_type_defs.h"
|
||||
#define Qfmt_31(a) (Int32)((double)a*0x7FFFFFFF)
|
||||
|
||||
#define Qfmt15(x) (Int16)(x*((Int32)1<<15) + (x>=0?0.5F:-0.5F))
|
||||
|
||||
|
||||
|
||||
__inline int32 pv_abs(int32 a)
|
||||
{
|
||||
int32 b = (a < 0) ? -a : a;
|
||||
return b;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
__inline Int32 fxp_mul32_Q30(const Int32 a, const Int32 b)
|
||||
{
|
||||
return (Int32)(((int64)(a) * b) >> 30);
|
||||
}
|
||||
|
||||
__inline Int32 fxp_mac32_Q30(const Int32 a, const Int32 b, Int32 L_add)
|
||||
{
|
||||
return (L_add + (Int32)(((int64)(a) * b) >> 30));
|
||||
}
|
||||
|
||||
__inline Int32 fxp_mul32_Q32(const Int32 a, const Int32 b)
|
||||
{
|
||||
return (Int32)(((int64)(a) * b) >> 32);
|
||||
}
|
||||
|
||||
|
||||
__inline Int32 fxp_mul32_Q28(const Int32 a, const Int32 b)
|
||||
{
|
||||
return (Int32)(((int64)(a) * b) >> 28);
|
||||
}
|
||||
|
||||
__inline Int32 fxp_mul32_Q27(const Int32 a, const Int32 b)
|
||||
{
|
||||
return (Int32)(((int64)(a) * b) >> 27);
|
||||
}
|
||||
|
||||
__inline Int32 fxp_mul32_Q26(const Int32 a, const Int32 b)
|
||||
{
|
||||
return (Int32)(((int64)(a) * b) >> 26);
|
||||
}
|
||||
|
||||
|
||||
__inline Int32 fxp_mac32_Q32(Int32 L_add, const Int32 a, const Int32 b)
|
||||
{
|
||||
return (L_add + (Int32)(((int64)(a) * b) >> 32));
|
||||
}
|
||||
|
||||
__inline Int32 fxp_msb32_Q32(Int32 L_sub, const Int32 a, const Int32 b)
|
||||
{
|
||||
return (L_sub - ((Int32)(((int64)(a) * b) >> 32)));
|
||||
}
|
||||
|
||||
|
||||
__inline Int32 fxp_mul32_Q29(const Int32 a, const Int32 b)
|
||||
{
|
||||
return (Int32)(((int64)(a) * b) >> 29);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* PV_MP3DEC_FXD_OP_C_EQUIVALENT */
|
||||
|
||||
|
||||
|
||||
132
cocos2d-x/external/sources/pvmp3dec/src/pv_mp3dec_fxd_op_msc_evc.h
vendored
Normal file
132
cocos2d-x/external/sources/pvmp3dec/src/pv_mp3dec_fxd_op_msc_evc.h
vendored
Normal file
@@ -0,0 +1,132 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Pathname: ./cpp/include/pv_mp3dec_fxd_op_msc_evc.h
|
||||
|
||||
Date: 08/20/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
Description:
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file select the associated fixed point functions with the OS/ARCH.
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef PV_MP3DEC_FXD_OP_MSC_EVC_H
|
||||
#define PV_MP3DEC_FXD_OP_MSC_EVC_H
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include "pvmp3_audio_type_defs.h"
|
||||
|
||||
|
||||
#if (defined(PV_ARM_MSC_EVC_V5)||defined(PV_ARM_MSC_EVC_V4))
|
||||
#include "armintr.h"
|
||||
#include "cmnintrin.h"
|
||||
|
||||
|
||||
__inline int32 fxp_mul32_Q30(const int32 a, const int32 b)
|
||||
{
|
||||
return (int32)(((int64)(a) * b) >> 30);
|
||||
}
|
||||
|
||||
|
||||
__inline int32 fxp_mac32_Q30(const int32 a, const int32 b, int32 L_add)
|
||||
{
|
||||
return (L_add + (int32)(((int64)(a) * b) >> 30));
|
||||
}
|
||||
|
||||
|
||||
#define Qfmt_31(a) (int32)(a*0x7FFFFFFF + (a>=0?0.5F:-0.5F))
|
||||
|
||||
#define Qfmt15(x) (Int16)(x*((int32)1<<15) + (x>=0?0.5F:-0.5F))
|
||||
|
||||
#define fxp_mul32_Q32( a, b) _MulHigh( b, a)
|
||||
|
||||
|
||||
|
||||
__inline int32 fxp_mul32_Q28(const int32 a, const int32 b)
|
||||
{
|
||||
return (int32)(((int64)(a) * b) >> 28);
|
||||
}
|
||||
|
||||
|
||||
__inline int32 fxp_mul32_Q27(const int32 a, const int32 b)
|
||||
{
|
||||
return (int32)(((int64)(a) * b) >> 27);
|
||||
}
|
||||
|
||||
|
||||
|
||||
__inline int32 fxp_mul32_Q26(const int32 a, const int32 b)
|
||||
{
|
||||
return (int32)(((int64)(a) * b) >> 26);
|
||||
}
|
||||
|
||||
|
||||
__inline int32 fxp_mac32_Q32(int32 L_add, const int32 a, const int32 b)
|
||||
{
|
||||
return (L_add + _MulHigh(b, a));
|
||||
}
|
||||
|
||||
|
||||
__inline int32 fxp_msb32_Q32(int32 L_sub, const int32 a, const int32 b)
|
||||
{
|
||||
return (L_sub - _MulHigh(b, a));
|
||||
}
|
||||
|
||||
|
||||
|
||||
__inline int32 fxp_mul32_Q29(const int32 a, const int32 b)
|
||||
{
|
||||
return (int32)(((int64)(a) * b) >> 29);
|
||||
}
|
||||
|
||||
|
||||
|
||||
__inline int32 pv_abs(int32 a)
|
||||
{
|
||||
int32 b = (a < 0) ? -a : a;
|
||||
return b;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* PV_MP3DEC_FXD_OP_MSC_EVC_H */
|
||||
|
||||
261
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_alias_reduction.cpp
vendored
Normal file
261
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_alias_reduction.cpp
vendored
Normal file
@@ -0,0 +1,261 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: pvmp3_alias_reduction.cpp
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
|
||||
Description:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Input
|
||||
int32 *input_buffer, Ptr to fequency lines of current channel
|
||||
struct gr_info_s *gr_info, structure with granuke information for the
|
||||
input
|
||||
mp3Header *info mp3 header information
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION DESCRIPTION
|
||||
|
||||
Alias Reduction
|
||||
|
||||
|
||||
|
||||
Alias reduction before processing by the IMDCT
|
||||
|
||||
Csi +
|
||||
>---------0---------0-------->
|
||||
\ / -
|
||||
Cai \ /
|
||||
\ /
|
||||
\ /
|
||||
\
|
||||
/ \
|
||||
Cai / \
|
||||
/ \ +
|
||||
>--------0---------0---------->
|
||||
Csi +
|
||||
|
||||
Aliasing Butterfly
|
||||
Alias reduction is not applied to short blocks
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REQUIREMENTS
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
|
||||
[1] ISO MPEG Audio Subgroup Software Simulation Group (1996)
|
||||
ISO 13818-3 MPEG-2 Audio Decoder - Lower Sampling Frequency Extension
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PSEUDO-CODE
|
||||
1 ci
|
||||
csi = ---------------- csi = ----------------
|
||||
sqrt( 1 + (ci^2)) sqrt( 1 + (ci^2))
|
||||
|
||||
|
||||
ci = -0.6, -0.535, -0.33, -0.185, -0.095, -0.041, -0.0142, -0.0037
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "pvmp3_alias_reduction.h"
|
||||
#include "pv_mp3dec_fxd_op.h"
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here. Include conditional
|
||||
; compile variables also.
|
||||
----------------------------------------------------------------------------*/
|
||||
#define NUM_BUTTERFLIES 8
|
||||
|
||||
#define Q31_fmt(a) (int32(double(0x7FFFFFFF)*a))
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL STORE/BUFFER/POINTER DEFINITIONS
|
||||
; Variable declaration - defined here and used outside this module
|
||||
----------------------------------------------------------------------------*/
|
||||
const int32 c_signal [ NUM_BUTTERFLIES ] =
|
||||
{
|
||||
|
||||
Q31_fmt(0.85749292571254f), Q31_fmt(0.88174199731771f),
|
||||
Q31_fmt(0.94962864910273f), Q31_fmt(0.98331459249179f),
|
||||
Q31_fmt(0.99551781606759f), Q31_fmt(0.99916055817815f),
|
||||
Q31_fmt(0.99989919524445f), Q31_fmt(0.99999315507028f)
|
||||
|
||||
};
|
||||
|
||||
|
||||
const int32 c_alias [ NUM_BUTTERFLIES ] =
|
||||
{
|
||||
|
||||
Q31_fmt(-0.51449575542753f), Q31_fmt(-0.47173196856497f),
|
||||
Q31_fmt(-0.31337745420390f), Q31_fmt(-0.18191319961098f),
|
||||
Q31_fmt(-0.09457419252642f), Q31_fmt(-0.04096558288530f),
|
||||
Q31_fmt(-0.01419856857247f), Q31_fmt(-0.00369997467376f)
|
||||
};
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL FUNCTION REFERENCES
|
||||
; Declare functions defined elsewhere and referenced in this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
void pvmp3_alias_reduction(int32 *input_buffer, /* Ptr to spec values of current channel */
|
||||
granuleInfo *gr_info,
|
||||
int32 *used_freq_lines,
|
||||
mp3Header *info)
|
||||
{
|
||||
int32 *ptr1;
|
||||
int32 *ptr2;
|
||||
int32 *ptr3;
|
||||
int32 *ptr4;
|
||||
const int32 *ptr_csi;
|
||||
const int32 *ptr_csa;
|
||||
int32 sblim;
|
||||
|
||||
int32 i, j;
|
||||
|
||||
*used_freq_lines = fxp_mul32_Q32(*used_freq_lines << 16, (int32)(0x7FFFFFFF / 18.0 - 1.0)) >> 15;
|
||||
|
||||
|
||||
if (gr_info->window_switching_flag && gr_info->block_type == 2)
|
||||
{
|
||||
if (gr_info->mixed_block_flag)
|
||||
{
|
||||
sblim = ((info->version_x == MPEG_2_5) && (info->sampling_frequency == 2)) ? 3 : 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return; /* illegal parameter */
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sblim = *used_freq_lines + 1;
|
||||
|
||||
if (sblim > SUBBANDS_NUMBER - 1)
|
||||
{
|
||||
sblim = SUBBANDS_NUMBER - 1; /* default */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
ptr3 = &input_buffer[17];
|
||||
ptr4 = &input_buffer[18];
|
||||
ptr_csi = c_signal;
|
||||
ptr_csa = c_alias;
|
||||
|
||||
/* NUM_BUTTERFLIES (=8) butterflies between each pair of sub-bands*/
|
||||
|
||||
for (i = NUM_BUTTERFLIES >> 1; i != 0; i--)
|
||||
{
|
||||
int32 csi1 = *ptr_csi++;
|
||||
int32 csi2 = *ptr_csi++;
|
||||
int32 csa1 = *ptr_csa++;
|
||||
int32 csa2 = *ptr_csa++;
|
||||
|
||||
ptr1 = ptr3;
|
||||
ptr3 -= 2;
|
||||
ptr2 = ptr4;
|
||||
ptr4 += 2;
|
||||
|
||||
/*
|
||||
* "sblim" alias-reduction operations between each
|
||||
* pair of sub-bands
|
||||
*/
|
||||
|
||||
for (j = sblim >> 1; j != 0; j--)
|
||||
{
|
||||
int32 y = *ptr2;
|
||||
int32 x = *ptr1 << 1;
|
||||
*ptr1-- = fxp_msb32_Q32(fxp_mul32_Q32(x, csi1), y << 1, csa1);
|
||||
*ptr2++ = fxp_mac32_Q32(fxp_mul32_Q32(y << 1, csi1), x, csa1);
|
||||
y = *ptr2;
|
||||
x = *ptr1 << 1;
|
||||
*ptr1 = fxp_msb32_Q32(fxp_mul32_Q32(x, csi2), y << 1, csa2);
|
||||
*ptr2 = fxp_mac32_Q32(fxp_mul32_Q32(y << 1, csi2), x, csa2);
|
||||
ptr1 += 19;
|
||||
ptr2 += 17;
|
||||
y = *ptr2;
|
||||
x = *ptr1 << 1;
|
||||
*ptr1-- = fxp_msb32_Q32(fxp_mul32_Q32(x, csi1), y << 1, csa1);
|
||||
*ptr2++ = fxp_mac32_Q32(fxp_mul32_Q32(y << 1, csi1), x, csa1);
|
||||
y = *ptr2;
|
||||
x = *ptr1 << 1;
|
||||
*ptr1 = fxp_msb32_Q32(fxp_mul32_Q32(x, csi2), y << 1, csa2);
|
||||
*ptr2 = fxp_mac32_Q32(fxp_mul32_Q32(y << 1, csi2), x, csa2);
|
||||
ptr1 += 19;
|
||||
ptr2 += 17;
|
||||
|
||||
}
|
||||
|
||||
if (sblim & 1)
|
||||
{
|
||||
int32 x = *ptr1 << 1;
|
||||
int32 y = *ptr2;
|
||||
*ptr1-- = fxp_msb32_Q32(fxp_mul32_Q32(x, csi1), y << 1, csa1);
|
||||
*ptr2++ = fxp_mac32_Q32(fxp_mul32_Q32(y << 1, csi1), x, csa1);
|
||||
|
||||
x = *ptr1 << 1;
|
||||
y = *ptr2;
|
||||
*ptr1 = fxp_msb32_Q32(fxp_mul32_Q32(x, csi2), y << 1, csa2);
|
||||
*ptr2 = fxp_mac32_Q32(fxp_mul32_Q32(y << 1, csi2), x, csa2);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
100
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_alias_reduction.h
vendored
Normal file
100
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_alias_reduction.h
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: pvmp3_alias_reduction.h
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
Description:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef PVMP3_ALIAS_REDUCTION_H
|
||||
#define PVMP3_ALIAS_REDUCTION_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "pvmp3_dec_defs.h"
|
||||
#include "pvmp3_audio_type_defs.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
void pvmp3_alias_reduction(int32 *input_buffer,
|
||||
granuleInfo *gr_info,
|
||||
int32 *used_freq_lines,
|
||||
mp3Header *info);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#endif
|
||||
|
||||
161
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_crc.cpp
vendored
Normal file
161
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_crc.cpp
vendored
Normal file
@@ -0,0 +1,161 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: pvmp3_crc.cpp
|
||||
|
||||
Functions:
|
||||
getbits_crc
|
||||
calculate_crc
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
|
||||
Description:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
getbits_crc
|
||||
|
||||
Input
|
||||
tbits *inputStream, bit stream structure
|
||||
int32 neededBits, number of bits to read from the bit stream
|
||||
uint32 *crc, memory location holding calculated crc value
|
||||
uint32 crc_enabled flag to enable/disable crc checking
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
calculate_crc
|
||||
|
||||
Input
|
||||
uint32 data, data vector
|
||||
uint32 length, number of element upon the crc will be calculated
|
||||
uint32 *crc, memory location holding calculated crc value
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION DESCRIPTION
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REQUIREMENTS
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
|
||||
[1] ISO MPEG Audio Subgroup Software Simulation Group (1996)
|
||||
ISO 13818-3 MPEG-2 Audio Decoder - Lower Sampling Frequency Extension
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PSEUDO-CODE
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "pvmp3_getbits.h"
|
||||
#include "pvmp3_crc.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here. Include conditional
|
||||
; compile variables also.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL STORE/BUFFER/POINTER DEFINITIONS
|
||||
; Variable declaration - defined here and used outside this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL FUNCTION REFERENCES
|
||||
; Declare functions defined elsewhere and referenced in this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
uint32 getbits_crc(tmp3Bits *inputStream, /* bit stream structure */
|
||||
int32 neededBits, /* number of bits to read from the bit stream */
|
||||
uint32 *crc,
|
||||
uint32 crc_enabled)
|
||||
{
|
||||
uint32 bits = getNbits(inputStream, neededBits);
|
||||
|
||||
if (crc_enabled)
|
||||
{
|
||||
calculate_crc(bits, neededBits, crc);
|
||||
}
|
||||
return(bits);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
void calculate_crc(uint32 data,
|
||||
uint32 length,
|
||||
uint32 *crc)
|
||||
{
|
||||
uint32 carry;
|
||||
uint32 masking = 1 << length;
|
||||
|
||||
while ((masking >>= 1))
|
||||
{
|
||||
carry = *crc & 0x8000;
|
||||
*crc <<= 1;
|
||||
if (!carry ^ !(data & masking))
|
||||
{
|
||||
*crc ^= CRC16_POLYNOMIAL;
|
||||
}
|
||||
}
|
||||
*crc &= 0xffff;
|
||||
}
|
||||
|
||||
|
||||
|
||||
110
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_crc.h
vendored
Normal file
110
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_crc.h
vendored
Normal file
@@ -0,0 +1,110 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: pvmp3_crc.h
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
Description:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef PVMP3_CRC_H
|
||||
#define PVMP3_CRC_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "pvmp3_audio_type_defs.h"
|
||||
#include "s_mp3bits.h"
|
||||
#include "pvmp3decoder_api.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
#define CRC16_POLYNOMIAL 0x8005
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
uint32 getbits_crc(tmp3Bits *inputStream,
|
||||
int32 neededBits,
|
||||
uint32 *crc,
|
||||
uint32 crc_enabled);
|
||||
|
||||
|
||||
void calculate_crc(uint32 data,
|
||||
uint32 length,
|
||||
uint32 *crc);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
410
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_dct_16.cpp
vendored
Normal file
410
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_dct_16.cpp
vendored
Normal file
@@ -0,0 +1,410 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: pvmp3_dct_16.cpp
|
||||
|
||||
Functions:
|
||||
dct_16
|
||||
pv_merge_in_place_N32
|
||||
pv_split
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
|
||||
Description:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
dct_16
|
||||
|
||||
Input
|
||||
int32 vec[], input vector length 16
|
||||
Int flag processing direction: forward (1), backward ( 0)
|
||||
Returns
|
||||
|
||||
int32 vec[], dct length 16
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
pv_merge_in_place_N32
|
||||
|
||||
Input
|
||||
int32 vec[], input vector length 16
|
||||
|
||||
Returns
|
||||
|
||||
int32 vec[], merged output of two dct 16 to create a dct 32
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
pv_split
|
||||
|
||||
Input
|
||||
int32 vec[], input vector length 16
|
||||
|
||||
Returns
|
||||
|
||||
int32 vec[], splitted even/odd and pre processing rotation
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION DESCRIPTION
|
||||
|
||||
dct 16 and tools to assemble a dct32 output
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REQUIREMENTS
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PSEUDO-CODE
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#if ( !defined(PV_ARM_GCC_V5) && !defined(PV_ARM_GCC_V4) )
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "pvmp3_dct_16.h"
|
||||
#include "pv_mp3dec_fxd_op.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here. Include conditional
|
||||
; compile variables also.
|
||||
----------------------------------------------------------------------------*/
|
||||
#define Qfmt(a) (int32)(a*((int32)1<<27))
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL STORE/BUFFER/POINTER DEFINITIONS
|
||||
; Variable declaration - defined here and used outside this module
|
||||
----------------------------------------------------------------------------*/
|
||||
const int32 CosTable_dct32[16] =
|
||||
{
|
||||
Qfmt_31(0.50060299823520F) , Qfmt_31(0.50547095989754F) ,
|
||||
Qfmt_31(0.51544730992262F) , Qfmt_31(0.53104259108978F) ,
|
||||
Qfmt_31(0.55310389603444F) , Qfmt_31(0.58293496820613F) ,
|
||||
Qfmt_31(0.62250412303566F) , Qfmt_31(0.67480834145501F) ,
|
||||
Qfmt_31(0.74453627100230F) , Qfmt_31(0.83934964541553F) ,
|
||||
|
||||
Qfmt(0.97256823786196F) , Qfmt(1.16943993343288F) ,
|
||||
Qfmt(1.48416461631417F) , Qfmt(2.05778100995341F) ,
|
||||
Qfmt(3.40760841846872F) , Qfmt(10.19000812354803F)
|
||||
};
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL FUNCTION REFERENCES
|
||||
; Declare functions defined elsewhere and referenced in this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
void pvmp3_dct_16(int32 vec[], int32 flag)
|
||||
{
|
||||
int32 tmp0;
|
||||
int32 tmp1;
|
||||
int32 tmp2;
|
||||
int32 tmp3;
|
||||
int32 tmp4;
|
||||
int32 tmp5;
|
||||
int32 tmp6;
|
||||
int32 tmp7;
|
||||
int32 tmp_o0;
|
||||
int32 tmp_o1;
|
||||
int32 tmp_o2;
|
||||
int32 tmp_o3;
|
||||
int32 tmp_o4;
|
||||
int32 tmp_o5;
|
||||
int32 tmp_o6;
|
||||
int32 tmp_o7;
|
||||
int32 itmp_e0;
|
||||
int32 itmp_e1;
|
||||
int32 itmp_e2;
|
||||
|
||||
/* split input vector */
|
||||
|
||||
tmp_o0 = fxp_mul32_Q32((vec[ 0] - vec[15]), Qfmt_31(0.50241928618816F));
|
||||
tmp0 = vec[ 0] + vec[15];
|
||||
|
||||
tmp_o7 = fxp_mul32_Q32((vec[ 7] - vec[ 8]) << 3, Qfmt_31(0.63764357733614F));
|
||||
tmp7 = vec[ 7] + vec[ 8];
|
||||
|
||||
itmp_e0 = fxp_mul32_Q32((tmp0 - tmp7), Qfmt_31(0.50979557910416F));
|
||||
tmp7 = (tmp0 + tmp7);
|
||||
|
||||
tmp_o1 = fxp_mul32_Q32((vec[ 1] - vec[14]), Qfmt_31(0.52249861493969F));
|
||||
tmp1 = vec[ 1] + vec[14];
|
||||
|
||||
tmp_o6 = fxp_mul32_Q32((vec[ 6] - vec[ 9]) << 1, Qfmt_31(0.86122354911916F));
|
||||
tmp6 = vec[ 6] + vec[ 9];
|
||||
|
||||
|
||||
|
||||
itmp_e1 = (tmp1 + tmp6);
|
||||
tmp6 = fxp_mul32_Q32((tmp1 - tmp6), Qfmt_31(0.60134488693505F));
|
||||
|
||||
|
||||
|
||||
tmp_o2 = fxp_mul32_Q32((vec[ 2] - vec[13]), Qfmt_31(0.56694403481636F));
|
||||
tmp2 = vec[ 2] + vec[13];
|
||||
tmp_o5 = fxp_mul32_Q32((vec[ 5] - vec[10]) << 1, Qfmt_31(0.53033884299517F));
|
||||
tmp5 = vec[ 5] + vec[10];
|
||||
|
||||
itmp_e2 = (tmp2 + tmp5);
|
||||
tmp5 = fxp_mul32_Q32((tmp2 - tmp5), Qfmt_31(0.89997622313642F));
|
||||
|
||||
tmp_o3 = fxp_mul32_Q32((vec[ 3] - vec[12]), Qfmt_31(0.64682178335999F));
|
||||
tmp3 = vec[ 3] + vec[12];
|
||||
tmp_o4 = fxp_mul32_Q32((vec[ 4] - vec[11]), Qfmt_31(0.78815462345125F));
|
||||
tmp4 = vec[ 4] + vec[11];
|
||||
|
||||
tmp1 = (tmp3 + tmp4);
|
||||
tmp4 = fxp_mul32_Q32((tmp3 - tmp4) << 2, Qfmt_31(0.64072886193538F));
|
||||
|
||||
/* split even part of tmp_e */
|
||||
|
||||
tmp0 = (tmp7 + tmp1);
|
||||
tmp1 = fxp_mul32_Q32((tmp7 - tmp1), Qfmt_31(0.54119610014620F));
|
||||
|
||||
tmp3 = fxp_mul32_Q32((itmp_e1 - itmp_e2) << 1, Qfmt_31(0.65328148243819F));
|
||||
tmp7 = (itmp_e1 + itmp_e2);
|
||||
|
||||
vec[ 0] = (tmp0 + tmp7) >> 1;
|
||||
vec[ 8] = fxp_mul32_Q32((tmp0 - tmp7), Qfmt_31(0.70710678118655F));
|
||||
tmp0 = fxp_mul32_Q32((tmp1 - tmp3) << 1, Qfmt_31(0.70710678118655F));
|
||||
vec[ 4] = tmp1 + tmp3 + tmp0;
|
||||
vec[12] = tmp0;
|
||||
|
||||
/* split odd part of tmp_e */
|
||||
|
||||
tmp1 = fxp_mul32_Q32((itmp_e0 - tmp4) << 1, Qfmt_31(0.54119610014620F));
|
||||
tmp7 = itmp_e0 + tmp4;
|
||||
|
||||
tmp3 = fxp_mul32_Q32((tmp6 - tmp5) << 2, Qfmt_31(0.65328148243819F));
|
||||
tmp6 += tmp5;
|
||||
|
||||
tmp4 = fxp_mul32_Q32((tmp7 - tmp6) << 1, Qfmt_31(0.70710678118655F));
|
||||
tmp6 += tmp7;
|
||||
tmp7 = fxp_mul32_Q32((tmp1 - tmp3) << 1, Qfmt_31(0.70710678118655F));
|
||||
|
||||
tmp1 += tmp3 + tmp7;
|
||||
vec[ 2] = tmp1 + tmp6;
|
||||
vec[ 6] = tmp1 + tmp4;
|
||||
vec[10] = tmp7 + tmp4;
|
||||
vec[14] = tmp7;
|
||||
|
||||
|
||||
// dct8;
|
||||
|
||||
tmp1 = fxp_mul32_Q32((tmp_o0 - tmp_o7) << 1, Qfmt_31(0.50979557910416F));
|
||||
tmp7 = tmp_o0 + tmp_o7;
|
||||
|
||||
tmp6 = tmp_o1 + tmp_o6;
|
||||
tmp_o1 = fxp_mul32_Q32((tmp_o1 - tmp_o6) << 1, Qfmt_31(0.60134488693505F));
|
||||
|
||||
tmp5 = tmp_o2 + tmp_o5;
|
||||
tmp_o5 = fxp_mul32_Q32((tmp_o2 - tmp_o5) << 1, Qfmt_31(0.89997622313642F));
|
||||
|
||||
tmp0 = fxp_mul32_Q32((tmp_o3 - tmp_o4) << 3, Qfmt_31(0.6407288619354F));
|
||||
tmp4 = tmp_o3 + tmp_o4;
|
||||
|
||||
if (!flag)
|
||||
{
|
||||
tmp7 = -tmp7;
|
||||
tmp1 = -tmp1;
|
||||
tmp6 = -tmp6;
|
||||
tmp_o1 = -tmp_o1;
|
||||
tmp5 = -tmp5;
|
||||
tmp_o5 = -tmp_o5;
|
||||
tmp4 = -tmp4;
|
||||
tmp0 = -tmp0;
|
||||
}
|
||||
|
||||
|
||||
tmp2 = fxp_mul32_Q32((tmp1 - tmp0) << 1, Qfmt_31(0.54119610014620F));
|
||||
tmp0 += tmp1;
|
||||
tmp1 = fxp_mul32_Q32((tmp7 - tmp4) << 1, Qfmt_31(0.54119610014620F));
|
||||
tmp7 += tmp4;
|
||||
tmp4 = fxp_mul32_Q32((tmp6 - tmp5) << 2, Qfmt_31(0.65328148243819F));
|
||||
tmp6 += tmp5;
|
||||
tmp5 = fxp_mul32_Q32((tmp_o1 - tmp_o5) << 2, Qfmt_31(0.65328148243819F));
|
||||
tmp_o1 += tmp_o5;
|
||||
|
||||
|
||||
vec[13] = fxp_mul32_Q32((tmp1 - tmp4) << 1, Qfmt_31(0.70710678118655F));
|
||||
vec[ 5] = tmp1 + tmp4 + vec[13];
|
||||
|
||||
vec[ 9] = fxp_mul32_Q32((tmp7 - tmp6) << 1, Qfmt_31(0.70710678118655F));
|
||||
vec[ 1] = tmp7 + tmp6;
|
||||
|
||||
tmp4 = fxp_mul32_Q32((tmp0 - tmp_o1) << 1, Qfmt_31(0.70710678118655F));
|
||||
tmp0 += tmp_o1;
|
||||
tmp6 = fxp_mul32_Q32((tmp2 - tmp5) << 1, Qfmt_31(0.70710678118655F));
|
||||
tmp2 += tmp5 + tmp6;
|
||||
tmp0 += tmp2;
|
||||
|
||||
vec[ 1] += tmp0;
|
||||
vec[ 3] = tmp0 + vec[ 5];
|
||||
tmp2 += tmp4;
|
||||
vec[ 5] = tmp2 + vec[ 5];
|
||||
vec[ 7] = tmp2 + vec[ 9];
|
||||
tmp4 += tmp6;
|
||||
vec[ 9] = tmp4 + vec[ 9];
|
||||
vec[11] = tmp4 + vec[13];
|
||||
vec[13] = tmp6 + vec[13];
|
||||
vec[15] = tmp6;
|
||||
|
||||
}
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
void pvmp3_merge_in_place_N32(int32 vec[])
|
||||
{
|
||||
|
||||
|
||||
int32 temp0;
|
||||
int32 temp1;
|
||||
int32 temp2;
|
||||
int32 temp3;
|
||||
|
||||
temp0 = vec[14];
|
||||
vec[14] = vec[ 7];
|
||||
temp1 = vec[12];
|
||||
vec[12] = vec[ 6];
|
||||
temp2 = vec[10];
|
||||
vec[10] = vec[ 5];
|
||||
temp3 = vec[ 8];
|
||||
vec[ 8] = vec[ 4];
|
||||
vec[ 6] = vec[ 3];
|
||||
vec[ 4] = vec[ 2];
|
||||
vec[ 2] = vec[ 1];
|
||||
|
||||
vec[ 1] = (vec[16] + vec[17]);
|
||||
vec[16] = temp3;
|
||||
vec[ 3] = (vec[18] + vec[17]);
|
||||
vec[ 5] = (vec[19] + vec[18]);
|
||||
vec[18] = vec[9];
|
||||
|
||||
vec[ 7] = (vec[20] + vec[19]);
|
||||
vec[ 9] = (vec[21] + vec[20]);
|
||||
vec[20] = temp2;
|
||||
temp2 = vec[13];
|
||||
temp3 = vec[11];
|
||||
vec[11] = (vec[22] + vec[21]);
|
||||
vec[13] = (vec[23] + vec[22]);
|
||||
vec[22] = temp3;
|
||||
temp3 = vec[15];
|
||||
|
||||
vec[15] = (vec[24] + vec[23]);
|
||||
vec[17] = (vec[25] + vec[24]);
|
||||
vec[19] = (vec[26] + vec[25]);
|
||||
vec[21] = (vec[27] + vec[26]);
|
||||
vec[23] = (vec[28] + vec[27]);
|
||||
vec[24] = temp1;
|
||||
vec[25] = (vec[29] + vec[28]);
|
||||
vec[26] = temp2;
|
||||
vec[27] = (vec[30] + vec[29]);
|
||||
vec[28] = temp0;
|
||||
vec[29] = (vec[30] + vec[31]);
|
||||
vec[30] = temp3;
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
||||
void pvmp3_split(int32 *vect)
|
||||
{
|
||||
|
||||
int32 i;
|
||||
const int32 *pt_cosTerms = &CosTable_dct32[15];
|
||||
int32 *pt_vect = vect;
|
||||
int32 *pt_vect_2 = pt_vect - 1;
|
||||
|
||||
for (i = 3; i != 0; i--)
|
||||
{
|
||||
int32 tmp2 = *(pt_vect);
|
||||
int32 tmp1 = *(pt_vect_2);
|
||||
int32 cosx = *(pt_cosTerms--);
|
||||
*(pt_vect_2--) = (tmp1 + tmp2);
|
||||
*(pt_vect++) = fxp_mul32_Q27((tmp1 - tmp2), cosx);
|
||||
|
||||
tmp2 = *(pt_vect);
|
||||
tmp1 = *(pt_vect_2);
|
||||
cosx = *(pt_cosTerms--);
|
||||
*(pt_vect_2--) = (tmp1 + tmp2);
|
||||
*(pt_vect++) = fxp_mul32_Q27((tmp1 - tmp2), cosx);
|
||||
|
||||
}
|
||||
|
||||
for (i = 5; i != 0; i--)
|
||||
{
|
||||
int32 tmp2 = *(pt_vect);
|
||||
int32 tmp1 = *(pt_vect_2);
|
||||
int32 cosx = *(pt_cosTerms--);
|
||||
*(pt_vect_2--) = (tmp1 + tmp2);
|
||||
*(pt_vect++) = fxp_mul32_Q32((tmp1 - tmp2) << 1, cosx);
|
||||
|
||||
tmp2 = *(pt_vect);
|
||||
tmp1 = *(pt_vect_2);
|
||||
cosx = *(pt_cosTerms--);
|
||||
*(pt_vect_2--) = (tmp1 + tmp2);
|
||||
*(pt_vect++) = fxp_mul32_Q32((tmp1 - tmp2) << 1, cosx);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
102
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_dct_16.h
vendored
Normal file
102
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_dct_16.h
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: pvmp3_dct_16.h
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
Description:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef PVMP3_DCT_16_H
|
||||
#define PVMP3_DCT_16_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "pvmp3_audio_type_defs.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
void pvmp3_dct_16(int32 vec[], int32 flag);
|
||||
|
||||
void pvmp3_merge_in_place_N32(int32 vec[]);
|
||||
|
||||
void pvmp3_split(int32 *vect);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#endif
|
||||
|
||||
152
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_dct_6.cpp
vendored
Normal file
152
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_dct_6.cpp
vendored
Normal file
@@ -0,0 +1,152 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: pvmp3_dct6.cpp
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
|
||||
Description:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Input
|
||||
Int32 vec[] vector of 6 32-bit integers
|
||||
Returns
|
||||
Int32 vec[] dct computation in-place
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION DESCRIPTION
|
||||
|
||||
Returns the dct of length 6 of the input vector
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REQUIREMENTS
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PSEUDO-CODE
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "pvmp3_audio_type_defs.h"
|
||||
#include "pv_mp3dec_fxd_op.h"
|
||||
#include "pvmp3_mdct_6.h"
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here. Include conditional
|
||||
; compile variables also.
|
||||
----------------------------------------------------------------------------*/
|
||||
#define Qfmt30(a) (Int32)(a*((Int32)1<<30) + (a>=0?0.5F:-0.5F))
|
||||
|
||||
#define cos_pi_6 Qfmt30( 0.86602540378444f)
|
||||
#define cos_2_pi_6 Qfmt30( 0.5f)
|
||||
#define cos_7_pi_12 Qfmt30( -0.25881904510252f)
|
||||
#define cos_3_pi_12 Qfmt30( 0.70710678118655f)
|
||||
#define cos_11_pi_12 Qfmt30( -0.96592582628907f)
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL STORE/BUFFER/POINTER DEFINITIONS
|
||||
; Variable declaration - defined here and used outside this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL FUNCTION REFERENCES
|
||||
; Declare functions defined elsewhere and referenced in this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
void pvmp3_dct_6(int32 vec[])
|
||||
{
|
||||
|
||||
Int32 tmp0;
|
||||
Int32 tmp1;
|
||||
Int32 tmp2;
|
||||
Int32 tmp3;
|
||||
Int32 tmp4;
|
||||
Int32 tmp5;
|
||||
|
||||
|
||||
/* split input vector */
|
||||
|
||||
tmp0 = vec[5] + vec[0];
|
||||
tmp5 = vec[5] - vec[0];
|
||||
tmp1 = vec[4] + vec[1];
|
||||
tmp4 = vec[4] - vec[1];
|
||||
tmp2 = vec[3] + vec[2];
|
||||
tmp3 = vec[3] - vec[2];
|
||||
|
||||
vec[0] = tmp0 + tmp2 ;
|
||||
vec[2] = fxp_mul32_Q30(tmp0 - tmp2, cos_pi_6);
|
||||
vec[4] = (vec[0] >> 1) - tmp1;
|
||||
vec[0] += tmp1;
|
||||
|
||||
tmp0 = fxp_mul32_Q30(tmp3, cos_7_pi_12);
|
||||
tmp0 = fxp_mac32_Q30(tmp4, -cos_3_pi_12, tmp0);
|
||||
vec[1] = fxp_mac32_Q30(tmp5, cos_11_pi_12, tmp0);
|
||||
|
||||
vec[3] = fxp_mul32_Q30((tmp3 + tmp4 - tmp5), cos_3_pi_12);
|
||||
tmp0 = fxp_mul32_Q30(tmp3, cos_11_pi_12);
|
||||
tmp0 = fxp_mac32_Q30(tmp4, cos_3_pi_12, tmp0);
|
||||
vec[5] = fxp_mac32_Q30(tmp5, cos_7_pi_12, tmp0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
167
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_dct_9.cpp
vendored
Normal file
167
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_dct_9.cpp
vendored
Normal file
@@ -0,0 +1,167 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: pvmp3_dct_9.cpp
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
|
||||
Description:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Input
|
||||
int32 vec[] vector of 9 32-bit integers
|
||||
Returns
|
||||
int32 vec[] dct computation in-place
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION DESCRIPTION
|
||||
|
||||
Returns the dct of length 9 of the input vector
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REQUIREMENTS
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PSEUDO-CODE
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#if ( !defined(PV_ARM_GCC_V5) && !defined(PV_ARM_GCC_V4) && !defined(PV_ARM_V5) && !defined(PV_ARM_V4) )
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "pvmp3_audio_type_defs.h"
|
||||
#include "pv_mp3dec_fxd_op.h"
|
||||
#include "pvmp3_mdct_18.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here. Include conditional
|
||||
; compile variables also.
|
||||
----------------------------------------------------------------------------*/
|
||||
#define Qfmt31(a) (int32)(1.0*a*(0x7FFFFFFF))
|
||||
|
||||
#define cos_pi_9 Qfmt31( 0.93969262078591f)
|
||||
#define cos_2pi_9 Qfmt31( 0.76604444311898f)
|
||||
#define cos_4pi_9 Qfmt31( 0.17364817766693f)
|
||||
#define cos_5pi_9 Qfmt31(-0.17364817766693f)
|
||||
#define cos_7pi_9 Qfmt31(-0.76604444311898f)
|
||||
#define cos_8pi_9 Qfmt31(-0.93969262078591f)
|
||||
#define cos_pi_6 Qfmt31( 0.86602540378444f)
|
||||
#define cos_5pi_6 Qfmt31(-0.86602540378444f)
|
||||
#define cos_5pi_18 Qfmt31( 0.64278760968654f)
|
||||
#define cos_7pi_18 Qfmt31( 0.34202014332567f)
|
||||
#define cos_11pi_18 Qfmt31(-0.34202014332567f)
|
||||
#define cos_13pi_18 Qfmt31(-0.64278760968654f)
|
||||
#define cos_17pi_18 Qfmt31(-0.98480775301221f)
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL STORE/BUFFER/POINTER DEFINITIONS
|
||||
; Variable declaration - defined here and used outside this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL FUNCTION REFERENCES
|
||||
; Declare functions defined elsewhere and referenced in this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
void pvmp3_dct_9(int32 vec[])
|
||||
{
|
||||
|
||||
/* split input vector */
|
||||
|
||||
int32 tmp0 = vec[8] + vec[0];
|
||||
int32 tmp8 = vec[8] - vec[0];
|
||||
int32 tmp1 = vec[7] + vec[1];
|
||||
int32 tmp7 = vec[7] - vec[1];
|
||||
int32 tmp2 = vec[6] + vec[2];
|
||||
int32 tmp6 = vec[6] - vec[2];
|
||||
int32 tmp3 = vec[5] + vec[3];
|
||||
int32 tmp5 = vec[5] - vec[3];
|
||||
|
||||
vec[0] = (tmp0 + tmp2 + tmp3) + (tmp1 + vec[4]);
|
||||
vec[6] = ((tmp0 + tmp2 + tmp3) >> 1) - (tmp1 + vec[4]);
|
||||
vec[2] = (tmp1 >> 1) - vec[4];
|
||||
vec[4] = -vec[2];
|
||||
vec[8] = -vec[2];
|
||||
vec[4] = fxp_mac32_Q32(vec[4], tmp0 << 1, cos_2pi_9);
|
||||
vec[8] = fxp_mac32_Q32(vec[8], tmp0 << 1, cos_4pi_9);
|
||||
vec[2] = fxp_mac32_Q32(vec[2], tmp0 << 1, cos_pi_9);
|
||||
vec[2] = fxp_mac32_Q32(vec[2], tmp2 << 1, cos_5pi_9);
|
||||
vec[4] = fxp_mac32_Q32(vec[4], tmp2 << 1, cos_8pi_9);
|
||||
vec[8] = fxp_mac32_Q32(vec[8], tmp2 << 1, cos_2pi_9);
|
||||
vec[8] = fxp_mac32_Q32(vec[8], tmp3 << 1, cos_8pi_9);
|
||||
vec[4] = fxp_mac32_Q32(vec[4], tmp3 << 1, cos_4pi_9);
|
||||
vec[2] = fxp_mac32_Q32(vec[2], tmp3 << 1, cos_7pi_9);
|
||||
|
||||
vec[1] = fxp_mul32_Q32(tmp5 << 1, cos_11pi_18);
|
||||
vec[1] = fxp_mac32_Q32(vec[1], tmp6 << 1, cos_13pi_18);
|
||||
vec[1] = fxp_mac32_Q32(vec[1], tmp7 << 1, cos_5pi_6);
|
||||
vec[1] = fxp_mac32_Q32(vec[1], tmp8 << 1, cos_17pi_18);
|
||||
vec[3] = fxp_mul32_Q32((tmp5 + tmp6 - tmp8) << 1, cos_pi_6);
|
||||
vec[5] = fxp_mul32_Q32(tmp5 << 1, cos_17pi_18);
|
||||
vec[5] = fxp_mac32_Q32(vec[5], tmp6 << 1, cos_7pi_18);
|
||||
vec[5] = fxp_mac32_Q32(vec[5], tmp7 << 1, cos_pi_6);
|
||||
vec[5] = fxp_mac32_Q32(vec[5], tmp8 << 1, cos_13pi_18);
|
||||
vec[7] = fxp_mul32_Q32(tmp5 << 1, cos_5pi_18);
|
||||
vec[7] = fxp_mac32_Q32(vec[7], tmp6 << 1, cos_17pi_18);
|
||||
vec[7] = fxp_mac32_Q32(vec[7], tmp7 << 1, cos_pi_6);
|
||||
vec[7] = fxp_mac32_Q32(vec[7], tmp8 << 1, cos_11pi_18);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif // If not assembly
|
||||
199
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_dec_defs.h
vendored
Normal file
199
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_dec_defs.h
vendored
Normal file
@@ -0,0 +1,199 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: pvmp3_dec_defs.h
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
Description:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This include file has the mp3 decoder common defines.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef PVMP3_DEC_DEFS_H
|
||||
#define PVMP3_DEC_DEFS_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "pvmp3_audio_type_defs.h"
|
||||
#include "pvmp3decoder_api.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
#define module(x, POW2) ((x)&(POW2-1))
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
#define BUFSIZE 8192 // big enough to hold 4608 bytes == biggest mp3 frame
|
||||
|
||||
#define CHAN 2
|
||||
#define GRAN 2
|
||||
|
||||
|
||||
#define SUBBANDS_NUMBER 32
|
||||
#define FILTERBANK_BANDS 18
|
||||
#define HAN_SIZE 512
|
||||
|
||||
|
||||
/* MPEG Header Definitions - ID Bit Values */
|
||||
|
||||
#define MPEG_1 0
|
||||
#define MPEG_2 1
|
||||
#define MPEG_2_5 2
|
||||
#define INVALID_VERSION -1
|
||||
|
||||
/* MPEG Header Definitions - Mode Values */
|
||||
|
||||
#define MPG_MD_STEREO 0
|
||||
#define MPG_MD_JOINT_STEREO 1
|
||||
#define MPG_MD_DUAL_CHANNEL 2
|
||||
#define MPG_MD_MONO 3
|
||||
|
||||
|
||||
|
||||
#define LEFT 0
|
||||
#define RIGHT 1
|
||||
|
||||
|
||||
#define SYNC_WORD (int32)0x7ff
|
||||
#define SYNC_WORD_LNGTH 11
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/* Header Information Structure */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int32 version_x;
|
||||
int32 layer_description;
|
||||
int32 error_protection;
|
||||
int32 bitrate_index;
|
||||
int32 sampling_frequency;
|
||||
int32 padding;
|
||||
int32 extension;
|
||||
int32 mode;
|
||||
int32 mode_ext;
|
||||
int32 copyright;
|
||||
int32 original;
|
||||
int32 emphasis;
|
||||
} mp3Header;
|
||||
|
||||
|
||||
/* Layer III side information. */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32 part2_3_length;
|
||||
uint32 big_values;
|
||||
int32 global_gain;
|
||||
uint32 scalefac_compress;
|
||||
uint32 window_switching_flag;
|
||||
uint32 block_type;
|
||||
uint32 mixed_block_flag;
|
||||
uint32 table_select[3];
|
||||
uint32 subblock_gain[3];
|
||||
uint32 region0_count;
|
||||
uint32 region1_count;
|
||||
uint32 preflag;
|
||||
uint32 scalefac_scale;
|
||||
uint32 count1table_select;
|
||||
|
||||
} granuleInfo;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32 scfsi[4];
|
||||
granuleInfo gran[2];
|
||||
|
||||
} channelInfo;
|
||||
|
||||
/* Layer III side info. */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32 main_data_begin;
|
||||
uint32 private_bits;
|
||||
channelInfo ch[2];
|
||||
|
||||
} mp3SideInfo;
|
||||
|
||||
/* Layer III scale factors. */
|
||||
typedef struct
|
||||
{
|
||||
int32 l[23]; /* [cb] */
|
||||
int32 s[3][13]; /* [window][cb] */
|
||||
|
||||
} mp3ScaleFactors;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
194
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_decode_header.cpp
vendored
Normal file
194
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_decode_header.cpp
vendored
Normal file
@@ -0,0 +1,194 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: pvmp3_decode_header.cpp
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
|
||||
Description:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Input
|
||||
tbits *inputStream, bit stream
|
||||
mp3Header *info,
|
||||
uint32 *crc
|
||||
Returns
|
||||
|
||||
mp3Header *info, structure holding the parsed mp3 header info
|
||||
uint32 *crc initialized crc computation
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION DESCRIPTION
|
||||
|
||||
gets mp3 header information
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REQUIREMENTS
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
|
||||
[1] ISO MPEG Audio Subgroup Software Simulation Group (1996)
|
||||
ISO 13818-3 MPEG-2 Audio Decoder - Lower Sampling Frequency Extension
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PSEUDO-CODE
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "pvmp3_decode_header.h"
|
||||
#include "pvmp3_crc.h"
|
||||
#include "pvmp3_getbits.h"
|
||||
#include "pvmp3_seek_synch.h"
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here. Include conditional
|
||||
; compile variables also.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL STORE/BUFFER/POINTER DEFINITIONS
|
||||
; Variable declaration - defined here and used outside this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL FUNCTION REFERENCES
|
||||
; Declare functions defined elsewhere and referenced in this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
ERROR_CODE pvmp3_decode_header(tmp3Bits *inputStream,
|
||||
mp3Header *info,
|
||||
uint32 *crc)
|
||||
{
|
||||
|
||||
ERROR_CODE err = NO_DECODING_ERROR;
|
||||
uint32 temp;
|
||||
|
||||
/*
|
||||
* Verify that at least the header is complete
|
||||
* Note that SYNC_WORD_LNGTH is in unit of bits, but inputBufferCurrentLength
|
||||
* is in unit of bytes.
|
||||
*/
|
||||
if (inputStream->inputBufferCurrentLength < ((SYNC_WORD_LNGTH + 21) >> 3))
|
||||
{
|
||||
return NO_ENOUGH_MAIN_DATA_ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
* MPEG Audio Version ID
|
||||
*/
|
||||
temp = getUpTo17bits(inputStream, SYNC_WORD_LNGTH);
|
||||
if ((temp & SYNC_WORD) != SYNC_WORD)
|
||||
{
|
||||
err = pvmp3_header_sync(inputStream);
|
||||
|
||||
if (err != NO_DECODING_ERROR)
|
||||
{
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
temp = getNbits(inputStream, 21); // to avoid multiple bitstream accesses
|
||||
|
||||
|
||||
switch (temp >> 19) /* 2 */
|
||||
{
|
||||
case 0:
|
||||
info->version_x = MPEG_2_5;
|
||||
break;
|
||||
case 2:
|
||||
info->version_x = MPEG_2;
|
||||
break;
|
||||
case 3:
|
||||
info->version_x = MPEG_1;
|
||||
break;
|
||||
default:
|
||||
info->version_x = INVALID_VERSION;
|
||||
err = UNSUPPORTED_LAYER;
|
||||
break;
|
||||
}
|
||||
|
||||
info->layer_description = 4 - ((temp << 13) >> 30); /* 2 */
|
||||
info->error_protection = !((temp << 15) >> 31); /* 1 */
|
||||
|
||||
if (info->error_protection)
|
||||
{
|
||||
*crc = 0xffff; /* CRC start value */
|
||||
calculate_crc((temp << 16) >> 16, 16, crc);
|
||||
}
|
||||
|
||||
info->bitrate_index = (temp << 16) >> 28; /* 4 */
|
||||
info->sampling_frequency = (temp << 20) >> 30; /* 2 */
|
||||
info->padding = (temp << 22) >> 31; /* 1 */
|
||||
info->extension = (temp << 23) >> 31; /* 1 */
|
||||
info->mode = (temp << 24) >> 30; /* 2 */
|
||||
info->mode_ext = (temp << 26) >> 30; /* 2 */
|
||||
info->copyright = (temp << 27) >> 31; /* 1 */
|
||||
info->original = (temp << 28) >> 31; /* 1 */
|
||||
info->emphasis = (temp << 30) >> 30; /* 2 */
|
||||
|
||||
|
||||
if (!info->bitrate_index || info->sampling_frequency == 3)
|
||||
{
|
||||
err = UNSUPPORTED_FREE_BITRATE;
|
||||
}
|
||||
|
||||
return(err);
|
||||
}
|
||||
|
||||
101
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_decode_header.h
vendored
Normal file
101
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_decode_header.h
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: pvmp3_decode_header.h
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
Description:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef PVMP3_DECODE_HEADER_H
|
||||
#define PVMP3_DECODE_HEADER_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "pvmp3_audio_type_defs.h"
|
||||
#include "pvmp3_dec_defs.h"
|
||||
#include "s_mp3bits.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
ERROR_CODE pvmp3_decode_header(tmp3Bits *inputStream,
|
||||
mp3Header *info,
|
||||
uint32 *crc);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#endif
|
||||
|
||||
758
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_decode_huff_cw.cpp
vendored
Normal file
758
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_decode_huff_cw.cpp
vendored
Normal file
@@ -0,0 +1,758 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: pvmp3_decode_huff_cw.cpp
|
||||
|
||||
Funtions:
|
||||
pvmp3_decode_huff_cw_tab0
|
||||
pvmp3_decode_huff_cw_tab1
|
||||
pvmp3_decode_huff_cw_tab2
|
||||
pvmp3_decode_huff_cw_tab3
|
||||
pvmp3_decode_huff_cw_tab5
|
||||
pvmp3_decode_huff_cw_tab6
|
||||
pvmp3_decode_huff_cw_tab7
|
||||
pvmp3_decode_huff_cw_tab8
|
||||
pvmp3_decode_huff_cw_tab9
|
||||
pvmp3_decode_huff_cw_tab10
|
||||
pvmp3_decode_huff_cw_tab11
|
||||
pvmp3_decode_huff_cw_tab12
|
||||
pvmp3_decode_huff_cw_tab13
|
||||
pvmp3_decode_huff_cw_tab15
|
||||
pvmp3_decode_huff_cw_tab16
|
||||
pvmp3_decode_huff_cw_tab24
|
||||
pvmp3_decode_huff_cw_tab32
|
||||
pvmp3_decode_huff_cw_tab33
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
|
||||
Description:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Inputs:
|
||||
BITS *pMainData = pointer to input mp3 Main data bit stream
|
||||
|
||||
|
||||
Outputs:
|
||||
cw = bit field extracted from a leaf entry of packed mp3 Huffman Tables
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION DESCRIPTION
|
||||
|
||||
These functions are used to decode huffman codewords from the input
|
||||
bitstream using combined binary search and look-up table approach.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REQUIREMENTS
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
[1] ISO MPEG Audio Subgroup Software Simulation Group (1996)
|
||||
ISO 13818-3 MPEG-2 Audio Decoder - Lower Sampling Frequency Extension
|
||||
|
||||
[2] Introduction to Algorithms,
|
||||
Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest.
|
||||
The MIT press, 1990
|
||||
|
||||
[3] "Selecting an Optimal Huffman Decoder for AAC",
|
||||
Vladimir Z. Mesarovic, et al.
|
||||
AES 111th Convention, September 21-24, 2001, New York, USA
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PSEUDO-CODE
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "pv_mp3dec_fxd_op.h"
|
||||
#include "pvmp3_tables.h"
|
||||
#include "pvmp3_getbits.h"
|
||||
#include "pvmp3_decode_huff_cw.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here. Include conditional
|
||||
; compile variables also.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL STORE/BUFFER/POINTER DEFINITIONS
|
||||
; Variable declaration - defined here and used outside this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL FUNCTION REFERENCES
|
||||
; Declare functions defined elsewhere and referenced in this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
uint16 pvmp3_decode_huff_cw_tab0(tmp3Bits *pMainData)
|
||||
{
|
||||
OSCL_UNUSED_ARG(pMainData);
|
||||
return(0);
|
||||
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
uint16 pvmp3_decode_huff_cw_tab1(tmp3Bits *pMainData)
|
||||
{
|
||||
uint32 tmp;
|
||||
uint16 cw;
|
||||
|
||||
tmp = getUpTo9bits(pMainData, 3); /* hufftable1 */
|
||||
|
||||
cw = *(huffTable_1 + tmp);
|
||||
pMainData->usedBits -= (3 - (cw & 0xFF));
|
||||
return(cw >> 8);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
uint16 pvmp3_decode_huff_cw_tab2(tmp3Bits *pMainData)
|
||||
{
|
||||
uint32 tmp;
|
||||
uint16 cw;
|
||||
|
||||
tmp = getUpTo9bits(pMainData, 6); /* huffTable_2,3 */
|
||||
|
||||
if (tmp >> 3)
|
||||
{
|
||||
tmp = (tmp >> 3) - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp = tmp + 7;
|
||||
}
|
||||
|
||||
cw = *(huffTable_2 + tmp);
|
||||
pMainData->usedBits -= (6 - (cw & 0xFF));
|
||||
|
||||
return(cw >> 8);
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
uint16 pvmp3_decode_huff_cw_tab3(tmp3Bits *pMainData)
|
||||
{
|
||||
uint32 tmp;
|
||||
uint16 cw;
|
||||
|
||||
tmp = getUpTo9bits(pMainData, 6); /* huffTable_2,3 */
|
||||
|
||||
if (tmp >> 3)
|
||||
{
|
||||
tmp = (tmp >> 3) - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp = tmp + 7;
|
||||
}
|
||||
|
||||
cw = *(huffTable_3 + tmp);
|
||||
pMainData->usedBits -= (6 - (cw & 0xFF));
|
||||
|
||||
return(cw >> 8);
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
uint16 pvmp3_decode_huff_cw_tab5(tmp3Bits *pMainData)
|
||||
{
|
||||
uint32 tmp;
|
||||
uint16 cw;
|
||||
|
||||
tmp = getUpTo9bits(pMainData, 8); /* huffTable_5 */
|
||||
|
||||
if ((tmp >> 5))
|
||||
{
|
||||
tmp = (tmp >> 5) - 1;
|
||||
}
|
||||
else if ((tmp >> 1) >= 2)
|
||||
{
|
||||
tmp = (tmp >> 1) - 2 + 7;
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp = (tmp & 3) + 21;
|
||||
}
|
||||
|
||||
cw = *(huffTable_5 + tmp);
|
||||
pMainData->usedBits -= (8 - (cw & 0xFF));
|
||||
|
||||
return(cw >> 8);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
uint16 pvmp3_decode_huff_cw_tab6(tmp3Bits *pMainData)
|
||||
{
|
||||
uint32 tmp;
|
||||
uint16 cw;
|
||||
|
||||
tmp = getUpTo9bits(pMainData, 7); /* huffTable_6 */
|
||||
if ((tmp >> 3) >= 3)
|
||||
{
|
||||
tmp = (tmp >> 3) - 3;
|
||||
}
|
||||
else if (tmp >> 1)
|
||||
{
|
||||
tmp = (tmp >> 1) - 1 + 13;
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp = tmp + 24;
|
||||
}
|
||||
|
||||
cw = *(huffTable_6 + tmp);
|
||||
pMainData->usedBits -= (7 - (cw & 0xFF));
|
||||
|
||||
return(cw >> 8);
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
uint16 pvmp3_decode_huff_cw_tab7(tmp3Bits *pMainData)
|
||||
{
|
||||
uint32 tmp;
|
||||
uint16 cw;
|
||||
|
||||
tmp = getUpTo17bits(pMainData, 10); /* huffTable_7 */
|
||||
if ((tmp >> 7) >= 2)
|
||||
{
|
||||
tmp = (tmp >> 7) - 2;
|
||||
}
|
||||
else if ((tmp >> 4) >= 7)
|
||||
{
|
||||
tmp = (tmp >> 4) - 7 + 6;
|
||||
}
|
||||
else if ((tmp >> 1) >= 2)
|
||||
{
|
||||
tmp = (tmp >> 1) - 2 + 15;
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp = (tmp & 3) + 69;
|
||||
}
|
||||
|
||||
cw = *(huffTable_7 + tmp);
|
||||
pMainData->usedBits -= (10 - (cw & 0xFF));
|
||||
|
||||
return(cw >> 8);
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
uint16 pvmp3_decode_huff_cw_tab8(tmp3Bits *pMainData)
|
||||
{
|
||||
uint32 tmp;
|
||||
uint16 cw;
|
||||
|
||||
tmp = getUpTo17bits(pMainData, 11); /* huffTable_8 */
|
||||
if ((tmp >> 7) >= 2)
|
||||
{
|
||||
tmp = (tmp >> 7) - 2;
|
||||
}
|
||||
else if ((tmp >> 5) >= 5)
|
||||
{
|
||||
tmp = (tmp >> 5) - 5 + 14;
|
||||
}
|
||||
else if ((tmp >> 2) >= 3)
|
||||
{
|
||||
tmp = (tmp >> 2) - 3 + 17;
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp = (tmp) + 54;
|
||||
}
|
||||
|
||||
cw = *(huffTable_8 + tmp);
|
||||
pMainData->usedBits -= (11 - (cw & 0xFF));
|
||||
|
||||
return(cw >> 8);
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
uint16 pvmp3_decode_huff_cw_tab9(tmp3Bits *pMainData)
|
||||
{
|
||||
uint32 tmp;
|
||||
uint16 cw;
|
||||
|
||||
tmp = getUpTo9bits(pMainData, 9); /* huffTable_9 */
|
||||
if ((tmp >> 5) >= 5)
|
||||
{
|
||||
tmp = (tmp >> 5) - 5;
|
||||
}
|
||||
else if ((tmp >> 3) >= 6)
|
||||
{
|
||||
tmp = (tmp >> 3) - 6 + 11;
|
||||
}
|
||||
else if ((tmp >> 1) >= 4)
|
||||
{
|
||||
tmp = (tmp >> 1) - 4 + 25;
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp = tmp + 45;
|
||||
}
|
||||
|
||||
cw = *(huffTable_9 + tmp);
|
||||
pMainData->usedBits -= (9 - (cw & 0xFF));
|
||||
|
||||
return(cw >> 8);
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
uint16 pvmp3_decode_huff_cw_tab10(tmp3Bits *pMainData)
|
||||
{
|
||||
uint32 tmp;
|
||||
uint16 cw;
|
||||
|
||||
tmp = getUpTo17bits(pMainData, 11); /* huffTable_10 */
|
||||
if (tmp >> 10)
|
||||
{
|
||||
tmp = (tmp >> 10) - 1;
|
||||
}
|
||||
else if ((tmp >> 7) >= 3)
|
||||
{
|
||||
tmp = (tmp >> 7) - 3 + 1;
|
||||
}
|
||||
else if ((tmp >> 5) >= 8)
|
||||
{
|
||||
tmp = (tmp >> 5) - 8 + 6;
|
||||
}
|
||||
else if ((tmp >> 3) >= 18)
|
||||
{
|
||||
tmp = (tmp >> 3) - 18 + 10;
|
||||
}
|
||||
else if ((tmp >> 2) >= 24)
|
||||
{
|
||||
tmp = (tmp >> 2) - 24 + 24;
|
||||
}
|
||||
else if ((tmp >> 1) >= 12)
|
||||
{
|
||||
tmp = (tmp >> 1) - 12 + 36;
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp = (tmp) + 72;
|
||||
}
|
||||
|
||||
cw = *(huffTable_10 + tmp);
|
||||
pMainData->usedBits -= (11 - (cw & 0xFF));
|
||||
|
||||
return(cw >> 8);
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
uint16 pvmp3_decode_huff_cw_tab11(tmp3Bits *pMainData)
|
||||
{
|
||||
uint32 tmp;
|
||||
uint16 cw;
|
||||
|
||||
tmp = getUpTo17bits(pMainData, 11); /* huffTable_11 */
|
||||
if ((tmp >> 8) >= 3)
|
||||
{
|
||||
tmp = (tmp >> 8) - 3;
|
||||
}
|
||||
else if ((tmp >> 6) >= 7)
|
||||
{
|
||||
tmp = (tmp >> 6) - 7 + 5;
|
||||
}
|
||||
else if ((tmp >> 3) >= 32)
|
||||
{
|
||||
tmp = (tmp >> 3) - 32 + 10;
|
||||
}
|
||||
else if ((tmp >> 2) >= 10)
|
||||
{
|
||||
tmp = (tmp >> 2) - 10 + 34;
|
||||
}
|
||||
else if ((tmp >> 1) >= 8)
|
||||
{
|
||||
tmp = (tmp >> 1) - 8 + 88;
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp = (tmp & 0xFF) + 100;
|
||||
}
|
||||
cw = *(huffTable_11 + tmp);
|
||||
pMainData->usedBits -= (11 - (cw & 0xFF));
|
||||
|
||||
return(cw >> 8);
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
uint16 pvmp3_decode_huff_cw_tab12(tmp3Bits *pMainData)
|
||||
{
|
||||
uint32 tmp;
|
||||
uint16 cw;
|
||||
|
||||
tmp = getUpTo17bits(pMainData, 10); /* huffTable_12 */
|
||||
if ((tmp >> 7) >= 5)
|
||||
{
|
||||
tmp = (tmp >> 7) - 5;
|
||||
}
|
||||
else if ((tmp >> 5) >= 12)
|
||||
{
|
||||
tmp = (tmp >> 5) - 12 + 3;
|
||||
}
|
||||
else if ((tmp >> 4) >= 17)
|
||||
{
|
||||
tmp = (tmp >> 4) - 17 + 11;
|
||||
}
|
||||
else if ((tmp >> 2) >= 32)
|
||||
{
|
||||
tmp = (tmp >> 2) - 32 + 18;
|
||||
}
|
||||
else if ((tmp >> 1) >= 16)
|
||||
{
|
||||
tmp = (tmp >> 1) - 16 + 54;
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp = (tmp & 0x1F) + 102;
|
||||
|
||||
}
|
||||
cw = *(huffTable_12 + tmp);
|
||||
pMainData->usedBits -= (10 - (cw & 0xFF));
|
||||
|
||||
return(cw >> 8);
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
uint16 pvmp3_decode_huff_cw_tab13(tmp3Bits *pMainData)
|
||||
{
|
||||
uint32 tmp;
|
||||
uint16 cw;
|
||||
|
||||
tmp = getNbits(pMainData, 19); /* huffTable_13 */
|
||||
if (tmp >> 18)
|
||||
{
|
||||
tmp = 0;
|
||||
}
|
||||
else if ((tmp >> 15) >= 4)
|
||||
{
|
||||
tmp = (tmp >> 15) - 4 + 1;
|
||||
}
|
||||
else if ((tmp >> 11) >= 32)
|
||||
{
|
||||
tmp = (tmp >> 11) - 32 + 5;
|
||||
}
|
||||
else if ((tmp >> 9) >= 64)
|
||||
{
|
||||
tmp = (tmp >> 9) - 64 + 37;
|
||||
}
|
||||
else if ((tmp >> 8) >= 64)
|
||||
{
|
||||
tmp = (tmp >> 8) - 64 + 101;
|
||||
}
|
||||
else if ((tmp >> 7) >= 64)
|
||||
{
|
||||
tmp = (tmp >> 7) - 64 + 165;
|
||||
}
|
||||
else if ((tmp >> 6) >= 32)
|
||||
{
|
||||
tmp = (tmp >> 6) - 32 + 229;
|
||||
}
|
||||
else if ((tmp >> 5) >= 32)
|
||||
{
|
||||
tmp = (tmp >> 5) - 32 + 325;
|
||||
}
|
||||
else if ((tmp >> 4) >= 32)
|
||||
{
|
||||
tmp = (tmp >> 4) - 32 + 357;
|
||||
}
|
||||
else if ((tmp >> 3) >= 32)
|
||||
{
|
||||
tmp = (tmp >> 3) - 32 + 389;
|
||||
}
|
||||
else if ((tmp >> 2) >= 2)
|
||||
{
|
||||
tmp = (tmp >> 2) - 2 + 421;
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp = (tmp & 0x7) + 483;
|
||||
}
|
||||
|
||||
cw = *(huffTable_13 + tmp);
|
||||
pMainData->usedBits -= (19 - (cw & 0xFF));
|
||||
|
||||
return(cw >> 8);
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
uint16 pvmp3_decode_huff_cw_tab15(tmp3Bits *pMainData)
|
||||
{
|
||||
uint32 tmp;
|
||||
uint16 cw;
|
||||
|
||||
tmp = getUpTo17bits(pMainData, 13); /* huffTable_15 */
|
||||
if ((tmp >> 9) >= 10)
|
||||
{
|
||||
tmp = (tmp >> 9) - 10;
|
||||
}
|
||||
else if ((tmp >> 6) >= 39)
|
||||
{
|
||||
tmp = (tmp >> 6) - 39 + 6;
|
||||
}
|
||||
else if ((tmp >> 4) >= 62)
|
||||
{
|
||||
tmp = (tmp >> 4) - 62 + 47;
|
||||
}
|
||||
else if ((tmp >> 3) >= 60)
|
||||
{
|
||||
tmp = (tmp >> 3) - 60 + 141;
|
||||
}
|
||||
else if ((tmp >> 2) >= 64)
|
||||
{
|
||||
tmp = (tmp >> 2) - 64 + 205;
|
||||
}
|
||||
else if ((tmp >> 1) >= 32)
|
||||
{
|
||||
tmp = (tmp >> 1) - 32 + 261;
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp = (tmp & 0x3f) + 357;
|
||||
}
|
||||
|
||||
cw = *(huffTable_15 + tmp);
|
||||
pMainData->usedBits -= (13 - (cw & 0xFF));
|
||||
|
||||
return(cw >> 8);
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
uint16 pvmp3_decode_huff_cw_tab16(tmp3Bits *pMainData)
|
||||
{
|
||||
uint32 tmp;
|
||||
uint16 cw;
|
||||
|
||||
tmp = getUpTo17bits(pMainData, 17); /* huffTable_16 */
|
||||
if (tmp >> 16)
|
||||
{
|
||||
tmp = 0;
|
||||
}
|
||||
else if ((tmp >> 13) >= 4)
|
||||
{
|
||||
tmp = (tmp >> 13) - 4 + 1;
|
||||
}
|
||||
else if ((tmp >> 9) >= 38)
|
||||
{
|
||||
tmp = (tmp >> 9) - 38 + 5;
|
||||
}
|
||||
else if ((tmp >> 7) >= 94)
|
||||
{
|
||||
tmp = (tmp >> 7) - 94 + 31;
|
||||
}
|
||||
else if ((tmp >> 5) >= 214)
|
||||
{
|
||||
tmp = (tmp >> 5) - 214 + 89;
|
||||
}
|
||||
else if ((tmp >> 3) >= 704)
|
||||
{
|
||||
if ((tmp >> 4) >= 384)
|
||||
{
|
||||
tmp = (tmp >> 4) - 384 + 315;
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp = (tmp >> 3) - 704 + 251;
|
||||
}
|
||||
}
|
||||
else if ((tmp >> 8) >= 14)
|
||||
{
|
||||
tmp = (tmp >> 8) - 14 + 359;
|
||||
}
|
||||
else if ((tmp) >= 3456)
|
||||
{
|
||||
if ((tmp >> 2) >= 868)
|
||||
{
|
||||
tmp = (tmp >> 2) - 868 + 383;
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp = (tmp) - 3456 + 367;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp = ((tmp >> 6) & 0x3f) + 411;
|
||||
}
|
||||
|
||||
cw = *(huffTable_16 + tmp);
|
||||
pMainData->usedBits -= (17 - (cw & 0xFF));
|
||||
|
||||
return(cw >> 8);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
uint16 pvmp3_decode_huff_cw_tab24(tmp3Bits *pMainData)
|
||||
{
|
||||
uint32 tmp;
|
||||
uint16 cw;
|
||||
|
||||
tmp = getUpTo17bits(pMainData, 12); /* huffTable_24 */
|
||||
if ((tmp >> 6) >= 41)
|
||||
{
|
||||
tmp = (tmp >> 6) - 41;
|
||||
}
|
||||
else if ((tmp >> 3) >= 218)
|
||||
{
|
||||
tmp = (tmp >> 3) - 218 + 23;
|
||||
}
|
||||
else if ((tmp >> 2) >= 336)
|
||||
{
|
||||
tmp = (tmp >> 2) - 336 + 133;
|
||||
}
|
||||
else if ((tmp >> 1) >= 520)
|
||||
{
|
||||
tmp = (tmp >> 1) - 520 + 233;
|
||||
}
|
||||
else if ((tmp) >= 1024)
|
||||
{
|
||||
tmp = (tmp) - 1024 + 385;
|
||||
}
|
||||
else if ((tmp >> 1) >= 352)
|
||||
{
|
||||
if ((tmp >> 8) == 3)
|
||||
{
|
||||
tmp = (tmp >> 8) - 3 + 433;
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp = (tmp >> 1) - 352 + 401;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp = ((tmp >> 4) & 0x3f) + 434;
|
||||
}
|
||||
|
||||
cw = *(huffTable_24 + tmp);
|
||||
pMainData->usedBits -= (12 - (cw & 0xFF));
|
||||
|
||||
return(cw >> 8);
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
uint16 pvmp3_decode_huff_cw_tab32(tmp3Bits *pMainData)
|
||||
{
|
||||
uint32 tmp = getUpTo9bits(pMainData, 6); /* huffTable_32 */
|
||||
if ((tmp >> 5))
|
||||
{
|
||||
pMainData->usedBits -= 5;
|
||||
return(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
uint16 cw = *(huffTable_32 + (tmp & 0x1f));
|
||||
pMainData->usedBits -= (6 - (cw & 0xFF));
|
||||
|
||||
return(cw >> 8);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
uint16 pvmp3_decode_huff_cw_tab33(tmp3Bits *pMainData)
|
||||
{
|
||||
|
||||
uint16 tmp = getUpTo9bits(pMainData, 4); /* huffTable_33 */
|
||||
|
||||
return((0x0f - tmp));
|
||||
}
|
||||
|
||||
114
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_decode_huff_cw.h
vendored
Normal file
114
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_decode_huff_cw.h
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: pvmp3_decode_huff_cw.h
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
Description:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef PVMP3_DECODE_HUFF_CW_H
|
||||
#define PVMP3_DECODE_HUFF_CW_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "pvmp3_audio_type_defs.h"
|
||||
#include "pvmp3_dec_defs.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
uint16 pvmp3_decode_huff_cw_tab0(tmp3Bits *);
|
||||
uint16 pvmp3_decode_huff_cw_tab1(tmp3Bits *);
|
||||
uint16 pvmp3_decode_huff_cw_tab2(tmp3Bits *);
|
||||
uint16 pvmp3_decode_huff_cw_tab3(tmp3Bits *);
|
||||
uint16 pvmp3_decode_huff_cw_tab5(tmp3Bits *);
|
||||
uint16 pvmp3_decode_huff_cw_tab6(tmp3Bits *);
|
||||
uint16 pvmp3_decode_huff_cw_tab7(tmp3Bits *);
|
||||
uint16 pvmp3_decode_huff_cw_tab8(tmp3Bits *);
|
||||
uint16 pvmp3_decode_huff_cw_tab9(tmp3Bits *);
|
||||
uint16 pvmp3_decode_huff_cw_tab10(tmp3Bits *);
|
||||
uint16 pvmp3_decode_huff_cw_tab11(tmp3Bits *);
|
||||
uint16 pvmp3_decode_huff_cw_tab12(tmp3Bits *);
|
||||
uint16 pvmp3_decode_huff_cw_tab13(tmp3Bits *);
|
||||
uint16 pvmp3_decode_huff_cw_tab15(tmp3Bits *);
|
||||
uint16 pvmp3_decode_huff_cw_tab16(tmp3Bits *);
|
||||
uint16 pvmp3_decode_huff_cw_tab24(tmp3Bits *);
|
||||
uint16 pvmp3_decode_huff_cw_tab32(tmp3Bits *);
|
||||
uint16 pvmp3_decode_huff_cw_tab33(tmp3Bits *);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#endif
|
||||
|
||||
452
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_dequantize_sample.cpp
vendored
Normal file
452
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_dequantize_sample.cpp
vendored
Normal file
@@ -0,0 +1,452 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: pvmp3_dequantize_sample.cpp
|
||||
|
||||
Functions:
|
||||
power_1_third
|
||||
pvmp3_dequantize_sample
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
|
||||
Description:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
power_1_third
|
||||
int32 power_1_third( int32 xx)
|
||||
|
||||
Input
|
||||
int32 xx, int32 in the [0, 8192] range
|
||||
|
||||
Returns
|
||||
|
||||
int32 xx^(1/3) int32 Q26 number representing
|
||||
the 1/3 power of the input
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
pvmp3_dequantize_sample
|
||||
|
||||
Input
|
||||
int32 is[SUBBANDS_NUMBER*FILTERBANK_BANDS],
|
||||
mp3ScaleFactors *scalefac, scale factor structure
|
||||
struct gr_info_s *gr_info, granule structure informatiom
|
||||
mp3Header *info mp3 header info
|
||||
|
||||
Returns
|
||||
|
||||
int32 is[SUBBANDS_NUMBER*FILTERBANK_BANDS], dequantize output as (.)^(4/3)
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION DESCRIPTION
|
||||
|
||||
dequantize sample
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REQUIREMENTS
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
|
||||
[1] ISO MPEG Audio Subgroup Software Simulation Group (1996)
|
||||
ISO 13818-3 MPEG-2 Audio Decoder - Lower Sampling Frequency Extension
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PSEUDO-CODE
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "pv_mp3dec_fxd_op.h"
|
||||
#include "pvmp3_dec_defs.h"
|
||||
#include "pvmp3_dequantize_sample.h"
|
||||
#include "pvmp3_normalize.h"
|
||||
#include "mp3_mem_funcs.h"
|
||||
#include "pvmp3_tables.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here. Include conditional
|
||||
; compile variables also.
|
||||
----------------------------------------------------------------------------*/
|
||||
#define Q30_fmt(a)(int32(double(0x40000000)*a))
|
||||
#define Q29_fmt(a)(int32(double(0x20000000)*a))
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL STORE/BUFFER/POINTER DEFINITIONS
|
||||
; Variable declaration - defined here and used outside this module
|
||||
----------------------------------------------------------------------------*/
|
||||
const int32 pretab[22] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 3, 2, 0};
|
||||
|
||||
const int32 pow_2_1_fourth[4] =
|
||||
{
|
||||
Q30_fmt(1.0), Q30_fmt(1.18920711500272),
|
||||
Q30_fmt(1.41421356237310), Q30_fmt(1.68179283050743)
|
||||
};
|
||||
|
||||
const int32 two_cubic_roots[7] =
|
||||
{
|
||||
Q29_fmt(0), Q29_fmt(1.25992104989487),
|
||||
Q29_fmt(1.58740105196820), Q29_fmt(2.00000000000000),
|
||||
Q29_fmt(2.51984209978975), Q29_fmt(3.17480210393640),
|
||||
Q29_fmt(3.99999999999999)
|
||||
};
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL FUNCTION REFERENCES
|
||||
; Declare functions defined elsewhere and referenced in this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
int32 power_1_third(int32 xx)
|
||||
{
|
||||
|
||||
if (xx <= 512)
|
||||
{
|
||||
return (power_one_third[xx] >> 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (xx >> 15)
|
||||
{
|
||||
return 0x7FFFFFFF; /* saturate any value over 32767 */
|
||||
}
|
||||
else
|
||||
{
|
||||
int32 x = xx;
|
||||
int32 m = 22 - pvmp3_normalize(xx);
|
||||
|
||||
xx >>= m;
|
||||
xx = (power_one_third[xx]) + (((power_one_third[xx+1] - power_one_third[xx]) >> m) * (x & ((1 << m) - 1)));
|
||||
return (fxp_mul32_Q30(xx, two_cubic_roots[m]));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
||||
void pvmp3_dequantize_sample(int32 is[SUBBANDS_NUMBER*FILTERBANK_BANDS],
|
||||
mp3ScaleFactors *scalefac,
|
||||
granuleInfo *gr_info,
|
||||
int32 used_freq_lines,
|
||||
mp3Header *info)
|
||||
{
|
||||
int32 ss;
|
||||
int32 cb = 0;
|
||||
int32 global_gain;
|
||||
int32 sfreq = info->sampling_frequency + info->version_x + (info->version_x << 1);
|
||||
|
||||
/* apply formula per block type */
|
||||
|
||||
if (gr_info->window_switching_flag && (gr_info->block_type == 2))
|
||||
{
|
||||
int32 next_cb_boundary;
|
||||
int32 cb_begin = 0;
|
||||
int32 cb_width = 0;
|
||||
int32 mixstart = 8; /* added 2003/08/21 efs */
|
||||
|
||||
if (info->version_x != MPEG_1)
|
||||
{
|
||||
mixstart = 6; /* different value in MPEG2 LSF */
|
||||
}
|
||||
|
||||
if (gr_info->mixed_block_flag)
|
||||
{
|
||||
next_cb_boundary = mp3_sfBandIndex[sfreq].l[1]; /* LONG blocks: 0,1,3 */
|
||||
}
|
||||
else
|
||||
{
|
||||
next_cb_boundary = mp3_sfBandIndex[sfreq].s[1] * 3; /* pure SHORT block */
|
||||
cb_width = 0;
|
||||
}
|
||||
|
||||
global_gain = gr_info->global_gain;
|
||||
int32 two_raise_one_fourth = pow_2_1_fourth[global_gain&0x3];
|
||||
global_gain = 12 + (global_gain >> 2);
|
||||
|
||||
for (ss = 0 ; ss < used_freq_lines ; ss++)
|
||||
{
|
||||
if (ss == next_cb_boundary)
|
||||
{
|
||||
cb++; /* critical band counter */
|
||||
if (gr_info->mixed_block_flag)
|
||||
{
|
||||
if (next_cb_boundary == mp3_sfBandIndex[sfreq].l[mixstart])
|
||||
{
|
||||
next_cb_boundary = mp3_sfBandIndex[sfreq].s[4] * 3;
|
||||
|
||||
cb_begin = mp3_sfBandIndex[sfreq].s[3] * 3;
|
||||
cb_width = 3;
|
||||
cb = 3;
|
||||
}
|
||||
else if (ss < mp3_sfBandIndex[sfreq].l[mixstart])
|
||||
{
|
||||
next_cb_boundary = mp3_sfBandIndex[sfreq].l[cb+1];
|
||||
}
|
||||
else
|
||||
{
|
||||
next_cb_boundary = mp3_sfBandIndex[sfreq].s[cb+1] * 3;
|
||||
|
||||
cb_width = cb;
|
||||
cb_begin = mp3_sfBandIndex[sfreq].s[cb] * 3;
|
||||
}
|
||||
|
||||
if (ss < 2*FILTERBANK_BANDS)
|
||||
{ /* 1st 2 subbands of switched blocks */
|
||||
global_gain = (gr_info->global_gain);
|
||||
global_gain -= (1 + gr_info->scalefac_scale) *
|
||||
(scalefac->l[cb] + gr_info->preflag * pretab[cb]) << 1;
|
||||
|
||||
two_raise_one_fourth = pow_2_1_fourth[global_gain&0x3];
|
||||
global_gain = 12 + (global_gain >> 2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
next_cb_boundary = mp3_sfBandIndex[sfreq].s[cb+1] * 3;
|
||||
cb_width = cb;
|
||||
cb_begin = mp3_sfBandIndex[sfreq].s[cb] * 3;
|
||||
}
|
||||
|
||||
} /* end-if ( ss == next_cb_boundary) */
|
||||
|
||||
/* Do long/short dependent scaling operations. */
|
||||
if ((gr_info->mixed_block_flag == 0) || (gr_info->mixed_block_flag && (ss >= 2*FILTERBANK_BANDS)))
|
||||
{
|
||||
int32 temp2 = fxp_mul32_Q32((ss - cb_begin) << 16, mp3_shortwindBandWidths[sfreq][cb_width]);
|
||||
temp2 = (temp2 + 1) >> 15;
|
||||
|
||||
global_gain = (gr_info->global_gain);
|
||||
global_gain -= gr_info->subblock_gain[temp2] << 3;
|
||||
global_gain -= (1 + gr_info->scalefac_scale) * (scalefac->s[temp2][cb] << 1);
|
||||
|
||||
two_raise_one_fourth = pow_2_1_fourth[global_gain&0x3];
|
||||
global_gain = 12 + (global_gain >> 2);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* xr[sb][ss] = 2^(global_gain/4)
|
||||
*/
|
||||
|
||||
/* Scale quantized value. */
|
||||
|
||||
/* 0 < abs(is[ss]) < 8192 */
|
||||
|
||||
int32 tmp = fxp_mul32_Q30((is[ss] << 16), power_1_third(pv_abs(is[ ss])));
|
||||
|
||||
tmp = fxp_mul32_Q30(tmp, two_raise_one_fourth);
|
||||
|
||||
if (global_gain < 0)
|
||||
{
|
||||
int32 temp = - global_gain;
|
||||
if (temp < 32)
|
||||
{
|
||||
is[ss] = (tmp >> temp);
|
||||
}
|
||||
else
|
||||
{
|
||||
is[ss] = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
is[ss] = (tmp << global_gain);
|
||||
}
|
||||
|
||||
} /* for (ss=0 ; ss < used_freq_lines ; ss++) */
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
for (cb = 0 ; cb < 22 ; cb++)
|
||||
{
|
||||
|
||||
/* Compute overall (global) scaling. */
|
||||
|
||||
global_gain = (gr_info->global_gain);
|
||||
|
||||
global_gain -= (1 + gr_info->scalefac_scale) *
|
||||
(scalefac->l[cb] + gr_info->preflag * pretab[cb]) << 1;
|
||||
|
||||
|
||||
int32 two_raise_one_fourth = pow_2_1_fourth[global_gain&0x3];
|
||||
global_gain = 12 + (global_gain >> 2);
|
||||
|
||||
/*
|
||||
* xr[sb][ss] = 2^(global_gain/4)
|
||||
*/
|
||||
|
||||
/* Scale quantized value. */
|
||||
|
||||
if (used_freq_lines >= mp3_sfBandIndex[sfreq].l[cb+1])
|
||||
{
|
||||
if (global_gain <= 0)
|
||||
{
|
||||
global_gain = - global_gain;
|
||||
if (global_gain < 32)
|
||||
{
|
||||
for (ss = mp3_sfBandIndex[sfreq].l[cb]; ss < mp3_sfBandIndex[sfreq].l[cb+1]; ss += 2)
|
||||
{
|
||||
int32 tmp = is[ss];
|
||||
if (tmp)
|
||||
{
|
||||
tmp = fxp_mul32_Q30((tmp << 16), power_1_third(pv_abs(tmp)));
|
||||
is[ss] = fxp_mul32_Q30(tmp, two_raise_one_fourth) >> global_gain;
|
||||
}
|
||||
tmp = is[ss+1];
|
||||
if (tmp)
|
||||
{
|
||||
tmp = fxp_mul32_Q30((tmp << 16), power_1_third(pv_abs(tmp)));
|
||||
is[ss+1] = fxp_mul32_Q30(tmp, two_raise_one_fourth) >> global_gain;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pv_memset(&is[ mp3_sfBandIndex[sfreq].l[cb]],
|
||||
0,
|
||||
(mp3_sfBandIndex[sfreq].l[cb+1] - mp3_sfBandIndex[sfreq].l[cb])*sizeof(*is));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (ss = mp3_sfBandIndex[sfreq].l[cb]; ss < mp3_sfBandIndex[sfreq].l[cb+1]; ss += 2)
|
||||
{
|
||||
int32 tmp = is[ss];
|
||||
if (tmp)
|
||||
{
|
||||
tmp = fxp_mul32_Q30((tmp << 16), power_1_third(pv_abs(tmp)));
|
||||
is[ss] = fxp_mul32_Q30(tmp, two_raise_one_fourth) << global_gain;
|
||||
}
|
||||
|
||||
tmp = is[ss+1];
|
||||
if (tmp)
|
||||
{
|
||||
tmp = fxp_mul32_Q30((tmp << 16), power_1_third(pv_abs(tmp)));
|
||||
is[ss+1] = fxp_mul32_Q30(tmp, two_raise_one_fourth) << global_gain;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (global_gain <= 0)
|
||||
{
|
||||
global_gain = - global_gain;
|
||||
if (global_gain < 32)
|
||||
{
|
||||
for (ss = mp3_sfBandIndex[sfreq].l[cb]; ss < used_freq_lines; ss += 2)
|
||||
{
|
||||
int32 tmp = is[ss];
|
||||
if (tmp)
|
||||
{
|
||||
tmp = fxp_mul32_Q30((tmp << 16), power_1_third(pv_abs(tmp)));
|
||||
is[ss] = fxp_mul32_Q30(tmp, two_raise_one_fourth) >> global_gain;
|
||||
}
|
||||
tmp = is[ss+1];
|
||||
if (tmp)
|
||||
{
|
||||
tmp = fxp_mul32_Q30((tmp << 16), power_1_third(pv_abs(tmp)));
|
||||
is[ss+1] = fxp_mul32_Q30(tmp, two_raise_one_fourth) >> global_gain;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
pv_memset(&is[ mp3_sfBandIndex[sfreq].l[cb]],
|
||||
0,
|
||||
(mp3_sfBandIndex[sfreq].l[cb+1] - mp3_sfBandIndex[sfreq].l[cb])*sizeof(*is));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (ss = mp3_sfBandIndex[sfreq].l[cb]; ss < used_freq_lines; ss++)
|
||||
{
|
||||
int32 tmp = is[ss];
|
||||
|
||||
if (tmp)
|
||||
{
|
||||
tmp = fxp_mul32_Q30((tmp << 16), power_1_third(pv_abs(tmp)));
|
||||
is[ss] = fxp_mul32_Q30(tmp, two_raise_one_fourth) << global_gain;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cb = 22; // force breaking out of the loop
|
||||
|
||||
} /* if ( used_freq_lines >= mp3_sfBandIndex[sfreq].l[cb+1]) */
|
||||
|
||||
} /* for (cb=0 ; cb < 22 ; cb++) */
|
||||
|
||||
} /* if (gr_info->window_switching_flag && (gr_info->block_type == 2)) */
|
||||
|
||||
|
||||
pv_memset(&is[used_freq_lines],
|
||||
0,
|
||||
(FILTERBANK_BANDS*SUBBANDS_NUMBER - used_freq_lines)*sizeof(*is));
|
||||
|
||||
}
|
||||
|
||||
106
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_dequantize_sample.h
vendored
Normal file
106
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_dequantize_sample.h
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: pvmp3_dequantize_sample.h
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
Description:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef PVMP3_DEQUANTIZE_SAMPLE_H
|
||||
#define PVMP3_DEQUANTIZE_SAMPLE_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "pvmp3_dec_defs.h"
|
||||
#include "pvmp3_audio_type_defs.h"
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
int32 power_1_third(int32 xx);
|
||||
|
||||
void pvmp3_dequantize_sample(int32 is[SUBBANDS_NUMBER*FILTERBANK_BANDS],
|
||||
mp3ScaleFactors *scalefac,
|
||||
granuleInfo *gr_info,
|
||||
int32 num_lines,
|
||||
mp3Header *info);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#endif
|
||||
|
||||
|
||||
415
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_equalizer.cpp
vendored
Normal file
415
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_equalizer.cpp
vendored
Normal file
@@ -0,0 +1,415 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: pvmp3_equalizer.cpp
|
||||
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
|
||||
Description:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Input
|
||||
int32 *inData, pointer to the spectrum frequency-line
|
||||
e_equalization equalizerType, equalization mode
|
||||
int32 *pt_work_buff
|
||||
|
||||
Output
|
||||
int32 *pt_work_buff pointer to the equalized frequency-line
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION DESCRIPTION
|
||||
|
||||
Equalizer
|
||||
Each subband sample is scaled according to a spectrum shape setting
|
||||
defined by "equalizerType"
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REQUIREMENTS
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PSEUDO-CODE
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "pvmp3_equalizer.h"
|
||||
#include "pv_mp3dec_fxd_op.h"
|
||||
#include "pvmp3_dec_defs.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here. Include conditional
|
||||
; compile variables also.
|
||||
----------------------------------------------------------------------------*/
|
||||
#define LEVEL__0__dB 0.999999970f
|
||||
#define LEVEL__1_5dB 0.841395142f
|
||||
#define LEVEL__3__dB 0.707106781f
|
||||
#define LEVEL__4_5dB 0.595662143f
|
||||
#define LEVEL__6__dB 0.500000000f
|
||||
#define LEVEL__7_5dB 0.421696503f
|
||||
#define LEVEL__9__dB 0.353553393f
|
||||
#define LEVEL_12__dB 0.250000000f
|
||||
#define LEVEL_15__dB 0.176776695f
|
||||
#define LEVEL_18__dB 0.125000000f
|
||||
#define LEVEL_21__dB 0.088388347f
|
||||
#define LEVEL_30__dB 0.031250000f
|
||||
#define LEVEL_45__dB 0.005524271f
|
||||
#define LEVEL_60__dB 0.000976562f
|
||||
|
||||
#define Qmf31( x) (int32)(x*(float)0x7FFFFFFF)
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL STORE/BUFFER/POINTER DEFINITIONS
|
||||
; Variable declaration - defined here and used outside this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
const int32 equalizerTbl[8][SUBBANDS_NUMBER] =
|
||||
{
|
||||
/* FLAT */
|
||||
{
|
||||
Qmf31(LEVEL__0__dB),
|
||||
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB)
|
||||
},
|
||||
/* BASS BOOST */
|
||||
{
|
||||
Qmf31(LEVEL__0__dB),
|
||||
|
||||
Qmf31(LEVEL__1_5dB), Qmf31(LEVEL__3__dB),
|
||||
|
||||
Qmf31(LEVEL__4_5dB), Qmf31(LEVEL__6__dB),
|
||||
Qmf31(LEVEL__6__dB), Qmf31(LEVEL__6__dB),
|
||||
|
||||
Qmf31(LEVEL__6__dB), Qmf31(LEVEL__6__dB),
|
||||
Qmf31(LEVEL__6__dB), Qmf31(LEVEL__6__dB),
|
||||
Qmf31(LEVEL__6__dB), Qmf31(LEVEL__6__dB),
|
||||
Qmf31(LEVEL__6__dB), Qmf31(LEVEL__6__dB),
|
||||
|
||||
Qmf31(LEVEL__6__dB), Qmf31(LEVEL__6__dB),
|
||||
Qmf31(LEVEL__6__dB), Qmf31(LEVEL__6__dB),
|
||||
Qmf31(LEVEL__6__dB), Qmf31(LEVEL__6__dB),
|
||||
Qmf31(LEVEL__6__dB), Qmf31(LEVEL__6__dB),
|
||||
Qmf31(LEVEL__6__dB), Qmf31(LEVEL__6__dB),
|
||||
Qmf31(LEVEL__6__dB), Qmf31(LEVEL__6__dB),
|
||||
Qmf31(LEVEL__6__dB), Qmf31(LEVEL__6__dB),
|
||||
Qmf31(LEVEL__6__dB), Qmf31(LEVEL__6__dB),
|
||||
Qmf31(LEVEL__6__dB)
|
||||
},
|
||||
/* ROCK */
|
||||
{
|
||||
Qmf31(LEVEL__0__dB),
|
||||
|
||||
Qmf31(LEVEL__1_5dB), Qmf31(LEVEL__3__dB),
|
||||
|
||||
Qmf31(LEVEL__4_5dB), Qmf31(LEVEL__6__dB),
|
||||
Qmf31(LEVEL__6__dB), Qmf31(LEVEL__6__dB),
|
||||
|
||||
Qmf31(LEVEL__3__dB), Qmf31(LEVEL__3__dB),
|
||||
Qmf31(LEVEL__3__dB), Qmf31(LEVEL__3__dB),
|
||||
Qmf31(LEVEL__3__dB), Qmf31(LEVEL__3__dB),
|
||||
Qmf31(LEVEL__3__dB), Qmf31(LEVEL__1_5dB),
|
||||
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB)
|
||||
},
|
||||
/* POP */
|
||||
{
|
||||
Qmf31(LEVEL__6__dB),
|
||||
|
||||
Qmf31(LEVEL__3__dB), Qmf31(LEVEL__3__dB),
|
||||
|
||||
Qmf31(LEVEL__1_5dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
|
||||
Qmf31(LEVEL__3__dB), Qmf31(LEVEL__3__dB),
|
||||
Qmf31(LEVEL__3__dB), Qmf31(LEVEL__3__dB),
|
||||
Qmf31(LEVEL__3__dB), Qmf31(LEVEL__3__dB),
|
||||
Qmf31(LEVEL__3__dB), Qmf31(LEVEL__3__dB),
|
||||
|
||||
Qmf31(LEVEL__9__dB), Qmf31(LEVEL__9__dB),
|
||||
Qmf31(LEVEL__9__dB), Qmf31(LEVEL__9__dB),
|
||||
Qmf31(LEVEL__9__dB), Qmf31(LEVEL__9__dB),
|
||||
Qmf31(LEVEL__9__dB), Qmf31(LEVEL__9__dB),
|
||||
Qmf31(LEVEL__9__dB), Qmf31(LEVEL__9__dB),
|
||||
Qmf31(LEVEL__9__dB), Qmf31(LEVEL__9__dB),
|
||||
Qmf31(LEVEL__9__dB), Qmf31(LEVEL__9__dB),
|
||||
Qmf31(LEVEL__9__dB), Qmf31(LEVEL__9__dB),
|
||||
Qmf31(LEVEL__9__dB)
|
||||
},
|
||||
/* JAZZ */
|
||||
{
|
||||
Qmf31(LEVEL__0__dB),
|
||||
|
||||
Qmf31(LEVEL__6__dB), Qmf31(LEVEL__6__dB),
|
||||
|
||||
Qmf31(LEVEL__9__dB), Qmf31(LEVEL__9__dB),
|
||||
Qmf31(LEVEL__9__dB), Qmf31(LEVEL__9__dB),
|
||||
|
||||
Qmf31(LEVEL__3__dB), Qmf31(LEVEL__3__dB),
|
||||
Qmf31(LEVEL__3__dB), Qmf31(LEVEL__3__dB),
|
||||
Qmf31(LEVEL__3__dB), Qmf31(LEVEL__3__dB),
|
||||
Qmf31(LEVEL__3__dB), Qmf31(LEVEL__1_5dB),
|
||||
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB)
|
||||
},
|
||||
/* CLASSICAL */
|
||||
{
|
||||
Qmf31(LEVEL__0__dB),
|
||||
|
||||
Qmf31(LEVEL__9__dB), Qmf31(LEVEL__9__dB),
|
||||
|
||||
Qmf31(LEVEL__9__dB), Qmf31(LEVEL__9__dB),
|
||||
Qmf31(LEVEL__9__dB), Qmf31(LEVEL__9__dB),
|
||||
|
||||
Qmf31(LEVEL__3__dB), Qmf31(LEVEL__3__dB),
|
||||
Qmf31(LEVEL__3__dB), Qmf31(LEVEL__3__dB),
|
||||
Qmf31(LEVEL__3__dB), Qmf31(LEVEL__3__dB),
|
||||
Qmf31(LEVEL__3__dB), Qmf31(LEVEL__1_5dB),
|
||||
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB)
|
||||
},
|
||||
/* TALK */
|
||||
{
|
||||
Qmf31(LEVEL__9__dB),
|
||||
|
||||
Qmf31(LEVEL__6__dB), Qmf31(LEVEL__6__dB),
|
||||
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__1_5dB),
|
||||
|
||||
Qmf31(LEVEL__3__dB), Qmf31(LEVEL__3__dB),
|
||||
Qmf31(LEVEL__3__dB), Qmf31(LEVEL__3__dB),
|
||||
Qmf31(LEVEL__3__dB), Qmf31(LEVEL__3__dB),
|
||||
Qmf31(LEVEL__3__dB), Qmf31(LEVEL__3__dB),
|
||||
Qmf31(LEVEL__3__dB), Qmf31(LEVEL__3__dB),
|
||||
Qmf31(LEVEL__3__dB), Qmf31(LEVEL__3__dB),
|
||||
Qmf31(LEVEL__3__dB), Qmf31(LEVEL__3__dB),
|
||||
Qmf31(LEVEL__3__dB), Qmf31(LEVEL__3__dB),
|
||||
Qmf31(LEVEL__3__dB)
|
||||
},
|
||||
/* FLAT */
|
||||
{
|
||||
Qmf31(LEVEL__0__dB),
|
||||
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB), Qmf31(LEVEL__0__dB),
|
||||
Qmf31(LEVEL__0__dB)
|
||||
}
|
||||
};
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL FUNCTION REFERENCES
|
||||
; Declare functions defined elsewhere and referenced in this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
void pvmp3_equalizer(int32 *circ_buffer,
|
||||
e_equalization equalizerType,
|
||||
int32 *work_buff)
|
||||
{
|
||||
|
||||
if (equalizerType == flat)
|
||||
{
|
||||
for (int32 band = 0; band < FILTERBANK_BANDS; band += 2)
|
||||
{
|
||||
|
||||
int32 *pt_work_buff = &work_buff[band];
|
||||
int32 *inData = &circ_buffer[544 - (band<<5)];
|
||||
|
||||
int32 i;
|
||||
for (i = 0; i < SUBBANDS_NUMBER*FILTERBANK_BANDS; i += FILTERBANK_BANDS << 2)
|
||||
{
|
||||
int32 temp1 = (pt_work_buff[ i ]);
|
||||
int32 temp2 = (pt_work_buff[ i + FILTERBANK_BANDS ]);
|
||||
int32 temp3 = (pt_work_buff[ i + 2*FILTERBANK_BANDS ]);
|
||||
int32 temp4 = (pt_work_buff[ i + 3*FILTERBANK_BANDS ]);
|
||||
*(inData++) = temp1;
|
||||
*(inData++) = temp2;
|
||||
*(inData++) = temp3;
|
||||
*(inData++) = temp4;
|
||||
}
|
||||
|
||||
inData -= SUBBANDS_NUMBER << 1;
|
||||
pt_work_buff++;
|
||||
|
||||
for (i = 0; i < SUBBANDS_NUMBER*FILTERBANK_BANDS; i += FILTERBANK_BANDS << 2)
|
||||
{
|
||||
int32 temp1 = (pt_work_buff[ i ]);
|
||||
int32 temp2 = (pt_work_buff[ i + FILTERBANK_BANDS ]);
|
||||
int32 temp3 = (pt_work_buff[ i + 2*FILTERBANK_BANDS ]);
|
||||
int32 temp4 = (pt_work_buff[ i + 3*FILTERBANK_BANDS ]);
|
||||
*(inData++) = temp1;
|
||||
*(inData++) = temp2;
|
||||
*(inData++) = temp3;
|
||||
*(inData++) = temp4;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const int32 *pt_equalizer = equalizerTbl[equalizerType&7];
|
||||
|
||||
|
||||
for (int32 band = 0; band < FILTERBANK_BANDS; band += 3)
|
||||
{
|
||||
int32 *inData = &circ_buffer[544 - (band<<5)];
|
||||
|
||||
int32 *pt_work_buff = &work_buff[band];
|
||||
int32 i;
|
||||
|
||||
for (i = 0; i < SUBBANDS_NUMBER*FILTERBANK_BANDS; i += FILTERBANK_BANDS << 2)
|
||||
{
|
||||
int32 temp1 = (pt_work_buff[ i ]);
|
||||
int32 temp2 = (pt_work_buff[ i + FILTERBANK_BANDS ]);
|
||||
int32 temp3 = (pt_work_buff[ i + 2*FILTERBANK_BANDS ]);
|
||||
int32 temp4 = (pt_work_buff[ i + 3*FILTERBANK_BANDS ]);
|
||||
*(inData++) = fxp_mul32_Q32(temp1 << 1, *(pt_equalizer++));
|
||||
*(inData++) = fxp_mul32_Q32(temp2 << 1, *(pt_equalizer++));
|
||||
*(inData++) = fxp_mul32_Q32(temp3 << 1, *(pt_equalizer++));
|
||||
*(inData++) = fxp_mul32_Q32(temp4 << 1, *(pt_equalizer++));
|
||||
}
|
||||
|
||||
pt_equalizer -= SUBBANDS_NUMBER;
|
||||
|
||||
inData -= SUBBANDS_NUMBER << 1;
|
||||
pt_work_buff++;
|
||||
|
||||
for (i = 0; i < SUBBANDS_NUMBER*FILTERBANK_BANDS; i += FILTERBANK_BANDS << 2)
|
||||
{
|
||||
int32 temp1 = (pt_work_buff[ i ]);
|
||||
int32 temp2 = (pt_work_buff[ i + FILTERBANK_BANDS ]);
|
||||
int32 temp3 = (pt_work_buff[ i + 2*FILTERBANK_BANDS ]);
|
||||
int32 temp4 = (pt_work_buff[ i + 3*FILTERBANK_BANDS ]);
|
||||
*(inData++) = fxp_mul32_Q32(temp1 << 1, *(pt_equalizer++));
|
||||
*(inData++) = fxp_mul32_Q32(temp2 << 1, *(pt_equalizer++));
|
||||
*(inData++) = fxp_mul32_Q32(temp3 << 1, *(pt_equalizer++));
|
||||
*(inData++) = fxp_mul32_Q32(temp4 << 1, *(pt_equalizer++));
|
||||
}
|
||||
pt_equalizer -= SUBBANDS_NUMBER;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
101
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_equalizer.h
vendored
Normal file
101
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_equalizer.h
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: pvmp3_equalizer.h
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
Description:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef PVMP3_EQUALIZER_H
|
||||
#define PVMP3_EQUALIZER_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "pvmp3_audio_type_defs.h"
|
||||
#include "pvmp3decoder_api.h"
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
void pvmp3_equalizer(int32 *inData,
|
||||
e_equalization equalizerType,
|
||||
int32 *pt_work_buff);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#endif
|
||||
|
||||
834
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_framedecoder.cpp
vendored
Normal file
834
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_framedecoder.cpp
vendored
Normal file
@@ -0,0 +1,834 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: pvmp3_framedecoder.cpp
|
||||
|
||||
Functions:
|
||||
pvmp3_framedecoder
|
||||
pvmp3_InitDecoder
|
||||
pvmp3_resetDecoder
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
|
||||
Description:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Input
|
||||
pExt = pointer to the external interface structure. See the file
|
||||
pvmp3decoder_api.h for a description of each field.
|
||||
Data type of pointer to a tPVMP3DecoderExternal
|
||||
structure.
|
||||
|
||||
pMem = void pointer to hide the internal implementation of the library
|
||||
It is cast back to a tmp3dec_file structure. This structure
|
||||
contains information that needs to persist between calls to
|
||||
this function, or is too big to be placed on the stack, even
|
||||
though the data is only needed during execution of this function
|
||||
Data type void pointer, internally pointer to a tmp3dec_file
|
||||
structure.
|
||||
|
||||
|
||||
Outputs:
|
||||
status = ERROR condition. see structure ERROR_CODE
|
||||
|
||||
Pointers and Buffers Modified:
|
||||
pMem contents are modified.
|
||||
pExt: (more detail in the file pvmp3decoder_api.h)
|
||||
inputBufferUsedLength - number of array elements used up by the stream.
|
||||
samplingRate - sampling rate in samples per sec
|
||||
bitRate - bit rate in bits per second, varies frame to frame.
|
||||
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTIONS DESCRIPTION
|
||||
|
||||
pvmp3_framedecoder
|
||||
frame decoder library driver
|
||||
pvmp3_InitDecoder
|
||||
Decoder Initialization
|
||||
pvmp3_resetDecoder
|
||||
Reset Decoder
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REQUIREMENTS
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
|
||||
[1] ISO MPEG Audio Subgroup Software Simulation Group (1996)
|
||||
ISO 13818-3 MPEG-2 Audio Decoder - Lower Sampling Frequency Extension
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PSEUDO-CODE
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#include "pvmp3_framedecoder.h"
|
||||
#include "pvmp3_dec_defs.h"
|
||||
#include "pvmp3_poly_phase_synthesis.h"
|
||||
#include "pvmp3_tables.h"
|
||||
#include "pvmp3_imdct_synth.h"
|
||||
#include "pvmp3_alias_reduction.h"
|
||||
#include "pvmp3_reorder.h"
|
||||
#include "pvmp3_dequantize_sample.h"
|
||||
#include "pvmp3_stereo_proc.h"
|
||||
#include "pvmp3_mpeg2_stereo_proc.h"
|
||||
#include "pvmp3_get_side_info.h"
|
||||
#include "pvmp3_get_scale_factors.h"
|
||||
#include "pvmp3_mpeg2_get_scale_factors.h"
|
||||
#include "pvmp3_decode_header.h"
|
||||
#include "pvmp3_get_main_data_size.h"
|
||||
#include "s_tmp3dec_file.h"
|
||||
#include "pvmp3_getbits.h"
|
||||
#include "mp3_mem_funcs.h"
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here. Include conditional
|
||||
; compile variables also.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL STORE/BUFFER/POINTER DEFINITIONS
|
||||
; Variable declaration - defined here and used outside this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL FUNCTION REFERENCES
|
||||
; Declare functions defined elsewhere and referenced in this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
ERROR_CODE pvmp3_framedecoder(tPVMP3DecoderExternal *pExt,
|
||||
void *pMem)
|
||||
{
|
||||
|
||||
ERROR_CODE errorCode = NO_DECODING_ERROR;
|
||||
|
||||
int32 crc_error_count = 0;
|
||||
uint32 sent_crc = 0;
|
||||
uint32 computed_crc = 0;
|
||||
|
||||
tmp3dec_chan *pChVars[CHAN];
|
||||
tmp3dec_file *pVars = (tmp3dec_file *)pMem;
|
||||
|
||||
mp3Header info_data;
|
||||
mp3Header *info = &info_data;
|
||||
|
||||
pVars->inputStream.pBuffer = pExt->pInputBuffer;
|
||||
|
||||
|
||||
pVars->inputStream.usedBits = pExt->inputBufferUsedLength << 3;
|
||||
pVars->inputStream.inputBufferCurrentLength = pExt->inputBufferCurrentLength;
|
||||
|
||||
|
||||
errorCode = pvmp3_decode_header(&pVars->inputStream,
|
||||
info,
|
||||
&computed_crc);
|
||||
|
||||
if (errorCode != NO_DECODING_ERROR)
|
||||
{
|
||||
pExt->outputFrameSize = 0;
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
pVars->num_channels = (info->mode == MPG_MD_MONO) ? 1 : 2;
|
||||
pExt->num_channels = pVars->num_channels;
|
||||
|
||||
int32 outputFrameSize = (info->version_x == MPEG_1) ?
|
||||
2 * SUBBANDS_NUMBER * FILTERBANK_BANDS :
|
||||
SUBBANDS_NUMBER * FILTERBANK_BANDS;
|
||||
|
||||
outputFrameSize = (info->mode == MPG_MD_MONO) ? outputFrameSize : outputFrameSize << 1;
|
||||
|
||||
|
||||
/*
|
||||
* Check if output buffer has enough room to hold output PCM
|
||||
*/
|
||||
if (pExt->outputFrameSize >= outputFrameSize)
|
||||
{
|
||||
pExt->outputFrameSize = outputFrameSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
pExt->outputFrameSize = 0;
|
||||
return OUTPUT_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
||||
|
||||
pChVars[ LEFT] = &pVars->perChan[ LEFT];
|
||||
pChVars[RIGHT] = &pVars->perChan[RIGHT];
|
||||
|
||||
|
||||
|
||||
|
||||
if (info->error_protection)
|
||||
{
|
||||
/*
|
||||
* Get crc content
|
||||
*/
|
||||
sent_crc = getUpTo17bits(&pVars->inputStream, 16);
|
||||
}
|
||||
|
||||
|
||||
if (info->layer_description == 3)
|
||||
{
|
||||
int32 gr;
|
||||
int32 ch;
|
||||
uint32 main_data_end;
|
||||
int32 bytes_to_discard;
|
||||
int16 *ptrOutBuffer = pExt->pOutputBuffer;
|
||||
|
||||
/*
|
||||
* Side Information must be extracted from the bitstream and store for use
|
||||
* during the decoded of the associated frame
|
||||
*/
|
||||
|
||||
errorCode = pvmp3_get_side_info(&pVars->inputStream,
|
||||
&pVars->sideInfo,
|
||||
info,
|
||||
&computed_crc);
|
||||
|
||||
if (errorCode != NO_DECODING_ERROR)
|
||||
{
|
||||
pExt->outputFrameSize = 0;
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
/*
|
||||
* If CRC was sent, check that matches the one got while parsing data
|
||||
* disable crc if this is the desired mode
|
||||
*/
|
||||
if (info->error_protection)
|
||||
{
|
||||
if ((computed_crc != sent_crc) && pExt->crcEnabled)
|
||||
{
|
||||
crc_error_count++;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* main data (scalefactors, Huffman coded, etc,) are not necessarily located
|
||||
* adjacent to the side-info. Beginning of main data is located using
|
||||
* field "main_data_begin" of the current frame. The length does not include
|
||||
* header and side info.
|
||||
* "main_data_begin" points to the first bit of main data of a frame. It is a negative
|
||||
* offset in bytes from the first byte of the sync word
|
||||
* main_data_begin = 0 <===> main data start rigth after side info.
|
||||
*/
|
||||
|
||||
int32 temp = pvmp3_get_main_data_size(info, pVars);
|
||||
|
||||
|
||||
/*
|
||||
* Check if available data holds a full frame, if not flag an error
|
||||
*/
|
||||
|
||||
if ((uint32)pVars->predicted_frame_size > pVars->inputStream.inputBufferCurrentLength)
|
||||
{
|
||||
pExt->outputFrameSize = 0;
|
||||
return NO_ENOUGH_MAIN_DATA_ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
* Fill in internal circular buffer
|
||||
*/
|
||||
fillMainDataBuf(pVars, temp);
|
||||
|
||||
|
||||
main_data_end = pVars->mainDataStream.usedBits >> 3; /* in bytes */
|
||||
if ((main_data_end << 3) < pVars->mainDataStream.usedBits)
|
||||
{
|
||||
main_data_end++;
|
||||
pVars->mainDataStream.usedBits = main_data_end << 3;
|
||||
}
|
||||
|
||||
|
||||
bytes_to_discard = pVars->frame_start - pVars->sideInfo.main_data_begin - main_data_end;
|
||||
|
||||
|
||||
if (main_data_end > BUFSIZE) /* check overflow on the buffer */
|
||||
{
|
||||
pVars->frame_start -= BUFSIZE;
|
||||
|
||||
pVars->mainDataStream.usedBits -= (BUFSIZE << 3);
|
||||
}
|
||||
|
||||
pVars->frame_start += temp;
|
||||
|
||||
|
||||
if (bytes_to_discard < 0 || crc_error_count)
|
||||
{
|
||||
/*
|
||||
* Not enough data to decode, then we should avoid reading this
|
||||
* data ( getting/ignoring sido info and scale data)
|
||||
* Main data could be located in the previous frame, so an unaccounted
|
||||
* frame can cause incorrect processing
|
||||
* Just run the polyphase filter to "clean" the history buffer
|
||||
*/
|
||||
errorCode = NO_ENOUGH_MAIN_DATA_ERROR;
|
||||
|
||||
/*
|
||||
* Clear the input to these filters
|
||||
*/
|
||||
|
||||
pv_memset((void*)pChVars[RIGHT]->work_buf_int32,
|
||||
0,
|
||||
SUBBANDS_NUMBER*FILTERBANK_BANDS*sizeof(pChVars[RIGHT]->work_buf_int32[0]));
|
||||
|
||||
pv_memset((void*)pChVars[LEFT]->work_buf_int32,
|
||||
0,
|
||||
SUBBANDS_NUMBER*FILTERBANK_BANDS*sizeof(pChVars[LEFT]->work_buf_int32[0]));
|
||||
|
||||
/* clear circular buffers, to avoid any glitch */
|
||||
pv_memset((void*)&pChVars[ LEFT]->circ_buffer[576],
|
||||
0,
|
||||
480*sizeof(pChVars[ LEFT]->circ_buffer[0]));
|
||||
pv_memset((void*)&pChVars[RIGHT]->circ_buffer[576],
|
||||
0,
|
||||
480*sizeof(pChVars[RIGHT]->circ_buffer[0]));
|
||||
|
||||
pChVars[ LEFT]->used_freq_lines = 575;
|
||||
pChVars[RIGHT]->used_freq_lines = 575;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
pVars->mainDataStream.usedBits += (bytes_to_discard << 3);
|
||||
}
|
||||
|
||||
/*
|
||||
* if (fr_ps->header->version_x == MPEG_1), use 2 granules, otherwise just 1
|
||||
*/
|
||||
for (gr = 0; gr < (1 + !(info->version_x)); gr++)
|
||||
{
|
||||
if (errorCode != NO_ENOUGH_MAIN_DATA_ERROR)
|
||||
{
|
||||
for (ch = 0; ch < pVars->num_channels; ch++)
|
||||
{
|
||||
int32 part2_start = pVars->mainDataStream.usedBits;
|
||||
|
||||
if (info->version_x == MPEG_1)
|
||||
{
|
||||
|
||||
pvmp3_get_scale_factors(&pVars->scaleFactors[ch],
|
||||
&pVars->sideInfo,
|
||||
gr,
|
||||
ch,
|
||||
&pVars->mainDataStream);
|
||||
}
|
||||
else
|
||||
{
|
||||
int32 * tmp = pVars->Scratch_mem;
|
||||
pvmp3_mpeg2_get_scale_factors(&pVars->scaleFactors[ch],
|
||||
&pVars->sideInfo,
|
||||
gr,
|
||||
ch,
|
||||
info,
|
||||
(uint32 *)tmp,
|
||||
&pVars->mainDataStream);
|
||||
}
|
||||
|
||||
pChVars[ch]->used_freq_lines = pvmp3_huffman_parsing(pChVars[ch]->work_buf_int32,
|
||||
&pVars->sideInfo.ch[ch].gran[gr],
|
||||
pVars,
|
||||
part2_start,
|
||||
info);
|
||||
|
||||
|
||||
pvmp3_dequantize_sample(pChVars[ch]->work_buf_int32,
|
||||
&pVars->scaleFactors[ch],
|
||||
&pVars->sideInfo.ch[ch].gran[gr],
|
||||
pChVars[ch]->used_freq_lines,
|
||||
info);
|
||||
|
||||
|
||||
|
||||
|
||||
} /* for (ch=0; ch<stereo; ch++) */
|
||||
|
||||
if (pVars->num_channels == 2)
|
||||
{
|
||||
|
||||
int32 used_freq_lines = (pChVars[ LEFT]->used_freq_lines >
|
||||
pChVars[RIGHT]->used_freq_lines) ?
|
||||
pChVars[ LEFT]->used_freq_lines :
|
||||
pChVars[RIGHT]->used_freq_lines;
|
||||
|
||||
pChVars[ LEFT]->used_freq_lines = used_freq_lines;
|
||||
pChVars[RIGHT]->used_freq_lines = used_freq_lines;
|
||||
|
||||
if (info->version_x == MPEG_1)
|
||||
{
|
||||
pvmp3_stereo_proc(pChVars[ LEFT]->work_buf_int32,
|
||||
pChVars[RIGHT]->work_buf_int32,
|
||||
&pVars->scaleFactors[RIGHT],
|
||||
&pVars->sideInfo.ch[LEFT].gran[gr],
|
||||
used_freq_lines,
|
||||
info);
|
||||
}
|
||||
else
|
||||
{
|
||||
int32 * tmp = pVars->Scratch_mem;
|
||||
pvmp3_mpeg2_stereo_proc(pChVars[ LEFT]->work_buf_int32,
|
||||
pChVars[RIGHT]->work_buf_int32,
|
||||
&pVars->scaleFactors[RIGHT],
|
||||
&pVars->sideInfo.ch[ LEFT].gran[gr],
|
||||
&pVars->sideInfo.ch[RIGHT].gran[gr],
|
||||
(uint32 *)tmp,
|
||||
used_freq_lines,
|
||||
info);
|
||||
}
|
||||
}
|
||||
|
||||
} /* if ( errorCode != NO_ENOUGH_MAIN_DATA_ERROR) */
|
||||
|
||||
for (ch = 0; ch < pVars->num_channels; ch++)
|
||||
{
|
||||
|
||||
pvmp3_reorder(pChVars[ch]->work_buf_int32,
|
||||
&pVars->sideInfo.ch[ch].gran[gr],
|
||||
&pChVars[ ch]->used_freq_lines,
|
||||
info,
|
||||
pVars->Scratch_mem);
|
||||
|
||||
pvmp3_alias_reduction(pChVars[ch]->work_buf_int32,
|
||||
&pVars->sideInfo.ch[ch].gran[gr],
|
||||
&pChVars[ ch]->used_freq_lines,
|
||||
info);
|
||||
|
||||
|
||||
/*
|
||||
* IMDCT
|
||||
*/
|
||||
/* set mxposition
|
||||
* In case of mixed blocks, # of bands with long
|
||||
* blocks (2 or 4) else 0
|
||||
*/
|
||||
uint16 mixedBlocksLongBlocks = 0; /* 0 = long or short, 2=mixed, 4=mixed 2.5@8000 */
|
||||
if (pVars->sideInfo.ch[ch].gran[gr].mixed_block_flag &&
|
||||
pVars->sideInfo.ch[ch].gran[gr].window_switching_flag)
|
||||
{
|
||||
if ((info->version_x == MPEG_2_5) && (info->sampling_frequency == 2))
|
||||
{
|
||||
mixedBlocksLongBlocks = 4; /* mpeg2.5 @ 8 KHz */
|
||||
}
|
||||
else
|
||||
{
|
||||
mixedBlocksLongBlocks = 2;
|
||||
}
|
||||
}
|
||||
|
||||
pvmp3_imdct_synth(pChVars[ch]->work_buf_int32,
|
||||
pChVars[ch]->overlap,
|
||||
pVars->sideInfo.ch[ch].gran[gr].block_type,
|
||||
mixedBlocksLongBlocks,
|
||||
pChVars[ ch]->used_freq_lines,
|
||||
pVars->Scratch_mem);
|
||||
|
||||
|
||||
/*
|
||||
* Polyphase synthesis
|
||||
*/
|
||||
|
||||
pvmp3_poly_phase_synthesis(pChVars[ch],
|
||||
pVars->num_channels,
|
||||
pExt->equalizerType,
|
||||
&ptrOutBuffer[ch]);
|
||||
|
||||
|
||||
}/* end ch loop */
|
||||
|
||||
ptrOutBuffer += pVars->num_channels * SUBBANDS_NUMBER * FILTERBANK_BANDS;
|
||||
} /* for (gr=0;gr<Max_gr;gr++) */
|
||||
|
||||
/* skip ancillary data */
|
||||
if (info->bitrate_index > 0)
|
||||
{ /* if not free-format */
|
||||
|
||||
int32 ancillary_data_lenght = pVars->predicted_frame_size << 3;
|
||||
|
||||
ancillary_data_lenght -= pVars->inputStream.usedBits;
|
||||
|
||||
/* skip ancillary data */
|
||||
if (ancillary_data_lenght > 0)
|
||||
{
|
||||
pVars->inputStream.usedBits += ancillary_data_lenght;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* This overrides a possible NO_ENOUGH_MAIN_DATA_ERROR
|
||||
*/
|
||||
errorCode = NO_DECODING_ERROR;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* The info on the header leads to an unsupported layer, more data
|
||||
* will not fix this, so this is a bad frame,
|
||||
*/
|
||||
|
||||
pExt->outputFrameSize = 0;
|
||||
return UNSUPPORTED_LAYER;
|
||||
}
|
||||
|
||||
pExt->inputBufferUsedLength = pVars->inputStream.usedBits >> 3;
|
||||
pExt->totalNumberOfBitsUsed += pVars->inputStream.usedBits;
|
||||
pExt->version = info->version_x;
|
||||
pExt->samplingRate = mp3_s_freq[info->version_x][info->sampling_frequency];
|
||||
pExt->bitRate = mp3_bitrate[pExt->version][info->bitrate_index];
|
||||
|
||||
|
||||
/*
|
||||
* Always verify buffer overrun condition
|
||||
*/
|
||||
|
||||
if (pExt->inputBufferUsedLength > pExt->inputBufferCurrentLength)
|
||||
{
|
||||
pExt->outputFrameSize = 0;
|
||||
errorCode = NO_ENOUGH_MAIN_DATA_ERROR;
|
||||
}
|
||||
|
||||
return errorCode;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
__inline void fillDataBuf(tmp3Bits *pMainData,
|
||||
uint32 val) /* val to write into the buffer */
|
||||
{
|
||||
pMainData->pBuffer[module(pMainData->offset++, BUFSIZE)] = (uint8)val;
|
||||
}
|
||||
|
||||
|
||||
void fillMainDataBuf(void *pMem, int32 temp)
|
||||
{
|
||||
tmp3dec_file *pVars = (tmp3dec_file *)pMem;
|
||||
|
||||
|
||||
int32 offset = (pVars->inputStream.usedBits) >> INBUF_ARRAY_INDEX_SHIFT;
|
||||
|
||||
/*
|
||||
* Check if input circular buffer boundaries need to be enforced
|
||||
*/
|
||||
if ((offset + temp) < BUFSIZE)
|
||||
{
|
||||
uint8 * ptr = pVars->inputStream.pBuffer + offset;
|
||||
|
||||
offset = pVars->mainDataStream.offset;
|
||||
|
||||
/*
|
||||
* Check if main data circular buffer boundaries need to be enforced
|
||||
*/
|
||||
if ((offset + temp) < BUFSIZE)
|
||||
{
|
||||
pv_memcpy((pVars->mainDataStream.pBuffer + offset), ptr, temp*sizeof(uint8));
|
||||
pVars->mainDataStream.offset += temp;
|
||||
}
|
||||
else
|
||||
{
|
||||
int32 tmp1 = *(ptr++);
|
||||
for (int32 nBytes = temp >> 1; nBytes != 0; nBytes--) /* read main data. */
|
||||
{
|
||||
int32 tmp2 = *(ptr++);
|
||||
fillDataBuf(&pVars->mainDataStream, tmp1);
|
||||
fillDataBuf(&pVars->mainDataStream, tmp2);
|
||||
tmp1 = *(ptr++);
|
||||
}
|
||||
|
||||
if (temp&1)
|
||||
{
|
||||
fillDataBuf(&pVars->mainDataStream, tmp1);
|
||||
}
|
||||
|
||||
/* adjust circular buffer counter */
|
||||
pVars->mainDataStream.offset = module(pVars->mainDataStream.offset, BUFSIZE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int32 nBytes = temp >> 1; nBytes != 0; nBytes--) /* read main data. */
|
||||
{
|
||||
fillDataBuf(&pVars->mainDataStream, *(pVars->inputStream.pBuffer + module(offset++ , BUFSIZE)));
|
||||
fillDataBuf(&pVars->mainDataStream, *(pVars->inputStream.pBuffer + module(offset++ , BUFSIZE)));
|
||||
}
|
||||
if (temp&1)
|
||||
{
|
||||
fillDataBuf(&pVars->mainDataStream, *(pVars->inputStream.pBuffer + module(offset , BUFSIZE)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pVars->inputStream.usedBits += (temp) << INBUF_ARRAY_INDEX_SHIFT;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
uint32 pvmp3_decoderMemRequirements(void)
|
||||
{
|
||||
uint32 size;
|
||||
|
||||
size = (uint32) sizeof(tmp3dec_file);
|
||||
return (size);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "pvmp3_decode_huff_cw.h"
|
||||
|
||||
void pvmp3_InitDecoder(tPVMP3DecoderExternal *pExt,
|
||||
void *pMem)
|
||||
{
|
||||
|
||||
tmp3dec_file *pVars;
|
||||
huffcodetab *pHuff;
|
||||
|
||||
pVars = (tmp3dec_file *)pMem;
|
||||
|
||||
pVars->num_channels = 0;
|
||||
|
||||
pExt->totalNumberOfBitsUsed = 0;
|
||||
pExt->inputBufferCurrentLength = 0;
|
||||
pExt->inputBufferUsedLength = 0;
|
||||
|
||||
pVars->mainDataStream.offset = 0;
|
||||
|
||||
pv_memset((void*)pVars->mainDataBuffer,
|
||||
0,
|
||||
BUFSIZE*sizeof(*pVars->mainDataBuffer));
|
||||
|
||||
|
||||
pVars->inputStream.pBuffer = pExt->pInputBuffer;
|
||||
|
||||
/*
|
||||
* Initialize huffman decoding table
|
||||
*/
|
||||
|
||||
pHuff = pVars->ht;
|
||||
pHuff[0].linbits = 0;
|
||||
pHuff[0].pdec_huff_tab = pvmp3_decode_huff_cw_tab0;
|
||||
pHuff[1].linbits = 0;
|
||||
pHuff[1].pdec_huff_tab = pvmp3_decode_huff_cw_tab1;
|
||||
pHuff[2].linbits = 0;
|
||||
pHuff[2].pdec_huff_tab = pvmp3_decode_huff_cw_tab2;
|
||||
pHuff[3].linbits = 0;
|
||||
pHuff[3].pdec_huff_tab = pvmp3_decode_huff_cw_tab3;
|
||||
pHuff[4].linbits = 0;
|
||||
pHuff[4].pdec_huff_tab = pvmp3_decode_huff_cw_tab0; /* tbl 4 is not used */
|
||||
pHuff[5].linbits = 4;
|
||||
pHuff[5].pdec_huff_tab = pvmp3_decode_huff_cw_tab5;
|
||||
pHuff[6].linbits = 0;
|
||||
pHuff[6].pdec_huff_tab = pvmp3_decode_huff_cw_tab6;
|
||||
pHuff[7].linbits = 0;
|
||||
pHuff[7].pdec_huff_tab = pvmp3_decode_huff_cw_tab7;
|
||||
pHuff[8].linbits = 0;
|
||||
pHuff[8].pdec_huff_tab = pvmp3_decode_huff_cw_tab8;
|
||||
pHuff[9].linbits = 0;
|
||||
pHuff[9].pdec_huff_tab = pvmp3_decode_huff_cw_tab9;
|
||||
pHuff[10].linbits = 0;
|
||||
pHuff[10].pdec_huff_tab = pvmp3_decode_huff_cw_tab10;
|
||||
pHuff[11].linbits = 0;
|
||||
pHuff[11].pdec_huff_tab = pvmp3_decode_huff_cw_tab11;
|
||||
pHuff[12].linbits = 0;
|
||||
pHuff[12].pdec_huff_tab = pvmp3_decode_huff_cw_tab12;
|
||||
pHuff[13].linbits = 0;
|
||||
pHuff[13].pdec_huff_tab = pvmp3_decode_huff_cw_tab13;
|
||||
pHuff[14].linbits = 0;
|
||||
pHuff[14].pdec_huff_tab = pvmp3_decode_huff_cw_tab0; /* tbl 14 is not used */
|
||||
pHuff[15].linbits = 0;
|
||||
pHuff[15].pdec_huff_tab = pvmp3_decode_huff_cw_tab15;
|
||||
pHuff[16].linbits = 1;
|
||||
pHuff[16].pdec_huff_tab = pvmp3_decode_huff_cw_tab16;
|
||||
pHuff[17].linbits = 2;
|
||||
pHuff[17].pdec_huff_tab = pvmp3_decode_huff_cw_tab16;
|
||||
pHuff[18].linbits = 3;
|
||||
pHuff[18].pdec_huff_tab = pvmp3_decode_huff_cw_tab16;
|
||||
pHuff[19].linbits = 4;
|
||||
pHuff[19].pdec_huff_tab = pvmp3_decode_huff_cw_tab16;
|
||||
pHuff[20].linbits = 6;
|
||||
pHuff[20].pdec_huff_tab = pvmp3_decode_huff_cw_tab16;
|
||||
pHuff[21].linbits = 8;
|
||||
pHuff[21].pdec_huff_tab = pvmp3_decode_huff_cw_tab16;
|
||||
pHuff[22].linbits = 10;
|
||||
pHuff[22].pdec_huff_tab = pvmp3_decode_huff_cw_tab16;
|
||||
pHuff[23].linbits = 13;
|
||||
pHuff[23].pdec_huff_tab = pvmp3_decode_huff_cw_tab16;
|
||||
pHuff[24].linbits = 4;
|
||||
pHuff[24].pdec_huff_tab = pvmp3_decode_huff_cw_tab24;
|
||||
pHuff[25].linbits = 5;
|
||||
pHuff[25].pdec_huff_tab = pvmp3_decode_huff_cw_tab24;
|
||||
pHuff[26].linbits = 6;
|
||||
pHuff[26].pdec_huff_tab = pvmp3_decode_huff_cw_tab24;
|
||||
pHuff[27].linbits = 7;
|
||||
pHuff[27].pdec_huff_tab = pvmp3_decode_huff_cw_tab24;
|
||||
pHuff[28].linbits = 8;
|
||||
pHuff[28].pdec_huff_tab = pvmp3_decode_huff_cw_tab24;
|
||||
pHuff[29].linbits = 9;
|
||||
pHuff[29].pdec_huff_tab = pvmp3_decode_huff_cw_tab24;
|
||||
pHuff[30].linbits = 11;
|
||||
pHuff[30].pdec_huff_tab = pvmp3_decode_huff_cw_tab24;
|
||||
pHuff[31].linbits = 13;
|
||||
pHuff[31].pdec_huff_tab = pvmp3_decode_huff_cw_tab24;
|
||||
pHuff[32].linbits = 0;
|
||||
pHuff[32].pdec_huff_tab = pvmp3_decode_huff_cw_tab32;
|
||||
pHuff[33].linbits = 0;
|
||||
pHuff[33].pdec_huff_tab = pvmp3_decode_huff_cw_tab33;
|
||||
|
||||
/*
|
||||
* Initialize polysynthesis circular buffer mechanism
|
||||
*/
|
||||
/* clear buffers */
|
||||
|
||||
pvmp3_resetDecoder(pMem);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
void pvmp3_resetDecoder(void *pMem)
|
||||
{
|
||||
|
||||
tmp3dec_file *pVars;
|
||||
tmp3dec_chan *pChVars[CHAN];
|
||||
|
||||
pVars = (tmp3dec_file *)pMem;
|
||||
pChVars[ LEFT] = &pVars->perChan[ LEFT];
|
||||
pChVars[RIGHT] = &pVars->perChan[RIGHT];
|
||||
|
||||
pVars->frame_start = 0;
|
||||
|
||||
pVars->mainDataStream.offset = 0;
|
||||
|
||||
pVars->mainDataStream.pBuffer = pVars->mainDataBuffer;
|
||||
pVars->mainDataStream.usedBits = 0;
|
||||
|
||||
|
||||
pVars->inputStream.usedBits = 0; // in bits
|
||||
|
||||
|
||||
pChVars[ LEFT]->used_freq_lines = 575;
|
||||
pChVars[RIGHT]->used_freq_lines = 575;
|
||||
|
||||
|
||||
/*
|
||||
* Initialize polysynthesis circular buffer mechanism
|
||||
*/
|
||||
|
||||
pv_memset((void*)&pChVars[ LEFT]->circ_buffer[576],
|
||||
0,
|
||||
480*sizeof(pChVars[ LEFT]->circ_buffer[0]));
|
||||
pv_memset((void*)&pChVars[RIGHT]->circ_buffer[576],
|
||||
0,
|
||||
480*sizeof(pChVars[RIGHT]->circ_buffer[0]));
|
||||
|
||||
|
||||
pv_memset((void*)pChVars[ LEFT]->overlap,
|
||||
0,
|
||||
SUBBANDS_NUMBER*FILTERBANK_BANDS*sizeof(pChVars[ LEFT]->overlap[0]));
|
||||
|
||||
|
||||
pv_memset((void*)pChVars[ RIGHT]->overlap,
|
||||
0,
|
||||
SUBBANDS_NUMBER*FILTERBANK_BANDS*sizeof(pChVars[ RIGHT]->overlap[0]));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Clear all the structures
|
||||
*/
|
||||
|
||||
|
||||
pv_memset((void*)&pVars->scaleFactors[RIGHT],
|
||||
0,
|
||||
sizeof(mp3ScaleFactors));
|
||||
|
||||
pv_memset((void*)&pVars->scaleFactors[LEFT],
|
||||
0,
|
||||
sizeof(mp3ScaleFactors));
|
||||
|
||||
pv_memset((void*)&pVars->sideInfo,
|
||||
0,
|
||||
sizeof(mp3SideInfo));
|
||||
|
||||
pv_memset((void*)&pVars->sideInfo,
|
||||
0,
|
||||
sizeof(mp3SideInfo));
|
||||
|
||||
}
|
||||
115
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_framedecoder.h
vendored
Normal file
115
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_framedecoder.h
vendored
Normal file
@@ -0,0 +1,115 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: pvmp3_framedecoder.h
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
Description:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef PVMP3_FRAMEDECODER_H
|
||||
#define PVMP3_FRAMEDECODER_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "pvmp3_dec_defs.h"
|
||||
#include "pvmp3_audio_type_defs.h"
|
||||
#include "pvmp3decoder_api.h"
|
||||
#include "s_mp3bits.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
|
||||
ERROR_CODE pvmp3_framedecoder(tPVMP3DecoderExternal *pExt,
|
||||
void *pMem);
|
||||
|
||||
|
||||
|
||||
uint32 pvmp3_decoderMemRequirements(void);
|
||||
|
||||
void pvmp3_InitDecoder(tPVMP3DecoderExternal *pExt,
|
||||
void *pMem);
|
||||
|
||||
|
||||
void pvmp3_resetDecoder(void *pMem);
|
||||
|
||||
|
||||
void fillMainDataBuf(void *pMem, int32 temp);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#endif
|
||||
|
||||
180
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_get_main_data_size.cpp
vendored
Normal file
180
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_get_main_data_size.cpp
vendored
Normal file
@@ -0,0 +1,180 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: pvmp3_get_main_data_size.cpp
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
|
||||
Description:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Input
|
||||
mp3Header *info, pointer to mp3 header info structure
|
||||
tmp3dec_file *pVars
|
||||
contains information that needs to persist
|
||||
between calls to this function, or is too big to
|
||||
be placed on the stack, even though the data is
|
||||
only needed during execution of this function
|
||||
|
||||
Returns
|
||||
|
||||
main data frame size
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION DESCRIPTION
|
||||
|
||||
get main data frame size
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REQUIREMENTS
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
|
||||
[1] ISO MPEG Audio Subgroup Software Simulation Group (1996)
|
||||
ISO 13818-3 MPEG-2 Audio Decoder - Lower Sampling Frequency Extension
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PSEUDO-CODE
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "pvmp3_tables.h"
|
||||
#include "pvmp3_get_main_data_size.h"
|
||||
#include "pv_mp3dec_fxd_op.h"
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here. Include conditional
|
||||
; compile variables also.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL STORE/BUFFER/POINTER DEFINITIONS
|
||||
; Variable declaration - defined here and used outside this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL FUNCTION REFERENCES
|
||||
; Declare functions defined elsewhere and referenced in this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
int32 pvmp3_get_main_data_size(mp3Header *info,
|
||||
tmp3dec_file *pVars)
|
||||
{
|
||||
|
||||
|
||||
int32 numBytes = fxp_mul32_Q28(mp3_bitrate[info->version_x][info->bitrate_index] << 20,
|
||||
inv_sfreq[info->sampling_frequency]);
|
||||
|
||||
|
||||
numBytes >>= (20 - info->version_x);
|
||||
|
||||
/*
|
||||
* Remove the size of the side information from the main data total
|
||||
*/
|
||||
if (info->version_x == MPEG_1)
|
||||
{
|
||||
pVars->predicted_frame_size = numBytes;
|
||||
if (info->mode == MPG_MD_MONO)
|
||||
{
|
||||
numBytes -= 17;
|
||||
}
|
||||
else
|
||||
{
|
||||
numBytes -= 32;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
numBytes >>= 1;
|
||||
pVars->predicted_frame_size = numBytes;
|
||||
|
||||
if (info->mode == MPG_MD_MONO)
|
||||
{
|
||||
numBytes -= 9;
|
||||
}
|
||||
else
|
||||
{
|
||||
numBytes -= 17;
|
||||
}
|
||||
}
|
||||
|
||||
if (info->padding)
|
||||
{
|
||||
numBytes++;
|
||||
pVars->predicted_frame_size++;
|
||||
}
|
||||
|
||||
if (info->error_protection)
|
||||
{
|
||||
numBytes -= 6;
|
||||
}
|
||||
else
|
||||
{
|
||||
numBytes -= 4;
|
||||
}
|
||||
|
||||
|
||||
if (numBytes < 0)
|
||||
{
|
||||
numBytes = 0;
|
||||
}
|
||||
|
||||
return(numBytes);
|
||||
}
|
||||
|
||||
101
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_get_main_data_size.h
vendored
Normal file
101
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_get_main_data_size.h
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: pvmp3_get_main_data_size.h
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
Description:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef PVMP3_GET_MAIN_DATA_SIZE_H
|
||||
#define PVMP3_GET_MAIN_DATA_SIZE_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "pvmp3_dec_defs.h"
|
||||
#include "pvmp3_audio_type_defs.h"
|
||||
#include "s_tmp3dec_file.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
int32 pvmp3_get_main_data_size(mp3Header *info,
|
||||
tmp3dec_file *pVars);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#endif
|
||||
|
||||
|
||||
226
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_get_scale_factors.cpp
vendored
Normal file
226
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_get_scale_factors.cpp
vendored
Normal file
@@ -0,0 +1,226 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: pvmp3_get_scale_factors.cpp
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
|
||||
Description:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Input
|
||||
mp3ScaleFactors *scalefac,
|
||||
mp3SideInfo *si, side info
|
||||
int32 gr, granule
|
||||
int32 ch, channel
|
||||
tbits *pMainData bit stream
|
||||
|
||||
Returns
|
||||
|
||||
mp3ScaleFactors *scalefac, scale factors
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION DESCRIPTION
|
||||
|
||||
get scale factors
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REQUIREMENTS
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
|
||||
[1] ISO MPEG Audio Subgroup Software Simulation Group (1996)
|
||||
ISO 13818-3 MPEG-2 Audio Decoder - Lower Sampling Frequency Extension
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PSEUDO-CODE
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "pvmp3_get_scale_factors.h"
|
||||
#include "pvmp3_getbits.h"
|
||||
#include "mp3_mem_funcs.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here. Include conditional
|
||||
; compile variables also.
|
||||
----------------------------------------------------------------------------*/
|
||||
#define Qfmt_28(a)(int32(double(0x10000000)*a))
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL STORE/BUFFER/POINTER DEFINITIONS
|
||||
; Variable declaration - defined here and used outside this module
|
||||
----------------------------------------------------------------------------*/
|
||||
const int32 slen[2][16] =
|
||||
{
|
||||
{0, 0, 0, 0, 3, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4},
|
||||
{0, 1, 2, 3, 0, 1, 2, 3, 1, 2, 3, 1, 2, 3, 2, 3}
|
||||
};
|
||||
|
||||
const struct
|
||||
{
|
||||
int32 l[5];
|
||||
int32 s[3];
|
||||
} sfbtable =
|
||||
{
|
||||
{0, 6, 11, 16, 21},
|
||||
{0, 6, 12}
|
||||
};
|
||||
|
||||
const int32 long_sfbtable[4] = { 6, 5, 5, 5};
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL FUNCTION REFERENCES
|
||||
; Declare functions defined elsewhere and referenced in this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
void pvmp3_get_scale_factors(mp3ScaleFactors *scalefac,
|
||||
mp3SideInfo *si,
|
||||
int32 gr,
|
||||
int32 ch,
|
||||
tmp3Bits *pMainData)
|
||||
{
|
||||
int32 sfb;
|
||||
int32 i;
|
||||
int32 window;
|
||||
granuleInfo *gr_info = &(si->ch[ch].gran[gr]);
|
||||
|
||||
if (gr_info->window_switching_flag && (gr_info->block_type == 2))
|
||||
{
|
||||
if (gr_info->mixed_block_flag)
|
||||
{ /* MIXED */
|
||||
for (sfb = 0; sfb < 8; sfb++)
|
||||
{
|
||||
scalefac->l[sfb] = getNbits(pMainData, slen[0][gr_info->scalefac_compress]);
|
||||
}
|
||||
|
||||
for (sfb = 3; sfb < 6; sfb++)
|
||||
{
|
||||
for (window = 0; window < 3; window++)
|
||||
{
|
||||
scalefac->s[window][sfb] = getNbits(pMainData, slen[0][gr_info->scalefac_compress]);
|
||||
}
|
||||
}
|
||||
for (sfb = 6; sfb < 12; sfb++)
|
||||
{
|
||||
for (window = 0; window < 3; window++)
|
||||
{
|
||||
scalefac->s[window][sfb] = getNbits(pMainData, slen[1][gr_info->scalefac_compress]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{ /* SHORT*/
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
for (sfb = sfbtable.s[i]; sfb < sfbtable.s[i+1]; sfb++)
|
||||
{
|
||||
for (window = 0; window < 3; window++)
|
||||
{
|
||||
scalefac->s[window][sfb] = getNbits(pMainData, slen[i][gr_info->scalefac_compress]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
scalefac->s[0][12] = 0; /* sfb = 12 win= 0 */
|
||||
scalefac->s[1][12] = 0; /* sfb = 12 win= 1 */
|
||||
scalefac->s[2][12] = 0; /* sfb = 12 win= 2 */
|
||||
}
|
||||
else
|
||||
{ /* LONG types 0,1,3 */
|
||||
|
||||
int32 *ptr = &scalefac->l[0];
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
int32 tmp4 = long_sfbtable[i];
|
||||
|
||||
if ((si->ch[ch].scfsi[i] == 0) || (gr == 0))
|
||||
{
|
||||
int32 tmp1 = slen[(i>>1)][gr_info->scalefac_compress];
|
||||
|
||||
if (tmp1)
|
||||
{
|
||||
int32 tmp2 = tmp1 * tmp4;
|
||||
uint32 tmp3 = getNbits(pMainData, tmp2);
|
||||
tmp4 = 32 - tmp1;
|
||||
for (; tmp2 > 0; tmp2 -= tmp1)
|
||||
{
|
||||
*(ptr++) = (tmp3 << (32 - tmp2)) >> tmp4;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (sfb = tmp4; sfb != 0; sfb--)
|
||||
{
|
||||
*(ptr++) = 0;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr += tmp4;
|
||||
}
|
||||
}
|
||||
scalefac->l[21] = 0;
|
||||
scalefac->l[22] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
104
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_get_scale_factors.h
vendored
Normal file
104
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_get_scale_factors.h
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: pvmp3_get_scale_factors.h
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
Description:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef PVMP3_GET_SCALE_FACTORS_H
|
||||
#define PVMP3_GET_SCALE_FACTORS_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "pvmp3_dec_defs.h"
|
||||
#include "pvmp3_audio_type_defs.h"
|
||||
#include "s_mp3bits.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
void pvmp3_get_scale_factors(mp3ScaleFactors *scalefac,
|
||||
mp3SideInfo *si,
|
||||
int32 gr,
|
||||
int32 ch,
|
||||
tmp3Bits *pMainData);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#endif
|
||||
|
||||
285
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_get_side_info.cpp
vendored
Normal file
285
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_get_side_info.cpp
vendored
Normal file
@@ -0,0 +1,285 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: pvmp3_get_side_info.cpp
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
|
||||
Description:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Input
|
||||
mp3SideInfo *si,
|
||||
mp3Header *info, mp3 header information
|
||||
uint32 *crc initialized crc value (if enabled)
|
||||
|
||||
|
||||
Returns
|
||||
|
||||
mp3SideInfo *si, side information
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION DESCRIPTION
|
||||
|
||||
acquires side information
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REQUIREMENTS
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
|
||||
[1] ISO MPEG Audio Subgroup Software Simulation Group (1996)
|
||||
ISO 13818-3 MPEG-2 Audio Decoder - Lower Sampling Frequency Extension
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PSEUDO-CODE
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "pvmp3_get_side_info.h"
|
||||
#include "pvmp3_crc.h"
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here. Include conditional
|
||||
; compile variables also.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL STORE/BUFFER/POINTER DEFINITIONS
|
||||
; Variable declaration - defined here and used outside this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL FUNCTION REFERENCES
|
||||
; Declare functions defined elsewhere and referenced in this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
ERROR_CODE pvmp3_get_side_info(tmp3Bits *inputStream,
|
||||
mp3SideInfo *si,
|
||||
mp3Header *info,
|
||||
uint32 *crc)
|
||||
{
|
||||
int32 ch, gr;
|
||||
uint32 tmp;
|
||||
|
||||
int stereo = (info->mode == MPG_MD_MONO) ? 1 : 2;
|
||||
|
||||
if (info->version_x == MPEG_1)
|
||||
{
|
||||
if (stereo == 1)
|
||||
{
|
||||
tmp = getbits_crc(inputStream, 14, crc, info->error_protection);
|
||||
si->main_data_begin = (tmp << 18) >> 23; /* 9 */
|
||||
si->private_bits = (tmp << 23) >> 27; /* 5 */
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp = getbits_crc(inputStream, 12, crc, info->error_protection);
|
||||
si->main_data_begin = (tmp << 20) >> 23; /* 9 */
|
||||
si->private_bits = (tmp << 23) >> 29; /* 3 */
|
||||
|
||||
}
|
||||
|
||||
for (ch = 0; ch < stereo; ch++)
|
||||
{
|
||||
tmp = getbits_crc(inputStream, 4, crc, info->error_protection);
|
||||
si->ch[ch].scfsi[0] = (tmp << 28) >> 31; /* 1 */
|
||||
si->ch[ch].scfsi[1] = (tmp << 29) >> 31; /* 1 */
|
||||
si->ch[ch].scfsi[2] = (tmp << 30) >> 31; /* 1 */
|
||||
si->ch[ch].scfsi[3] = tmp & 1; /* 1 */
|
||||
}
|
||||
|
||||
for (gr = 0; gr < 2 ; gr++)
|
||||
{
|
||||
for (ch = 0; ch < stereo; ch++)
|
||||
{
|
||||
si->ch[ch].gran[gr].part2_3_length = getbits_crc(inputStream, 12, crc, info->error_protection);
|
||||
tmp = getbits_crc(inputStream, 22, crc, info->error_protection);
|
||||
|
||||
si->ch[ch].gran[gr].big_values = (tmp << 10) >> 23; /* 9 */
|
||||
si->ch[ch].gran[gr].global_gain = ((tmp << 19) >> 24) - 210; /* 8 */
|
||||
si->ch[ch].gran[gr].scalefac_compress = (tmp << 27) >> 28; /* 4 */
|
||||
si->ch[ch].gran[gr].window_switching_flag = tmp & 1; /* 1 */
|
||||
|
||||
if (si->ch[ch].gran[gr].window_switching_flag)
|
||||
{
|
||||
tmp = getbits_crc(inputStream, 22, crc, info->error_protection);
|
||||
|
||||
si->ch[ch].gran[gr].block_type = (tmp << 10) >> 30; /* 2 */;
|
||||
si->ch[ch].gran[gr].mixed_block_flag = (tmp << 12) >> 31; /* 1 */;
|
||||
|
||||
si->ch[ch].gran[gr].table_select[0] = (tmp << 13) >> 27; /* 5 */;
|
||||
si->ch[ch].gran[gr].table_select[1] = (tmp << 18) >> 27; /* 5 */;
|
||||
|
||||
si->ch[ch].gran[gr].subblock_gain[0] = (tmp << 23) >> 29; /* 3 */;
|
||||
si->ch[ch].gran[gr].subblock_gain[1] = (tmp << 26) >> 29; /* 3 */;
|
||||
si->ch[ch].gran[gr].subblock_gain[2] = (tmp << 29) >> 29; /* 3 */;
|
||||
|
||||
/* Set region_count parameters since they are implicit in this case. */
|
||||
|
||||
if (si->ch[ch].gran[gr].block_type == 0)
|
||||
{
|
||||
return(SIDE_INFO_ERROR);
|
||||
}
|
||||
else if ((si->ch[ch].gran[gr].block_type == 2)
|
||||
&& (si->ch[ch].gran[gr].mixed_block_flag == 0))
|
||||
{
|
||||
si->ch[ch].gran[gr].region0_count = 8; /* MI 9; */
|
||||
si->ch[ch].gran[gr].region1_count = 12;
|
||||
}
|
||||
else
|
||||
{
|
||||
si->ch[ch].gran[gr].region0_count = 7; /* MI 8; */
|
||||
si->ch[ch].gran[gr].region1_count = 13;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp = getbits_crc(inputStream, 22, crc, info->error_protection);
|
||||
|
||||
si->ch[ch].gran[gr].table_select[0] = (tmp << 10) >> 27; /* 5 */;
|
||||
si->ch[ch].gran[gr].table_select[1] = (tmp << 15) >> 27; /* 5 */;
|
||||
si->ch[ch].gran[gr].table_select[2] = (tmp << 20) >> 27; /* 5 */;
|
||||
|
||||
si->ch[ch].gran[gr].region0_count = (tmp << 25) >> 28; /* 4 */;
|
||||
si->ch[ch].gran[gr].region1_count = (tmp << 29) >> 29; /* 3 */;
|
||||
|
||||
si->ch[ch].gran[gr].block_type = 0;
|
||||
}
|
||||
|
||||
tmp = getbits_crc(inputStream, 3, crc, info->error_protection);
|
||||
si->ch[ch].gran[gr].preflag = (tmp << 29) >> 31; /* 1 */
|
||||
si->ch[ch].gran[gr].scalefac_scale = (tmp << 30) >> 31; /* 1 */
|
||||
si->ch[ch].gran[gr].count1table_select = tmp & 1; /* 1 */
|
||||
}
|
||||
}
|
||||
}
|
||||
else /* Layer 3 LSF */
|
||||
{
|
||||
si->main_data_begin = getbits_crc(inputStream, 8, crc, info->error_protection);
|
||||
si->private_bits = getbits_crc(inputStream, stereo, crc, info->error_protection);
|
||||
|
||||
for (ch = 0; ch < stereo; ch++)
|
||||
{
|
||||
tmp = getbits_crc(inputStream, 21, crc, info->error_protection);
|
||||
si->ch[ch].gran[0].part2_3_length = (tmp << 11) >> 20; /* 12 */
|
||||
si->ch[ch].gran[0].big_values = (tmp << 23) >> 23; /* 9 */
|
||||
|
||||
tmp = getbits_crc(inputStream, 18, crc, info->error_protection);
|
||||
si->ch[ch].gran[0].global_gain = ((tmp << 14) >> 24) - 210; /* 8 */
|
||||
si->ch[ch].gran[0].scalefac_compress = (tmp << 22) >> 23; /* 9 */
|
||||
si->ch[ch].gran[0].window_switching_flag = tmp & 1; /* 1 */
|
||||
|
||||
if (si->ch[ch].gran[0].window_switching_flag)
|
||||
{
|
||||
|
||||
tmp = getbits_crc(inputStream, 22, crc, info->error_protection);
|
||||
|
||||
si->ch[ch].gran[0].block_type = (tmp << 10) >> 30; /* 2 */;
|
||||
si->ch[ch].gran[0].mixed_block_flag = (tmp << 12) >> 31; /* 1 */;
|
||||
|
||||
si->ch[ch].gran[0].table_select[0] = (tmp << 13) >> 27; /* 5 */;
|
||||
si->ch[ch].gran[0].table_select[1] = (tmp << 18) >> 27; /* 5 */;
|
||||
|
||||
si->ch[ch].gran[0].subblock_gain[0] = (tmp << 23) >> 29; /* 3 */;
|
||||
si->ch[ch].gran[0].subblock_gain[1] = (tmp << 26) >> 29; /* 3 */;
|
||||
si->ch[ch].gran[0].subblock_gain[2] = (tmp << 29) >> 29; /* 3 */;
|
||||
|
||||
/* Set region_count parameters since they are implicit in this case. */
|
||||
|
||||
if (si->ch[ch].gran[0].block_type == 0)
|
||||
{
|
||||
return(SIDE_INFO_ERROR);
|
||||
}
|
||||
else if ((si->ch[ch].gran[0].block_type == 2)
|
||||
&& (si->ch[ch].gran[0].mixed_block_flag == 0))
|
||||
{
|
||||
si->ch[ch].gran[0].region0_count = 8; /* MI 9; */
|
||||
si->ch[ch].gran[0].region1_count = 12;
|
||||
}
|
||||
else
|
||||
{
|
||||
si->ch[ch].gran[0].region0_count = 7; /* MI 8; */
|
||||
si->ch[ch].gran[0].region1_count = 13;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp = getbits_crc(inputStream, 22, crc, info->error_protection);
|
||||
|
||||
si->ch[ch].gran[0].table_select[0] = (tmp << 10) >> 27; /* 5 */;
|
||||
si->ch[ch].gran[0].table_select[1] = (tmp << 15) >> 27; /* 5 */;
|
||||
si->ch[ch].gran[0].table_select[2] = (tmp << 20) >> 27; /* 5 */;
|
||||
|
||||
si->ch[ch].gran[0].region0_count = (tmp << 25) >> 28; /* 4 */;
|
||||
si->ch[ch].gran[0].region1_count = (tmp << 29) >> 29; /* 3 */;
|
||||
|
||||
si->ch[ch].gran[0].block_type = 0;
|
||||
}
|
||||
|
||||
tmp = getbits_crc(inputStream, 2, crc, info->error_protection);
|
||||
si->ch[ch].gran[0].scalefac_scale = tmp >> 1; /* 1 */
|
||||
si->ch[ch].gran[0].count1table_select = tmp & 1; /* 1 */
|
||||
|
||||
}
|
||||
}
|
||||
return (NO_DECODING_ERROR);
|
||||
}
|
||||
|
||||
102
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_get_side_info.h
vendored
Normal file
102
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_get_side_info.h
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: pvmp3_get_side_info.h
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
Description:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef PVMP3_GET_SIDE_INFO_H
|
||||
#define PVMP3_GET_SIDE_INFO_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "pvmp3_dec_defs.h"
|
||||
#include "pvmp3_audio_type_defs.h"
|
||||
#include "s_mp3bits.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
ERROR_CODE pvmp3_get_side_info(tmp3Bits *inputStream,
|
||||
mp3SideInfo *si,
|
||||
mp3Header *info,
|
||||
uint32 *crc);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#endif
|
||||
|
||||
257
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_getbits.cpp
vendored
Normal file
257
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_getbits.cpp
vendored
Normal file
@@ -0,0 +1,257 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: pvmp3_getbits.cpp
|
||||
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
|
||||
Description:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Inputs:
|
||||
|
||||
tmp3Bits *inputStream, structure holding the input stream parameters
|
||||
int32 neededBits number of bits to read from the bit stream
|
||||
|
||||
Outputs:
|
||||
|
||||
word parsed from teh bitstream, with size neededBits-bits,
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION DESCRIPTION
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REQUIREMENTS
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
[1] ISO MPEG Audio Subgroup Software Simulation Group (1996)
|
||||
ISO 13818-3 MPEG-2 Audio Decoder - Lower Sampling Frequency Extension
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PSEUDO-CODE
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "pvmp3_getbits.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here. Include conditional
|
||||
; compile variables also.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL STORE/BUFFER/POINTER DEFINITIONS
|
||||
; Variable declaration - defined here and used outside this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL FUNCTION REFERENCES
|
||||
; Declare functions defined elsewhere and referenced in this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
uint32 getNbits(tmp3Bits *ptBitStream,
|
||||
int32 neededBits) /* number of bits to read from the bitstream (up to 25) */
|
||||
{
|
||||
|
||||
uint32 offset;
|
||||
uint32 bitIndex;
|
||||
uint8 Elem; /* Needs to be same type as pInput->pBuffer */
|
||||
uint8 Elem1;
|
||||
uint8 Elem2;
|
||||
uint8 Elem3;
|
||||
uint32 returnValue = 0;
|
||||
|
||||
if (!neededBits)
|
||||
{
|
||||
return (returnValue);
|
||||
}
|
||||
|
||||
offset = (ptBitStream->usedBits) >> INBUF_ARRAY_INDEX_SHIFT;
|
||||
|
||||
Elem = *(ptBitStream->pBuffer + module(offset , BUFSIZE));
|
||||
Elem1 = *(ptBitStream->pBuffer + module(offset + 1, BUFSIZE));
|
||||
Elem2 = *(ptBitStream->pBuffer + module(offset + 2, BUFSIZE));
|
||||
Elem3 = *(ptBitStream->pBuffer + module(offset + 3, BUFSIZE));
|
||||
|
||||
|
||||
returnValue = (((uint32)(Elem)) << 24) |
|
||||
(((uint32)(Elem1)) << 16) |
|
||||
(((uint32)(Elem2)) << 8) |
|
||||
((uint32)(Elem3));
|
||||
|
||||
/* Remove extra high bits by shifting up */
|
||||
bitIndex = module(ptBitStream->usedBits, INBUF_BIT_WIDTH);
|
||||
|
||||
/* This line is faster than to mask off the high bits. */
|
||||
returnValue <<= bitIndex;
|
||||
|
||||
/* Move the field down. */
|
||||
returnValue >>= (32 - neededBits);
|
||||
|
||||
ptBitStream->usedBits += neededBits;
|
||||
|
||||
return (returnValue);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
uint16 getUpTo9bits(tmp3Bits *ptBitStream,
|
||||
int32 neededBits) /* number of bits to read from the bit stream 2 to 9 */
|
||||
{
|
||||
|
||||
uint32 offset;
|
||||
uint32 bitIndex;
|
||||
uint8 Elem; /* Needs to be same type as pInput->pBuffer */
|
||||
uint8 Elem1;
|
||||
uint16 returnValue;
|
||||
|
||||
offset = (ptBitStream->usedBits) >> INBUF_ARRAY_INDEX_SHIFT;
|
||||
|
||||
Elem = *(ptBitStream->pBuffer + module(offset , BUFSIZE));
|
||||
Elem1 = *(ptBitStream->pBuffer + module(offset + 1, BUFSIZE));
|
||||
|
||||
|
||||
returnValue = (((uint16)(Elem)) << 8) |
|
||||
((uint16)(Elem1));
|
||||
|
||||
/* Remove extra high bits by shifting up */
|
||||
bitIndex = module(ptBitStream->usedBits, INBUF_BIT_WIDTH);
|
||||
|
||||
ptBitStream->usedBits += neededBits;
|
||||
/* This line is faster than to mask off the high bits. */
|
||||
returnValue = (returnValue << (bitIndex));
|
||||
|
||||
/* Move the field down. */
|
||||
|
||||
return (uint16)(returnValue >> (16 - neededBits));
|
||||
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
uint32 getUpTo17bits(tmp3Bits *ptBitStream,
|
||||
int32 neededBits) /* number of bits to read from the bit stream 2 to 8 */
|
||||
{
|
||||
|
||||
uint32 offset;
|
||||
uint32 bitIndex;
|
||||
uint8 Elem; /* Needs to be same type as pInput->pBuffer */
|
||||
uint8 Elem1;
|
||||
uint8 Elem2;
|
||||
uint32 returnValue;
|
||||
|
||||
offset = (ptBitStream->usedBits) >> INBUF_ARRAY_INDEX_SHIFT;
|
||||
|
||||
Elem = *(ptBitStream->pBuffer + module(offset , BUFSIZE));
|
||||
Elem1 = *(ptBitStream->pBuffer + module(offset + 1, BUFSIZE));
|
||||
Elem2 = *(ptBitStream->pBuffer + module(offset + 2, BUFSIZE));
|
||||
|
||||
|
||||
returnValue = (((uint32)(Elem)) << 16) |
|
||||
(((uint32)(Elem1)) << 8) |
|
||||
((uint32)(Elem2));
|
||||
|
||||
/* Remove extra high bits by shifting up */
|
||||
bitIndex = module(ptBitStream->usedBits, INBUF_BIT_WIDTH);
|
||||
|
||||
ptBitStream->usedBits += neededBits;
|
||||
/* This line is faster than to mask off the high bits. */
|
||||
returnValue = 0xFFFFFF & (returnValue << (bitIndex));
|
||||
|
||||
/* Move the field down. */
|
||||
|
||||
return (uint32)(returnValue >> (24 - neededBits));
|
||||
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
uint8 get1bit(tmp3Bits *ptBitStream) /* number of bits to read from the bit stream */
|
||||
{
|
||||
|
||||
uint32 offset;
|
||||
uint32 bitIndex;
|
||||
uint8 returnValue;
|
||||
|
||||
offset = (ptBitStream->usedBits) >> INBUF_ARRAY_INDEX_SHIFT;
|
||||
|
||||
returnValue = *(ptBitStream->pBuffer + module(offset , BUFSIZE));
|
||||
|
||||
/* Remove extra high bits by shifting up */
|
||||
bitIndex = module(ptBitStream->usedBits, INBUF_BIT_WIDTH);
|
||||
ptBitStream->usedBits++;
|
||||
|
||||
/* This line is faster than to mask off the high bits. */
|
||||
returnValue = (returnValue << (bitIndex));
|
||||
|
||||
return (uint8)(returnValue >> 7);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
112
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_getbits.h
vendored
Normal file
112
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_getbits.h
vendored
Normal file
@@ -0,0 +1,112 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: pvmp3_getbits.h
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
Description:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef PVMP3_GETBITS_H
|
||||
#define PVMP3_GETBITS_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "pvmp3_dec_defs.h"
|
||||
#include "s_mp3bits.h"
|
||||
#include "pvmp3_audio_type_defs.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
#define INBUF_ARRAY_INDEX_SHIFT (3)
|
||||
#define INBUF_BIT_WIDTH (1<<(INBUF_ARRAY_INDEX_SHIFT))
|
||||
#define INBUF_BIT_MODULO_MASK ((INBUF_BIT_WIDTH)-1)
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
uint32 getNbits(tmp3Bits *pMainData,
|
||||
int32 neededBits);
|
||||
|
||||
uint16 getUpTo9bits(tmp3Bits *pMainData,
|
||||
int32 neededBits);
|
||||
|
||||
uint32 getUpTo17bits(tmp3Bits *pMainData,
|
||||
int32 neededBits);
|
||||
|
||||
uint8 get1bit(tmp3Bits *pMainData);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#endif
|
||||
|
||||
304
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_huffman_decoding.cpp
vendored
Normal file
304
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_huffman_decoding.cpp
vendored
Normal file
@@ -0,0 +1,304 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: pvmp3_huffman_decoding.cpp
|
||||
|
||||
Funtions:
|
||||
pvmp3_huffman_quad_decoding
|
||||
pvmp3_huffman_pair_decoding
|
||||
pvmp3_huffman_pair_decoding_linbits
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
|
||||
Description:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Inputs:
|
||||
struct huffcodetab *h, pointer to huffman code record
|
||||
int32 *x, returns decoded x value
|
||||
int32 *y, returns decoded y value
|
||||
int32 *v, returns decoded v value (only in quad function)
|
||||
int32 *w, returns decoded w value (only in quad function)
|
||||
tbits *pMainData bit stream
|
||||
|
||||
Outputs:
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION DESCRIPTION
|
||||
|
||||
These functions are used to decode huffman codewords from the input
|
||||
bitstream using combined binary search and look-up table approach.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REQUIREMENTS
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
[1] ISO MPEG Audio Subgroup Software Simulation Group (1996)
|
||||
ISO 13818-3 MPEG-2 Audio Decoder - Lower Sampling Frequency Extension
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PSEUDO-CODE
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "pvmp3_dec_defs.h"
|
||||
#include "pv_mp3_huffman.h"
|
||||
#include "pvmp3_getbits.h"
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here. Include conditional
|
||||
; compile variables also.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL STORE/BUFFER/POINTER DEFINITIONS
|
||||
; Variable declaration - defined here and used outside this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL FUNCTION REFERENCES
|
||||
; Declare functions defined elsewhere and referenced in this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
void pvmp3_huffman_quad_decoding(struct huffcodetab *h,
|
||||
int32 *is,
|
||||
tmp3Bits *pMainData)
|
||||
{
|
||||
|
||||
int32 x;
|
||||
int32 y;
|
||||
int32 v;
|
||||
int32 w;
|
||||
|
||||
y = (*h->pdec_huff_tab)(pMainData);
|
||||
|
||||
|
||||
if (y)
|
||||
{
|
||||
v = (y >> 3);
|
||||
|
||||
if (v)
|
||||
{
|
||||
if (get1bit(pMainData))
|
||||
{
|
||||
v = -v;
|
||||
}
|
||||
}
|
||||
w = (y >> 2) & 1;
|
||||
if (w)
|
||||
{
|
||||
if (get1bit(pMainData))
|
||||
{
|
||||
w = -w;
|
||||
}
|
||||
}
|
||||
x = (y >> 1) & 1;
|
||||
if (x)
|
||||
{
|
||||
if (get1bit(pMainData))
|
||||
{
|
||||
x = -x;
|
||||
}
|
||||
}
|
||||
y = y & 1;
|
||||
if (y)
|
||||
{
|
||||
if (get1bit(pMainData))
|
||||
{
|
||||
y = -y;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
v = 0;
|
||||
w = 0;
|
||||
x = 0;
|
||||
|
||||
}
|
||||
|
||||
*is = v;
|
||||
*(is + 1) = w;
|
||||
*(is + 2) = x;
|
||||
*(is + 3) = y;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void pvmp3_huffman_pair_decoding(struct huffcodetab *h, /* pointer to huffman code record */
|
||||
int32 *is,
|
||||
tmp3Bits *pMainData)
|
||||
{
|
||||
/* Lookup in Huffman table. */
|
||||
int32 x;
|
||||
int32 y;
|
||||
|
||||
uint16 cw = (*h->pdec_huff_tab)(pMainData);
|
||||
|
||||
/* Process sign and escape encodings for dual tables. */
|
||||
|
||||
|
||||
if (cw)
|
||||
{
|
||||
x = cw >> 4;
|
||||
|
||||
if (x)
|
||||
{
|
||||
if (get1bit(pMainData))
|
||||
{
|
||||
x = -x;
|
||||
}
|
||||
y = cw & 0xf;
|
||||
if (y && get1bit(pMainData))
|
||||
{
|
||||
y = -y;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
y = cw & 0xf;
|
||||
if (get1bit(pMainData))
|
||||
{
|
||||
y = -y;
|
||||
}
|
||||
}
|
||||
|
||||
*is = x;
|
||||
*(is + 1) = y;
|
||||
}
|
||||
else
|
||||
{
|
||||
*is = 0;
|
||||
*(is + 1) = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void pvmp3_huffman_pair_decoding_linbits(struct huffcodetab *h, /* pointer to huffman code record */
|
||||
int32 *is,
|
||||
tmp3Bits *pMainData)
|
||||
{
|
||||
int32 x;
|
||||
int32 y;
|
||||
|
||||
uint16 cw;
|
||||
/* Lookup in Huffman table. */
|
||||
|
||||
|
||||
cw = (*h->pdec_huff_tab)(pMainData);
|
||||
x = cw >> 4;
|
||||
|
||||
/* Process sign and escape encodings for dual tables. */
|
||||
|
||||
|
||||
if (15 == (uint32)x)
|
||||
{
|
||||
int32 tmp = getUpTo17bits(pMainData, (h->linbits + 1));
|
||||
x += tmp >> 1;
|
||||
if (tmp&1)
|
||||
{
|
||||
x = -x;
|
||||
}
|
||||
}
|
||||
else if (x)
|
||||
{
|
||||
if (get1bit(pMainData))
|
||||
{
|
||||
x = -x;
|
||||
}
|
||||
}
|
||||
|
||||
y = cw & 0xf;
|
||||
if (15 == (uint32)y)
|
||||
{
|
||||
int32 tmp = getUpTo17bits(pMainData, (h->linbits + 1));
|
||||
y += tmp >> 1;
|
||||
if (tmp&1)
|
||||
{
|
||||
y = -y;
|
||||
}
|
||||
}
|
||||
else if (y)
|
||||
{
|
||||
if (get1bit(pMainData))
|
||||
{
|
||||
y = -y;
|
||||
}
|
||||
}
|
||||
|
||||
*is = x;
|
||||
*(is + 1) = y;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
328
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_huffman_parsing.cpp
vendored
Normal file
328
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_huffman_parsing.cpp
vendored
Normal file
@@ -0,0 +1,328 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: pvmp3_huffman_decoding.cpp
|
||||
|
||||
Funtions:
|
||||
pvmp3_huffman_quad_decoding
|
||||
pvmp3_huffman_pair_decoding
|
||||
pvmp3_huffman_pair_decoding_linbits
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
|
||||
Description:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Inputs:
|
||||
int32 is[],
|
||||
granuleInfo *grInfo, information for the given channel and granule
|
||||
tmp3dec_file *pVars, decoder state structure
|
||||
int32 part2_start, index to beginning of part 2 data
|
||||
mp3Header *info mp3 header info
|
||||
|
||||
Outputs:
|
||||
int32 is[], uncompressed data
|
||||
|
||||
Return:
|
||||
non zero frequency lines
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION DESCRIPTION
|
||||
|
||||
These functions are used to decode huffman codewords from the input
|
||||
bitstream using combined binary search and look-up table approach.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REQUIREMENTS
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
[1] ISO MPEG Audio Subgroup Software Simulation Group (1996)
|
||||
ISO 13818-3 MPEG-2 Audio Decoder - Lower Sampling Frequency Extension
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PSEUDO-CODE
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "pv_mp3_huffman.h"
|
||||
#include "s_mp3bits.h"
|
||||
#include "mp3_mem_funcs.h"
|
||||
#include "pvmp3_tables.h"
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here. Include conditional
|
||||
; compile variables also.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL STORE/BUFFER/POINTER DEFINITIONS
|
||||
; Variable declaration - defined here and used outside this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL FUNCTION REFERENCES
|
||||
; Declare functions defined elsewhere and referenced in this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
int32 pvmp3_huffman_parsing(int32 is[SUBBANDS_NUMBER*FILTERBANK_BANDS],
|
||||
granuleInfo *grInfo,
|
||||
tmp3dec_file *pVars,
|
||||
int32 part2_start,
|
||||
mp3Header *info)
|
||||
|
||||
|
||||
{
|
||||
int32 i;
|
||||
int32 region1Start;
|
||||
int32 region2Start;
|
||||
int32 sfreq;
|
||||
uint32 grBits;
|
||||
void(*pt_huff)(struct huffcodetab *, int32 *, tmp3Bits *);
|
||||
struct huffcodetab *h;
|
||||
|
||||
tmp3Bits *pMainData = &pVars->mainDataStream;
|
||||
|
||||
|
||||
/*int32 bt = (*si).ch[ch].gr[gr].window_switching_flag && ((*si).ch[ch].gr[gr].block_type == 2);*/
|
||||
|
||||
sfreq = info->sampling_frequency + info->version_x + (info->version_x << 1);
|
||||
|
||||
/* Find region boundary for short block case. */
|
||||
|
||||
|
||||
if ((grInfo->window_switching_flag) && (grInfo->block_type == 2))
|
||||
{
|
||||
if (info->version_x == MPEG_1)
|
||||
{
|
||||
/* Region2. */
|
||||
region1Start = 12;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Region2. */
|
||||
i = grInfo->region0_count + 1;
|
||||
region1Start = mp3_sfBandIndex[sfreq].s[i/3];
|
||||
}
|
||||
|
||||
region1Start += region1Start << 1;
|
||||
region2Start = 576; /* No Region2 for short block case. */
|
||||
}
|
||||
else
|
||||
{ /* Find region boundary for long block case. */
|
||||
i = grInfo->region0_count + 1;
|
||||
region1Start = mp3_sfBandIndex[sfreq].l[i];
|
||||
region2Start = mp3_sfBandIndex[sfreq].l[i + grInfo->region1_count + 1];
|
||||
}
|
||||
|
||||
/* Read bigvalues area. */
|
||||
|
||||
|
||||
if (grInfo->big_values > (FILTERBANK_BANDS*SUBBANDS_NUMBER >> 1))
|
||||
{
|
||||
grInfo->big_values = (FILTERBANK_BANDS * SUBBANDS_NUMBER >> 1);
|
||||
}
|
||||
|
||||
if ((grInfo->big_values << 1) > (uint32)region2Start)
|
||||
{
|
||||
h = &(pVars->ht[grInfo->table_select[0]]);
|
||||
if (h->linbits)
|
||||
{
|
||||
pt_huff = pvmp3_huffman_pair_decoding_linbits;
|
||||
}
|
||||
else
|
||||
{
|
||||
pt_huff = pvmp3_huffman_pair_decoding;
|
||||
}
|
||||
|
||||
for (i = 0; i < region1Start; i += 2)
|
||||
{
|
||||
(*pt_huff)(h, &is[i], pMainData);
|
||||
}
|
||||
|
||||
h = &(pVars->ht[grInfo->table_select[1]]);
|
||||
if (h->linbits)
|
||||
{
|
||||
pt_huff = pvmp3_huffman_pair_decoding_linbits;
|
||||
}
|
||||
else
|
||||
{
|
||||
pt_huff = pvmp3_huffman_pair_decoding;
|
||||
}
|
||||
|
||||
for (; i < region2Start; i += 2)
|
||||
{
|
||||
(*pt_huff)(h, &is[i], pMainData);
|
||||
}
|
||||
|
||||
h = &(pVars->ht[grInfo->table_select[2]]);
|
||||
if (h->linbits)
|
||||
{
|
||||
pt_huff = pvmp3_huffman_pair_decoding_linbits;
|
||||
}
|
||||
else
|
||||
{
|
||||
pt_huff = pvmp3_huffman_pair_decoding;
|
||||
}
|
||||
|
||||
for (; (uint32)i < (grInfo->big_values << 1); i += 2)
|
||||
{
|
||||
(*pt_huff)(h, &is[i], pMainData);
|
||||
}
|
||||
}
|
||||
else if ((grInfo->big_values << 1) > (uint32)region1Start)
|
||||
{
|
||||
h = &(pVars->ht[grInfo->table_select[0]]);
|
||||
if (h->linbits)
|
||||
{
|
||||
pt_huff = pvmp3_huffman_pair_decoding_linbits;
|
||||
}
|
||||
else
|
||||
{
|
||||
pt_huff = pvmp3_huffman_pair_decoding;
|
||||
}
|
||||
for (i = 0; i < region1Start; i += 2)
|
||||
{
|
||||
(*pt_huff)(h, &is[i], pMainData);
|
||||
}
|
||||
|
||||
h = &(pVars->ht[grInfo->table_select[1]]);
|
||||
if (h->linbits)
|
||||
{
|
||||
pt_huff = pvmp3_huffman_pair_decoding_linbits;
|
||||
}
|
||||
else
|
||||
{
|
||||
pt_huff = pvmp3_huffman_pair_decoding;
|
||||
}
|
||||
for (; (uint32)i < (grInfo->big_values << 1); i += 2)
|
||||
{
|
||||
(*pt_huff)(h, &is[i], pMainData);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
h = &(pVars->ht[grInfo->table_select[0]]);
|
||||
if (h->linbits)
|
||||
{
|
||||
pt_huff = pvmp3_huffman_pair_decoding_linbits;
|
||||
}
|
||||
else
|
||||
{
|
||||
pt_huff = pvmp3_huffman_pair_decoding;
|
||||
}
|
||||
|
||||
for (i = 0; (uint32)i < (grInfo->big_values << 1); i += 2)
|
||||
{
|
||||
(*pt_huff)(h, &is[i], pMainData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Read count1 area. */
|
||||
h = &(pVars->ht[grInfo->count1table_select+32]);
|
||||
|
||||
grBits = part2_start + grInfo->part2_3_length;
|
||||
|
||||
while ((pMainData->usedBits < grBits) &&
|
||||
(i < FILTERBANK_BANDS*SUBBANDS_NUMBER - 4))
|
||||
{
|
||||
pvmp3_huffman_quad_decoding(h, &is[i], pMainData);
|
||||
i += 4;
|
||||
}
|
||||
|
||||
if ((pMainData->usedBits < grBits) &&
|
||||
(i < FILTERBANK_BANDS*SUBBANDS_NUMBER))
|
||||
{
|
||||
pvmp3_huffman_quad_decoding(h, &is[i], pMainData);
|
||||
i += 4;
|
||||
|
||||
if ((i - 2) >= FILTERBANK_BANDS*SUBBANDS_NUMBER)
|
||||
{
|
||||
i -= 2;
|
||||
is[i] = 0;
|
||||
is[(i+1)] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (pMainData->usedBits > grBits)
|
||||
{
|
||||
i -= 4;
|
||||
|
||||
if (i < 0 || i > FILTERBANK_BANDS*SUBBANDS_NUMBER - 4)
|
||||
{
|
||||
/* illegal parameters may cause invalid access, set i to 0 */
|
||||
i = 0;
|
||||
}
|
||||
|
||||
is[i] = 0;
|
||||
is[(i+1)] = 0;
|
||||
is[(i+2)] = 0;
|
||||
is[(i+3)] = 0;
|
||||
|
||||
}
|
||||
|
||||
pMainData->usedBits = grBits;
|
||||
|
||||
return (i);
|
||||
|
||||
}
|
||||
|
||||
376
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_imdct_synth.cpp
vendored
Normal file
376
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_imdct_synth.cpp
vendored
Normal file
@@ -0,0 +1,376 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: pvmp3_imdct_synth.cpp
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
|
||||
Description:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Input
|
||||
int32 in[], Pointer to spec values of current channel
|
||||
int32 overlap[], Pointer to overlap values of current channel
|
||||
uint32 blk_type, Block type
|
||||
int16 mx_band, In case of mixed blocks, # of bands with long
|
||||
blocks (2 or 4) else 0
|
||||
int32 *Scratch_mem
|
||||
Returns
|
||||
|
||||
int32 in[],
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION DESCRIPTION
|
||||
|
||||
The frequency lines are preprocessed by the "alias reduction" scheme
|
||||
and fed into the IMDCT matrix, each 18 into one transform block.
|
||||
The first half of the output values are added to the stored overlap
|
||||
values from the last block. These values are new output values and
|
||||
are input values for the polyphase filterbank. The second half of the
|
||||
output values is stored for overlap with the next data granule.
|
||||
The number of windowed samples is 12 for short blocks, and 36 for long
|
||||
blocks
|
||||
|
||||
Windowing
|
||||
|
||||
Depending on window_switching_flag[gr][ch], block_type[gr][ch] and
|
||||
mixed_block_flag[gr][ch] different shapes of windows are used.
|
||||
normal window
|
||||
start window
|
||||
stop window
|
||||
short windows
|
||||
Each of the three short blocks is windowed separately.
|
||||
The windowed short blocks must be overlapped and concatenated.
|
||||
|
||||
Overlapping and adding with previous block
|
||||
|
||||
The first half (18 values) of the current block (36 values) has to be
|
||||
overlapped with the second half of the previous block. The second half
|
||||
of the current block has to be stored for overlapping with the next block
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REQUIREMENTS
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
|
||||
[1] ISO MPEG Audio Subgroup Software Simulation Group (1996)
|
||||
ISO 13818-3 MPEG-2 Audio Decoder - Lower Sampling Frequency Extension
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PSEUDO-CODE
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "pvmp3_imdct_synth.h"
|
||||
#include "pv_mp3dec_fxd_op.h"
|
||||
#include "pvmp3_dec_defs.h"
|
||||
#include "pvmp3_mdct_18.h"
|
||||
#include "pvmp3_mdct_6.h"
|
||||
#include "mp3_mem_funcs.h"
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here. Include conditional
|
||||
; compile variables also.
|
||||
----------------------------------------------------------------------------*/
|
||||
#define LONG 0
|
||||
#define START 1
|
||||
#define SHORT 2
|
||||
#define STOP 3
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL STORE/BUFFER/POINTER DEFINITIONS
|
||||
; Variable declaration - defined here and used outside this module
|
||||
----------------------------------------------------------------------------*/
|
||||
/*
|
||||
* sin(pi/36*(k+0.5)),k=0..35
|
||||
*/
|
||||
|
||||
const int32 normal_win[36] =
|
||||
{
|
||||
Qfmt_31(0.08723877473068f), Qfmt_31(0.26105238444010f), Qfmt_31(0.43287922787620f),
|
||||
Qfmt_31(0.60141159900854f), Qfmt_31(0.76536686473018f), Qfmt_31(0.92349722647006f),
|
||||
Qfmt_31(0.53729960834682f), Qfmt_31(0.60876142900872f), Qfmt_31(0.67559020761566f),
|
||||
Qfmt_31(-0.73727733681012f), Qfmt_31(-0.79335334029124f), Qfmt_31(0.84339144581289f),
|
||||
Qfmt_31(0.88701083317822f), Qfmt_31(0.92387953251129f), Qfmt_31(-0.95371695074823f),
|
||||
Qfmt_31(-0.97629600711993f), Qfmt_31(-0.99144486137381f), Qfmt_31(-0.99904822158186f),
|
||||
Qfmt_31(0.99904822158186f), Qfmt_31(0.99144486137381f), Qfmt_31(0.97629600711993f),
|
||||
Qfmt_31(0.95371695074823f), Qfmt_31(0.92387953251129f), Qfmt_31(0.88701083317822f),
|
||||
Qfmt_31(0.84339144581289f), Qfmt_31(0.79335334029124f), Qfmt_31(0.73727733681012f),
|
||||
Qfmt_31(0.67559020761566f), Qfmt_31(0.60876142900872f), Qfmt_31(0.53729960834682f),
|
||||
Qfmt_31(0.46174861323503f), Qfmt_31(0.38268343236509f), Qfmt_31(0.30070579950427f),
|
||||
Qfmt_31(0.21643961393810f), Qfmt_31(0.13052619222005f), Qfmt_31(0.04361938736534f)
|
||||
};
|
||||
|
||||
|
||||
const int32 start_win[36] =
|
||||
{
|
||||
/* k=0..17 sin(pi/36*(k+0.5)), */
|
||||
Qfmt_31(0.08723877473068f), Qfmt_31(0.26105238444010f), Qfmt_31(0.43287922787620f),
|
||||
Qfmt_31(0.60141159900854f), Qfmt_31(0.76536686473018f), Qfmt_31(0.92349722647006f),
|
||||
Qfmt_31(0.53729960834682f), Qfmt_31(0.60876142900872f), Qfmt_31(0.67559020761566f),
|
||||
Qfmt_31(-0.73727733681012f), Qfmt_31(-0.79335334029124f), Qfmt_31(0.84339144581289f),
|
||||
Qfmt_31(0.88701083317822f), Qfmt_31(0.92387953251129f), Qfmt_31(-0.95371695074823f),
|
||||
Qfmt_31(-0.97629600711993f), Qfmt_31(-0.99144486137381f), Qfmt_31(-0.99904822158186f),
|
||||
|
||||
Qfmt_31(0.99999990000000f), Qfmt_31(0.99999990000000f), Qfmt_31(0.99999990000000f),
|
||||
Qfmt_31(0.99999990000000f), Qfmt_31(0.99999990000000f), Qfmt_31(0.99999990000000f),
|
||||
/* k=24..29; sin(pi/12*(k-18+0.5)) */
|
||||
Qfmt_31(0.99144486137381f), Qfmt_31(0.92387953251129f), Qfmt_31(0.79335334029124f),
|
||||
Qfmt_31(0.60876142900872f), Qfmt_31(0.38268343236509f), Qfmt_31(0.13052619222005f),
|
||||
|
||||
Qfmt_31(0.00000000000000f), Qfmt_31(0.00000000000000f), Qfmt_31(0.00000000000000f),
|
||||
Qfmt_31(0.00000000000000f), Qfmt_31(0.00000000000000f), Qfmt_31(0.00000000000000f)
|
||||
};
|
||||
|
||||
|
||||
const int32 stop_win[36] =
|
||||
{
|
||||
Qfmt_31(0.00000000000000f), Qfmt_31(0.00000000000000f), Qfmt_31(0.00000000000000f),
|
||||
Qfmt_31(0.00000000000000f), Qfmt_31(0.00000000000000f), Qfmt_31(0.00000000000000f),
|
||||
/* k=6..11; sin(pi/12*(k-6+0.5)) */
|
||||
Qfmt_31(0.13052619222005f), Qfmt_31(0.38268343236509f), Qfmt_31(0.60876142900872f),
|
||||
Qfmt_31(-0.79335334029124f), Qfmt_31(-0.92387953251129f), Qfmt_31(0.99144486137381f),
|
||||
|
||||
Qfmt_31(0.99999990000000f), Qfmt_31(0.99999990000000f), Qfmt_31(-0.99999990000000f),
|
||||
Qfmt_31(-0.99999990000000f), Qfmt_31(-0.99999990000000f), Qfmt_31(-0.99999990000000f),
|
||||
/* k=18..35 sin(pi/36*(k+0.5)), */
|
||||
Qfmt_31(0.99904822158186f), Qfmt_31(0.99144486137381f), Qfmt_31(0.97629600711993f),
|
||||
Qfmt_31(0.95371695074823f), Qfmt_31(0.92387953251129f), Qfmt_31(0.88701083317822f),
|
||||
Qfmt_31(0.84339144581289f), Qfmt_31(0.79335334029124f), Qfmt_31(0.73727733681012f),
|
||||
Qfmt_31(0.67559020761566f), Qfmt_31(0.60876142900872f), Qfmt_31(0.53729960834682f),
|
||||
Qfmt_31(0.46174861323503f), Qfmt_31(0.38268343236509f), Qfmt_31(0.30070579950427f),
|
||||
Qfmt_31(0.21643961393810f), Qfmt_31(0.13052619222005f), Qfmt_31(0.04361938736534f)
|
||||
};
|
||||
|
||||
|
||||
const int32 short_win[12] =
|
||||
{
|
||||
/* k=0..11; sin(pi/12*(k+0.5)) */
|
||||
Qfmt_31(0.13052619222005f), Qfmt_31(0.38268343236509f), Qfmt_31(0.60876142900872f),
|
||||
Qfmt_31(0.79335334029124f), Qfmt_31(0.92387953251129f), Qfmt_31(0.99144486137381f),
|
||||
Qfmt_31(0.99144486137381f), Qfmt_31(0.92387953251129f), Qfmt_31(0.79335334029124f),
|
||||
Qfmt_31(0.60876142900872f), Qfmt_31(0.38268343236509f), Qfmt_31(0.13052619222005f),
|
||||
};
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL FUNCTION REFERENCES
|
||||
; Declare functions defined elsewhere and referenced in this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
void pvmp3_imdct_synth(int32 in[SUBBANDS_NUMBER*FILTERBANK_BANDS],
|
||||
int32 overlap[SUBBANDS_NUMBER*FILTERBANK_BANDS],
|
||||
uint32 blk_type,
|
||||
int16 mx_band,
|
||||
int32 used_freq_lines,
|
||||
int32 *Scratch_mem)
|
||||
{
|
||||
|
||||
int32 band;
|
||||
int32 bands2process = used_freq_lines + 2;
|
||||
|
||||
if (bands2process > SUBBANDS_NUMBER)
|
||||
{
|
||||
bands2process = SUBBANDS_NUMBER; /* default */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* in case of mx_poly_band> 0, do
|
||||
* long transforms
|
||||
*/
|
||||
|
||||
|
||||
for (band = 0; band < bands2process; band++)
|
||||
{
|
||||
uint32 current_blk_type = (band < mx_band) ? LONG : blk_type;
|
||||
|
||||
int32 * out = in + (band * FILTERBANK_BANDS);
|
||||
int32 * history = overlap + (band * FILTERBANK_BANDS);
|
||||
|
||||
switch (current_blk_type)
|
||||
{
|
||||
case LONG:
|
||||
|
||||
pvmp3_mdct_18(out, history, normal_win);
|
||||
|
||||
break;
|
||||
|
||||
case START:
|
||||
|
||||
pvmp3_mdct_18(out, history, start_win);
|
||||
|
||||
break;
|
||||
|
||||
case STOP:
|
||||
|
||||
pvmp3_mdct_18(out, history, stop_win);
|
||||
|
||||
break;
|
||||
|
||||
case SHORT:
|
||||
{
|
||||
int32 *tmp_prev_ovr = &Scratch_mem[FILTERBANK_BANDS];
|
||||
int32 i;
|
||||
|
||||
for (i = 0; i < 6; i++)
|
||||
{
|
||||
Scratch_mem[i ] = out[(i*3)];
|
||||
Scratch_mem[6 +i] = out[(i*3) + 1];
|
||||
Scratch_mem[12 +i] = out[(i*3) + 2];
|
||||
}
|
||||
|
||||
pvmp3_mdct_6(&Scratch_mem[ 0], &tmp_prev_ovr[ 0]);
|
||||
pvmp3_mdct_6(&Scratch_mem[ 6], &tmp_prev_ovr[ 6]);
|
||||
pvmp3_mdct_6(&Scratch_mem[12], &tmp_prev_ovr[12]);
|
||||
|
||||
for (i = 0; i < 6; i++)
|
||||
{
|
||||
int32 temp = history[i];
|
||||
/* next iteration overlap */
|
||||
history[i] = fxp_mul32_Q32(tmp_prev_ovr[ 6+i] << 1, short_win[6+i]);
|
||||
history[i] += fxp_mul32_Q32(Scratch_mem[12+i] << 1, short_win[ i]);
|
||||
out[i] = temp;
|
||||
}
|
||||
|
||||
for (i = 0; i < 6; i++)
|
||||
{
|
||||
out[i+6] = fxp_mul32_Q32(Scratch_mem[i] << 1, short_win[i]);
|
||||
out[i+6] += history[i+6];
|
||||
/* next iteration overlap */
|
||||
history[i+6] = fxp_mul32_Q32(tmp_prev_ovr[12+i] << 1, short_win[6+i]);
|
||||
|
||||
}
|
||||
for (i = 0; i < 6; i++)
|
||||
{
|
||||
out[i+12] = fxp_mul32_Q32(tmp_prev_ovr[ i] << 1, short_win[6+i]);
|
||||
out[i+12] += fxp_mul32_Q32(Scratch_mem[6+i] << 1, short_win[ i]);
|
||||
out[i+12] += history[i+12];
|
||||
history[12+i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Compensation for frequency inversion of polyphase filterbank
|
||||
* every odd time sample of every odd odd subband is mulitplied by -1 before
|
||||
* processing by the polyphase filter
|
||||
*/
|
||||
|
||||
if (band & 1)
|
||||
{
|
||||
for (int32 slot = 1; slot < FILTERBANK_BANDS; slot += 6)
|
||||
{
|
||||
int32 temp1 = out[slot ];
|
||||
int32 temp2 = out[slot+2];
|
||||
int32 temp3 = out[slot+4];
|
||||
out[slot ] = -temp1;
|
||||
out[slot+2] = -temp2;
|
||||
out[slot+4] = -temp3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (band = bands2process; band < SUBBANDS_NUMBER; band++)
|
||||
{
|
||||
int32 * out = in + (band * FILTERBANK_BANDS);
|
||||
int32 * history = overlap + (band * FILTERBANK_BANDS);
|
||||
int32 slot;
|
||||
|
||||
if (band & 1)
|
||||
{
|
||||
for (slot = 0; slot < FILTERBANK_BANDS; slot += 6)
|
||||
{
|
||||
int32 temp1 = history[slot ];
|
||||
int32 temp2 = history[slot+1];
|
||||
int32 temp3 = history[slot+2];
|
||||
out[slot ] = temp1;
|
||||
out[slot+1] = -temp2;
|
||||
out[slot+2] = temp3;
|
||||
|
||||
temp1 = history[slot+3];
|
||||
temp2 = history[slot+4];
|
||||
temp3 = history[slot+5];
|
||||
out[slot+3] = -temp1;
|
||||
out[slot+4] = temp2;
|
||||
out[slot+5] = -temp3;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (slot = 0; slot < FILTERBANK_BANDS; slot += 3)
|
||||
{
|
||||
int32 temp1 = history[slot ];
|
||||
int32 temp2 = history[slot+1];
|
||||
int32 temp3 = history[slot+2];
|
||||
out[slot ] = temp1;
|
||||
out[slot+1] = temp2;
|
||||
out[slot+2] = temp3;
|
||||
}
|
||||
}
|
||||
|
||||
pv_memset(history, 0, FILTERBANK_BANDS*sizeof(*overlap));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
102
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_imdct_synth.h
vendored
Normal file
102
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_imdct_synth.h
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: pvmp3_imdct_synth.h
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
Description:
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
|
||||
[1] ISO MPEG Audio Subgroup Software Simulation Group (1996)
|
||||
ISO 13818-3 MPEG-2 Audio Decoder - Lower Sampling Frequency Extension
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef PVMP3_IMDCT_SYNTH_H
|
||||
#define PVMP3_IMDCT_SYNTH_H
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "pvmp3_dec_defs.h"
|
||||
#include "pvmp3_audio_type_defs.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES AND SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
void pvmp3_imdct_synth(int32 in[SUBBANDS_NUMBER*FILTERBANK_BANDS],
|
||||
int32 overlap[SUBBANDS_NUMBER*FILTERBANK_BANDS],
|
||||
uint32 blk_type,
|
||||
int16 mx_band,
|
||||
int32 used_freq_lines,
|
||||
int32 *Scratch_mem);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
289
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_mdct_18.cpp
vendored
Normal file
289
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_mdct_18.cpp
vendored
Normal file
@@ -0,0 +1,289 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: mdct_18.cpp
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
|
||||
Description:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Input
|
||||
int32 vec[], input vector of length 18
|
||||
int32 *history input for overlap and add, vector updated with
|
||||
next overlap and add values
|
||||
const int32 *window sine window used in the mdct, three types are allowed
|
||||
noraml, start and stop
|
||||
Returns
|
||||
none mdct computation in-place
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION DESCRIPTION
|
||||
|
||||
Returns the mdct of length 18 of the input vector, as well as the overlap
|
||||
vector for next iteration ( on history[])
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REQUIREMENTS
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PSEUDO-CODE
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#if ( !defined(PV_ARM_GCC_V5) && !defined(PV_ARM_GCC_V4) && !defined(PV_ARM_V5) && !defined(PV_ARM_V4) )
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "pv_mp3dec_fxd_op.h"
|
||||
#include "pvmp3_mdct_18.h"
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here. Include conditional
|
||||
; compile variables also.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL STORE/BUFFER/POINTER DEFINITIONS
|
||||
; Variable declaration - defined here and used outside this module
|
||||
----------------------------------------------------------------------------*/
|
||||
const int32 cosTerms_dct18[9] =
|
||||
{
|
||||
Qfmt(0.50190991877167f), Qfmt(0.51763809020504f), Qfmt(0.55168895948125f),
|
||||
Qfmt(0.61038729438073f), Qfmt(0.70710678118655f), Qfmt(0.87172339781055f),
|
||||
Qfmt(1.18310079157625f), Qfmt(1.93185165257814f), Qfmt(5.73685662283493f)
|
||||
};
|
||||
|
||||
|
||||
const int32 cosTerms_1_ov_cos_phi[18] =
|
||||
{
|
||||
|
||||
Qfmt1(0.50047634258166f), Qfmt1(0.50431448029008f), Qfmt1(0.51213975715725f),
|
||||
Qfmt1(0.52426456257041f), Qfmt1(0.54119610014620f), Qfmt1(0.56369097343317f),
|
||||
Qfmt1(0.59284452371708f), Qfmt1(0.63023620700513f), Qfmt1(0.67817085245463f),
|
||||
|
||||
Qfmt2(0.74009361646113f), Qfmt2(0.82133981585229f), Qfmt2(0.93057949835179f),
|
||||
Qfmt2(1.08284028510010f), Qfmt2(1.30656296487638f), Qfmt2(1.66275476171152f),
|
||||
Qfmt2(2.31011315767265f), Qfmt2(3.83064878777019f), Qfmt2(11.46279281302667f)
|
||||
};
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL FUNCTION REFERENCES
|
||||
; Declare functions defined elsewhere and referenced in this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
||||
void pvmp3_mdct_18(int32 vec[], int32 *history, const int32 *window)
|
||||
{
|
||||
int32 i;
|
||||
int32 tmp;
|
||||
int32 tmp1;
|
||||
int32 tmp2;
|
||||
int32 tmp3;
|
||||
int32 tmp4;
|
||||
|
||||
|
||||
|
||||
const int32 *pt_cos_split = cosTerms_dct18;
|
||||
const int32 *pt_cos = cosTerms_1_ov_cos_phi;
|
||||
const int32 *pt_cos_x = &cosTerms_1_ov_cos_phi[17];
|
||||
int32 *pt_vec = vec;
|
||||
int32 *pt_vec_o = &vec[17];
|
||||
|
||||
|
||||
for (i = 9; i != 0; i--)
|
||||
{
|
||||
tmp = *(pt_vec);
|
||||
tmp1 = *(pt_vec_o);
|
||||
tmp = fxp_mul32_Q32(tmp << 1, *(pt_cos++));
|
||||
tmp1 = fxp_mul32_Q27(tmp1, *(pt_cos_x--));
|
||||
*(pt_vec++) = tmp + tmp1 ;
|
||||
*(pt_vec_o--) = fxp_mul32_Q28((tmp - tmp1), *(pt_cos_split++));
|
||||
}
|
||||
|
||||
|
||||
pvmp3_dct_9(vec); // Even terms
|
||||
pvmp3_dct_9(&vec[9]); // Odd terms
|
||||
|
||||
|
||||
tmp3 = vec[16]; //
|
||||
vec[16] = vec[ 8];
|
||||
tmp4 = vec[14]; //
|
||||
vec[14] = vec[ 7];
|
||||
tmp = vec[12];
|
||||
vec[12] = vec[ 6];
|
||||
tmp2 = vec[10]; // vec[10]
|
||||
vec[10] = vec[ 5];
|
||||
vec[ 8] = vec[ 4];
|
||||
vec[ 6] = vec[ 3];
|
||||
vec[ 4] = vec[ 2];
|
||||
vec[ 2] = vec[ 1];
|
||||
vec[ 1] = vec[ 9] - tmp2; // vec[9] + vec[10]
|
||||
vec[ 3] = vec[11] - tmp2;
|
||||
vec[ 5] = vec[11] - tmp;
|
||||
vec[ 7] = vec[13] - tmp;
|
||||
vec[ 9] = vec[13] - tmp4;
|
||||
vec[11] = vec[15] - tmp4;
|
||||
vec[13] = vec[15] - tmp3;
|
||||
vec[15] = vec[17] - tmp3;
|
||||
|
||||
|
||||
/* overlap and add */
|
||||
|
||||
tmp2 = vec[0];
|
||||
tmp3 = vec[9];
|
||||
|
||||
for (i = 0; i < 6; i++)
|
||||
{
|
||||
tmp = history[ i];
|
||||
tmp4 = vec[i+10];
|
||||
vec[i+10] = tmp3 + tmp4;
|
||||
tmp1 = vec[i+1];
|
||||
vec[ i] = fxp_mac32_Q32(tmp, (vec[i+10]), window[ i]);
|
||||
tmp3 = tmp4;
|
||||
history[i ] = -(tmp2 + tmp1);
|
||||
tmp2 = tmp1;
|
||||
}
|
||||
|
||||
tmp = history[ 6];
|
||||
tmp4 = vec[16];
|
||||
vec[16] = tmp3 + tmp4;
|
||||
tmp1 = vec[7];
|
||||
vec[ 6] = fxp_mac32_Q32(tmp, vec[16] << 1, window[ i]);
|
||||
tmp = history[ 7];
|
||||
history[6] = -(tmp2 + tmp1);
|
||||
history[7] = -(tmp1 + vec[8]);
|
||||
|
||||
tmp1 = history[ 8];
|
||||
tmp4 = vec[17] + tmp4;
|
||||
vec[ 7] = fxp_mac32_Q32(tmp, tmp4 << 1, window[ 7]);
|
||||
history[8] = -(vec[8] + vec[9]);
|
||||
vec[ 8] = fxp_mac32_Q32(tmp1, vec[17] << 1, window[ 8]);
|
||||
|
||||
tmp = history[9];
|
||||
tmp1 = history[17];
|
||||
tmp2 = history[16];
|
||||
vec[ 9] = fxp_mac32_Q32(tmp, vec[17] << 1, window[ 9]);
|
||||
|
||||
vec[17] = fxp_mac32_Q32(tmp1, vec[10] << 1, window[17]);
|
||||
vec[10] = -vec[ 16];
|
||||
vec[16] = fxp_mac32_Q32(tmp2, vec[11] << 1, window[16]);
|
||||
tmp1 = history[15];
|
||||
tmp2 = history[14];
|
||||
vec[11] = -vec[ 15];
|
||||
vec[15] = fxp_mac32_Q32(tmp1, vec[12] << 1, window[15]);
|
||||
vec[12] = -vec[ 14];
|
||||
vec[14] = fxp_mac32_Q32(tmp2, vec[13] << 1, window[14]);
|
||||
|
||||
tmp = history[13];
|
||||
tmp1 = history[12];
|
||||
tmp2 = history[11];
|
||||
tmp3 = history[10];
|
||||
vec[13] = fxp_mac32_Q32(tmp, vec[12] << 1, window[13]);
|
||||
vec[12] = fxp_mac32_Q32(tmp1, vec[11] << 1, window[12]);
|
||||
vec[11] = fxp_mac32_Q32(tmp2, vec[10] << 1, window[11]);
|
||||
vec[10] = fxp_mac32_Q32(tmp3, tmp4 << 1, window[10]);
|
||||
|
||||
|
||||
/* next iteration overlap */
|
||||
|
||||
tmp1 = history[ 8];
|
||||
tmp3 = history[ 7];
|
||||
tmp2 = history[ 1];
|
||||
tmp = history[ 0];
|
||||
tmp1 <<= 1;
|
||||
tmp3 <<= 1;
|
||||
|
||||
history[ 0] = fxp_mul32_Q32(tmp1, window[18]);
|
||||
history[17] = fxp_mul32_Q32(tmp1, window[35]);
|
||||
history[ 1] = fxp_mul32_Q32(tmp3, window[19]);
|
||||
history[16] = fxp_mul32_Q32(tmp3, window[34]);
|
||||
|
||||
tmp2 <<= 1;
|
||||
tmp <<= 1;
|
||||
history[ 7] = fxp_mul32_Q32(tmp2, window[25]);
|
||||
history[10] = fxp_mul32_Q32(tmp2, window[28]);
|
||||
history[ 8] = fxp_mul32_Q32(tmp, window[26]);
|
||||
history[ 9] = fxp_mul32_Q32(tmp, window[27]);
|
||||
|
||||
tmp1 = history[ 6];
|
||||
tmp3 = history[ 5];
|
||||
tmp4 = history[ 4];
|
||||
tmp2 = history[ 3];
|
||||
tmp = history[ 2];
|
||||
|
||||
tmp1 <<= 1;
|
||||
tmp3 <<= 1;
|
||||
tmp4 <<= 1;
|
||||
|
||||
history[ 2] = fxp_mul32_Q32(tmp1, window[20]);
|
||||
history[15] = fxp_mul32_Q32(tmp1, window[33]);
|
||||
history[ 3] = fxp_mul32_Q32(tmp3, window[21]);
|
||||
history[14] = fxp_mul32_Q32(tmp3, window[32]);
|
||||
history[ 4] = fxp_mul32_Q32(tmp4, window[22]);
|
||||
history[13] = fxp_mul32_Q32(tmp4, window[31]);
|
||||
tmp2 <<= 1;
|
||||
tmp <<= 1;
|
||||
history[ 5] = fxp_mul32_Q32(tmp2, window[23]);
|
||||
history[12] = fxp_mul32_Q32(tmp2, window[30]);
|
||||
history[ 6] = fxp_mul32_Q32(tmp, window[24]);
|
||||
history[11] = fxp_mul32_Q32(tmp, window[29]);
|
||||
}
|
||||
|
||||
#endif // If not assembly
|
||||
109
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_mdct_18.h
vendored
Normal file
109
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_mdct_18.h
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Pathname: ./include/pvmp3_mdct_18.h
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
|
||||
Description:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This include file defines function mdct_18, dct9, mdct_6 and dct_6
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef MDCT_18_H
|
||||
#define MDCT_18_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "pvmp3_audio_type_defs.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
#define Qfmt(a) (Int32)(a*((Int32)1<<28) )
|
||||
#define Qfmt1(a) (Int32)(a*((Int32)0x7FFFFFFF))
|
||||
#define Qfmt2(a) (Int32)(a*((Int32)1<<27))
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
void pvmp3_mdct_18(int32 vec[], int32 *history, const int32 *window);
|
||||
|
||||
void pvmp3_dct_9(int32 vec[]);
|
||||
|
||||
void pvmp3_mdct_6(int32 vec[], int32 *overlap);
|
||||
|
||||
void pvmp3_dct_6(int32 vec[]);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#endif
|
||||
|
||||
|
||||
165
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_mdct_6.cpp
vendored
Normal file
165
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_mdct_6.cpp
vendored
Normal file
@@ -0,0 +1,165 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
Filename: mdct_18.cpp
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
|
||||
Description:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Input
|
||||
int32 vec[], input vector of length 6
|
||||
int32 *history input for overlap and add, vector updated with
|
||||
next overlap and add values
|
||||
Returns
|
||||
none mdct computation in-place
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION DESCRIPTION
|
||||
|
||||
Returns the mdct of length 6 of the input vector, as well as the overlap
|
||||
vector for next iteration ( on history[])
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REQUIREMENTS
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PSEUDO-CODE
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "pv_mp3dec_fxd_op.h"
|
||||
#include "pvmp3_mdct_6.h"
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here. Include conditional
|
||||
; compile variables also.
|
||||
----------------------------------------------------------------------------*/
|
||||
#define QFORMAT 29
|
||||
#define Qfmt29(a) (int32)(a*((int32)1<<QFORMAT) + (a>=0?0.5F:-0.5F))
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL STORE/BUFFER/POINTER DEFINITIONS
|
||||
; Variable declaration - defined here and used outside this module
|
||||
----------------------------------------------------------------------------*/
|
||||
/*
|
||||
* (1./(2*cos((pi/(2*N))*(2*i+1)))), N = 12, i = [0:N/2-1]
|
||||
*/
|
||||
|
||||
const int32 cosTerms_1_ov_cos_phi_N6[6] =
|
||||
{
|
||||
|
||||
Qfmt29(0.50431448029008f), Qfmt29(0.54119610014620f),
|
||||
Qfmt29(0.63023620700513f), Qfmt29(0.82133981585229f),
|
||||
Qfmt29(1.30656296487638f), Qfmt29(3.83064878777019f)
|
||||
};
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL FUNCTION REFERENCES
|
||||
; Declare functions defined elsewhere and referenced in this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
void pvmp3_mdct_6(int32 vec[], int32 *history)
|
||||
{
|
||||
int32 i;
|
||||
int32 tmp;
|
||||
int32 tmp1;
|
||||
int32 tmp2;
|
||||
|
||||
int32 *pt_vec = vec;
|
||||
int32 *pt_vec_o = vec;
|
||||
const int32 *pt_cos = cosTerms_1_ov_cos_phi_N6;
|
||||
|
||||
for (i = 2; i != 0; i--)
|
||||
{
|
||||
tmp = *(pt_vec++);
|
||||
tmp1 = *(pt_vec++);
|
||||
tmp2 = *(pt_vec++);
|
||||
*(pt_vec_o++) = fxp_mul32_Q29(tmp, *(pt_cos++));
|
||||
*(pt_vec_o++) = fxp_mul32_Q29(tmp1, *(pt_cos++));
|
||||
*(pt_vec_o++) = fxp_mul32_Q29(tmp2, *(pt_cos++));
|
||||
}
|
||||
|
||||
|
||||
pvmp3_dct_6(vec); // Even terms
|
||||
|
||||
|
||||
tmp = -(vec[0] + vec[1]);
|
||||
history[3] = tmp;
|
||||
history[2] = tmp;
|
||||
tmp = -(vec[1] + vec[2]);
|
||||
vec[0] = vec[3] + vec[4];
|
||||
vec[1] = vec[4] + vec[5];
|
||||
history[4] = tmp;
|
||||
history[1] = tmp;
|
||||
tmp = -(vec[2] + vec[3]);
|
||||
vec[4] = -vec[1];
|
||||
history[5] = tmp;
|
||||
history[0] = tmp;
|
||||
|
||||
vec[2] = vec[5];
|
||||
vec[3] = -vec[5];
|
||||
vec[5] = -vec[0];
|
||||
|
||||
}
|
||||
|
||||
106
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_mdct_6.h
vendored
Normal file
106
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_mdct_6.h
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Pathname: ./include/pvmp3_mdct_6.h
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
|
||||
Description:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This include file defines function mdct_18, dct9, mdct_6 and dct_6
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef PVMP3_MDCT_6_H
|
||||
#define PVMP3_MDCT_6_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "pvmp3_audio_type_defs.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
#define Qfmt(a) (Int32)(a*((Int32)1<<28) )
|
||||
#define Qfmt1(a) (Int32)(a*((Int32)0x7FFFFFFF))
|
||||
#define Qfmt2(a) (Int32)(a*((Int32)1<<27))
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
|
||||
void pvmp3_mdct_6(int32 vec[], int32 *overlap);
|
||||
|
||||
void pvmp3_dct_6(int32 vec[]);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#endif
|
||||
|
||||
|
||||
247
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_mpeg2_get_scale_data.cpp
vendored
Normal file
247
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_mpeg2_get_scale_data.cpp
vendored
Normal file
@@ -0,0 +1,247 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: pvmp3_mpeg2_get_scale_data.cpp
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
|
||||
Description:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Input
|
||||
mp3SideInfo *si, side information
|
||||
int32 gr, granule
|
||||
int32 ch, channel
|
||||
mp3Header *info, mp3 header information
|
||||
uint32 *scalefac_buffer,
|
||||
uint32 *scalefac_IIP_buffer,
|
||||
tbits *pMainData bit stream Data
|
||||
|
||||
Returns
|
||||
|
||||
uint32 *scalefac_buffer, acquired scale band data
|
||||
uint32 *scalefac_IIP_buffer, auxiliary scale data
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION DESCRIPTION
|
||||
|
||||
get scale data for mpeg2 layer III LSF extension
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REQUIREMENTS
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
|
||||
[1] ISO MPEG Audio Subgroup Software Simulation Group (1996)
|
||||
ISO 13818-3 MPEG-2 Audio Decoder - Lower Sampling Frequency Extension
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PSEUDO-CODE
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "pvmp3_mpeg2_get_scale_data.h"
|
||||
#include "pvmp3_getbits.h"
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here. Include conditional
|
||||
; compile variables also.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL STORE/BUFFER/POINTER DEFINITIONS
|
||||
; Variable declaration - defined here and used outside this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
const uint32 nr_of_sfb_block[6][3][4] =
|
||||
{ {{ 6, 5, 5, 5}, { 9, 9, 9, 9}, { 6, 9, 9, 9}},
|
||||
{{ 6, 5, 7, 3}, { 9, 9, 12, 6}, { 6, 9, 12, 6}},
|
||||
{{11, 10, 0, 0}, { 18, 18, 0, 0}, {15, 18, 0, 0}},
|
||||
{{ 7, 7, 7, 0}, { 12, 12, 12, 0}, { 6, 15, 12, 0}},
|
||||
{{ 6, 6, 6, 3}, { 12, 9, 9, 6}, { 6, 12, 9, 6}},
|
||||
{{ 8, 8, 5, 0}, { 15, 12, 9, 0}, { 6, 18, 9, 0}}
|
||||
};
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL FUNCTION REFERENCES
|
||||
; Declare functions defined elsewhere and referenced in this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
void pvmp3_mpeg2_get_scale_data(mp3SideInfo *si,
|
||||
int32 gr,
|
||||
int32 ch,
|
||||
mp3Header *info,
|
||||
uint32 *scalefac_buffer,
|
||||
uint32 *scalefac_IIP_buffer,
|
||||
tmp3Bits *pMainData)
|
||||
{
|
||||
int16 i;
|
||||
int16 j;
|
||||
int16 k;
|
||||
int16 blocktypenumber = 0;
|
||||
int16 blocknumber = 0;
|
||||
|
||||
granuleInfo *gr_info = &(si->ch[ch].gran[gr]);
|
||||
uint32 scalefac_comp, int_scalefac_comp, new_slen[4] = { 0,0,0,0 };
|
||||
|
||||
scalefac_comp = gr_info->scalefac_compress;
|
||||
|
||||
|
||||
|
||||
if ((((info->mode_ext &1)) && (ch == 1)))
|
||||
{
|
||||
/* intensity_scale = scalefac_comp %2; */
|
||||
int_scalefac_comp = scalefac_comp >> 1;
|
||||
|
||||
if (int_scalefac_comp < 180)
|
||||
{
|
||||
new_slen[0] = int_scalefac_comp / 36;
|
||||
new_slen[1] = (int_scalefac_comp % 36) / 6;
|
||||
new_slen[2] = int_scalefac_comp % 6;
|
||||
blocknumber = 3;
|
||||
}
|
||||
else if (int_scalefac_comp < 244)
|
||||
{
|
||||
int_scalefac_comp -= 180;
|
||||
new_slen[0] = (int_scalefac_comp & 63) >> 4;
|
||||
new_slen[1] = (int_scalefac_comp & 15) >> 2;
|
||||
new_slen[2] = int_scalefac_comp & 3;
|
||||
blocknumber = 4;
|
||||
}
|
||||
else if (int_scalefac_comp <= 255)
|
||||
{
|
||||
int_scalefac_comp -= 244;
|
||||
new_slen[0] = (int_scalefac_comp) / 3;
|
||||
new_slen[1] = (int_scalefac_comp) % 3;
|
||||
new_slen[2] = 0;
|
||||
blocknumber = 5;
|
||||
}
|
||||
new_slen[3] = 0;
|
||||
si->ch[ch].gran[gr].preflag = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (scalefac_comp < 400)
|
||||
{
|
||||
new_slen[0] = (scalefac_comp >> 4) / 5;
|
||||
new_slen[1] = (scalefac_comp >> 4) % 5;
|
||||
new_slen[2] = (scalefac_comp & 15) >> 2 ;
|
||||
new_slen[3] = (scalefac_comp & 3);
|
||||
si->ch[ch].gran[gr].preflag = 0;
|
||||
|
||||
blocknumber = 0;
|
||||
}
|
||||
else if (scalefac_comp < 500)
|
||||
{
|
||||
scalefac_comp -= 400;
|
||||
new_slen[0] = (scalefac_comp >> 2) / 5;
|
||||
new_slen[1] = (scalefac_comp >> 2) % 5;
|
||||
new_slen[2] = scalefac_comp & 3;
|
||||
new_slen[3] = 0;
|
||||
si->ch[ch].gran[gr].preflag = 0;
|
||||
blocknumber = 1;
|
||||
}
|
||||
else if (scalefac_comp < 512)
|
||||
{
|
||||
scalefac_comp -= 500;
|
||||
new_slen[0] = scalefac_comp / 3;
|
||||
new_slen[1] = scalefac_comp % 3;
|
||||
new_slen[2] = 0 ;
|
||||
new_slen[3] = 0;
|
||||
si->ch[ch].gran[gr].preflag = 1;
|
||||
blocknumber = 2;
|
||||
}
|
||||
}
|
||||
|
||||
if (gr_info->block_type == 2)
|
||||
{
|
||||
if (gr_info->mixed_block_flag)
|
||||
{
|
||||
blocktypenumber = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
blocktypenumber = 1;
|
||||
}
|
||||
}
|
||||
|
||||
k = 0;
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if (new_slen[i])
|
||||
{
|
||||
for (j = 0; j < (int16)nr_of_sfb_block[blocknumber][blocktypenumber][i]; j++)
|
||||
{
|
||||
scalefac_buffer[k] = getNbits(pMainData, new_slen[i]);
|
||||
scalefac_IIP_buffer[k] = (1L << new_slen[i]) - 1;
|
||||
k++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (j = 0; j < (int16)nr_of_sfb_block[blocknumber][blocktypenumber][i]; j++)
|
||||
{
|
||||
scalefac_buffer[k] = 0;
|
||||
scalefac_IIP_buffer[k] = 0;
|
||||
k++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
105
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_mpeg2_get_scale_data.h
vendored
Normal file
105
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_mpeg2_get_scale_data.h
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: pvmp3_mpeg2_get_scale_data.h
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
Description:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef PVMP3_MPEG2_GET_SCALE_DATA_H
|
||||
#define PVMP3_MPEG2_GET_SCALE_DATA_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "pvmp3_dec_defs.h"
|
||||
#include "pvmp3_audio_type_defs.h"
|
||||
#include "s_mp3bits.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
void pvmp3_mpeg2_get_scale_data(mp3SideInfo *si,
|
||||
int32 gr,
|
||||
int32 ch,
|
||||
mp3Header *info,
|
||||
uint32 *scalefac_buffer,
|
||||
uint32 *scalefac_IIP_buffer,
|
||||
tmp3Bits *pMainData);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#endif
|
||||
|
||||
202
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_mpeg2_get_scale_factors.cpp
vendored
Normal file
202
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_mpeg2_get_scale_factors.cpp
vendored
Normal file
@@ -0,0 +1,202 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: pvmp3_mpeg2_get_scale_factors.cpp
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
|
||||
Description:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Input
|
||||
|
||||
mp3ScaleFactors *scalefac,
|
||||
mp3SideInfo *si, side information
|
||||
int32 gr, granule
|
||||
int32 ch, channel
|
||||
mp3Header *info, mp3 header information
|
||||
uint32 *scalefac_IIP_buffer, auxiliary scale data
|
||||
tbits *pMainData bit stream Data
|
||||
|
||||
Returns
|
||||
|
||||
III_scalefac_t *scalefac, scale factor
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION DESCRIPTION
|
||||
|
||||
get scale factor for mpe2 layer III LSF extension
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REQUIREMENTS
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
|
||||
[1] ISO MPEG Audio Subgroup Software Simulation Group (1996)
|
||||
ISO 13818-3 MPEG-2 Audio Decoder - Lower Sampling Frequency Extension
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PSEUDO-CODE
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "pvmp3_mpeg2_get_scale_factors.h"
|
||||
#include "pvmp3_mpeg2_get_scale_data.h"
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here. Include conditional
|
||||
; compile variables also.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL STORE/BUFFER/POINTER DEFINITIONS
|
||||
; Variable declaration - defined here and used outside this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL FUNCTION REFERENCES
|
||||
; Declare functions defined elsewhere and referenced in this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
void pvmp3_mpeg2_get_scale_factors(mp3ScaleFactors *scalefac,
|
||||
mp3SideInfo *si,
|
||||
int32 gr,
|
||||
int32 ch,
|
||||
mp3Header *info,
|
||||
uint32 *scalefac_IIP_buffer,
|
||||
tmp3Bits *pMainData)
|
||||
{
|
||||
|
||||
int32 sfb;
|
||||
int32 k = 0;
|
||||
int32 window;
|
||||
uint32 *scalefac_buffer = &scalefac_IIP_buffer[56];
|
||||
|
||||
granuleInfo *gr_info = &(si->ch[ch].gran[gr]);
|
||||
|
||||
pvmp3_mpeg2_get_scale_data(si,
|
||||
gr,
|
||||
ch,
|
||||
info,
|
||||
(uint32 *)scalefac_buffer,
|
||||
(uint32 *)scalefac_IIP_buffer,
|
||||
pMainData);
|
||||
|
||||
|
||||
if (gr_info->window_switching_flag && (gr_info->block_type == 2))
|
||||
{
|
||||
if (gr_info->mixed_block_flag)
|
||||
{
|
||||
for (sfb = 0; sfb < 6; sfb++)
|
||||
{
|
||||
scalefac->l[sfb] = scalefac_buffer[sfb];
|
||||
}
|
||||
|
||||
|
||||
k = 6;
|
||||
for (sfb = 3; sfb < 12; sfb++)
|
||||
{
|
||||
for (window = 0; window < 3; window++)
|
||||
{
|
||||
scalefac->s[window][sfb] = scalefac_buffer[k];
|
||||
k++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* adjust position of "illegal position" information in scalefac_IIP_buffer[] */
|
||||
/* in mixed blocks mode for short sfb, move them 3 places up. efs 3002-07-04 */
|
||||
for (sfb = 11; sfb >= 3; sfb--)
|
||||
{
|
||||
scalefac_IIP_buffer[3*sfb + 2] = scalefac_IIP_buffer[3*sfb - 1];
|
||||
scalefac_IIP_buffer[3*sfb + 1] = scalefac_IIP_buffer[3*sfb - 2];
|
||||
scalefac_IIP_buffer[3*sfb ] = scalefac_IIP_buffer[3*sfb - 3];
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{ /* SHORT*/
|
||||
for (sfb = 0; sfb < 12; sfb++)
|
||||
{
|
||||
for (window = 0; window < 3; window++)
|
||||
{
|
||||
scalefac->s[window][sfb] = scalefac_buffer[k];
|
||||
k++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
scalefac->s[0][12] = 0;
|
||||
scalefac->s[1][12] = 0;
|
||||
scalefac->s[2][12] = 0;
|
||||
|
||||
}
|
||||
else
|
||||
{ /* LONG types 0,1,3 */
|
||||
for (sfb = 0; sfb < 21; sfb++)
|
||||
{
|
||||
scalefac->l[sfb] = scalefac_buffer[sfb];
|
||||
}
|
||||
scalefac->l[21] = 0;
|
||||
scalefac->l[22] = 0;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
105
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_mpeg2_get_scale_factors.h
vendored
Normal file
105
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_mpeg2_get_scale_factors.h
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: pvmp3_mpeg2_get_scale_factors.h
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
Description:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef PVMP3_MPEG2_GET_SCALE_FACTORS_H
|
||||
#define PVMP3_MPEG2_GET_SCALE_FACTORS_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "pvmp3_dec_defs.h"
|
||||
#include "pvmp3_audio_type_defs.h"
|
||||
#include "s_mp3bits.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
void pvmp3_mpeg2_get_scale_factors(mp3ScaleFactors *scalefac,
|
||||
mp3SideInfo *si,
|
||||
int32 gr,
|
||||
int32 ch,
|
||||
mp3Header *info,
|
||||
uint32 *scalefac_IIP_buffer,
|
||||
tmp3Bits *pMainData);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#endif
|
||||
|
||||
700
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_mpeg2_stereo_proc.cpp
vendored
Normal file
700
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_mpeg2_stereo_proc.cpp
vendored
Normal file
@@ -0,0 +1,700 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: pvmp3_mpeg2_stereo_proc.cpp
|
||||
|
||||
Functions:
|
||||
|
||||
pvmp3_st_intensity_ver2
|
||||
pvmp3_mpeg2_stereo_proc
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
|
||||
Description:
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
pvmp3_st_intensity_ver2
|
||||
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Input
|
||||
|
||||
int32 xr[], input channel
|
||||
int32 xl[],
|
||||
int32 m, selecting index: io = 2(1/4) (m=0), io = 2(1/8) (m=1)
|
||||
int32 is_pos, index on table is_pos_pow_eitgh_root_of_2
|
||||
int32 Start, Location of first element where stereo intensity is applied
|
||||
int32 Number number of elements affected
|
||||
|
||||
Returns
|
||||
|
||||
int32 xl[], generated stereo channel
|
||||
|
||||
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
pvmp3_mpeg2_stereo_proc
|
||||
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Input
|
||||
|
||||
int32 xr[], input channel
|
||||
int32 xl[],
|
||||
mp3ScaleFactors *scalefac, scale factors structure for Right channel
|
||||
granuleInfo *gr_info_l, granule structure for the left channel
|
||||
granuleInfo *gr_info_r, granule structure for the rigth channel
|
||||
uint32 *scalefac_IIP_buffer, auxiliary scale factor vector
|
||||
mp3Header *info mp3 header info
|
||||
Returns
|
||||
|
||||
int32 xl[], generated stereo channel
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION DESCRIPTION
|
||||
|
||||
stereo processing for mpeg2 layer III LSF extension
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REQUIREMENTS
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
|
||||
[1] ISO MPEG Audio Subgroup Software Simulation Group (1996)
|
||||
ISO 13818-3 MPEG-2 Audio Decoder - Lower Sampling Frequency Extension
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PSEUDO-CODE
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "pvmp3_mpeg2_stereo_proc.h"
|
||||
#include "pvmp3_stereo_proc.h"
|
||||
#include "pv_mp3dec_fxd_op.h"
|
||||
#include "pvmp3_tables.h"
|
||||
#include "mp3_mem_funcs.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here. Include conditional
|
||||
; compile variables also.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#define Q31_fmt(a) (int32(double(0x7FFFFFFF)*a))
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL STORE/BUFFER/POINTER DEFINITIONS
|
||||
; Variable declaration - defined here and used outside this module
|
||||
----------------------------------------------------------------------------*/
|
||||
const int32 is_pos_pow_eitgh_root_of_2[8] =
|
||||
{
|
||||
/* --- 2^(1/8) ----- */
|
||||
Q31_fmt(1.00000000000000), Q31_fmt(0.91700404320467), Q31_fmt(0.84089641525371),
|
||||
Q31_fmt(0.77110541270397), Q31_fmt(0.70710678118655), Q31_fmt(0.64841977732550),
|
||||
Q31_fmt(0.59460355750136), Q31_fmt(0.54525386633263)
|
||||
};
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL FUNCTION REFERENCES
|
||||
; Declare functions defined elsewhere and referenced in this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
void pvmp3_st_intensity_ver2(int32 xr[SUBBANDS_NUMBER*FILTERBANK_BANDS],
|
||||
int32 xl[SUBBANDS_NUMBER*FILTERBANK_BANDS],
|
||||
int32 m,
|
||||
int32 is_pos,
|
||||
int32 Start,
|
||||
int32 Number)
|
||||
{
|
||||
int32 k[2];
|
||||
|
||||
/* pow(io, ((is_pos + 1)>>1)); io = 2(1/4) (m=0), io = 2(1/8) (m=1) */
|
||||
k[0] = is_pos_pow_eitgh_root_of_2[((is_pos+1)&(3+(m<<2)))<<(1-m)] >> ((is_pos + 1) >> (2 + m));
|
||||
/* pow(io, (is_pos>>1)); io = 2(1/4) (m=0), io = 2(1/8) (m=1) */
|
||||
k[1] = is_pos_pow_eitgh_root_of_2[(is_pos&(3+(m<<2)))<<(1-m)] >> (is_pos >> (2 + m));
|
||||
|
||||
|
||||
int32 *pt_xr = &xr[Start];
|
||||
int32 *pt_xl = &xl[Start];
|
||||
|
||||
if (is_pos == 0) /* 0 < is_pos < 31 */
|
||||
{
|
||||
pv_memcpy(pt_xl, pt_xr, Number*sizeof(*pt_xr));
|
||||
}
|
||||
else if (is_pos & 1)
|
||||
{
|
||||
for (int32 i = Number >> 1; i != 0; i--)
|
||||
{
|
||||
*(pt_xl++) = (*pt_xr);
|
||||
*(pt_xr) = fxp_mul32_Q32((*pt_xr) << 1, k[0]);
|
||||
pt_xr++;
|
||||
*(pt_xl++) = (*pt_xr);
|
||||
*(pt_xr) = fxp_mul32_Q32((*pt_xr) << 1, k[0]);
|
||||
pt_xr++;
|
||||
}
|
||||
if (Number&1)
|
||||
{
|
||||
*(pt_xl) = (*pt_xr);
|
||||
*(pt_xr) = fxp_mul32_Q32((*pt_xr) << 1, k[0]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int32 i = Number >> 1; i != 0; i--)
|
||||
{
|
||||
*(pt_xl++) = fxp_mul32_Q32((*(pt_xr++)) << 1, k[1]);
|
||||
*(pt_xl++) = fxp_mul32_Q32((*(pt_xr++)) << 1, k[1]);
|
||||
}
|
||||
if (Number&1)
|
||||
{
|
||||
*(pt_xl) = fxp_mul32_Q32((*pt_xr) << 1, k[1]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
void pvmp3_mpeg2_stereo_proc(int32 xr[SUBBANDS_NUMBER*FILTERBANK_BANDS],
|
||||
int32 xl[SUBBANDS_NUMBER*FILTERBANK_BANDS],
|
||||
mp3ScaleFactors *scalefac_R,
|
||||
granuleInfo *gr_info_l,
|
||||
granuleInfo *gr_info_r,
|
||||
uint32 *scalefac_IIP_buffer,
|
||||
int32 used_freq_lines,
|
||||
mp3Header *info)
|
||||
{
|
||||
|
||||
int32 sfreq;
|
||||
int32 sb;
|
||||
int32 ss;
|
||||
int32 sfbNo;
|
||||
int32 sfbStart;
|
||||
int32 sfb;
|
||||
int32 sfbTemp;
|
||||
int32 i;
|
||||
int32 j;
|
||||
int32 io;
|
||||
|
||||
|
||||
int32 i_stereo = (info->mode == MPG_MD_JOINT_STEREO) &&
|
||||
(info->mode_ext & 0x1);
|
||||
|
||||
int32 ms_stereo = (info->mode == MPG_MD_JOINT_STEREO) &&
|
||||
(info->mode_ext & 0x2);
|
||||
|
||||
|
||||
if (i_stereo)
|
||||
{
|
||||
if (gr_info_r->scalefac_compress & 1)
|
||||
{
|
||||
io = 0; /* 2^(-1/4) */
|
||||
}
|
||||
else
|
||||
{
|
||||
io = 1; /* 2^(-1/8) */
|
||||
}
|
||||
|
||||
sfreq = info->version_x + (info->version_x << 1);
|
||||
sfreq += info->sampling_frequency;
|
||||
|
||||
if (gr_info_l->window_switching_flag && (gr_info_l->block_type == 2))
|
||||
{
|
||||
if (gr_info_l->mixed_block_flag)
|
||||
{
|
||||
/*
|
||||
* mixed blocks processing
|
||||
*/
|
||||
i = 31;
|
||||
ss = 17;
|
||||
sb = -1;
|
||||
|
||||
while (i >= 0)
|
||||
{
|
||||
if (xl[(i*FILTERBANK_BANDS) + ss])
|
||||
{
|
||||
sb = (i << 4) + (i << 1) + ss;
|
||||
i = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ss--;
|
||||
if (ss < 0)
|
||||
{
|
||||
i--;
|
||||
ss = 17;
|
||||
}
|
||||
}
|
||||
} /* now sb is the number of highest line with value != 0 */
|
||||
/* can be between -1 (all lines zero) and 575 (no line zero) */
|
||||
|
||||
if (sb < 36) /* was (sb <= 36) */
|
||||
{
|
||||
/*
|
||||
* mixed blocks processing: intensity bound inside long blocks
|
||||
*/
|
||||
/* 1. long blocks up to intensity border: Stereo or M/S */
|
||||
if (mp3_sfBandIndex[sfreq].l[4] <= sb)
|
||||
{
|
||||
i = 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
i = 0;
|
||||
}
|
||||
|
||||
while (mp3_sfBandIndex[sfreq].l[i] <= sb)
|
||||
{
|
||||
i++;
|
||||
}
|
||||
sfbTemp = i; /* from that (long) sfb on we have intensity stereo */
|
||||
|
||||
sfbNo = mp3_sfBandIndex[sfreq].l[sfbTemp]; /* number of lines to process */
|
||||
|
||||
/* from sfbStart up sfbNo lines do ms_stereo or normal stereo */
|
||||
if (ms_stereo)
|
||||
{
|
||||
pvmp3_st_mid_side(xr, xl, 0, sfbNo);
|
||||
}
|
||||
|
||||
/* 2. long blocks from intensity border up to sfb band 6: intensity */
|
||||
/* calc. MPEG_1_2_Factor[0], MPEG_1_2_Factor[1] */
|
||||
|
||||
for (sfb = sfbTemp; sfb < 6; sfb++)
|
||||
{
|
||||
sfbStart = mp3_sfBandIndex[sfreq].l[sfb]; /* = Start in 0 ... 575 */
|
||||
sfbNo = mp3_sfBandIndex[sfreq].l[sfb+1] - mp3_sfBandIndex[sfreq].l[sfb]; /* No of lines to process */
|
||||
|
||||
if ((uint32)(scalefac_R->l[sfb]) != scalefac_IIP_buffer[sfb])
|
||||
{
|
||||
pvmp3_st_intensity_ver2(xr, xl, io, scalefac_R->l[sfb], sfbStart, sfbNo);
|
||||
}
|
||||
else if (ms_stereo)
|
||||
{
|
||||
pvmp3_st_mid_side(xr, xl, sfbStart, sfbNo);
|
||||
}
|
||||
}
|
||||
|
||||
/* 3. now process all sfb with short blocks (3...12), all in intensity mode */
|
||||
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
/* first calculate directional factors for intensity stereo,
|
||||
* for all sfb in intensity mode, but only
|
||||
* if they do not have "illegal" position:
|
||||
*/
|
||||
/* to do this for all sfb we have to get information for last scale factor band:
|
||||
* here we clearly have more than one sfb in intensity mode,
|
||||
* so copy factors and legal/illegal information from sfb11 to sfb12
|
||||
*/
|
||||
(scalefac_R->s[j][12]) = (scalefac_R->s[j][11]);
|
||||
scalefac_IIP_buffer[36 + j] = scalefac_IIP_buffer[33 + j]; /* legal/illegal in sfb 12 same as in sfb 11 */
|
||||
|
||||
for (sfb = 3; sfb < 13; sfb++)
|
||||
{
|
||||
sfbNo = mp3_sfBandIndex[sfreq].s[sfb+1] - mp3_sfBandIndex[sfreq].s[sfb]; /* No of lines to process */
|
||||
sfbStart = 3 * mp3_sfBandIndex[sfreq].s[sfb] + j * sfbNo;
|
||||
|
||||
if ((uint32)(scalefac_R->s[j][sfb]) != scalefac_IIP_buffer[3*sfb + j])
|
||||
{
|
||||
pvmp3_st_intensity_ver2(xr, xl, io, scalefac_R->s[j][sfb], sfbStart, sfbNo);
|
||||
}
|
||||
else if (ms_stereo)
|
||||
{
|
||||
pvmp3_st_mid_side(xr, xl, sfbStart, sfbNo);
|
||||
}
|
||||
}
|
||||
} /* for (j = 0; j < 3; j++) */
|
||||
}
|
||||
else /* else then (sb >= 36) */
|
||||
{
|
||||
/*
|
||||
* mixed blocks processing: intensity bound outside long blocks
|
||||
*/
|
||||
|
||||
/* 2. short blocks, do for all 3 */
|
||||
/* ------------------------------ */
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
int32 sfbcnt = -1;
|
||||
|
||||
for (sfb = 12; sfb >= 3; sfb--)
|
||||
{
|
||||
int32 lines = mp3_sfBandIndex[sfreq].s[sfb+1] - mp3_sfBandIndex[sfreq].s[sfb];
|
||||
|
||||
i = 3 * mp3_sfBandIndex[sfreq].s[sfb] + (j + 1) * lines - 1;
|
||||
|
||||
while (lines > 0)
|
||||
{
|
||||
if (xl[i])
|
||||
{
|
||||
sfbcnt = sfb;
|
||||
sfb = -10;
|
||||
lines = -10;
|
||||
}
|
||||
lines--;
|
||||
i--;
|
||||
}
|
||||
}
|
||||
|
||||
sfbcnt += 1;
|
||||
if (sfbcnt < 3)
|
||||
{
|
||||
sfbcnt = 3; /* should not be necessary */
|
||||
}
|
||||
|
||||
sfbTemp = sfbcnt; /* from this (short) sfb on we have intensity mode */
|
||||
/* can have values between 3 (all short sfb in intensity) */
|
||||
/* and 13 (no short sfb in intensity mode) */
|
||||
|
||||
/* 3. from sfbTemp to last sfb calculate is_ratio values: */
|
||||
/* first calculate directional factors for intensity stereo, */
|
||||
/* for all sfb in intensity mode, but only */
|
||||
/* if they do not have "illegal" position: */
|
||||
|
||||
/* to do this for all sfb we have to get information for last scale factor band: */
|
||||
/* get factors for last scale factor band: */
|
||||
/* more than one sfb in intensity mode,
|
||||
copy factors and legal/illegal information from sfb11 to sfb12 */
|
||||
if (sfbTemp < 12)
|
||||
{
|
||||
(scalefac_R->s[j][12]) = (scalefac_R->s[j][11]);
|
||||
scalefac_IIP_buffer[36 + j] = scalefac_IIP_buffer[33 + j]; /* legal/illegal in sfb 12 same as in sfb 11 */
|
||||
}
|
||||
else if (sfbTemp == sfb)
|
||||
/* only sfb 12 in intensity mode, use factors corresponding to is_pos[12] == 0 */
|
||||
{
|
||||
(scalefac_R->s[j][12]) = 0;
|
||||
scalefac_IIP_buffer[36 + j] = 1; /* the scf value 0 in sfb12 is "legal" */
|
||||
}
|
||||
/* if sfbTemp > sfb (no sfb in intensity mode): do nothing */
|
||||
|
||||
|
||||
/* 4. do normal stereo or MS stereo from sfb 3 to < sfbTemp: */
|
||||
for (sfb = 3; sfb < sfbTemp; sfb++)
|
||||
{
|
||||
sfbNo = mp3_sfBandIndex[sfreq].s[sfb+1] - mp3_sfBandIndex[sfreq].s[sfb];
|
||||
sfbStart = 3 * mp3_sfBandIndex[sfreq].s[sfb] + j * sfbNo;
|
||||
|
||||
if (ms_stereo)
|
||||
{
|
||||
pvmp3_st_mid_side(xr, xl, sfbStart, sfbNo);
|
||||
}
|
||||
}
|
||||
|
||||
/* 5. now intensity stereo processing of the remaining sfb's: */
|
||||
|
||||
for (sfb = sfbTemp; sfb < 13; sfb++)
|
||||
{
|
||||
sfbNo = mp3_sfBandIndex[sfreq].s[sfb+1] - mp3_sfBandIndex[sfreq].s[sfb]; /* No of lines to process */
|
||||
sfbStart = 3 * mp3_sfBandIndex[sfreq].s[sfb] + j * sfbNo;
|
||||
if ((uint32)(scalefac_R->s[j][sfb]) != scalefac_IIP_buffer[3*sfb + j])
|
||||
{
|
||||
pvmp3_st_intensity_ver2(xr, xl, io, scalefac_R->s[j][sfb], sfbStart, sfbNo);
|
||||
}
|
||||
else if (ms_stereo)
|
||||
{
|
||||
pvmp3_st_mid_side(xr, xl, sfbStart, sfbNo);
|
||||
}
|
||||
}
|
||||
/* end of correction by efs 2003-07-04 */
|
||||
} /* for (j = 0; j < 3; j++) */
|
||||
|
||||
|
||||
/* long blocks 0 up to sfb band 6: no intensity */
|
||||
|
||||
sfbNo = mp3_sfBandIndex[sfreq].l[6]; /* number of lines to process */
|
||||
if (ms_stereo)
|
||||
{
|
||||
pvmp3_st_mid_side(xr, xl, 0, sfbNo);
|
||||
}
|
||||
|
||||
} /* if intensity bound inside or outside long blocks */
|
||||
} /* if (gr_info->mixed_block_flag) */
|
||||
else
|
||||
{
|
||||
/*
|
||||
* short block processing
|
||||
*/
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
int32 sfbcnt = -1;
|
||||
|
||||
for (sfb = 12; sfb >= 0; sfb--)
|
||||
{
|
||||
int32 lines = mp3_sfBandIndex[sfreq].s[sfb+1] - mp3_sfBandIndex[sfreq].s[sfb];
|
||||
i = 3 * mp3_sfBandIndex[sfreq].s[sfb] + (j + 1) * lines - 1;
|
||||
|
||||
while (lines > 0)
|
||||
{
|
||||
if (xl[i])
|
||||
{
|
||||
sfbcnt = sfb;
|
||||
sfb = -10;
|
||||
lines = -10;
|
||||
}
|
||||
lines--;
|
||||
i--;
|
||||
}
|
||||
}
|
||||
|
||||
sfbcnt += 1;
|
||||
|
||||
/* start of corrected version by efs 2003-07-04 */
|
||||
sfbTemp = sfbcnt; /* from this (short) sfb on we have intensity mode */
|
||||
/* can have values between 3 (all short sfb in intensity) */
|
||||
/* and 13 (no short sfb in intensity mode) */
|
||||
|
||||
/* first calculate directional factors for intensity stereo,
|
||||
for all sfb in intensity mode, but only
|
||||
if they do not have "illegal" position: */
|
||||
|
||||
/* to do this for all sfb we have to get information for last scale factor band: */
|
||||
/* get factors for last scale factor band: */
|
||||
/* more than one sfb in intensity mode,
|
||||
copy factors and legal/illegal information from sfb11 to sfb12 */
|
||||
if (sfbTemp < 12)
|
||||
{
|
||||
(scalefac_R->s[j][12]) = (scalefac_R->s[j][11]);
|
||||
scalefac_IIP_buffer[36 + j] = scalefac_IIP_buffer[33 + j]; /* legal/illegal in sfb 12 same as in sfb 11 */
|
||||
}
|
||||
else if (sfbTemp == 12)
|
||||
/* only sfb 12 in intensity mode, use factors corresponding to is_pos[12] == 0 */
|
||||
{
|
||||
(scalefac_R->s[j][12]) = 0;
|
||||
scalefac_IIP_buffer[36 + j] = 1; /* the scf value 0 in sfb12 is "legal" */
|
||||
}
|
||||
/* if sfbTemp > sfb (no sfb in intensity mode): do nothing */
|
||||
|
||||
|
||||
/* Now process audio samples */
|
||||
/* first process lower sfb's not in intensity mode */
|
||||
for (sfb = 0; sfb < sfbTemp; sfb++)
|
||||
{
|
||||
sfbNo = mp3_sfBandIndex[sfreq].s[sfb+1] - mp3_sfBandIndex[sfreq].s[sfb];
|
||||
sfbStart = 3 * mp3_sfBandIndex[sfreq].s[sfb] + j * sfbNo;
|
||||
|
||||
if (ms_stereo)
|
||||
{
|
||||
pvmp3_st_mid_side(xr, xl, sfbStart, sfbNo);
|
||||
}
|
||||
}
|
||||
|
||||
/* now intensity stereo processing of the remaining sfb's: */
|
||||
for (sfb = sfbTemp; sfb < 13; sfb++)
|
||||
{
|
||||
sfbNo = mp3_sfBandIndex[sfreq].s[sfb+1] - mp3_sfBandIndex[sfreq].s[sfb]; /* No of lines to process */
|
||||
sfbStart = 3 * mp3_sfBandIndex[sfreq].s[sfb] + j * sfbNo;
|
||||
|
||||
if ((uint32)(scalefac_R->s[j][sfb]) != scalefac_IIP_buffer[3*sfb + j])
|
||||
{
|
||||
pvmp3_st_intensity_ver2(xr, xl, io, scalefac_R->s[j][sfb], sfbStart, sfbNo);
|
||||
}
|
||||
else if (ms_stereo)
|
||||
{
|
||||
pvmp3_st_mid_side(xr, xl, sfbStart, sfbNo);
|
||||
}
|
||||
}
|
||||
|
||||
} /* for (j = 0; j < 3; j++) */
|
||||
|
||||
} /* end of else ( gr_info->mixed_block_flag) */
|
||||
|
||||
} /* if (gr_info->window_switching_flag && (gr_info->block_type == 2)) */
|
||||
else
|
||||
{
|
||||
/*
|
||||
* long block processing
|
||||
*/
|
||||
i = 31;
|
||||
ss = 17;
|
||||
sb = 0;
|
||||
|
||||
while (i >= 0)
|
||||
{
|
||||
if (xl[(i*FILTERBANK_BANDS) + ss])
|
||||
{
|
||||
sb = (i << 4) + (i << 1) + ss;
|
||||
/* i = -1 patched RF 24-09-2002 */
|
||||
i = -2;
|
||||
}
|
||||
else
|
||||
{
|
||||
ss--;
|
||||
if (ss < 0)
|
||||
{
|
||||
i--;
|
||||
ss = 17;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* patched RF 24-09-2002 */
|
||||
if (sb)
|
||||
{
|
||||
if (mp3_sfBandIndex[sfreq].l[14] <= sb)
|
||||
{
|
||||
i = 14;
|
||||
}
|
||||
else if (mp3_sfBandIndex[sfreq].l[7] <= sb)
|
||||
{
|
||||
i = 7;
|
||||
}
|
||||
else
|
||||
{
|
||||
i = 0;
|
||||
}
|
||||
|
||||
while (mp3_sfBandIndex[sfreq].l[i] <= sb)
|
||||
{
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if (i == -1)
|
||||
{
|
||||
/* all xr[1][][] are 0: set IS bound sfb to 0 */
|
||||
i = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* xr[1][0][0] is unequal 0 and all others are 0: set IS bound sfb to 1 */
|
||||
i = 1;
|
||||
}
|
||||
}
|
||||
/* corrected version by efs 2003-07-04 */
|
||||
sfbTemp = i; /* from this (long) sfb on we have intensity mode */
|
||||
/* can have values between 0 (all long sfb in intensity) */
|
||||
/* and 22 (no long sfb in intensity mode) */
|
||||
|
||||
/* first calculate directional factors for intensity stereo,
|
||||
for all sfb in intensity mode, but only if they
|
||||
do not have "illegal" position: */
|
||||
|
||||
/* to do this for all sfb we have to get information for last scale factor band: */
|
||||
if (sfbTemp < 21)
|
||||
/* more than one sfb in intensity mode, */
|
||||
/* copy factors and legal/illegal information from sfb20 to sfb21 */
|
||||
{
|
||||
(scalefac_R->l[21]) = (scalefac_R->l[20]);
|
||||
scalefac_IIP_buffer[21] = scalefac_IIP_buffer[20]; /* legal/illegal in sfb 21 same as in sfb 20 */
|
||||
}
|
||||
else if (sfbTemp == 21)
|
||||
/* only sfb 21 in intensity mode, is_pos[21] = 0 */
|
||||
{
|
||||
(scalefac_R->l[21]) = 0;
|
||||
scalefac_IIP_buffer[21] = 1; /* the scf value 0 in sfb21 is "legal" */
|
||||
}
|
||||
/* if sfbTemp > 21 (no sfb in intensity mode): do nothing */
|
||||
|
||||
|
||||
/* Now process audio samples */
|
||||
/* first process lower sfb's not in intensity mode */
|
||||
|
||||
sfbNo = mp3_sfBandIndex[sfreq].l[sfbTemp] - mp3_sfBandIndex[sfreq].l[0];
|
||||
sfbStart = mp3_sfBandIndex[sfreq].l[0];
|
||||
|
||||
if (ms_stereo)
|
||||
{
|
||||
pvmp3_st_mid_side(xr, xl, sfbStart, sfbNo);
|
||||
}
|
||||
|
||||
/* now intensity stereo processing of the remaining sfb's: */
|
||||
for (sfb = sfbTemp; sfb < 22; sfb++)
|
||||
{
|
||||
sfbNo = mp3_sfBandIndex[sfreq].l[sfb+1] - mp3_sfBandIndex[sfreq].l[sfb]; /* number of lines to process */
|
||||
sfbStart = mp3_sfBandIndex[sfreq].l[sfb]; /* start of sfb */
|
||||
|
||||
if ((uint32)(scalefac_R->l[sfb]) != scalefac_IIP_buffer[sfb]) /* "legal" position ? */
|
||||
{
|
||||
pvmp3_st_intensity_ver2(xr, xl, io, scalefac_R->l[sfb], sfbStart, sfbNo);
|
||||
}
|
||||
else if (ms_stereo)
|
||||
{
|
||||
pvmp3_st_mid_side(xr, xl, sfbStart, sfbNo);
|
||||
}
|
||||
|
||||
} /* for (sfb = sfbTemp; sfb < 22; sfb++) */
|
||||
|
||||
} /* if (gr_info->window_switching_flag && (gr_info->block_type == 2)) */
|
||||
|
||||
} /* if (i_stereo) */
|
||||
else
|
||||
{
|
||||
/*
|
||||
* normal or ms stereo processing
|
||||
*/
|
||||
if (ms_stereo)
|
||||
{
|
||||
pvmp3_st_mid_side(xr, xl, 0, used_freq_lines);
|
||||
}
|
||||
|
||||
} /* if (i_stereo) */
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
112
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_mpeg2_stereo_proc.h
vendored
Normal file
112
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_mpeg2_stereo_proc.h
vendored
Normal file
@@ -0,0 +1,112 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: pvmp3_mpeg2_stereo_proc.h
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
Description:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef PVMP3_MPEG2_STEREO_PROC_H
|
||||
#define PVMP3_MPEG2_STEREO_PROC_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "pvmp3_dec_defs.h"
|
||||
#include "pvmp3_audio_type_defs.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
void pvmp3_mpeg2_stereo_proc(int32 xr[SUBBANDS_NUMBER*FILTERBANK_BANDS],
|
||||
int32 xl[SUBBANDS_NUMBER*FILTERBANK_BANDS],
|
||||
mp3ScaleFactors *scalefac,
|
||||
granuleInfo *gr_info_l,
|
||||
granuleInfo *gr_info_r,
|
||||
uint32 *scalefac_IIP_buffer,
|
||||
int32 used_freq_lines,
|
||||
mp3Header *info);
|
||||
|
||||
|
||||
void pvmp3_st_intensity_ver2(int32 xr[SUBBANDS_NUMBER*FILTERBANK_BANDS],
|
||||
int32 xl[SUBBANDS_NUMBER*FILTERBANK_BANDS],
|
||||
int32 m,
|
||||
int32 is_pos,
|
||||
int32 Start,
|
||||
int32 Number);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#endif
|
||||
|
||||
|
||||
173
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_normalize.cpp
vendored
Normal file
173
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_normalize.cpp
vendored
Normal file
@@ -0,0 +1,173 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: pvmp3_normalize.cpp
|
||||
|
||||
Date: 10/02/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
|
||||
Description:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Input
|
||||
Int32 x 32-bit integer non-zero input
|
||||
Returns
|
||||
Int32 i number of leading zeros on x
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION DESCRIPTION
|
||||
|
||||
Returns number of leading zeros on the non-zero input
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REQUIREMENTS
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PSEUDO-CODE
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "pvmp3_audio_type_defs.h"
|
||||
#include "pvmp3_normalize.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here. Include conditional
|
||||
; compile variables also.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL STORE/BUFFER/POINTER DEFINITIONS
|
||||
; Variable declaration - defined here and used outside this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL FUNCTION REFERENCES
|
||||
; Declare functions defined elsewhere and referenced in this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#if (defined(PV_ARM_V5)||defined(PV_ARM_V4))
|
||||
#elif (defined(PV_ARM_GCC_V5)||defined(PV_ARM_GCC_V4))
|
||||
|
||||
|
||||
/* function is inlined in header file */
|
||||
|
||||
|
||||
#else
|
||||
|
||||
int32 pvmp3_normalize(int32 x)
|
||||
{
|
||||
/*----------------------------------------------------------------------------
|
||||
; Define all local variables
|
||||
----------------------------------------------------------------------------*/
|
||||
int32 i;
|
||||
|
||||
|
||||
if (x > 0x0FFFFFFF)
|
||||
{
|
||||
i = 0; /* most likely case */
|
||||
}
|
||||
else if (x > 0x00FFFFFF)
|
||||
{
|
||||
i = 3; /* second most likely case */
|
||||
}
|
||||
else if (x > 0x0000FFFF)
|
||||
{
|
||||
i = x > 0x000FFFFF ? 7 : 11;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (x > 0x000000FF)
|
||||
{
|
||||
i = x > 0x00000FFF ? 15 : 19;
|
||||
}
|
||||
else
|
||||
{
|
||||
i = x > 0x0000000F ? 23 : 27;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
x <<= i;
|
||||
|
||||
switch (x & 0x78000000)
|
||||
{
|
||||
case 0x08000000:
|
||||
i += 3;
|
||||
break;
|
||||
|
||||
case 0x18000000:
|
||||
case 0x10000000:
|
||||
i += 2;
|
||||
break;
|
||||
case 0x28000000:
|
||||
case 0x20000000:
|
||||
case 0x38000000:
|
||||
case 0x30000000:
|
||||
i++;
|
||||
|
||||
default:
|
||||
;
|
||||
}
|
||||
|
||||
return i;
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
108
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_normalize.h
vendored
Normal file
108
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_normalize.h
vendored
Normal file
@@ -0,0 +1,108 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: pvmp3_normalize.h
|
||||
|
||||
Date: 10/02/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
Description:
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef PVMP3_NORMALIZE_H
|
||||
#define PVMP3_NORMALIZE_H
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "pvmp3_audio_type_defs.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES AND SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#if (defined(PV_ARM_V5)||defined(PV_ARM_V4))
|
||||
|
||||
__inline int32 pvmp3_normalize(int32 x)
|
||||
{
|
||||
int32 y;
|
||||
__asm
|
||||
{
|
||||
clz y, x;
|
||||
sub y, y, #1
|
||||
}
|
||||
return (y);
|
||||
}
|
||||
|
||||
|
||||
#elif (defined(PV_ARM_GCC_V5)||defined(PV_ARM_GCC_V4))
|
||||
|
||||
__inline int32 pvmp3_normalize(int32 x)
|
||||
{
|
||||
register int32 y;
|
||||
register int32 ra = x;
|
||||
|
||||
|
||||
asm volatile(
|
||||
"clz %0, %1\n\t"
|
||||
"sub %0, %0, #1"
|
||||
: "=&r*i"(y)
|
||||
: "r"(ra));
|
||||
return (y);
|
||||
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
int32 pvmp3_normalize(int32 x);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif /* PV_NORMALIZE_H */
|
||||
187
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_poly_phase_synthesis.cpp
vendored
Normal file
187
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_poly_phase_synthesis.cpp
vendored
Normal file
@@ -0,0 +1,187 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: pvmp3_poly_phase_synthesis.cpp
|
||||
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
|
||||
Description:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Input
|
||||
tmp3dec_chan *pChVars, decoder state structure per channel
|
||||
int32 numChannels, number of channels
|
||||
e_equalization equalizerType, equalization mode
|
||||
int16 *outPcm pointer to the PCM output data
|
||||
|
||||
Output
|
||||
int16 *outPcm pointer to the PCM output data
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION DESCRIPTION
|
||||
|
||||
polyphase synthesis
|
||||
Each time the subband samples for all 32 polyphase subbands of one
|
||||
channel have been calculated, they can be applied to the synthesis
|
||||
subband filter and 32 consecutive audio samples can be calculated
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REQUIREMENTS
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
|
||||
[1] ISO MPEG Audio Subgroup Software Simulation Group (1996)
|
||||
ISO 13818-3 MPEG-2 Audio Decoder - Lower Sampling Frequency Extension
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PSEUDO-CODE
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "pvmp3_poly_phase_synthesis.h"
|
||||
#include "pvmp3_polyphase_filter_window.h"
|
||||
#include "pv_mp3dec_fxd_op.h"
|
||||
#include "pvmp3_dec_defs.h"
|
||||
#include "pvmp3_dct_16.h"
|
||||
#include "pvmp3_equalizer.h"
|
||||
#include "mp3_mem_funcs.h"
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here. Include conditional
|
||||
; compile variables also.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL STORE/BUFFER/POINTER DEFINITIONS
|
||||
; Variable declaration - defined here and used outside this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL FUNCTION REFERENCES
|
||||
; Declare functions defined elsewhere and referenced in this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
void pvmp3_poly_phase_synthesis(tmp3dec_chan *pChVars,
|
||||
int32 numChannels,
|
||||
e_equalization equalizerType,
|
||||
int16 *outPcm)
|
||||
{
|
||||
/*
|
||||
* Equalizer
|
||||
*/
|
||||
pvmp3_equalizer(pChVars->circ_buffer,
|
||||
equalizerType,
|
||||
pChVars->work_buf_int32);
|
||||
|
||||
|
||||
int16 * ptr_out = outPcm;
|
||||
|
||||
|
||||
for (int32 band = 0; band < FILTERBANK_BANDS; band += 2)
|
||||
{
|
||||
int32 *inData = &pChVars->circ_buffer[544 - (band<<5)];
|
||||
|
||||
/*
|
||||
* DCT 32
|
||||
*/
|
||||
|
||||
pvmp3_split(&inData[16]);
|
||||
|
||||
pvmp3_dct_16(&inData[16], 0);
|
||||
pvmp3_dct_16(inData, 1); // Even terms
|
||||
|
||||
pvmp3_merge_in_place_N32(inData);
|
||||
|
||||
pvmp3_polyphase_filter_window(inData,
|
||||
ptr_out,
|
||||
numChannels);
|
||||
|
||||
inData -= SUBBANDS_NUMBER;
|
||||
|
||||
/*
|
||||
* DCT 32
|
||||
*/
|
||||
|
||||
pvmp3_split(&inData[16]);
|
||||
|
||||
pvmp3_dct_16(&inData[16], 0);
|
||||
pvmp3_dct_16(inData, 1); // Even terms
|
||||
|
||||
pvmp3_merge_in_place_N32(inData);
|
||||
|
||||
pvmp3_polyphase_filter_window(inData,
|
||||
ptr_out + (numChannels << 5),
|
||||
numChannels);
|
||||
|
||||
ptr_out += (numChannels << 6);
|
||||
|
||||
inData -= SUBBANDS_NUMBER;
|
||||
|
||||
}/* end band loop */
|
||||
|
||||
pv_memmove(&pChVars->circ_buffer[576],
|
||||
pChVars->circ_buffer,
|
||||
480*sizeof(*pChVars->circ_buffer));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
102
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_poly_phase_synthesis.h
vendored
Normal file
102
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_poly_phase_synthesis.h
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: pvmp3_poly_phase_synthesis.h
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
Description:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef PVMP3_POLY_PHASE_SYNTHESIS_H
|
||||
#define PVMP3_POLY_PHASE_SYNTHESIS_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "pvmp3_audio_type_defs.h"
|
||||
#include "s_tmp3dec_chan.h"
|
||||
#include "pvmp3decoder_api.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
void pvmp3_poly_phase_synthesis(tmp3dec_chan *pChVars,
|
||||
int32 numChannels,
|
||||
e_equalization equalizerType,
|
||||
int16 *outPcm);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#endif
|
||||
|
||||
239
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_polyphase_filter_window.cpp
vendored
Normal file
239
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_polyphase_filter_window.cpp
vendored
Normal file
@@ -0,0 +1,239 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: pvmp3_polyphase_filter_window.cpp
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
|
||||
Description:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
|
||||
Input
|
||||
int32 *synth_buffer, synthesis input buffer
|
||||
int16 *outPcm, generated output ( 32 values)
|
||||
int32 numChannels number of channels
|
||||
Returns
|
||||
|
||||
int16 *outPcm
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION DESCRIPTION
|
||||
|
||||
apply polyphase filter window
|
||||
Input 32 subband samples
|
||||
Calculate 64 values
|
||||
------------------------------------------------------------------------------
|
||||
REQUIREMENTS
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
|
||||
[1] ISO MPEG Audio Subgroup Software Simulation Group (1996)
|
||||
ISO 13818-3 MPEG-2 Audio Decoder - Lower Sampling Frequency Extension
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PSEUDO-CODE
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#if ( !defined(PV_ARM_GCC_V5) && !defined(PV_ARM_GCC_V4) && !defined(PV_ARM_V5) && !defined(PV_ARM_V4) )
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "pvmp3_polyphase_filter_window.h"
|
||||
#include "pv_mp3dec_fxd_op.h"
|
||||
#include "pvmp3_dec_defs.h"
|
||||
#include "pvmp3_tables.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module1 specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here. Include conditional
|
||||
; compile variables also.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL STORE/BUFFER/POINTER DEFINITIONS
|
||||
; Variable declaration - defined here and used outside this module1
|
||||
----------------------------------------------------------------------------*/
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL FUNCTION REFERENCES
|
||||
; Declare functions defined elsewhere and referenced in this module_x
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
|
||||
; Declare variables used in this module_x but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
void pvmp3_polyphase_filter_window(int32 *synth_buffer,
|
||||
int16 *outPcm,
|
||||
int32 numChannels)
|
||||
{
|
||||
int32 sum1;
|
||||
int32 sum2;
|
||||
const int32 *winPtr = pqmfSynthWin;
|
||||
int32 i;
|
||||
|
||||
|
||||
for (int16 j = 1; j < SUBBANDS_NUMBER / 2; j++)
|
||||
{
|
||||
sum1 = 0x00000020;
|
||||
sum2 = 0x00000020;
|
||||
|
||||
|
||||
for (i = (SUBBANDS_NUMBER >> 1);
|
||||
i < HAN_SIZE + (SUBBANDS_NUMBER >> 1);
|
||||
i += SUBBANDS_NUMBER << 4)
|
||||
{
|
||||
int32 *pt_1 = &synth_buffer[ i+j];
|
||||
int32 *pt_2 = &synth_buffer[ i-j];
|
||||
int32 temp1 = pt_1[ 0];
|
||||
int32 temp3 = pt_2[ SUBBANDS_NUMBER*15 ];
|
||||
int32 temp2 = pt_2[ SUBBANDS_NUMBER* 1 ];
|
||||
int32 temp4 = pt_1[ SUBBANDS_NUMBER*14 ];
|
||||
|
||||
sum1 = fxp_mac32_Q32(sum1, temp1, winPtr[ 0]);
|
||||
sum2 = fxp_mac32_Q32(sum2, temp3, winPtr[ 0]);
|
||||
sum2 = fxp_mac32_Q32(sum2, temp1, winPtr[ 1]);
|
||||
sum1 = fxp_msb32_Q32(sum1, temp3, winPtr[ 1]);
|
||||
sum1 = fxp_mac32_Q32(sum1, temp2, winPtr[ 2]);
|
||||
sum2 = fxp_msb32_Q32(sum2, temp4, winPtr[ 2]);
|
||||
sum2 = fxp_mac32_Q32(sum2, temp2, winPtr[ 3]);
|
||||
sum1 = fxp_mac32_Q32(sum1, temp4, winPtr[ 3]);
|
||||
|
||||
temp1 = pt_1[ SUBBANDS_NUMBER* 2];
|
||||
temp3 = pt_2[ SUBBANDS_NUMBER*13];
|
||||
temp2 = pt_2[ SUBBANDS_NUMBER* 3];
|
||||
temp4 = pt_1[ SUBBANDS_NUMBER*12];
|
||||
|
||||
sum1 = fxp_mac32_Q32(sum1, temp1, winPtr[ 4]);
|
||||
sum2 = fxp_mac32_Q32(sum2, temp3, winPtr[ 4]);
|
||||
sum2 = fxp_mac32_Q32(sum2, temp1, winPtr[ 5]);
|
||||
sum1 = fxp_msb32_Q32(sum1, temp3, winPtr[ 5]);
|
||||
sum1 = fxp_mac32_Q32(sum1, temp2, winPtr[ 6]);
|
||||
sum2 = fxp_msb32_Q32(sum2, temp4, winPtr[ 6]);
|
||||
sum2 = fxp_mac32_Q32(sum2, temp2, winPtr[ 7]);
|
||||
sum1 = fxp_mac32_Q32(sum1, temp4, winPtr[ 7]);
|
||||
|
||||
temp1 = pt_1[ SUBBANDS_NUMBER* 4 ];
|
||||
temp3 = pt_2[ SUBBANDS_NUMBER*11 ];
|
||||
temp2 = pt_2[ SUBBANDS_NUMBER* 5 ];
|
||||
temp4 = pt_1[ SUBBANDS_NUMBER*10 ];
|
||||
|
||||
sum1 = fxp_mac32_Q32(sum1, temp1, winPtr[ 8]);
|
||||
sum2 = fxp_mac32_Q32(sum2, temp3, winPtr[ 8]);
|
||||
sum2 = fxp_mac32_Q32(sum2, temp1, winPtr[ 9]);
|
||||
sum1 = fxp_msb32_Q32(sum1, temp3, winPtr[ 9]);
|
||||
sum1 = fxp_mac32_Q32(sum1, temp2, winPtr[10]);
|
||||
sum2 = fxp_msb32_Q32(sum2, temp4, winPtr[10]);
|
||||
sum2 = fxp_mac32_Q32(sum2, temp2, winPtr[11]);
|
||||
sum1 = fxp_mac32_Q32(sum1, temp4, winPtr[11]);
|
||||
|
||||
temp1 = pt_1[ SUBBANDS_NUMBER*6 ];
|
||||
temp3 = pt_2[ SUBBANDS_NUMBER*9 ];
|
||||
temp2 = pt_2[ SUBBANDS_NUMBER*7 ];
|
||||
temp4 = pt_1[ SUBBANDS_NUMBER*8 ];
|
||||
|
||||
sum1 = fxp_mac32_Q32(sum1, temp1, winPtr[12]);
|
||||
sum2 = fxp_mac32_Q32(sum2, temp3, winPtr[12]);
|
||||
sum2 = fxp_mac32_Q32(sum2, temp1, winPtr[13]);
|
||||
sum1 = fxp_msb32_Q32(sum1, temp3, winPtr[13]);
|
||||
sum1 = fxp_mac32_Q32(sum1, temp2, winPtr[14]);
|
||||
sum2 = fxp_msb32_Q32(sum2, temp4, winPtr[14]);
|
||||
sum2 = fxp_mac32_Q32(sum2, temp2, winPtr[15]);
|
||||
sum1 = fxp_mac32_Q32(sum1, temp4, winPtr[15]);
|
||||
|
||||
winPtr += 16;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int32 k = j << (numChannels - 1);
|
||||
outPcm[k] = saturate16(sum1 >> 6);
|
||||
outPcm[(numChannels<<5) - k] = saturate16(sum2 >> 6);
|
||||
}
|
||||
|
||||
|
||||
|
||||
sum1 = 0x00000020;
|
||||
sum2 = 0x00000020;
|
||||
|
||||
|
||||
for (i = 16; i < HAN_SIZE + 16; i += (SUBBANDS_NUMBER << 2))
|
||||
{
|
||||
int32 *pt_synth = &synth_buffer[i];
|
||||
int32 temp1 = pt_synth[ 0 ];
|
||||
int32 temp2 = pt_synth[ SUBBANDS_NUMBER ];
|
||||
int32 temp3 = pt_synth[ SUBBANDS_NUMBER/2];
|
||||
|
||||
sum1 = fxp_mac32_Q32(sum1, temp1, winPtr[0]) ;
|
||||
sum1 = fxp_mac32_Q32(sum1, temp2, winPtr[1]) ;
|
||||
sum2 = fxp_mac32_Q32(sum2, temp3, winPtr[2]) ;
|
||||
|
||||
temp1 = pt_synth[ SUBBANDS_NUMBER<<1 ];
|
||||
temp2 = pt_synth[ 3*SUBBANDS_NUMBER ];
|
||||
temp3 = pt_synth[ SUBBANDS_NUMBER*5/2];
|
||||
|
||||
sum1 = fxp_mac32_Q32(sum1, temp1, winPtr[3]) ;
|
||||
sum1 = fxp_mac32_Q32(sum1, temp2, winPtr[4]) ;
|
||||
sum2 = fxp_mac32_Q32(sum2, temp3, winPtr[5]) ;
|
||||
|
||||
winPtr += 6;
|
||||
}
|
||||
|
||||
|
||||
outPcm[0] = saturate16(sum1 >> 6);
|
||||
outPcm[(SUBBANDS_NUMBER/2)<<(numChannels-1)] = saturate16(sum2 >> 6);
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif // If not assembly
|
||||
|
||||
138
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_polyphase_filter_window.h
vendored
Normal file
138
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_polyphase_filter_window.h
vendored
Normal file
@@ -0,0 +1,138 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: pvmp3_decode_header.h
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
Description:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef PVMP3_POLYPHASE_FILTER_WINDOW_H
|
||||
#define PVMP3_POLYPHASE_FILTER_WINDOW_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "pvmp3_audio_type_defs.h"
|
||||
#include "s_tmp3dec_chan.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
#define MAX_16BITS_INT 0x7FFF
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
|
||||
#if (defined(PV_ARM_V5)||defined(PV_ARM_V4))
|
||||
|
||||
|
||||
__inline int16 saturate16(int32 sample)
|
||||
{
|
||||
int32 a;
|
||||
int32 b = 31;
|
||||
__asm
|
||||
{
|
||||
mov a, sample, asr#15
|
||||
teq a, sample, asr b
|
||||
eorne sample, MAX_16BITS_INT, sample, asr#31
|
||||
}
|
||||
return sample ;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
inline int16 saturate16(int32 sample)
|
||||
{
|
||||
|
||||
if ((sample >> 15) ^(sample >> 31))
|
||||
{
|
||||
sample = MAX_16BITS_INT ^(sample >> 31);
|
||||
}
|
||||
return sample;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void pvmp3_polyphase_filter_window(int32 *synth_buffer,
|
||||
int16 *outPcm,
|
||||
int32 numChannels);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
197
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_reorder.cpp
vendored
Normal file
197
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_reorder.cpp
vendored
Normal file
@@ -0,0 +1,197 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: pvmp3_reorder.cpp
|
||||
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
|
||||
Description:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Inputs:
|
||||
|
||||
int32 xr[ ], rescaled data
|
||||
struct gr_info_s *gr_info, granule structure
|
||||
mp3Header *info, mp3 header info
|
||||
int32 Scratch_mem[198] for temporary usage
|
||||
|
||||
Outputs:
|
||||
|
||||
int32 xr[ ], reordered data
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION DESCRIPTION
|
||||
|
||||
If short blocks are used (block_type[gr][ch]=='10'), the rescaled data
|
||||
xr[scf_band][window][freq_line] shall be reordered in polyphase subband
|
||||
order, xr[subband][window][freq_line], prior to the IMDCT operation.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REQUIREMENTS
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
[1] ISO MPEG Audio Subgroup Software Simulation Group (1996)
|
||||
ISO 13818-3 MPEG-2 Audio Decoder - Lower Sampling Frequency Extension
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PSEUDO-CODE
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "pv_mp3dec_fxd_op.h"
|
||||
#include "pvmp3_dec_defs.h"
|
||||
#include "pvmp3_reorder.h"
|
||||
#include "pvmp3_tables.h"
|
||||
#include "mp3_mem_funcs.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here. Include conditional
|
||||
; compile variables also.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL STORE/BUFFER/POINTER DEFINITIONS
|
||||
; Variable declaration - defined here and used outside this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL FUNCTION REFERENCES
|
||||
; Declare functions defined elsewhere and referenced in this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
void pvmp3_reorder(int32 xr[SUBBANDS_NUMBER*FILTERBANK_BANDS],
|
||||
granuleInfo *gr_info,
|
||||
int32 *used_freq_lines,
|
||||
mp3Header *info,
|
||||
int32 Scratch_mem[198])
|
||||
{
|
||||
int32 sfreq = info->version_x + (info->version_x << 1);
|
||||
sfreq += info->sampling_frequency;
|
||||
|
||||
if (gr_info->window_switching_flag && (gr_info->block_type == 2))
|
||||
{
|
||||
int32 sfb_lines;
|
||||
int32 freq;
|
||||
int32 src_line;
|
||||
int32 sfb;
|
||||
if (gr_info->mixed_block_flag)
|
||||
{
|
||||
/* REORDERING FOR REST SWITCHED SHORT */
|
||||
sfb = 3; /* no reorder for low 2 subbands */
|
||||
src_line = 36;
|
||||
}
|
||||
else
|
||||
{ /* pure short */
|
||||
sfb = 0;
|
||||
src_line = 0;
|
||||
}
|
||||
int16 ct = src_line;
|
||||
|
||||
for (; sfb < 13; sfb++)
|
||||
{
|
||||
if (*used_freq_lines > 3*mp3_sfBandIndex[sfreq].s[sfb+1])
|
||||
{
|
||||
sfb_lines = mp3_sfBandIndex[sfreq].s[sfb+1] - mp3_sfBandIndex[sfreq].s[sfb];
|
||||
|
||||
for (freq = 0; freq < 3*sfb_lines; freq += 3)
|
||||
{
|
||||
int32 tmp1 = xr[src_line];
|
||||
int32 tmp2 = xr[src_line+(sfb_lines)];
|
||||
int32 tmp3 = xr[src_line+(sfb_lines<<1)];
|
||||
src_line++;
|
||||
Scratch_mem[freq ] = tmp1;
|
||||
Scratch_mem[freq+1] = tmp2;
|
||||
Scratch_mem[freq+2] = tmp3;
|
||||
}
|
||||
src_line += (sfb_lines << 1);
|
||||
|
||||
pv_memcpy(&xr[ct], Scratch_mem, sfb_lines*3*sizeof(int32));
|
||||
ct += sfb_lines + (sfb_lines << 1);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
sfb_lines = mp3_sfBandIndex[sfreq].s[sfb+1] - mp3_sfBandIndex[sfreq].s[sfb];
|
||||
|
||||
for (freq = 0; freq < 3*sfb_lines; freq += 3)
|
||||
{
|
||||
int32 tmp1 = xr[src_line];
|
||||
int32 tmp2 = xr[src_line+(sfb_lines)];
|
||||
int32 tmp3 = xr[src_line+(sfb_lines<<1)];
|
||||
src_line++;
|
||||
Scratch_mem[freq ] = tmp1;
|
||||
Scratch_mem[freq+1] = tmp2;
|
||||
Scratch_mem[freq+2] = tmp3;
|
||||
}
|
||||
|
||||
pv_memcpy(&xr[ct], Scratch_mem, sfb_lines*3*sizeof(int32));
|
||||
|
||||
*used_freq_lines = mp3_sfBandIndex[sfreq].s[sfb+1] * 3;
|
||||
|
||||
sfb = 13; /* force out of the for-loop */
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
103
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_reorder.h
vendored
Normal file
103
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_reorder.h
vendored
Normal file
@@ -0,0 +1,103 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: pvmp3_reorder.h
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
Description:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef PVMP3_REORDER_H
|
||||
#define PVMP3_REORDER_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "pvmp3_dec_defs.h"
|
||||
#include "pvmp3_audio_type_defs.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
void pvmp3_reorder(int32 xr[SUBBANDS_NUMBER*FILTERBANK_BANDS],
|
||||
granuleInfo *gr_info,
|
||||
int32 *used_freq_lines,
|
||||
mp3Header *info,
|
||||
int32 Scratch_mem[198]);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#endif
|
||||
|
||||
|
||||
308
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_seek_synch.cpp
vendored
Normal file
308
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_seek_synch.cpp
vendored
Normal file
@@ -0,0 +1,308 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: pvmp3_seek_synch.cpp
|
||||
|
||||
Functions:
|
||||
pvmp3_seek_synch
|
||||
pvmp3_header_sync
|
||||
|
||||
|
||||
Date: 9/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
|
||||
Description:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
pvmp3_frame_synch
|
||||
|
||||
Input
|
||||
pExt = pointer to the external interface structure. See the file
|
||||
pvmp3decoder_api.h for a description of each field.
|
||||
Data type of pointer to a tPVMP3DecoderExternal
|
||||
structure.
|
||||
|
||||
pMem = void pointer to hide the internal implementation of the library
|
||||
It is cast back to a tmp3dec_file structure. This structure
|
||||
contains information that needs to persist between calls to
|
||||
this function, or is too big to be placed on the stack, even
|
||||
though the data is only needed during execution of this function
|
||||
Data type void pointer, internally pointer to a tmp3dec_file
|
||||
structure.
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION DESCRIPTION
|
||||
|
||||
search mp3 sync word, when found, it verifies, based on header parameters,
|
||||
the locations of the very next sync word,
|
||||
- if fails, then indicates a false sync,
|
||||
- otherwise, it confirm synchronization of at least 2 consecutives frames
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REQUIREMENTS
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PSEUDO-CODE
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "pvmp3_seek_synch.h"
|
||||
#include "pvmp3_getbits.h"
|
||||
#include "s_tmp3dec_file.h"
|
||||
#include "pv_mp3dec_fxd_op.h"
|
||||
#include "pvmp3_tables.h"
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here. Include conditional
|
||||
; compile variables also.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL STORE/BUFFER/POINTER DEFINITIONS
|
||||
; Variable declaration - defined here and used outside this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL FUNCTION REFERENCES
|
||||
; Declare functions defined elsewhere and referenced in this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
||||
ERROR_CODE pvmp3_frame_synch(tPVMP3DecoderExternal *pExt,
|
||||
void *pMem) /* bit stream structure */
|
||||
{
|
||||
uint16 val;
|
||||
ERROR_CODE err;
|
||||
|
||||
tmp3dec_file *pVars;
|
||||
|
||||
pVars = (tmp3dec_file *)pMem;
|
||||
|
||||
pVars->inputStream.pBuffer = pExt->pInputBuffer;
|
||||
pVars->inputStream.usedBits = (pExt->inputBufferUsedLength << 3); // in bits
|
||||
|
||||
|
||||
pVars->inputStream.inputBufferCurrentLength = (pExt->inputBufferCurrentLength); // in bits
|
||||
|
||||
err = pvmp3_header_sync(&pVars->inputStream);
|
||||
|
||||
if (err == NO_DECODING_ERROR)
|
||||
{
|
||||
/* validate synchronization by checking two consecutive sync words */
|
||||
|
||||
// to avoid multiple bitstream accesses
|
||||
uint32 temp = getNbits(&pVars->inputStream, 21);
|
||||
// put back whole header
|
||||
pVars->inputStream.usedBits -= 21 + SYNC_WORD_LNGTH;
|
||||
|
||||
int32 version;
|
||||
|
||||
switch (temp >> 19) /* 2 */
|
||||
{
|
||||
case 0:
|
||||
version = MPEG_2_5;
|
||||
break;
|
||||
case 2:
|
||||
version = MPEG_2;
|
||||
break;
|
||||
case 3:
|
||||
version = MPEG_1;
|
||||
break;
|
||||
default:
|
||||
version = INVALID_VERSION;
|
||||
break;
|
||||
}
|
||||
|
||||
int32 freq_index = (temp << 20) >> 30;
|
||||
|
||||
if (version != INVALID_VERSION && (freq_index != 3))
|
||||
{
|
||||
int32 numBytes = fxp_mul32_Q28(mp3_bitrate[version][(temp<<16)>>28] << 20,
|
||||
inv_sfreq[freq_index]);
|
||||
|
||||
numBytes >>= (20 - version);
|
||||
|
||||
if (version != MPEG_1)
|
||||
{
|
||||
numBytes >>= 1;
|
||||
}
|
||||
if ((temp << 22) >> 31)
|
||||
{
|
||||
numBytes++;
|
||||
}
|
||||
|
||||
if (numBytes > (int32)pVars->inputStream.inputBufferCurrentLength)
|
||||
{
|
||||
/* frame should account for padding and 2 bytes to check sync */
|
||||
pExt->CurrentFrameLength = numBytes + 3;
|
||||
return (SYNCH_LOST_ERROR);
|
||||
}
|
||||
else if (numBytes == (int32)pVars->inputStream.inputBufferCurrentLength)
|
||||
{
|
||||
/* No enough data to validate, but current frame appears to be correct ( EOF case) */
|
||||
pExt->inputBufferUsedLength = pVars->inputStream.usedBits >> 3;
|
||||
return (NO_DECODING_ERROR);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
int32 offset = pVars->inputStream.usedBits + ((numBytes) << 3);
|
||||
|
||||
offset >>= INBUF_ARRAY_INDEX_SHIFT;
|
||||
uint8 *pElem = pVars->inputStream.pBuffer + offset;
|
||||
uint16 tmp1 = *(pElem++);
|
||||
uint16 tmp2 = *(pElem);
|
||||
|
||||
val = (tmp1 << 3);
|
||||
val |= (tmp2 >> 5);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
val = 0; // force mismatch
|
||||
}
|
||||
|
||||
if (val == SYNC_WORD)
|
||||
{
|
||||
pExt->inputBufferUsedLength = pVars->inputStream.usedBits >> 3; /// !!!!!
|
||||
err = NO_DECODING_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
pExt->inputBufferCurrentLength = 0;
|
||||
err = SYNCH_LOST_ERROR;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pExt->inputBufferCurrentLength = 0;
|
||||
}
|
||||
|
||||
return(err);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
|
||||
Description:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
pvmp3_header_sync
|
||||
|
||||
Input
|
||||
tmp3Bits *inputStream, structure holding the input stream parameters
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION DESCRIPTION
|
||||
|
||||
search mp3 sync word
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REQUIREMENTS
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PSEUDO-CODE
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
ERROR_CODE pvmp3_header_sync(tmp3Bits *inputStream)
|
||||
{
|
||||
uint16 val;
|
||||
uint32 availableBits = (inputStream->inputBufferCurrentLength << 3); // in bits
|
||||
|
||||
// byte aligment
|
||||
inputStream->usedBits = (inputStream->usedBits + 7) & 8;
|
||||
|
||||
val = (uint16)getUpTo17bits(inputStream, SYNC_WORD_LNGTH);
|
||||
|
||||
while (((val&SYNC_WORD) != SYNC_WORD) && (inputStream->usedBits < availableBits))
|
||||
{
|
||||
val <<= 8;
|
||||
val |= getUpTo9bits(inputStream, 8);
|
||||
}
|
||||
|
||||
if ((val&SYNC_WORD) == SYNC_WORD && (inputStream->usedBits < availableBits))
|
||||
{
|
||||
return(NO_DECODING_ERROR);
|
||||
}
|
||||
else
|
||||
{
|
||||
return(SYNCH_LOST_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
106
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_seek_synch.h
vendored
Normal file
106
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_seek_synch.h
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: pvmp3_seek_synch.h
|
||||
|
||||
Date: 09/21/2007
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
|
||||
Description:
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef PVMP3_SEEK_SYNCH_H
|
||||
#define PVMP3_SEEK_SYNCH_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "pvmp3_audio_type_defs.h"
|
||||
#include "pvmp3decoder_api.h"
|
||||
#include "s_tmp3dec_file.h"
|
||||
#include "pvmp3_dec_defs.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
ERROR_CODE pvmp3_frame_synch(tPVMP3DecoderExternal *pExt,
|
||||
void *pMem);
|
||||
|
||||
ERROR_CODE pvmp3_header_sync(tmp3Bits *inputStream);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#endif /* DECODE_READ_INPUT_H */
|
||||
|
||||
|
||||
676
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_stereo_proc.cpp
vendored
Normal file
676
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_stereo_proc.cpp
vendored
Normal file
@@ -0,0 +1,676 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: pvmp3_stereo_proc.cpp
|
||||
|
||||
Functions:
|
||||
|
||||
pvmp3_st_mid_side
|
||||
pvmp3_st_intensity
|
||||
pvmp3_stereo_proc
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
pvmp3_st_mid_side
|
||||
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Input
|
||||
|
||||
int32 xr[], input channel
|
||||
int32 xl[],
|
||||
int32 Start, Location of first element where stereo intensity is applied
|
||||
int32 Number number of elements affected
|
||||
|
||||
Returns
|
||||
|
||||
int32 xl[], generated stereo channel
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
pvmp3_st_intensity
|
||||
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Input
|
||||
|
||||
int32 xr[], input channel
|
||||
int32 xl[],
|
||||
int32 is_pos, index to table is_ratio_factor[]
|
||||
int32 Start, Location of first element where stereo intensity is applied
|
||||
int32 Number number of elements affected
|
||||
|
||||
Returns
|
||||
|
||||
int32 xl[], generated stereo channel
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
pvmp3_stereo_proc
|
||||
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Input
|
||||
|
||||
int32 xr[], input channel
|
||||
int32 xl[],
|
||||
mp3ScaleFactors *scalefac, scale factors structure
|
||||
struct gr_info_s *gr_info, granule structure
|
||||
mp3Header *info mp3 header info
|
||||
Returns
|
||||
|
||||
int32 xl[], generated stereo channel
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION DESCRIPTION
|
||||
|
||||
stereo processing for mpeg1 layer III
|
||||
After requantization, the reconstructed values are processed for ms_stereo
|
||||
or intensity_stereo modes or both, before passing them to the synthesis
|
||||
filterbank
|
||||
|
||||
In ms_stereo mode the values of the normalized middle/side channels
|
||||
M[l] and S[l] are transmitted instead of the left/right channel values
|
||||
L[l] and R[l]. From here, L[l] and R[l] are reconstructed
|
||||
|
||||
Intensity_stereo is done by specifying the magnitude (via the
|
||||
scalefactors of the left channel) and a stereo position is_pos[sfb],
|
||||
which is transmitted instead of scalefactors of the right channel.
|
||||
The stereo position is used to derive the left and right channel signals
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REQUIREMENTS
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
|
||||
[1] ISO MPEG Audio Subgroup Software Simulation Group (1996)
|
||||
ISO 13818-3 MPEG-2 Audio Decoder - Lower Sampling Frequency Extension
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PSEUDO-CODE
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "pvmp3_stereo_proc.h"
|
||||
#include "pv_mp3dec_fxd_op.h"
|
||||
#include "pvmp3_tables.h"
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here. Include conditional
|
||||
; compile variables also.
|
||||
----------------------------------------------------------------------------*/
|
||||
#define N31 31
|
||||
|
||||
#define Q31_fmt(a) (int32(double(0x7FFFFFFF)*a))
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL STORE/BUFFER/POINTER DEFINITIONS
|
||||
; Variable declaration - defined here and used outside this module
|
||||
----------------------------------------------------------------------------*/
|
||||
/*
|
||||
* TmpFac= tan(is_pos * (PI /12));
|
||||
*
|
||||
* TmpFac /= (1 + TmpFac);
|
||||
*
|
||||
*/
|
||||
|
||||
const int32 is_ratio_factor[8] = {0,
|
||||
Q31_fmt(0.21132486540519), Q31_fmt(0.36602540378444), Q31_fmt(0.50000000000000),
|
||||
Q31_fmt(0.63397459621556), Q31_fmt(0.78867513459481), Q31_fmt(1.00000000000000),
|
||||
0
|
||||
};
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL FUNCTION REFERENCES
|
||||
; Declare functions defined elsewhere and referenced in this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
void pvmp3_st_mid_side(int32 xr[SUBBANDS_NUMBER*FILTERBANK_BANDS],
|
||||
int32 xl[SUBBANDS_NUMBER*FILTERBANK_BANDS],
|
||||
int32 Start,
|
||||
int32 Number)
|
||||
{
|
||||
|
||||
int32 *pt_xr = &xr[Start];
|
||||
int32 *pt_xl = &xl[Start];
|
||||
|
||||
for (int32 i = Number >> 1; i != 0; i--)
|
||||
{
|
||||
int32 xxr = *(pt_xr) << 1;
|
||||
int32 xxl = *(pt_xl) << 1;
|
||||
*(pt_xr++) = fxp_mul32_Q32((xxr + xxl), Q31_fmt(0.70710678118655)); /* Sum */
|
||||
*(pt_xl++) = fxp_mul32_Q32((xxr - xxl), Q31_fmt(0.70710678118655)); /* Diff */
|
||||
xxr = *(pt_xr) << 1;
|
||||
xxl = *(pt_xl) << 1;
|
||||
*(pt_xr++) = fxp_mul32_Q32((xxr + xxl), Q31_fmt(0.70710678118655)); /* Sum */
|
||||
*(pt_xl++) = fxp_mul32_Q32((xxr - xxl), Q31_fmt(0.70710678118655)); /* Diff */
|
||||
}
|
||||
|
||||
|
||||
if (Number&1)
|
||||
{
|
||||
int32 xxr = *(pt_xr) << 1;
|
||||
int32 xxl = *(pt_xl) << 1;
|
||||
*(pt_xr) = fxp_mul32_Q32((xxr + xxl), Q31_fmt(0.70710678118655)); /* Sum */
|
||||
*(pt_xl) = fxp_mul32_Q32((xxr - xxl), Q31_fmt(0.70710678118655)); /* Diff */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
void pvmp3_st_intensity(int32 xr[SUBBANDS_NUMBER*FILTERBANK_BANDS],
|
||||
int32 xl[SUBBANDS_NUMBER*FILTERBANK_BANDS],
|
||||
int32 is_pos,
|
||||
int32 Start,
|
||||
int32 Number)
|
||||
{
|
||||
|
||||
int32 TmpFac = is_ratio_factor[ is_pos & 7];
|
||||
|
||||
int32 *pt_xr = &xr[Start];
|
||||
int32 *pt_xl = &xl[Start];
|
||||
|
||||
for (int32 i = Number >> 1; i != 0; i--)
|
||||
{
|
||||
int32 tmp = fxp_mul32_Q32((*pt_xr) << 1, TmpFac);
|
||||
*(pt_xl++) = (*pt_xr) - tmp;
|
||||
*(pt_xr++) = tmp;
|
||||
tmp = fxp_mul32_Q32((*pt_xr) << 1, TmpFac);
|
||||
*(pt_xl++) = (*pt_xr) - tmp;
|
||||
*(pt_xr++) = tmp;
|
||||
}
|
||||
|
||||
if (Number&1)
|
||||
{
|
||||
int32 tmp = fxp_mul32_Q32((*pt_xr) << 1, TmpFac);
|
||||
*(pt_xl) = (*pt_xr) - tmp;
|
||||
*(pt_xr) = tmp;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
void pvmp3_stereo_proc(int32 xr[SUBBANDS_NUMBER*FILTERBANK_BANDS],
|
||||
int32 xl[SUBBANDS_NUMBER*FILTERBANK_BANDS],
|
||||
mp3ScaleFactors *scalefac,
|
||||
granuleInfo *gr_info,
|
||||
int32 used_freq_lines,
|
||||
mp3Header *info)
|
||||
{
|
||||
|
||||
|
||||
int32 sb;
|
||||
int32 ss;
|
||||
int32 sfbNo;
|
||||
int32 sfbStart;
|
||||
|
||||
int32 sfb;
|
||||
int32 sfbTemp;
|
||||
int32 i;
|
||||
int32 j;
|
||||
|
||||
|
||||
int32 i_stereo = (info->mode == MPG_MD_JOINT_STEREO) &&
|
||||
(info->mode_ext & 0x1);
|
||||
|
||||
int32 ms_stereo = (info->mode == MPG_MD_JOINT_STEREO) &&
|
||||
(info->mode_ext & 0x2);
|
||||
|
||||
int32 sfreq = info->version_x + (info->version_x << 1);
|
||||
sfreq += info->sampling_frequency;
|
||||
|
||||
|
||||
|
||||
|
||||
if (i_stereo)
|
||||
{
|
||||
if (gr_info->window_switching_flag && (gr_info->block_type == 2))
|
||||
{
|
||||
if (gr_info->mixed_block_flag)
|
||||
{
|
||||
/*
|
||||
* mixed blocks processing
|
||||
*/
|
||||
i = 31;
|
||||
ss = 17;
|
||||
sb = 0;
|
||||
while (i >= 0)
|
||||
{
|
||||
if (xl[(i*FILTERBANK_BANDS) + ss])
|
||||
{
|
||||
sb = (i << 4) + (i << 1) + ss;
|
||||
i = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ss--;
|
||||
if (ss < 0)
|
||||
{
|
||||
i--;
|
||||
ss = 17;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (sb < 36)
|
||||
{
|
||||
/*
|
||||
* mixed blocks processing: intensity bound inside long blocks
|
||||
*/
|
||||
/* 1. long blocks up to intensity border: not intensity */
|
||||
|
||||
if (mp3_sfBandIndex[sfreq].l[4] <= sb)
|
||||
{
|
||||
sfb = 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
sfb = 0;
|
||||
}
|
||||
|
||||
while (mp3_sfBandIndex[sfreq].l[sfb] < sb)
|
||||
{
|
||||
sfb++;
|
||||
}
|
||||
|
||||
/* from that sfb on intensity stereo */
|
||||
sfbTemp = sfb; /* save for later use */
|
||||
|
||||
sfbStart = mp3_sfBandIndex[sfreq].l[sfb];
|
||||
|
||||
/* from 0 up to sfbStart do ms_stereo or normal stereo */
|
||||
|
||||
if (ms_stereo)
|
||||
{
|
||||
pvmp3_st_mid_side(xr, xl, 0, sfbStart);
|
||||
}
|
||||
|
||||
/* 2. long blocks from intensity border up to sfb band 8: intensity */
|
||||
/* calc. is_ratio */
|
||||
|
||||
|
||||
/* Start of intensity stereo of remaining sfc bands: */
|
||||
for (; sfbTemp < 8; sfbTemp++)
|
||||
{
|
||||
sfbStart = mp3_sfBandIndex[sfreq].l[sfbTemp]; /* = Start in 0 ... 575 */
|
||||
sfbNo = mp3_sfBandIndex[sfreq].l[sfbTemp+1] - mp3_sfBandIndex[sfreq].l[sfbTemp]; /* No of lines to process */
|
||||
|
||||
if (scalefac->l[sfbTemp] != 7)
|
||||
{
|
||||
pvmp3_st_intensity(xr, xl, scalefac->l[sfbTemp], sfbStart, sfbNo);
|
||||
}
|
||||
else if (ms_stereo)
|
||||
{
|
||||
pvmp3_st_mid_side(xr, xl, sfbStart, sfbNo);
|
||||
}
|
||||
|
||||
} /* for (; sfbTemp < 8; sfbTemp++) */
|
||||
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
/* 3. short blocks from sfbcnt to last sfb do intensity stereo */
|
||||
for (sfbTemp = 3; sfbTemp < 13; sfbTemp++)
|
||||
{
|
||||
sfbNo = mp3_sfBandIndex[sfreq].s[sfbTemp+1] - mp3_sfBandIndex[sfreq].s[sfbTemp]; /* No of lines to process */
|
||||
sfbStart = 3 * mp3_sfBandIndex[sfreq].s[sfbTemp] + j * sfbNo;
|
||||
|
||||
if (scalefac->s[j][sfbTemp] != 7)
|
||||
{
|
||||
pvmp3_st_intensity(xr, xl, scalefac->s[j][sfbTemp], sfbStart, sfbNo);
|
||||
}
|
||||
else if (ms_stereo)
|
||||
{
|
||||
pvmp3_st_mid_side(xr, xl, sfbStart, sfbNo);
|
||||
}
|
||||
|
||||
} /* for (; sfbTemp < 22; sfbTemp++) */
|
||||
} /* for (j = 0; j < 3; j++) */
|
||||
}
|
||||
else /* else for (sb >= 36) */
|
||||
{
|
||||
/*
|
||||
* mixed blocks processing: intensity bound outside long blocks
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* 2. short blocks from sfb band 3 up to intensity border: normal stereo, ms stereo and intensity
|
||||
*/
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
int32 sfbcnt;
|
||||
sfbcnt = -1;
|
||||
|
||||
for (sfb = 12; sfb >= 3; sfb--)
|
||||
{
|
||||
int32 lines;
|
||||
lines = mp3_sfBandIndex[sfreq].s[sfb+1] - mp3_sfBandIndex[sfreq].s[sfb];
|
||||
i = 3 * mp3_sfBandIndex[sfreq].s[sfb] + (j + 1) * lines - 1;
|
||||
|
||||
while (lines > 0)
|
||||
{
|
||||
if (xl[i])
|
||||
{
|
||||
sfbcnt = sfb;
|
||||
sfb = -10;
|
||||
lines = -10;
|
||||
}
|
||||
lines--;
|
||||
i--;
|
||||
}
|
||||
}
|
||||
|
||||
sfbcnt += 1;
|
||||
if (sfbcnt < 3)
|
||||
{
|
||||
sfbcnt = 3;
|
||||
}
|
||||
|
||||
sfbTemp = sfbcnt; /* for later use */
|
||||
|
||||
|
||||
/*
|
||||
* do normal stereo or MS stereo from sfb 3 to < sfbcnt:
|
||||
*/
|
||||
for (sb = 3; sb < sfbcnt; sb++)
|
||||
{
|
||||
sfbNo = mp3_sfBandIndex[sfreq].s[sb+1] - mp3_sfBandIndex[sfreq].s[sb];
|
||||
sfbStart = 3 * mp3_sfBandIndex[sfreq].s[sb] + j * sfbNo;
|
||||
|
||||
if (ms_stereo)
|
||||
{
|
||||
pvmp3_st_mid_side(xr, xl, sfbStart, sfbNo);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* from sfbcnt to last sfb do intensity stereo */
|
||||
for (; sfbTemp < 13; sfbTemp++)
|
||||
{
|
||||
sfbNo = mp3_sfBandIndex[sfreq].s[sfbTemp+1] - mp3_sfBandIndex[sfreq].s[sfbTemp]; /* No of lines to process */
|
||||
sfbStart = 3 * mp3_sfBandIndex[sfreq].s[sfbTemp] + j * sfbNo;
|
||||
|
||||
if (scalefac->s[j][sfbTemp] != 7)
|
||||
{
|
||||
pvmp3_st_intensity(xr, xl, scalefac->s[j][sfbTemp], sfbStart, sfbNo);
|
||||
}
|
||||
else if (ms_stereo)
|
||||
{
|
||||
pvmp3_st_mid_side(xr, xl, sfbStart, sfbNo);
|
||||
}
|
||||
|
||||
} /* for (; sfbTemp < 22; sfbTemp++) */
|
||||
|
||||
} /* for (j = 0; j < 3; j++) */
|
||||
|
||||
/* 1. long blocks up to sfb band 8: not intensity */
|
||||
/* from 0 to sfb 8 ms_stereo or normal stereo */
|
||||
|
||||
sfbStart = mp3_sfBandIndex[sfreq].l[8];
|
||||
|
||||
if (ms_stereo)
|
||||
{
|
||||
pvmp3_st_mid_side(xr, xl, 0, sfbStart);
|
||||
}
|
||||
|
||||
}
|
||||
} /* if (gr_info->mixed_block_flag) */
|
||||
else
|
||||
{
|
||||
/*
|
||||
* short block processing
|
||||
*/
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
int32 sfbcnt = -1;
|
||||
|
||||
for (sfb = 12; sfb >= 0; sfb--)
|
||||
{
|
||||
int32 lines = mp3_sfBandIndex[sfreq].s[sfb+1] - mp3_sfBandIndex[sfreq].s[sfb];
|
||||
i = 3 * mp3_sfBandIndex[sfreq].s[sfb] + (j + 1) * lines - 1;
|
||||
|
||||
while (lines > 0)
|
||||
{
|
||||
if (xl[i])
|
||||
{
|
||||
sfbcnt = sfb;
|
||||
sfb = -10;
|
||||
lines = -10;
|
||||
}
|
||||
lines--;
|
||||
i--;
|
||||
}
|
||||
}
|
||||
|
||||
sfbcnt += 1;
|
||||
sfbTemp = sfbcnt; /* for later use */
|
||||
|
||||
/* do normal stereo or MS stereo from 0 to sfbcnt */
|
||||
for (sb = 0; sb < sfbcnt; sb++)
|
||||
{
|
||||
sfbNo = mp3_sfBandIndex[sfreq].s[sb+1] - mp3_sfBandIndex[sfreq].s[sb];
|
||||
sfbStart = 3 * mp3_sfBandIndex[sfreq].s[sb] + j * sfbNo;
|
||||
|
||||
if (ms_stereo)
|
||||
{
|
||||
pvmp3_st_mid_side(xr, xl, sfbStart, sfbNo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* from sfbcnt to last sfb do intensity stereo */
|
||||
for (; sfbTemp < 13; sfbTemp++)
|
||||
{
|
||||
sfbNo = mp3_sfBandIndex[sfreq].s[sfbTemp+1] - mp3_sfBandIndex[sfreq].s[sfbTemp]; /* No of lines to process */
|
||||
sfbStart = 3 * mp3_sfBandIndex[sfreq].s[sfbTemp] + j * sfbNo;
|
||||
|
||||
if (scalefac->s[j][sfbTemp] != 7)
|
||||
{
|
||||
pvmp3_st_intensity(xr, xl, scalefac->s[j][sfbTemp], sfbStart, sfbNo);
|
||||
}
|
||||
else if (ms_stereo)
|
||||
{
|
||||
pvmp3_st_mid_side(xr, xl, sfbStart, sfbNo);
|
||||
}
|
||||
|
||||
} /* for (; sfbTemp < 22; sfbTemp++) */
|
||||
|
||||
} /* for (j = 0; j < 3; j++) */
|
||||
|
||||
} /* if( gr_info->mixed_block_flag) */
|
||||
|
||||
|
||||
|
||||
} /* if (gr_info->window_switching_flag && (gr_info->block_type == 2)) */
|
||||
else
|
||||
{
|
||||
/*
|
||||
* long block processing
|
||||
*/
|
||||
i = 31;
|
||||
ss = 17;
|
||||
sb = 0;
|
||||
|
||||
while (i >= 0)
|
||||
{
|
||||
if (xl[(i*FILTERBANK_BANDS) + ss] != 0)
|
||||
{
|
||||
sb = (i << 4) + (i << 1) + ss;
|
||||
i = -2;
|
||||
}
|
||||
else
|
||||
{
|
||||
ss--;
|
||||
if (ss < 0)
|
||||
{
|
||||
i--;
|
||||
ss = 17;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (sb)
|
||||
{
|
||||
if (mp3_sfBandIndex[sfreq].l[14] <= sb)
|
||||
{
|
||||
sfb = 14;
|
||||
}
|
||||
else if (mp3_sfBandIndex[sfreq].l[7] <= sb)
|
||||
{
|
||||
sfb = 7;
|
||||
}
|
||||
else
|
||||
{
|
||||
sfb = 0;
|
||||
}
|
||||
|
||||
|
||||
while (mp3_sfBandIndex[sfreq].l[sfb] <= sb)
|
||||
{
|
||||
sfb++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (i == -1)
|
||||
{
|
||||
/* all xr[1][][] are 0: set IS bound sfb to 0 */
|
||||
sfb = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* xr[1][0][0] is unequal 0 and all others are 0: set IS bound sfb to 1 */
|
||||
sfb = 1;
|
||||
}
|
||||
}
|
||||
|
||||
sfbTemp = sfb; /* save for later use */
|
||||
|
||||
|
||||
sfbStart = mp3_sfBandIndex[sfreq].l[sfb];
|
||||
|
||||
/* from 0 to sfbStart ms_stereo or normal stereo */
|
||||
if (ms_stereo)
|
||||
{
|
||||
pvmp3_st_mid_side(xr, xl, 0, sfbStart);
|
||||
}
|
||||
|
||||
/* now intensity stereo of the remaining sfb's: */
|
||||
for (; sfb < 21; sfb++)
|
||||
{
|
||||
sfbStart = mp3_sfBandIndex[sfreq].l[sfb];
|
||||
sfbNo = mp3_sfBandIndex[sfreq].l[sfb+1] - mp3_sfBandIndex[sfreq].l[sfb]; /* No of lines to process */
|
||||
|
||||
if (scalefac->l[sfb] != 7)
|
||||
{
|
||||
pvmp3_st_intensity(xr, xl, scalefac->l[sfb], sfbStart, sfbNo);
|
||||
}
|
||||
else if (ms_stereo)
|
||||
{
|
||||
pvmp3_st_mid_side(xr, xl, sfbStart, sfbNo);
|
||||
}
|
||||
|
||||
} /* for (; sfbTemp < 22; sfbTemp++) */
|
||||
|
||||
|
||||
|
||||
sfbStart = mp3_sfBandIndex[sfreq].l[21];
|
||||
sfbNo = mp3_sfBandIndex[sfreq].l[22] - mp3_sfBandIndex[sfreq].l[21]; /* No of lines to process */
|
||||
|
||||
if (scalefac->l[21] != 7)
|
||||
{
|
||||
if (sfbTemp < 21)
|
||||
{
|
||||
sfbTemp = scalefac->l[20];
|
||||
}
|
||||
else
|
||||
{
|
||||
sfbTemp = 0; /* if scalefac[20] is not an intensity position, is_pos = 0 */
|
||||
}
|
||||
|
||||
pvmp3_st_intensity(xr, xl, sfbTemp, sfbStart, sfbNo);
|
||||
}
|
||||
else if (ms_stereo)
|
||||
{
|
||||
pvmp3_st_mid_side(xr, xl, sfbStart, sfbNo);
|
||||
}
|
||||
|
||||
} /* if (gr_info->window_switching_flag && (gr_info->block_type == 2)) */
|
||||
|
||||
|
||||
} /* if (i_stereo) */
|
||||
else
|
||||
{
|
||||
/*
|
||||
* normal or ms stereo processing
|
||||
*/
|
||||
if (ms_stereo)
|
||||
{
|
||||
|
||||
pvmp3_st_mid_side(xr, xl, 0, used_freq_lines);
|
||||
|
||||
}
|
||||
|
||||
} /* if (i_stereo) */
|
||||
|
||||
}
|
||||
|
||||
114
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_stereo_proc.h
vendored
Normal file
114
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_stereo_proc.h
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: pvmp3_stereo_proc.h
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
Description:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef PVMP3_STEREO_PROC_H
|
||||
#define PVMP3_STEREO_PROC_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "pvmp3_dec_defs.h"
|
||||
#include "pvmp3_audio_type_defs.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
|
||||
void pvmp3_stereo_proc(int32 xr[SUBBANDS_NUMBER*FILTERBANK_BANDS],
|
||||
int32 xl[SUBBANDS_NUMBER*FILTERBANK_BANDS],
|
||||
mp3ScaleFactors *scalefac,
|
||||
granuleInfo *gr_info,
|
||||
int32 used_freq_lines,
|
||||
mp3Header *info);
|
||||
|
||||
void pvmp3_st_intensity(int32 xr[SUBBANDS_NUMBER*FILTERBANK_BANDS],
|
||||
int32 xl[SUBBANDS_NUMBER*FILTERBANK_BANDS],
|
||||
int32 is_pos,
|
||||
int32 Start,
|
||||
int32 Number);
|
||||
|
||||
void pvmp3_st_mid_side(int32 xr[SUBBANDS_NUMBER*FILTERBANK_BANDS],
|
||||
int32 xl[SUBBANDS_NUMBER*FILTERBANK_BANDS],
|
||||
int32 Start,
|
||||
int32 Number);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#endif
|
||||
|
||||
2934
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_tables.cpp
vendored
Normal file
2934
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_tables.cpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
124
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_tables.h
vendored
Normal file
124
cocos2d-x/external/sources/pvmp3dec/src/pvmp3_tables.h
vendored
Normal file
@@ -0,0 +1,124 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
Filename: pvmp3_tables.h
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
Description:
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef PVMP3_TABLES_H
|
||||
#define PVMP3_TABLES_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "pvmp3_dec_defs.h"
|
||||
#include "pv_mp3_huffman.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES AND SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
#define Qfmt_28(a) (int32(double(0x10000000)*a))
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int16 l[23];
|
||||
int16 s[14];
|
||||
} mp3_scaleFactorBandIndex;
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
extern const int32 mp3_s_freq[4][4];
|
||||
extern const int32 inv_sfreq[4];
|
||||
extern const int16 mp3_bitrate[3][15];
|
||||
extern const int32 power_one_third[513];
|
||||
|
||||
extern const mp3_scaleFactorBandIndex mp3_sfBandIndex[9];
|
||||
extern const int32 mp3_shortwindBandWidths[9][13];
|
||||
extern const int32 pqmfSynthWin[(HAN_SIZE/2) + 8];
|
||||
|
||||
|
||||
extern const uint16 huffTable_1[];
|
||||
extern const uint16 huffTable_2[];
|
||||
extern const uint16 huffTable_3[];
|
||||
extern const uint16 huffTable_5[];
|
||||
extern const uint16 huffTable_6[];
|
||||
extern const uint16 huffTable_7[];
|
||||
extern const uint16 huffTable_8[];
|
||||
extern const uint16 huffTable_9[];
|
||||
extern const uint16 huffTable_10[];
|
||||
extern const uint16 huffTable_11[];
|
||||
extern const uint16 huffTable_12[];
|
||||
extern const uint16 huffTable_13[];
|
||||
extern const uint16 huffTable_15[];
|
||||
extern const uint16 huffTable_16[];
|
||||
extern const uint16 huffTable_24[];
|
||||
extern const uint16 huffTable_32[];
|
||||
extern const uint16 huffTable_33[];
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#endif
|
||||
98
cocos2d-x/external/sources/pvmp3dec/src/s_huffcodetab.h
vendored
Normal file
98
cocos2d-x/external/sources/pvmp3dec/src/s_huffcodetab.h
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: s_huffcodetab.h
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
Description:
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
|
||||
[1] ISO MPEG Audio Subgroup Software Simulation Group (1996)
|
||||
ISO 13818-3 MPEG-2 Audio Decoder - Lower Sampling Frequency Extension
|
||||
|
||||
----------------------------------------------------------------------------*/
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef S_HUFFCODETAB_H
|
||||
#define S_HUFFCODETAB_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "pvmp3_audio_type_defs.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
#define HUFF_TBL 34
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
struct huffcodetab
|
||||
{
|
||||
uint32 linbits; /*number of linbits */
|
||||
uint16(*pdec_huff_tab)(tmp3Bits *);
|
||||
};
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#endif
|
||||
|
||||
107
cocos2d-x/external/sources/pvmp3dec/src/s_mp3bits.h
vendored
Normal file
107
cocos2d-x/external/sources/pvmp3dec/src/s_mp3bits.h
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: s_mp3bits.h
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
Description:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This include file defines the structure, BITS
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef S_MP3BITS_H
|
||||
#define S_MP3BITS_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "pvmp3_audio_type_defs.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
/*
|
||||
* Name: BITS
|
||||
* Description: Holds information for processing the input data buffer
|
||||
* as a "stream". The data is in packed format.
|
||||
* Fields:
|
||||
* pBuffer - pointer to the beginning of the buffer. If the data type of
|
||||
* this changes, make sure to update the constants in ibstream.h
|
||||
* usedBits - number of bits read thus far from the buffer. Bit 0 is
|
||||
* the LSB of pBuffer[0].
|
||||
*/
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8 *pBuffer;
|
||||
uint32 usedBits;
|
||||
uint32 inputBufferCurrentLength;
|
||||
uint32 offset;
|
||||
} tmp3Bits;
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#endif
|
||||
|
||||
110
cocos2d-x/external/sources/pvmp3dec/src/s_tmp3dec_chan.h
vendored
Normal file
110
cocos2d-x/external/sources/pvmp3dec/src/s_tmp3dec_chan.h
vendored
Normal file
@@ -0,0 +1,110 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: s_tmp3dec_chan.h
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
Description:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This include file defines the structure, tmp3dec_chan.
|
||||
This structure contains information per channel that needs to persist
|
||||
between calls
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef S_TMP3DEC_CHAN_H
|
||||
#define S_TMP3DEC_CHAN_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "pvmp3_audio_type_defs.h"
|
||||
#include "pvmp3_dec_defs.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int32 used_freq_lines;
|
||||
int32 overlap[SUBBANDS_NUMBER*FILTERBANK_BANDS];
|
||||
int32 work_buf_int32[SUBBANDS_NUMBER*FILTERBANK_BANDS]; /* working buffer */
|
||||
int32 circ_buffer[480 + 576];
|
||||
|
||||
} tmp3dec_chan;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
118
cocos2d-x/external/sources/pvmp3dec/src/s_tmp3dec_file.h
vendored
Normal file
118
cocos2d-x/external/sources/pvmp3dec/src/s_tmp3dec_file.h
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
PacketVideo Corp.
|
||||
MP3 Decoder Library
|
||||
|
||||
Filename: s_tmp3dec_file.h
|
||||
|
||||
Date: 09/21/2007
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REVISION HISTORY
|
||||
|
||||
Description:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This include file defines the structure, tmp3dec_file.
|
||||
This structure contains information that needs to persist between calls
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef S_TMP3DEC_FILE_H
|
||||
#define S_TMP3DEC_FILE_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "s_tmp3dec_chan.h"
|
||||
#include "s_mp3bits.h"
|
||||
#include "s_huffcodetab.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int32 num_channels;
|
||||
int32 predicted_frame_size;
|
||||
int32 frame_start;
|
||||
int32 Scratch_mem[198];
|
||||
tmp3dec_chan perChan[CHAN];
|
||||
mp3ScaleFactors scaleFactors[CHAN];
|
||||
mp3SideInfo sideInfo;
|
||||
tmp3Bits mainDataStream;
|
||||
uint8 mainDataBuffer[BUFSIZE];
|
||||
tmp3Bits inputStream;
|
||||
huffcodetab ht[HUFF_TBL];
|
||||
} tmp3dec_file;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user