Image format conversion method and device, computer equipment and storage medium

文档序号:196364 发布日期:2021-11-02 浏览:26次 中文

阅读说明:本技术 一种图像格式转换方法、装置、计算机设备和存储介质 (Image format conversion method and device, computer equipment and storage medium ) 是由 张卿麒 张彬 吴阳平 许亮 于 2021-07-30 设计创作,主要内容包括:本公开提供了一种图像格式转换方法、装置、计算机设备和存储介质,其中,该方法包括:获取待转换图像的第一颜色编码信息;第一颜色编码信息中包括多个第一亮度信息和多组第一色彩信息,待转换图像的每个像素点对应一个第一亮度信息,至少一个第一亮度信息对应一组第一色彩信息;基于第一颜色编码信息的第一排序顺序,并行提取多个第一亮度信息,得到第一信息序列,以及,并行提取多组第一色彩信息,得到第二信息序列;基于一组第一色彩信息对应的第一亮度信息的第一数量、第二信息序列和第一信息序列,确定每个像素点对应的颜色编码子信息;基于每个像素点对应的颜色编码子信息,生成待转换图像对应于目标格式的目标图像。(The present disclosure provides an image format conversion method, apparatus, computer device and storage medium, wherein the method comprises: acquiring first color coding information of an image to be converted; the first color coding information comprises a plurality of first brightness information and a plurality of groups of first color information, each pixel point of the image to be converted corresponds to one first brightness information, and at least one first brightness information corresponds to one group of first color information; based on a first sequencing sequence of the first color coding information, extracting a plurality of first luminance information in parallel to obtain a first information sequence, and extracting a plurality of groups of first color information in parallel to obtain a second information sequence; determining color coding sub-information corresponding to each pixel point based on a first quantity of first brightness information corresponding to a group of first color information, a second information sequence and a first information sequence; and generating a target image of the image to be converted corresponding to the target format based on the color coding sub-information corresponding to each pixel point.)

1. An image format conversion method is applied to an ARM development board, and comprises the following steps:

acquiring first color coding information of an image to be converted; the first color coding information comprises a plurality of first brightness information and a plurality of groups of first color information, each pixel point of the image to be converted corresponds to one first brightness information, and at least one first brightness information corresponds to one group of first color information;

extracting a plurality of first luminance information in parallel based on a first sorting order of the first luminance information and the first color information in the first color coding information to obtain a first information sequence, and extracting a plurality of groups of first color information in parallel based on the first sorting order to obtain a second information sequence;

determining color coding sub-information corresponding to each pixel point based on a first quantity of first brightness information corresponding to a group of first color information, the second information sequence and the first information sequence;

and generating a target image of the image to be converted corresponding to the target format based on the color coding sub-information corresponding to each pixel point.

2. The method according to claim 1, wherein the extracting a plurality of first luminance information in parallel based on the first luminance information and the first color information in the first color-coded information in a first order to obtain a first information sequence comprises:

determining first sorting feature information of the first luminance information in the first color-coded information based on the first sorting order;

determining the parallel processing performance information of the ARM development board based on the storage capacity of the register in the ARM;

extracting a plurality of first luminance information from the first color coding information in parallel based on the first ordering feature information and the parallel processing performance information to obtain the first information sequence;

the extracting, in parallel, multiple sets of first color information based on the first ordering order to obtain a second information sequence includes:

determining second ordering characteristic information of the first color information in the first color coding information based on the first ordering order;

and extracting multiple groups of first color information from the first color coding information in parallel based on the second sorting characteristic information and the parallel processing performance information to obtain the second information sequence.

3. The method of claim 2, wherein the parallel processing performance information comprises a target number of the information extracted in parallel; the first color information comprises first color sub information and second color sub information; the first sorting order includes that the first luminance information is arranged between the first color sub information and the second color sub information; the first sorting feature information includes a plurality of first sorting orders of the plurality of first luminance information;

the determining, based on the first sorting order, first sorting feature information of the first luminance information in the first color-coded information includes:

determining a first sorting order of the first luminance information in the first color-coded information based on the first sorting order;

the extracting, in parallel, a plurality of first luminance information from the first color-coded information based on the first ordering feature information and the parallel processing performance information to obtain the first information sequence, includes:

the target number of pieces of first luminance information is extracted in parallel from the first color-coded information based on the plurality of first sorting orders, and the first information sequence is determined based on the extracted plurality of pieces of first luminance information.

4. The method according to any one of claims 1 to 3, wherein the first color information comprises first color sub-information and second color sub-information;

the determining, based on the first quantity of the first luminance information corresponding to the group of first color information, the second information sequence, and the first information sequence, the color coding sub-information corresponding to each pixel point includes:

determining a third information sequence corresponding to the first color sub-information and a fourth information sequence corresponding to the second color sub-information based on a second ordering order of the first color sub-information and the second color sub-information in the second information sequence;

and determining color coding sub-information corresponding to each pixel point based on a first quantity of first brightness information corresponding to a group of the first color information, the third information sequence, the fourth information sequence and the first information sequence.

5. The method of claim 4, wherein determining the color-coded sub-information corresponding to each pixel point based on the first quantity of the first luminance information, the third information sequence, the fourth information sequence and the first information sequence corresponding to a set of the first color information comprises:

under the condition that two pieces of first brightness information correspond to one group of first color information, adding the first color sub information at the adjacent position of each first color sub information in the third information sequence to obtain a new third information sequence;

adding the second color sub-information at the adjacent position of each second color sub-information in the fourth information sequence to obtain a new fourth information sequence;

and determining color coding sub-information corresponding to each pixel point based on the new third information sequence, the new fourth information sequence and the first information sequence.

6. The method according to any one of claims 1 to 5, wherein the target format comprises a first sub-format; the target image comprises a first target sub-image;

generating a target image of the image to be converted corresponding to the target format based on the color coding sub-information corresponding to each pixel point, wherein the generating comprises:

respectively determining second color coding information of each pixel point corresponding to the first sub-format based on the color coding sub-information corresponding to each pixel point;

and generating a first target sub-image of the image to be converted corresponding to the first sub-format based on the second color coding information corresponding to each pixel point.

7. The method of claim 6, wherein the target format further comprises a second sub-format; the target image further comprises a second target sub-image; the second sub-format corresponds to third color coding information; the third color coding information comprises second brightness information and second color information; each pixel point of the second target sub-image corresponds to one second brightness information, and at least one second brightness information corresponds to one group of second color information;

after determining the second color-coding information, further comprising:

on the basis of second color coding information corresponding to each pixel point in the image to be converted, parallel calculation is carried out to obtain second brightness information corresponding to each pixel point of the second target sub-image;

performing parallel calculation based on a second quantity of second brightness information corresponding to a group of second color information and second color coding information corresponding to each pixel point in the image to be converted to obtain second color information corresponding to each pixel point of the second target sub-image;

and generating a second target sub-image corresponding to the second sub-format based on second brightness information and second color information corresponding to each pixel point of the second target sub-image.

8. The method of claim 7, wherein the obtaining the second color information corresponding to each pixel point of the second target sub-image by performing parallel computation based on the second amount of the second luminance information corresponding to a group of the second color information and the second color coding information corresponding to each pixel point in the image to be converted comprises:

determining third sorting feature information of the target pixel point based on a second quantity of second brightness information corresponding to the second color information; the target pixel point comprises a pixel point for determining the second color information;

determining second color coding information corresponding to the target pixel point based on the third sorting feature information and second color coding information corresponding to each pixel point in the image to be converted;

and performing parallel calculation based on the second color coding information corresponding to the target pixel point to obtain second color information corresponding to each pixel point of the second target sub-image.

9. The method of claim 8, wherein determining third ordering attribute information for the target pixel based on a second amount of second luminance information corresponding to a set of the second luminance information comprises:

under the condition that four pieces of second brightness information correspond to one group of second color information, determining that third sorting feature information of the target pixel point comprises that the target pixel point is located in an even row and is located in an even column; alternatively, the first and second electrodes may be,

and under the condition that the four pieces of second brightness information correspond to one group of second color information, determining third sorting feature information of the target pixel points, wherein the third sorting feature information of the target pixel points comprises that the target pixel points are positioned in odd rows and odd columns.

10. The method of claim 7, wherein the obtaining the second color information corresponding to each pixel point of the second target sub-image by performing parallel computation based on the second amount of the second luminance information corresponding to a group of the second color information and the second color coding information corresponding to each pixel point in the image to be converted comprises:

determining a third number of registers based on a second number of second luminance information corresponding to a set of the second color information;

and storing the second color coding information by using the registers of the third number, and performing parallel calculation based on the second color coding information stored by the registers to obtain second color information corresponding to each pixel point of the second target sub-image.

11. An image format conversion apparatus, characterized by comprising:

the information acquisition module is used for acquiring first color coding information of an image to be converted; the first color coding information comprises a plurality of first brightness information and a plurality of groups of first color information, each pixel point of the image to be converted corresponds to one first brightness information, and at least one first brightness information corresponds to one group of first color information;

