[vlc-devel] [PATCH] vout: opengl: add NV12/NV12 support

Thomas Guillem thomas at gllm.fr
Thu Dec 8 19:55:51 CET 2016



On Sun, Dec 4, 2016, at 11:40, Rémi Denis-Courmont wrote:
> Le dimanche 4 décembre 2016, 11:13:43 Thomas Guillem a écrit :
> > > I have not had time to read my OpenGL paper book, so I can't comment on
> > > the OpenGL aspects. But I think that the file is getting much too big,
> > > but I don't like meaningless splits with tight dependencies between files
> > > either :/
> > > 
> > > I would though think that chroma conversion belongs in a separate
> > > conversion plugin. It might not be feasible without an opaque OpenGL
> > > texture chroma type however.
> > > 
> > > Also, NV12 specifically is a hardware decoder output format. For sure, it
> > > needs to be supported eventually... But does it really make sense at this
> > > point, that the OpenGL output does not support pass-through, so the NV12
> > > will be copied anyway. If copied, then conversion to I420 can be done on
> > > the fly for free in SIMD. IIRC, Laurent even implemented that for x86
> > > already.
> > 
> > Not really free, there is an extra memcpy when doing NV12 -> I420.
> 
> NV12->NV12 would need a copy in vlc_va_Extract() or equivalent, AFAIR. It 
> wouldn't make sense for a software decoder to output NV12.
> 
> So why would there be an extra memcpy()? The SIMD code should copy and
> convert 
> at the same time. Conversion from NV12 to I420 is really trivial.
> 
> IMO, this shader is vain until we have pass-through from hardware decoder
> to 
> OpenGL. And by then, we should have a less monolithic OpenGL code base,
> so to 
> speak.

I was able to get Android MediaCodec render into an OpenGL texture
directly.
See the proof of concept here:
https://github.com/tguillem/vlc/commit/c19b345b5d53845be443df6c3fbac64e538b0d4b
Before integrating this commit, I must refactor opengl sources to be
less monolithic like Remi said.

I started the heavy refactor of opengl, see here
https://github.com/tguillem/vlc/commits/gl-fmt
It's still WIP, I'm not happy with the naming of the new structs and
didn't check that everything is cleaned-up, but you can still get the
idea. I added opengl_fmt.c (bad name) that handle yuv and xyz12
formats/shaders/shader parameters. I'll also add a new source:
opengl_android.c that will handle the Android Opaque format. For the
Android format, I'll also need to override the GetPool function.

> 
> P.S.: also patch title is wrong
> 
> -- 
> Rémi Denis-Courmont
> http://www.remlab.net/
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list