Mercurial > sdl-ios-xcode
annotate src/hermes/mmx_main.asm @ 773:da0a2ad35bf4
Date: Sun, 4 Jan 2004 23:48:19 +0100
From: Max Horn
Subject: Re: Again Audio CD patch
Am 04.01.2004 um 22:38 schrieb Sam Lantinga:
>
> Okay, I fixed the buffering problems by simply using a 4 second buffer
> instead of a 1 second buffer. However, using your code I can't play an
> entire CD - the playback stops after the first song.
>
Found the problem: FSReadFork returns eofErr when the file is finished.
However, we check its return value for errors, and if anything but
noErr occurs, the reader thread aborts its current iteration. That is
bad, because it aborts before it can ever set the flag which tells that
the file is over (also, any remaining data which FSRead did return is
lost - so you'd not hear about to 4 seconds from the end of the file.
Furthermore, the computed data size was 8 bytes to high (I forgot to
account for the fact that the size of an (A)IFF chunk always contains
the chunk header & size fields, too). This is enough to make it work.
However, the end condition is rather fragile, so I tuned some other
things to be pessimistic (check for <= 0 instead of == 0, when eofErr
is encountered enforce mReadFilePosition == mFileLength). You never
know...
The attached patch fixes the issue for me.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 05 Jan 2004 00:57:51 +0000 |
parents | 74212992fb08 |
children | da33b7e6d181 |
rev | line source |
---|---|
0 | 1 ; |
2 ; mmx format converter main loops for HERMES | |
3 ; Some routines Copyright (c) 1998 Christian Nentwich (c.nentwich@cs.ucl.ac.uk) | |
4 ; This source code is licensed under the GNU LGPL | |
5 ; | |
6 ; Please refer to the file COPYING.LIB contained in the distribution for | |
7 ; licensing conditions | |
8 ; | |
9 | |
10 BITS 32 | |
11 | |
12 GLOBAL _ConvertMMX | |
13 GLOBAL _mmxreturn | |
14 | |
15 | |
16 SECTION .text | |
17 | |
18 ;; _ConvertMMX: | |
19 ;; [ESP+8] ConverterInfo* | |
20 ;; -------------------------------------------------------------------------- | |
21 ;; ConverterInfo (ebp+..) | |
22 ;; 0: void *s_pixels | |
23 ;; 4: int s_width | |
24 ;; 8: int s_height | |
25 ;; 12: int s_add | |
26 ;; 16: void *d_pixels | |
27 ;; 20: int d_width | |
28 ;; 24: int d_height | |
29 ;; 28: int d_add | |
30 ;; 32: void (*converter_function)() | |
31 ;; 36: int32 *lookup | |
32 | |
33 _ConvertMMX: | |
34 push ebp | |
35 mov ebp,esp | |
36 | |
37 ; Save the registers used by the blitters, necessary for optimized code | |
38 pusha | |
39 | |
40 mov eax,[ebp+8] | |
41 | |
42 cmp dword [eax+4],BYTE 0 | |
43 je endconvert | |
44 | |
45 mov ebp,eax | |
46 | |
47 mov esi,[ebp+0] | |
48 mov edi,[ebp+16] | |
49 | |
50 y_loop: | |
51 mov ecx,[ebp+4] | |
52 | |
53 jmp [ebp+32] | |
54 | |
55 _mmxreturn: | |
56 add esi,[ebp+12] | |
57 add edi,[ebp+28] | |
58 | |
59 dec dword [ebp+8] | |
60 jnz y_loop | |
61 | |
62 | |
63 ; Restore the registers used by the blitters, necessary for optimized code | |
64 popa | |
65 | |
66 pop ebp | |
67 | |
68 endconvert: | |
69 emms | |
70 | |
71 ret | |
72 | |
73 | |
74 |