various: implement sequence pixel aspect ratios and interlacing settings

Implements the following:
- Sequences have pixel aspect ratios that work in tandem with footage PARs
  to render footage correctly. Viewer and export also acknowledge PARs
- Sequences can have interlacing settings. This doesn't do anything yet,
  eventually the renderer will need to interlace/deinterlace/reinterlace
  appropriately in order to conform all the footage to the sequence. Export
  acknowledges interlacing, but this only affects metadata, not the image.
This commit is contained in:
itsmattkc
2020-08-10 01:47:26 +10:00
parent 901f1001af
commit 28dcff10c0
51 changed files with 1201 additions and 605 deletions
+12 -4
View File
@@ -149,22 +149,26 @@ QVariant OpenGLProxy::FrameToValue(FramePtr frame, StreamPtr stream, const Video
VideoParams frame_params = frame->video_params();
// Check frame aspect ratio
if (frame->sample_aspect_ratio() != 1) {
rational true_pixel_aspect_ratio = frame_params.pixel_aspect_ratio() / params.pixel_aspect_ratio();
if (true_pixel_aspect_ratio != 1) {
int new_width = frame_params.width();
int new_height = frame_params.height();
// Scale the frame in a way that does not reduce the resolution
if (frame->sample_aspect_ratio() > 1) {
if (frame_params.pixel_aspect_ratio() > 1) {
// Make wider
new_width = qRound(static_cast<double>(new_width) * frame->sample_aspect_ratio().toDouble());
new_width = qRound(static_cast<double>(new_width) * frame_params.pixel_aspect_ratio().toDouble());
} else {
// Make taller
new_height = qRound(static_cast<double>(new_height) / frame->sample_aspect_ratio().toDouble());
new_height = qRound(static_cast<double>(new_height) / frame_params.pixel_aspect_ratio().toDouble());
}
frame_params = VideoParams(new_width,
new_height,
frame_params.format(),
frame_params.pixel_aspect_ratio(),
frame_params.interlacing(),
frame_params.divider());
}
@@ -178,6 +182,8 @@ QVariant OpenGLProxy::FrameToValue(FramePtr frame, StreamPtr stream, const Video
VideoParams dest_params(frame_params.width(),
frame_params.height(),
texture_fmt,
frame_params.pixel_aspect_ratio(),
frame_params.interlacing(),
frame_params.divider());
// Create destination texture
@@ -420,6 +426,8 @@ QVariant OpenGLProxy::RunNodeAccelerated(const Node *node,
params.height(),
params.time_base(),
output_format,
params.pixel_aspect_ratio(),
params.interlacing(),
params.divider());
int real_iteration_count;
+6
View File
@@ -127,6 +127,8 @@ void RenderWorker::RenderFrame(RenderTicketPtr ticket, ViewerOutput* viewer, con
video_params_.height(),
video_params_.time_base(),
output_format,
video_params_.pixel_aspect_ratio(),
video_params_.interlacing(),
video_params_.divider()));
frame->set_timestamp(time);
frame->allocate();
@@ -295,6 +297,8 @@ QVariant RenderWorker::ProcessFrameGeneration(const Node* node, const GenerateJo
video_params_.height(),
video_params_.time_base(),
output_fmt,
video_params_.pixel_aspect_ratio(),
video_params_.interlacing(),
video_params_.divider()));
frame->allocate();
@@ -316,6 +320,8 @@ QVariant RenderWorker::GetCachedFrame(const Node* node, const rational& time)
f->height() * video_params_.divider(),
f->video_params().time_base(),
f->video_params().format(),
f->video_params().pixel_aspect_ratio(),
f->video_params().interlacing(),
video_params_.divider()));
return CachedFrameToTexture(f);