diff mbox series

[FFmpeg-devel,1/4] avcodec/adpcm_psx: always fetch next byte irregardless of flag

Message ID 20210503113157.2215-1-zane@zanevaniperen.com
State Accepted
Commit a845e6daa9aba4cbed024de8cbefccaa6c40f4bb
Headers show
Series [FFmpeg-devel,1/4] avcodec/adpcm_psx: always fetch next byte irregardless of flag | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Zane van Iperen May 3, 2021, 11:31 a.m. UTC
Even though all samples are meant to be zero (if flag == 0x07),
doesn't mean that they aren't there. See No$PSX docs [1].

[1]: https://problemkaputt.de/psx-spx.htm#spuadpcmsamples

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
---
 libavcodec/adpcm.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

Comments

Zane van Iperen May 7, 2021, 11:17 a.m. UTC | #1
On 3/5/21 9:31 pm, Zane van Iperen wrote:
> Even though all samples are meant to be zero (if flag == 0x07),
> doesn't mean that they aren't there. See No$PSX docs [1].
> 
> [1]: https://problemkaputt.de/psx-spx.htm#spuadpcmsamples
> 

Ping on this patchset.
Zane van Iperen May 10, 2021, 1:56 p.m. UTC | #2
On 7/5/21 9:17 pm, Zane van Iperen wrote:
> 
> 
> On 3/5/21 9:31 pm, Zane van Iperen wrote:
>> Even though all samples are meant to be zero (if flag == 0x07),
>> doesn't mean that they aren't there. See No$PSX docs [1].
>>
>> [1]: https://problemkaputt.de/psx-spx.htm#spuadpcmsamples
>>
> 
> Ping on this patchset.

Ping 2, will apply in a few days if no objections.
diff mbox series

Patch

diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index 3da6b734cf..8c07f3673d 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -1990,14 +1990,14 @@  static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
                     for (n = 0; n < 28; n++) {
                         int sample = 0, scale;
 
-                        if (flag < 0x07) {
-                            if (n & 1) {
-                                scale = sign_extend(byte >> 4, 4);
-                            } else {
-                                byte  = bytestream2_get_byteu(&gb);
-                                scale = sign_extend(byte, 4);
-                            }
+                        if (n & 1) {
+                            scale = sign_extend(byte >> 4, 4);
+                        } else {
+                            byte  = bytestream2_get_byteu(&gb);
+                            scale = sign_extend(byte, 4);
+                        }
 
+                        if (flag < 0x07) {
                             scale  = scale * (1 << 12);
                             sample = (int)((scale >> shift) + (c->status[channel].sample1 * xa_adpcm_table[filter][0] + c->status[channel].sample2 * xa_adpcm_table[filter][1]) / 64);
                         }