summaryrefslogtreecommitdiff
path: root/firmware/target/arm
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm')
-rw-r--r--firmware/target/arm/lcd-as-memframe.S46
-rw-r--r--firmware/target/arm/tcc780x/cowond2/lcd-cowond2.c87
2 files changed, 44 insertions, 89 deletions
diff --git a/firmware/target/arm/lcd-as-memframe.S b/firmware/target/arm/lcd-as-memframe.S
index 1cd27bdf28..519a8a1615 100644
--- a/firmware/target/arm/lcd-as-memframe.S
+++ b/firmware/target/arm/lcd-as-memframe.S
@@ -189,7 +189,10 @@ lcd_write_yuv420_lines:
@
orr r1, r1, r7, lsl #5 @ r4 |= (g << 5)
orr r1, r1, r11, lsl #11 @ r4 = b | (r << 11)
-#if LCD_WIDTH < 256
+
+#if LCD_WIDTH >= LCD_HEIGHT
+ strh r1, [r0] @
+#elif LCD_WIDTH < 256
strh r1, [r0], #LCD_WIDTH @ store pixel
#else
strh r1, [r0] @
@@ -222,7 +225,12 @@ lcd_write_yuv420_lines:
@
orr r1, r1, r11, lsl #11 @ r1 = b | (r << 11)
orr r1, r1, r7, lsl #5 @ r1 |= (g << 5)
-#if LCD_WIDTH < 256
+
+#if LCD_WIDTH >= LCD_HEIGHT
+ add r0, r0, #2*LCD_WIDTH @
+ strh r1, [r0] @ store pixel
+ sub r0, r0, #2*LCD_WIDTH @
+#elif LCD_WIDTH < 256
strh r1, [r0, #-LCD_WIDTH-2] @ store pixel
#else
strh r1, [r0, #-2] @
@@ -256,7 +264,10 @@ lcd_write_yuv420_lines:
@
orr r1, r1, r7, lsl #5 @ r1 = b | (g << 5)
orr r1, r1, r11, lsl #11 @ r1 |= (r << 11)
-#if LCD_WIDTH < 256
+
+#if LCD_WIDTH >= LCD_HEIGHT
+ strh r1, [r0, #2]
+#elif LCD_WIDTH < 256
strh r1, [r0, #LCD_WIDTH]! @ store pixel
#else
strh r1, [r0] @
@@ -287,12 +298,19 @@ lcd_write_yuv420_lines:
@
orr r12, r1, r11, lsl #11 @ r12 = b | (r << 11)
orr r12, r12, r7, lsl #5 @ r12 |= (g << 5)
+
+#if LCD_WIDTH >= LCD_HEIGHT
+ add r0, r0, #2*LCD_WIDTH
+ strh r12, [r0, #2]
+ sub r0, r0, #(2*LCD_WIDTH)-4
+#else
strh r12, [r0, #-2] @ store pixel
#if LCD_WIDTH < 256
add r0, r0, #2*LCD_WIDTH @
#else
add r0, r0, #LCD_WIDTH @
#endif
+#endif
@
subs r2, r2, #2 @ subtract block from width
bgt 10b @ loop line @
@@ -423,7 +441,9 @@ lcd_write_yuv420_lines_odither:
orr r11, r11, r7, lsr #4 @ ((g & 0x7e00) >> 4) |
orr r1, r11, r1, lsr #10 @ (b >> 10)
@
-#if LCD_WIDTH < 256
+#if LCD_WIDTH >= LCD_HEIGHT
+ strh r1, [r0] @
+#elif LCD_WIDTH < 256
strh r1, [r0], #LCD_WIDTH @ store pixel
#else
strh r1, [r0] @
@@ -473,7 +493,11 @@ lcd_write_yuv420_lines_odither:
orr r11, r11, r7, lsr #4 @ ((g & 0x7e00) >> 4) |
orr r1, r11, r1, lsr #10 @ (b >> 10)
@
-#if LCD_WIDTH < 256
+#if LCD_WIDTH >= LCD_HEIGHT
+ add r0, r0, #2*LCD_WIDTH @
+ strh r1, [r0] @ store pixel
+ sub r0, r0, #2*LCD_WIDTH @
+#elif LCD_WIDTH < 256
strh r1, [r0, #-LCD_WIDTH-2] @ store pixel
#else
strh r1, [r0, #-2] @ store pixel
@@ -526,12 +550,14 @@ lcd_write_yuv420_lines_odither:
orr r11, r11, r7, lsr #4 @ ((g & 0x7e00) >> 4) |
orr r1, r11, r1, lsr #10 @ (b >> 10)
@
-#if LCD_WIDTH < 256
+#if LCD_WIDTH >= LCD_HEIGHT
+ strh r1, [r0, #2]
+#elif LCD_WIDTH < 256
strh r1, [r0, #LCD_WIDTH]! @ store pixel
#else
strh r1, [r0] @
#endif
- @
+
sub r7, r12, #16 @ r7 = Y = (Y' - 16)*149
add r12, r7, r7, asl #2 @
add r12, r12, r12, asl #4 @
@@ -574,12 +600,18 @@ lcd_write_yuv420_lines_odither:
orr r11, r11, r7, lsr #4 @ ((g & 0x7e00) >> 4) |
orr r1, r11, r1, lsr #10 @ (b >> 10)
@
+#if LCD_WIDTH >= LCD_HEIGHT
+ add r0, r0, #2*LCD_WIDTH
+ strh r1, [r0, #2] @ store pixel
+ sub r0, r0, #(2*LCD_WIDTH-4)
+#else
strh r1, [r0, #-2] @ store pixel
#if LCD_WIDTH < 256
add r0, r0, #2*LCD_WIDTH @
#else
add r0, r0, #LCD_WIDTH @
#endif
+#endif
@
subs r2, r2, #2 @ subtract block from width
bgt 10b @ loop line @
diff --git a/firmware/target/arm/tcc780x/cowond2/lcd-cowond2.c b/firmware/target/arm/tcc780x/cowond2/lcd-cowond2.c
index 48ae99ddcd..70d823a25b 100644
--- a/firmware/target/arm/tcc780x/cowond2/lcd-cowond2.c
+++ b/firmware/target/arm/tcc780x/cowond2/lcd-cowond2.c
@@ -359,88 +359,11 @@ void lcd_yuv_set_options(unsigned options)
}
/* Line write helper function for lcd_yuv_blit. Write two lines of yuv420. */
-static void lcd_write_yuv420_lines(fb_data *dst,
- unsigned char const * const src[3],
- int width,
- int stride)
-{
- int i = 0;
- int y;
- int rv, guv, bu;
- int cb, cr;
- int r, g, b;
- unsigned const char *y_p = src[0];
-
- for (i = 0; i < width/2; i++)
- {
- y_p++;
-
- /* YCbCr -> RGB conversion */
- cb = src[1][i] - 128;
- cr = src[2][i] - 128;
-
- rv = (cr*101 + 56) >> 9;
- guv = (128 - cr*51 + cb*24) >> 8;
- bu = (cb*128 + 256) >> 9;
-
- y = (*y_p - 16)*74;
- r = (y >> 9) + rv;
- g = (y >> 8) + guv;
- b = (y >> 9) + bu;
- if (r < 0) r = 0;
- else if (r > 31) r = 31;
- if (g < 0) g = 0;
- else if (g > 63) g = 63;
- if (b < 0) b = 0;
- else if (b > 31) b = 31;
-
- dst[i*2] = (r << 11) | (g << 5) | b;
-
- /* YCbCr -> RGB conversion */
- y = (*(y_p+stride) - 16)*74;
- r = (y >> 9) + rv;
- g = (y >> 8) + guv;
- b = (y >> 9) + bu;
- if (r < 0) r = 0;
- else if (r > 31) r = 31;
- if (g < 0) g = 0;
- else if (g > 63) g = 63;
- if (b < 0) b = 0;
- else if (b > 31) b = 31;
-
- dst[i*2+LCD_FBWIDTH] = (r << 11) | (g << 5) | b;
-
- y_p++;
-
- /* YCbCr -> RGB conversion */
- y = (*y_p - 16)*74;
- r = (y >> 9) + rv;
- g = (y >> 8) + guv;
- b = (y >> 9) + bu;
- if (r < 0) r = 0;
- else if (r > 31) r = 31;
- if (g < 0) g = 0;
- else if (g > 63) g = 63;
- if (b < 0) b = 0;
- else if (b > 31) b = 31;
-
- dst[i*2+1] = (r << 11) | (g << 5) | b;
-
- /* YCbCr -> RGB conversion */
- y = (*(y_p+stride) - 16)*74;
- r = (y >> 9) + rv;
- g = (y >> 8) + guv;
- b = (y >> 9) + bu;
- if (r < 0) r = 0;
- else if (r > 31) r = 31;
- if (g < 0) g = 0;
- else if (g > 63) g = 63;
- if (b < 0) b = 0;
- else if (b > 31) b = 31;
-
- dst[i*2+1+LCD_FBWIDTH] = (r << 11) | (g << 5) | b;
- }
-}
+extern void lcd_write_yuv420_lines(fb_data *dst,
+ unsigned char const * const src[3],
+ int width,
+ int stride);
+
extern void lcd_write_yuv420_lines_odither(fb_data *dst,
unsigned char const * const src[3],
int width,