fixed #924
This commit is contained in:
parent
f7866677eb
commit
50df95650a
@ -1199,13 +1199,33 @@ bool CvVideoWriter_FFMPEG::writeFrame( const unsigned char* data, int step, int
|
||||
temp_image.width = width;
|
||||
temp_image.height = height;
|
||||
temp_image.cn = cn;
|
||||
temp_image.data = malloc(temp_image.step*temp_image.height);
|
||||
temp_image.data = (unsigned char*)malloc(temp_image.step*temp_image.height);
|
||||
}
|
||||
for( int y = 0; y < height; y++ )
|
||||
memcpy(temp_image.data + y*temp_image.step, data + (height-1-y)*step, width*cn);
|
||||
data = temp_image.data;
|
||||
step = temp_image.step;
|
||||
}
|
||||
#else
|
||||
if( width*cn != step )
|
||||
{
|
||||
if( !temp_image.data )
|
||||
{
|
||||
temp_image.step = width*cn;
|
||||
temp_image.width = width;
|
||||
temp_image.height = height;
|
||||
temp_image.cn = cn;
|
||||
temp_image.data = (unsigned char*)malloc(temp_image.step*temp_image.height);
|
||||
}
|
||||
if (origin == 1)
|
||||
for( int y = 0; y < height; y++ )
|
||||
memcpy(temp_image.data + y*temp_image.step, data + (height-1-y)*step, temp_image.step);
|
||||
else
|
||||
for( int y = 0; y < height; y++ )
|
||||
memcpy(temp_image.data + y*temp_image.step, data + y*step, temp_image.step);
|
||||
data = temp_image.data;
|
||||
step = temp_image.step;
|
||||
}
|
||||
#endif
|
||||
|
||||
// check parameters
|
||||
|
Loading…
Reference in New Issue
Block a user