WO2021168624A1 - Video image coding method and device, and movable platform - Google Patents
Video image coding method and device, and movable platform Download PDFInfo
- Publication number
- WO2021168624A1 WO2021168624A1 PCT/CN2020/076469 CN2020076469W WO2021168624A1 WO 2021168624 A1 WO2021168624 A1 WO 2021168624A1 CN 2020076469 W CN2020076469 W CN 2020076469W WO 2021168624 A1 WO2021168624 A1 WO 2021168624A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- prediction
- preset
- block
- division
- processed
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 133
- 238000013139 quantization Methods 0.000 claims abstract description 22
- 238000004364 calculation method Methods 0.000 claims description 24
- 238000012545 processing Methods 0.000 abstract description 26
- 238000009825 accumulation Methods 0.000 abstract description 7
- 238000013461 design Methods 0.000 description 49
- 238000004891 communication Methods 0.000 description 23
- 238000010586 diagram Methods 0.000 description 12
- 238000006243 chemical reaction Methods 0.000 description 7
- 238000005516 engineering process Methods 0.000 description 7
- 230000005540 biological transmission Effects 0.000 description 5
- 230000001186 cumulative effect Effects 0.000 description 5
- 230000003287 optical effect Effects 0.000 description 4
- 238000003491 array Methods 0.000 description 3
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 230000006870 function Effects 0.000 description 3
- 239000004973 liquid crystal related substance Substances 0.000 description 3
- 238000005070 sampling Methods 0.000 description 3
- 208000037170 Delayed Emergence from Anesthesia Diseases 0.000 description 2
- XUIMIQQOPSSXEZ-UHFFFAOYSA-N Silicon Chemical compound [Si] XUIMIQQOPSSXEZ-UHFFFAOYSA-N 0.000 description 2
- 230000006835 compression Effects 0.000 description 2
- 238000007906 compression Methods 0.000 description 2
- 230000001419 dependent effect Effects 0.000 description 2
- 238000009826 distribution Methods 0.000 description 2
- 238000007781 pre-processing Methods 0.000 description 2
- 229910052710 silicon Inorganic materials 0.000 description 2
- 239000010703 silicon Substances 0.000 description 2
- 238000009966 trimming Methods 0.000 description 2
- 241000023320 Luma <angiosperm> Species 0.000 description 1
- 238000012952 Resampling Methods 0.000 description 1
- 230000003190 augmentative effect Effects 0.000 description 1
- 239000003086 colorant Substances 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 230000002452 interceptive effect Effects 0.000 description 1
- 239000011159 matrix material Substances 0.000 description 1
- OSWPMRLSEDHDFF-UHFFFAOYSA-N methyl salicylate Chemical compound COC(=O)C1=CC=CC=C1O OSWPMRLSEDHDFF-UHFFFAOYSA-N 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 238000012805 post-processing Methods 0.000 description 1
- 230000011664 signaling Effects 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/10—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
- H04N19/169—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
- H04N19/17—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
- H04N19/176—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object the region being a block, e.g. a macroblock
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/10—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
- H04N19/102—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
- H04N19/124—Quantisation
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/10—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
- H04N19/169—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
- H04N19/184—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being bits, e.g. of the compressed video stream
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/10—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
- H04N19/169—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
- H04N19/186—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being a colour or a chrominance component
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/50—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding
- H04N19/587—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding involving temporal sub-sampling or interpolation, e.g. decimation or subsequent interpolation of pictures in a video sequence
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/20—Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
- H04N21/23—Processing of content or additional data; Elementary server operations; Server middleware
- H04N21/234—Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs
- H04N21/2343—Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs involving reformatting operations of video signals for distribution or compliance with end-user requests or end-user device requirements
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/43—Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
- H04N21/44—Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs
- H04N21/4402—Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs involving reformatting operations of video signals for household redistribution, storage or real-time display
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/80—Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
- H04N21/83—Generation or processing of protective or descriptive data associated with content; Content structuring
- H04N21/845—Structuring of content, e.g. decomposing content into time segments
- H04N21/8456—Structuring of content, e.g. decomposing content into time segments by decomposing the content in the time domain, e.g. in time segments
Definitions
- the embodiments of the present application relate to coding technology, and in particular to a video image coding method, device, and movable platform.
- Video image signals have become people’s daily routines due to their intuitiveness and efficiency. The most important way to get information in life. Because the video image signal contains a large amount of data, it needs to occupy a large amount of transmission bandwidth and storage space. For effective transmission and storage, video image signals need to be compressed and encoded.
- DPCM as a simple prediction method, is widely used in image compression coding.
- DPCM generally uses the encoded pixels on the left or above for prediction.
- DPCM uses adjacent pixels for prediction, which makes data dependent, prone to cumulative errors and difficult hardware parallel processing, which in turn leads to higher coding error rates and slower coding speeds.
- the embodiments of the present application provide a video image encoding method, device, and movable platform to overcome at least one of the above-mentioned problems.
- an embodiment of the present application provides a video image encoding method, including:
- Encoding is performed according to the prediction residual.
- an embodiment of the present application provides a video image encoding device, including a memory, a processor, and computer-executable instructions stored in the memory and running on the processor, and the processor executes the computer The following steps are implemented when executing instructions:
- Encoding is performed according to the prediction residual.
- an embodiment of the present application provides a movable platform, including:
- the movable platform body The movable platform body
- the video image encoding device is installed on the movable platform body.
- an embodiment of the present application provides a computer-readable storage medium that stores computer-executable instructions.
- the processor executes the computer-executable instructions, the first aspect and the first aspect described above are implemented.
- the video image coding method, device, and movable platform body provided by the embodiments of the present application.
- the method divides each of the multiple channels of the image frame in the video code stream to obtain the code block to be processed, and then calculates the code block to be processed.
- the processing coding block is divided into the corresponding division cost, the target division mode is determined, and the coding block to be processed is divided according to the target division mode to obtain the prediction block, and then the to-be-processed coding block is calculated
- the corresponding prediction cost is predicted, so that the target prediction mode is determined, and each prediction block of the coding block to be processed is predicted according to the target prediction mode, which can reduce the data Dependence, reducing the accumulation of data errors, is conducive to hardware parallel data processing, reduces hardware implementation resources, and does not need to be reconstructed in the quantization process to improve coding speed.
- FIG. 1 is a schematic diagram of the architecture of a video image coding system provided by an embodiment of the application
- FIG. 2 is a schematic flowchart of a video image encoding method provided by an embodiment of the application
- FIG. 3 is a schematic diagram of dividing each of multiple channels of an image frame in a video bitstream according to an embodiment of the application
- FIG. 4 is a schematic diagram of a preset division mode provided by an embodiment of the application.
- FIG. 5 is a schematic flowchart of another video image encoding method provided by an embodiment of the application.
- FIG. 6 is a schematic flowchart of still another video image encoding method provided by an embodiment of this application.
- FIG. 7 is a schematic diagram of a first prediction mode provided by an embodiment of the application.
- FIG. 8 is a schematic flowchart of another video image encoding method provided by an embodiment of the application.
- FIG. 9 is a schematic diagram of a second prediction mode provided by an embodiment of the application.
- FIG. 10 is a schematic flowchart of another video image encoding method provided by an embodiment of this application.
- FIG. 11 is a schematic structural diagram of a video image encoding device provided by an embodiment of this application.
- FIG. 12 is a schematic diagram of the hardware structure of a video image encoding device provided by an embodiment of the application.
- FIG. 13 is a schematic structural diagram of a movable platform provided by an embodiment of the application.
- Video image coding usually refers to processing a sequence of pictures that form a video or video sequence.
- the terms "PiCTUre", “frame” or “Image” can be used as synonyms.
- the video encoding in this application is performed on the source side, and usually includes processing (for example, by compressing) the original video picture to reduce the amount of data required to represent the video picture (thus storing and/or transmitting more efficiently).
- Video decoding is performed on the destination side and usually involves inverse processing relative to the encoder to reconstruct the video picture.
- Each picture of a video sequence is usually divided into a set of non-overlapping blocks, and is usually coded at the block level.
- the encoder side usually processes the video at the block (video block) level, that is, encodes the video.
- the prediction block is generated by prediction, and the prediction block is subtracted from the current block (currently processed or to-be-processed block) to obtain the residual.
- Block transform the residual block in the transform domain and quantize the residual block to reduce the amount of data to be transmitted (compressed), and the decoder side applies the inverse processing part relative to the encoder to the encoded or compressed block to reproduce Constructs the current block used to represent.
- the encoder duplicates the decoder processing loop so that the encoder and decoder generate the same prediction and/or reconstruction for processing, that is, encoding subsequent blocks.
- DPCM as a simple prediction method, is widely used in image compression coding.
- DPCM generally uses the encoded pixels on the left or above for prediction.
- DPCM uses adjacent pixels for prediction, which makes data dependent, prone to cumulative errors and difficult hardware parallel processing, which in turn leads to higher encoding error rates and slower encoding speeds.
- the present application provides a video image coding method, which obtains the code blocks to be processed by dividing each of the multiple channels of the image frame in the video code stream, and further, calculates the code blocks to be processed In each mode of the preset division mode, the division cost corresponding to the block division is performed, the target division mode is determined, and the coding block to be processed is divided into blocks according to the target division mode to obtain the prediction block, and then each of the coding blocks to be processed is calculated.
- the prediction block predicts the corresponding prediction cost in each of the preset prediction modes, thereby determining the target prediction mode, and predicting each prediction block of the coding block to be processed according to the target prediction mode, which can reduce data dependence. Reducing the accumulation of data errors is conducive to hardware parallel data processing, reducing hardware implementation resources, and there is no need to reconstruct during the quantization process, which improves coding speed.
- the video image encoding method provided by this application can be applied to the schematic diagram of the video image encoding system architecture shown in FIG. 1.
- the video image encoding system 10 includes a source device 12 and a target device 14, and the source device 12 includes : Picture acquisition device 121, preprocessor 122, encoder 123 and communication interface 124.
- the target device 14 includes a display device 141, a processor 142, a decoder 143, and a communication interface 144.
- the source device 12 sends the encoded data 13 obtained by encoding to the target device 14.
- the method of this application is applied to the encoder 123.
- the source device 12 may be referred to as a video encoding device or a video encoding device.
- the target device 14 may be referred to as a video decoding device or a video decoding device.
- the source device 12 and the target device 14 may be examples of video encoding devices or video encoding devices.
- the source device 12 and the target device 14 may include any of a variety of devices, including any type of handheld or stationary device, for example, a notebook or laptop computer, mobile phone, smart phone, tablet or tablet computer, video camera, desktop computer , Set-top boxes, televisions, display devices, digital media players, video game consoles, video streaming devices (such as content service servers or content distribution servers), broadcast receiver devices, broadcast transmitter devices, etc., and may not be used or Use any type of operating system.
- a notebook or laptop computer mobile phone, smart phone, tablet or tablet computer, video camera, desktop computer , Set-top boxes, televisions, display devices, digital media players, video game consoles, video streaming devices (such as content service servers or content distribution servers), broadcast receiver devices, broadcast transmitter devices, etc., and may not be used or Use any type of operating system.
- source device 12 and target device 14 may be equipped for wireless communication. Therefore, the source device 12 and the target device 14 may be wireless video and image encoding devices.
- the video image encoding system 10 shown in FIG. 1 is only an example, and the technology of this application can be applied to video encoding settings that do not necessarily include any data communication between encoding and decoding devices (for example, video encoding or video decoding). ).
- the data can be retrieved from local storage, streamed on the network, etc.
- the video encoding device can encode data and store the data to the memory, and/or the video decoding device can retrieve the data from the memory and decode the data.
- encoding and decoding are performed by devices that do not communicate with each other but only encode data to and/or retrieve data from the memory and decode the data.
- the encoder 123 of the video image encoding system 10 may also be referred to as a video encoder, and the decoder 143 may also be referred to as a video decoder.
- the picture acquisition device 121 may include or may be any type of picture capture device, for example, to capture real-world pictures, and/or any type of pictures or comments (for screen content encoding, some text on the screen is also Considered to be a part of the picture or image to be encoded) generating equipment, for example, a computer graphics processor for generating computer animation pictures, or for obtaining and/or providing real-world pictures, computer animation pictures (for example, screen content, virtual Any type of equipment of virtual reality (VR) pictures, and/or any combination thereof (for example, augmented reality (AR) pictures).
- the picture is or can be regarded as a two-dimensional array or matrix of sampling points with brightness values.
- the sampling points in the array may also be called pixels (pixels) or pixels (piCTUre element, pel for short).
- the number of sampling points of the array in the horizontal and vertical directions (or axis) defines the size and/or resolution of the picture.
- three color components are usually used, that is, pictures can be represented as or contain three sample arrays.
- a picture includes corresponding red, green, and blue sample arrays.
- each pixel is usually expressed in a luminance/chrominance format or color space, for example, YCbCr, including the luminance (luma) component indicated by Y (sometimes indicated by L), and Cb and Cr indications.
- the two chroma (chroma for short) components The luminance component Y represents luminance or grayscale level intensity (for example, the two are the same in a grayscale picture), and the two chrominance components Cb and Cr represent chrominance or color information components.
- a picture in the YCbCr format includes a luminance sample array of the luminance component (Y), and two chrominance sample arrays of the chrominance component (Cb and Cr).
- Pictures in RGB format can be converted or converted to YCbCr format, and vice versa. This process is also called color conversion or conversion.
- the picture acquisition device 121 may be, for example, a camera for capturing pictures, such as a memory of a picture memory, including or storing previously captured or generated pictures, and/or any type of (internal or external) interface for acquiring or receiving pictures.
- the camera may be, for example, an integrated camera that is local or integrated in the source device, and the memory may be local or, for example, an integrated memory that is integrated in the source device.
- the interface may be, for example, an external interface for receiving pictures from an external video source.
- the external video source is, for example, an external picture capturing device, such as a camera, an external memory, or an external picture generating device
- the external picture generating device is, for example, an external computer graphics processor. , Computer or server.
- the interface can be any type of interface according to any proprietary or standardized interface protocol, such as a wired or wireless interface, and an optical interface.
- the interface for acquiring the picture data 125 in FIG. 1 may be the same interface as the communication interface 124 or a part of the communication interface 124.
- the picture data 125 (for example, video data) may be referred to as original picture or original picture data.
- the pre-processor 122 is used to receive the picture data 125 and perform pre-processing on the picture data 125 to obtain a pre-processed picture (or pre-processed picture data) 126.
- the preprocessing performed by the preprocessor 122 may include trimming, color format conversion (for example, conversion from RGB to YCbCr), toning or denoising. It can be understood that the pre-processor 122 may be an optional component.
- the encoder 123 (eg, a video encoder) is used to receive pre-processed pictures (or pre-processed picture data) 126 and provide encoded picture data 127.
- the communication interface 124 of the source device 12 can be used to receive the encoded picture data 127 and transmit it to other devices, for example, the target device 14 or any other device for storage or direct reconstruction, or for storing
- the encoded data 13 is stored and/or the encoded picture data 127 is processed before transmitting the encoded data 13 to other devices, such as the target device 14 or any other device for decoding or storage.
- the communication interface 144 of the target device 14 is used, for example, to directly receive the encoded picture data 127 or the encoded data 13 from the source device 12 or any other source. Any other source is, for example, a storage device, and the storage device is, for example, an encoded picture data storage device.
- the communication interface 124 and the communication interface 144 can be used to directly communicate through the direct communication link between the source device 12 and the target device 14 or through any type of network to transmit or receive the encoded picture data 127 or the encoded data 13
- the link is, for example, a direct wired or wireless connection, and any type of network is, for example, a wired or wireless network or any combination thereof, or any type of private network and public network, or any combination thereof.
- the communication interface 124 may be used, for example, to encapsulate the encoded picture data 127 into a suitable format, such as a packet, for transmission on a communication link or communication network.
- the communication interface 144 forming the corresponding part of the communication interface 124 may be used, for example, to decapsulate the encoded data 13 to obtain the encoded picture data 127.
- Both the communication interface 124 and the communication interface 144 can be configured as a one-way communication interface, as indicated by the arrow pointing from the source device 12 to the target device 14 for the encoded picture data 127 in FIG. 1, or can be configured as a two-way communication interface, and can It is used, for example, to send and receive messages to establish a connection, confirm and exchange any other information related to the communication link and/or data transmission such as the transmission of encoded picture data.
- the decoder 143 is used to receive encoded picture data 127 and provide decoded picture data (or decoded picture) 145.
- the processor 142 of the target device 14 is used to post-process decoded picture data (or decoded picture) 145, for example, a decoded picture, to obtain post-processed picture data 146, for example, a post-processed picture.
- the post-processing performed by the processor 142 may include, for example, color format conversion (for example, conversion from YCbCr to RGB), toning, trimming or resampling, or any other processing for preparing decoded picture data (or decoded picture data, for example).
- the picture 145 is displayed by the display device 141.
- the display device 141 of the target device 14 is used to receive the post-processed picture data 145 to display the picture to, for example, a user or viewer.
- the display device 141 may be or may include any type of display for presenting the reconstructed picture, for example, an integrated or external display or monitor.
- the display may include a liquid crystal display (LCD for short), an organic light emitting diode (OLED) display, a plasma display, a projector, a micro LED display, and a liquid crystal on silicon (liquid crystal on silicon, for short) LCoS), digital light processor (digital light processor, DLP for short), or any other type of display.
- FIG. 1 depicts the source device 12 and the target device 14 as separate devices
- the device embodiment may also include the source device 12 and the target device 14 or the functionality of both, that is, the source device 12 or the corresponding The functionality of the target device 14 or the corresponding functionality.
- the same hardware and/or software may be used, or separate hardware and/or software, or any combination thereof may be used to implement the source device 12 or the corresponding functionality and the target device 14 or the corresponding functionality.
- the functionality of different units or the existence and (accurate) division of the functionality of the source device 12 and/or the target device 14 shown in FIG. 1 may vary according to actual devices and applications.
- both the encoder 123 e.g., video encoder
- the decoder 143 e.g., video decoder
- DSP digital Signal processor
- ASIC application-specific integrated circuit
- FPGA field-programmable gate array
- the device can store the instructions of the software in a suitable non-transitory computer-readable storage medium, and can use one or more processors to execute the instructions in hardware to execute the technology of the present application .
- Each of the encoder 123 and the decoder 143 may be included in one or more encoders or decoders, and any one of the encoders or decoders may be integrated as a combined encoder/decoder in the corresponding device ( Codec).
- the decoder 143 may be used to perform the reverse process.
- the decoder 143 can be used to receive and parse such syntax elements, and decode related video data accordingly.
- the encoder 123 may entropy encode one or more defined syntax elements into an encoded video bitstream. In such instances, the decoder 143 can parse such syntax elements and decode related video data accordingly.
- FIG. 2 is a schematic flowchart of a video image encoding method provided by an embodiment of this application.
- the execution subject of this embodiment may be the encoder in the embodiment shown in FIG. 1.
- the method includes:
- the above-mentioned video code stream may be a preset video format, such as a YUV420 video format, which is not particularly limited for comparison in this application.
- the encoder may divide each of the Y, U, and V channels of the image frame in the video code stream.
- the foregoing division of each of the multiple channels of the image frame in the video code stream to obtain the code block to be processed includes:
- the above-mentioned first preset size and second preset size can be set according to actual conditions, which are not particularly limited in the embodiment of the present application.
- the encoder can divide each of the multiple channels of the input image frame into non-overlapping 64x4 slices. It can be coded and decoded independently.
- the Y component in the 64x4 slice block is divided into 16 4x4 coding blocks; the UV component is divided into 4x2 coding blocks.
- the coded block to be processed is obtained from the coded block.
- the 4x4 coded block of the Y component is obtained from the coded block as the coded block to be processed.
- the 4x2 code of the U component can also be obtained from the coded block.
- the block is the above-mentioned to-be-processed coding block, which is not particularly limited in the embodiment of the present application.
- S202 Calculate the division cost corresponding to the block division of the coding block to be processed in each division mode of the preset division mode.
- the foregoing preset division mode may be set according to actual conditions.
- the foregoing preset division mode may include None, Horizontal, Vertical, and Split. ), etc.
- the embodiments of the present application do not impose any special restrictions on this.
- the encoder calculates the division cost corresponding to the block division of the coding block to be processed in each division mode of the preset division mode, and then determines the final division mode according to the division cost.
- S203 Select a target division mode from the preset division modes according to the division cost, and perform block division on the coding block to be processed according to the target division mode to obtain a prediction block.
- the foregoing selection of the target division mode from the foregoing preset division modes according to the foregoing division cost includes:
- the division mode corresponding to the minimum division cost is selected from the preset division modes, and the selected division mode is used as the target division mode.
- the target division mode can also be selected according to the actual situation, for example, the target division cost is obtained from the above division cost, and the division mode corresponding to the target division cost is selected from the above preset division mode.
- the selected division mode is used as the above-mentioned target division mode, which is not particularly limited in the embodiment of the present application.
- the aforementioned target division cost may be other division costs except the aforementioned minimum division cost, which can be specifically determined according to actual conditions.
- S204 Calculate the prediction cost corresponding to the prediction of each prediction block of the coding block to be processed in each prediction mode of the preset prediction mode.
- the foregoing preset prediction mode may be set according to actual conditions.
- the foregoing preset division mode includes the first prediction mode maxDPCM and the second prediction mode MinDPCM, which are not particularly limited in the embodiment of the present application.
- maxDPCM is to predict according to the maximum value of the pixel in the prediction block of the coding block to be processed, that is, the maximum value in the prediction block is selected first, and then the maximum value is used to subtract the remaining values to obtain the prediction residual.
- minDPCM predicts based on the minimum pixel value in the prediction block of the coding block to be processed, that is, first selects the minimum value in the prediction block, and then uses other values to subtract the minimum value to obtain the prediction residual.
- the above two prediction modes do not have negative numbers, there is no need to encode symbols, which increases the coding speed. Moreover, the above two prediction modes do not need to use adjacent pixels for prediction, reducing data dependence and not easy to generate cumulative errors. In addition, follow-up Quantization does not need to be reconstructed, and parallel processing can be used to solve the difficult problem of hardware parallel processing.
- the encoder calculates the prediction cost corresponding to the prediction of each prediction block of the coding block to be processed in each prediction mode of the preset prediction mode, and then determines the final prediction mode according to the prediction cost.
- the foregoing selection of the target prediction mode from the foregoing preset prediction modes according to the foregoing prediction cost includes:
- the prediction mode corresponding to the minimum prediction cost is selected from the preset prediction modes, and the selected prediction mode is used as the target prediction mode.
- the target prediction mode can also be selected according to the actual situation, for example, the target prediction cost is obtained from the above prediction cost; the prediction mode corresponding to the target prediction cost is selected from the above preset prediction mode,
- the selected prediction mode is used as the aforementioned target prediction mode, which is not particularly limited in the embodiment of the present application.
- the aforementioned forecast division cost may be other forecast costs other than the aforementioned minimum forecast cost, which can be specifically determined according to actual conditions.
- the encoder can perform multiple quantization, encoding, etc. processes at the same time based on the above prediction residuals to select the encoding parameters with the best image quality at the same bit rate to obtain the output bit stream.
- the video image encoding method obtains the code block to be processed by dividing each of the multiple channels of the image frame in the video code stream, and further, calculates each of the code blocks to be processed in the preset division mode.
- the division cost corresponding to the block division is determined
- the target division mode is determined
- the coding block to be processed is divided into blocks according to the target division mode to obtain the prediction block
- each prediction block of the coding block to be processed is calculated in the preset prediction mode
- predict the corresponding prediction cost thereby determining the target prediction mode, and predicting each prediction block of the coding block to be processed according to the target prediction mode, which can reduce data dependence and reduce the accumulation of data errors. It is conducive to hardware parallel data processing, reduces hardware implementation resources, and does not need to be reconstructed in the quantization process, which improves the coding speed.
- FIG. 5 is a schematic flowchart of another video image encoding method proposed in an embodiment of this application.
- the execution subject of this embodiment may be the encoder in the embodiment shown in FIG. 1. As shown in Figure 5, the method includes:
- step S501 is implemented in the same manner as the foregoing step S201, and will not be repeated here.
- the foregoing preset division mode may include None, Horizontal, Vertical, Split, etc. as shown in FIG. 4.
- the preset prediction mode may include the first prediction mode maxDPCM, the second prediction mode minDPCM, and so on.
- the prediction mode of each prediction block of the above-mentioned coding block to be processed is the same.
- the prediction mode of each prediction block of the above-mentioned coding block to be processed is the same. Both are the above-mentioned first prediction mode maxDPCM, or both are the above-mentioned second prediction mode minDPCM.
- each of the foregoing division modes calculate the prediction residual corresponding to each prediction block of the foregoing coding block to be processed in each of the foregoing prediction modes, and if the prediction residual is greater than the preset residual threshold, then The predicted division cost of the above-mentioned coded block to be processed in the prediction mode is accumulated and the preset cost value is added to obtain the predicted cost predCost.
- the above-mentioned preset residual threshold value and the preset cost value can be set according to actual conditions, and the embodiment of the present application does not specifically limit this. For example, as long as the prediction residual is greater than 15, the prediction cost predCost is accumulated by 8.
- headerCost includes the number of coded bits corresponding to the division mode, the number of coded bits corresponding to the prediction mode, and a preset At least one of the number of coded bits corresponding to the base pixel.
- the foregoing preset division mode includes no division (None).
- the foregoing calculation of the header information cost corresponding to the foregoing coding block to be processed in each of the foregoing division modes includes:
- the number of coded bits corresponding to the non-division, the number of coded bits corresponding to the prediction mode, and the number of coded bits corresponding to the preset base pixels are added to obtain the first header information cost corresponding to the coded block to be processed.
- the foregoing preset division mode includes horizontal dichotomy (Horizontal).
- the foregoing calculation of the header information cost corresponding to the foregoing coding block to be processed in each of the foregoing division modes includes:
- the number of coding bits corresponding to the horizontal dichotomy, the number of coding bits corresponding to the prediction mode, and the total number of base pixel coding bits corresponding to the coding block to be processed are added to obtain the second header information cost corresponding to the coding block to be processed.
- the foregoing preset division mode includes vertical dichotomy (Vertical).
- the foregoing calculation of the header information cost corresponding to the foregoing coding block to be processed in each of the foregoing division modes includes:
- the foregoing preset division mode includes a cross division (Split).
- the foregoing calculation of the header information cost corresponding to the foregoing coding block to be processed in each of the foregoing division modes includes:
- the number of coded bits corresponding to the cross division, the number of coded bits corresponding to the prediction mode, and the total number of base pixel coded bits corresponding to the coded block to be processed are added to obtain the fourth header information cost corresponding to the coded block to be processed.
- the division cost is the sum of the aforementioned predCosts and headerCost, and further, the division mode is selected according to the division cost.
- S505 Select a target division mode from the preset division modes according to the division cost, and perform block division on the coding block to be processed according to the target division mode to obtain a prediction block.
- S506 Calculate the prediction cost corresponding to the prediction of each prediction block of the coding block to be processed in each prediction mode of the preset prediction mode.
- steps S505-S508 are implemented in the same manner as the foregoing steps S203-S206, and will not be repeated here.
- the video image coding method provided in this embodiment calculates the prediction cost corresponding to the prediction of each prediction block of the coding block to be processed in each prediction mode in each division mode, and the header information cost corresponding to the coding block to be processed , And then accurately determine the division cost corresponding to the block division of the coded block to be processed in each division mode, to ensure the accuracy of subsequent processing, and by performing processing on each of the multiple channels of the image frame in the video bitstream.
- each prediction block of the block can reduce data dependence and reduce the accumulation of data errors, which is conducive to hardware parallel data processing, reduces hardware implementation resources, and does not need to be reconstructed in the quantization process, which improves coding speed.
- FIG. 6 is a schematic flowchart of another video image encoding method proposed by an embodiment of the application.
- the execution subject of this embodiment may be the encoder in the embodiment shown in FIG. 1. As shown in Figure 6, the method includes:
- S602 Calculate the division cost corresponding to the block division of the coding block to be processed in each division mode of the preset division mode.
- S603 Select a target division mode from the preset division modes according to the division cost, and perform block division on the coding block to be processed according to the target division mode to obtain a prediction block.
- steps S601-S603 are implemented in the same manner as the foregoing steps S201-S203, and will not be repeated here.
- the preset prediction mode includes a first prediction mode.
- the first prediction mode is based on the prediction based on the maximum value of the pixel in the prediction block of the to-be-processed coding block, and the prediction is performed based on the maximum value of the pixel and the first remaining value of the to-be-processed coding block. Predict the pixels of the block and calculate the first prediction residual, where the first remaining prediction block is the remaining prediction block in the prediction block of the coding block to be processed except for the prediction block with the maximum value of the pixel.
- the maximum value of pixels in the prediction block of the coding block to be processed is 26, and the maximum value is used to subtract the remaining values, and the prediction residual is the smallest, and the residual has no negative number, so there is no need to code the sign later. , Can further improve the subsequent encoding speed.
- the prediction cost of the coding block to be processed in the prediction mode is accumulated and the preset cost value is obtained to obtain the prediction cost.
- the above-mentioned first preset residual threshold value and the first preset generation value can be set according to actual conditions, which are not particularly limited in the embodiment of the present application. Exemplarily, as long as the prediction residual is greater than 15, the prediction cost predCost is accumulated by 8.
- steps S606-S607 are implemented in the same manner as the foregoing steps S205-S206, and will not be repeated here.
- the video image encoding method provided by this embodiment obtains the code block to be processed by dividing each of the multiple channels of the image frame in the video code stream, and further, calculates each of the code blocks to be processed in the preset division mode.
- the division cost corresponding to the block division is determined
- the target division mode is determined
- the coding block to be processed is divided into blocks according to the target division mode to obtain the prediction block, and then each prediction block of the coding block to be processed is calculated in the preset prediction mode
- the prediction cost corresponding to the prediction is performed, so that the target prediction mode is determined, and each prediction block of the coding block to be processed is predicted according to the target prediction mode.
- FIG. 8 is a schematic flowchart of another video image encoding method proposed by an embodiment of the application.
- the execution subject of this embodiment may be the encoder in the embodiment shown in FIG. 1. As shown in Figure 8, the method includes:
- S802 Calculate the division cost corresponding to the block division of the coding block to be processed in each division mode of the preset division mode.
- S803 Select a target division mode from the preset division modes according to the division cost, and perform block division on the coding block to be processed according to the target division mode to obtain a prediction block.
- steps S801-S803 are implemented in the same manner as the foregoing steps S201-S203, and will not be repeated here.
- the preset prediction mode includes a second prediction mode.
- the second prediction mode is based on the prediction based on the minimum value of the pixel in the prediction block of the to-be-processed coding block, and the pixel value of the second remaining prediction block of the to-be-processed coding block is The pixel minimum value is used to calculate a second prediction residual, wherein the second remaining prediction block is a prediction block remaining except for the prediction block of the pixel minimum value among the prediction blocks of the coding block to be processed.
- the minimum value of the pixel in the prediction block of the coding block to be processed is 22, and the remaining other values are used to subtract the minimum value, the prediction residual is the smallest, and the residual has no negative number, so there is no need to code the sign later , Can further improve the subsequent encoding speed.
- the prediction cost of the coding block to be processed in the prediction mode is accumulated and the preset cost value is obtained to obtain the prediction cost.
- the above-mentioned second preset residual threshold value and second preset generation value can be set according to actual conditions, which are not particularly limited in the embodiment of the present application. Exemplarily, as long as the prediction residual is greater than 15, the prediction cost predCost is accumulated by 8.
- steps S806-S807 are implemented in the same manner as the foregoing steps S205-S206, and will not be repeated here.
- the video image encoding method provided by this embodiment obtains the code block to be processed by dividing each of the multiple channels of the image frame in the video code stream, and further, calculates each of the code blocks to be processed in the preset division mode.
- the division cost corresponding to the block division is determined
- the target division mode is determined
- the coding block to be processed is divided into blocks according to the target division mode to obtain the prediction block, and then each prediction block of the coding block to be processed is calculated in the preset prediction mode
- the prediction cost corresponding to the prediction is performed, so that the target prediction mode is determined, and each prediction block of the coding block to be processed is predicted according to the target prediction mode.
- FIG. 10 is a schematic flowchart of another video image encoding method proposed by an embodiment of this application.
- the execution subject of this embodiment may be the encoder in the embodiment shown in FIG. 1. As shown in Figure 10, the method includes:
- S1002 Calculate the division cost corresponding to the block division of the coding block to be processed in each division mode of the preset division mode.
- steps S1001-S1005 are implemented in the same manner as the foregoing steps S201-S205, and will not be repeated here.
- the method further includes:
- the preset encoding method is VLC encoding
- the preset encoding method is FLC encoding.
- the above-mentioned preset threshold is determined according to the residual during the conversion from FLC coding to VLC coding. If the prediction residual is greater than the preset threshold, VLC coding is adopted, otherwise, FLC coding is adopted.
- the foregoing encoding each of the foregoing multiple channels separately according to the foregoing quantization residual and a preset encoding manner includes:
- the LSB of each of the multiple channels is separately coded by using the preset coding method
- the LSB of the encoding channel is stopped.
- the fixed bit rate coding is used. For example, taking the above-mentioned video bit stream as the YUV420 video format as an example, (1) If the total number of coded bits is less than the given bit rate and can meet the MSB of at least one codeword length, code Y If the total number of encoded bits is less than the given code rate and can meet the MSB of at least one codeword length, encode the MSB of the U component, And accumulate the number of encoded bits; otherwise, stop encoding and go to (5); (3) If the total number of encoded bits is less than the given code rate and can meet the MSB of at least one codeword length, encode the MSB of the V component, and accumulate the encoded The total number of bits; otherwise, stop encoding and go to (5); (4) In accordance with the order of MSB encoding, encode the LSB in the same manner until the encoded bits are greater than the given code rate. (5) If there are still a few bits away from the fixed bit rate and encoding cannot be continued, padding will be
- the foregoing encoding the MSB of each of the foregoing multiple channels separately by using the foregoing preset encoding method according to the foregoing quantized residual includes:
- the above-mentioned preset coding method is used to start from the first row of the MSB of each of the above-mentioned multiple channels, and from left to right, each preset number of bits is used as a codeword to perform Huffman look-up table coding. .
- the MSB adopts the Huffman coding method. Due to the different probability distributions, different code tables are used for the Y and UV components.
- the code table is shown in Table 1.
- the above-mentioned quantized residual is converted into a bit-plane method, and then for the MSB part, start from the first row, and each preset number of bits from left to right, for example, every 4bit is used as a codeword for Huffman table look-up encoding. After encoding the first line, continue to encode the second line until all MSBs are compiled or the given bit rate is reached.
- the foregoing encoding the LSB of each of the foregoing multiple channels separately using the foregoing preset encoding method according to the foregoing quantization residual includes:
- the above-mentioned preset coding method is used to respectively start from the first line of the LSB of each of the above-mentioned multiple channels, and perform coding bit by bit from left to right.
- the above-mentioned quantized residual is converted into a bit-plane, and then LSB adopts fixed-length coding, starting from the first line of the LSB part, coding from left to right bit by bit, and after editing the first line, compile the next line. Until the given bit rate is reached.
- the video image encoding method obtains the code block to be processed by dividing each of the multiple channels of the image frame in the video code stream, and further, calculates each of the code blocks to be processed in the preset division mode.
- the division cost corresponding to the block division is determined
- the target division mode is determined
- the coding block to be processed is divided into blocks according to the target division mode to obtain the prediction block, and then each prediction block of the coding block to be processed is calculated in the preset prediction mode
- the prediction cost corresponding to the prediction is performed, thereby determining the target prediction mode, and predicting each prediction block of the coding block to be processed according to the target prediction mode, and quantizing the prediction residual according to the preset quantization step size, Obtain the quantized residual, and further encode according to the quantized residual and the preset encoding method to obtain the output code stream.
- the encoding method can reduce data dependence and reduce the accumulation of data errors, which is conducive to hardware parallel data processing and reduces hardware Realize
- FIG. 11 is a schematic structural diagram of a video image encoding device provided by an embodiment of the application. For ease of description, only the parts related to the embodiments of the present application are shown.
- the video image encoding device 110 includes: a first division module 1101, a first calculation module 1102, a second division module 1103, a second calculation module 1104, a prediction module 1105, and an encoding module 1106.
- the first dividing module 1101 is configured to divide each of the multiple channels of the image frame in the video bitstream to obtain the code block to be processed.
- the first calculation module 1102 is configured to calculate the division cost corresponding to the block division of the coded block to be processed in each division mode of the preset division mode.
- the second division module 1103 is configured to select a target division mode from the preset division modes according to the division cost, and perform block division on the coding block to be processed according to the target division mode to obtain a prediction block.
- the second calculation module 1104 is configured to calculate the prediction cost corresponding to the prediction of each prediction block of the coded block to be processed in each prediction mode of the preset prediction mode.
- the prediction module 1105 is configured to select a target prediction mode from the preset prediction modes according to the prediction cost, and predict each prediction block of the coding block to be processed according to the target prediction mode to obtain a prediction residual ;
- the encoding module 1106 is configured to perform encoding according to the prediction residual.
- the first division module 1101 is specifically used for:
- the first calculation module 1102 is specifically used for:
- each division mode calculate the header information cost corresponding to the coded block to be processed, where the header information cost includes the number of coded bits corresponding to the division mode, the number of coded bits corresponding to the prediction mode, and the preset base pixels At least one of the corresponding number of coded bits;
- the calculated prediction cost and the header information cost are added to obtain the division cost corresponding to the block division of the to-be-processed coding block in each division mode.
- the second division module 1103 selects a target division mode from the preset division modes according to the division cost, including:
- the division mode corresponding to the smallest division cost is selected from the preset division modes, and the selected division mode is used as the target division mode.
- the preset prediction mode includes a first prediction mode, and the first prediction mode is prediction based on a maximum value of pixels in a prediction block of the coding block to be processed;
- the second calculation module 1104 is specifically used for:
- the first prediction residual based on the maximum value of the pixel and the pixels of the first remaining prediction block of the to-be-processed coding block, where the first remaining prediction block is the prediction block of the to-be-processed coding block divided by Prediction blocks remaining outside the prediction block of the maximum pixel;
- first prediction residual is greater than a first preset residual threshold, then a first preset generation value is added to the prediction cost of the to-be-processed coding block in the first prediction mode to obtain the first prediction cost.
- the preset prediction mode includes a second prediction mode, and the second prediction mode is to perform prediction according to a minimum value of pixels in a prediction block of the coding block to be processed;
- the second calculation module 1104 is specifically used for:
- the second prediction residual is calculated according to the pixels of the second remaining prediction block of the to-be-processed coding block and the pixel minimum value, wherein the second remaining prediction block is the prediction block of the to-be-processed coding block divided by Prediction blocks remaining outside the prediction block of the minimum pixel;
- the second preset generation value is accumulated for the prediction division cost of the code block to be processed in the second prediction mode to obtain the second prediction cost .
- the prediction module 1105 selects a target prediction mode from the preset prediction modes according to the prediction cost, including:
- the prediction mode corresponding to the smallest prediction cost is selected from the preset prediction modes, and the selected prediction mode is used as the target prediction mode.
- the preset division mode includes no division
- the first calculation module 1102 calculates the header information cost corresponding to the to-be-processed coding block in each division mode, including:
- the number of coded bits corresponding to the non-division, the number of coded bits corresponding to the prediction mode, and the number of coded bits corresponding to the preset base pixels are added to obtain the first header information cost corresponding to the coded block to be processed.
- the preset division mode includes horizontal dichotomy
- the first calculation module 1102 calculates the header information cost corresponding to the to-be-processed coding block in each division mode, including:
- the number of coding bits corresponding to the horizontal dichotomy, the number of coding bits corresponding to the prediction mode, and the total number of base pixel coding bits corresponding to the coding block to be processed are added to obtain the second corresponding to the coding block to be processed Header information cost.
- the preset division mode includes vertical dichotomy
- the first calculation module 1102 calculates the header information cost corresponding to the to-be-processed coding block in each division mode, including:
- the preset division mode includes cross division
- the first calculation module 1102 calculates the header information cost corresponding to the to-be-processed coding block in each division mode, including:
- the number of coded bits corresponding to the cross division, the number of coded bits corresponding to the prediction mode, and the total number of base pixel coded bits corresponding to the coded block to be processed are added to obtain the fourth coded block corresponding to the coded block to be processed. Header information cost.
- the encoding module 1106 performs encoding according to the prediction residual, including:
- each channel of the multiple channels is respectively encoded to obtain an output code stream.
- the encoding module 1106 is further configured to:
- the preset coding mode is FLC coding.
- the encoding module 1106 separately encodes each of the multiple channels according to the quantized residual and a preset encoding method, including:
- the encoding module 1106 uses the preset encoding method to encode the MSB of each of the multiple channels separately according to the quantized residual, including:
- the preset encoding method is used to start from the first row of the MSB of each of the multiple channels, and each preset number of bits from left to right is used as a codeword for Huffman. Look up the table code.
- the encoding module 1106 uses the preset encoding method to encode the LSB of each of the multiple channels separately according to the quantized residual, including:
- the preset coding mode is used to perform coding from left to right bit by bit starting from the first row of the LSB of each of the multiple channels respectively.
- the device provided in this embodiment can be used to implement the technical solutions of the foregoing method embodiments, and its implementation principles and technical effects are similar, and will not be repeated here in this embodiment.
- FIG. 12 is a schematic diagram of the hardware structure of a video image encoding device provided by an embodiment of the application.
- the video image encoding device 120 of this embodiment includes: a memory 1201 and a processor 1202; where
- the memory 1201 is used to store program instructions
- the processor 1202 is configured to execute program instructions stored in the memory, and when the program instructions are executed, the processor executes the following steps:
- Encoding is performed according to the prediction residual.
- the dividing each of the multiple channels of the image frame in the video bitstream to obtain the code block to be processed includes:
- the calculating the division cost corresponding to the block division of the coding block to be processed in each division mode of the preset division mode includes:
- each division mode calculate the header information cost corresponding to the coded block to be processed, where the header information cost includes the number of coded bits corresponding to the division mode, the number of coded bits corresponding to the prediction mode, and the preset base pixels At least one of the corresponding number of coded bits;
- the calculated prediction cost and the header information cost are added to obtain the division cost corresponding to the block division of the to-be-processed coding block in each division mode.
- the selecting a target division mode from the preset division modes according to the division cost includes:
- the division mode corresponding to the smallest division cost is selected from the preset division modes, and the selected division mode is used as the target division mode.
- the preset prediction mode includes a first prediction mode, and the first prediction mode is prediction based on a maximum value of pixels in a prediction block of the coding block to be processed;
- the calculation of the prediction cost corresponding to the prediction of each prediction block of the coding block to be processed in each prediction mode of the preset prediction mode includes:
- the first prediction residual based on the maximum value of the pixel and the pixels of the first remaining prediction block of the to-be-processed coding block, where the first remaining prediction block is the prediction block of the to-be-processed coding block divided by Prediction blocks remaining outside the prediction block of the maximum pixel;
- first prediction residual is greater than a first preset residual threshold, then a first preset generation value is added to the prediction cost of the to-be-processed coding block in the first prediction mode to obtain the first prediction cost.
- the preset prediction mode includes a second prediction mode, and the second prediction mode is to perform prediction according to a minimum value of pixels in a prediction block of the coding block to be processed;
- the calculation of the prediction cost corresponding to the prediction of each prediction block of the coding block to be processed in each prediction mode of the preset prediction mode includes:
- the second prediction residual is calculated according to the pixels of the second remaining prediction block of the to-be-processed coding block and the pixel minimum value, wherein the second remaining prediction block is the prediction block of the to-be-processed coding block divided by Prediction blocks remaining outside the prediction block of the minimum pixel;
- the second preset generation value is accumulated for the prediction division cost of the code block to be processed in the second prediction mode to obtain the second prediction cost .
- the selecting a target prediction mode from the preset prediction modes according to the prediction cost includes:
- the prediction mode corresponding to the smallest prediction cost is selected from the preset prediction modes, and the selected prediction mode is used as the target prediction mode.
- the preset division mode includes no division
- the calculating the header information cost corresponding to the coding block to be processed in each of the division modes includes:
- the number of coded bits corresponding to the non-division, the number of coded bits corresponding to the prediction mode, and the number of coded bits corresponding to the preset base pixels are added to obtain the first header information cost corresponding to the coded block to be processed.
- the preset division mode includes horizontal dichotomy
- the calculating the header information cost corresponding to the coding block to be processed in each of the division modes includes:
- the number of coding bits corresponding to the horizontal dichotomy, the number of coding bits corresponding to the prediction mode, and the total number of base pixel coding bits corresponding to the coding block to be processed are added to obtain the second corresponding to the coding block to be processed Header information cost.
- the preset division mode includes vertical dichotomy
- the calculating the header information cost corresponding to the coding block to be processed in each of the division modes includes:
- the preset division mode includes cross division
- the calculating the header information cost corresponding to the coding block to be processed in each of the division modes includes:
- the number of coded bits corresponding to the cross division, the number of coded bits corresponding to the prediction mode, and the total number of base pixel coded bits corresponding to the coded block to be processed are added to obtain the fourth coded block corresponding to the coded block to be processed. Header information cost.
- the encoding according to the prediction residual includes:
- each channel of the multiple channels is respectively encoded to obtain an output code stream.
- the method before the encoding each of the multiple channels separately according to the quantized residual and the preset encoding mode, the method further includes:
- the preset coding mode is FLC coding.
- the separately encoding each of the multiple channels according to the quantized residual and a preset encoding manner includes:
- the respectively encoding the MSB of each of the multiple channels by using the preset encoding method according to the quantized residual includes:
- the preset encoding method is used to start from the first row of the MSB of each of the multiple channels, and each preset number of bits from left to right is used as a codeword for Huffman. Look up the table code.
- the step of separately encoding the LSB of each of the multiple channels according to the quantized residual using the preset encoding manner includes:
- the preset coding mode is used to perform coding from left to right bit by bit starting from the first row of the LSB of each of the multiple channels respectively.
- the memory 1201 may be independent or integrated with the processor 1202.
- the video image encoding device further includes a bus 1203 for connecting the memory 1201 and the processor 1202.
- the video image encoding system 120 may be a single device, and the system includes a complete set of the foregoing memory 1201, processor 1202, and so on. It can also be distributed on a certain device, which can be determined according to the actual situation.
- FIG. 13 is a schematic structural diagram of a movable platform provided by an embodiment of the application.
- the movable platform 130 of this embodiment includes: a movable platform body 1301, and a video image encoding device 1302; the video image encoding device 1302 is provided on the movable platform body 1301, and the movable platform body 1301
- the platform body 1301 and the video image encoding device 1302 are connected wirelessly or wiredly.
- the video image encoding device 1302 divides each of the multiple channels of the image frame in the video code stream to obtain a code block to be processed;
- Encoding is performed according to the prediction residual.
- the dividing each of the multiple channels of the image frame in the video bitstream to obtain the code block to be processed includes:
- the calculation of the division cost corresponding to the block division of the coding block to be processed in each division mode of the preset division mode includes:
- each division mode calculate the header information cost corresponding to the coded block to be processed, where the header information cost includes the number of coded bits corresponding to the division mode, the number of coded bits corresponding to the prediction mode, and the preset base pixels At least one of the corresponding number of coded bits;
- the calculated prediction cost and the header information cost are added to obtain the division cost corresponding to the block division of the to-be-processed coding block in each division mode.
- the selecting a target division mode from the preset division modes according to the division cost includes:
- the division mode corresponding to the smallest division cost is selected from the preset division modes, and the selected division mode is used as the target division mode.
- the preset prediction mode includes a first prediction mode, and the first prediction mode is prediction based on a maximum value of pixels in a prediction block of the coding block to be processed;
- the calculation of the prediction cost corresponding to the prediction of each prediction block of the coding block to be processed in each prediction mode of the preset prediction mode includes:
- the first prediction residual based on the maximum value of the pixel and the pixels of the first remaining prediction block of the to-be-processed coding block, where the first remaining prediction block is the prediction block of the to-be-processed coding block divided by Prediction blocks remaining outside the prediction block of the maximum pixel;
- first prediction residual is greater than a first preset residual threshold, then a first preset generation value is added to the prediction cost of the to-be-processed coding block in the first prediction mode to obtain the first prediction cost.
- the preset prediction mode includes a second prediction mode, and the second prediction mode is to perform prediction according to a minimum value of pixels in a prediction block of the coding block to be processed;
- the calculation of the prediction cost corresponding to the prediction of each prediction block of the coding block to be processed in each prediction mode of the preset prediction mode includes:
- the second prediction residual is calculated according to the pixels of the second remaining prediction block of the to-be-processed coding block and the pixel minimum value, wherein the second remaining prediction block is the prediction block of the to-be-processed coding block divided by Prediction blocks remaining outside the prediction block of the minimum pixel;
- the second preset generation value is accumulated for the prediction division cost of the code block to be processed in the second prediction mode to obtain the second prediction cost .
- the selecting a target prediction mode from the preset prediction modes according to the prediction cost includes:
- the prediction mode corresponding to the smallest prediction cost is selected from the preset prediction modes, and the selected prediction mode is used as the target prediction mode.
- the preset division mode includes no division
- the calculating the header information cost corresponding to the coding block to be processed in each of the division modes includes:
- the number of coded bits corresponding to the non-division, the number of coded bits corresponding to the prediction mode, and the number of coded bits corresponding to the preset base pixels are added to obtain the first header information cost corresponding to the coded block to be processed.
- the preset division mode includes horizontal dichotomy
- the calculating the header information cost corresponding to the coding block to be processed in each of the division modes includes:
- the number of coding bits corresponding to the horizontal dichotomy, the number of coding bits corresponding to the prediction mode, and the total number of base pixel coding bits corresponding to the coding block to be processed are added to obtain the second corresponding to the coding block to be processed Header information cost.
- the preset division mode includes vertical dichotomy
- the calculating the header information cost corresponding to the coding block to be processed in each of the division modes includes:
- the preset division mode includes cross division
- the calculating the header information cost corresponding to the coding block to be processed in each of the division modes includes:
- the number of coded bits corresponding to the cross division, the number of coded bits corresponding to the prediction mode, and the total number of base pixel coded bits corresponding to the coded block to be processed are added to obtain the fourth coded block corresponding to the coded block to be processed. Header information cost.
- the encoding according to the prediction residual includes:
- each channel of the multiple channels is respectively encoded to obtain an output code stream.
- the method before the encoding each of the multiple channels separately according to the quantized residual and the preset encoding mode, the method further includes:
- the preset coding mode is FLC coding.
- the separately encoding each of the multiple channels according to the quantized residual and a preset encoding manner includes:
- the respectively encoding the MSB of each of the multiple channels by using the preset encoding method according to the quantized residual includes:
- the preset encoding method is used to start from the first row of the MSB of each of the multiple channels, and each preset number of bits from left to right is used as a codeword for Huffman. Look up the table code.
- the step of separately encoding the LSB of each of the multiple channels according to the quantized residual using the preset encoding manner includes:
- the preset coding mode is used to perform coding from left to right bit by bit starting from the first row of the LSB of each of the multiple channels respectively.
- the movable platform includes: a movable platform body, and a video image encoding device.
- the video image encoding device is set on the movable platform body, wherein the video image encoding device performs multiple Each channel in the channel is divided to obtain the code block to be processed, and then the division cost corresponding to the block division of the code block to be processed in each mode of the preset division mode is calculated, the target division mode is determined, and the target division mode is determined.
- the mode performs block division on the coding block to be processed to obtain the prediction block, and then calculates the prediction cost corresponding to the prediction of each prediction block of the coding block to be processed in each mode of the preset prediction mode, thereby determining the target prediction mode, and Predicting each prediction block of the coding block to be processed according to the target prediction mode can reduce data dependence and reduce the accumulation of data errors, which is conducive to hardware parallel data processing, reduces hardware implementation resources, and does not require reconstruction in the quantization process. Improve encoding speed.
- An embodiment of the present application provides a computer-readable storage medium having program instructions stored in the computer-readable storage medium, and when a processor executes the program instructions, the video image encoding method described above is implemented.
- the disclosed device and method may be implemented in other ways.
- the device embodiments described above are merely illustrative.
- the division of the modules is only a logical function division, and there may be other divisions in actual implementation, for example, multiple modules can be combined or integrated. To another system, or some features can be ignored or not implemented.
- the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or modules, and may be in electrical, mechanical or other forms.
- modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
- the functional modules in the various embodiments of the present invention may be integrated into one processing unit, or each module may exist alone physically, or two or more modules may be integrated into one unit.
- the units formed by the above-mentioned modules can be implemented in the form of hardware, or in the form of hardware plus software functional units.
- the above-mentioned integrated modules implemented in the form of software functional modules may be stored in a computer readable storage medium.
- the above-mentioned software function module is stored in a storage medium and includes a number of instructions to make a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor (English: processor) execute the various embodiments of the present application Part of the method.
- processor may be a central processing unit (Central Processing Unit, CPU for short), or other general-purpose processors, digital signal processors (Digital Signal Processor, DSP), and application specific integrated circuits (Application Specific Integrated Circuits). Referred to as ASIC) and so on.
- the general-purpose processor may be a microprocessor or the processor may also be any conventional processor or the like.
- the steps of the method disclosed in combination with the invention may be directly embodied as being executed and completed by a hardware processor, or executed and completed by a combination of hardware and software modules in the processor.
- the memory may include a high-speed RAM memory, or may also include a non-volatile storage NVM, such as at least one disk storage, and may also be a U disk, a mobile hard disk, a read-only memory, a magnetic disk, or an optical disk.
- NVM non-volatile storage
- the bus may be an Industry Standard Architecture (ISA) bus, Peripheral Component (PCI) bus, or Extended Industry Standard Architecture (EISA) bus, etc.
- ISA Industry Standard Architecture
- PCI Peripheral Component
- EISA Extended Industry Standard Architecture
- the bus can be divided into address bus, data bus, control bus and so on.
- the buses in the drawings of this application are not limited to only one bus or one type of bus.
- the above-mentioned storage medium can be realized by any type of volatile or non-volatile storage device or their combination, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable Except for programmable read only memory (EPROM), programmable read only memory (PROM), read only memory (ROM), magnetic memory, flash memory, magnetic disks or optical disks.
- SRAM static random access memory
- EEPROM electrically erasable programmable read-only memory
- EPROM erasable except for programmable read only memory
- PROM programmable read only memory
- ROM read only memory
- magnetic memory flash memory
- flash memory magnetic disks or optical disks.
- optical disks any available medium that can be accessed by a general-purpose or special-purpose computer.
- An exemplary storage medium is coupled to the processor, so that the processor can read information from the storage medium and write information to the storage medium.
- the storage medium may also be an integral part of the processor.
- the processor and the storage medium may be located in Application Specific Integrated Circuits (ASIC for short).
- ASIC Application Specific Integrated Circuits
- the processor and the storage medium may also exist as discrete components in the electronic device or the main control device.
- a person of ordinary skill in the art can understand that all or part of the steps in the foregoing method embodiments can be implemented by a program instructing relevant hardware.
- the aforementioned program can be stored in a computer readable storage medium. When the program is executed, it executes the steps including the foregoing method embodiments; and the foregoing storage medium includes: ROM, RAM, magnetic disk, or optical disk and other media that can store program codes.
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Compression Or Coding Systems Of Tv Signals (AREA)
Abstract
A video image coding method and device, and a movable platform. The method comprises: dividing each of multiple channels of an image frame in a video code stream to obtain a coding block to be processed, and thus calculating a division cost corresponding to performing block division on said coding block in each mode of preset division modes, determining a target division mode, performing block division on said coding block according to the target division mode to obtain prediction blocks, and then calculating a prediction cost corresponding to predicting each prediction block of said coding block in each mode of preset prediction modes so as to determine a target prediction mode and predict each prediction block of said coding block according to the target prediction mode. The method can reduce the data dependence, reduce the data error accumulation, facilitates hardware parallel data processing, and reduces hardware implementation resources, and there is no need to reconstruct during the quantization process, which improves the coding speed.
Description
本申请实施例涉及编码技术,尤其涉及一种视频图像编码方法、设备及可移动平台。The embodiments of the present application relate to coding technology, and in particular to a video image coding method, device, and movable platform.
随着信息技术的发展,高清晰度电视、网络会议、交互式网络电视(IPTV)、三维(3D)电视等视频图像业务迅速发展,视频图像信号以其直观性和高效性等优势成为人们日常生活中获取信息最主要的方式。由于视频图像信号包含的数据量大,需要占用大量的传输带宽和存储空间。为了有效的传输和存储,需要对视频图像信号进行压缩编码。With the development of information technology, video image services such as high-definition television, web conferencing, interactive Internet television (IPTV), and three-dimensional (3D) television have developed rapidly. Video image signals have become people’s daily routines due to their intuitiveness and efficiency. The most important way to get information in life. Because the video image signal contains a large amount of data, it needs to occupy a large amount of transmission bandwidth and storage space. For effective transmission and storage, video image signals need to be compressed and encoded.
相关技术中,DPCM作为一种处理简单的预测方式,在图像压缩编码中应用十分广泛。DPCM一般使用左侧或者上方已编码的像素进行预测。In related technologies, DPCM, as a simple prediction method, is widely used in image compression coding. DPCM generally uses the encoded pixels on the left or above for prediction.
然而,DPCM使用相邻像素进行预测,使得数据依赖性很强,容易产生累积误差和硬件并行处理困难的问题,进而导致编码出错率较高,且编码速度较慢。However, DPCM uses adjacent pixels for prediction, which makes data dependent, prone to cumulative errors and difficult hardware parallel processing, which in turn leads to higher coding error rates and slower coding speeds.
发明内容Summary of the invention
本申请实施例提供一种视频图像编码方法、设备及可移动平台,以克服上述至少一个问题。The embodiments of the present application provide a video image encoding method, device, and movable platform to overcome at least one of the above-mentioned problems.
第一方面,本申请实施例提供一种视频图像编码方法,包括:In the first aspect, an embodiment of the present application provides a video image encoding method, including:
对视频码流中图像帧的多个通道中的每一个通道进行划分,获得待处理码块;Divide each of the multiple channels of the image frame in the video code stream to obtain the code block to be processed;
计算所述待处理编码块在预设划分模式的每一划分模式下,进行块划分对应的划分代价;Calculating the division cost corresponding to the block division of the coding block to be processed in each division mode of the preset division mode;
根据所述划分代价从所述预设划分模式中选择目标划分模式,并根据所述目标划分模式对所述待处理编码块进行块划分,获得预测块;Selecting a target division mode from the preset division modes according to the division cost, and performing block division on the coding block to be processed according to the target division mode to obtain a prediction block;
计算所述待处理编码块的每一预测块在预设预测模式的每一预测模 式下,进行预测对应的预测代价;Calculating the prediction cost corresponding to the prediction of each prediction block of the coding block to be processed in each prediction mode of the preset prediction mode;
根据所述预测代价从所述预设预测模式中选择目标预测模式,并根据所述目标预测模式对所述待处理编码块的每一预测块进行预测,获得预测残差;Selecting a target prediction mode from the preset prediction modes according to the prediction cost, and predicting each prediction block of the coding block to be processed according to the target prediction mode to obtain a prediction residual;
根据所述预测残差进行编码。Encoding is performed according to the prediction residual.
第二方面,本申请实施例提供一种视频图像编码设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机执行指令,所述处理器执行所述计算机执行指令时实现如下步骤:In a second aspect, an embodiment of the present application provides a video image encoding device, including a memory, a processor, and computer-executable instructions stored in the memory and running on the processor, and the processor executes the computer The following steps are implemented when executing instructions:
对视频码流中图像帧的多个通道中的每一个通道进行划分,获得待处理码块;Divide each of the multiple channels of the image frame in the video code stream to obtain the code block to be processed;
计算所述待处理编码块在预设划分模式的每一划分模式下,进行块划分对应的划分代价;Calculating the division cost corresponding to the block division of the coding block to be processed in each division mode of the preset division mode;
根据所述划分代价从所述预设划分模式中选择目标划分模式,并根据所述目标划分模式对所述待处理编码块进行块划分,获得预测块;Selecting a target division mode from the preset division modes according to the division cost, and performing block division on the coding block to be processed according to the target division mode to obtain a prediction block;
计算所述待处理编码块的每一预测块在预设预测模式的每一预测模式下,进行预测对应的预测代价;Calculating the prediction cost corresponding to the prediction of each prediction block of the coding block to be processed in each prediction mode of the preset prediction mode;
根据所述预测代价从所述预设预测模式中选择目标预测模式,并根据所述目标预测模式对所述待处理编码块的每一预测块进行预测,获得预测残差;Selecting a target prediction mode from the preset prediction modes according to the prediction cost, and predicting each prediction block of the coding block to be processed according to the target prediction mode to obtain a prediction residual;
根据所述预测残差进行编码。Encoding is performed according to the prediction residual.
第三方面,本申请实施例提供一种可移动平台,包括:In the third aspect, an embodiment of the present application provides a movable platform, including:
可移动平台本体;以及The movable platform body; and
如上第二方面以及第二方面各种可能的设计所述的视频图像编码设备,所述视频图像编码设备安装于可移动平台本体。In the video image encoding device described in the above second aspect and various possible designs of the second aspect, the video image encoding device is installed on the movable platform body.
第四方面,本申请实施例提供一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机执行指令,当处理器执行所述计算机执行指令时,实现如上第一方面以及第一方面各种可能的设计所述的视频图像编码方法。In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium that stores computer-executable instructions. When the processor executes the computer-executable instructions, the first aspect and the first aspect described above are implemented. In terms of various possible designs, the video image coding method described.
本申请实施例提供的视频图像编码方法、设备及可移动平台本体,该方法通过对视频码流中图像帧的多个通道中的每一个通道进行划分,获得 待处理码块,进而,计算待处理编码块在预设划分模式的每一模式下,进行块划分对应的划分代价,确定目标划分模式,并根据目标划分模式对待处理编码块进行块划分,获得预测块,再计算待处理编码块的每一预测块在预设预测模式的每一模式下,进行预测对应的预测代价,从而,确定目标预测模式,并根据目标预测模式对待处理编码块的每一预测块进行预测,能够降低数据依赖性,减小数据误差积累,有利于硬件并行数据处理,减少硬件实现资源,而且无需在量化过程中进行重构,提高编码速度。The video image coding method, device, and movable platform body provided by the embodiments of the present application. The method divides each of the multiple channels of the image frame in the video code stream to obtain the code block to be processed, and then calculates the code block to be processed. In each mode of the preset division mode, the processing coding block is divided into the corresponding division cost, the target division mode is determined, and the coding block to be processed is divided according to the target division mode to obtain the prediction block, and then the to-be-processed coding block is calculated For each prediction block in the preset prediction mode, the corresponding prediction cost is predicted, so that the target prediction mode is determined, and each prediction block of the coding block to be processed is predicted according to the target prediction mode, which can reduce the data Dependence, reducing the accumulation of data errors, is conducive to hardware parallel data processing, reduces hardware implementation resources, and does not need to be reconstructed in the quantization process to improve coding speed.
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本申请的实施例,并与说明书一起用于解释本申请的原理。The drawings herein are incorporated into the specification and constitute a part of the specification, show embodiments that conform to the application, and are used together with the specification to explain the principle of the application.
图1为本申请实施例提供的视频图像编码***架构示意图;FIG. 1 is a schematic diagram of the architecture of a video image coding system provided by an embodiment of the application;
图2为本申请实施例提供的一种视频图像编码方法的流程示意图;FIG. 2 is a schematic flowchart of a video image encoding method provided by an embodiment of the application;
图3为本申请实施例提供的对视频码流中图像帧的多个通道中的每一个通道进行划分的示意图;3 is a schematic diagram of dividing each of multiple channels of an image frame in a video bitstream according to an embodiment of the application;
图4为本申请实施例提供的预设划分模式示意图;FIG. 4 is a schematic diagram of a preset division mode provided by an embodiment of the application;
图5为本申请实施例提供的另一种视频图像编码方法的流程示意图;FIG. 5 is a schematic flowchart of another video image encoding method provided by an embodiment of the application;
图6为本申请实施例提供的再一种视频图像编码方法的流程示意图;FIG. 6 is a schematic flowchart of still another video image encoding method provided by an embodiment of this application;
图7为本申请实施例提供的第一预测模式示意图;FIG. 7 is a schematic diagram of a first prediction mode provided by an embodiment of the application;
图8为本申请实施例提供的又一种视频图像编码方法的流程示意图;FIG. 8 is a schematic flowchart of another video image encoding method provided by an embodiment of the application;
图9为本申请实施例提供的第二预测模式示意图;FIG. 9 is a schematic diagram of a second prediction mode provided by an embodiment of the application;
图10为本申请实施例提供的又一种视频图像编码方法的流程示意图;FIG. 10 is a schematic flowchart of another video image encoding method provided by an embodiment of this application;
图11为本申请实施例提供的一种视频图像编码设备的结构示意图;FIG. 11 is a schematic structural diagram of a video image encoding device provided by an embodiment of this application;
图12为本申请实施例提供的视频图像编码设备的硬件结构示意图;FIG. 12 is a schematic diagram of the hardware structure of a video image encoding device provided by an embodiment of the application;
图13为本申请实施例提供的一种可移动平台的结构示意图。FIG. 13 is a schematic structural diagram of a movable platform provided by an embodiment of the application.
通过上述附图,已示出本申请明确的实施例,后文中将有更详细的描述。这些附图和文字描述并不是为了通过任何方式限制本申请构思的范围,而是通过参考特定实施例为本领域技术人员说明本申请的概念。Through the above drawings, the specific embodiments of the present application have been shown, which will be described in more detail later. These drawings and text description are not intended to limit the scope of the concept of the present application in any way, but to explain the concept of the present application for those skilled in the art by referring to specific embodiments.
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本申请相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本申请的一些方面相一致的装置和方法的例子。The exemplary embodiments will be described in detail here, and examples thereof are shown in the accompanying drawings. When the following description refers to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementation manners described in the following exemplary embodiments do not represent all implementation manners consistent with the present application. On the contrary, they are merely examples of devices and methods consistent with some aspects of the application as detailed in the appended claims.
首先对本申请所涉及的名词进行解释:First, explain the terms involved in this application:
视频图像编码:通常是指处理形成视频或视频序列的图片序列。在视频编码领域,术语“图片(piCTUre)”、“帧(frame)”或“图像(Image)”可以用作同义词。本申请中视频编码在源侧执行,通常包括处理(例如,通过压缩)原始视频图片以减少表示该视频图片所需的数据量(从而更高效地存储和/或传输)。视频解码在目的地侧执行,通常包括相对于编码器作逆处理,以重构视频图片。Video image coding: usually refers to processing a sequence of pictures that form a video or video sequence. In the field of video coding, the terms "PiCTUre", "frame" or "Image" can be used as synonyms. The video encoding in this application is performed on the source side, and usually includes processing (for example, by compressing) the original video picture to reduce the amount of data required to represent the video picture (thus storing and/or transmitting more efficiently). Video decoding is performed on the destination side and usually involves inverse processing relative to the encoder to reconstruct the video picture.
视频序列的每个图片通常分割成不重叠的块集合,通常在块层级上进行编码。换句话说,编码器侧通常在块(视频块)层级处理亦即编码视频,例如,通过预测来产生预测块,从当前块(当前处理或待处理的块)减去预测块以获取残差块,在变换域变换残差块并量化残差块,以减少待传输(压缩)的数据量,而解码器侧将相对于编码器的逆处理部分应用于经编码或经压缩块,以重构用于表示的当前块。另外,编码器复制解码器处理循环,使得编码器和解码器生成相同的预测和/或重构,用于处理亦即编码后续块。Each picture of a video sequence is usually divided into a set of non-overlapping blocks, and is usually coded at the block level. In other words, the encoder side usually processes the video at the block (video block) level, that is, encodes the video. For example, the prediction block is generated by prediction, and the prediction block is subtracted from the current block (currently processed or to-be-processed block) to obtain the residual. Block, transform the residual block in the transform domain and quantize the residual block to reduce the amount of data to be transmitted (compressed), and the decoder side applies the inverse processing part relative to the encoder to the encoded or compressed block to reproduce Constructs the current block used to represent. In addition, the encoder duplicates the decoder processing loop so that the encoder and decoder generate the same prediction and/or reconstruction for processing, that is, encoding subsequent blocks.
相关技术中,DPCM作为一种处理简单的预测方式,在图像压缩编码中应用十分广泛。DPCM一般使用左侧或者上方已编码的像素进行预测。然而,DPCM使用相邻像素进行预测,使得数据依赖性很强,容易产生累积误差和硬件并行处理困难的问题,进而导致编码出错率较高,且编码速度较慢。In related technologies, DPCM, as a simple prediction method, is widely used in image compression coding. DPCM generally uses the encoded pixels on the left or above for prediction. However, DPCM uses adjacent pixels for prediction, which makes data dependent, prone to cumulative errors and difficult hardware parallel processing, which in turn leads to higher encoding error rates and slower encoding speeds.
因此,考虑到上述问题,本申请提供一种视频图像编码方法,通过对视频码流中图像帧的多个通道中的每一个通道进行划分,获得待处理码块,进而,计算待处理编码块在预设划分模式的每一模式下,进行块划分对应的划分代价,确定目标划分模式,并根据目标划分模式对待处理编码块进行块划分,获得预测块,再计算待处理编码块的每一预测块在预设预测模 式的每一模式下,进行预测对应的预测代价,从而,确定目标预测模式,并根据目标预测模式对待处理编码块的每一预测块进行预测,能够降低数据依赖性,减小数据误差积累,有利于硬件并行数据处理,减少硬件实现资源,而且无需在量化过程中进行重构,提高编码速度。Therefore, in consideration of the above-mentioned problems, the present application provides a video image coding method, which obtains the code blocks to be processed by dividing each of the multiple channels of the image frame in the video code stream, and further, calculates the code blocks to be processed In each mode of the preset division mode, the division cost corresponding to the block division is performed, the target division mode is determined, and the coding block to be processed is divided into blocks according to the target division mode to obtain the prediction block, and then each of the coding blocks to be processed is calculated. The prediction block predicts the corresponding prediction cost in each of the preset prediction modes, thereby determining the target prediction mode, and predicting each prediction block of the coding block to be processed according to the target prediction mode, which can reduce data dependence. Reducing the accumulation of data errors is conducive to hardware parallel data processing, reducing hardware implementation resources, and there is no need to reconstruct during the quantization process, which improves coding speed.
本申请提供的一种视频图像编码方法,可以适用于图1所示的视频图像编码***架构示意图,如图1所示,视频图像编码***10包括源设备12和目标设备14,源设备12包括:图片获取装置121、预处理器122、编码器123和通信接口124。目标设备14包括:显示设备141、处理器142、解码器143和通信接口144。源设备12将编码得到的编码数据13发送给目标设备14。本申请的方法应用于编码器123。The video image encoding method provided by this application can be applied to the schematic diagram of the video image encoding system architecture shown in FIG. 1. As shown in FIG. 1, the video image encoding system 10 includes a source device 12 and a target device 14, and the source device 12 includes : Picture acquisition device 121, preprocessor 122, encoder 123 and communication interface 124. The target device 14 includes a display device 141, a processor 142, a decoder 143, and a communication interface 144. The source device 12 sends the encoded data 13 obtained by encoding to the target device 14. The method of this application is applied to the encoder 123.
其中,源设备12可称为视频编码设备或视频编码装置。目标设备14可称为视频解码设备或视频解码装置。源设备12以及目标设备14可以是视频编码设备或视频编码装置的实例。Among them, the source device 12 may be referred to as a video encoding device or a video encoding device. The target device 14 may be referred to as a video decoding device or a video decoding device. The source device 12 and the target device 14 may be examples of video encoding devices or video encoding devices.
源设备12和目标设备14可以包括各种设备中的任一个,包含任何类别的手持或静止设备,例如,笔记本或膝上型计算机、移动电话、智能电话、平板或平板计算机、摄像机、台式计算机、机顶盒、电视、显示设备、数字媒体播放器、视频游戏控制台、视频流式传输设备(例如内容服务服务器或内容分发服务器)、广播接收器设备、广播发射器设备等,并可以不使用或使用任何类别的操作***。The source device 12 and the target device 14 may include any of a variety of devices, including any type of handheld or stationary device, for example, a notebook or laptop computer, mobile phone, smart phone, tablet or tablet computer, video camera, desktop computer , Set-top boxes, televisions, display devices, digital media players, video game consoles, video streaming devices (such as content service servers or content distribution servers), broadcast receiver devices, broadcast transmitter devices, etc., and may not be used or Use any type of operating system.
在一些情况下,源设备12和目标设备14可以经装备以用于无线通信。因此,源设备12和目标设备14可以为无线视频图像编码设备。In some cases, source device 12 and target device 14 may be equipped for wireless communication. Therefore, the source device 12 and the target device 14 may be wireless video and image encoding devices.
在一些情况下,图1中所示视频图像编码***10仅为示例,本申请的技术可以适用于不必包含编码和解码设备之间的任何数据通信的视频编码设置(例如,视频编码或视频解码)。在其它实例中,数据可从本地存储器检索、在网络上流式传输等。视频编码设备可以对数据进行编码并且将数据存储到存储器,和/或视频解码设备可以从存储器检索数据并且对数据进行解码。在一些实例中,由并不彼此通信而是仅编码数据到存储器和/或从存储器检索数据且解码数据的设备执行编码和解码。In some cases, the video image encoding system 10 shown in FIG. 1 is only an example, and the technology of this application can be applied to video encoding settings that do not necessarily include any data communication between encoding and decoding devices (for example, video encoding or video decoding). ). In other instances, the data can be retrieved from local storage, streamed on the network, etc. The video encoding device can encode data and store the data to the memory, and/or the video decoding device can retrieve the data from the memory and decode the data. In some instances, encoding and decoding are performed by devices that do not communicate with each other but only encode data to and/or retrieve data from the memory and decode the data.
在一些情况下,视频图像编码***10的编码器123也可以称为视频编码器,解码器143也可以称为视频解码器。In some cases, the encoder 123 of the video image encoding system 10 may also be referred to as a video encoder, and the decoder 143 may also be referred to as a video decoder.
在一些情况下,图片获取装置121可以包括或可以为任何类别的图片捕获设备,用于例如捕获现实世界图片,和/或任何类别的图片或评论(对于屏幕内容编码,屏幕上的一些文字也认为是待编码的图片或图像的一部分)生成设备,例如,用于生成计算机动画图片的计算机图形处理器,或用于获取和/或提供现实世界图片、计算机动画图片(例如,屏幕内容、虚拟现实(virtual reality,简称VR)图片)的任何类别设备,和/或其任何组合(例如,实景(augmented reality,简称AR)图片)。其中,图片为或者可以视为具有亮度值的采样点的二维阵列或矩阵。以阵列为例,阵列中的采样点也可以称为像素(pixel)或像素(piCTUre element,简称pel)。阵列在水平和垂直方向(或轴线)上的采样点数目定义图片的尺寸和/或分辨率。为了表示颜色,通常采用三个颜色分量,即图片可以表示为或包含三个采样阵列。RBG格式或颜色空间中,图片包括对应的红色、绿色及蓝色采样阵列。但是,在视频编码中,每个像素通常以亮度/色度格式或颜色空间表示,例如,YCbCr,包括Y指示的亮度(简写为luma)分量(有时也可以用L指示)以及Cb和Cr指示的两个色度(简写为chroma)分量。亮度分量Y表示亮度或灰度水平强度(例如,在灰度等级图片中两者相同),而两个色度分量Cb和Cr表示色度或颜色信息分量。相应地,YCbCr格式的图片包括亮度分量(Y)的亮度采样阵列,和色度分量(Cb和Cr)的两个色度采样阵列。RGB格式的图片可以转换或变换为YCbCr格式,反之亦然,该过程也称为色彩变换或转换。In some cases, the picture acquisition device 121 may include or may be any type of picture capture device, for example, to capture real-world pictures, and/or any type of pictures or comments (for screen content encoding, some text on the screen is also Considered to be a part of the picture or image to be encoded) generating equipment, for example, a computer graphics processor for generating computer animation pictures, or for obtaining and/or providing real-world pictures, computer animation pictures (for example, screen content, virtual Any type of equipment of virtual reality (VR) pictures, and/or any combination thereof (for example, augmented reality (AR) pictures). Wherein, the picture is or can be regarded as a two-dimensional array or matrix of sampling points with brightness values. Taking the array as an example, the sampling points in the array may also be called pixels (pixels) or pixels (piCTUre element, pel for short). The number of sampling points of the array in the horizontal and vertical directions (or axis) defines the size and/or resolution of the picture. In order to represent colors, three color components are usually used, that is, pictures can be represented as or contain three sample arrays. In the RBG format or color space, a picture includes corresponding red, green, and blue sample arrays. However, in video coding, each pixel is usually expressed in a luminance/chrominance format or color space, for example, YCbCr, including the luminance (luma) component indicated by Y (sometimes indicated by L), and Cb and Cr indications. The two chroma (chroma for short) components. The luminance component Y represents luminance or grayscale level intensity (for example, the two are the same in a grayscale picture), and the two chrominance components Cb and Cr represent chrominance or color information components. Correspondingly, a picture in the YCbCr format includes a luminance sample array of the luminance component (Y), and two chrominance sample arrays of the chrominance component (Cb and Cr). Pictures in RGB format can be converted or converted to YCbCr format, and vice versa. This process is also called color conversion or conversion.
另外,图片获取装置121可以为,例如用于捕获图片的相机,例如图片存储器的存储器,包括或存储先前捕获或产生的图片,和/或获取或接收图片的任何类别的(内部或外部)接口。其中,相机可以为,例如,本地的或集成在源设备中的集成相机,存储器可为本地的或例如集成在源设备中的集成存储器。接口可以为,例如,从外部视频源接收图片的外部接口,这里,外部视频源例如为外部图片捕获设备,比如相机、外部存储器或外部图片生成设备,外部图片生成设备例如为外部计算机图形处理器、计算机或服务器。另外,接口可以为根据任何专有或标准化接口协议的任何类别的接口,例如有线或无线接口、光接口。图1中获取图片数据125的接口可以是与通信接口124相同的接口或是通信接口124的一部分。其中, 图片数据125(例如,视频数据)可以称为原始图片或原始图片数据。In addition, the picture acquisition device 121 may be, for example, a camera for capturing pictures, such as a memory of a picture memory, including or storing previously captured or generated pictures, and/or any type of (internal or external) interface for acquiring or receiving pictures. . The camera may be, for example, an integrated camera that is local or integrated in the source device, and the memory may be local or, for example, an integrated memory that is integrated in the source device. The interface may be, for example, an external interface for receiving pictures from an external video source. Here, the external video source is, for example, an external picture capturing device, such as a camera, an external memory, or an external picture generating device, and the external picture generating device is, for example, an external computer graphics processor. , Computer or server. In addition, the interface can be any type of interface according to any proprietary or standardized interface protocol, such as a wired or wireless interface, and an optical interface. The interface for acquiring the picture data 125 in FIG. 1 may be the same interface as the communication interface 124 or a part of the communication interface 124. Wherein, the picture data 125 (for example, video data) may be referred to as original picture or original picture data.
在一些情况下,预处理器122用于接收图片数据125并对图片数据125执行预处理,以获取经预处理的图片(或经预处理的图片数据)126。其中,预处理器122执行的预处理可以包括整修、色彩格式转换(例如,从RGB转换为YCbCr)、调色或去噪。可以理解,预处理器122可以是可选组件。In some cases, the pre-processor 122 is used to receive the picture data 125 and perform pre-processing on the picture data 125 to obtain a pre-processed picture (or pre-processed picture data) 126. The preprocessing performed by the preprocessor 122 may include trimming, color format conversion (for example, conversion from RGB to YCbCr), toning or denoising. It can be understood that the pre-processor 122 may be an optional component.
在一些情况下,编码器123(例如,视频编码器)用于接收经预处理的图片(或经预处理的图片数据)126并提供经编码图片数据127。In some cases, the encoder 123 (eg, a video encoder) is used to receive pre-processed pictures (or pre-processed picture data) 126 and provide encoded picture data 127.
在一些情况下,源设备12的通信接口124可以用于接收经编码图片数据127并传输至其它设备,例如,目标设备14或任何其它设备,以用于存储或直接重构,或用于在对应地存储编码数据13和/或传输编码数据13至其它设备之前处理经编码图片数据127,其它设备例如为目标设备14或任何其它用于解码或存储的设备。目标设备14的通信接口144用于例如,直接从源设备12或任何其它源接收经编码图片数据127或编码数据13,任何其它源例如为存储设备,存储设备例如为经编码图片数据存储设备。In some cases, the communication interface 124 of the source device 12 can be used to receive the encoded picture data 127 and transmit it to other devices, for example, the target device 14 or any other device for storage or direct reconstruction, or for storing Correspondingly, the encoded data 13 is stored and/or the encoded picture data 127 is processed before transmitting the encoded data 13 to other devices, such as the target device 14 or any other device for decoding or storage. The communication interface 144 of the target device 14 is used, for example, to directly receive the encoded picture data 127 or the encoded data 13 from the source device 12 or any other source. Any other source is, for example, a storage device, and the storage device is, for example, an encoded picture data storage device.
其中,通信接口124和通信接口144可以用于藉由源设备12和目标设备14之间的直接通信链路或藉由任何类别的网络传输或接收经编码图片数据127或编码数据13,直接通信链路例如为直接有线或无线连接,任何类别的网络例如为有线或无线网络或其任何组合,或任何类别的私网和公网,或其任何组合。通信接口124可以例如用于将经编码图片数据127封装成合适的格式,例如包,以在通信链路或通信网络上传输。形成通信接口124的对应部分的通信接口144可以例如用于解封装编码数据13,以获取经编码图片数据127。通信接口124和通信接口144都可以配置为单向通信接口,如图1中用于经编码图片数据127的从源设备12指向目标设备14的箭头所指示,或配置为双向通信接口,以及可以用于例如发送和接收消息来建立连接、确认和交换任何其它与通信链路和/或例如经编码图片数据传输的数据传输有关的信息。Among them, the communication interface 124 and the communication interface 144 can be used to directly communicate through the direct communication link between the source device 12 and the target device 14 or through any type of network to transmit or receive the encoded picture data 127 or the encoded data 13 The link is, for example, a direct wired or wireless connection, and any type of network is, for example, a wired or wireless network or any combination thereof, or any type of private network and public network, or any combination thereof. The communication interface 124 may be used, for example, to encapsulate the encoded picture data 127 into a suitable format, such as a packet, for transmission on a communication link or communication network. The communication interface 144 forming the corresponding part of the communication interface 124 may be used, for example, to decapsulate the encoded data 13 to obtain the encoded picture data 127. Both the communication interface 124 and the communication interface 144 can be configured as a one-way communication interface, as indicated by the arrow pointing from the source device 12 to the target device 14 for the encoded picture data 127 in FIG. 1, or can be configured as a two-way communication interface, and can It is used, for example, to send and receive messages to establish a connection, confirm and exchange any other information related to the communication link and/or data transmission such as the transmission of encoded picture data.
在一些情况下,解码器143用于接收经编码图片数据127并提供经解码图片数据(或经解码图片)145。In some cases, the decoder 143 is used to receive encoded picture data 127 and provide decoded picture data (or decoded picture) 145.
在一些情况下,目标设备14的处理器142用于后处理经解码图片数据(或经解码图片)145,例如,经解码图片,以获取经后处理图片数据146,例如,经后处理图片。处理器142执行的后处理可以包括,例如,色彩格式转换(例如,从YCbCr转换为RGB)、调色、整修或重采样,或任何其它处理,用于例如准备经解码图片数据(或经解码图片)145以由显示设备141显示。In some cases, the processor 142 of the target device 14 is used to post-process decoded picture data (or decoded picture) 145, for example, a decoded picture, to obtain post-processed picture data 146, for example, a post-processed picture. The post-processing performed by the processor 142 may include, for example, color format conversion (for example, conversion from YCbCr to RGB), toning, trimming or resampling, or any other processing for preparing decoded picture data (or decoded picture data, for example). The picture 145 is displayed by the display device 141.
在一些情况下,目标设备14的显示设备141用于接收经后处理图片数据145以向例如用户或观看者显示图片。显示设备141可以为或可以包括任何类别的用于呈现经重构图片的显示器,例如,集成的或外部的显示器或监视器。例如,显示器可以包括液晶显示器(liquid crystal display,简称LCD)、有机发光二极管(organic light emitting diode,简称OLED)显示器、等离子显示器、投影仪、微LED显示器、硅基液晶(liquid crystal on silicon,简称LCoS)、数字光处理器(digital light processor,简称DLP)或任何类别的其它显示器。In some cases, the display device 141 of the target device 14 is used to receive the post-processed picture data 145 to display the picture to, for example, a user or viewer. The display device 141 may be or may include any type of display for presenting the reconstructed picture, for example, an integrated or external display or monitor. For example, the display may include a liquid crystal display (LCD for short), an organic light emitting diode (OLED) display, a plasma display, a projector, a micro LED display, and a liquid crystal on silicon (liquid crystal on silicon, for short) LCoS), digital light processor (digital light processor, DLP for short), or any other type of display.
另外,虽然图1将源设备12和目标设备14绘示为单独的设备,但设备实施例也可以同时包括源设备12和目标设备14或同时包括两者的功能性,即源设备12或对应的功能性以及目标设备14或对应的功能性。在此类实施例中,可以使用相同硬件和/或软件,或使用单独的硬件和/或软件,或其任何组合来实施源设备12或对应的功能性以及目标设备14或对应的功能性。不同单元的功能性或图1所示的源设备12和/或目标设备14的功能性的存在和(准确)划分可能根据实际设备和应用有所不同。In addition, although FIG. 1 depicts the source device 12 and the target device 14 as separate devices, the device embodiment may also include the source device 12 and the target device 14 or the functionality of both, that is, the source device 12 or the corresponding The functionality of the target device 14 or the corresponding functionality. In such embodiments, the same hardware and/or software may be used, or separate hardware and/or software, or any combination thereof may be used to implement the source device 12 or the corresponding functionality and the target device 14 or the corresponding functionality. The functionality of different units or the existence and (accurate) division of the functionality of the source device 12 and/or the target device 14 shown in FIG. 1 may vary according to actual devices and applications.
在一些情况下,编码器123(例如,视频编码器)和解码器143(例如,视频解码器)都可以实施为各种合适电路中的任一个,例如,一个或多个微处理器、数字信号处理器(digital signal processor,简称DSP)、专用集成电路(application-specific integrated circuit,简称ASIC)、现场可编程门阵列(field-programmable gate array,简称FPGA)、离散逻辑、硬件或其任何组合。如果部分地以软件实施所述技术,则设备可将软件的指令存储于合适的非暂时性计算机可读存储介质中,且可使用一或多个处理器以硬件执行指令从而执行本申请的技术。前述内容(包含硬件、软件、硬件与软件的组合等)中的任一者可视为一或多个处理器。编码器123和 解码器143中的每一个可以包含在一或多个编码器或解码器中,所述编码器或解码器中的任一个可以集成为对应设备中的组合编码器/解码器(编解码器)的一部分。In some cases, both the encoder 123 (e.g., video encoder) and the decoder 143 (e.g., video decoder) can be implemented as any of various suitable circuits, such as one or more microprocessors, digital Signal processor (digital signal processor, DSP), application-specific integrated circuit (ASIC), field-programmable gate array (FPGA), discrete logic, hardware, or any combination thereof . If the technology is partially implemented in software, the device can store the instructions of the software in a suitable non-transitory computer-readable storage medium, and can use one or more processors to execute the instructions in hardware to execute the technology of the present application . Any of the foregoing (including hardware, software, a combination of hardware and software, etc.) can be regarded as one or more processors. Each of the encoder 123 and the decoder 143 may be included in one or more encoders or decoders, and any one of the encoders or decoders may be integrated as a combined encoder/decoder in the corresponding device ( Codec).
应理解,对于以上参考编码器123所描述的实例中的每一个,解码器143可以用于执行相反过程。关于信令语法元素,解码器143可以用于接收并解析这种语法元素,相应地解码相关视频数据。在一些例子中,编码器123可以将一个或多个定义的语法元素熵编码成经编码视频比特流。在此类实例中,解码器143可以解析这种语法元素,并相应地解码相关视频数据。It should be understood that for each of the examples described above with reference to the encoder 123, the decoder 143 may be used to perform the reverse process. Regarding signaling syntax elements, the decoder 143 can be used to receive and parse such syntax elements, and decode related video data accordingly. In some examples, the encoder 123 may entropy encode one or more defined syntax elements into an encoded video bitstream. In such instances, the decoder 143 can parse such syntax elements and decode related video data accordingly.
下面以具体地实施例对本申请的技术方案以及本申请的技术方案如何解决上述技术问题进行详细说明。下面这几个具体的实施例可以相互结合,对于相同或相似的概念或过程可能在某些实施例中不再赘述。下面将结合附图,对本申请的实施例进行描述。The technical solution of the present application and how the technical solution of the present application solves the above technical problems will be described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
图2为本申请实施例提供的视频图像编码方法的流程示意图,本实施例的执行主体可以为图1所示实施例中的编码器,如图2所示,该方法包括:FIG. 2 is a schematic flowchart of a video image encoding method provided by an embodiment of this application. The execution subject of this embodiment may be the encoder in the embodiment shown in FIG. 1. As shown in FIG. 2, the method includes:
S201、对视频码流中图像帧的多个通道中的每一个通道进行划分,获得待处理码块。S201: Divide each of the multiple channels of the image frame in the video code stream to obtain a code block to be processed.
这里,上述视频码流可以为预设视频格式,例如YUV420视频格式,本申请对比不做特别限制。Here, the above-mentioned video code stream may be a preset video format, such as a YUV420 video format, which is not particularly limited for comparison in this application.
示例性的,以视频码流为YUV420视频格式为例,编码器可以对视频码流中图像帧的Y、U、V多个通道中的每一个通道进行划分。Illustratively, taking the video code stream as the YUV420 video format as an example, the encoder may divide each of the Y, U, and V channels of the image frame in the video code stream.
可选地,上述对视频码流中图像帧的多个通道中的每一个通道进行划分,获得待处理码块,包括:Optionally, the foregoing division of each of the multiple channels of the image frame in the video code stream to obtain the code block to be processed includes:
将上述视频码流中图像帧的多个通道中的每一个通道分别划分为第一预设大小的切片;Dividing each of the multiple channels of the image frame in the video code stream into slices of a first preset size;
分别将划分后每一切片中的通道分量划分为第二预设大小的编码块;Separately dividing the channel components in each slice after division into coding blocks of a second preset size;
从上述编码块中获得上述待处理编码块。Obtain the above-mentioned to-be-processed coding block from the above-mentioned coding block.
其中,上述第一预设大小、第二预设大小均可以根据实际情况设置,本申请实施例对此不做特别限制。Among them, the above-mentioned first preset size and second preset size can be set according to actual conditions, which are not particularly limited in the embodiment of the present application.
具体的,如图3所示,以视频码流为YUV420视频格式为例,编码器可以将输入图像帧的多个通道中的每一个通道划分为不重叠的64x4大小的切片(Slice),切片之间可以独立编解码。将64x4的slice块中的Y分量,划分为16个4x4的编码块(Block);UV分量划分为4x2的编码块。最后从上述编码块中获得上述待处理编码块,例如从上述编码块中获得Y分量的4x4的编码块作为上述待处理编码块,同理也可以从上述编码块中获得U分量的4x2的编码块作为上述待处理编码块,本申请实施例对此不做特别限制。Specifically, as shown in Figure 3, taking the video code stream as the YUV420 video format as an example, the encoder can divide each of the multiple channels of the input image frame into non-overlapping 64x4 slices. It can be coded and decoded independently. The Y component in the 64x4 slice block is divided into 16 4x4 coding blocks; the UV component is divided into 4x2 coding blocks. Finally, the coded block to be processed is obtained from the coded block. For example, the 4x4 coded block of the Y component is obtained from the coded block as the coded block to be processed. Similarly, the 4x2 code of the U component can also be obtained from the coded block. The block is the above-mentioned to-be-processed coding block, which is not particularly limited in the embodiment of the present application.
S202、计算上述待处理编码块在预设划分模式的每一划分模式下,进行块划分对应的划分代价。S202: Calculate the division cost corresponding to the block division of the coding block to be processed in each division mode of the preset division mode.
其中,上述预设划分模式可以根据实际情况设置,例如如图4所示,上述预设划分模式可以包括不划分(None)、水平二分(Horizontal)、竖直二分(Vertical)和十字划分(Split)等,本申请实施例对此不做特别限制。Wherein, the foregoing preset division mode may be set according to actual conditions. For example, as shown in FIG. 4, the foregoing preset division mode may include None, Horizontal, Vertical, and Split. ), etc. The embodiments of the present application do not impose any special restrictions on this.
这里,编码器计算上述待处理编码块在预设划分模式的每一划分模式下,进行块划分对应的划分代价,进而,根据划分代价确定最终的划分模式。Here, the encoder calculates the division cost corresponding to the block division of the coding block to be processed in each division mode of the preset division mode, and then determines the final division mode according to the division cost.
S203、根据上述划分代价从上述预设划分模式中选择目标划分模式,并根据上述目标划分模式对上述待处理编码块进行块划分,获得预测块。S203: Select a target division mode from the preset division modes according to the division cost, and perform block division on the coding block to be processed according to the target division mode to obtain a prediction block.
可选地,上述根据上述划分代价从上述预设划分模式中选择目标划分模式,包括:Optionally, the foregoing selection of the target division mode from the foregoing preset division modes according to the foregoing division cost includes:
从上述划分代价中获取最小的划分代价;Obtain the smallest division cost from the above division costs;
从上述预设划分模式中选择上述最小的划分代价对应的划分模式,将选择的划分模式作为上述目标划分模式。The division mode corresponding to the minimum division cost is selected from the preset division modes, and the selected division mode is used as the target division mode.
另外,除上述选择目标划分模式的方式外,还可以根据实际情况选择目标划分模式,例如从上述划分代价中获取目标划分代价,从上述预设划分模式中选择上述目标划分代价对应的划分模式,将选择的划分模式作为上述目标划分模式,本申请实施例对此不做特别限制。其中,上述目标划分代价可以为除上述最小的划分代价外的其它划分代价,具体可以根据实际情况确定。In addition, in addition to the above method of selecting the target division mode, the target division mode can also be selected according to the actual situation, for example, the target division cost is obtained from the above division cost, and the division mode corresponding to the target division cost is selected from the above preset division mode. The selected division mode is used as the above-mentioned target division mode, which is not particularly limited in the embodiment of the present application. Among them, the aforementioned target division cost may be other division costs except the aforementioned minimum division cost, which can be specifically determined according to actual conditions.
S204、计算上述待处理编码块的每一预测块在预设预测模式的每一预测模式下,进行预测对应的预测代价。S204: Calculate the prediction cost corresponding to the prediction of each prediction block of the coding block to be processed in each prediction mode of the preset prediction mode.
其中,上述预设预测模式可以根据实际情况设置,例如上述预设划分模式包括第一预测模式maxDPCM和第二预测模式MinDPCM等,本申请实施例对此不做特别限制。The foregoing preset prediction mode may be set according to actual conditions. For example, the foregoing preset division mode includes the first prediction mode maxDPCM and the second prediction mode MinDPCM, which are not particularly limited in the embodiment of the present application.
其中,maxDPCM为根据上述待处理编码块的预测块中的像素最大值进行预测,即先选出预测块中的最大值,然后使用最大值减去其余值,得到预测残差。minDPCM为根据上述待处理编码块的预测块中的像素最小值进行预测,即先选出预测块中的最小值,然后使用其他值减去最小值,得到预测残差。Among them, maxDPCM is to predict according to the maximum value of the pixel in the prediction block of the coding block to be processed, that is, the maximum value in the prediction block is selected first, and then the maximum value is used to subtract the remaining values to obtain the prediction residual. minDPCM predicts based on the minimum pixel value in the prediction block of the coding block to be processed, that is, first selects the minimum value in the prediction block, and then uses other values to subtract the minimum value to obtain the prediction residual.
由于上述两个预测模式得到的残差没有负数,所以不需要对符号编码,提高编码速度,而且上述两个预测模式无需使用相邻像素进行预测,降低数据依赖,不易产生累积误差,另外,后续量化不需要进行重建,可以使用并行处理,解决硬件并行处理困难的问题。Since the residuals obtained by the above two prediction modes do not have negative numbers, there is no need to encode symbols, which increases the coding speed. Moreover, the above two prediction modes do not need to use adjacent pixels for prediction, reducing data dependence and not easy to generate cumulative errors. In addition, follow-up Quantization does not need to be reconstructed, and parallel processing can be used to solve the difficult problem of hardware parallel processing.
这里,编码器计算上述待处理编码块的每一预测块在预设预测模式的每一预测模式下,进行预测对应的预测代价,进而,根据预测代价确定最终的预测模式。Here, the encoder calculates the prediction cost corresponding to the prediction of each prediction block of the coding block to be processed in each prediction mode of the preset prediction mode, and then determines the final prediction mode according to the prediction cost.
S205、根据上述预测代价从上述预设预测模式中选择目标预测模式,并根据上述目标预测模式对上述待处理编码块的每一预测块进行预测,获得预测残差。S205. Select a target prediction mode from the preset prediction modes according to the prediction cost, and predict each prediction block of the coding block to be processed according to the target prediction mode to obtain a prediction residual.
可选地,上述根据上述预测代价从上述预设预测模式中选择目标预测模式,包括:Optionally, the foregoing selection of the target prediction mode from the foregoing preset prediction modes according to the foregoing prediction cost includes:
从上述预测代价中获取最小的预测代价;Obtain the smallest predicted cost from the above predicted costs;
从上述预设预测模式中选择上述最小的预测代价对应的预测模式,将选择的预测模式作为上述目标预测模式。The prediction mode corresponding to the minimum prediction cost is selected from the preset prediction modes, and the selected prediction mode is used as the target prediction mode.
另外,除上述选择目标预测模式的方式外,还可以根据实际情况选择目标预测模式,例如从上述预测代价中获取目标预测代价;从上述预设预测模式中选择上述目标预测代价对应的预测模式,将选择的预测模式作为上述目标预测模式,本申请实施例对此不做特别限制。其中,上述预测划分代价可以为除上述最小的预测代价外的其它预测代价,具体可以根据实 际情况确定。In addition, in addition to the above method of selecting the target prediction mode, the target prediction mode can also be selected according to the actual situation, for example, the target prediction cost is obtained from the above prediction cost; the prediction mode corresponding to the target prediction cost is selected from the above preset prediction mode, The selected prediction mode is used as the aforementioned target prediction mode, which is not particularly limited in the embodiment of the present application. Among them, the aforementioned forecast division cost may be other forecast costs other than the aforementioned minimum forecast cost, which can be specifically determined according to actual conditions.
S206、根据上述预测残差进行编码。S206: Perform encoding according to the foregoing prediction residual.
这里,编码器可以基于上述预测残差同时进行多次量化、编码等处理,以选取同等码率下画质最优的编码参数,获得输出码流。Here, the encoder can perform multiple quantization, encoding, etc. processes at the same time based on the above prediction residuals to select the encoding parameters with the best image quality at the same bit rate to obtain the output bit stream.
本实施例提供的视频图像编码方法,通过对视频码流中图像帧的多个通道中的每一个通道进行划分,获得待处理码块,进而,计算待处理编码块在预设划分模式的每一模式下,进行块划分对应的划分代价,确定目标划分模式,并根据目标划分模式对待处理编码块进行块划分,获得预测块,再计算待处理编码块的每一预测块在预设预测模式的每一模式下,进行预测对应的预测代价,从而,确定目标预测模式,并根据目标预测模式对待处理编码块的每一预测块进行预测,能够降低数据依赖性,减小数据误差积累,有利于硬件并行数据处理,减少硬件实现资源,而且无需在量化过程中进行重构,提高编码速度。The video image encoding method provided by this embodiment obtains the code block to be processed by dividing each of the multiple channels of the image frame in the video code stream, and further, calculates each of the code blocks to be processed in the preset division mode. In the first mode, the division cost corresponding to the block division is determined, the target division mode is determined, and the coding block to be processed is divided into blocks according to the target division mode to obtain the prediction block, and then each prediction block of the coding block to be processed is calculated in the preset prediction mode In each mode, predict the corresponding prediction cost, thereby determining the target prediction mode, and predicting each prediction block of the coding block to be processed according to the target prediction mode, which can reduce data dependence and reduce the accumulation of data errors. It is conducive to hardware parallel data processing, reduces hardware implementation resources, and does not need to be reconstructed in the quantization process, which improves the coding speed.
另外,本申请实施例还能够基于预测代价和头信息代价获得划分代价。图5为本申请实施例提出的另一种视频图像编码方法的流程示意图,本实施例的执行主体可以为图1所示实施例中的编码器。如图5所示,该方法包括:In addition, the embodiment of the present application can also obtain the division cost based on the prediction cost and the header information cost. FIG. 5 is a schematic flowchart of another video image encoding method proposed in an embodiment of this application. The execution subject of this embodiment may be the encoder in the embodiment shown in FIG. 1. As shown in Figure 5, the method includes:
S501、对视频码流中图像帧的多个通道中的每一个通道进行划分,获得待处理码块。S501. Divide each of the multiple channels of the image frame in the video code stream to obtain a code block to be processed.
其中,步骤S501与上述步骤S201的实现方式相同,此处不再赘述。Wherein, step S501 is implemented in the same manner as the foregoing step S201, and will not be repeated here.
S502、在预设划分模式的每一划分模式下,计算上述待处理编码块的每一预测块在预设预测模式的每一预测模式下进行预测对应的预测代价。S502: In each division mode of the preset division mode, calculate the prediction cost corresponding to the prediction of each prediction block of the coding block to be processed in each prediction mode of the preset prediction mode.
可选地,上述预设划分模式可以包括如图4所示的不划分(None)、水平二分(Horizontal)、竖直二分(Vertical)和十字划分(Split)等。Optionally, the foregoing preset division mode may include None, Horizontal, Vertical, Split, etc. as shown in FIG. 4.
上述预设预测模式可以包括上述第一预测模式maxDPCM和第二预测模式minDPCM等。The preset prediction mode may include the first prediction mode maxDPCM, the second prediction mode minDPCM, and so on.
这里,一种划分模式下,上述待处理编码块的每一预测块的预测模式是相同的,例如在不划分模式下,上述待处理编码块的每一预测块的预测模式是相同的,可以都是上述第一预测模式maxDPCM,或者都是上述第二预测模式minDPCM。Here, in a division mode, the prediction mode of each prediction block of the above-mentioned coding block to be processed is the same. For example, in the non-divided mode, the prediction mode of each prediction block of the above-mentioned coding block to be processed is the same. Both are the above-mentioned first prediction mode maxDPCM, or both are the above-mentioned second prediction mode minDPCM.
示例性的,在上述每一划分模式下,计算上述待处理编码块的每一预测块在上述每一预测模式下进行预测对应的预测残差,如果预测残差大于预设残差阈值,则对上述待处理编码块在该预测模式下的预测划分代价累加预设代价值,获得预测代价predCost。Exemplarily, in each of the foregoing division modes, calculate the prediction residual corresponding to each prediction block of the foregoing coding block to be processed in each of the foregoing prediction modes, and if the prediction residual is greater than the preset residual threshold, then The predicted division cost of the above-mentioned coded block to be processed in the prediction mode is accumulated and the preset cost value is added to obtain the predicted cost predCost.
其中,上述预设残差阈值、预设代价值均可以根据实际情况设置,本申请实施例对此不做特别限制。例如只要预测残差大于15,预测代价predCost就累加8。Among them, the above-mentioned preset residual threshold value and the preset cost value can be set according to actual conditions, and the embodiment of the present application does not specifically limit this. For example, as long as the prediction residual is greater than 15, the prediction cost predCost is accumulated by 8.
for(int i=0;i<size;i++)for(int i=0; i<size; i++)
if(resi[i]>15)if(resi[i]>15)
predCost+=8predCost+=8
S503、在上述每一划分模式下,计算上述待处理编码块对应的头信息代价,其中,该头信息代价(headerCost)包括划分模式对应的编码比特数、预测模式对应的编码比特数和预设基像素对应的编码比特数中至少一个。S503. In each of the foregoing division modes, calculate a header information cost corresponding to the encoding block to be processed, where the header cost (headerCost) includes the number of coded bits corresponding to the division mode, the number of coded bits corresponding to the prediction mode, and a preset At least one of the number of coded bits corresponding to the base pixel.
可选地,上述预设划分模式包括不划分(None)。Optionally, the foregoing preset division mode includes no division (None).
上述在上述每一划分模式下,计算上述待处理编码块对应的头信息代价,包括:The foregoing calculation of the header information cost corresponding to the foregoing coding block to be processed in each of the foregoing division modes includes:
将上述不划分对应的编码比特数、上述预测模式对应的编码比特数和预设基像素对应的编码比特数相加,获得上述待处理编码块对应的第一头信息代价。The number of coded bits corresponding to the non-division, the number of coded bits corresponding to the prediction mode, and the number of coded bits corresponding to the preset base pixels are added to obtain the first header information cost corresponding to the coded block to be processed.
示例性的,None--------headerCost=2bit(不划分对应的编码比特数)+1bit(预测模式对应的编码比特数)+8bit(预设基像素对应的编码比特数)=11。Exemplarily, None--------headerCost=2bit (the number of coded bits corresponding to no division) + 1 bit (the number of coded bits corresponding to the prediction mode) + 8bit (the number of coded bits corresponding to the preset base pixel)= 11.
可选地,上述预设划分模式包括水平二分(Horizontal)。Optionally, the foregoing preset division mode includes horizontal dichotomy (Horizontal).
上述在上述每一划分模式下,计算上述待处理编码块对应的头信息代价,包括:The foregoing calculation of the header information cost corresponding to the foregoing coding block to be processed in each of the foregoing division modes includes:
根据上述水平二分和上述预设基像素对应的编码比特数,计算上述待处理编码块对应的总的基像素编码比特数。例如,总的基像素编码比特数=2*8bit(预设基像素对应的编码比特数)。According to the horizontal dichotomy and the number of encoding bits corresponding to the preset base pixels, the total number of encoding bits of base pixels corresponding to the encoding block to be processed is calculated. For example, the total number of base pixel encoding bits=2*8bit (the number of encoding bits corresponding to the preset base pixel).
将上述水平二分对应的编码比特数、上述预测模式对应的编码比特数 和上述待处理编码块对应的总的基像素编码比特数相加,获得上述待处理编码块对应的第二头信息代价。The number of coding bits corresponding to the horizontal dichotomy, the number of coding bits corresponding to the prediction mode, and the total number of base pixel coding bits corresponding to the coding block to be processed are added to obtain the second header information cost corresponding to the coding block to be processed.
示例性的,Horizontal--headerCost=2bit(上述水平二分对应的编码比特数)+1bit(上述预测模式对应的编码比特数)+2*8bit(总的基像素编码比特数)=19。Exemplarily, Horizontal-headerCost=2bit (the number of coding bits corresponding to the horizontal dichotomy)+1 bit (the number of coding bits corresponding to the prediction mode)+2*8bit (the total number of base pixel coding bits)=19.
可选地,上述预设划分模式包括竖直二分(Vertical)。Optionally, the foregoing preset division mode includes vertical dichotomy (Vertical).
上述在上述每一划分模式下,计算上述待处理编码块对应的头信息代价,包括:The foregoing calculation of the header information cost corresponding to the foregoing coding block to be processed in each of the foregoing division modes includes:
根据上述竖直二分和上述预设基像素对应的编码比特数,计算上述待处理编码块对应的总的基像素编码比特数,例如总的基像素编码比特数=2*8bit(预设基像素对应的编码比特数)。According to the vertical dichotomy and the number of encoding bits corresponding to the preset base pixels, calculate the total number of base pixel encoding bits corresponding to the encoding block to be processed, for example, the total number of base pixel encoding bits=2*8bit (preset base pixel Corresponding number of coded bits).
将上述竖直二分对应的编码比特数、上述预测模式对应的编码比特数和上述待处理编码块对应的总的基像素编码比特数相加,获得上述待处理编码块对应的第三头信息代价。Add the number of coding bits corresponding to the vertical dichotomy, the number of coding bits corresponding to the prediction mode, and the total number of base pixel coding bits corresponding to the coding block to be processed to obtain the third header information cost corresponding to the coding block to be processed .
示例性的,Vertical--headerCost=2bit(上述竖直二分对应的编码比特数)+1bit(上述预测模式对应的编码比特数)+2*8bit(总的基像素编码比特数)=19。Exemplarily, Vertical--headerCost=2bit (the number of coded bits corresponding to the vertical dichotomy)+1 bit (the number of coded bits corresponding to the prediction mode)+2*8bit (the total number of base pixel coded bits)=19.
可选地,上述预设划分模式包括十字划分(Split)。Optionally, the foregoing preset division mode includes a cross division (Split).
上述在上述每一划分模式下,计算上述待处理编码块对应的头信息代价,包括:The foregoing calculation of the header information cost corresponding to the foregoing coding block to be processed in each of the foregoing division modes includes:
根据上述十字划分和上述预设基像素对应的编码比特数,计算上述待处理编码块对应的总的基像素编码比特数,例如总的基像素编码比特数=4*8bit(预设基像素对应的编码比特数)。According to the above cross division and the number of encoding bits corresponding to the preset base pixels, calculate the total number of base pixel encoding bits corresponding to the encoding block to be processed, for example, the total number of base pixel encoding bits=4*8bit (the preset base pixel corresponds to Number of coded bits).
将上述十字划分对应的编码比特数、上述预测模式对应的编码比特数和上述待处理编码块对应的总的基像素编码比特数相加,获得上述待处理编码块对应的第四头信息代价。The number of coded bits corresponding to the cross division, the number of coded bits corresponding to the prediction mode, and the total number of base pixel coded bits corresponding to the coded block to be processed are added to obtain the fourth header information cost corresponding to the coded block to be processed.
示例性的,Split--headerCost=2bit(上述十字划分对应的编码比特数)+1bit(上述预测模式对应的编码比特数)+4*8bit(总的基像素编码比特数)=35。Exemplarily, Split--headerCost=2bit (the number of coded bits corresponding to the above-mentioned cross division)+1 bit (the number of coded bits corresponding to the above-mentioned prediction mode)+4*8bit (the total number of base pixel coded bits)=35.
S504、将上述计算的预测代价和头信息代价相加,获得上述待处理编 码块在上述每一划分模式下进行块划分对应的划分代价。S504. Add the calculated prediction cost and the header information cost to obtain the division cost corresponding to the block division of the to-be-processed coding block in each division mode.
这里,划分代价是上述predCosts和headerCost之和,进而,根据该划分代价选择划分模式。Here, the division cost is the sum of the aforementioned predCosts and headerCost, and further, the division mode is selected according to the division cost.
S505、根据上述划分代价从上述预设划分模式中选择目标划分模式,并根据上述目标划分模式对上述待处理编码块进行块划分,获得预测块。S505: Select a target division mode from the preset division modes according to the division cost, and perform block division on the coding block to be processed according to the target division mode to obtain a prediction block.
S506、计算上述待处理编码块的每一预测块在预设预测模式的每一预测模式下,进行预测对应的预测代价。S506: Calculate the prediction cost corresponding to the prediction of each prediction block of the coding block to be processed in each prediction mode of the preset prediction mode.
S507、根据上述预测代价从上述预设预测模式中选择目标预测模式,并根据上述目标预测模式对上述待处理编码块的每一预测块进行预测,获得预测残差。S507. Select a target prediction mode from the preset prediction modes according to the prediction cost, and predict each prediction block of the coding block to be processed according to the target prediction mode to obtain a prediction residual.
S508、根据上述预测残差进行编码。S508. Perform encoding according to the foregoing prediction residual.
其中,步骤S505-S508与上述步骤S203-S206的实现方式相同,此处不再赘述。Wherein, steps S505-S508 are implemented in the same manner as the foregoing steps S203-S206, and will not be repeated here.
本实施例提供的视频图像编码方法,通过计算每一划分模式下,待处理编码块的每一预测块在每一预测模式下进行预测对应的预测代价,以及待处理编码块对应的头信息代价,进而准确确定待处理编码块在所述每一划分模式下进行块划分对应的划分代价,保证后续处理的准确性,而且通过对视频码流中图像帧的多个通道中的每一个通道进行划分,获得待处理码块,进而,计算待处理编码块在预设划分模式的每一模式下,进行块划分对应的划分代价,确定目标划分模式,并根据目标划分模式对待处理编码块进行块划分,获得预测块,再计算待处理编码块的每一预测块在预设预测模式的每一模式下,进行预测对应的预测代价,从而,确定目标预测模式,并根据目标预测模式对待处理编码块的每一预测块进行预测,能够降低数据依赖性,减小数据误差积累,有利于硬件并行数据处理,减少硬件实现资源,而且无需在量化过程中进行重构,提高编码速度。The video image coding method provided in this embodiment calculates the prediction cost corresponding to the prediction of each prediction block of the coding block to be processed in each prediction mode in each division mode, and the header information cost corresponding to the coding block to be processed , And then accurately determine the division cost corresponding to the block division of the coded block to be processed in each division mode, to ensure the accuracy of subsequent processing, and by performing processing on each of the multiple channels of the image frame in the video bitstream. Divide, obtain the code block to be processed, and then calculate the division cost corresponding to the block division of the code block to be processed in each mode of the preset division mode, determine the target division mode, and block the code block to be processed according to the target division mode Divide, obtain the prediction block, and then calculate the prediction cost of each prediction block of the coding block to be processed. In each mode of the preset prediction mode, the prediction cost corresponding to the prediction is performed, so that the target prediction mode is determined, and the coding to be processed is determined according to the target prediction mode Predicting each prediction block of the block can reduce data dependence and reduce the accumulation of data errors, which is conducive to hardware parallel data processing, reduces hardware implementation resources, and does not need to be reconstructed in the quantization process, which improves coding speed.
另外,本申请实施例还能够计算上述待处理编码块的每一预测块在第一预测模式下进行预测对应的预测代价。图6为本申请实施例提出的再一种视频图像编码方法的流程示意图,本实施例的执行主体可以为图1所示实施例中的编码器。如图6所示,该方法包括:In addition, the embodiment of the present application can also calculate the prediction cost corresponding to the prediction of each prediction block of the coding block to be processed in the first prediction mode. FIG. 6 is a schematic flowchart of another video image encoding method proposed by an embodiment of the application. The execution subject of this embodiment may be the encoder in the embodiment shown in FIG. 1. As shown in Figure 6, the method includes:
S601、对视频码流中图像帧的多个通道中的每一个通道进行划分,获 得待处理码块。S601. Divide each of the multiple channels of the image frame in the video code stream to obtain a code block to be processed.
S602、计算上述待处理编码块在预设划分模式的每一划分模式下,进行块划分对应的划分代价。S602: Calculate the division cost corresponding to the block division of the coding block to be processed in each division mode of the preset division mode.
S603、根据上述划分代价从上述预设划分模式中选择目标划分模式,并根据上述目标划分模式对上述待处理编码块进行块划分,获得预测块。S603: Select a target division mode from the preset division modes according to the division cost, and perform block division on the coding block to be processed according to the target division mode to obtain a prediction block.
其中,步骤S601-S603与上述步骤S201-S203的实现方式相同,此处不再赘述。Wherein, steps S601-S603 are implemented in the same manner as the foregoing steps S201-S203, and will not be repeated here.
S604、预设预测模式包括第一预测模式,该第一预测模式为根据上述待处理编码块的预测块中的像素最大值进行预测,根据上述像素最大值与上述待处理编码块的第一剩余预测块的像素,计算第一预测残差,其中,上述第一剩余预测块为上述待处理编码块的预测块中除上述像素最大值的预测块外剩余的预测块。S604. The preset prediction mode includes a first prediction mode. The first prediction mode is based on the prediction based on the maximum value of the pixel in the prediction block of the to-be-processed coding block, and the prediction is performed based on the maximum value of the pixel and the first remaining value of the to-be-processed coding block. Predict the pixels of the block and calculate the first prediction residual, where the first remaining prediction block is the remaining prediction block in the prediction block of the coding block to be processed except for the prediction block with the maximum value of the pixel.
示例性的,如图7所示,待处理编码块的预测块中的像素最大值为26,使用该最大值减去其余值,预测残差最小,而且残差没有负数,后续无需对符号编码,可以进一步提高后续编码速度。Exemplarily, as shown in FIG. 7, the maximum value of pixels in the prediction block of the coding block to be processed is 26, and the maximum value is used to subtract the remaining values, and the prediction residual is the smallest, and the residual has no negative number, so there is no need to code the sign later. , Can further improve the subsequent encoding speed.
S605、若上述第一预测残差大于第一预设残差阈值,则对上述待处理编码块在上述第一预测模式下的预测代价累加第一预设代价值,获得第一预测代价。S605: If the first prediction residual is greater than the first preset residual threshold, add a first preset generation value to the prediction cost of the code block to be processed in the first prediction mode to obtain the first prediction cost.
这里,如果上述预测残差大于预设残差阈值,则对上述待处理编码块在该预测模式下的预测代价累加预设代价值,获得预测代价。其中,上述第一预设残差阈值、第一预设代价值均可以根据实际情况设置,本申请实施例对此不做特别限制。示例性的,只要预测残差大于15,预测代价predCost就累加8。Here, if the prediction residual is greater than the preset residual threshold, the prediction cost of the coding block to be processed in the prediction mode is accumulated and the preset cost value is obtained to obtain the prediction cost. Among them, the above-mentioned first preset residual threshold value and the first preset generation value can be set according to actual conditions, which are not particularly limited in the embodiment of the present application. Exemplarily, as long as the prediction residual is greater than 15, the prediction cost predCost is accumulated by 8.
S606、根据上述预测代价从上述预设预测模式中选择目标预测模式,并根据上述目标预测模式对上述待处理编码块的每一预测块进行预测,获得预测残差。S606. Select a target prediction mode from the preset prediction modes according to the prediction cost, and predict each prediction block of the coding block to be processed according to the target prediction mode to obtain a prediction residual.
S607、根据上述预测残差进行编码。S607: Perform encoding according to the foregoing prediction residual.
其中,步骤S606-S607与上述步骤S205-S206的实现方式相同,此处不再赘述。Wherein, steps S606-S607 are implemented in the same manner as the foregoing steps S205-S206, and will not be repeated here.
本实施例提供的视频图像编码方法,通过对视频码流中图像帧的多个 通道中的每一个通道进行划分,获得待处理码块,进而,计算待处理编码块在预设划分模式的每一模式下,进行块划分对应的划分代价,确定目标划分模式,并根据目标划分模式对待处理编码块进行块划分,获得预测块,再计算待处理编码块的每一预测块在预设预测模式的每一模式下,进行预测对应的预测代价,从而,确定目标预测模式,并根据目标预测模式对待处理编码块的每一预测块进行预测,其中,由于上述预测模式得到的残差没有负数,所以不需要对符号编码,提高编码速度,而且上述预测模式无需使用相邻像素进行预测,降低数据依赖,不易产生累积误差,解决硬件并行处理困难的问题。The video image encoding method provided by this embodiment obtains the code block to be processed by dividing each of the multiple channels of the image frame in the video code stream, and further, calculates each of the code blocks to be processed in the preset division mode. In the first mode, the division cost corresponding to the block division is determined, the target division mode is determined, and the coding block to be processed is divided into blocks according to the target division mode to obtain the prediction block, and then each prediction block of the coding block to be processed is calculated in the preset prediction mode In each mode, the prediction cost corresponding to the prediction is performed, so that the target prediction mode is determined, and each prediction block of the coding block to be processed is predicted according to the target prediction mode. Since the residuals obtained by the above prediction modes are not negative, Therefore, it is not necessary to encode symbols, which improves the encoding speed, and the above prediction mode does not need to use adjacent pixels for prediction, which reduces data dependence, is not easy to generate cumulative errors, and solves the problem of hardware parallel processing difficulties.
另外,本申请实施例还能够计算上述待处理编码块的每一预测块在第二预测模式下进行预测对应的预测代价。图8为本申请实施例提出的又一种视频图像编码方法的流程示意图,本实施例的执行主体可以为图1所示实施例中的编码器。如图8所示,该方法包括:In addition, the embodiment of the present application can also calculate the prediction cost corresponding to the prediction of each prediction block of the coding block to be processed in the second prediction mode. FIG. 8 is a schematic flowchart of another video image encoding method proposed by an embodiment of the application. The execution subject of this embodiment may be the encoder in the embodiment shown in FIG. 1. As shown in Figure 8, the method includes:
S801、对视频码流中图像帧的多个通道中的每一个通道进行划分,获得待处理码块。S801: Divide each of the multiple channels of the image frame in the video code stream to obtain a code block to be processed.
S802、计算上述待处理编码块在预设划分模式的每一划分模式下,进行块划分对应的划分代价。S802: Calculate the division cost corresponding to the block division of the coding block to be processed in each division mode of the preset division mode.
S803、根据上述划分代价从上述预设划分模式中选择目标划分模式,并根据上述目标划分模式对上述待处理编码块进行块划分,获得预测块。S803: Select a target division mode from the preset division modes according to the division cost, and perform block division on the coding block to be processed according to the target division mode to obtain a prediction block.
其中,步骤S801-S803与上述步骤S201-S203的实现方式相同,此处不再赘述。Wherein, steps S801-S803 are implemented in the same manner as the foregoing steps S201-S203, and will not be repeated here.
S804、预设预测模式包括第二预测模式,该第二预测模式为根据上述待处理编码块的预测块中的像素最小值进行预测,根据上述待处理编码块的第二剩余预测块的像素与上述像素最小值,计算第二预测残差,其中,上述第二剩余预测块为上述待处理编码块的预测块中除上述像素最小值的预测块外剩余的预测块。S804. The preset prediction mode includes a second prediction mode. The second prediction mode is based on the prediction based on the minimum value of the pixel in the prediction block of the to-be-processed coding block, and the pixel value of the second remaining prediction block of the to-be-processed coding block is The pixel minimum value is used to calculate a second prediction residual, wherein the second remaining prediction block is a prediction block remaining except for the prediction block of the pixel minimum value among the prediction blocks of the coding block to be processed.
示例性的,如图9所示,待处理编码块的预测块中的像素最小值为22,使用剩余其他值减去最小值,预测残差最小,而且残差没有负数,后续无需对符号编码,可以进一步提高后续编码速度。Exemplarily, as shown in FIG. 9, the minimum value of the pixel in the prediction block of the coding block to be processed is 22, and the remaining other values are used to subtract the minimum value, the prediction residual is the smallest, and the residual has no negative number, so there is no need to code the sign later , Can further improve the subsequent encoding speed.
S805、若上述第二预测残差大于第二预设残差阈值,则对上述待处理 编码块在上述第二预测模式下的预测划分代价累加第二预设代价值,获得第二预测代价。S805: If the second prediction residual is greater than a second preset residual threshold, add a second preset generation value to the prediction division cost of the code block to be processed in the second prediction mode to obtain a second prediction cost.
这里,如果上述预测残差大于预设残差阈值,则对上述待处理编码块在该预测模式下的预测代价累加预设代价值,获得预测代价。其中,上述第二预设残差阈值、第二预设代价值均可以根据实际情况设置,本申请实施例对此不做特别限制。示例性的,只要预测残差大于15,预测代价predCost就累加8。Here, if the prediction residual is greater than the preset residual threshold, the prediction cost of the coding block to be processed in the prediction mode is accumulated and the preset cost value is obtained to obtain the prediction cost. Among them, the above-mentioned second preset residual threshold value and second preset generation value can be set according to actual conditions, which are not particularly limited in the embodiment of the present application. Exemplarily, as long as the prediction residual is greater than 15, the prediction cost predCost is accumulated by 8.
S806、根据上述预测代价从上述预设预测模式中选择目标预测模式,并根据上述目标预测模式对上述待处理编码块的每一预测块进行预测,获得预测残差。S806. Select a target prediction mode from the preset prediction modes according to the prediction cost, and predict each prediction block of the coding block to be processed according to the target prediction mode to obtain a prediction residual.
S807、根据上述预测残差进行编码。S807. Perform encoding according to the foregoing prediction residual.
其中,步骤S806-S807与上述步骤S205-S206的实现方式相同,此处不再赘述。Wherein, steps S806-S807 are implemented in the same manner as the foregoing steps S205-S206, and will not be repeated here.
本实施例提供的视频图像编码方法,通过对视频码流中图像帧的多个通道中的每一个通道进行划分,获得待处理码块,进而,计算待处理编码块在预设划分模式的每一模式下,进行块划分对应的划分代价,确定目标划分模式,并根据目标划分模式对待处理编码块进行块划分,获得预测块,再计算待处理编码块的每一预测块在预设预测模式的每一模式下,进行预测对应的预测代价,从而,确定目标预测模式,并根据目标预测模式对待处理编码块的每一预测块进行预测,其中,由于上述预测模式得到的残差没有负数,所以不需要对符号编码,提高编码速度,而且上述预测模式无需使用相邻像素进行预测,降低数据依赖,不易产生累积误差,解决硬件并行处理困难的问题。The video image encoding method provided by this embodiment obtains the code block to be processed by dividing each of the multiple channels of the image frame in the video code stream, and further, calculates each of the code blocks to be processed in the preset division mode. In the first mode, the division cost corresponding to the block division is determined, the target division mode is determined, and the coding block to be processed is divided into blocks according to the target division mode to obtain the prediction block, and then each prediction block of the coding block to be processed is calculated in the preset prediction mode In each mode, the prediction cost corresponding to the prediction is performed, so that the target prediction mode is determined, and each prediction block of the coding block to be processed is predicted according to the target prediction mode. Since the residuals obtained by the above prediction modes are not negative, Therefore, it is not necessary to encode symbols, which improves the encoding speed, and the above prediction mode does not need to use adjacent pixels for prediction, which reduces data dependence, is not easy to generate cumulative errors, and solves the problem of hardware parallel processing difficulties.
另外,本申请实施例还能够根据预设量化步长对上述预测残差进行量化,以及根据预设编码方式进行编码。图10为本申请实施例提出的又一种视频图像编码方法的流程示意图,本实施例的执行主体可以为图1所示实施例中的编码器。如图10所示,该方法包括:In addition, the embodiment of the present application can also quantize the prediction residual according to a preset quantization step size, and perform coding according to a preset coding method. FIG. 10 is a schematic flowchart of another video image encoding method proposed by an embodiment of this application. The execution subject of this embodiment may be the encoder in the embodiment shown in FIG. 1. As shown in Figure 10, the method includes:
S1001、对视频码流中图像帧的多个通道中的每一个通道进行划分,获得待处理码块。S1001. Divide each of the multiple channels of the image frame in the video code stream to obtain a code block to be processed.
S1002、计算上述待处理编码块在预设划分模式的每一划分模式下, 进行块划分对应的划分代价。S1002: Calculate the division cost corresponding to the block division of the coding block to be processed in each division mode of the preset division mode.
S1003、根据上述划分代价从上述预设划分模式中选择目标划分模式,并根据上述目标划分模式对上述待处理编码块进行块划分,获得预测块。S1003. Select a target division mode from the preset division modes according to the division cost, and perform block division on the coding block to be processed according to the target division mode to obtain a prediction block.
S1004、计算上述待处理编码块的每一预测块在预设预测模式的每一预测模式下,进行预测对应的预测代价。S1004. Calculate the prediction cost corresponding to the prediction of each prediction block of the to-be-processed coding block in each prediction mode of the preset prediction mode.
S1005、根据上述预测代价从上述预设预测模式中选择目标预测模式,并根据上述目标预测模式对上述待处理编码块的每一预测块进行预测,获得预测残差。S1005. Select a target prediction mode from the preset prediction modes according to the prediction cost, and predict each prediction block of the coding block to be processed according to the target prediction mode to obtain a prediction residual.
其中,步骤S1001-S1005与上述步骤S201-S205的实现方式相同,此处不再赘述。Wherein, steps S1001-S1005 are implemented in the same manner as the foregoing steps S201-S205, and will not be repeated here.
S1006、根据预设量化步长对上述预测残差进行量化,获得量化残差。S1006. Quantify the prediction residual according to a preset quantization step size to obtain a quantized residual.
其中,预设量化步长可以根据实际情况设置,例如2。根据预设量化步长对上述预测残差进行量化,获得量化残差,示例性的,qResi[i]=round(resi[i]/Q),qResi[i]表示量化残差,Q表示量化步长,round()是四舍五入的函数。Among them, the preset quantization step size can be set according to actual conditions, such as 2. Quantify the above prediction residuals according to the preset quantization step size to obtain the quantized residuals, for example, qResi[i]=round(resi[i]/Q), qResi[i] represents the quantized residuals, and Q represents quantization Step size, round() is a rounding function.
S1007、根据上述量化残差和预设编码方式,分别对上述多个通道中的每一个通道进行编码,获得输出码流。S1007: According to the above-mentioned quantized residual and the preset coding method, respectively encode each of the above-mentioned multiple channels to obtain an output code stream.
可选地,在上述根据上述量化残差和预设编码方式,分别对上述多个通道中的每一个通道进行编码之前,还包括:Optionally, before the encoding is performed on each of the multiple channels according to the quantized residual and the preset encoding method, the method further includes:
判断上述预测残差是否大于预设阈值;Determine whether the above prediction residual is greater than a preset threshold;
若上述预测残差大于上述预设阈值,则确定上述预设编码方式为VLC编码;If the prediction residual is greater than the preset threshold, it is determined that the preset encoding method is VLC encoding;
若上述预测残差小于或等于上述预设阈值,则确定上述预设编码方式为FLC编码。If the prediction residual is less than or equal to the preset threshold, it is determined that the preset encoding method is FLC encoding.
其中,上述预设阈值根据从FLC编码向VLC编码转化时的残差确定。如果上述预测残差大于上述预设阈值,则采用VLC编码,否则,采用FLC编码。Wherein, the above-mentioned preset threshold is determined according to the residual during the conversion from FLC coding to VLC coding. If the prediction residual is greater than the preset threshold, VLC coding is adopted, otherwise, FLC coding is adopted.
可选地,上述根据上述量化残差和预设编码方式,分别对上述多个通道中的每一个通道进行编码,包括:Optionally, the foregoing encoding each of the foregoing multiple channels separately according to the foregoing quantization residual and a preset encoding manner includes:
根据上述量化残差,采用上述预设编码方式分别编码所述多个通道中 的每一个通道的MSB;Encoding the MSB of each of the multiple channels separately by using the above preset encoding method according to the above-mentioned quantized residual;
在上述多个通道中的每一个通道已编码的比特数达到预设编码码率时,停止编码通道的MSB,When the number of encoded bits in each of the above-mentioned multiple channels reaches the preset encoding bit rate, stop the MSB of the encoding channel,
根据上述量化残差,采用上述预设编码方式分别编码上述多个通道中的每一个通道的LSB;According to the quantized residual, the LSB of each of the multiple channels is separately coded by using the preset coding method;
在上述多个通道中的每一个通道已编码的比特数达到上述预设编码码率时,停止编码通道的LSB。When the number of encoded bits in each of the multiple channels reaches the preset encoding bit rate, the LSB of the encoding channel is stopped.
这里,采用固定码率编码,示例性的,以上述视频码流为YUV420视频格式为例,(1)如果已编码比特总数小于给定码率且可以满足至少一个码字长度的MSB,编码Y分量的MSB,并累加已编码比特数;否则停止编码,转(5);(2)如果已编码比特总数小于给定码率且可以满足至少一个码字长度的MSB,编码U分量的MSB,并累加已编码比特数;否则停止编码,转(5);(3)如果已编码比特总数小于给定码率且可以满足至少一个码字长度的MSB,编码V分量的MSB,并累加已编码比特总数;否则停止编码,转(5);(4)按照MSB编码的顺序,对LSB进行相同方式的编码,直到已编码比特大于给定码率。(5)如果离固定码率仍有几比特且无法继续编码,则进行padding补0;否则直接输出。Here, the fixed bit rate coding is used. For example, taking the above-mentioned video bit stream as the YUV420 video format as an example, (1) If the total number of coded bits is less than the given bit rate and can meet the MSB of at least one codeword length, code Y If the total number of encoded bits is less than the given code rate and can meet the MSB of at least one codeword length, encode the MSB of the U component, And accumulate the number of encoded bits; otherwise, stop encoding and go to (5); (3) If the total number of encoded bits is less than the given code rate and can meet the MSB of at least one codeword length, encode the MSB of the V component, and accumulate the encoded The total number of bits; otherwise, stop encoding and go to (5); (4) In accordance with the order of MSB encoding, encode the LSB in the same manner until the encoded bits are greater than the given code rate. (5) If there are still a few bits away from the fixed bit rate and encoding cannot be continued, padding will be added to 0; otherwise, it will be output directly.
可选地,上述根据上述量化残差,采用上述预设编码方式分别编码上述多个通道中的每一个通道的MSB,包括:Optionally, the foregoing encoding the MSB of each of the foregoing multiple channels separately by using the foregoing preset encoding method according to the foregoing quantized residual includes:
将上述量化残差转换成位平面的方式;The method of converting the above-mentioned quantized residual error into a bit plane;
基于上述位平面的方式,采用上述预设编码方式分别从上述多个通道中的每一个通道的MSB的第一行开始,从左到右每预设比特数作为一个码字进行Huffman查表编码。Based on the above-mentioned bit-plane method, the above-mentioned preset coding method is used to start from the first row of the MSB of each of the above-mentioned multiple channels, and from left to right, each preset number of bits is used as a codeword to perform Huffman look-up table coding. .
这里,还以上述视频码流为YUV420视频格式为例,MSB采用Huffman编码方式,由于概率分布不同,Y和UV分量采用不同的码表,码表如表1。Here, taking the above-mentioned video code stream as the YUV420 video format as an example, the MSB adopts the Huffman coding method. Due to the different probability distributions, different code tables are used for the Y and UV components. The code table is shown in Table 1.
表1 MSB码表Table 1 MSB code table
具体的,将上述量化残差转换成位平面的方式,然后对于MSB部分,先从第一行开始,从左往右每预设比特数,例如每4bit作为一个码字进行Huffman查表编码,编码完第一行继续编码第二行,直到编完所有的MSB或者达到给定码率为止。Specifically, the above-mentioned quantized residual is converted into a bit-plane method, and then for the MSB part, start from the first row, and each preset number of bits from left to right, for example, every 4bit is used as a codeword for Huffman table look-up encoding. After encoding the first line, continue to encode the second line until all MSBs are compiled or the given bit rate is reached.
可选地,上述根据上述量化残差,采用上述预设编码方式分别编码上述多个通道中的每一个通道的LSB,包括:Optionally, the foregoing encoding the LSB of each of the foregoing multiple channels separately using the foregoing preset encoding method according to the foregoing quantization residual includes:
将上述量化残差转换成位平面的方式;The method of converting the above-mentioned quantized residual error into a bit plane;
基于上述位平面的方式,采用上述预设编码方式分别从上述多个通道中的每一个通道的LSB的第一行开始,从左到右逐比特进行编码。Based on the above-mentioned bit-plane method, the above-mentioned preset coding method is used to respectively start from the first line of the LSB of each of the above-mentioned multiple channels, and perform coding bit by bit from left to right.
示例性的,将上述量化残差转换成位平面的方式,然后LSB采用定长编码,从LSB部分的第一行开始,从左往右逐bit进行编码,编完第一行编下一行,直到达到给定的码率为止。Exemplarily, the above-mentioned quantized residual is converted into a bit-plane, and then LSB adopts fixed-length coding, starting from the first line of the LSB part, coding from left to right bit by bit, and after editing the first line, compile the next line. Until the given bit rate is reached.
本实施例提供的视频图像编码方法,通过对视频码流中图像帧的多个通道中的每一个通道进行划分,获得待处理码块,进而,计算待处理编码块在预设划分模式的每一模式下,进行块划分对应的划分代价,确定目标划分模式,并根据目标划分模式对待处理编码块进行块划分,获得预测块,再计算待处理编码块的每一预测块在预设预测模式的每一模式下,进行预测对应的预测代价,从而,确定目标预测模式,并根据目标预测模式对待处理编码块的每一预测块进行预测,根据预设量化步长对预测残差进行量化,获得量化残差,进一步根据量化残差和预设编码方式进行编码,从而获得输出码流,其中,该编码方式能够降低数据依赖性,减小数据误差积累,有利于硬件并行数据处理,减少硬件实现资源,而且无需在量化过程中进行重构,提高编码速度。The video image encoding method provided by this embodiment obtains the code block to be processed by dividing each of the multiple channels of the image frame in the video code stream, and further, calculates each of the code blocks to be processed in the preset division mode. In the first mode, the division cost corresponding to the block division is determined, the target division mode is determined, and the coding block to be processed is divided into blocks according to the target division mode to obtain the prediction block, and then each prediction block of the coding block to be processed is calculated in the preset prediction mode In each mode of, the prediction cost corresponding to the prediction is performed, thereby determining the target prediction mode, and predicting each prediction block of the coding block to be processed according to the target prediction mode, and quantizing the prediction residual according to the preset quantization step size, Obtain the quantized residual, and further encode according to the quantized residual and the preset encoding method to obtain the output code stream. Among them, the encoding method can reduce data dependence and reduce the accumulation of data errors, which is conducive to hardware parallel data processing and reduces hardware Realize resources, and there is no need to reconstruct in the quantization process, which improves the coding speed.
图11为本申请实施例提供的一种视频图像编码设备的结构示意图。为了便于说明,仅示出了与本申请实施例相关的部分。如图11所示,该视频图像编码设备110包括:第一划分模块1101、第一计算模块1102、第二划分模块1103、第二计算模块1104、预测模块1105和编码模块1106。FIG. 11 is a schematic structural diagram of a video image encoding device provided by an embodiment of the application. For ease of description, only the parts related to the embodiments of the present application are shown. As shown in FIG. 11, the video image encoding device 110 includes: a first division module 1101, a first calculation module 1102, a second division module 1103, a second calculation module 1104, a prediction module 1105, and an encoding module 1106.
其中,第一划分模块1101,用于对视频码流中图像帧的多个通道中的每一个通道进行划分,获得待处理码块。Wherein, the first dividing module 1101 is configured to divide each of the multiple channels of the image frame in the video bitstream to obtain the code block to be processed.
第一计算模块1102,用于计算所述待处理编码块在预设划分模式的每 一划分模式下,进行块划分对应的划分代价。The first calculation module 1102 is configured to calculate the division cost corresponding to the block division of the coded block to be processed in each division mode of the preset division mode.
第二划分模块1103,用于根据所述划分代价从所述预设划分模式中选择目标划分模式,并根据所述目标划分模式对所述待处理编码块进行块划分,获得预测块。The second division module 1103 is configured to select a target division mode from the preset division modes according to the division cost, and perform block division on the coding block to be processed according to the target division mode to obtain a prediction block.
第二计算模块1104,用于计算所述待处理编码块的每一预测块在预设预测模式的每一预测模式下,进行预测对应的预测代价。The second calculation module 1104 is configured to calculate the prediction cost corresponding to the prediction of each prediction block of the coded block to be processed in each prediction mode of the preset prediction mode.
预测模块1105,用于根据所述预测代价从所述预设预测模式中选择目标预测模式,并根据所述目标预测模式对所述待处理编码块的每一预测块进行预测,获得预测残差;The prediction module 1105 is configured to select a target prediction mode from the preset prediction modes according to the prediction cost, and predict each prediction block of the coding block to be processed according to the target prediction mode to obtain a prediction residual ;
编码模块1106,用于根据所述预测残差进行编码。The encoding module 1106 is configured to perform encoding according to the prediction residual.
在一种可能的设计中,第一划分模块1101,具体用于:In a possible design, the first division module 1101 is specifically used for:
将所述视频码流中图像帧的多个通道中的每一个通道分别划分为第一预设大小的切片;Dividing each of the multiple channels of the image frame in the video code stream into slices of a first preset size;
分别将划分后每一切片中的通道分量划分为第二预设大小的编码块;Separately dividing the channel components in each slice after division into coding blocks of a second preset size;
从所述编码块中获得所述待处理编码块。Obtain the to-be-processed coding block from the coding block.
在一种可能的设计中,第一计算模块1102,具体用于:In a possible design, the first calculation module 1102 is specifically used for:
在所述每一划分模式下,计算所述待处理编码块的每一预测块在所述每一预测模式下进行预测对应的预测代价;In each of the division modes, calculating the prediction cost corresponding to the prediction of each prediction block of the to-be-processed coding block in each prediction mode;
在所述每一划分模式下,计算所述待处理编码块对应的头信息代价,其中,所述头信息代价包括划分模式对应的编码比特数、预测模式对应的编码比特数和预设基像素对应的编码比特数中至少一个;In each division mode, calculate the header information cost corresponding to the coded block to be processed, where the header information cost includes the number of coded bits corresponding to the division mode, the number of coded bits corresponding to the prediction mode, and the preset base pixels At least one of the corresponding number of coded bits;
将计算的预测代价和所述头信息代价相加,获得所述待处理编码块在所述每一划分模式下进行块划分对应的划分代价。The calculated prediction cost and the header information cost are added to obtain the division cost corresponding to the block division of the to-be-processed coding block in each division mode.
在一种可能的设计中,所述第二划分模块1103根据所述划分代价从所述预设划分模式中选择目标划分模式,包括:In a possible design, the second division module 1103 selects a target division mode from the preset division modes according to the division cost, including:
从所述划分代价中获取最小的划分代价;Obtain the smallest division cost from the division costs;
从所述预设划分模式中选择所述最小的划分代价对应的划分模式,将选择的划分模式作为所述目标划分模式。The division mode corresponding to the smallest division cost is selected from the preset division modes, and the selected division mode is used as the target division mode.
在一种可能的设计中,所述预设预测模式包括第一预测模式,所述第一预测模式为根据所述待处理编码块的预测块中的像素最大值进行预测;In a possible design, the preset prediction mode includes a first prediction mode, and the first prediction mode is prediction based on a maximum value of pixels in a prediction block of the coding block to be processed;
第二计算模块1104,具体用于:The second calculation module 1104 is specifically used for:
根据所述像素最大值与所述待处理编码块的第一剩余预测块的像素,计算第一预测残差,其中,所述第一剩余预测块为所述待处理编码块的预测块中除所述像素最大值的预测块外剩余的预测块;Calculate the first prediction residual based on the maximum value of the pixel and the pixels of the first remaining prediction block of the to-be-processed coding block, where the first remaining prediction block is the prediction block of the to-be-processed coding block divided by Prediction blocks remaining outside the prediction block of the maximum pixel;
若所述第一预测残差大于第一预设残差阈值,则对所述待处理编码块在所述第一预测模式下的预测代价累加第一预设代价值,获得第一预测代价。If the first prediction residual is greater than a first preset residual threshold, then a first preset generation value is added to the prediction cost of the to-be-processed coding block in the first prediction mode to obtain the first prediction cost.
在一种可能的设计中,所述预设预测模式包括第二预测模式,所述第二预测模式为根据所述待处理编码块的预测块中的像素最小值进行预测;In a possible design, the preset prediction mode includes a second prediction mode, and the second prediction mode is to perform prediction according to a minimum value of pixels in a prediction block of the coding block to be processed;
第二计算模块1104,具体用于:The second calculation module 1104 is specifically used for:
根据所述待处理编码块的第二剩余预测块的像素与所述像素最小值,计算第二预测残差,其中,所述第二剩余预测块为所述待处理编码块的预测块中除所述像素最小值的预测块外剩余的预测块;The second prediction residual is calculated according to the pixels of the second remaining prediction block of the to-be-processed coding block and the pixel minimum value, wherein the second remaining prediction block is the prediction block of the to-be-processed coding block divided by Prediction blocks remaining outside the prediction block of the minimum pixel;
若所述第二预测残差大于第二预设残差阈值,则对所述待处理编码块在所述第二预测模式下的预测划分代价累加第二预设代价值,获得第二预测代价。If the second prediction residual is greater than the second preset residual threshold, the second preset generation value is accumulated for the prediction division cost of the code block to be processed in the second prediction mode to obtain the second prediction cost .
在一种可能的设计中,所述预测模块1105根据所述预测代价从所述预设预测模式中选择目标预测模式,包括:In a possible design, the prediction module 1105 selects a target prediction mode from the preset prediction modes according to the prediction cost, including:
从所述预测代价中获取最小的预测代价;Obtain the smallest predicted cost from the predicted cost;
从所述预设预测模式中选择所述最小的预测代价对应的预测模式,将选择的预测模式作为所述目标预测模式。The prediction mode corresponding to the smallest prediction cost is selected from the preset prediction modes, and the selected prediction mode is used as the target prediction mode.
在一种可能的设计中,所述预设划分模式包括不划分;In a possible design, the preset division mode includes no division;
所述第一计算模块1102在所述每一划分模式下,计算所述待处理编码块对应的头信息代价,包括:The first calculation module 1102 calculates the header information cost corresponding to the to-be-processed coding block in each division mode, including:
将所述不划分对应的编码比特数、所述预测模式对应的编码比特数和所述预设基像素对应的编码比特数相加,获得所述待处理编码块对应的第一头信息代价。The number of coded bits corresponding to the non-division, the number of coded bits corresponding to the prediction mode, and the number of coded bits corresponding to the preset base pixels are added to obtain the first header information cost corresponding to the coded block to be processed.
在一种可能的设计中,所述预设划分模式包括水平二分;In a possible design, the preset division mode includes horizontal dichotomy;
所述第一计算模块1102在所述每一划分模式下,计算所述待处理编码块对应的头信息代价,包括:The first calculation module 1102 calculates the header information cost corresponding to the to-be-processed coding block in each division mode, including:
根据所述水平二分和所述预设基像素对应的编码比特数,计算所述待处理编码块对应的总的基像素编码比特数;Calculating the total number of encoding bits of base pixels corresponding to the encoding block to be processed according to the horizontal dichotomy and the number of encoding bits corresponding to the preset base pixels;
将所述水平二分对应的编码比特数、所述预测模式对应的编码比特数和所述待处理编码块对应的总的基像素编码比特数相加,获得所述待处理编码块对应的第二头信息代价。The number of coding bits corresponding to the horizontal dichotomy, the number of coding bits corresponding to the prediction mode, and the total number of base pixel coding bits corresponding to the coding block to be processed are added to obtain the second corresponding to the coding block to be processed Header information cost.
在一种可能的设计中,所述预设划分模式包括竖直二分;In a possible design, the preset division mode includes vertical dichotomy;
所述第一计算模块1102在所述每一划分模式下,计算所述待处理编码块对应的头信息代价,包括:The first calculation module 1102 calculates the header information cost corresponding to the to-be-processed coding block in each division mode, including:
根据所述竖直二分和所述预设基像素对应的编码比特数,计算所述待处理编码块对应的总的基像素编码比特数;Calculating the total number of base pixel encoding bits corresponding to the encoding block to be processed according to the vertical dichotomy and the number of encoding bits corresponding to the preset base pixel;
将所述竖直二分对应的编码比特数、所述预测模式对应的编码比特数和所述待处理编码块对应的总的基像素编码比特数相加,获得所述待处理编码块对应的第三头信息代价。Add the number of coded bits corresponding to the vertical dichotomy, the number of coded bits corresponding to the prediction mode, and the total number of base pixel coded bits corresponding to the coded block to be processed to obtain the first coded bit corresponding to the coded block to be processed Three-head information cost.
在一种可能的设计中,所述预设划分模式包括十字划分;In a possible design, the preset division mode includes cross division;
所述第一计算模块1102在所述每一划分模式下,计算所述待处理编码块对应的头信息代价,包括:The first calculation module 1102 calculates the header information cost corresponding to the to-be-processed coding block in each division mode, including:
根据所述十字划分和所述预设基像素对应的编码比特数,计算所述待处理编码块对应的总的基像素编码比特数;Calculating the total number of encoding bits of base pixels corresponding to the encoding block to be processed according to the cross division and the number of encoding bits corresponding to the preset base pixels;
将所述十字划分对应的编码比特数、所述预测模式对应的编码比特数和所述待处理编码块对应的总的基像素编码比特数相加,获得所述待处理编码块对应的第四头信息代价。The number of coded bits corresponding to the cross division, the number of coded bits corresponding to the prediction mode, and the total number of base pixel coded bits corresponding to the coded block to be processed are added to obtain the fourth coded block corresponding to the coded block to be processed. Header information cost.
在一种可能的设计中,所述编码模块1106根据所述预测残差进行编码,包括:In a possible design, the encoding module 1106 performs encoding according to the prediction residual, including:
根据预设量化步长对所述预测残差进行量化,获得量化残差;Quantize the prediction residual according to a preset quantization step to obtain a quantized residual;
根据所述量化残差和预设编码方式,分别对所述多个通道中的每一个通道进行编码,获得输出码流。According to the quantized residual and the preset encoding method, each channel of the multiple channels is respectively encoded to obtain an output code stream.
在一种可能的设计中,在所述根据所述量化残差和预设编码方式,分别对所述多个通道中的每一个通道进行编码之前,所述编码模块1106还用于:In a possible design, before the encoding of each of the multiple channels according to the quantized residual and the preset encoding mode, the encoding module 1106 is further configured to:
判断所述预测残差是否大于预设阈值;Judging whether the prediction residual is greater than a preset threshold;
若所述预测残差大于所述预设阈值,则确定所述预设编码方式为VLC编码;If the prediction residual is greater than the preset threshold, determining that the preset coding mode is VLC coding;
若所述预测残差小于或等于所述预设阈值,则确定所述预设编码方式为FLC编码。If the prediction residual is less than or equal to the preset threshold, it is determined that the preset coding mode is FLC coding.
在一种可能的设计中,所述编码模块1106根据所述量化残差和预设编码方式,分别对所述多个通道中的每一个通道进行编码,包括:In a possible design, the encoding module 1106 separately encodes each of the multiple channels according to the quantized residual and a preset encoding method, including:
根据所述量化残差,采用所述预设编码方式分别编码所述多个通道中的每一个通道的MSB;According to the quantized residual, respectively encode the MSB of each of the multiple channels by using the preset encoding manner;
在所述多个通道中的每一个通道已编码的比特数达到预设编码码率时,停止编码通道的MSB,When the number of encoded bits in each of the multiple channels reaches the preset encoding bit rate, stop the MSB of the encoding channel,
根据所述量化残差,采用所述预设编码方式分别编码所述多个通道中的每一个通道的LSB;Encoding the LSB of each of the multiple channels separately by using the preset encoding method according to the quantized residual;
在所述多个通道中的每一个通道已编码的比特数达到所述预设编码码率时,停止编码通道的LSB。When the number of encoded bits in each of the multiple channels reaches the preset encoding code rate, stop encoding the LSB of the channel.
在一种可能的设计中,所述编码模块1106根据所述量化残差,采用所述预设编码方式分别编码所述多个通道中的每一个通道的MSB,包括:In a possible design, the encoding module 1106 uses the preset encoding method to encode the MSB of each of the multiple channels separately according to the quantized residual, including:
将所述量化残差转换成位平面的方式;A way of converting the quantized residual into a bit plane;
基于所述位平面的方式,采用所述预设编码方式分别从所述多个通道中的每一个通道的MSB的第一行开始,从左到右每预设比特数作为一个码字进行Huffman查表编码。Based on the bit-plane method, the preset encoding method is used to start from the first row of the MSB of each of the multiple channels, and each preset number of bits from left to right is used as a codeword for Huffman. Look up the table code.
在一种可能的设计中,所述编码模块1106根据所述量化残差,采用所述预设编码方式分别编码所述多个通道中的每一个通道的LSB,包括:In a possible design, the encoding module 1106 uses the preset encoding method to encode the LSB of each of the multiple channels separately according to the quantized residual, including:
将所述量化残差转换成位平面的方式;A way of converting the quantized residual into a bit plane;
基于所述位平面的方式,采用所述预设编码方式分别从所述多个通道中的每一个通道的LSB的第一行开始,从左到右逐比特进行编码。Based on the bit-plane mode, the preset coding mode is used to perform coding from left to right bit by bit starting from the first row of the LSB of each of the multiple channels respectively.
本实施例提供的设备,可用于执行上述方法实施例的技术方案,其实现原理和技术效果类似,本实施例此处不再赘述。The device provided in this embodiment can be used to implement the technical solutions of the foregoing method embodiments, and its implementation principles and technical effects are similar, and will not be repeated here in this embodiment.
图12为本申请实施例提供的视频图像编码设备的硬件结构示意图。如图12所示,本实施例的视频图像编码设备120包括:存储器1201和处理器1202;其中FIG. 12 is a schematic diagram of the hardware structure of a video image encoding device provided by an embodiment of the application. As shown in FIG. 12, the video image encoding device 120 of this embodiment includes: a memory 1201 and a processor 1202; where
存储器1201,用于存储程序指令;The memory 1201 is used to store program instructions;
处理器1202,用于执行存储器存储的程序指令,当所述程序指令被执行时,处理器执行如下步骤:The processor 1202 is configured to execute program instructions stored in the memory, and when the program instructions are executed, the processor executes the following steps:
对视频码流中图像帧的多个通道中的每一个通道进行划分,获得待处理码块;Divide each of the multiple channels of the image frame in the video code stream to obtain the code block to be processed;
计算所述待处理编码块在预设划分模式的每一划分模式下,进行块划分对应的划分代价;Calculating the division cost corresponding to the block division of the coding block to be processed in each division mode of the preset division mode;
根据所述划分代价从所述预设划分模式中选择目标划分模式,并根据所述目标划分模式对所述待处理编码块进行块划分,获得预测块;Selecting a target division mode from the preset division modes according to the division cost, and performing block division on the coding block to be processed according to the target division mode to obtain a prediction block;
计算所述待处理编码块的每一预测块在预设预测模式的每一预测模式下,进行预测对应的预测代价;Calculating the prediction cost corresponding to the prediction of each prediction block of the coding block to be processed in each prediction mode of the preset prediction mode;
根据所述预测代价从所述预设预测模式中选择目标预测模式,并根据所述目标预测模式对所述待处理编码块的每一预测块进行预测,获得预测残差;Selecting a target prediction mode from the preset prediction modes according to the prediction cost, and predicting each prediction block of the coding block to be processed according to the target prediction mode to obtain a prediction residual;
根据所述预测残差进行编码。Encoding is performed according to the prediction residual.
在一种可能的设计中,所述对视频码流中图像帧的多个通道中的每一个通道进行划分,获得待处理码块,包括:In a possible design, the dividing each of the multiple channels of the image frame in the video bitstream to obtain the code block to be processed includes:
将所述视频码流中图像帧的多个通道中的每一个通道分别划分为第一预设大小的切片;Dividing each of the multiple channels of the image frame in the video code stream into slices of a first preset size;
分别将划分后每一切片中的通道分量划分为第二预设大小的编码块;Separately dividing the channel components in each slice after division into coding blocks of a second preset size;
从所述编码块中获得所述待处理编码块。Obtain the to-be-processed coding block from the coding block.
在一种可能的设计中,所述计算所述待处理编码块在预设划分模式的每一划分模式下,进行块划分对应的划分代价,包括:In a possible design, the calculating the division cost corresponding to the block division of the coding block to be processed in each division mode of the preset division mode includes:
在所述每一划分模式下,计算所述待处理编码块的每一预测块在所述每一预测模式下进行预测对应的预测代价;In each of the division modes, calculating the prediction cost corresponding to the prediction of each prediction block of the to-be-processed coding block in each prediction mode;
在所述每一划分模式下,计算所述待处理编码块对应的头信息代价,其中,所述头信息代价包括划分模式对应的编码比特数、预测模式对应的编码比特数和预设基像素对应的编码比特数中至少一个;In each division mode, calculate the header information cost corresponding to the coded block to be processed, where the header information cost includes the number of coded bits corresponding to the division mode, the number of coded bits corresponding to the prediction mode, and the preset base pixels At least one of the corresponding number of coded bits;
将计算的预测代价和所述头信息代价相加,获得所述待处理编码块在所述每一划分模式下进行块划分对应的划分代价。The calculated prediction cost and the header information cost are added to obtain the division cost corresponding to the block division of the to-be-processed coding block in each division mode.
在一种可能的设计中,所述根据所述划分代价从所述预设划分模式中选择目标划分模式,包括:In a possible design, the selecting a target division mode from the preset division modes according to the division cost includes:
从所述划分代价中获取最小的划分代价;Obtain the smallest division cost from the division costs;
从所述预设划分模式中选择所述最小的划分代价对应的划分模式,将选择的划分模式作为所述目标划分模式。The division mode corresponding to the smallest division cost is selected from the preset division modes, and the selected division mode is used as the target division mode.
在一种可能的设计中,所述预设预测模式包括第一预测模式,所述第一预测模式为根据所述待处理编码块的预测块中的像素最大值进行预测;In a possible design, the preset prediction mode includes a first prediction mode, and the first prediction mode is prediction based on a maximum value of pixels in a prediction block of the coding block to be processed;
所述计算所述待处理编码块的每一预测块在预设预测模式的每一预测模式下,进行预测对应的预测代价,包括:The calculation of the prediction cost corresponding to the prediction of each prediction block of the coding block to be processed in each prediction mode of the preset prediction mode includes:
根据所述像素最大值与所述待处理编码块的第一剩余预测块的像素,计算第一预测残差,其中,所述第一剩余预测块为所述待处理编码块的预测块中除所述像素最大值的预测块外剩余的预测块;Calculate the first prediction residual based on the maximum value of the pixel and the pixels of the first remaining prediction block of the to-be-processed coding block, where the first remaining prediction block is the prediction block of the to-be-processed coding block divided by Prediction blocks remaining outside the prediction block of the maximum pixel;
若所述第一预测残差大于第一预设残差阈值,则对所述待处理编码块在所述第一预测模式下的预测代价累加第一预设代价值,获得第一预测代价。If the first prediction residual is greater than a first preset residual threshold, then a first preset generation value is added to the prediction cost of the to-be-processed coding block in the first prediction mode to obtain the first prediction cost.
在一种可能的设计中,所述预设预测模式包括第二预测模式,所述第二预测模式为根据所述待处理编码块的预测块中的像素最小值进行预测;In a possible design, the preset prediction mode includes a second prediction mode, and the second prediction mode is to perform prediction according to a minimum value of pixels in a prediction block of the coding block to be processed;
所述计算所述待处理编码块的每一预测块在预设预测模式的每一预测模式下,进行预测对应的预测代价,包括:The calculation of the prediction cost corresponding to the prediction of each prediction block of the coding block to be processed in each prediction mode of the preset prediction mode includes:
根据所述待处理编码块的第二剩余预测块的像素与所述像素最小值,计算第二预测残差,其中,所述第二剩余预测块为所述待处理编码块的预测块中除所述像素最小值的预测块外剩余的预测块;The second prediction residual is calculated according to the pixels of the second remaining prediction block of the to-be-processed coding block and the pixel minimum value, wherein the second remaining prediction block is the prediction block of the to-be-processed coding block divided by Prediction blocks remaining outside the prediction block of the minimum pixel;
若所述第二预测残差大于第二预设残差阈值,则对所述待处理编码块在所述第二预测模式下的预测划分代价累加第二预设代价值,获得第二预测代价。If the second prediction residual is greater than the second preset residual threshold, the second preset generation value is accumulated for the prediction division cost of the code block to be processed in the second prediction mode to obtain the second prediction cost .
在一种可能的设计中,所述根据所述预测代价从所述预设预测模式中选择目标预测模式,包括:In a possible design, the selecting a target prediction mode from the preset prediction modes according to the prediction cost includes:
从所述预测代价中获取最小的预测代价;Obtain the smallest predicted cost from the predicted cost;
从所述预设预测模式中选择所述最小的预测代价对应的预测模式,将选择的预测模式作为所述目标预测模式。The prediction mode corresponding to the smallest prediction cost is selected from the preset prediction modes, and the selected prediction mode is used as the target prediction mode.
在一种可能的设计中,所述预设划分模式包括不划分;In a possible design, the preset division mode includes no division;
所述在所述每一划分模式下,计算所述待处理编码块对应的头信息代价,包括:The calculating the header information cost corresponding to the coding block to be processed in each of the division modes includes:
将所述不划分对应的编码比特数、所述预测模式对应的编码比特数和所述预设基像素对应的编码比特数相加,获得所述待处理编码块对应的第一头信息代价。The number of coded bits corresponding to the non-division, the number of coded bits corresponding to the prediction mode, and the number of coded bits corresponding to the preset base pixels are added to obtain the first header information cost corresponding to the coded block to be processed.
在一种可能的设计中,所述预设划分模式包括水平二分;In a possible design, the preset division mode includes horizontal dichotomy;
所述在所述每一划分模式下,计算所述待处理编码块对应的头信息代价,包括:The calculating the header information cost corresponding to the coding block to be processed in each of the division modes includes:
根据所述水平二分和所述预设基像素对应的编码比特数,计算所述待处理编码块对应的总的基像素编码比特数;Calculating the total number of encoding bits of base pixels corresponding to the encoding block to be processed according to the horizontal dichotomy and the number of encoding bits corresponding to the preset base pixels;
将所述水平二分对应的编码比特数、所述预测模式对应的编码比特数和所述待处理编码块对应的总的基像素编码比特数相加,获得所述待处理编码块对应的第二头信息代价。The number of coding bits corresponding to the horizontal dichotomy, the number of coding bits corresponding to the prediction mode, and the total number of base pixel coding bits corresponding to the coding block to be processed are added to obtain the second corresponding to the coding block to be processed Header information cost.
在一种可能的设计中,所述预设划分模式包括竖直二分;In a possible design, the preset division mode includes vertical dichotomy;
所述在所述每一划分模式下,计算所述待处理编码块对应的头信息代价,包括:The calculating the header information cost corresponding to the coding block to be processed in each of the division modes includes:
根据所述竖直二分和所述预设基像素对应的编码比特数,计算所述待处理编码块对应的总的基像素编码比特数;Calculating the total number of base pixel encoding bits corresponding to the encoding block to be processed according to the vertical dichotomy and the number of encoding bits corresponding to the preset base pixel;
将所述竖直二分对应的编码比特数、所述预测模式对应的编码比特数和所述待处理编码块对应的总的基像素编码比特数相加,获得所述待处理编码块对应的第三头信息代价。Add the number of coded bits corresponding to the vertical dichotomy, the number of coded bits corresponding to the prediction mode, and the total number of base pixel coded bits corresponding to the coded block to be processed to obtain the first coded bit corresponding to the coded block to be processed Three-head information cost.
在一种可能的设计中,所述预设划分模式包括十字划分;In a possible design, the preset division mode includes cross division;
所述在所述每一划分模式下,计算所述待处理编码块对应的头信息代价,包括:The calculating the header information cost corresponding to the coding block to be processed in each of the division modes includes:
根据所述十字划分和所述预设基像素对应的编码比特数,计算所述待处理编码块对应的总的基像素编码比特数;Calculating the total number of encoding bits of base pixels corresponding to the encoding block to be processed according to the cross division and the number of encoding bits corresponding to the preset base pixels;
将所述十字划分对应的编码比特数、所述预测模式对应的编码比特数和所述待处理编码块对应的总的基像素编码比特数相加,获得所述待处理编码块对应的第四头信息代价。The number of coded bits corresponding to the cross division, the number of coded bits corresponding to the prediction mode, and the total number of base pixel coded bits corresponding to the coded block to be processed are added to obtain the fourth coded block corresponding to the coded block to be processed. Header information cost.
在一种可能的设计中,所述根据所述预测残差进行编码,包括:In a possible design, the encoding according to the prediction residual includes:
根据预设量化步长对所述预测残差进行量化,获得量化残差;Quantize the prediction residual according to a preset quantization step to obtain a quantized residual;
根据所述量化残差和预设编码方式,分别对所述多个通道中的每一个通道进行编码,获得输出码流。According to the quantized residual and the preset encoding method, each channel of the multiple channels is respectively encoded to obtain an output code stream.
在一种可能的设计中,在所述根据所述量化残差和预设编码方式,分别对所述多个通道中的每一个通道进行编码之前,还包括:In a possible design, before the encoding each of the multiple channels separately according to the quantized residual and the preset encoding mode, the method further includes:
判断所述预测残差是否大于预设阈值;Judging whether the prediction residual is greater than a preset threshold;
若所述预测残差大于所述预设阈值,则确定所述预设编码方式为VLC编码;If the prediction residual is greater than the preset threshold, determining that the preset coding mode is VLC coding;
若所述预测残差小于或等于所述预设阈值,则确定所述预设编码方式为FLC编码。If the prediction residual is less than or equal to the preset threshold, it is determined that the preset coding mode is FLC coding.
在一种可能的设计中,所述根据所述量化残差和预设编码方式,分别对所述多个通道中的每一个通道进行编码,包括:In a possible design, the separately encoding each of the multiple channels according to the quantized residual and a preset encoding manner includes:
根据所述量化残差,采用所述预设编码方式分别编码所述多个通道中的每一个通道的MSB;According to the quantized residual, respectively encode the MSB of each of the multiple channels by using the preset encoding manner;
在所述多个通道中的每一个通道已编码的比特数达到预设编码码率时,停止编码通道的MSB,When the number of encoded bits in each of the multiple channels reaches the preset encoding bit rate, stop the MSB of the encoding channel,
根据所述量化残差,采用所述预设编码方式分别编码所述多个通道中的每一个通道的LSB;Encoding the LSB of each of the multiple channels separately by using the preset encoding method according to the quantized residual;
在所述多个通道中的每一个通道已编码的比特数达到所述预设编码码率时,停止编码通道的LSB。When the number of encoded bits in each of the multiple channels reaches the preset encoding code rate, stop encoding the LSB of the channel.
在一种可能的设计中,所述根据所述量化残差,采用所述预设编码方式分别编码所述多个通道中的每一个通道的MSB,包括:In a possible design, the respectively encoding the MSB of each of the multiple channels by using the preset encoding method according to the quantized residual includes:
将所述量化残差转换成位平面的方式;A way of converting the quantized residual into a bit plane;
基于所述位平面的方式,采用所述预设编码方式分别从所述多个通道中的每一个通道的MSB的第一行开始,从左到右每预设比特数作为一个码字进行Huffman查表编码。Based on the bit-plane method, the preset encoding method is used to start from the first row of the MSB of each of the multiple channels, and each preset number of bits from left to right is used as a codeword for Huffman. Look up the table code.
在一种可能的设计中,所述根据所述量化残差,采用所述预设编码方式分别编码所述多个通道中的每一个通道的LSB,包括:In a possible design, the step of separately encoding the LSB of each of the multiple channels according to the quantized residual using the preset encoding manner includes:
将所述量化残差转换成位平面的方式;A way of converting the quantized residual into a bit plane;
基于所述位平面的方式,采用所述预设编码方式分别从所述多个通道中的每一个通道的LSB的第一行开始,从左到右逐比特进行编码。Based on the bit-plane mode, the preset coding mode is used to perform coding from left to right bit by bit starting from the first row of the LSB of each of the multiple channels respectively.
在一种可能的设计中,存储器1201既可以是独立的,也可以跟处理器1202集成在一起。In a possible design, the memory 1201 may be independent or integrated with the processor 1202.
当存储器1201独立设置时,该视频图像编码设备还包括总线1203,用于连接所述存储器1201和处理器1202。When the memory 1201 is independently provided, the video image encoding device further includes a bus 1203 for connecting the memory 1201 and the processor 1202.
在一种可能的设计中,视频图像编码***120可以是一个单独的设备,该***包括上述存储器1201、处理器1202等一整套。也可以分布式布置在某设备上,具体可以根据实际情况确定。In a possible design, the video image encoding system 120 may be a single device, and the system includes a complete set of the foregoing memory 1201, processor 1202, and so on. It can also be distributed on a certain device, which can be determined according to the actual situation.
图13为本申请实施例提供的一种可移动平台的结构示意图。如图13所示,本实施例的可移动平台130包括:可移动平台本体1301,以及视频图像编码设备1302;所述视频图像编码设备1302设置在所述可移动平台本体1301,所述可移动平台本体1301和所述视频图像编码设备1302无线连接或有线连接。FIG. 13 is a schematic structural diagram of a movable platform provided by an embodiment of the application. As shown in FIG. 13, the movable platform 130 of this embodiment includes: a movable platform body 1301, and a video image encoding device 1302; the video image encoding device 1302 is provided on the movable platform body 1301, and the movable platform body 1301 The platform body 1301 and the video image encoding device 1302 are connected wirelessly or wiredly.
所述视频图像编码设备1302对视频码流中图像帧的多个通道中的每一个通道进行划分,获得待处理码块;The video image encoding device 1302 divides each of the multiple channels of the image frame in the video code stream to obtain a code block to be processed;
计算所述待处理编码块在预设划分模式的每一划分模式下,进行块划分对应的划分代价;Calculating the division cost corresponding to the block division of the coding block to be processed in each division mode of the preset division mode;
根据所述划分代价从所述预设划分模式中选择目标划分模式,并根据所述目标划分模式对所述待处理编码块进行块划分,获得预测块;Selecting a target division mode from the preset division modes according to the division cost, and performing block division on the coding block to be processed according to the target division mode to obtain a prediction block;
计算所述待处理编码块的每一预测块在预设预测模式的每一预测模式下,进行预测对应的预测代价;Calculating the prediction cost corresponding to the prediction of each prediction block of the coding block to be processed in each prediction mode of the preset prediction mode;
根据所述预测代价从所述预设预测模式中选择目标预测模式,并根据所述目标预测模式对所述待处理编码块的每一预测块进行预测,获得预测残差;Selecting a target prediction mode from the preset prediction modes according to the prediction cost, and predicting each prediction block of the coding block to be processed according to the target prediction mode to obtain a prediction residual;
根据所述预测残差进行编码。Encoding is performed according to the prediction residual.
在一种可能的设计中,所述对视频码流中图像帧的多个通道中的每一个通道进行划分,获得待处理码块,包括:In a possible design, the dividing each of the multiple channels of the image frame in the video bitstream to obtain the code block to be processed includes:
将所述视频码流中图像帧的多个通道中的每一个通道分别划分为第一预设大小的切片;Dividing each of the multiple channels of the image frame in the video code stream into slices of a first preset size;
分别将划分后每一切片中的通道分量划分为第二预设大小的编码块;Separately dividing the channel components in each slice after division into coding blocks of a second preset size;
从所述编码块中获得所述待处理编码块。Obtain the to-be-processed coding block from the coding block.
在一种可能的设计中,所述计算所述待处理编码块在预设划分模式的每一划分模式下,进行块划分对应的划分代价,包括:In a possible design, the calculation of the division cost corresponding to the block division of the coding block to be processed in each division mode of the preset division mode includes:
在所述每一划分模式下,计算所述待处理编码块的每一预测块在所述每一预测模式下进行预测对应的预测代价;In each of the division modes, calculating the prediction cost corresponding to the prediction of each prediction block of the to-be-processed coding block in each prediction mode;
在所述每一划分模式下,计算所述待处理编码块对应的头信息代价,其中,所述头信息代价包括划分模式对应的编码比特数、预测模式对应的编码比特数和预设基像素对应的编码比特数中至少一个;In each division mode, calculate the header information cost corresponding to the coded block to be processed, where the header information cost includes the number of coded bits corresponding to the division mode, the number of coded bits corresponding to the prediction mode, and the preset base pixels At least one of the corresponding number of coded bits;
将计算的预测代价和所述头信息代价相加,获得所述待处理编码块在所述每一划分模式下进行块划分对应的划分代价。The calculated prediction cost and the header information cost are added to obtain the division cost corresponding to the block division of the to-be-processed coding block in each division mode.
在一种可能的设计中,所述根据所述划分代价从所述预设划分模式中选择目标划分模式,包括:In a possible design, the selecting a target division mode from the preset division modes according to the division cost includes:
从所述划分代价中获取最小的划分代价;Obtain the smallest division cost from the division costs;
从所述预设划分模式中选择所述最小的划分代价对应的划分模式,将选择的划分模式作为所述目标划分模式。The division mode corresponding to the smallest division cost is selected from the preset division modes, and the selected division mode is used as the target division mode.
在一种可能的设计中,所述预设预测模式包括第一预测模式,所述第一预测模式为根据所述待处理编码块的预测块中的像素最大值进行预测;In a possible design, the preset prediction mode includes a first prediction mode, and the first prediction mode is prediction based on a maximum value of pixels in a prediction block of the coding block to be processed;
所述计算所述待处理编码块的每一预测块在预设预测模式的每一预测模式下,进行预测对应的预测代价,包括:The calculation of the prediction cost corresponding to the prediction of each prediction block of the coding block to be processed in each prediction mode of the preset prediction mode includes:
根据所述像素最大值与所述待处理编码块的第一剩余预测块的像素,计算第一预测残差,其中,所述第一剩余预测块为所述待处理编码块的预测块中除所述像素最大值的预测块外剩余的预测块;Calculate the first prediction residual based on the maximum value of the pixel and the pixels of the first remaining prediction block of the to-be-processed coding block, where the first remaining prediction block is the prediction block of the to-be-processed coding block divided by Prediction blocks remaining outside the prediction block of the maximum pixel;
若所述第一预测残差大于第一预设残差阈值,则对所述待处理编码块在所述第一预测模式下的预测代价累加第一预设代价值,获得第一预测代价。If the first prediction residual is greater than a first preset residual threshold, then a first preset generation value is added to the prediction cost of the to-be-processed coding block in the first prediction mode to obtain the first prediction cost.
在一种可能的设计中,所述预设预测模式包括第二预测模式,所述第二预测模式为根据所述待处理编码块的预测块中的像素最小值进行预测;In a possible design, the preset prediction mode includes a second prediction mode, and the second prediction mode is to perform prediction according to a minimum value of pixels in a prediction block of the coding block to be processed;
所述计算所述待处理编码块的每一预测块在预设预测模式的每一预测模式下,进行预测对应的预测代价,包括:The calculation of the prediction cost corresponding to the prediction of each prediction block of the coding block to be processed in each prediction mode of the preset prediction mode includes:
根据所述待处理编码块的第二剩余预测块的像素与所述像素最小值,计算第二预测残差,其中,所述第二剩余预测块为所述待处理编码块的预测块中除所述像素最小值的预测块外剩余的预测块;The second prediction residual is calculated according to the pixels of the second remaining prediction block of the to-be-processed coding block and the pixel minimum value, wherein the second remaining prediction block is the prediction block of the to-be-processed coding block divided by Prediction blocks remaining outside the prediction block of the minimum pixel;
若所述第二预测残差大于第二预设残差阈值,则对所述待处理编码块在所述第二预测模式下的预测划分代价累加第二预设代价值,获得第二预测代价。If the second prediction residual is greater than the second preset residual threshold, the second preset generation value is accumulated for the prediction division cost of the code block to be processed in the second prediction mode to obtain the second prediction cost .
在一种可能的设计中,所述根据所述预测代价从所述预设预测模式中选择目标预测模式,包括:In a possible design, the selecting a target prediction mode from the preset prediction modes according to the prediction cost includes:
从所述预测代价中获取最小的预测代价;Obtain the smallest predicted cost from the predicted cost;
从所述预设预测模式中选择所述最小的预测代价对应的预测模式,将选择的预测模式作为所述目标预测模式。The prediction mode corresponding to the smallest prediction cost is selected from the preset prediction modes, and the selected prediction mode is used as the target prediction mode.
在一种可能的设计中,所述预设划分模式包括不划分;In a possible design, the preset division mode includes no division;
所述在所述每一划分模式下,计算所述待处理编码块对应的头信息代价,包括:The calculating the header information cost corresponding to the coding block to be processed in each of the division modes includes:
将所述不划分对应的编码比特数、所述预测模式对应的编码比特数和所述预设基像素对应的编码比特数相加,获得所述待处理编码块对应的第一头信息代价。The number of coded bits corresponding to the non-division, the number of coded bits corresponding to the prediction mode, and the number of coded bits corresponding to the preset base pixels are added to obtain the first header information cost corresponding to the coded block to be processed.
在一种可能的设计中,所述预设划分模式包括水平二分;In a possible design, the preset division mode includes horizontal dichotomy;
所述在所述每一划分模式下,计算所述待处理编码块对应的头信息代价,包括:The calculating the header information cost corresponding to the coding block to be processed in each of the division modes includes:
根据所述水平二分和所述预设基像素对应的编码比特数,计算所述待处理编码块对应的总的基像素编码比特数;Calculating the total number of encoding bits of base pixels corresponding to the encoding block to be processed according to the horizontal dichotomy and the number of encoding bits corresponding to the preset base pixels;
将所述水平二分对应的编码比特数、所述预测模式对应的编码比特数和所述待处理编码块对应的总的基像素编码比特数相加,获得所述待处理编码块对应的第二头信息代价。The number of coding bits corresponding to the horizontal dichotomy, the number of coding bits corresponding to the prediction mode, and the total number of base pixel coding bits corresponding to the coding block to be processed are added to obtain the second corresponding to the coding block to be processed Header information cost.
在一种可能的设计中,所述预设划分模式包括竖直二分;In a possible design, the preset division mode includes vertical dichotomy;
所述在所述每一划分模式下,计算所述待处理编码块对应的头信息代价,包括:The calculating the header information cost corresponding to the coding block to be processed in each of the division modes includes:
根据所述竖直二分和所述预设基像素对应的编码比特数,计算所述待处理编码块对应的总的基像素编码比特数;Calculating the total number of base pixel encoding bits corresponding to the encoding block to be processed according to the vertical dichotomy and the number of encoding bits corresponding to the preset base pixel;
将所述竖直二分对应的编码比特数、所述预测模式对应的编码比特数和所述待处理编码块对应的总的基像素编码比特数相加,获得所述待处理编码块对应的第三头信息代价。Add the number of coded bits corresponding to the vertical dichotomy, the number of coded bits corresponding to the prediction mode, and the total number of base pixel coded bits corresponding to the coded block to be processed to obtain the first coded bit corresponding to the coded block to be processed Three-head information cost.
在一种可能的设计中,所述预设划分模式包括十字划分;In a possible design, the preset division mode includes cross division;
所述在所述每一划分模式下,计算所述待处理编码块对应的头信息代价,包括:The calculating the header information cost corresponding to the coding block to be processed in each of the division modes includes:
根据所述十字划分和所述预设基像素对应的编码比特数,计算所述待处理编码块对应的总的基像素编码比特数;Calculating the total number of encoding bits of base pixels corresponding to the encoding block to be processed according to the cross division and the number of encoding bits corresponding to the preset base pixels;
将所述十字划分对应的编码比特数、所述预测模式对应的编码比特数和所述待处理编码块对应的总的基像素编码比特数相加,获得所述待处理编码块对应的第四头信息代价。The number of coded bits corresponding to the cross division, the number of coded bits corresponding to the prediction mode, and the total number of base pixel coded bits corresponding to the coded block to be processed are added to obtain the fourth coded block corresponding to the coded block to be processed. Header information cost.
在一种可能的设计中,所述根据所述预测残差进行编码,包括:In a possible design, the encoding according to the prediction residual includes:
根据预设量化步长对所述预测残差进行量化,获得量化残差;Quantize the prediction residual according to a preset quantization step to obtain a quantized residual;
根据所述量化残差和预设编码方式,分别对所述多个通道中的每一个通道进行编码,获得输出码流。According to the quantized residual and the preset encoding method, each channel of the multiple channels is respectively encoded to obtain an output code stream.
在一种可能的设计中,在所述根据所述量化残差和预设编码方式,分别对所述多个通道中的每一个通道进行编码之前,还包括:In a possible design, before the encoding each of the multiple channels separately according to the quantized residual and the preset encoding mode, the method further includes:
判断所述预测残差是否大于预设阈值;Judging whether the prediction residual is greater than a preset threshold;
若所述预测残差大于所述预设阈值,则确定所述预设编码方式为VLC编码;If the prediction residual is greater than the preset threshold, determining that the preset coding mode is VLC coding;
若所述预测残差小于或等于所述预设阈值,则确定所述预设编码方式为FLC编码。If the prediction residual is less than or equal to the preset threshold, it is determined that the preset coding mode is FLC coding.
在一种可能的设计中,所述根据所述量化残差和预设编码方式,分别对所述多个通道中的每一个通道进行编码,包括:In a possible design, the separately encoding each of the multiple channels according to the quantized residual and a preset encoding manner includes:
根据所述量化残差,采用所述预设编码方式分别编码所述多个通道中的每一个通道的MSB;According to the quantized residual, respectively encode the MSB of each of the multiple channels by using the preset encoding manner;
在所述多个通道中的每一个通道已编码的比特数达到预设编码码率时,停止编码通道的MSB,When the number of encoded bits in each of the multiple channels reaches the preset encoding bit rate, stop the MSB of the encoding channel,
根据所述量化残差,采用所述预设编码方式分别编码所述多个通道中的每一个通道的LSB;Encoding the LSB of each of the multiple channels separately by using the preset encoding method according to the quantized residual;
在所述多个通道中的每一个通道已编码的比特数达到所述预设编码码率时,停止编码通道的LSB。When the number of encoded bits in each of the multiple channels reaches the preset encoding code rate, stop encoding the LSB of the channel.
在一种可能的设计中,所述根据所述量化残差,采用所述预设编码方式分别编码所述多个通道中的每一个通道的MSB,包括:In a possible design, the respectively encoding the MSB of each of the multiple channels by using the preset encoding method according to the quantized residual includes:
将所述量化残差转换成位平面的方式;A way of converting the quantized residual into a bit plane;
基于所述位平面的方式,采用所述预设编码方式分别从所述多个通道中的每一个通道的MSB的第一行开始,从左到右每预设比特数作为一个码字进行Huffman查表编码。Based on the bit-plane method, the preset encoding method is used to start from the first row of the MSB of each of the multiple channels, and each preset number of bits from left to right is used as a codeword for Huffman. Look up the table code.
在一种可能的设计中,所述根据所述量化残差,采用所述预设编码方式分别编码所述多个通道中的每一个通道的LSB,包括:In a possible design, the step of separately encoding the LSB of each of the multiple channels according to the quantized residual using the preset encoding manner includes:
将所述量化残差转换成位平面的方式;A way of converting the quantized residual into a bit plane;
基于所述位平面的方式,采用所述预设编码方式分别从所述多个通道中的每一个通道的LSB的第一行开始,从左到右逐比特进行编码。Based on the bit-plane mode, the preset coding mode is used to perform coding from left to right bit by bit starting from the first row of the LSB of each of the multiple channels respectively.
本实施例提供的可移动平台,包括:可移动平台本体,以及视频图像编码设备,视频图像编码设备设置在可移动平台本体,其中,视频图像编码设备通过对视频码流中图像帧的多个通道中的每一个通道进行划分,获得待处理码块,进而,计算待处理编码块在预设划分模式的每一模式下,进行块划分对应的划分代价,确定目标划分模式,并根据目标划分模式对待处理编码块进行块划分,获得预测块,再计算待处理编码块的每一预测块在预设预测模式的每一模式下,进行预测对应的预测代价,从而,确定目标预测模式,并根据目标预测模式对待处理编码块的每一预测块进行预测,能够降低数据依赖性,减小数据误差积累,有利于硬件并行数据处理,减少硬件实现资源,而且无需在量化过程中进行重构,提高编码速度。The movable platform provided by this embodiment includes: a movable platform body, and a video image encoding device. The video image encoding device is set on the movable platform body, wherein the video image encoding device performs multiple Each channel in the channel is divided to obtain the code block to be processed, and then the division cost corresponding to the block division of the code block to be processed in each mode of the preset division mode is calculated, the target division mode is determined, and the target division mode is determined. The mode performs block division on the coding block to be processed to obtain the prediction block, and then calculates the prediction cost corresponding to the prediction of each prediction block of the coding block to be processed in each mode of the preset prediction mode, thereby determining the target prediction mode, and Predicting each prediction block of the coding block to be processed according to the target prediction mode can reduce data dependence and reduce the accumulation of data errors, which is conducive to hardware parallel data processing, reduces hardware implementation resources, and does not require reconstruction in the quantization process. Improve encoding speed.
本申请实施例提供一种计算机可读存储介质,所述计算机可读存储介质中存储有程序指令,当处理器执行所述程序指令时,实现如上所述的视频图像编码方法。An embodiment of the present application provides a computer-readable storage medium having program instructions stored in the computer-readable storage medium, and when a processor executes the program instructions, the video image encoding method described above is implemented.
在本发明所提供的几个实施例中,应该理解到,所揭露的设备和方法,可以通过其它的方式实现。例如,以上所描述的设备实施例仅仅是示意性的,例如,所述模块的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个模块可以结合或者可以集成到另一个***, 或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或模块的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided by the present invention, it should be understood that the disclosed device and method may be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the modules is only a logical function division, and there may be other divisions in actual implementation, for example, multiple modules can be combined or integrated. To another system, or some features can be ignored or not implemented. In addition, the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or modules, and may be in electrical, mechanical or other forms.
所述作为分离部件说明的模块可以是或者也可以不是物理上分开的,作为模块显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。The modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
另外,在本发明各个实施例中的各功能模块可以集成在一个处理单元中,也可以是各个模块单独物理存在,也可以两个或两个以上模块集成在一个单元中。上述模块成的单元既可以采用硬件的形式实现,也可以采用硬件加软件功能单元的形式实现。In addition, the functional modules in the various embodiments of the present invention may be integrated into one processing unit, or each module may exist alone physically, or two or more modules may be integrated into one unit. The units formed by the above-mentioned modules can be implemented in the form of hardware, or in the form of hardware plus software functional units.
上述以软件功能模块的形式实现的集成的模块,可以存储在一个计算机可读取存储介质中。上述软件功能模块存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或处理器(英文:processor)执行本申请各个实施例所述方法的部分步骤。The above-mentioned integrated modules implemented in the form of software functional modules may be stored in a computer readable storage medium. The above-mentioned software function module is stored in a storage medium and includes a number of instructions to make a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor (English: processor) execute the various embodiments of the present application Part of the method.
应理解,上述处理器可以是中央处理单元(Central Processing Unit,简称CPU),还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,简称DSP)、专用集成电路(Application Specific Integrated Circuit,简称ASIC)等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合发明所公开的方法的步骤可以直接体现为硬件处理器执行完成,或者用处理器中的硬件及软件模块组合执行完成。It should be understood that the foregoing processor may be a central processing unit (Central Processing Unit, CPU for short), or other general-purpose processors, digital signal processors (Digital Signal Processor, DSP), and application specific integrated circuits (Application Specific Integrated Circuits). Referred to as ASIC) and so on. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor or the like. The steps of the method disclosed in combination with the invention may be directly embodied as being executed and completed by a hardware processor, or executed and completed by a combination of hardware and software modules in the processor.
存储器可能包含高速RAM存储器,也可能还包括非易失性存储NVM,例如至少一个磁盘存储器,还可以为U盘、移动硬盘、只读存储器、磁盘或光盘等。The memory may include a high-speed RAM memory, or may also include a non-volatile storage NVM, such as at least one disk storage, and may also be a U disk, a mobile hard disk, a read-only memory, a magnetic disk, or an optical disk.
总线可以是工业标准体系结构(Industry Standard Architecture,简称ISA)总线、外部设备互连(Peripheral Component,简称PCI)总线或扩展工业标准体系结构(Extended Industry Standard Architecture,简称EISA)总线等。总线可以分为地址总线、数据总线、控制总线等。为便于表示,本申请附图中的总线并不限定仅有一根总线或一种类型的总线。The bus may be an Industry Standard Architecture (ISA) bus, Peripheral Component (PCI) bus, or Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into address bus, data bus, control bus and so on. For ease of representation, the buses in the drawings of this application are not limited to only one bus or one type of bus.
上述存储介质可以是由任何类型的易失性或非易失性存储设备或者它们的组合实现,如静态随机存取存储器(SRAM),电可擦除可编程只读存储器(EEPROM),可擦除可编程只读存储器(EPROM),可编程只读存储器(PROM),只读存储器(ROM),磁存储器,快闪存储器,磁盘或光盘。存储介质可以是通用或专用计算机能够存取的任何可用介质。The above-mentioned storage medium can be realized by any type of volatile or non-volatile storage device or their combination, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable Except for programmable read only memory (EPROM), programmable read only memory (PROM), read only memory (ROM), magnetic memory, flash memory, magnetic disks or optical disks. The storage medium may be any available medium that can be accessed by a general-purpose or special-purpose computer.
一种示例性的存储介质耦合至处理器,从而使处理器能够从该存储介质读取信息,且可向该存储介质写入信息。当然,存储介质也可以是处理器的组成部分。处理器和存储介质可以位于专用集成电路(Application Specific Integrated Circuits,简称ASIC)中。当然,处理器和存储介质也可以作为分立组件存在于电子设备或主控设备中。An exemplary storage medium is coupled to the processor, so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium may also be an integral part of the processor. The processor and the storage medium may be located in Application Specific Integrated Circuits (ASIC for short). Of course, the processor and the storage medium may also exist as discrete components in the electronic device or the main control device.
本领域普通技术人员可以理解:实现上述各方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成。前述的程序可以存储于一计算机可读取存储介质中。该程序在执行时,执行包括上述各方法实施例的步骤;而前述的存储介质包括:ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。A person of ordinary skill in the art can understand that all or part of the steps in the foregoing method embodiments can be implemented by a program instructing relevant hardware. The aforementioned program can be stored in a computer readable storage medium. When the program is executed, it executes the steps including the foregoing method embodiments; and the foregoing storage medium includes: ROM, RAM, magnetic disk, or optical disk and other media that can store program codes.
最后应说明的是:以上各实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述各实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的范围。Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: The technical solutions recorded in the foregoing embodiments can still be modified, or some or all of the technical features can be equivalently replaced; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the technical solutions of the embodiments of the present invention. Scope.
Claims (34)
- 一种视频图像编码方法,其特征在于,包括:A video image coding method, characterized in that it comprises:对视频码流中图像帧的多个通道中的每一个通道进行划分,获得待处理码块;Divide each of the multiple channels of the image frame in the video code stream to obtain the code block to be processed;计算所述待处理编码块在预设划分模式的每一划分模式下,进行块划分对应的划分代价;Calculating the division cost corresponding to the block division of the coding block to be processed in each division mode of the preset division mode;根据所述划分代价从所述预设划分模式中选择目标划分模式,并根据所述目标划分模式对所述待处理编码块进行块划分,获得预测块;Selecting a target division mode from the preset division modes according to the division cost, and performing block division on the coding block to be processed according to the target division mode to obtain a prediction block;计算所述待处理编码块的每一预测块在预设预测模式的每一预测模式下,进行预测对应的预测代价;Calculating the prediction cost corresponding to the prediction of each prediction block of the coding block to be processed in each prediction mode of the preset prediction mode;根据所述预测代价从所述预设预测模式中选择目标预测模式,并根据所述目标预测模式对所述待处理编码块的每一预测块进行预测,获得预测残差;Selecting a target prediction mode from the preset prediction modes according to the prediction cost, and predicting each prediction block of the coding block to be processed according to the target prediction mode to obtain a prediction residual;根据所述预测残差进行编码。Encoding is performed according to the prediction residual.
- 根据权利要求1所述的方法,其特征在于,所述对视频码流中图像帧的多个通道中的每一个通道进行划分,获得待处理码块,包括:The method according to claim 1, wherein the dividing each of the multiple channels of the image frame in the video code stream to obtain the code block to be processed comprises:将所述视频码流中图像帧的多个通道中的每一个通道分别划分为第一预设大小的切片;Dividing each of the multiple channels of the image frame in the video code stream into slices of a first preset size;分别将划分后每一切片中的通道分量划分为第二预设大小的编码块;Separately dividing the channel components in each slice after division into coding blocks of a second preset size;从所述编码块中获得所述待处理编码块。Obtain the to-be-processed coding block from the coding block.
- 根据权利要求1或2所述的方法,其特征在于,所述计算所述待处理编码块在预设划分模式的每一划分模式下,进行块划分对应的划分代价,包括:The method according to claim 1 or 2, wherein the calculating the division cost corresponding to the block division of the coded block to be processed in each division mode of the preset division mode comprises:在所述每一划分模式下,计算所述待处理编码块的每一预测块在所述每一预测模式下进行预测对应的预测代价;In each of the division modes, calculating the prediction cost corresponding to the prediction of each prediction block of the to-be-processed coding block in each prediction mode;在所述每一划分模式下,计算所述待处理编码块对应的头信息代价,其中,所述头信息代价包括划分模式对应的编码比特数、预测模式对应的编码比特数和预设基像素对应的编码比特数中至少一个;In each division mode, calculate the header information cost corresponding to the coded block to be processed, where the header information cost includes the number of coded bits corresponding to the division mode, the number of coded bits corresponding to the prediction mode, and the preset base pixels At least one of the corresponding number of coded bits;将计算的预测代价和所述头信息代价相加,获得所述待处理编码块在所述每一划分模式下进行块划分对应的划分代价。The calculated prediction cost and the header information cost are added to obtain the division cost corresponding to the block division of the to-be-processed coding block in each division mode.
- 根据权利要求1所述的方法,其特征在于,所述根据所述划分代价从所述预设划分模式中选择目标划分模式,包括:The method according to claim 1, wherein the selecting a target division mode from the preset division modes according to the division cost comprises:从所述划分代价中获取最小的划分代价;Obtain the smallest division cost from the division costs;从所述预设划分模式中选择所述最小的划分代价对应的划分模式,将选择的划分模式作为所述目标划分模式。The division mode corresponding to the smallest division cost is selected from the preset division modes, and the selected division mode is used as the target division mode.
- 根据权利要求1至4中任一项所述的方法,其特征在于,所述预设预测模式包括第一预测模式,所述第一预测模式为根据所述待处理编码块的预测块中的像素最大值进行预测;The method according to any one of claims 1 to 4, wherein the preset prediction mode comprises a first prediction mode, and the first prediction mode is based on a prediction block of the to-be-processed coding block Pixel maximum value for prediction;所述计算所述待处理编码块的每一预测块在预设预测模式的每一预测模式下,进行预测对应的预测代价,包括:The calculation of the prediction cost corresponding to the prediction of each prediction block of the coding block to be processed in each prediction mode of the preset prediction mode includes:根据所述像素最大值与所述待处理编码块的第一剩余预测块的像素,计算第一预测残差,其中,所述第一剩余预测块为所述待处理编码块的预测块中除所述像素最大值的预测块外剩余的预测块;Calculate the first prediction residual based on the maximum value of the pixel and the pixels of the first remaining prediction block of the to-be-processed coding block, where the first remaining prediction block is the prediction block of the to-be-processed coding block divided by Prediction blocks remaining outside the prediction block of the maximum pixel;若所述第一预测残差大于第一预设残差阈值,则对所述待处理编码块在所述第一预测模式下的预测代价累加第一预设代价值,获得第一预测代价。If the first prediction residual is greater than a first preset residual threshold, then a first preset generation value is added to the prediction cost of the to-be-processed coding block in the first prediction mode to obtain the first prediction cost.
- 根据权利要求1至4中任一项所述的方法,其特征在于,所述预设预测模式包括第二预测模式,所述第二预测模式为根据所述待处理编码块的预测块中的像素最小值进行预测;The method according to any one of claims 1 to 4, wherein the preset prediction mode comprises a second prediction mode, and the second prediction mode is based on a prediction block of the to-be-processed coding block Pixel minimum value for prediction;所述计算所述待处理编码块的每一预测块在预设预测模式的每一预测模式下,进行预测对应的预测代价,包括:The calculation of the prediction cost corresponding to the prediction of each prediction block of the coding block to be processed in each prediction mode of the preset prediction mode includes:根据所述待处理编码块的第二剩余预测块的像素与所述像素最小值,计算第二预测残差,其中,所述第二剩余预测块为所述待处理编码块的预测块中除所述像素最小值的预测块外剩余的预测块;The second prediction residual is calculated according to the pixels of the second remaining prediction block of the to-be-processed coding block and the pixel minimum value, wherein the second remaining prediction block is the prediction block of the to-be-processed coding block divided by Prediction blocks remaining outside the prediction block of the minimum pixel;若所述第二预测残差大于第二预设残差阈值,则对所述待处理编码块在所述第二预测模式下的预测划分代价累加第二预设代价值,获得第二预测代价。If the second prediction residual is greater than the second preset residual threshold, the second preset generation value is accumulated for the prediction division cost of the code block to be processed in the second prediction mode to obtain the second prediction cost .
- 根据权利要求1所述的方法,其特征在于,所述根据所述预测代价从所述预设预测模式中选择目标预测模式,包括:The method according to claim 1, wherein the selecting a target prediction mode from the preset prediction modes according to the prediction cost comprises:从所述预测代价中获取最小的预测代价;Obtain the smallest predicted cost from the predicted cost;从所述预设预测模式中选择所述最小的预测代价对应的预测模式,将选择的预测模式作为所述目标预测模式。The prediction mode corresponding to the smallest prediction cost is selected from the preset prediction modes, and the selected prediction mode is used as the target prediction mode.
- 根据权利要求3所述的方法,其特征在于,所述预设划分模式包括不划分;The method according to claim 3, wherein the preset division mode includes no division;所述在所述每一划分模式下,计算所述待处理编码块对应的头信息代价,包括:The calculating the header information cost corresponding to the coding block to be processed in each of the division modes includes:将所述不划分对应的编码比特数、所述预测模式对应的编码比特数和所述预设基像素对应的编码比特数相加,获得所述待处理编码块对应的第一头信息代价。The number of coded bits corresponding to the non-division, the number of coded bits corresponding to the prediction mode, and the number of coded bits corresponding to the preset base pixels are added to obtain the first header information cost corresponding to the coded block to be processed.
- 根据权利要求3所述的方法,其特征在于,所述预设划分模式包括水平二分;The method according to claim 3, wherein the preset division mode includes horizontal dichotomy;所述在所述每一划分模式下,计算所述待处理编码块对应的头信息代价,包括:The calculating the header information cost corresponding to the coding block to be processed in each of the division modes includes:根据所述水平二分和所述预设基像素对应的编码比特数,计算所述待处理编码块对应的总的基像素编码比特数;Calculating the total number of encoding bits of base pixels corresponding to the encoding block to be processed according to the horizontal dichotomy and the number of encoding bits corresponding to the preset base pixels;将所述水平二分对应的编码比特数、所述预测模式对应的编码比特数和所述待处理编码块对应的总的基像素编码比特数相加,获得所述待处理编码块对应的第二头信息代价。The number of coding bits corresponding to the horizontal dichotomy, the number of coding bits corresponding to the prediction mode, and the total number of base pixel coding bits corresponding to the coding block to be processed are added to obtain the second corresponding to the coding block to be processed Header information cost.
- 根据权利要求3所述的方法,其特征在于,所述预设划分模式包括竖直二分;The method according to claim 3, wherein the preset division mode includes vertical dichotomy;所述在所述每一划分模式下,计算所述待处理编码块对应的头信息代价,包括:The calculating the header information cost corresponding to the coding block to be processed in each of the division modes includes:根据所述竖直二分和所述预设基像素对应的编码比特数,计算所述待处理编码块对应的总的基像素编码比特数;Calculating the total number of base pixel encoding bits corresponding to the encoding block to be processed according to the vertical dichotomy and the number of encoding bits corresponding to the preset base pixel;将所述竖直二分对应的编码比特数、所述预测模式对应的编码比特数和所述待处理编码块对应的总的基像素编码比特数相加,获得所述待处理编码块对应的第三头信息代价。Add the number of coded bits corresponding to the vertical dichotomy, the number of coded bits corresponding to the prediction mode, and the total number of base pixel coded bits corresponding to the coded block to be processed to obtain the first coded bit corresponding to the coded block to be processed Three-head information cost.
- 根据权利要求3所述的方法,其特征在于,所述预设划分模式包括十字划分;The method according to claim 3, wherein the preset division mode includes cross division;所述在所述每一划分模式下,计算所述待处理编码块对应的头信息代 价,包括:The calculating the header information cost corresponding to the coding block to be processed in each of the division modes includes:根据所述十字划分和所述预设基像素对应的编码比特数,计算所述待处理编码块对应的总的基像素编码比特数;Calculating the total number of encoding bits of base pixels corresponding to the encoding block to be processed according to the cross division and the number of encoding bits corresponding to the preset base pixels;将所述十字划分对应的编码比特数、所述预测模式对应的编码比特数和所述待处理编码块对应的总的基像素编码比特数相加,获得所述待处理编码块对应的第四头信息代价。The number of coded bits corresponding to the cross division, the number of coded bits corresponding to the prediction mode, and the total number of base pixel coded bits corresponding to the coded block to be processed are added to obtain the fourth coded block corresponding to the coded block to be processed. Header information cost.
- 根据权利要求1所述的方法,其特征在于,所述根据所述预测残差进行编码,包括:The method according to claim 1, wherein the encoding according to the prediction residual comprises:根据预设量化步长对所述预测残差进行量化,获得量化残差;Quantize the prediction residual according to a preset quantization step to obtain a quantized residual;根据所述量化残差和预设编码方式,分别对所述多个通道中的每一个通道进行编码,获得输出码流。According to the quantized residual and the preset encoding method, each channel of the multiple channels is respectively encoded to obtain an output code stream.
- 根据权利要求12所述的方法,其特征在于,在所述根据所述量化残差和预设编码方式,分别对所述多个通道中的每一个通道进行编码之前,还包括:The method according to claim 12, characterized in that, before said separately encoding each of the multiple channels according to the quantized residual and a preset encoding method, the method further comprises:判断所述预测残差是否大于预设阈值;Judging whether the prediction residual is greater than a preset threshold;若所述预测残差大于所述预设阈值,则确定所述预设编码方式为VLC编码;If the prediction residual is greater than the preset threshold, determining that the preset coding mode is VLC coding;若所述预测残差小于或等于所述预设阈值,则确定所述预设编码方式为FLC编码。If the prediction residual is less than or equal to the preset threshold, it is determined that the preset coding mode is FLC coding.
- 根据权利要求12或13所述的方法,其特征在于,所述根据所述量化残差和预设编码方式,分别对所述多个通道中的每一个通道进行编码,包括:The method according to claim 12 or 13, wherein the separately encoding each of the multiple channels according to the quantized residual and a preset encoding method comprises:根据所述量化残差,采用所述预设编码方式分别编码所述多个通道中的每一个通道的MSB;According to the quantized residual, respectively encode the MSB of each of the multiple channels by using the preset encoding manner;在所述多个通道中的每一个通道已编码的比特数达到预设编码码率时,停止编码通道的MSB,When the number of encoded bits in each of the multiple channels reaches the preset encoding bit rate, stop the MSB of the encoding channel,根据所述量化残差,采用所述预设编码方式分别编码所述多个通道中的每一个通道的LSB;Encoding the LSB of each of the multiple channels separately by using the preset encoding method according to the quantized residual;在所述多个通道中的每一个通道已编码的比特数达到所述预设编码码率时,停止编码通道的LSB。When the number of encoded bits in each of the multiple channels reaches the preset encoding code rate, stop encoding the LSB of the channel.
- 根据权利要求14所述的方法,其特征在于,所述根据所述量化残差,采用所述预设编码方式分别编码所述多个通道中的每一个通道的MSB,包括:14. The method according to claim 14, wherein the step of separately encoding the MSB of each of the multiple channels according to the quantized residual using the preset encoding method comprises:将所述量化残差转换成位平面的方式;A way of converting the quantized residual into a bit plane;基于所述位平面的方式,采用所述预设编码方式分别从所述多个通道中的每一个通道的MSB的第一行开始,从左到右每预设比特数作为一个码字进行Huffman查表编码。Based on the bit-plane method, the preset encoding method is used to start from the first row of the MSB of each of the multiple channels, and each preset number of bits from left to right is used as a codeword for Huffman. Look up the table code.
- 根据权利要求14所述的方法,其特征在于,所述根据所述量化残差,采用所述预设编码方式分别编码所述多个通道中的每一个通道的LSB,包括:The method according to claim 14, wherein the encoding the LSB of each of the multiple channels by using the preset encoding method according to the quantized residual comprises:将所述量化残差转换成位平面的方式;A way of converting the quantized residual into a bit plane;基于所述位平面的方式,采用所述预设编码方式分别从所述多个通道中的每一个通道的LSB的第一行开始,从左到右逐比特进行编码。Based on the bit-plane mode, the preset coding mode is used to perform coding from left to right bit by bit starting from the first row of the LSB of each of the multiple channels respectively.
- 一种视频图像编码设备,其特征在于,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机执行指令,所述处理器执行所述计算机执行指令时实现如下步骤:A video image encoding device, which is characterized by comprising a memory, a processor, and computer-executable instructions stored in the memory and running on the processor. When the processor executes the computer-executable instructions, the following is achieved step:对视频码流中图像帧的多个通道中的每一个通道进行划分,获得待处理码块;Divide each of the multiple channels of the image frame in the video code stream to obtain the code block to be processed;计算所述待处理编码块在预设划分模式的每一划分模式下,进行块划分对应的划分代价;Calculating the division cost corresponding to the block division of the coding block to be processed in each division mode of the preset division mode;根据所述划分代价从所述预设划分模式中选择目标划分模式,并根据所述目标划分模式对所述待处理编码块进行块划分,获得预测块;Selecting a target division mode from the preset division modes according to the division cost, and performing block division on the coding block to be processed according to the target division mode to obtain a prediction block;计算所述待处理编码块的每一预测块在预设预测模式的每一预测模式下,进行预测对应的预测代价;Calculating the prediction cost corresponding to the prediction of each prediction block of the coding block to be processed in each prediction mode of the preset prediction mode;根据所述预测代价从所述预设预测模式中选择目标预测模式,并根据所述目标预测模式对所述待处理编码块的每一预测块进行预测,获得预测残差;Selecting a target prediction mode from the preset prediction modes according to the prediction cost, and predicting each prediction block of the coding block to be processed according to the target prediction mode to obtain a prediction residual;根据所述预测残差进行编码。Encoding is performed according to the prediction residual.
- 根据权利要求17所述的设备,其特征在于,所述对视频码流中图像帧的多个通道中的每一个通道进行划分,获得待处理码块,包括:The device according to claim 17, wherein the dividing each of the multiple channels of the image frame in the video code stream to obtain the code block to be processed comprises:将所述视频码流中图像帧的多个通道中的每一个通道分别划分为第一预设大小的切片;Dividing each of the multiple channels of the image frame in the video code stream into slices of a first preset size;分别将划分后每一切片中的通道分量划分为第二预设大小的编码块;Separately dividing the channel components in each slice after division into coding blocks of a second preset size;从所述编码块中获得所述待处理编码块。Obtain the to-be-processed coding block from the coding block.
- 根据权利要求17或18所述的设备,其特征在于,所述计算所述待处理编码块在预设划分模式的每一划分模式下,进行块划分对应的划分代价,包括:The device according to claim 17 or 18, wherein the calculating the division cost corresponding to the block division of the coded block to be processed in each division mode of the preset division mode comprises:在所述每一划分模式下,计算所述待处理编码块的每一预测块在所述每一预测模式下进行预测对应的预测代价;In each of the division modes, calculating the prediction cost corresponding to the prediction of each prediction block of the to-be-processed coding block in each prediction mode;在所述每一划分模式下,计算所述待处理编码块对应的头信息代价,其中,所述头信息代价包括划分模式对应的编码比特数、预测模式对应的编码比特数和预设基像素对应的编码比特数中至少一个;In each division mode, calculate the header information cost corresponding to the coded block to be processed, where the header information cost includes the number of coded bits corresponding to the division mode, the number of coded bits corresponding to the prediction mode, and the preset base pixels At least one of the corresponding number of coded bits;将计算的预测代价和所述头信息代价相加,获得所述待处理编码块在所述每一划分模式下进行块划分对应的划分代价。The calculated prediction cost and the header information cost are added to obtain the division cost corresponding to the block division of the to-be-processed coding block in each division mode.
- 根据权利要求17所述的设备,其特征在于,所述根据所述划分代价从所述预设划分模式中选择目标划分模式,包括:The device according to claim 17, wherein the selecting a target division mode from the preset division modes according to the division cost comprises:从所述划分代价中获取最小的划分代价;Obtain the smallest division cost from the division costs;从所述预设划分模式中选择所述最小的划分代价对应的划分模式,将选择的划分模式作为所述目标划分模式。The division mode corresponding to the smallest division cost is selected from the preset division modes, and the selected division mode is used as the target division mode.
- 根据权利要求17至20中任一项所述的设备,其特征在于,所述预设预测模式包括第一预测模式,所述第一预测模式为根据所述待处理编码块的预测块中的像素最大值进行预测;The device according to any one of claims 17 to 20, wherein the preset prediction mode comprises a first prediction mode, and the first prediction mode is based on a prediction block of the to-be-processed coding block Pixel maximum value for prediction;所述计算所述待处理编码块的每一预测块在预设预测模式的每一预测模式下,进行预测对应的预测代价,包括:The calculation of the prediction cost corresponding to the prediction of each prediction block of the coding block to be processed in each prediction mode of the preset prediction mode includes:根据所述像素最大值与所述待处理编码块的第一剩余预测块的像素,计算第一预测残差,其中,所述第一剩余预测块为所述待处理编码块的预测块中除所述像素最大值的预测块外剩余的预测块;Calculate the first prediction residual based on the maximum value of the pixel and the pixels of the first remaining prediction block of the to-be-processed coding block, where the first remaining prediction block is the prediction block of the to-be-processed coding block divided by Prediction blocks remaining outside the prediction block of the maximum pixel;若所述第一预测残差大于第一预设残差阈值,则对所述待处理编码块在所述第一预测模式下的预测代价累加第一预设代价值,获得第一预测代价。If the first prediction residual is greater than a first preset residual threshold, then a first preset generation value is added to the prediction cost of the to-be-processed coding block in the first prediction mode to obtain the first prediction cost.
- 根据权利要求17至20中任一项所述的设备,其特征在于,所述预设预测模式包括第二预测模式,所述第二预测模式为根据所述待处理编码块的预测块中的像素最小值进行预测;The device according to any one of claims 17 to 20, wherein the preset prediction mode comprises a second prediction mode, and the second prediction mode is based on a prediction block of the to-be-processed coding block Pixel minimum value for prediction;所述计算所述待处理编码块的每一预测块在预设预测模式的每一预测模式下,进行预测对应的预测代价,包括:The calculation of the prediction cost corresponding to the prediction of each prediction block of the coding block to be processed in each prediction mode of the preset prediction mode includes:根据所述待处理编码块的第二剩余预测块的像素与所述像素最小值,计算第二预测残差,其中,所述第二剩余预测块为所述待处理编码块的预测块中除所述像素最小值的预测块外剩余的预测块;The second prediction residual is calculated according to the pixels of the second remaining prediction block of the to-be-processed coding block and the pixel minimum value, wherein the second remaining prediction block is the prediction block of the to-be-processed coding block divided by Prediction blocks remaining outside the prediction block of the minimum pixel;若所述第二预测残差大于第二预设残差阈值,则对所述待处理编码块在所述第二预测模式下的预测划分代价累加第二预设代价值,获得第二预测代价。If the second prediction residual is greater than the second preset residual threshold, the second preset generation value is accumulated for the prediction division cost of the code block to be processed in the second prediction mode to obtain the second prediction cost .
- 根据权利要求17所述的设备,其特征在于,所述根据所述预测代价从所述预设预测模式中选择目标预测模式,包括:The device according to claim 17, wherein the selecting a target prediction mode from the preset prediction modes according to the prediction cost comprises:从所述预测代价中获取最小的预测代价;Obtain the smallest predicted cost from the predicted cost;从所述预设预测模式中选择所述最小的预测代价对应的预测模式,将选择的预测模式作为所述目标预测模式。The prediction mode corresponding to the smallest prediction cost is selected from the preset prediction modes, and the selected prediction mode is used as the target prediction mode.
- 根据权利要求19所述的设备,其特征在于,所述预设划分模式包括不划分;The device according to claim 19, wherein the preset division mode includes no division;所述在所述每一划分模式下,计算所述待处理编码块对应的头信息代价,包括:The calculating the header information cost corresponding to the coding block to be processed in each of the division modes includes:将所述不划分对应的编码比特数、所述预测模式对应的编码比特数和所述预设基像素对应的编码比特数相加,获得所述待处理编码块对应的第一头信息代价。The number of coded bits corresponding to the non-division, the number of coded bits corresponding to the prediction mode, and the number of coded bits corresponding to the preset base pixels are added to obtain the first header information cost corresponding to the coded block to be processed.
- 根据权利要求19所述的设备,其特征在于,所述预设划分模式包括水平二分;The device according to claim 19, wherein the preset division mode comprises horizontal dichotomy;所述在所述每一划分模式下,计算所述待处理编码块对应的头信息代价,包括:The calculating the header information cost corresponding to the coding block to be processed in each of the division modes includes:根据所述水平二分和所述预设基像素对应的编码比特数,计算所述待处理编码块对应的总的基像素编码比特数;Calculating the total number of encoding bits of base pixels corresponding to the encoding block to be processed according to the horizontal dichotomy and the number of encoding bits corresponding to the preset base pixels;将所述水平二分对应的编码比特数、所述预测模式对应的编码比特数 和所述待处理编码块对应的总的基像素编码比特数相加,获得所述待处理编码块对应的第二头信息代价。The number of coding bits corresponding to the horizontal dichotomy, the number of coding bits corresponding to the prediction mode, and the total number of base pixel coding bits corresponding to the coding block to be processed are added to obtain the second corresponding to the coding block to be processed. Header information cost.
- 根据权利要求19所述的设备,其特征在于,所述预设划分模式包括竖直二分;The device according to claim 19, wherein the preset division mode includes vertical dichotomy;所述在所述每一划分模式下,计算所述待处理编码块对应的头信息代价,包括:The calculating the header information cost corresponding to the coding block to be processed in each of the division modes includes:根据所述竖直二分和所述预设基像素对应的编码比特数,计算所述待处理编码块对应的总的基像素编码比特数;Calculating the total number of base pixel encoding bits corresponding to the encoding block to be processed according to the vertical dichotomy and the number of encoding bits corresponding to the preset base pixel;将所述竖直二分对应的编码比特数、所述预测模式对应的编码比特数和所述待处理编码块对应的总的基像素编码比特数相加,获得所述待处理编码块对应的第三头信息代价。Add the number of coded bits corresponding to the vertical dichotomy, the number of coded bits corresponding to the prediction mode, and the total number of base pixel coded bits corresponding to the coded block to be processed to obtain the first coded bit corresponding to the coded block to be processed Three-head information cost.
- 根据权利要求19所述的设备,其特征在于,所述预设划分模式包括十字划分;The device according to claim 19, wherein the preset division mode comprises a cross division;所述在所述每一划分模式下,计算所述待处理编码块对应的头信息代价,包括:The calculating the header information cost corresponding to the coding block to be processed in each of the division modes includes:根据所述十字划分和所述预设基像素对应的编码比特数,计算所述待处理编码块对应的总的基像素编码比特数;Calculating the total number of encoding bits of base pixels corresponding to the encoding block to be processed according to the cross division and the number of encoding bits corresponding to the preset base pixels;将所述十字划分对应的编码比特数、所述预测模式对应的编码比特数和所述待处理编码块对应的总的基像素编码比特数相加,获得所述待处理编码块对应的第四头信息代价。The number of coded bits corresponding to the cross division, the number of coded bits corresponding to the prediction mode, and the total number of base pixel coded bits corresponding to the coded block to be processed are added to obtain the fourth coded block corresponding to the coded block to be processed. Header information cost.
- 根据权利要求17所述的设备,其特征在于,所述根据所述预测残差进行编码,包括:The device according to claim 17, wherein the encoding according to the prediction residual comprises:根据预设量化步长对所述预测残差进行量化,获得量化残差;Quantize the prediction residual according to a preset quantization step to obtain a quantized residual;根据所述量化残差和预设编码方式,分别对所述多个通道中的每一个通道进行编码,获得输出码流。According to the quantized residual and the preset encoding method, each channel of the multiple channels is respectively encoded to obtain an output code stream.
- 根据权利要求28所述的设备,其特征在于,在所述根据所述量化残差和预设编码方式,分别对所述多个通道中的每一个通道进行编码之前,还包括:The device according to claim 28, characterized in that, before said separately encoding each of said multiple channels according to said quantized residual and a preset encoding method, the method further comprises:判断所述预测残差是否大于预设阈值;Judging whether the prediction residual is greater than a preset threshold;若所述预测残差大于所述预设阈值,则确定所述预设编码方式为VLC 编码;If the prediction residual is greater than the preset threshold, determining that the preset coding mode is VLC coding;若所述预测残差小于或等于所述预设阈值,则确定所述预设编码方式为FLC编码。If the prediction residual is less than or equal to the preset threshold, it is determined that the preset coding mode is FLC coding.
- 根据权利要求28或29所述的设备,其特征在于,所述根据所述量化残差和预设编码方式,分别对所述多个通道中的每一个通道进行编码,包括:The device according to claim 28 or 29, wherein the separately encoding each of the multiple channels according to the quantized residual and a preset encoding method comprises:根据所述量化残差,采用所述预设编码方式分别编码所述多个通道中的每一个通道的MSB;According to the quantized residual, respectively encode the MSB of each of the multiple channels by using the preset encoding manner;在所述多个通道中的每一个通道已编码的比特数达到预设编码码率时,停止编码通道的MSB,When the number of encoded bits in each of the multiple channels reaches the preset encoding bit rate, stop the MSB of the encoding channel,根据所述量化残差,采用所述预设编码方式分别编码所述多个通道中的每一个通道的LSB;Encoding the LSB of each of the multiple channels separately by using the preset encoding method according to the quantized residual;在所述多个通道中的每一个通道已编码的比特数达到所述预设编码码率时,停止编码通道的LSB。When the number of encoded bits in each of the multiple channels reaches the preset encoding code rate, stop encoding the LSB of the channel.
- 根据权利要求30所述的设备,其特征在于,所述根据所述量化残差,采用所述预设编码方式分别编码所述多个通道中的每一个通道的MSB,包括:The device according to claim 30, wherein the encoding the MSB of each of the multiple channels by using the preset encoding method according to the quantized residual comprises:将所述量化残差转换成位平面的方式;A way of converting the quantized residual into a bit plane;基于所述位平面的方式,采用所述预设编码方式分别从所述多个通道中的每一个通道的MSB的第一行开始,从左到右每预设比特数作为一个码字进行Huffman查表编码。Based on the bit-plane method, the preset encoding method is used to start from the first row of the MSB of each of the multiple channels, and each preset number of bits from left to right is used as a codeword for Huffman. Look up the table code.
- 根据权利要求30所述的设备,其特征在于,所述根据所述量化残差,采用所述预设编码方式分别编码所述多个通道中的每一个通道的LSB,包括:The device according to claim 30, wherein the encoding the LSB of each of the multiple channels by using the preset encoding method according to the quantized residual comprises:将所述量化残差转换成位平面的方式;A way of converting the quantized residual into a bit plane;基于所述位平面的方式,采用所述预设编码方式分别从所述多个通道中的每一个通道的LSB的第一行开始,从左到右逐比特进行编码。Based on the bit-plane mode, the preset coding mode is used to perform coding from left to right bit by bit starting from the first row of the LSB of each of the multiple channels respectively.
- 一种可移动平台,其特征在于,包括:A movable platform, characterized in that it comprises:可移动平台本体;以及The movable platform body; and权利要求17~32任一项所述的视频图像编码设备,所述视频图像编码 设备安装于所述可移动平台本体。The video image encoding device according to any one of claims 17 to 32, wherein the video image encoding device is installed on the movable platform body.
- 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中存储有计算机执行指令,当处理器执行所述计算机执行指令时,实现如权利要求1至16任一项所述的视频图像编码方法。A computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when the processor executes the computer-executable instructions, the computer-readable Video image coding method.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
PCT/CN2020/076469 WO2021168624A1 (en) | 2020-02-24 | 2020-02-24 | Video image coding method and device, and movable platform |
CN202080002903.7A CN112204971A (en) | 2020-02-24 | 2020-02-24 | Video image coding method and device and movable platform |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
PCT/CN2020/076469 WO2021168624A1 (en) | 2020-02-24 | 2020-02-24 | Video image coding method and device, and movable platform |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2021168624A1 true WO2021168624A1 (en) | 2021-09-02 |
Family
ID=74033870
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2020/076469 WO2021168624A1 (en) | 2020-02-24 | 2020-02-24 | Video image coding method and device, and movable platform |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN112204971A (en) |
WO (1) | WO2021168624A1 (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116156174A (en) * | 2023-02-23 | 2023-05-23 | 格兰菲智能科技有限公司 | Data encoding processing method, device, computer equipment and storage medium |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20090274211A1 (en) * | 2008-04-30 | 2009-11-05 | Omnivision Technologies, Inc. | Apparatus and method for high quality intra mode prediction in a video coder |
CN103327328A (en) * | 2007-06-28 | 2013-09-25 | 三菱电机株式会社 | Image encoding device and image decoding device |
CN105791863A (en) * | 2016-03-24 | 2016-07-20 | 西安电子科技大学 | Layer-based 3D-HEVC depth map intra-prediction coding method |
CN106162176A (en) * | 2016-10-09 | 2016-11-23 | 北京数码视讯科技股份有限公司 | Method for choosing frame inner forecast mode and device |
CN109302613A (en) * | 2018-10-26 | 2019-02-01 | 西安科锐盛创新科技有限公司 | Based on the prediction technique of macroblock partition in bandwidth reduction |
CN110213581A (en) * | 2019-05-20 | 2019-09-06 | 广州市数字视频编解码技术国家工程实验室研究开发与产业化中心 | A kind of coding method skipped based on block partition mode, device and storage medium |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20190014325A1 (en) * | 2017-07-05 | 2019-01-10 | Industrial Technology Research Institute | Video encoding method, video decoding method, video encoder and video decoder |
-
2020
- 2020-02-24 CN CN202080002903.7A patent/CN112204971A/en active Pending
- 2020-02-24 WO PCT/CN2020/076469 patent/WO2021168624A1/en active Application Filing
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103327328A (en) * | 2007-06-28 | 2013-09-25 | 三菱电机株式会社 | Image encoding device and image decoding device |
US20090274211A1 (en) * | 2008-04-30 | 2009-11-05 | Omnivision Technologies, Inc. | Apparatus and method for high quality intra mode prediction in a video coder |
CN105791863A (en) * | 2016-03-24 | 2016-07-20 | 西安电子科技大学 | Layer-based 3D-HEVC depth map intra-prediction coding method |
CN106162176A (en) * | 2016-10-09 | 2016-11-23 | 北京数码视讯科技股份有限公司 | Method for choosing frame inner forecast mode and device |
CN109302613A (en) * | 2018-10-26 | 2019-02-01 | 西安科锐盛创新科技有限公司 | Based on the prediction technique of macroblock partition in bandwidth reduction |
CN110213581A (en) * | 2019-05-20 | 2019-09-06 | 广州市数字视频编解码技术国家工程实验室研究开发与产业化中心 | A kind of coding method skipped based on block partition mode, device and storage medium |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116156174A (en) * | 2023-02-23 | 2023-05-23 | 格兰菲智能科技有限公司 | Data encoding processing method, device, computer equipment and storage medium |
CN116156174B (en) * | 2023-02-23 | 2024-02-13 | 格兰菲智能科技有限公司 | Data encoding processing method, device, computer equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN112204971A (en) | 2021-01-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11936884B2 (en) | Coded-block-flag coding and derivation | |
WO2018184468A1 (en) | Image file processing method, device and storage medium | |
KR102120571B1 (en) | Entropy coding techniques for display stream compression (DSC) of non-4:4:4 chroma sub-sampling | |
WO2018184457A1 (en) | Image file processing method as well as equipment and system thereof | |
US11558631B2 (en) | Super-resolution loop restoration | |
US10136147B2 (en) | Efficient transcoding for backward-compatible wide dynamic range codec | |
WO2019210822A1 (en) | Video encoding and decoding method, device, and system, and storage medium | |
CN110169068B (en) | DC coefficient sign coding scheme | |
WO2020119449A1 (en) | Chroma block prediction method and device | |
WO2020103800A1 (en) | Video decoding method and video decoder | |
US8526745B2 (en) | Embedded graphics coding: reordered bitstream for parallel decoding | |
US10382767B2 (en) | Video coding using frame rotation | |
WO2023040600A1 (en) | Image encoding method and apparatus, image decoding method and apparatus, electronic device, and medium | |
CN111741302B (en) | Data processing method and device, computer readable medium and electronic equipment | |
WO2018184465A1 (en) | Image file processing method, apparatus, and storage medium | |
KR102185027B1 (en) | Apparatus and method for vector-based entropy coding for display stream compression | |
WO2011031592A2 (en) | Bitstream syntax for graphics-mode compression in wireless hd 1.1 | |
US20210337189A1 (en) | Prediction mode determining method and apparatus | |
CN111246208B (en) | Video processing method and device and electronic equipment | |
WO2021168624A1 (en) | Video image coding method and device, and movable platform | |
WO2021147464A1 (en) | Video processing method and apparatus, and electronic device | |
US8355057B2 (en) | Joint scalar embedded graphics coding for color images | |
CN114125448B (en) | Video coding method, decoding method and related devices | |
US10609411B1 (en) | Cross color prediction for image/video compression | |
US11870993B2 (en) | Transforms for large video and image blocks |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 20921747 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 20921747 Country of ref document: EP Kind code of ref document: A1 |