This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Decoding Problem with hle.sceAtrac3plus
#1
Since I haven't tried a new revision for some time now, I tried to do so again.
That's when I encountered an interesting problem:

The external decoder(SonicStage is installed and enabled in the settings) is not working anymore.

The last revision I used was r2984. There I got these lines in the logger:

39453 [CRI ADX Audio] INFO hle.sceAtrac3plus - hleAtracSetData atracID=0, buffer=0x09DDC600, readSize=0x4000, bufferSize=0x4000, fileSize=0xF8B0C
41563 [CRI ADX Audio] INFO hle - AT3+ data decoded by the external decoder (all AT3+ data retrieved).

so decoding worked back then.

Now, with r3128 I only get:

35171 [CRI ADX Audio] INFO hle.sceAtrac3plus - hleAtracSetData atID=0x0, buffer=0x09DDC600, readSize=0x4000, bufferSize=0x4000, fileSize=0xF8B0C

so the external decoding is not working anymore.

I then tried a few older revisions from the build-bot but even with the oldest revision there(r3000) the results are the same.
There are three revisions between r3000 and r2984 that make changes to Atrac(r2989,r2994,r2995-according to the commit-logs), so I guess one of theese broke the external decoding for me.

I only experiencend the problem with ULUS10515(Valkyria Chrociles II). It still works as intended for ULJM05781(Senjou no Valkyria III). I guess this means that it depends on the actual encoding of the files(as far as I know they are different for thouse two games).

I guess I can work arround this by decoding using the r2984, then move the files from one temp folder to the other. But decoding is on demand only, so I would need to trigger every music in r2984 at least once. Is there a way to "force-decode" all music?

Any ideas what the original cause for this might be?

Edit: Since I didn't use atrac3plus2wav.exe and atracplug.dll before, I checked if including them would lead to a different outcone but to no avail.
External decoding still doesn't work for me(but only for ULUS10515).

Edit2: I did some more testing and also played with the settings a little.
There seems to be a common problem for both the default and the atrac3plus2wav.exe decoder:
If a file gets larger than 10,7MB(1:03Minutes), everything after that mark can't be decoded.
The default decoder just ends the file when that happens(which results in shortened music and losing the loop).
The atrac3plus2wav.exe decoder tries to go on after that mark, but only creates garbage-data(stuttering). Since the file is the correct lenght, the music loops as intended.

(This was observed using ULJM05781, both with the r2984[default decoder only] and the r3128, with and without using Hyakkis launcher)
Could this be a memory problem? Do I need different settings for the launcher?

Edit3: I tried putting the Atrac folder that was created in temp by r2984 into the temp folder in r3128 but that didn't work as well. So the music is not only not being decryted but even if there is an already decrypted file in the temp folder, it won't play.
I can't think of what else I could try to make this work.
Devs, any thoughs?

Edit4: Since I didn't get any feedback yet, I decided to checkout some of the revisions between r3000 and r2984. By now, I have it narrowed down to this: Whatever broke the decoding ability is in r2994, r2995 or r2996; r2993 still works for me and since r2994 and r2995 both mention Atrac in the commit log, I'll take a closer look at thoose two. I'll report my findings(if any) after that.

Edit5: I found the revision and respective line that broke the external decryption for me.
I can't say what exactly this line does, but I know what needs to be different for the excryption to work(for me, in the chase of ULUS10515).
What I did was this: I checked out the latest version from the repository, then looked for the file sceAtrac3plus.java in jpcsp.HLE.modules150 and there for the function protected int getRemainFrames(AtracID id, int samples). r2995(the revision that broke decryption for me) changed the line "} else if (id.getAtracCodec().getChannelLength() <=0)" to "} else if (id.getAtracCodec().getChannelLength() < 32768)". Reverting the line back to it's pre-r2995-state fixed the decoding.

