Diffstat (limited to 'noncore/multimedia/opieplayer2/yuv2rgb_arm.c') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/yuv2rgb_arm.c | 174 |
1 files changed, 174 insertions, 0 deletions
diff --git a/noncore/multimedia/opieplayer2/yuv2rgb_arm.c b/noncore/multimedia/opieplayer2/yuv2rgb_arm.c new file mode 100644 index 0000000..699ee48 --- a/dev/null +++ b/noncore/multimedia/opieplayer2/yuv2rgb_arm.c | |||
@@ -0,0 +1,174 @@ | |||
1 | /* | ||
2 | * yuv2rgb_arm.c | ||
3 | * Copyright (C) 2000-2001 Project OPIE. | ||
4 | * All Rights Reserved. | ||
5 | * | ||
6 | * Author: Robert Griebl <sandman@handhelds.org> | ||
7 | * | ||
8 | * This file is part of OpiePlayer2. | ||
9 | * | ||
10 | * OpiePlayer2 is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License as published by | ||
12 | * the Free Software Foundation; either version 2 of the License, or | ||
13 | * (at your option) any later version. | ||
14 | * | ||
15 | * OpiePlayer2 is distributed in the hope that it will be useful, | ||
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
18 | * GNU General Public License for more details. | ||
19 | * | ||
20 | * You should have received a copy of the GNU General Public License | ||
21 | * along with this program; if not, write to the Free Software | ||
22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
23 | */ | ||
24 | |||
25 | #ifdef __arm__ | ||
26 | |||
27 | #include <stdio.h> | ||
28 | #include <stdlib.h> | ||
29 | #include <string.h> | ||
30 | #include <inttypes.h> | ||
31 | |||
32 | #include "yuv2rgb.h" | ||
33 | #include <xine/xineutils.h> | ||
34 | |||
35 | #define RGB(i) \ | ||
36 | U = pu[i]; \ | ||
37 | V = pv[i]; \ | ||
38 | r = this->table_rV[V]; \ | ||
39 | g = (void *) (((uint8_t *)this->table_gU[U]) + this->table_gV[V]);\ | ||
40 | b = this->table_bU[U]; | ||
41 | |||
42 | #define DST1(i) \ | ||
43 | Y = py_1[2*i]; \ | ||
44 | dst_1[2*i] = r[Y] + g[Y] + b[Y];\ | ||
45 | Y = py_1[2*i+1]; \ | ||
46 | dst_1[2*i+1] = r[Y] + g[Y] + b[Y]; | ||
47 | |||
48 | |||
49 | struct dummy { | ||
50 | uint8_t *yuv [3]; | ||
51 | int stride [3]; | ||
52 | }; | ||
53 | |||
54 | extern void convert_yuv420_rgb565(struct dummy *picture, unsigned char *results, int w, int h) ; | ||
55 | |||
56 | |||
57 | static void arm_rgb16 (yuv2rgb_t *this, uint8_t * _dst, | ||
58 | uint8_t * _py, uint8_t * _pu, uint8_t * _pv) | ||
59 | { | ||
60 | if ( !this-> do_scale ) { | ||
61 | struct dummy d; | ||
62 | d. yuv [0] = _py; | ||
63 | d. yuv [1] = _pu; | ||
64 | d. yuv [2] = _pv; | ||
65 | d. stride [0] = this-> y_stride; | ||
66 | d. stride [1] = d. stride [2] = this-> uv_stride; | ||
67 | |||
68 | // printf( "calling arm (%dx%d)\n", this-> dest_width, this-> dest_height ); | ||
69 | |||
70 | convert_yuv420_rgb565 ( &d, _dst, this->dest_width, this->dest_height ); | ||
71 | |||
72 | // printf ( "arm done\n" ); | ||
73 | } | ||
74 | else { | ||
75 | int U, V, Y; | ||
76 | uint8_t * py_1, * py_2, * pu, * pv; | ||
77 | uint16_t * r, * g, * b; | ||
78 | uint16_t * dst_1, * dst_2; | ||
79 | int width, height, dst_height; | ||
80 | int dy; | ||
81 | |||
82 | scale_line_func_t scale_line = this->scale_line; | ||
83 | |||
84 | scale_line (_pu, this->u_buffer, | ||
85 | this->dest_width >> 1, this->step_dx); | ||
86 | scale_line (_pv, this->v_buffer, | ||
87 | this->dest_width >> 1, this->step_dx); | ||
88 | scale_line (_py, this->y_buffer, | ||
89 | this->dest_width, this->step_dx); | ||
90 | |||
91 | dy = 0; | ||
92 | dst_height = this->dest_height; | ||
93 | |||
94 | for (height = 0;; ) { | ||
95 | dst_1 = (uint16_t*)_dst; | ||
96 | py_1 = this->y_buffer; | ||
97 | pu = this->u_buffer; | ||
98 | pv = this->v_buffer; | ||
99 | |||
100 | width = this->dest_width >> 3; | ||
101 | |||
102 | do { | ||
103 | RGB(0); | ||
104 | DST1(0); | ||
105 | |||
106 | RGB(1); | ||
107 | DST1(1); | ||
108 | |||
109 | RGB(2); | ||
110 | DST1(2); | ||
111 | |||
112 | RGB(3); | ||
113 | DST1(3); | ||
114 | |||
115 | pu += 4; | ||
116 | pv += 4; | ||
117 | py_1 += 8; | ||
118 | dst_1 += 8; | ||
119 | } while (--width); | ||
120 | |||
121 | dy += this->step_dy; | ||
122 | _dst += this->rgb_stride; | ||
123 | |||
124 | while (--dst_height > 0 && dy < 32768) { | ||
125 | |||
126 | xine_fast_memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width*2); | ||
127 | |||
128 | dy += this->step_dy; | ||
129 | _dst += this->rgb_stride; | ||
130 | } | ||
131 | |||
132 | if (dst_height <= 0) | ||
133 | break; | ||
134 | |||
135 | do { | ||
136 | dy -= 32768; | ||
137 | _py += this->y_stride; | ||
138 | |||
139 | scale_line (_py, this->y_buffer, | ||
140 | this->dest_width, this->step_dx); | ||
141 | |||
142 | if (height & 1) { | ||
143 | _pu += this->uv_stride; | ||
144 | _pv += this->uv_stride; | ||
145 | |||
146 | scale_line (_pu, this->u_buffer, | ||
147 | this->dest_width >> 1, this->step_dx); | ||
148 | scale_line (_pv, this->v_buffer, | ||
149 | this->dest_width >> 1, this->step_dx); | ||
150 | |||
151 | } | ||
152 | height++; | ||
153 | } while( dy>=32768); | ||
154 | } | ||
155 | } | ||
156 | } | ||
157 | |||
158 | |||
159 | |||
160 | void yuv2rgb_init_arm (yuv2rgb_factory_t *this) { | ||
161 | |||
162 | if (this->swapped) | ||
163 | return; /*no swapped pixel output upto now*/ | ||
164 | |||
165 | switch (this->mode) { | ||
166 | case MODE_16_RGB: | ||
167 | this->yuv2rgb_fun = arm_rgb16; | ||
168 | break; | ||
169 | } | ||
170 | } | ||
171 | |||
172 | |||
173 | |||
174 | #endif | ||