/[pcsx2_0.9.7]/trunk/pcsx2/Mdec.h
ViewVC logotype

Contents of /trunk/pcsx2/Mdec.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 31 - (show annotations) (download)
Tue Sep 7 03:24:11 2010 UTC (10 years, 2 months ago) by william
File MIME type: text/plain
File size: 2972 byte(s)
committing r3113 initial commit again...
1 /* Pcsx2 - Pc Ps2 Emulator
2 * Copyright (C) 2002-2008 Pcsx2 Team
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
17 */
18
19 #ifndef __MDEC_H__
20 #define __MDEC_H__
21
22
23 // mdec status:
24 #define MDEC_BUSY 0x20000000
25 #define MDEC_DREQ 0x18000000
26 #define MDEC_FIFO 0xc0000000
27 #define MDEC_RGB24 0x02000000
28 #define MDEC_STP 0x00800000
29
30
31 #define CONST_BITS 8
32 #define PASS1_BITS 2
33 #define CONST_BITS14 14
34 #define IFAST_SCALE_BITS 2
35
36 #define FIX_1_082392200 (277)
37 #define FIX_1_414213562 (362)
38 #define FIX_1_847759065 (473)
39 #define FIX_2_613125930 (669)
40
41 #define MULTIPLY(var,const) (DESCALE((var) * (const), CONST_BITS))
42
43 #define DEQUANTIZE(coef,quantval) (coef)
44
45 #define DESCALE(x,n) ((x)>>(n))
46 #define RANGE(n) (n)
47
48 #define DCTSIZE 8
49 #define DCTSIZE2 64
50
51 #define RUNOF(a) ((a)>>10)
52 #define VALOF(a) (((int)(a)<<(32-10))>>(32-10))
53 #define NOP 0xfe00
54
55 #define FIXED
56
57 #ifdef FIXED
58 #define MULR(a) ((((int)0x0000059B) * (a)) >> 10)
59 #define MULG(a) ((((int)0xFFFFFEA1) * (a)) >> 10)
60 #define MULG2(a) ((((int)0xFFFFFD25) * (a)) >> 10)
61 #define MULB(a) ((((int)0x00000716) * (a)) >> 10)
62 #else
63 #define MULR(a) ((int)((float)1.40200 * (a)))
64 #define MULG(a) ((int)((float)-0.3437 * (a)))
65 #define MULG2(a) ((int)((float)-0.7143 * (a)))
66 #define MULB(a) ((int)((float)1.77200 * (a)))
67 #endif
68
69 #define MAKERGB15(r,g,b) ( (((r)>>3)<<10)|(((g)>>3)<<5)|((b)>>3) )
70 #define ROUND(c) roundtbl[((c)+128+256)]//&0x3ff]
71
72 #define RGB15(n, Y) \
73 image[n] = MAKERGB15(ROUND(Y + R),ROUND(Y + G),ROUND(Y + B));
74
75 #define RGB15BW(n, Y) \
76 image[n] = MAKERGB15(ROUND(Y),ROUND(Y),ROUND(Y));
77
78 #define RGB24(n, Y) \
79 image[n+2] = ROUND(Y + R); \
80 image[n+1] = ROUND(Y + G); \
81 image[n+0] = ROUND(Y + B);
82
83 #define RGB24BW(n, Y) \
84 image[n+2] = ROUND(Y); \
85 image[n+1] = ROUND(Y); \
86 image[n+0] = ROUND(Y);
87
88 void mdecInit();
89 void mdecWrite0(u32 data);
90 void mdecWrite1(u32 data);
91 u32 mdecRead0();
92 u32 mdecRead1();
93 void psxDma0(u32 madr, u32 bcr, u32 chcr);
94 void psxDma1(u32 madr, u32 bcr, u32 chcr);
95 int mdecFreeze(gzFile f, int Mode);
96
97 u16* rl2blk(int *blk,u16 *mdec_rl);
98 void iqtab_init(int *iqtab,unsigned char *iq_y);
99 void round_init(void);
100 void yuv2rgb24(int *blk,unsigned char *image);
101 void yuv2rgb15(int *blk,u16 *image);
102
103 struct {
104 u32 command;
105 u32 status;
106 u16 *rl;
107 int rlsize;
108 } mdec;
109
110 #endif /* __MDEC_H__ */

  ViewVC Help
Powered by ViewVC 1.1.22