<div dir="ltr"><div dir="ltr">Hi Laurent,<div><br></div><div>Thanks for your review.</div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Aug 24, 2020 at 8:11 AM Laurent Pinchart <<a href="mailto:laurent.pinchart@ideasonboard.com" target="_blank">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 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></blockquote><div> </div><div>Some other reasons are like:</div><div>1. The viewfinder and viewfinderGL are very similar, too many parts are duplicate.</div><div>2. My idea is that if viewfinder is able to handle both Qt and OpenGL rendering would be perfect.</div><div>    The original processing flow when viewfinder got a new frame from camera is like below</div><div>          Frame -> rendering -> call update() -> paintEvent( painting)</div><div>    But in QOpenGLWidget way, the processing flow become</div><div>          Frame -> call update() -> rendering and painting in paintGL()</div><div>    That's why I try to render into off-screen to fit the original viewfinder process flow.</div><div>    </div><div>BUT honestly it seems not a good idea to render to an external off screen surface</div><div>then convert to QImage due to the performance issue. I am trying to find some way </div>to paint the QOpenGLFramebufferObject directly.</div><div class="gmail_quote"> </div><div class="gmail_quote">OR just letting the viewfinder inherit from QOpenGLWidget and QOpenGLFunctions</div><div class="gmail_quote">and make it able to handle Qt and OpenGL rendering both.</div><div class="gmail_quote">I am still trying to figure out a good solution for that.</div><div class="gmail_quote"><br></div><div class="gmail_quote"><br></div><div class="gmail_quote"><br clear="all"><div><div dir="ltr"><div dir="ltr">Best Regards,</div></div></div><div>Show Liu </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
> 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>