CN113538215A - Image format conversion method, device and system, electronic equipment and storage medium - Google Patents

Image format conversion method, device and system, electronic equipment and storage medium Download PDF

Info

Publication number
CN113538215A
CN113538215A CN202110653285.9A CN202110653285A CN113538215A CN 113538215 A CN113538215 A CN 113538215A CN 202110653285 A CN202110653285 A CN 202110653285A CN 113538215 A CN113538215 A CN 113538215A
Authority
CN
China
Prior art keywords
data
format
image
channels
groups
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
CN202110653285.9A
Other languages
Chinese (zh)
Other versions
CN113538215B (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.)
Spreadtrum Semiconductor Chengdu Co Ltd
Original Assignee
Spreadtrum Semiconductor Chengdu 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 Spreadtrum Semiconductor Chengdu Co Ltd filed Critical Spreadtrum Semiconductor Chengdu Co Ltd
Priority to CN202110653285.9A priority Critical patent/CN113538215B/en
Publication of CN113538215A publication Critical patent/CN113538215A/en
Application granted granted Critical
Publication of CN113538215B publication Critical patent/CN113538215B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/04Context-preserving transformations, e.g. by using an importance map
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Image Processing (AREA)

Abstract

The invention discloses a method, a device and a system for converting an image format, electronic equipment and a storage medium. The image format conversion method comprises the following steps: receiving image data in a first format; analyzing the image data into component data of three channels; dividing the component data of the three channels into m first data groups respectively; sending 3m first data groups to m computing units of a graphics processor, and receiving a second data group sent by the computing units; and combining the component data in the second data group to obtain image data in a second format. The invention analyzes and divides the image data of the first format to obtain 3m first data groups, and m computing units in the image processor perform parallel computation on the 3m first data groups, thereby realizing the conversion of the image data of the first format into the image data of the second format, greatly reducing the time of format conversion and improving the efficiency of format conversion.

Description