the information extraction module is used for extracting a plurality of first luminance information in parallel to obtain a first information sequence based on a first sorting sequence of the first luminance information and the first color information in the first color coding information, and extracting a plurality of groups of first color information in parallel to obtain a second information sequence based on the first sorting sequence;

the information determining module is used for determining color coding sub-information corresponding to each pixel point based on a first quantity of first brightness information corresponding to a group of first color information, the second information sequence and the first information sequence;

and the first image conversion module is used for generating a target image of the image to be converted corresponding to the target format based on the color coding sub-information corresponding to each pixel point.

12. A computer device, comprising: a processor, a memory and a bus, the memory storing machine-readable instructions executable by the processor, the processor and the memory communicating over the bus when a computer device is running, the machine-readable instructions when executed by the processor performing the steps of the image format conversion method according to any one of claims 1 to 10.

13. A computer-readable storage medium, characterized in that a computer program is stored thereon, which computer program, when being executed by a processor, performs the steps of the image format conversion method according to any one of claims 1 to 10.

Technical Field

The present disclosure relates to the field of image processing technologies, and in particular, to an image format conversion method, an image format conversion apparatus, a computer device, and a storage medium.

Background

Image format conversion is a pre-processing operation for video encoding, requiring conversion of an input image to an image in a particular format, such as NV12 format, prior to video encoding. The existing open source image format conversion scheme, which is generally an image format conversion tool in software libraries OpenCV and FFmpeg based on an X86-64 platform, accelerates the speed of image format conversion by virtue of the performance advantages of a graphics processor GPU or an instruction set. However, under the QNX platform of the ARM development board, the image format conversion cannot be accelerated due to insufficient computing power of the ARM development board and the inability to use the performance advantages of external image processing devices such as a GPU, which results in high time consumption for image format conversion, and the image format conversion method based on the ARM development board cannot be used in applications with high real-time requirements due to the ultra-high time consumption.

Disclosure of Invention

The embodiment of the disclosure at least provides an image format conversion method, an image format conversion device, computer equipment and a storage medium.

In a first aspect, an embodiment of the present disclosure provides an image format conversion method, applied to an ARM development board, including:

acquiring first color coding information of an image to be converted; the first color coding information comprises a plurality of first brightness information and a plurality of groups of first color information, each pixel point of the image to be converted corresponds to one first brightness information, and at least one first brightness information corresponds to one group of first color information;

extracting a plurality of first luminance information in parallel based on a first sorting order of the first luminance information and the first color information in the first color coding information to obtain a first information sequence, and extracting a plurality of groups of first color information in parallel based on the first sorting order to obtain a second information sequence;

determining color coding sub-information corresponding to each pixel point based on a first quantity of first brightness information corresponding to a group of first color information, the second information sequence and the first information sequence;

and generating a target image of the image to be converted corresponding to the target format based on the color coding sub-information corresponding to each pixel point.

In the aspect, the ARM development board can be used for processing data in parallel, for example, a Neon extension structure in the ARM development board and a register of a CPU are used, a plurality of first luminance information and a plurality of groups of first color information can be extracted in parallel from first color coding information stored in the register, and the information acquisition speed can be increased in multiples due to parallel extraction, so that the image format conversion can be accelerated in multiples on the CPU, and the requirement of real-time image format conversion can be met. Compared with the prior art, the method does not depend on image processing equipment such as a GPU (graphics processing unit), and can reduce the hardware cost of image format conversion; in addition, the method provides a universal image format conversion method for the ARM development board for real-time image format conversion, and meanwhile, compared with an X86-64 platform, the power consumption and hardware cost of the ARM development board are lower.

In an alternative embodiment, the extracting a plurality of first luminance information in parallel based on the first ordering order of the first luminance information and the first color information in the first color-coded information to obtain a first information sequence includes:

determining first sorting feature information of the first luminance information in the first color-coded information based on the first sorting order;

determining the parallel processing performance information of the ARM development board based on the storage capacity of the register in the ARM;

extracting a plurality of first luminance information from the first color coding information in parallel based on the first ordering feature information and the parallel processing performance information to obtain the first information sequence;

the extracting, in parallel, multiple sets of first color information based on the first ordering order to obtain a second information sequence includes:

determining second ordering characteristic information of the first color information in the first color coding information based on the first ordering order;

and extracting multiple groups of first color information from the first color coding information in parallel based on the second sorting characteristic information and the parallel processing performance information to obtain the second information sequence.

In this embodiment, because the arrangement manner of the first luminance information and the first color information in the first color coding information conforms to a certain ordering characteristic, for example, the first luminance information and the first color information are located at odd or even bits, the first luminance information corresponding to the first ordering characteristic information and the first color information corresponding to the second ordering characteristic information can be respectively extracted from the first color coding information in parallel by using a Neon extension structure, and the extraction of the first luminance information and the first color information is accelerated in parallel by processing the performance information in parallel, so that the first information sequence and the second information sequence corresponding to a plurality of pixels in the image to be converted can be quickly obtained, and the efficiency of converting the image format of a plurality of pixels in the image to be converted is further improved.

In an alternative embodiment, the parallel processing performance information includes a target number of pieces of the information extracted in parallel; the first color information comprises first color sub information and second color sub information; the first sorting order includes that the first luminance information is arranged between the first color sub information and the second color sub information; the first sorting feature information includes a plurality of first sorting orders of the plurality of first luminance information;

the determining, based on the first sorting order, first sorting feature information of the first luminance information in the first color-coded information includes:

determining a first sorting order of the first luminance information in the first color-coded information based on the first sorting order;

the extracting, in parallel, a plurality of first luminance information from the first color-coded information based on the first ordering feature information and the parallel processing performance information to obtain the first information sequence, includes:

the target number of pieces of first luminance information is extracted in parallel from the first color-coded information based on the plurality of first sorting orders, and the first information sequence is determined based on the extracted plurality of pieces of first luminance information.

According to the embodiment, the number of pieces of first brightness information which is extracted in parallel at one time from the first color coding information by using the Neon extension structure is determined by using the parallel processing performance information, and then the position of the extracted first brightness information is positioned by using the plurality of first sorting orders of the first brightness information indicated by the first sorting feature information, so that the plurality of first brightness information can be accurately extracted, the parallel extraction speed is further increased, and the image format conversion efficiency is further improved.

In an optional embodiment, the first color information includes first color sub information and second color sub information;

the determining, based on the first quantity of the first luminance information corresponding to the group of first color information, the second information sequence, and the first information sequence, the color coding sub-information corresponding to each pixel point includes:

determining a third information sequence corresponding to the first color sub-information and a fourth information sequence corresponding to the second color sub-information based on a second ordering order of the first color sub-information and the second color sub-information in the second information sequence;

and determining color coding sub-information corresponding to each pixel point based on a first quantity of first brightness information corresponding to a group of the first color information, the third information sequence, the fourth information sequence and the first information sequence.

According to the embodiment, the corresponding relation between the first brightness information in the first information sequence and the first color sub-information in the third information sequence and the corresponding relation between the first brightness information in the first information sequence and the second color sub-information in the fourth information sequence can be determined by utilizing the corresponding relation between the group of first color information and the first brightness information, and then the color coding sub-information corresponding to each pixel point in the image to be converted can be accurately obtained based on the corresponding relation. In addition, the first brightness information and the first color information are extracted in parallel, so that the color coding sub-information corresponding to a plurality of pixel points in the image to be converted can be determined simultaneously, and the efficiency of determining the color coding sub-information corresponding to each pixel point is improved.

In an optional implementation manner, the determining, based on the first quantity of the first luminance information corresponding to a group of the first color information, the third information sequence, the fourth information sequence, and the first information sequence, the color coding sub-information corresponding to each pixel point includes:

under the condition that two pieces of first brightness information correspond to one group of first color information, adding the first color sub information at the adjacent position of each first color sub information in the third information sequence to obtain a new third information sequence;

adding the second color sub-information at the adjacent position of each second color sub-information in the fourth information sequence to obtain a new fourth information sequence;

and determining color coding sub-information corresponding to each pixel point based on the new third information sequence, the new fourth information sequence and the first information sequence.

In this embodiment, under the condition that it is determined that two pieces of first luminance information in the first information sequence correspond to one set of first color sub information, based on the above embodiment, the correspondence between each piece of first luminance information in the first information sequence and the first color sub information in the third information sequence can be accurately obtained, and the value is assigned to the first color sub information, so that a new third information sequence corresponding to the first information sequence can be accurately obtained, where the first color sub information in the new third information sequence corresponds to the first luminance information in the first information sequence one to one. Meanwhile, based on the above embodiment, the corresponding relationship between each first luminance information in the first information sequence and the second color sub information in the fourth information sequence can be accurately obtained, and the second color sub information is assigned, so that a precise new fourth information sequence corresponding to the first information sequence can be obtained, and the second color sub information in the new fourth information sequence corresponds to the first luminance information in the first information sequence one to one.

In an alternative embodiment, the target format comprises a first sub-format; the target image comprises a first target sub-image;

generating a target image of the image to be converted corresponding to the target format based on the color coding sub-information corresponding to each pixel point, wherein the generating comprises:

respectively determining second color coding information of each pixel point corresponding to the first sub-format based on the color coding sub-information corresponding to each pixel point;

and generating a first target sub-image of the image to be converted corresponding to the first sub-format based on the second color coding information corresponding to each pixel point.

In this embodiment, because the color coding sub-information corresponding to the plurality of pixel points in the image to be converted can be determined at the same time in the above embodiment, the second color coding information corresponding to the first sub-format corresponding to the plurality of pixel points can be determined at the same time, and then the image formats of the plurality of pixel points in the image to be converted can be converted at the same time, so that the efficiency of converting the image format of the image to be converted into the first target sub-image is improved.

In an optional embodiment, the target format further comprises a second sub-format; the target image further comprises a second target sub-image; the second sub-format corresponds to third color coding information; the third color coding information comprises second brightness information and second color information; each pixel point of the second target sub-image corresponds to one second brightness information, and at least one second brightness information corresponds to one group of second color information;

after determining the second color-coding information, further comprising:

on the basis of second color coding information corresponding to each pixel point in the image to be converted, parallel calculation is carried out to obtain second brightness information corresponding to each pixel point of the second target sub-image;

performing parallel calculation based on a second quantity of second brightness information corresponding to a group of second color information and second color coding information corresponding to each pixel point in the image to be converted to obtain second color information corresponding to each pixel point of the second target sub-image;

and generating a second target sub-image corresponding to the second sub-format based on second brightness information and second color information corresponding to each pixel point of the second target sub-image.

According to the embodiment, based on the second color coding information corresponding to the multiple pixel points stored by the register in the ARM development board, the second brightness information of the multiple pixel points can be obtained through parallel calculation, based on the second color coding information corresponding to the multiple pixel points stored by the register in the ARM development board, the second color information of the multiple pixel points can be obtained through parallel calculation, and the second brightness information and the second color information of each pixel point are compared and calculated in sequence.

In an optional implementation manner, the parallel computing based on the second quantity of the second luminance information corresponding to a group of the second color information and the second color coding information corresponding to each pixel point in the image to be converted to obtain the second color information corresponding to each pixel point of the second target sub-image includes:

determining third sorting feature information of the target pixel point based on a second quantity of second brightness information corresponding to the second color information; the target pixel point comprises a pixel point for determining the second color information;

determining second color coding information corresponding to the target pixel point based on the third sorting feature information and second color coding information corresponding to each pixel point in the image to be converted;

and performing parallel calculation based on the second color coding information corresponding to the target pixel point to obtain second color information corresponding to each pixel point of the second target sub-image.

In the embodiment, the second quantity of the second luminance information corresponding to the group of second color information represents a group of second color information shared by the second number of second luminance information, due to the image format characteristic of the second sub-format, before the second color information is determined, the ordering characteristic information of the target pixel points needs to be predetermined, that is, the third ordering characteristic information of the target pixel points is determined by using the second quantity, and the second color information corresponding to the plurality of target pixel points can be extracted in parallel based on the second color coding information corresponding to the plurality of target pixel points indicated by the third ordering characteristic information. Then, since the second luminance information shares a group of second color information, the second color information corresponding to each pixel point in the second target sub-image can be obtained.

In an optional implementation manner, the determining third ordering characteristic information of the target pixel point based on the second number of the second luminance information corresponding to the group of the second color information includes:

under the condition that four pieces of second brightness information correspond to one group of second color information, determining that third sorting feature information of the target pixel point comprises that the target pixel point is located in an even row and is located in an even column; alternatively, the first and second electrodes may be,

and under the condition that the four pieces of second brightness information correspond to one group of second color information, determining third sorting feature information of the target pixel points, wherein the third sorting feature information of the target pixel points comprises that the target pixel points are positioned in odd rows and odd columns.

In this embodiment, under the condition that it is determined that the four pieces of second luminance information share one set of second color information, that is, the second sub-format is that the four pieces of second luminance information share one set of second color information, according to the sorting characteristics of the pixel points, it can be determined that the third sorting feature information is even rows and even columns; or odd rows and odd columns.

In an optional implementation manner, the parallel computing based on the second quantity of the second luminance information corresponding to a group of the second color information and the second color coding information corresponding to each pixel point in the image to be converted to obtain the second color information corresponding to each pixel point of the second target sub-image includes:

determining a third number of registers based on a second number of second luminance information corresponding to a set of the second color information;

and storing the second color coding information by using the registers of the third number, and performing parallel calculation based on the second color coding information stored by the registers to obtain second color information corresponding to each pixel point of the second target sub-image.

According to the embodiment, the second color information of the plurality of pixel points can be obtained through parallel calculation by using the second color coding information of the plurality of pixel points stored in the third number of registers, so that the calculation efficiency of the second color information is improved. In addition, on the basis of parallel computing, the more the third number of registers, the more remarkable the computing efficiency of the second color information is improved.

In a second aspect, an embodiment of the present disclosure further provides an image format conversion apparatus, including:

the information acquisition module is used for acquiring first color coding information of an image to be converted; the first color coding information comprises a plurality of first brightness information and a plurality of groups of first color information, each pixel point of the image to be converted corresponds to one first brightness information, and at least one first brightness information corresponds to one group of first color information;

the information extraction module is used for extracting a plurality of first luminance information in parallel to obtain a first information sequence based on a first sorting sequence of the first luminance information and the first color information in the first color coding information, and extracting a plurality of groups of first color information in parallel to obtain a second information sequence based on the first sorting sequence;

the information determining module is used for determining color coding sub-information corresponding to each pixel point based on a first quantity of first brightness information corresponding to a group of first color information, the second information sequence and the first information sequence;

and the first image conversion module is used for generating a target image of the image to be converted corresponding to the target format based on the color coding sub-information corresponding to each pixel point.

In an optional embodiment, the information extraction module is configured to determine, based on the first sorting order, first sorting feature information of the first luminance information in the first color-coded information; determining the parallel processing performance information of the ARM development board based on the storage capacity of the register in the ARM; extracting a plurality of first luminance information from the first color coding information in parallel based on the first ordering feature information and the parallel processing performance information to obtain the first information sequence; and determining second ordering characteristic information of the first color information in the first color coding information based on the first ordering order; and extracting multiple groups of first color information from the first color coding information in parallel based on the second sorting characteristic information and the parallel processing performance information to obtain the second information sequence.

In an alternative embodiment, the parallel processing performance information includes the number of information objects extracted in parallel; the first color information comprises first color sub information and second color sub information; the first sorting order includes that the first luminance information is arranged between the first color sub information and the second color sub information; the first sorting feature information includes a plurality of first sorting orders of the plurality of first luminance information;

the information extraction module is configured to determine a first sorting order of the first luminance information in the first color-coded information based on the first sorting order; the target number of pieces of first luminance information is extracted in parallel from the first color-coded information based on the plurality of first sorting orders, and the first information sequence is determined based on the extracted plurality of pieces of first luminance information.

In an optional embodiment, the first color information includes first color sub information and second color sub information;

the information determining module is configured to determine, based on a second ordering order of the first color sub-information and the second color sub-information in the second information sequence, a third information sequence corresponding to the first color sub-information and a fourth information sequence corresponding to the second color sub-information; and determining color coding sub-information corresponding to each pixel point based on a first quantity of first brightness information corresponding to a group of the first color information, the third information sequence, the fourth information sequence and the first information sequence.

In an optional embodiment, the information determining module is configured to, in a case that two pieces of first luminance information correspond to one set of the first color information, add the first color sub information at an adjacent position of each first color sub information in the third information sequence to obtain a new third information sequence; adding the second color sub-information at the adjacent position of each second color sub-information in the fourth information sequence to obtain a new fourth information sequence; and determining color coding sub-information corresponding to each pixel point based on the new third information sequence, the new fourth information sequence and the first information sequence.

In an alternative embodiment, the target format comprises a first sub-format; the target image comprises a first target sub-image;

the first image conversion module is used for respectively determining second color coding information of each pixel point corresponding to the first sub-format based on the color coding sub-information corresponding to each pixel point; and generating a first target sub-image of the image to be converted corresponding to the first sub-format based on the second color coding information corresponding to each pixel point.

In an optional embodiment, the target format further comprises a second sub-format; the target image further comprises a second target sub-image; the second sub-format corresponds to third color coding information; the third color coding information comprises second brightness information and second color information; each pixel point of the second target sub-image corresponds to one second brightness information, and at least one second brightness information corresponds to one group of second color information;

the device also comprises a second image conversion module, which is used for performing parallel calculation based on second color coding information corresponding to each pixel point in the image to be converted after the second color coding information is determined, so as to obtain second brightness information corresponding to each pixel point of the second target sub-image; performing parallel calculation based on a second quantity of second brightness information corresponding to a group of second color information and second color coding information corresponding to each pixel point in the image to be converted to obtain second color information corresponding to each pixel point of the second target sub-image; and generating a second target sub-image corresponding to the second sub-format based on second brightness information and second color information corresponding to each pixel point of the second target sub-image.

In an optional implementation manner, the second image conversion module is configured to determine third ordering feature information of a target pixel point based on a second quantity of second luminance information corresponding to a group of the second color information; the target pixel point comprises a pixel point for determining the second color information; determining second color coding information corresponding to the target pixel point based on the third sorting feature information and second color coding information corresponding to each pixel point in the image to be converted; and performing parallel calculation based on the second color coding information corresponding to the target pixel point to obtain second color information corresponding to each pixel point of the second target sub-image.

In an optional embodiment, the second image conversion module is configured to, in a case that four pieces of the second luminance information correspond to one set of the second color information, determine that the third ordering characteristic information of the target pixel includes that the target pixel is located in an even row and is located in an even column; or, under the condition that the four pieces of second brightness information correspond to one set of second color information, determining that the third ordering characteristic information of the target pixel point includes that the target pixel point is located in an odd row and is located in an odd column.

In an optional implementation manner, the second image conversion module is configured to determine a third number of registers based on a second number of second luminance information corresponding to a group of the second color information; and storing the second color coding information by using the registers of the third number, and performing parallel calculation based on the second color coding information stored by the registers to obtain second color information corresponding to each pixel point of the second target sub-image.

In a third aspect, an embodiment of the present disclosure further provides a computer device, including: a processor, a memory and a bus, the memory storing machine-readable instructions executable by the processor, the processor and the memory communicating via the bus when a computer device is running, the machine-readable instructions when executed by the processor performing the steps of the first aspect described above, or any one of the possible image format conversion methods of the first aspect.

In a fourth aspect, the disclosed embodiments also provide a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and the computer program is executed by a processor to perform the steps of the first aspect, or any one of the possible image format conversion methods in the first aspect.

For the description of the effects of the image format conversion apparatus, the computer device and the storage medium, reference is made to the description of the image format conversion method, which is not repeated here.

In order to make the aforementioned objects, features and advantages of the present disclosure more comprehensible, preferred embodiments accompanied with figures are described in detail below.

Drawings

In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings required for use in the embodiments will be briefly described below, and the drawings herein incorporated in and forming a part of the specification illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the technical solutions of the present disclosure. It is appreciated that the following drawings depict only certain embodiments of the disclosure and are therefore not to be considered limiting of its scope, for those skilled in the art will be able to derive additional related drawings therefrom without the benefit of the inventive faculty.

Fig. 1 shows a flowchart of an image format conversion method provided by an embodiment of the present disclosure;

FIG. 2 illustrates a flowchart for generating a second target sub-image corresponding to a second sub-format provided by an embodiment of the present disclosure;

FIG. 3 is a schematic diagram illustrating a target pixel point determined from a first target sub-image according to an embodiment of the disclosure;

fig. 4 is a schematic diagram illustrating an image format conversion apparatus provided in an embodiment of the present disclosure;

fig. 5 shows a schematic structural diagram of a computer device provided by an embodiment of the present disclosure.

Detailed Description

In order to make the objects, technical solutions and advantages of the embodiments of the present disclosure more clear, the technical solutions of the embodiments of the present disclosure will be described clearly and completely with reference to the drawings in the embodiments of the present disclosure, and it is obvious that the described embodiments are only a part of the embodiments of the present disclosure, not all of the embodiments. The components of the embodiments of the present disclosure, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present disclosure, presented in the figures, is not intended to limit the scope of the claimed disclosure, but is merely representative of selected embodiments of the disclosure. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the disclosure without making creative efforts, shall fall within the protection scope of the disclosure.

Furthermore, the terms "first," "second," and the like in the description and in the claims, and in the drawings described above, in the embodiments of the present disclosure are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It will be appreciated that the data so used may be interchanged under appropriate circumstances such that the embodiments described herein may be practiced otherwise than as specifically illustrated or described herein.

Reference herein to "a plurality or a number" means two or more. "and/or" describes the association relationship of the associated objects, meaning that there may be three relationships, e.g., a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship.

It has been found that image format conversion is a preprocessing operation for video encoding, and it is necessary to convert an input image into an image of a specific format, such as NV12, before video encoding. The existing open source image format conversion scheme, which is generally an image format conversion tool in OpenCV, FFmpeg library based on X86-64 platform, accelerates the speed of image format conversion by virtue of the performance of a graphics processor GPU or an instruction set. However, under the QNX platform of the ARM development board, the image format conversion cannot be accelerated due to insufficient computing power of the ARM development board and the inability to use the performance advantages of external image processing devices such as a GPU, which results in high time consumption for image format conversion, and the image format conversion method based on the ARM development board cannot be used in applications with high real-time requirements due to the ultra-high time consumption.

Based on the research, the disclosure provides an image format conversion method, which can extract a plurality of first luminance information and a plurality of groups of first color information in parallel from the first color coding information stored in the register by using a Neon extension structure in an ARM development board and a register of a CPU, and can multiply accelerate image format conversion on the CPU and meet the requirement of real-time image format conversion because the information acquisition speed can be multiplied by parallel extraction. Compared with the prior art, the method does not depend on image processing equipment such as a GPU (graphics processing unit), and can reduce the hardware cost of image format conversion; in addition, the method provides a universal image format conversion method for the ARM development board for real-time image format conversion, and meanwhile, compared with an X86-64 platform, the power consumption and hardware cost of the ARM development board are lower.

The above-mentioned drawbacks are the results of the inventor after practical and careful study, and therefore, the discovery process of the above-mentioned problems and the solutions proposed by the present disclosure to the above-mentioned problems should be the contribution of the inventor in the process of the present disclosure.

It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.

The following description is given of specific terms involved in the embodiments of the present disclosure:

1. an ARM processor (Advanced RISC Machines, ARM) is a RISC microprocessor with low power consumption and cost.

2. The ARM development board is an embedded development board which takes an ARM core chip as a CPU and is added with other peripheral functions, and is used for evaluating the functions of the core chip and researching and developing products of various science and technology enterprises.

3. A Central Processing Unit (CPU) is a final execution unit for information processing and program operation, and serves as an operation and control core of a computer system.

4. A Graphics Processing Unit (GPU), also called a display core, a visual processor, and a display chip, is a microprocessor that is dedicated to perform operations related to images and Graphics on personal computers, workstations, game machines, and some mobile devices (e.g., tablet computers, smart phones, etc.).

5. A Reduced Instruction Set Computer (RISC) is a microprocessor that executes fewer types of computer instructions.

6. OpenCV is a BSD license (open source) based distributed cross-platform computer vision and machine learning software library that can run on Linux, Windows, Android, and Mac OS operating systems. The method is light and efficient, is composed of a series of C functions and a small number of C + + classes, provides interfaces of languages such as Python, Ruby, MATLAB and the like, and realizes a plurality of general algorithms in the aspects of image processing and computer vision.

7. FFmpeg is a set of open source computer programs that can be used to record, convert digital audio, video, and convert them into streams.

8. Neon is a 128-bit SIMD (Single Instruction, Multiple Data) extension architecture suitable for ARM processors.

9. YUV, a color coding method, is often used in various video processing components. YUV allows for reduced bandwidth of chrominance in view of human perception when encoding against photographs or video. Where Y denotes brightness, and U and V denote chroma. May include the UYVU format and the NV12 format.

10. pack, a sort method for managing added information, has only a relationship of top, bottom, left and right, and each added information is arranged according to an adding order.

11. The linear interpolation refers to an interpolation mode in which an interpolation function is a first-order polynomial, and the interpolation error of the interpolation function on an interpolation node is zero.

12. QNX, a commercially available Unix-like real-time operating system that conforms to the POSIX specification. The method is a hard real-time operating system based on priority preemption.

13. BGR, OpenCV default channel. Wherein B represents blue, G represents green, and R represents red.

14. X86-64, the shorthand for 64-bit extended, 64-bit extension, is the 64-bit extension of the X86 architecture.

To facilitate understanding of the present embodiment, first, a detailed description is given to an image format conversion method disclosed in the embodiments of the present disclosure, and an execution subject of the image format conversion method provided in the embodiments of the present disclosure is an ARM processor in an ARM development board. The ARM development board herein may store computer readable instructions compiled by the QNX system. In some possible implementations, the image format conversion method may be implemented by an ARM processor calling computer readable instructions stored in a memory.

The following describes the image format conversion method provided by the embodiment of the disclosure by taking an ARM processor as an example.

Referring to fig. 1, a flowchart of an image format conversion method provided in an embodiment of the present disclosure is shown, where the method includes steps S101 to S104, where:

s101: acquiring first color coding information of an image to be converted; the first color coding information comprises a plurality of first brightness information and a plurality of groups of first color information, each pixel point of the image to be converted corresponds to one first brightness information, and at least one first brightness information corresponds to one group of first color information.

In this step, the image to be converted may be an acquired image captured by the capturing device, and the first color coding information of the image to be converted may include coding information for coding the image to be converted in a UYVY format, where the UYVY format is one of a horizontal sampling format and a vertical full sampling format in a YUV format. Or, the encoding information may be encoding information for encoding the image to be converted in NV12 format, where NV12 format is one of a horizontal sampling and vertical 2:1 sampling format in YUV format. Or, the encoding information may be encoding information for encoding the image to be converted in an axyuv format, where the axyuv format is one of the full sampling formats in the YUV format.

Illustratively, taking the image to be converted into the UYVY-format image as an example, the first color coding information includes a plurality of first luminance information, i.e., a plurality of Y; and, multiple sets of first color information, i.e., multiple sets of UV. And each pixel point of the image to be converted corresponds to one Y, and every two pieces of first brightness information correspond to one group of first color information.

In some embodiments, the image size of the image to be converted is also obtained, including the width and height of the image to be converted.

S102: the method comprises the steps of extracting a plurality of first luminance information in parallel based on a first sorting order of first luminance information and first color information in first color coding information to obtain a first information sequence, and extracting a plurality of groups of first color information in parallel based on the first sorting order to obtain a second information sequence.

In this step, the first sorting order of the first color coding information may be a pack sorting order, that is, the first color coding information is sorted according to the adding order.

For example, the uyyyyy format is arranged in the order of addition, and the first order of obtaining the first color-coded information is uyvyuyy … …. Y, U, V is the element of the pixel. In addition, the address of each element in the first sorting order uyvyuyyy … … may be determined based on the image size of the image to be converted acquired as described above, and the elements of the corresponding positions may be extracted in parallel by address.

In particular, after determining the first sorting order of the first color-coding information, the first element address of the image to be converted may be determined. Based on a first sorting sequence of the first color coding information, sequentially and parallelly extracting a plurality of first luminance information in the first sorting sequence from a first element address to obtain a first information sequence; and sequentially and parallelly extracting multiple groups of first color information in the first sequencing sequence from the first element address based on the first sequencing sequence of the first color coding information to obtain a second information sequence.

Here, since each element occupies 8 bits, and the element calculates a sign (including plus "+", minus "-", etc.) with 8 bits in the image format conversion process, each element needs to occupy 16 bits of memory, i.e., one 128-bit register can store 8 16-bit signed elements. The 8 elements in the first sort order can be extracted in parallel using Neon and stored into a 128bit register.

Illustratively, taking the image to be converted into the UYVU format image as an example, eight elements are extracted in parallel from the address of the first element to obtain uyvuyyyvy, wherein the first information sequence, that is, yyyyy, is determined according to the address of the first luminance information, and the second information sequence, that is, UVUV, is determined according to the address of the second color information.

S103: and determining color coding sub-information corresponding to each pixel point based on the first quantity, the second information sequence and the first information sequence of the first brightness information corresponding to a group of first color information.

In this step, the first quantity of the first luminance information corresponding to the group of first color information may represent the quantity of the first luminance information sharing the group of first color information. For example, for the UYVY format, a set of first color information corresponds to two pieces of first luminance information, that is, the two pieces of first luminance information share a set of first color information; for the NV12 format, a set of first color information corresponds to four first luminance information, that is, the four first luminance information share a set of first color information; for the AYUV format, a group of first color information corresponds to a group of first brightness information, namely, a group of first color information is shared by the first brightness information.

The color coding sub-information corresponding to each pixel point comprises first brightness information Y and second color information UV. Since each pixel point corresponds to one first luminance information, in the process of determining the color coding sub-information corresponding to each pixel point, a group of first color information corresponding to each first luminance information needs to be determined first. Then, the color coding sub-information corresponding to each pixel point can be determined according to the corresponding relationship, the plurality of first brightness information and the plurality of groups of first color information.

For example, for an image to be converted in the UYVY format, it may be determined that one set of first color information UV corresponds to two first luminance information Y, i.e. the first number is 2. Under the condition that the first information sequence is YYYY and the second information sequence is UVUV, corresponding to the first information sequence, first luminance information Y corresponds to a first group of first color information UV; the second first luminance information Y corresponding to the first information sequence corresponds to the first group of first color information UV; the third first luminance information Y corresponding to the first information sequence corresponds to the second group of first color information UV; the fourth first luminance information Y corresponding to the first information sequence corresponds to the second set of first color information UV. Further, color coding sub-information corresponding to a first pixel point in the image to be converted can be determined as first brightness information Y and a first group of first color information UV; color coding sub-information corresponding to a second pixel point in the image to be converted can be determined as second first brightness information Y and a first group of first color information UV; color coding sub-information corresponding to a third pixel point in the image to be converted can be determined as third first brightness information Y and a second group of first color information UV; the color coding sub-information corresponding to the fourth pixel point in the image to be converted can be determined as the fourth first luminance information Y and the second group of first color information UV. Similarly, according to the above process, other first luminance information and other first color information extracted in parallel by Neon are recycled, and color coding sub-information of each pixel point in the image to be converted can be determined.

S104: and generating a target image of the image to be converted corresponding to the target format based on the color coding sub-information corresponding to each pixel point.

In this step, the target format may include, but is not limited to, a BGR format, an NV12 format, a UYVY format, and the like. Under the condition that the image to be converted is determined to be the image in the UYVY format, the target image in the target format can be the image in the BGR format; alternatively, the target image in the target format may be an image in NV12 format. The setting may be performed according to different application scenarios, and the embodiment of the present disclosure is not specifically limited.

In some embodiments, the target format may include a first sub-format, such as a BGR format. And generating a first target sub-image of the image to be converted corresponding to the first sub-format based on the color coding sub-information corresponding to each pixel point. In specific implementation, first, second color coding information corresponding to the first sub-format for each pixel point can be respectively determined based on the color coding sub-information corresponding to each pixel point; and then, generating a first target sub-image of the image to be converted corresponding to the first sub-format based on the second color coding information corresponding to each pixel point.

Here, it is determined that each pixel point corresponds to the second color coding information of the first sub-format, and the second color coding information of the first sub-format corresponding to each pixel point in the image to be converted may be calculated by using a linear interpolation function.

Here, the second color-coding information includes an element B, an element G, and an element R.

For example, taking the example of converting the image to be converted in the UYVY format into the first target sub-image in the BGR format, the color coding sub-information corresponding to one pixel point, that is, Y1、U1、V1Determining the second color coding information of the corresponding BGR format of the pixel point by using a linear interpolation function f (Y, U, V), and recording the second color coding information as B ═ α f (Y)1,U1,V1),G=βf(Y1,U1,V1),R=γf(Y1,U1,V1) Wherein, alpha represents a fixed coefficient in a linear interpolation function corresponding to the B element in the pixel; beta represents a fixed coefficient in a linear interpolation function corresponding to the G element in the pixel; γ represents a fixed coefficient in the linear interpolation function that calculates the R element correspondence in the pixel. The α, β, and γ may be set according to actual application scenarios and empirical values, and the embodiment of the present disclosure is not particularly limited. After the second color-coded information B, G, R for the pixel is determined, the pixel is determined to be converted from the UYVY format to the BGR format. Similarly, for each pixel point in the image to be converted, according to the format conversion mode of the pixel point, a first target sub-image of the image to be converted, which corresponds to the first sub-format, that is, a BGR image of the BGR format, is finally generated.

In addition, after the BGR element of each pixel point is calculated, the element corresponding to each pixel point can be stored in the memory from the address of the first element in the BGR image according to the sequence of each pixel point.

The above S101 to S104 utilize the Neon extension structure in the ARM development board and the register of the CPU, and can extract a plurality of first luminance information and a plurality of groups of first color information in parallel from the first color coding information stored in the register, and since the parallel extraction can multiply increase the information acquisition speed, the image format conversion can be accelerated in multiples on the CPU, and the requirement of real-time image format conversion can be satisfied. Compared with the prior art, the method does not depend on image processing equipment such as a GPU (graphics processing unit), and can reduce the hardware cost of image format conversion; in addition, the method provides a universal image format conversion method for the ARM development board for real-time image format conversion, and meanwhile, compared with an X86-64 platform, the power consumption and hardware cost of the ARM development board are lower.

For the first sorting order in S102, a plurality of first luminance information are extracted in parallel to obtain a first information sequence, and since the arrangement manner of the first luminance information in the first color coding information conforms to a certain sorting feature, such as being located at an odd number or an even number. Therefore, the first luminance information corresponding to the first ordering feature information can be extracted from the first color coding information in parallel by using the Neon extension structure, and the extraction of the first luminance information is accelerated in parallel by processing the performance information in parallel, that is, a plurality of pieces of first luminance information are extracted simultaneously, so that the first information sequence corresponding to a plurality of pixel points in the image to be converted can be obtained quickly.

In a specific implementation, the first sorting feature information of the first luminance information in the first color coding information may be determined based on the first sorting order; determining parallel processing performance information of an ARM development board based on the storage capacity of a register in the ARM; a plurality of first luminance information are extracted in parallel from the first color-coded information based on the first-order feature information and the parallel-processing performance information, resulting in a first information sequence.

Here, the parallel processing capability information may include a target number of pieces of information to be extracted in parallel, for example, the memory capacity of a register in the ARM may be 128 bits, and the parallel processing capability information may include 16 elements which are not signed to be extracted in parallel at a time, or 8 elements which are signed.

The first sorting order may include a sorting order in which the first luminance information is arranged between the first color sub information and the second color sub information, for example, a UYVY format. The first sorting feature information may include a plurality of first sorting orders of the first luminance information, for example, in the case where the first sorting feature information is odd-numbered, the plurality of first sorting orders may be 1, 3, 5, 7, … …, respectively; in the case where the first sorting feature information is in an even number of bits, the plurality of first sorting orders may be 0, 2, 4, 6, … …, respectively.

In some embodiments, a first sorting order of the first luminance information in the first color-coded information may be determined based on the first sorting order, and then the target number of pieces of the first luminance information are extracted in parallel from the first color-coded information based on a plurality of the first sorting orders, and the first information sequence is determined based on the plurality of extracted first luminance information.

For example, taking an image to be converted into an image in the uyyyyyyyyy format as an example, the first sorting order is uyyyyyyyyyy … …, the corresponding addresses may be 0, 1, 2, 3, 4, 5, 6, 7, … …, and it may be determined that the first sorting feature information of the first luminance information in the first color coding information is odd bits, and the plurality of first sorting orders of the first luminance information included therein may be 1, 3, 5, 7, … …, and then 8 first luminance information of the odd bits, that is, Y corresponding to addresses 1, 3, 5, 7, 9, 11, 13, 15, are extracted in parallel each time by using Neon, and then the extraction process is executed in a loop to continuously obtain the first luminance information, and then the first information sequence is determined to be yyyyyyyyyyyyyyyyyy … … based on the obtained plurality of first luminance information.

For the first sorting sequence based on the first color coding information in S102, a plurality of groups of first color information are extracted in parallel to obtain a second information sequence, because the arrangement manner of the first color information in the first color coding information conforms to a certain sorting characteristic, such as being located at odd or even bits, the first color information corresponding to the second sorting characteristic information can be extracted in parallel from the first color coding information by using a Neon extension structure, and the extraction of the first color information is accelerated in parallel by parallel processing the performance information, that is, a plurality of groups of first color information are extracted at the same time, so that the second information sequence corresponding to a plurality of pixel points in the image to be converted can be obtained quickly.

In specific implementation, second sorting feature information of the first color information in the first color coding information is determined based on the first sorting sequence; determining parallel processing performance information of an ARM development board based on the storage capacity of a register in the ARM; and extracting multiple groups of first color information from the first color coding information in parallel based on the second sorting characteristic information and the parallel processing performance information to obtain a second information sequence.

The second sorting feature information may include a plurality of second sorting orders of the first color information, for example, in the case where the second sorting feature information is an odd number digit, the plurality of second sorting orders may be 1, 3, 5, 7, … …, respectively; in the case where the second sorting characteristic information is in an even number of bits, the plurality of second sorting orders may be 0, 2, 4, 6, … …, respectively.

In some embodiments, a second sorting order of the first color information in the first color-coded information is determined based on the second sorting order; and extracting information quantity first color information from the first color coding information in parallel based on a plurality of second sorting orders, and determining the second information sequence based on the extracted first color information.

Continuing the above example, the first ordering order is uyvyyyyyyy … …, the corresponding addresses may be 0, 1, 2, 3, 4, 5, 6, 7, … …, and it may be further determined that the second ordering characteristic information of the first color information in the first color coding information is an even number, and the multiple second ordering orders of the first color information included therein may be 0, 2, 4, 6, … …, then, 4 groups of first color information of the even number are extracted in parallel by Neon each time, which are respectively 4 first color sub information U and 4 second color sub information V, that is, U corresponding to addresses 0, 4, 8, 12 and V corresponding to addresses 2, 6, 10, 14, and then, the extraction process is executed in a loop to continuously obtain the first color information, and based on the obtained multiple groups of first color information, it is determined that the second information sequence is uvvv … ….

The extraction of the first brightness information and the first color information is accelerated in parallel through the parallel processing of the performance information, the first information sequence and the second information sequence corresponding to the multiple pixel points in the image to be converted can be obtained quickly, and the efficiency of image format conversion of the multiple pixel points in the image to be converted is improved.

And determining color coding sub-information corresponding to each pixel point according to the first quantity, the second information sequence and the first information sequence of the first brightness information corresponding to the group of first color information in the S103. Here, the first color information may include first color sub information and second color sub information, and specifically, for example, if the first color information is UV, the first color sub information may be U, and the second color sub information may be V.

Since the first number of values may be an integer greater than 1, there is a case where the first luminance information shares a set of first color sub information U and second color sub information V, i.e., in the first color-coded information of the image to be converted in the UYVY format, two first luminance information Y share a set of first color sub information U and second color sub information V. Therefore, the color coding sub-information corresponding to each pixel point is determined, and in specific implementation, a third information sequence corresponding to the first color sub-information and a fourth information sequence corresponding to the second color sub-information are determined based on a second sorting order of the first color sub-information and the second color sub-information in the second information sequence; and determining color coding sub-information corresponding to each pixel point based on the first quantity, the third information sequence, the fourth information sequence and the first information sequence of the first brightness information corresponding to a group of first color information.

Here, the second sorting order may be a U and V interval arrangement. The third information sequence corresponding to the first color sub-information can be an information sequence formed by the first color sub-information screened from the second information sequence according to the arrangement sequence of each element address; the fourth information sequence corresponding to the second color sub-information may be an information sequence formed by the second color sub-information screened from the second information sequence according to the arrangement order of each element address. For example, taking the image to be converted into the image in the UYVY format as an example, the second information sequence may be UVUV … …, the third information sequence may be UU … …, and the fourth information sequence may be VV … …. Here, the number of elements in the second information sequence is twice the number of elements U in the third information sequence, and is also twice the number of elements V in the fourth information sequence.

Then, color coding sub-information corresponding to each pixel point is determined, specifically, first color sub-information in a third information sequence corresponding to each first brightness information in the first information sequence and second color sub-information in a fourth information sequence can be respectively determined, and then the first brightness information, the first color sub-information and the second color sub-information corresponding to each pixel point are determined, that is, the color coding sub-information corresponding to each pixel point is determined.

In some embodiments, in the case that two pieces of first luminance information correspond to one set of first color information, adding the first color sub information at a position adjacent to each first color sub information in the third information sequence may result in a new third information sequence; adding second color sub-information at the adjacent position of each second color sub-information in the fourth information sequence to obtain a new fourth information sequence; and determining color coding sub-information corresponding to each pixel point based on the new third information sequence, the new fourth information sequence and the first information sequence.

Here, the color coding sub-information corresponding to each pixel point includes first luminance information Y, first color sub-information U, and second color sub-information V.

Continuing with the above example, the third information sequence is U1 U2.., adding first color sub-information at the adjacent position of each first color sub-information to obtain a new third information sequence of U1 U1 U2 U2.., wherein the number of elements in the new third information sequence is the same as the number of elements in the second information sequence, and the first color sub-information in the new third information sequence corresponds one-to-one with the first luminance information in the first information sequence. The fourth information sequence is V1 V2.., adding second color sub-information at the adjacent position of each second color sub-information to obtain a new fourth information sequence V1 V1 V2V2.., wherein the number of elements in the new fourth information sequence is the same as the number of elements in the second information sequence, and the second color sub-information in the new fourth information sequence corresponds one-to-one to the first luminance information in the first information sequence. Here, the color coding sub-information corresponding to each pixel point can be accurately obtained by using the first luminance information, the first color sub-information and the second color sub-information which are in one-to-one correspondence respectively.

In some embodiments, for S104, the target format may further include a second sub-format. Based on that each pixel point determined in S104 corresponds to the second color coding information in the first sub-format, here, the second target sub-image may also be converted into a second target sub-image in a second sub-format, where the second sub-format corresponds to third color coding information, and the third color coding information includes second luminance information and second color information. Each pixel point of the second target sub-image corresponds to one second brightness information, and at least one second brightness information corresponds to one group of second color information.

For example, the second sub-format may include, but is not limited to, NV12 format, UYVY format, and the like. For a 4 × 4 NV12 format image, the corresponding third color coding information may be yyyyyyyyyyyyyyyyuvuvuvuvuvuvuv. The third color coding information comprises second brightness information Y and second color information UV. Each pixel point of the NV12 format image corresponds to one second luminance information, and four second luminance information correspond to one set of second color information.

In specific implementation, see fig. 2, which is a flowchart for generating a second target sub-image corresponding to a second sub-format, the method includes the following steps S201 to S203:

s201: and based on the second color coding information corresponding to each pixel point in the image to be converted, performing parallel computation to obtain second brightness information corresponding to each pixel point of the second target sub-image.

In a specific implementation, based on that each determined pixel corresponds to the second color coding information in the BGR format, that is, B ═ α f (Y, U, V), G ═ β f (Y, U, V), and R ═ γ f (Y, U, V), parallel computation is performed by using a linear interpolation function, so as to obtain second luminance information corresponding to each pixel of the second target sub-image, that is, Y ═ δ f (B, G, R), where δ represents a fixed coefficient in the linear interpolation function corresponding to the second luminance information Y in the pixel, and may be defined according to an empirical value, and the present disclosure is not limited in particular.

Here, the parallel calculation may be to extract, from the three registers, the element B in the stored 8 pieces of 8-bit second color coding information, the element G in the 8 pieces of 8-bit second color coding information, and the element R in the 8 pieces of 8-bit second color coding information in parallel, respectively, by using Neon, to obtain 8 groups of second color coding information BGR, that is, 8 pixel points, and then calculate 8 groups of BGR in parallel by using a linear interpolation function Y ═ δ f (B, G, R), to obtain second luminance information corresponding to each group of BGR (each pixel point). And circularly calling the Neon parallel computation until second brightness information after format conversion of each pixel point corresponding to the first target sub-image is obtained.

S202: and based on the second quantity of the second brightness information corresponding to the group of second color information and the second color coding information corresponding to each pixel point in the image to be converted, performing parallel calculation to obtain second color information corresponding to each pixel point of the second target sub-image.

In this step, the second amount of the second luminance information corresponding to the group of second luminance information may represent the amount of the group of second luminance information shared by the second luminance information.

In specific implementation, determining third sorting feature information of the target pixel point based on a second quantity of second brightness information corresponding to the group of second color information; the target pixel point comprises a pixel point used for determining second color information; determining second color coding information corresponding to the target pixel point based on the third sorting characteristic information and second color coding information corresponding to each pixel point in the image to be converted; and based on the second color coding information corresponding to the target pixel point, performing parallel computation to obtain second color information corresponding to each pixel point of a second target sub-image.

Here, since the second number is different, the number of the determined target pixel points is different. For example, if the second number is 1, that is, one second luminance information shares one group of second color information, each pixel point in the first target sub-image is a target pixel point. And under the condition that the second quantity is 4, namely the four pieces of second brightness information share one piece of second color information, determining four pixel points in the first target sub-image and determining one target pixel point, namely the number of the target pixel points is one fourth of the number of the pixel points in the first target sub-image. Specifically, refer to fig. 3, which is a schematic diagram of a target pixel point determined from the first target sub-image. Where 31 denotes a 4 × 4 first target sub-image; 32 represents pixel points in the first target sub-image, and 16 pixel points are total; 33 represent target pixels, for a total of 4, which is one fourth of the number of pixels in the 16 first target subimages.

And under the condition that the second quantity is 1, the third sequencing feature information of the target pixel points is the position information of the pixel points in each first target sub-image. Under the condition that the second number is 4, the third sorting feature information of the target pixel points is position information of pixel points in the first target sub-image in even rows and even columns, such as 0 th row and 0 th column, 0 th row and 2 nd column, 2 nd row and 0 th column, 2 nd row and 2 nd column in fig. 3.

Here, the parallel computation may be to extract, from the three registers, the element B, the element G, and the element R at the positions of the rows and columns corresponding to the stored third ordering feature information, respectively, in parallel by using Neon, determine at least one group of second color coding information BGR, that is, at least one pixel, and then, obtain second color information U and V corresponding to each group of BGR (each pixel) by using linear interpolation functions U ═ epsilon f (B, G, R) and V ═ θ f (B, G, R) and parallel compute the extracted BGR. Wherein, epsilon represents to calculate a fixed coefficient in the linear interpolation function corresponding to the second color information U in the pixel, and theta represents to calculate a fixed coefficient in the linear interpolation function corresponding to the second color information V in the pixel, which may be defined according to an empirical value, and the embodiment of the present disclosure is not specifically limited. And then, circularly calling the Neon parallel computation until second color information after format conversion of each pixel point corresponding to the first target sub-image is obtained.

In some embodiments, in a case where the four second luminance information correspond to one group of the second color information, determining the third ordering characteristic information of the target pixel point includes that the target pixel point is located in an even-numbered row and is located in an even-numbered column; or, under the condition that the four pieces of second brightness information correspond to one group of second color information, determining third sorting feature information of the target pixel points, wherein the target pixel points are located in odd rows and odd columns.

Illustratively, in the case where the second target sub-image is an NV12 format image, the second number is 4. And determining third sorting characteristic information of the target pixel points, namely screening even-numbered rows and even-numbered columns or odd-numbered rows and odd-numbered columns of the pixel points from the first target subimage as the target pixel points, namely sharing a group of second color information by the four pieces of second brightness information.

S203: and generating a second target sub-image corresponding to the second sub-format based on the second brightness information and the second color information corresponding to each pixel point of the second target sub-image.

Specifically, third color coding information corresponding to each pixel point is determined based on second brightness information and second color information corresponding to each pixel point of the second target sub-image; a second target sub-image corresponding to the second sub-format is generated based on the third color-coding information.

Here, one pixel point corresponds to one second luminance information, and a second number of pixel points are determined to share one group of second color information according to a second number of second luminance information corresponding to one group of second color information.

For example, in the case that the second sub-format is NV12 format, the second luminance information and the second color information, i.e., YYYYYYYYYYYYYYYY and UVUVUVUV, corresponding to each pixel point of the 4 × 4 second target sub-image are determined, and the third color coding information corresponding to each pixel point may be YYYYYYYYYYYYYYYY UVUVUVUV, i.e., YYYYYYYYYYYYYYYY UVUVUVUV is generated as the second target sub-image in NV12 format.

After the second brightness information and the second color information of each pixel point are calculated, storing the first second brightness information in the generated second target sub-image into a preset second brightness information initial address, and sequentially storing the rest second brightness information according to the sequence; and storing the first group of second color information in the generated second target sub-image into a preset second color information first address, and sequentially storing the rest second color information according to the sequence, so that the second target sub-image is called from the memory subsequently based on the second brightness information first address and the second color information first address.

In S201 to S203, based on the second color coding information corresponding to the plurality of pixel points stored in the register of the ARM development board, the second luminance information of the plurality of pixel points can be obtained through parallel calculation, and based on the second color coding information corresponding to the plurality of pixel points stored in the register of the ARM development board, the second color information of the plurality of pixel points can be obtained through parallel calculation, and the second luminance information and the second color information of each pixel point are compared and sequentially calculated.

In some embodiments, for S202, a third number of registers is determined based on a second number of second luminance information corresponding to a set of second color information; and storing second color coding information by using a third number of registers, and performing parallel calculation based on the second color coding information stored by the registers to obtain second color information corresponding to each pixel point of the second target sub-image.

Illustratively, for the conversion of the BGR format image into the NV12 format image, the four second luminance information share a set of second luminance information, when the second color information is calculated in parallel, only 4 groups of BGR can be extracted at one time when the second color coding information BGR is extracted by utilizing the Neon parallel calculation, namely BGRs of even rows and even columns or BGRs of odd rows and odd columns, can simultaneously process 8 groups of BGRs at most by utilizing Neon parallel computation, neon's effort would be wasted if only 4 sets of BGRs extracted in parallel were used, and therefore, the second color-coded information stored by two registers (i.e., a third number of 2) could be called simultaneously, simultaneously extracts 8 groups of BGRs, and can simultaneously calculate second color information corresponding to 16 pixel points in parallel by using a linear interpolation function, thereby improving the calculation efficiency of the second color information, and further improves the image conversion efficiency of converting the images in the BGR format into the images in the NV12 format.

It will be understood by those skilled in the art that in the method of the present invention, the order of writing the steps does not imply a strict order of execution and any limitations on the implementation, and the specific order of execution of the steps should be determined by their function and possible inherent logic.

Based on the same inventive concept, an image format conversion device corresponding to the image format conversion method is also provided in the embodiments of the present disclosure, and because the principle of solving the problem of the device in the embodiments of the present disclosure is similar to the image format conversion method in the embodiments of the present disclosure, the implementation of the device may refer to the implementation of the method, and repeated details are not repeated.

Referring to fig. 4, a schematic diagram of an image format conversion apparatus provided in an embodiment of the present disclosure is shown, where the apparatus includes: an information acquisition module 401, an information extraction module 402, an information determination module 403, and a first image conversion module 404; wherein the content of the first and second substances,

an information obtaining module 401, configured to obtain first color coding information of an image to be converted; the first color coding information comprises a plurality of first brightness information and a plurality of groups of first color information, each pixel point of the image to be converted corresponds to one first brightness information, and at least one first brightness information corresponds to one group of first color information;