gid15, do have an idea how this code might break decryption?
Reply
#2
Would it help to change the function getRemainFrames in sceAtrac3plus to the following:
Code:
protected int getRemainFrames(AtracID id, int samples) {
        int remainFrames = id.getRemainFrames();

        if (!id.getInputBuffer().isFileEnd()) {
            if (remainFrames > 0 && samples < id.getMaxSamples()) {
                // If we could not decode all the requested samples, request more data
                id.getInputBuffer().notifyReadAll();
                remainFrames = 0;
            } else if (id.getAtracCodec().getChannelLength() < 32768 && id.getAtracCurrentSample() > 0) {
                // The media engine is reading chunks of 32768 bytes from the channel.
                // If the channel contains less than one chunk, request more data,
                // but only after the first call to sceAtracDecode().
                id.getInputBuffer().notifyReadAll();
                remainFrames = 0;
            } else if (id.getAtracCodec().getChannelLength() <= 0) {
                // If the channel is empty, request more data.
                id.getInputBuffer().notifyReadAll();
                remainFrames = 0;
            }
        }

        return remainFrames;
    }
Thank you for your analysis and research Smile
Always include a complete log file at INFO level in your reports. Thanks! How to post a log
Reply
#3
I just implement the code you suggested into the r3131. And well, I already stated that I don't quite understand what the code does but external audio decoding works again, with and without atrac3plus2wav.exe. Also, the audio in ULUS10515 is decoded past that 10,7MB limit i mentioned and without any stuttering(when using atrac3plus2wav.exe).
However the audio in ULJM05781 still suffer from that stuttering effect for files bigger than 10,7MB or 1:03Minutes(when using atrac3plus2wav.exe). The audio before that mark is working as intended but as soon as the 1:03 mark of the music i reached, it stutters until then end of the file. But since this can be avoided but removing the atrac3plus2wav.exe from the lib-dir it's not really a critical problem(just a weird one).

So thank you very much for your fix gid15. Will you implement that change in a new revision, or would it be better if I make the change myself, for every new revision I use?
Reply
#4
(05-02-2013, 09:10 AM)nightflyer Wrote: I just implement the code you suggested into the r3131. And well, I already stated that I don't quite understand what the code does but external audio decoding works again, with and without atrac3plus2wav.exe. Also, the audio in ULUS10515 is decoded past that 10,7MB limit i mentioned and without any stuttering(when using atrac3plus2wav.exe).
However the audio in ULJM05781 still suffer from that stuttering effect for files bigger than 10,7MB or 1:03Minutes(when using atrac3plus2wav.exe). The audio before that mark is working as intended but as soon as the 1:03 mark of the music i reached, it stutters until then end of the file. But since this can be avoided but removing the atrac3plus2wav.exe from the lib-dir it's not really a critical problem(just a weird one).

So thank you very much for your fix gid15. Will you implement that change in a new revision, or would it be better if I make the change myself, for every new revision I use?
Thank you for the quick feedback!
I will submit the change and hope it will not break any other application Wink
Always include a complete log file at INFO level in your reports. Thanks! How to post a log
Reply
#5
(05-02-2013, 09:32 AM)gid15 Wrote:
(05-02-2013, 09:10 AM)nightflyer Wrote: I just implement the code you suggested into the r3131. And well, I already stated that I don't quite understand what the code does but external audio decoding works again, with and without atrac3plus2wav.exe. Also, the audio in ULUS10515 is decoded past that 10,7MB limit i mentioned and without any stuttering(when using atrac3plus2wav.exe).
However the audio in ULJM05781 still suffer from that stuttering effect for files bigger than 10,7MB or 1:03Minutes(when using atrac3plus2wav.exe). The audio before that mark is working as intended but as soon as the 1:03 mark of the music i reached, it stutters until then end of the file. But since this can be avoided but removing the atrac3plus2wav.exe from the lib-dir it's not really a critical problem(just a weird one).

So thank you very much for your fix gid15. Will you implement that change in a new revision, or would it be better if I make the change myself, for every new revision I use?
Thank you for the quick feedback!
I will submit the change and hope it will not break any other application Wink
Change available in r3135.
Always include a complete log file at INFO level in your reports. Thanks! How to post a log
Reply
#6
(05-02-2013, 05:16 PM)gid15 Wrote: Change available in r3135.
Is the buildbot broken? I checked and the latest rev it has available is r3129.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)