28 #include "../../include/effects/Deinterlace.h"
36 init_effect_details();
43 init_effect_details();
47 void Deinterlace::init_effect_details()
55 info.
description =
"Remove interlacing from a video (i.e. even or odd horizontal lines)";
65 int original_width = frame->GetImage()->width();
66 int original_height = frame->GetImage()->height();
69 std::shared_ptr<QImage> image = frame->GetImage();
70 const unsigned char* pixels = image->bits();
73 QImage deinterlaced_image(image->width(), image->height() / 2, QImage::Format_RGBA8888);
74 const unsigned char* deinterlaced_pixels = deinterlaced_image.bits();
80 for (
int row =
start; row < image->height(); row += 2) {
81 memcpy((
unsigned char*)deinterlaced_pixels, pixels + (row * image->bytesPerLine()), image->bytesPerLine());
82 deinterlaced_pixels += image->bytesPerLine();
86 image = std::shared_ptr<QImage>(
new QImage(deinterlaced_image.scaled(original_width, original_height, Qt::IgnoreAspectRatio, Qt::FastTransformation)));
89 frame->AddImage(image);
108 root[
"isOdd"] = isOdd;
120 bool success = reader.parse( value, root );
123 throw InvalidJSON(
"JSON could not be parsed (or is invalid)",
"");
133 throw InvalidJSON(
"JSON is invalid (missing keys or invalid data types)",
"");
144 if (!root[
"isOdd"].isNull())
145 isOdd = root[
"isOdd"].asBool();
153 root[
"id"] =
add_property_json(
"ID", 0.0,
"string",
Id(), NULL, -1, -1,
true, requested_frame);
154 root[
"position"] =
add_property_json(
"Position",
Position(),
"float",
"", NULL, 0, 30 * 60 * 60 * 48,
false, requested_frame);
156 root[
"start"] =
add_property_json(
"Start",
Start(),
"float",
"", NULL, 0, 30 * 60 * 60 * 48,
false, requested_frame);
157 root[
"end"] =
add_property_json(
"End",
End(),
"float",
"", NULL, 0, 30 * 60 * 60 * 48,
false, requested_frame);
158 root[
"duration"] =
add_property_json(
"Duration",
Duration(),
"float",
"", NULL, 0, 30 * 60 * 60 * 48,
true, requested_frame);
159 root[
"isOdd"] =
add_property_json(
"Is Odd Frame", isOdd,
"bool",
"", NULL, 0, 1,
true, requested_frame);
166 return root.toStyledString();