further progress on better blending

This commit is contained in:
itsmattkc
2019-01-26 23:34:58 +11:00
parent 97a28ab54a
commit 7a436ef51f
20 changed files with 271 additions and 189 deletions
+4 -7
View File
@@ -777,6 +777,8 @@ void open_clip_worker(Clip* clip) {
last_filter = yadif_filter;
}
// ffmpeg premultiplier
/*
if (!clip->media->to_footage()->alpha_is_premultiplied) {
AVFilterContext* premultiply_filter;
snprintf(filter_args, sizeof(filter_args), "inplace=1");
@@ -785,6 +787,7 @@ void open_clip_worker(Clip* clip) {
avfilter_link(last_filter, 0, premultiply_filter, 0);
last_filter = premultiply_filter;
}
*/
/* stabilization code */
/*bool stabilize = false;
@@ -801,13 +804,7 @@ void open_clip_worker(Clip* clip) {
}
}*/
enum AVPixelFormat valid_pix_fmts[] = {
// AV_PIX_FMT_RGB24,
AV_PIX_FMT_RGBA,
AV_PIX_FMT_NONE
};
clip->pix_fmt = avcodec_find_best_pix_fmt_of_list(valid_pix_fmts, static_cast<enum AVPixelFormat>(clip->stream->codecpar->format), 1, nullptr);
clip->pix_fmt = AV_PIX_FMT_RGBA;
const char* chosen_format = av_get_pix_fmt_name(static_cast<enum AVPixelFormat>(clip->pix_fmt));
snprintf(filter_args, sizeof(filter_args), "pix_fmts=%s", chosen_format);
+8 -2
View File
@@ -370,9 +370,15 @@ int retrieve_next_frame(Clip* c, AVFrame* f) {
}
bool is_clip_active(Clip* c, long playhead) {
// these buffers allow clips to be opened and prepared well before they're displayed
// as well as closed a little after they're not needed anymore
int open_buffer = qCeil(c->sequence->frame_rate*2);
int close_buffer = qCeil(c->sequence->frame_rate);
return c->enabled
&& c->get_timeline_in_with_transition() < playhead + ceil(c->sequence->frame_rate*2)
&& c->get_timeline_out_with_transition() > playhead
&& c->get_timeline_in_with_transition() < playhead + open_buffer
&& c->get_timeline_out_with_transition() > playhead - close_buffer
&& playhead - c->get_timeline_in_with_transition() + c->get_clip_in_with_transition() < c->getMaximumLength();
}