annotate DOCS/tech/video-filters.txt @ 5421:d1ff2c2f74f0

fixed RoQ framerate by multiplying PTS calculation by some absurd constant (and it works!)
author melanson
date Sun, 31 Mar 2002 17:24:12 +0000
parents 4a743a02eb57
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5364
4a743a02eb57 draft v0.1
arpi
parents:
diff changeset
1 First draft on video filter layer by A'rpi
4a743a02eb57 draft v0.1
arpi
parents:
diff changeset
2 =================================
4a743a02eb57 draft v0.1
arpi
parents:
diff changeset
3
4a743a02eb57 draft v0.1
arpi
parents:
diff changeset
4 Main goals:
4a743a02eb57 draft v0.1
arpi
parents:
diff changeset
5 - it should be in libmpcodecs
4a743a02eb57 draft v0.1
arpi
parents:
diff changeset
6 - it should reduce number of memcpys and memoru allocation to minimum
4a743a02eb57 draft v0.1
arpi
parents:
diff changeset
7 - it should do postprocessing, colorspace convert, scale and crop/expand/flip
4a743a02eb57 draft v0.1
arpi
parents:
diff changeset
8 [is there any other type of filters? maybe we could generalize these]
4a743a02eb57 draft v0.1
arpi
parents:
diff changeset
9 - maybe: sub/osd
4a743a02eb57 draft v0.1
arpi
parents:
diff changeset
10
4a743a02eb57 draft v0.1
arpi
parents:
diff changeset
11 Implementation:
4a743a02eb57 draft v0.1
arpi
parents:
diff changeset
12
4a743a02eb57 draft v0.1
arpi
parents:
diff changeset
13 The video filter plugin should implement the get_image() call (called from
4a743a02eb57 draft v0.1
arpi
parents:
diff changeset
14 the video decoder) and call get_image() for the destination image.
4a743a02eb57 draft v0.1
arpi
parents:
diff changeset
15
4a743a02eb57 draft v0.1
arpi
parents:
diff changeset
16 so, it would have:
4a743a02eb57 draft v0.1
arpi
parents:
diff changeset
17
4a743a02eb57 draft v0.1
arpi
parents:
diff changeset
18 optional:
4a743a02eb57 draft v0.1
arpi
parents:
diff changeset
19 int get_image(mp_image_t* mpi) // called through control()
4a743a02eb57 draft v0.1
arpi
parents:
diff changeset
20
4a743a02eb57 draft v0.1
arpi
parents:
diff changeset
21 if the filter doesn't implement this call, the core (vd.c) will alloc
4a743a02eb57 draft v0.1
arpi
parents:
diff changeset
22 buffer using memalign() as for disabled direct rendering.
4a743a02eb57 draft v0.1
arpi
parents:
diff changeset
23
4a743a02eb57 draft v0.1
arpi
parents:
diff changeset
24 mandatory:
4a743a02eb57 draft v0.1
arpi
parents:
diff changeset
25 mp_vfilter_data* init()
4a743a02eb57 draft v0.1
arpi
parents:
diff changeset
26
4a743a02eb57 draft v0.1
arpi
parents:
diff changeset
27 void uninit(mp_vfilter_data* vfd)
4a743a02eb57 draft v0.1
arpi
parents:
diff changeset
28
4a743a02eb57 draft v0.1
arpi
parents:
diff changeset
29 int control(mp_vfilter_data* vfd, ...)
4a743a02eb57 draft v0.1
arpi
parents:
diff changeset
30
4a743a02eb57 draft v0.1
arpi
parents:
diff changeset
31 mp_image_t* process(mp_vfilter_data* vfd, mp_image_t* mpi,(*get_image)())
4a743a02eb57 draft v0.1
arpi
parents:
diff changeset
32
4a743a02eb57 draft v0.1
arpi
parents:
diff changeset
33 this function will receive an mpi (maybe previously returned by get_image())
4a743a02eb57 draft v0.1
arpi
parents:
diff changeset
34 and should return the filtered mpi. it should use mpcodecs_get_image() to
4a743a02eb57 draft v0.1
arpi
parents:
diff changeset
35 allocate a new mpi.
4a743a02eb57 draft v0.1
arpi
parents:
diff changeset
36 the returned mpi may be EXPORT type, so just doing some pointer/stride
4a743a02eb57 draft v0.1
arpi
parents:
diff changeset
37 tricks (usually enough for crop/expand/flip) without duplicating the
4a743a02eb57 draft v0.1
arpi
parents:
diff changeset
38 image buffer or doing the modifications in the incoming buffer (if its
4a743a02eb57 draft v0.1
arpi
parents:
diff changeset
39 type allows it - so no flags PRESERVE/READABLE set)
4a743a02eb57 draft v0.1
arpi
parents:
diff changeset
40
4a743a02eb57 draft v0.1
arpi
parents:
diff changeset
41 mp_vfilter_data would be a transparent (to caller) pointer, used by the
4a743a02eb57 draft v0.1
arpi
parents:
diff changeset
42 filter instance to store its internal data, tables, parameters etc.
4a743a02eb57 draft v0.1
arpi
parents:
diff changeset
43 it would allow a fliter to be used more than one times in the queue.
4a743a02eb57 draft v0.1
arpi
parents:
diff changeset
44 for example: resize in 2 step, postproc+resize+postproc, expand+scale+crop etc
4a743a02eb57 draft v0.1
arpi
parents:
diff changeset
45
4a743a02eb57 draft v0.1
arpi
parents:
diff changeset
46 the tricky part of these filters is finding and implementing Direct
4a743a02eb57 draft v0.1
arpi
parents:
diff changeset
47 Filtering(C) using get_image().
4a743a02eb57 draft v0.1
arpi
parents:
diff changeset
48
4a743a02eb57 draft v0.1
arpi
parents:
diff changeset
49 anyway, as first step you can skip get_image() implementation, and just
4a743a02eb57 draft v0.1
arpi
parents:
diff changeset
50 leave it to vd.c core. in most cases it will be enough, direct filtering
4a743a02eb57 draft v0.1
arpi
parents:
diff changeset
51 only helps with simple filters (crop/expand/flip) in most cases.
4a743a02eb57 draft v0.1
arpi
parents:
diff changeset
52