diff options
Diffstat (limited to 'apps/recorder')
-rw-r--r-- | apps/recorder/resize.c | 20 |
1 files changed, 13 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 | */ |
67 | int recalc_dimension(struct dim *dst, struct dim *src) | 67 | int 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; |