mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-10 01:28:44 +02:00
test(audiodec): cover the raw M4AAC configuration search with a 5.1 stream
A raw 5.1 LC frame decodes as 6 channels with a maximum of 6 and of 8, which is only reached by moving past the mono/stereo configuration. The configuration search is listed under unknown function info, together with a mono raw stream being reported as 2 channels. Co-authored-by: Dextroid17 <217507631+Dextroid17@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -48,6 +48,74 @@ const std::uint8_t AAC_ADTS[] = {
|
||||
0x33, 0x50, 0x8E, 0x34, 0xA2, 0x64, 0xA6, 0xBB, 0xDF, 0xD5, 0xAA, 0xE4, 0xB4, 0x97, 0x1D, 0x72, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C,
|
||||
};
|
||||
|
||||
const std::uint8_t AAC_RAW_51[] = {
|
||||
0x00, 0xDE, 0x34, 0xAC, 0xF1, 0x1D, 0x0C, 0x05, 0x89, 0xA2, 0x61, 0x40,
|
||||
0xB4, 0x4A, 0x37, 0x8D, 0xFF, 0x7F, 0xFD, 0x3F, 0xCF, 0xFB, 0x79, 0xE7,
|
||||
0xE3, 0xCE, 0x4C, 0x8B, 0x5D, 0xD5, 0xD5, 0x3F, 0xE9, 0x47, 0x6A, 0x5D,
|
||||
0x69, 0xBA, 0xB1, 0x9A, 0x78, 0xAA, 0x3C, 0xD4, 0xF7, 0xA6, 0xD3, 0x13,
|
||||
0xCC, 0x21, 0x93, 0x2B, 0x3E, 0x67, 0xDE, 0x74, 0x1A, 0xA3, 0xE7, 0x31,
|
||||
0xE2, 0x47, 0xE8, 0x68, 0xFB, 0xD5, 0xF6, 0xB5, 0xFC, 0x57, 0xDE, 0x9E,
|
||||
0x43, 0x6F, 0x3E, 0xF5, 0xF2, 0x1F, 0xBC, 0xFB, 0xC5, 0xBC, 0x53, 0x16,
|
||||
0xE4, 0x57, 0xAC, 0x64, 0x14, 0xE6, 0x88, 0xAF, 0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||
0x19, 0x60, 0x33, 0x3A, 0x38,
|
||||
};
|
||||
|
||||
const std::uint8_t MP3_MONO[] = {
|
||||
0xFF, 0xFB, 0x14, 0xC4, 0x00, 0x00, 0x03, 0xB0, 0x21, 0x5E, 0xF4, 0x30, 0x80, 0x30, 0x98, 0x88, 0xA9, 0x83, 0x34, 0x70, 0x00, 0x18, 0x89, 0xCB,
|
||||
0x20, 0x00, 0x3B, 0xBB, 0xB9, 0x9F, 0xD7, 0x0E, 0x06, 0x06, 0x06, 0x2C, 0x3E, 0xEF, 0x83, 0xE7, 0xF1, 0x00, 0x63, 0x83, 0xFD, 0x4E, 0xFC, 0xFF,
|
||||
@@ -143,6 +211,20 @@ void TestAac(bool adts, std::uint32_t maxChannels = 2) {
|
||||
Require(sceAudiodecDeleteDecoder(handle) == 0);
|
||||
}
|
||||
|
||||
void TestAacRaw51(std::uint32_t maxChannels) {
|
||||
AudiodecParamM4aac param{sizeof(param), 1, 2, 3, maxChannels, 0};
|
||||
AudiodecM4aacInfo info{sizeof(info), 0, 0, 0, 0};
|
||||
AudiodecCtrl ctrl{¶m, &info, nullptr, nullptr};
|
||||
const std::int32_t handle = sceAudiodecCreateDecoder(&ctrl, 3);
|
||||
Require(handle > 0 && info.ui_number_of_channels == maxChannels);
|
||||
Streams streams;
|
||||
Require(Decode(handle, ctrl, streams, AAC_RAW_51, sizeof(AAC_RAW_51)) == 0);
|
||||
Require(streams.pcm.ui_pcm_size == 1024 * 6 * 2);
|
||||
Require(info.ui_sampling_freq == 48000 && info.ui_number_of_channels == 6 && info.i_result == 0);
|
||||
Require(sceAudiodecClearContext(handle) == 0);
|
||||
Require(sceAudiodecDeleteDecoder(handle) == 0);
|
||||
}
|
||||
|
||||
void TestMp3() {
|
||||
AudiodecParamMp3 param{sizeof(param), 2};
|
||||
AudiodecMp3Info info{};
|
||||
@@ -231,6 +313,8 @@ int main() {
|
||||
TestAac(false);
|
||||
TestAac(false, 6);
|
||||
TestAac(false, 8);
|
||||
TestAacRaw51(6);
|
||||
TestAacRaw51(8);
|
||||
TestMp3();
|
||||
TestAt9();
|
||||
for (std::uint32_t type = 1; type <= 3; ++type) Require(sceAudiodecTermLibrary(type) == 0);
|
||||
|
||||
@@ -70,6 +70,7 @@ Throughout the project, every function at every stage either **does exactly what
|
||||
- [s_setkill](../../core/shader/recompiler/RdnaDecoder/src/RdnaScalarOpDecoder.cpp) (core/shader/recompiler) - decoded as `s_endpgm` for any immediate: measured on RDNA2 hardware (gfx1035), a store before it is visible and nothing after it runs ([#771](https://github.com/boykopovar/AnyPS5/pull/771)); whether the KILL status bit it sets is observable differently from `s_endpgm` is unverified
|
||||
- [sceRtcParseDateTime](../../core/libs/prx/libSceRtc/Export.cpp) (libSceRtc) - the console's zone name table is only known from the names measured on a PS5 (firmware 13.60); any other name is assumed to take the military letter offset of its first character, as every measured name outside the table does (`HST`, `MSK`, `XYZ`), so a name the console's table holds but nobody measured gets the wrong offset
|
||||
- [sceAudio3dPortOpen](../../core/libs/prx/libSceAudio3d/Export.cpp) (libSceAudio3d) - buffer modes 0 and 1 (also selected by the 0x10 and 0x18 parameter sizes) and 3 beds depend on an SDK version check in the module ([prosper](https://github.com/mattias800/prosper)) and throw. A repeated `sceAudio3dInitialize` (`NOT_READY` in shadPS4, 0 in prosper) and `sceAudio3dPortAdvance` on a full queue (`NOT_READY` in shadPS4, unhandled in KytyPS5) throw too
|
||||
- [sceAudiodecDecode](../../core/libs/prx/libSceAudiodec/src/Codecs.cpp) (libSceAudiodec) - a raw M4AAC stream carries no channel configuration, so the decoder tries the mono/stereo configuration and then configurations 3 to 7 within `ui_max_channels` until one decodes the first access unit, and keeps that one. No reference documents how the library picks the layout (shadPS4 maps the channel count straight to the configuration; SharpProspero only describes the maximum). With the stereo configuration a mono raw stream decodes as 2 channels, so 2 is reported, not 1
|
||||
- [sceAudio3dObjectReserve](../../core/libs/prx/libSceAudio3d/Export.cpp) (libSceAudio3d) - object ids, the `max_objects` limit and the checks of `sceAudio3dObjectReserve` and `sceAudio3dObjectUnreserve` follow [shadPS4](https://github.com/shadps4-emu/shadPS4) (PS4), the only reference with a body: ids count up from 1 per port, skipping 0, 0xFFFFFFFF and ids in use, and a failed reserve writes 0xFFFFFFFF
|
||||
- [s_sethalt](../../core/shader/recompiler/Translation/src/ScalarInstructions.cpp) (core/shader/recompiler) - with SIMM16[0] clear it is a no-op: the RDNA 2 ISA guide describes that value as resuming a halted wave, and a wave that executes it is not halted; measured on a gfx1035 (RDNA 2) wave: `s_sethalt 0` followed by a VALU op completes and gives the normal result. Only SIMM16[0] is read; with it set the instruction throws
|
||||
- [AMPR WriteAddressFromCounterPairOnCompletion](../../core/libs/prx/libSceAmpr/Export.cpp) (libSceAmpr) - the pair of an even counter n is assumed to give counter n in the low 32 bits and n + 1 in the high 32 bits. Wait compare values, wait flush and counter index ranges follow the [ampr_emu](https://github.com/drakmor/ampr_emu) reimplementation; the flush is accepted and has no effect, as commands run in order
|
||||
|
||||
Reference in New Issue
Block a user