Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
C
cog
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Package Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
If you have an issue with any of our projects. feel free to register.
Open sidebar
Christopher Snowhill
cog
Commits
f1c45a81
Commit
f1c45a81
authored
Dec 22, 2020
by
Christopher Snowhill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated VGMStream to r1050-3533-g95709ce3
parent
3a677f5f
Changes
40
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
40 changed files
with
2195 additions
and
1297 deletions
+2195
-1297
Frameworks/vgmstream/libvgmstream.xcodeproj/project.pbxproj
Frameworks/vgmstream/libvgmstream.xcodeproj/project.pbxproj
+16
-0
Frameworks/vgmstream/vgmstream/src/coding/coding.h
Frameworks/vgmstream/vgmstream/src/coding/coding.h
+9
-1
Frameworks/vgmstream/vgmstream/src/coding/ffmpeg_decoder_custom_opus.c
...mstream/vgmstream/src/coding/ffmpeg_decoder_custom_opus.c
+27
-3
Frameworks/vgmstream/vgmstream/src/coding/ima_decoder.c
Frameworks/vgmstream/vgmstream/src/coding/ima_decoder.c
+33
-13
Frameworks/vgmstream/vgmstream/src/coding/mpeg_custom_utils_ealayer3.c
...mstream/vgmstream/src/coding/mpeg_custom_utils_ealayer3.c
+16
-11
Frameworks/vgmstream/vgmstream/src/coding/oki_decoder.c
Frameworks/vgmstream/vgmstream/src/coding/oki_decoder.c
+214
-214
Frameworks/vgmstream/vgmstream/src/coding/vorbis_custom_decoder.c
...ks/vgmstream/vgmstream/src/coding/vorbis_custom_decoder.c
+2
-0
Frameworks/vgmstream/vgmstream/src/coding/vorbis_custom_decoder.h
...ks/vgmstream/vgmstream/src/coding/vorbis_custom_decoder.h
+8
-6
Frameworks/vgmstream/vgmstream/src/coding/vorbis_custom_utils_awc.c
.../vgmstream/vgmstream/src/coding/vorbis_custom_utils_awc.c
+86
-0
Frameworks/vgmstream/vgmstream/src/decode.c
Frameworks/vgmstream/vgmstream/src/decode.c
+10
-2
Frameworks/vgmstream/vgmstream/src/formats.c
Frameworks/vgmstream/vgmstream/src/formats.c
+9
-2
Frameworks/vgmstream/vgmstream/src/layout/blocked_ubi_sce.c
Frameworks/vgmstream/vgmstream/src/layout/blocked_ubi_sce.c
+7
-8
Frameworks/vgmstream/vgmstream/src/meta/aifc.c
Frameworks/vgmstream/vgmstream/src/meta/aifc.c
+22
-3
Frameworks/vgmstream/vgmstream/src/meta/awb.c
Frameworks/vgmstream/vgmstream/src/meta/awb.c
+9
-1
Frameworks/vgmstream/vgmstream/src/meta/awc.c
Frameworks/vgmstream/vgmstream/src/meta/awc.c
+306
-76
Frameworks/vgmstream/vgmstream/src/meta/bmp_konami.c
Frameworks/vgmstream/vgmstream/src/meta/bmp_konami.c
+44
-45
Frameworks/vgmstream/vgmstream/src/meta/ea_eaac.c
Frameworks/vgmstream/vgmstream/src/meta/ea_eaac.c
+34
-26
Frameworks/vgmstream/vgmstream/src/meta/ffmpeg.c
Frameworks/vgmstream/vgmstream/src/meta/ffmpeg.c
+14
-1
Frameworks/vgmstream/vgmstream/src/meta/hca_keys.h
Frameworks/vgmstream/vgmstream/src/meta/hca_keys.h
+3
-0
Frameworks/vgmstream/vgmstream/src/meta/ifs.c
Frameworks/vgmstream/vgmstream/src/meta/ifs.c
+67
-0
Frameworks/vgmstream/vgmstream/src/meta/meta.h
Frameworks/vgmstream/vgmstream/src/meta/meta.h
+7
-1
Frameworks/vgmstream/vgmstream/src/meta/naac.c
Frameworks/vgmstream/vgmstream/src/meta/naac.c
+23
-18
Frameworks/vgmstream/vgmstream/src/meta/ngc_dsp_std.c
Frameworks/vgmstream/vgmstream/src/meta/ngc_dsp_std.c
+115
-46
Frameworks/vgmstream/vgmstream/src/meta/nxa.c
Frameworks/vgmstream/vgmstream/src/meta/nxa.c
+79
-58
Frameworks/vgmstream/vgmstream/src/meta/sbk.c
Frameworks/vgmstream/vgmstream/src/meta/sbk.c
+128
-0
Frameworks/vgmstream/vgmstream/src/meta/smp.c
Frameworks/vgmstream/vgmstream/src/meta/smp.c
+137
-127
Frameworks/vgmstream/vgmstream/src/meta/txth.c
Frameworks/vgmstream/vgmstream/src/meta/txth.c
+14
-2
Frameworks/vgmstream/vgmstream/src/meta/txtp.c
Frameworks/vgmstream/vgmstream/src/meta/txtp.c
+6
-1
Frameworks/vgmstream/vgmstream/src/meta/ubi_sb.c
Frameworks/vgmstream/vgmstream/src/meta/ubi_sb.c
+170
-125
Frameworks/vgmstream/vgmstream/src/meta/ubi_sb_garbage_streamfile.h
.../vgmstream/vgmstream/src/meta/ubi_sb_garbage_streamfile.h
+41
-0
Frameworks/vgmstream/vgmstream/src/meta/ubi_sb_streamfile.h
Frameworks/vgmstream/vgmstream/src/meta/ubi_sb_streamfile.h
+417
-424
Frameworks/vgmstream/vgmstream/src/meta/wii_bns.c
Frameworks/vgmstream/vgmstream/src/meta/wii_bns.c
+72
-75
Frameworks/vgmstream/vgmstream/src/meta/wwise.c
Frameworks/vgmstream/vgmstream/src/meta/wwise.c
+27
-1
Frameworks/vgmstream/vgmstream/src/meta/xmv_valve.c
Frameworks/vgmstream/vgmstream/src/meta/xmv_valve.c
+1
-1
Frameworks/vgmstream/vgmstream/src/mixing.c
Frameworks/vgmstream/vgmstream/src/mixing.c
+1
-1
Frameworks/vgmstream/vgmstream/src/plugins.c
Frameworks/vgmstream/vgmstream/src/plugins.c
+4
-4
Frameworks/vgmstream/vgmstream/src/streamfile.h
Frameworks/vgmstream/vgmstream/src/streamfile.h
+4
-0
Frameworks/vgmstream/vgmstream/src/util.h
Frameworks/vgmstream/vgmstream/src/util.h
+4
-0
Frameworks/vgmstream/vgmstream/src/vgmstream.c
Frameworks/vgmstream/vgmstream/src/vgmstream.c
+5
-1
Frameworks/vgmstream/vgmstream/src/vgmstream.h
Frameworks/vgmstream/vgmstream/src/vgmstream.h
+4
-0
No files found.
Frameworks/vgmstream/libvgmstream.xcodeproj/project.pbxproj
View file @
f1c45a81
...
...
@@ -504,6 +504,10 @@
838BDB7B1D3B1FC20022CA6F
/* CoreMedia.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
838BDB7A1D3B1FC20022CA6F
/* CoreMedia.framework */
;
};
838BDB7D1D3B1FCC0022CA6F
/* CoreVideo.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
838BDB7C1D3B1FCC0022CA6F
/* CoreVideo.framework */
;
};
838BDB7F1D3B1FD10022CA6F
/* Cocoa.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
838BDB7E1D3B1FD10022CA6F
/* Cocoa.framework */
;
};
8399335B2591E896001855AF
/* vorbis_custom_utils_awc.c in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
839933572591E896001855AF
/* vorbis_custom_utils_awc.c */
;
};
8399335F2591E8C1001855AF
/* ifs.c in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
8399335C2591E8C0001855AF
/* ifs.c */
;
};
839933602591E8C1001855AF
/* ubi_sb_garbage_streamfile.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
8399335D2591E8C0001855AF
/* ubi_sb_garbage_streamfile.h */
;
};
839933612591E8C1001855AF
/* sbk.c in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
8399335E2591E8C0001855AF
/* sbk.c */
;
};
83997F5B22D9569E00633184
/* rad.c in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
83997F5722D9569E00633184
/* rad.c */
;
};
839B54521EEE1D9600048A2D
/* ngc_ulw.c in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
831BD11F1EEE1CF200198540
/* ngc_ulw.c */
;
};
839E21E01F2EDAF100EE54D7
/* vorbis_custom_data_fsb.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
839E21D61F2EDAF000EE54D7
/* vorbis_custom_data_fsb.h */
;
};
...
...
@@ -1243,6 +1247,10 @@
838BDB7A1D3B1FC20022CA6F
/* CoreMedia.framework */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
wrapper.framework
;
name
=
CoreMedia.framework
;
path
=
System/Library/Frameworks/CoreMedia.framework
;
sourceTree
=
SDKROOT
;
};
838BDB7C1D3B1FCC0022CA6F
/* CoreVideo.framework */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
wrapper.framework
;
name
=
CoreVideo.framework
;
path
=
System/Library/Frameworks/CoreVideo.framework
;
sourceTree
=
SDKROOT
;
};
838BDB7E1D3B1FD10022CA6F
/* Cocoa.framework */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
wrapper.framework
;
name
=
Cocoa.framework
;
path
=
System/Library/Frameworks/Cocoa.framework
;
sourceTree
=
SDKROOT
;
};
839933572591E896001855AF
/* vorbis_custom_utils_awc.c */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.c
;
path
=
vorbis_custom_utils_awc.c
;
sourceTree
=
"<group>"
;
};
8399335C2591E8C0001855AF
/* ifs.c */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.c
;
path
=
ifs.c
;
sourceTree
=
"<group>"
;
};
8399335D2591E8C0001855AF
/* ubi_sb_garbage_streamfile.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
ubi_sb_garbage_streamfile.h
;
sourceTree
=
"<group>"
;
};
8399335E2591E8C0001855AF
/* sbk.c */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.c
;
path
=
sbk.c
;
sourceTree
=
"<group>"
;
};
83997F5722D9569E00633184
/* rad.c */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.c
;
path
=
rad.c
;
sourceTree
=
"<group>"
;
};
839E21D61F2EDAF000EE54D7
/* vorbis_custom_data_fsb.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
vorbis_custom_data_fsb.h
;
sourceTree
=
"<group>"
;
};
839E21D71F2EDAF000EE54D7
/* vorbis_custom_decoder.c */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.c
;
path
=
vorbis_custom_decoder.c
;
sourceTree
=
"<group>"
;
};
...
...
@@ -1598,6 +1606,7 @@
839E21DC1F2EDAF000EE54D7
/* vorbis_custom_data_wwise.h */
,
839E21D71F2EDAF000EE54D7
/* vorbis_custom_decoder.c */
,
839E21DB1F2EDAF000EE54D7
/* vorbis_custom_decoder.h */
,
839933572591E896001855AF
/* vorbis_custom_utils_awc.c */
,
839E21DA1F2EDAF000EE54D7
/* vorbis_custom_utils_fsb.c */
,
83E56BA01F2EE3500026BC60
/* vorbis_custom_utils_ogl.c */
,
839E21DF1F2EDAF000EE54D7
/* vorbis_custom_utils_sk.c */
,
...
...
@@ -1787,6 +1796,7 @@
834FE0DF215C79EB000A5D3D
/* hd3_bd3.c */
,
836F6E5318BDC2180095E648
/* his.c */
,
834FE0E0215C79EB000A5D3D
/* idsp_ie.c */
,
8399335C2591E8C0001855AF
/* ifs.c */
,
83C7280922BC893C00678B4A
/* ikm.c */
,
837CEAE623487F2B00E62A4A
/* ima.c */
,
832BF81121E05149006F50F1
/* imc.c */
,
...
...
@@ -1980,6 +1990,7 @@
836F6EEB18BDC2190095E648
/* sat_baka.c */
,
836F6EEC18BDC2190095E648
/* sat_dvi.c */
,
836F6EED18BDC2190095E648
/* sat_sap.c */
,
8399335E2591E8C0001855AF
/* sbk.c */
,
8349A8F51FE6257D00E26435
/* scd_pcm.c */
,
836F6EEE18BDC2190095E648
/* sd9.c */
,
834FE0E6215C79EC000A5D3D
/* sdf.c */
,
...
...
@@ -2031,6 +2042,7 @@
83031ED4243C510400C3F3E0
/* ubi_lyn_streamfile.h */
,
8306B0CA2098458E000302D4
/* ubi_lyn.c */
,
831BA6131EAC61A500CF89B0
/* ubi_raki.c */
,
8399335D2591E8C0001855AF
/* ubi_sb_garbage_streamfile.h */
,
8375737521F950EC00F01AF5
/* ubi_sb_streamfile.h */
,
8349A8F41FE6257D00E26435
/* ubi_sb.c */
,
834FE0C5215C79E6000A5D3D
/* ue4opus.c */
,
...
...
@@ -2156,6 +2168,7 @@
83FC176F23AC58D100E1025F
/* cri_utf.h in Headers */
,
83C7282822BC8C1500678B4A
/* mixing.h in Headers */
,
832BF82C21E0514B006F50F1
/* hca_keys_awb.h in Headers */
,
839933602591E8C1001855AF
/* ubi_sb_garbage_streamfile.h in Headers */
,
8306B0E020984590000302D4
/* ppst_streamfile.h in Headers */
,
83AA7F722519BFEA004C5298
/* vorbis_bitreader.h in Headers */
,
834FE0BA215C798C000A5D3D
/* ea_mt_decoder_utk.h in Headers */
,
...
...
@@ -2390,6 +2403,7 @@
837CEA7923487E2500E62A4A
/* ubi_adpcm_decoder.c in Sources */
,
834FE0EB215C79ED000A5D3D
/* str_wav.c in Sources */
,
83269DD32399F5DE00F49FE3
/* ivag.c in Sources */
,
8399335B2591E896001855AF
/* vorbis_custom_utils_awc.c in Sources */
,
8349A8DF1FE6251F00E26435
/* vorbis_custom_utils_vid1.c in Sources */
,
83A21F8D201D8982000F04B9
/* sqex_sead.c in Sources */
,
83EED5D3203A8BC7008BEB45
/* ea_swvr.c in Sources */
,
...
...
@@ -2846,6 +2860,7 @@
836F6FBF18BDC2190095E648
/* otm.c in Sources */
,
8306B0B420984552000302D4
/* blocked_tra.c in Sources */
,
834FE0B8215C798C000A5D3D
/* acm_decoder_decode.c in Sources */
,
8399335F2591E8C1001855AF
/* ifs.c in Sources */
,
8373342A23F60CDC00DE14DC
/* lrmd.c in Sources */
,
836F6FBD18BDC2190095E648
/* nwa.c in Sources */
,
837CEAFC23487F2C00E62A4A
/* raw_wavm.c in Sources */
,
...
...
@@ -2859,6 +2874,7 @@
83AA7F7F2519C042004C5298
/* bsf.c in Sources */
,
836F6F4118BDC2190095E648
/* blocked.c in Sources */
,
836F6F3B18BDC2190095E648
/* ws_decoder.c in Sources */
,
839933612591E8C1001855AF
/* sbk.c in Sources */
,
838BDB6E1D3B043C0022CA6F
/* ffmpeg.c in Sources */
,
832BF82B21E0514B006F50F1
/* xopus.c in Sources */
,
836F6F3418BDC2190095E648
/* nwa_decoder.c in Sources */
,
...
...
Frameworks/vgmstream/vgmstream/src/coding/coding.h
View file @
f1c45a81
...
...
@@ -37,7 +37,8 @@ void decode_apple_ima4(VGMSTREAMCHANNEL* stream, sample_t* outbuf, int channelsp
void
decode_fsb_ima
(
VGMSTREAM
*
vgmstream
,
VGMSTREAMCHANNEL
*
stream
,
sample_t
*
outbuf
,
int
channelspacing
,
int32_t
first_sample
,
int32_t
samples_to_do
,
int
channel
);
void
decode_wwise_ima
(
VGMSTREAM
*
vgmstream
,
VGMSTREAMCHANNEL
*
stream
,
sample_t
*
outbuf
,
int
channelspacing
,
int32_t
first_sample
,
int32_t
samples_to_do
,
int
channel
);
void
decode_awc_ima
(
VGMSTREAMCHANNEL
*
stream
,
sample_t
*
outbuf
,
int
channelspacing
,
int32_t
first_sample
,
int32_t
samples_to_do
);
void
decode_ubi_ima
(
VGMSTREAMCHANNEL
*
stream
,
sample_t
*
outbuf
,
int
channelspacing
,
int32_t
first_sample
,
int32_t
samples_to_do
,
int
channel
,
int
codec_config
);
void
decode_ubi_ima
(
VGMSTREAMCHANNEL
*
stream
,
sample_t
*
outbuf
,
int
channelspacing
,
int32_t
first_sample
,
int32_t
samples_to_do
,
int
channel
);
void
decode_ubi_sce_ima
(
VGMSTREAMCHANNEL
*
stream
,
sample_t
*
outbuf
,
int
channelspacing
,
int32_t
first_sample
,
int32_t
samples_to_do
,
int
channel
);
void
decode_h4m_ima
(
VGMSTREAMCHANNEL
*
stream
,
sample_t
*
outbuf
,
int
channelspacing
,
int32_t
first_sample
,
int32_t
samples_to_do
,
int
channel
,
uint16_t
frame_format
);
void
decode_cd_ima
(
VGMSTREAMCHANNEL
*
stream
,
sample_t
*
outbuf
,
int
channelspacing
,
int32_t
first_sample
,
int32_t
samples_to_do
,
int
channel
);
size_t
ima_bytes_to_samples
(
size_t
bytes
,
int
channels
);
...
...
@@ -343,6 +344,7 @@ typedef enum {
VORBIS_OGL
,
/* Shin'en OGL: custom packet headers */
VORBIS_SK
,
/* Silicon Knights AUD: "OggS" replaced by "SK" */
VORBIS_VID1
,
/* Neversoft VID1: custom packet blocks/headers */
VORBIS_AWC
,
/* Rockstar AWC: custom packet blocks/headers */
}
vorbis_custom_t
;
/* config for Wwise Vorbis (3 types for flexibility though not all combinations exist) */
...
...
@@ -365,6 +367,9 @@ typedef struct {
wwise_header_t
header_type
;
wwise_packet_t
packet_type
;
/* AWC config */
off_t
header_offset
;
/* output (kinda ugly here but to simplify) */
off_t
data_start_offset
;
...
...
@@ -543,6 +548,8 @@ typedef struct {
/* frame table */
off_t
table_offset
;
int
table_count
;
/* fixed frames */
uint16_t
frame_size
;
}
opus_config
;
ffmpeg_codec_data
*
init_ffmpeg_switch_opus_config
(
STREAMFILE
*
sf
,
off_t
start_offset
,
size_t
data_size
,
opus_config
*
cfg
);
...
...
@@ -552,6 +559,7 @@ ffmpeg_codec_data* init_ffmpeg_ea_opus(STREAMFILE* sf, off_t start_offset, size_
ffmpeg_codec_data
*
init_ffmpeg_x_opus
(
STREAMFILE
*
sf
,
off_t
table_offset
,
int
table_count
,
off_t
data_offset
,
size_t
data_size
,
int
channels
,
int
skip
);
ffmpeg_codec_data
*
init_ffmpeg_fsb_opus
(
STREAMFILE
*
sf
,
off_t
start_offset
,
size_t
data_size
,
int
channels
,
int
skip
,
int
sample_rate
);
ffmpeg_codec_data
*
init_ffmpeg_wwise_opus
(
STREAMFILE
*
sf
,
off_t
data_offset
,
size_t
data_size
,
opus_config
*
cfg
);
ffmpeg_codec_data
*
init_ffmpeg_fixed_opus
(
STREAMFILE
*
sf
,
off_t
data_offset
,
size_t
data_size
,
opus_config
*
cfg
);
size_t
switch_opus_get_samples
(
off_t
offset
,
size_t
stream_size
,
STREAMFILE
*
sf
);
...
...
Frameworks/vgmstream/vgmstream/src/coding/ffmpeg_decoder_custom_opus.c
View file @
f1c45a81
...
...
@@ -17,7 +17,7 @@
* https://github.com/hcs64/ww2ogg
*/
typedef
enum
{
OPUS_SWITCH
,
OPUS_UE4_v1
,
OPUS_UE4_v2
,
OPUS_EA
,
OPUS_X
,
OPUS_FSB
,
OPUS_WWISE
}
opus_type_t
;
typedef
enum
{
OPUS_SWITCH
,
OPUS_UE4_v1
,
OPUS_UE4_v2
,
OPUS_EA
,
OPUS_X
,
OPUS_FSB
,
OPUS_WWISE
,
OPUS_FIXED
}
opus_type_t
;
static
size_t
make_oggs_first
(
uint8_t
*
buf
,
int
buf_size
,
opus_config
*
cfg
);
static
size_t
make_oggs_page
(
uint8_t
*
buf
,
int
buf_size
,
size_t
data_size
,
int
page_sequence
,
int
granule
);
...
...
@@ -36,6 +36,9 @@ typedef struct {
int
table_count
;
uint16_t
*
frame_table
;
/* fixed frame size for variations that use this */
uint16_t
frame_size
;
/* state */
off_t
logical_offset
;
/* offset that corresponds to physical_offset */
off_t
physical_offset
;
/* actual file offset */
...
...
@@ -130,6 +133,10 @@ static size_t opus_io_read(STREAMFILE* sf, uint8_t *dest, off_t offset, size_t l
data_size
=
get_table_frame_size
(
data
,
data
->
sequence
-
2
);
skip_size
=
0
;
break
;
case
OPUS_FIXED
:
data_size
=
data
->
frame_size
;
skip_size
=
0
;
break
;
default:
return
0
;
}
...
...
@@ -231,6 +238,10 @@ static size_t opus_io_size(STREAMFILE* sf, opus_io_data* data) {
data_size
=
get_table_frame_size
(
data
,
packet
);
skip_size
=
0x00
;
break
;
case
OPUS_FIXED
:
data_size
=
data
->
frame_size
;
skip_size
=
0
;
break
;
default:
return
0
;
}
...
...
@@ -295,7 +306,7 @@ static void opus_io_close(STREAMFILE* sf, opus_io_data* data) {
/* Prepares custom IO for custom Opus, that is converted to Ogg Opus on the fly */
static
STREAMFILE
*
setup_opus_streamfile
(
STREAMFILE
*
sf
,
opus_config
*
cfg
,
off_t
stream_offset
,
size_t
stream_size
,
opus_type_t
type
)
{
static
STREAMFILE
*
setup_opus_streamfile
(
STREAMFILE
*
sf
,
opus_config
*
cfg
,
off_t
stream_offset
,
size_t
stream_size
,
opus_type_t
type
)
{
STREAMFILE
*
new_sf
=
NULL
;
opus_io_data
io_data
=
{
0
};
...
...
@@ -308,6 +319,7 @@ static STREAMFILE* setup_opus_streamfile(STREAMFILE* sf, opus_config *cfg, off_t
io_data
.
physical_offset
=
stream_offset
;
io_data
.
table_offset
=
cfg
->
table_offset
;
io_data
.
table_count
=
cfg
->
table_count
;
io_data
.
frame_size
=
cfg
->
frame_size
;
io_data
.
head_size
=
make_oggs_first
(
io_data
.
head_buffer
,
sizeof
(
io_data
.
head_buffer
),
cfg
);
if
(
!
io_data
.
head_size
)
goto
fail
;
...
...
@@ -612,12 +624,16 @@ static size_t custom_opus_get_samples(off_t offset, size_t stream_size, STREAMFI
skip_size
=
0x02
;
break
;
#if 0 //
needs data* for frame table, but
num_samples should exist on header
#if 0 //
needs data*,
num_samples should exist on header
case OPUS_X:
case OPUS_WWISE:
data_size = get_table_frame_size(data, packet);
skip_size = 0x00;
break;
case OPUS_FIXED:
data_size = data->frame_size;
skip_size = 0;
break;
#endif
default:
return
0
;
...
...
@@ -661,6 +677,11 @@ static size_t custom_opus_get_encoder_delay(off_t offset, STREAMFILE* sf, opus_t
case
OPUS_WWISE
:
skip_size
=
0x00
;
break
;
#if 0 //should exist on header
case OPUS_FIXED:
skip_size = 0x00;
break;
#endif
default:
return
0
;
}
...
...
@@ -756,6 +777,9 @@ ffmpeg_codec_data* init_ffmpeg_fsb_opus(STREAMFILE* sf, off_t start_offset, size
ffmpeg_codec_data
*
init_ffmpeg_wwise_opus
(
STREAMFILE
*
sf
,
off_t
data_offset
,
size_t
data_size
,
opus_config
*
cfg
)
{
return
init_ffmpeg_custom_opus_config
(
sf
,
data_offset
,
data_size
,
cfg
,
OPUS_WWISE
);
}
ffmpeg_codec_data
*
init_ffmpeg_fixed_opus
(
STREAMFILE
*
sf
,
off_t
data_offset
,
size_t
data_size
,
opus_config
*
cfg
)
{
return
init_ffmpeg_custom_opus_config
(
sf
,
data_offset
,
data_size
,
cfg
,
OPUS_FIXED
);
}
static
opus_type_t
get_ue4opus_version
(
STREAMFILE
*
sf
,
off_t
offset
)
{
int
read_samples
,
calc_samples
;
...
...
Frameworks/vgmstream/vgmstream/src/coding/ima_decoder.c
View file @
f1c45a81
...
...
@@ -1065,9 +1065,8 @@ void decode_awc_ima(VGMSTREAMCHANNEL * stream, sample_t * outbuf, int channelspa
/* DVI stereo/mono with some mini header and sample output */
void
decode_ubi_ima
(
VGMSTREAMCHANNEL
*
stream
,
sample_t
*
outbuf
,
int
channelspacing
,
int32_t
first_sample
,
int32_t
samples_to_do
,
int
channel
,
int
codec_config
)
{
void
decode_ubi_ima
(
VGMSTREAMCHANNEL
*
stream
,
sample_t
*
outbuf
,
int
channelspacing
,
int32_t
first_sample
,
int32_t
samples_to_do
,
int
channel
)
{
int
i
,
sample_count
=
0
;
int
has_header
=
(
codec_config
&
0x80
)
==
0
;
int32_t
hist1
=
stream
->
adpcm_history1_32
;
int
step_index
=
stream
->
adpcm_step_index
;
...
...
@@ -1075,7 +1074,7 @@ void decode_ubi_ima(VGMSTREAMCHANNEL * stream, sample_t * outbuf, int channelspa
//internal interleave
//header in the beginning of the stream
if
(
has_header
&&
stream
->
channel_start_offset
==
stream
->
offset
)
{
if
(
stream
->
channel_start_offset
==
stream
->
offset
)
{
int
version
,
big_endian
,
header_samples
,
max_samples_to_do
;
int16_t
(
*
read_16bit
)(
off_t
,
STREAMFILE
*
)
=
NULL
;
off_t
offset
=
stream
->
offset
;
...
...
@@ -1108,16 +1107,10 @@ void decode_ubi_ima(VGMSTREAMCHANNEL * stream, sample_t * outbuf, int channelspa
}
}
if
(
has_header
)
{
first_sample
-=
10
;
//todo fix hack (needed to adjust nibble offset below)
first_sample
-=
10
;
//todo fix hack (needed to adjust nibble offset below)
if
(
step_index
<
0
)
step_index
=
0
;
if
(
step_index
>
88
)
step_index
=
88
;
}
else
{
if
(
step_index
<
0
)
step_index
=
0
;
if
(
step_index
>
89
)
step_index
=
89
;
}
if
(
step_index
<
0
)
step_index
=
0
;
if
(
step_index
>
88
)
step_index
=
88
;
for
(
i
=
first_sample
;
i
<
first_sample
+
samples_to_do
;
i
++
,
sample_count
+=
channelspacing
)
{
off_t
byte_offset
=
channelspacing
==
1
?
...
...
@@ -1131,12 +1124,39 @@ void decode_ubi_ima(VGMSTREAMCHANNEL * stream, sample_t * outbuf, int channelspa
outbuf
[
sample_count
]
=
(
short
)(
hist1
);
/* all samples are written */
}
//external interleave
stream
->
adpcm_history1_32
=
hist1
;
stream
->
adpcm_step_index
=
step_index
;
}
/* standard IMA but with a tweak for Ubi's encoder bug with step index (see blocked_ubi_sce.c) */
void
decode_ubi_sce_ima
(
VGMSTREAMCHANNEL
*
stream
,
sample_t
*
outbuf
,
int
channelspacing
,
int32_t
first_sample
,
int32_t
samples_to_do
,
int
channel
)
{
int
i
,
sample_count
=
0
;
int32_t
hist1
=
stream
->
adpcm_history1_32
;
int
step_index
=
stream
->
adpcm_step_index
;
//internal interleave
if
(
step_index
<
0
)
step_index
=
0
;
if
(
step_index
>
89
)
step_index
=
89
;
for
(
i
=
first_sample
;
i
<
first_sample
+
samples_to_do
;
i
++
,
sample_count
+=
channelspacing
)
{
off_t
byte_offset
=
channelspacing
==
1
?
stream
->
offset
+
i
/
2
:
/* mono mode */
stream
->
offset
+
i
;
/* stereo mode */
int
nibble_shift
=
channelspacing
==
1
?
(
!
(
i
%
2
)
?
4
:
0
)
:
/* mono mode (high first) */
(
channel
==
0
?
4
:
0
);
/* stereo mode (high=L,low=R) */
std_ima_expand_nibble
(
stream
,
byte_offset
,
nibble_shift
,
&
hist1
,
&
step_index
);
outbuf
[
sample_count
]
=
(
short
)(
hist1
);
/* all samples are written */
}
stream
->
adpcm_history1_32
=
hist1
;
stream
->
adpcm_step_index
=
step_index
;
}
/* IMA with variable frame formats controlled by the block layout. The original code uses
* tables mapping all standard IMA combinations (to optimize calculations), but decodes the same.
* Based on HCS's and Nisto's reverse engineering in h4m_audio_decode. */
...
...
Frameworks/vgmstream/vgmstream/src/coding/mpeg_custom_utils_ealayer3.c
View file @
f1c45a81
...
...
@@ -97,23 +97,23 @@ static int ealayer3_is_empty_frame_v2p(STREAMFILE* sf, off_t offset);
/* **************************************************************************** */
/* init codec from an EALayer3 frame */
int
mpeg_custom_setup_init_ealayer3
(
STREAMFILE
*
s
treamfile
,
off_t
start_offset
,
mpeg_codec_data
*
data
,
coding_t
*
coding_type
)
{
int
mpeg_custom_setup_init_ealayer3
(
STREAMFILE
*
s
f
,
off_t
start_offset
,
mpeg_codec_data
*
data
,
coding_t
*
coding_type
)
{
int
ok
;
ealayer3_buffer_t
ib
=
{
0
};
ealayer3_frame_t
eaf
;
//;VGM_LOG("init at %lx
\n", start_offset
);
//;VGM_LOG("init at %lx
, %x\n", start_offset, read_u32be(start_offset, sf)
);
/* get first frame for info */
{
ib
.
sf
=
s
treamfile
;
ib
.
sf
=
s
f
;
ib
.
offset
=
start_offset
;
ib
.
is
.
buf
=
ib
.
buf
;
ok
=
ealayer3_parse_frame
(
data
,
-
1
,
&
ib
,
&
eaf
);
if
(
!
ok
)
goto
fail
;
}
;
VGM_ASSERT
(
!
eaf
.
mpeg1
,
"EAL3: mpeg2 found at 0x%lx
\n
"
,
start_offset
);
/* rare [FIFA 08 (PS3) abk] */
VGM_ASSERT
(
!
eaf
.
mpeg1
,
"EAL3: mpeg2 found at 0x%lx
\n
"
,
start_offset
);
/* rare [FIFA 08 (PS3) abk] */
*
coding_type
=
coding_MPEG_ealayer3
;
data
->
channels_per_frame
=
eaf
.
channels
;
...
...
@@ -385,11 +385,16 @@ static int ealayer3_parse_frame_v2(ealayer3_buffer_t* ib, ealayer3_frame_t* eaf)
ok
=
ealayer3_parse_frame_common
(
ib
,
eaf
);
if
(
!
ok
)
goto
fail
;
}
else
{
/* rarely frames contain PCM data only [FIFA 2014 World Cup Brazil (PS3)] */
eaf
->
channels
=
eaf
->
v2_stereo_flag
+
1
;
}
VGM_ASSERT
(
eaf
->
v2_extended_flag
&&
eaf
->
v2_common_size
==
0
,
"EA EAL3: v2 empty frame
\n
"
);
/* seen in V2S */
VGM_ASSERT
(
eaf
->
v2_extended_flag
&&
eaf
->
v2_offset_samples
>
0
,
"EA EAL3: v2_offset_mode=%x with value=0x%x
\n
"
,
eaf
->
v2_offset_mode
,
eaf
->
v2_offset_samples
);
//VGM_ASSERT(eaf->v2_pcm_samples > 0, "EA EAL3: v2_pcm_samples 0x%x\n", eaf->v2_pcm_samples);
eaf
->
pcm_size
=
(
2
*
eaf
->
v2_pcm_samples
*
eaf
->
channels
);
eaf
->
pcm_size
=
(
eaf
->
v2_pcm_samples
*
sizeof
(
int16_t
)
*
eaf
->
channels
);
eaf
->
eaframe_size
=
eaf
->
pre_size
+
eaf
->
common_size
+
eaf
->
pcm_size
;
...
...
@@ -408,14 +413,14 @@ fail:
/* parses an EALayer3 frame (common part) */
static
int
ealayer3_parse_frame_common
(
ealayer3_buffer_t
*
ib
,
ealayer3_frame_t
*
eaf
)
{
/* index tables */
static
const
int
version
s
[
4
]
=
{
/* MPEG 2.5 */
3
,
/* reserved */
-
1
,
/* MPEG 2 */
2
,
/* MPEG 1 */
1
};
static
const
int
sample_rate
s
[
4
][
4
]
=
{
/* [version_index][sample rate index] */
static
const
int
version
_table
[
4
]
=
{
/* MPEG 2.5 */
3
,
/* reserved */
-
1
,
/* MPEG 2 */
2
,
/* MPEG 1 */
1
};
static
const
int
sample_rate
_table
[
4
][
4
]
=
{
/* [version_index][sample rate index] */
{
11025
,
12000
,
8000
,
-
1
},
/* MPEG2.5 */
{
-
1
,
-
1
,
-
1
,
-
1
},
/* reserved */
{
22050
,
24000
,
16000
,
-
1
},
/* MPEG2 */
{
44100
,
48000
,
32000
,
-
1
},
/* MPEG1 */
};
static
const
int
channel
s
[
4
]
=
{
2
,
2
,
2
,
1
};
/* [channel_mode] */
static
const
int
channel
_table
[
4
]
=
{
2
,
2
,
2
,
1
};
/* [channel_mode] */
bitstream_t
*
is
=
&
ib
->
is
;
off_t
start_b_off
=
is
->
b_off
;
...
...
@@ -441,9 +446,9 @@ static int ealayer3_parse_frame_common(ealayer3_buffer_t* ib, ealayer3_frame_t*
/* derived */
eaf
->
version
=
version
s
[
eaf
->
version_index
];
eaf
->
channels
=
channel
s
[
eaf
->
channel_mode
];
eaf
->
sample_rate
=
sample_rate
s
[
eaf
->
version_index
][
eaf
->
sample_rate_index
];
eaf
->
version
=
version
_table
[
eaf
->
version_index
];
eaf
->
channels
=
channel
_table
[
eaf
->
channel_mode
];
eaf
->
sample_rate
=
sample_rate
_table
[
eaf
->
version_index
][
eaf
->
sample_rate_index
];
eaf
->
mpeg1
=
(
eaf
->
version
==
1
);
if
(
eaf
->
version
==
-
1
||
eaf
->
sample_rate
==
-
1
)
{
...
...
Frameworks/vgmstream/vgmstream/src/coding/oki_decoder.c
View file @
f1c45a81
#include "coding.h"
static
const
int
step_sizes
[
49
]
=
{
/* OKI table (subsection of IMA's table) */
16
,
17
,
19
,
21
,
23
,
25
,
28
,
31
,
34
,
37
,
41
,
45
,
50
,
55
,
60
,
66
,
73
,
80
,
88
,
97
,
107
,
118
,
130
,
143
,
157
,
173
,
190
,
209
,
230
,
253
,
279
,
307
,
337
,
371
,
408
,
449
,
494
,
544
,
598
,
658
,
724
,
796
,
876
,
963
,
1060
,
1166
,
1282
,
1411
,
1552
};
static
const
int
stex_indexes
[
16
]
=
{
/* OKI table (also from IMA) */
-
1
,
-
1
,
-
1
,
-
1
,
2
,
4
,
6
,
8
,
-
1
,
-
1
,
-
1
,
-
1
,
2
,
4
,
6
,
8
};
static
void
pcfx_expand_nibble
(
VGMSTREAMCHANNEL
*
stream
,
off_t
byte_offset
,
int
nibble_shift
,
int32_t
*
hist1
,
int32_t
*
step_index
,
int16_t
*
out_sample
,
int
mode
)
{
int
code
,
step
,
delta
;
code
=
(
read_8bit
(
byte_offset
,
stream
->
streamfile
)
>>
nibble_shift
)
&
0xf
;
step
=
step_sizes
[
*
step_index
];
delta
=
(
code
&
0x7
);
if
(
mode
&
1
)
{
if
(
step
==
1552
)
/* bad last step_sizes value from OKI table */
step
=
1522
;
delta
=
step
*
(
delta
+
1
)
*
2
;
}
else
{
delta
=
step
*
(
delta
+
1
);
}
if
(
code
&
0x8
)
delta
=
-
delta
;
*
step_index
+=
stex_indexes
[
code
];
if
(
*
step_index
<
0
)
*
step_index
=
0
;
if
(
*
step_index
>
48
)
*
step_index
=
48
;
*
hist1
+=
delta
;
if
(
*
hist1
>
16383
)
*
hist1
=
16383
;
if
(
*
hist1
<
-
16384
)
*
hist1
=
-
16384
;
if
(
mode
&
1
)
{
*
out_sample
=
*
hist1
;
}
else
{
*
out_sample
=
*
hist1
<<
1
;
}
/* seems real HW does filtering here too */
/* double volume since it clips at half */
if
(
mode
&
2
)
{
*
out_sample
=
*
hist1
<<
1
;
}
}
static
void
oki16_expand_nibble
(
VGMSTREAMCHANNEL
*
stream
,
off_t
byte_offset
,
int
nibble_shift
,
int32_t
*
hist1
,
int32_t
*
step_index
,
int16_t
*
out_sample
)
{
int
code
,
step
,
delta
;
code
=
(
read_8bit
(
byte_offset
,
stream
->
streamfile
)
>>
nibble_shift
)
&
0xf
;
step
=
step_sizes
[
*
step_index
];
/* IMA 'mul' style (standard OKI uses 'shift-add') */
delta
=
(
code
&
0x7
);
delta
=
(((
delta
*
2
)
+
1
)
*
step
)
>>
3
;
if
(
code
&
0x8
)
delta
=
-
delta
;
*
hist1
+=
delta
;
/* standard OKI clamps hist to 2047,-2048 here */
*
step_index
+=
stex_indexes
[
code
];
if
(
*
step_index
<
0
)
*
step_index
=
0
;
if
(
*
step_index
>
48
)
*
step_index
=
48
;
*
out_sample
=
*
hist1
;
}
/* Possible variation for adp_konami (Viper hardware):
* delta = ((n&7) + 0.5) * stepsize / 4; clamps 2047,-2048
; nigh nibble first
*
* Results are very similar, but can't verify actual decoding, and oki4s is used in
* Jubeat (also Konami) so it makes sense they would have reused it.
* Viper sound chip may be a YMZ280B though.
*/
static
void
oki4s_expand_nibble
(
VGMSTREAMCHANNEL
*
stream
,
off_t
byte_offset
,
int
nibble_shift
,
int32_t
*
hist1
,
int32_t
*
step_index
,
int16_t
*
out_sample
)
{
int
code
,
step
,
delta
;
code
=
(
read_8bit
(
byte_offset
,
stream
->
streamfile
)
>>
nibble_shift
)
&
0xf
;
step
=
step_sizes
[
*
step_index
];
step
=
step
<<
4
;
/* original table has precomputed step_sizes so that this isn't done */
/* IMA 'shift-add' style (like standard OKI) */
delta
=
step
>>
3
;
if
(
code
&
1
)
delta
+=
step
>>
2
;
if
(
code
&
2
)
delta
+=
step
>>
1
;
if
(
code
&
4
)
delta
+=
step
;
if
(
code
&
8
)
delta
=
-
delta
;
*
hist1
+=
delta
;
*
hist1
=
clamp16
(
*
hist1
);
/* standard OKI clamps hist to 2047,-2048 here */
*
step_index
+=
stex_indexes
[
code
];
if
(
*
step_index
<
0
)
*
step_index
=
0
;
if
(
*
step_index
>
48
)
*
step_index
=
48
;
*
out_sample
=
*
hist1
;
}
/* PC-FX ADPCM decoding, variation of OKI/Dialogic/VOX ADPCM. Based on mednafen/pcfx-music-dump.
* Apparently most ADPCM was made with a buggy encoder, resulting in incorrect sound in real hardware
* and sound clipped at half. Decoding can be controlled with modes:
* - 0: hardware decoding (waveforms in many games will look wrong, ex. Der Langrisser track 032)
* - 1: 'buggy encoder' decoding (waveforms will look fine)
* - 2: hardware decoding with double volume (may clip?)
* - 3: 'buggy encoder' decoding with double volume
*
* PC-FX ISOs don't have a standard filesystem nor file formats (raw data must be custom-ripped),
* so it's needs GENH/TXTH. Sample rate can only be base_value divided by 1/2/3/4, where
* base_value is approximately ~31468.5 (follows hardware clocks), mono or interleaved for stereo.
*/
void
decode_pcfx
(
VGMSTREAMCHANNEL
*
stream
,
sample_t
*
outbuf
,
int
channelspacing
,
int32_t
first_sample
,
int32_t
samples_to_do
,
int
mode
)
{
int
i
,
sample_count
=
0
;
int32_t
hist1
=
stream
->
adpcm_history1_32
;
int
step_index
=
stream
->
adpcm_step_index
;
int16_t
out_sample
;
for
(
i
=
first_sample
;
i
<
first_sample
+
samples_to_do
;
i
++
)
{
off_t
byte_offset
=
stream
->
offset
+
i
/
2
;
int
nibble_shift
=
(
i
&
1
?
4
:
0
);
/* low nibble first */
pcfx_expand_nibble
(
stream
,
byte_offset
,
nibble_shift
,
&
hist1
,
&
step_index
,
&
out_sample
,
mode
);
outbuf
[
sample_count
]
=
out_sample
;
sample_count
+=
channelspacing
;
}
stream
->
adpcm_history1_32
=
hist1
;
stream
->
adpcm_step_index
=
step_index
;
}
/* OKI variation with 16-bit output (vs standard's 12-bit), found in FrontWing's PS2 games (Sweet Legacy, Hooligan).
* Reverse engineered from the ELF with help from the folks at hcs.
*/
void
decode_oki16
(
VGMSTREAMCHANNEL
*
stream
,
sample_t
*
outbuf
,
int
channelspacing
,
int32_t
first_sample
,
int32_t
samples_to_do
,
int
channel
)
{
int
i
,
sample_count
=
0
;
int32_t
hist1
=
stream
->
adpcm_history1_32
;
int
step_index
=
stream
->
adpcm_step_index
;
int16_t
out_sample
;
int
is_stereo
=
channelspacing
>
1
;
/* external interleave */
/* no header (external setup), pre-clamp for wrong values */
if
(
step_index
<
0
)
step_index
=
0
;
if
(
step_index
>
48
)
step_index
=
48
;
/* decode nibbles (layout: varies) */
for
(
i
=
first_sample
;
i
<
first_sample
+
samples_to_do
;
i
++
,
sample_count
+=
channelspacing
)
{
off_t
byte_offset
=
is_stereo
?
stream
->
offset
+
i
:
/* stereo: one nibble per channel */
stream
->
offset
+
i
/
2
;
/* mono: consecutive nibbles (assumed) */
int
nibble_shift
=
is_stereo
?
(
!
(
channel
&
1
)
?
0
:
4
)
:
(
!
(
i
&
1
)
?
0
:
4
);
/* even = low, odd = high */
oki16_expand_nibble
(
stream
,
byte_offset
,
nibble_shift
,
&
hist1
,
&
step_index
,
&
out_sample
);
outbuf
[
sample_count
]
=
(
out_sample
);
}
stream
->
adpcm_history1_32
=
hist1
;
stream
->
adpcm_step_index
=
step_index
;
}
/* OKI variation with 16-bit output (vs standard's 12-bit) and pre-adjusted tables (shifted by 4), found in Jubeat Clan (AC).