diff options
author | Peter Schlaile <peter@schlaile.de> | 2008-06-23 00:39:41 +0400 |
---|---|---|
committer | Peter Schlaile <peter@schlaile.de> | 2008-06-23 00:39:41 +0400 |
commit | abda1a9ec17d830396c72d1dccd799509cebaa80 (patch) | |
tree | 1d13afdb390d2ff288b020fac7c526533a278b86 | |
parent | 381f15189d8555ff4825917f3f7076bb8524bbc4 (diff) |
== FFMPEG ==
Added serious interlacing to movies opened using ffmpeg.
(Other video decoders to be done)
Rational: deinterlacing, if done seriously _has_ to be done
in YUV-space. Since internal interface first converts data
to RGB we are pretty much lost (and fall back to IMB_filtery
in that case).
-rw-r--r-- | source/blender/imbuf/IMB_imbuf_types.h | 1 | ||||
-rw-r--r-- | source/blender/imbuf/intern/anim.c | 20 | ||||
-rw-r--r-- | source/blender/src/buttons_scene.c | 2 | ||||
-rw-r--r-- | source/blender/src/sequence.c | 14 |
4 files changed, 32 insertions, 5 deletions
diff --git a/source/blender/imbuf/IMB_imbuf_types.h b/source/blender/imbuf/IMB_imbuf_types.h index 94203bab447..73ef83393b0 100644 --- a/source/blender/imbuf/IMB_imbuf_types.h +++ b/source/blender/imbuf/IMB_imbuf_types.h @@ -149,6 +149,7 @@ typedef enum { #define IB_zbuffloat (1 << 16) #define IB_multilayer (1 << 17) #define IB_imginfo (1 << 18) +#define IB_animdeinterlace (1 << 19) /* * The bit flag is stored in the ImBuf.ftype variable. diff --git a/source/blender/imbuf/intern/anim.c b/source/blender/imbuf/intern/anim.c index 87d67f5263b..7fc8145c4a7 100644 --- a/source/blender/imbuf/intern/anim.c +++ b/source/blender/imbuf/intern/anim.c @@ -638,6 +638,7 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position) { AVPacket packet; int64_t pts_to_search = 0; int pos_found = 1; + int filter_y = 0; if (anim == 0) return (0); @@ -722,6 +723,18 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position) { } if(frameFinished && pos_found == 1) { + if (anim->ib_flags & IB_animdeinterlace) { + if (avpicture_deinterlace( + anim->pFrame, + anim->pFrame, + anim->pCodecCtx->pix_fmt, + anim->pCodecCtx->width, + anim->pCodecCtx->height) + < 0) { + filter_y = 1; + } + } + if (G.order == B_ENDIAN) { int * dstStride = anim->pFrameRGB->linesize; @@ -823,6 +836,10 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position) { av_free_packet(&packet); } + if (filter_y && ibuf) { + IMB_filtery(ibuf); + } + return(ibuf); } @@ -983,6 +1000,7 @@ struct ImBuf * IMB_anim_absolute(struct anim * anim, int position) { char head[256], tail[256]; unsigned short digits; int pic; + int filter_y = (anim->ib_flags & IB_animdeinterlace); if (anim == NULL) return(0); @@ -1040,6 +1058,7 @@ struct ImBuf * IMB_anim_absolute(struct anim * anim, int position) { case ANIM_FFMPEG: ibuf = ffmpeg_fetchibuf(anim, position); if (ibuf) anim->curposition = position; + filter_y = 0; /* done internally */ break; #endif #ifdef WITH_REDCODE @@ -1052,6 +1071,7 @@ struct ImBuf * IMB_anim_absolute(struct anim * anim, int position) { if (ibuf) { if (anim->ib_flags & IB_ttob) IMB_flipy(ibuf); + if (filter_y) IMB_filtery(ibuf); sprintf(ibuf->name, "%s.%04d", anim->name, anim->curposition + 1); } diff --git a/source/blender/src/buttons_scene.c b/source/blender/src/buttons_scene.c index 3797a92f16f..5ab4e5b6741 100644 --- a/source/blender/src/buttons_scene.c +++ b/source/blender/src/buttons_scene.c @@ -900,7 +900,7 @@ static void seq_panel_filter_video() "Convert input to float data"); uiDefButBitI(block, TOG, SEQ_FILTERY, - B_SEQ_BUT_RELOAD, "FilterY", + B_SEQ_BUT_RELOAD_FILE, "FilterY", 170,110,80,19, &last_seq->flag, 0.0, 21.0, 100, 0, "For video movies to remove fields"); diff --git a/source/blender/src/sequence.c b/source/blender/src/sequence.c index bf519dd6e9c..6851929bbc2 100644 --- a/source/blender/src/sequence.c +++ b/source/blender/src/sequence.c @@ -445,7 +445,10 @@ void reload_sequence_new_file(Sequence * seq) seq->strip->len = seq->len; } else if (seq->type == SEQ_MOVIE) { if(seq->anim) IMB_free_anim(seq->anim); - seq->anim = openanim(str, IB_rect); + seq->anim = openanim( + str, IB_rect | + ((seq->flag & SEQ_FILTERY) + ? IB_animdeinterlace : 0)); if (!seq->anim) { return; @@ -1445,7 +1448,7 @@ static void input_preprocess(Sequence * seq, TStripElem* se, int cfra) seq->strip->orx= se->ibuf->x; seq->strip->ory= se->ibuf->y; - if(seq->flag & SEQ_FILTERY) { + if((seq->flag & SEQ_FILTERY) && seq->type != SEQ_MOVIE) { IMB_filtery(se->ibuf); } @@ -1772,8 +1775,11 @@ static void do_build_seq_ibuf(Sequence * seq, TStripElem *se, int cfra, BLI_join_dirfile(name, seq->strip->dir, seq->strip->stripdata->name); BLI_convertstringcode(name, G.sce); BLI_convertstringframe(name, G.scene->r.cfra); - - seq->anim = openanim(name, IB_rect); + + seq->anim = openanim( + name, IB_rect | + ((seq->flag & SEQ_FILTERY) + ? IB_animdeinterlace : 0)); } if(seq->anim) { IMB_anim_set_preseek(seq->anim, seq->anim_preseek); |