summaryrefslogtreecommitdiff
path: root/firmware/target/arm/philips/hdd6330/lcd-hdd6330.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/philips/hdd6330/lcd-hdd6330.c')
-rw-r--r--firmware/target/arm/philips/hdd6330/lcd-hdd6330.c98
1 files changed, 0 insertions, 98 deletions
diff --git a/firmware/target/arm/philips/hdd6330/lcd-hdd6330.c b/firmware/target/arm/philips/hdd6330/lcd-hdd6330.c
index cdd3064bba..9d2fdc8519 100644
--- a/firmware/target/arm/philips/hdd6330/lcd-hdd6330.c
+++ b/firmware/target/arm/philips/hdd6330/lcd-hdd6330.c
@@ -37,9 +37,6 @@
37/* whether the lcd is currently enabled or not */ 37/* whether the lcd is currently enabled or not */
38static bool lcd_enabled; 38static bool lcd_enabled;
39 39
40/* Display status */
41static unsigned lcd_yuv_options SHAREDBSS_ATTR = 0;
42
43/* Value used for flipping. Must be remembered when display is turned off. */ 40/* Value used for flipping. Must be remembered when display is turned off. */
44static unsigned short flip; 41static unsigned short flip;
45 42
@@ -147,101 +144,6 @@ void lcd_set_flip(bool yesno)
147 lcd_send_data(0x08 | flip); 144 lcd_send_data(0x08 | flip);
148} 145}
149 146
150void lcd_yuv_set_options(unsigned options)
151{
152 lcd_yuv_options = options;
153}
154
155#define CSUB_X 2
156#define CSUB_Y 2
157
158/* YUV- > RGB565 conversion
159 * |R| |1.000000 -0.000001 1.402000| |Y'|
160 * |G| = |1.000000 -0.334136 -0.714136| |Pb|
161 * |B| |1.000000 1.772000 0.000000| |Pr|
162 * Scaled, normalized, rounded and tweaked to yield RGB 565:
163 * |R| |74 0 101| |Y' - 16| >> 9
164 * |G| = |74 -24 -51| |Cb - 128| >> 8
165 * |B| |74 128 0| |Cr - 128| >> 9
166*/
167
168extern void lcd_yuv_write_inner_loop(unsigned char const * const ysrc,
169 unsigned char const * const usrc,
170 unsigned char const * const vsrc,
171 int width);
172
173/* Performance function to blit a YUV bitmap directly to the LCD */
174void lcd_blit_yuv(unsigned char * const src[3],
175 int src_x, int src_y, int stride,
176 int x, int y, int width, int height)
177{
178 int h;
179
180 width = (width + 1) & ~1;
181
182 lcd_send_reg(LCD_REG_HORIZ_ADDR_START);
183 lcd_send_data(y);
184
185 lcd_send_reg(LCD_REG_HORIZ_ADDR_END);
186 lcd_send_data(y + height - 1);
187
188 lcd_send_reg(LCD_REG_VERT_ADDR_START);
189 lcd_send_data(x + x_offset);
190
191 lcd_send_reg(LCD_REG_VERT_ADDR_END);
192 lcd_send_data(x + width - 1 + x_offset);
193
194 lcd_send_reg(LCD_REG_WRITE_DATA_2_GRAM);
195
196 const int stride_div_csub_x = stride/CSUB_X;
197
198 h=0;
199 while (1)
200 {
201 /* upsampling, YUV->RGB conversion and reduction to RGB565 in one go */
202 const unsigned char *ysrc = src[0] + stride * src_y + src_x;
203
204 const int uvoffset = stride_div_csub_x * (src_y/CSUB_Y) +
205 (src_x/CSUB_X);
206
207 const unsigned char *usrc = src[1] + uvoffset;
208 const unsigned char *vsrc = src[2] + uvoffset;
209
210 int pixels_to_write;
211
212 if (h==0)
213 {
214 while (!(LCD2_BLOCK_CTRL & LCD2_BLOCK_READY));
215 LCD2_BLOCK_CONFIG = 0;
216
217 if (height == 0) break;
218
219 pixels_to_write = (width * height) * 2;
220 h = height;
221
222 /* calculate how much we can do in one go */
223 if (pixels_to_write > 0x10000)
224 {
225 h = (0x10000/2) / width;
226 pixels_to_write = (width * h) * 2;
227 }
228
229 height -= h;
230 LCD2_BLOCK_CTRL = 0x10000080;
231 LCD2_BLOCK_CONFIG = 0xc0010000 | (pixels_to_write - 1);
232 LCD2_BLOCK_CTRL = 0x34000000;
233 }
234
235 lcd_yuv_write_inner_loop(ysrc,usrc,vsrc,width);
236
237 src_y++;
238 h--;
239 }
240
241 while (!(LCD2_BLOCK_CTRL & LCD2_BLOCK_READY));
242 LCD2_BLOCK_CONFIG = 0;
243}
244
245/* Update the display. 147/* Update the display.
246 This must be called after all other LCD functions that change the display. */ 148 This must be called after all other LCD functions that change the display. */
247void lcd_update(void) 149void lcd_update(void)