<div dir="ltr"><div dir="ltr">Hi Laurent,<br clear="all"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Aug 26, 2020 at 3:06 AM Laurent Pinchart <<a href="mailto:laurent.pinchart@ideasonboard.com">laurent.pinchart@ideasonboard.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Show,<br>
<br>
On Tue, Aug 25, 2020 at 05:21:38PM +0800, Show Liu wrote:<br>
> Hi Laurent,<br>
> <br>
> Thanks for your review.<br>
> <br>
> On Mon, Aug 24, 2020 at 8:11 AM Laurent Pinchart wrote:<br>
> > On Sat, Aug 22, 2020 at 12:15:59AM +0800, Show Liu wrote:<br>
> > > Hi,<br>
> > ><br>
> > > This is the version 4 patchset for qcam to accelerate the YUV format conversion<br>
> > > by OpenGL shader. Most of the modifications are according to the comments<br>
> > > and suggestions from V3.<br>
> > > And the big change is using the QOpenGLFramebufferObject with QOffscreenSurface<br>
> > > instead of the QOpenGLWidget, the main reason that use dynamic_cast<br>
> > > to get the viewfinder_ is really weird.<br>
> > > In this version, OpenGL rendering enabled by --render=gles,<br>
> > > and if any error occurs during OpenGL configuration, it will return to use QT rendering.<br>
> > > But compared with the previous version, this version performance dropped a lot<br>
> > > due to I using the toImage() function to get the image when rendering complete,<br>
> > > it's really an inefficient operation. the framerate down to 16.x ~ 18.x fps(1280 x 800).<br>
> > > I am still trying to improve this performance issue. Any suggestions are welcome.<br>
> ><br>
> > Isn't it expected though if you render to an off-screen surface and then<br>
> > convert it to a QImage ? What was the issue with rendering directly on<br>
> > the screen with QOpenGLWidget ? Just the dynamic cast ?<br>
> <br>
> Some other reasons are like:<br>
> 1. The viewfinder and viewfinderGL are very similar, too many parts are<br>
> duplicate.<br>
> 2. My idea is that if viewfinder is able to handle both Qt and OpenGL<br>
> rendering would be perfect.<br>
>     The original processing flow when viewfinder got a new frame from<br>
> camera is like below<br>
>           Frame -> rendering -> call update() -> paintEvent( painting)<br>
>     But in QOpenGLWidget way, the processing flow become<br>
>           Frame -> call update() -> rendering and painting in paintGL()<br>
>     That's why I try to render into off-screen to fit the original<br>
> viewfinder process flow.<br>
> <br>
> BUT honestly it seems not a good idea to render to an external off screen surface<br>
> then convert to QImage due to the performance issue. I am trying to find some way<br>
> to paint the QOpenGLFramebufferObject directly.<br>
> <br>
> OR just letting the viewfinder inherit from QOpenGLWidgetand QOpenGLFunctions<br>
> and make it able to handle Qt and OpenGL rendering both.<br>
> I am still trying to figure out a good solution for that.<br>
<br>
How about starting with a ViewfinderGL implementation that duplicates<br>
code from the existing Viewfinder class, to get the feature merged, and<br>
then reworking both classes on top to reduce code duplication ? I can<br>
help with the latter.<br></blockquote><div><br></div><div>Sounds Great.</div><div>I will have the next version based on viewfinderGL ASAP.</div><div><br></div><div><div><div dir="ltr" class="gmail_signature"><div dir="ltr">Best Regards,<div>Show Liu</div></div></div></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
> > > Show Liu (3):<br>
> > >   qcam: add OpenGL shader code as QT resource<br>
> > >   qcam: add OpenGL renderer<br>
> > >   qcam: use the OpenGL renderer as NV family YUV format converter<br>
> > ><br>
> > >  src/qcam/assets/shader/NV_2_planes_UV_f.glsl |  32 ++<br>
> > >  src/qcam/assets/shader/NV_2_planes_VU_f.glsl |  32 ++<br>
> > >  src/qcam/assets/shader/NV_3_planes_UV_f.glsl |  33 ++<br>
> > >  src/qcam/assets/shader/NV_3_planes_VU_f.glsl |  33 ++<br>
> > >  src/qcam/assets/shader/NV_vertex_shader.glsl |  16 +<br>
> > >  src/qcam/assets/shader/shaders.qrc           |  10 +<br>
> > >  src/qcam/main.cpp                            |   3 +<br>
> > >  src/qcam/main_window.cpp                     |   2 +<br>
> > >  src/qcam/main_window.h                       |   1 +<br>
> > >  src/qcam/meson.build                         |   3 +<br>
> > >  src/qcam/renderer.cpp                        | 346 +++++++++++++++++++<br>
> > >  src/qcam/renderer.h                          |  81 +++++<br>
> > >  src/qcam/viewfinder.cpp                      |  46 ++-<br>
> > >  src/qcam/viewfinder.h                        |  10 +<br>
> > >  14 files changed, 640 insertions(+), 8 deletions(-)<br>
> > >  create mode 100644 src/qcam/assets/shader/NV_2_planes_UV_f.glsl<br>
> > >  create mode 100644 src/qcam/assets/shader/NV_2_planes_VU_f.glsl<br>
> > >  create mode 100644 src/qcam/assets/shader/NV_3_planes_UV_f.glsl<br>
> > >  create mode 100644 src/qcam/assets/shader/NV_3_planes_VU_f.glsl<br>
> > >  create mode 100644 src/qcam/assets/shader/NV_vertex_shader.glsl<br>
> > >  create mode 100644 src/qcam/assets/shader/shaders.qrc<br>
> > >  create mode 100644 src/qcam/renderer.cpp<br>
> > >  create mode 100644 src/qcam/renderer.h<br>
<br>
-- <br>
Regards,<br>
<br>
Laurent Pinchart<br>
</blockquote></div></div>