summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Mahone <andrew.mahone@gmail.com>2009-01-13 14:41:29 +0000
committerAndrew Mahone <andrew.mahone@gmail.com>2009-01-13 14:41:29 +0000
commit738a5643ad3248ee9fb9fc47134160681a19068c (patch)
treeb3d329d0a47431e81382e9a9f95b5adccf3811b2
parent2fbf09752d385af861279af195d68f920859202d (diff)
downloadrockbox-738a5643ad3248ee9fb9fc47134160681a19068c.tar.gz
rockbox-738a5643ad3248ee9fb9fc47134160681a19068c.zip
support pixel aspect ratio compensation in recalc_dimension, with PAR defined as 1:1 by default, and set to 4:5 for archos bitmap targets
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19759 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/recorder/resize.c20
-rw-r--r--firmware/export/config-fmrecorder.h3
-rw-r--r--firmware/export/config-ondiofm.h3
-rw-r--r--firmware/export/config-ondiosp.h3
-rw-r--r--firmware/export/config-recorder.h3
-rw-r--r--firmware/export/config-recorderv2.h3
-rw-r--r--firmware/export/config.h10
7 files changed, 38 insertions, 7 deletions
diff --git a/apps/recorder/resize.c b/apps/recorder/resize.c
index 2e6c3ff266..f9345113d6 100644
--- a/apps/recorder/resize.c
+++ b/apps/recorder/resize.c
@@ -66,24 +66,30 @@
66*/ 66*/
67int recalc_dimension(struct dim *dst, struct dim *src) 67int recalc_dimension(struct dim *dst, struct dim *src)
68{ 68{
69 /* This only looks backwards. The input image size is being pre-scaled by
70 * the inverse of the pixel aspect ratio, so that once the size it scaled
71 * to meet the output constraints, the scaled image will have appropriate
72 * proportions.
73 */
74 int sw = src->width * LCD_PIXEL_ASPECT_HEIGHT;
75 int sh = src->height * LCD_PIXEL_ASPECT_WIDTH;
69 int tmp; 76 int tmp;
70 if (dst->width <= 0) 77 if (dst->width <= 0)
71 dst->width = LCD_WIDTH; 78 dst->width = LCD_WIDTH;
72 if (dst->height <= 0) 79 if (dst->height <= 0)
73 dst->height = LCD_HEIGHT; 80 dst->height = LCD_HEIGHT;
74#ifndef HAVE_UPSCALER 81#ifndef HAVE_UPSCALER
75 if (dst->width > src->width || dst->height > src->height) 82 if (dst->width > sw || dst->height > sh)
76 { 83 {
77 dst->width = src->width; 84 dst->width = sw;
78 dst->height = src->height; 85 dst->height = sh;
79 } 86 }
80 if (src->width == dst->width && src->height == dst->height) 87 if (sw == dst->width && sh == dst->height)
81 return 1; 88 return 1;
82#endif 89#endif
83 tmp = (src->width * dst->height + (src->height >> 1)) / src->height; 90 tmp = (sw * dst->height + (sh >> 1)) / sh;
84 if (tmp > dst->width) 91 if (tmp > dst->width)
85 dst->height = (src->height * dst->width + (src->width >> 1)) 92 dst->height = (sh * dst->width + (sw >> 1)) / sw;
86 / src->width;
87 else 93 else
88 dst->width = tmp; 94 dst->width = tmp;
89 return src->width == dst->width && src->height == dst->height; 95 return src->width == dst->width && src->height == dst->height;
diff --git a/firmware/export/config-fmrecorder.h b/firmware/export/config-fmrecorder.h
index 50cee2be12..da281bd033 100644
--- a/firmware/export/config-fmrecorder.h
+++ b/firmware/export/config-fmrecorder.h
@@ -34,6 +34,9 @@
34#define LCD_HEIGHT 64 34#define LCD_HEIGHT 64
35#define LCD_DEPTH 1 35#define LCD_DEPTH 1
36 36
37#define LCD_PIXEL_ASPECT_WIDTH 4
38#define LCD_PIXEL_ASPECT_HEIGHT 5
39
37#define LCD_PIXELFORMAT VERTICAL_PACKING 40#define LCD_PIXELFORMAT VERTICAL_PACKING
38 41
39/* define this if you have a Recorder style 10-key keyboard */ 42/* define this if you have a Recorder style 10-key keyboard */
diff --git a/firmware/export/config-ondiofm.h b/firmware/export/config-ondiofm.h
index 8233728f1b..1b3b266191 100644
--- a/firmware/export/config-ondiofm.h
+++ b/firmware/export/config-ondiofm.h
@@ -24,6 +24,9 @@
24#define LCD_HEIGHT 64 24#define LCD_HEIGHT 64
25#define LCD_DEPTH 1 25#define LCD_DEPTH 1
26 26
27#define LCD_PIXEL_ASPECT_WIDTH 4
28#define LCD_PIXEL_ASPECT_HEIGHT 5
29
27#define LCD_PIXELFORMAT VERTICAL_PACKING 30#define LCD_PIXELFORMAT VERTICAL_PACKING
28 31
29/* define this if you have an Ondio style 6-key keyboard */ 32/* define this if you have an Ondio style 6-key keyboard */
diff --git a/firmware/export/config-ondiosp.h b/firmware/export/config-ondiosp.h
index 5fb7806d6a..85065f40bb 100644
--- a/firmware/export/config-ondiosp.h
+++ b/firmware/export/config-ondiosp.h
@@ -17,6 +17,9 @@
17#define LCD_HEIGHT 64 17#define LCD_HEIGHT 64
18#define LCD_DEPTH 1 18#define LCD_DEPTH 1
19 19
20#define LCD_PIXEL_ASPECT_WIDTH 4
21#define LCD_PIXEL_ASPECT_HEIGHT 5
22
20#define LCD_PIXELFORMAT VERTICAL_PACKING 23#define LCD_PIXELFORMAT VERTICAL_PACKING
21 24
22/* define this if you have an Ondio style 6-key keyboard */ 25/* define this if you have an Ondio style 6-key keyboard */
diff --git a/firmware/export/config-recorder.h b/firmware/export/config-recorder.h
index 75aa2cf789..ff74eef402 100644
--- a/firmware/export/config-recorder.h
+++ b/firmware/export/config-recorder.h
@@ -34,6 +34,9 @@
34#define LCD_HEIGHT 64 34#define LCD_HEIGHT 64
35#define LCD_DEPTH 1 35#define LCD_DEPTH 1
36 36
37#define LCD_PIXEL_ASPECT_WIDTH 4
38#define LCD_PIXEL_ASPECT_HEIGHT 5
39
37#define LCD_PIXELFORMAT VERTICAL_PACKING 40#define LCD_PIXELFORMAT VERTICAL_PACKING
38 41
39/* define this if you have the Recorder's 10-key keyboard */ 42/* define this if you have the Recorder's 10-key keyboard */
diff --git a/firmware/export/config-recorderv2.h b/firmware/export/config-recorderv2.h
index 3244f19f1d..4e77e3d4ed 100644
--- a/firmware/export/config-recorderv2.h
+++ b/firmware/export/config-recorderv2.h
@@ -34,6 +34,9 @@
34#define LCD_HEIGHT 64 34#define LCD_HEIGHT 64
35#define LCD_DEPTH 1 35#define LCD_DEPTH 1
36 36
37#define LCD_PIXEL_ASPECT_WIDTH 4
38#define LCD_PIXEL_ASPECT_HEIGHT 5
39
37#define LCD_PIXELFORMAT VERTICAL_PACKING 40#define LCD_PIXELFORMAT VERTICAL_PACKING
38 41
39/* define this if you have a Recorder style 10-key keyboard */ 42/* define this if you have a Recorder style 10-key keyboard */
diff --git a/firmware/export/config.h b/firmware/export/config.h
index 9bc6c7c775..15b137588e 100644
--- a/firmware/export/config.h
+++ b/firmware/export/config.h
@@ -379,6 +379,16 @@
379#endif 379#endif
380#endif 380#endif
381 381
382/* Pixel aspect ratio is defined in terms of a multiplier for pixel width and
383 * height, and is set to 1:1 if the target does not set a value
384 */
385#ifndef LCD_PIXEL_ASPECT_HEIGHT
386#define LCD_PIXEL_ASPECT_HEIGHT 1
387#endif
388#ifndef LCD_PIXEL_ASPECT_WIDTH
389#define LCD_PIXEL_ASPECT_WIDTH 1
390#endif
391
382/* define this in the target config.h to use a different size */ 392/* define this in the target config.h to use a different size */
383#ifndef CONFIG_DEFAULT_ICON_HEIGHT 393#ifndef CONFIG_DEFAULT_ICON_HEIGHT
384#define CONFIG_DEFAULT_ICON_HEIGHT 8 394#define CONFIG_DEFAULT_ICON_HEIGHT 8