[MPlayer-dev-eng] New stereo output mode for OpenGL video driver

Reimar Döffinger Reimar.Doeffinger at gmx.de
Sat Dec 24 16:10:48 CET 2011


On Sat, Dec 24, 2011 at 03:48:33PM +0100, Wolfgang Draxinger wrote:
> On Fri, 23 Dec 2011 23:37:02 +0100
> Reimar Döffinger <Reimar.Doeffinger at gmx.de> wrote:
> > > You shouldn't be using tabs in this code.
> 
> Replaced them with spaces (though personally I prefer tabs ;).

The major reason against them is that you cannot realistically enforce
correct usage of tabs via a svn hook.
Thus you end up with a wild mix of tabs and space (which I think your patch
already contained) that surprisingly often looks crap in every editor
except the author's.
In contrast you can easily enforce use of only spaces.

> > > Also using the glAdjustAlignment function instead of
> > > GL_UNPACK_ALIGNMENT directly is more consistent with the rest of
> > > the code, even if it is a bit overkill.
> 
> glAdjustAlignment is a MPlayer helper function. By prefixing it with
> 'gl' it's technically violating the OpenGL namespace and may confuse
> people who don't know OpenGL, possible making them try to look it up in
> the OpenGL reference pages. So I strongly suggest to re-prefix the
> OpenGL helpers to something like 'mpglh'.
> 
> Also I feel more comfortable using glPixelStorei directly instead of
> some helper function. In fact I'm not even sure if that function should
> be there at all. There are some interactions between
> GL_[UN]PACK_ROW_LENGTH and GL_[UN]PACK_ALIGNMENT which may get obscured
> by such a function.

Maybe, maybe not. However wildly mixing and doing it one way once and in
another way in a different case is probably the worst possible way to do
it.
If there's an issue it can be quickly fixed if the same code is used
everywhere, when different code is used for the same thing you end up
with half-working, half-broken code quite quickly.

> I modified my patch according to your suggestions, but I'm still
> waiting for that stereo swap feature to show up in SVN, so I can
> incorporate those as well, before submitting.

Huh? It is in SVN since yesterday, r34463.

> On the topic stereo: So far MPlayer, well the OpenGL video output driver
> only supports Side-By-Side stereo. However there are also Over-Under
> and separate track stereo (the last being supported by Matroska for
> quite a long time).

There are far more methods, unfortunately.

> I think it would make more sense to decode stereo
> into separate textures instead of adjusting texture coordinates.

That requires a lot of changes.

> While
> adding Over-Under support is trivial, separate track support would
> require to first build a composit texture image (well glTexSubImage2D
> would do the trick).

As you say glTexSubImage2D would work for this.
In addition -vf stereo3d filter is there to do all those conversions.
The OpenGL implementation nowadays should be limited to
1) Things trivial to do in OpenGL (swapping left and right is an
example).
2) Things that would be an issue to do in the filter (e.g. due to
requiring scaling to be done before the filter, in software - the
support you added is an example).
3) Things not possible to do in the filter (quadbuffer stereo).

> But using multiple textures had other advantages
> as well. For example for accelerating things like Multi View Coding (3D
> BluRay), where one effectively receives a "merged" picture and
> "differences" to that.

That is not how MVC works, you won't be able to accelerate any of it in
OpenGL (well, not any more than you can accelerate H.264 decoding
itself).


More information about the MPlayer-dev-eng mailing list