Mercurial > sdl-ios-xcode
annotate src/video/ps3/spulibs/yuv2rgb_converter.c @ 3144:0d8d1f870964 gsoc2009_ps3
Moved SPE-functions to SDL_ps3spe.c.
Added ActivateRenderer() and PS3_QueryTexturePixels().
Added yuv2rgb_spu but not yet in use.
author | Martin Lowinski <martin@goldtopf.org> |
---|---|
date | Wed, 10 Jun 2009 09:15:33 +0000 |
parents | |
children |
rev | line source |
---|---|
3144
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
1 /* |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
2 * SDL - Simple DirectMedia Layer |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
3 * CELL BE Support for PS3 Framebuffer |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
4 * Copyright (C) 2008, 2009 International Business Machines Corporation |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
5 * |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
6 * This library is free software; you can redistribute it and/or modify it |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
7 * under the terms of the GNU Lesser General Public License as published |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
8 * by the Free Software Foundation; either version 2.1 of the License, or |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
9 * (at your option) any later version. |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
10 * |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
11 * This library is distributed in the hope that it will be useful, but |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
12 * WITHOUT ANY WARRANTY; without even the implied warranty of |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
14 * Lesser General Public License for more details. |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
15 * |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
16 * You should have received a copy of the GNU Lesser General Public |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
17 * License along with this library; if not, write to the Free Software |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
19 * USA |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
20 * |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
21 * Martin Lowinski <lowinski [at] de [dot] ibm [ibm] com> |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
22 * Dirk Herrendoerfer <d.herrendoerfer [at] de [dot] ibm [dot] com> |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
23 * SPE code based on research by: |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
24 * Rene Becker |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
25 * Thimo Emmerich |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
26 */ |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
27 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
28 #include "spu_common.h" |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
29 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
30 #include <spu_intrinsics.h> |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
31 #include <spu_mfcio.h> |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
32 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
33 // Debugging |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
34 //#define DEBUG |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
35 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
36 #ifdef DEBUG |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
37 #define deprintf(fmt, args... ) \ |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
38 fprintf( stdout, fmt, ##args ); \ |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
39 fflush( stdout ); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
40 #else |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
41 #define deprintf( fmt, args... ) |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
42 #endif |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
43 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
44 struct yuv2rgb_parms_t parms_converter __attribute__((aligned(128))); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
45 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
46 /* A maximum of 8 lines Y, therefore 4 lines V, 4 lines U are stored |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
47 * there might be the need to retrieve misaligned data, adjust |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
48 * incoming v and u plane to be able to handle this (add 128) |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
49 */ |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
50 unsigned char y_plane[2][(MAX_HDTV_WIDTH + 128) * 4] __attribute__((aligned(128))); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
51 unsigned char v_plane[2][(MAX_HDTV_WIDTH + 128) * 2] __attribute__((aligned(128))); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
52 unsigned char u_plane[2][(MAX_HDTV_WIDTH + 128) * 2] __attribute__((aligned(128))); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
53 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
54 /* A maximum of 4 lines BGRA are stored, 4 byte per pixel */ |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
55 unsigned char bgra[4 * MAX_HDTV_WIDTH * 4] __attribute__((aligned(128))); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
56 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
57 /* some vectors needed by the float to int conversion */ |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
58 static const vector float vec_255 = { 255.0f, 255.0f, 255.0f, 255.0f }; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
59 static const vector float vec_0_1 = { 0.1f, 0.1f, 0.1f, 0.1f }; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
60 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
61 void yuv_to_rgb_w16(); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
62 void yuv_to_rgb_w32(); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
63 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
64 void yuv_to_rgb_w16_line(unsigned char* y_addr, unsigned char* v_addr, unsigned char* u_addr, unsigned char* bgra_addr, unsigned int width); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
65 void yuv_to_rgb_w32_line(unsigned char* y_addr, unsigned char* v_addr, unsigned char* u_addr, unsigned char* bgra_addr_, unsigned int width); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
66 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
67 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
68 int main(unsigned long long spe_id __attribute__((unused)), unsigned long long argp __attribute__ ((unused))) |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
69 { |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
70 deprintf("[SPU] yuv2rgb_spu is up... (on SPE #%llu)\n", spe_id); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
71 uint32_t ea_mfc, mbox; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
72 // send ready message |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
73 spu_write_out_mbox(SPU_READY); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
74 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
75 while (1) { |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
76 /* Check mailbox */ |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
77 mbox = spu_read_in_mbox(); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
78 deprintf("[SPU] Message is %u\n", mbox); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
79 switch (mbox) { |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
80 case SPU_EXIT: |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
81 deprintf("[SPU] fb_writer goes down...\n"); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
82 return 0; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
83 case SPU_START: |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
84 break; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
85 default: |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
86 deprintf("[SPU] Cannot handle message\n"); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
87 continue; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
88 } |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
89 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
90 /* Tag Manager setup */ |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
91 unsigned int tag_id; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
92 tag_id = mfc_multi_tag_reserve(1); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
93 if (tag_id == MFC_TAG_INVALID) { |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
94 deprintf("[SPU] Failed to reserve mfc tags on yuv2rgb_converter\n"); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
95 return 0; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
96 } |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
97 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
98 /* DMA transfer for the input parameters */ |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
99 ea_mfc = spu_read_in_mbox(); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
100 deprintf("[SPU] Message on yuv2rgb_converter is %u\n", ea_mfc); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
101 spu_mfcdma32(&parms_converter, (unsigned int)ea_mfc, sizeof(struct yuv2rgb_parms_t), tag_id, MFC_GET_CMD); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
102 DMA_WAIT_TAG(tag_id); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
103 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
104 /* There are alignment issues that involve handling of special cases |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
105 * a width of 32 results in a width of 16 in the chrominance |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
106 * --> choose the proper handling to optimize the performance |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
107 */ |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
108 deprintf("[SPU] Convert %ix%i from YUV to RGB\n", parms_converter.src_pixel_width, parms_converter.src_pixel_height); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
109 if (parms_converter.src_pixel_width & 0x1f) { |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
110 deprintf("[SPU] Using yuv_to_rgb_w16\n"); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
111 yuv_to_rgb_w16(); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
112 } else { |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
113 deprintf("[SPU] Using yuv_to_rgb_w32\n"); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
114 yuv_to_rgb_w32(); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
115 } |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
116 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
117 mfc_multi_tag_release(tag_id, 1); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
118 deprintf("[SPU] yuv2rgb_spu... done!\n"); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
119 /* Send FIN message */ |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
120 spu_write_out_mbox(SPU_FIN); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
121 } |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
122 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
123 return 0; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
124 } |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
125 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
126 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
127 /* |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
128 * float_to_char() |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
129 * |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
130 * converts a float to a character using saturated |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
131 * arithmetic |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
132 * |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
133 * @param s float for conversion |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
134 * @returns converted character |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
135 */ |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
136 inline static unsigned char float_to_char(float s) { |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
137 vector float vec_s = spu_splats(s); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
138 vector unsigned int select_1 = spu_cmpgt(vec_0_1, vec_s); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
139 vec_s = spu_sel(vec_s, vec_0_1, select_1); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
140 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
141 vector unsigned int select_2 = spu_cmpgt(vec_s, vec_255); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
142 vec_s = spu_sel(vec_s, vec_255, select_2); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
143 return (unsigned char) spu_extract(vec_s,0); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
144 } |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
145 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
146 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
147 /* |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
148 * vfloat_to_vuint() |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
149 * |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
150 * converts a float vector to an unsinged int vector using saturated |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
151 * arithmetic |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
152 * |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
153 * @param vec_s float vector for conversion |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
154 * @returns converted unsigned int vector |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
155 */ |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
156 inline static vector unsigned int vfloat_to_vuint(vector float vec_s) { |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
157 vector unsigned int select_1 = spu_cmpgt(vec_0_1, vec_s); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
158 vec_s = spu_sel(vec_s, vec_0_1, select_1); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
159 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
160 vector unsigned int select_2 = spu_cmpgt(vec_s, vec_255); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
161 vec_s = spu_sel(vec_s, vec_255, select_2); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
162 return spu_convtu(vec_s,0); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
163 } |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
164 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
165 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
166 void yuv_to_rgb_w16() { |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
167 // Pixel dimensions of the picture |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
168 uint32_t width, height; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
169 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
170 // Extract parameters |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
171 width = parms_converter.src_pixel_width; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
172 height = parms_converter.src_pixel_height; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
173 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
174 // Plane data management |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
175 // Y |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
176 unsigned char* ram_addr_y = parms_converter.y_plane; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
177 // V |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
178 unsigned char* ram_addr_v = parms_converter.v_plane; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
179 // U |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
180 unsigned char* ram_addr_u = parms_converter.u_plane; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
181 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
182 // BGRA |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
183 unsigned char* ram_addr_bgra = parms_converter.dstBuffer; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
184 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
185 // Strides |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
186 unsigned int stride_y = width; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
187 unsigned int stride_vu = width>>1; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
188 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
189 // Buffer management |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
190 unsigned int buf_idx = 0; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
191 unsigned int size_4lines_y = stride_y<<2; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
192 unsigned int size_2lines_y = stride_y<<1; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
193 unsigned int size_2lines_vu = stride_vu<<1; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
194 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
195 // 2*width*4byte_per_pixel |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
196 unsigned int size_2lines_bgra = width<<3; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
197 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
198 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
199 // start double-buffered processing |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
200 // 4 lines y |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
201 spu_mfcdma32(y_plane[buf_idx], (unsigned int) ram_addr_y, size_4lines_y, RETR_BUF+buf_idx, MFC_GET_CMD); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
202 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
203 // 2 lines v |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
204 spu_mfcdma32(v_plane[buf_idx], (unsigned int) ram_addr_v, size_2lines_vu, RETR_BUF+buf_idx, MFC_GET_CMD); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
205 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
206 // 2 lines u |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
207 spu_mfcdma32(u_plane[buf_idx], (unsigned int) ram_addr_u, size_2lines_vu, RETR_BUF+buf_idx, MFC_GET_CMD); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
208 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
209 // Wait for these transfers to be completed |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
210 DMA_WAIT_TAG((RETR_BUF + buf_idx)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
211 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
212 unsigned int i; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
213 for(i=0; i<(height>>2)-1; i++) { |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
214 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
215 buf_idx^=1; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
216 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
217 // 4 lines y |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
218 spu_mfcdma32(y_plane[buf_idx], (unsigned int) ram_addr_y+size_4lines_y, size_4lines_y, RETR_BUF+buf_idx, MFC_GET_CMD); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
219 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
220 // 2 lines v |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
221 spu_mfcdma32(v_plane[buf_idx], (unsigned int) ram_addr_v+size_2lines_vu, size_2lines_vu, RETR_BUF+buf_idx, MFC_GET_CMD); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
222 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
223 // 2 lines u |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
224 spu_mfcdma32(u_plane[buf_idx], (unsigned int) ram_addr_u+size_2lines_vu, size_2lines_vu, RETR_BUF+buf_idx, MFC_GET_CMD); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
225 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
226 DMA_WAIT_TAG((RETR_BUF + buf_idx)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
227 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
228 buf_idx^=1; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
229 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
230 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
231 // Convert YUV to BGRA, store it back (first two lines) |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
232 yuv_to_rgb_w16_line(y_plane[buf_idx], v_plane[buf_idx], u_plane[buf_idx], bgra, width); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
233 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
234 // Next two lines |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
235 yuv_to_rgb_w16_line(y_plane[buf_idx] + size_2lines_y, |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
236 v_plane[buf_idx] + stride_vu, |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
237 u_plane[buf_idx] + stride_vu, |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
238 bgra + size_2lines_bgra, |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
239 width); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
240 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
241 // Wait for previous storing transfer to be completed |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
242 DMA_WAIT_TAG(STR_BUF); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
243 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
244 // Store converted lines in two steps->max transfer size 16384 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
245 spu_mfcdma32(bgra, (unsigned int) ram_addr_bgra, size_2lines_bgra, STR_BUF, MFC_PUT_CMD); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
246 ram_addr_bgra += size_2lines_bgra; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
247 spu_mfcdma32(bgra+size_2lines_bgra, (unsigned int) ram_addr_bgra, size_2lines_bgra, STR_BUF, MFC_PUT_CMD); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
248 ram_addr_bgra += size_2lines_bgra; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
249 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
250 // Move 4 lines |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
251 ram_addr_y += size_4lines_y; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
252 ram_addr_v += size_2lines_vu; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
253 ram_addr_u += size_2lines_vu; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
254 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
255 buf_idx^=1; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
256 } |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
257 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
258 // Convert YUV to BGRA, store it back (first two lines) |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
259 yuv_to_rgb_w16_line(y_plane[buf_idx], v_plane[buf_idx], u_plane[buf_idx], bgra, width); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
260 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
261 // Next two lines |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
262 yuv_to_rgb_w16_line(y_plane[buf_idx] + size_2lines_y, |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
263 v_plane[buf_idx] + stride_vu, |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
264 u_plane[buf_idx] + stride_vu, |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
265 bgra + size_2lines_bgra, |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
266 width); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
267 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
268 // Wait for previous storing transfer to be completed |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
269 DMA_WAIT_TAG(STR_BUF); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
270 spu_mfcdma32(bgra, (unsigned int) ram_addr_bgra, size_2lines_bgra, STR_BUF, MFC_PUT_CMD); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
271 ram_addr_bgra += size_2lines_bgra; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
272 spu_mfcdma32(bgra+size_2lines_bgra, (unsigned int) ram_addr_bgra, size_2lines_bgra, STR_BUF, MFC_PUT_CMD); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
273 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
274 // wait for previous storing transfer to be completed |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
275 DMA_WAIT_TAG(STR_BUF); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
276 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
277 } |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
278 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
279 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
280 void yuv_to_rgb_w32() { |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
281 // Pixel dimensions of the picture |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
282 uint32_t width, height; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
283 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
284 // Extract parameters |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
285 width = parms_converter.src_pixel_width; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
286 height = parms_converter.src_pixel_height; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
287 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
288 // Plane data management |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
289 // Y |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
290 unsigned char* ram_addr_y = parms_converter.y_plane; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
291 // V |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
292 unsigned char* ram_addr_v = parms_converter.v_plane; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
293 // U |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
294 unsigned char* ram_addr_u = parms_converter.u_plane; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
295 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
296 // BGRA |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
297 unsigned char* ram_addr_bgra = parms_converter.dstBuffer; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
298 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
299 // Strides |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
300 unsigned int stride_y = width; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
301 unsigned int stride_vu = width>>1; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
302 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
303 // Buffer management |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
304 unsigned int buf_idx = 0; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
305 unsigned int size_4lines_y = stride_y<<2; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
306 unsigned int size_2lines_y = stride_y<<1; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
307 unsigned int size_2lines_vu = stride_vu<<1; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
308 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
309 // 2*width*4byte_per_pixel |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
310 unsigned int size_2lines_bgra = width<<3; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
311 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
312 // start double-buffered processing |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
313 // 4 lines y |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
314 spu_mfcdma32(y_plane[buf_idx], (unsigned int) ram_addr_y, size_4lines_y, RETR_BUF + buf_idx, MFC_GET_CMD); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
315 // 2 lines v |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
316 spu_mfcdma32(v_plane[buf_idx], (unsigned int) ram_addr_v, size_2lines_vu, RETR_BUF + buf_idx, MFC_GET_CMD); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
317 // 2 lines u |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
318 spu_mfcdma32(u_plane[buf_idx], (unsigned int) ram_addr_u, size_2lines_vu, RETR_BUF + buf_idx, MFC_GET_CMD); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
319 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
320 // Wait for these transfers to be completed |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
321 DMA_WAIT_TAG((RETR_BUF + buf_idx)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
322 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
323 unsigned int i; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
324 for(i=0; i < (height>>2)-1; i++) { |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
325 buf_idx^=1; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
326 // 4 lines y |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
327 spu_mfcdma32(y_plane[buf_idx], (unsigned int) ram_addr_y+size_4lines_y, size_4lines_y, RETR_BUF + buf_idx, MFC_GET_CMD); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
328 deprintf("4lines = %d\n", size_4lines_y); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
329 // 2 lines v |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
330 spu_mfcdma32(v_plane[buf_idx], (unsigned int) ram_addr_v+size_2lines_vu, size_2lines_vu, RETR_BUF + buf_idx, MFC_GET_CMD); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
331 deprintf("2lines = %d\n", size_2lines_vu); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
332 // 2 lines u |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
333 spu_mfcdma32(u_plane[buf_idx], (unsigned int) ram_addr_u+size_2lines_vu, size_2lines_vu, RETR_BUF + buf_idx, MFC_GET_CMD); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
334 deprintf("2lines = %d\n", size_2lines_vu); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
335 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
336 DMA_WAIT_TAG((RETR_BUF + buf_idx)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
337 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
338 buf_idx^=1; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
339 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
340 // Convert YUV to BGRA, store it back (first two lines) |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
341 yuv_to_rgb_w32_line(y_plane[buf_idx], v_plane[buf_idx], u_plane[buf_idx], bgra, width); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
342 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
343 // Next two lines |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
344 yuv_to_rgb_w32_line(y_plane[buf_idx] + size_2lines_y, |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
345 v_plane[buf_idx] + stride_vu, |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
346 u_plane[buf_idx] + stride_vu, |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
347 bgra + size_2lines_bgra, |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
348 width); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
349 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
350 // Wait for previous storing transfer to be completed |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
351 DMA_WAIT_TAG(STR_BUF); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
352 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
353 // Store converted lines in two steps->max transfer size 16384 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
354 spu_mfcdma32(bgra, (unsigned int)ram_addr_bgra, size_2lines_bgra, STR_BUF, MFC_PUT_CMD); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
355 ram_addr_bgra += size_2lines_bgra; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
356 spu_mfcdma32(bgra + size_2lines_bgra, (unsigned int)ram_addr_bgra, size_2lines_bgra, STR_BUF, MFC_PUT_CMD); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
357 ram_addr_bgra += size_2lines_bgra; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
358 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
359 // Move 4 lines |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
360 ram_addr_y += size_4lines_y; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
361 ram_addr_v += size_2lines_vu; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
362 ram_addr_u += size_2lines_vu; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
363 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
364 buf_idx^=1; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
365 } |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
366 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
367 // Convert YUV to BGRA, store it back (first two lines) |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
368 yuv_to_rgb_w32_line(y_plane[buf_idx], v_plane[buf_idx], u_plane[buf_idx], bgra, width); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
369 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
370 // Next two lines |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
371 yuv_to_rgb_w32_line(y_plane[buf_idx] + size_2lines_y, |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
372 v_plane[buf_idx] + stride_vu, |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
373 u_plane[buf_idx] + stride_vu, |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
374 bgra + size_2lines_bgra, |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
375 width); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
376 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
377 // Wait for previous storing transfer to be completed |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
378 DMA_WAIT_TAG(STR_BUF); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
379 spu_mfcdma32(bgra, (unsigned int) ram_addr_bgra, size_2lines_bgra, STR_BUF, MFC_PUT_CMD); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
380 ram_addr_bgra += size_2lines_bgra; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
381 spu_mfcdma32(bgra + size_2lines_bgra, (unsigned int) ram_addr_bgra, size_2lines_bgra, STR_BUF, MFC_PUT_CMD); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
382 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
383 // Wait for previous storing transfer to be completed |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
384 DMA_WAIT_TAG(STR_BUF); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
385 } |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
386 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
387 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
388 /* Some vectors needed by the yuv 2 rgb conversion algorithm */ |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
389 const vector float vec_minus_128 = { -128.0f, -128.0f, -128.0f, -128.0f }; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
390 const vector unsigned char vec_null = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
391 const vector unsigned char vec_char2int_first = { 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x13 }; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
392 const vector unsigned char vec_char2int_second = { 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x17 }; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
393 const vector unsigned char vec_char2int_third = { 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x1A, 0x00, 0x00, 0x00, 0x1B }; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
394 const vector unsigned char vec_char2int_fourth = { 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x1D, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x1F }; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
395 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
396 const vector float vec_R_precalc_coeff = {1.403f, 1.403f, 1.403f, 1.403f}; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
397 const vector float vec_Gu_precalc_coeff = {-0.344f, -0.344f, -0.344f, -0.344f}; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
398 const vector float vec_Gv_precalc_coeff = {-0.714f, -0.714f, -0.714f, -0.714f}; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
399 const vector float vec_B_precalc_coeff = {1.773f, 1.773f, 1.773f, 1.773f}; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
400 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
401 const vector unsigned int vec_alpha = { 255 << 24, 255 << 24, 255 << 24, 255 << 24 }; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
402 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
403 const vector unsigned char vec_select_floats_upper = { 0x00, 0x01, 0x02, 0x03, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x04, 0x05, 0x06, 0x07 }; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
404 const vector unsigned char vec_select_floats_lower = { 0x08, 0x09, 0x0A, 0x0B, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x0C, 0x0D, 0x0E, 0x0F }; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
405 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
406 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
407 /* |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
408 * yuv_to_rgb_w16() |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
409 * |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
410 * processes to line of yuv-input, width has to be a multiple of 16 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
411 * two lines of yuv are taken as input |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
412 * |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
413 * @param y_addr address of the y plane in local store |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
414 * @param v_addr address of the v plane in local store |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
415 * @param u_addr address of the u plane in local store |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
416 * @param bgra_addr_ address of the bgra output buffer |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
417 * @param width the width in pixel |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
418 */ |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
419 void yuv_to_rgb_w16_line(unsigned char* y_addr, unsigned char* v_addr, unsigned char* u_addr, unsigned char* bgra_addr_, unsigned int width) { |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
420 // each pixel is stored as an integer |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
421 unsigned int* bgra_addr = (unsigned int*) bgra_addr_; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
422 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
423 unsigned int x; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
424 for(x = 0; x < width; x+=2) { |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
425 // Gehe zweischrittig durch die zeile, da jeder u und v wert fuer 4 pixel(zwei hoch, zwei breit) gilt |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
426 const unsigned char Y_1 = *(y_addr + x); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
427 const unsigned char Y_2 = *(y_addr + x + 1); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
428 const unsigned char Y_3 = *(y_addr + x + width); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
429 const unsigned char Y_4 = *(y_addr + x + width + 1); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
430 const unsigned char U = *(u_addr + (x >> 1)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
431 const unsigned char V = *(v_addr + (x >> 1)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
432 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
433 float V_minus_128 = (float)((float)V - 128.0f); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
434 float U_minus_128 = (float)((float)U - 128.0f); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
435 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
436 float R_precalculate = 1.403f * V_minus_128; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
437 float G_precalculate = -(0.344f * U_minus_128 + 0.714f * V_minus_128); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
438 float B_precalculate = 1.773f * U_minus_128; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
439 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
440 const unsigned char R_1 = float_to_char((Y_1 + R_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
441 const unsigned char R_2 = float_to_char((Y_2 + R_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
442 const unsigned char R_3 = float_to_char((Y_3 + R_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
443 const unsigned char R_4 = float_to_char((Y_4 + R_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
444 const unsigned char G_1 = float_to_char((Y_1 + G_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
445 const unsigned char G_2 = float_to_char((Y_2 + G_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
446 const unsigned char G_3 = float_to_char((Y_3 + G_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
447 const unsigned char G_4 = float_to_char((Y_4 + G_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
448 const unsigned char B_1 = float_to_char((Y_1 + B_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
449 const unsigned char B_2 = float_to_char((Y_2 + B_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
450 const unsigned char B_3 = float_to_char((Y_3 + B_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
451 const unsigned char B_4 = float_to_char((Y_4 + B_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
452 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
453 *(bgra_addr + x) = (B_1 << 0)| (G_1 << 8) | (R_1 << 16) | (255 << 24); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
454 *(bgra_addr + x + 1) = (B_2 << 0)| (G_2 << 8) | (R_2 << 16) | (255 << 24); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
455 *(bgra_addr + x + width) = (B_3 << 0)| (G_3 << 8) | (R_3 << 16) | (255 << 24); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
456 *(bgra_addr + x + width + 1) = (B_4 << 0)| (G_4 << 8) | (R_4 << 16) | (255 << 24); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
457 } |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
458 } |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
459 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
460 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
461 /* |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
462 * yuv_to_rgb_w32() |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
463 * |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
464 * processes to line of yuv-input, width has to be a multiple of 32 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
465 * two lines of yuv are taken as input |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
466 * |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
467 * @param y_addr address of the y plane in local store |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
468 * @param v_addr address of the v plane in local store |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
469 * @param u_addr address of the u plane in local store |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
470 * @param bgra_addr_ address of the bgra output buffer |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
471 * @param width the width in pixel |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
472 */ |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
473 void yuv_to_rgb_w32_line(unsigned char* y_addr, unsigned char* v_addr, unsigned char* u_addr, unsigned char* bgra_addr_, unsigned int width) { |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
474 // each pixel is stored as an integer |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
475 unsigned int* bgra_addr = (unsigned int*) bgra_addr_; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
476 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
477 unsigned int x; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
478 for(x = 0; x < width; x+=32) { |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
479 // Gehe zweischrittig durch die zeile, da jeder u und v wert fuer 4 pixel(zwei hoch, zwei breit) gilt |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
480 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
481 const vector unsigned char vchar_Y_1 = *((vector unsigned char*)(y_addr + x)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
482 const vector unsigned char vchar_Y_2 = *((vector unsigned char*)(y_addr + x + 16)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
483 const vector unsigned char vchar_Y_3 = *((vector unsigned char*)(y_addr + x + width)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
484 const vector unsigned char vchar_Y_4 = *((vector unsigned char*)(y_addr + x + width + 16)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
485 const vector unsigned char vchar_U = *((vector unsigned char*)(u_addr + (x >> 1))); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
486 const vector unsigned char vchar_V = *((vector unsigned char*)(v_addr + (x >> 1))); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
487 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
488 const vector float vfloat_U_1 = spu_add(spu_convtf((vector unsigned int)spu_shuffle(vec_null, vchar_U, vec_char2int_first), 0),vec_minus_128); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
489 const vector float vfloat_U_2 = spu_add(spu_convtf((vector unsigned int)spu_shuffle(vec_null, vchar_U, vec_char2int_second), 0),vec_minus_128); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
490 const vector float vfloat_U_3 = spu_add(spu_convtf((vector unsigned int)spu_shuffle(vec_null, vchar_U, vec_char2int_third), 0),vec_minus_128); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
491 const vector float vfloat_U_4 = spu_add(spu_convtf((vector unsigned int)spu_shuffle(vec_null, vchar_U, vec_char2int_fourth), 0),vec_minus_128); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
492 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
493 const vector float vfloat_V_1 = spu_add(spu_convtf((vector unsigned int)spu_shuffle(vec_null, vchar_V, vec_char2int_first), 0),vec_minus_128); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
494 const vector float vfloat_V_2 = spu_add(spu_convtf((vector unsigned int)spu_shuffle(vec_null, vchar_V, vec_char2int_second), 0),vec_minus_128); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
495 const vector float vfloat_V_3 = spu_add(spu_convtf((vector unsigned int)spu_shuffle(vec_null, vchar_V, vec_char2int_third), 0),vec_minus_128); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
496 const vector float vfloat_V_4 = spu_add(spu_convtf((vector unsigned int)spu_shuffle(vec_null, vchar_V, vec_char2int_fourth), 0),vec_minus_128); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
497 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
498 vector float Y_1 = spu_convtf((vector unsigned int)spu_shuffle(vec_null, vchar_Y_1, vec_char2int_first), 0); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
499 vector float Y_2 = spu_convtf((vector unsigned int)spu_shuffle(vec_null, vchar_Y_1, vec_char2int_second), 0); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
500 vector float Y_3 = spu_convtf((vector unsigned int)spu_shuffle(vec_null, vchar_Y_1, vec_char2int_third), 0); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
501 vector float Y_4 = spu_convtf((vector unsigned int)spu_shuffle(vec_null, vchar_Y_1, vec_char2int_fourth), 0); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
502 vector float Y_5 = spu_convtf((vector unsigned int)spu_shuffle(vec_null, vchar_Y_2, vec_char2int_first), 0); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
503 vector float Y_6 = spu_convtf((vector unsigned int)spu_shuffle(vec_null, vchar_Y_2, vec_char2int_second), 0); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
504 vector float Y_7 = spu_convtf((vector unsigned int)spu_shuffle(vec_null, vchar_Y_2, vec_char2int_third), 0); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
505 vector float Y_8 = spu_convtf((vector unsigned int)spu_shuffle(vec_null, vchar_Y_2, vec_char2int_fourth), 0); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
506 vector float Y_9 = spu_convtf((vector unsigned int)spu_shuffle(vec_null, vchar_Y_3, vec_char2int_first), 0); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
507 vector float Y_10 = spu_convtf((vector unsigned int)spu_shuffle(vec_null, vchar_Y_3, vec_char2int_second), 0); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
508 vector float Y_11 = spu_convtf((vector unsigned int)spu_shuffle(vec_null, vchar_Y_3, vec_char2int_third), 0); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
509 vector float Y_12 = spu_convtf((vector unsigned int)spu_shuffle(vec_null, vchar_Y_3, vec_char2int_fourth), 0); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
510 vector float Y_13 = spu_convtf((vector unsigned int)spu_shuffle(vec_null, vchar_Y_4, vec_char2int_first), 0); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
511 vector float Y_14 = spu_convtf((vector unsigned int)spu_shuffle(vec_null, vchar_Y_4, vec_char2int_second), 0); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
512 vector float Y_15 = spu_convtf((vector unsigned int)spu_shuffle(vec_null, vchar_Y_4, vec_char2int_third), 0); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
513 vector float Y_16 = spu_convtf((vector unsigned int)spu_shuffle(vec_null, vchar_Y_4, vec_char2int_fourth), 0); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
514 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
515 const vector float R1a_precalculate = spu_mul(vec_R_precalc_coeff, vfloat_V_1); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
516 const vector float R2a_precalculate = spu_mul(vec_R_precalc_coeff, vfloat_V_2); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
517 const vector float R3a_precalculate = spu_mul(vec_R_precalc_coeff, vfloat_V_3); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
518 const vector float R4a_precalculate = spu_mul(vec_R_precalc_coeff, vfloat_V_4); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
519 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
520 const vector float R1_precalculate = spu_shuffle(R1a_precalculate, R1a_precalculate, vec_select_floats_upper); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
521 const vector float R2_precalculate = spu_shuffle(R1a_precalculate, R1a_precalculate, vec_select_floats_lower); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
522 const vector float R3_precalculate = spu_shuffle(R2a_precalculate, R2a_precalculate, vec_select_floats_upper); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
523 const vector float R4_precalculate = spu_shuffle(R2a_precalculate, R2a_precalculate, vec_select_floats_lower); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
524 const vector float R5_precalculate = spu_shuffle(R3a_precalculate, R3a_precalculate, vec_select_floats_upper); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
525 const vector float R6_precalculate = spu_shuffle(R3a_precalculate, R3a_precalculate, vec_select_floats_lower); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
526 const vector float R7_precalculate = spu_shuffle(R4a_precalculate, R4a_precalculate, vec_select_floats_upper); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
527 const vector float R8_precalculate = spu_shuffle(R4a_precalculate, R4a_precalculate, vec_select_floats_lower); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
528 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
529 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
530 const vector float G1a_precalculate = spu_madd(vec_Gu_precalc_coeff, vfloat_U_1, spu_mul(vfloat_V_1, vec_Gv_precalc_coeff)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
531 const vector float G2a_precalculate = spu_madd(vec_Gu_precalc_coeff, vfloat_U_2, spu_mul(vfloat_V_2, vec_Gv_precalc_coeff)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
532 const vector float G3a_precalculate = spu_madd(vec_Gu_precalc_coeff, vfloat_U_3, spu_mul(vfloat_V_3, vec_Gv_precalc_coeff)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
533 const vector float G4a_precalculate = spu_madd(vec_Gu_precalc_coeff, vfloat_U_4, spu_mul(vfloat_V_4, vec_Gv_precalc_coeff)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
534 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
535 const vector float G1_precalculate = spu_shuffle(G1a_precalculate, G1a_precalculate, vec_select_floats_upper); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
536 const vector float G2_precalculate = spu_shuffle(G1a_precalculate, G1a_precalculate, vec_select_floats_lower); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
537 const vector float G3_precalculate = spu_shuffle(G2a_precalculate, G2a_precalculate, vec_select_floats_upper); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
538 const vector float G4_precalculate = spu_shuffle(G2a_precalculate, G2a_precalculate, vec_select_floats_lower); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
539 const vector float G5_precalculate = spu_shuffle(G3a_precalculate, G3a_precalculate, vec_select_floats_upper); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
540 const vector float G6_precalculate = spu_shuffle(G3a_precalculate, G3a_precalculate, vec_select_floats_lower); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
541 const vector float G7_precalculate = spu_shuffle(G4a_precalculate, G4a_precalculate, vec_select_floats_upper); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
542 const vector float G8_precalculate = spu_shuffle(G4a_precalculate, G4a_precalculate, vec_select_floats_lower); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
543 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
544 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
545 const vector float B1a_precalculate = spu_mul(vec_B_precalc_coeff, vfloat_U_1); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
546 const vector float B2a_precalculate = spu_mul(vec_B_precalc_coeff, vfloat_U_2); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
547 const vector float B3a_precalculate = spu_mul(vec_B_precalc_coeff, vfloat_U_3); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
548 const vector float B4a_precalculate = spu_mul(vec_B_precalc_coeff, vfloat_U_4); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
549 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
550 const vector float B1_precalculate = spu_shuffle(B1a_precalculate, B1a_precalculate, vec_select_floats_upper); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
551 const vector float B2_precalculate = spu_shuffle(B1a_precalculate, B1a_precalculate, vec_select_floats_lower); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
552 const vector float B3_precalculate = spu_shuffle(B2a_precalculate, B2a_precalculate, vec_select_floats_upper); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
553 const vector float B4_precalculate = spu_shuffle(B2a_precalculate, B2a_precalculate, vec_select_floats_lower); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
554 const vector float B5_precalculate = spu_shuffle(B3a_precalculate, B3a_precalculate, vec_select_floats_upper); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
555 const vector float B6_precalculate = spu_shuffle(B3a_precalculate, B3a_precalculate, vec_select_floats_lower); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
556 const vector float B7_precalculate = spu_shuffle(B4a_precalculate, B4a_precalculate, vec_select_floats_upper); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
557 const vector float B8_precalculate = spu_shuffle(B4a_precalculate, B4a_precalculate, vec_select_floats_lower); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
558 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
559 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
560 const vector unsigned int R_1 = vfloat_to_vuint(spu_add( Y_1, R1_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
561 const vector unsigned int R_2 = vfloat_to_vuint(spu_add( Y_2, R2_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
562 const vector unsigned int R_3 = vfloat_to_vuint(spu_add( Y_3, R3_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
563 const vector unsigned int R_4 = vfloat_to_vuint(spu_add( Y_4, R4_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
564 const vector unsigned int R_5 = vfloat_to_vuint(spu_add( Y_5, R5_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
565 const vector unsigned int R_6 = vfloat_to_vuint(spu_add( Y_6, R6_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
566 const vector unsigned int R_7 = vfloat_to_vuint(spu_add( Y_7, R7_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
567 const vector unsigned int R_8 = vfloat_to_vuint(spu_add( Y_8, R8_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
568 const vector unsigned int R_9 = vfloat_to_vuint(spu_add( Y_9, R1_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
569 const vector unsigned int R_10 = vfloat_to_vuint(spu_add(Y_10, R2_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
570 const vector unsigned int R_11 = vfloat_to_vuint(spu_add(Y_11, R3_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
571 const vector unsigned int R_12 = vfloat_to_vuint(spu_add(Y_12, R4_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
572 const vector unsigned int R_13 = vfloat_to_vuint(spu_add(Y_13, R5_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
573 const vector unsigned int R_14 = vfloat_to_vuint(spu_add(Y_14, R6_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
574 const vector unsigned int R_15 = vfloat_to_vuint(spu_add(Y_15, R7_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
575 const vector unsigned int R_16 = vfloat_to_vuint(spu_add(Y_16, R8_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
576 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
577 const vector unsigned int G_1 = vfloat_to_vuint(spu_add( Y_1, G1_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
578 const vector unsigned int G_2 = vfloat_to_vuint(spu_add( Y_2, G2_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
579 const vector unsigned int G_3 = vfloat_to_vuint(spu_add( Y_3, G3_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
580 const vector unsigned int G_4 = vfloat_to_vuint(spu_add( Y_4, G4_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
581 const vector unsigned int G_5 = vfloat_to_vuint(spu_add( Y_5, G5_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
582 const vector unsigned int G_6 = vfloat_to_vuint(spu_add( Y_6, G6_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
583 const vector unsigned int G_7 = vfloat_to_vuint(spu_add( Y_7, G7_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
584 const vector unsigned int G_8 = vfloat_to_vuint(spu_add( Y_8, G8_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
585 const vector unsigned int G_9 = vfloat_to_vuint(spu_add( Y_9, G1_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
586 const vector unsigned int G_10 = vfloat_to_vuint(spu_add(Y_10, G2_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
587 const vector unsigned int G_11 = vfloat_to_vuint(spu_add(Y_11, G3_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
588 const vector unsigned int G_12 = vfloat_to_vuint(spu_add(Y_12, G4_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
589 const vector unsigned int G_13 = vfloat_to_vuint(spu_add(Y_13, G5_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
590 const vector unsigned int G_14 = vfloat_to_vuint(spu_add(Y_14, G6_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
591 const vector unsigned int G_15 = vfloat_to_vuint(spu_add(Y_15, G7_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
592 const vector unsigned int G_16 = vfloat_to_vuint(spu_add(Y_16, G8_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
593 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
594 const vector unsigned int B_1 = vfloat_to_vuint(spu_add( Y_1, B1_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
595 const vector unsigned int B_2 = vfloat_to_vuint(spu_add( Y_2, B2_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
596 const vector unsigned int B_3 = vfloat_to_vuint(spu_add( Y_3, B3_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
597 const vector unsigned int B_4 = vfloat_to_vuint(spu_add( Y_4, B4_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
598 const vector unsigned int B_5 = vfloat_to_vuint(spu_add( Y_5, B5_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
599 const vector unsigned int B_6 = vfloat_to_vuint(spu_add( Y_6, B6_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
600 const vector unsigned int B_7 = vfloat_to_vuint(spu_add( Y_7, B7_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
601 const vector unsigned int B_8 = vfloat_to_vuint(spu_add( Y_8, B8_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
602 const vector unsigned int B_9 = vfloat_to_vuint(spu_add( Y_9, B1_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
603 const vector unsigned int B_10 = vfloat_to_vuint(spu_add(Y_10, B2_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
604 const vector unsigned int B_11 = vfloat_to_vuint(spu_add(Y_11, B3_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
605 const vector unsigned int B_12 = vfloat_to_vuint(spu_add(Y_12, B4_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
606 const vector unsigned int B_13 = vfloat_to_vuint(spu_add(Y_13, B5_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
607 const vector unsigned int B_14 = vfloat_to_vuint(spu_add(Y_14, B6_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
608 const vector unsigned int B_15 = vfloat_to_vuint(spu_add(Y_15, B7_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
609 const vector unsigned int B_16 = vfloat_to_vuint(spu_add(Y_16, B8_precalculate)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
610 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
611 *((vector unsigned int*)(bgra_addr + x)) = spu_or(spu_or(vec_alpha, B_1), spu_or(spu_slqwbyte( R_1, 2),spu_slqwbyte(G_1, 1))); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
612 *((vector unsigned int*)(bgra_addr + x + 4)) = spu_or(spu_or(vec_alpha, B_2), spu_or(spu_slqwbyte( R_2, 2),spu_slqwbyte(G_2, 1))); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
613 *((vector unsigned int*)(bgra_addr + x + 8)) = spu_or(spu_or(vec_alpha, B_3), spu_or(spu_slqwbyte( R_3, 2),spu_slqwbyte(G_3, 1))); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
614 *((vector unsigned int*)(bgra_addr + x + 12)) = spu_or(spu_or(vec_alpha, B_4), spu_or(spu_slqwbyte( R_4, 2),spu_slqwbyte(G_4, 1))); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
615 *((vector unsigned int*)(bgra_addr + x + 16)) = spu_or(spu_or(vec_alpha, B_5), spu_or(spu_slqwbyte( R_5, 2),spu_slqwbyte(G_5, 1))); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
616 *((vector unsigned int*)(bgra_addr + x + 20)) = spu_or(spu_or(vec_alpha, B_6), spu_or(spu_slqwbyte( R_6, 2),spu_slqwbyte(G_6, 1))); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
617 *((vector unsigned int*)(bgra_addr + x + 24)) = spu_or(spu_or(vec_alpha, B_7), spu_or(spu_slqwbyte( R_7, 2),spu_slqwbyte(G_7, 1))); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
618 *((vector unsigned int*)(bgra_addr + x + 28)) = spu_or(spu_or(vec_alpha, B_8), spu_or(spu_slqwbyte( R_8, 2),spu_slqwbyte(G_8, 1))); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
619 *((vector unsigned int*)(bgra_addr + x + width)) = spu_or(spu_or(vec_alpha, B_9), spu_or(spu_slqwbyte( R_9, 2),spu_slqwbyte(G_9, 1))); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
620 *((vector unsigned int*)(bgra_addr + x + width + 4)) = spu_or(spu_or(vec_alpha, B_10), spu_or(spu_slqwbyte(R_10, 2),spu_slqwbyte(G_10, 1))); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
621 *((vector unsigned int*)(bgra_addr + x + width + 8)) = spu_or(spu_or(vec_alpha, B_11), spu_or(spu_slqwbyte(R_11, 2),spu_slqwbyte(G_11, 1))); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
622 *((vector unsigned int*)(bgra_addr + x + width + 12)) = spu_or(spu_or(vec_alpha, B_12), spu_or(spu_slqwbyte(R_12, 2),spu_slqwbyte(G_12, 1))); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
623 *((vector unsigned int*)(bgra_addr + x + width + 16)) = spu_or(spu_or(vec_alpha, B_13), spu_or(spu_slqwbyte(R_13, 2),spu_slqwbyte(G_13, 1))); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
624 *((vector unsigned int*)(bgra_addr + x + width + 20)) = spu_or(spu_or(vec_alpha, B_14), spu_or(spu_slqwbyte(R_14, 2),spu_slqwbyte(G_14, 1))); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
625 *((vector unsigned int*)(bgra_addr + x + width + 24)) = spu_or(spu_or(vec_alpha, B_15), spu_or(spu_slqwbyte(R_15, 2),spu_slqwbyte(G_15, 1))); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
626 *((vector unsigned int*)(bgra_addr + x + width + 28)) = spu_or(spu_or(vec_alpha, B_16), spu_or(spu_slqwbyte(R_16, 2),spu_slqwbyte(G_16, 1))); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
627 } |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
628 } |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
629 |