You've already forked libopenshot
mirror of
https://github.com/OpenShot/libopenshot.git
synced 2026-03-02 08:53:52 -08:00
Frame: Fix interlaced AddImage
This commit is contained in:
@@ -818,16 +818,23 @@ void Frame::AddImage(std::shared_ptr<QImage> new_image, bool only_odd_lines)
|
||||
// Ignore image of different sizes or formats
|
||||
bool ret=false;
|
||||
#pragma omp critical (AddImage)
|
||||
if (image == new_image || image->size() != image->size() || image->format() != image->format())
|
||||
ret=true;
|
||||
if (ret)
|
||||
{
|
||||
if (image == new_image || image->size() != new_image->size()) {
|
||||
ret = true;
|
||||
}
|
||||
else if (new_image->format() != image->format()) {
|
||||
new_image = std::shared_ptr<QImage>(new QImage(new_image->convertToFormat(image->format())));
|
||||
}
|
||||
}
|
||||
if (ret) {
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
// Get the frame's image
|
||||
const GenericScopedLock<juce::CriticalSection> lock(addingImageSection);
|
||||
#pragma omp critical (AddImage)
|
||||
{
|
||||
const unsigned char *pixels = image->constBits();
|
||||
unsigned char *pixels = image->bits();
|
||||
const unsigned char *new_pixels = new_image->constBits();
|
||||
|
||||
// Loop through the scanlines of the image (even or odd)
|
||||
@@ -836,13 +843,13 @@ void Frame::AddImage(std::shared_ptr<QImage> new_image, bool only_odd_lines)
|
||||
start = 1;
|
||||
|
||||
for (int row = start; row < image->height(); row += 2) {
|
||||
memcpy((unsigned char *) pixels, new_pixels + (row * image->bytesPerLine()), image->bytesPerLine());
|
||||
new_pixels += image->bytesPerLine();
|
||||
int offset = row * image->bytesPerLine();
|
||||
memcpy(pixels + offset, new_pixels + offset, image->bytesPerLine());
|
||||
}
|
||||
|
||||
// Update height and width
|
||||
width = image->width();
|
||||
height = image->height();
|
||||
width = image->width();
|
||||
has_image_data = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user