Fixed a big bug on frame rate mapping, due to incorrect # of samples being copied into the new frame. Also, implemented interalacing support, and full pulldown support (in the frame mapper).

This commit is contained in:
Jonathan Thomas
2012-10-18 02:58:09 -05:00
parent 129a2fccd7
commit 5e5ca2a55c
4 changed files with 54 additions and 6 deletions

View File

@@ -451,6 +451,36 @@ void Frame::AddImage(tr1::shared_ptr<Magick::Image> new_image)
image = new_image;
}
// Add (or replace) pixel data to the frame (for only the odd or even lines)
void Frame::AddImage(tr1::shared_ptr<Magick::Image> new_image, bool only_odd_lines)
{
// Replace image (if needed)
if (image->columns() == 1)
image = new_image;
// Loop through each odd or even line, and copy it to the image
int starting_row = 0;
if (!only_odd_lines)
// even rows
starting_row = 1;
// Replace some rows of pixels
for (int row = starting_row; row < new_image->rows(); row += 2)
{
// Get row of pixels from original image
Magick::PixelPacket* row_pixels = image->getPixels(0, row, image->columns(), 1);
const Magick::PixelPacket* new_row_pixels = new_image->getConstPixels(0, row, image->columns(), 1);
// Copy pixels
for (int col = 0; col < image->columns(); col++)
row_pixels[col] = new_row_pixels[col];
// Replace them with updated pixels
image->syncPixels();
}
}
// Add audio samples to a specific channel
void Frame::AddAudio(int destChannel, int destStartSample, const float* source, int numSamples, float gainToApplyToSource = 1.0f)
{