Image format conversion method, device and system, electronic equipment and storage medium
Technical Field
The present invention relates to the field of image processing, and in particular, to a method, an apparatus, and a system for converting an image format, an electronic device, and a storage medium.
Background
At present, data output formats of widely adopted digital image sensors and analog image sensors are generally YUV formats, and different sampling modes such as YUV4:4:4, YUV4:2:2 or YUV4:2:0 and different storage modes such as a plane format or a packaging format cause that YUV data has multiple formats. RGB data is mainly used for hardware-oriented devices, which are widely used for video monitors, color cameras, printers, or the like. In the use process of the RGB data, different numbers of bits and different arrangement of R, G, B for each pixel point also result in different format standards for the RGB data.
Under the condition that the acquired data is in YUV format and the display equipment supports RGB format, the acquired data is transmitted to the display equipment for display, and conversion from YUV to RGB color space is needed. Under the condition that the acquired data is in an RGB format and the display equipment supports a YUV format, the acquired data is transmitted to the display equipment for display, and conversion from RGB to YUV color space is needed.
At present, conversion between YUV and RGB is usually performed in a CPU (Central Processing Unit), and since conversion between YUV and RGB data formats involves a large amount of floating point operations and matrix transformation calculations, for an embedded device, performing a large amount of data format conversion in the CPU causes a CPU load of the embedded device to be increased, a calculation time to be too long, and finally causes a format conversion time of YUV and RGB data to be increased, which affects a conversion effect, and in a serious case, even affects other real-time tasks running in the CPU, thereby reducing the performance of the CPU.
Disclosure of Invention
The invention provides a method, a device and a system for converting an image format, an electronic device and a storage medium, which aim to overcome the defects that conversion time is long and the performance of a CPU is affected when conversion between YUV and RGB is performed in the CPU.
The invention solves the technical problems through the following technical scheme:
a first aspect of the present invention provides a method for converting an image format, including the steps of:
receiving image data in a first format;
analyzing the image data into component data of three channels;
dividing the component data of the three channels into m first data groups respectively, wherein m is an integer greater than or equal to 2;
sending 3m first data groups to m calculation units of a graphics processor, and receiving a second data group sent by the calculation units, wherein the 3 first data groups sent to the same calculation unit are ith first data groups of three channels, i is an integer less than or equal to m, the second data group is obtained by format conversion of component data in the first data groups by the calculation units according to a second format, and the second data groups correspond to the first data groups one by one;
and combining the component data in the second data group to obtain image data in a second format.
Optionally, before the step of performing segmentation, the method of converting further comprises:
if the quantity of the component data of the three channels is inconsistent, filling the component data with a small quantity according to a preset storage space so as to enable the quantity of the component data of each channel to be consistent.
Optionally, the step of dividing the component data of the three channels into m first data groups respectively specifically includes: the component data for each channel is partitioned according to the number of computational units in the graphics processor.
Optionally, the step of combining the component data in the second data group to obtain the image data in the second format specifically includes:
the components in the 3 second data sets corresponding to the ith first data set of the three channels are combined according to a second format.
Optionally, the first format is a YUV format, and the second format is an RGB format.
Optionally, the first format is an RGB format, and the second format is a YUV format.
A second aspect of the present invention provides an image format conversion apparatus, comprising:
a receiving unit configured to receive image data in a first format;
the analysis unit is used for analyzing the image data into component data of three channels;
a dividing unit, configured to divide component data of three channels into m first data groups, where m is an integer greater than or equal to 2;
the communication unit is used for sending 3m first data groups to m calculation units of the graphics processor and receiving second data groups sent by the calculation units, wherein the 3 first data groups sent to the same calculation unit are ith first data groups of three channels respectively, i is an integer less than or equal to m, the second data groups are obtained by performing format conversion on component data in the first data groups by the calculation units according to a second format, and the second data groups correspond to the first data groups one to one;
and the combination unit is used for combining the component data in the second data group to obtain the image data in the second format.
Optionally, the conversion apparatus further includes a filling unit, configured to, when the number of the component data of the three channels is inconsistent, fill the component data with a smaller number according to a preset storage space, so that the number of the component data of each channel is consistent.
Optionally, the segmentation unit is specifically configured to segment the component data of each channel according to the number of computing units in the graphics processor.
Optionally, the combining unit is specifically configured to combine components in 3 second data sets corresponding to ith first data sets of the three channels according to the second format.
Optionally, the first format is a YUV format, and the second format is an RGB format.
Optionally, the first format is an RGB format, and the second format is a YUV format.
A third aspect of the present invention provides an electronic device, comprising a memory, a central processing unit, and a computer program stored on the memory and executable on the central processing unit, wherein the central processing unit implements the method for converting an image format according to the first aspect when executing the computer program.
Optionally, the electronic device further includes a graphics processor communicatively connected to the central processor, where the graphics processor includes at least m computing units.
A fourth aspect of the present invention provides a method for converting an image format, including the steps of:
the method comprises the steps that a central processing unit receives image data in a first format, analyzes the image data into component data of three channels, divides the component data of the three channels into m first data groups respectively, and sends 3m first data groups to m calculation units of a graphics processor, wherein the 3 first data groups sent to the same calculation unit are the ith first data groups of the three channels respectively, m is an integer greater than or equal to 2, and i is an integer less than or equal to m;
the computing unit performs format conversion on the component data in the first data group according to a second format to obtain a corresponding second data group, and sends all the second data groups to the central processing unit;
and the central processing unit combines the component data in the second data group to obtain the image data in the second format.
A fifth aspect of the present invention provides an image format conversion system, including a central processing unit and a graphics processor, where the graphics processor includes at least m computing units, where m is an integer greater than or equal to 2;
the central processing unit is used for receiving the image data in the first format, analyzing the image data into component data of three channels, dividing the component data of the three channels into m first data groups respectively, and sending the 3m first data groups to m computing units of the graphics processor; the 3 first data groups sent to the same computing unit are respectively the ith first data groups of the three channels, and i is an integer less than or equal to m;
the computing unit is used for carrying out format conversion on the component data in the first data group according to a second format to obtain a corresponding second data group and sending all the second data groups to the central processing unit;
the central processing unit is further configured to combine the component data in the second data group to obtain the image data in the second format.
A sixth aspect of the present invention provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the method of converting an image format according to the first or fourth aspect
The positive progress effects of the invention are as follows: the image data in the first format is analyzed and segmented to obtain 3m first data groups, and the 3m first data groups are calculated in parallel by m calculation units in the graphics processor, so that the image data in the first format is converted into the image data in the second format, the format conversion time is greatly reduced, and the format conversion efficiency is improved.
Drawings
Fig. 1 is a flowchart of an image format conversion method according to embodiment 1 of the present invention.
Fig. 2 is a schematic diagram of component data of an R channel, a G channel, and a B channel according to embodiment 1 of the present invention after being divided.
Fig. 3 is a schematic diagram of component data of a Y channel, a U channel, and a V channel according to embodiment 1 of the present invention after being divided.
Fig. 4 is a block diagram of a structure of an image format conversion apparatus according to embodiment 1 of the present invention.
Fig. 5 is a schematic structural diagram of an electronic device according to embodiment 2 of the present invention.
Fig. 6 is a block diagram of a structure of an image format conversion system according to embodiment 3 of the present invention.
Detailed Description
The invention is further illustrated by the following examples, which are not intended to limit the scope of the invention.
Example 1
Fig. 1 is a flowchart illustrating a method for converting an image format according to this embodiment, where the method may be executed by an image format conversion apparatus, the image format conversion apparatus may be implemented by software and/or hardware, and the image format conversion apparatus may include part or all of an electronic device.
As shown in fig. 2, the method for converting an image format provided by the present embodiment may include the following steps S101 to S103:
step S101, image data in a first format is received.
In an implementation of step S101, the received image data may be image data downloaded from a network, and the format thereof may be RGB format, such as RGB4:4:4, RGB4:2:2, and the like. The received image data may also be raw data output by the video capture chip, and the format may be YUV format, such as YUV4:4:4, YUV4:2:2, YUV4:2:0, and so on. The format of the image data, that is, the first format, may be determined according to the specific attribute of the image data.
And step S102, analyzing the image data into component data of three channels.
In the example where the first format is the RGB format, the image data is analyzed as component data of an R channel, component data of a G channel, and component data of a B channel. In an example where the first format is a YUV format, the image data is parsed into component data of a Y channel, component data of a U channel, and component data of a V channel.
In an optional implementation manner, if the number of the component data of the three channels is inconsistent, the component data with a smaller number is filled according to a preset storage space, so that the number of the component data of each channel is consistent. In a specific implementation, the same storage space may be applied for each channel according to the largest amount of component data. In addition, in the data padding process, 0 may be padded in the corresponding storage space, so that the number of component data per channel is kept consistent after data padding.
Step S103, the component data of the three channels are divided into m first data groups, respectively. Wherein m is an integer of 2 or more.
And step S104, sending 3m first data sets to m calculation units of the graphics processor, and receiving a second data set sent by the calculation units. The 3 first data groups sent to the same computing unit are the ith first data groups of the three channels respectively, and i is an integer less than or equal to m. The second data group is obtained by performing format conversion on the component data in the first data group by the computing unit according to a second format, and the second data group is in one-to-one correspondence with the first data group, that is, the number of the second data group is the same as that of the first data group, and is 3 m.
Fig. 2 is a schematic diagram illustrating a process of dividing component data of an R channel, a G channel, and a B channel. As shown in fig. 2, the component data of the R channel, the component data of the G channel, and the component data of the B channel are all divided into m groups, the 1 st first data group of the R channel, the G channel, and the B channel is sent to the computing unit 1, the 2 nd first data group of the R channel, the G channel, and the B channel is sent to the computing unit 2, and so on, the m-th first data group of the R channel, the G channel, and the B channel is sent to the computing unit m.
Fig. 3 is a schematic diagram showing a case where component data of a Y channel, a U channel, and a V channel is divided. As shown in fig. 3, the first format is YUV4:2:0, after the component data of the U channel and the V channel are padded, the component data of the Y channel, the component data of the U channel, and the component data of the V channel are divided into 4 groups, the 1 st first data group of the Y channel, the U channel, and the V channel is sent to the calculation unit 1, the 2 nd first data group of the Y channel, the U channel, and the V channel is sent to the calculation unit 2, the 3 rd first data group of the Y channel, the U channel, and the V channel is sent to the calculation unit 3, and the 4 th first data group of the Y channel, the U channel, and the V channel is sent to the calculation unit 4, respectively.
In some scenarios, the compute units in a graphics processor may also be referred to as GPU cores.
It should be noted that, since the first data group is sent to the computing unit in the idle state in the graphics processor, the computing unit in the graphics processor may be dedicated to the floating point operation and the matrix transformation operation, and thus, the efficiency of format conversion may be improved by performing parallel format conversion computation on the component data in the first data group by using a plurality of computing units. Specifically, the computing unit converts the component data in the first data group into corresponding second data groups, wherein the component data in the second data groups correspond to the three channels of the second format respectively. The second format is a target format for format conversion of the computing unit.
In a specific implementation of step S103, the component data of each channel may be divided according to the number of computing units in the graphics processor. Wherein the larger the number of computing units in the idle state, the more first data groups can be segmented.
It should be noted that, for component data of one channel, the number of the first data groups obtained by dividing needs to be less than or equal to the number of computing units in the graphics processor.
In an example where the first format is RGB format and the second format is YUV format, the calculation unit performs format conversion on the component data in the first data group using the following formula:
Figure BDA0003112665450000071
wherein i is an integer of m or less, m is the number of the first data groups, ArConversion matrix coefficients for RGB to YUV format, BrAnd quantizing the coefficients for the conversion matrix from the RGB format to the YUV format. Wherein the above formula is passedThe deformation may result in the following expression:
Yi=ar1*Ri+ar2*Gi+ar3*Bi
Ui=ar4*Ri-ar5*Gi+ar6*Bi+br1
Vi=ar4*Ri-ar5*Gi-ar6*Bi+br1
wherein, ar1、ar2、ar3、ar4、ar5、ar6Are all conversion matrix coefficients ArElement (b) ofr1Quantizing coefficients B for a transform matrixrOf (1). It should be noted that the matrix coefficients a are converted for different RGB formatsrAnd converting the matrix quantized coefficients BrAre different.
In this example, referring to fig. 2, component data of R channel, G channel, and B channel are divided to obtain m first data groups, respectively. For each first data group, R, G, B channels of component data are needed to obtain Y, U, V components through conversion, and therefore, 3 first data groups sent to the same computing unit are the ith first data groups of three channels respectively. By analogy, the three channels correspond to 3m first data groups in total and need to be sent to m computing units.
In an example where the first format is YUV format and the second format is RGB format, the calculation unit performs format conversion on the component data in the first data group using the following formula:
Figure BDA0003112665450000081
wherein i is an integer of m or less, m is the number of the first data groups, AtConversion matrix coefficients for YUV format to RGB format, BtAnd quantizing the coefficients for the conversion matrix from the YUV format to the RGB format. Wherein the above formula can be modified to obtain the following expressionFormula (II):
Ri=Yi+at1*(Vi-bt1)
Gi=Yi-at2*(Ui-bt1)-at3*(Vi-bt1)
Bi=Yi+at4*(Ui-bt1)
wherein, at1、at2、at3、at4Are all conversion matrix coefficients AtElement (b) oft1Quantizing coefficients B for a transform matrixtOf (1). It should be noted that, for different YUV formats, the matrix coefficient a is convertedtAnd converting the matrix quantized coefficients BtAre different.
In this example, referring to fig. 3, the component data of the Y channel, the U channel, and the V channel are divided into 4 first data groups. For each first data group, Y, U, V channels of component data are needed to obtain R, G, B components through conversion, and therefore, 3 first data groups sent to the same computing unit are the ith first data groups of three channels respectively. By analogy, the three channels correspond to 4 × 3 — 12 first data sets in total, and need to be sent to 4 computing units.
In the specific implementation of step S104, the first data group may be sent to the graphics processor through the BUS, and the second data group sent by the graphics processor may be received through the BUS.
And step S105, combining the component data in the second data group to obtain image data in a second format. In a specific implementation, the components in the 3 second data sets corresponding to the ith first data set of the three channels are combined according to a second format. In the example shown in fig. 3, format conversion is performed on the 1 st first data group of the Y channel, the U channel, and the V channel according to the RGB format to obtain the 1 st second data group corresponding to the R channel, the G channel, and the B channel, and the second data groups of the three channels are combined, and so on, and the image data in the RGB format is obtained after all the second data groups are combined.
In this embodiment, the image data in the first format is analyzed and segmented to obtain 3m first data sets, and the m computing units in the graphics processor perform parallel computation on the 3m first data sets, so that the image data in the first format is converted into the image data in the second format, the format conversion time is greatly reduced, and the format conversion efficiency is improved.
The present embodiment further provides an image format conversion apparatus 40, as shown in fig. 4, including a receiving unit 41, an analyzing unit 42, a dividing unit 43, a communication unit 44, and a combining unit 45.
The receiving unit 41 is configured to receive image data in a first format.
The parsing unit 42 is configured to parse the image data into component data of three channels.
The dividing unit 43 is configured to divide the component data of the three channels into m first data groups, where m is an integer greater than or equal to 2.
In an alternative embodiment, the segmentation unit 43 is specifically configured to segment the component data of each channel according to the number of computing units in the graphics processor.
The communication unit 44 is configured to send 3m first data groups to m calculation units of a graphics processor, and receive a second data group sent by the calculation unit, where the 3 first data groups sent to the same calculation unit are ith first data groups of three channels, i is an integer less than or equal to m, the second data group is obtained by performing format conversion on component data in the first data groups by the calculation unit according to a second format, and the second data groups correspond to the first data groups one to one.
The combining unit 45 is configured to combine the component data in the second data group to obtain image data in a second format.
It should be noted that the image format conversion device in this embodiment may be a separate chip, a chip module, or an electronic device, or may be a chip or a chip module integrated in an electronic device.
The image format conversion apparatus described in this embodiment may include various modules/units, which may be software modules/units, or hardware modules/units, or may be partly software modules/units and partly hardware modules/units. For example, for each device and product applied to or integrated in a chip, each module/unit included in the device and product may be implemented by hardware such as a circuit, or at least a part of the modules/units may be implemented by a software program running on a processor integrated in the chip, and the rest of the modules/units may be implemented by hardware such as a circuit; for each device and product applied to or integrated with the chip module, each module/unit included in the device and product may be implemented in a hardware manner such as a circuit, and different modules/units may be located in the same component (e.g., a chip, a circuit module, etc.) or different components of the chip module, or at least a part of the modules/units may be implemented in a software program running on a processor integrated inside the chip module, and the remaining part of the modules/units may be implemented in a hardware manner such as a circuit; for each device and product applied to or integrated in a base station or an electronic device, each module/unit included in the device and product may be implemented by hardware such as a circuit, and different modules/units may be located in the same component (e.g., a chip, a circuit module, etc.) or different components in the electronic device, or at least a part of the modules/units may be implemented by a software program running on a processor integrated inside the electronic device, and the remaining part of the modules/units may be implemented by hardware such as a circuit.
Example 2
Fig. 5 is a schematic structural diagram of an electronic device provided in this embodiment. The electronic equipment comprises a central processing unit and a memory which is in communication connection with the central processing unit. Wherein the memory stores instructions executable by the at least one central processor, the instructions being executable by the at least one processor to enable the at least one central processor to perform the image format conversion method of embodiment 1. The electronic device 3 shown in fig. 5 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiment of the present invention.
The components of the electronic device 3 may include, but are not limited to: the at least one central processing unit 4, the at least one memory 5, a bus 6 connecting different system components (including the memory 5 and the central processing unit 4), a graphics processor 7, and a display module 8.
The bus 6 includes a data bus, an address bus, and a control bus.
The memory 5 may include volatile memory, such as Random Access Memory (RAM)51 and/or cache memory 52, and may further include Read Only Memory (ROM) 53.
The memory 5 may also include a program/utility 55 having a set (at least one) of program modules 54, such program modules 54 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may comprise an implementation of a network environment.
The graphic processor 7, also called a display core, a visual processor, and a display chip, is a microprocessor dedicated to image and graphic related operations on a personal computer, a workstation, a game console, and some mobile devices (e.g., a tablet computer, a smart phone, etc.).
The display module 8 is used to display images, videos, and the like. The display module 8 includes a display panel. The display panel can be a Liquid Crystal Display (LCD), an Organic Light Emitting Diode (OLED), an Active Matrix Organic Light Emitting Diode (AMOLED), a quantum dot light emitting diode (QLED), or the like.
The central processing unit 4 executes various functional applications and data processing, such as the above-described image format conversion method, by running the computer program stored in the memory 5.
The electronic device 3 may also communicate with one or more external devices 7, such as a keyboard, pointing device, etc. Such communication may be via an input/output (I/O) interface 9. Also, the electronic device 3 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the internet) through the network adapter 10. As shown in fig. 5, the network adapter 10 communicates with other modules of the electronic device 3 via the bus 6. It should be appreciated that although not shown in FIG. 5, other hardware and/or software modules may be used in conjunction with the electronic device 3, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID (disk array) systems, tape drives, and data backup storage systems, etc.
It should be noted that although in the above detailed description several units/modules or sub-units/modules of the electronic device are mentioned, such a division is merely exemplary and not mandatory. Indeed, the features and functionality of two or more of the units/modules described above may be embodied in one unit/module according to embodiments of the invention. Conversely, the features and functions of one unit/module described above may be further divided into embodiments by a plurality of units/modules.
Example 3
On the basis of embodiment 1, this embodiment provides a method for converting an image format, including the following steps:
step S201, a central processing unit receives image data in a first format, analyzes the image data into component data of three channels, divides the component data of the three channels into m first data groups respectively, and sends the 3m first data groups to m calculation units of a graphics processor, wherein the 3 first data groups sent to the same calculation unit are the ith first data groups of the three channels respectively, m is an integer greater than or equal to 2, and i is an integer less than or equal to m;
step S202, the calculating unit carries out format conversion on the component data in the first data group according to a second format to obtain a corresponding second data group, and sends all the second data groups to the central processing unit;
step S203, the central processing unit combines the component data in the second data group to obtain the image data in the second format.
The present embodiment further provides an image format conversion system 60, as shown in fig. 6, which includes a central processing unit 61 and a graphics processing unit 62, where the graphics processing unit 62 includes at least m computing units, where m is an integer greater than or equal to 2.
The central processing unit 61 is configured to receive image data in a first format, parse the image data into component data of three channels, divide the component data of the three channels into m first data groups, and send the 3m first data groups to m computing units of the graphics processor; the 3 first data groups sent to the same computing unit are the ith first data groups of the three channels respectively, and i is an integer less than or equal to m.
And the computing unit is used for carrying out format conversion on the component data in the first data group according to a second format to obtain a corresponding second data group and sending all the second data groups to the central processing unit.
The central processing unit 61 is further configured to combine the component data in the second data group to obtain the image data in the second format.
In this embodiment, the central processing unit analyzes and segments the image data in the first format to obtain 3m first data sets, and m computing units in the graphics processor perform parallel computing on the 3m first data sets, so that the image data in the first format is converted into the image data in the second format, the time for format conversion is greatly reduced, and the efficiency of format conversion is improved.
Example 4
The present embodiment provides a non-transitory computer-readable storage medium storing computer instructions for causing a computer to execute the method of converting an image format in embodiment 1 or embodiment 3.
More specific examples, among others, that the readable storage medium may employ may include, but are not limited to: a portable disk, a hard disk, random access memory, read only memory, erasable programmable read only memory, optical storage device, magnetic storage device, or any suitable combination of the foregoing.
In a possible implementation, the invention may also be implemented in the form of a program product comprising program code for causing an electronic device to perform a method of converting an image format as in embodiment 1 or embodiment 3 when said program product is run on said electronic device.
Where program code for carrying out the invention is written in any combination of one or more programming languages, the program code may be executed entirely on the electronic device, partly on the electronic device, as a stand-alone software package, partly on the electronic device and partly on a remote device or entirely on the remote device.
While specific embodiments of the invention have been described above, it will be appreciated by those skilled in the art that this is by way of example only, and that the scope of the invention is defined by the appended claims. Various changes and modifications to these embodiments may be made by those skilled in the art without departing from the spirit and scope of the invention, and these changes and modifications are within the scope of the invention.

