[FFmpeg-devel] [PATCH] [2/??] [3/3] Filter graphs - Parser for a graph description

vmrsss vmrsss
Wed Mar 19 13:11:12 CET 2008


On 18 Mar 2008, at 20:53, Michael Niedermayer wrote:
> How does the following work in your system?
>
> (in0,tmp0,tmp2)filter1(tmp1,out0,tmp2); 
> (in1,tmp1,tmp3)filter2(tmp3,tmp0,out1)

There are of course very many ways to write this (as I said, ruled by  
a few simple equations), some longer and cleaner, some shorted and  
more cryptic. If you're after a short form, let me try this on you.

Observe first of all that with swap, id, * and , you can easily write  
all permutations; in this case we are interested in remapping  
{1,...,n} onto itself, which correspond to reordering n inputs or n  
outputs. (Just to make sure everybody is following, for instance with  
n=3 you may want to say output 1 becomes 3, output 2 becomes 1, output  
3 becomes 2; this would be

	(swap * nop),(nop * swap)

So in our case, I would suggest we have a special syntax for  
permutations (nothing more than filtergraphs in a predefined library).  
Let's suppose we use (3,1,2) to express the permutation above -- in  
general (k1, k2, ..., kn) would have in the 1st place the final  
position of 1 (say k1); in the 2nd place the final position of 2 (say  
k2); ... in the nth place the final position of n (say kn)). --- 
Notice: there alternative and better ways to represent permutations;  
this is just an example, it's not the right time to argue which one is  
the most convenient for our application.---

Then your term is a filtergraph of type 2 ---> 2 and can be written as:

   !!!! (3,4,5,6,1,2) , filter1 * filter2 , (3,5,2,4,1,6)

again, if I understood what you meant. My entire point is that this  
syntax is modular, you can always define complex graphs incrementally.

Notice of course that it would be quite possible to offer also  
shorthands for the feedback operator where one can indicate  
specifically which output is fed back to which input. All in all, my  
suggestion would be to have predefined terms on top of the basic  
syntax at least for:

  - split_n :1 ---> n		(copy stream n times, with split_0 = kill;  
split_1 = nop)
  - perm: n ---> n		(whatever the representation chosen, with swap =  
(2,1) )

-vmrsss









More information about the ffmpeg-devel mailing list