Image format conversion method, device and equipment
Through the shift register shifting method, the problem of low conversion efficiency of YUV format data is solved, and efficient image format conversion is achieved, especially for the fast conversion of large-scale image data.
Patent Information
- Application Number
- CN202211684921.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-27
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2042-12-27
AI Technical Summary
The existing technology is inefficient when converting YUV format data from one storage format to another storage format, and requires multiple memory copy operations.
By adopting the shift register shifting method and analyzing the pixel component arrangement rule of the target format, at least two pixel component sequences are shifted and converted to realize the continuous cross storage of the pixel components.
The efficiency of image format conversion has been greatly improved, and the number of instructions has been reduced. The efficiency improvement is especially significant when it comes to large-scale images.
Smart Images

Figure CN116016881B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of image processing technology, specifically the field of image format conversion technology, and can be applied to video encoding scenarios. Background Art
[0002] YUV is a color encoding method. Y represents luminance (Luminance or Luma), which is the grayscale value, and U and V represent chrominance (Chrominance or Chroma). They are used to describe the color and saturation of the image and are used to specify the color of the pixel.
[0003] The following are two storage formats for YUV format data: the first one continuously stores the Y component of all pixels, followed by the U component of all pixels, and then the V component of all pixels; the second one continuously stores the Y, U, and V components of each pixel. When YUV format data needs to be converted from the first storage format to the second storage format, the existing technology is to achieve it by memory copying and moving byte by byte. Figure 1 A scene diagram of an image format conversion method in the prior art is shown. Figure 1 As shown in the figure, the top two rows are YUV format data stored in the first storage format, which first continuously stores the Y components of all pixels: Y0, Y1, Y2, Y3, Y4, Y5, Y6, Y7, followed by the U components of all pixels: U0, U1, U2, U3, followed by the V components of all pixels: V0, V1, V2, V3. The bottom two rows are YUV format data stored in the second storage format, which is achieved by copying the above two rows of YUV format data 16 times, and the Y, U, and V components of each pixel are continuously interleaved and stored: Y0, U0, Y1, V0, Y2, U1, Y3, V1, Y4, U2, Y5, V2, Y6, U3, Y7, V3. Summary of the Invention
[0004] The embodiments of the present disclosure provide an image format conversion method, apparatus, device, storage medium, and program product.
[0005] In a first aspect, an embodiment of the present disclosure proposes an image format conversion method, comprising: obtaining an original image; obtaining at least two pixel component sequences from the original image; and performing at least one shift conversion on the at least two pixel component sequences based on a target format to obtain a target image.
[0006] In a second aspect, an embodiment of the present disclosure proposes an image format conversion device, comprising: a first acquisition module, configured to acquire an original image; a second acquisition module, configured to acquire at least two pixel component sequences from the original image; and a conversion module, configured to perform at least one shift conversion on the at least two pixel component sequences based on a target format to obtain a target image.
[0007] In a third aspect, an embodiment of the present disclosure proposes an electronic device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method described in any implementation manner in the first aspect.
[0008] In a fourth aspect, an embodiment of the present disclosure proposes a non-transitory computer-readable storage medium storing computer instructions, where the computer instructions are used to enable a computer to execute the method described in any implementation manner in the first aspect.
[0009] In a fifth aspect, an embodiment of the present disclosure proposes a computer program product, including a computer program, which implements the method described in any implementation manner in the first aspect when executed by a processor.
[0010] The image format conversion method provided by the embodiment of the present disclosure adopts a shift register shifting method, thereby improving the image format conversion efficiency.
[0011] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present disclosure, nor are they intended to limit the scope of the present disclosure. Other features of the present disclosure will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Other features, objects, and advantages of the present disclosure will become more apparent upon reading the detailed description of the non-limiting embodiments made with reference to the following drawings. The drawings are provided for a better understanding of the present disclosure and do not constitute a limitation of the present disclosure. Among them:
[0013] Figure 1 It is a scene graph of the image format conversion method of the prior art;
[0014] Figure 2 is a flowchart of an embodiment of an image format conversion method according to the present disclosure;
[0015] Figure 3 is a flowchart of another embodiment of the image format conversion method according to the present disclosure;
[0016] Figure 4 is a flowchart of another embodiment of the image format conversion method according to the present disclosure;
[0017] Figure 5 is a scene graph that can implement the image format conversion method of the embodiment of the present disclosure;
[0018] Figure 6 is a structural diagram of an embodiment of an image format conversion device according to the present disclosure;
[0019] Figure 7 It is a block diagram of an electronic device used to implement the image format conversion method according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0020] The following description of exemplary embodiments of the present disclosure is made in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding. These details should be considered as merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0021] It should be noted that, in the absence of conflict, the embodiments and features of the embodiments in the present disclosure may be combined with each other. The present disclosure will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0022] Figure 2 A process 200 of an embodiment of an image format conversion method according to the present disclosure is shown. The image format conversion method includes the following steps:
[0023] Step 201: Acquire an original image.
[0024] In this embodiment, the image format conversion method can obtain an original image. The original image can be an image whose pixels include at least two pixel components. For example, a YUV image's pixels include a Y component, a U component, and a V component. The Y component represents brightness and is a grayscale value, while the U and V components represent chromaticity, with U representing a blue projection and V representing a red projection.
[0025] Step 202: Obtain at least two pixel component sequences from the original image.
[0026] In this embodiment, the execution entity may obtain at least two pixel component sequences from the original image.
[0027] Typically, at least two pixel component sequences are obtained from the original image and stored sequentially. For example, if the original image is a YUV image, the Y component sequence is first obtained from the original image and stored continuously. Next, the U component sequence is obtained and stored continuously. Finally, the V component sequence is obtained and stored continuously. In this way, YUV format data stored according to the first storage format described in the background art is obtained.
[0028] Step 203 : Based on the target format, perform at least one shift conversion on at least two pixel component sequences to obtain a target image.
[0029] In this embodiment, the execution subject may perform at least one shift conversion on at least two pixel component sequences based on the target format to obtain a target image.
[0030] Typically, the distribution of different pixel components in the target format can exhibit a certain periodicity. Therefore, by analyzing the target format, the arrangement pattern of each pixel component can be determined. Based on the arrangement pattern of each pixel component, at least two pixel component sequences are shifted and transformed at least once, so that at least two pixel components are continuously interleaved and stored, thereby obtaining the target image. A single shift transformation requires only one instruction and can evenly shift pixels from one pixel component sequence to another pixel component sequence, so that the two pixel components are continuously interleaved and stored. For example, a Y component sequence and a U component sequence are shifted and transformed to obtain a YU component sequence. In the YU component sequence, Y and U are continuously interleaved and stored. A YU component sequence and a V component sequence are shifted and transformed to obtain a YUV component sequence. In the YUV component sequence, Y, U, and V are continuously interleaved and stored.
[0031] The image format conversion method provided by the embodiment of the present disclosure adopts a shift register shifting method, thereby improving the image format conversion efficiency.
[0032] Further references Figure 3 , which shows a process 300 of another embodiment of the image format conversion method according to the present disclosure. The image format conversion method includes the following steps:
[0033] Step 301: Acquire an original image.
[0034] In this embodiment, the specific operation of step 301 has been Figure 2 In the embodiment shown, step 201 is described in detail and will not be repeated here.
[0035] Step 302: Sample at least two pixel components in the original image according to a preset sampling ratio to obtain at least two pixel component sequences.
[0036] In this embodiment, the execution subject of the image format conversion method may sample at least two pixel components in the original image according to a preset sampling ratio to obtain at least two pixel component sequences.
[0037] Among them, the preset sampling ratios may include but are not limited to: 4:4:4, 4:2:2, 4:2:0 and 4:1:1. 4:4:4 means that the sampling rate of the chroma (UV) channel is not reduced. Each Y component corresponds to a set of UV components. 4:2:2 means 2:1 horizontal downsampling without vertical downsampling. Every two Y components share a set of UV components. 4:2:0 means 2:1 horizontal downsampling and 2:1 vertical downsampling at the same time. Every four Y components share a set of UV components. 4:1:1 means 4:1 horizontal downsampling without vertical downsampling. Every four Y components share a set of UV components. By presetting the sampling ratio, YUV data of various storage formats can be generated, which has a wider range of applications.
[0038] Step 303: Determine the shift conversion mode and the number of shift conversions based on the target format.
[0039] In this embodiment, the execution entity may determine the shift conversion method and the number of shift conversions based on the target format.
[0040] Typically, the distribution of different pixel components in the target format exhibits a certain degree of periodicity. Therefore, by analyzing the target format, the shift conversion method and the number of shift conversions can be determined. The number of shift conversions can be determined based on the types of pixel components in the target format. Typically, the number of shift conversions is equal to the number of pixel components minus one. For example, if the target format contains three pixel components, two shift conversions are required. The shift conversion method can be determined based on the order of the pixel components in the target format. For example, if the target format contains three pixel components, a shift conversion is performed on the two pixel components arranged last, followed by a shift conversion with the pixel component arranged first.
[0041] Step 304 : performing a shift conversion for a specified number of times on at least two pixel component sequences in a shift conversion manner to obtain a target image.
[0042] In this embodiment, the execution entity can perform a shift conversion a specified number of times on at least two pixel component sequences according to a shift conversion method to obtain a target image. Performing the shift conversion based on the shift conversion method and the number of shift conversions can rapidly generate the target image. For example, if the target format contains three pixel components, the two pixel components arranged later are first shift converted, followed by a shift conversion with the pixel component arranged earlier.
[0043] from Figure 3 It can be seen that Figure 2Compared to the corresponding embodiment, process 300 of the image format conversion method in this embodiment emphasizes the sampling and shift conversion steps. Thus, the solution described in this embodiment can generate YUV data in various storage formats by presetting the sampling ratio, thus expanding its application range. Shift conversion based on the shift conversion method and the number of shift conversions can quickly generate the target image.
[0044] Further references Figure 4 , which shows a process 400 of another embodiment of the image format conversion method according to the present disclosure. The image format conversion method includes the following steps:
[0045] Step 401: Acquire an original image.
[0046] In this embodiment, the specific operation of step 401 has been Figure 3 In the illustrated embodiment, step 301 is described in detail and will not be repeated here.
[0047] Step 402 : Sample the first pixel component, the second pixel component, and the third pixel component in the original image according to a sampling ratio of 4:2:2 to obtain a first pixel component sequence, a second pixel component sequence, and a third pixel component sequence.
[0048] In this embodiment, the execution body of the image format conversion method can sample the first pixel component, the second pixel component, and the third pixel component in the original image according to a sampling ratio of 4:2:2 to obtain a first pixel component sequence, a second pixel component sequence, and a third pixel component sequence. The first pixel component can be a brightness Y component, the second pixel component can be a chroma U component, and the third pixel component can be a chroma V component. 4:2:2 represents 2:1 horizontal downsampling and no vertical downsampling. Every two Y components share a set of UV components. Here, the sampling rate of the chroma channel UV component can be lower than that of the luma channel Y component without significantly reducing the perceived quality.
[0049] Step 403: Perform a first shift conversion on the second pixel component sequence and the third pixel component sequence to obtain a combined sequence of the second pixel component and the third pixel component.
[0050] In this embodiment, the execution entity may perform a first shift conversion on the second pixel component sequence and the third pixel component sequence to obtain a combined sequence of the second pixel component and the third pixel component. Specifically, the second pixel component sequence and the third pixel component sequence are shift converted so that the second pixel component and the third pixel component are stored continuously and interleaved. For example, the U component sequence and the V component sequence are shift converted so that the UV components in the obtained UV component sequence are stored continuously and interleaved.
[0051] Step 404: Perform a second shift conversion on the first pixel component sequence and the combined sequence to obtain a target image.
[0052] In this embodiment, the execution entity may perform a second shift conversion on the first pixel component sequence and the combined sequence to obtain a target image. Specifically, the first pixel component sequence and the combined sequence are shift converted so that the first pixel components are stored continuously and interleaved with the components in the combined sequence. For example, the Y component sequence and the UV component sequence are shift converted so that the YUYV components in the resulting YUV component sequence are stored continuously and interleaved.
[0053] from Figure 4 It can be seen that Figure 3 Compared to the corresponding embodiment, process 400 of the image format conversion method in this embodiment emphasizes the sampling and shift conversion steps. As a result, the scheme described in this embodiment allows the sampling rate of the chroma channel UV component to be lower than the luma channel Y component without significantly reducing perceived quality. After two shift conversions, only two instructions are required to generate YUV format data in the YUYV storage format, significantly improving image format conversion efficiency.
[0054] For ease of understanding, Figure 5 FIG. 1 shows a scene diagram in which the image format conversion method of the embodiment of the present disclosure can be implemented. Figure 5 As shown in the figure, the Y, U, and V components of the original image are sampled at a 4:2:2 ratio, resulting in the Y, U, and V component sequences. The first row shows the U component sequence: U0, U1, U2, U3, and the V component sequence: V0, V1, V2, V3. The third row shows the Y component sequence: Y0, Y1, Y2, Y3, Y4, Y5, Y6, Y7. The U and V component sequences are first shifted to produce the UV component sequence: U0, V0, U1, V1, U2, V2, U3, V3. The UV and Y component sequences are second shifted to produce the target image: Y0, U0, Y1, V0, Y2, U1, Y3, V1, Y4, U2, Y5, V2, Y6, U3, Y7, V3.
[0055] Figure 5 The scene shown only requires two instructions to perform two shift conversions to get the target image. Figure 1 The scenario shown requires 16 instructions and 16 memory copies to obtain the target image. This shows that the image format conversion method provided by the disclosed embodiments significantly improves image format conversion efficiency. Furthermore, the efficiency improvement is even more significant for images with more pixels and a larger number of images.
[0056] Further references Figure 6As an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of an image format conversion device. Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0057] like Figure 6 As shown, the image format conversion device 600 of this embodiment may include: a first acquisition module 601, a second acquisition module 602, and a conversion module 603. The first acquisition module 601 is configured to acquire an original image; the second acquisition module 602 is configured to acquire at least two pixel component sequences from the original image; and the conversion module 603 is configured to perform at least one shift conversion on the at least two pixel component sequences based on a target format to obtain a target image.
[0058] In this embodiment, in the image format conversion device 600, the specific processing of the first acquisition module 601, the second acquisition module 602 and the conversion module 603 and the technical effects thereof can be referred to in the respective Figure 2 The relevant descriptions of steps 201-203 in the corresponding embodiment are not repeated here.
[0059] In some optional implementations of this embodiment, the conversion module 603 includes: a determination submodule, configured to determine a shift conversion method and a number of shift conversions based on a target format; a conversion submodule, configured to perform a shift conversion number of shift conversions on at least two pixel component sequences according to the shift conversion method to obtain a target image.
[0060] In some optional implementations of this embodiment, the second acquisition module 602 includes: a sampling submodule configured to sample at least two pixel components in the original image according to a preset sampling ratio to obtain at least two pixel component sequences.
[0061] In some optional implementations of this embodiment, the sampling submodule is further configured to: sample the first pixel component, the second pixel component and the third pixel component in the original image according to a sampling ratio of 4:2:2 to obtain a first pixel component sequence, a second pixel component sequence and a third pixel component sequence.
[0062] In some optional implementations of this embodiment, the conversion submodule is further configured to: perform a first shift conversion on the second pixel component sequence and the third pixel component sequence to obtain a combined sequence of the second pixel component and the third pixel component; and perform a second shift conversion on the first pixel component sequence and the combined sequence to obtain a target image.
[0063] In some optional implementations of this embodiment, the first pixel component is a brightness Y component, the second pixel component is a chroma U component, and the third pixel component is a chroma V component.
[0064] In the technical solutions disclosed herein, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0065] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0066] Figure 7 A schematic block diagram of an example electronic device 700 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0067] like Figure 7 As shown, the device 700 includes a computing unit 701, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 702 or a computer program loaded from a storage unit 708 into a random access memory (RAM) 703. Various programs and data required for the operation of the device 700 can also be stored in the RAM 703. The computing unit 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0068] Various components in device 700 are connected to I / O interface 705, including an input unit 706, such as a keyboard, mouse, etc.; an output unit 707, such as various types of displays, speakers, etc.; a storage unit 708, such as a magnetic disk, optical disk, etc.; and a communication unit 709, such as a network card, modem, wireless communication transceiver, etc. The communication unit 709 allows device 700 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0069] The computing unit 701 can be a variety of general-purpose and / or specialized processing components with processing and computing capabilities. Some examples of the computing unit 701 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units that run machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 701 performs the various methods and processes described above, such as the image format conversion method. For example, in some embodiments, the image format conversion method can be implemented as a computer software program that is tangibly contained in a machine-readable medium, such as the storage unit 708. In some embodiments, part or all of the computer program can be loaded and / or installed on the device 700 via the ROM 702 and / or the communication unit 709. When the computer program is loaded into the RAM 703 and executed by the computing unit 701, one or more steps of the image format conversion method described above can be performed. Alternatively, in other embodiments, the computing unit 701 can be configured to perform the image format conversion method by any other suitable means (e.g., by means of firmware).
[0070] Various embodiments of the systems and techniques described herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system-on-chip systems (SOCs), programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0071] The program code for implementing the method of the present disclosure can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device so that when the program code is executed by the processor or controller, the functions / operations specified in the flow chart and / or block diagram are implemented. The program code can be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0072] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device or equipment. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0073] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0074] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet.
[0075] A computer system may include a client and a server. The client and server are generally remote from each other and typically interact through a communication network. The client-server relationship arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server may be a cloud server, a server in a distributed system, or a server integrated with a blockchain.
[0076] It should be understood that the various forms of processes shown above can be used to reorder, add, or delete steps. For example, the steps described in this disclosure can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions provided by this disclosure can be achieved. This is not limited herein.
[0077] The above specific embodiments do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure shall be included within the scope of protection of this disclosure.
Claims
1. A method for image format conversion, comprising: Get the original image; Obtain at least two pixel component sequences from the original image; Based on the target format, determine the shift conversion method and the number of shift conversions; Performing the shift conversion for the number of shift conversions on the at least two pixel component sequences according to the shift conversion method to obtain a target image, wherein the number of shift conversions is equal to the number of pixel component types minus 1; The at least two pixel component sequences include a first pixel component sequence, a second pixel component sequence, and a third pixel component sequence, the first pixel component sequence including a luminance Y component, the second pixel component sequence including a chrominance U component, and the third pixel component sequence including a chrominance V component; and The step of performing the shift conversion for the number of shift conversions on the at least two pixel component sequences according to the shift conversion method to obtain the target image includes: Performing a first shift conversion on the second pixel component sequence and the third pixel component sequence to obtain a combined sequence of the second pixel component and the third pixel component; Performing a second shift conversion on the first pixel component sequence and the combined sequence to obtain the target image.
2. The method according to claim 1, wherein The acquiring at least two pixel component sequences from the original image comprises: At least two pixel components in the original image are sampled according to a preset sampling ratio to obtain the at least two pixel component sequences.
3. The method according to claim 2, wherein: The step of sampling the at least two pixel components in the original image according to a preset sampling ratio to obtain the at least two pixel component sequences includes: The first pixel component, the second pixel component, and the third pixel component in the original image are sampled according to a sampling ratio of 4:2:2 to obtain a first pixel component sequence, a second pixel component sequence, and a third pixel component sequence.
4. An image format conversion device, comprising: A first acquisition module is configured to acquire an original image; A second acquisition module is configured to acquire at least two pixel component sequences from the original image; A determination module is configured to determine a shift conversion mode and a shift conversion number based on a target format; a conversion module configured to perform a shift conversion for the number of shift conversions on the at least two pixel component sequences according to the shift conversion method to obtain a target image, wherein the number of shift conversions is equal to the number of pixel component types minus 1; The at least two pixel component sequences include a first pixel component sequence, a second pixel component sequence, and a third pixel component sequence, the first pixel component sequence including a luminance Y component, the second pixel component sequence including a chrominance U component, and the third pixel component sequence including a chrominance V component; and The conversion module is further configured to: Performing a first shift conversion on the second pixel component sequence and the third pixel component sequence to obtain a combined sequence of the second pixel component and the third pixel component; Performing a second shift conversion on the first pixel component sequence and the combined sequence to obtain the target image.
5. The device according to claim 4, wherein The second acquisition module includes: The sampling submodule is configured to sample at least two pixel components in the original image according to a preset sampling ratio to obtain the at least two pixel component sequences.
6. The device according to claim 5, wherein The sampling submodule is further configured to: The first pixel component, the second pixel component, and the third pixel component in the original image are sampled according to a sampling ratio of 4:2:2 to obtain a first pixel component sequence, a second pixel component sequence, and a third pixel component sequence.
7. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 3.
8. A non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 3.
9. A computer program product comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 3.
Citation Information
Patent Citations
Method and apparatus for memory management of video images
US20030151610A1
Image formats for video capture, processing and display
US20050200630A1
Method and apparatus for transforming the dimensions of an image
US20060023952A1
Graphical image reformatting
US5943040A