Claims (15)

1. A method for converting an image format, comprising the steps of:
receiving image data in a first format;
analyzing the image data into component data of three channels;
dividing the component data of the three channels into m first data groups respectively, wherein m is an integer greater than or equal to 2;
sending 3m first data groups to m calculation units of a graphics processor, and receiving a second data group sent by the calculation units, wherein the 3 first data groups sent to the same calculation unit are ith first data groups of three channels, i is an integer less than or equal to m, the second data group is obtained by format conversion of component data in the first data groups by the calculation units according to a second format, and the second data groups correspond to the first data groups one by one;
and combining the component data in the second data group to obtain image data in a second format.
2. The method for converting an image format according to claim 1, wherein before the step of performing segmentation, the method for converting further comprises:
if the quantity of the component data of the three channels is inconsistent, filling the component data with a small quantity according to a preset storage space so as to enable the quantity of the component data of each channel to be consistent.
3. The method for converting an image format according to claim 1 or 2, wherein the step of dividing the component data of the three channels into m first data groups respectively includes: the component data for each channel is partitioned according to the number of computational units in the graphics processor.
4. The method for converting an image format according to any one of claims 1 to 3, wherein the step of combining the component data in the second data group to obtain the image data in the second format specifically comprises:
the components in the 3 second data sets corresponding to the ith first data set of the three channels are combined according to a second format.
5. The method for converting an image format according to any one of claims 1 to 4,
the first format is YUV format, and the second format is RGB format; alternatively, the first and second electrodes may be,
the first format is an RGB format, and the second format is a YUV format.
6. An apparatus for converting an image format, comprising:
a receiving unit configured to receive image data in a first format;
the analysis unit is used for analyzing the image data into component data of three channels;
a dividing unit, configured to divide component data of three channels into m first data groups, where m is an integer greater than or equal to 2;
the communication unit is used for sending 3m first data groups to m calculation units of the graphics processor and receiving second data groups sent by the calculation units, wherein the 3 first data groups sent to the same calculation unit are ith first data groups of three channels respectively, i is an integer less than or equal to m, the second data groups are obtained by performing format conversion on component data in the first data groups by the calculation units according to a second format, and the second data groups correspond to the first data groups one to one;
and the combination unit is used for combining the component data in the second data group to obtain the image data in the second format.
7. The conversion apparatus according to claim 6, further comprising a padding unit configured to pad a smaller number of component data according to a preset storage space so that the number of component data per channel is consistent, in a case where the number of component data of three channels is inconsistent.
8. The conversion apparatus according to claim 6 or 7, wherein the segmentation unit is specifically configured to segment the component data of each channel according to the number of computing units in the graphics processor.
9. Conversion device according to one of claims 6 to 8, characterized in that the combination unit is in particular adapted to combine the components of the 3 second data sets corresponding to the ith first data set of the three channels according to the second format.
10. The conversion apparatus according to any one of claims 6 to 9,
the first format is YUV format, and the second format is RGB format; alternatively, the first and second electrodes may be,
the first format is an RGB format, and the second format is a YUV format.
11. An electronic device comprising a memory, a central processing unit, and a computer program stored on the memory and executable on the central processing unit, wherein the central processing unit implements the method for converting an image format according to any one of claims 1 to 5 when executing the computer program.
12. The electronic device of claim 11, further comprising a graphics processor communicatively connected to the central processor, the graphics processor comprising at least m computing units.
13. A method for converting an image format, comprising the steps of:
the method comprises the steps that a central processing unit receives image data in a first format, analyzes the image data into component data of three channels, divides the component data of the three channels into m first data groups respectively, and sends 3m first data groups to m calculation units of a graphics processor, wherein the 3 first data groups sent to the same calculation unit are the ith first data groups of the three channels respectively, m is an integer greater than or equal to 2, and i is an integer less than or equal to m;
the computing unit performs format conversion on the component data in the first data group according to a second format to obtain a corresponding second data group, and sends all the second data groups to the central processing unit;
and the central processing unit combines the component data in the second data group to obtain the image data in the second format.
14. The image format conversion system is characterized by comprising a central processing unit and a graphics processor, wherein the graphics processor comprises at least m computing units, and m is an integer greater than or equal to 2;
the central processing unit is used for receiving the image data in the first format, analyzing the image data into component data of three channels, dividing the component data of the three channels into m first data groups respectively, and sending the 3m first data groups to m computing units of the graphics processor; the 3 first data groups sent to the same computing unit are respectively the ith first data groups of the three channels, and i is an integer less than or equal to m;
the computing unit is used for carrying out format conversion on the component data in the first data group according to a second format to obtain a corresponding second data group and sending all the second data groups to the central processing unit;
the central processing unit is further configured to combine the component data in the second data group to obtain the image data in the second format.
15. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out a method of converting an image format according to any one of claims 1 to 5 and 13.
CN202110653285.9A 2021-06-11 2021-06-11 Image format conversion method, device and system, electronic equipment and storage medium Active CN113538215B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110653285.9A CN113538215B (en) 2021-06-11 2021-06-11 Image format conversion method, device and system, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110653285.9A CN113538215B (en) 2021-06-11 2021-06-11 Image format conversion method, device and system, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113538215A true CN113538215A (en) 2021-10-22
CN113538215B CN113538215B (en) 2022-12-27

Family

ID=78124906

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110653285.9A Active CN113538215B (en) 2021-06-11 2021-06-11 Image format conversion method, device and system, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113538215B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115348432A (en) * 2022-08-15 2022-11-15 上海壁仞智能科技有限公司 Data processing method and device, image processing method, electronic device and medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5798753A (en) * 1995-03-03 1998-08-25 Sun Microsystems, Inc. Color format conversion in a parallel processor
JP2005323293A (en) * 2004-05-11 2005-11-17 Fujitsu Ltd Image processing apparatus
US20080180456A1 (en) * 2007-01-26 2008-07-31 Microsoft Corporation Fast Filtered YUV to RGB Conversion
CN101867833A (en) * 2010-06-12 2010-10-20 北京东方艾迪普科技发展有限公司 Method and device for converting video image format
WO2014067138A1 (en) * 2012-11-02 2014-05-08 华为技术有限公司 Image processing method, apparatus and computer-readable medium
CN109934783A (en) * 2019-03-04 2019-06-25 天翼爱音乐文化科技有限公司 Image processing method, device, computer equipment and storage medium
CN110324598A (en) * 2018-03-30 2019-10-11 武汉斗鱼网络科技有限公司 A kind of image processing method, device and computer equipment

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5798753A (en) * 1995-03-03 1998-08-25 Sun Microsystems, Inc. Color format conversion in a parallel processor
JP2005323293A (en) * 2004-05-11 2005-11-17 Fujitsu Ltd Image processing apparatus
US20080180456A1 (en) * 2007-01-26 2008-07-31 Microsoft Corporation Fast Filtered YUV to RGB Conversion
CN101867833A (en) * 2010-06-12 2010-10-20 北京东方艾迪普科技发展有限公司 Method and device for converting video image format
WO2014067138A1 (en) * 2012-11-02 2014-05-08 华为技术有限公司 Image processing method, apparatus and computer-readable medium
CN103918007A (en) * 2012-11-02 2014-07-09 华为技术有限公司 Image processing method, apparatus and computer-readable medium
CN110324598A (en) * 2018-03-30 2019-10-11 武汉斗鱼网络科技有限公司 A kind of image processing method, device and computer equipment
CN109934783A (en) * 2019-03-04 2019-06-25 天翼爱音乐文化科技有限公司 Image processing method, device, computer equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115348432A (en) * 2022-08-15 2022-11-15 上海壁仞智能科技有限公司 Data processing method and device, image processing method, electronic device and medium
CN115348432B (en) * 2022-08-15 2024-05-07 上海壁仞科技股份有限公司 Data processing method and device, image processing method, electronic equipment and medium

