diff options
-rw-r--r-- | libvo/vo_vesa.c | 2 | ||||
-rw-r--r-- | postproc/rgb2rgb.c | 17 | ||||
-rw-r--r-- | postproc/rgb2rgb.h | 3 | ||||
-rw-r--r-- | postproc/rgb2rgb_template.c | 17 |
4 files changed, 38 insertions, 1 deletions
diff --git a/libvo/vo_vesa.c b/libvo/vo_vesa.c index 7f7cb9cab4..1e9c01c315 100644 --- a/libvo/vo_vesa.c +++ b/libvo/vo_vesa.c @@ -582,6 +582,8 @@ init(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint3 { if(image_bpp == 24 && video_mode_info.BitsPerPixel == 32) rgb2rgb_fnc = rgb24to32; else + if(image_bpp == 32 && video_mode_info.BitsPerPixel == 24) rgb2rgb_fnc = rgb32to24; + else { printf("vo_vesa: Can't convert %u to %u\n",image_bpp,video_mode_info.BitsPerPixel); return -1; diff --git a/postproc/rgb2rgb.c b/postproc/rgb2rgb.c index 1a71ba9dce..7e0a1e9917 100644 --- a/postproc/rgb2rgb.c +++ b/postproc/rgb2rgb.c @@ -2,6 +2,8 @@ #include "../config.h" #include "rgb2rgb.h" +/* TODO: MMX optimization */ + void rgb24to32(uint8_t *src,uint8_t *dst,uint32_t src_size) { uint32_t *dest = (uint32_t *)dst; @@ -16,3 +18,18 @@ void rgb24to32(uint8_t *src,uint8_t *dst,uint32_t src_size) s += 3; } } + +void rgb32to24(uint8_t *src,uint8_t *dst,uint32_t src_size) +{ + uint8_t *dest = dst; + uint8_t *s = src; + uint8_t *end; + end = s + src_size; + while(s < end) + { + *dest++ = *s++; + *dest++ = *s++; + *dest++ = *s++; + s++; + } +} diff --git a/postproc/rgb2rgb.h b/postproc/rgb2rgb.h index 4224487d32..7d81ef171a 100644 --- a/postproc/rgb2rgb.h +++ b/postproc/rgb2rgb.h @@ -1,6 +1,6 @@ /* * - * rgb2rgb.h, Software RGB to RGB coverter + * rgb2rgb.h, Software RGB to RGB converter * */ @@ -8,5 +8,6 @@ #define RGB2RGB_INCLUDED extern void rgb24to32(uint8_t *src,uint8_t *dst,uint32_t src_size); +extern void rgb32to24(uint8_t *src,uint8_t *dst,uint32_t src_size); #endif diff --git a/postproc/rgb2rgb_template.c b/postproc/rgb2rgb_template.c index 1a71ba9dce..7e0a1e9917 100644 --- a/postproc/rgb2rgb_template.c +++ b/postproc/rgb2rgb_template.c @@ -2,6 +2,8 @@ #include "../config.h" #include "rgb2rgb.h" +/* TODO: MMX optimization */ + void rgb24to32(uint8_t *src,uint8_t *dst,uint32_t src_size) { uint32_t *dest = (uint32_t *)dst; @@ -16,3 +18,18 @@ void rgb24to32(uint8_t *src,uint8_t *dst,uint32_t src_size) s += 3; } } + +void rgb32to24(uint8_t *src,uint8_t *dst,uint32_t src_size) +{ + uint8_t *dest = dst; + uint8_t *s = src; + uint8_t *end; + end = s + src_size; + while(s < end) + { + *dest++ = *s++; + *dest++ = *s++; + *dest++ = *s++; + s++; + } +} |