CN111640191A - Projection screen picture acquisition processing method based on VR (virtual reality) all-in-one machine - Google Patents

Projection screen picture acquisition processing method based on VR (virtual reality) all-in-one machine Download PDF

Info

Publication number
CN111640191A
CN111640191A CN202010506055.5A CN202010506055A CN111640191A CN 111640191 A CN111640191 A CN 111640191A CN 202010506055 A CN202010506055 A CN 202010506055A CN 111640191 A CN111640191 A CN 111640191A
Authority
CN
China
Prior art keywords
screen
picture
texture
screen projection
rendering thread
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202010506055.5A
Other languages
Chinese (zh)
Other versions
CN111640191B (en
Inventor
孙鹏飞
高磊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nanjing IQIYI Intelligent Technology Co Ltd
Original Assignee
Nanjing IQIYI Intelligent Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nanjing IQIYI Intelligent Technology Co Ltd filed Critical Nanjing IQIYI Intelligent Technology Co Ltd
Priority to CN202010506055.5A priority Critical patent/CN111640191B/en
Publication of CN111640191A publication Critical patent/CN111640191A/en
Application granted granted Critical
Publication of CN111640191B publication Critical patent/CN111640191B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T19/00Manipulating 3D models or images for computer graphics
    • G06T19/006Mixed reality
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Graphics (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Image Generation (AREA)
  • Processing Or Creating Images (AREA)

Abstract

本发明公开了一种基于VR一体机的投录屏画面采集处理方法,将3D应用的更新画面投放到投屏模块中,在进行画面更新的同时,还可以实现同一进程下的不同线程共享纹理资源。相对于现有技术而言,本发明的技术方案其能灵活处理多重投屏请求,且能完美适配目标投屏端的尺寸。同时采集处理的画面清晰完整,没有大黑边,对系统渲染负载影响小。无论是用户使用,还是制作宣发材料都是非常好的方案。

Figure 202010506055

The invention discloses a method for capturing and processing a screen projection screen based on a VR all-in-one machine. The updated screen of a 3D application is put into a screen projection module, and while the screen is updated, different threads in the same process can also share textures. resource. Compared with the prior art, the technical solution of the present invention can flexibly handle multiple screen projection requests, and can perfectly adapt to the size of the target screen projection terminal. At the same time, the captured and processed images are clear and complete, without large black borders, and have little impact on the system rendering load. Whether it is used by users or made publicity materials, it is a very good solution.

Figure 202010506055

Description

基于VR一体机的投录屏画面采集处理方法A method of capturing and processing screen recording images based on VR all-in-one machine

技术领域technical field

本发明涉及VR技术领域,尤其涉及一种基于VR一体机的投录屏画面采集处理方法。The present invention relates to the technical field of VR, and in particular, to a method for capturing and processing a recording screen based on a VR all-in-one machine.

背景技术Background technique

VR(Virtual Reality,虚拟现实技术),是一种可以创建和体验虚拟世界的计算机仿真系统,它利用计算机生成一种模拟环境,是一种多源信息融合的、交互式的三维动态视景和实体行为的系统,使用户沉浸到该仿真环境中。VR (Virtual Reality, virtual reality technology) is a computer simulation system that can create and experience virtual worlds. It uses computers to generate a simulation environment, which is a multi-source information fusion, interactive three-dimensional dynamic vision and A system of entity behavior that immerses the user in the simulation environment.

VR设备在进行画面投屏处理时,可将一体机内的单眼画面投到外部设备或者录制成视频文件。目前常见的投屏处理方式有两种:现有技术中的第一种方式为:一种是借助android系统的虚拟屏幕直接录制整个屏幕作为画面来源。现有技术中的第二种方式:借助android系统的Presentation方案。Apk将要投出的画面渲染到一个单独的SurfaceView,然后将SurfaceView与具有Presentation的虚拟屏幕关联。最终将画面传递给虚拟屏幕。When the VR device performs screen projection processing, the single-eye image in the all-in-one machine can be projected to an external device or recorded as a video file. There are two common screen projection processing methods at present: the first method in the prior art is: one is to directly record the entire screen as a picture source with the help of the virtual screen of the android system. The second method in the prior art: using the Presentation solution of the android system. The Apk renders the screen to be cast to a separate SurfaceView, and then associates the SurfaceView with the virtual screen with Presentation. Finally pass the picture to the virtual screen.

但是很显然,现有技术的上述两种技术方案仍然存在一些客观的技术问题:上述第一种方式的技术缺陷在于:借助android系统的虚拟屏幕直接录制整个屏幕作为画面来源。这种方式最大的缺点是投出的画面是两个圆形的画面,接收端看到的图像不美观,用户体验差。上述第二种方式的技术缺陷在于:借助android系统的Presentation方案的缺点是渲染效率低,需要经过surfaceflinger,且不易增加后处理环节(例如:加水印)。具体地,图像数据传输经过surfaceflinger处理时,会有额外的拷贝apk的画面到虚拟屏幕之间的操作,数据传输延迟和系统负载都会增加,也会因为拷贝操作与apk的渲染同步并不完善会导致投出画面有画面撕裂现象。However, obviously, the above two technical solutions in the prior art still have some objective technical problems: the technical defect of the above-mentioned first method is that the entire screen is directly recorded by using the virtual screen of the android system as a picture source. The biggest disadvantage of this method is that the projected images are two circular images, the images seen by the receiving end are not beautiful, and the user experience is poor. The technical defect of the above-mentioned second method is: the disadvantage of the presentation scheme using the android system is that the rendering efficiency is low, the surfaceflinger needs to be passed, and it is not easy to add post-processing links (for example, adding watermarks). Specifically, when the image data transmission is processed by surfaceflinger, there will be an additional operation between copying the image of the apk to the virtual screen, the data transmission delay and system load will increase, and the synchronization between the copy operation and the rendering of the apk will not be perfect. Causes the projected screen to have screen tearing.

因此说,如何克服上述技术问题是本领域技术人员需要解决的问题。Therefore, how to overcome the above technical problems is a problem to be solved by those skilled in the art.

发明内容SUMMARY OF THE INVENTION

有鉴于此,本发明实施例提出一种基于VR一体机的投录屏画面采集处理方法,用以解决上述技术问题。In view of this, an embodiment of the present invention proposes a method for capturing and processing a screen recording image based on an all-in-one VR machine, so as to solve the above-mentioned technical problem.

本发明的一实施例提出一种基于VR一体机的投录屏画面采集处理方法,将3D应用的更新画面投放到投屏模块中,在进行画面更新的同时,还可以实现同一进程下的不同线程共享纹理资源,具体包括如下操作步骤:An embodiment of the present invention proposes a method for capturing and processing a screen-casting screen based on a VR all-in-one machine. The updated screen of a 3D application is put into the screen-casting module, and while the screen is updated, it is also possible to realize different images under the same process. Threads share texture resources, including the following steps:

步骤S100:后台投屏服务单元启动之后创建一个后台主渲染线程,同时再创建一个OpenGLES的纹理;所述OpenGLES的纹理作为数据中端的纹理区域用于提供共享的纹理资源;Step S100: after the background screen projection service unit is started, a background main rendering thread is created, and a texture of OpenGLES is created simultaneously; the texture of the OpenGLES is used as a texture area in the middle of the data for providing shared texture resources;

步骤S200:有投屏需求的投屏模块向后台投屏服务单元发送投屏请求;所述后台投屏服务单元对接收的投屏请求进行识别,识别出所述投屏请求中包含的Surface-x的ID编号和Surface-x其所需画面的尺寸信息;所述尺寸信息包括Surface-x所需投屏的高度尺寸和宽度尺寸;Step S200: The screencasting module that has a screencasting requirement sends a screencasting request to the background screencasting service unit; the background screencasting service unit identifies the received screencasting request, and identifies the Surface-Projection request included in the screencasting request. The ID number of x and the size information of the screen required by Surface-x; the size information includes the height size and width size of the screen required by Surface-x;

步骤S300:所述后台投屏服务单元在接收到步骤S200中的投屏请求之后,基于投屏请求中的Surface-x创建一个渲染线程A并与后台主渲染线程共享上下文;所述渲染线程A与所述后台主渲染线程共享上下文,用以共享后台主渲染线程中OpenGLES的纹理所记载的纹理资源;所述渲染线程A与所述Surface-x一一对应;在所述后台投屏服务单元中的其他渲染线程任意调用OpenGLES的纹理所记载的纹理资源;同时后台投屏服务单元会基于后台主渲染线程的OpenGLES的纹理再创建一个Surface-APP;Step S300: after receiving the screen projection request in step S200, the background screen projection service unit creates a rendering thread A based on the Surface-x in the screen projection request and shares the context with the background main rendering thread; the rendering thread A Share the context with the background main rendering thread to share the texture resources recorded by the texture of OpenGLES in the background main rendering thread; the rendering thread A corresponds to the Surface-x one-to-one; in the background screen projection service unit Other rendering threads in the OpenGL ES texture resources are called arbitrarily; at the same time, the background screen projection service unit will create a Surface-APP based on the OpenGLES texture of the background main rendering thread;

步骤S400:所述后台投屏服务单元通过AIDL接口把Surface-APP传递给3D应用,所述Surface-APP用于建立3D应用与后台投屏服务单元之间的信息链路连接;Step S400: the background screen projection service unit transfers the Surface-APP to the 3D application through the AIDL interface, and the Surface-APP is used to establish an information link connection between the 3D application and the background screen projection service unit;

步骤S500:所述3D应用其本身包括有3D主渲染线程,且所述3D应用收到Surface-APP之后,所述3D应用基于Surface-APP创建一个与3D主渲染线程共享上下文的渲染线程B;所述渲染线程B用于渲染绘制所述3D主渲染线程中单眼画面,将渲染后的单眼画面落在所述Surface-APP的画面上,以保障Surface-APP的画面进行更新处理,从而最终将更新画面添加到OpenGLES的纹理中。Step S500: the 3D application itself includes a 3D main rendering thread, and after the 3D application receives the Surface-APP, the 3D application creates a rendering thread B that shares a context with the 3D main rendering thread based on the Surface-APP; The rendering thread B is used to render and draw the monocular image in the 3D main rendering thread, and place the rendered monocular image on the Surface-APP image to ensure that the Surface-APP image is updated, so that the The update screen is added to the OpenGLES texture.

优选的,作为一种可实施方案;所述投屏模块包括Rtmp投屏模块、Miracast投屏模块。Preferably, as an implementable solution, the screen projection module includes an Rtmp screen projection module and a Miracast screen projection module.

优选的,作为一种可实施方案;在步骤S500中,还包括对更新画面进行剪裁处理,以适应投屏模块的尺寸的操作步骤:Preferably, as an implementable embodiment; in step S500, it also includes the operation steps of cropping the updated picture to fit the size of the screen projection module:

步骤S510:将更新画面添加到OpenGLES的纹理中后,调取目标的投屏模块的Surface-x中记载的尺寸信息;根据所述尺寸信息进行裁剪以保证更新画面尺寸与所述投屏模块适配。Step S510: After adding the update screen to the texture of OpenGLES, call the size information recorded in the Surface-x of the target screen projection module; crop according to the size information to ensure that the size of the update screen is suitable for the screen projection module. match.

优选的,作为一种可实施方案;在步骤S500中,还包括对更新画面进行添加logo水印处理的操作步骤:Preferably, as an implementable embodiment; in step S500, the operation steps of adding a logo watermark to the update screen are also included:

步骤S520:将更新画面添加到OpenGLES的纹理中后,获取需要添加的logo水印并添加到更新画面中,最后将更新画面投放到目标的投屏模块中。Step S520: After adding the update picture to the texture of OpenGLES, obtain the logo watermark to be added and add it to the update picture, and finally put the update picture into the target screen projection module.

优选的,作为一种可实施方案;在上述步骤S520中:所述获取需要添加的logo水印并添加到更新画面,具体包括如下操作步骤:Preferably, as an implementable embodiment; in the above step S520: the obtaining of the logo watermark that needs to be added and adding it to the update screen specifically includes the following operation steps:

步骤S5210:将更新画面添加到OpenGLES的纹理中后,所述渲染线程A获取需要添加的logo水印,将其添加到更新画面上,并将添加logo水印的画面整理到OpenGLES的纹理的纹理资源中;Step S5210: After adding the update picture to the texture of OpenGLES, the rendering thread A obtains the logo watermark to be added, adds it to the update picture, and organizes the picture with the logo watermark added into the texture resources of the texture of OpenGLES ;

步骤S5220:目标的投屏模块访问OpenGLES的纹理,根据其Surface-x的ID编号,调取与所述Surface-x的ID编号同一链路上对应的更新画面,将其投放到目标的投屏模块中。Step S5220: The target screen projection module accesses the texture of OpenGLES, and according to the ID number of its Surface-x, retrieves the update screen corresponding to the same link as the ID number of the Surface-x, and puts it on the target screen projection in the module.

本发明实施例存在如下技术优势:The embodiments of the present invention have the following technical advantages:

本发明实施例提出了一种基于VR一体机的投录屏画面采集处理方法的技术方案,至少包括如下两个方面的技术优势;The embodiment of the present invention proposes a technical solution for a method for capturing and processing a projected screen image based on an all-in-one VR machine, which at least includes the following technical advantages in the following two aspects;

一、本发明实施例提供的基于VR一体机的投录屏画面采集处理方法,其降低了系统渲染负载,具体降低系统渲染负载的原因主要是通过AIDL的接口将3D应用的画面传递给后台投屏服务,不经过surfaceflinger处理。二、本发明实施例提供的基于VR一体机的投录屏画面采集处理方法,其实现了同一进程中的不同渲染线程之间的共享纹理区域,从而简便了处理操作,降低了渲染存储空间,进一步降低了系统渲染负载;研究发现,现有技术中同一进程中的不同线程相互之间是隔离的,无法实现纹理的共享;因此本申请技术方案实施后,在同一进程内的其他后续创建的渲染线程也可以任意访问来分享后台主渲染线程中OpenGLES的纹理所记载的纹理资源。1. The method for capturing and processing a projected screen based on an all-in-one VR machine provided by the embodiment of the present invention reduces the system rendering load. The specific reason for reducing the system rendering load is mainly to pass the image of the 3D application to the background projection through the AIDL interface. Screen service, not processed by surfaceflinger. 2. The method for capturing and processing a video recording screen based on the VR all-in-one machine provided by the embodiment of the present invention realizes the shared texture area between different rendering threads in the same process, thereby simplifying the processing operation and reducing the rendering storage space. The system rendering load is further reduced; the research found that in the prior art, different threads in the same process are isolated from each other, and texture sharing cannot be achieved; therefore, after the technical solution of the present application is implemented, other subsequent creations in the same process The rendering thread can also freely access to share the texture resources recorded by the OpenGLES texture in the background main rendering thread.

附图说明Description of drawings

为了更清楚地说明本发明的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,应当理解,以下附图仅示出了本发明的某些实施例,因此不应被看作是对本发明保护范围的限定。在各个附图中,类似的构成部分采用类似的编号。In order to illustrate the technical solutions of the present invention more clearly, the accompanying drawings required in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention, and therefore should not be It is regarded as the limitation of the protection scope of the present invention. In the various figures, similar components are numbered similarly.

图1示出了本发明实施例基于VR一体机的投录屏画面采集处理方法的主要流程示意图;FIG. 1 shows a schematic flowchart of the main flow of a method for capturing and processing a screen shot based on a VR all-in-one machine according to an embodiment of the present invention;

图2示出了本发明实施例基于VR一体机的投录屏画面采集处理方法的控制原理结构示意图。FIG. 2 shows a schematic structural diagram of a control principle of a method for capturing and processing a screen shot based on an all-in-one VR machine according to an embodiment of the present invention.

标号:10-投屏模块;20-后台投屏服务单元;21-后台主渲染线程;22-OpenGLES的纹理;30-3D应用;31-3D主渲染线程。Labels: 10-screencasting module; 20-background screencasting service unit; 21-background main rendering thread; 22-OpenGLES texture; 30-3D application; 31-3D main rendering thread.

具体实施方式Detailed ways

下面将结合本发明实施例中附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, but not all of the embodiments.

通常在此处附图中描述和示出的本发明实施例的组件可以以各种不同的配置来布置和设计。因此,以下对在附图中提供的本发明的实施例的详细描述并非旨在限制要求保护的本发明的范围,而是仅仅表示本发明的选定实施例。基于本发明的实施例,本领域技术人员在没有做出创造性劳动的前提下所获得的所有其他实施例,都属于本发明保护的范围。The components of the embodiments of the invention generally described and illustrated in the drawings herein may be arranged and designed in a variety of different configurations. Thus, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the invention as claimed, but is merely representative of selected embodiments of the invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work fall within the protection scope of the present invention.

在下文中,可在本发明的各种实施例中使用的术语“包括”、“具有”及其同源词仅意在表示特定特征、数字、步骤、操作、元件、组件或前述项的组合,并且不应被理解为首先排除一个或更多个其它特征、数字、步骤、操作、元件、组件或前述项的组合的存在或增加一个或更多个特征、数字、步骤、操作、元件、组件或前述项的组合的可能性。Hereinafter, the terms "comprising", "having" and their cognates, which may be used in various embodiments of the present invention, are only intended to denote particular features, numbers, steps, operations, elements, components, or combinations of the foregoing, and should not be construed as first excluding the presence or addition of one or more other features, numbers, steps, operations, elements, components or combinations of the foregoing or the possibility of a combination of the foregoing.

此外,术语“第一”、“第二”、“第三”等仅用于区分描述,而不能理解为指示或暗示相对重要性。Furthermore, the terms "first", "second", "third", etc. are only used to differentiate the description and should not be construed as indicating or implying relative importance.

除非另有限定,否则在这里使用的所有术语(包括技术术语和科学术语)具有与本发明的各种实施例所属领域普通技术人员通常理解的含义相同的含义。所述术语(诸如在一般使用的词典中限定的术语)将被解释为具有与在相关技术领域中的语境含义相同的含义并且将不被解释为具有理想化的含义或过于正式的含义,除非在本发明的各种实施例中被清楚地限定。Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which various embodiments of this invention belong. The terms (such as those defined in commonly used dictionaries) will be interpreted as having the same meaning as the contextual meaning in the relevant technical field and will not be interpreted as having an idealized or overly formal meaning, unless explicitly defined in the various embodiments of the present invention.

实施例一Example 1

如图1所示,下面对本发明实施例一中的基于VR一体机的投录屏画面采集处理方法进行详细说明。As shown in FIG. 1 , the following describes in detail the method for capturing and processing a screen recording image based on the VR all-in-one machine in Embodiment 1 of the present invention.

本发明实施一提出一种基于VR一体机的投录屏画面采集处理方法,将3D应用的更新画面投放到投屏模块中,在进行画面更新的同时,还可以实现同一进程下的不同线程共享纹理资源,具体包括如下操作步骤:The first implementation of the present invention proposes a method for capturing and processing a screen projection screen based on a VR all-in-one machine. The updated screen of a 3D application is put into the screen projection module. While updating the screen, it can also realize the sharing of different threads under the same process. Texture resources, including the following steps:

步骤S100:后台投屏服务单元启动之后创建一个后台主渲染线程,同时再创建一个OpenGLES的纹理;所述OpenGLES的纹理作为数据中端的纹理区域用于提供共享的纹理资源;即需要说明的是,步骤S100中涉及的后台主渲染线程,其与步骤S500中的3D主渲染线程不同;renderthread是指的渲染线程RenderThread,他是一种安卓系统内的渲染线程。Step S100: After the background screen projection service unit is started, a background main rendering thread is created, and a texture of OpenGLES is created at the same time; the texture of the OpenGLES is used as a texture area at the middle end of the data to provide shared texture resources; that is, it should be noted that, The background main rendering thread involved in step S100 is different from the 3D main rendering thread in step S500; renderthread refers to the rendering thread RenderThread, which is a rendering thread in the Android system.

步骤S200:有投屏需求的投屏模块向后台投屏服务单元发送投屏请求;后台投屏服务单元对接收的投屏请求进行识别,识别出所述投屏请求中包含的Surface-x的ID编号和Surface-x其所需画面的尺寸信息;所述尺寸信息包括Surface-x所需投屏的高度尺寸和宽度尺寸;例如:所述投屏请求中包含了Surface-1以及Surface-1其所需画面的尺寸信息。另外一个投屏模块可能就会发送Surface-2以及Surface-2其所需画面的尺寸信息;(即Surface-x其中的x为数字即为ID编号);Step S200: The screencasting module that has a screencasting requirement sends a screencasting request to the background screencasting service unit; the background screencasting service unit identifies the received screencasting request, and identifies the Surface-x included in the screencasting request. ID number and size information of the screen required by Surface-x; the size information includes the height size and width size of the screen required by Surface-x; for example: the screen projection request includes Surface-1 and Surface-1 The size information of the desired screen. Another screen projection module may send Surface-2 and the size information of the desired screen of Surface-2; (that is, the x in Surface-x is the ID number);

步骤S300:所述后台投屏服务单元在接收到步骤S200中的投屏请求之后,基于投屏请求中的Surface-x创建一个渲染线程A并与后台主渲染线程共享上下文;所述渲染线程A与后台主渲染线程共享上下文,用以共享后台主渲染线程中OpenGLES的纹理所记载的纹理资源;所述渲染线程A与所述Surface-x一一对应;且所述渲染线程A还用于将附加logo添加到单眼画面上,并将绘制结果整理到OpenGLES的纹理的纹理资源中;在所述后台投屏服务单元中的其他渲染线程任意调用OpenGLES的纹理所记载的纹理资源;同时后台投屏服务单元会基于后台主渲染线程的OpenGLES的纹理再创建一个Surface-APP;上述投屏模块包括Rtmp投屏模块、Miracast投屏模块或者其他形式的投屏模块。Step S300: after receiving the screen projection request in step S200, the background screen projection service unit creates a rendering thread A based on the Surface-x in the screen projection request and shares the context with the background main rendering thread; the rendering thread A Share the context with the background main rendering thread to share the texture resources recorded by the texture of OpenGLES in the background main rendering thread; the rendering thread A is in one-to-one correspondence with the Surface-x; and the rendering thread A is also used to The additional logo is added to the monocular screen, and the drawing results are sorted into the texture resources of the OpenGLES texture; other rendering threads in the background screen projection service unit arbitrarily call the texture resources recorded by the OpenGLES texture; at the same time, the background screen projection The service unit will create a Surface-APP based on the OpenGLES texture of the background main rendering thread; the above screencasting modules include Rtmp screencasting modules, Miracast screencasting modules or other forms of screencasting modules.

步骤S400:所述后台投屏服务单元通过AIDL接口把Surface-APP传递给3D应用(或称3D应用APK),所述Surface-APP用于建立3D应用与后台投屏服务单元之间的信息链路连接;Step S400: the background screen projection service unit transfers the Surface-APP to the 3D application (or 3D application APK) through the AIDL interface, and the Surface-APP is used to establish an information link between the 3D application and the background screen projection service unit road connection;

步骤S500:所述3D应用其本身包括有3D主渲染线程,且所述3D应用收到Surface-APP之后,所述3D应用基于Surface-APP创建一个与3D主渲染线程共享上下文的渲染线程B;所述渲染线程B用于渲染绘制所述3D主渲染线程中单眼画面(或称单眼纹理,即3D应用每次变化画面都需要通过3D主渲染线程进行处理操作),将渲染后的单眼画面落在所述Surface-APP的画面上,以保障Surface-APP的画面进行更新处理,从而最终将更新画面添加到OpenGLES的纹理中;即需要说明的是,渲染线程B渲染绘制所述3D主渲染线程中单眼画面,将渲染后的单眼画面落在所述Surface-APP的画面上,以保障Surface-APP的画面进行更新处理,Surface-APP又是由所述后台服务单元中的OpenGLES的纹理实施创建的,所以后台服务单元也能获知Surface-APP的每帧画面数据变化,此时后台服务单元中的OpenGLES的纹理的内容就已经是最新的画面了。Step S500: the 3D application itself includes a 3D main rendering thread, and after the 3D application receives the Surface-APP, the 3D application creates a rendering thread B that shares a context with the 3D main rendering thread based on the Surface-APP; The rendering thread B is used to render and draw the monocular picture (or monocular texture, that is, every time the 3D application changes the picture, it needs to be processed by the 3D main rendering thread) in the 3D main rendering thread, and the rendered monocular picture is dropped. On the screen of the Surface-APP, to ensure that the screen of the Surface-APP is updated, so that the updated screen is finally added to the texture of OpenGLES; that is, it should be noted that the rendering thread B renders and draws the 3D main rendering thread. In the monocular picture, the rendered monocular picture is placed on the picture of the Surface-APP to ensure that the picture of the Surface-APP is updated, and the Surface-APP is created by the OpenGLES texture in the background service unit. , so the background service unit can also know the change of each frame of the Surface-APP image data. At this time, the content of the OpenGLES texture in the background service unit is already the latest image.

需要说明的是,前序步骤S100创建的后台主渲染线程、渲染线程A都是发生后台投屏服务单元的进程里面的,然而后来创建的3D主渲染线程、渲染线程B则是发生在3D应用的进程中;一方面3D应用基于Surface-APP创建了渲染线程B,那么渲染线程B中绘制单眼纹理,最终的画面结果都会落在Surface-APP上。下面进行举例说明:比如说渲染线程B以30FPS的帧率渲染,Surface-APP的画面就会以30FPS的帧率更新。另一方面,Surface-APP又是由后台服务单元实施创建的。所以后台服务单元也能获知Surface-APP的每帧画面数据变化,也就是说,3D应用的渲染线程B中每次更新画面,后台服务单元中都能收到系统通知,告知Surface-APP已经更新了。此时后台服务单元中的纹理1的内容就已经是最新的画面了。It should be noted that the background main rendering thread and rendering thread A created in the pre-procedure step S100 are in the process of the background screen projection service unit, but the 3D main rendering thread and rendering thread B created later are in the 3D application. On the one hand, the 3D application creates a rendering thread B based on the Surface-APP, then the single-eye texture is drawn in the rendering thread B, and the final picture result will fall on the Surface-APP. The following is an example: For example, rendering thread B renders at a frame rate of 30FPS, and the Surface-APP screen will be updated at a frame rate of 30FPS. On the other hand, Surface-APP is created by the background service unit implementation. Therefore, the background service unit can also know the changes of each frame of the Surface-APP, that is to say, every time the screen is updated in the rendering thread B of the 3D application, the background service unit can receive a system notification to inform that the Surface-APP has been updated. . At this time, the content of texture 1 in the background service unit is already the latest picture.

在使用嵌入式开放图形库(Open Graphics Library for Embedded Systems,OpenGLES)进行视频渲染开发的过程中,需要根据解码后的视频帧数据创建纹理,并根据创建的纹理进行图像的渲染。本发明实施例所采用的技术方案,其OpenGLES的纹理作为数据中端的纹理区域用于提供共享的纹理资源;In the process of video rendering development using the Open Graphics Library for Embedded Systems (OpenGLES), textures need to be created according to the decoded video frame data, and images are rendered according to the created textures. In the technical solution adopted in the embodiment of the present invention, the texture of OpenGLES is used as the texture area at the middle end of the data to provide shared texture resources;

在上述步骤S300中,需要说明的是,上述渲染线程A与上述后台主渲染线程实现共享上下文,最终本质目的是为了共享后台主渲染线程中OpenGLES的纹理所记载的纹理资源,这样其他的渲染线程(例如:渲染线程B1、渲染线程B2、渲染线程B3等)也可以来访问OpenGLES的纹理所记载的纹理资源;所以说,共享纹理资源的目的是在同一进程中的其他渲染线程在进行绘制时,可以任意调用使用后台主渲染线程的OpenGLES的纹理的纹理资源来直接绘制。另外,共享上下文,只存在于同一个进程的不同线程之间。需要说明的是,前序步骤S100创建的后台主渲染线程、渲染线程A都是发生后台投屏服务单元的进程里面的;然而后来创建的3D主渲染线程、渲染线程B则是发生在3D应用的进程中的;需要说明的是,上述后台投屏服务单元每次接收到步骤S100的投屏请求都会基于这个投屏请求中的Surface-x创建渲染线程A,即针对每一个Surface-x都会创建一个渲染线程A;针对每一个Surface-x的ID编号都会特定生产一个渲染线程A。In the above-mentioned step S300, it should be noted that the above-mentioned rendering thread A and the above-mentioned background main rendering thread realize a shared context, and the ultimate essential purpose is to share the texture resources recorded by the OpenGLES texture in the background main rendering thread, so that other rendering threads (For example: rendering thread B1, rendering thread B2, rendering thread B3, etc.) can also access the texture resources recorded by the texture of OpenGLES; therefore, the purpose of sharing texture resources is when other rendering threads in the same process are drawing , you can arbitrarily call the texture resources of the OpenGLES texture using the background main rendering thread to draw directly. In addition, the shared context exists only between different threads of the same process. It should be noted that the background main rendering thread and rendering thread A created in the pre-procedure step S100 are in the process of the background screen projection service unit; however, the 3D main rendering thread and rendering thread B created later are in the 3D application. It should be noted that each time the above-mentioned background screen projection service unit receives the screen projection request in step S100, it will create a rendering thread A based on the Surface-x in the screen projection request, that is, for each Surface-x, it will create a rendering thread A. Create a rendering thread A; a rendering thread A will be specifically produced for each Surface-x ID number.

如图2所示,本发明实施例提供的基于VR一体机的投录屏画面采集处理方法其应用的控制原理,图2中分别示意了投屏模块10、后台投屏服务单元20、后台主渲染线程21、后台主渲染线程中OpenGLES的纹理22、渲染线程A以及Surface-x、Surface-APP、3D应用30、3D主渲染线程31、渲染线程B等。As shown in FIG. 2 , the control principle of the application of the method for capturing and processing a screen-casting screen based on the VR all-in-one machine provided by the embodiment of the present invention is shown in FIG. 2 . Rendering thread 21, OpenGLES texture 22 in the background main rendering thread, rendering thread A, Surface-x, Surface-APP, 3D application 30, 3D main rendering thread 31, rendering thread B, etc.

在步骤S500中,还包括对更新画面进行剪裁处理,以适应投屏模块的尺寸的操作步骤:In step S500, it also includes the operation steps of cropping the updated picture to fit the size of the screen projection module:

步骤S510:将更新画面添加到OpenGLES的纹理中后,调取目标的投屏模块的Surface-x中记载的尺寸信息;根据所述尺寸信息进行裁剪以保证更新画面尺寸与所述投屏模块适配。Step S510: After adding the update screen to the texture of OpenGLES, call the size information recorded in the Surface-x of the target screen projection module; crop according to the size information to ensure that the size of the update screen is suitable for the screen projection module. match.

需要说明的是,现有技术不会对单眼画面进行裁剪的,单眼画面一般是正方形的,然而外部投屏模块的显示屏幕都是长方形的,为此现有技术都是居中处理,即将单眼画面投放到外部投屏模块的显示屏幕上,因此两侧会出现大黑边,严重影响美观。但是本发明实施例则采用了裁剪适配方式避免了大黑边的出现。It should be noted that the existing technology does not crop the monocular image. The monocular image is generally square. However, the display screen of the external screen projection module is all rectangular. It is placed on the display screen of the external screen projection module, so there will be large black borders on both sides, which seriously affects the appearance. However, in the embodiment of the present invention, the cropping and adaptation method is adopted to avoid the appearance of large black borders.

在步骤S500中,还包括对更新画面进行添加logo水印处理的操作步骤:In step S500, it also includes the operation steps of adding a logo watermark to the update screen:

步骤S520:将更新画面添加到OpenGLES的纹理中后,获取需要添加的logo水印并添加到更新画面中,最后将更新画面投放到目标的投屏模块中。Step S520: After adding the update picture to the texture of OpenGLES, obtain the logo watermark to be added and add it to the update picture, and finally put the update picture into the target screen projection module.

需要说明的是,现有技术也无法对更新画面进行添加水印,本发明实施例方案可以将更新画面添加到OpenGLES的纹理中,然后再获取logo水印添加到更新画面中。It should be noted that the existing technology cannot add a watermark to the update picture, and the solution of the embodiment of the present invention can add the update picture to the texture of OpenGLES, and then obtain the logo watermark and add it to the update picture.

在具体的技术方案中,在上述步骤S520中:所述获取需要添加的logo水印并添加到更新画面,具体包括如下操作步骤:In a specific technical solution, in the above step S520: the obtaining of the logo watermark that needs to be added and adding it to the update screen specifically includes the following operation steps:

步骤S5210:将更新画面添加到OpenGLES的纹理中后,所述渲染线程A获取需要添加的logo水印,将其添加到更新画面上,并将添加logo水印的画面整理到OpenGLES的纹理的纹理资源中;Step S5210: After adding the update picture to the texture of OpenGLES, the rendering thread A obtains the logo watermark to be added, adds it to the update picture, and organizes the picture with the logo watermark added into the texture resources of the texture of OpenGLES ;

步骤S5220:目标的投屏模块访问OpenGLES的纹理,根据其Surface-x的ID编号,调取与所述Surface-x的ID编号同一链路上对应的更新画面,将其投放到目标的投屏模块中。Step S5220: The target screen projection module accesses the texture of OpenGLES, and according to the ID number of its Surface-x, retrieves the update screen corresponding to the same link as the ID number of the Surface-x, and puts it on the target screen projection in the module.

综上所述,本发明实施例提供的基于VR一体机的投录屏画面采集处理方法,其能灵活处理多重投屏请求,且能完美适配目标投屏端的尺寸。且画面清晰完整,没有大黑边。对系统渲染负载影响小。无论是用户使用,还是制作宣发材料都是非常好的方案。To sum up, the method for capturing and processing a screen-casting screen based on the VR all-in-one machine provided by the embodiments of the present invention can flexibly handle multiple screen-casting requests, and can perfectly adapt to the size of the target screen-casting terminal. And the picture is clear and complete, without big black borders. Small impact on system rendering load. Whether it is used by users or made publicity materials, it is a very good solution.

以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本发明的保护范围之内。The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention. should be included within the protection scope of the present invention.

Claims (5)

1. A projection screen picture collecting and processing method based on a VR (virtual reality) all-in-one machine is characterized in that an updated picture of a 3D application is projected into a projection screen module, and texture resources can be shared by different threads in the same process while the picture is updated, and the method specifically comprises the following operation steps:
step S100: after the background screen projection service unit is started, a background main rendering thread is created, and meanwhile, an OpenGLES texture is created; the texture of OpenGLES is used as a texture area of a data middle end for providing shared texture resources;
step S200: the screen projection module with the screen projection requirement sends a screen projection request to a background screen projection service unit; the background screen projection service unit identifies the received screen projection request and identifies the ID number of the Surface-x and the size information of the required picture of the Surface-x contained in the screen projection request; the size information comprises the height size and the width size of a screen required to be projected by Surface-x;
step S300: after receiving the screen-casting request in step S200, the background screen-casting service unit creates a rendering thread a based on Surface-x in the screen-casting request and shares a context with the background main rendering thread; the rendering thread A and the background main rendering thread share a context and are used for sharing texture resources recorded by the OpenGLES textures in the background main rendering thread; the rendering thread A corresponds to the Surface-x one by one; randomly calling texture resources recorded by the textures of OpenGLES by other rendering threads in the background screen projection service unit; meanwhile, the background screen-casting service unit can create a Surface-APP based on the texture of the OpenGLES of the background main rendering thread;
step S400: the background screen-casting service unit transmits Surface-APP to the 3D application through an AIDL interface, and the Surface-APP is used for establishing information link connection between the 3D application and the background screen-casting service unit;
step S500: the 3D application comprises a 3D main rendering thread, and after the 3D application receives the Surface-APP, the 3D application creates a rendering thread B which shares the context with the 3D main rendering thread based on the Surface-APP; and the rendering thread B is used for rendering and drawing a monocular picture in the 3D main rendering thread, and the rendered monocular picture is dropped on the picture of the Surface-APP so as to ensure that the picture of the Surface-APP is updated, and finally the updated picture is added into the texture of the OpenGLES.
2. The VR integrated machine-based screen projection and recording picture collection processing method of claim 1, wherein the screen projection module comprises an Rtmp screen projection module and a Miracast screen projection module.
3. The VR all-in-one machine-based screen projection and recording picture collection processing method of claim 2, further comprising, in step S500, an operation step of clipping the updated picture to fit the size of the screen projection module:
step S510: after the updated picture is added into the texture of OpenGLES, the size information recorded in the Surface-x of the screen projection module of the target is called; and cutting according to the size information to ensure that the updated picture size is matched with the screen projection module.
4. The VR all-in-one machine-based screen projection collection processing method of claim 3, further comprising, in step S500, an operation step of adding a logo watermark to the updated screen:
step S520: and after the updated picture is added into the texture of the OpenGLES, obtaining a logo watermark to be added and adding the logo watermark into the updated picture, and finally putting the updated picture into a target screen projection module.
5. The VR integrated machine based screen shot collection processing method of claim 4, wherein in step S520: the method for acquiring the logo watermark to be added and adding the logo watermark to the updated picture specifically comprises the following operation steps:
step S5210: after the updated picture is added into the texture of the OpenGLES, the rendering thread A acquires a logo watermark needing to be added, adds the logo watermark to the updated picture, and arranges the picture added with the logo watermark into the texture resource of the texture of the OpenGLES;
step S5220: and the screen projection module of the target accesses the texture of OpenGLES, calls an updating picture corresponding to the ID number of the Surface-x on the same link according to the ID number of the Surface-x, and projects the updating picture into the screen projection module of the target.
CN202010506055.5A 2020-06-05 2020-06-05 Screen capture and processing method based on VR all-in-one machine Expired - Fee Related CN111640191B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010506055.5A CN111640191B (en) 2020-06-05 2020-06-05 Screen capture and processing method based on VR all-in-one machine

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010506055.5A CN111640191B (en) 2020-06-05 2020-06-05 Screen capture and processing method based on VR all-in-one machine

Publications (2)

Publication Number Publication Date
CN111640191A true CN111640191A (en) 2020-09-08
CN111640191B CN111640191B (en) 2023-04-21

Family

ID=72329826

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010506055.5A Expired - Fee Related CN111640191B (en) 2020-06-05 2020-06-05 Screen capture and processing method based on VR all-in-one machine

Country Status (1)

Country Link
CN (1) CN111640191B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112565839A (en) * 2020-11-23 2021-03-26 青岛海信传媒网络技术有限公司 Display method and display device of screen projection image
CN113891167A (en) * 2021-08-27 2022-01-04 荣耀终端有限公司 Screen projection method and electronic equipment
CN114650442A (en) * 2020-12-17 2022-06-21 青岛海尔多媒体有限公司 Method and device for mirror image screen projection and mirror image screen projection equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103902390A (en) * 2014-03-12 2014-07-02 深圳创维-Rgb电子有限公司 Inter-process communication method based on Android application layer and basis application communication system
US9473758B1 (en) * 2015-12-06 2016-10-18 Sliver VR Technologies, Inc. Methods and systems for game video recording and virtual reality replay
CN110248022A (en) * 2019-06-06 2019-09-17 武汉卡比特信息有限公司 A kind of throwing screen method of tripartite's application based on mobile phone interconnection
CN110908624A (en) * 2018-09-18 2020-03-24 深圳市布谷鸟科技有限公司 Control method and system for screen abnormal display

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103902390A (en) * 2014-03-12 2014-07-02 深圳创维-Rgb电子有限公司 Inter-process communication method based on Android application layer and basis application communication system
US9473758B1 (en) * 2015-12-06 2016-10-18 Sliver VR Technologies, Inc. Methods and systems for game video recording and virtual reality replay
CN110908624A (en) * 2018-09-18 2020-03-24 深圳市布谷鸟科技有限公司 Control method and system for screen abnormal display
CN110248022A (en) * 2019-06-06 2019-09-17 武汉卡比特信息有限公司 A kind of throwing screen method of tripartite's application based on mobile phone interconnection

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112565839A (en) * 2020-11-23 2021-03-26 青岛海信传媒网络技术有限公司 Display method and display device of screen projection image
CN112565839B (en) * 2020-11-23 2022-11-29 青岛海信传媒网络技术有限公司 Display method and display device of screen projection image
CN114650442A (en) * 2020-12-17 2022-06-21 青岛海尔多媒体有限公司 Method and device for mirror image screen projection and mirror image screen projection equipment
CN113891167A (en) * 2021-08-27 2022-01-04 荣耀终端有限公司 Screen projection method and electronic equipment
CN116887005A (en) * 2021-08-27 2023-10-13 荣耀终端有限公司 Screencasting methods and electronic devices
CN116887005B (en) * 2021-08-27 2024-05-03 荣耀终端有限公司 Screen projection method, electronic device and computer readable storage medium

Also Published As

Publication number Publication date
CN111640191B (en) 2023-04-21

Similar Documents

Publication Publication Date Title
CN107590771B (en) 2D video with options for projection viewing in modeled 3D space
EP3883256A1 (en) Live stream processing method in webrtc and stream pushing client
US20200413027A1 (en) Image processing method and device
WO2017113681A1 (en) Video image processing method and apparatus based on virtual reality technology
CN103077239B (en) Based on the iFrame embedded Web 3D system that cloud is played up
WO2017193576A1 (en) Video resolution adaptation method and apparatus, and virtual reality terminal
US10403045B2 (en) Photorealistic augmented reality system
US11095871B2 (en) System that generates virtual viewpoint image, method and storage medium
US20070070067A1 (en) Scene splitting for perspective presentations
CN107924587A (en) Object is directed the user in mixed reality session
CN111640191A (en) Projection screen picture acquisition processing method based on VR (virtual reality) all-in-one machine
CN112804459A (en) Image display method and device based on virtual camera, storage medium and electronic equipment
CN107248194A (en) A kind of CAE data three-dimensionals based on cloud computing show exchange method
CN103959220B (en) Method for achieving augmented reality, and user equipment
US20150134665A1 (en) System and method for associating a file with one or more other files in an online storage system
CN110930325B (en) Image processing method and device based on artificial intelligence and storage medium
KR102257132B1 (en) Methods, systems and media for creating and rendering immersive video content
CN107925657A (en) Via the asynchronous session of user equipment
US20240275934A1 (en) Information processing apparatus, management apparatus, information processing method, and control method for management apparatus
CN105898562A (en) Virtual reality terminal and method and device for simulating play scene thereof
CN114820660B (en) Image processing method, device, electronic device, storage medium and program product
CN116385291A (en) Texture rendering method and device, electronic equipment and medium
CN115797522A (en) Real-time visualization method and device for digital content creation
JP4080295B2 (en) Plural media display method in virtual space, plural media display terminal device in virtual space, virtual space management server device, plural media display program in virtual space, and recording medium recording this program
JP5030890B2 (en) Method, program, and apparatus for relating and switching display between multiple images

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20230421