annotate DOCS/tech/libvo2.txt @ 4091:696341879c3c

few changes, slice and frame
author iive
date Fri, 11 Jan 2002 18:30:35 +0000
parents c9aca79b7527
children 6ce9c6231bdd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
1 //First Announce by Ivan Kalvachev
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
2 //Some explanations by Arpi & Pontscho
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
3
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
4 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
5 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
6 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
7 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
8 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
9 moved at the top of the document.
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
10
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
11 1.libvo2 drivers
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
12 1.1 functions
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
13 Currently these functions are implemented:
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
14 init
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
15 control
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
16 start
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
17 stop
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
18 get_surface
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
19 update_surface - renamed draw
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
20 show_surface - renamed flip_page
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
21 query
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
22 hw_decode
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
23 subpicture
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
24
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
25 Here is detailed description of the functions:
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
26 init - initialisation. It is called once on mplayer start
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
27 control - this function is message oriented interface for controlling the libvo2 driver
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
28 start - sets given mode and display it on the screen
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
29 stop - closes libvo2 driver, after stop we may call start again
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
30 query - the negotiation is more complex than just finding which imgfmt the
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
31 device could show, we must have list of capabilities, etc.
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
32 This function will have at least 3 modes:
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
33 a) return list with description of available modes.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
34 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
35 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
36 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
37 surfaces.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
38 c) return supported subpicture formats if any.
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
39 +d) supported functionality by hw_decode
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
40
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
41 As you may see I have removed some functionality from control() and made
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
42 separate function. Why? It is generally good thing functions that are
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
43 critical to the driver to have it's own implementation.
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
44 get_surface - this function give us surfaces where we could write. In most
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
45 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
46 some special meaning (AGP memory , X shared memory, GL texture ...).
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
47
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
48 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
49 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
50 second it really must update video surface, it must directly call the
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
51 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
52 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
53 (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
54 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
55 screen update functions wait for vertical retrace before return, other
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
56 functions just can't handle partial updates. In this case we should inform
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
57 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
58 the additional buffering and update_surface becomes usual draw function.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
59 When update_surface() is used with combination on get_surface(), ONLY VALID
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
60 POINTERS ARE THESE RETURNED BY get_surface(). Watch out with cropping.
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
61
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
62 show_surface - this functions is always called on frame change. it is used
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
63 to show the given surface on the screen.
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
64 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
65 does nothing.
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
66
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
67 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
68 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
69 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
70 be supported and under linux. Be careful:)
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
71
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
72 subpicture - this function will place subtitles. It must be called once to
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
73 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
74 frame, the driver will take care of this. Currently I propose this
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
75 implementation: we get array of bitmaps. Each one have its own starting
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
76 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
77 in specific imgfmt (spfmt). THE BITMAPS SHOULD NOT OVERLAP! This may not
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
78 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
79 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
80 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
81 It is generally good to merge small bitmaps (like characters) in larger
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
82 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
83 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
84
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
85 1.2 control()
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
86 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
87 SET_ASPECT
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
88 SET_SCALLE_X, SET_SIZE_X
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
89 SET_SCALLE_Y, SET_SIZE_Y
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
90 RESET_SIZE
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
91 GET/SET_POSITION_X
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
92 GET/SET_POSTIION_Y
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
93 GET/SET_RESOLUTION
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
94 GET/SET_DISPLAY
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
95 GET/SET_ATTRIBUTES
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
96 + GET/SET_WIN_DECORATION
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
97
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
98 Here is description of how these controls to be used:
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
99
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
100 SET_ASPECT - this is the move/video aspect, why not calculate it in
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
101 different place (mplayer.c) and pass the results to driver by
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
102 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
103 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
104 width.
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
105
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
106 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
107 override SET_ASPECT, they will have cumulative effect, this could be used
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
108 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
109 want to lose aspect calculations. Or better SET_SCALLE to work with
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
110 current size?
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
111
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
112 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
113 and for more precise results.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
114
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
115 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
116
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
117 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
118 window.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
119
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
120 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
121 for changing desktop resolution or the resolution of the current
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
122 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
123
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
124 GET/SET_DISPLAY - mainly for X11 and remote displays. Not very useful, but
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
125 may be handy.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
126
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
127 GET/SET_ATTRIBUTES - Xv overlays have contrast, brightness, hue,
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
128 saturation etc. these and others could be controlled by this. If we want
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
129 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
130 there (xv developers be careful, 2 or 3 of default attributes sometimes
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
131 are not queried by X, but could be set).
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
132
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
133 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
134 I would like to hear the GUI developers. Could we separate Mouse/Keyboard
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
135 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
136 it's own keyboard/mouse interface. Maybe we should allow video driver to
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
137 change the libin driver ?
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
138
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
139 <SOP>
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
140 Arpi wrote:
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
141 I've asked Pontscho (he doesn't understand english well...).
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
142 There is 2 option of GUI<->mplayer interface.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
143
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
144 The current, ugly (IMHO) way:
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
145 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
146 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
147 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
148 already display the video window.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
149
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
150 The wanted way:
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
151 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
152 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
153 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
154 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
155 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
156 extra control() call and some extra code in mplayer.c
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 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
159 head for TVout etc), hardware decoders (dvb.dxr3) etc.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
160
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
161 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
162 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
163
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
164 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
165 enable/disable window decoration (title, border).
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
166
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
167 we need fullscreen switch control function too.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
168
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
169 > Maybe we should allow video driver to change the libin driver ?
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
170 forget libin. most input stuff is handled by libvo drivers.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
171 think of all X stuff (x11,xv,dga,xmga,gl), SDL, aalib, svgalib.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
172 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
173 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
174 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
175 and handled by getch2.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
176
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
177 I can't see any sense of writing libin.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
178
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
179 mpalyer.c should _handle_ all input events, collected from lirc interface,
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
180 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
181
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
182 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
183 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
184 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
185 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
186 bigger binaries...
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
187 <EOP, Arpi>
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
188
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
189 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
190 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
191 standart way to send commands to the mplayer itself.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
192
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
193
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
194 1.3. query()
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
195
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
196 Here come and some attributes for the queried modes, each supported mode
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
197 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
198 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
199 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
200 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
201 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
202 one computer to another and have to be flexible.
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
203 {
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
204 IMGFMT - image format (RGB,YV12, etc...)
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
205
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
206 Height - the height of fullscreen mode or the maximum height of window mode
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
207
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
208 Width - the width of fullscreen mode or the maximum withd of window mode
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
209
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
210 }
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
211 {
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
212 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
213 one for y (win does)?
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
214
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
215 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
216 fullscreen and window we must threat them as separate modes.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
217
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
218 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
219 it is mutually exclusive with Fullscreen
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
220
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
221 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
222
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
223 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
224
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
225 HWdecode y/n - if driver could take advantage of hw_decode()
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
226
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
227 MaxSurfaces 1..n - Theoretical maximum of surfaces
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
228
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
229 SubPicture y/n - Could we put subpicture (OSD) of any kind by hw
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
230
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
231 WriteCombine y/n - if GetSurface==yes, most (or all) pci&agp cards are
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
232 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
233 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
234 This is only a hint.
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
235
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
236 us_clip y/n - if UpdateSurface=yes, this shows could update_surface()
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
237 remove strides (when stride> width ), this is used and for cropping. If
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
238 not, we must do it.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
239
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
240 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
241 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
242 vertical retrace, so we could update surface slice by slice.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
243 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
244
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
245 us_upsidedown - if UpdateSufrace=yes, this shows that update_suface()
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
246 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
247 us_clip /stride tricks/
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
248
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
249 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
250 of desktop, if fullscreen==y, shows that we could change resolution, after
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
251 we have set the fullscreen mode.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
252
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
253 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
254 (radeon, TV out).
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
255 }
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
256 1.4 conclusion
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
257
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
258 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
259 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
260 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
261 that will support it by software.
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
262
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
263 Some of the parameters should be able to
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
264 be overridden by user config, mainly
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
265 to disable buggy modes or parameters. I
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
266 believe that this should not be done
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
267 by command line as there are enough
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
268 commands now.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
269
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
270 I wait comments and ideas.
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
271 //--------------------------------------------------------------------------
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
272 2. libvo2 core
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
273 2.1 functions
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
274 now these function are implemented:
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
275 init
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
276 new
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
277 start
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
278 query_format
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
279 close
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
280
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
281 and as draw.c:
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
282 choose_buffering
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
283 draw_slice_start
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
284 draw_slice
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
285 draw_frame
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
286 flip
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
287
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
288 init() is called at mplayer start. internal initialisation.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
289 new() -> rename to open_drv() or something like this.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
290 query_format -> not usable in this form, this function mean that all
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
291 negotiation will be performed outside libvo2. Replace or find better name.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
292 close -> open/close :)
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
293
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
294 choose_buffering - all buffering must stay hidden. The only exception is for
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
295 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
296 It will be replaced with some kind of negotiation.
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
297 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
298 draw_slice_done could help.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
299
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
300 draw_frame -> classic draw function.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
301
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
302 2.2 Minimal buffering
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
303
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
304 I should say that I stand after the idea all buffering, postprocessing,
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
305 format conversion , sw draw of subtitles, etc to be done in libvo2 core.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
306 Why? First this is the only way we could fully control buffering and
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
307 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
308 could have the opposite effect (look at direct rendering).
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
309
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
310 The first step of the analyse is to find out what we need:
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
311
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
312 DECODER - num_out_buffers={1/2/3/...}
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
313 {
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
314 buffer_type:{fixed/static/movable}
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
315 read_only:{yes/no}
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
316 } * (num_out_buffers)
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
317 slice:{not/supported}
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
318
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
319 FILTER 1..x - processing:{ c-copy(buff1,buff2), p-process(buff1) },
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
320 slice:{not/supported}
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
321 write_combine:{not/safe},
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
322 runtime_remove:{static/dynamic}
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
323
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
324 VIDEO_OUT - method:{get_surface,update_surface},
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
325 slice:{not/supported},
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
326 write_combine:{not/safe},
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
327 clip:{can/not},
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
328 upsidedown:(can/not),
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
329 surfaces:{1/2/3,..,n}
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
330
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
331
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
332
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
333 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
334 Details:
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
335
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
336 DECODER - We always get buffer from the decoder, some decoders could give
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
337 pointer to it's internal buffers, other takes pointers to buffers where
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
338 they should store the final image. Some decoders could call draw_slice
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
339 after they have finished with some portion of the image.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
340
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
341 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
342 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
343 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
344 of different types(2 static and 1 temp).
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
345
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
346 buffer_type -
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
347 - 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
348 just take pointer to this buffer. No direct rendering is possible.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
349 - 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
350 - 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
351 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
352 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
353 of filter we'll make copy.
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
354
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
355 slice - this flag shows that decoder knows and want to work with slices.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
356
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
357 FILTER - postprocessing, sw drawing subtitles, format conversion, crop,
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
358 external filters.
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
359
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
360 slice - could this filter work with slice order. We could use slice even
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
361 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
362 does. This could give us remarkable speed boost.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
363
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
364 processing - some filters can copy the image from one buffer to the other,
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
365 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
366 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
367 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
368 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
369 them 't' class, after analyse they will fade to 'c' or 'p'.
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
370
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
371 runtime_remove - postprocess with autoq. Subtitles appear and disappear,
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
372 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
373 at all?
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
374
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
375 //clip, crop, upsidedown - all 'c' filters must support strides, and should
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
376 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
377
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
378 VIDEO_OUT - take a look of libvo2 driver I propose.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
379 method - If we get surface -'S'. If we use draw* (update_surface) - 'd'
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
380
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
381 As you may see hw_decode don't have complicated buffering:)
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
382
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
383 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
384 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
385 temp buffers where needed. This is simple enough to be made on runtime.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
386
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
387 2.5 Various
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
388 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
389 x2,y2 how much of the end we should remove.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
390 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
391 height-=y1+y2;
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
392 width-=x1+x2;
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
393 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
394 plane we just need to copy it to frame where stide=width;
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
395
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
396 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
397 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
398 drivers could use negative stride
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
399 plane+=(width-1)*stride;//point to the last line
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
400 stride=-stride;//make stride point to previus line
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
401 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
402
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
403 BE careful, some modes may pack 2 pixels in 1 byte!
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
404 Other modes (YUYV) require y1 to be multiply of 2.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
405
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
406 stride is always in bytes, while width & height are in pixels
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
407
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
408 2.5.3 PostProcessing
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
409 Arpi was afraid that postprocessing needs more internal data to work. I think
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
410 that the quantization table should be passed as additional plane.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
411 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
412 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
413 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
414 calc table size form image size? Currently pp work with fixed 8x8 blocks.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
415 There may have and problem with interlaced images.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
416 / for frame look at 2.3.4 /
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
417 I recommend splitting postprocessing to it's original filters and ability to
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
418 use them separately.
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
419
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
420 2.3. Rules for minimal buffering
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
421 2.3.1 Direct rendering.
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
422 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
423 Most of the decoders have internal buffers and on request they copy
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
424 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
425 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
426 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
427 copy routines are optimised for double words aligned access.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
428 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
429 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
430 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
431 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
432 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
433 performed. Moreover, reading from video memory on some cards is extremely
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
434 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
435 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
436 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
437 speed as DivX4 is skipping frames.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
438
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
439 What does we need for Direct Rendering?
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
440 1. We should be able to get video surfaces.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
441 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
442 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
443 'p' filter we may allow it.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
444 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
445 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
446 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
447 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
448 but it is too complicated //using direct rendering for the first in
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
449 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
450 video surfaces for the rest of decoder buffers//
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
451 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
452 any available video surface.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
453
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
454 2.3.2 Normal process
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
455 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
456 follow these rules:
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
457 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
458 buffer then vo2 core must insert 'c' copy filter and temp buffer.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
459 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
460 that
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
461 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
462 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
463 upside down.
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
464 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
465 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
466 be before subtitles:)
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
467 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
468 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
469 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
470 one filter.
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
471 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
472 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
473 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
474 update_sufrace() function.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
475
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
476 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
477 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
478 returned and by get_surface().
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
479
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
480 2.3.3 Slices.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
481 Slice is a small rectangle of the image. In decoders world it represents
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
482 independently rendered portion of the image. In mplayer slice width is equal
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
483 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
484 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
485 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
486 This makes slice processing of video data preferred even when decoder and/or
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
487 video driver couldn't work with slices.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
488 Smaller slices increase possibility of data to be in the cache, but also
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
489 increase the overhead of function calls( brunch prediction too), so it may be
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
490 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
491
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
492 Here are some rules:
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
493 1. Slices are always with width of the image
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
494 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
495 they are not changed. This is made for postprocessing filter as there may
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
496 have different output image based on different neighbourhood lines(slices).
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
497 3. Slice always finish with last line, this is extended of 2. rule.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
498 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
499 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
500 needed and for pp filters.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
501 5. Slice processing could be used if:
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
502 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
503 filter (or video driver) should be able to work with slices.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
504 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
505 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
506 for 'p' type)
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
507 5.3. If the final filter can slice and vo2_driver can slice
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
508 6. All filers should have independent counters for processed lines. These counters
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
509 must be controlled by vo2 core.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
510
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
511 2.3.3.1 Slice counters.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
512 For the incoming image we need:
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
513 1. value that show the last valid line.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
514 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
515 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
516 on new frame.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
517
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
518 For the result image we need:
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
519 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
520
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
521 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
522 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
523 filter as parameter.
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.2 Auto slice.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
526 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
527 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
528 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
529 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
530 it will wait until it accumulates them.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
531
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
532 2.3.4. Frame structure
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
533 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
534 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
535 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
536 they have to know from where to read, and where they should write.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
537 So I introduce Frame struct:
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
538 {
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
539 imgfmt - the image format, the most important parameter
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
540 height, width - dimensions in pixel
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
541 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
542 it could be and negative (for vertical flip)
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
543 base0,base1,base2,base3 - pointers to planes, thay depend on imgfmt
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
544 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
545 palette - pointer to table with palette colors.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
546 flags read-only - this frame is read only.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
547 //screen position ??
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
548 }
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
549
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
550
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
551 2.4 Negotiation
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
552 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
553 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
554 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
555 something like megabytes/second, something that we may measure or benchmark.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
556
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
557 1. We choose codec
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
558 2. We choose video driver.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
559 3. For each combination find the total weight and if there are any
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
560 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
561 always at maximum filters!! (e.g. cropping)
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
562 4. Compare the results.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
563
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
564 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
565 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
566 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
567 order of decoders and video modes:)
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
568
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
569 I wait comments and ideas.