Small code fixes

This commit is contained in:
Kfir Itzhak 2011-06-14 20:38:18 +03:00
parent eab09844de
commit 11029d57b6
4 changed files with 1463 additions and 1460 deletions

File diff suppressed because it is too large Load Diff

View File

@ -51,7 +51,7 @@ static delta_fptr_t fptr_delta8_abgr;
static delta_fptr_t fptr_delta8_gray8; static delta_fptr_t fptr_delta8_gray8;
/* Pointer to image buffer memory copy function */ /* Pointer to image buffer memory copy function */
static imgbufcpy_fptr_t fptr_imgbufcpy; imgbufcpy_fptr_t fptr_imgbufcpy;
Image::Image() Image::Image()
{ {

View File

@ -44,6 +44,13 @@ extern "C"
#define ZM_BUFTYPE_AVMALLOC 3 #define ZM_BUFTYPE_AVMALLOC 3
#define ZM_BUFTYPE_ZM 4 #define ZM_BUFTYPE_ZM 4
typedef void (*blend_fptr_t)(const uint8_t*, const uint8_t*, uint8_t*, unsigned long, double);
typedef void (*delta_fptr_t)(const uint8_t*, const uint8_t*, uint8_t*, unsigned long);
typedef void (*convert_fptr_t)(const uint8_t*, uint8_t*, unsigned long);
typedef void* (*imgbufcpy_fptr_t)(void*, const void*, size_t);
extern imgbufcpy_fptr_t fptr_imgbufcpy;
/* Should be called from Image class functions */ /* Should be called from Image class functions */
inline static uint8_t* AllocBuffer(size_t p_bufsize) { inline static uint8_t* AllocBuffer(size_t p_bufsize) {
@ -68,6 +75,7 @@ inline static void DumpBuffer(uint8_t* buffer, int buffertype) {
} }
} }
// //
// This is image class, and represents a frame captured from a // This is image class, and represents a frame captured from a
// camera in raw form. // camera in raw form.
@ -181,13 +189,13 @@ public:
{ {
if ( image.size != size ) if ( image.size != size )
{ {
Panic( "Attempt to copy different size image buffers, expected %d, got %d", size, image.size ); Panic( "Attempt to copy different size image buffers, expected %d, got %d", size, image.size );
} }
sse2_aligned_memcpy( buffer, image.buffer, size ); (*fptr_imgbufcpy)(buffer, image.buffer, size);
} }
inline Image &operator=( const unsigned char *new_buffer ) inline Image &operator=( const unsigned char *new_buffer )
{ {
sse2_aligned_memcpy( buffer, new_buffer, size ); (*fptr_imgbufcpy)(buffer, new_buffer, size);
return( *this ); return( *this );
} }
@ -238,12 +246,6 @@ public:
#endif // ZM_IMAGE_H #endif // ZM_IMAGE_H
typedef void (*blend_fptr_t)(const uint8_t*, const uint8_t*, uint8_t*, unsigned long, double);
typedef void (*delta_fptr_t)(const uint8_t*, const uint8_t*, uint8_t*, unsigned long);
typedef void (*convert_fptr_t)(const uint8_t*, uint8_t*, unsigned long);
typedef void* (*imgbufcpy_fptr_t)(void*, const void*, size_t);
/* Blend functions */ /* Blend functions */
void sse2_fastblend(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count, double blendpercent); void sse2_fastblend(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count, double blendpercent);
void std_fastblend(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count, double blendpercent); void std_fastblend(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count, double blendpercent);

View File

@ -1901,8 +1901,8 @@ int LocalCamera::Capture( Image &image )
Debug( 3, "Captured %d for channel %d", capture_frame, channel ); Debug( 3, "Captured %d for channel %d", capture_frame, channel );
buffer = v4l1_data.bufptr+v4l1_data.frames.offsets[capture_frame]; buffer = v4l1_data.bufptr+v4l1_data.frames.offsets[capture_frame];
#endif // ZM_HAS_V4L1
} }
#endif // ZM_HAS_V4L1
} /* prime capture */ } /* prime capture */
if(conversion_type != 0) { if(conversion_type != 0) {