Fixed bug in AddImage() method on a frame, to copy the image instead of just pointing to it. This fixed many issues in the FrameMapper as well, which copies images alot.

This commit is contained in:
Jonathan Thomas
2013-11-04 15:16:19 -06:00
parent 1bdea062d6
commit 1e7cd7ddbb
4 changed files with 30 additions and 49 deletions

View File

@@ -420,28 +420,6 @@ int FrameMapper::GetSamplesPerFrame(int frame_number, Fraction rate)
return samples_per_frame;
}
// De-interlace a frame
tr1::shared_ptr<Frame> FrameMapper::DeInterlaceFrame(tr1::shared_ptr<Frame> frame, bool isOdd)
{
// Calculate the new size (used to shrink and expand the image, to remove interlacing)
Magick::Geometry original_size = frame->GetImage()->size();
Magick::Geometry frame_size = frame->GetImage()->size();
frame_size.aspect(false); // allow the image to be re-sized to an invalid aspect ratio
frame_size.height(frame_size.height() / 2.0); // height set to 50% of original height
if (isOdd)
// Roll the image by 1 pixel, to use the ODD horizontal lines (instead of the even ones)
frame->GetImage()->roll(0,1);
// Resample the image to 50% height (to remove every other line)
frame->GetImage()->sample(frame_size);
// Resize image back to original height
frame->GetImage()->resize(original_size);
return frame;
}
void FrameMapper::PrintMapping()
{
// Get the difference (in frames) between the original and target frame rates