[FFmpeg-devel] [PATCH] Make slicify honour the slice direction

Michael Niedermayer michaelni
Tue Dec 1 12:44:10 CET 2009


On Mon, Nov 30, 2009 at 11:41:26PM +0100, Stefano Sabatini wrote:
> Hi, as in subject.
> 
> Without this some combination with the pad filter may issue weird
> behavior.
> 
> Regards.
> -- 
> FFmpeg = Fast Furious Mere Peaceful Eccentric Guru

>  vf_slicify.c |   22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
> 9e459bac2cabe3ccb99c5419be00af872fc72f01  fix-slice-dir-for-slicify.patch
> Index: libavfilter-soc/ffmpeg/libavfilter/vf_slicify.c
> ===================================================================
> --- libavfilter-soc.orig/ffmpeg/libavfilter/vf_slicify.c	2009-11-30 22:18:44.000000000 +0100
> +++ libavfilter-soc/ffmpeg/libavfilter/vf_slicify.c	2009-11-30 23:34:49.000000000 +0100
> @@ -28,6 +28,8 @@
>  typedef struct {
>      int h;          ///< output slice height
>      int vshift;     ///< vertical chroma subsampling shift
> +    int slice_dir;  ///< detected slice direction for the current frame
> +    int slice_y;    ///< if the slice direction is bottom-up is the bottom y for the next slice
>  } SliceContext;
>  
>  static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
> @@ -65,6 +67,8 @@
>  
>  static void start_frame(AVFilterLink *link, AVFilterPicRef *picref)
>  {
> +    SliceContext *slice = link->dst->priv;
> +    slice->slice_dir = 0;
>      avfilter_start_frame(link->dst->outputs[0], picref);
>  }
>  
> @@ -78,11 +82,29 @@
>      SliceContext *slice = link->dst->priv;
>      int y2;
>  
> +    if (!slice->slice_dir) {
> +        if (y != 0 && y + h != link->h) {
> +            av_log(link->dst, AV_LOG_ERROR, "Slices start in the middle!\n");
> +            return;
> +        }
> +        slice->slice_dir = y ?                       -1 : 1;
> +        slice->slice_y   = y ? link->dst->outputs[0]->h : y;
> +    }

code duplication

an additional argument in draw_slice() that specifies direction seems
simpler to me.

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The educated differ from the uneducated as much as the living from the
dead. -- Aristotle 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091201/a0c49e3f/attachment.pgp>



More information about the ffmpeg-devel mailing list