Warning fixes continued
This commit is contained in:
@@ -157,22 +157,22 @@ bool PngDecoder::readHeader()
|
||||
|
||||
if( !m_buf.empty() || m_f )
|
||||
{
|
||||
png_uint_32 width, height;
|
||||
png_uint_32 wdth, hght;
|
||||
int bit_depth, color_type;
|
||||
|
||||
png_read_info( png_ptr, info_ptr );
|
||||
|
||||
png_get_IHDR( png_ptr, info_ptr, &width, &height,
|
||||
png_get_IHDR( png_ptr, info_ptr, &wdth, &hght,
|
||||
&bit_depth, &color_type, 0, 0, 0 );
|
||||
|
||||
m_width = (int)width;
|
||||
m_height = (int)height;
|
||||
m_width = (int)wdth;
|
||||
m_height = (int)hght;
|
||||
m_color_type = color_type;
|
||||
m_bit_depth = bit_depth;
|
||||
|
||||
if( bit_depth <= 8 || bit_depth == 16 )
|
||||
{
|
||||
switch(color_type)
|
||||
switch(color_type)
|
||||
{
|
||||
case PNG_COLOR_TYPE_RGB:
|
||||
case PNG_COLOR_TYPE_PALETTE:
|
||||
@@ -224,7 +224,7 @@ bool PngDecoder::readData( Mat& img )
|
||||
else if( !isBigEndian() )
|
||||
png_set_swap( png_ptr );
|
||||
|
||||
if(img.channels() < 4)
|
||||
if(img.channels() < 4)
|
||||
{
|
||||
/* observation: png_read_image() writes 400 bytes beyond
|
||||
* end of data when reading a 400x118 color png
|
||||
@@ -247,7 +247,7 @@ bool PngDecoder::readData( Mat& img )
|
||||
#else
|
||||
png_set_gray_1_2_4_to_8( png_ptr );
|
||||
#endif
|
||||
|
||||
|
||||
if( CV_MAT_CN(m_type) > 1 && color )
|
||||
png_set_bgr( png_ptr ); // convert RGB to BGR
|
||||
else if( color )
|
||||
@@ -330,7 +330,7 @@ bool PngEncoder::write( const Mat& img, const vector<int>& params )
|
||||
if( params[i] == CV_IMWRITE_PNG_STRATEGY )
|
||||
{
|
||||
compression_strategy = params[i+1];
|
||||
compression_strategy = MIN(MAX(compression_strategy, 0), Z_FIXED);
|
||||
compression_strategy = MIN(MAX(compression_strategy, 0), Z_FIXED);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user