mirror of
https://github.com/opencv/opencv.git
synced 2026-07-31 00:03:03 +04:00
Merge branch 4.x
This commit is contained in:
@@ -153,7 +153,7 @@ void RBaseStream::setPos( int64_t pos )
|
||||
int64_t RBaseStream::getPos()
|
||||
{
|
||||
CV_Assert(isOpened());
|
||||
int64_t pos = validateToInt64((m_current - m_start) + m_block_pos);
|
||||
int64_t pos = static_cast<int64_t>((m_current - m_start) + m_block_pos);
|
||||
CV_Assert(pos >= m_block_pos); // overflow check
|
||||
CV_Assert(pos >= 0); // overflow check
|
||||
return pos;
|
||||
|
||||
@@ -79,6 +79,7 @@ Mat BaseImageDecoder::getMetadata(ImageMetadataType type) const
|
||||
|
||||
case IMAGE_METADATA_XMP:
|
||||
case IMAGE_METADATA_ICCP:
|
||||
case IMAGE_METADATA_CICP:
|
||||
return makeMat(m_metadata[type]);
|
||||
|
||||
default:
|
||||
|
||||
@@ -212,7 +212,7 @@ bool GifDecoder::readData(Mat &img) {
|
||||
if(!restore.empty())
|
||||
{
|
||||
Mat roi = Mat(lastImage, cv::Rect(left,top,width,height));
|
||||
restore.copyTo(roi);
|
||||
restore.copyAt(roi);
|
||||
}
|
||||
|
||||
return hasRead;
|
||||
|
||||
@@ -715,7 +715,7 @@ void PngDecoder::compose_frame(std::vector<png_bytep>& rows_dst, const std::vect
|
||||
|
||||
// Blending mode
|
||||
for (unsigned int i = 0; i < w; i++, sp += channels, dp += channels) {
|
||||
uint16_t alpha = sp[3];
|
||||
uint16_t alpha = channels < 4 ? 0 : sp[3];
|
||||
|
||||
if (channels < 4 || alpha == 65535 || dp[3] == 0) {
|
||||
// Fully opaque OR destination fully transparent: direct copy
|
||||
@@ -745,7 +745,7 @@ void PngDecoder::compose_frame(std::vector<png_bytep>& rows_dst, const std::vect
|
||||
|
||||
// Blending mode
|
||||
for (unsigned int i = 0; i < w; i++, sp += channels, dp += channels) {
|
||||
uint8_t alpha = sp[3];
|
||||
uint8_t alpha = channels < 4 ? 0 : sp[3];
|
||||
|
||||
if (channels < 4 || alpha == 255 || dp[3] == 0) {
|
||||
// Fully opaque OR destination fully transparent: direct copy
|
||||
|
||||
@@ -476,7 +476,8 @@ static const char* metadataTypeToString(ImageMetadataType type)
|
||||
{
|
||||
return type == IMAGE_METADATA_EXIF ? "Exif" :
|
||||
type == IMAGE_METADATA_XMP ? "XMP" :
|
||||
type == IMAGE_METADATA_ICCP ? "ICC Profile" : "???";
|
||||
type == IMAGE_METADATA_ICCP ? "ICC Profile" :
|
||||
type == IMAGE_METADATA_CICP ? "cICP" : "???";
|
||||
}
|
||||
|
||||
static void addMetadata(ImageEncoder& encoder,
|
||||
|
||||
@@ -51,13 +51,6 @@ int validateToInt(size_t sz)
|
||||
return valueInt;
|
||||
}
|
||||
|
||||
int64_t validateToInt64(ptrdiff_t sz)
|
||||
{
|
||||
int64_t valueInt = static_cast<int64_t>(sz);
|
||||
CV_Assert((ptrdiff_t)valueInt == sz);
|
||||
return valueInt;
|
||||
}
|
||||
|
||||
#define SCALE 14
|
||||
#define cR (int)(0.299*(1 << SCALE) + 0.5)
|
||||
#define cG (int)(0.587*(1 << SCALE) + 0.5)
|
||||
|
||||
@@ -45,7 +45,6 @@
|
||||
namespace cv {
|
||||
|
||||
int validateToInt(size_t step);
|
||||
int64_t validateToInt64(ptrdiff_t step);
|
||||
|
||||
template <typename _Tp> static inline
|
||||
size_t safeCastToSizeT(const _Tp v_origin, const char* msg)
|
||||
|
||||
Reference in New Issue
Block a user