Added RGB565 format.
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@472 e3e1d417-86f3-4887-817a-d78f3d33393fpull/27/merge
parent
d1fd5c0828
commit
a0e29e0401
|
@ -101,13 +101,24 @@ void LocalCamera::Initialise()
|
|||
exit(-1);
|
||||
}
|
||||
|
||||
if ( (vid_pic.palette = palette) == VIDEO_PALETTE_GREY )
|
||||
switch (vid_pic.palette = palette)
|
||||
{
|
||||
vid_pic.depth = 8;
|
||||
}
|
||||
else
|
||||
{
|
||||
vid_pic.depth = 24;
|
||||
case VIDEO_PALETTE_GREY :
|
||||
{
|
||||
vid_pic.depth = 8;
|
||||
break;
|
||||
}
|
||||
case VIDEO_PALETTE_RGB565 :
|
||||
{
|
||||
vid_pic.depth = 16;
|
||||
break;
|
||||
}
|
||||
case VIDEO_PALETTE_RGB24 :
|
||||
case VIDEO_PALETTE_YUV420P :
|
||||
{
|
||||
vid_pic.depth = 24;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( ioctl( m_videohandle, VIDIOCSPICT, &vid_pic ) )
|
||||
|
@ -547,7 +558,7 @@ int LocalCamera::PostCapture( Image &image )
|
|||
v1_ptr = v_plane;
|
||||
int size = Y_size*3;
|
||||
int r,g,b;
|
||||
for ( int i = 0; i < size; i++ )
|
||||
for ( int i = 0; i < size; i += 3 )
|
||||
{
|
||||
y = *y_ptr++;
|
||||
u = *u1_ptr++;
|
||||
|
@ -564,21 +575,58 @@ int LocalCamera::PostCapture( Image &image )
|
|||
buffer = temp_buffer;
|
||||
break;
|
||||
}
|
||||
case VIDEO_PALETTE_RGB565 :
|
||||
{
|
||||
int size = width*height*2;
|
||||
unsigned char r,g,b;
|
||||
unsigned char *s_ptr = buffer;
|
||||
unsigned char *d_ptr = temp_buffer;
|
||||
for ( int i = 0; i < size; i += 2 )
|
||||
{
|
||||
//r = ((*(s_ptr+1))<<3)&0xf8;
|
||||
//g = (((*s_ptr)<<5)|(*(s_ptr+1)>>3))&0xf8;
|
||||
//b = (*s_ptr)&0xf8;
|
||||
b = ((*s_ptr)<<3)&0xf8;
|
||||
g = (((*(s_ptr+1))<<5)|((*s_ptr)>>3))&0xf8;
|
||||
r = (*(s_ptr+1))&0xf8;
|
||||
|
||||
*d_ptr++ = r;
|
||||
*d_ptr++ = g;
|
||||
*d_ptr++ = b;
|
||||
s_ptr += 2;
|
||||
}
|
||||
buffer = temp_buffer;
|
||||
break;
|
||||
}
|
||||
case VIDEO_PALETTE_RGB24 :
|
||||
{
|
||||
if ( ZM_LOCAL_BGR_INVERT )
|
||||
{
|
||||
int size = width*height*3;
|
||||
unsigned char *s_ptr = buffer;
|
||||
unsigned char *d_ptr = temp_buffer;
|
||||
for ( int i = 0; i < size; i += 3 )
|
||||
{
|
||||
temp_buffer[i] = buffer[i+2];
|
||||
temp_buffer[i+1] = buffer[i+1];
|
||||
temp_buffer[i+2] = buffer[i];
|
||||
*d_ptr++ = *(s_ptr+2);
|
||||
*d_ptr++ = *(s_ptr+1);
|
||||
*d_ptr++ = *s_ptr;
|
||||
s_ptr += 3;
|
||||
}
|
||||
}
|
||||
buffer = temp_buffer;
|
||||
break;
|
||||
}
|
||||
case VIDEO_PALETTE_GREY :
|
||||
{
|
||||
int size = width*height;
|
||||
for ( int i = 0; i < size; i++ )
|
||||
{
|
||||
if ( buffer[i] < 16 )
|
||||
Info(( "Lo grey %d", buffer[i] ));
|
||||
if ( buffer[i] > 235 )
|
||||
Info(( "Hi grey %d", buffer[i] ));
|
||||
}
|
||||
}
|
||||
default : // Everything else is straightforward, for now.
|
||||
{
|
||||
break;
|
||||
|
|
|
@ -2063,7 +2063,7 @@ function configureButton(form,name)
|
|||
$monitor[FPSReportInterval] = 1000;
|
||||
$monitor[RefBlendPerc] = 10;
|
||||
}
|
||||
$local_palettes = array( "Greyscale"=>1, "RGB24"=>4, "YUV420P"=>15 );
|
||||
$local_palettes = array( "Grey"=>1, "RGB24"=>4, "RGB565"=>3, "YUV420P"=>15 );
|
||||
$remote_palettes = array( "8 bit greyscale"=>1, "24 bit colour"=>4 );
|
||||
?>
|
||||
<html>
|
||||
|
|
Loading…
Reference in New Issue