annotate DOCS/tech/libvo2.txt @ 13998:14c476d62fc2

Some fixes by myself and compn <tempn at twmi dot rr dot com>
author diego
date Sat, 20 Nov 2004 16:23:10 +0000
parents d4e2bdc246a3
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9484
551d1f5ca980 mark libvo2.txt as obsolete
attila
parents: 7727
diff changeset
1 *******************************************************************************
551d1f5ca980 mark libvo2.txt as obsolete
attila
parents: 7727
diff changeset
2 ******************************************************************************
551d1f5ca980 mark libvo2.txt as obsolete
attila
parents: 7727
diff changeset
3 WARNING: THIS FILE IS OBSOLETE, SEE libvo.txt INSTEAD
551d1f5ca980 mark libvo2.txt as obsolete
attila
parents: 7727
diff changeset
4 *******************************************************************************
551d1f5ca980 mark libvo2.txt as obsolete
attila
parents: 7727
diff changeset
5 *******************************************************************************
5586
6ce9c6231bdd updated
arpi
parents: 4091
diff changeset
6
6ce9c6231bdd updated
arpi
parents: 4091
diff changeset
7 ============================================================
6ce9c6231bdd updated
arpi
parents: 4091
diff changeset
8
7727
6face4250a29 better wording
arpi
parents: 5586
diff changeset
9 NOTE: the 'libvo2 from scratch' plan was abandoned, we're changing libvo1 now.
5586
6ce9c6231bdd updated
arpi
parents: 4091
diff changeset
10
7727
6face4250a29 better wording
arpi
parents: 5586
diff changeset
11 So, this draft is ONLY A DRAFT, see libvo.txt for the current code docs!
5586
6ce9c6231bdd updated
arpi
parents: 4091
diff changeset
12
6ce9c6231bdd updated
arpi
parents: 4091
diff changeset
13 ============================================================
6ce9c6231bdd updated
arpi
parents: 4091
diff changeset
14
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
15 //First Announce by Ivan Kalvachev
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
16 //Some explanations by Arpi & Pontscho
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
17
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
18 If you have any suggestion related to the subjects in this document you
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
19 could send them to mplayer developer or advanced users mail lists. If you are
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
20 developer and have CVS access do not delete parts of this document, but you
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
21 could feel free to add paragraphs that you will sign with your name.
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
22 Be warned that the text could be changed, modified and your name could be
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
23 moved at the top of the document.
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
24
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
25 1.libvo2 drivers
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
26 1.1 functions
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
27 Currently these functions are implemented:
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
28 init
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
29 control
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
30 start
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
31 stop
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
32 get_surface
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
33 update_surface - renamed draw
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
34 show_surface - renamed flip_page
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
35 query
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
36 hw_decode
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
37 subpicture
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
38
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
39 Here is detailed description of the functions:
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
40 init - initialisation. It is called once on mplayer start
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
41 control - this function is message oriented interface for controlling the libvo2 driver
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
42 start - sets given mode and display it on the screen
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
43 stop - closes libvo2 driver, after stop we may call start again
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
44 query - the negotiation is more complex than just finding which imgfmt the
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
45 device could show, we must have list of capabilities, etc.
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
46 This function will have at least 3 modes:
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
47 a) return list with description of available modes.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
48 b) check could we use this mode with these parameters. E.g. if we want
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
49 RGB32 with 3 surfaces for windows image 800x600 we may get out of video
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
50 memory. We don't want error because this mode could be used with 2
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
51 surfaces.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
52 c) return supported subpicture formats if any.
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
53 +d) supported functionality by hw_decode
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
54
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
55 As you may see I have removed some functionality from control() and made
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
56 separate function. Why? It is generally good thing functions that are
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
57 critical to the driver to have it's own implementation.
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
58 get_surface - this function give us surfaces where we could write. In most
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
59 cases this is video memory, but it is possible to be and computer RAM, with
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
60 some special meaning (AGP memory , X shared memory, GL texture ...).
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
61
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
62 update_surface - as in the note above, this is draw function. Why I change
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
63 it's name? I have 2 reasons, first I don't want implementation like vo1,
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
64 second it really must update video surface, it must directly call the
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
65 system function that will do it. This function should work only with
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
66 slices, the size of slice should not be limited and should be passed
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
67 (e.g ystart, yend), if we want draw function, we will call one form libvo2
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
68 core, that will call this one with ystart=0; yend=Ymax;. Also some system
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
69 screen update functions wait for vertical retrace before return, other
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
70 functions just can't handle partial updates. In this case we should inform
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
71 libvo2 core that device cannot slice, and libvo2 core must take care of
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
72 the additional buffering and update_surface becomes usual draw function.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
73 When update_surface() is used with combination on get_surface(), ONLY VALID
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
74 POINTERS ARE THESE RETURNED BY get_surface(). Watch out with cropping.
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
75
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
76 show_surface - this functions is always called on frame change. it is used
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
77 to show the given surface on the screen.
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
78 If there is only one surface then it is always visible and this function
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
79 does nothing.
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
80
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
81 hw_decode - to make all dvb,dxr3, TV etc. developers happy. This function
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
82 is for you. Be careful, don't OBSEBE it, think and for the future, this
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
83 function should have and ability to control HW IDCT, MC that one day will
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
84 be supported and under linux. Be careful:)
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
85
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
86 subpicture - this function will place subtitles. It must be called once to
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
87 place them and once to remove them, it should not be called on every
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
88 frame, the driver will take care of this. Currently I propose this
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
89 implementation: we get array of bitmaps. Each one have its own starting
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
90 x, y and it's own height and width, each one (or all together) could be
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
91 in specific imgfmt (spfmt). THE BITMAPS SHOULD NOT OVERLAP! This may not
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
92 be hw limitation but sw subtitles may get confused if they work as 'c'
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
93 filter (look my libvo2 core). Anyway, so far I don't know hardware that
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
94 have such limitations, but it is safer to be so (and faster I think).
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
95 It is generally good to merge small bitmaps (like characters) in larger
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
96 ones and make all subtitles as one bitmap( or one bitmap for one subtitle line).
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
97 There will be and one for each OSD time & seek/brightness/contrast/volume bar.
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
98
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
99 1.2 control()
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
100 OK, here is list of some control()s that I think that could be useful:
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
101 SET_ASPECT
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
102 SET_SCALLE_X, SET_SIZE_X
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
103 SET_SCALLE_Y, SET_SIZE_Y
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
104 RESET_SIZE
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
105 GET/SET_POSITION_X
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
106 GET/SET_POSTIION_Y
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
107 GET/SET_RESOLUTION
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
108 GET/SET_DISPLAY
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
109 GET/SET_ATTRIBUTES
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
110 + GET/SET_WIN_DECORATION
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
111
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
112 Here is description of how these controls to be used:
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
113
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
114 SET_ASPECT - this is the move/video aspect, why not calculate it in
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
115 different place (mplayer.c) and pass the results to driver by
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
116 set_size_x/y. First this is only if hardware could scale. Second we may
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
117 need this value if we have TV and we won't calculate any new height and
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
118 width.
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
119
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
120 SET_SCALLE_X/Y - this is to enlarge/downscale the image, it WILL NOT
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
121 override SET_ASPECT, they will have cumulative effect, this could be used
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
122 for deinterlacing (HALF SIZE). Second if we want to zoom 200% we don't
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
123 want to lose aspect calculations. Or better SET_SCALLE to work with
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
124 current size?
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
125
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
126 SET_SIZE_X/Y - This is for custom enlarge, to save some scale calculation
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
127 and for more precise results.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
128
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
129 RESET_SIZE - Set the original size of image, we must call SET_ASPECT again.
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
130
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
131 GET/SET_POSOTION_X/Y - This if for windows only, to allow custom move on
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
132 window.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
133
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
134 GET/SET_RESOLUTION - change resolution and/or bpp if possible. To be used
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
135 for changing desktop resolution or the resolution of the current
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
136 fullscreen mode (NOT TO SET IT just to change it if we don't like it)
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
137
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
138 GET/SET_DISPLAY - mainly for X11 and remote displays. Not very useful, but
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
139 may be handy.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
140
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
141 GET/SET_ATTRIBUTES - Xv overlays have contrast, brightness, hue,
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
142 saturation etc. these and others could be controlled by this. If we want
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
143 to query it we must call GET_*, and the to check does our attribute is in
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
144 there (xv developers be careful, 2 or 3 of default attributes sometimes
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
145 are not queried by X, but could be set).
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
146
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
147 Do you think that TV encoding (NTSC,PAL,SECAM) should have it's own attribute?
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
148 I would like to hear the GUI developers. Could we separate Mouse/Keyboard
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
149 from the driver. What info do you need to do it. Don't forget that SDL have
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
150 it's own keyboard/mouse interface. Maybe we should allow video driver to
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
151 change the libin driver ?
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
152
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
153 <SOP>
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
154 Arpi wrote:
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
155 I've asked Pontscho (he doesn't understand english well...).
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
156 There is 2 option of GUI<->mplayer interface.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
157
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
158 The current, ugly (IMHO) way:
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
159 gui have the control of the video window, it does handle resizing, moving,
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
160 key events etc. all window manipulation in libvo drivers are disabled as gui
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
161 is enabled. it was required as libvo isn't inited and running when gui
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
162 already display the video window.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
163
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
164 The wanted way:
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
165 GUI shouldn't control the X window directly, it should use libvo2 control
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
166 calls to resize/move/etc it. But there is a big problem: X cannot be opened
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
167 twice from a process. It means GUI and libvo2 should share the X connection.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
168 And, as GUI run first (and when file is selected etc then libvo2 is started)
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
169 it should connect to X and later pass the connection to libvo2. It needs an
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
170 extra control() call and some extra code in mplayer.c
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
171
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
172 but this way gui could work with non-X stuff, like SDL, fbdev (on second
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
173 head for TVout etc), hardware decoders (dvb.dxr3) etc.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
174
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
175 as X is so special, libvo2 should have a core function to open/get an X
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
176 connection, and it should be used by all X-based X drivers and gui.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
177
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
178 also, GUI needs functions to get mouse and keyboard events, and to
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
179 enable/disable window decoration (title, border).
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
180
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
181 we need fullscreen switch control function too.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
182
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
183 > Maybe we should allow video driver to change the libin driver ?
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
184 forget libin. most input stuff is handled by libvo drivers.
12216
d4e2bdc246a3 -vo caca documentation, patch by Pigeon <pigeon@pigeond.net>
diego
parents: 9484
diff changeset
185 think of all X stuff (x11,xv,dga,xmga,gl), SDL, aalib, libcaca, svgalib.
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
186 only a few transparent drivers (fbdev, mga, tdfxfb, vesa) has not, but all
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
187 of them are running on console (and maybe on second head) at fullscreen, so
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
188 they may not need mouse events. console keyboard events are already catched
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
189 and handled by getch2.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
190
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
191 I can't see any sense of writing libin.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
192
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
193 mpalyer.c should _handle_ all input events, collected from lirc interface,
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
194 getch2, libvo2 etc. and it should set update flags, for gui and osd.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
195
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
196 but we should share some plugin code. examples: *_vid code, all common X
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
197 code. it can be either implementing them in libvo2 core (and called from
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
198 plugins) or include these files from all drivers which need it. later method
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
199 is a bit cleaner (from viewpoint of core-plugin independency) but results
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
200 bigger binaries...
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
201 <EOP, Arpi>
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
202
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
203 Btw. when we finish we will have libin, but it will be spread around mplayer.
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
204 I agree that libin could be build in in libvo2 driver, but there have to be
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
205 standart way to send commands to the mplayer itself.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
206
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
207
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
208 1.3. query()
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
209
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
210 Here come and some attributes for the queried modes, each supported mode
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
211 should have such description. It is even possible to have more than one mode
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
212 that could display given imgfmt. I think that we have to separate window from fullscreen
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
213 modes and to have yv12 mode for window and yv12 fullscreen mode. We need and naming
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
214 scheme, in order to have *.conf control over modes - to disable buggy modes, to limit
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
215 surfaces (buggy ones), to manually disable slices etc. The naming should not change from
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
216 one computer to another and have to be flexible.
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
217 {
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
218 IMGFMT - image format (RGB,YV12, etc...)
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
219
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
220 Height - the height of fullscreen mode or the maximum height of window mode
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
221
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
222 Width - the width of fullscreen mode or the maximum withd of window mode
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
223
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
224 }
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
225 {
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
226 Scale y/n - hardware scale, do you think that we must have one for x and
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
227 one for y (win does)?
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
228
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
229 Fullscreen y/n - if the supported mode is fullscreen, if we have yv12 for
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
230 fullscreen and window we must threat them as separate modes.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
231
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
232 Window y/n - The mode will show the image in a window. Could be removed as
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
233 it is mutually exclusive with Fullscreen
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
234
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
235 GetSurface y/n - if driver could give us video surface we'll use get_surface()
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
236
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
237 UpdateSurfece y/n - if driver will update video surface through sys function (X,SDL)
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
238
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
239 HWdecode y/n - if driver could take advantage of hw_decode()
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
240
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
241 MaxSurfaces 1..n - Theoretical maximum of surfaces
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
242
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
243 SubPicture y/n - Could we put subpicture (OSD) of any kind by hw
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
244
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
245 WriteCombine y/n - if GetSurface==yes, most (or all) pci&agp cards are
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
246 extremely slow on byte access, this is hint to vo2 core those surfaces
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
247 that got affected by WC. Some surfaces are in memory (X shm, OpenGL textures)
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
248 This is only a hint.
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
249
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
250 us_clip y/n - if UpdateSurface=yes, this shows could update_surface()
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
251 remove strides (when stride> width ), this is used and for cropping. If
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
252 not, we must do it.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
253
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
254 us_slice y/n - if UpdateSurface=yes, this shows that update_surface()
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
255 could draw slices and that after updating surface,it won't wait for
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
256 vertical retrace, so we could update surface slice by slice.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
257 If us_slice==n we will have to accumulate all slices in some buffer.
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
258
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
259 us_upsidedown - if UpdateSufrace=yes, this shows that update_suface()
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
260 could flip the image vertically. In some case this could be combined with
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
261 us_clip /stride tricks/
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
262
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
263 switch_resoliton y/n - if window=y, this shows could we switch resolution
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
264 of desktop, if fullscreen==y, shows that we could change resolution, after
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
265 we have set the fullscreen mode.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
266
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
267 deinterlace y/n - indicates that the device could deinterlace on it's own
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
268 (radeon, TV out).
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
269 }
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
270 1.4 conclusion
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
271
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
272 As you see, I have removed all additional buffering from the driver. There
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
273 is a lot of functionality that should be checked and handled by libvo2 core.
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
274 If some of the functionality is not supported the libvo2 core should add filters
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
275 that will support it by software.
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
276
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
277 Some of the parameters should be able to
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
278 be overridden by user config, mainly
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
279 to disable buggy modes or parameters. I
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
280 believe that this should not be done
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
281 by command line as there are enough
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
282 commands now.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
283
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
284 I wait comments and ideas.
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
285 //--------------------------------------------------------------------------
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
286 2. libvo2 core
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
287 2.1 functions
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
288 now these function are implemented:
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
289 init
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
290 new
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
291 start
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
292 query_format
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
293 close
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
294
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
295 and as draw.c:
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
296 choose_buffering
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
297 draw_slice_start
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
298 draw_slice
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
299 draw_frame
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
300 flip
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
301
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
302 init() is called at mplayer start. internal initialisation.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
303 new() -> rename to open_drv() or something like this.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
304 query_format -> not usable in this form, this function mean that all
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
305 negotiation will be performed outside libvo2. Replace or find better name.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
306 close -> open/close :)
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
307
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
308 choose_buffering - all buffering must stay hidden. The only exception is for
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
309 hw_decode. In the new implementation this functions is not usable.
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
310 It will be replaced with some kind of negotiation.
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
311 draw_slice_start, draw_slice -> if you like it this way, then it's OK. But i think that
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
312 draw_slice_done could help.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
313
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
314 draw_frame -> classic draw function.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
315
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
316 2.2 Minimal buffering
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
317
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
318 I should say that I stand after the idea all buffering, postprocessing,
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
319 format conversion , sw draw of subtitles, etc to be done in libvo2 core.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
320 Why? First this is the only way we could fully control buffering and
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
321 decrease it to minimum. Less buffers means less coping. In some cases this
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
322 could have the opposite effect (look at direct rendering).
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
323
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
324 The first step of the analyse is to find out what we need:
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
325
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
326 DECODER - num_out_buffers={1/2/3/...}
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
327 {
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
328 buffer_type:{fixed/static/movable}
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
329 read_only:{yes/no}
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
330 } * (num_out_buffers)
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
331 slice:{not/supported}
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
332
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
333 FILTER 1..x - processing:{ c-copy(buff1,buff2), p-process(buff1) },
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
334 slice:{not/supported}
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
335 write_combine:{not/safe},
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
336 runtime_remove:{static/dynamic}
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
337
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
338 VIDEO_OUT - method:{get_surface,update_surface},
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
339 slice:{not/supported},
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
340 write_combine:{not/safe},
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
341 clip:{can/not},
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
342 upsidedown:(can/not),
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
343 surfaces:{1/2/3,..,n}
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
344
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
345
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
346
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
347 I use one letter code for the type of filters. You could find them in filters section.
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
348 Details:
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
349
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
350 DECODER - We always get buffer from the decoder, some decoders could give
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
351 pointer to it's internal buffers, other takes pointers to buffers where
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
352 they should store the final image. Some decoders could call draw_slice
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
353 after they have finished with some portion of the image.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
354
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
355 num_out_buffers - number of output buffers. Each one could have it's own
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
356 parameters. In the usual case there will be only one buffer. Some
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
357 decoders may have 2 internal buffers like odivx, or like mpeg12 - 3 buffers
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
358 of different types(2 static and 1 temp).
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
359
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
360 buffer_type -
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
361 - fixed - we don't have control where the buffer will be. We could
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
362 just take pointer to this buffer. No direct rendering is possible.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
363 - static - we could set this buffer but then we can't change it's position.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
364 - movable - we could set this buffer to any location at any time.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
365 read_only - the data in this buffer will be used in future so we must not
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
366 try to write in there or we'll corrupt the video. If we have any 'p' kind
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
367 of filter we'll make copy.
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
368
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
369 slice - this flag shows that decoder knows and want to work with slices.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
370
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
371 FILTER - postprocessing, sw drawing subtitles, format conversion, crop,
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
372 external filters.
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
373
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
374 slice - could this filter work with slice order. We could use slice even
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
375 when decoder does not support slice, we just need 2 or more filters that
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
376 does. This could give us remarkable speed boost.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
377
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
378 processing - some filters can copy the image from one buffer to the other,
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
379 I call them 'c', convert and crop(stride copy) are good examples but don't
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
380 forget simple 1:1 copy. Other filters does process only part if the image,
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
381 and could reuse the given buffer, e.g. putting subtitles. I call them 'p'
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
382 Other filters could work in one buffer, but could work and with 2, I call
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
383 them 't' class, after analyse they will fade to 'c' or 'p'.
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
384
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
385 runtime_remove - postprocess with autoq. Subtitles appear and disappear,
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
386 should we copy image from one buffer to another if there is no processing
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
387 at all?
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
388
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
389 //clip, crop, upsidedown - all 'c' filters must support strides, and should
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
390 be able to remove them and to make some tricks like crop and upside_down.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
391
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
392 VIDEO_OUT - take a look of libvo2 driver I propose.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
393 method - If we get surface -'S'. If we use draw* (update_surface) - 'd'
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
394
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
395 As you may see hw_decode don't have complicated buffering:)
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
396
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
397 I make the analyse this way. First I put decoder buffer, then I put all
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
398 filters, that may be needed, and finally I put video out method. Then I add
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
399 temp buffers where needed. This is simple enough to be made on runtime.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
400
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
401 2.5 Various
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
402 2.5.1 clip&crop - we have x1,y1 that shows how much of the beginning and
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
403 x2,y2 how much of the end we should remove.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
404 plane+=(x1*sizeof(pixel))+(y1*stride);//let plane point to 1'st visible pixel
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
405 height-=y1+y2;
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
406 width-=x1+x2;
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
407 isn't is simple? no copy just change few variables. In order to make normal
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
408 plane we just need to copy it to frame where stide=width;
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
409
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
410 2.5.2 flip,upsidedown - in windows this is indicated by negative height, here
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
411 in mplayer we may use negative stride, so we must make sure that filters and
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
412 drivers could use negative stride
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
413 plane+=(width-1)*stride;//point to the last line
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
414 stride=-stride;//make stride point to previus line
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
415 and this one is very simple, and I hope that could work with all know image formats
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
416
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
417 BE careful, some modes may pack 2 pixels in 1 byte!
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
418 Other modes (YUYV) require y1 to be multiply of 2.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
419
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
420 stride is always in bytes, while width & height are in pixels
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
421
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
422 2.5.3 PostProcessing
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
423 Arpi was afraid that postprocessing needs more internal data to work. I think
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
424 that the quantization table should be passed as additional plane.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
425 How to be done this? When using Frame structure there is qbase that should point
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
426 to quantization table. The only problem is that usually the table is with fixed
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
427 size. I expect recommendations how to be properly implemented. should we crop it? Or add qstride, qheight, qwidth? Or mark the size of marcoblocks and
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
428 calc table size form image size? Currently pp work with fixed 8x8 blocks.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
429 There may have and problem with interlaced images.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
430 / for frame look at 2.3.4 /
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
431 I recommend splitting postprocessing to it's original filters and ability to
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
432 use them separately.
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
433
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
434 2.3. Rules for minimal buffering
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
435 2.3.1 Direct rendering.
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
436 Direct rendering means that the decoder will use video surface as output buffer.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
437 Most of the decoders have internal buffers and on request they copy
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
438 the ready image from one of them to a given location. As we can't get pointer
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
439 to the internal buffer the fastest way is to give video surface as
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
440 output buffer and the decoder will draw it for us. This is safe as most of
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
441 copy routines are optimised for double words aligned access.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
442 If we get internal buffer, we could copy the image on our own. This is not
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
443 direct rendering but it gets the same speed. If fact that's why -vc odivx
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
444 is faster that -vc divx4 while they use the same divx4linux library.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
445 Sometimes it's possible to set video surface as internal buffer, but in most
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
446 cases the decoding process is byte oriented and many unaligned access is
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
447 performed. Moreover, reading from video memory on some cards is extremely
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
448 slow, about 4 times and more (and this is without setting MTRR), but some
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
449 decoders could take advantage of this. In the best case (reading performed
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
450 from the cache and using combined write ) we'll watch DivX movie with the same
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
451 speed as DivX4 is skipping frames.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
452
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
453 What does we need for Direct Rendering?
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
454 1. We should be able to get video surfaces.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
455 2. The decoder should have at least one buffer with buffer_type != fixed.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
456 3. If we have 'c' filter we can not use direct rendering. If we have
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
457 'p' filter we may allow it.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
458 4. If decoder have one static buffer, then we are limited to 1 video surface.
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
459 In this case we may see how the frame is rendered (ugly refresh in best case)
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
460 5. Each static buffer and each read_only buffer needs to have it own
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
461 video surface. If we don't have enough ... well we may make some tricks
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
462 but it is too complicated //using direct rendering for the first in
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
463 the list and the rest will use memory buffering. And we must have (1 or 2 ) free
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
464 video surfaces for the rest of decoder buffers//
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
465 6. Normal (buffer_type=movable, read_only=no) buffer could be redirected to
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
466 any available video surface.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
467
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
468 2.3.2 Normal process
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
469 The usual case libvo2 core takes responsibility to move the data. It must
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
470 follow these rules:
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
471 1. The 'p' filters process in the buffer of the left, if we have read_only
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
472 buffer then vo2 core must insert 'c' copy filter and temp buffer.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
473 2. With 'c' filter we must make sure that we have buffer on the right(->) side. I think
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
474 that
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
475 3. In the usual case 't' are replaced with 'p' except when 't' is before video surface.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
476 We must have at least one 'c' if core have to make crop, clip, or flip image
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
477 upside down.
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
478 4. Take care for the additional buffering when we have 1 surface (the libvo1 way).
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
479 5. Be aware that some filters must be before other. E.g. Postporcessing should
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
480 be before subtitles:)
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
481 6. If we want scale (-zoom), and vo2 driver can't make it then add and scale
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
482 filter 'c'. For better understanding I have only one convert filter that can
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
483 copy, convert, scale, convert and scale. In mplayer it really will be only
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
484 one filter.
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
485 7. If we have video surface then the final 'c' filters will update it for us. If the filter
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
486 and video surface are not WriteCombine safe we may add buffering. In case we use both
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
487 get_surface and update_surface, after writing in video surface we must call and
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
488 update_sufrace() function.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
489
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
490 If we must update_surface() then we will call it with the last buffer. This buffer could
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
491 be and the internal decoder buffer if there are no 'c' filters. This buffer could be
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
492 returned and by get_surface().
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
493
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
494 2.3.3 Slices.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
495 Slice is a small rectangle of the image. In decoders world it represents
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
496 independently rendered portion of the image. In mplayer slice width is equal
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
497 to the image width, the height is usually 8 but there is no problem to vary.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
498 The slices advantage is that working with smaller part of the image the most
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
499 of data stays in the cache, so post processing would read the data for free.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
500 This makes slice processing of video data preferred even when decoder and/or
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
501 video driver couldn't work with slices.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
502 Smaller slices increase possibility of data to be in the cache, but also
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
503 increase the overhead of function calls( brunch prediction too), so it may be
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
504 good to tune the size, when it is possible (mainly at 2 filter slices)
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
505
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
506 Here are some rules:
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
507 1. Slices are always with width of the image
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
508 2. Slices always are one after another, so you could not skip few lines because
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
509 they are not changed. This is made for postprocessing filter as there may
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
510 have different output image based on different neighbourhood lines(slices).
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
511 3. Slice always finish with last line, this is extended of 2. rule.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
512 4. Slice buffers are normal buffers that could contain a whole frame. This is
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
513 need in case we have to accumulate slices for frame process (draw). This is
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
514 needed and for pp filters.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
515 5. Slice processing could be used if:
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
516 5.1. decoder know for slices and call function when one is completed. The next
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
517 filter (or video driver) should be able to work with slices.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
518 5.2. Two or more filters could work with slices. Call them one after another.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
519 The result will be accumulated in the buffer of the last filter (look down
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
520 for 'p' type)
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
521 5.3. If the final filter can slice and vo2_driver can slice
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
522 6. All filers should have independent counters for processed lines. These counters
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
523 must be controlled by vo2 core.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
524
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
525 2.3.3.1 Slice counters.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
526 For the incoming image we need:
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
527 1. value that show the last valid line.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
528 2. value that show the line from where filter will start working. It is updated by the
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
529 filter to remember what portion of the image is processed. Vo2 core will zero it
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
530 on new frame.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
531
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
532 For the result image we need:
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
533 1. value that show which line is ready. This will be last valid line for next filter.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
534
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
535 The filter may need more internal variables. And as it may be used 2 or more times
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
536 in one chain it must be reentrant. So that internal variables should be passed to
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
537 filter as parameter.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
538
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
539 2.3.3.2 Auto slice.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
540 In case we have complete frame that will be processed by few filters that support slices, we must start processing this frame slice by slice. We have same situation
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
541 when one filter accumulates too many lines and forces the next filters to work with bigger slice.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
542 To avoid that case and to automatically start slicing we need to limit the slice size
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
543 and when slice is bigger to break it apart. If some filter needs more image lines then
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
544 it will wait until it accumulates them.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
545
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
546 2.3.4. Frame structure
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
547 So far we have buffer, that contain image, we have filters that work with
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
548 buffers. For croping and for normal work with the image data we need to know
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
549 dimensions of the image. We also need some structure to pass to the filters as
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
550 they have to know from where to read, and where they should write.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
551 So I introduce Frame struct:
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
552 {
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
553 imgfmt - the image format, the most important parameter
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
554 height, width - dimensions in pixel
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
555 stride - size of image line in bytes, it could be larger then width*sizeof(pixel),
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
556 it could be and negative (for vertical flip)
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
557 base0,base1,base2,base3 - pointers to planes, thay depend on imgfmt
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
558 baseq - quant storage plane. we may need to add qstride, or some qhight/qwidth
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
559 palette - pointer to table with palette colors.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
560 flags read-only - this frame is read only.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
561 //screen position ??
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
562 }
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
563
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
564
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
565 2.4 Negotiation
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
566 Few words about negotiation. It is hard thing to find the best mode. Here is
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
567 algorithm that could find the best mode. But first I must say that we need
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
568 some kind of weight for the filters and drawing. I think that we could use
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
569 something like megabytes/second, something that we may measure or benchmark.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
570
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
571 1. We choose codec
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
572 2. We choose video driver.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
573 3. For each combination find the total weight and if there are any
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
574 optional filters find min and max weight. Be careful max weight is not
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
575 always at maximum filters!! (e.g. cropping)
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
576 4. Compare the results.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
577
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
578 I may say that we don't need automatic codec selection as now we could put
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
579 best codecs at beginning of codecs.conf as it is now. We may need to make
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
580 the same thing with videodrv.conf. Or better make config files with preferred
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
581 order of decoders and video modes:)
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
582
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
583 I wait comments and ideas.