diff options
author | Andrew Mahone <andrew.mahone@gmail.com> | 2009-01-13 14:41:29 +0000 |
---|---|---|
committer | Andrew Mahone <andrew.mahone@gmail.com> | 2009-01-13 14:41:29 +0000 |
commit | 738a5643ad3248ee9fb9fc47134160681a19068c (patch) | |
tree | b3d329d0a47431e81382e9a9f95b5adccf3811b2 | |
parent | 2fbf09752d385af861279af195d68f920859202d (diff) |
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.c | 20 | ||||
-rw-r--r-- | firmware/export/config-fmrecorder.h | 3 | ||||
-rw-r--r-- | firmware/export/config-ondiofm.h | 3 | ||||
-rw-r--r-- | firmware/export/config-ondiosp.h | 3 | ||||
-rw-r--r-- | firmware/export/config-recorder.h | 3 | ||||
-rw-r--r-- | firmware/export/config-recorderv2.h | 3 | ||||
-rw-r--r-- | firmware/export/config.h | 10 |
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 @@ */ int recalc_dimension(struct dim *dst, struct dim *src) { + /* This only looks backwards. The input image size is being pre-scaled by + * the inverse of the pixel aspect ratio, so that once the size it scaled + * to meet the output constraints, the scaled image will have appropriate + * proportions. + */ + int sw = src->width * LCD_PIXEL_ASPECT_HEIGHT; + int sh = src->height * LCD_PIXEL_ASPECT_WIDTH; int tmp; if (dst->width <= 0) dst->width = LCD_WIDTH; if (dst->height <= 0) dst->height = LCD_HEIGHT; #ifndef HAVE_UPSCALER - if (dst->width > src->width || dst->height > src->height) + if (dst->width > sw || dst->height > sh) { - dst->width = src->width; - dst->height = src->height; + dst->width = sw; + dst->height = sh; } - if (src->width == dst->width && src->height == dst->height) + if (sw == dst->width && sh == dst->height) return 1; #endif - tmp = (src->width * dst->height + (src->height >> 1)) / src->height; + tmp = (sw * dst->height + (sh >> 1)) / sh; if (tmp > dst->width) - dst->height = (src->height * dst->width + (src->width >> 1)) - / src->width; + dst->height = (sh * dst->width + (sw >> 1)) / sw; else dst->width = tmp; 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 @@ #define LCD_HEIGHT 64 #define LCD_DEPTH 1 +#define LCD_PIXEL_ASPECT_WIDTH 4 +#define LCD_PIXEL_ASPECT_HEIGHT 5 + #define LCD_PIXELFORMAT VERTICAL_PACKING /* 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 @@ #define LCD_HEIGHT 64 #define LCD_DEPTH 1 +#define LCD_PIXEL_ASPECT_WIDTH 4 +#define LCD_PIXEL_ASPECT_HEIGHT 5 + #define LCD_PIXELFORMAT VERTICAL_PACKING /* 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 @@ #define LCD_HEIGHT 64 #define LCD_DEPTH 1 +#define LCD_PIXEL_ASPECT_WIDTH 4 +#define LCD_PIXEL_ASPECT_HEIGHT 5 + #define LCD_PIXELFORMAT VERTICAL_PACKING /* 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 @@ #define LCD_HEIGHT 64 #define LCD_DEPTH 1 +#define LCD_PIXEL_ASPECT_WIDTH 4 +#define LCD_PIXEL_ASPECT_HEIGHT 5 + #define LCD_PIXELFORMAT VERTICAL_PACKING /* 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 @@ #define LCD_HEIGHT 64 #define LCD_DEPTH 1 +#define LCD_PIXEL_ASPECT_WIDTH 4 +#define LCD_PIXEL_ASPECT_HEIGHT 5 + #define LCD_PIXELFORMAT VERTICAL_PACKING /* 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 @@ #endif #endif +/* Pixel aspect ratio is defined in terms of a multiplier for pixel width and + * height, and is set to 1:1 if the target does not set a value + */ +#ifndef LCD_PIXEL_ASPECT_HEIGHT +#define LCD_PIXEL_ASPECT_HEIGHT 1 +#endif +#ifndef LCD_PIXEL_ASPECT_WIDTH +#define LCD_PIXEL_ASPECT_WIDTH 1 +#endif + /* define this in the target config.h to use a different size */ #ifndef CONFIG_DEFAULT_ICON_HEIGHT #define CONFIG_DEFAULT_ICON_HEIGHT 8 |