[gl/renderer] - pass the video orientation down to the gl renderer and... #1144

merged 4 commits into from Aug 1, 2012

3 participants

Team Kodi member

...rotate the video texture accordingly.

This is not complete. Its for getting some feedback from more experienced devs. Its ment to finally close the trac ticket http://trac.xbmc.org/ticket/12231

  1. This only implements rotation for OpenGL - i know. But i'm unsure if everything is right here. It crashs when using the Software Renderer (during libswscale) - i have no clue why this could happen.

  2. I didn't get the knot out of my brain for reordering the points for GLES - there we use triangles and i just have not a freaken idea how to handle it correctly there.

  3. All the GL HW Renderers are adapted blindly.

All in all i'm more then unsure with this stuff and hope someone can guide me.

Team Kodi member

Ok updated once more. I decided the following approach

  1. Use CPoint[4]
  2. Leave m_destRect untouched
  3. Let the baseclass do the rotation - with option of overwriting in e.x. gles renderer (still no solution there with the triangle points)

I also adapted the winrenderer.

Its still assuming that pixels are square. Any hint on how to get the pixel aspect ratio?

Furthermore its still crashing when using gl software rendering (guess what - its swscale again - but a different thing this time - i have the feeling the cachedcontext stuff might be wonky).

Team Kodi member

Successfully tested so far:

OSX: all renderings working, beside software rendering is crashing in swscale - VDA needs testing (don't have a mashine with VDA support)
Linux: all renderings are working including software rendering (no crash in swscale here - strange) and VDPAU
Windows: to be tested in software rendering (no DXVA support - maybe someone could give hints?)
GLES: to be implemented

If anyone wants to test - i have orientated movies in my folder on the teamftp...

Team Kodi member

Ok - sorted the gles orientation aswell.

Works with VTB and GLSL singlepass (no other settings available on ios).

Untested is OpenMax (should work ^^).
Untested aswell multipass (which isn't even hooked up in gles renderer) and software modes - no clue which devices with gles support these.

Team Kodi member

Once again windows is completly different. Rotation works with Software rendering, but doesn't with Pixel Shader or DXVA setting.

I was not able to figure out an easy way howto rotate on render with these 2 settings. @elupus do you have any idea how we can make windows working?

If not i'm willing to merge this someday even if video rotation is not working on all our renderers.

Team Kodi member

Not really no. DXVA probably have something built in to do it. But can't say i know how. For pixelshader case it aught to be in CYUV2RGBShader::PrepareParameters WinShaders.cpp

Team Kodi member

Ok thx @elupus added rotation for pixel shader rendering on windows (and tested briefly).


tested working under VDA (nvidia) on osx for all four orientation test files.

Team Kodi member

thx davilla for the test. So the only things which are untested are vaapi and omxplayer. But the fact that all others worked and the approach is the same on all of these i think they will just work.[tm]

So if any one could give a hint on how to determine the pixel aspect ratio i could take it into account in the calculation.

The question is if the autorotation of videos should be an option like we have for pictures already?

Team Kodi member

Ok i have added an optimisation so that the draw points are only recalculated if either destrect or orientation changes (before it was calculated on each frame).

Beside that i added a new Renderfeature RENDERFEATURE_ROTATION to the renderers and use this to determine if the renderer supports rotating the video.

I also added a new filter FILTER_ROTATE to the codecs.

If the renderer doesn't support rotation the filter will be set in the codec instead. For FFMPEG codec i have implemented support for this filter already.

This fixes rotation when rendering with DXVA under windows. Though this still doesn't work when hardware decoding is enabled and the renderer doesn't support orientation (so to say - it doesn't work for DXVA2 hw decoding).

Am i still on track guys? ;)

Not much more todo imho. Basically every constellation on every platform should be able to handle videos with orientation with this PR, but windows with dxva2 hw doesn't.

I've also tested VAAPI - though my test movies didn't get decoded with it, i can confirm that normal oriented movies are still working with VAAPI ;)

@Memphiz Memphiz was assigned Jul 24, 2012
Team Kodi member

@jmarshallnz i guess i found out that i can get the pixel aspect ratio by using g_graphicsContext.GetScalingPixelRatio(); ... but i don't get how to apply it to that diff value. I bet you know :)

Memphiz added some commits Jul 18, 2012
@Memphiz Memphiz [gl/gles/win/renderer] - pass the video orientation down to the gl re…
…nderer and rotate the video texture accordingly, this handles linuxgl (software, vaapi, vdpau, vda), linuxgles (software, vtb) and windows gl renderers (all except DXVA2 hw decoder) - fixes #12231
@Memphiz Memphiz [baserenderer] - make Supports(ERENDERFEATURE) a virtual member of ba…
…serenderer (defaulting to return false)

- in BaseRenderer if the renderer doesn't support RENDERFEATURE_ROTATION - don't rotate the draw points but treat it as 0 degree rotation
@Memphiz Memphiz [renderers] - GL, GLES support RENDERFEATURE_ROTATION for all renderm…
…ethods, windows for all but DXVA rendering
@Memphiz Memphiz [filter] - add a new codec filter FILTER_ROTATE, in dvdplayervideo pr…
…ocess if the renderer doesn't support rotation - set FILTER_ROTATE in codec flags

- for DVDVideoCodecFFmpeg use ffmpeg filters to rotate video based on the orientation hint when FILTER_ROTATE filter is set
@Memphiz Memphiz merged commit 99f7407 into xbmc:master Aug 1, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment