CN114155137A - Format conversion method, controller and computer-readable storage medium - Google Patents
Format conversion method, controller and computer-readable storage medium Download PDFInfo
- Publication number
- CN114155137A CN114155137A CN202111296756.1A CN202111296756A CN114155137A CN 114155137 A CN114155137 A CN 114155137A CN 202111296756 A CN202111296756 A CN 202111296756A CN 114155137 A CN114155137 A CN 114155137A
- Authority
- CN
- China
- Prior art keywords
- format
- image data
- processed
- buffer
- determining
- 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.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T1/00—General purpose image data processing
- G06T1/60—Memory management
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F12/00—Accessing, addressing or allocating within memory systems or architectures
- G06F12/02—Addressing or allocation; Relocation
- G06F12/08—Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
- G06F12/0802—Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
- G06F12/0875—Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches with dedicated cache, e.g. instruction or stack
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F12/00—Accessing, addressing or allocating within memory systems or architectures
- G06F12/02—Addressing or allocation; Relocation
- G06F12/08—Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
- G06F12/0802—Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
- G06F12/0893—Caches characterised by their organisation or structure
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T1/00—General purpose image data processing
- G06T1/0007—Image acquisition
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T1/00—General purpose image data processing
- G06T1/20—Processor architectures; Processor configuration, e.g. pipelining
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T9/00—Image coding
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2212/00—Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
- G06F2212/10—Providing a specific technical effect
- G06F2212/1016—Performance improvement
- G06F2212/1024—Latency reduction
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2212/00—Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
- G06F2212/45—Caching of specific data in cache memory
- G06F2212/455—Image or video data
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2210/00—Indexing scheme for image generation or computer graphics
- G06T2210/32—Image data format
Abstract
The invention discloses a format conversion method, a controller and a computer readable storage medium, wherein the method comprises the following steps: acquiring image data to be processed and determining an input format and an output format of the image data to be processed; determining a read-write address of a buffer in the buffer unit according to the input format, and determining a format conversion parameter according to the input format and the output format; storing the image data to be processed into a corresponding buffer in the buffer unit according to the read-write address; and reading the corresponding image data to be processed in the buffer and outputting the image data to be processed to the computing unit, so that the computing unit converts the image data to be processed from the input format to the output format according to the format conversion parameter. It is intended to improve the efficiency of image data format conversion.
Description
Technical Field
The present invention relates to the field of image format conversion technologies, and in particular, to a format conversion method, a controller, and a computer-readable storage medium.
Background
At present, most of digital images are composed of pixels, the color of each pixel point can adopt RGB and YUV encoding methods, in an RGB image, each pixel point is composed of three primary colors of red, green and blue, and a YUV image adopts brightness and Chroma to represent the pixel point, wherein Y represents brightness (luminance), and U and V represent Chroma (Chroma). YUV data can be mainly divided into three storage formats: packet, planar and semi-planar, YUV format pixel points can save storage and bandwidth, and during image transmission, the pixel format is usually YUV format, but the image display usually uses RGB format. Therefore, when data is transmitted, an image needs to be converted into a YUV format, and when the image is displayed, the YUV format image is converted into an RGB format.
In the related art, the interconversion between the YUV format and the RGB format data is generally realized by the CPU, but the format conversion speed by the CPU is too slow, which results in low interconversion efficiency between the YUV format and the RGB format data.
The above is only for the purpose of assisting understanding of the technical aspects of the present invention, and does not represent an admission that the above is prior art.
Disclosure of Invention
The present invention provides a format conversion method, a controller and a computer readable storage medium, which aims to achieve the effect of improving the format conversion efficiency of image data.
In order to achieve the above object, the present invention provides a format conversion method applied to a controller of a format conversion system, wherein the controller is configured to control a configuration unit, a cache unit and a calculation unit in the format conversion system, the cache unit includes at least two caches, and the format conversion method includes:
acquiring image data to be processed and determining an input format and an output format of the image data to be processed;
determining a read-write address of a buffer in the buffer unit according to the input format, and determining a format conversion parameter according to the input format and the output format;
storing the image data to be processed into a corresponding buffer in the buffer unit according to the read-write address;
and reading the corresponding image data to be processed in the buffer and outputting the image data to be processed to the computing unit, so that the computing unit converts the image data to be processed from the input format to the output format according to the format conversion parameter.
Optionally, the step of determining the read-write address of the buffer in the buffer unit according to the input format, and determining the format conversion parameter according to the input format and the output format includes:
judging whether the input format is a YUV format;
if the input format is not the YUV format, determining a read-write address of a first buffer of the buffer unit, and executing the step of storing the image data to be processed into a corresponding buffer in the buffer unit according to the read-write address, wherein the image data to be processed is completely stored into the first buffer.
Optionally, the step of determining the read-write address of the buffer in the buffer unit according to the input format, and determining the format conversion parameter according to the input format and the output format includes:
judging whether the input format is a YUV format;
if the input format is the YUV format, judging whether the storage format of the YUV format of the image data to be processed is a packet format;
and determining the read-write address of the buffer in the buffer unit according to the judgment result.
Optionally, the step of determining the read-write address of the buffer in the buffer unit according to the determination result includes:
if the storage format of the YUV format of the image data to be processed is the packet format, determining a read-write address of a first buffer of the buffer unit, and executing the step of storing the image data to be processed into a corresponding buffer in the buffer unit according to the read-write address, wherein the image data to be processed is completely stored into the first buffer;
if the storage format of the YUV format of the image data to be processed is not the packet format, determining read-write addresses of a first buffer and a second buffer of the buffer unit, and executing the step of storing the image data to be processed into the corresponding buffers in the buffer unit according to the read-write addresses, wherein Y component data of the image data to be processed is stored into the first buffer, and U component data and V component data of the image data to be processed are stored into the second buffer.
Optionally, the format conversion system further includes a preprocessing module, and before the step of reading the corresponding image data to be processed in the buffer and outputting the image data to be processed to the computing unit, the format conversion system further includes:
acquiring a preset data sampling format and a preset data arrangement format in the configuration unit;
reading the corresponding image data to be processed in the cache unit and outputting the image data to be processed to the preprocessing module, so that the preprocessing module copies and rearranges the image data to be processed according to the preset data sampling format or the preset data arrangement format;
inputting the processed image data to the computing unit.
Optionally, the format conversion system further includes a post-processing module, and after the step of reading the corresponding image data to be processed in the buffer and outputting the image data to be processed to the computing unit, the format conversion system further includes:
acquiring a preset data sampling format and a preset data arrangement format in the configuration unit;
reading the converted image data in the computing unit and outputting the image data to the post-processing module so that the post-processing module performs sampling and rearrangement processing on the image data according to the preset data sampling format or the preset data arrangement format;
and outputting the processed image data.
Optionally, the step of reading the corresponding image data to be processed in the buffer and outputting the image data to be processed to the computing unit includes:
and performing matrix multiplication operation on the image data to be processed according to the conversion parameters so as to enable the computing unit to convert the image data to be processed from the input format to the output format.
Further, to achieve the above object, the present invention also provides a controller comprising: a memory, a processor and a format conversion program stored on the memory and executable on the processor, the format conversion program when executed by the processor implementing the steps of the format conversion method as described above.
Further, to achieve the above object, the present invention also provides a controller comprising:
the device comprises an acquisition module, a processing module and a display module, wherein the acquisition module is used for acquiring image data to be processed and determining an input format and an output format of the image data to be processed;
the determining module is used for determining the read-write address of a buffer in the buffer unit according to the input format and determining format conversion parameters according to the input format and the output format;
the cache module stores the image data to be processed into a corresponding cache in the cache unit according to the read-write address;
and the reading module is used for reading the corresponding image data to be processed in the buffer and outputting the image data to be processed to the computing unit, so that the computing unit converts the image data to be processed from the input format to the output format according to the format conversion parameter.
Further, to achieve the above object, the present invention also provides a computer-readable storage medium having a format conversion program stored thereon, the format conversion program, when executed by the processor, implementing the steps of the format conversion method as described above.
The format conversion method, the controller and the computer readable storage medium provided by the embodiment of the invention firstly acquire image data to be processed and determine the input format and the output format of the image data to be processed; determining a read-write address of a buffer in the buffer unit according to the input format, and determining a format conversion parameter according to the input format and the output format; storing the image data to be processed into a corresponding buffer in the buffer unit according to the read-write address; and reading the corresponding image data to be processed in the buffer and outputting the image data to be processed to the computing unit, so that the computing unit converts the image data to be processed from the input format to the output format according to the format conversion parameter. Therefore, the image data to be processed is stored in the buffer, the image data to be processed is read into the computing unit through the buffer, the address of the buffer is determined according to the input format of the image data to be processed, the image data to be processed is stored in the buffer, and the data is read from the buffer to the computing unit, so that the data can be input and computed at the same time, the conversion time is shortened, and the efficiency of converting the image data format is improved.
Drawings
Fig. 1 is a schematic terminal structure diagram of a hardware operating environment according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a format conversion method according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating a format conversion method according to another embodiment of the present invention;
fig. 4 is a schematic diagram of a controller architecture according to an embodiment of the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
In the related art, the conversion between the RGB format data and the YUV format data is usually realized by the CPU, and the calculation of the format conversion needs to be completed by inputting all the data, so that the speed of the format conversion by the CPU is too slow, which results in the low efficiency of the interconversion between the YUV format data and the RGB format data.
In order to improve the efficiency of interconversion between YUV format data and RGB format data, an embodiment of the present invention provides a format conversion method, a controller, and a computer-readable storage medium, where the method mainly includes:
acquiring image data to be processed and determining an input format and an output format of the image data to be processed;
determining a read-write address of a buffer in the buffer unit according to the input format, and determining a format conversion parameter according to the input format and the output format;
storing the image data to be processed into a corresponding buffer in the buffer unit according to the read-write address;
and reading the corresponding image data to be processed in the buffer and outputting the image data to be processed to the computing unit, so that the computing unit converts the image data to be processed from the input format to the output format according to the format conversion parameter.
Therefore, the address of the buffer is determined according to the input format of the image data to be processed, the image data to be processed is stored in the buffer, the data is read from the buffer and is converted into the data in the computing unit, the data can be input and the computation can be carried out at the same time, and the efficiency of converting the image data format is improved.
The following detailed description of the claimed invention refers to the accompanying drawings.
As shown in fig. 1, fig. 1 is a schematic diagram of a controller structure of a hardware operating environment according to an embodiment of the present invention.
The terminal of the embodiment of the invention can be a controller.
As shown in fig. 1, the terminal may include: a processor 1001, such as a CPU, a memory 1003, and a communication bus 1002. Wherein a communication bus 1002 is used to enable connective communication between these components. The memory 1003 may be a high-speed RAM memory or a non-volatile memory (e.g., a disk memory). The memory 1003 may alternatively be a storage device separate from the processor 1001.
Those skilled in the art will appreciate that the terminal structure shown in fig. 1 is not intended to be limiting and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
As shown in fig. 1, the memory 1003, which is a kind of computer storage medium, may include therein an operating system and a format conversion processing program.
In the terminal shown in fig. 1, the processor 1001 may be configured to call a format conversion program stored in the memory 1003, and perform the following operations:
acquiring image data to be processed and determining an input format and an output format of the image data to be processed;
determining a read-write address of a buffer in the buffer unit according to the input format, and determining a format conversion parameter according to the input format and the output format;
storing the image data to be processed into a corresponding buffer in the buffer unit according to the read-write address;
and reading the corresponding image data to be processed in the buffer and outputting the image data to be processed to the computing unit, so that the computing unit converts the image data to be processed from the input format to the output format according to the format conversion parameter.
Further, the processor 1001 may call a format conversion program stored in the memory 1003, and further perform the following operations:
judging whether the input format is a YUV format;
if the input format is not the YUV format, determining a read-write address of a first buffer of the buffer unit, and executing the step of storing the image data to be processed into a corresponding buffer in the buffer unit according to the read-write address, wherein the image data to be processed is completely stored into the first buffer.
Further, the processor 1001 may call a format conversion program stored in the memory 1003, and further perform the following operations:
judging whether the input format is a YUV format;
if the input format is the YUV format, judging whether the storage format of the YUV format of the image data to be processed is a packet format;
and determining the read-write address of the buffer in the buffer unit according to the judgment result.
Further, the processor 1001 may call a format conversion program stored in the memory 1003, and further perform the following operations:
if the storage format of the YUV format of the image data to be processed is the packet format, determining a read-write address of a first buffer of the buffer unit, and executing the step of storing the image data to be processed into a corresponding buffer in the buffer unit according to the read-write address, wherein the image data to be processed is completely stored into the first buffer;
if the storage format of the YUV format of the image data to be processed is not the packet format, determining read-write addresses of a first buffer and a second buffer of the buffer unit, and executing the step of storing the image data to be processed into the corresponding buffers in the buffer unit according to the read-write addresses, wherein Y component data of the image data to be processed is stored into the first buffer, and U component data and V component data of the image data to be processed are stored into the second buffer.
Further, the processor 1001 may call a format conversion program stored in the memory 1003, and further perform the following operations:
acquiring a preset data sampling format and a preset data arrangement format in the configuration unit;
reading the corresponding image data to be processed in the cache unit and outputting the image data to be processed to the preprocessing module, so that the preprocessing module copies and rearranges the image data to be processed according to the preset data sampling format or the preset data arrangement format;
inputting the processed image data to the computing unit.
Further, the processor 1001 may call a format conversion program stored in the memory 1003, and further perform the following operations:
acquiring a preset data sampling format and a preset data arrangement format in the configuration unit;
reading the converted image data in the computing unit and outputting the image data to the post-processing module so that the post-processing module performs sampling and rearrangement processing on the image data according to the preset data sampling format or the preset data arrangement format;
and outputting the processed image data.
Further, the processor 1001 may call a format conversion program stored in the memory 1003, and further perform the following operations:
and performing matrix multiplication operation on the image data to be processed according to the conversion parameters so as to enable the computing unit to convert the image data to be processed from the input format to the output format.
At present, most of digital images are composed of pixels, the color of each pixel point can adopt RGB and YUV encoding methods, in an RGB image, each pixel point is composed of three primary colors of red, green and blue, and a YUV image adopts brightness and Chroma to represent the pixel point, wherein Y represents brightness (luminance), and U and V represent Chroma (Chroma). The YUV format pixel point can save storage and bandwidth, and the pixel format is usually YUV when the image is transmitted, but the image display usually uses the RGB format.
YUV data can be mainly divided into three storage formats: packet, planar and semi-planar. The packet format is to store YUV data first and then store the next YUV data; the planar format is that Y data of all pixel points are continuously stored firstly, U data of all pixel points are stored subsequently, and V data of all pixel points are stored finally; the semi-planar format stores the Y data plane first and then stores the UV data plane.
In the related art, a CPU or a dedicated hardware module may be used to convert YUV and RGB format data into each other. However, the CPU is used to realize the interconversion between the YUV format and the RGB format, which occupies a large amount of CPU resources and is slow. The conversion between the YUV format and the RGB format is realized by using a special hardware module, the universality is limited, the specific requirement is met on the YUV data storage format, the conversion from the YUV format to the RGB format can be realized only, or the conversion from the RGB format to the YUV format can be realized only, and the universality is not high.
In order to solve the above-mentioned defects in the related art, the embodiment of the present invention provides a format conversion method, which improves the efficiency of image data format conversion, i.e., the efficiency of interconversion between the RGB format and the YUV format.
Hereinafter, the contents of the claims of the present invention are explained by specific exemplary embodiments so that those skilled in the art can better understand the scope of the claims of the present invention. It is to be understood that the following exemplary embodiments are not intended to limit the scope of the present invention, but are merely illustrative of the present invention.
Exemplarily, referring to fig. 2, in an embodiment of the format conversion method of the present invention, the format conversion method includes the steps of:
s10: acquiring image data to be processed and determining an input format and an output format of the image data to be processed;
in this embodiment, the format conversion method is applied to a controller of a format conversion system, where the controller is used to control a configuration unit, a cache unit and a calculation unit in the format conversion system, and the cache unit includes at least two caches. The buffer is used for buffering input image data to be processed, and the buffer can realize data storage and data reading. The image data to be processed is composed of a plurality of pixel points, each pixel point has own color, the color of each pixel point can adopt RGB and YUV encoding methods, in the RGB image, each pixel point is composed of three primary colors of red, green and blue, the YUV image adopts brightness and Chroma to represent the pixel point, wherein Y represents brightness (luminance), and U and V represent Chroma (Chroma). When the data to be processed is an RGB image, the input format is an RGB format, and the corresponding output format is a YUV format; when the data to be processed is a YUV image, its input format is YUV format, and the corresponding output format is RGB format.
S20: determining a read-write address of a buffer in the buffer unit according to the input format, and determining a format conversion parameter according to the input format and the output format;
s30: storing the image data to be processed into a corresponding buffer in the buffer unit according to the read-write address;
in this embodiment, the cache unit includes at least two caches, the image data to be processed needs to determine the read-write address of the cache in the cache unit according to the format conversion need, and the read-write address is used to confirm the location of the cache, so that the image data to be processed has a path to be stored in the cache unit; and determining format conversion parameters according to the input format and the output format, wherein the format conversion parameters are parameters required to be used during format conversion, and the format conversion parameters can be configured by a configuration unit in a format conversion system.
Optionally, after the input format of the image data to be processed is confirmed, it is determined whether the input format is a YUV format, that is, whether the image data to be processed is a YUV image. If the input format is not the YUV format, the input format is the RGB format, the image data to be processed is the RGB image, the RGB format is actually formed by combining three color data of R (red: red), G (green: green), and B (blue: blue), the image is displayed by mixing and superimposing the three color data according to different proportions on a color television or a computer display screen, and the red, green, and blue are also called three primary colors, so called "primary colors" because the three colors can become almost all colors that can be perceived by human examples after being mixed according to different proportions. And if the image data to be processed needs one buffer memory for storing the image data into the buffer memory unit, determining a read-write address of a first buffer memory of the buffer memory unit, and executing the step of storing the image data to be processed into a corresponding buffer memory in the buffer memory unit according to the read-write address, wherein the image data to be processed is completely stored into the first buffer memory.
Optionally, after the input format of the image data to be processed is confirmed, it is determined whether the input format is a YUV format, that is, whether the image data to be processed is a YUV image. And if the input format is the YUV format, judging whether the storage format of the YUV format of the image data to be processed is a packet format.
YUV color coding uses luminance and chrominance to represent pixels. Where Y denotes luminance (luminance), and U and V denote Chroma (Chroma). And chroma in turn defines two aspects of color: hue and saturation. For the YUV encoding format, the Y and UV components are separated. If only the Y component has no UV component, the image represents a black and white image. The human eyes have lower sensitivity to chrominance than to luminance, so that chrominance information is reduced to a certain extent and cannot be perceived by human eyes. Not every pixel point need contain Y, U, V three components, according to different sampling rates, can divide YUV sampling format into: YUV 444, YUV422, and YUV 420. YUV data can be divided into three storage formats: packet, planar and semi-planar.
packet format: storing YUV data first, and then storing the next YUV data;
planar format: firstly, continuously storing Y data of all pixel points, then storing U data of all pixel points, and finally storing V data of all pixel points;
semi-planar format: the Y data plane is stored first, followed by the UV data plane.
It will be appreciated that other YUV storage formats can store the Y component separately from the U and V components, except that in the packet format, the Y component of the image data cannot be stored separately from the U and V components.
After judging whether the storage format of the YUV format of the image data to be processed is a packet format, if the storage format of the YUV format of the image data to be processed is the packet format and the image data to be processed needs a buffer to be stored in a buffer unit, determining a read-write address of a first buffer of the buffer unit, and executing the step of storing the image data to be processed into a corresponding buffer in the buffer unit according to the read-write address, wherein the image data to be processed is completely stored in the first buffer; if the storage format of the YUV format of the image data to be processed is not a packet format, and the image data to be processed needs two buffers to be stored in a buffer unit, determining the read-write addresses of a first buffer and a second buffer of the buffer unit, and executing the step of storing the image data to be processed into the corresponding buffers in the buffer unit according to the read-write addresses, wherein Y component data of the image data to be processed is stored in the first buffer, and U component data and V component data of the image data to be processed are stored in the second buffer.
S40: and reading the corresponding image data to be processed in the buffer and outputting the image data to be processed to the computing unit, so that the computing unit converts the image data to be processed from the input format to the output format according to the format conversion parameter.
In this embodiment, the computing unit is composed of a plurality of computing engines, the number of the computing engines is expandable, and the mutual conversion between the RGB format and the YUV format is realized in a conversion matrix, a table lookup method, and an assembly language-based conversion method.
Optionally, a matrix multiplication operation is performed on the image data to be processed according to the conversion parameter, so that the computing unit converts the image data to be processed from the input format to the output format, and the matrix multiplication operation is implemented by the following two formulas:
coefficients (C11, C12 and the like) in the formula have slight difference for different algorithms, format conversion coefficients can be configured, the coefficients can be finely adjusted according to algorithm requirements, meanwhile, the same computing unit can realize conversion and reverse conversion of a YUV format and an RGB format, and computing resources are saved.
In the technical scheme disclosed in the embodiment, image data to be processed is obtained first, and an input format and an output format of the image data to be processed are determined; determining a read-write address of a buffer in the buffer unit according to the input format, and determining a format conversion parameter according to the input format and the output format; storing the image data to be processed into a corresponding buffer in the buffer unit according to the read-write address; and reading the corresponding image data to be processed in the buffer and outputting the image data to be processed to the computing unit, so that the computing unit converts the image data to be processed from the input format to the output format according to the format conversion parameter. Therefore, the image data to be processed is stored in the buffer, then the image data to be processed is read into the computing unit through the buffer, the address of the buffer is determined according to the input format of the image data to be processed, the image data to be processed is sequentially stored into the buffer, then the data is read from the buffer to the computing unit, and the data can be input and computed at the same time, so that the mutual conversion between the YUV format and the RGB format is realized, the multiplexing of computing resources is realized, and the efficiency of the conversion of the image data format is improved.
Optionally, referring to fig. 3, in another embodiment of the format conversion method of the present invention, the format conversion method further includes:
the format conversion system further includes a preprocessing module, and before the step of reading the corresponding image data to be processed in the buffer and outputting the image data to be processed to the computing unit, the format conversion system further includes:
s50: acquiring a preset data sampling format and a preset data arrangement format in the configuration unit;
s60: reading the corresponding image data to be processed in the cache unit and outputting the image data to be processed to the preprocessing module, so that the preprocessing module copies and rearranges the image data to be processed according to the preset data sampling format or the preset data arrangement format;
s70: inputting the processed image data to the computing unit. And/or
The format conversion system further includes a post-processing module, and after the step of reading the corresponding image data to be processed in the buffer and outputting the image data to be processed to the computing unit, the format conversion system further includes:
s80: acquiring a preset data sampling format and a preset data arrangement format in the configuration unit;
s90: reading the converted image data in the computing unit and outputting the image data to the post-processing module so that the post-processing module performs sampling and rearrangement processing on the image data according to the preset data sampling format or the preset data arrangement format;
s100: and outputting the processed image data.
In this embodiment, before the image data to be processed is input into the computing unit, the image data to be processed may be further processed by a pre-processing module to copy and rearrange the image data, and/or after the image data to be processed is input into the computing unit, the image data after conversion may be further processed by a post-processing module to sample and rearrange the image.
The method comprises the steps of firstly, obtaining a preset data sampling format and a preset data arrangement format configured by a configuration unit in a format conversion system, wherein the configuration unit is used for determining an input format and an output format of image data to be processed, and format conversion parameters and the like used when the preset data sampling format and YUV format and RGB format data are converted mutually.
Similar to the RGB format representation image, the YUV format contains Y, U, V data components for each pixel. But its Y data component and U, V data component are separable, and a complete image can be displayed without U, V data component, but in black and white. For the YUV format image, not every pixel point needs to contain Y, U, V three data components, and according to different sampling formats, each Y component may correspond to its own U, V data component, or several Y data components may share U, V data components.
In the pre-processing module, the conversion from the YUV format to the RGB format is to convert Y, U, V components of all pixel points of the image data to R, G, B components, before the conversion, the YUV format image may not have complete Y, U, V components for each pixel point, and needs to be restored to Y, U, V components corresponding to each pixel point, and the image data is copied and rearranged according to the preset data sampling format or the preset data arrangement format, so that the computing unit can convert Y, U, V components of all pixel points of the image to R, G, B components.
In the post-processing module, the conversion from the RGB format to the YUV format is to convert R, G, B data components of all pixel points of the image data into Y, U, V data components, after the conversion, each pixel point is a complete Y, U, V data component, next, Y, U, V data components of the image can be recombined in different sampling modes, and the image data is sampled and rearranged according to the preset data sampling format or the preset data arrangement format, so that the output YUV format conforms to the preset data sampling format of the configuration unit.
In the technical scheme disclosed in this embodiment, the image data is copied and rearranged by the pre-processing module according to the preset data sampling format or the preset data arrangement format and/or sampled and rearranged by the post-processing module according to the preset data sampling format or the preset data arrangement format, so that the YUV format image data in different sampling formats can be mutually converted with the RGB format, the effect of improving the universality of the mutual conversion of the YUV format and the RGB format is realized, and the efficiency of the mutual conversion of the YUV format and the RGB format is improved.
In addition, an embodiment of the present invention further provides a controller, where the controller includes a memory, a processor, and a format conversion program stored in the memory and executable on the processor, and when the format conversion program is executed by the processor, the controller implements the steps of the format conversion method according to the above embodiments.
Furthermore, an embodiment of the present invention further provides a controller, and exemplarily, referring to fig. 4, the controller 100 includes:
the image processing device comprises an acquisition module 101, a determination module 102, a cache module 103 and a reading module 104, wherein the acquisition module 101 is used for acquiring image data to be processed and determining an input format and an output format of the image data to be processed; the determining module 102 is configured to determine a read-write address of a buffer in a buffer unit according to the input format, and determine a format conversion parameter according to the input format and the output format; the cache module 103 is configured to store the image data to be processed into a corresponding cache in the cache unit according to the read-write address; the reading module 104 is configured to read the corresponding image data to be processed in the buffer and output the image data to a computing unit, so that the computing unit converts the image data to be processed from the input format to the output format according to the format conversion parameter.
Furthermore, an embodiment of the present invention further provides a computer-readable storage medium, where a format conversion program is stored, and the format conversion program, when executed by a processor, implements the steps of the format conversion method according to the above embodiments.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on this understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) as described above and includes instructions for causing a controller to execute the methods according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.
Claims (10)
1. A format conversion method applied to a controller of a format conversion system, the controller being configured to control a configuration unit, a buffer unit and a calculation unit in the format conversion system, the buffer unit including at least two buffers, the format conversion method comprising:
acquiring image data to be processed and determining an input format and an output format of the image data to be processed;
determining a read-write address of a buffer in the buffer unit according to the input format, and determining a format conversion parameter according to the input format and the output format;
storing the image data to be processed into a corresponding buffer in the buffer unit according to the read-write address;
and reading the corresponding image data to be processed in the buffer and outputting the image data to be processed to the computing unit, so that the computing unit converts the image data to be processed from the input format to the output format according to the format conversion parameter.
2. The format conversion method according to claim 1, wherein the step of determining the read-write address of the buffer in the buffer unit according to the input format, and determining the format conversion parameter according to the input format and the output format comprises:
judging whether the input format is a YUV format;
if the input format is not the YUV format, determining a read-write address of a first buffer of the buffer unit, and executing the step of storing the image data to be processed into a corresponding buffer in the buffer unit according to the read-write address, wherein the image data to be processed is completely stored into the first buffer.
3. The format conversion method according to claim 1, wherein the step of determining the read-write address of the buffer in the buffer unit according to the input format, and determining the format conversion parameter according to the input format and the output format comprises:
judging whether the input format is a YUV format;
if the input format is the YUV format, judging whether the storage format of the YUV format of the image data to be processed is a packet format;
and determining the read-write address of the buffer in the buffer unit according to the judgment result.
4. The format conversion method according to claim 3, wherein the step of determining the read/write address of the buffer in the buffer unit according to the determination result comprises:
if the storage format of the YUV format of the image data to be processed is the packet format, determining a read-write address of a first buffer of the buffer unit, and executing the step of storing the image data to be processed into a corresponding buffer in the buffer unit according to the read-write address, wherein the image data to be processed is completely stored into the first buffer;
if the storage format of the YUV format of the image data to be processed is not the packet format, determining read-write addresses of a first buffer and a second buffer of the buffer unit, and executing the step of storing the image data to be processed into the corresponding buffers in the buffer unit according to the read-write addresses, wherein Y component data of the image data to be processed is stored into the first buffer, and U component data and V component data of the image data to be processed are stored into the second buffer.
5. The format conversion method according to claim 1, wherein the format conversion system further comprises a preprocessing module, and before the step of reading the corresponding image data to be processed in the buffer and outputting the image data to be processed to the computing unit, the method further comprises:
acquiring a preset data sampling format and a preset data arrangement format in the configuration unit;
reading the corresponding image data to be processed in the cache unit and outputting the image data to be processed to the preprocessing module, so that the preprocessing module copies and rearranges the image data to be processed according to the preset data sampling format or the preset data arrangement format;
inputting the processed image data to the computing unit.
6. The format conversion method according to claim 1, wherein the format conversion system further comprises a post-processing module, and after the step of reading the corresponding image data to be processed in the buffer and outputting the image data to be processed to the computing unit, the method further comprises:
acquiring a preset data sampling format and a preset data arrangement format in the configuration unit;
reading the converted image data in the computing unit and outputting the image data to the post-processing module so that the post-processing module performs sampling and rearrangement processing on the image data according to the preset data sampling format or the preset data arrangement format;
and outputting the processed image data.
7. The format conversion method according to claim 1, wherein the step of reading the corresponding image data to be processed in the buffer and outputting the image data to be processed to the computing unit comprises:
and performing matrix multiplication operation on the image data to be processed according to the conversion parameters so as to enable the computing unit to convert the image data to be processed from the input format to the output format.
8. A controller, characterized in that the controller comprises: memory, processor and format conversion program stored on the memory and executable on the processor, which when executed by the processor implements the steps of the format conversion method according to any of claims 1 to 7.
9. A controller, characterized in that the controller comprises:
the device comprises an acquisition module, a processing module and a display module, wherein the acquisition module is used for acquiring image data to be processed and determining an input format and an output format of the image data to be processed;
the determining module is used for determining the read-write address of a buffer in the buffer unit according to the input format and determining format conversion parameters according to the input format and the output format;
the cache module stores the image data to be processed into a corresponding cache in the cache unit according to the read-write address;
and the reading module is used for reading the corresponding image data to be processed in the buffer and outputting the image data to be processed to the computing unit, so that the computing unit converts the image data to be processed from the input format to the output format according to the format conversion parameter.
10. A computer-readable storage medium, characterized in that a format conversion program is stored thereon, which when executed by a processor implements the steps of the format conversion method according to any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111296756.1A CN114155137A (en) | 2021-11-03 | 2021-11-03 | Format conversion method, controller and computer-readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111296756.1A CN114155137A (en) | 2021-11-03 | 2021-11-03 | Format conversion method, controller and computer-readable storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114155137A true CN114155137A (en) | 2022-03-08 |
Family
ID=80458884
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111296756.1A Pending CN114155137A (en) | 2021-11-03 | 2021-11-03 | Format conversion method, controller and computer-readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114155137A (en) |
Cited By (1)
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 |
-
2021
- 2021-11-03 CN CN202111296756.1A patent/CN114155137A/en active Pending
Cited By (1)
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 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
EP2887636B1 (en) | Method of mapping source colors from a source color gamut into a target color gamut | |
JP5116393B2 (en) | Image processing apparatus and image processing method | |
KR101138852B1 (en) | Smart clipper for mobile displays | |
EP3087725B1 (en) | Method of mapping source colors of images of a video content into the target color gamut of a target color device | |
US20050024380A1 (en) | Method for reducing random access memory of IC in display devices | |
CN102118624A (en) | Method for converting an image from an RGB color space to a YUV color space | |
US10796461B2 (en) | Image color conversion apparatus, non-transitory computer-readable medium storing computer program, and image color conversion method | |
EP2111714B1 (en) | Fast filtered yuv to rgb conversion | |
EP1560417A2 (en) | System and method for clipping values of pixels in one color space so not to exceed the limits of a second color space | |
US8055069B2 (en) | Image data sampling method | |
US8411106B2 (en) | Converting digital values corresponding to colors of an image from a source color space to a destination color space | |
CN111861964A (en) | Image processing method, apparatus and storage medium | |
CN114155137A (en) | Format conversion method, controller and computer-readable storage medium | |
JP2001014454A (en) | Picture processor | |
JP4215014B2 (en) | Image processing apparatus and image processing program | |
CN109471686B (en) | System and method for rendering graphical assets | |
JP4111689B2 (en) | Image processing apparatus, computer-readable recording medium storing image processing program, and program | |
US7949183B2 (en) | Methods and apparatus for enhancing color data | |
US7903124B2 (en) | Individual channel filtering of palettized image formats | |
US20050212813A1 (en) | Mechanism for color-space neutral (video) effects scripting engine | |
JP2002247376A (en) | Image processor | |
CN112862905B (en) | Image processing method, device, storage medium and computer equipment | |
KR100663130B1 (en) | Apparatus for converting for common memory | |
CN116228525A (en) | Image processing method, device, electronic equipment and readable storage medium | |
Szedo | Color-space converter: RGB to YCrCb |
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 |