Also Published As

Publication number Publication date
CN113538215B (en) 2022-12-27

Similar Documents

Publication Publication Date Title
US20140362098A1 (en) Display stream compression
US7460136B2 (en) Efficient scaling of image data in graphics display systems
US20140086309A1 (en) Method and device for encoding and decoding an image
US10559244B2 (en) Electronic apparatus, display driver and method for generating display data of display panel
US11856238B2 (en) System and method for RGBG conversion
CN113538215B (en) Image format conversion method, device and system, electronic equipment and storage medium
US20220292638A1 (en) Video resolution enhancement method, storage medium, and electronic device
US20240104780A1 (en) Image compression method and apparatus, and intelligent terminal and computer-readable storage medium
CN108650460A (en) Server, panoramic video store and transmit method and computer storage media
US10186052B1 (en) Two-pass decoding of images
KR100818034B1 (en) ON THE FLY DATA TRANSFER BETWEEN RGB AND YCrCb COLOR SPACES FOR DCT INTERFACE
CN114926318A (en) Multi-GPU aggregation method, image processing device, electronic equipment and storage medium
WO2021073638A1 (en) Method and apparatus for running neural network model, and computer device
US10015496B2 (en) Method and apparatus for temporal reference coding with light coding systems for display systems
US20140281603A1 (en) System, method, and computer program product for allowing a head to enter a reduced power mode
CN116405692A (en) Transmission method based on cloud matting and related equipment
KR20020052199A (en) Data transfer between rgb and ycrcb color spaces for dct interface
CN115576513A (en) Target image display method, display device, electronic device, and storage medium
WO2022141022A1 (en) Methods and apparatus for adaptive subsampling for demura corrections
US10152766B2 (en) Image processor, method, and chipset for increasing intergration and performance of image processing
CN111787331B (en) Display data compression method, compression device and display device
CN110944194A (en) System and method for switching display links back and forth
CN101065760A (en) System and method for processing image data
CN116109468B (en) Graphics processing unit, instruction compiling method, storage medium, and terminal device
US20080229034A1 (en) Data management for image processing

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