an information extraction module 402, configured to extract multiple sets of first luminance information in parallel based on a first sorting order of first luminance information and first color information in the first color coding information to obtain a first information sequence, and extract multiple sets of first color information in parallel based on the first sorting order to obtain a second information sequence;

an information determining module 403, configured to determine color coding sub-information corresponding to each pixel point based on a first quantity of first luminance information corresponding to a group of first color information, the second information sequence, and the first information sequence;

the first image conversion module 404 is configured to generate a target image, in which the image to be converted corresponds to a target format, based on the color coding sub-information corresponding to each pixel point.

In an alternative embodiment, the information extracting module 402 is configured to determine, based on the first sorting order, first sorting feature information of the first luminance information in the first color-coded information; determining the parallel processing performance information of the ARM development board based on the storage capacity of the register in the ARM; extracting a plurality of first luminance information and the parallel processing performance information from the first color coding information in parallel based on the first ordering feature information to obtain the first information sequence; and determining second ordering characteristic information of the first color information in the first color coding information based on the first ordering order; and extracting multiple groups of first color information from the first color coding information in parallel based on the second sorting characteristic information and the parallel processing performance information to obtain the second information sequence.

In an alternative embodiment, the parallel processing performance information includes a target number of pieces of the information extracted in parallel; the first color information comprises first color sub information and second color sub information; the first sorting order includes that the first luminance information is arranged between the first color sub information and the second color sub information; the first sorting feature information includes a plurality of first sorting orders of the first luminance information;

the information extraction module 402, configured to determine a first sorting order of the first luminance information in the first color-coded information based on the first sorting order; the target number of pieces of first luminance information is extracted in parallel from the first color-coded information based on the plurality of first sorting orders, and the first information sequence is determined based on the extracted plurality of pieces of first luminance information.

In an optional embodiment, the first color information includes first color sub information and second color sub information;

the information determining module 403 is configured to determine, based on a second sorting order of the first color sub information and the second color sub information in the second information sequence, a third information sequence corresponding to the first color sub information and a fourth information sequence corresponding to the second color sub information; and determining color coding sub-information corresponding to each pixel point based on a first quantity of first brightness information corresponding to a group of the first color information, the third information sequence, the fourth information sequence and the first information sequence.

In an alternative embodiment, the information determining module 403 is configured to, in a case that two pieces of first luminance information correspond to one set of the first color information, add the first color sub information at a position adjacent to each first color sub information in the third information sequence, so as to obtain a new third information sequence; adding the second color sub-information at the adjacent position of each second color sub-information in the fourth information sequence to obtain a new fourth information sequence; and determining color coding sub-information corresponding to each pixel point based on the new third information sequence, the new fourth information sequence and the first information sequence.

In an alternative embodiment, the target format comprises a first sub-format; the target image comprises a first target sub-image;

the first image conversion module 404 is configured to determine, based on the color coding sub-information corresponding to each pixel point, second color coding information corresponding to the first sub-format for each pixel point respectively; and generating a first target sub-image of the image to be converted corresponding to the first sub-format based on the second color coding information corresponding to each pixel point.

In an optional embodiment, the target format further comprises a second sub-format; the target image further comprises a second target sub-image; the second sub-format corresponds to third color coding information; the third color coding information comprises second brightness information and second color information; each pixel point of the second target sub-image corresponds to one second brightness information, and at least one second brightness information corresponds to one group of second color information;

the apparatus further includes a second image conversion module 405, configured to, after determining the second color coding information, perform parallel computation based on second color coding information corresponding to each pixel point in the image to be converted, to obtain second luminance information corresponding to each pixel point of the second target sub-image; performing parallel calculation based on a second quantity of second brightness information corresponding to a group of second color information and second color coding information corresponding to each pixel point in the image to be converted to obtain second color information corresponding to each pixel point of the second target sub-image; and generating a second target sub-image corresponding to the second sub-format based on second brightness information and second color information corresponding to each pixel point of the second target sub-image.

In an optional implementation manner, the second image conversion module 405 is configured to determine third sorting feature information of a target pixel point based on a second quantity of second luminance information corresponding to a group of the second color information; the target pixel point comprises a pixel point for determining the second color information; determining second color coding information corresponding to the target pixel point based on the third sorting feature information and second color coding information corresponding to each pixel point in the image to be converted; and performing parallel calculation based on the second color coding information corresponding to the target pixel point to obtain second color information corresponding to each pixel point of the second target sub-image.

In an optional embodiment, the second image conversion module 405 is configured to, in a case that four pieces of the second luminance information correspond to one set of the second color information, determine that the third ordering characteristic information of the target pixel includes that the target pixel is located in an even row and is located in an even column; or, under the condition that the four pieces of second brightness information correspond to one set of second color information, determining that the third ordering characteristic information of the target pixel point includes that the target pixel point is located in an odd row and is located in an odd column.

In an optional implementation manner, the second image conversion module 405 is configured to determine a third number of registers based on a second number of second luminance information corresponding to a group of the second color information; and storing the second color coding information by using the registers of the third number, and performing parallel calculation based on the second color coding information stored by the registers to obtain second color information corresponding to each pixel point of the second target sub-image.

The description of the processing flow of each module in the image format conversion device and the interaction flow between each module may refer to the related description in the above-mentioned embodiment of the image format conversion method, and will not be described in detail here.

Based on the same technical concept, the embodiment of the application also provides computer equipment. Referring to fig. 5, a schematic structural diagram of a computer device provided in an embodiment of the present application includes:

a processor 51, a memory 52 and a bus 53. Wherein the memory 52 stores machine-readable instructions executable by the processor 51, and the processor 51 is configured to execute the machine-readable instructions stored in the memory 52, and when the machine-readable instructions are executed by the processor 51, the processor 51 performs the following steps: s101: acquiring first color coding information of an image to be converted; the first color coding information comprises a plurality of first brightness information and a plurality of groups of first color information, each pixel point of the image to be converted corresponds to one first brightness information, and at least one first brightness information corresponds to one group of first color information; s102: extracting a plurality of first luminance information in parallel to obtain a first information sequence based on a first sorting order of first luminance information and first color information in the first color coding information, and extracting a plurality of groups of first color information in parallel to obtain a second information sequence based on the first sorting order; s103: determining color coding sub-information corresponding to each pixel point based on a first quantity of first brightness information corresponding to a group of first color information, a second information sequence and a first information sequence; s104: and generating a target image of the image to be converted corresponding to the target format based on the color coding sub-information corresponding to each pixel point.

The storage 52 includes a memory 521 and an external storage 522; the memory 521 is also referred to as an internal memory, and is used for temporarily storing the operation data in the processor 51 and the data exchanged with the external storage 522 such as a hard disk, the processor 51 exchanges data with the external storage 522 through the memory 521, and when the computer device is operated, the processor 51 communicates with the storage 52 through the bus 53, so that the processor 51 executes the execution instructions mentioned in the above method embodiments.

The embodiments of the present disclosure also provide a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the computer program performs the steps of the image format conversion method in the above method embodiments. The storage medium may be a volatile or non-volatile computer-readable storage medium.

The embodiments of the present disclosure also provide a computer program product, which includes computer instructions, and the computer instructions, when executed by a processor, implement the steps of the image format conversion method described above. Wherein a computer program product may be any product capable of implementing the above image format conversion method, and part or all of the solutions in the computer program product contributing to the prior art may be embodied in the form of a Software product (e.g., Software Development Kit (SDK)), which may be stored in a storage medium, and the computer instructions included therein cause an associated device or processor to perform part or all of the steps of the above image format conversion method.

It is clear to those skilled in the art that, for convenience and brevity of description, the specific working process of the apparatus described above may refer to the corresponding process in the foregoing method embodiment, and is not described herein again. In the several embodiments provided in the present disclosure, it should be understood that the disclosed apparatus and method may be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the modules is only one logical division, and there may be other divisions in actual implementation, and for example, a plurality of modules or components may be combined, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or modules through some communication interfaces, and may be in an electrical, mechanical or other form.

The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.

In addition, functional modules in the embodiments of the present disclosure may be integrated into one processing module, or each module may exist alone physically, or two or more modules are integrated into one module.

The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a non-volatile computer-readable storage medium executable by a processor. Based on such understanding, the technical solution of the present disclosure may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present disclosure. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.

Finally, it should be noted that: the above-mentioned embodiments are merely specific embodiments of the present disclosure, which are used for illustrating the technical solutions of the present disclosure and not for limiting the same, and the scope of the present disclosure is not limited thereto, and although the present disclosure is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: any person skilled in the art can modify or easily conceive of the technical solutions described in the foregoing embodiments or equivalent technical features thereof within the technical scope of the present disclosure; such modifications, changes or substitutions do not depart from the spirit and scope of the embodiments of the present disclosure, and should be construed as being included therein. Therefore, the protection scope of the present disclosure shall be subject to the protection scope of the claims.

27页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种视频预览方法、装置及电子设备

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类