|
From: libvidcap c. m. <lib...@li...> - 2007-09-11 18:43:53
|
Revision: 15
http://libvidcap.svn.sourceforge.net/libvidcap/?rev=15&view=rev
Author: jpgrayson
Date: 2007-09-11 11:43:51 -0700 (Tue, 11 Sep 2007)
Log Message:
-----------
Fix some signed/unsigned type mismatch warnings.
Tidy-up some spacing.
Modified Paths:
--------------
trunk/src/conv.h
trunk/src/conv_to_i420.c
trunk/src/conv_to_rgb.c
trunk/src/conv_to_yuy2.c
Modified: trunk/src/conv.h
===================================================================
--- trunk/src/conv.h 2007-09-11 15:31:16 UTC (rev 14)
+++ trunk/src/conv.h 2007-09-11 18:43:51 UTC (rev 15)
@@ -38,8 +38,7 @@
VIDCAP_FOURCC_BOTTOM_UP_RGB24 = 204,
};
-typedef int (*conv_func)(int width, int height,
- const char * src, char * dst);
+typedef int (*conv_func)(int width, int height, const char * src, char * dst);
#ifdef __cplusplus
extern "C" {
Modified: trunk/src/conv_to_i420.c
===================================================================
--- trunk/src/conv_to_i420.c 2007-09-11 15:31:16 UTC (rev 14)
+++ trunk/src/conv_to_i420.c 2007-09-11 18:43:51 UTC (rev 15)
@@ -31,18 +31,14 @@
*/
int
-vidcap_rgb32_to_i420(int width, int height,
- const char * src,
- char * dst)
+vidcap_rgb32_to_i420(int width, int height, const char * src, char * dst)
{
log_error("vidcap_rgb32_to_i420() not implemented\n");
return -1;
}
int
-vidcap_yuy2_to_i420(int width, int height,
- const char * src,
- char * dst)
+vidcap_yuy2_to_i420(int width, int height, const char * src, char * dst)
{
/* convert from a packed structure to a planar structure */
char * dst_y_even = dst;
@@ -86,9 +82,7 @@
* same except where we find the yuv components.
*/
int
-conv_2vuy_to_i420(int width, int height,
- const char * src,
- char * dst)
+conv_2vuy_to_i420(int width, int height, const char * src, char * dst)
{
char * dst_y_even = dst;
char * dst_y_odd = dst + width;
@@ -127,9 +121,7 @@
* are reversed and 4x4 subsampled, instead of 2x2
*/
int
-conv_yvu9_to_i420(int width, int height,
- const char * src,
- char * dst)
+conv_yvu9_to_i420(int width, int height, const char * src, char * dst)
{
char * dst_y = dst;
char * dst_u_even = dst + width * height;
Modified: trunk/src/conv_to_rgb.c
===================================================================
--- trunk/src/conv_to_rgb.c 2007-09-11 15:31:16 UTC (rev 14)
+++ trunk/src/conv_to_rgb.c 2007-09-11 18:43:51 UTC (rev 15)
@@ -96,14 +96,12 @@
* Dest should be width * height * 4 bytes in size.
*
* Based on the formulas found at http://en.wikipedia.org/wiki/YUV
+ *
+ * NOTE: size of dest buffer must be >= width * height * 4
*/
-/* NOTE: size of dest buffer must be >= width * height * 4
- */
-
int
-vidcap_i420_to_rgb32(int width, int height, const char * src,
- char * dest)
+vidcap_i420_to_rgb32(int width, int height, const char * src, char * dest)
{
const unsigned char * y_even;
const unsigned char * y_odd;
@@ -158,8 +156,7 @@
* includes two luminance (y) components and a single red and blue
* chroma (Cr and Cb aka v and u) sample use for both pixels.
*/
-int vidcap_yuy2_to_rgb32(int width, int height, const char * src,
- char * dest)
+int vidcap_yuy2_to_rgb32(int width, int height, const char * src, char * dest)
{
unsigned int * d = (unsigned int *)dest;
int i, j;
@@ -189,37 +186,37 @@
return 0;
}
-int conv_rgb24_to_rgb32(int width, int height, const char * src,
- char * dest)
+int conv_rgb24_to_rgb32(int width, int height, const char * src, char * dest)
{
int i;
unsigned int * d = (unsigned int *)dest;
+ const unsigned char * s = (const unsigned char *)src;
for ( i = 0; i < width * height; ++i )
{
*d = 0xff000000;
- *d |= ((unsigned char)(*src++)); // blue
- *d |= ((unsigned char)(*src++)) << 8; // green
- *d++ |= ((unsigned char)(*src++)) << 16; // red
+ *d |= *s++; /* blue */
+ *d |= (*s++) << 8; /* green */
+ *d++ |= (*s++) << 16; /* red */
}
return 0;
}
int conv_bottom_up_rgb24_to_rgb32(int width, int height,
- const char * src,
- char * dest)
+ const char * src, char * dest)
{
int i;
unsigned int * d = (unsigned int *)dest;
- const unsigned char *src_end = src - 1 + width * height * 3;
+ const unsigned char * src_end = (const unsigned char *)src +
+ width * height * 3 - 1;
for ( i = 0; i < width * height; ++i )
{
*d = 0xff000000;
- *d |= ((unsigned char)(*src_end--)) << 16; // red
- *d |= ((unsigned char)(*src_end--)) << 8; // green
- *d++ |= ((unsigned char)(*src_end--)); // blue
+ *d |= (*src_end--) << 16; /* red */
+ *d |= (*src_end--) << 8; /* green */
+ *d++ |= *src_end--; /* blue */
}
return 0;
Modified: trunk/src/conv_to_yuy2.c
===================================================================
--- trunk/src/conv_to_yuy2.c 2007-09-11 15:31:16 UTC (rev 14)
+++ trunk/src/conv_to_yuy2.c 2007-09-11 18:43:51 UTC (rev 15)
@@ -26,28 +26,24 @@
#include <vidcap/converters.h>
#include "logging.h"
-/* NOTE: size of dest buffer must be >= width * height * 2
- */
+/* NOTE: size of dest buffer must be >= width * height * 2 */
int
-vidcap_rgb32_to_yuy2(int width, int height, const char * src,
- char * dest)
+vidcap_rgb32_to_yuy2(int width, int height, const char * src, char * dest)
{
log_error("vidcap_rgb32_to_yuy2() not implemented\n");
return -1;
}
int
-vidcap_i420_to_yuy2(int width, int height, const char * src,
- char * dest)
+vidcap_i420_to_yuy2(int width, int height, const char * src, char * dest)
{
log_error("vidcap_i420_to_yuy2() not implemented\n");
return -1;
}
int
-conv_2vuy_to_yuy2(int width, int height, const char * src,
- char * dest)
+conv_2vuy_to_yuy2(int width, int height, const char * src, char * dest)
{
int i;
unsigned int * d = (unsigned int *)dest;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|