TWI838028B - Electronic device and method for loading graphic resource and image processing model - Google Patents

Electronic device and method for loading graphic resource and image processing model Download PDF

Info

Publication number
TWI838028B
TWI838028B TW111149150A TW111149150A TWI838028B TW I838028 B TWI838028 B TW I838028B TW 111149150 A TW111149150 A TW 111149150A TW 111149150 A TW111149150 A TW 111149150A TW I838028 B TWI838028 B TW I838028B
Authority
TW
Taiwan
Prior art keywords
image processing
task
graphics
processing model
processor
Prior art date
Application number
TW111149150A
Other languages
Chinese (zh)
Other versions
TW202427191A (en
Inventor
佑 和
譚馳澔
林士豪
Original Assignee
宏碁股份有限公司
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 宏碁股份有限公司 filed Critical 宏碁股份有限公司
Priority to TW111149150A priority Critical patent/TWI838028B/en
Application granted granted Critical
Publication of TWI838028B publication Critical patent/TWI838028B/en
Publication of TW202427191A publication Critical patent/TW202427191A/en

Links

Images

Landscapes

  • Image Generation (AREA)

Abstract

An electronic device and a method for loading a graphic resource and an image processing model are provided. The method includes: executing a first task to initialize a graphic resource by using a first thread of a processor; executing a second task to load an image processing model by using a second thread of the processor; determining whether the first task and the second task are complete; obtaining a graphic setting in response to the first task and the second task being completed; determining whether the image processing model matches the graphic setting, and executing the second task again to update the image processing model by using the second thread in response to the image processing model not matching the graphic setting; and generating an output frame according to the graphic resource and the image processing model, and transmitting the output frame via a transceiver.

Description

用於讀取圖形資源和影像處理模型的電子裝置和方法Electronic device and method for reading graphics resources and image processing models

本發明是有關於一種影像處理技術,且特別是有關於一種用於讀取圖形資源和影像處理模型的電子裝置和方法。The present invention relates to an image processing technology, and more particularly to an electronic device and method for reading graphic resources and image processing models.

隨著機器學習技術的發展,越來越多顯示器開始使用機器學習技術來處理影像以提供給用戶多樣化的觀看體驗。例如,支援三維影像播放技術的顯示器可利用機器學習技術即時地將二維影像轉換為三維影像。然而,應用基於機器學習的影像處理技術可能會大量地消耗顯示器的運算資源,從而降低輸出影像的品質或造成輸出影像出現延遲。因此,如何節省影像處理技術所需消耗的運算資源,是本領域的重要課題之一。With the development of machine learning technology, more and more displays are beginning to use machine learning technology to process images to provide users with a diverse viewing experience. For example, a display that supports 3D image playback technology can use machine learning technology to convert 2D images into 3D images in real time. However, the application of machine learning-based image processing technology may consume a large amount of computing resources of the display, thereby reducing the quality of the output image or causing delays in the output image. Therefore, how to save the computing resources required by image processing technology is one of the important topics in this field.

本發明提供一種用於讀取圖形資源和影像處理模型的電子裝置和方法,可最小化讀取圖形資源和影像處理模型所使用的運算資源。The present invention provides an electronic device and method for reading graphic resources and image processing models, which can minimize the computing resources used for reading graphic resources and image processing models.

本發明的一種用於讀取圖形資源和影像處理模型的電子裝置,包含處理器以及收發器。處理器耦接收發器,其中處理器經配置以:使用第一執行緒執行第一任務以初始化圖形資源;使用第二執行緒執行第二任務以讀取影像處理模型;判斷第一任務和第二任務是否已經完成;響應於第一任務和第二任務已經完成,取得圖形設定;判斷影像處理模型與圖形設定是否匹配,並且響應於影像處理模型與圖形設定不匹配而使用第二執行緒再次執行第二任務以更新影像處理模型;以及根據圖形資源和影像處理模型產生輸出幀,並且通過收發器傳送輸出幀。The electronic device for reading graphics resources and image processing models of the present invention comprises a processor and a transceiver. The processor is coupled to the transceiver, wherein the processor is configured to: use a first thread to execute a first task to initialize graphics resources; use a second thread to execute a second task to read the image processing model; determine whether the first task and the second task have been completed; in response to the first task and the second task being completed, obtain graphics settings; determine whether the image processing model matches the graphics settings, and in response to the image processing model not matching the graphics settings, use a second thread to execute the second task again to update the image processing model; and generate output frames according to the graphics resources and the image processing model, and transmit the output frames through the transceiver.

在本發明的一實施例中,上述的處理器更經配置以:判斷圖形資源與圖形設定是否匹配;以及響應於圖形資源與圖形設定不匹配而使用第一執行緒再次執行第一任務以更新圖形資源。In one embodiment of the present invention, the processor is further configured to: determine whether the graphics resource matches the graphics setting; and in response to the graphics resource not matching the graphics setting, execute the first task again using the first thread to update the graphics resource.

在本發明的一實施例中,上述的電子裝置更包含儲存媒體。儲存媒體耦接處理器,其中第一任務包含:清理儲存媒體中對應於先前幀的先前圖形資源;以及初始化對應於當前幀的圖形資源以將圖形資源儲存在儲存媒體中。In an embodiment of the present invention, the electronic device further comprises a storage medium coupled to the processor, wherein the first task comprises: clearing the previous graphic resources corresponding to the previous frame in the storage medium; and initializing the graphic resources corresponding to the current frame to store the graphic resources in the storage medium.

在本發明的一實施例中,上述的電子裝置更包含快取記憶體。快取記憶體耦接處理器,其中第二任務包含:檢查快取記憶體是否儲存對應於圖形設定的影像處理模型;以及響應於快取記憶體儲存對應於圖形設定的影像處理模型,自快取記憶體讀取影像處理模型。In one embodiment of the present invention, the electronic device further comprises a cache memory coupled to the processor, wherein the second task comprises: checking whether the cache memory stores an image processing model corresponding to the graphics setting; and in response to the cache memory storing the image processing model corresponding to the graphics setting, reading the image processing model from the cache memory.

在本發明的一實施例中,上述的電子裝置更包含儲存媒體。儲存媒體耦接處理器,並且儲存多個影像處理模型,其中第二任務更包含:響應於快取記憶體並未儲存對應於圖形設定的影像處理模型,自儲存媒體讀取多個影像處理模型中的影像處理模型,並且將影像處理模型儲存至快取記憶體。In one embodiment of the present invention, the electronic device further comprises a storage medium. The storage medium is coupled to the processor and stores a plurality of image processing models, wherein the second task further comprises: in response to the cache memory not storing the image processing model corresponding to the graphics setting, reading an image processing model from the storage medium and storing the image processing model in the cache memory.

在本發明的一實施例中,上述的圖形資源包含對應於輸出影像的當前幀的三維網格以及紋理。In one embodiment of the present invention, the above-mentioned graphic resources include a three-dimensional grid and texture corresponding to the current frame of the output image.

在本發明的一實施例中,上述的處理器更經配置以:使用影像處理模型對當前幀執行深度預測以產生深度資訊;根據深度資訊更新三維網格;以及將紋理映射至經更新的三維網格以產生輸出幀。In one embodiment of the present invention, the processor is further configured to: perform depth prediction on the current frame using an image processing model to generate depth information; update the three-dimensional grid according to the depth information; and map the texture to the updated three-dimensional grid to generate an output frame.

在本發明的一實施例中,上述的處理器更經配置以:通過收發器接收用戶指令;以及響應於接收用戶指令,使用第一執行緒執行第一任務,並且使用第二執行緒執行第二任務。In one embodiment of the present invention, the processor is further configured to: receive a user instruction through a transceiver; and in response to receiving the user instruction, use the first execution thread to execute the first task, and use the second execution thread to execute the second task.

在本發明的一實施例中,上述的處理器更經配置以:根據用戶指令開始產生包含輸出幀的輸出影像。In one embodiment of the present invention, the processor is further configured to start generating an output image including an output frame according to a user instruction.

在本發明的一實施例中,上述的處理器更經配置以:根據用戶指令停止產生包含輸出幀的輸出影像。In one embodiment of the present invention, the processor is further configured to stop generating an output image including an output frame according to a user instruction.

在本發明的一實施例中,上述的電子裝置更包含儲存媒體。儲存媒體耦接處理器,並且儲存用於產生輸出影像的應用程式,其中處理器更經配置以:響應於應用程式被啟用,使用第一執行緒執行第一任務,並且使用第二執行緒執行第二任務。In one embodiment of the present invention, the electronic device further comprises a storage medium coupled to the processor and storing an application for generating an output image, wherein the processor is further configured to: in response to the application being activated, use a first execution thread to execute a first task, and use a second execution thread to execute a second task.

本發明的一種用於讀取圖形資源和影像處理模型的方法,包含:使用處理器的第一執行緒執行第一任務以初始化圖形資源;使用處理器的第二執行緒執行第二任務以讀取影像處理模型;判斷第一任務和第二任務是否已經完成;響應於第一任務和第二任務已經完成,取得圖形設定;判斷影像處理模型與圖形設定是否匹配,並且響應於影像處理模型與圖形設定不匹配而使用第二執行緒再次執行第二任務以更新影像處理模型;以及根據圖形資源和影像處理模型產生輸出幀,並且通過收發器傳送輸出幀。The present invention provides a method for reading graphics resources and image processing models, comprising: using a first execution thread of a processor to execute a first task to initialize graphics resources; using a second execution thread of the processor to execute a second task to read the image processing model; determining whether the first task and the second task have been completed; in response to the first task and the second task being completed, obtaining graphics settings; determining whether the image processing model matches the graphics settings, and in response to the image processing model not matching the graphics settings, using a second execution thread to execute the second task again to update the image processing model; and generating output frames according to the graphics resources and the image processing model, and transmitting the output frames through a transceiver.

基於上述,本發明的電子裝置可利用多執行緒讀取圖形資源和影像處理模型,且僅在必要時重設圖形資源和影像處理模型。據此,本發明可在節省運算資源的消耗,並可避免輸出影像的品質降低或避免輸出影像發生延遲。Based on the above, the electronic device of the present invention can use multiple threads to read graphics resources and image processing models, and only reset the graphics resources and image processing models when necessary. Accordingly, the present invention can save the consumption of computing resources and avoid the reduction of output image quality or delay of output image.

為了使本發明之內容可以被更容易明瞭,以下特舉實施例作為本發明確實能夠據以實施的範例。另外,凡可能之處,在圖式及實施方式中使用相同標號的元件/構件/步驟,係代表相同或類似部件。In order to make the content of the present invention more clearly understood, the following embodiments are specifically cited as examples by which the present invention can be truly implemented. In addition, wherever possible, elements/components/steps with the same reference numerals in the drawings and embodiments represent the same or similar components.

圖1根據本發明的一實施例繪示一種用於讀取圖形資源和影像處理模型的電子裝置100的示意圖。電子裝置100可包含處理器110、儲存媒體120、收發器130以及快取記憶體140。FIG1 is a schematic diagram of an electronic device 100 for reading graphics resources and image processing models according to an embodiment of the present invention. The electronic device 100 may include a processor 110, a storage medium 120, a transceiver 130, and a cache 140.

處理器110例如是中央處理單元(central processing unit,CPU),或是其他可程式化之一般用途或特殊用途的微控制單元(micro control unit,MCU)、微處理器(microprocessor)、數位信號處理器(digital signal processor,DSP)、可程式化控制器、特殊應用積體電路(application specific integrated circuit,ASIC)、圖形處理器(graphics processing unit,GPU)、影像訊號處理器(image signal processor,ISP)、影像處理單元(image processing unit,IPU)、算數邏輯單元(arithmetic logic unit,ALU)、複雜可程式邏輯裝置(complex programmable logic device,CPLD)、現場可程式化邏輯閘陣列(field programmable gate array,FPGA)或其他類似元件或上述元件的組合。處理器110可耦接至儲存媒體120、收發器130以及快取記憶體140,並且存取和執行儲存於儲存媒體120中的多個模組和各種應用程式。處理器110可具有多執行緒的能力。在本實施例中,處理器110可運行執行緒111和執行緒112。The processor 110 is, for example, a central processing unit (CPU), or other programmable general-purpose or special-purpose micro control unit (MCU), microprocessor, digital signal processor (DSP), programmable controller, application specific integrated circuit (ASIC), graphics processing unit (GPU), image signal processor (ISP), image processing unit (IPU), arithmetic logic unit (ALU), complex programmable logic device (CPLD), field programmable gate array (FPGA), or other similar components or combinations of the above components. The processor 110 may be coupled to the storage medium 120, the transceiver 130, and the cache 140, and access and execute multiple modules and various applications stored in the storage medium 120. The processor 110 may have a multi-thread capability. In this embodiment, the processor 110 may run a thread 111 and a thread 112.

儲存媒體120或快取記憶體140例如是任何型態的固定式或可移動式的隨機存取記憶體(random access memory,RAM)、唯讀記憶體(read-only memory,ROM)、快閃記憶體(flash memory)、硬碟(hard disk drive,HDD)、固態硬碟(solid state drive,SSD)或類似元件或上述元件的組合,而用於儲存可由處理器110執行的多個模組或各種應用程式。在本實施例中,儲存媒體120可儲存包含多個影像處理模型121、用於儲存圖形資源(graphic resource)的儲存區122以及用於產生輸出影像的應用程式(例如:影像播放軟體)123等多個模組,其功能將於後續說明。The storage medium 120 or cache memory 140 is, for example, any type of fixed or removable random access memory (RAM), read-only memory (ROM), flash memory, hard disk drive (HDD), solid state drive (SSD) or similar components or a combination of the above components, and is used to store multiple modules or various applications that can be executed by the processor 110. In this embodiment, the storage medium 120 can store multiple modules including multiple image processing models 121, a storage area 122 for storing graphic resources, and an application (e.g., image playback software) 123 for generating output images, and its functions will be described later.

收發器130以無線或有線的方式傳送及接收訊號。收發器130還可以執行例如低噪聲放大、阻抗匹配、混頻、向上或向下頻率轉換、濾波、放大以及類似的操作。The transceiver 130 transmits and receives signals wirelessly or wiredly. The transceiver 130 may also perform operations such as low noise amplification, impedance matching, frequency mixing, up or down frequency conversion, filtering, amplification, and the like.

圖2根據本發明的一實施例繪示一種用於讀取圖形資源和影像處理模型的方法的流程圖,其中所述方法可由如圖1所示的電子裝置100實施。FIG. 2 is a flow chart of a method for reading a graphics resource and an image processing model according to an embodiment of the present invention, wherein the method may be implemented by the electronic device 100 shown in FIG. 1 .

在步驟S201中,處理器110可啟用應用程式123。在一實施例中,處理器110可通過收發器130接收用於啟用應用程式123的用戶指令。處理器110可響應於接收到所述用戶指令而啟用應用程式123。在本實施例中,處理器110可通過收發器130接收輸入影像,其中輸入影像例如是二維影像。應用程式123可用以將輸入影像轉換為三維的輸出影像,並播放所述輸出影像。In step S201, the processor 110 may activate the application 123. In one embodiment, the processor 110 may receive a user command for activating the application 123 through the transceiver 130. The processor 110 may activate the application 123 in response to receiving the user command. In this embodiment, the processor 110 may receive an input image through the transceiver 130, wherein the input image is, for example, a two-dimensional image. The application 123 may be used to convert the input image into a three-dimensional output image and play the output image.

在步驟S202中,處理器110可取得圖形設定(graphic setting)。圖形設定可指示應用程式123所需使用的圖形資源以及影像處理模型121。圖形設定可以是預設的。舉例來說,處理器110可自儲存媒體120讀取預設的圖形設定。圖形設定也可以是由用戶決定的。舉例來說,處理器110可從如步驟S201所述的用戶指令中取得圖形設定。In step S202, the processor 110 may obtain a graphic setting. The graphic setting may indicate the graphic resources and the image processing model 121 required for use by the application 123. The graphic setting may be a default. For example, the processor 110 may read the default graphic setting from the storage medium 120. The graphic setting may also be determined by the user. For example, the processor 110 may obtain the graphic setting from the user instruction as described in step S201.

在步驟S203中,處理器110可使用執行緒111執行用於初始化圖形資源的任務300。在步驟S204中,處理器110可使用執行緒112執行用於讀取影像處理模型121的任務400。執行緒111與執行緒112可並行運行。也就是說,處理器110可同時執行步驟S203和步驟S204。In step S203, the processor 110 may use the thread 111 to execute the task 300 for initializing the graphics resources. In step S204, the processor 110 may use the thread 112 to execute the task 400 for reading the image processing model 121. The thread 111 and the thread 112 may run in parallel. That is, the processor 110 may execute step S203 and step S204 at the same time.

任務300可包含步驟S301和步驟S302等步驟。在步驟S301中,執行緒111可清理儲存區122中對應於應用程式123所播放之輸出影像的先前幀的先前圖形資源。先前圖形資源可包含但不限於對應於輸出影像的先前幀的三維網格(3D mesh)或紋理(texture)。Task 300 may include steps S301 and S302. In step S301, thread 111 may clear previous graphics resources corresponding to previous frames of output images played by application 123 in storage area 122. Previous graphics resources may include but are not limited to 3D meshes or textures corresponding to previous frames of output images.

在步驟S302中,執行緒111可初始化對應於輸出影像的當前幀的圖形資源以將圖形資源儲存在儲存區122中。具體來說,執行緒111可根據圖形設定以及輸入影像產生用於根據輸入影像的當前幀產生輸出影像的三維網格或紋理。執行緒111可將所產生的三維網格或紋理作為當前幀的圖形資源儲存在儲存區122中。圖形資源可用於對輸入影像的當前幀執行影像處理以產生輸出幀。In step S302, the execution thread 111 may initialize the graphics resource corresponding to the current frame of the output image to store the graphics resource in the storage area 122. Specifically, the execution thread 111 may generate a three-dimensional grid or texture for generating the output image according to the current frame of the input image according to the graphics setting and the input image. The execution thread 111 may store the generated three-dimensional grid or texture as the graphics resource of the current frame in the storage area 122. The graphics resource may be used to perform image processing on the current frame of the input image to generate the output frame.

任務400用於加快影像處理模型121的讀取速率。任務400可包含步驟S401至步驟S404等步驟。在步驟S401中,執行緒112可檢查快取記憶體140中是否儲存對應於圖形設定的影像處理模型121。具體來說,執行緒112可根據圖形設定以及輸入影像判斷對輸入影像執行影像處理所需使用的模型為影像處理模型121。接著,執行緒112可判斷對應於圖形設定的影像處理模型121是否已被讀取至快取記憶體140。若快取記憶體140已經儲存了對應於圖形設定的影像處理模型121,則執行緒112可執行步驟S402。若快取記憶體140尚未儲存對應於圖形設定的影像處理模型121,則執行緒112可執行步驟S403。Task 400 is used to speed up the reading rate of the image processing model 121. Task 400 may include steps S401 to S404. In step S401, the execution thread 112 may check whether the image processing model 121 corresponding to the graphics setting is stored in the cache 140. Specifically, the execution thread 112 may determine that the model required to perform image processing on the input image is the image processing model 121 based on the graphics setting and the input image. Then, the execution thread 112 may determine whether the image processing model 121 corresponding to the graphics setting has been read into the cache 140. If the cache memory 140 has stored the image processing model 121 corresponding to the graphics setting, the execution thread 112 may execute step S402. If the cache memory 140 has not stored the image processing model 121 corresponding to the graphics setting, the execution thread 112 may execute step S403.

在步驟S402中,執行緒112可自快取記憶體140讀取影像處理模型121。影像處理模型121可用於對輸入影像的當前幀執行影像處理以產生輸出幀。In step S402, the thread 112 may read the image processing model 121 from the cache 140. The image processing model 121 may be used to perform image processing on the current frame of the input image to generate an output frame.

在步驟S403中,執行緒112可從儲存媒體120儲存的多個影像處理模型121中選出對應於圖形設定的影像處理模型121,並且讀取受選的影像處理模型121。In step S403 , the thread 112 may select an image processing model 121 corresponding to the graphic setting from a plurality of image processing models 121 stored in the storage medium 120 , and read the selected image processing model 121 .

在步驟S404中,執行緒112可將受選的影像處理模型121儲存至快取記憶體140,並自快取記憶體140讀取受選的影像處理模型121。若快取記憶體140尚未建立,則執行緒112可在儲存媒體120中建立快取記憶體140,並且將受選的影像處理模型121儲存至快取記憶體140中。In step S404, the thread 112 may store the selected image processing model 121 in the cache 140 and read the selected image processing model 121 from the cache 140. If the cache 140 has not been created, the thread 112 may create the cache 140 in the storage medium 120 and store the selected image processing model 121 in the cache 140.

在步驟S205中,處理器110可等待接收用戶指令。在步驟S206中,處理器110可通過收發器130接收用戶指令,其中所述用戶指令用於指示應用程式123播放輸出影像。In step S205, the processor 110 may wait to receive a user instruction. In step S206, the processor 110 may receive a user instruction via the transceiver 130, wherein the user instruction is used to instruct the application 123 to play the output image.

在接收到用戶指令後,在步驟S207中,處理器110可判斷任務300和任務400是否已經完成。若任務300和任務400已經完成,則進入步驟S209。若任務300和任務400尚未完成,則進入步驟S208。After receiving the user instruction, in step S207, the processor 110 can determine whether the task 300 and the task 400 have been completed. If the task 300 and the task 400 have been completed, the process proceeds to step S209. If the task 300 and the task 400 have not been completed, the process proceeds to step S208.

在步驟S208中,處理器110可等待執行緒111完成任務300,並且等待執行緒112完成任務400。In step S208 , the processor 110 may wait for the thread 111 to complete the task 300 , and wait for the thread 112 to complete the task 400 .

在步驟S209中,處理器110可再次取得圖形設定。步驟S209所述的圖形設定與步驟S202所述的圖形設定可相同或相異。舉例來說,處理器110可基於輸入影像的改變或接收到的指令來調整應用程式123所需使用的圖形資源和影像處理模型121,進而使步驟S209所述的圖形設定相異於步驟S202所述的圖形設定。In step S209, the processor 110 may obtain the graphics settings again. The graphics settings described in step S209 may be the same as or different from the graphics settings described in step S202. For example, the processor 110 may adjust the graphics resources and image processing model 121 required for use by the application 123 based on changes in the input image or received instructions, thereby making the graphics settings described in step S209 different from the graphics settings described in step S202.

在步驟S210中,處理器110可判斷是否需重設快取記憶體140中的影像處理模型121。具體來說,處理器110可判斷快取記憶體140中的影像處理模型121與步驟S209的圖形設定是否匹配。若快取記憶體140中的影像處理模型121與步驟S209的圖形設定匹配,則處理器110可判斷不需重設快取記憶體140中的影像處理模型,並接著執行步驟S212。若快取記憶體140中的影像處理模型121與步驟S209的圖形設定不匹配,則處理器110可判斷需重設快取記憶體140中的影像處理模型121。據此,處理器110可使用執行緒112執行步驟S211。在步驟S211中,執行緒112可再次執行任務300,藉以更新快取記憶體140中的影像處理模型121。In step S210, the processor 110 may determine whether it is necessary to reset the image processing model 121 in the cache memory 140. Specifically, the processor 110 may determine whether the image processing model 121 in the cache memory 140 matches the graphics setting of step S209. If the image processing model 121 in the cache memory 140 matches the graphics setting of step S209, the processor 110 may determine that it is not necessary to reset the image processing model in the cache memory 140, and then execute step S212. If the image processing model 121 in the cache memory 140 does not match the graphics setting of step S209, the processor 110 may determine that it is necessary to reset the image processing model 121 in the cache memory 140. Accordingly, the processor 110 may use the thread 112 to execute step S211. In step S211, the thread 112 may execute the task 300 again to update the image processing model 121 in the cache 140.

在步驟S212中,處理器110可判斷是否需重設儲存區122中的圖形資源。具體來說,處理器110可判斷儲存區122中的圖形資源與步驟S209的圖形設定是否匹配。若儲存區122中的圖形資源與步驟S209的圖形設定匹配,則處理器110可判斷不需重設儲存區122中的圖形資源,並接著執行步驟S214。若儲存區122中的圖形資源與步驟S209的圖形設定不匹配,則處理器110可判斷需重設儲存區122中的圖形資源。據此,處理器110可使用執行緒111執行步驟S213。在步驟S213中,執行緒111可再次執行任務300,藉以更新儲存區122中的圖形資源。In step S212, the processor 110 may determine whether it is necessary to reset the graphics resources in the storage area 122. Specifically, the processor 110 may determine whether the graphics resources in the storage area 122 match the graphics settings of step S209. If the graphics resources in the storage area 122 match the graphics settings of step S209, the processor 110 may determine that it is not necessary to reset the graphics resources in the storage area 122, and then execute step S214. If the graphics resources in the storage area 122 do not match the graphics settings of step S209, the processor 110 may determine that it is necessary to reset the graphics resources in the storage area 122. Accordingly, the processor 110 may use the thread 111 to execute step S213. In step S213, the thread 111 may execute the task 300 again to update the graphics resources in the storage area 122.

在步驟S214中,處理器110可判斷對應於步驟S211的任務300和對應於步驟S213的任務400是否已經完成。若任務300和任務400已經完成,則進入步驟S215。若任務300和任務400尚未完成,則進入步驟S208。在步驟S208中,處理器110可等待執行緒111完成任務300,並且等待執行緒112完成任務400。In step S214, the processor 110 may determine whether the task 300 corresponding to step S211 and the task 400 corresponding to step S213 have been completed. If the task 300 and the task 400 have been completed, the process proceeds to step S215. If the task 300 and the task 400 have not been completed, the process proceeds to step S208. In step S208, the processor 110 may wait for the thread 111 to complete the task 300, and wait for the thread 112 to complete the task 400.

在步驟S215中,處理器110可開始產生包含輸出幀的輸出影像,並可通過收發器130傳送輸出幀。具體來說,處理器110可根據儲存區122中的圖形資源以及快取記憶體140中的影像處理模型121產生輸出幀。在一實施例中,處理器110可使用快取記憶體140中的影像處理模型121對輸入影像的當前幀執行深度預測(depth estimation)以產生深度資訊。處理器110可根據深度資訊更新當前幀的三維網格,並將紋理映射至經更新的三維網格以產生輸出幀。換句話說,處理器110可使用快取記憶體140中的影像處理模型121以及儲存區122中的圖形資源將二維的輸入影像轉換為三維的輸出影像。In step S215, the processor 110 may start to generate an output image including an output frame, and may transmit the output frame through the transceiver 130. Specifically, the processor 110 may generate an output frame based on the graphics resources in the storage area 122 and the image processing model 121 in the cache memory 140. In one embodiment, the processor 110 may use the image processing model 121 in the cache memory 140 to perform depth estimation on the current frame of the input image to generate depth information. The processor 110 may update the three-dimensional grid of the current frame according to the depth information, and map the texture to the updated three-dimensional grid to generate an output frame. In other words, the processor 110 may use the image processing model 121 in the cache 140 and the graphics resources in the storage area 122 to convert a two-dimensional input image into a three-dimensional output image.

在步驟S216中,處理器110可持續地運行應用程式123產生輸出影像,並通過收發器130傳送輸出影像。舉例來說,處理器110可通過收發器130將輸出影像傳送至支援三維影像的顯示器,以通過所述顯示器播放輸出影像。In step S216, the processor 110 may continuously run the application 123 to generate output images, and transmit the output images through the transceiver 130. For example, the processor 110 may transmit the output images to a display supporting three-dimensional images through the transceiver 130 to play the output images through the display.

在步驟S217中,處理器110可通過收發器130接收用戶指令,其中所述用戶指令用於指示電子裝置100停止產生輸出影像。在步驟S218中,處理器110可根據如步驟S217所述的用戶指令停止產生輸出影像。In step S217, the processor 110 may receive a user instruction via the transceiver 130, wherein the user instruction is used to instruct the electronic device 100 to stop generating the output image. In step S218, the processor 110 may stop generating the output image according to the user instruction as described in step S217.

圖3根據本發明的另一實施例繪示一種用於讀取圖形資源和影像處理模型的方法的流程圖,其中所述方法可由如圖1所示的電子裝置100實施。在步驟S501中,使用處理器的第一執行緒執行第一任務以初始化圖形資源。在步驟S502中,使用處理器的第二執行緒執行第二任務以讀取影像處理模型。在步驟S503中,判斷第一任務和第二任務是否已經完成。在步驟S504中,響應於第一任務和第二任務已經完成,取得圖形設定。在步驟S505中,判斷影像處理模型與圖形設定是否匹配,並且響應於影像處理模型與圖形設定不匹配而使用第二執行緒再次執行第二任務以更新影像處理模型。在步驟S506中,根據圖形資源和影像處理模型產生輸出幀,並且通過收發器傳送輸出幀。FIG. 3 is a flow chart of a method for reading graphics resources and image processing models according to another embodiment of the present invention, wherein the method can be implemented by the electronic device 100 shown in FIG. 1. In step S501, a first task is executed using a first thread of a processor to initialize graphics resources. In step S502, a second task is executed using a second thread of a processor to read an image processing model. In step S503, it is determined whether the first task and the second task have been completed. In step S504, in response to the first task and the second task having been completed, graphics settings are obtained. In step S505, it is determined whether the image processing model matches the graphics setting, and in response to the image processing model not matching the graphics setting, the second task is executed again using the second thread to update the image processing model. In step S506, an output frame is generated according to the graphics resource and the image processing model, and the output frame is transmitted through the transceiver.

綜上所述,本發明的電子裝置可利用多執行緒讀取圖形資源和影像處理模型。電子裝置可在特定事件(例如:應用程式備啟用、用戶指示應用程式開始產生輸出影像或用戶指示應用程式停止產生輸出影像)發生時,判斷圖形資源或影像處理模型是否需重設。若判斷結果為否,電子裝置可繼續應用使用中的圖形資源或影像處理模型,進而達到節省運算資源的功效。若判斷結果為是,電子裝置可利用多執行緒重設圖形資源和影像處理模型,藉此降低重設所需消耗的時間。據此,本發明可在節省運算資源的消耗,並可避免輸出影像的品質降低或避免輸出影像發生延遲。In summary, the electronic device of the present invention can utilize multiple threads to read graphics resources and image processing models. The electronic device can determine whether the graphics resources or image processing model need to be reset when a specific event occurs (for example, the application is activated, the user instructs the application to start generating output images, or the user instructs the application to stop generating output images). If the judgment result is no, the electronic device can continue to apply the graphics resources or image processing model in use, thereby achieving the effect of saving computing resources. If the judgment result is yes, the electronic device can utilize multiple threads to reset the graphics resources and image processing model, thereby reducing the time required for the reset. Accordingly, the present invention can save the consumption of computing resources and avoid the reduction of the quality of the output image or avoid the delay of the output image.

100:電子裝置 110:處理器 111、112:執行緒 120:儲存媒體 121:影像處理模型 122:儲存區 123:應用程式 130:收發器 140:快取記憶體 300、400:任務 S201、S202、S203、S204、S205、S206、S207、S208、S209、S210、S211、S212、S213、S214、S215、S216、S217、S218、S301、S302、S401、S402、S403、S404、S501、S502、S503、S504、S505、S506:步驟 100: electronic device 110: processor 111, 112: thread 120: storage medium 121: image processing model 122: storage area 123: application 130: transceiver 140: cache memory 300, 400: task S201, S202, S203, S204, S205, S206, S207, S208, S209, S210, S211, S212, S213, S214, S215, S216, S217, S218, S301, S302, S401, S402, S403, S404, S501, S502, S503, S504, S505, S506: Steps

圖1根據本發明的一實施例繪示一種用於讀取圖形資源和影像處理模型的電子裝置的示意圖。 圖2根據本發明的一實施例繪示一種用於讀取圖形資源和影像處理模型的方法的流程圖。 圖3根據本發明的另一實施例繪示一種用於讀取圖形資源和影像處理模型的方法的流程圖。 FIG. 1 is a schematic diagram of an electronic device for reading a graphics resource and an image processing model according to an embodiment of the present invention. FIG. 2 is a flow chart of a method for reading a graphics resource and an image processing model according to an embodiment of the present invention. FIG. 3 is a flow chart of a method for reading a graphics resource and an image processing model according to another embodiment of the present invention.

S501、S502、S503、S504、S505、S506:步驟 S501, S502, S503, S504, S505, S506: Steps

Claims (12)

一種用於讀取圖形資源和影像處理模型的電子裝置,包括:收發器;以及處理器,耦接所述收發器,其中所述處理器經配置以:使用第一執行緒執行第一任務以初始化圖形資源;使用第二執行緒執行第二任務以讀取影像處理模型;判斷所述第一任務和所述第二任務是否已經完成;響應於所述第一任務和所述第二任務已經完成,取得圖形設定;判斷所述影像處理模型與所述圖形設定是否匹配,並且響應於所述影像處理模型與所述圖形設定不匹配而使用所述第二執行緒再次執行所述第二任務以更新所述影像處理模型;以及根據所述圖形資源和所述影像處理模型產生輸出幀,並且通過所述收發器傳送所述輸出幀。 An electronic device for reading graphics resources and image processing models, comprising: a transceiver; and a processor coupled to the transceiver, wherein the processor is configured to: use a first thread to execute a first task to initialize graphics resources; use a second thread to execute a second task to read the image processing model; determine whether the first task and the second task have been completed; in response to the first task and the second task being completed, obtain graphics settings; determine whether the image processing model matches the graphics settings, and in response to the image processing model not matching the graphics settings, use the second thread to execute the second task again to update the image processing model; and generate an output frame according to the graphics resources and the image processing model, and transmit the output frame through the transceiver. 如請求項1所述的電子裝置,其中所述處理器更經配置以:判斷所述圖形資源與所述圖形設定是否匹配;以及響應於所述圖形資源與所述圖形設定不匹配而使用所述第一執行緒再次執行所述第一任務以更新所述圖形資源。 An electronic device as described in claim 1, wherein the processor is further configured to: determine whether the graphics resource matches the graphics setting; and in response to the graphics resource not matching the graphics setting, execute the first task again using the first execution thread to update the graphics resource. 如請求項1所述的電子裝置,更包括: 儲存媒體,耦接所述處理器,其中所述第一任務包括:清理所述儲存媒體中對應於先前幀的先前圖形資源;以及初始化對應於當前幀的所述圖形資源以將所述圖形資源儲存在所述儲存媒體中。 The electronic device as described in claim 1 further comprises: A storage medium coupled to the processor, wherein the first task comprises: clearing the previous graphics resources corresponding to the previous frame in the storage medium; and initializing the graphics resources corresponding to the current frame to store the graphics resources in the storage medium. 如請求項1所述的電子裝置,更包括:快取記憶體,耦接所述處理器,其中所述第二任務包括:檢查所述快取記憶體是否儲存對應於所述圖形設定的所述影像處理模型;以及響應於所述快取記憶體儲存對應於所述圖形設定的所述影像處理模型,自所述快取記憶體讀取所述影像處理模型。 The electronic device as described in claim 1 further comprises: a cache memory coupled to the processor, wherein the second task comprises: checking whether the cache memory stores the image processing model corresponding to the graphics setting; and in response to the cache memory storing the image processing model corresponding to the graphics setting, reading the image processing model from the cache memory. 如請求項4所述的電子裝置,更包括:儲存媒體,耦接所述處理器,並且儲存多個影像處理模型,其中所述第二任務更包括:響應於所述快取記憶體並未儲存對應於所述圖形設定的所述影像處理模型,自所述儲存媒體讀取所述多個影像處理模型中的所述影像處理模型,並且將所述影像處理模型儲存至所述快取記憶體。 The electronic device as described in claim 4 further includes: a storage medium coupled to the processor and storing a plurality of image processing models, wherein the second task further includes: in response to the cache memory not storing the image processing model corresponding to the graphics setting, reading the image processing model from the plurality of image processing models from the storage medium, and storing the image processing model in the cache memory. 如請求項1所述的電子裝置,其中所述圖形資源包括對應於輸出影像的當前幀的三維網格以及紋理。 An electronic device as described in claim 1, wherein the graphics resource includes a three-dimensional grid and texture corresponding to the current frame of the output image. 如請求項6所述的電子裝置,其中所述處理器更經配置以: 使用所述影像處理模型對所述當前幀執行深度預測以產生深度資訊;根據所述深度資訊更新所述三維網格;以及將所述紋理映射至經更新的所述三維網格以產生所述輸出幀。 An electronic device as described in claim 6, wherein the processor is further configured to: Perform depth prediction on the current frame using the image processing model to generate depth information; update the three-dimensional grid according to the depth information; and map the texture to the updated three-dimensional grid to generate the output frame. 如請求項1所述的電子裝置,其中所述處理器更經配置以:通過所述收發器接收用戶指令;以及響應於接收所述用戶指令,使用所述第一執行緒執行所述第一任務,並且使用所述第二執行緒執行所述第二任務。 An electronic device as described in claim 1, wherein the processor is further configured to: receive a user instruction through the transceiver; and in response to receiving the user instruction, use the first execution thread to execute the first task, and use the second execution thread to execute the second task. 如請求項8所述的電子裝置,其中所述處理器更經配置以:根據所述用戶指令開始產生包括所述輸出幀的輸出影像。 An electronic device as described in claim 8, wherein the processor is further configured to: start generating an output image including the output frame according to the user instruction. 如請求項8所述的電子裝置,其中所述處理器更經配置以:根據所述用戶指令停止產生包括所述輸出幀的輸出影像。 An electronic device as described in claim 8, wherein the processor is further configured to: stop generating an output image including the output frame according to the user instruction. 如請求項1所述的電子裝置,更包括:儲存媒體,耦接所述處理器,並且儲存用於產生輸出影像的應用程式,其中所述處理器更經配置以:響應於所述應用程式被啟用,使用所述第一執行緒執行所述第一任務,並且使用所述第二執行緒執行所述第二任務。 The electronic device as claimed in claim 1 further comprises: a storage medium coupled to the processor and storing an application for generating an output image, wherein the processor is further configured to: in response to the application being activated, use the first execution thread to execute the first task, and use the second execution thread to execute the second task. 一種用於讀取圖形資源和影像處理模型的方法,包括: 使用處理器的第一執行緒執行第一任務以初始化圖形資源;使用所述處理器的第二執行緒執行第二任務以讀取影像處理模型;判斷所述第一任務和所述第二任務是否已經完成;響應於所述第一任務和所述第二任務已經完成,取得圖形設定;判斷所述影像處理模型與所述圖形設定是否匹配,並且響應於所述影像處理模型與所述圖形設定不匹配而使用所述第二執行緒再次執行所述第二任務以更新所述影像處理模型;以及根據所述圖形資源和所述影像處理模型產生輸出幀,並且通過收發器傳送所述輸出幀。 A method for reading graphics resources and image processing models, comprising: Using a first thread of a processor to execute a first task to initialize graphics resources; using a second thread of the processor to execute a second task to read an image processing model; determining whether the first task and the second task have been completed; in response to the first task and the second task being completed, obtaining graphics settings; determining whether the image processing model matches the graphics settings, and in response to the image processing model not matching the graphics settings, using the second thread to execute the second task again to update the image processing model; and generating an output frame according to the graphics resources and the image processing model, and transmitting the output frame through a transceiver.
TW111149150A 2022-12-21 2022-12-21 Electronic device and method for loading graphic resource and image processing model TWI838028B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW111149150A TWI838028B (en) 2022-12-21 2022-12-21 Electronic device and method for loading graphic resource and image processing model

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW111149150A TWI838028B (en) 2022-12-21 2022-12-21 Electronic device and method for loading graphic resource and image processing model

Publications (2)

Publication Number Publication Date
TWI838028B true TWI838028B (en) 2024-04-01
TW202427191A TW202427191A (en) 2024-07-01

Family

ID=91618919

Family Applications (1)

Application Number Title Priority Date Filing Date
TW111149150A TWI838028B (en) 2022-12-21 2022-12-21 Electronic device and method for loading graphic resource and image processing model

Country Status (1)

Country Link
TW (1) TWI838028B (en)

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW200511113A (en) * 2003-08-18 2005-03-16 Nvidia Corp Adaptive load balancing in a multi-processor graphics processing system
CN107870816A (en) * 2016-09-27 2018-04-03 苏宁云商集团股份有限公司 A kind of method and device for being used for image procossing and storage
TW201911027A (en) * 2017-07-27 2019-03-16 優派國際股份有限公司 Method for adjusting output images and multi-picture display system
US20190236749A1 (en) * 2018-01-29 2019-08-01 Microsoft Technology Licensing, Llc Fifo queue, memory resource, and task management for graphics processing
TW201946436A (en) * 2018-04-17 2019-12-01 美商菲絲博克科技有限公司 Image sensor, method for image reconstruction from image sensor output and non-transitory computer readable medium storing instructions
CN111464522A (en) * 2020-03-27 2020-07-28 银江股份有限公司 System and method for automatically generating service based on container
US20200349385A1 (en) * 2018-04-13 2020-11-05 Tencent Technology (Shenzhen) Company Limited Multimedia resource matching method and apparatus, storage medium, and electronic apparatus
US20220004773A1 (en) * 2020-07-06 2022-01-06 Electronics And Telecommunications Research Institute Apparatus for training recognition model, apparatus for analyzing video, and apparatus for providing video search service
CN114035854A (en) * 2020-07-21 2022-02-11 珠海全志科技股份有限公司 SoC-based image processing system starting control method and device
CN114663901A (en) * 2020-12-04 2022-06-24 北京搜狗科技发展有限公司 Image processing method, image recognition device, electronic apparatus, and medium

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW200511113A (en) * 2003-08-18 2005-03-16 Nvidia Corp Adaptive load balancing in a multi-processor graphics processing system
CN107870816A (en) * 2016-09-27 2018-04-03 苏宁云商集团股份有限公司 A kind of method and device for being used for image procossing and storage
TW201911027A (en) * 2017-07-27 2019-03-16 優派國際股份有限公司 Method for adjusting output images and multi-picture display system
US20190236749A1 (en) * 2018-01-29 2019-08-01 Microsoft Technology Licensing, Llc Fifo queue, memory resource, and task management for graphics processing
US20200349385A1 (en) * 2018-04-13 2020-11-05 Tencent Technology (Shenzhen) Company Limited Multimedia resource matching method and apparatus, storage medium, and electronic apparatus
TW201946436A (en) * 2018-04-17 2019-12-01 美商菲絲博克科技有限公司 Image sensor, method for image reconstruction from image sensor output and non-transitory computer readable medium storing instructions
CN111464522A (en) * 2020-03-27 2020-07-28 银江股份有限公司 System and method for automatically generating service based on container
US20220004773A1 (en) * 2020-07-06 2022-01-06 Electronics And Telecommunications Research Institute Apparatus for training recognition model, apparatus for analyzing video, and apparatus for providing video search service
CN114035854A (en) * 2020-07-21 2022-02-11 珠海全志科技股份有限公司 SoC-based image processing system starting control method and device
CN114663901A (en) * 2020-12-04 2022-06-24 北京搜狗科技发展有限公司 Image processing method, image recognition device, electronic apparatus, and medium

Similar Documents

Publication Publication Date Title
TWI622015B (en) Frame based clock rate adjustment for processing unit
EP3254171B1 (en) Clock rate adjustment for processing unit
TWI393067B (en) Graphics processing system with power-gating function, power-gating method, and computer program products thereof
JP6513891B2 (en) Active and stall cycle based dynamic scaling of processor frequency and bus bandwidth
US11567587B2 (en) Mixed reality system with reduced power rendering
EP3646177B1 (en) Early virtualization context switch for virtualized accelerated processing device
US20220058048A1 (en) Varying firmware for virtualized device
TWI498849B (en) Method for graphics driver level decoupled rendering and display
KR102521654B1 (en) Computing system and method for performing graphics pipeline of tile-based rendering thereof
JP2020518876A (en) Shader writing to compressed resources
WO2022237289A1 (en) Vibration control method and apparatus, mobile terminal, and storage medium
TWI838028B (en) Electronic device and method for loading graphic resource and image processing model
TW202427191A (en) Electronic device and method for loading graphic resource and image processing model
TWI566205B (en) Method for approximating motion blur in rendered frame from within graphic driver
TWI817875B (en) Electronic device and method of generating 3d image based on multi-thread
TW202427360A (en) Electronic device and method of generating 3d image based on multi-thread
JP2006171760A (en) Memory controller with graphic processing function
JP6132902B1 (en) Computer graphic equipment
US20150109473A1 (en) Programming a camera sensor
BR112018015857B1 (en) FRAME-BASED CLOCK RATE ADJUSTMENT FOR PROCESSING UNIT